8202642: Replace PAR_OOP_ITERATE with templates

Reviewed-by: eosterlund, sjohanss
This commit is contained in:
Stefan Karlsson 2018-05-07 14:42:10 +02:00
parent 1dd85fe2f4
commit 5f40eda733
6 changed files with 13 additions and 42 deletions

@ -60,10 +60,4 @@ class CMSInnerParMarkAndPushClosure;
f(CMSKeepAliveClosure,_nv) \
f(CMSInnerParMarkAndPushClosure,_nv)
#define SPECIALIZED_PAR_OOP_ITERATE_CLOSURES(f) \
f(MarkRefsIntoAndScanClosure,_nv) \
f(PushAndMarkClosure,_nv) \
f(ParMarkRefsIntoAndScanClosure,_nv) \
f(ParPushAndMarkClosure,_nv)
#endif // SHARE_GC_CMS_CMS_SPECIALIZED_OOP_CLOSURES_HPP

@ -55,6 +55,7 @@
#include "gc/shared/genOopClosures.inline.hpp"
#include "gc/shared/isGCActiveMark.hpp"
#include "gc/shared/referencePolicy.hpp"
#include "gc/shared/space.inline.hpp"
#include "gc/shared/strongRootsScope.hpp"
#include "gc/shared/taskqueue.inline.hpp"
#include "gc/shared/weakProcessor.hpp"

@ -490,23 +490,6 @@ bool Space::obj_is_alive(const HeapWord* p) const {
return true;
}
#if INCLUDE_CMSGC
#define ContigSpace_PAR_OOP_ITERATE_DEFN(OopClosureType, nv_suffix) \
\
void ContiguousSpace::par_oop_iterate(MemRegion mr, OopClosureType* blk) {\
HeapWord* obj_addr = mr.start(); \
HeapWord* t = mr.end(); \
while (obj_addr < t) { \
assert(oopDesc::is_oop(oop(obj_addr)), "Should be an oop"); \
obj_addr += oop(obj_addr)->oop_iterate_size(blk); \
} \
}
ALL_PAR_OOP_ITERATE_CLOSURES(ContigSpace_PAR_OOP_ITERATE_DEFN)
#undef ContigSpace_PAR_OOP_ITERATE_DEFN
#endif // INCLUDE_CMSGC
void ContiguousSpace::oop_iterate(ExtendedOopClosure* blk) {
if (is_empty()) return;
HeapWord* obj_addr = bottom();

@ -608,15 +608,9 @@ class ContiguousSpace: public CompactibleSpace {
_concurrent_iteration_safe_limit = new_limit;
}
#if INCLUDE_CMSGC
// In support of parallel oop_iterate.
#define ContigSpace_PAR_OOP_ITERATE_DECL(OopClosureType, nv_suffix) \
void par_oop_iterate(MemRegion mr, OopClosureType* blk);
ALL_PAR_OOP_ITERATE_CLOSURES(ContigSpace_PAR_OOP_ITERATE_DECL)
#undef ContigSpace_PAR_OOP_ITERATE_DECL
#endif // INCLUDE_CMSGC
template <typename OopClosureType>
void par_oop_iterate(MemRegion mr, OopClosureType* blk);
// Compaction support
virtual void reset_after_compaction() {

@ -377,4 +377,14 @@ void ContiguousSpace::oop_since_save_marks_iterate(OopClosureType* blk) {
set_saved_mark_word(p);
}
template <typename OopClosureType>
void ContiguousSpace::par_oop_iterate(MemRegion mr, OopClosureType* blk) {
HeapWord* obj_addr = mr.start();
HeapWord* limit = mr.end();
while (obj_addr < limit) {
assert(oopDesc::is_oop(oop(obj_addr)), "Should be an oop");
obj_addr += oop(obj_addr)->oop_iterate_size(blk);
}
}
#endif // SHARE_VM_GC_SHARED_SPACE_INLINE_HPP

@ -80,15 +80,4 @@ class OopsInGenClosure;
#define ALL_OOP_OOP_ITERATE_CLOSURES_2(f) \
SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_2(f)
// This macro applies an argument macro to all OopClosures for which we
// want specialized bodies of a family of methods related to
// "par_oop_iterate". The arguments to f are the same as above.
// The "root_class" is the most general class to define; this may be
// "OopClosure" in some applications and "OopsInGenClosure" in others.
#define ALL_PAR_OOP_ITERATE_CLOSURES(f) \
f(ExtendedOopClosure,_v) \
CMSGC_ONLY(SPECIALIZED_PAR_OOP_ITERATE_CLOSURES(f))
#endif // SHARE_VM_GC_SHARED_SPECIALIZED_OOP_CLOSURES_HPP