Skip to content
Permalink
Browse files
8230808: Remove Access::equals()
Reviewed-by: phh
Backport-of: cb50d3b
  • Loading branch information
shipilev committed Aug 4, 2021
1 parent 35fcac6 commit 775135214df14dc52e0d4d339b15cd23033423af
@@ -296,10 +296,6 @@ class BarrierSet: public CHeapObj<mtGC> {
static oop resolve(oop obj) {
return Raw::resolve(obj);
}

static bool equals(oop o1, oop o2) {
return Raw::equals(o1, o2);
}
};
};

This file was deleted.

@@ -58,7 +58,6 @@
// * arraycopy: Copy data from one heap array to another heap array. The ArrayAccess class has convenience functions for this.
// * clone: Clone the contents of an object to a newly allocated object.
// * resolve: Resolve a stable to-space invariant oop that is guaranteed not to relocate its payload until a subsequent thread transition.
// * equals: Object equality, e.g. when different copies of the same objects are in use (from-space vs. to-space)
//
// == IMPLEMENTATION ==
// Each access goes through the following steps in a template pipeline.
@@ -275,11 +274,6 @@ class Access: public AllStatic {
verify_decorators<INTERNAL_EMPTY>();
return AccessInternal::resolve<decorators>(obj);
}

static bool equals(oop o1, oop o2) {
verify_decorators<INTERNAL_EMPTY>();
return AccessInternal::equals<decorators>(o1, o2);
}
};

// Helper for performing raw accesses (knows only of memory ordering
@@ -206,13 +206,6 @@ namespace AccessInternal {
}
};

template <class GCBarrierType, DecoratorSet decorators>
struct PostRuntimeDispatch<GCBarrierType, BARRIER_EQUALS, decorators>: public AllStatic {
static bool access_barrier(oop o1, oop o2) {
return GCBarrierType::equals(o1, o2);
}
};

// Resolving accessors with barriers from the barrier set happens in two steps.
// 1. Expand paths with runtime-decorators, e.g. is UseCompressedOops on or off.
// 2. Expand paths for each BarrierSet available in the system.
@@ -367,13 +360,6 @@ namespace AccessInternal {
_resolve_func = function;
return function(obj);
}

template <DecoratorSet decorators, typename T>
bool RuntimeDispatch<decorators, T, BARRIER_EQUALS>::equals_init(oop o1, oop o2) {
func_t function = BarrierResolver<decorators, func_t, BARRIER_EQUALS>::resolve_barrier();
_equals_func = function;
return function(o1, o2);
}
}

#endif // SHARE_OOPS_ACCESS_INLINE_HPP
@@ -63,8 +63,7 @@ namespace AccessInternal {
BARRIER_ATOMIC_XCHG_AT,
BARRIER_ARRAYCOPY,
BARRIER_CLONE,
BARRIER_RESOLVE,
BARRIER_EQUALS
BARRIER_RESOLVE
};

template <DecoratorSet decorators, typename T>
@@ -115,7 +114,6 @@ namespace AccessInternal {
size_t length);
typedef void (*clone_func_t)(oop src, oop dst, size_t size);
typedef oop (*resolve_func_t)(oop obj);
typedef bool (*equals_func_t)(oop o1, oop o2);
};

template <DecoratorSet decorators>
@@ -143,7 +141,6 @@ namespace AccessInternal {
ACCESS_GENERATE_ACCESS_FUNCTION(BARRIER_ARRAYCOPY, arraycopy_func_t);
ACCESS_GENERATE_ACCESS_FUNCTION(BARRIER_CLONE, clone_func_t);
ACCESS_GENERATE_ACCESS_FUNCTION(BARRIER_RESOLVE, resolve_func_t);
ACCESS_GENERATE_ACCESS_FUNCTION(BARRIER_EQUALS, equals_func_t);
#undef ACCESS_GENERATE_ACCESS_FUNCTION

template <DecoratorSet decorators, typename T, BarrierType barrier_type>
@@ -409,8 +406,6 @@ class RawAccessBarrier: public AllStatic {
static void clone(oop src, oop dst, size_t size);

static oop resolve(oop obj) { return obj; }

static bool equals(oop o1, oop o2) { return o1 == o2; }
};

// Below is the implementation of the first 4 steps of the template pipeline:
@@ -604,18 +599,6 @@ namespace AccessInternal {
}
};

template <DecoratorSet decorators, typename T>
struct RuntimeDispatch<decorators, T, BARRIER_EQUALS>: AllStatic {
typedef typename AccessFunction<decorators, T, BARRIER_EQUALS>::type func_t;
static func_t _equals_func;

static bool equals_init(oop o1, oop o2);

static inline bool equals(oop o1, oop o2) {
return _equals_func(o1, o2);
}
};

// Initialize the function pointers to point to the resolving function.
template <DecoratorSet decorators, typename T>
typename AccessFunction<decorators, T, BARRIER_STORE>::type
@@ -661,10 +644,6 @@ namespace AccessInternal {
typename AccessFunction<decorators, T, BARRIER_RESOLVE>::type
RuntimeDispatch<decorators, T, BARRIER_RESOLVE>::_resolve_func = &resolve_init;

template <DecoratorSet decorators, typename T>
typename AccessFunction<decorators, T, BARRIER_EQUALS>::type
RuntimeDispatch<decorators, T, BARRIER_EQUALS>::_equals_func = &equals_init;

// Step 3: Pre-runtime dispatching.
// The PreRuntimeDispatch class is responsible for filtering the barrier strength
// decorators. That is, for AS_RAW, it hardwires the accesses without a runtime
@@ -995,21 +974,6 @@ namespace AccessInternal {
resolve(oop obj) {
return RuntimeDispatch<decorators, oop, BARRIER_RESOLVE>::resolve(obj);
}

template <DecoratorSet decorators>
inline static typename EnableIf<
HasDecorator<decorators, INTERNAL_BT_TO_SPACE_INVARIANT>::value, bool>::type
equals(oop o1, oop o2) {
typedef RawAccessBarrier<decorators & RAW_DECORATOR_MASK> Raw;
return Raw::equals(o1, o2);
}

template <DecoratorSet decorators>
inline static typename EnableIf<
!HasDecorator<decorators, INTERNAL_BT_TO_SPACE_INVARIANT>::value, bool>::type
equals(oop o1, oop o2) {
return RuntimeDispatch<decorators, oop, BARRIER_EQUALS>::equals(o1, o2);
}
};

// Step 2: Reduce types.
@@ -1308,12 +1272,6 @@ namespace AccessInternal {
return PreRuntimeDispatch::resolve<expanded_decorators>(obj);
}

template <DecoratorSet decorators>
inline bool equals(oop o1, oop o2) {
const DecoratorSet expanded_decorators = DecoratorFixup<decorators>::value;
return PreRuntimeDispatch::equals<expanded_decorators>(o1, o2);
}

// Infer the type that should be returned from an Access::oop_load.
template <typename P, DecoratorSet decorators>
class OopLoadProxy: public StackObj {
@@ -152,7 +152,7 @@ class oopDesc {
}
}

inline static bool equals(oop o1, oop o2) { return Access<>::equals(o1, o2); }
inline static bool equals(oop o1, oop o2) { return o1 == o2; }

// Access to fields in a instanceOop through these methods.
template <DecoratorSet decorator>

1 comment on commit 7751352

@openjdk-notifier

This comment has been minimized.

Copy link

@openjdk-notifier openjdk-notifier bot commented on 7751352 Aug 4, 2021

Please sign in to comment.