< prev index next >

src/hotspot/share/asm/codeBuffer.hpp

Print this page
rev 58404 : 8241042: x86_64: Improve Assembler generation
Reviewed-by: vlivanov


 183 
 184   void    set_end(address pc)       { assert(allocates2(pc), "not in CodeBuffer memory: " INTPTR_FORMAT " <= " INTPTR_FORMAT " <= " INTPTR_FORMAT, p2i(_start), p2i(pc), p2i(_limit)); _end = pc; }
 185   void    set_mark(address pc)      { assert(contains2(pc), "not in codeBuffer");
 186                                       _mark = pc; }
 187   void    set_mark_off(int offset)  { assert(contains2(offset+_start),"not in codeBuffer");
 188                                       _mark = offset + _start; }
 189   void    set_mark()                { _mark = _end; }
 190   void    clear_mark()              { _mark = NULL; }
 191 
 192   void    set_locs_end(relocInfo* p) {
 193     assert(p <= locs_limit(), "locs data fits in allocated buffer");
 194     _locs_end = p;
 195   }
 196   void    set_locs_point(address pc) {
 197     assert(pc >= locs_point(), "relocation addr may not decrease");
 198     assert(allocates2(pc),     "relocation addr must be in this section");
 199     _locs_point = pc;
 200   }
 201 
 202   // Code emission
 203   void emit_int8 ( int8_t  x)  { *((int8_t*)  end()) = x; set_end(end() + sizeof(int8_t)); }
 204   void emit_int16( int16_t x)  { *((int16_t*) end()) = x; set_end(end() + sizeof(int16_t)); }
 205   void emit_int32( int32_t x)  { *((int32_t*) end()) = x; set_end(end() + sizeof(int32_t)); }





























 206   void emit_int64( int64_t x)  { *((int64_t*) end()) = x; set_end(end() + sizeof(int64_t)); }
 207 
 208   void emit_float( jfloat  x)  { *((jfloat*)  end()) = x; set_end(end() + sizeof(jfloat)); }
 209   void emit_double(jdouble x)  { *((jdouble*) end()) = x; set_end(end() + sizeof(jdouble)); }
 210   void emit_address(address x) { *((address*) end()) = x; set_end(end() + sizeof(address)); }
 211 
 212   // Share a scratch buffer for relocinfo.  (Hacky; saves a resource allocation.)
 213   void initialize_shared_locs(relocInfo* buf, int length);
 214 
 215   // Manage labels and their addresses.
 216   address target(Label& L, address branch_pc);
 217 
 218   // Emit a relocation.
 219   void relocate(address at, RelocationHolder const& rspec, int format = 0);
 220   void relocate(address at,    relocInfo::relocType rtype, int format = 0, jint method_index = 0);
 221 
 222   // alignment requirement for starting offset
 223   // Requirements are that the instruction area and the
 224   // stubs area must start on CodeEntryAlignment, and
 225   // the ctable on sizeof(jdouble)




 183 
 184   void    set_end(address pc)       { assert(allocates2(pc), "not in CodeBuffer memory: " INTPTR_FORMAT " <= " INTPTR_FORMAT " <= " INTPTR_FORMAT, p2i(_start), p2i(pc), p2i(_limit)); _end = pc; }
 185   void    set_mark(address pc)      { assert(contains2(pc), "not in codeBuffer");
 186                                       _mark = pc; }
 187   void    set_mark_off(int offset)  { assert(contains2(offset+_start),"not in codeBuffer");
 188                                       _mark = offset + _start; }
 189   void    set_mark()                { _mark = _end; }
 190   void    clear_mark()              { _mark = NULL; }
 191 
 192   void    set_locs_end(relocInfo* p) {
 193     assert(p <= locs_limit(), "locs data fits in allocated buffer");
 194     _locs_end = p;
 195   }
 196   void    set_locs_point(address pc) {
 197     assert(pc >= locs_point(), "relocation addr may not decrease");
 198     assert(allocates2(pc),     "relocation addr must be in this section");
 199     _locs_point = pc;
 200   }
 201 
 202   // Code emission
 203   void emit_int8(int8_t x1) {
 204     address curr = end();
 205     *((int8_t*)  curr++) = x1;
 206     set_end(curr);
 207   }
 208 
 209   void emit_int16(int16_t x) { *((int16_t*) end()) = x; set_end(end() + sizeof(int16_t)); }
 210   void emit_int16(int8_t x1, int8_t x2) {
 211     address curr = end();
 212     *((int8_t*)  curr++) = x1;
 213     *((int8_t*)  curr++) = x2;
 214     set_end(curr);
 215   }
 216 
 217   void emit_int24(int8_t x1, int8_t x2, int8_t x3)  {
 218     address curr = end();
 219     *((int8_t*)  curr++) = x1;
 220     *((int8_t*)  curr++) = x2;
 221     *((int8_t*)  curr++) = x3;
 222     set_end(curr);
 223   }
 224 
 225   void emit_int32(int32_t x) { *((int32_t*) end()) = x; set_end(end() + sizeof(int32_t)); }
 226   void emit_int32(int8_t x1, int8_t x2, int8_t x3, int8_t x4)  {
 227     address curr = end();
 228     *((int8_t*)  curr++) = x1;
 229     *((int8_t*)  curr++) = x2;
 230     *((int8_t*)  curr++) = x3;
 231     *((int8_t*)  curr++) = x4;
 232     set_end(curr);
 233   }
 234 
 235   void emit_int64( int64_t x)  { *((int64_t*) end()) = x; set_end(end() + sizeof(int64_t)); }
 236 
 237   void emit_float( jfloat  x)  { *((jfloat*)  end()) = x; set_end(end() + sizeof(jfloat)); }
 238   void emit_double(jdouble x)  { *((jdouble*) end()) = x; set_end(end() + sizeof(jdouble)); }
 239   void emit_address(address x) { *((address*) end()) = x; set_end(end() + sizeof(address)); }
 240 
 241   // Share a scratch buffer for relocinfo.  (Hacky; saves a resource allocation.)
 242   void initialize_shared_locs(relocInfo* buf, int length);
 243 
 244   // Manage labels and their addresses.
 245   address target(Label& L, address branch_pc);
 246 
 247   // Emit a relocation.
 248   void relocate(address at, RelocationHolder const& rspec, int format = 0);
 249   void relocate(address at,    relocInfo::relocType rtype, int format = 0, jint method_index = 0);
 250 
 251   // alignment requirement for starting offset
 252   // Requirements are that the instruction area and the
 253   // stubs area must start on CodeEntryAlignment, and
 254   // the ctable on sizeof(jdouble)


< prev index next >