comparison src/share/vm/code/codeBlob.hpp @ 1748:3e8fbc61cee8

6978355: renaming for 6961697 Summary: This is the renaming part of 6961697 to keep the actual changes small for review. Reviewed-by: kvn, never
author twisti
date Wed, 25 Aug 2010 05:27:54 -0700
parents 126ea7725993
children f95d63e2154a
comparison
equal deleted inserted replaced
1747:53dbe853fb3a 1748:3e8fbc61cee8
33 // 33 //
34 // 34 //
35 // Layout: 35 // Layout:
36 // - header 36 // - header
37 // - relocation 37 // - relocation
38 // - instruction space 38 // - content space
39 // - instruction space
39 // - data space 40 // - data space
40 class DeoptimizationBlob; 41 class DeoptimizationBlob;
41 42
42 class CodeBlob VALUE_OBJ_CLASS_SPEC { 43 class CodeBlob VALUE_OBJ_CLASS_SPEC {
43 44
46 private: 47 private:
47 const char* _name; 48 const char* _name;
48 int _size; // total size of CodeBlob in bytes 49 int _size; // total size of CodeBlob in bytes
49 int _header_size; // size of header (depends on subclass) 50 int _header_size; // size of header (depends on subclass)
50 int _relocation_size; // size of relocation 51 int _relocation_size; // size of relocation
51 int _instructions_offset; // offset to where instructions region begins 52 int _content_offset; // offset to where content region begins (this includes consts, insts, stubs)
53 int _code_offset; // offset to where instructions region begins (this includes insts, stubs)
52 int _frame_complete_offset; // instruction offsets in [0.._frame_complete_offset) have 54 int _frame_complete_offset; // instruction offsets in [0.._frame_complete_offset) have
53 // not finished setting up their frame. Beware of pc's in 55 // not finished setting up their frame. Beware of pc's in
54 // that range. There is a similar range(s) on returns 56 // that range. There is a similar range(s) on returns
55 // which we don't detect. 57 // which we don't detect.
56 int _data_offset; // offset to where data region begins 58 int _data_offset; // offset to where data region begins
104 // Boundaries 106 // Boundaries
105 address header_begin() const { return (address) this; } 107 address header_begin() const { return (address) this; }
106 address header_end() const { return ((address) this) + _header_size; }; 108 address header_end() const { return ((address) this) + _header_size; };
107 relocInfo* relocation_begin() const { return (relocInfo*) header_end(); }; 109 relocInfo* relocation_begin() const { return (relocInfo*) header_end(); };
108 relocInfo* relocation_end() const { return (relocInfo*)(header_end() + _relocation_size); } 110 relocInfo* relocation_end() const { return (relocInfo*)(header_end() + _relocation_size); }
109 address instructions_begin() const { return (address) header_begin() + _instructions_offset; } 111 address content_begin() const { return (address) header_begin() + _content_offset; }
110 address instructions_end() const { return (address) header_begin() + _data_offset; } 112 address content_end() const { return (address) header_begin() + _data_offset; }
113 address code_begin() const { return (address) header_begin() + _code_offset; }
114 address code_end() const { return (address) header_begin() + _data_offset; }
111 address data_begin() const { return (address) header_begin() + _data_offset; } 115 address data_begin() const { return (address) header_begin() + _data_offset; }
112 address data_end() const { return (address) header_begin() + _size; } 116 address data_end() const { return (address) header_begin() + _size; }
113 117
114 // Offsets 118 // Offsets
115 int relocation_offset() const { return _header_size; } 119 int relocation_offset() const { return _header_size; }
116 int instructions_offset() const { return _instructions_offset; } 120 int content_offset() const { return _content_offset; }
121 int code_offset() const { return _code_offset; }
117 int data_offset() const { return _data_offset; } 122 int data_offset() const { return _data_offset; }
118 123
119 // Sizes 124 // Sizes
120 int size() const { return _size; } 125 int size() const { return _size; }
121 int header_size() const { return _header_size; } 126 int header_size() const { return _header_size; }
122 int relocation_size() const { return (address) relocation_end() - (address) relocation_begin(); } 127 int relocation_size() const { return (address) relocation_end() - (address) relocation_begin(); }
123 int instructions_size() const { return instructions_end() - instructions_begin(); } 128 int content_size() const { return content_end() - content_begin(); }
124 int data_size() const { return data_end() - data_begin(); } 129 int code_size() const { return code_end() - code_begin(); }
130 int data_size() const { return data_end() - data_begin(); }
125 131
126 // Containment 132 // Containment
127 bool blob_contains(address addr) const { return header_begin() <= addr && addr < data_end(); } 133 bool blob_contains(address addr) const { return header_begin() <= addr && addr < data_end(); }
128 bool relocation_contains(relocInfo* addr) const{ return relocation_begin() <= addr && addr < relocation_end(); } 134 bool relocation_contains(relocInfo* addr) const{ return relocation_begin() <= addr && addr < relocation_end(); }
129 bool instructions_contains(address addr) const { return instructions_begin() <= addr && addr < instructions_end(); } 135 bool content_contains(address addr) const { return content_begin() <= addr && addr < content_end(); }
130 bool data_contains(address addr) const { return data_begin() <= addr && addr < data_end(); } 136 bool code_contains(address addr) const { return code_begin() <= addr && addr < code_end(); }
131 bool contains(address addr) const { return instructions_contains(addr); } 137 bool data_contains(address addr) const { return data_begin() <= addr && addr < data_end(); }
132 bool is_frame_complete_at(address addr) const { return instructions_contains(addr) && 138 bool contains(address addr) const { return content_contains(addr); }
133 addr >= instructions_begin() + _frame_complete_offset; } 139 bool is_frame_complete_at(address addr) const { return code_contains(addr) &&
140 addr >= code_begin() + _frame_complete_offset; }
134 141
135 // CodeCache support: really only used by the nmethods, but in order to get 142 // CodeCache support: really only used by the nmethods, but in order to get
136 // asserts and certain bookkeeping to work in the CodeCache they are defined 143 // asserts and certain bookkeeping to work in the CodeCache they are defined
137 // virtual here. 144 // virtual here.
138 virtual bool is_zombie() const { return false; } 145 virtual bool is_zombie() const { return false; }
167 virtual void print_on(outputStream* st) const; 174 virtual void print_on(outputStream* st) const;
168 virtual void print_value_on(outputStream* st) const; 175 virtual void print_value_on(outputStream* st) const;
169 176
170 // Print the comment associated with offset on stream, if there is one 177 // Print the comment associated with offset on stream, if there is one
171 virtual void print_block_comment(outputStream* stream, address block_begin) { 178 virtual void print_block_comment(outputStream* stream, address block_begin) {
172 intptr_t offset = (intptr_t)(block_begin - instructions_begin()); 179 intptr_t offset = (intptr_t)(block_begin - code_begin());
173 _comments.print_block_comment(stream, offset); 180 _comments.print_block_comment(stream, offset);
174 } 181 }
175 182
176 // Transfer ownership of comments to this CodeBlob 183 // Transfer ownership of comments to this CodeBlob
177 void set_comments(CodeComments& comments) { 184 void set_comments(CodeComments& comments) {
284 bool is_runtime_stub() const { return true; } 291 bool is_runtime_stub() const { return true; }
285 292
286 // GC support 293 // GC support
287 bool caller_must_gc_arguments(JavaThread* thread) const { return _caller_must_gc_arguments; } 294 bool caller_must_gc_arguments(JavaThread* thread) const { return _caller_must_gc_arguments; }
288 295
289 address entry_point() { return instructions_begin(); } 296 address entry_point() { return code_begin(); }
290 297
291 // GC/Verification support 298 // GC/Verification support
292 void preserve_callee_argument_oops(frame fr, const RegisterMap *reg_map, OopClosure* f) { /* nothing to do */ } 299 void preserve_callee_argument_oops(frame fr, const RegisterMap *reg_map, OopClosure* f) { /* nothing to do */ }
293 bool is_alive() const { return true; } 300 bool is_alive() const { return true; }
294 301
311 int size, 318 int size,
312 int frame_size, 319 int frame_size,
313 OopMapSet* oop_maps 320 OopMapSet* oop_maps
314 ) 321 )
315 : CodeBlob(name, cb, header_size, size, CodeOffsets::frame_never_safe, frame_size, oop_maps) 322 : CodeBlob(name, cb, header_size, size, CodeOffsets::frame_never_safe, frame_size, oop_maps)
316 {}; 323 {};
317 324
318 bool is_alive() const { return true; } 325 address entry_point() { return code_begin(); }
319 326
320 void verify(); // does nothing 327 bool is_alive() const { return true; }
321 void print_on(outputStream* st) const; 328
322 void print_value_on(outputStream* st) const; 329 void verify(); // does nothing
330 void print_on(outputStream* st) const;
331 void print_value_on(outputStream* st) const;
323 }; 332 };
324 333
325 334
326 //---------------------------------------------------------------------------------------------------- 335 //----------------------------------------------------------------------------------------------------
327 // DeoptimizationBlob 336 // DeoptimizationBlob
374 void preserve_callee_argument_oops(frame fr, const RegisterMap *reg_map, OopClosure* f) { /* Nothing to do */ } 383 void preserve_callee_argument_oops(frame fr, const RegisterMap *reg_map, OopClosure* f) { /* Nothing to do */ }
375 384
376 // Printing 385 // Printing
377 void print_value_on(outputStream* st) const; 386 void print_value_on(outputStream* st) const;
378 387
379 address unpack() const { return instructions_begin() + _unpack_offset; } 388 address unpack() const { return code_begin() + _unpack_offset; }
380 address unpack_with_exception() const { return instructions_begin() + _unpack_with_exception; } 389 address unpack_with_exception() const { return code_begin() + _unpack_with_exception; }
381 address unpack_with_reexecution() const { return instructions_begin() + _unpack_with_reexecution; } 390 address unpack_with_reexecution() const { return code_begin() + _unpack_with_reexecution; }
382 391
383 // Alternate entry point for C1 where the exception and issuing pc 392 // Alternate entry point for C1 where the exception and issuing pc
384 // are in JavaThread::_exception_oop and JavaThread::_exception_pc 393 // are in JavaThread::_exception_oop and JavaThread::_exception_pc
385 // instead of being in registers. This is needed because C1 doesn't 394 // instead of being in registers. This is needed because C1 doesn't
386 // model exception paths in a way that keeps these registers free so 395 // model exception paths in a way that keeps these registers free so
387 // there may be live values in those registers during deopt. 396 // there may be live values in those registers during deopt.
388 void set_unpack_with_exception_in_tls_offset(int offset) { 397 void set_unpack_with_exception_in_tls_offset(int offset) {
389 _unpack_with_exception_in_tls = offset; 398 _unpack_with_exception_in_tls = offset;
390 assert(contains(instructions_begin() + _unpack_with_exception_in_tls), "must be PC inside codeblob"); 399 assert(code_contains(code_begin() + _unpack_with_exception_in_tls), "must be PC inside codeblob");
391 } 400 }
392 address unpack_with_exception_in_tls() const { return instructions_begin() + _unpack_with_exception_in_tls; } 401 address unpack_with_exception_in_tls() const { return code_begin() + _unpack_with_exception_in_tls; }
393 }; 402 };
394 403
395 404
396 //---------------------------------------------------------------------------------------------------- 405 //----------------------------------------------------------------------------------------------------
397 // UncommonTrapBlob (currently only used by Compiler 2) 406 // UncommonTrapBlob (currently only used by Compiler 2)