Index: vm/jitrino/src/jet/sconsts.h =================================================================== --- vm/jitrino/src/jet/sconsts.h (revision 569303) +++ vm/jitrino/src/jet/sconsts.h (working copy) @@ -98,6 +98,18 @@ static unsigned rt_suspend_req_flag_offset; /** + * @brief An address of 'method entry flag'. + * @see exe_notify_method_enter + */ + static char* rt_method_entry_flag_address; + + /** + * @brief An address of 'method exit flag'. + * @see exe_notify_method_exit + */ + static char* rt_method_exit_flag_address; + + /** * @brief Address of helper that returns a pointer to thread local struct. * @param none Index: vm/jitrino/src/jet/cg_meth.cpp =================================================================== --- vm/jitrino/src/jet/cg_meth.cpp (revision 569303) +++ vm/jitrino/src/jet/cg_meth.cpp (working copy) @@ -511,8 +511,17 @@ // JVMTI method_enter notification // if (compilation_params.exe_notify_method_entry) { + AR ar = valloc(iplatf); + Opnd flag_addr(iplatf, ar); + mov(flag_addr,(int_ptr)rt_method_entry_flag_address); + Opnd mem(i16, ar, 0); + alu(alu_cmp, mem, Opnd(0)); + unsigned br_off = br(z, 0, 0, taken); + static const CallSig cs_ti_menter(CCONV_HELPERS, jobj); gen_call_vm(cs_ti_menter, rt_helper_ti_method_enter, 0, m_method); + + patch(br_off, ip()); } @@ -592,6 +601,13 @@ } if (compilation_params.exe_notify_method_exit) { + AR ar = valloc(iplatf); + Opnd flag_addr(iplatf, ar); + mov(flag_addr,(int_ptr)rt_method_exit_flag_address); + Opnd mem(i16, ar, 0); + alu(alu_cmp, mem, Opnd(0)); + unsigned br_off = br(z, 0, 0, taken); + // JVMTI helper takes pointer to return value and method handle const CallSig cs_ti_mexit(CCONV_STDCALL, jobj, jobj); // The call is a bit unusual, and is processed as follows: @@ -622,6 +638,8 @@ gen_args(cs_ti_mexit, 0, &vmeth, &retValPtr); gen_call_vm(cs_ti_mexit, rt_helper_ti_method_exit, cs_ti_mexit.count()); runlock(cs_ti_mexit); + + patch(br_off, ip()); } if (is_f(retType)) { Index: vm/jitrino/src/jet/compiler.cpp =================================================================== --- vm/jitrino/src/jet/compiler.cpp (revision 569303) +++ vm/jitrino/src/jet/compiler.cpp (working copy) @@ -1532,6 +1532,8 @@ // rt_array_length_offset = vector_length_offset(); rt_suspend_req_flag_offset = (unsigned)hythread_tls_get_request_offset(); + rt_method_entry_flag_address = get_method_entry_flag_address(); + rt_method_exit_flag_address = get_method_exit_flag_address(); rt_vtable_offset = object_get_vtable_offset(); Class_Handle clss; Index: vm/jitrino/src/jet/sconsts.cpp =================================================================== --- vm/jitrino/src/jet/sconsts.cpp (revision 569303) +++ vm/jitrino/src/jet/sconsts.cpp (working copy) @@ -78,6 +78,8 @@ unsigned StaticConsts::rt_array_length_offset = NOTHING; unsigned StaticConsts::rt_suspend_req_flag_offset = NOTHING; +char* StaticConsts::rt_method_entry_flag_address = NULL; +char* StaticConsts::rt_method_exit_flag_address = NULL; int StaticConsts::rt_vtable_offset = 0; bool StaticConsts::g_jvmtiMode = false;