comparison src/share/vm/oops/klass.hpp @ 342:37f87013dfd8

6711316: Open source the Garbage-First garbage collector Summary: First mercurial integration of the code for the Garbage-First garbage collector. Reviewed-by: apetrusenko, iveresov, jmasa, sgoldman, tonyp, ysr
author ysr
date Thu, 05 Jun 2008 15:57:56 -0700
parents ba764ed4b6f2
children 1ee8caae33af
comparison
equal deleted inserted replaced
189:0b27f3512f9e 342:37f87013dfd8
132 void post_new_init_klass(KlassHandle& klass, klassOop obj, int size) const; 132 void post_new_init_klass(KlassHandle& klass, klassOop obj, int size) const;
133 133
134 // Every subclass on which vtbl_value is called must include this macro. 134 // Every subclass on which vtbl_value is called must include this macro.
135 // Delay the installation of the klassKlass pointer until after the 135 // Delay the installation of the klassKlass pointer until after the
136 // the vtable for a new klass has been installed (after the call to new()). 136 // the vtable for a new klass has been installed (after the call to new()).
137 #define DEFINE_ALLOCATE_PERMANENT(thisKlass) \ 137 #define DEFINE_ALLOCATE_PERMANENT(thisKlass) \
138 void* allocate_permanent(KlassHandle& klass_klass, int size, TRAPS) const { \ 138 void* allocate_permanent(KlassHandle& klass_klass, int size, TRAPS) const { \
139 void* result = new(klass_klass, size, THREAD) thisKlass(); \ 139 void* result = new(klass_klass, size, THREAD) thisKlass(); \
140 if (HAS_PENDING_EXCEPTION) return NULL; \ 140 if (HAS_PENDING_EXCEPTION) return NULL; \
141 klassOop new_klass = ((Klass*) result)->as_klassOop(); \ 141 klassOop new_klass = ((Klass*) result)->as_klassOop(); \
142 OrderAccess::storestore(); \ 142 OrderAccess::storestore(); \
143 post_new_init_klass(klass_klass, new_klass, size); \ 143 post_new_init_klass(klass_klass, new_klass, size); \
144 return result; \ 144 return result; \
145 } 145 }
146 146
147 bool null_vtbl() { return *(intptr_t*)this == 0; } 147 bool null_vtbl() { return *(intptr_t*)this == 0; }
148 148
149 protected: 149 protected:
692 virtual int oop_oop_iterate(oop obj, OopClosure* blk) = 0; 692 virtual int oop_oop_iterate(oop obj, OopClosure* blk) = 0;
693 virtual int oop_oop_iterate_v(oop obj, OopClosure* blk) { 693 virtual int oop_oop_iterate_v(oop obj, OopClosure* blk) {
694 return oop_oop_iterate(obj, blk); 694 return oop_oop_iterate(obj, blk);
695 } 695 }
696 696
697 #ifndef SERIALGC
698 // In case we don't have a specialized backward scanner use forward
699 // iteration.
700 virtual int oop_oop_iterate_backwards_v(oop obj, OopClosure* blk) {
701 return oop_oop_iterate_v(obj, blk);
702 }
703 #endif // !SERIALGC
704
697 // Iterates "blk" over all the oops in "obj" (of type "this") within "mr". 705 // Iterates "blk" over all the oops in "obj" (of type "this") within "mr".
698 // (I don't see why the _m should be required, but without it the Solaris 706 // (I don't see why the _m should be required, but without it the Solaris
699 // C++ gives warning messages about overridings of the "oop_oop_iterate" 707 // C++ gives warning messages about overridings of the "oop_oop_iterate"
700 // defined above "hiding" this virtual function. (DLD, 6/20/00)) */ 708 // defined above "hiding" this virtual function. (DLD, 6/20/00)) */
701 virtual int oop_oop_iterate_m(oop obj, OopClosure* blk, MemRegion mr) = 0; 709 virtual int oop_oop_iterate_m(oop obj, OopClosure* blk, MemRegion mr) = 0;
720 MemRegion mr) { \ 728 MemRegion mr) { \
721 return oop_oop_iterate_m(obj, blk, mr); \ 729 return oop_oop_iterate_m(obj, blk, mr); \
722 } 730 }
723 731
724 SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_1(Klass_OOP_OOP_ITERATE_DECL) 732 SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_1(Klass_OOP_OOP_ITERATE_DECL)
725 SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_3(Klass_OOP_OOP_ITERATE_DECL) 733 SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_2(Klass_OOP_OOP_ITERATE_DECL)
734
735 #ifndef SERIALGC
736 #define Klass_OOP_OOP_ITERATE_BACKWARDS_DECL(OopClosureType, nv_suffix) \
737 virtual int oop_oop_iterate_backwards##nv_suffix(oop obj, \
738 OopClosureType* blk) { \
739 /* Default implementation reverts to general version. */ \
740 return oop_oop_iterate_backwards_v(obj, blk); \
741 }
742
743 SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_1(Klass_OOP_OOP_ITERATE_BACKWARDS_DECL)
744 SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_2(Klass_OOP_OOP_ITERATE_BACKWARDS_DECL)
745 #endif // !SERIALGC
726 746
727 virtual void array_klasses_do(void f(klassOop k)) {} 747 virtual void array_klasses_do(void f(klassOop k)) {}
728 virtual void with_array_klasses_do(void f(klassOop k)); 748 virtual void with_array_klasses_do(void f(klassOop k));
729 749
730 // Return self, except for abstract classes with exactly 1 750 // Return self, except for abstract classes with exactly 1