Mercurial > hg > graal-compiler
comparison src/share/vm/oops/constMethodOop.hpp @ 6213:8150fa46d2ed
7178145: Change constMethodOop::_exception_table to optionally inlined u2 table.
Summary: Change constMethodOop::_exception_table to optionally inlined u2 table.
Reviewed-by: bdelsart, coleenp, kamg
author | jiangli |
---|---|
date | Tue, 26 Jun 2012 19:08:44 -0400 |
parents | 2fe087c3e814 |
children |
comparison
equal
deleted
inserted
replaced
6177:06320b1578cb | 6213:8150fa46d2ed |
---|---|
41 // |------------------------------------------------------| | 41 // |------------------------------------------------------| |
42 // | fingerprint 1 | | 42 // | fingerprint 1 | |
43 // | fingerprint 2 | | 43 // | fingerprint 2 | |
44 // | constants (oop) | | 44 // | constants (oop) | |
45 // | stackmap_data (oop) | | 45 // | stackmap_data (oop) | |
46 // | exception_table (oop) | | |
47 // | constMethod_size | | 46 // | constMethod_size | |
48 // | interp_kind | flags | code_size | | 47 // | interp_kind | flags | code_size | |
49 // | name index | signature index | | 48 // | name index | signature index | |
50 // | method_idnum | generic_signature_index | | 49 // | method_idnum | generic_signature_index | |
51 // |------------------------------------------------------| | 50 // |------------------------------------------------------| |
62 // |------------------------------------------------------| | 61 // |------------------------------------------------------| |
63 // | localvariable table elements + length (length last) | | 62 // | localvariable table elements + length (length last) | |
64 // | (length is u2, elements are 6-tuples of u2) | | 63 // | (length is u2, elements are 6-tuples of u2) | |
65 // | (see class LocalVariableTableElement) | | 64 // | (see class LocalVariableTableElement) | |
66 // | (access flags bit tells whether table is present) | | 65 // | (access flags bit tells whether table is present) | |
67 // | (indexed from end of contMethodOop) | | 66 // | (indexed from end of constMethodOop) | |
67 // |------------------------------------------------------| | |
68 // | exception table + length (length last) | | |
69 // | (length is u2, elements are 4-tuples of u2) | | |
70 // | (see class ExceptionTableElement) | | |
71 // | (access flags bit tells whether table is present) | | |
72 // | (indexed from end of constMethodOop) | | |
68 // |------------------------------------------------------| | 73 // |------------------------------------------------------| |
69 // | checked exceptions elements + length (length last) | | 74 // | checked exceptions elements + length (length last) | |
70 // | (length is u2, elements are u2) | | 75 // | (length is u2, elements are u2) | |
71 // | (see class CheckedExceptionElement) | | 76 // | (see class CheckedExceptionElement) | |
72 // | (access flags bit tells whether table is present) | | 77 // | (access flags bit tells whether table is present) | |
91 u2 signature_cp_index; | 96 u2 signature_cp_index; |
92 u2 slot; | 97 u2 slot; |
93 }; | 98 }; |
94 | 99 |
95 | 100 |
101 // Utitily class describing elements in exception table | |
102 class ExceptionTableElement VALUE_OBJ_CLASS_SPEC { | |
103 public: | |
104 u2 start_pc; | |
105 u2 end_pc; | |
106 u2 handler_pc; | |
107 u2 catch_type_index; | |
108 }; | |
109 | |
96 class constMethodOopDesc : public oopDesc { | 110 class constMethodOopDesc : public oopDesc { |
97 friend class constMethodKlass; | 111 friend class constMethodKlass; |
98 friend class VMStructs; | 112 friend class VMStructs; |
99 private: | 113 private: |
100 enum { | 114 enum { |
101 _has_linenumber_table = 1, | 115 _has_linenumber_table = 1, |
102 _has_checked_exceptions = 2, | 116 _has_checked_exceptions = 2, |
103 _has_localvariable_table = 4 | 117 _has_localvariable_table = 4, |
118 _has_exception_table = 8 | |
104 }; | 119 }; |
105 | 120 |
106 // Bit vector of signature | 121 // Bit vector of signature |
107 // Callers interpret 0=not initialized yet and | 122 // Callers interpret 0=not initialized yet and |
108 // -1=too many args to fix, must parse the slow way. | 123 // -1=too many args to fix, must parse the slow way. |
112 volatile uint64_t _fingerprint; | 127 volatile uint64_t _fingerprint; |
113 volatile bool _is_conc_safe; // if true, safe for concurrent GC processing | 128 volatile bool _is_conc_safe; // if true, safe for concurrent GC processing |
114 | 129 |
115 public: | 130 public: |
116 oop* oop_block_beg() const { return adr_constants(); } | 131 oop* oop_block_beg() const { return adr_constants(); } |
117 oop* oop_block_end() const { return adr_exception_table() + 1; } | 132 oop* oop_block_end() const { return adr_stackmap_data() + 1; } |
118 | 133 |
119 private: | 134 private: |
120 // | 135 // |
121 // The oop block. See comment in klass.hpp before making changes. | 136 // The oop block. See comment in klass.hpp before making changes. |
122 // | 137 // |
123 | 138 |
124 constantPoolOop _constants; // Constant pool | 139 constantPoolOop _constants; // Constant pool |
125 | 140 |
126 // Raw stackmap data for the method | 141 // Raw stackmap data for the method |
127 typeArrayOop _stackmap_data; | 142 typeArrayOop _stackmap_data; |
128 | |
129 // The exception handler table. 4-tuples of ints [start_pc, end_pc, | |
130 // handler_pc, catch_type index] For methods with no exceptions the | |
131 // table is pointing to Universe::the_empty_int_array | |
132 typeArrayOop _exception_table; | |
133 | 143 |
134 // | 144 // |
135 // End of the oop block. | 145 // End of the oop block. |
136 // | 146 // |
137 | 147 |
150 | 160 |
151 public: | 161 public: |
152 // Inlined tables | 162 // Inlined tables |
153 void set_inlined_tables_length(int checked_exceptions_len, | 163 void set_inlined_tables_length(int checked_exceptions_len, |
154 int compressed_line_number_size, | 164 int compressed_line_number_size, |
155 int localvariable_table_len); | 165 int localvariable_table_len, |
166 int exception_table_len); | |
156 | 167 |
157 bool has_linenumber_table() const | 168 bool has_linenumber_table() const |
158 { return (_flags & _has_linenumber_table) != 0; } | 169 { return (_flags & _has_linenumber_table) != 0; } |
159 | 170 |
160 bool has_checked_exceptions() const | 171 bool has_checked_exceptions() const |
161 { return (_flags & _has_checked_exceptions) != 0; } | 172 { return (_flags & _has_checked_exceptions) != 0; } |
162 | 173 |
163 bool has_localvariable_table() const | 174 bool has_localvariable_table() const |
164 { return (_flags & _has_localvariable_table) != 0; } | 175 { return (_flags & _has_localvariable_table) != 0; } |
176 | |
177 bool has_exception_handler() const | |
178 { return (_flags & _has_exception_table) != 0; } | |
165 | 179 |
166 void set_interpreter_kind(int kind) { _interpreter_kind = kind; } | 180 void set_interpreter_kind(int kind) { _interpreter_kind = kind; } |
167 int interpreter_kind(void) const { return _interpreter_kind; } | 181 int interpreter_kind(void) const { return _interpreter_kind; } |
168 | 182 |
169 // constant pool | 183 // constant pool |
178 typeArrayOop stackmap_data() const { return _stackmap_data; } | 192 typeArrayOop stackmap_data() const { return _stackmap_data; } |
179 void set_stackmap_data(typeArrayOop sd) { | 193 void set_stackmap_data(typeArrayOop sd) { |
180 oop_store_without_check((oop*)&_stackmap_data, (oop)sd); | 194 oop_store_without_check((oop*)&_stackmap_data, (oop)sd); |
181 } | 195 } |
182 bool has_stackmap_table() const { return _stackmap_data != NULL; } | 196 bool has_stackmap_table() const { return _stackmap_data != NULL; } |
183 | |
184 // exception handler table | |
185 typeArrayOop exception_table() const { return _exception_table; } | |
186 void set_exception_table(typeArrayOop e) { oop_store_without_check((oop*) &_exception_table, (oop) e); } | |
187 bool has_exception_handler() const { return exception_table() != NULL && exception_table()->length() > 0; } | |
188 | 197 |
189 void init_fingerprint() { | 198 void init_fingerprint() { |
190 const uint64_t initval = CONST64(0x8000000000000000); | 199 const uint64_t initval = CONST64(0x8000000000000000); |
191 _fingerprint = initval; | 200 _fingerprint = initval; |
192 } | 201 } |
233 } | 242 } |
234 | 243 |
235 // Object size needed | 244 // Object size needed |
236 static int object_size(int code_size, int compressed_line_number_size, | 245 static int object_size(int code_size, int compressed_line_number_size, |
237 int local_variable_table_length, | 246 int local_variable_table_length, |
247 int exception_table_length, | |
238 int checked_exceptions_length); | 248 int checked_exceptions_length); |
239 | 249 |
240 int object_size() const { return _constMethod_size; } | 250 int object_size() const { return _constMethod_size; } |
241 void set_constMethod_size(int size) { _constMethod_size = size; } | 251 void set_constMethod_size(int size) { _constMethod_size = size; } |
242 // Is object parsable by gc | 252 // Is object parsable by gc |
254 // linenumber table - note that length is unknown until decompression, | 264 // linenumber table - note that length is unknown until decompression, |
255 // see class CompressedLineNumberReadStream. | 265 // see class CompressedLineNumberReadStream. |
256 u_char* compressed_linenumber_table() const; // not preserved by gc | 266 u_char* compressed_linenumber_table() const; // not preserved by gc |
257 u2* checked_exceptions_length_addr() const; | 267 u2* checked_exceptions_length_addr() const; |
258 u2* localvariable_table_length_addr() const; | 268 u2* localvariable_table_length_addr() const; |
269 u2* exception_table_length_addr() const; | |
259 | 270 |
260 // checked exceptions | 271 // checked exceptions |
261 int checked_exceptions_length() const; | 272 int checked_exceptions_length() const; |
262 CheckedExceptionElement* checked_exceptions_start() const; | 273 CheckedExceptionElement* checked_exceptions_start() const; |
263 | 274 |
264 // localvariable table | 275 // localvariable table |
265 int localvariable_table_length() const; | 276 int localvariable_table_length() const; |
266 LocalVariableTableElement* localvariable_table_start() const; | 277 LocalVariableTableElement* localvariable_table_start() const; |
278 | |
279 // exception table | |
280 int exception_table_length() const; | |
281 ExceptionTableElement* exception_table_start() const; | |
267 | 282 |
268 // byte codes | 283 // byte codes |
269 void set_code(address code) { | 284 void set_code(address code) { |
270 if (code_size() > 0) { | 285 if (code_size() > 0) { |
271 memcpy(code_base(), code, code_size()); | 286 memcpy(code_base(), code, code_size()); |
280 { return in_ByteSize(sizeof(constMethodOopDesc)); } | 295 { return in_ByteSize(sizeof(constMethodOopDesc)); } |
281 | 296 |
282 // interpreter support | 297 // interpreter support |
283 static ByteSize constants_offset() | 298 static ByteSize constants_offset() |
284 { return byte_offset_of(constMethodOopDesc, _constants); } | 299 { return byte_offset_of(constMethodOopDesc, _constants); } |
285 static ByteSize exception_table_offset() | |
286 { return byte_offset_of(constMethodOopDesc, _exception_table); } | |
287 | 300 |
288 // Garbage collection support | 301 // Garbage collection support |
289 oop* adr_constants() const { return (oop*)&_constants; } | 302 oop* adr_constants() const { return (oop*)&_constants; } |
290 oop* adr_stackmap_data() const { return (oop*)&_stackmap_data; } | 303 oop* adr_stackmap_data() const { return (oop*)&_stackmap_data; } |
291 oop* adr_exception_table() const { return (oop*)&_exception_table; } | |
292 bool is_conc_safe() { return _is_conc_safe; } | 304 bool is_conc_safe() { return _is_conc_safe; } |
293 void set_is_conc_safe(bool v) { _is_conc_safe = v; } | 305 void set_is_conc_safe(bool v) { _is_conc_safe = v; } |
294 | 306 |
295 // Unique id for the method | 307 // Unique id for the method |
296 static const u2 MAX_IDNUM; | 308 static const u2 MAX_IDNUM; |