@@ -2184,7 +2184,7 @@ nmethod *SharedRuntime::generate_native_wrapper(MacroAssembler *masm,
21842184
21852185 // The last java pc will also be used as resume pc if this is the wrapper for wait0.
21862186 // For this purpose the precise location matters but not for oopmap lookup.
2187- __ load_const (Z_R10, last_java_pc);
2187+ __ z_larl (Z_R10, last_java_pc);
21882188
21892189 // Lock a synchronized method.
21902190
@@ -2364,14 +2364,12 @@ nmethod *SharedRuntime::generate_native_wrapper(MacroAssembler *masm,
23642364
23652365 // Check preemption for Object.wait()
23662366 if (method->is_object_wait0 ()) {
2367- __ stop (" crash here also" );
2368- Label not_preempted;
2367+ NearLabel not_preempted;
23692368 __ z_ltg (Z_R1_scratch, Address (Z_thread, JavaThread::preempt_alternate_return_offset ()));
23702369 __ z_brz (not_preempted); // if 0, jump to not_preempted
23712370 __ z_mvghi (Address (Z_thread, JavaThread::preempt_alternate_return_offset ()), 0 );
23722371 __ z_br (Z_R1_scratch);
23732372 __ bind (not_preempted);
2374-
23752373 }
23762374 __ bind (last_java_pc);
23772375
@@ -2483,8 +2481,13 @@ nmethod *SharedRuntime::generate_native_wrapper(MacroAssembler *masm,
24832481 // Clear "last Java frame" SP and PC.
24842482 // --------------------------------------------------------------------
24852483
2486- // TODO: FIX THIS, Last java frame won't be set if we're resuming after preemption
2487- __ reset_last_Java_frame ();
2484+ if (method->is_object_wait0 ()) {
2485+ // Last java frame won't be set if we're resuming after preemption
2486+ __ store_const (Address (Z_thread, JavaThread::last_Java_sp_offset ()), 0 );
2487+ __ store_const (Address (Z_thread, JavaThread::last_Java_pc_offset ()), 0 );
2488+ } else {
2489+ __ reset_last_Java_frame ();
2490+ }
24882491
24892492 // Unpack oop result, e.g. JNIHandles::resolve result.
24902493 if (is_reference_type (ret_type)) {
0 commit comments