75 // | (length is u2, elements are u2) | |
75 // | (length is u2, elements are u2) | |
76 // | (see class CheckedExceptionElement) | |
76 // | (see class CheckedExceptionElement) | |
77 // | (access flags bit tells whether table is present) | |
77 // | (access flags bit tells whether table is present) | |
78 // | (indexed from end of ConstMethod*) | |
78 // | (indexed from end of ConstMethod*) | |
79 // |------------------------------------------------------| |
79 // |------------------------------------------------------| |
|
80 // | method parameters elements + length (length last) | |
|
81 // | (length is u2, elements are u2, u4 structures) | |
|
82 // | (see class MethodParametersElement) | |
|
83 // | (access flags bit tells whether table is present) | |
|
84 // | (indexed from end of ConstMethod*) | |
|
85 // |------------------------------------------------------| |
80 // | generic signature index (u2) | |
86 // | generic signature index (u2) | |
81 // | (indexed from start of constMethodOop) | |
87 // | (indexed from start of constMethodOop) | |
82 // |------------------------------------------------------| |
88 // |------------------------------------------------------| |
|
89 // |
|
90 // IMPORTANT: If anything gets added here, there need to be changes to |
|
91 // ensure that ServicabilityAgent doesn't get broken as a result! |
83 |
92 |
84 |
93 |
85 // Utitily class decribing elements in checked exceptions table inlined in Method*. |
94 // Utitily class decribing elements in checked exceptions table inlined in Method*. |
86 class CheckedExceptionElement VALUE_OBJ_CLASS_SPEC { |
95 class CheckedExceptionElement VALUE_OBJ_CLASS_SPEC { |
87 public: |
96 public: |
121 _has_linenumber_table = 1, |
137 _has_linenumber_table = 1, |
122 _has_checked_exceptions = 2, |
138 _has_checked_exceptions = 2, |
123 _has_localvariable_table = 4, |
139 _has_localvariable_table = 4, |
124 _has_exception_table = 8, |
140 _has_exception_table = 8, |
125 _has_generic_signature = 16, |
141 _has_generic_signature = 16, |
126 _is_overpass = 32 |
142 _has_method_parameters = 32, |
|
143 _is_overpass = 64 |
127 }; |
144 }; |
128 |
145 |
129 // Bit vector of signature |
146 // Bit vector of signature |
130 // Callers interpret 0=not initialized yet and |
147 // Callers interpret 0=not initialized yet and |
131 // -1=too many args to fix, must parse the slow way. |
148 // -1=too many args to fix, must parse the slow way. |
158 ConstMethod(int byte_code_size, |
175 ConstMethod(int byte_code_size, |
159 int compressed_line_number_size, |
176 int compressed_line_number_size, |
160 int localvariable_table_length, |
177 int localvariable_table_length, |
161 int exception_table_length, |
178 int exception_table_length, |
162 int checked_exceptions_length, |
179 int checked_exceptions_length, |
|
180 int method_parameters_length, |
163 u2 generic_signature_index, |
181 u2 generic_signature_index, |
164 MethodType is_overpass, |
182 MethodType is_overpass, |
165 int size); |
183 int size); |
166 public: |
184 public: |
167 |
185 |
169 int byte_code_size, |
187 int byte_code_size, |
170 int compressed_line_number_size, |
188 int compressed_line_number_size, |
171 int localvariable_table_length, |
189 int localvariable_table_length, |
172 int exception_table_length, |
190 int exception_table_length, |
173 int checked_exceptions_length, |
191 int checked_exceptions_length, |
|
192 int method_parameters_length, |
174 u2 generic_signature_index, |
193 u2 generic_signature_index, |
175 MethodType mt, |
194 MethodType mt, |
176 TRAPS); |
195 TRAPS); |
177 |
196 |
178 bool is_constMethod() const { return true; } |
197 bool is_constMethod() const { return true; } |
180 // Inlined tables |
199 // Inlined tables |
181 void set_inlined_tables_length(u2 generic_signature_index, |
200 void set_inlined_tables_length(u2 generic_signature_index, |
182 int checked_exceptions_len, |
201 int checked_exceptions_len, |
183 int compressed_line_number_size, |
202 int compressed_line_number_size, |
184 int localvariable_table_len, |
203 int localvariable_table_len, |
185 int exception_table_len); |
204 int exception_table_len, |
|
205 int method_parameters_length); |
186 |
206 |
187 bool has_generic_signature() const |
207 bool has_generic_signature() const |
188 { return (_flags & _has_generic_signature) != 0; } |
208 { return (_flags & _has_generic_signature) != 0; } |
189 |
209 |
190 bool has_linenumber_table() const |
210 bool has_linenumber_table() const |
196 bool has_localvariable_table() const |
216 bool has_localvariable_table() const |
197 { return (_flags & _has_localvariable_table) != 0; } |
217 { return (_flags & _has_localvariable_table) != 0; } |
198 |
218 |
199 bool has_exception_handler() const |
219 bool has_exception_handler() const |
200 { return (_flags & _has_exception_table) != 0; } |
220 { return (_flags & _has_exception_table) != 0; } |
|
221 |
|
222 bool has_method_parameters() const |
|
223 { return (_flags & _has_method_parameters) != 0; } |
201 |
224 |
202 MethodType method_type() const { |
225 MethodType method_type() const { |
203 return ((_flags & _is_overpass) == 0) ? NORMAL : OVERPASS; |
226 return ((_flags & _is_overpass) == 0) ? NORMAL : OVERPASS; |
204 } |
227 } |
205 |
228 |
282 return sizeof(ConstMethod)/HeapWordSize; |
305 return sizeof(ConstMethod)/HeapWordSize; |
283 } |
306 } |
284 |
307 |
285 // Size needed |
308 // Size needed |
286 static int size(int code_size, int compressed_line_number_size, |
309 static int size(int code_size, int compressed_line_number_size, |
287 int local_variable_table_length, |
310 int local_variable_table_length, |
288 int exception_table_length, |
311 int exception_table_length, |
289 int checked_exceptions_length, |
312 int checked_exceptions_length, |
290 u2 generic_signature_index); |
313 int method_parameters_length, |
|
314 u2 generic_signature_index); |
291 |
315 |
292 int size() const { return _constMethod_size;} |
316 int size() const { return _constMethod_size;} |
293 void set_constMethod_size(int size) { _constMethod_size = size; } |
317 void set_constMethod_size(int size) { _constMethod_size = size; } |
294 |
318 |
295 // code size |
319 // code size |
306 u_char* compressed_linenumber_table() const; // not preserved by gc |
330 u_char* compressed_linenumber_table() const; // not preserved by gc |
307 u2* generic_signature_index_addr() const; |
331 u2* generic_signature_index_addr() const; |
308 u2* checked_exceptions_length_addr() const; |
332 u2* checked_exceptions_length_addr() const; |
309 u2* localvariable_table_length_addr() const; |
333 u2* localvariable_table_length_addr() const; |
310 u2* exception_table_length_addr() const; |
334 u2* exception_table_length_addr() const; |
|
335 u2* method_parameters_length_addr() const; |
311 |
336 |
312 // checked exceptions |
337 // checked exceptions |
313 int checked_exceptions_length() const; |
338 int checked_exceptions_length() const; |
314 CheckedExceptionElement* checked_exceptions_start() const; |
339 CheckedExceptionElement* checked_exceptions_start() const; |
315 |
340 |
318 LocalVariableTableElement* localvariable_table_start() const; |
343 LocalVariableTableElement* localvariable_table_start() const; |
319 |
344 |
320 // exception table |
345 // exception table |
321 int exception_table_length() const; |
346 int exception_table_length() const; |
322 ExceptionTableElement* exception_table_start() const; |
347 ExceptionTableElement* exception_table_start() const; |
|
348 |
|
349 // method parameters table |
|
350 int method_parameters_length() const; |
|
351 MethodParametersElement* method_parameters_start() const; |
323 |
352 |
324 // byte codes |
353 // byte codes |
325 void set_code(address code) { |
354 void set_code(address code) { |
326 if (code_size() > 0) { |
355 if (code_size() > 0) { |
327 memcpy(code_base(), code, code_size()); |
356 memcpy(code_base(), code, code_size()); |