104 u2 slot;
105 };
106
107 // Utility class describing elements in exception table
108 class ExceptionTableElement VALUE_OBJ_CLASS_SPEC {
109 public:
110 u2 start_pc;
111 u2 end_pc;
112 u2 handler_pc;
113 u2 catch_type_index;
114 };
115
116 // Utility class describing elements in method parameters
117 class MethodParametersElement VALUE_OBJ_CLASS_SPEC {
118 public:
119 u2 name_cp_index;
120 u2 flags;
121 };
122
123 class KlassSizeStats;
124
125 // Class to collect the sizes of ConstMethod inline tables
126 #define INLINE_TABLES_DO(do_element) \
127 do_element(localvariable_table_length) \
128 do_element(compressed_linenumber_size) \
129 do_element(exception_table_length) \
130 do_element(checked_exceptions_length) \
131 do_element(method_parameters_length) \
132 do_element(generic_signature_index) \
133 do_element(method_annotations_length) \
134 do_element(parameter_annotations_length) \
135 do_element(type_annotations_length) \
136 do_element(default_annotations_length)
137
138 #define INLINE_TABLE_DECLARE(sym) int _##sym;
139 #define INLINE_TABLE_PARAM(sym) int sym,
140 #define INLINE_TABLE_INIT(sym) _##sym(sym),
141 #define INLINE_TABLE_NULL(sym) _##sym(0),
142 #define INLINE_TABLE_ACCESSOR(sym) int sym() const { return _##sym; }
143
184 _is_overpass = 0x0040,
185 _has_method_annotations = 0x0080,
186 _has_parameter_annotations = 0x0100,
187 _has_type_annotations = 0x0200,
188 _has_default_annotations = 0x0400
189 };
190
191 // Bit vector of signature
192 // Callers interpret 0=not initialized yet and
193 // -1=too many args to fix, must parse the slow way.
194 // The real initial value is special to account for nonatomicity of 64 bit
195 // loads and stores. This value may updated and read without a lock by
196 // multiple threads, so is volatile.
197 volatile uint64_t _fingerprint;
198
199 ConstantPool* _constants; // Constant pool
200
201 // Raw stackmap data for the method
202 Array<u1>* _stackmap_data;
203
204 int _constMethod_size;
205 u2 _flags;
206
207 // Size of Java bytecodes allocated immediately after Method*.
208 u2 _code_size;
209 u2 _name_index; // Method name (index in constant pool)
210 u2 _signature_index; // Method signature (index in constant pool)
211 u2 _method_idnum; // unique identification number for the method within the class
212 // initially corresponds to the index into the methods array.
213 // but this may change with redefinition
214 u2 _max_stack; // Maximum number of entries on the expression stack
215 u2 _max_locals; // Number of local variables used by this method
216 u2 _size_of_parameters; // size of the parameter block (receiver + arguments) in words
217 u2 _orig_method_idnum; // Original unique identification number for the method
218
219 // Constructor
220 ConstMethod(int byte_code_size,
221 InlineTableSizes* sizes,
222 MethodType is_overpass,
223 int size);
259 void set_method_type(MethodType mt) {
260 if (mt == NORMAL) {
261 _flags &= ~(_is_overpass);
262 } else {
263 _flags |= _is_overpass;
264 }
265 }
266
267 // constant pool
268 ConstantPool* constants() const { return _constants; }
269 void set_constants(ConstantPool* c) { _constants = c; }
270
271 Method* method() const;
272
273 // stackmap table data
274 Array<u1>* stackmap_data() const { return _stackmap_data; }
275 void set_stackmap_data(Array<u1>* sd) { _stackmap_data = sd; }
276 void copy_stackmap_data(ClassLoaderData* loader_data, u1* sd, int length, TRAPS);
277 bool has_stackmap_table() const { return _stackmap_data != NULL; }
278
279 void init_fingerprint() {
280 const uint64_t initval = UCONST64(0x8000000000000000);
281 _fingerprint = initval;
282 }
283
284 uint64_t fingerprint() const {
285 // Since reads aren't atomic for 64 bits, if any of the high or low order
286 // word is the initial value, return 0. See init_fingerprint for initval.
287 uint high_fp = (uint)(_fingerprint >> 32);
288 if ((int) _fingerprint == 0 || high_fp == 0x80000000) {
289 return 0L;
290 } else {
291 return _fingerprint;
292 }
293 }
294
295 uint64_t set_fingerprint(uint64_t new_fingerprint) {
296 #ifdef ASSERT
297 // Assert only valid if complete/valid 64 bit _fingerprint value is read.
298 uint64_t oldfp = fingerprint();
|
104 u2 slot;
105 };
106
107 // Utility class describing elements in exception table
108 class ExceptionTableElement VALUE_OBJ_CLASS_SPEC {
109 public:
110 u2 start_pc;
111 u2 end_pc;
112 u2 handler_pc;
113 u2 catch_type_index;
114 };
115
116 // Utility class describing elements in method parameters
117 class MethodParametersElement VALUE_OBJ_CLASS_SPEC {
118 public:
119 u2 name_cp_index;
120 u2 flags;
121 };
122
123 class KlassSizeStats;
124 class AdapterHandlerEntry;
125
126 // Class to collect the sizes of ConstMethod inline tables
127 #define INLINE_TABLES_DO(do_element) \
128 do_element(localvariable_table_length) \
129 do_element(compressed_linenumber_size) \
130 do_element(exception_table_length) \
131 do_element(checked_exceptions_length) \
132 do_element(method_parameters_length) \
133 do_element(generic_signature_index) \
134 do_element(method_annotations_length) \
135 do_element(parameter_annotations_length) \
136 do_element(type_annotations_length) \
137 do_element(default_annotations_length)
138
139 #define INLINE_TABLE_DECLARE(sym) int _##sym;
140 #define INLINE_TABLE_PARAM(sym) int sym,
141 #define INLINE_TABLE_INIT(sym) _##sym(sym),
142 #define INLINE_TABLE_NULL(sym) _##sym(0),
143 #define INLINE_TABLE_ACCESSOR(sym) int sym() const { return _##sym; }
144
185 _is_overpass = 0x0040,
186 _has_method_annotations = 0x0080,
187 _has_parameter_annotations = 0x0100,
188 _has_type_annotations = 0x0200,
189 _has_default_annotations = 0x0400
190 };
191
192 // Bit vector of signature
193 // Callers interpret 0=not initialized yet and
194 // -1=too many args to fix, must parse the slow way.
195 // The real initial value is special to account for nonatomicity of 64 bit
196 // loads and stores. This value may updated and read without a lock by
197 // multiple threads, so is volatile.
198 volatile uint64_t _fingerprint;
199
200 ConstantPool* _constants; // Constant pool
201
202 // Raw stackmap data for the method
203 Array<u1>* _stackmap_data;
204
205 // Adapter blob (i2c/c2i) for this Method*. Set once when method is linked.
206 union {
207 AdapterHandlerEntry* _adapter;
208 AdapterHandlerEntry** _adapter_trampoline;
209 };
210
211 int _constMethod_size;
212 u2 _flags;
213
214 // Size of Java bytecodes allocated immediately after Method*.
215 u2 _code_size;
216 u2 _name_index; // Method name (index in constant pool)
217 u2 _signature_index; // Method signature (index in constant pool)
218 u2 _method_idnum; // unique identification number for the method within the class
219 // initially corresponds to the index into the methods array.
220 // but this may change with redefinition
221 u2 _max_stack; // Maximum number of entries on the expression stack
222 u2 _max_locals; // Number of local variables used by this method
223 u2 _size_of_parameters; // size of the parameter block (receiver + arguments) in words
224 u2 _orig_method_idnum; // Original unique identification number for the method
225
226 // Constructor
227 ConstMethod(int byte_code_size,
228 InlineTableSizes* sizes,
229 MethodType is_overpass,
230 int size);
266 void set_method_type(MethodType mt) {
267 if (mt == NORMAL) {
268 _flags &= ~(_is_overpass);
269 } else {
270 _flags |= _is_overpass;
271 }
272 }
273
274 // constant pool
275 ConstantPool* constants() const { return _constants; }
276 void set_constants(ConstantPool* c) { _constants = c; }
277
278 Method* method() const;
279
280 // stackmap table data
281 Array<u1>* stackmap_data() const { return _stackmap_data; }
282 void set_stackmap_data(Array<u1>* sd) { _stackmap_data = sd; }
283 void copy_stackmap_data(ClassLoaderData* loader_data, u1* sd, int length, TRAPS);
284 bool has_stackmap_table() const { return _stackmap_data != NULL; }
285
286 // adapter
287 void set_adapter_entry(AdapterHandlerEntry* adapter) {
288 assert(!is_shared(), "shared methods have fixed adapter_trampoline");
289 _adapter = adapter;
290 }
291 void set_adapter_trampoline(AdapterHandlerEntry** trampoline) {
292 assert(DumpSharedSpaces, "must be");
293 assert(*trampoline == NULL, "must be NULL during dump time, to be initialized at run time");
294 _adapter_trampoline = trampoline;
295 }
296 void update_adapter_trampoline(AdapterHandlerEntry* adapter) {
297 assert(is_shared(), "must be");
298 *_adapter_trampoline = adapter;
299 assert(this->adapter() == adapter, "must be");
300 }
301 AdapterHandlerEntry* adapter() {
302 if (is_shared()) {
303 return *_adapter_trampoline;
304 } else {
305 return _adapter;
306 }
307 }
308
309 void init_fingerprint() {
310 const uint64_t initval = UCONST64(0x8000000000000000);
311 _fingerprint = initval;
312 }
313
314 uint64_t fingerprint() const {
315 // Since reads aren't atomic for 64 bits, if any of the high or low order
316 // word is the initial value, return 0. See init_fingerprint for initval.
317 uint high_fp = (uint)(_fingerprint >> 32);
318 if ((int) _fingerprint == 0 || high_fp == 0x80000000) {
319 return 0L;
320 } else {
321 return _fingerprint;
322 }
323 }
324
325 uint64_t set_fingerprint(uint64_t new_fingerprint) {
326 #ifdef ASSERT
327 // Assert only valid if complete/valid 64 bit _fingerprint value is read.
328 uint64_t oldfp = fingerprint();
|