Mercurial > hg > truffle
comparison src/share/vm/oops/instanceKlass.hpp @ 2177:3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
Summary: move symbols from permgen into C heap and reference count them
Reviewed-by: never, acorn, jmasa, stefank
author | coleenp |
---|---|
date | Thu, 27 Jan 2011 16:11:27 -0800 |
parents | f95d63e2154a |
children | e5383553fd4e |
comparison
equal
deleted
inserted
replaced
2176:27e4ea99855d | 2177:3582bf76420e |
---|---|
187 // This is only non-null for an anonymous class (AnonymousClasses enabled). | 187 // This is only non-null for an anonymous class (AnonymousClasses enabled). |
188 // The host class is either named, or a previously loaded anonymous class. | 188 // The host class is either named, or a previously loaded anonymous class. |
189 klassOop _host_klass; | 189 klassOop _host_klass; |
190 // Class signers. | 190 // Class signers. |
191 objArrayOop _signers; | 191 objArrayOop _signers; |
192 // Name of source file containing this klass, NULL if not specified. | |
193 symbolOop _source_file_name; | |
194 // the source debug extension for this klass, NULL if not specified. | |
195 symbolOop _source_debug_extension; | |
196 // inner_classes attribute. | 192 // inner_classes attribute. |
197 typeArrayOop _inner_classes; | 193 typeArrayOop _inner_classes; |
198 // Implementors of this interface (not valid if it overflows) | 194 // Implementors of this interface (not valid if it overflows) |
199 klassOop _implementors[implementors_limit]; | 195 klassOop _implementors[implementors_limit]; |
200 // Generic signature, or null if none. | |
201 symbolOop _generic_signature; | |
202 // invokedynamic bootstrap method (a java.dyn.MethodHandle) | 196 // invokedynamic bootstrap method (a java.dyn.MethodHandle) |
203 oop _bootstrap_method; | 197 oop _bootstrap_method; |
204 // Annotations for this class, or null if none. | 198 // Annotations for this class, or null if none. |
205 typeArrayOop _class_annotations; | 199 typeArrayOop _class_annotations; |
206 // Annotation objects (byte arrays) for fields, or null if no annotations. | 200 // Annotation objects (byte arrays) for fields, or null if no annotations. |
219 objArrayOop _methods_default_annotations; | 213 objArrayOop _methods_default_annotations; |
220 | 214 |
221 // | 215 // |
222 // End of the oop block. | 216 // End of the oop block. |
223 // | 217 // |
218 | |
219 // Name of source file containing this klass, NULL if not specified. | |
220 Symbol* _source_file_name; | |
221 // the source debug extension for this klass, NULL if not specified. | |
222 Symbol* _source_debug_extension; | |
223 // Generic signature, or null if none. | |
224 Symbol* _generic_signature; | |
225 // Array name derived from this class which needs unreferencing | |
226 // if this class is unloaded. | |
227 Symbol* _array_name; | |
224 | 228 |
225 // Number of heapOopSize words used by non-static fields in this klass | 229 // Number of heapOopSize words used by non-static fields in this klass |
226 // (including inherited fields but after header_size()). | 230 // (including inherited fields but after header_size()). |
227 int _nonstatic_field_size; | 231 int _nonstatic_field_size; |
228 int _static_field_size; // number words used by static fields (oop and non-oop) in this klass | 232 int _static_field_size; // number words used by static fields (oop and non-oop) in this klass |
341 inner_class_access_flags_offset = 3, | 345 inner_class_access_flags_offset = 3, |
342 inner_class_next_offset = 4 | 346 inner_class_next_offset = 4 |
343 }; | 347 }; |
344 | 348 |
345 // method override check | 349 // method override check |
346 bool is_override(methodHandle super_method, Handle targetclassloader, symbolHandle targetclassname, TRAPS); | 350 bool is_override(methodHandle super_method, Handle targetclassloader, Symbol* targetclassname, TRAPS); |
347 | 351 |
348 // package | 352 // package |
349 bool is_same_class_package(klassOop class2); | 353 bool is_same_class_package(klassOop class2); |
350 bool is_same_class_package(oop classloader2, symbolOop classname2); | 354 bool is_same_class_package(oop classloader2, Symbol* classname2); |
351 static bool is_same_class_package(oop class_loader1, symbolOop class_name1, oop class_loader2, symbolOop class_name2); | 355 static bool is_same_class_package(oop class_loader1, Symbol* class_name1, oop class_loader2, Symbol* class_name2); |
352 | 356 |
353 // find an enclosing class (defined where original code was, in jvm.cpp!) | 357 // find an enclosing class (defined where original code was, in jvm.cpp!) |
354 klassOop compute_enclosing_class(bool* inner_is_member, TRAPS) { | 358 klassOop compute_enclosing_class(bool* inner_is_member, TRAPS) { |
355 instanceKlassHandle self(THREAD, this->as_klassOop()); | 359 instanceKlassHandle self(THREAD, this->as_klassOop()); |
356 return compute_enclosing_class_impl(self, inner_is_member, THREAD); | 360 return compute_enclosing_class_impl(self, inner_is_member, THREAD); |
400 // reference type | 404 // reference type |
401 ReferenceType reference_type() const { return _reference_type; } | 405 ReferenceType reference_type() const { return _reference_type; } |
402 void set_reference_type(ReferenceType t) { _reference_type = t; } | 406 void set_reference_type(ReferenceType t) { _reference_type = t; } |
403 | 407 |
404 // find local field, returns true if found | 408 // find local field, returns true if found |
405 bool find_local_field(symbolOop name, symbolOop sig, fieldDescriptor* fd) const; | 409 bool find_local_field(Symbol* name, Symbol* sig, fieldDescriptor* fd) const; |
406 // find field in direct superinterfaces, returns the interface in which the field is defined | 410 // find field in direct superinterfaces, returns the interface in which the field is defined |
407 klassOop find_interface_field(symbolOop name, symbolOop sig, fieldDescriptor* fd) const; | 411 klassOop find_interface_field(Symbol* name, Symbol* sig, fieldDescriptor* fd) const; |
408 // find field according to JVM spec 5.4.3.2, returns the klass in which the field is defined | 412 // find field according to JVM spec 5.4.3.2, returns the klass in which the field is defined |
409 klassOop find_field(symbolOop name, symbolOop sig, fieldDescriptor* fd) const; | 413 klassOop find_field(Symbol* name, Symbol* sig, fieldDescriptor* fd) const; |
410 // find instance or static fields according to JVM spec 5.4.3.2, returns the klass in which the field is defined | 414 // find instance or static fields according to JVM spec 5.4.3.2, returns the klass in which the field is defined |
411 klassOop find_field(symbolOop name, symbolOop sig, bool is_static, fieldDescriptor* fd) const; | 415 klassOop find_field(Symbol* name, Symbol* sig, bool is_static, fieldDescriptor* fd) const; |
412 | 416 |
413 // find a non-static or static field given its offset within the class. | 417 // find a non-static or static field given its offset within the class. |
414 bool contains_field_offset(int offset) { | 418 bool contains_field_offset(int offset) { |
415 return instanceOopDesc::contains_field_offset(offset, nonstatic_field_size()); | 419 return instanceOopDesc::contains_field_offset(offset, nonstatic_field_size()); |
416 } | 420 } |
417 | 421 |
418 bool find_local_field_from_offset(int offset, bool is_static, fieldDescriptor* fd) const; | 422 bool find_local_field_from_offset(int offset, bool is_static, fieldDescriptor* fd) const; |
419 bool find_field_from_offset(int offset, bool is_static, fieldDescriptor* fd) const; | 423 bool find_field_from_offset(int offset, bool is_static, fieldDescriptor* fd) const; |
420 | 424 |
421 // find a local method (returns NULL if not found) | 425 // find a local method (returns NULL if not found) |
422 methodOop find_method(symbolOop name, symbolOop signature) const; | 426 methodOop find_method(Symbol* name, Symbol* signature) const; |
423 static methodOop find_method(objArrayOop methods, symbolOop name, symbolOop signature); | 427 static methodOop find_method(objArrayOop methods, Symbol* name, Symbol* signature); |
424 | 428 |
425 // lookup operation (returns NULL if not found) | 429 // lookup operation (returns NULL if not found) |
426 methodOop uncached_lookup_method(symbolOop name, symbolOop signature) const; | 430 methodOop uncached_lookup_method(Symbol* name, Symbol* signature) const; |
427 | 431 |
428 // lookup a method in all the interfaces that this class implements | 432 // lookup a method in all the interfaces that this class implements |
429 // (returns NULL if not found) | 433 // (returns NULL if not found) |
430 methodOop lookup_method_in_all_interfaces(symbolOop name, symbolOop signature) const; | 434 methodOop lookup_method_in_all_interfaces(Symbol* name, Symbol* signature) const; |
431 | 435 |
432 // constant pool | 436 // constant pool |
433 constantPoolOop constants() const { return _constants; } | 437 constantPoolOop constants() const { return _constants; } |
434 void set_constants(constantPoolOop c) { oop_store_without_check((oop*) &_constants, (oop) c); } | 438 void set_constants(constantPoolOop c) { oop_store_without_check((oop*) &_constants, (oop) c); } |
435 | 439 |
449 // signers | 453 // signers |
450 objArrayOop signers() const { return _signers; } | 454 objArrayOop signers() const { return _signers; } |
451 void set_signers(objArrayOop s) { oop_store((oop*) &_signers, oop(s)); } | 455 void set_signers(objArrayOop s) { oop_store((oop*) &_signers, oop(s)); } |
452 | 456 |
453 // source file name | 457 // source file name |
454 symbolOop source_file_name() const { return _source_file_name; } | 458 Symbol* source_file_name() const { return _source_file_name; } |
455 void set_source_file_name(symbolOop n) { oop_store_without_check((oop*) &_source_file_name, (oop) n); } | 459 void set_source_file_name(Symbol* n); |
456 | 460 |
457 // minor and major version numbers of class file | 461 // minor and major version numbers of class file |
458 u2 minor_version() const { return _minor_version; } | 462 u2 minor_version() const { return _minor_version; } |
459 void set_minor_version(u2 minor_version) { _minor_version = minor_version; } | 463 void set_minor_version(u2 minor_version) { _minor_version = minor_version; } |
460 u2 major_version() const { return _major_version; } | 464 u2 major_version() const { return _major_version; } |
461 void set_major_version(u2 major_version) { _major_version = major_version; } | 465 void set_major_version(u2 major_version) { _major_version = major_version; } |
462 | 466 |
463 // source debug extension | 467 // source debug extension |
464 symbolOop source_debug_extension() const { return _source_debug_extension; } | 468 Symbol* source_debug_extension() const { return _source_debug_extension; } |
465 void set_source_debug_extension(symbolOop n){ oop_store_without_check((oop*) &_source_debug_extension, (oop) n); } | 469 void set_source_debug_extension(Symbol* n); |
470 | |
471 // symbol unloading support (refcount already added) | |
472 Symbol* array_name() { return _array_name; } | |
473 void set_array_name(Symbol* name) { assert(_array_name == NULL, "name already created"); _array_name = name; } | |
466 | 474 |
467 // nonstatic oop-map blocks | 475 // nonstatic oop-map blocks |
468 static int nonstatic_oop_map_size(unsigned int oop_map_count) { | 476 static int nonstatic_oop_map_size(unsigned int oop_map_count) { |
469 return oop_map_count * OopMapBlock::size_in_words(); | 477 return oop_map_count * OopMapBlock::size_in_words(); |
470 } | 478 } |
509 // for adding methods, constMethodOopDesc::UNSET_IDNUM means no more ids available | 517 // for adding methods, constMethodOopDesc::UNSET_IDNUM means no more ids available |
510 inline u2 next_method_idnum(); | 518 inline u2 next_method_idnum(); |
511 void set_initial_method_idnum(u2 value) { _idnum_allocated_count = value; } | 519 void set_initial_method_idnum(u2 value) { _idnum_allocated_count = value; } |
512 | 520 |
513 // generics support | 521 // generics support |
514 symbolOop generic_signature() const { return _generic_signature; } | 522 Symbol* generic_signature() const { return _generic_signature; } |
515 void set_generic_signature(symbolOop sig) { oop_store_without_check((oop*)&_generic_signature, (oop)sig); } | 523 void set_generic_signature(Symbol* sig) { _generic_signature = sig; } |
524 | |
516 u2 enclosing_method_class_index() const { return _enclosing_method_class_index; } | 525 u2 enclosing_method_class_index() const { return _enclosing_method_class_index; } |
517 u2 enclosing_method_method_index() const { return _enclosing_method_method_index; } | 526 u2 enclosing_method_method_index() const { return _enclosing_method_method_index; } |
518 void set_enclosing_method_indices(u2 class_index, | 527 void set_enclosing_method_indices(u2 class_index, |
519 u2 method_index) { _enclosing_method_class_index = class_index; | 528 u2 method_index) { _enclosing_method_class_index = class_index; |
520 _enclosing_method_method_index = method_index; } | 529 _enclosing_method_method_index = method_index; } |
805 oop* adr_constants() const { return (oop*)&this->_constants;} | 814 oop* adr_constants() const { return (oop*)&this->_constants;} |
806 oop* adr_class_loader() const { return (oop*)&this->_class_loader;} | 815 oop* adr_class_loader() const { return (oop*)&this->_class_loader;} |
807 oop* adr_protection_domain() const { return (oop*)&this->_protection_domain;} | 816 oop* adr_protection_domain() const { return (oop*)&this->_protection_domain;} |
808 oop* adr_host_klass() const { return (oop*)&this->_host_klass;} | 817 oop* adr_host_klass() const { return (oop*)&this->_host_klass;} |
809 oop* adr_signers() const { return (oop*)&this->_signers;} | 818 oop* adr_signers() const { return (oop*)&this->_signers;} |
810 oop* adr_source_file_name() const { return (oop*)&this->_source_file_name;} | |
811 oop* adr_source_debug_extension() const { return (oop*)&this->_source_debug_extension;} | |
812 oop* adr_inner_classes() const { return (oop*)&this->_inner_classes;} | 819 oop* adr_inner_classes() const { return (oop*)&this->_inner_classes;} |
813 oop* adr_implementors() const { return (oop*)&this->_implementors[0];} | 820 oop* adr_implementors() const { return (oop*)&this->_implementors[0];} |
814 oop* adr_generic_signature() const { return (oop*)&this->_generic_signature;} | |
815 oop* adr_bootstrap_method() const { return (oop*)&this->_bootstrap_method;} | 821 oop* adr_bootstrap_method() const { return (oop*)&this->_bootstrap_method;} |
816 oop* adr_methods_jmethod_ids() const { return (oop*)&this->_methods_jmethod_ids;} | 822 oop* adr_methods_jmethod_ids() const { return (oop*)&this->_methods_jmethod_ids;} |
817 oop* adr_methods_cached_itable_indices() const { return (oop*)&this->_methods_cached_itable_indices;} | 823 oop* adr_methods_cached_itable_indices() const { return (oop*)&this->_methods_cached_itable_indices;} |
818 oop* adr_class_annotations() const { return (oop*)&this->_class_annotations;} | 824 oop* adr_class_annotations() const { return (oop*)&this->_class_annotations;} |
819 oop* adr_fields_annotations() const { return (oop*)&this->_fields_annotations;} | 825 oop* adr_fields_annotations() const { return (oop*)&this->_fields_annotations;} |
841 klassOop array_klass_impl(bool or_null, TRAPS); | 847 klassOop array_klass_impl(bool or_null, TRAPS); |
842 | 848 |
843 public: | 849 public: |
844 // sharing support | 850 // sharing support |
845 virtual void remove_unshareable_info(); | 851 virtual void remove_unshareable_info(); |
846 void field_names_and_sigs_iterate(OopClosure* closure); | 852 virtual void shared_symbols_iterate(SymbolClosure* closure); |
847 | 853 |
848 // jvm support | 854 // jvm support |
849 jint compute_modifier_flags(TRAPS) const; | 855 jint compute_modifier_flags(TRAPS) const; |
850 | 856 |
851 public: | 857 public: |