Mercurial > hg > truffle
comparison src/share/vm/oops/instanceKlass.hpp @ 2376:c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
Reviewed-by: kvn, coleenp, twisti, stefank
author | never |
---|---|
date | Fri, 18 Mar 2011 16:00:34 -0700 |
parents | 8033953d67ff |
children | 38fea01eb669 e1162778c1c8 |
comparison
equal
deleted
inserted
replaced
2375:d673ef06fe96 | 2376:c7f3d0b4570f |
---|---|
73 // [initialization state ] | 73 // [initialization state ] |
74 // [initializing thread ] | 74 // [initializing thread ] |
75 // [Java vtable length ] | 75 // [Java vtable length ] |
76 // [oop map cache (stack maps) ] | 76 // [oop map cache (stack maps) ] |
77 // [EMBEDDED Java vtable ] size in words = vtable_len | 77 // [EMBEDDED Java vtable ] size in words = vtable_len |
78 // [EMBEDDED static oop fields ] size in words = static_oop_fields_size | |
79 // [ static non-oop fields ] size in words = static_field_size - static_oop_fields_size | |
80 // [EMBEDDED nonstatic oop-map blocks] size in words = nonstatic_oop_map_size | 78 // [EMBEDDED nonstatic oop-map blocks] size in words = nonstatic_oop_map_size |
81 // | 79 // |
82 // The embedded nonstatic oop-map blocks are short pairs (offset, length) indicating | 80 // The embedded nonstatic oop-map blocks are short pairs (offset, length) indicating |
83 // where oops are located in instances of this klass. | 81 // where oops are located in instances of this klass. |
84 | 82 |
228 | 226 |
229 // Number of heapOopSize words used by non-static fields in this klass | 227 // Number of heapOopSize words used by non-static fields in this klass |
230 // (including inherited fields but after header_size()). | 228 // (including inherited fields but after header_size()). |
231 int _nonstatic_field_size; | 229 int _nonstatic_field_size; |
232 int _static_field_size; // number words used by static fields (oop and non-oop) in this klass | 230 int _static_field_size; // number words used by static fields (oop and non-oop) in this klass |
233 int _static_oop_field_size;// number of static oop fields in this klass | 231 int _static_oop_field_count;// number of static oop fields in this klass |
234 int _nonstatic_oop_map_size;// size in words of nonstatic oop map blocks | 232 int _nonstatic_oop_map_size;// size in words of nonstatic oop map blocks |
235 bool _is_marked_dependent; // used for marking during flushing and deoptimization | 233 bool _is_marked_dependent; // used for marking during flushing and deoptimization |
236 bool _rewritten; // methods rewritten. | 234 bool _rewritten; // methods rewritten. |
237 bool _has_nonstatic_fields; // for sizing with UseCompressedOops | 235 bool _has_nonstatic_fields; // for sizing with UseCompressedOops |
238 bool _should_verify_class; // allow caching of preverification | 236 bool _should_verify_class; // allow caching of preverification |
279 void set_nonstatic_field_size(int size) { _nonstatic_field_size = size; } | 277 void set_nonstatic_field_size(int size) { _nonstatic_field_size = size; } |
280 | 278 |
281 int static_field_size() const { return _static_field_size; } | 279 int static_field_size() const { return _static_field_size; } |
282 void set_static_field_size(int size) { _static_field_size = size; } | 280 void set_static_field_size(int size) { _static_field_size = size; } |
283 | 281 |
284 int static_oop_field_size() const { return _static_oop_field_size; } | 282 int static_oop_field_count() const { return _static_oop_field_count; } |
285 void set_static_oop_field_size(int size) { _static_oop_field_size = size; } | 283 void set_static_oop_field_count(int size) { _static_oop_field_count = size; } |
286 | 284 |
287 // Java vtable | 285 // Java vtable |
288 int vtable_length() const { return _vtable_len; } | 286 int vtable_length() const { return _vtable_len; } |
289 void set_vtable_length(int len) { _vtable_len = len; } | 287 void set_vtable_length(int len) { _vtable_len = len; } |
290 | 288 |
658 void with_array_klasses_do(void f(klassOop k)); | 656 void with_array_klasses_do(void f(klassOop k)); |
659 bool super_types_do(SuperTypeClosure* blk); | 657 bool super_types_do(SuperTypeClosure* blk); |
660 | 658 |
661 // Casting from klassOop | 659 // Casting from klassOop |
662 static instanceKlass* cast(klassOop k) { | 660 static instanceKlass* cast(klassOop k) { |
661 assert(k->is_klass(), "must be"); | |
663 Klass* kp = k->klass_part(); | 662 Klass* kp = k->klass_part(); |
664 assert(kp->null_vtbl() || kp->oop_is_instance_slow(), "cast to instanceKlass"); | 663 assert(kp->null_vtbl() || kp->oop_is_instance_slow(), "cast to instanceKlass"); |
665 return (instanceKlass*) kp; | 664 return (instanceKlass*) kp; |
666 } | 665 } |
667 | 666 |
668 // Sizing (in words) | 667 // Sizing (in words) |
669 static int header_size() { return align_object_offset(oopDesc::header_size() + sizeof(instanceKlass)/HeapWordSize); } | 668 static int header_size() { return align_object_offset(oopDesc::header_size() + sizeof(instanceKlass)/HeapWordSize); } |
670 int object_size() const { return object_size(align_object_offset(vtable_length()) + align_object_offset(itable_length()) + static_field_size() + nonstatic_oop_map_size()); } | 669 int object_size() const { return object_size(align_object_offset(vtable_length()) + align_object_offset(itable_length()) + nonstatic_oop_map_size()); } |
671 static int vtable_start_offset() { return header_size(); } | 670 static int vtable_start_offset() { return header_size(); } |
672 static int vtable_length_offset() { return oopDesc::header_size() + offset_of(instanceKlass, _vtable_len) / HeapWordSize; } | 671 static int vtable_length_offset() { return oopDesc::header_size() + offset_of(instanceKlass, _vtable_len) / HeapWordSize; } |
673 static int object_size(int extra) { return align_object_size(header_size() + extra); } | 672 static int object_size(int extra) { return align_object_size(header_size() + extra); } |
674 | 673 |
675 intptr_t* start_of_vtable() const { return ((intptr_t*)as_klassOop()) + vtable_start_offset(); } | 674 intptr_t* start_of_vtable() const { return ((intptr_t*)as_klassOop()) + vtable_start_offset(); } |
676 intptr_t* start_of_itable() const { return start_of_vtable() + align_object_offset(vtable_length()); } | 675 intptr_t* start_of_itable() const { return start_of_vtable() + align_object_offset(vtable_length()); } |
677 int itable_offset_in_words() const { return start_of_itable() - (intptr_t*)as_klassOop(); } | 676 int itable_offset_in_words() const { return start_of_itable() - (intptr_t*)as_klassOop(); } |
678 | 677 |
679 // Static field offset is an offset into the Heap, should be converted by | |
680 // based on UseCompressedOop for traversal | |
681 HeapWord* start_of_static_fields() const { | |
682 return (HeapWord*)(start_of_itable() + align_object_offset(itable_length())); | |
683 } | |
684 | |
685 intptr_t* end_of_itable() const { return start_of_itable() + itable_length(); } | 678 intptr_t* end_of_itable() const { return start_of_itable() + itable_length(); } |
686 | 679 |
687 int offset_of_static_fields() const { | 680 address static_field_addr(int offset); |
688 return (intptr_t)start_of_static_fields() - (intptr_t)as_klassOop(); | |
689 } | |
690 | 681 |
691 OopMapBlock* start_of_nonstatic_oop_maps() const { | 682 OopMapBlock* start_of_nonstatic_oop_maps() const { |
692 return (OopMapBlock*) (start_of_static_fields() + static_field_size()); | 683 return (OopMapBlock*)(start_of_itable() + align_object_offset(itable_length())); |
693 } | 684 } |
694 | 685 |
695 // Allocation profiling support | 686 // Allocation profiling support |
696 juint alloc_size() const { return _alloc_count * size_helper(); } | 687 juint alloc_size() const { return _alloc_count * size_helper(); } |
697 void set_alloc_size(juint n) {} | 688 void set_alloc_size(juint n) {} |
717 klassItable* itable() const; // return new klassItable wrapper | 708 klassItable* itable() const; // return new klassItable wrapper |
718 methodOop method_at_itable(klassOop holder, int index, TRAPS); | 709 methodOop method_at_itable(klassOop holder, int index, TRAPS); |
719 | 710 |
720 // Garbage collection | 711 // Garbage collection |
721 void oop_follow_contents(oop obj); | 712 void oop_follow_contents(oop obj); |
722 void follow_static_fields(); | |
723 void adjust_static_fields(); | |
724 int oop_adjust_pointers(oop obj); | 713 int oop_adjust_pointers(oop obj); |
725 bool object_is_parsable() const { return _init_state != unparsable_by_gc; } | 714 bool object_is_parsable() const { return _init_state != unparsable_by_gc; } |
726 // Value of _init_state must be zero (unparsable_by_gc) when klass field is set. | 715 // Value of _init_state must be zero (unparsable_by_gc) when klass field is set. |
727 | 716 |
728 void follow_weak_klass_links( | 717 void follow_weak_klass_links( |
729 BoolObjectClosure* is_alive, OopClosure* keep_alive); | 718 BoolObjectClosure* is_alive, OopClosure* keep_alive); |
730 void release_C_heap_structures(); | 719 void release_C_heap_structures(); |
731 | 720 |
732 // Parallel Scavenge and Parallel Old | 721 // Parallel Scavenge and Parallel Old |
733 PARALLEL_GC_DECLS | 722 PARALLEL_GC_DECLS |
734 | |
735 #ifndef SERIALGC | |
736 // Parallel Scavenge | |
737 void push_static_fields(PSPromotionManager* pm); | |
738 | |
739 // Parallel Old | |
740 void follow_static_fields(ParCompactionManager* cm); | |
741 void copy_static_fields(ParCompactionManager* cm); | |
742 void update_static_fields(); | |
743 #endif // SERIALGC | |
744 | 723 |
745 // Naming | 724 // Naming |
746 const char* signature_name() const; | 725 const char* signature_name() const; |
747 | 726 |
748 // Iterators | 727 // Iterators |
767 int oop_oop_iterate_backwards##nv_suffix(oop obj, OopClosureType* blk); | 746 int oop_oop_iterate_backwards##nv_suffix(oop obj, OopClosureType* blk); |
768 | 747 |
769 ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceKlass_OOP_OOP_ITERATE_BACKWARDS_DECL) | 748 ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceKlass_OOP_OOP_ITERATE_BACKWARDS_DECL) |
770 ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceKlass_OOP_OOP_ITERATE_BACKWARDS_DECL) | 749 ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceKlass_OOP_OOP_ITERATE_BACKWARDS_DECL) |
771 #endif // !SERIALGC | 750 #endif // !SERIALGC |
772 | |
773 void iterate_static_fields(OopClosure* closure); | |
774 void iterate_static_fields(OopClosure* closure, MemRegion mr); | |
775 | 751 |
776 private: | 752 private: |
777 // initialization state | 753 // initialization state |
778 #ifdef ASSERT | 754 #ifdef ASSERT |
779 void set_init_state(ClassState state); | 755 void set_init_state(ClassState state); |
924 // Constructor | 900 // Constructor |
925 JNIid(klassOop holder, int offset, JNIid* next); | 901 JNIid(klassOop holder, int offset, JNIid* next); |
926 // Identifier lookup | 902 // Identifier lookup |
927 JNIid* find(int offset); | 903 JNIid* find(int offset); |
928 | 904 |
905 bool find_local_field(fieldDescriptor* fd) { | |
906 return instanceKlass::cast(holder())->find_local_field_from_offset(offset(), true, fd); | |
907 } | |
908 | |
929 // Garbage collection support | 909 // Garbage collection support |
930 oop* holder_addr() { return (oop*)&_holder; } | 910 oop* holder_addr() { return (oop*)&_holder; } |
931 void oops_do(OopClosure* f); | 911 void oops_do(OopClosure* f); |
932 static void deallocate(JNIid* id); | 912 static void deallocate(JNIid* id); |
933 // Debugging | 913 // Debugging |