< prev index next >

src/hotspot/share/c1/c1_Runtime1.cpp

Print this page




  39 #include "code/vtableStubs.hpp"
  40 #include "compiler/disassembler.hpp"
  41 #include "gc/shared/barrierSet.hpp"
  42 #include "gc/shared/c1/barrierSetC1.hpp"
  43 #include "gc/shared/collectedHeap.hpp"
  44 #include "interpreter/bytecode.hpp"
  45 #include "interpreter/interpreter.hpp"
  46 #include "jfr/support/jfrIntrinsics.hpp"
  47 #include "logging/log.hpp"
  48 #include "memory/allocation.inline.hpp"
  49 #include "memory/oopFactory.hpp"
  50 #include "memory/resourceArea.hpp"
  51 #include "memory/universe.hpp"
  52 #include "oops/access.inline.hpp"
  53 #include "oops/objArrayOop.inline.hpp"
  54 #include "oops/objArrayKlass.hpp"
  55 #include "oops/oop.inline.hpp"
  56 #include "runtime/atomic.hpp"
  57 #include "runtime/biasedLocking.hpp"
  58 #include "runtime/compilationPolicy.hpp"

  59 #include "runtime/fieldDescriptor.inline.hpp"
  60 #include "runtime/frame.inline.hpp"
  61 #include "runtime/handles.inline.hpp"
  62 #include "runtime/interfaceSupport.inline.hpp"
  63 #include "runtime/javaCalls.hpp"
  64 #include "runtime/sharedRuntime.hpp"
  65 #include "runtime/threadCritical.hpp"
  66 #include "runtime/vframe.inline.hpp"
  67 #include "runtime/vframeArray.hpp"
  68 #include "runtime/vm_version.hpp"
  69 #include "utilities/copy.hpp"
  70 #include "utilities/events.hpp"
  71 
  72 
  73 // Implementation of StubAssembler
  74 
  75 StubAssembler::StubAssembler(CodeBuffer* code, const char * name, int stub_id) : C1_MacroAssembler(code) {
  76   _name = name;
  77   _must_gc_arguments = false;
  78   _frame_size = no_frame_size;


 326   FUNCTION_CASE(entry, SharedRuntime::lmul);
 327   FUNCTION_CASE(entry, SharedRuntime::lrem);
 328   FUNCTION_CASE(entry, SharedRuntime::lrem);
 329   FUNCTION_CASE(entry, SharedRuntime::dtrace_method_entry);
 330   FUNCTION_CASE(entry, SharedRuntime::dtrace_method_exit);
 331   FUNCTION_CASE(entry, is_instance_of);
 332   FUNCTION_CASE(entry, trace_block_entry);
 333 #ifdef JFR_HAVE_INTRINSICS
 334   FUNCTION_CASE(entry, JFR_TIME_FUNCTION);
 335 #endif
 336   FUNCTION_CASE(entry, StubRoutines::updateBytesCRC32());
 337   FUNCTION_CASE(entry, StubRoutines::updateBytesCRC32C());
 338   FUNCTION_CASE(entry, StubRoutines::vectorizedMismatch());
 339   FUNCTION_CASE(entry, StubRoutines::dexp());
 340   FUNCTION_CASE(entry, StubRoutines::dlog());
 341   FUNCTION_CASE(entry, StubRoutines::dlog10());
 342   FUNCTION_CASE(entry, StubRoutines::dpow());
 343   FUNCTION_CASE(entry, StubRoutines::dsin());
 344   FUNCTION_CASE(entry, StubRoutines::dcos());
 345   FUNCTION_CASE(entry, StubRoutines::dtan());




 346 
 347 #undef FUNCTION_CASE
 348 
 349   // Soft float adds more runtime names.
 350   return pd_name_for_address(entry);
 351 }
 352 
 353 
 354 JRT_ENTRY(void, Runtime1::new_instance(JavaThread* thread, Klass* klass))
 355   NOT_PRODUCT(_new_instance_slowcase_cnt++;)
 356 
 357   assert(klass->is_klass(), "not a class");
 358   Handle holder(THREAD, klass->klass_holder()); // keep the klass alive
 359   InstanceKlass* h = InstanceKlass::cast(klass);
 360   h->check_valid_for_instantiation(true, CHECK);
 361   // make sure klass is initialized
 362   h->initialize(CHECK);
 363   // allocate instance and return via TLS
 364   oop obj = h->allocate_instance(CHECK);
 365   thread->set_vm_result(obj);


1261 #endif
1262           }
1263 
1264         } else {
1265           ICache::invalidate_range(copy_buff, *byte_count);
1266           NativeGeneralJump::insert_unconditional(instr_pc, being_initialized_entry);
1267         }
1268       }
1269     }
1270   }
1271 
1272   // If we are patching in a non-perm oop, make sure the nmethod
1273   // is on the right list.
1274   {
1275     MutexLocker ml_code (CodeCache_lock, Mutex::_no_safepoint_check_flag);
1276     nmethod* nm = CodeCache::find_nmethod(caller_frame.pc());
1277     guarantee(nm != NULL, "only nmethods can contain non-perm oops");
1278 
1279     // Since we've patched some oops in the nmethod,
1280     // (re)register it with the heap.

1281     Universe::heap()->register_nmethod(nm);
1282   }
1283 JRT_END
1284 
1285 #else // DEOPTIMIZE_WHEN_PATCHING
1286 
1287 JRT_ENTRY(void, Runtime1::patch_code(JavaThread* thread, Runtime1::StubID stub_id ))
1288   RegisterMap reg_map(thread, false);
1289 
1290   NOT_PRODUCT(_patch_code_slowcase_cnt++;)
1291   if (TracePatching) {
1292     tty->print_cr("Deoptimizing because patch is needed");
1293   }
1294 
1295   frame runtime_frame = thread->last_frame();
1296   frame caller_frame = runtime_frame.sender(&reg_map);
1297 
1298   // It's possible the nmethod was invalidated in the last
1299   // safepoint, but if it's still alive then make it not_entrant.
1300   nmethod* nm = CodeCache::find_nmethod(caller_frame.pc());




  39 #include "code/vtableStubs.hpp"
  40 #include "compiler/disassembler.hpp"
  41 #include "gc/shared/barrierSet.hpp"
  42 #include "gc/shared/c1/barrierSetC1.hpp"
  43 #include "gc/shared/collectedHeap.hpp"
  44 #include "interpreter/bytecode.hpp"
  45 #include "interpreter/interpreter.hpp"
  46 #include "jfr/support/jfrIntrinsics.hpp"
  47 #include "logging/log.hpp"
  48 #include "memory/allocation.inline.hpp"
  49 #include "memory/oopFactory.hpp"
  50 #include "memory/resourceArea.hpp"
  51 #include "memory/universe.hpp"
  52 #include "oops/access.inline.hpp"
  53 #include "oops/objArrayOop.inline.hpp"
  54 #include "oops/objArrayKlass.hpp"
  55 #include "oops/oop.inline.hpp"
  56 #include "runtime/atomic.hpp"
  57 #include "runtime/biasedLocking.hpp"
  58 #include "runtime/compilationPolicy.hpp"
  59 #include "runtime/continuation.hpp"
  60 #include "runtime/fieldDescriptor.inline.hpp"
  61 #include "runtime/frame.inline.hpp"
  62 #include "runtime/handles.inline.hpp"
  63 #include "runtime/interfaceSupport.inline.hpp"
  64 #include "runtime/javaCalls.hpp"
  65 #include "runtime/sharedRuntime.hpp"
  66 #include "runtime/threadCritical.hpp"
  67 #include "runtime/vframe.inline.hpp"
  68 #include "runtime/vframeArray.hpp"
  69 #include "runtime/vm_version.hpp"
  70 #include "utilities/copy.hpp"
  71 #include "utilities/events.hpp"
  72 
  73 
  74 // Implementation of StubAssembler
  75 
  76 StubAssembler::StubAssembler(CodeBuffer* code, const char * name, int stub_id) : C1_MacroAssembler(code) {
  77   _name = name;
  78   _must_gc_arguments = false;
  79   _frame_size = no_frame_size;


 327   FUNCTION_CASE(entry, SharedRuntime::lmul);
 328   FUNCTION_CASE(entry, SharedRuntime::lrem);
 329   FUNCTION_CASE(entry, SharedRuntime::lrem);
 330   FUNCTION_CASE(entry, SharedRuntime::dtrace_method_entry);
 331   FUNCTION_CASE(entry, SharedRuntime::dtrace_method_exit);
 332   FUNCTION_CASE(entry, is_instance_of);
 333   FUNCTION_CASE(entry, trace_block_entry);
 334 #ifdef JFR_HAVE_INTRINSICS
 335   FUNCTION_CASE(entry, JFR_TIME_FUNCTION);
 336 #endif
 337   FUNCTION_CASE(entry, StubRoutines::updateBytesCRC32());
 338   FUNCTION_CASE(entry, StubRoutines::updateBytesCRC32C());
 339   FUNCTION_CASE(entry, StubRoutines::vectorizedMismatch());
 340   FUNCTION_CASE(entry, StubRoutines::dexp());
 341   FUNCTION_CASE(entry, StubRoutines::dlog());
 342   FUNCTION_CASE(entry, StubRoutines::dlog10());
 343   FUNCTION_CASE(entry, StubRoutines::dpow());
 344   FUNCTION_CASE(entry, StubRoutines::dsin());
 345   FUNCTION_CASE(entry, StubRoutines::dcos());
 346   FUNCTION_CASE(entry, StubRoutines::dtan());
 347   FUNCTION_CASE(entry, StubRoutines::cont_getPC());
 348   FUNCTION_CASE(entry, StubRoutines::cont_thaw());
 349   FUNCTION_CASE(entry, StubRoutines::cont_doYield());
 350   FUNCTION_CASE(entry, StubRoutines::cont_jump());
 351 
 352 #undef FUNCTION_CASE
 353 
 354   // Soft float adds more runtime names.
 355   return pd_name_for_address(entry);
 356 }
 357 
 358 
 359 JRT_ENTRY(void, Runtime1::new_instance(JavaThread* thread, Klass* klass))
 360   NOT_PRODUCT(_new_instance_slowcase_cnt++;)
 361 
 362   assert(klass->is_klass(), "not a class");
 363   Handle holder(THREAD, klass->klass_holder()); // keep the klass alive
 364   InstanceKlass* h = InstanceKlass::cast(klass);
 365   h->check_valid_for_instantiation(true, CHECK);
 366   // make sure klass is initialized
 367   h->initialize(CHECK);
 368   // allocate instance and return via TLS
 369   oop obj = h->allocate_instance(CHECK);
 370   thread->set_vm_result(obj);


1266 #endif
1267           }
1268 
1269         } else {
1270           ICache::invalidate_range(copy_buff, *byte_count);
1271           NativeGeneralJump::insert_unconditional(instr_pc, being_initialized_entry);
1272         }
1273       }
1274     }
1275   }
1276 
1277   // If we are patching in a non-perm oop, make sure the nmethod
1278   // is on the right list.
1279   {
1280     MutexLocker ml_code (CodeCache_lock, Mutex::_no_safepoint_check_flag);
1281     nmethod* nm = CodeCache::find_nmethod(caller_frame.pc());
1282     guarantee(nm != NULL, "only nmethods can contain non-perm oops");
1283 
1284     // Since we've patched some oops in the nmethod,
1285     // (re)register it with the heap.
1286     Continuation::nmethod_patched(nm);
1287     Universe::heap()->register_nmethod(nm);
1288   }
1289 JRT_END
1290 
1291 #else // DEOPTIMIZE_WHEN_PATCHING
1292 
1293 JRT_ENTRY(void, Runtime1::patch_code(JavaThread* thread, Runtime1::StubID stub_id ))
1294   RegisterMap reg_map(thread, false);
1295 
1296   NOT_PRODUCT(_patch_code_slowcase_cnt++;)
1297   if (TracePatching) {
1298     tty->print_cr("Deoptimizing because patch is needed");
1299   }
1300 
1301   frame runtime_frame = thread->last_frame();
1302   frame caller_frame = runtime_frame.sender(&reg_map);
1303 
1304   // It's possible the nmethod was invalidated in the last
1305   // safepoint, but if it's still alive then make it not_entrant.
1306   nmethod* nm = CodeCache::find_nmethod(caller_frame.pc());


< prev index next >