< prev index next >

src/share/vm/jvmci/jvmciCodeInstaller.hpp

Print this page




  90  */
  91 class CodeInstaller : public StackObj {
  92   friend class VMStructs;
  93 private:
  94   enum MarkId {
  95     VERIFIED_ENTRY             = 1,
  96     UNVERIFIED_ENTRY           = 2,
  97     OSR_ENTRY                  = 3,
  98     EXCEPTION_HANDLER_ENTRY    = 4,
  99     DEOPT_HANDLER_ENTRY        = 5,
 100     INVOKEINTERFACE            = 6,
 101     INVOKEVIRTUAL              = 7,
 102     INVOKESTATIC               = 8,
 103     INVOKESPECIAL              = 9,
 104     INLINE_INVOKE              = 10,
 105     POLL_NEAR                  = 11,
 106     POLL_RETURN_NEAR           = 12,
 107     POLL_FAR                   = 13,
 108     POLL_RETURN_FAR            = 14,
 109     CARD_TABLE_ADDRESS         = 15,
 110     HEAP_TOP_ADDRESS           = 16,
 111     HEAP_END_ADDRESS           = 17,
 112     NARROW_KLASS_BASE_ADDRESS  = 18,
 113     CRC_TABLE_ADDRESS          = 19,

 114     INVOKE_INVALID             = -1
 115   };
 116 
 117   Arena         _arena;
 118 
 119   jobject       _data_section_handle;
 120   jobject       _data_section_patches_handle;
 121   jobject       _sites_handle;
 122   jobject       _exception_handlers_handle;
 123   CodeOffsets   _offsets;
 124 
 125   jobject       _code_handle;
 126   jint          _code_size;
 127   jint          _total_frame_size;
 128   jint          _custom_stack_area_offset;
 129   jint          _parameter_count;
 130   jint          _constants_size;
 131 #ifndef PRODUCT
 132   jobject       _comments_handle;
 133 #endif


 138   MarkId        _next_call_type;
 139   address       _invoke_mark_pc;
 140 
 141   CodeSection*  _instructions;
 142   CodeSection*  _constants;
 143 
 144   OopRecorder*              _oop_recorder;
 145   DebugInformationRecorder* _debug_recorder;
 146   Dependencies*             _dependencies;
 147   ExceptionHandlerTable     _exception_handler_table;
 148 
 149   static ConstantOopWriteValue* _oop_null_scope_value;
 150   static ConstantIntValue*    _int_m1_scope_value;
 151   static ConstantIntValue*    _int_0_scope_value;
 152   static ConstantIntValue*    _int_1_scope_value;
 153   static ConstantIntValue*    _int_2_scope_value;
 154   static LocationValue*       _illegal_value;
 155 
 156   jint pd_next_offset(NativeInstruction* inst, jint pc_offset, oop method);
 157   void pd_patch_OopConstant(int pc_offset, Handle& constant);

 158   void pd_patch_DataSectionReference(int pc_offset, int data_offset);
 159   void pd_relocate_CodeBlob(CodeBlob* cb, NativeInstruction* inst);
 160   void pd_relocate_ForeignCall(NativeInstruction* inst, jlong foreign_call_destination);
 161   void pd_relocate_JavaMethod(oop method, jint pc_offset);
 162   void pd_relocate_poll(address pc, jint mark);
 163 
 164   objArrayOop sites() { return (objArrayOop) JNIHandles::resolve(_sites_handle); }
 165   arrayOop code() { return (arrayOop) JNIHandles::resolve(_code_handle); }
 166   arrayOop data_section() { return (arrayOop) JNIHandles::resolve(_data_section_handle); }
 167   objArrayOop data_section_patches() { return (objArrayOop) JNIHandles::resolve(_data_section_patches_handle); }
 168   objArrayOop exception_handlers() { return (objArrayOop) JNIHandles::resolve(_exception_handlers_handle); }
 169 #ifndef PRODUCT
 170   objArrayOop comments() { return (objArrayOop) JNIHandles::resolve(_comments_handle); }
 171 #endif
 172 
 173   void record_resolved(oop obj);
 174 
 175   oop word_kind() { return (oop) JNIHandles::resolve(_word_kind_handle); }
 176 
 177 public:

 178   CodeInstaller() : _arena(mtCompiler) {}
 179 
 180   JVMCIEnv::CodeInstallResult gather_metadata(Handle target, Handle& compiled_code, CodeMetadata& metadata);
 181   JVMCIEnv::CodeInstallResult install(JVMCICompiler* compiler, Handle target, Handle& compiled_code, CodeBlob*& cb, Handle installed_code, Handle speculation_log);
 182 
 183   static address runtime_call_target_address(oop runtime_call);
 184   static VMReg get_hotspot_reg(jint jvmciRegisterNumber);
 185   static bool is_general_purpose_reg(VMReg hotspotRegister);
 186 
 187   const OopMapSet* oopMapSet() const { return _debug_recorder->_oopmaps; }
 188 
 189 protected:
 190   Location::Type get_oop_type(oop value);
 191   ScopeValue* get_scope_value(oop value, BasicType type, GrowableArray<ScopeValue*>* objects, ScopeValue* &second);
 192   MonitorValue* get_monitor_value(oop value, GrowableArray<ScopeValue*>* objects);
 193 





 194   // extract the fields of the CompilationResult
 195   void initialize_fields(oop target, oop target_method);
 196   void initialize_dependencies(oop target_method, OopRecorder* oop_recorder);
 197 
 198   int estimate_stubs_size();
 199 
 200   // perform data and call relocation on the CodeBuffer
 201   JVMCIEnv::CodeInstallResult initialize_buffer(CodeBuffer& buffer);
 202 
 203   void assumption_NoFinalizableSubclass(Handle assumption);
 204   void assumption_ConcreteSubtype(Handle assumption);
 205   void assumption_LeafType(Handle assumption);
 206   void assumption_ConcreteMethod(Handle assumption);
 207   void assumption_CallSiteTargetValue(Handle assumption);
 208 
 209   void site_Safepoint(CodeBuffer& buffer, jint pc_offset, oop site);
 210   void site_Infopoint(CodeBuffer& buffer, jint pc_offset, oop site);
 211   void site_Call(CodeBuffer& buffer, jint pc_offset, oop site);
 212   void site_DataPatch(CodeBuffer& buffer, jint pc_offset, oop site);
 213   void site_Mark(CodeBuffer& buffer, jint pc_offset, oop site);




  90  */
  91 class CodeInstaller : public StackObj {
  92   friend class VMStructs;
  93 private:
  94   enum MarkId {
  95     VERIFIED_ENTRY             = 1,
  96     UNVERIFIED_ENTRY           = 2,
  97     OSR_ENTRY                  = 3,
  98     EXCEPTION_HANDLER_ENTRY    = 4,
  99     DEOPT_HANDLER_ENTRY        = 5,
 100     INVOKEINTERFACE            = 6,
 101     INVOKEVIRTUAL              = 7,
 102     INVOKESTATIC               = 8,
 103     INVOKESPECIAL              = 9,
 104     INLINE_INVOKE              = 10,
 105     POLL_NEAR                  = 11,
 106     POLL_RETURN_NEAR           = 12,
 107     POLL_FAR                   = 13,
 108     POLL_RETURN_FAR            = 14,
 109     CARD_TABLE_ADDRESS         = 15,
 110     CARD_TABLE_SHIFT           = 16,
 111     HEAP_TOP_ADDRESS           = 17,
 112     HEAP_END_ADDRESS           = 18,
 113     NARROW_KLASS_BASE_ADDRESS  = 19,
 114     CRC_TABLE_ADDRESS          = 20,
 115     INVOKE_INVALID             = -1
 116   };
 117 
 118   Arena         _arena;
 119 
 120   jobject       _data_section_handle;
 121   jobject       _data_section_patches_handle;
 122   jobject       _sites_handle;
 123   jobject       _exception_handlers_handle;
 124   CodeOffsets   _offsets;
 125 
 126   jobject       _code_handle;
 127   jint          _code_size;
 128   jint          _total_frame_size;
 129   jint          _custom_stack_area_offset;
 130   jint          _parameter_count;
 131   jint          _constants_size;
 132 #ifndef PRODUCT
 133   jobject       _comments_handle;
 134 #endif


 139   MarkId        _next_call_type;
 140   address       _invoke_mark_pc;
 141 
 142   CodeSection*  _instructions;
 143   CodeSection*  _constants;
 144 
 145   OopRecorder*              _oop_recorder;
 146   DebugInformationRecorder* _debug_recorder;
 147   Dependencies*             _dependencies;
 148   ExceptionHandlerTable     _exception_handler_table;
 149 
 150   static ConstantOopWriteValue* _oop_null_scope_value;
 151   static ConstantIntValue*    _int_m1_scope_value;
 152   static ConstantIntValue*    _int_0_scope_value;
 153   static ConstantIntValue*    _int_1_scope_value;
 154   static ConstantIntValue*    _int_2_scope_value;
 155   static LocationValue*       _illegal_value;
 156 
 157   jint pd_next_offset(NativeInstruction* inst, jint pc_offset, oop method);
 158   void pd_patch_OopConstant(int pc_offset, Handle& constant);
 159   void pd_patch_MetaspaceConstant(int pc_offset, Handle& constant);
 160   void pd_patch_DataSectionReference(int pc_offset, int data_offset);

 161   void pd_relocate_ForeignCall(NativeInstruction* inst, jlong foreign_call_destination);
 162   void pd_relocate_JavaMethod(oop method, jint pc_offset);
 163   void pd_relocate_poll(address pc, jint mark);
 164 
 165   objArrayOop sites() { return (objArrayOop) JNIHandles::resolve(_sites_handle); }
 166   arrayOop code() { return (arrayOop) JNIHandles::resolve(_code_handle); }
 167   arrayOop data_section() { return (arrayOop) JNIHandles::resolve(_data_section_handle); }
 168   objArrayOop data_section_patches() { return (objArrayOop) JNIHandles::resolve(_data_section_patches_handle); }
 169   objArrayOop exception_handlers() { return (objArrayOop) JNIHandles::resolve(_exception_handlers_handle); }
 170 #ifndef PRODUCT
 171   objArrayOop comments() { return (objArrayOop) JNIHandles::resolve(_comments_handle); }
 172 #endif
 173 


 174   oop word_kind() { return (oop) JNIHandles::resolve(_word_kind_handle); }
 175 
 176 public:
 177 
 178   CodeInstaller() : _arena(mtCompiler) {}
 179 
 180   JVMCIEnv::CodeInstallResult gather_metadata(Handle target, Handle& compiled_code, CodeMetadata& metadata);
 181   JVMCIEnv::CodeInstallResult install(JVMCICompiler* compiler, Handle target, Handle& compiled_code, CodeBlob*& cb, Handle installed_code, Handle speculation_log);
 182 
 183   static address runtime_call_target_address(oop runtime_call);
 184   static VMReg get_hotspot_reg(jint jvmciRegisterNumber);
 185   static bool is_general_purpose_reg(VMReg hotspotRegister);
 186 
 187   const OopMapSet* oopMapSet() const { return _debug_recorder->_oopmaps; }
 188 
 189 protected:
 190   Location::Type get_oop_type(oop value);
 191   ScopeValue* get_scope_value(oop value, BasicType type, GrowableArray<ScopeValue*>* objects, ScopeValue* &second);
 192   MonitorValue* get_monitor_value(oop value, GrowableArray<ScopeValue*>* objects);
 193 
 194   Metadata* record_metadata_reference(Handle& constant);
 195 #ifdef _LP64
 196   narrowKlass record_narrow_metadata_reference(Handle& constant);
 197 #endif
 198 
 199   // extract the fields of the CompilationResult
 200   void initialize_fields(oop target, oop target_method);
 201   void initialize_dependencies(oop target_method, OopRecorder* oop_recorder);
 202 
 203   int estimate_stubs_size();
 204 
 205   // perform data and call relocation on the CodeBuffer
 206   JVMCIEnv::CodeInstallResult initialize_buffer(CodeBuffer& buffer);
 207 
 208   void assumption_NoFinalizableSubclass(Handle assumption);
 209   void assumption_ConcreteSubtype(Handle assumption);
 210   void assumption_LeafType(Handle assumption);
 211   void assumption_ConcreteMethod(Handle assumption);
 212   void assumption_CallSiteTargetValue(Handle assumption);
 213 
 214   void site_Safepoint(CodeBuffer& buffer, jint pc_offset, oop site);
 215   void site_Infopoint(CodeBuffer& buffer, jint pc_offset, oop site);
 216   void site_Call(CodeBuffer& buffer, jint pc_offset, oop site);
 217   void site_DataPatch(CodeBuffer& buffer, jint pc_offset, oop site);
 218   void site_Mark(CodeBuffer& buffer, jint pc_offset, oop site);


< prev index next >