275 #endif
276 call(CAST_FROM_FN_PTR(address, reinitialize_thread), relocInfo::runtime_call_type);
277 delayed()->nop();
278 mov(L0, G1);
279 mov(L1, G5_method);
280 mov(L2, G3);
281 mov(L5, G4);
282 restore(O0, 0, G2_thread);
283 }
284
285 static Thread* verify_thread_subroutine(Thread* gthread_value) {
286 Thread* correct_value = Thread::current();
287 guarantee(gthread_value == correct_value, "G2_thread value must be the thread");
288 return correct_value;
289 }
290
291 void MacroAssembler::verify_thread() {
292 if (VerifyThread) {
293 // NOTE: this chops off the heads of the 64-bit O registers.
294 // make sure G2_thread contains the right value
295 save_frame_and_mov(0, Lmethod, Lmethod); // to avoid clobbering O0 (and propagate Lmethod for -Xprof)
296 mov(G1, L1); // avoid clobbering G1
297 // G2 saved below
298 mov(G3, L3); // avoid clobbering G3
299 mov(G4, L4); // avoid clobbering G4
300 mov(G5_method, L5); // avoid clobbering G5_method
301 call(CAST_FROM_FN_PTR(address,verify_thread_subroutine), relocInfo::runtime_call_type);
302 delayed()->mov(G2_thread, O0);
303
304 mov(L1, G1); // Restore G1
305 // G2 restored below
306 mov(L3, G3); // restore G3
307 mov(L4, G4); // restore G4
308 mov(L5, G5_method); // restore G5_method
309 restore(O0, 0, G2_thread);
310 }
311 }
312
313
314 void MacroAssembler::save_thread(const Register thread_cache) {
315 verify_thread();
381 andcc(last_java_sp, 0x01, G0);
382 br(Assembler::notZero, false, Assembler::pt, StackOk);
383 delayed()->nop();
384 STOP("Stack Not Biased in set_last_Java_frame");
385 bind(StackOk);
386 #endif // ASSERT
387 assert( last_java_sp != G4_scratch, "bad register usage in set_last_Java_frame");
388 add( last_java_sp, STACK_BIAS, G4_scratch );
389 st_ptr(G4_scratch, G2_thread, JavaThread::last_Java_sp_offset());
390 }
391
392 void MacroAssembler::reset_last_Java_frame(void) {
393 assert_not_delayed();
394
395 Address sp_addr(G2_thread, JavaThread::last_Java_sp_offset());
396 Address pc_addr(G2_thread, JavaThread::frame_anchor_offset() + JavaFrameAnchor::last_Java_pc_offset());
397 Address flags (G2_thread, JavaThread::frame_anchor_offset() + JavaFrameAnchor::flags_offset());
398
399 #ifdef ASSERT
400 // check that it WAS previously set
401 save_frame_and_mov(0, Lmethod, Lmethod); // Propagate Lmethod to helper frame for -Xprof
402 ld_ptr(sp_addr, L0);
403 tst(L0);
404 breakpoint_trap(Assembler::zero, Assembler::ptr_cc);
405 restore();
406 #endif // ASSERT
407
408 st_ptr(G0, sp_addr);
409 // Always return last_Java_pc to zero
410 st_ptr(G0, pc_addr);
411 // Always null flags after return to Java
412 st(G0, flags);
413 }
414
415
416 void MacroAssembler::call_VM_base(
417 Register oop_result,
418 Register thread_cache,
419 Register last_java_sp,
420 address entry_point,
421 int number_of_arguments,
601 }
602
603
604 void MacroAssembler::get_vm_result_2(Register metadata_result) {
605 verify_thread();
606 Address vm_result_addr_2(G2_thread, JavaThread::vm_result_2_offset());
607 ld_ptr(vm_result_addr_2, metadata_result);
608 st_ptr(G0, vm_result_addr_2);
609 }
610
611
612 // We require that C code which does not return a value in vm_result will
613 // leave it undisturbed.
614 void MacroAssembler::set_vm_result(Register oop_result) {
615 verify_thread();
616 Address vm_result_addr(G2_thread, JavaThread::vm_result_offset());
617 verify_oop(oop_result);
618
619 # ifdef ASSERT
620 // Check that we are not overwriting any other oop.
621 save_frame_and_mov(0, Lmethod, Lmethod); // Propagate Lmethod for -Xprof
622 ld_ptr(vm_result_addr, L0);
623 tst(L0);
624 restore();
625 breakpoint_trap(notZero, Assembler::ptr_cc);
626 // }
627 # endif
628
629 st_ptr(oop_result, vm_result_addr);
630 }
631
632
633 void MacroAssembler::ic_call(address entry, bool emit_delay, jint method_index) {
634 RelocationHolder rspec = virtual_call_Relocation::spec(pc(), method_index);
635 patchable_set((intptr_t)Universe::non_oop_word(), G5_inline_cache_reg);
636 relocate(rspec);
637 call(entry, relocInfo::none);
638 if (emit_delay) {
639 delayed()->nop();
640 }
641 }
|
275 #endif
276 call(CAST_FROM_FN_PTR(address, reinitialize_thread), relocInfo::runtime_call_type);
277 delayed()->nop();
278 mov(L0, G1);
279 mov(L1, G5_method);
280 mov(L2, G3);
281 mov(L5, G4);
282 restore(O0, 0, G2_thread);
283 }
284
285 static Thread* verify_thread_subroutine(Thread* gthread_value) {
286 Thread* correct_value = Thread::current();
287 guarantee(gthread_value == correct_value, "G2_thread value must be the thread");
288 return correct_value;
289 }
290
291 void MacroAssembler::verify_thread() {
292 if (VerifyThread) {
293 // NOTE: this chops off the heads of the 64-bit O registers.
294 // make sure G2_thread contains the right value
295 save_frame_and_mov(0, Lmethod, Lmethod); // to avoid clobbering O0 (and propagate Lmethod)
296 mov(G1, L1); // avoid clobbering G1
297 // G2 saved below
298 mov(G3, L3); // avoid clobbering G3
299 mov(G4, L4); // avoid clobbering G4
300 mov(G5_method, L5); // avoid clobbering G5_method
301 call(CAST_FROM_FN_PTR(address,verify_thread_subroutine), relocInfo::runtime_call_type);
302 delayed()->mov(G2_thread, O0);
303
304 mov(L1, G1); // Restore G1
305 // G2 restored below
306 mov(L3, G3); // restore G3
307 mov(L4, G4); // restore G4
308 mov(L5, G5_method); // restore G5_method
309 restore(O0, 0, G2_thread);
310 }
311 }
312
313
314 void MacroAssembler::save_thread(const Register thread_cache) {
315 verify_thread();
381 andcc(last_java_sp, 0x01, G0);
382 br(Assembler::notZero, false, Assembler::pt, StackOk);
383 delayed()->nop();
384 STOP("Stack Not Biased in set_last_Java_frame");
385 bind(StackOk);
386 #endif // ASSERT
387 assert( last_java_sp != G4_scratch, "bad register usage in set_last_Java_frame");
388 add( last_java_sp, STACK_BIAS, G4_scratch );
389 st_ptr(G4_scratch, G2_thread, JavaThread::last_Java_sp_offset());
390 }
391
392 void MacroAssembler::reset_last_Java_frame(void) {
393 assert_not_delayed();
394
395 Address sp_addr(G2_thread, JavaThread::last_Java_sp_offset());
396 Address pc_addr(G2_thread, JavaThread::frame_anchor_offset() + JavaFrameAnchor::last_Java_pc_offset());
397 Address flags (G2_thread, JavaThread::frame_anchor_offset() + JavaFrameAnchor::flags_offset());
398
399 #ifdef ASSERT
400 // check that it WAS previously set
401 save_frame_and_mov(0, Lmethod, Lmethod); // Propagate Lmethod to helper frame
402 ld_ptr(sp_addr, L0);
403 tst(L0);
404 breakpoint_trap(Assembler::zero, Assembler::ptr_cc);
405 restore();
406 #endif // ASSERT
407
408 st_ptr(G0, sp_addr);
409 // Always return last_Java_pc to zero
410 st_ptr(G0, pc_addr);
411 // Always null flags after return to Java
412 st(G0, flags);
413 }
414
415
416 void MacroAssembler::call_VM_base(
417 Register oop_result,
418 Register thread_cache,
419 Register last_java_sp,
420 address entry_point,
421 int number_of_arguments,
601 }
602
603
604 void MacroAssembler::get_vm_result_2(Register metadata_result) {
605 verify_thread();
606 Address vm_result_addr_2(G2_thread, JavaThread::vm_result_2_offset());
607 ld_ptr(vm_result_addr_2, metadata_result);
608 st_ptr(G0, vm_result_addr_2);
609 }
610
611
612 // We require that C code which does not return a value in vm_result will
613 // leave it undisturbed.
614 void MacroAssembler::set_vm_result(Register oop_result) {
615 verify_thread();
616 Address vm_result_addr(G2_thread, JavaThread::vm_result_offset());
617 verify_oop(oop_result);
618
619 # ifdef ASSERT
620 // Check that we are not overwriting any other oop.
621 save_frame_and_mov(0, Lmethod, Lmethod); // Propagate Lmethod
622 ld_ptr(vm_result_addr, L0);
623 tst(L0);
624 restore();
625 breakpoint_trap(notZero, Assembler::ptr_cc);
626 // }
627 # endif
628
629 st_ptr(oop_result, vm_result_addr);
630 }
631
632
633 void MacroAssembler::ic_call(address entry, bool emit_delay, jint method_index) {
634 RelocationHolder rspec = virtual_call_Relocation::spec(pc(), method_index);
635 patchable_set((intptr_t)Universe::non_oop_word(), G5_inline_cache_reg);
636 relocate(rspec);
637 call(entry, relocInfo::none);
638 if (emit_delay) {
639 delayed()->nop();
640 }
641 }
|