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 |
627 virtual int oop_oop_iterate(oop obj, ExtendedOopClosure* blk) = 0; |
628 virtual int oop_oop_iterate(oop obj, ExtendedOopClosure* blk) = 0; |
628 virtual int oop_oop_iterate_v(oop obj, ExtendedOopClosure* blk) { |
629 virtual int oop_oop_iterate_v(oop obj, ExtendedOopClosure* blk) { |
629 return oop_oop_iterate(obj, blk); |
630 return oop_oop_iterate(obj, blk); |
630 } |
631 } |
631 |
632 |
632 #ifndef SERIALGC |
633 #if INCLUDE_ALL_GCS |
633 // In case we don't have a specialized backward scanner use forward |
634 // In case we don't have a specialized backward scanner use forward |
634 // iteration. |
635 // iteration. |
635 virtual int oop_oop_iterate_backwards_v(oop obj, ExtendedOopClosure* blk) { |
636 virtual int oop_oop_iterate_backwards_v(oop obj, ExtendedOopClosure* blk) { |
636 return oop_oop_iterate_v(obj, blk); |
637 return oop_oop_iterate_v(obj, blk); |
637 } |
638 } |
638 #endif // !SERIALGC |
639 #endif // INCLUDE_ALL_GCS |
639 |
640 |
640 // Iterates "blk" over all the oops in "obj" (of type "this") within "mr". |
641 // Iterates "blk" over all the oops in "obj" (of type "this") within "mr". |
641 // (I don't see why the _m should be required, but without it the Solaris |
642 // (I don't see why the _m should be required, but without it the Solaris |
642 // C++ gives warning messages about overridings of the "oop_oop_iterate" |
643 // C++ gives warning messages about overridings of the "oop_oop_iterate" |
643 // defined above "hiding" this virtual function. (DLD, 6/20/00)) */ |
644 // defined above "hiding" this virtual function. (DLD, 6/20/00)) */ |
665 } |
666 } |
666 |
667 |
667 SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_1(Klass_OOP_OOP_ITERATE_DECL) |
668 SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_1(Klass_OOP_OOP_ITERATE_DECL) |
668 SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_2(Klass_OOP_OOP_ITERATE_DECL) |
669 SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_2(Klass_OOP_OOP_ITERATE_DECL) |
669 |
670 |
670 #ifndef SERIALGC |
671 #if INCLUDE_ALL_GCS |
671 #define Klass_OOP_OOP_ITERATE_BACKWARDS_DECL(OopClosureType, nv_suffix) \ |
672 #define Klass_OOP_OOP_ITERATE_BACKWARDS_DECL(OopClosureType, nv_suffix) \ |
672 virtual int oop_oop_iterate_backwards##nv_suffix(oop obj, \ |
673 virtual int oop_oop_iterate_backwards##nv_suffix(oop obj, \ |
673 OopClosureType* blk) { \ |
674 OopClosureType* blk) { \ |
674 /* Default implementation reverts to general version. */ \ |
675 /* Default implementation reverts to general version. */ \ |
675 return oop_oop_iterate_backwards_v(obj, blk); \ |
676 return oop_oop_iterate_backwards_v(obj, blk); \ |
676 } |
677 } |
677 |
678 |
678 SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_1(Klass_OOP_OOP_ITERATE_BACKWARDS_DECL) |
679 SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_1(Klass_OOP_OOP_ITERATE_BACKWARDS_DECL) |
679 SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_2(Klass_OOP_OOP_ITERATE_BACKWARDS_DECL) |
680 SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_2(Klass_OOP_OOP_ITERATE_BACKWARDS_DECL) |
680 #endif // !SERIALGC |
681 #endif // INCLUDE_ALL_GCS |
681 |
682 |
682 virtual void array_klasses_do(void f(Klass* k)) {} |
683 virtual void array_klasses_do(void f(Klass* k)) {} |
683 virtual void with_array_klasses_do(void f(Klass* k)); |
684 virtual void with_array_klasses_do(void f(Klass* k)); |
684 |
685 |
685 // Return self, except for abstract classes with exactly 1 |
686 // Return self, except for abstract classes with exactly 1 |