1 /*
2 * Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 // A Klass is the part of the klassOop that provides:
26 // 1: language level class object (method dictionary etc.)
27 // 2: provide vm dispatch behavior for the object
28 // Both functions are combined into one C++ class. The toplevel class "Klass"
29 // implements purpose 1 whereas all subclasses provide extra virtual functions
30 // for purpose 2.
31
32 // One reason for the oop/klass dichotomy in the implementation is
33 // that we don't want a C++ vtbl pointer in every object. Thus,
34 // normal oops don't have any virtual functions. Instead, they
35 // forward all "virtual" functions to their klass, which does have
36 // a vtbl and does the C++ dispatch depending on the object's
37 // actual type. (See oop.inline.hpp for some of the forwarding code.)
38 // ALL FUNCTIONS IMPLEMENTING THIS DISPATCH ARE PREFIXED WITH "oop_"!
39
40 // Klass layout:
41 // [header ] klassOop
42 // [klass pointer ] klassOop
43 // [C++ vtbl ptr ] (contained in Klass_vtbl)
44 // [layout_helper ]
775 // JVMTI support
776 virtual jint jvmti_class_status() const;
777
778 // Printing
779 virtual void oop_print_value_on(oop obj, outputStream* st);
780 virtual void oop_print_on (oop obj, outputStream* st);
781
782 // Verification
783 virtual const char* internal_name() const = 0;
784 virtual void oop_verify_on(oop obj, outputStream* st);
785 virtual void oop_verify_old_oop(oop obj, oop* p, bool allow_dirty);
786 virtual void oop_verify_old_oop(oop obj, narrowOop* p, bool allow_dirty);
787 // tells whether obj is partially constructed (gc during class loading)
788 virtual bool oop_partially_loaded(oop obj) const { return false; }
789 virtual void oop_set_partially_loaded(oop obj) {};
790
791 #ifndef PRODUCT
792 void verify_vtable_index(int index);
793 #endif
794 };
|
1 /*
2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #ifndef SHARE_VM_OOPS_KLASS_HPP
26 #define SHARE_VM_OOPS_KLASS_HPP
27
28 #include "memory/genOopClosures.hpp"
29 #include "memory/iterator.hpp"
30 #include "memory/memRegion.hpp"
31 #include "memory/specialized_oop_closures.hpp"
32 #include "oops/klassOop.hpp"
33 #include "oops/klassPS.hpp"
34 #include "oops/oop.hpp"
35 #include "runtime/orderAccess.hpp"
36 #include "utilities/accessFlags.hpp"
37 #ifndef SERIALGC
38 #include "gc_implementation/concurrentMarkSweep/cmsOopClosures.hpp"
39 #include "gc_implementation/g1/g1OopClosures.hpp"
40 #include "gc_implementation/parNew/parOopClosures.hpp"
41 #endif
42
43 // A Klass is the part of the klassOop that provides:
44 // 1: language level class object (method dictionary etc.)
45 // 2: provide vm dispatch behavior for the object
46 // Both functions are combined into one C++ class. The toplevel class "Klass"
47 // implements purpose 1 whereas all subclasses provide extra virtual functions
48 // for purpose 2.
49
50 // One reason for the oop/klass dichotomy in the implementation is
51 // that we don't want a C++ vtbl pointer in every object. Thus,
52 // normal oops don't have any virtual functions. Instead, they
53 // forward all "virtual" functions to their klass, which does have
54 // a vtbl and does the C++ dispatch depending on the object's
55 // actual type. (See oop.inline.hpp for some of the forwarding code.)
56 // ALL FUNCTIONS IMPLEMENTING THIS DISPATCH ARE PREFIXED WITH "oop_"!
57
58 // Klass layout:
59 // [header ] klassOop
60 // [klass pointer ] klassOop
61 // [C++ vtbl ptr ] (contained in Klass_vtbl)
62 // [layout_helper ]
793 // JVMTI support
794 virtual jint jvmti_class_status() const;
795
796 // Printing
797 virtual void oop_print_value_on(oop obj, outputStream* st);
798 virtual void oop_print_on (oop obj, outputStream* st);
799
800 // Verification
801 virtual const char* internal_name() const = 0;
802 virtual void oop_verify_on(oop obj, outputStream* st);
803 virtual void oop_verify_old_oop(oop obj, oop* p, bool allow_dirty);
804 virtual void oop_verify_old_oop(oop obj, narrowOop* p, bool allow_dirty);
805 // tells whether obj is partially constructed (gc during class loading)
806 virtual bool oop_partially_loaded(oop obj) const { return false; }
807 virtual void oop_set_partially_loaded(oop obj) {};
808
809 #ifndef PRODUCT
810 void verify_vtable_index(int index);
811 #endif
812 };
813
814 #endif // SHARE_VM_OOPS_KLASS_HPP
|