want to call spmt_parent_delete_or_abort any time we exit a method and it's due to an exception. want to call spmt_virtual_enter_method when entering a method, and spmt_virtual_exit_method when exiting due to either exception or normal control flow. we can't call parent_delete_or_abort while in an internal frame because there may not be a child and even if there was it would not be for this frame since we never pushed anything for it. simplest just to move the abort after the return from this frame. This is how internal calls are used: 1) push and set up internal frame 2) push and set up java frame 3) _svmf_interpreter (env); 4) eventually execute RETURN and leave java frame pushed in (2) 5) execute INTERNAL_CALL_END as the only bytecode of the internal frame 6) leave _svmf_interpreter(). There are further notes in doc/stack_layout.txt and in the comments for INTERNAL_CALL_END. interpreter.c ============= -> call enter at beginning -> corresponding exit will be called in RETURN -> call delete_or_abort on exception -> call exit on exception too instructions.m4.c ================= PREPARE_INVOKE -> if prepared, enter PREPARE_METHOD -> enter at end of it INVOKE -> if prepared, enter LINK_NATIVE_METHOD -> enter -> this is like PREPARE_METHOD but for natives NATIVE_STATIC_METHOD -> nothing (invoke will have entered) NATIVE_NON_STATIC_METHOD -> nothing (invoke will have entered) RETURN -> should be able to assert prepared -> exit if structured locking exception -> otherwise still exit INTERNAL_CALL_END -> do not exit -> but return normally from _svmf_interpreter() spmt_instructions.m4.c ====================== RETURN -> assert prepared -> exit INVOKE -> assert prepared (because otherwise, how did this instruction get here?) -> enter method -> may be better to check if prepared and abort if not native_interface.c: =================== -> _svmf_interpreter() callid in internal_CallNonVirtualMethod. there is a stack frame push and pop around this call. method_invoke.m4.c java_lang_reflect_Method.c ========================== -> similar to native_interface.c invoke_interface.c ================== -> main call to _svmf_interpreter() native.c: ========= -> after _svmf_verbose_methods_exit copypasta -> two places, one for static natives, one for non-static natives Summary: ======== enter: (if prepared) - INVOKE - PREPARE_INVOKE - LINK_NATIVE_METHOD - PREPARE_METHOD - SPMT_INVOKE --> probably need to check if prepared, not just assert - interpreter() start, if prepared exit: - locking problem in RETURN - regular RETURN (seems redundant) - SPMT_RETURN - 2 places in native.c push internal call frame and call _svmf_interpreter(): - native_interface.m4.c, java_lang_reflect_Method.c, invoke_interface.c pop internal call frame and exit _svmf_interpreter(): - INTERNAL_CALL_END - exception loop call parent_delete_or_abort - exception loop, but not for internal frames