hotspot/src/share/vm/asm/codeBuffer.hpp
changeset 16368 713209c45a82
parent 14626 0cf4eccf130f
child 19696 bd5a0131bde1
equal deleted inserted replaced
16366:b54bc5cfaa6d 16368:713209c45a82
    26 #define SHARE_VM_ASM_CODEBUFFER_HPP
    26 #define SHARE_VM_ASM_CODEBUFFER_HPP
    27 
    27 
    28 #include "code/oopRecorder.hpp"
    28 #include "code/oopRecorder.hpp"
    29 #include "code/relocInfo.hpp"
    29 #include "code/relocInfo.hpp"
    30 
    30 
    31 class CodeComments;
    31 class CodeStrings;
    32 class PhaseCFG;
    32 class PhaseCFG;
    33 class Compile;
    33 class Compile;
    34 class BufferBlob;
    34 class BufferBlob;
    35 class CodeBuffer;
    35 class CodeBuffer;
    36 class Label;
    36 class Label;
   238   void dump();
   238   void dump();
   239   void print(const char* name);
   239   void print(const char* name);
   240 #endif //PRODUCT
   240 #endif //PRODUCT
   241 };
   241 };
   242 
   242 
   243 class CodeComment;
   243 class CodeString;
   244 class CodeComments VALUE_OBJ_CLASS_SPEC {
   244 class CodeStrings VALUE_OBJ_CLASS_SPEC {
   245 private:
   245 private:
   246 #ifndef PRODUCT
   246 #ifndef PRODUCT
   247   CodeComment* _comments;
   247   CodeString* _strings;
   248 #endif
   248 #endif
       
   249 
       
   250   CodeString* find(intptr_t offset) const;
       
   251   CodeString* find_last(intptr_t offset) const;
   249 
   252 
   250 public:
   253 public:
   251   CodeComments() {
   254   CodeStrings() {
   252 #ifndef PRODUCT
   255 #ifndef PRODUCT
   253     _comments = NULL;
   256     _strings = NULL;
   254 #endif
   257 #endif
   255   }
   258   }
       
   259 
       
   260   const char* add_string(const char * string) PRODUCT_RETURN_(return NULL;);
   256 
   261 
   257   void add_comment(intptr_t offset, const char * comment) PRODUCT_RETURN;
   262   void add_comment(intptr_t offset, const char * comment) PRODUCT_RETURN;
   258   void print_block_comment(outputStream* stream, intptr_t offset) const PRODUCT_RETURN;
   263   void print_block_comment(outputStream* stream, intptr_t offset) const PRODUCT_RETURN;
   259   void assign(CodeComments& other)  PRODUCT_RETURN;
   264   void assign(CodeStrings& other)  PRODUCT_RETURN;
   260   void free() PRODUCT_RETURN;
   265   void free() PRODUCT_RETURN;
   261 };
   266 };
   262 
       
   263 
   267 
   264 // A CodeBuffer describes a memory space into which assembly
   268 // A CodeBuffer describes a memory space into which assembly
   265 // code is generated.  This memory space usually occupies the
   269 // code is generated.  This memory space usually occupies the
   266 // interior of a single BufferBlob, but in some cases it may be
   270 // interior of a single BufferBlob, but in some cases it may be
   267 // an arbitrary span of memory, even outside the code cache.
   271 // an arbitrary span of memory, even outside the code cache.
   324   BufferBlob*  _blob;           // optional buffer in CodeCache for generated code
   328   BufferBlob*  _blob;           // optional buffer in CodeCache for generated code
   325   address      _total_start;    // first address of combined memory buffer
   329   address      _total_start;    // first address of combined memory buffer
   326   csize_t      _total_size;     // size in bytes of combined memory buffer
   330   csize_t      _total_size;     // size in bytes of combined memory buffer
   327 
   331 
   328   OopRecorder* _oop_recorder;
   332   OopRecorder* _oop_recorder;
   329   CodeComments _comments;
   333   CodeStrings  _strings;
   330   OopRecorder  _default_oop_recorder;  // override with initialize_oop_recorder
   334   OopRecorder  _default_oop_recorder;  // override with initialize_oop_recorder
   331   Arena*       _overflow_arena;
   335   Arena*       _overflow_arena;
   332 
   336 
   333   address      _decode_begin;   // start address for decode
   337   address      _decode_begin;   // start address for decode
   334   address      decode_begin();
   338   address      decode_begin();
   525   void initialize_stubs_size(csize_t size)             { initialize_section_size(&_stubs,   size); }
   529   void initialize_stubs_size(csize_t size)             { initialize_section_size(&_stubs,   size); }
   526   // Override default oop recorder.
   530   // Override default oop recorder.
   527   void initialize_oop_recorder(OopRecorder* r);
   531   void initialize_oop_recorder(OopRecorder* r);
   528 
   532 
   529   OopRecorder* oop_recorder() const   { return _oop_recorder; }
   533   OopRecorder* oop_recorder() const   { return _oop_recorder; }
   530   CodeComments& comments()            { return _comments; }
   534   CodeStrings& strings()              { return _strings; }
   531 
   535 
   532   // Code generation
   536   // Code generation
   533   void relocate(address at, RelocationHolder const& rspec, int format = 0) {
   537   void relocate(address at, RelocationHolder const& rspec, int format = 0) {
   534     _insts.relocate(at, rspec, format);
   538     _insts.relocate(at, rspec, format);
   535   }
   539   }
   554 
   558 
   555   // Transform an address from the code in this code buffer to a specified code buffer
   559   // Transform an address from the code in this code buffer to a specified code buffer
   556   address transform_address(const CodeBuffer &cb, address addr) const;
   560   address transform_address(const CodeBuffer &cb, address addr) const;
   557 
   561 
   558   void block_comment(intptr_t offset, const char * comment) PRODUCT_RETURN;
   562   void block_comment(intptr_t offset, const char * comment) PRODUCT_RETURN;
       
   563   const char* code_string(const char* str) PRODUCT_RETURN_(return NULL;);
   559 
   564 
   560   // Log a little info about section usage in the CodeBuffer
   565   // Log a little info about section usage in the CodeBuffer
   561   void log_section_sizes(const char* name);
   566   void log_section_sizes(const char* name);
   562 
   567 
   563 #ifndef PRODUCT
   568 #ifndef PRODUCT