< prev index next >

src/hotspot/share/aot/aotCompiledMethod.hpp

Print this page




 101         relocation_begin, // relocation_begin
 102         relocation_end
 103         ) {
 104     }
 105 };
 106 
 107 class AOTCompiledMethod : public CompiledMethod, public CHeapObj<mtCode> {
 108 private:
 109   address       _code;
 110   aot_metadata* _meta;
 111   Metadata**    _metadata_got;
 112   jlong*        _state_adr; // Address of cell to indicate aot method state (in_use or not_entrant)
 113   AOTCodeHeap*  _heap;    // code heap which has this method
 114   const char*   _name;    // For stub: "AOT Stub<name>" for stub,
 115                           // For nmethod: "<u2_size>Ljava/lang/ThreadGroup;<u2_size>addUnstarted<u2_size>()V"
 116   const int _metadata_size; // size of _metadata_got
 117   const int _aot_id;
 118   const int _method_index;
 119   oop _oop;  // method()->method_holder()->klass_holder()
 120 
 121   address* orig_pc_addr(const frame* fr);
 122   bool make_not_entrant_helper(int new_state);
 123 
 124  public:
 125   using CHeapObj<mtCode>::operator new;
 126   using CHeapObj<mtCode>::operator delete;
 127 
 128   int method_index() const { return _method_index; }
 129   void set_oop(oop o) { _oop = o; }
 130 
 131   AOTCompiledMethod(address code, Method* method, aot_metadata* meta, address metadata_got, int metadata_size, jlong* state_adr, AOTCodeHeap* heap, const char* name, int method_index, int aot_id) :
 132     CompiledMethod(method, name, compiler_jvmci, // AOT code is generated by JVMCI compiler
 133         AOTCompiledMethodLayout(code, code + meta->code_size(), (address) meta->relocation_begin(), (address) meta->relocation_end()),
 134         0 /* frame_complete_offset */, meta->frame_size() /* frame_size */, meta->oopmap_set(), false /* caller_must_gc_arguments */),

 135     _code(code),
 136     _meta(meta),
 137     _metadata_got((Metadata**) metadata_got),
 138     _state_adr(state_adr),
 139     _heap(heap),
 140     _name(name),
 141     _metadata_size(metadata_size),
 142     _aot_id(aot_id),
 143     _method_index(method_index) {
 144 
 145     _is_far_code = CodeCache::is_far_target(code) ||
 146                    CodeCache::is_far_target(code + meta->code_size());
 147     _exception_cache = NULL;
 148 
 149     _scopes_data_begin = (address) _meta->scopes_data_begin();
 150     _deopt_handler_begin = (address) _code + _meta->deopt_handler_offset();
 151     _deopt_mh_handler_begin = (address) this;
 152 
 153     _pc_desc_container.reset_to(scopes_pcs_begin());
 154 
 155     // Mark the AOTCompiledMethod as in_use
 156     *_state_adr = nmethod::in_use;
 157     set_has_unsafe_access(_meta->has_unsafe_access());
 158     _oop = NULL;
 159   }
 160 
 161   virtual bool is_aot() const { return true; }
 162   virtual bool is_runtime_stub() const { return is_aot_runtime_stub(); }
 163 
 164   virtual bool is_compiled() const     { return !is_aot_runtime_stub(); }
 165 
 166   virtual bool is_locked_by_vm() const { return false; }
 167 
 168   int state() const { return *_state_adr; }
 169 
 170   // Non-virtual for speed
 171   bool _is_alive() const { return state() < unloaded; }
 172 
 173   virtual bool is_zombie() const { return state() == zombie; }
 174   virtual bool is_unloaded() const { return state() == unloaded; }
 175   virtual bool is_not_entrant() const { return state() == not_entrant ||
 176                                                  state() == not_used; }
 177   virtual bool is_alive() const { return _is_alive(); }
 178   virtual bool is_in_use() const { return state() == in_use; }
 179 
 180   virtual bool is_unloading() { return false; }
 181 
 182   address exception_begin() const { return (address) _code + _meta->exception_handler_offset(); }
 183 
 184   virtual const char* name() const { return _name; }
 185 


 219   virtual Metadata* metadata_at(int index) const;
 220 
 221   virtual PcDesc* scopes_pcs_begin() const { return _meta->scopes_pcs_begin(); }
 222   virtual PcDesc* scopes_pcs_end() const { return _meta->scopes_pcs_end(); }
 223 
 224   virtual address handler_table_begin() const { return _meta->handler_table_begin(); }
 225   virtual address handler_table_end() const { return _meta->handler_table_end(); }
 226 
 227   virtual address nul_chk_table_begin() const { return _meta->nul_chk_table_begin(); }
 228   virtual address nul_chk_table_end() const { return _meta->nul_chk_table_end(); }
 229 
 230   virtual address consts_begin() const { return _meta->consts_begin(); }
 231   virtual address consts_end() const { return _meta->consts_end(); }
 232 
 233   virtual address stub_begin() const { return code_begin() + _meta->stub_offset(); }
 234   virtual address stub_end() const { return code_end(); }
 235 
 236   virtual oop* oop_addr_at(int index) const { ShouldNotReachHere(); return NULL; }
 237   virtual Metadata** metadata_addr_at(int index) const { ShouldNotReachHere(); return NULL; }
 238 
 239   // Accessor/mutator for the original pc of a frame before a frame was deopted.
 240   address get_original_pc(const frame* fr) { return *orig_pc_addr(fr); }
 241   void    set_original_pc(const frame* fr, address pc) { *orig_pc_addr(fr) = pc; }
 242 
 243   virtual void metadata_do(MetadataClosure* f);
 244 


 245   bool metadata_got_contains(Metadata **p) {
 246     return p >= &_metadata_got[0] && p < &_metadata_got[_metadata_size];
 247   }
 248 
 249   Metadata** metadata_begin() const { return &_metadata_got[0] ; }
 250   Metadata** metadata_end()   const { return &_metadata_got[_metadata_size] ; }
 251   const char* compile_kind() const { return "AOT"; }
 252 
 253   int get_state() const {
 254     return (int) (*_state_adr);
 255   }
 256 
 257   // inlined and non-virtual for AOTCodeHeap::oops_do
 258   void do_oops(OopClosure* f) {
 259     assert(_is_alive(), "");
 260     if (_oop != NULL) {
 261       f->do_oop(&_oop);
 262     }
 263 #if 0
 264     metadata_oops_do(metadata_begin(), metadata_end(), f);




 101         relocation_begin, // relocation_begin
 102         relocation_end
 103         ) {
 104     }
 105 };
 106 
 107 class AOTCompiledMethod : public CompiledMethod, public CHeapObj<mtCode> {
 108 private:
 109   address       _code;
 110   aot_metadata* _meta;
 111   Metadata**    _metadata_got;
 112   jlong*        _state_adr; // Address of cell to indicate aot method state (in_use or not_entrant)
 113   AOTCodeHeap*  _heap;    // code heap which has this method
 114   const char*   _name;    // For stub: "AOT Stub<name>" for stub,
 115                           // For nmethod: "<u2_size>Ljava/lang/ThreadGroup;<u2_size>addUnstarted<u2_size>()V"
 116   const int _metadata_size; // size of _metadata_got
 117   const int _aot_id;
 118   const int _method_index;
 119   oop _oop;  // method()->method_holder()->klass_holder()
 120 

 121   bool make_not_entrant_helper(int new_state);
 122 
 123  public:
 124   using CHeapObj<mtCode>::operator new;
 125   using CHeapObj<mtCode>::operator delete;
 126 
 127   int method_index() const { return _method_index; }
 128   void set_oop(oop o) { _oop = o; }
 129 
 130   AOTCompiledMethod(address code, Method* method, aot_metadata* meta, address metadata_got, int metadata_size, jlong* state_adr, AOTCodeHeap* heap, const char* name, int method_index, int aot_id) :
 131     CompiledMethod(method, name, compiler_jvmci, // AOT code is generated by JVMCI compiler
 132         AOTCompiledMethodLayout(code, code + meta->code_size(), (address) meta->relocation_begin(), (address) meta->relocation_end()),
 133         0 /* frame_complete_offset */, meta->frame_size() /* frame_size */, meta->oopmap_set(), false /* caller_must_gc_arguments */,
 134         method != NULL /* compiled */),
 135     _code(code),
 136     _meta(meta),
 137     _metadata_got((Metadata**) metadata_got),
 138     _state_adr(state_adr),
 139     _heap(heap),
 140     _name(name),
 141     _metadata_size(metadata_size),
 142     _aot_id(aot_id),
 143     _method_index(method_index) {
 144 
 145     _is_far_code = CodeCache::is_far_target(code) ||
 146                    CodeCache::is_far_target(code + meta->code_size());
 147     _exception_cache = NULL;
 148 
 149     _scopes_data_begin = (address) _meta->scopes_data_begin();
 150     _deopt_handler_begin = (address) _code + _meta->deopt_handler_offset();
 151     _deopt_mh_handler_begin = (address) this;
 152 
 153     _pc_desc_container.reset_to(scopes_pcs_begin());
 154 
 155     // Mark the AOTCompiledMethod as in_use
 156     *_state_adr = nmethod::in_use;
 157     set_has_unsafe_access(_meta->has_unsafe_access());
 158     _oop = NULL;
 159   }
 160 
 161   virtual bool is_aot() const { return true; }
 162   virtual bool is_runtime_stub() const { return is_aot_runtime_stub(); }
 163 


 164   virtual bool is_locked_by_vm() const { return false; }
 165 
 166   int state() const { return *_state_adr; }
 167 
 168   // Non-virtual for speed
 169   bool _is_alive() const { return state() < unloaded; }
 170 
 171   virtual bool is_zombie() const { return state() == zombie; }
 172   virtual bool is_unloaded() const { return state() == unloaded; }
 173   virtual bool is_not_entrant() const { return state() == not_entrant ||
 174                                                  state() == not_used; }
 175   virtual bool is_alive() const { return _is_alive(); }
 176   virtual bool is_in_use() const { return state() == in_use; }
 177 
 178   virtual bool is_unloading() { return false; }
 179 
 180   address exception_begin() const { return (address) _code + _meta->exception_handler_offset(); }
 181 
 182   virtual const char* name() const { return _name; }
 183 


 217   virtual Metadata* metadata_at(int index) const;
 218 
 219   virtual PcDesc* scopes_pcs_begin() const { return _meta->scopes_pcs_begin(); }
 220   virtual PcDesc* scopes_pcs_end() const { return _meta->scopes_pcs_end(); }
 221 
 222   virtual address handler_table_begin() const { return _meta->handler_table_begin(); }
 223   virtual address handler_table_end() const { return _meta->handler_table_end(); }
 224 
 225   virtual address nul_chk_table_begin() const { return _meta->nul_chk_table_begin(); }
 226   virtual address nul_chk_table_end() const { return _meta->nul_chk_table_end(); }
 227 
 228   virtual address consts_begin() const { return _meta->consts_begin(); }
 229   virtual address consts_end() const { return _meta->consts_end(); }
 230 
 231   virtual address stub_begin() const { return code_begin() + _meta->stub_offset(); }
 232   virtual address stub_end() const { return code_end(); }
 233 
 234   virtual oop* oop_addr_at(int index) const { ShouldNotReachHere(); return NULL; }
 235   virtual Metadata** metadata_addr_at(int index) const { ShouldNotReachHere(); return NULL; }
 236 




 237   virtual void metadata_do(MetadataClosure* f);
 238 
 239   int orig_pc_offset() { return _meta->orig_pc_offset(); }
 240   
 241   bool metadata_got_contains(Metadata **p) {
 242     return p >= &_metadata_got[0] && p < &_metadata_got[_metadata_size];
 243   }
 244 
 245   Metadata** metadata_begin() const { return &_metadata_got[0] ; }
 246   Metadata** metadata_end()   const { return &_metadata_got[_metadata_size] ; }
 247   const char* compile_kind() const { return "AOT"; }
 248 
 249   int get_state() const {
 250     return (int) (*_state_adr);
 251   }
 252 
 253   // inlined and non-virtual for AOTCodeHeap::oops_do
 254   void do_oops(OopClosure* f) {
 255     assert(_is_alive(), "");
 256     if (_oop != NULL) {
 257       f->do_oop(&_oop);
 258     }
 259 #if 0
 260     metadata_oops_do(metadata_begin(), metadata_end(), f);


< prev index next >