Mercurial > hg > graal-jvmci-8
comparison src/share/vm/code/codeBlob.hpp @ 1579:e9ff18c4ace7
Merge
author | jrose |
---|---|
date | Wed, 02 Jun 2010 22:45:42 -0700 |
parents | c18cbe5936b8 1a5913bf5e19 |
children | 7139e81efd2d |
comparison
equal
deleted
inserted
replaced
1562:dfe27f03244a | 1579:e9ff18c4ace7 |
---|---|
52 int _frame_complete_offset; // instruction offsets in [0.._frame_complete_offset) have | 52 int _frame_complete_offset; // instruction offsets in [0.._frame_complete_offset) have |
53 // not finished setting up their frame. Beware of pc's in | 53 // not finished setting up their frame. Beware of pc's in |
54 // that range. There is a similar range(s) on returns | 54 // that range. There is a similar range(s) on returns |
55 // which we don't detect. | 55 // which we don't detect. |
56 int _data_offset; // offset to where data region begins | 56 int _data_offset; // offset to where data region begins |
57 int _oops_offset; // offset to where embedded oop table begins (inside data) | |
58 int _oops_length; // number of embedded oops | |
59 int _frame_size; // size of stack frame | 57 int _frame_size; // size of stack frame |
60 OopMapSet* _oop_maps; // OopMap for this CodeBlob | 58 OopMapSet* _oop_maps; // OopMap for this CodeBlob |
61 CodeComments _comments; | 59 CodeComments _comments; |
62 | 60 |
63 friend class OopRecorder; | 61 friend class OopRecorder; |
64 | |
65 void fix_oop_relocations(address begin, address end, bool initialize_immediates); | |
66 inline void initialize_immediate_oop(oop* dest, jobject handle); | |
67 | 62 |
68 public: | 63 public: |
69 // Returns the space needed for CodeBlob | 64 // Returns the space needed for CodeBlob |
70 static unsigned int allocation_size(CodeBuffer* cb, int header_size); | 65 static unsigned int allocation_size(CodeBuffer* cb, int header_size); |
71 | 66 |
113 relocInfo* relocation_end() const { return (relocInfo*)(header_end() + _relocation_size); } | 108 relocInfo* relocation_end() const { return (relocInfo*)(header_end() + _relocation_size); } |
114 address instructions_begin() const { return (address) header_begin() + _instructions_offset; } | 109 address instructions_begin() const { return (address) header_begin() + _instructions_offset; } |
115 address instructions_end() const { return (address) header_begin() + _data_offset; } | 110 address instructions_end() const { return (address) header_begin() + _data_offset; } |
116 address data_begin() const { return (address) header_begin() + _data_offset; } | 111 address data_begin() const { return (address) header_begin() + _data_offset; } |
117 address data_end() const { return (address) header_begin() + _size; } | 112 address data_end() const { return (address) header_begin() + _size; } |
118 oop* oops_begin() const { return (oop*) (header_begin() + _oops_offset); } | |
119 oop* oops_end() const { return oops_begin() + _oops_length; } | |
120 | 113 |
121 // Offsets | 114 // Offsets |
122 int relocation_offset() const { return _header_size; } | 115 int relocation_offset() const { return _header_size; } |
123 int instructions_offset() const { return _instructions_offset; } | 116 int instructions_offset() const { return _instructions_offset; } |
124 int data_offset() const { return _data_offset; } | 117 int data_offset() const { return _data_offset; } |
125 int oops_offset() const { return _oops_offset; } | |
126 | 118 |
127 // Sizes | 119 // Sizes |
128 int size() const { return _size; } | 120 int size() const { return _size; } |
129 int header_size() const { return _header_size; } | 121 int header_size() const { return _header_size; } |
130 int relocation_size() const { return (address) relocation_end() - (address) relocation_begin(); } | 122 int relocation_size() const { return (address) relocation_end() - (address) relocation_begin(); } |
131 int instructions_size() const { return instructions_end() - instructions_begin(); } | 123 int instructions_size() const { return instructions_end() - instructions_begin(); } |
132 int data_size() const { return data_end() - data_begin(); } | 124 int data_size() const { return data_end() - data_begin(); } |
133 int oops_size() const { return (address) oops_end() - (address) oops_begin(); } | |
134 | 125 |
135 // Containment | 126 // Containment |
136 bool blob_contains(address addr) const { return header_begin() <= addr && addr < data_end(); } | 127 bool blob_contains(address addr) const { return header_begin() <= addr && addr < data_end(); } |
137 bool relocation_contains(relocInfo* addr) const{ return relocation_begin() <= addr && addr < relocation_end(); } | 128 bool relocation_contains(relocInfo* addr) const{ return relocation_begin() <= addr && addr < relocation_end(); } |
138 bool instructions_contains(address addr) const { return instructions_begin() <= addr && addr < instructions_end(); } | 129 bool instructions_contains(address addr) const { return instructions_begin() <= addr && addr < instructions_end(); } |
139 bool data_contains(address addr) const { return data_begin() <= addr && addr < data_end(); } | 130 bool data_contains(address addr) const { return data_begin() <= addr && addr < data_end(); } |
140 bool oops_contains(oop* addr) const { return oops_begin() <= addr && addr < oops_end(); } | |
141 bool contains(address addr) const { return instructions_contains(addr); } | 131 bool contains(address addr) const { return instructions_contains(addr); } |
142 bool is_frame_complete_at(address addr) const { return instructions_contains(addr) && | 132 bool is_frame_complete_at(address addr) const { return instructions_contains(addr) && |
143 addr >= instructions_begin() + _frame_complete_offset; } | 133 addr >= instructions_begin() + _frame_complete_offset; } |
144 | |
145 // Relocation support | |
146 void fix_oop_relocations(address begin, address end) { | |
147 fix_oop_relocations(begin, end, false); | |
148 } | |
149 void fix_oop_relocations() { | |
150 fix_oop_relocations(NULL, NULL, false); | |
151 } | |
152 relocInfo::relocType reloc_type_for_address(address pc); | |
153 bool is_at_poll_return(address pc); | |
154 bool is_at_poll_or_poll_return(address pc); | |
155 | |
156 // Support for oops in scopes and relocs: | |
157 // Note: index 0 is reserved for null. | |
158 oop oop_at(int index) const { return index == 0? (oop)NULL: *oop_addr_at(index); } | |
159 oop* oop_addr_at(int index) const{ // for GC | |
160 // relocation indexes are biased by 1 (because 0 is reserved) | |
161 assert(index > 0 && index <= _oops_length, "must be a valid non-zero index"); | |
162 return &oops_begin()[index-1]; | |
163 } | |
164 | |
165 void copy_oops(GrowableArray<jobject>* oops); | |
166 | 134 |
167 // CodeCache support: really only used by the nmethods, but in order to get | 135 // CodeCache support: really only used by the nmethods, but in order to get |
168 // asserts and certain bookkeeping to work in the CodeCache they are defined | 136 // asserts and certain bookkeeping to work in the CodeCache they are defined |
169 // virtual here. | 137 // virtual here. |
170 virtual bool is_zombie() const { return false; } | 138 virtual bool is_zombie() const { return false; } |
173 virtual bool is_unloaded() const { return false; } | 141 virtual bool is_unloaded() const { return false; } |
174 virtual bool is_not_entrant() const { return false; } | 142 virtual bool is_not_entrant() const { return false; } |
175 | 143 |
176 // GC support | 144 // GC support |
177 virtual bool is_alive() const = 0; | 145 virtual bool is_alive() const = 0; |
178 virtual void do_unloading(BoolObjectClosure* is_alive, | |
179 OopClosure* keep_alive, | |
180 bool unloading_occurred); | |
181 virtual void oops_do(OopClosure* f) = 0; | |
182 // (All CodeBlob subtypes other than NMethod currently have | |
183 // an empty oops_do() method. | |
184 | 146 |
185 // OopMap for frame | 147 // OopMap for frame |
186 OopMapSet* oop_maps() const { return _oop_maps; } | 148 OopMapSet* oop_maps() const { return _oop_maps; } |
187 void set_oop_maps(OopMapSet* p); | 149 void set_oop_maps(OopMapSet* p); |
188 OopMap* oop_map_for_return_address(address return_address); | 150 OopMap* oop_map_for_return_address(address return_address); |
243 virtual bool is_buffer_blob() const { return true; } | 205 virtual bool is_buffer_blob() const { return true; } |
244 | 206 |
245 // GC/Verification support | 207 // GC/Verification support |
246 void preserve_callee_argument_oops(frame fr, const RegisterMap* reg_map, OopClosure* f) { /* nothing to do */ } | 208 void preserve_callee_argument_oops(frame fr, const RegisterMap* reg_map, OopClosure* f) { /* nothing to do */ } |
247 bool is_alive() const { return true; } | 209 bool is_alive() const { return true; } |
248 void do_unloading(BoolObjectClosure* is_alive, | |
249 OopClosure* keep_alive, | |
250 bool unloading_occurred) { /* do nothing */ } | |
251 | |
252 void oops_do(OopClosure* f) { /* do nothing*/ } | |
253 | 210 |
254 void verify(); | 211 void verify(); |
255 void print() const PRODUCT_RETURN; | 212 void print() const PRODUCT_RETURN; |
256 void print_value_on(outputStream* st) const PRODUCT_RETURN; | 213 void print_value_on(outputStream* st) const PRODUCT_RETURN; |
257 }; | 214 }; |
332 address entry_point() { return instructions_begin(); } | 289 address entry_point() { return instructions_begin(); } |
333 | 290 |
334 // GC/Verification support | 291 // GC/Verification support |
335 void preserve_callee_argument_oops(frame fr, const RegisterMap *reg_map, OopClosure* f) { /* nothing to do */ } | 292 void preserve_callee_argument_oops(frame fr, const RegisterMap *reg_map, OopClosure* f) { /* nothing to do */ } |
336 bool is_alive() const { return true; } | 293 bool is_alive() const { return true; } |
337 void do_unloading(BoolObjectClosure* is_alive, | |
338 OopClosure* keep_alive, | |
339 bool unloading_occurred) { /* do nothing */ } | |
340 void oops_do(OopClosure* f) { /* do-nothing*/ } | |
341 | 294 |
342 void verify(); | 295 void verify(); |
343 void print() const PRODUCT_RETURN; | 296 void print() const PRODUCT_RETURN; |
344 void print_value_on(outputStream* st) const PRODUCT_RETURN; | 297 void print_value_on(outputStream* st) const PRODUCT_RETURN; |
345 }; | 298 }; |
361 ) | 314 ) |
362 : CodeBlob(name, cb, header_size, size, CodeOffsets::frame_never_safe, frame_size, oop_maps) | 315 : CodeBlob(name, cb, header_size, size, CodeOffsets::frame_never_safe, frame_size, oop_maps) |
363 {}; | 316 {}; |
364 | 317 |
365 bool is_alive() const { return true; } | 318 bool is_alive() const { return true; } |
366 void do_unloading(BoolObjectClosure* is_alive, | |
367 OopClosure* keep_alive, | |
368 bool unloading_occurred) { /* do-nothing*/ } | |
369 | 319 |
370 void verify(); // does nothing | 320 void verify(); // does nothing |
371 void print() const PRODUCT_RETURN; | 321 void print() const PRODUCT_RETURN; |
372 void print_value_on(outputStream* st) const PRODUCT_RETURN; | 322 void print_value_on(outputStream* st) const PRODUCT_RETURN; |
373 }; | 323 }; |
420 | 370 |
421 | 371 |
422 | 372 |
423 // GC for args | 373 // GC for args |
424 void preserve_callee_argument_oops(frame fr, const RegisterMap *reg_map, OopClosure* f) { /* Nothing to do */ } | 374 void preserve_callee_argument_oops(frame fr, const RegisterMap *reg_map, OopClosure* f) { /* Nothing to do */ } |
425 | |
426 // Iteration | |
427 void oops_do(OopClosure* f) {} | |
428 | 375 |
429 // Printing | 376 // Printing |
430 void print_value_on(outputStream* st) const PRODUCT_RETURN; | 377 void print_value_on(outputStream* st) const PRODUCT_RETURN; |
431 | 378 |
432 address unpack() const { return instructions_begin() + _unpack_offset; } | 379 address unpack() const { return instructions_begin() + _unpack_offset; } |
475 // GC for args | 422 // GC for args |
476 void preserve_callee_argument_oops(frame fr, const RegisterMap *reg_map, OopClosure* f) { /* nothing to do */ } | 423 void preserve_callee_argument_oops(frame fr, const RegisterMap *reg_map, OopClosure* f) { /* nothing to do */ } |
477 | 424 |
478 // Typing | 425 // Typing |
479 bool is_uncommon_trap_stub() const { return true; } | 426 bool is_uncommon_trap_stub() const { return true; } |
480 | |
481 // Iteration | |
482 void oops_do(OopClosure* f) {} | |
483 }; | 427 }; |
484 | 428 |
485 | 429 |
486 //---------------------------------------------------------------------------------------------------- | 430 //---------------------------------------------------------------------------------------------------- |
487 // ExceptionBlob: used for exception unwinding in compiled code (currently only used by Compiler 2) | 431 // ExceptionBlob: used for exception unwinding in compiled code (currently only used by Compiler 2) |
510 // GC for args | 454 // GC for args |
511 void preserve_callee_argument_oops(frame fr, const RegisterMap* reg_map, OopClosure* f) { /* nothing to do */ } | 455 void preserve_callee_argument_oops(frame fr, const RegisterMap* reg_map, OopClosure* f) { /* nothing to do */ } |
512 | 456 |
513 // Typing | 457 // Typing |
514 bool is_exception_stub() const { return true; } | 458 bool is_exception_stub() const { return true; } |
515 | |
516 // Iteration | |
517 void oops_do(OopClosure* f) {} | |
518 }; | 459 }; |
519 #endif // COMPILER2 | 460 #endif // COMPILER2 |
520 | 461 |
521 | 462 |
522 //---------------------------------------------------------------------------------------------------- | 463 //---------------------------------------------------------------------------------------------------- |
546 // GC for args | 487 // GC for args |
547 void preserve_callee_argument_oops(frame fr, const RegisterMap* reg_map, OopClosure* f) { /* nothing to do */ } | 488 void preserve_callee_argument_oops(frame fr, const RegisterMap* reg_map, OopClosure* f) { /* nothing to do */ } |
548 | 489 |
549 // Typing | 490 // Typing |
550 bool is_safepoint_stub() const { return true; } | 491 bool is_safepoint_stub() const { return true; } |
551 | 492 }; |
552 // Iteration | |
553 void oops_do(OopClosure* f) {} | |
554 }; |