comparison src/share/vm/oops/methodOop.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 0382d2b469b2
children eba1d5bce9e8
comparison
equal deleted inserted replaced
6115:6e2633440960 6123:2fe087c3e814
62 // |------------------------------------------------------| 62 // |------------------------------------------------------|
63 // | header | 63 // | header |
64 // | klass | 64 // | klass |
65 // |------------------------------------------------------| 65 // |------------------------------------------------------|
66 // | constMethodOop (oop) | 66 // | constMethodOop (oop) |
67 // | constants (oop) |
68 // |------------------------------------------------------| 67 // |------------------------------------------------------|
69 // | methodData (oop) | 68 // | methodData (oop) |
70 // | interp_invocation_count | 69 // | interp_invocation_count |
71 // |------------------------------------------------------| 70 // |------------------------------------------------------|
72 // | access_flags | 71 // | access_flags |
108 class methodOopDesc : public oopDesc { 107 class methodOopDesc : public oopDesc {
109 friend class methodKlass; 108 friend class methodKlass;
110 friend class VMStructs; 109 friend class VMStructs;
111 private: 110 private:
112 constMethodOop _constMethod; // Method read-only data. 111 constMethodOop _constMethod; // Method read-only data.
113 constantPoolOop _constants; // Constant pool
114 methodDataOop _method_data; 112 methodDataOop _method_data;
115 int _interpreter_invocation_count; // Count of times invoked (reused as prev_event_count in tiered) 113 int _interpreter_invocation_count; // Count of times invoked (reused as prev_event_count in tiered)
116 AccessFlags _access_flags; // Access flags 114 AccessFlags _access_flags; // Access flags
117 int _vtable_index; // vtable index of this method (see VtableIndexFlag) 115 int _vtable_index; // vtable index of this method (see VtableIndexFlag)
118 // note: can have vtables with >2**16 elements (because of inheritance) 116 // note: can have vtables with >2**16 elements (because of inheritance)
168 // access flag 166 // access flag
169 AccessFlags access_flags() const { return _access_flags; } 167 AccessFlags access_flags() const { return _access_flags; }
170 void set_access_flags(AccessFlags flags) { _access_flags = flags; } 168 void set_access_flags(AccessFlags flags) { _access_flags = flags; }
171 169
172 // name 170 // name
173 Symbol* name() const { return _constants->symbol_at(name_index()); } 171 Symbol* name() const { return constants()->symbol_at(name_index()); }
174 int name_index() const { return constMethod()->name_index(); } 172 int name_index() const { return constMethod()->name_index(); }
175 void set_name_index(int index) { constMethod()->set_name_index(index); } 173 void set_name_index(int index) { constMethod()->set_name_index(index); }
176 174
177 // signature 175 // signature
178 Symbol* signature() const { return _constants->symbol_at(signature_index()); } 176 Symbol* signature() const { return constants()->symbol_at(signature_index()); }
179 int signature_index() const { return constMethod()->signature_index(); } 177 int signature_index() const { return constMethod()->signature_index(); }
180 void set_signature_index(int index) { constMethod()->set_signature_index(index); } 178 void set_signature_index(int index) { constMethod()->set_signature_index(index); }
181 179
182 // generics support 180 // generics support
183 Symbol* generic_signature() const { int idx = generic_signature_index(); return ((idx != 0) ? _constants->symbol_at(idx) : (Symbol*)NULL); } 181 Symbol* generic_signature() const { int idx = generic_signature_index(); return ((idx != 0) ? constants()->symbol_at(idx) : (Symbol*)NULL); }
184 int generic_signature_index() const { return constMethod()->generic_signature_index(); } 182 int generic_signature_index() const { return constMethod()->generic_signature_index(); }
185 void set_generic_signature_index(int index) { constMethod()->set_generic_signature_index(index); } 183 void set_generic_signature_index(int index) { constMethod()->set_generic_signature_index(index); }
186 184
187 // annotations support 185 // annotations support
188 typeArrayOop annotations() const { return instanceKlass::cast(method_holder())->get_method_annotations_of(method_idnum()); } 186 typeArrayOop annotations() const { return instanceKlass::cast(method_holder())->get_method_annotations_of(method_idnum()); }
240 assert(0 <= size && size < (1 << 16), "invalid method size"); 238 assert(0 <= size && size < (1 << 16), "invalid method size");
241 _method_size = size; 239 _method_size = size;
242 } 240 }
243 241
244 // constant pool for klassOop holding this method 242 // constant pool for klassOop holding this method
245 constantPoolOop constants() const { return _constants; } 243 constantPoolOop constants() const { return constMethod()->constants(); }
246 void set_constants(constantPoolOop c) { oop_store_without_check((oop*)&_constants, c); } 244 void set_constants(constantPoolOop c) { constMethod()->set_constants(c); }
247 245
248 // max stack 246 // max stack
249 int max_stack() const { return _max_stack; } 247 int max_stack() const { return _max_stack; }
250 void set_max_stack(int size) { _max_stack = size; } 248 void set_max_stack(int size) { _max_stack = size; }
251 249
451 { return constMethod()->has_linenumber_table(); } 449 { return constMethod()->has_linenumber_table(); }
452 u_char* compressed_linenumber_table() const 450 u_char* compressed_linenumber_table() const
453 { return constMethod()->compressed_linenumber_table(); } 451 { return constMethod()->compressed_linenumber_table(); }
454 452
455 // method holder (the klassOop holding this method) 453 // method holder (the klassOop holding this method)
456 klassOop method_holder() const { return _constants->pool_holder(); } 454 klassOop method_holder() const { return constants()->pool_holder(); }
457 455
458 void compute_size_of_parameters(Thread *thread); // word size of parameters (receiver if any + arguments) 456 void compute_size_of_parameters(Thread *thread); // word size of parameters (receiver if any + arguments)
459 Symbol* klass_name() const; // returns the name of the method holder 457 Symbol* klass_name() const; // returns the name of the method holder
460 BasicType result_type() const; // type of the method result 458 BasicType result_type() const; // type of the method result
461 int result_type_index() const; // type index of the method result 459 int result_type_index() const; // type index of the method result
542 540
543 bool object_is_parsable() const { return method_size() > 0; } 541 bool object_is_parsable() const { return method_size() > 0; }
544 542
545 // interpreter support 543 // interpreter support
546 static ByteSize const_offset() { return byte_offset_of(methodOopDesc, _constMethod ); } 544 static ByteSize const_offset() { return byte_offset_of(methodOopDesc, _constMethod ); }
547 static ByteSize constants_offset() { return byte_offset_of(methodOopDesc, _constants ); }
548 static ByteSize access_flags_offset() { return byte_offset_of(methodOopDesc, _access_flags ); } 545 static ByteSize access_flags_offset() { return byte_offset_of(methodOopDesc, _access_flags ); }
549 #ifdef CC_INTERP 546 #ifdef CC_INTERP
550 static ByteSize result_index_offset() { return byte_offset_of(methodOopDesc, _result_index ); } 547 static ByteSize result_index_offset() { return byte_offset_of(methodOopDesc, _result_index ); }
551 #endif /* CC_INTERP */ 548 #endif /* CC_INTERP */
552 static ByteSize size_of_locals_offset() { return byte_offset_of(methodOopDesc, _max_locals ); } 549 static ByteSize size_of_locals_offset() { return byte_offset_of(methodOopDesc, _max_locals ); }
721 address* native_function_addr() const { assert(is_native(), "must be native"); return (address*) (this+1); } 718 address* native_function_addr() const { assert(is_native(), "must be native"); return (address*) (this+1); }
722 address* signature_handler_addr() const { return native_function_addr() + 1; } 719 address* signature_handler_addr() const { return native_function_addr() + 1; }
723 720
724 // Garbage collection support 721 // Garbage collection support
725 oop* adr_constMethod() const { return (oop*)&_constMethod; } 722 oop* adr_constMethod() const { return (oop*)&_constMethod; }
726 oop* adr_constants() const { return (oop*)&_constants; }
727 oop* adr_method_data() const { return (oop*)&_method_data; } 723 oop* adr_method_data() const { return (oop*)&_method_data; }
728 }; 724 };
729 725
730 726
731 // Utility class for compressing line number tables 727 // Utility class for compressing line number tables