hotspot/src/share/vm/asm/codeBuffer.hpp
changeset 6432 d36e09b60939
parent 6418 6671edbd230e
child 6772 2563324665d5
equal deleted inserted replaced
6431:d76212f83824 6432:d36e09b60939
   287   void  operator delete(void* p)  { ShouldNotCallThis(); }
   287   void  operator delete(void* p)  { ShouldNotCallThis(); }
   288 
   288 
   289  public:
   289  public:
   290   typedef int csize_t;  // code size type; would be size_t except for history
   290   typedef int csize_t;  // code size type; would be size_t except for history
   291   enum {
   291   enum {
   292     // Here is the list of all possible sections, in order of ascending address.
   292     // Here is the list of all possible sections.  The order reflects
       
   293     // the final layout.
       
   294     SECT_FIRST = 0,
       
   295     SECT_CONSTS = SECT_FIRST, // Non-instruction data:  Floats, jump tables, etc.
   293     SECT_INSTS,               // Executable instructions.
   296     SECT_INSTS,               // Executable instructions.
   294     SECT_STUBS,               // Outbound trampolines for supporting call sites.
   297     SECT_STUBS,               // Outbound trampolines for supporting call sites.
   295     SECT_CONSTS,              // Non-instruction data:  Floats, jump tables, etc.
       
   296     SECT_LIMIT, SECT_NONE = -1
   298     SECT_LIMIT, SECT_NONE = -1
   297   };
   299   };
   298 
   300 
   299  private:
   301  private:
   300   enum {
   302   enum {
   302     sect_mask = (1<<sect_bits)-1
   304     sect_mask = (1<<sect_bits)-1
   303   };
   305   };
   304 
   306 
   305   const char*  _name;
   307   const char*  _name;
   306 
   308 
       
   309   CodeSection  _consts;             // constants, jump tables
   307   CodeSection  _insts;              // instructions (the main section)
   310   CodeSection  _insts;              // instructions (the main section)
   308   CodeSection  _stubs;              // stubs (call site support), deopt, exception handling
   311   CodeSection  _stubs;              // stubs (call site support), deopt, exception handling
   309   CodeSection  _consts;             // constants, jump tables
       
   310 
   312 
   311   CodeBuffer*  _before_expand;  // dead buffer, from before the last expansion
   313   CodeBuffer*  _before_expand;  // dead buffer, from before the last expansion
   312 
   314 
   313   BufferBlob*  _blob;           // optional buffer in CodeCache for generated code
   315   BufferBlob*  _blob;           // optional buffer in CodeCache for generated code
   314   address      _total_start;    // first address of combined memory buffer
   316   address      _total_start;    // first address of combined memory buffer
   332     _decode_begin    = NULL;
   334     _decode_begin    = NULL;
   333     _overflow_arena  = NULL;
   335     _overflow_arena  = NULL;
   334   }
   336   }
   335 
   337 
   336   void initialize(address code_start, csize_t code_size) {
   338   void initialize(address code_start, csize_t code_size) {
       
   339     _consts.initialize_outer(this,  SECT_CONSTS);
   337     _insts.initialize_outer(this,   SECT_INSTS);
   340     _insts.initialize_outer(this,   SECT_INSTS);
   338     _stubs.initialize_outer(this,   SECT_STUBS);
   341     _stubs.initialize_outer(this,   SECT_STUBS);
   339     _consts.initialize_outer(this,  SECT_CONSTS);
       
   340     _total_start = code_start;
   342     _total_start = code_start;
   341     _total_size  = code_size;
   343     _total_size  = code_size;
   342     // Initialize the main section:
   344     // Initialize the main section:
   343     _insts.initialize(code_start, code_size);
   345     _insts.initialize(code_start, code_size);
   344     assert(!_stubs.is_allocated(),  "no garbage here");
   346     assert(!_stubs.is_allocated(),  "no garbage here");
   412   // constructor 4 is equivalent to calling constructor 3 and then
   414   // constructor 4 is equivalent to calling constructor 3 and then
   413   // calling this method.  It's been factored out for convenience of
   415   // calling this method.  It's been factored out for convenience of
   414   // construction.
   416   // construction.
   415   void initialize(csize_t code_size, csize_t locs_size);
   417   void initialize(csize_t code_size, csize_t locs_size);
   416 
   418 
       
   419   CodeSection* consts()            { return &_consts; }
   417   CodeSection* insts()             { return &_insts; }
   420   CodeSection* insts()             { return &_insts; }
   418   CodeSection* stubs()             { return &_stubs; }
   421   CodeSection* stubs()             { return &_stubs; }
   419   CodeSection* consts()            { return &_consts; }
   422 
   420 
   423   // present sections in order; return NULL at end; consts is #0, etc.
   421   // present sections in order; return NULL at end; insts is #0, etc.
       
   422   CodeSection* code_section(int n) {
   424   CodeSection* code_section(int n) {
   423     // This makes the slightly questionable but portable assumption that
   425     // This makes the slightly questionable but portable assumption
   424     // the various members (_insts, _stubs, etc.) are adjacent in the
   426     // that the various members (_consts, _insts, _stubs, etc.) are
   425     // layout of CodeBuffer.
   427     // adjacent in the layout of CodeBuffer.
   426     CodeSection* cs = &_insts + n;
   428     CodeSection* cs = &_consts + n;
   427     assert(cs->index() == n || !cs->is_allocated(), "sanity");
   429     assert(cs->index() == n || !cs->is_allocated(), "sanity");
   428     return cs;
   430     return cs;
   429   }
   431   }
   430   const CodeSection* code_section(int n) const {  // yucky const stuff
   432   const CodeSection* code_section(int n) const {  // yucky const stuff
   431     return ((CodeBuffer*)this)->code_section(n);
   433     return ((CodeBuffer*)this)->code_section(n);
   482   // Allocated size in all sections, when aligned and concatenated
   484   // Allocated size in all sections, when aligned and concatenated
   483   // (this is the eventual state of the content in its final
   485   // (this is the eventual state of the content in its final
   484   // CodeBlob).
   486   // CodeBlob).
   485   csize_t total_content_size() const;
   487   csize_t total_content_size() const;
   486 
   488 
   487   // combined offset (relative to start of insts) of given address,
   489   // Combined offset (relative to start of first section) of given
   488   // as eventually found in the final CodeBlob
   490   // section, as eventually found in the final CodeBlob.
   489   csize_t total_offset_of(address addr) const;
   491   csize_t total_offset_of(CodeSection* cs) const;
   490 
   492 
   491   // allocated size of all relocation data, including index, rounded up
   493   // allocated size of all relocation data, including index, rounded up
   492   csize_t total_relocation_size() const;
   494   csize_t total_relocation_size() const;
   493 
   495 
   494   // allocated size of any and all recorded oops
   496   // allocated size of any and all recorded oops