< prev index next >

src/hotspot/share/code/codeBlob.hpp

Print this page




 125   // Returns the space needed for CodeBlob
 126   static unsigned int allocation_size(CodeBuffer* cb, int header_size);
 127   static unsigned int align_code_offset(int offset);
 128 
 129   // Deletion
 130   virtual void flush();
 131 
 132   // Typing
 133   virtual bool is_buffer_blob() const                 { return false; }
 134   virtual bool is_nmethod() const                     { return false; }
 135   virtual bool is_runtime_stub() const                { return false; }
 136   virtual bool is_deoptimization_stub() const         { return false; }
 137   virtual bool is_uncommon_trap_stub() const          { return false; }
 138   virtual bool is_exception_stub() const              { return false; }
 139   virtual bool is_safepoint_stub() const              { return false; }
 140   virtual bool is_adapter_blob() const                { return false; }
 141   virtual bool is_vtable_blob() const                 { return false; }
 142   virtual bool is_method_handles_adapter_blob() const { return false; }
 143   virtual bool is_aot() const                         { return false; }
 144   virtual bool is_compiled() const                    { return false; }

 145 
 146   inline bool is_compiled_by_c1() const    { return _type == compiler_c1; };
 147   inline bool is_compiled_by_c2() const    { return _type == compiler_c2; };
 148   inline bool is_compiled_by_jvmci() const { return _type == compiler_jvmci; };
 149   const char* compiler_name() const;
 150 
 151   // Casting
 152   nmethod* as_nmethod_or_null()                { return is_nmethod() ? (nmethod*) this : NULL; }
 153   nmethod* as_nmethod()                        { assert(is_nmethod(), "must be nmethod"); return (nmethod*) this; }
 154   CompiledMethod* as_compiled_method_or_null() { return is_compiled() ? (CompiledMethod*) this : NULL; }
 155   CompiledMethod* as_compiled_method()         { assert(is_compiled(), "must be compiled"); return (CompiledMethod*) this; }
 156   CodeBlob* as_codeblob_or_null() const        { return (CodeBlob*) this; }
 157 
 158   // Boundaries
 159   address header_begin() const        { return (address) this; }
 160   relocInfo* relocation_begin() const { return (relocInfo*) _relocation_begin; };
 161   relocInfo* relocation_end() const   { return (relocInfo*) _relocation_end; }
 162   address content_begin() const       { return _content_begin; }
 163   address content_end() const         { return _code_end; } // _code_end == _content_end is true for all types of blobs for now, it is also checked in the constructor
 164   address code_begin() const          { return _code_begin;    }


 377   // OopMap for frame
 378   virtual void preserve_callee_argument_oops(frame fr, const RegisterMap* reg_map, OopClosure* f)  { ShouldNotReachHere(); }
 379 
 380   // Debugging
 381   virtual void print_on(outputStream* st) const { CodeBlob::print_on(st); }
 382   virtual void print_value_on(outputStream* st) const { CodeBlob::print_value_on(st); }
 383 
 384   // Deal with Disassembler, VTune, Forte, JvmtiExport, MemoryService.
 385   static void trace_new_stub(RuntimeBlob* blob, const char* name1, const char* name2 = "");
 386 };
 387 
 388 class WhiteBox;
 389 //----------------------------------------------------------------------------------------------------
 390 // BufferBlob: used to hold non-relocatable machine code such as the interpreter, stubroutines, etc.
 391 
 392 class BufferBlob: public RuntimeBlob {
 393   friend class VMStructs;
 394   friend class AdapterBlob;
 395   friend class VtableBlob;
 396   friend class MethodHandlesAdapterBlob;

 397   friend class WhiteBox;
 398 
 399  private:
 400   // Creation support
 401   BufferBlob(const char* name, int size);
 402   BufferBlob(const char* name, int size, CodeBuffer* cb);

 403 
 404   // This ordinary operator delete is needed even though not used, so the
 405   // below two-argument operator delete will be treated as a placement
 406   // delete rather than an ordinary sized delete; see C++14 3.7.4.2/p2.
 407   void operator delete(void* p);
 408   void* operator new(size_t s, unsigned size) throw();
 409 
 410  public:
 411   // Creation
 412   static BufferBlob* create(const char* name, int buffer_size);
 413   static BufferBlob* create(const char* name, CodeBuffer* cb);
 414 
 415   static void free(BufferBlob* buf);
 416 
 417   // Typing
 418   virtual bool is_buffer_blob() const            { return true; }
 419 
 420   // GC/Verification support
 421   void preserve_callee_argument_oops(frame fr, const RegisterMap* reg_map, OopClosure* f)  { /* nothing to do */ }
 422   bool is_alive() const                          { return true; }
 423 
 424   void verify();
 425   void print_on(outputStream* st) const;
 426   void print_value_on(outputStream* st) const;
 427 };
 428 
 429 
 430 //----------------------------------------------------------------------------------------------------
 431 // AdapterBlob: used to hold C2I/I2C adapters
 432 
 433 class AdapterBlob: public BufferBlob {
 434 private:
 435   AdapterBlob(int size, CodeBuffer* cb);
 436 
 437 public:
 438   // Creation
 439   static AdapterBlob* create(CodeBuffer* cb);




 440 
 441   // Typing
 442   virtual bool is_adapter_blob() const { return true; }


 443 };
 444 
 445 //---------------------------------------------------------------------------------------------------
 446 class VtableBlob: public BufferBlob {
 447 private:
 448   VtableBlob(const char*, int);
 449 
 450 public:
 451   // Creation
 452   static VtableBlob* create(const char* name, int buffer_size);
 453 
 454   // Typing
 455   virtual bool is_vtable_blob() const { return true; }
 456 };
 457 
 458 //----------------------------------------------------------------------------------------------------
 459 // MethodHandlesAdapterBlob: used to hold MethodHandles adapters
 460 
 461 class MethodHandlesAdapterBlob: public BufferBlob {
 462 private:
 463   MethodHandlesAdapterBlob(int size)                 : BufferBlob("MethodHandles adapters", size) {}
 464 
 465 public:
 466   // Creation
 467   static MethodHandlesAdapterBlob* create(int buffer_size);
 468 
 469   // Typing
 470   virtual bool is_method_handles_adapter_blob() const { return true; }
 471 };
 472 




















 473 
 474 //----------------------------------------------------------------------------------------------------
 475 // RuntimeStub: describes stubs used by compiled code to call a (static) C++ runtime routine
 476 
 477 class RuntimeStub: public RuntimeBlob {
 478   friend class VMStructs;
 479  private:
 480   // Creation support
 481   RuntimeStub(
 482     const char* name,
 483     CodeBuffer* cb,
 484     int         size,
 485     int         frame_complete,
 486     int         frame_size,
 487     OopMapSet*  oop_maps,
 488     bool        caller_must_gc_arguments
 489   );
 490 
 491   // This ordinary operator delete is needed even though not used, so the
 492   // below two-argument operator delete will be treated as a placement




 125   // Returns the space needed for CodeBlob
 126   static unsigned int allocation_size(CodeBuffer* cb, int header_size);
 127   static unsigned int align_code_offset(int offset);
 128 
 129   // Deletion
 130   virtual void flush();
 131 
 132   // Typing
 133   virtual bool is_buffer_blob() const                 { return false; }
 134   virtual bool is_nmethod() const                     { return false; }
 135   virtual bool is_runtime_stub() const                { return false; }
 136   virtual bool is_deoptimization_stub() const         { return false; }
 137   virtual bool is_uncommon_trap_stub() const          { return false; }
 138   virtual bool is_exception_stub() const              { return false; }
 139   virtual bool is_safepoint_stub() const              { return false; }
 140   virtual bool is_adapter_blob() const                { return false; }
 141   virtual bool is_vtable_blob() const                 { return false; }
 142   virtual bool is_method_handles_adapter_blob() const { return false; }
 143   virtual bool is_aot() const                         { return false; }
 144   virtual bool is_compiled() const                    { return false; }
 145   virtual bool is_buffered_value_type_blob() const    { return false; }
 146 
 147   inline bool is_compiled_by_c1() const    { return _type == compiler_c1; };
 148   inline bool is_compiled_by_c2() const    { return _type == compiler_c2; };
 149   inline bool is_compiled_by_jvmci() const { return _type == compiler_jvmci; };
 150   const char* compiler_name() const;
 151 
 152   // Casting
 153   nmethod* as_nmethod_or_null()                { return is_nmethod() ? (nmethod*) this : NULL; }
 154   nmethod* as_nmethod()                        { assert(is_nmethod(), "must be nmethod"); return (nmethod*) this; }
 155   CompiledMethod* as_compiled_method_or_null() { return is_compiled() ? (CompiledMethod*) this : NULL; }
 156   CompiledMethod* as_compiled_method()         { assert(is_compiled(), "must be compiled"); return (CompiledMethod*) this; }
 157   CodeBlob* as_codeblob_or_null() const        { return (CodeBlob*) this; }
 158 
 159   // Boundaries
 160   address header_begin() const        { return (address) this; }
 161   relocInfo* relocation_begin() const { return (relocInfo*) _relocation_begin; };
 162   relocInfo* relocation_end() const   { return (relocInfo*) _relocation_end; }
 163   address content_begin() const       { return _content_begin; }
 164   address content_end() const         { return _code_end; } // _code_end == _content_end is true for all types of blobs for now, it is also checked in the constructor
 165   address code_begin() const          { return _code_begin;    }


 378   // OopMap for frame
 379   virtual void preserve_callee_argument_oops(frame fr, const RegisterMap* reg_map, OopClosure* f)  { ShouldNotReachHere(); }
 380 
 381   // Debugging
 382   virtual void print_on(outputStream* st) const { CodeBlob::print_on(st); }
 383   virtual void print_value_on(outputStream* st) const { CodeBlob::print_value_on(st); }
 384 
 385   // Deal with Disassembler, VTune, Forte, JvmtiExport, MemoryService.
 386   static void trace_new_stub(RuntimeBlob* blob, const char* name1, const char* name2 = "");
 387 };
 388 
 389 class WhiteBox;
 390 //----------------------------------------------------------------------------------------------------
 391 // BufferBlob: used to hold non-relocatable machine code such as the interpreter, stubroutines, etc.
 392 
 393 class BufferBlob: public RuntimeBlob {
 394   friend class VMStructs;
 395   friend class AdapterBlob;
 396   friend class VtableBlob;
 397   friend class MethodHandlesAdapterBlob;
 398   friend class BufferedValueTypeBlob;
 399   friend class WhiteBox;
 400 
 401  private:
 402   // Creation support
 403   BufferBlob(const char* name, int size);
 404   BufferBlob(const char* name, int size, CodeBuffer* cb);
 405   BufferBlob(const char* name, int size, CodeBuffer* cb, int frame_complete, int frame_size, OopMapSet* oop_maps, bool caller_must_gc_arguments = false);
 406 
 407   // This ordinary operator delete is needed even though not used, so the
 408   // below two-argument operator delete will be treated as a placement
 409   // delete rather than an ordinary sized delete; see C++14 3.7.4.2/p2.
 410   void operator delete(void* p);
 411   void* operator new(size_t s, unsigned size) throw();
 412 
 413  public:
 414   // Creation
 415   static BufferBlob* create(const char* name, int buffer_size);
 416   static BufferBlob* create(const char* name, CodeBuffer* cb);
 417 
 418   static void free(BufferBlob* buf);
 419 
 420   // Typing
 421   virtual bool is_buffer_blob() const            { return true; }
 422 
 423   // GC/Verification support
 424   void preserve_callee_argument_oops(frame fr, const RegisterMap* reg_map, OopClosure* f)  { /* nothing to do */ }
 425   bool is_alive() const                          { return true; }
 426 
 427   void verify();
 428   void print_on(outputStream* st) const;
 429   void print_value_on(outputStream* st) const;
 430 };
 431 
 432 
 433 //----------------------------------------------------------------------------------------------------
 434 // AdapterBlob: used to hold C2I/I2C adapters
 435 
 436 class AdapterBlob: public BufferBlob {
 437 private:
 438   AdapterBlob(int size, CodeBuffer* cb, int frame_complete, int frame_size, OopMapSet* oop_maps, bool caller_must_gc_arguments = false);
 439 
 440 public:
 441   // Creation
 442   static AdapterBlob* create(CodeBuffer* cb,
 443                              int frame_complete,
 444                              int frame_size,
 445                              OopMapSet* oop_maps,
 446                              bool caller_must_gc_arguments = false);
 447 
 448   // Typing
 449   virtual bool is_adapter_blob() const { return true; }
 450 
 451   bool caller_must_gc_arguments(JavaThread* thread) const { return true; }
 452 };
 453 
 454 //---------------------------------------------------------------------------------------------------
 455 class VtableBlob: public BufferBlob {
 456 private:
 457   VtableBlob(const char*, int);
 458 
 459 public:
 460   // Creation
 461   static VtableBlob* create(const char* name, int buffer_size);
 462 
 463   // Typing
 464   virtual bool is_vtable_blob() const { return true; }
 465 };
 466 
 467 //----------------------------------------------------------------------------------------------------
 468 // MethodHandlesAdapterBlob: used to hold MethodHandles adapters
 469 
 470 class MethodHandlesAdapterBlob: public BufferBlob {
 471 private:
 472   MethodHandlesAdapterBlob(int size)                 : BufferBlob("MethodHandles adapters", size) {}
 473 
 474 public:
 475   // Creation
 476   static MethodHandlesAdapterBlob* create(int buffer_size);
 477 
 478   // Typing
 479   virtual bool is_method_handles_adapter_blob() const { return true; }
 480 };
 481 
 482 //----------------------------------------------------------------------------------------------------
 483 // BufferedValueTypeBlob : used for pack/unpack handlers
 484 
 485 class BufferedValueTypeBlob: public BufferBlob {
 486 private:
 487   const int _pack_fields_off;
 488   const int _unpack_fields_off;
 489 
 490   BufferedValueTypeBlob(int size, CodeBuffer* cb, int pack_fields_off, int unpack_fields_off);
 491 
 492 public:
 493   // Creation
 494   static BufferedValueTypeBlob* create(CodeBuffer* cb, int pack_fields_off, int unpack_fields_off);
 495 
 496   address pack_fields() const { return code_begin() + _pack_fields_off; }
 497   address unpack_fields() const { return code_begin() + _unpack_fields_off; }
 498 
 499   // Typing
 500   virtual bool is_buffered_value_type_blob() const { return true; }
 501 };
 502 
 503 //----------------------------------------------------------------------------------------------------
 504 // RuntimeStub: describes stubs used by compiled code to call a (static) C++ runtime routine
 505 
 506 class RuntimeStub: public RuntimeBlob {
 507   friend class VMStructs;
 508  private:
 509   // Creation support
 510   RuntimeStub(
 511     const char* name,
 512     CodeBuffer* cb,
 513     int         size,
 514     int         frame_complete,
 515     int         frame_size,
 516     OopMapSet*  oop_maps,
 517     bool        caller_must_gc_arguments
 518   );
 519 
 520   // This ordinary operator delete is needed even though not used, so the
 521   // below two-argument operator delete will be treated as a placement


< prev index next >