< prev index next >

src/share/vm/oops/oop.hpp

Print this page
rev 7183 : autospecialized oop_iterate using SFINAE and templates

*** 25,38 **** #ifndef SHARE_VM_OOPS_OOP_HPP #define SHARE_VM_OOPS_OOP_HPP #include "memory/iterator.hpp" #include "memory/memRegion.hpp" ! #include "memory/specialized_oop_closures.hpp" #include "oops/metadata.hpp" #include "utilities/macros.hpp" #include "utilities/top.hpp" // oopDesc is the top baseclass for objects classes. The {name}Desc classes describe // the format of Java objects so the fields can be accessed from C++. // oopDesc is abstract. // (see oopHierarchy for complete oop class hierarchy) --- 25,39 ---- #ifndef SHARE_VM_OOPS_OOP_HPP #define SHARE_VM_OOPS_OOP_HPP #include "memory/iterator.hpp" #include "memory/memRegion.hpp" ! #include "memory/specialized_oop_closures.inline.hpp" #include "oops/metadata.hpp" #include "utilities/macros.hpp" #include "utilities/top.hpp" + #include "utilities/templateIdioms.hpp" // oopDesc is the top baseclass for objects classes. The {name}Desc classes describe // the format of Java objects so the fields can be accessed from C++. // oopDesc is abstract. // (see oopHierarchy for complete oop class hierarchy)
*** 334,344 **** --- 335,368 ---- // Fast access to barrier set static BarrierSet* bs() { return _bs; } static void set_bs(BarrierSet* bs) { _bs = bs; } + private: + // Dispatch member functions to oop closures + + template <class OopClosureType> + typename enable_if<is_kind_of<ExtendedOopClosure, OopClosureType>::value, void>::type + do_metadata_if_applicable(OopClosureType *cl); + + template <class OopClosureType> + typename enable_if<!is_kind_of<ExtendedOopClosure, OopClosureType>::value, void>::type + do_metadata_if_applicable(OopClosureType *cl); + + template <class OopClosureType> + int oop_iterate_dispatch_tag(OopClosureType *blk, DispatchTag tag); + + template <class OopClosureType> + int oop_iterate_internal(OopClosureType *blk); + + public: + template <class OopClosureType> + typename enable_if<is_kind_of<ExtendedOopClosure, OopClosureType>::value, int>::type + oop_iterate(OopClosureType *blk); + // iterators, returns size of object + #define OOP_ITERATE_DECL(OopClosureType, nv_suffix) \ int oop_iterate(OopClosureType* blk); \ int oop_iterate(OopClosureType* blk, MemRegion mr); // Only in mr. ALL_OOP_OOP_ITERATE_CLOSURES_1(OOP_ITERATE_DECL)
*** 351,361 **** ALL_OOP_OOP_ITERATE_CLOSURES_1(OOP_ITERATE_BACKWARDS_DECL) ALL_OOP_OOP_ITERATE_CLOSURES_2(OOP_ITERATE_BACKWARDS_DECL) #endif ! int oop_iterate_no_header(OopClosure* bk); int oop_iterate_no_header(OopClosure* bk, MemRegion mr); // identity hash; returns the identity hash key (computes it if necessary) // NOTE with the introduction of UseBiasedLocking that identity_hash() might reach a // safepoint if called on a biased object. Calling code must be aware of that. --- 375,388 ---- ALL_OOP_OOP_ITERATE_CLOSURES_1(OOP_ITERATE_BACKWARDS_DECL) ALL_OOP_OOP_ITERATE_CLOSURES_2(OOP_ITERATE_BACKWARDS_DECL) #endif ! template <class OopClosureType> ! typename enable_if<is_kind_of<OopClosure, OopClosureType>::value, int>::type ! oop_iterate_no_header(OopClosureType* bk); ! int oop_iterate_no_header(OopClosure* bk, MemRegion mr); // identity hash; returns the identity hash key (computes it if necessary) // NOTE with the introduction of UseBiasedLocking that identity_hash() might reach a // safepoint if called on a biased object. Calling code must be aware of that.
< prev index next >