@@ -2182,21 +2182,9 @@ nmethod *SharedRuntime::generate_native_wrapper(MacroAssembler *masm,
21822182 // So if we must call out we must push a new frame.
21832183 // ////////////////////////////////////////////////////////////////////
21842184
2185- if (method->is_object_wait0 ()) {
2186- // The last java pc will also be used as resume pc if this is the wrapper for wait0.
2187- // For this purpose the precise location matters but not for oopmap lookup.
2188- __ load_const (Z_R10, last_java_pc);
2189- } else {
2190- // Calc the current pc into Z_R10 and into wrapper_CRegsSet.
2191- // Both values represent the same position.
2192- __ get_PC (Z_R10); // PC into register
2193- wrapper_CRegsSet = __ offset (); // and into into variable.
2194-
2195- // Z_R10 now has the pc loaded that we will use when we finally call to native.
2196-
2197- // We use the same pc/oopMap repeatedly when we call out.
2198- oop_maps->add_gc_map ((int )(wrapper_CRegsSet-wrapper_CodeStart), map);
2199- }
2185+ // The last java pc will also be used as resume pc if this is the wrapper for wait0.
2186+ // For this purpose the precise location matters but not for oopmap lookup.
2187+ __ load_const (Z_R10, last_java_pc);
22002188
22012189 // Lock a synchronized method.
22022190
@@ -2374,24 +2362,24 @@ nmethod *SharedRuntime::generate_native_wrapper(MacroAssembler *masm,
23742362 // Transition from _thread_in_native_trans to _thread_in_Java.
23752363 __ set_thread_state (_thread_in_Java);
23762364
2365+ // Check preemption for Object.wait()
23772366 if (method->is_object_wait0 ()) {
2367+ __ stop (" crash here also" );
23782368 Label not_preempted;
23792369 __ z_ltg (Z_R1_scratch, Address (Z_thread, JavaThread::preempt_alternate_return_offset ()));
23802370 __ z_brz (not_preempted); // if 0, jump to not_preempted
23812371 __ z_mvghi (Address (Z_thread, JavaThread::preempt_alternate_return_offset ()), 0 );
2382- __ call (Z_R1_scratch);
2372+ __ z_br (Z_R1_scratch);
23832373 __ bind (not_preempted);
23842374
2385- __ bind (last_java_pc);
2375+ }
2376+ __ bind (last_java_pc);
23862377
2387- // Calc the current pc into Z_R10 and into wrapper_CRegsSet.
2388- // Both values represent the same position.
2389- __ get_PC (Z_R10);
2390- wrapper_CRegsSet = __ offset (); // and into into variable.
2378+ // Calc the current pc into wrapper_CRegsSet.
2379+ wrapper_CRegsSet = __ offset (); // and into into variable.
23912380
2392- // We use the same pc/oopMap repeatedly when we call out.
2393- oop_maps->add_gc_map ((int )(wrapper_CRegsSet-wrapper_CodeStart), map);
2394- }
2381+ // We use the same pc/oopMap repeatedly when we call out.
2382+ oop_maps->add_gc_map ((int )(wrapper_CRegsSet-wrapper_CodeStart), map);
23952383
23962384 // --------------------------------------------------------------------
23972385 // Reguard any pages if necessary.
@@ -2495,6 +2483,7 @@ nmethod *SharedRuntime::generate_native_wrapper(MacroAssembler *masm,
24952483 // Clear "last Java frame" SP and PC.
24962484 // --------------------------------------------------------------------
24972485
2486+ // TODO: FIX THIS, Last java frame won't be set if we're resuming after preemption
24982487 __ reset_last_Java_frame ();
24992488
25002489 // Unpack oop result, e.g. JNIHandles::resolve result.
0 commit comments