mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-16 17:14:41 +02:00
8230808: Remove Access::equals()
Reviewed-by: tschatzl, shade
This commit is contained in:
parent
0848c76a66
commit
cb50d3b4f3
6 changed files with 3 additions and 105 deletions
|
@ -314,10 +314,6 @@ public:
|
|||
static oop resolve(oop obj) {
|
||||
return Raw::resolve(obj);
|
||||
}
|
||||
|
||||
static bool equals(oop o1, oop o2) {
|
||||
return Raw::equals(o1, o2);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -1,36 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled.hpp"
|
||||
#include "oops/access.inline.hpp"
|
||||
#include "oops/accessDecorators.hpp"
|
||||
|
||||
// This macro allows instantiating selected accesses to be usable from the
|
||||
// access.hpp file, to break dependencies to the access.inline.hpp file.
|
||||
#define INSTANTIATE_HPP_ACCESS(decorators, T, barrier_type) \
|
||||
template struct RuntimeDispatch<DecoratorFixup<decorators>::value, T, barrier_type>
|
||||
|
||||
namespace AccessInternal {
|
||||
INSTANTIATE_HPP_ACCESS(DECORATORS_NONE, oop, BARRIER_EQUALS);
|
||||
}
|
|
@ -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 @@ public:
|
|||
verify_decorators<DECORATORS_NONE>();
|
||||
return AccessInternal::resolve<decorators>(obj);
|
||||
}
|
||||
|
||||
static bool equals(oop o1, oop o2) {
|
||||
verify_decorators<AS_RAW>();
|
||||
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
|
||||
|
|
|
@ -64,8 +64,7 @@ namespace AccessInternal {
|
|||
BARRIER_ATOMIC_XCHG_AT,
|
||||
BARRIER_ARRAYCOPY,
|
||||
BARRIER_CLONE,
|
||||
BARRIER_RESOLVE,
|
||||
BARRIER_EQUALS
|
||||
BARRIER_RESOLVE
|
||||
};
|
||||
|
||||
template <DecoratorSet decorators, typename T>
|
||||
|
@ -116,7 +115,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>
|
||||
|
@ -144,7 +142,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>
|
||||
|
@ -410,8 +407,6 @@ public:
|
|||
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 (void*)o1 == (void*)o2; }
|
||||
};
|
||||
|
||||
// Below is the implementation of the first 4 steps of the template pipeline:
|
||||
|
@ -605,18 +600,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
|
||||
|
@ -662,10 +645,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
|
||||
|
@ -996,21 +975,6 @@ namespace AccessInternal {
|
|||
resolve(oop obj) {
|
||||
return RuntimeDispatch<decorators, oop, BARRIER_RESOLVE>::resolve(obj);
|
||||
}
|
||||
|
||||
template <DecoratorSet decorators>
|
||||
inline static typename EnableIf<
|
||||
HasDecorator<decorators, AS_RAW>::value || 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, AS_RAW>::value && !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.
|
||||
|
@ -1309,12 +1273,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 {
|
||||
|
|
|
@ -150,9 +150,9 @@ class oopDesc {
|
|||
}
|
||||
}
|
||||
|
||||
inline static bool equals(oop o1, oop o2) { return Access<>::equals(o1, o2); }
|
||||
inline static bool equals(oop o1, oop o2) { return equals_raw(o1, o2); }
|
||||
|
||||
inline static bool equals_raw(oop o1, oop o2) { return RawAccess<>::equals(o1, o2); }
|
||||
inline static bool equals_raw(oop o1, oop o2) { return o1 == o2; }
|
||||
|
||||
// Access to fields in a instanceOop through these methods.
|
||||
template <DecoratorSet decorator>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue