< prev index next >

src/share/vm/jvmci/jvmciRuntime.cpp

Print this page
rev 12906 : [mq]: gc_interface


  99     frame runtime_frame = thread->last_frame();
 100     frame caller_frame = runtime_frame.sender(&reg_map);
 101     Deoptimization::deoptimize_frame(thread, caller_frame.id(), Deoptimization::Reason_constraint);
 102     assert(caller_is_deopted(), "Must be deoptimized");
 103   }
 104 }
 105 
 106 JRT_BLOCK_ENTRY(void, JVMCIRuntime::new_instance(JavaThread* thread, Klass* klass))
 107   JRT_BLOCK;
 108   assert(klass->is_klass(), "not a class");
 109   Handle holder(THREAD, klass->klass_holder()); // keep the klass alive
 110   InstanceKlass* ik = InstanceKlass::cast(klass);
 111   ik->check_valid_for_instantiation(true, CHECK);
 112   // make sure klass is initialized
 113   ik->initialize(CHECK);
 114   // allocate instance and return via TLS
 115   oop obj = ik->allocate_instance(CHECK);
 116   thread->set_vm_result(obj);
 117   JRT_BLOCK_END;
 118 
 119   if (ReduceInitialCardMarks) {
 120     new_store_pre_barrier(thread);
 121   }
 122 JRT_END
 123 
 124 JRT_BLOCK_ENTRY(void, JVMCIRuntime::new_array(JavaThread* thread, Klass* array_klass, jint length))
 125   JRT_BLOCK;
 126   // Note: no handle for klass needed since they are not used
 127   //       anymore after new_objArray() and no GC can happen before.
 128   //       (This may have to change if this code changes!)
 129   assert(array_klass->is_klass(), "not a class");
 130   oop obj;
 131   if (array_klass->is_typeArray_klass()) {
 132     BasicType elt_type = TypeArrayKlass::cast(array_klass)->element_type();
 133     obj = oopFactory::new_typeArray(elt_type, length, CHECK);
 134   } else {
 135     Handle holder(THREAD, array_klass->klass_holder()); // keep the klass alive
 136     Klass* elem_klass = ObjArrayKlass::cast(array_klass)->element_klass();
 137     obj = oopFactory::new_objArray(elem_klass, length, CHECK);
 138   }
 139   thread->set_vm_result(obj);
 140   // This is pretty rare but this runtime patch is stressful to deoptimization
 141   // if we deoptimize here so force a deopt to stress the path.
 142   if (DeoptimizeALot) {
 143     static int deopts = 0;
 144     // Alternate between deoptimizing and raising an error (which will also cause a deopt)
 145     if (deopts++ % 2 == 0) {
 146       ResourceMark rm(THREAD);
 147       THROW(vmSymbols::java_lang_OutOfMemoryError());
 148     } else {
 149       deopt_caller();
 150     }
 151   }
 152   JRT_BLOCK_END;
 153 
 154   if (ReduceInitialCardMarks) {
 155     new_store_pre_barrier(thread);
 156   }
 157 JRT_END
 158 
 159 void JVMCIRuntime::new_store_pre_barrier(JavaThread* thread) {
 160   // After any safepoint, just before going back to compiled code,
 161   // we inform the GC that we will be doing initializing writes to
 162   // this object in the future without emitting card-marks, so
 163   // GC may take any compensating steps.
 164   // NOTE: Keep this code consistent with GraphKit::store_barrier.
 165 
 166   oop new_obj = thread->vm_result();
 167   if (new_obj == NULL)  return;
 168 
 169   assert(Universe::heap()->can_elide_tlab_store_barriers(),
 170          "compiler must check this first");
 171   // GC may decide to give back a safer copy of new_obj.
 172   new_obj = Universe::heap()->new_store_pre_barrier(thread, new_obj);
 173   thread->set_vm_result(new_obj);
 174 }
 175 
 176 JRT_ENTRY(void, JVMCIRuntime::new_multi_array(JavaThread* thread, Klass* klass, int rank, jint* dims))
 177   assert(klass->is_klass(), "not a class");
 178   assert(rank >= 1, "rank must be nonzero");
 179   Handle holder(THREAD, klass->klass_holder()); // keep the klass alive
 180   oop obj = ArrayKlass::cast(klass)->multi_allocate(rank, dims, CHECK);
 181   thread->set_vm_result(obj);
 182 JRT_END
 183 
 184 JRT_ENTRY(void, JVMCIRuntime::dynamic_new_array(JavaThread* thread, oopDesc* element_mirror, jint length))
 185   oop obj = Reflection::reflect_new_array(element_mirror, length, CHECK);
 186   thread->set_vm_result(obj);
 187 JRT_END
 188 
 189 JRT_ENTRY(void, JVMCIRuntime::dynamic_new_instance(JavaThread* thread, oopDesc* type_mirror))
 190   InstanceKlass* klass = InstanceKlass::cast(java_lang_Class::as_Klass(type_mirror));
 191 
 192   if (klass == NULL) {
 193     ResourceMark rm(THREAD);
 194     THROW(vmSymbols::java_lang_InstantiationException());




  99     frame runtime_frame = thread->last_frame();
 100     frame caller_frame = runtime_frame.sender(&reg_map);
 101     Deoptimization::deoptimize_frame(thread, caller_frame.id(), Deoptimization::Reason_constraint);
 102     assert(caller_is_deopted(), "Must be deoptimized");
 103   }
 104 }
 105 
 106 JRT_BLOCK_ENTRY(void, JVMCIRuntime::new_instance(JavaThread* thread, Klass* klass))
 107   JRT_BLOCK;
 108   assert(klass->is_klass(), "not a class");
 109   Handle holder(THREAD, klass->klass_holder()); // keep the klass alive
 110   InstanceKlass* ik = InstanceKlass::cast(klass);
 111   ik->check_valid_for_instantiation(true, CHECK);
 112   // make sure klass is initialized
 113   ik->initialize(CHECK);
 114   // allocate instance and return via TLS
 115   oop obj = ik->allocate_instance(CHECK);
 116   thread->set_vm_result(obj);
 117   JRT_BLOCK_END;
 118 
 119   SharedRuntime::on_slowpath_allocation(thread);


 120 JRT_END
 121 
 122 JRT_BLOCK_ENTRY(void, JVMCIRuntime::new_array(JavaThread* thread, Klass* array_klass, jint length))
 123   JRT_BLOCK;
 124   // Note: no handle for klass needed since they are not used
 125   //       anymore after new_objArray() and no GC can happen before.
 126   //       (This may have to change if this code changes!)
 127   assert(array_klass->is_klass(), "not a class");
 128   oop obj;
 129   if (array_klass->is_typeArray_klass()) {
 130     BasicType elt_type = TypeArrayKlass::cast(array_klass)->element_type();
 131     obj = oopFactory::new_typeArray(elt_type, length, CHECK);
 132   } else {
 133     Handle holder(THREAD, array_klass->klass_holder()); // keep the klass alive
 134     Klass* elem_klass = ObjArrayKlass::cast(array_klass)->element_klass();
 135     obj = oopFactory::new_objArray(elem_klass, length, CHECK);
 136   }
 137   thread->set_vm_result(obj);
 138   // This is pretty rare but this runtime patch is stressful to deoptimization
 139   // if we deoptimize here so force a deopt to stress the path.
 140   if (DeoptimizeALot) {
 141     static int deopts = 0;
 142     // Alternate between deoptimizing and raising an error (which will also cause a deopt)
 143     if (deopts++ % 2 == 0) {
 144       ResourceMark rm(THREAD);
 145       THROW(vmSymbols::java_lang_OutOfMemoryError());
 146     } else {
 147       deopt_caller();
 148     }
 149   }
 150   JRT_BLOCK_END;
 151 
 152   SharedRuntime::on_slowpath_allocation(thread);


 153 JRT_END

















 154 
 155 JRT_ENTRY(void, JVMCIRuntime::new_multi_array(JavaThread* thread, Klass* klass, int rank, jint* dims))
 156   assert(klass->is_klass(), "not a class");
 157   assert(rank >= 1, "rank must be nonzero");
 158   Handle holder(THREAD, klass->klass_holder()); // keep the klass alive
 159   oop obj = ArrayKlass::cast(klass)->multi_allocate(rank, dims, CHECK);
 160   thread->set_vm_result(obj);
 161 JRT_END
 162 
 163 JRT_ENTRY(void, JVMCIRuntime::dynamic_new_array(JavaThread* thread, oopDesc* element_mirror, jint length))
 164   oop obj = Reflection::reflect_new_array(element_mirror, length, CHECK);
 165   thread->set_vm_result(obj);
 166 JRT_END
 167 
 168 JRT_ENTRY(void, JVMCIRuntime::dynamic_new_instance(JavaThread* thread, oopDesc* type_mirror))
 169   InstanceKlass* klass = InstanceKlass::cast(java_lang_Class::as_Klass(type_mirror));
 170 
 171   if (klass == NULL) {
 172     ResourceMark rm(THREAD);
 173     THROW(vmSymbols::java_lang_InstantiationException());


< prev index next >