1 #ifdef USE_PRAGMA_IDENT_HDR
2 #pragma ident "@(#)klass.hpp 1.142 07/05/29 09:44:17 JVM"
3 #endif
4 /*
5 * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved.
6 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7 *
8 * This code is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License version 2 only, as
10 * published by the Free Software Foundation.
11 *
12 * This code is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 * version 2 for more details (a copy is included in the LICENSE file that
16 * accompanied this code).
17 *
18 * You should have received a copy of the GNU General Public License version
19 * 2 along with this work; if not, write to the Free Software Foundation,
20 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
21 *
22 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
23 * CA 95054 USA or visit www.sun.com if you need additional information or
24 * have any questions.
25 *
680 case Prefetch::do_read: \
681 Prefetch::read(*ref, foffset_); \
682 break; \
683 case Prefetch::do_write: \
684 Prefetch::write(*ref, foffset_); \
685 break; \
686 default: \
687 ShouldNotReachHere(); \
688 break; \
689 } \
690 } \
691 } \
692 }
693
694 // iterators
695 virtual int oop_oop_iterate(oop obj, OopClosure* blk) = 0;
696 virtual int oop_oop_iterate_v(oop obj, OopClosure* blk) {
697 return oop_oop_iterate(obj, blk);
698 }
699
700 // Iterates "blk" over all the oops in "obj" (of type "this") within "mr".
701 // (I don't see why the _m should be required, but without it the Solaris
702 // C++ gives warning messages about overridings of the "oop_oop_iterate"
703 // defined above "hiding" this virtual function. (DLD, 6/20/00)) */
704 virtual int oop_oop_iterate_m(oop obj, OopClosure* blk, MemRegion mr) = 0;
705 virtual int oop_oop_iterate_v_m(oop obj, OopClosure* blk, MemRegion mr) {
706 return oop_oop_iterate_m(obj, blk, mr);
707 }
708
709 // Versions of the above iterators specialized to particular subtypes
710 // of OopClosure, to avoid closure virtual calls.
711 #define Klass_OOP_OOP_ITERATE_DECL(OopClosureType, nv_suffix) \
712 virtual int oop_oop_iterate##nv_suffix(oop obj, OopClosureType* blk) { \
713 /* Default implementation reverts to general version. */ \
714 return oop_oop_iterate(obj, blk); \
715 } \
716 \
717 /* Iterates "blk" over all the oops in "obj" (of type "this") within "mr". \
718 (I don't see why the _m should be required, but without it the Solaris \
719 C++ gives warning messages about overridings of the "oop_oop_iterate" \
720 defined above "hiding" this virtual function. (DLD, 6/20/00)) */ \
721 virtual int oop_oop_iterate##nv_suffix##_m(oop obj, \
722 OopClosureType* blk, \
723 MemRegion mr) { \
724 return oop_oop_iterate_m(obj, blk, mr); \
725 }
726
727 SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_1(Klass_OOP_OOP_ITERATE_DECL)
728 SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_3(Klass_OOP_OOP_ITERATE_DECL)
729
730 virtual void array_klasses_do(void f(klassOop k)) {}
731 virtual void with_array_klasses_do(void f(klassOop k));
732
733 // Return self, except for abstract classes with exactly 1
734 // implementor. Then return the 1 concrete implementation.
735 Klass *up_cast_abstract();
736
737 // klass name
738 symbolOop name() const { return _name; }
739 void set_name(symbolOop n) { oop_store_without_check((oop*) &_name, (oop) n); }
740
741 friend class klassKlass;
742
743 public:
744 // jvm support
745 virtual jint compute_modifier_flags(TRAPS) const;
746
747 public:
748 // JVMTI support
749 virtual jint jvmti_class_status() const;
750
751 #ifndef PRODUCT
752 public:
753 // Printing
754 virtual void oop_print_on (oop obj, outputStream* st);
755 virtual void oop_print_value_on(oop obj, outputStream* st);
756 #endif
757
758 public:
759 // Verification
760 virtual const char* internal_name() const = 0;
761 virtual void oop_verify_on(oop obj, outputStream* st);
762 virtual void oop_verify_old_oop(oop obj, oop* p, bool allow_dirty);
763 // tells whether obj is partially constructed (gc during class loading)
764 virtual bool oop_partially_loaded(oop obj) const { return false; }
765 virtual void oop_set_partially_loaded(oop obj) {};
766
767 #ifndef PRODUCT
768 void verify_vtable_index(int index);
769 #endif
770 };
771
|
1 #ifdef USE_PRAGMA_IDENT_HDR
2 #pragma ident "@(#)klass.hpp 1.142 07/05/29 09:44:17 JVM"
3 #endif
4 /*
5 * Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved.
6 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7 *
8 * This code is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License version 2 only, as
10 * published by the Free Software Foundation.
11 *
12 * This code is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 * version 2 for more details (a copy is included in the LICENSE file that
16 * accompanied this code).
17 *
18 * You should have received a copy of the GNU General Public License version
19 * 2 along with this work; if not, write to the Free Software Foundation,
20 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
21 *
22 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
23 * CA 95054 USA or visit www.sun.com if you need additional information or
24 * have any questions.
25 *
680 case Prefetch::do_read: \
681 Prefetch::read(*ref, foffset_); \
682 break; \
683 case Prefetch::do_write: \
684 Prefetch::write(*ref, foffset_); \
685 break; \
686 default: \
687 ShouldNotReachHere(); \
688 break; \
689 } \
690 } \
691 } \
692 }
693
694 // iterators
695 virtual int oop_oop_iterate(oop obj, OopClosure* blk) = 0;
696 virtual int oop_oop_iterate_v(oop obj, OopClosure* blk) {
697 return oop_oop_iterate(obj, blk);
698 }
699
700 #ifndef SERIALGC
701 // In case we don't have a specialized backward scanner use forward
702 // iteration.
703 virtual int oop_oop_iterate_backwards_v(oop obj, OopClosure* blk) {
704 return oop_oop_iterate_v(obj, blk);
705 }
706 #endif // !SERIALGC
707
708 // Iterates "blk" over all the oops in "obj" (of type "this") within "mr".
709 // (I don't see why the _m should be required, but without it the Solaris
710 // C++ gives warning messages about overridings of the "oop_oop_iterate"
711 // defined above "hiding" this virtual function. (DLD, 6/20/00)) */
712 virtual int oop_oop_iterate_m(oop obj, OopClosure* blk, MemRegion mr) = 0;
713 virtual int oop_oop_iterate_v_m(oop obj, OopClosure* blk, MemRegion mr) {
714 return oop_oop_iterate_m(obj, blk, mr);
715 }
716
717 // Versions of the above iterators specialized to particular subtypes
718 // of OopClosure, to avoid closure virtual calls.
719 #define Klass_OOP_OOP_ITERATE_DECL(OopClosureType, nv_suffix) \
720 virtual int oop_oop_iterate##nv_suffix(oop obj, OopClosureType* blk) { \
721 /* Default implementation reverts to general version. */ \
722 return oop_oop_iterate(obj, blk); \
723 } \
724 \
725 /* Iterates "blk" over all the oops in "obj" (of type "this") within "mr". \
726 (I don't see why the _m should be required, but without it the Solaris \
727 C++ gives warning messages about overridings of the "oop_oop_iterate" \
728 defined above "hiding" this virtual function. (DLD, 6/20/00)) */ \
729 virtual int oop_oop_iterate##nv_suffix##_m(oop obj, \
730 OopClosureType* blk, \
731 MemRegion mr) { \
732 return oop_oop_iterate_m(obj, blk, mr); \
733 }
734
735 SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_1(Klass_OOP_OOP_ITERATE_DECL)
736 SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_2(Klass_OOP_OOP_ITERATE_DECL)
737
738 #ifndef SERIALGC
739 #define Klass_OOP_OOP_ITERATE_BACKWARDS_DECL(OopClosureType, nv_suffix) \
740 virtual int oop_oop_iterate_backwards##nv_suffix(oop obj, \
741 OopClosureType* blk) { \
742 /* Default implementation reverts to general version. */ \
743 return oop_oop_iterate_backwards_v(obj, blk); \
744 }
745
746 SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_1(Klass_OOP_OOP_ITERATE_BACKWARDS_DECL)
747 SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_2(Klass_OOP_OOP_ITERATE_BACKWARDS_DECL)
748 #endif // !SERIALGC
749
750 virtual void array_klasses_do(void f(klassOop k)) {}
751 virtual void with_array_klasses_do(void f(klassOop k));
752
753 // Return self, except for abstract classes with exactly 1
754 // implementor. Then return the 1 concrete implementation.
755 Klass *up_cast_abstract();
756
757 // klass name
758 symbolOop name() const { return _name; }
759 void set_name(symbolOop n) { oop_store_without_check((oop*) &_name, (oop) n); }
760
761 friend class klassKlass;
762
763 public:
764 // jvm support
765 virtual jint compute_modifier_flags(TRAPS) const;
766
767 public:
768 // JVMTI support
769 virtual jint jvmti_class_status() const;
770
771 #ifndef PRODUCT
772 public:
773 // Printing
774 virtual void oop_print_on (oop obj, outputStream* st);
775 virtual void oop_print_value_on(oop obj, outputStream* st);
776 #endif
777
778 public:
779 // Verification
780 virtual const char* internal_name() const = 0;
781 virtual void oop_verify_on(oop obj, outputStream* st);
782 virtual void oop_verify_old_oop(oop obj, oop* p, bool allow_dirty);
783 virtual void oop_verify_old_oop(oop obj, narrowOop* p, bool allow_dirty);
784 // tells whether obj is partially constructed (gc during class loading)
785 virtual bool oop_partially_loaded(oop obj) const { return false; }
786 virtual void oop_set_partially_loaded(oop obj) {};
787
788 #ifndef PRODUCT
789 void verify_vtable_index(int index);
790 #endif
791 };
792
|