summaryrefslogtreecommitdiff
path: root/vm/mterp/c/OP_THROW.c
diff options
context:
space:
mode:
Diffstat (limited to 'vm/mterp/c/OP_THROW.c')
-rw-r--r--vm/mterp/c/OP_THROW.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/vm/mterp/c/OP_THROW.c b/vm/mterp/c/OP_THROW.c
new file mode 100644
index 0000000..0dcaced
--- /dev/null
+++ b/vm/mterp/c/OP_THROW.c
@@ -0,0 +1,24 @@
+HANDLE_OPCODE(OP_THROW /*vAA*/)
+ {
+ Object* obj;
+
+ /*
+ * We don't create an exception here, but the process of searching
+ * for a catch block can do class lookups and throw exceptions.
+ * We need to update the saved PC.
+ */
+ EXPORT_PC();
+
+ vsrc1 = INST_AA(inst);
+ ILOGV("|throw v%d (%p)", vsrc1, (void*)GET_REGISTER(vsrc1));
+ obj = (Object*) GET_REGISTER(vsrc1);
+ if (!checkForNull(obj)) {
+ /* will throw a null pointer exception */
+ LOGVV("Bad exception\n");
+ } else {
+ /* use the requested exception */
+ dvmSetException(self, obj);
+ }
+ GOTO_exceptionThrown();
+ }
+OP_END