comparison src/share/vm/oops/constMethodOop.hpp @ 6123:2fe087c3e814

7172967: Eliminate constMethod's _method backpointer to methodOop. Summary: Eliminate constMethod's _method backpointer to methodOop, and move the _constant field from methodOop to constMethod. Reviewed-by: roland, bdelsart, kamg
author jiangli
date Wed, 06 Jun 2012 14:33:43 -0400
parents f95d63e2154a
children 8150fa46d2ed
comparison
equal deleted inserted replaced
6115:6e2633440960 6123:2fe087c3e814
1 /* 1 /*
2 * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
39 // | header | 39 // | header |
40 // | klass | 40 // | klass |
41 // |------------------------------------------------------| 41 // |------------------------------------------------------|
42 // | fingerprint 1 | 42 // | fingerprint 1 |
43 // | fingerprint 2 | 43 // | fingerprint 2 |
44 // | method (oop) | 44 // | constants (oop) |
45 // | stackmap_data (oop) | 45 // | stackmap_data (oop) |
46 // | exception_table (oop) | 46 // | exception_table (oop) |
47 // | constMethod_size | 47 // | constMethod_size |
48 // | interp_kind | flags | code_size | 48 // | interp_kind | flags | code_size |
49 // | name index | signature index | 49 // | name index | signature index |
111 // multiple threads, so is volatile. 111 // multiple threads, so is volatile.
112 volatile uint64_t _fingerprint; 112 volatile uint64_t _fingerprint;
113 volatile bool _is_conc_safe; // if true, safe for concurrent GC processing 113 volatile bool _is_conc_safe; // if true, safe for concurrent GC processing
114 114
115 public: 115 public:
116 oop* oop_block_beg() const { return adr_method(); } 116 oop* oop_block_beg() const { return adr_constants(); }
117 oop* oop_block_end() const { return adr_exception_table() + 1; } 117 oop* oop_block_end() const { return adr_exception_table() + 1; }
118 118
119 private: 119 private:
120 // 120 //
121 // The oop block. See comment in klass.hpp before making changes. 121 // The oop block. See comment in klass.hpp before making changes.
122 // 122 //
123 123
124 // Backpointer to non-const methodOop (needed for some JVMTI operations) 124 constantPoolOop _constants; // Constant pool
125 methodOop _method;
126 125
127 // Raw stackmap data for the method 126 // Raw stackmap data for the method
128 typeArrayOop _stackmap_data; 127 typeArrayOop _stackmap_data;
129 128
130 // The exception handler table. 4-tuples of ints [start_pc, end_pc, 129 // The exception handler table. 4-tuples of ints [start_pc, end_pc,
165 { return (_flags & _has_localvariable_table) != 0; } 164 { return (_flags & _has_localvariable_table) != 0; }
166 165
167 void set_interpreter_kind(int kind) { _interpreter_kind = kind; } 166 void set_interpreter_kind(int kind) { _interpreter_kind = kind; }
168 int interpreter_kind(void) const { return _interpreter_kind; } 167 int interpreter_kind(void) const { return _interpreter_kind; }
169 168
170 // backpointer to non-const methodOop 169 // constant pool
171 methodOop method() const { return _method; } 170 constantPoolOop constants() const { return _constants; }
172 void set_method(methodOop m) { oop_store_without_check((oop*)&_method, (oop) m); } 171 void set_constants(constantPoolOop c) {
173 172 oop_store_without_check((oop*)&_constants, (oop)c);
173 }
174
175 methodOop method() const;
174 176
175 // stackmap table data 177 // stackmap table data
176 typeArrayOop stackmap_data() const { return _stackmap_data; } 178 typeArrayOop stackmap_data() const { return _stackmap_data; }
177 void set_stackmap_data(typeArrayOop sd) { 179 void set_stackmap_data(typeArrayOop sd) {
178 oop_store_without_check((oop*)&_stackmap_data, (oop)sd); 180 oop_store_without_check((oop*)&_stackmap_data, (oop)sd);
276 // Offset to bytecodes 278 // Offset to bytecodes
277 static ByteSize codes_offset() 279 static ByteSize codes_offset()
278 { return in_ByteSize(sizeof(constMethodOopDesc)); } 280 { return in_ByteSize(sizeof(constMethodOopDesc)); }
279 281
280 // interpreter support 282 // interpreter support
283 static ByteSize constants_offset()
284 { return byte_offset_of(constMethodOopDesc, _constants); }
281 static ByteSize exception_table_offset() 285 static ByteSize exception_table_offset()
282 { return byte_offset_of(constMethodOopDesc, _exception_table); } 286 { return byte_offset_of(constMethodOopDesc, _exception_table); }
283 287
284 // Garbage collection support 288 // Garbage collection support
285 oop* adr_method() const { return (oop*)&_method; } 289 oop* adr_constants() const { return (oop*)&_constants; }
286 oop* adr_stackmap_data() const { return (oop*)&_stackmap_data; } 290 oop* adr_stackmap_data() const { return (oop*)&_stackmap_data; }
287 oop* adr_exception_table() const { return (oop*)&_exception_table; } 291 oop* adr_exception_table() const { return (oop*)&_exception_table; }
288 bool is_conc_safe() { return _is_conc_safe; } 292 bool is_conc_safe() { return _is_conc_safe; }
289 void set_is_conc_safe(bool v) { _is_conc_safe = v; } 293 void set_is_conc_safe(bool v) { _is_conc_safe = v; }
290 294