< prev index next >

src/share/vm/opto/runtime.cpp

Print this page
rev 12854 : [mq]: gcinterface.patch


 187 
 188 //=============================================================================
 189 // Opto compiler runtime routines
 190 //=============================================================================
 191 
 192 
 193 //=============================allocation======================================
 194 // We failed the fast-path allocation.  Now we need to do a scavenge or GC
 195 // and try allocation again.
 196 
 197 void OptoRuntime::new_store_pre_barrier(JavaThread* thread) {
 198   // After any safepoint, just before going back to compiled code,
 199   // we inform the GC that we will be doing initializing writes to
 200   // this object in the future without emitting card-marks, so
 201   // GC may take any compensating steps.
 202   // NOTE: Keep this code consistent with GraphKit::store_barrier.
 203 
 204   oop new_obj = thread->vm_result();
 205   if (new_obj == NULL)  return;
 206 
 207   assert(Universe::heap()->can_elide_tlab_store_barriers(),
 208          "compiler must check this first");
 209   // GC may decide to give back a safer copy of new_obj.
 210   new_obj = Universe::heap()->new_store_pre_barrier(thread, new_obj);
 211   thread->set_vm_result(new_obj);
 212 }
 213 
 214 // object allocation
 215 JRT_BLOCK_ENTRY(void, OptoRuntime::new_instance_C(Klass* klass, JavaThread* thread))
 216   JRT_BLOCK;
 217 #ifndef PRODUCT
 218   SharedRuntime::_new_instance_ctr++;         // new instance requires GC
 219 #endif
 220   assert(check_compiled_frame(thread), "incorrect caller");
 221 
 222   // These checks are cheap to make and support reflective allocation.
 223   int lh = klass->layout_helper();
 224   if (Klass::layout_helper_needs_slow_path(lh) || !InstanceKlass::cast(klass)->is_initialized()) {
 225     Handle holder(THREAD, klass->klass_holder()); // keep the klass alive
 226     klass->check_valid_for_instantiation(false, THREAD);
 227     if (!HAS_PENDING_EXCEPTION) {
 228       InstanceKlass::cast(klass)->initialize(THREAD);
 229     }
 230   }




 187 
 188 //=============================================================================
 189 // Opto compiler runtime routines
 190 //=============================================================================
 191 
 192 
 193 //=============================allocation======================================
 194 // We failed the fast-path allocation.  Now we need to do a scavenge or GC
 195 // and try allocation again.
 196 
 197 void OptoRuntime::new_store_pre_barrier(JavaThread* thread) {
 198   // After any safepoint, just before going back to compiled code,
 199   // we inform the GC that we will be doing initializing writes to
 200   // this object in the future without emitting card-marks, so
 201   // GC may take any compensating steps.
 202   // NOTE: Keep this code consistent with GraphKit::store_barrier.
 203 
 204   oop new_obj = thread->vm_result();
 205   if (new_obj == NULL)  return;
 206 
 207   assert(GC::gc()->heap()->can_elide_tlab_store_barriers(),
 208          "compiler must check this first");
 209   // GC may decide to give back a safer copy of new_obj.
 210   new_obj = GC::gc()->heap()->new_store_pre_barrier(thread, new_obj);
 211   thread->set_vm_result(new_obj);
 212 }
 213 
 214 // object allocation
 215 JRT_BLOCK_ENTRY(void, OptoRuntime::new_instance_C(Klass* klass, JavaThread* thread))
 216   JRT_BLOCK;
 217 #ifndef PRODUCT
 218   SharedRuntime::_new_instance_ctr++;         // new instance requires GC
 219 #endif
 220   assert(check_compiled_frame(thread), "incorrect caller");
 221 
 222   // These checks are cheap to make and support reflective allocation.
 223   int lh = klass->layout_helper();
 224   if (Klass::layout_helper_needs_slow_path(lh) || !InstanceKlass::cast(klass)->is_initialized()) {
 225     Handle holder(THREAD, klass->klass_holder()); // keep the klass alive
 226     klass->check_valid_for_instantiation(false, THREAD);
 227     if (!HAS_PENDING_EXCEPTION) {
 228       InstanceKlass::cast(klass)->initialize(THREAD);
 229     }
 230   }


< prev index next >