< prev index next >

src/hotspot/share/code/codeBlob.hpp

Print this page

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

151   virtual bool is_optimized_entry_blob() const                  { return false; }
152 
153   inline bool is_compiled_by_c1() const    { return _type == compiler_c1; };
154   inline bool is_compiled_by_c2() const    { return _type == compiler_c2; };
155   inline bool is_compiled_by_jvmci() const { return _type == compiler_jvmci; };
156   const char* compiler_name() const;
157   CompilerType compiler_type() const { return _type; }
158 
159   // Casting
160   nmethod* as_nmethod_or_null()                { return is_nmethod() ? (nmethod*) this : NULL; }
161   nmethod* as_nmethod()                        { assert(is_nmethod(), "must be nmethod"); return (nmethod*) this; }
162   CompiledMethod* as_compiled_method_or_null() { return is_compiled() ? (CompiledMethod*) this : NULL; }
163   CompiledMethod* as_compiled_method()         { assert(is_compiled(), "must be compiled"); return (CompiledMethod*) this; }
164   CodeBlob* as_codeblob_or_null() const        { return (CodeBlob*) this; }
165   OptimizedEntryBlob* as_optimized_entry_blob() const             { assert(is_optimized_entry_blob(), "must be entry blob"); return (OptimizedEntryBlob*) this; }
166 
167   // Boundaries
168   address header_begin() const        { return (address) this; }
169   relocInfo* relocation_begin() const { return (relocInfo*) _relocation_begin; };
170   relocInfo* relocation_end() const   { return (relocInfo*) _relocation_end; }

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

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

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);
439 
440 public:
441   // Creation
442   static AdapterBlob* create(CodeBuffer* cb);




443 
444   // Typing
445   virtual bool is_adapter_blob() const { return true; }


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






















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

131 
132   // Returns the space needed for CodeBlob
133   static unsigned int allocation_size(CodeBuffer* cb, int header_size);
134   static unsigned int align_code_offset(int offset);
135 
136   // Deletion
137   virtual void flush();
138 
139   // Typing
140   virtual bool is_buffer_blob() const                 { return false; }
141   virtual bool is_nmethod() const                     { return false; }
142   virtual bool is_runtime_stub() const                { return false; }
143   virtual bool is_deoptimization_stub() const         { return false; }
144   virtual bool is_uncommon_trap_stub() const          { return false; }
145   virtual bool is_exception_stub() const              { return false; }
146   virtual bool is_safepoint_stub() const              { return false; }
147   virtual bool is_adapter_blob() const                { return false; }
148   virtual bool is_vtable_blob() const                 { return false; }
149   virtual bool is_method_handles_adapter_blob() const { return false; }
150   virtual bool is_compiled() const                    { return false; }
151   virtual bool is_buffered_inline_type_blob() const   { return false; }
152   virtual bool is_optimized_entry_blob() const                  { return false; }
153 
154   inline bool is_compiled_by_c1() const    { return _type == compiler_c1; };
155   inline bool is_compiled_by_c2() const    { return _type == compiler_c2; };
156   inline bool is_compiled_by_jvmci() const { return _type == compiler_jvmci; };
157   const char* compiler_name() const;
158   CompilerType compiler_type() const { return _type; }
159 
160   // Casting
161   nmethod* as_nmethod_or_null()                { return is_nmethod() ? (nmethod*) this : NULL; }
162   nmethod* as_nmethod()                        { assert(is_nmethod(), "must be nmethod"); return (nmethod*) this; }
163   CompiledMethod* as_compiled_method_or_null() { return is_compiled() ? (CompiledMethod*) this : NULL; }
164   CompiledMethod* as_compiled_method()         { assert(is_compiled(), "must be compiled"); return (CompiledMethod*) this; }
165   CodeBlob* as_codeblob_or_null() const        { return (CodeBlob*) this; }
166   OptimizedEntryBlob* as_optimized_entry_blob() const             { assert(is_optimized_entry_blob(), "must be entry blob"); return (OptimizedEntryBlob*) this; }
167 
168   // Boundaries
169   address header_begin() const        { return (address) this; }
170   relocInfo* relocation_begin() const { return (relocInfo*) _relocation_begin; };
171   relocInfo* relocation_end() const   { return (relocInfo*) _relocation_end; }

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