< prev index next >

src/hotspot/share/asm/codeBuffer.hpp

Print this page




  60 
  61 public:
  62   CodeOffsets() {
  63     _values[Entry         ] = 0;
  64     _values[Verified_Entry] = 0;
  65     _values[Frame_Complete] = frame_never_safe;
  66     _values[OSR_Entry     ] = 0;
  67     _values[Exceptions    ] = -1;
  68     _values[Deopt         ] = -1;
  69     _values[DeoptMH       ] = -1;
  70     _values[UnwindHandler ] = -1;
  71   }
  72 
  73   int value(Entries e) { return _values[e]; }
  74   void set_value(Entries e, int val) { _values[e] = val; }
  75 };
  76 
  77 // This class represents a stream of code and associated relocations.
  78 // There are a few in each CodeBuffer.
  79 // They are filled concurrently, and concatenated at the end.
  80 class CodeSection VALUE_OBJ_CLASS_SPEC {
  81   friend class CodeBuffer;
  82  public:
  83   typedef int csize_t;  // code size type; would be size_t except for history
  84 
  85  private:
  86   address     _start;           // first byte of contents (instructions)
  87   address     _mark;            // user mark, usually an instruction beginning
  88   address     _end;             // current end address
  89   address     _limit;           // last possible (allocated) end address
  90   relocInfo*  _locs_start;      // first byte of relocation information
  91   relocInfo*  _locs_end;        // first byte after relocation information
  92   relocInfo*  _locs_limit;      // first byte after relocation information buf
  93   address     _locs_point;      // last relocated position (grows upward)
  94   bool        _locs_own;        // did I allocate the locs myself?
  95   bool        _frozen;          // no more expansion of this section
  96   bool        _scratch_emit;    // Buffer is used for scratch emit, don't relocate.
  97   char        _index;           // my section number (SECT_INST, etc.)
  98   CodeBuffer* _outer;           // enclosing CodeBuffer
  99 
 100   // (Note:  _locs_point used to be called _last_reloc_offset.)


 229   static csize_t end_slop()         { return MAX2((int)sizeof(jdouble), (int)CodeEntryAlignment); }
 230 
 231   csize_t align_at_start(csize_t off) const { return (csize_t) align_up(off, alignment()); }
 232 
 233   // Mark a section frozen.  Assign its remaining space to
 234   // the following section.  It will never expand after this point.
 235   inline void freeze();         //  { _outer->freeze_section(this); }
 236 
 237   // Ensure there's enough space left in the current section.
 238   // Return true if there was an expansion.
 239   bool maybe_expand_to_ensure_remaining(csize_t amount);
 240 
 241 #ifndef PRODUCT
 242   void decode();
 243   void dump();
 244   void print(const char* name);
 245 #endif //PRODUCT
 246 };
 247 
 248 class CodeString;
 249 class CodeStrings VALUE_OBJ_CLASS_SPEC {
 250 private:
 251 #ifndef PRODUCT
 252   CodeString* _strings;
 253 #ifdef ASSERT
 254   // Becomes true after copy-out, forbids further use.
 255   bool _defunct; // Zero bit pattern is "valid", see memset call in decode_env::decode_env
 256 #endif
 257   static const char* _prefix; // defaults to " ;; "
 258 #endif
 259 
 260   CodeString* find(intptr_t offset) const;
 261   CodeString* find_last(intptr_t offset) const;
 262 
 263   void set_null_and_invalidate() {
 264 #ifndef PRODUCT
 265     _strings = NULL;
 266 #ifdef ASSERT
 267     _defunct = true;
 268 #endif
 269 #endif




  60 
  61 public:
  62   CodeOffsets() {
  63     _values[Entry         ] = 0;
  64     _values[Verified_Entry] = 0;
  65     _values[Frame_Complete] = frame_never_safe;
  66     _values[OSR_Entry     ] = 0;
  67     _values[Exceptions    ] = -1;
  68     _values[Deopt         ] = -1;
  69     _values[DeoptMH       ] = -1;
  70     _values[UnwindHandler ] = -1;
  71   }
  72 
  73   int value(Entries e) { return _values[e]; }
  74   void set_value(Entries e, int val) { _values[e] = val; }
  75 };
  76 
  77 // This class represents a stream of code and associated relocations.
  78 // There are a few in each CodeBuffer.
  79 // They are filled concurrently, and concatenated at the end.
  80 class CodeSection {
  81   friend class CodeBuffer;
  82  public:
  83   typedef int csize_t;  // code size type; would be size_t except for history
  84 
  85  private:
  86   address     _start;           // first byte of contents (instructions)
  87   address     _mark;            // user mark, usually an instruction beginning
  88   address     _end;             // current end address
  89   address     _limit;           // last possible (allocated) end address
  90   relocInfo*  _locs_start;      // first byte of relocation information
  91   relocInfo*  _locs_end;        // first byte after relocation information
  92   relocInfo*  _locs_limit;      // first byte after relocation information buf
  93   address     _locs_point;      // last relocated position (grows upward)
  94   bool        _locs_own;        // did I allocate the locs myself?
  95   bool        _frozen;          // no more expansion of this section
  96   bool        _scratch_emit;    // Buffer is used for scratch emit, don't relocate.
  97   char        _index;           // my section number (SECT_INST, etc.)
  98   CodeBuffer* _outer;           // enclosing CodeBuffer
  99 
 100   // (Note:  _locs_point used to be called _last_reloc_offset.)


 229   static csize_t end_slop()         { return MAX2((int)sizeof(jdouble), (int)CodeEntryAlignment); }
 230 
 231   csize_t align_at_start(csize_t off) const { return (csize_t) align_up(off, alignment()); }
 232 
 233   // Mark a section frozen.  Assign its remaining space to
 234   // the following section.  It will never expand after this point.
 235   inline void freeze();         //  { _outer->freeze_section(this); }
 236 
 237   // Ensure there's enough space left in the current section.
 238   // Return true if there was an expansion.
 239   bool maybe_expand_to_ensure_remaining(csize_t amount);
 240 
 241 #ifndef PRODUCT
 242   void decode();
 243   void dump();
 244   void print(const char* name);
 245 #endif //PRODUCT
 246 };
 247 
 248 class CodeString;
 249 class CodeStrings {
 250 private:
 251 #ifndef PRODUCT
 252   CodeString* _strings;
 253 #ifdef ASSERT
 254   // Becomes true after copy-out, forbids further use.
 255   bool _defunct; // Zero bit pattern is "valid", see memset call in decode_env::decode_env
 256 #endif
 257   static const char* _prefix; // defaults to " ;; "
 258 #endif
 259 
 260   CodeString* find(intptr_t offset) const;
 261   CodeString* find_last(intptr_t offset) const;
 262 
 263   void set_null_and_invalidate() {
 264 #ifndef PRODUCT
 265     _strings = NULL;
 266 #ifdef ASSERT
 267     _defunct = true;
 268 #endif
 269 #endif


< prev index next >