Mercurial > hg > truffle
comparison src/share/vm/oops/klass.hpp @ 8124:5fc51c1ecdeb
Merge.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Tue, 05 Mar 2013 23:44:54 +0100 |
parents | 989155e2d07a 3c9bc17b9403 |
children | b9a918201d47 |
comparison
equal
deleted
inserted
replaced
7943:a413bcd552a4 | 8124:5fc51c1ecdeb |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 1997, 2013, 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. |
33 #include "oops/metadata.hpp" | 33 #include "oops/metadata.hpp" |
34 #include "oops/oop.hpp" | 34 #include "oops/oop.hpp" |
35 #include "runtime/orderAccess.hpp" | 35 #include "runtime/orderAccess.hpp" |
36 #include "trace/traceMacros.hpp" | 36 #include "trace/traceMacros.hpp" |
37 #include "utilities/accessFlags.hpp" | 37 #include "utilities/accessFlags.hpp" |
38 #ifndef SERIALGC | 38 #include "utilities/macros.hpp" |
39 #if INCLUDE_ALL_GCS | |
39 #include "gc_implementation/concurrentMarkSweep/cmsOopClosures.hpp" | 40 #include "gc_implementation/concurrentMarkSweep/cmsOopClosures.hpp" |
40 #include "gc_implementation/g1/g1OopClosures.hpp" | 41 #include "gc_implementation/g1/g1OopClosures.hpp" |
41 #include "gc_implementation/parNew/parOopClosures.hpp" | 42 #include "gc_implementation/parNew/parOopClosures.hpp" |
42 #endif | 43 #endif // INCLUDE_ALL_GCS |
43 | 44 |
44 // | 45 // |
45 // A Klass provides: | 46 // A Klass provides: |
46 // 1: language level class object (method dictionary etc.) | 47 // 1: language level class object (method dictionary etc.) |
47 // 2: provide vm dispatch behavior for the object | 48 // 2: provide vm dispatch behavior for the object |
73 // [next_sibling ] link to chain additional subklasses | 74 // [next_sibling ] link to chain additional subklasses |
74 // [next_link ] | 75 // [next_link ] |
75 // [class_loader_data] | 76 // [class_loader_data] |
76 // [modifier_flags] | 77 // [modifier_flags] |
77 // [access_flags ] | 78 // [access_flags ] |
78 // [verify_count ] - not in product | |
79 // [alloc_count ] | |
80 // [last_biased_lock_bulk_revocation_time] (64 bits) | 79 // [last_biased_lock_bulk_revocation_time] (64 bits) |
81 // [prototype_header] | 80 // [prototype_header] |
82 // [biased_lock_revocation_count] | 81 // [biased_lock_revocation_count] |
82 // [verify_count ] - not in product | |
83 // [alloc_count ] | |
83 // [_modified_oops] | 84 // [_modified_oops] |
84 // [_accumulated_modified_oops] | 85 // [_accumulated_modified_oops] |
85 // [trace_id] | 86 // [trace_id] |
86 | 87 |
87 | 88 |
89 template <class T> class Array; | 90 template <class T> class Array; |
90 template <class T> class GrowableArray; | 91 template <class T> class GrowableArray; |
91 class ClassLoaderData; | 92 class ClassLoaderData; |
92 class klassVtable; | 93 class klassVtable; |
93 class ParCompactionManager; | 94 class ParCompactionManager; |
95 class KlassSizeStats; | |
94 | 96 |
95 class Klass : public Metadata { | 97 class Klass : public Metadata { |
96 friend class VMStructs; | 98 friend class VMStructs; |
97 protected: | 99 protected: |
98 // note: put frequently-used fields together at start of klass structure | 100 // note: put frequently-used fields together at start of klass structure |
166 ClassLoaderData* _class_loader_data; | 168 ClassLoaderData* _class_loader_data; |
167 | 169 |
168 jint _modifier_flags; // Processed access flags, for use by Class.getModifiers. | 170 jint _modifier_flags; // Processed access flags, for use by Class.getModifiers. |
169 AccessFlags _access_flags; // Access flags. The class/interface distinction is stored here. | 171 AccessFlags _access_flags; // Access flags. The class/interface distinction is stored here. |
170 | 172 |
171 #ifndef PRODUCT | |
172 int _verify_count; // to avoid redundant verifies | |
173 #endif | |
174 | |
175 juint _alloc_count; // allocation profiling support | |
176 | |
177 // Biased locking implementation and statistics | 173 // Biased locking implementation and statistics |
178 // (the 64-bit chunk goes first, to avoid some fragmentation) | 174 // (the 64-bit chunk goes first, to avoid some fragmentation) |
179 jlong _last_biased_lock_bulk_revocation_time; | 175 jlong _last_biased_lock_bulk_revocation_time; |
180 markOop _prototype_header; // Used when biased locking is both enabled and disabled for this type | 176 markOop _prototype_header; // Used when biased locking is both enabled and disabled for this type |
181 jint _biased_lock_revocation_count; | 177 jint _biased_lock_revocation_count; |
178 | |
179 #ifndef PRODUCT | |
180 int _verify_count; // to avoid redundant verifies | |
181 #endif | |
182 | |
183 juint _alloc_count; // allocation profiling support | |
182 | 184 |
183 TRACE_DEFINE_KLASS_TRACE_ID; | 185 TRACE_DEFINE_KLASS_TRACE_ID; |
184 | 186 |
185 // Remembered sets support for the oops in the klasses. | 187 // Remembered sets support for the oops in the klasses. |
186 jbyte _modified_oops; // Card Table Equivalent (YC/CMS support) | 188 jbyte _modified_oops; // Card Table Equivalent (YC/CMS support) |
487 // actual oop size of obj in memory | 489 // actual oop size of obj in memory |
488 virtual int oop_size(oop obj) const = 0; | 490 virtual int oop_size(oop obj) const = 0; |
489 | 491 |
490 // Size of klass in word size. | 492 // Size of klass in word size. |
491 virtual int size() const = 0; | 493 virtual int size() const = 0; |
494 #if INCLUDE_SERVICES | |
495 virtual void collect_statistics(KlassSizeStats *sz) const; | |
496 #endif | |
492 | 497 |
493 // Returns the Java name for a class (Resource allocated) | 498 // Returns the Java name for a class (Resource allocated) |
494 // For arrays, this returns the name of the element with a leading '['. | 499 // For arrays, this returns the name of the element with a leading '['. |
495 // For classes, this returns the name with the package separators | 500 // For classes, this returns the name with the package separators |
496 // turned into '.'s. | 501 // turned into '.'s. |
635 virtual int oop_oop_iterate(oop obj, ExtendedOopClosure* blk) = 0; | 640 virtual int oop_oop_iterate(oop obj, ExtendedOopClosure* blk) = 0; |
636 virtual int oop_oop_iterate_v(oop obj, ExtendedOopClosure* blk) { | 641 virtual int oop_oop_iterate_v(oop obj, ExtendedOopClosure* blk) { |
637 return oop_oop_iterate(obj, blk); | 642 return oop_oop_iterate(obj, blk); |
638 } | 643 } |
639 | 644 |
640 #ifndef SERIALGC | 645 #if INCLUDE_ALL_GCS |
641 // In case we don't have a specialized backward scanner use forward | 646 // In case we don't have a specialized backward scanner use forward |
642 // iteration. | 647 // iteration. |
643 virtual int oop_oop_iterate_backwards_v(oop obj, ExtendedOopClosure* blk) { | 648 virtual int oop_oop_iterate_backwards_v(oop obj, ExtendedOopClosure* blk) { |
644 return oop_oop_iterate_v(obj, blk); | 649 return oop_oop_iterate_v(obj, blk); |
645 } | 650 } |
646 #endif // !SERIALGC | 651 #endif // INCLUDE_ALL_GCS |
647 | 652 |
648 // Iterates "blk" over all the oops in "obj" (of type "this") within "mr". | 653 // Iterates "blk" over all the oops in "obj" (of type "this") within "mr". |
649 // (I don't see why the _m should be required, but without it the Solaris | 654 // (I don't see why the _m should be required, but without it the Solaris |
650 // C++ gives warning messages about overridings of the "oop_oop_iterate" | 655 // C++ gives warning messages about overridings of the "oop_oop_iterate" |
651 // defined above "hiding" this virtual function. (DLD, 6/20/00)) */ | 656 // defined above "hiding" this virtual function. (DLD, 6/20/00)) */ |
673 } | 678 } |
674 | 679 |
675 SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_1(Klass_OOP_OOP_ITERATE_DECL) | 680 SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_1(Klass_OOP_OOP_ITERATE_DECL) |
676 SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_2(Klass_OOP_OOP_ITERATE_DECL) | 681 SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_2(Klass_OOP_OOP_ITERATE_DECL) |
677 | 682 |
678 #ifndef SERIALGC | 683 #if INCLUDE_ALL_GCS |
679 #define Klass_OOP_OOP_ITERATE_BACKWARDS_DECL(OopClosureType, nv_suffix) \ | 684 #define Klass_OOP_OOP_ITERATE_BACKWARDS_DECL(OopClosureType, nv_suffix) \ |
680 virtual int oop_oop_iterate_backwards##nv_suffix(oop obj, \ | 685 virtual int oop_oop_iterate_backwards##nv_suffix(oop obj, \ |
681 OopClosureType* blk) { \ | 686 OopClosureType* blk) { \ |
682 /* Default implementation reverts to general version. */ \ | 687 /* Default implementation reverts to general version. */ \ |
683 return oop_oop_iterate_backwards_v(obj, blk); \ | 688 return oop_oop_iterate_backwards_v(obj, blk); \ |
684 } | 689 } |
685 | 690 |
686 SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_1(Klass_OOP_OOP_ITERATE_BACKWARDS_DECL) | 691 SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_1(Klass_OOP_OOP_ITERATE_BACKWARDS_DECL) |
687 SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_2(Klass_OOP_OOP_ITERATE_BACKWARDS_DECL) | 692 SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_2(Klass_OOP_OOP_ITERATE_BACKWARDS_DECL) |
688 #endif // !SERIALGC | 693 #endif // INCLUDE_ALL_GCS |
689 | 694 |
690 virtual void array_klasses_do(void f(Klass* k)) {} | 695 virtual void array_klasses_do(void f(Klass* k)) {} |
691 virtual void with_array_klasses_do(void f(Klass* k)); | 696 virtual void with_array_klasses_do(void f(Klass* k)); |
692 | 697 |
693 // Return self, except for abstract classes with exactly 1 | 698 // Return self, except for abstract classes with exactly 1 |