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