8075955: Replace the macro based implementation of oop_oop_iterate with a template based solution

Reviewed-by: brutisso, coleenp, kbarrett, sjohanss
This commit is contained in:
Stefan Karlsson 2015-04-02 10:04:27 +02:00
parent c0af548c2b
commit 232a59cb40
48 changed files with 2281 additions and 1867 deletions

View file

@ -64,30 +64,71 @@ class InstanceRefKlass: public InstanceKlass {
return (InstanceRefKlass*) k;
}
// Garbage collection
int oop_adjust_pointers(oop obj);
void oop_follow_contents(oop obj);
// GC specific object visitors
//
// Mark Sweep
void oop_ms_follow_contents(oop obj);
int oop_ms_adjust_pointers(oop obj);
#if INCLUDE_ALL_GCS
// Parallel Scavenge
void oop_ps_push_contents( oop obj, PSPromotionManager* pm);
// Parallel Compact
void oop_pc_follow_contents(oop obj, ParCompactionManager* cm);
void oop_pc_update_pointers(oop obj);
#endif
// Parallel Scavenge and Parallel Old
PARALLEL_GC_DECLS
// Oop fields (and metadata) iterators
// [nv = true] Use non-virtual calls to do_oop_nv.
// [nv = false] Use virtual calls to do_oop.
//
// The InstanceRefKlass iterators also support reference processing.
int oop_oop_iterate(oop obj, ExtendedOopClosure* blk) {
return oop_oop_iterate_v(obj, blk);
}
int oop_oop_iterate_m(oop obj, ExtendedOopClosure* blk, MemRegion mr) {
return oop_oop_iterate_v_m(obj, blk, mr);
}
#define InstanceRefKlass_OOP_OOP_ITERATE_DECL(OopClosureType, nv_suffix) \
int oop_oop_iterate##nv_suffix(oop obj, OopClosureType* blk); \
int oop_oop_iterate##nv_suffix##_m(oop obj, OopClosureType* blk, MemRegion mr);
// Forward iteration
private:
// Iterate over all oop fields and metadata.
template <bool nv, class OopClosureType>
inline int oop_oop_iterate(oop obj, OopClosureType* closure);
// Reverse iteration
#if INCLUDE_ALL_GCS
// Iterate over all oop fields and metadata.
template <bool nv, class OopClosureType>
inline int oop_oop_iterate_reverse(oop obj, OopClosureType* closure);
#endif // INCLUDE_ALL_GCS
// Bounded range iteration
// Iterate over all oop fields and metadata.
template <bool nv, class OopClosureType>
inline int oop_oop_iterate_bounded(oop obj, OopClosureType* closure, MemRegion mr);
// Reference processing part of the iterators.
// Specialized for [T = oop] or [T = narrowOop].
template <bool nv, typename T, class OopClosureType, class Contains>
inline void oop_oop_iterate_ref_processing_specialized(oop obj, OopClosureType* closure, Contains& contains);
// Only perform reference processing if the referent object is within mr.
template <bool nv, class OopClosureType>
inline void oop_oop_iterate_ref_processing_bounded(oop obj, OopClosureType* closure, MemRegion mr);
// Reference processing
template <bool nv, class OopClosureType>
inline void oop_oop_iterate_ref_processing(oop obj, OopClosureType* closure);
public:
#define InstanceRefKlass_OOP_OOP_ITERATE_DECL(OopClosureType, nv_suffix) \
int oop_oop_iterate##nv_suffix(oop obj, OopClosureType* closure); \
int oop_oop_iterate##nv_suffix##_m(oop obj, OopClosureType* closure, MemRegion mr);
ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceRefKlass_OOP_OOP_ITERATE_DECL)
ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceRefKlass_OOP_OOP_ITERATE_DECL)
#if INCLUDE_ALL_GCS
#define InstanceRefKlass_OOP_OOP_ITERATE_BACKWARDS_DECL(OopClosureType, nv_suffix) \
int oop_oop_iterate_backwards##nv_suffix(oop obj, OopClosureType* blk);
#define InstanceRefKlass_OOP_OOP_ITERATE_BACKWARDS_DECL(OopClosureType, nv_suffix) \
int oop_oop_iterate_backwards##nv_suffix(oop obj, OopClosureType* closure);
ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceRefKlass_OOP_OOP_ITERATE_BACKWARDS_DECL)
ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceRefKlass_OOP_OOP_ITERATE_BACKWARDS_DECL)