< prev index next >

src/hotspot/share/code/nmethod.cpp

Print this page

 691   address low_boundary = verified_entry_point();
 692   if (!is_in_use()) {
 693     low_boundary += NativeJump::instruction_size;
 694     // %%% Note:  On SPARC we patch only a 4-byte trap, not a full NativeJump.
 695     // This means that the low_boundary is going to be a little too high.
 696     // This shouldn't matter, since oops of non-entrant methods are never used.
 697     // In fact, why are we bothering to look at oops in a non-entrant method??
 698   }
 699   return low_boundary;
 700 }
 701 
 702 // Method that knows how to preserve outgoing arguments at call. This method must be
 703 // called with a frame corresponding to a Java invoke
 704 void nmethod::preserve_callee_argument_oops(frame fr, const RegisterMap *reg_map, OopClosure* f) {
 705   if (method() == nullptr) {
 706     return;
 707   }
 708 
 709   // handle the case of an anchor explicitly set in continuation code that doesn't have a callee
 710   JavaThread* thread = reg_map->thread();
 711   if (thread->has_last_Java_frame() && fr.sp() == thread->last_Java_sp()) {
 712     return;
 713   }
 714 
 715   if (!method()->is_native()) {
 716     address pc = fr.pc();
 717     bool has_receiver, has_appendix;
 718     Symbol* signature;
 719 
 720     // The method attached by JIT-compilers should be used, if present.
 721     // Bytecode can be inaccurate in such case.
 722     Method* callee = attached_method_before_pc(pc);
 723     if (callee != nullptr) {
 724       has_receiver = !(callee->access_flags().is_static());
 725       has_appendix = false;
 726       signature    = callee->signature();
 727     } else {
 728       SimpleScopeDesc ssd(this, pc);
 729 
 730       Bytecode_invoke call(methodHandle(Thread::current(), ssd.method()), ssd.bci());
 731       has_receiver = call.has_receiver();

1281              offsets->value(CodeOffsets::Frame_Complete), frame_size, oop_maps, false),
1282   _deoptimization_generation(0),
1283   _gc_epoch(CodeCache::gc_epoch()),
1284   _method(method),
1285   _native_receiver_sp_offset(basic_lock_owner_sp_offset),
1286   _native_basic_lock_sp_offset(basic_lock_sp_offset)
1287 {
1288   {
1289     debug_only(NoSafepointVerifier nsv;)
1290     assert_locked_or_safepoint(CodeCache_lock);
1291 
1292     init_defaults(code_buffer, offsets);
1293 
1294     _osr_entry_point         = nullptr;
1295     _pc_desc_container       = nullptr;
1296     _entry_bci               = InvocationEntryBci;
1297     _compile_id              = compile_id;
1298     _comp_level              = CompLevel_none;
1299     _compiler_type           = type;
1300     _orig_pc_offset          = 0;
1301     _num_stack_arg_slots     = _method->constMethod()->num_stack_arg_slots();
1302 
1303     if (offsets->value(CodeOffsets::Exceptions) != -1) {
1304       // Continuation enter intrinsic
1305       _exception_offset      = code_offset() + offsets->value(CodeOffsets::Exceptions);
1306     } else {
1307       _exception_offset      = 0;
1308     }
1309     // Native wrappers do not have deopt handlers. Make the values
1310     // something that will never match a pc like the nmethod vtable entry
1311     _deopt_handler_offset    = 0;
1312     _deopt_mh_handler_offset = 0;
1313     _unwind_handler_offset   = 0;
1314 
1315     CHECKED_CAST(_metadata_offset, uint16_t, (align_up(code_buffer->total_oop_size(), oopSize)));
1316     int data_end_offset = _metadata_offset + align_up(code_buffer->total_metadata_size(), wordSize);
1317 #if INCLUDE_JVMCI
1318     // jvmci_data_size is 0 in native wrapper but we need to set offset
1319     // to correctly calculate metadata_end address
1320     CHECKED_CAST(_jvmci_data_offset, uint16_t, data_end_offset);
1321 #endif

 691   address low_boundary = verified_entry_point();
 692   if (!is_in_use()) {
 693     low_boundary += NativeJump::instruction_size;
 694     // %%% Note:  On SPARC we patch only a 4-byte trap, not a full NativeJump.
 695     // This means that the low_boundary is going to be a little too high.
 696     // This shouldn't matter, since oops of non-entrant methods are never used.
 697     // In fact, why are we bothering to look at oops in a non-entrant method??
 698   }
 699   return low_boundary;
 700 }
 701 
 702 // Method that knows how to preserve outgoing arguments at call. This method must be
 703 // called with a frame corresponding to a Java invoke
 704 void nmethod::preserve_callee_argument_oops(frame fr, const RegisterMap *reg_map, OopClosure* f) {
 705   if (method() == nullptr) {
 706     return;
 707   }
 708 
 709   // handle the case of an anchor explicitly set in continuation code that doesn't have a callee
 710   JavaThread* thread = reg_map->thread();
 711   if ((thread->has_last_Java_frame() && fr.sp() == thread->last_Java_sp()) JVMTI_ONLY(|| (method()->is_continuation_enter_intrinsic() && thread->on_monitor_waited_event()))) {
 712     return;
 713   }
 714 
 715   if (!method()->is_native()) {
 716     address pc = fr.pc();
 717     bool has_receiver, has_appendix;
 718     Symbol* signature;
 719 
 720     // The method attached by JIT-compilers should be used, if present.
 721     // Bytecode can be inaccurate in such case.
 722     Method* callee = attached_method_before_pc(pc);
 723     if (callee != nullptr) {
 724       has_receiver = !(callee->access_flags().is_static());
 725       has_appendix = false;
 726       signature    = callee->signature();
 727     } else {
 728       SimpleScopeDesc ssd(this, pc);
 729 
 730       Bytecode_invoke call(methodHandle(Thread::current(), ssd.method()), ssd.bci());
 731       has_receiver = call.has_receiver();

1281              offsets->value(CodeOffsets::Frame_Complete), frame_size, oop_maps, false),
1282   _deoptimization_generation(0),
1283   _gc_epoch(CodeCache::gc_epoch()),
1284   _method(method),
1285   _native_receiver_sp_offset(basic_lock_owner_sp_offset),
1286   _native_basic_lock_sp_offset(basic_lock_sp_offset)
1287 {
1288   {
1289     debug_only(NoSafepointVerifier nsv;)
1290     assert_locked_or_safepoint(CodeCache_lock);
1291 
1292     init_defaults(code_buffer, offsets);
1293 
1294     _osr_entry_point         = nullptr;
1295     _pc_desc_container       = nullptr;
1296     _entry_bci               = InvocationEntryBci;
1297     _compile_id              = compile_id;
1298     _comp_level              = CompLevel_none;
1299     _compiler_type           = type;
1300     _orig_pc_offset          = 0;
1301     _num_stack_arg_slots     = 0;
1302 
1303     if (offsets->value(CodeOffsets::Exceptions) != -1) {
1304       // Continuation enter intrinsic
1305       _exception_offset      = code_offset() + offsets->value(CodeOffsets::Exceptions);
1306     } else {
1307       _exception_offset      = 0;
1308     }
1309     // Native wrappers do not have deopt handlers. Make the values
1310     // something that will never match a pc like the nmethod vtable entry
1311     _deopt_handler_offset    = 0;
1312     _deopt_mh_handler_offset = 0;
1313     _unwind_handler_offset   = 0;
1314 
1315     CHECKED_CAST(_metadata_offset, uint16_t, (align_up(code_buffer->total_oop_size(), oopSize)));
1316     int data_end_offset = _metadata_offset + align_up(code_buffer->total_metadata_size(), wordSize);
1317 #if INCLUDE_JVMCI
1318     // jvmci_data_size is 0 in native wrapper but we need to set offset
1319     // to correctly calculate metadata_end address
1320     CHECKED_CAST(_jvmci_data_offset, uint16_t, data_end_offset);
1321 #endif
< prev index next >