mirror of
https://github.com/openjdk/jdk.git
synced 2026-04-06 04:59:02 +00:00
8299079: Better interface nmethod oop accesses
Co-authored-by: Axel Boldt-Christmas <aboldtch@openjdk.org> Reviewed-by: kvn, dholmes
This commit is contained in:
parent
41900b57af
commit
e3035bad60
@ -1462,14 +1462,14 @@ oop nmethod::oop_at(int index) const {
|
||||
if (index == 0) {
|
||||
return NULL;
|
||||
}
|
||||
return NativeAccess<AS_NO_KEEPALIVE>::oop_load(oop_addr_at(index));
|
||||
return NMethodAccess<AS_NO_KEEPALIVE>::oop_load(oop_addr_at(index));
|
||||
}
|
||||
|
||||
oop nmethod::oop_at_phantom(int index) const {
|
||||
if (index == 0) {
|
||||
return NULL;
|
||||
}
|
||||
return NativeAccess<ON_PHANTOM_OOP_REF>::oop_load(oop_addr_at(index));
|
||||
return NMethodAccess<ON_PHANTOM_OOP_REF>::oop_load(oop_addr_at(index));
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
@ -271,20 +271,25 @@ public:
|
||||
};
|
||||
|
||||
// Helper for performing raw accesses (knows only of memory ordering
|
||||
// atomicity decorators as well as compressed oops)
|
||||
// atomicity decorators as well as compressed oops).
|
||||
template <DecoratorSet decorators = DECORATORS_NONE>
|
||||
class RawAccess: public Access<AS_RAW | decorators> {};
|
||||
|
||||
// Helper for performing normal accesses on the heap. These accesses
|
||||
// may resolve an accessor on a GC barrier set
|
||||
// may resolve an accessor on a GC barrier set.
|
||||
template <DecoratorSet decorators = DECORATORS_NONE>
|
||||
class HeapAccess: public Access<IN_HEAP | decorators> {};
|
||||
|
||||
// Helper for performing normal accesses in roots. These accesses
|
||||
// may resolve an accessor on a GC barrier set
|
||||
// may resolve an accessor on a GC barrier set.
|
||||
template <DecoratorSet decorators = DECORATORS_NONE>
|
||||
class NativeAccess: public Access<IN_NATIVE | decorators> {};
|
||||
|
||||
// Helper for performing accesses in nmethods. These accesses
|
||||
// may resolve an accessor on a GC barrier set.
|
||||
template <DecoratorSet decorators = DECORATORS_NONE>
|
||||
class NMethodAccess: public Access<IN_NMETHOD | decorators> {};
|
||||
|
||||
// Helper for array access.
|
||||
template <DecoratorSet decorators = DECORATORS_NONE>
|
||||
class ArrayAccess: public HeapAccess<IS_ARRAY | decorators> {
|
||||
@ -362,6 +367,7 @@ void Access<decorators>::verify_decorators() {
|
||||
const DecoratorSet location_decorators = decorators & IN_DECORATOR_MASK;
|
||||
STATIC_ASSERT(location_decorators == 0 || ( // make sure location decorators are disjoint if set
|
||||
(location_decorators ^ IN_NATIVE) == 0 ||
|
||||
(location_decorators ^ IN_NMETHOD) == 0 ||
|
||||
(location_decorators ^ IN_HEAP) == 0
|
||||
));
|
||||
}
|
||||
|
||||
@ -172,9 +172,11 @@ const DecoratorSet ON_DECORATOR_MASK = ON_STRONG_OOP_REF | ON_WEAK_OOP_REF |
|
||||
// * IN_HEAP: The access is performed in the heap. Many barriers such as card marking will
|
||||
// be omitted if this decorator is not set.
|
||||
// * IN_NATIVE: The access is performed in an off-heap data structure.
|
||||
// * IN_NMETHOD: The access is performed inside of an nmethod.
|
||||
const DecoratorSet IN_HEAP = UCONST64(1) << 18;
|
||||
const DecoratorSet IN_NATIVE = UCONST64(1) << 19;
|
||||
const DecoratorSet IN_DECORATOR_MASK = IN_HEAP | IN_NATIVE;
|
||||
const DecoratorSet IN_NMETHOD = UCONST64(1) << 20;
|
||||
const DecoratorSet IN_DECORATOR_MASK = IN_HEAP | IN_NATIVE | IN_NMETHOD;
|
||||
|
||||
// == Boolean Flag Decorators ==
|
||||
// * IS_ARRAY: The access is performed on a heap allocated array. This is sometimes a special case
|
||||
@ -182,9 +184,9 @@ const DecoratorSet IN_DECORATOR_MASK = IN_HEAP | IN_NATIVE;
|
||||
// * IS_DEST_UNINITIALIZED: This property can be important to e.g. SATB barriers by
|
||||
// marking that the previous value is uninitialized nonsense rather than a real value.
|
||||
// * IS_NOT_NULL: This property can make certain barriers faster such as compressing oops.
|
||||
const DecoratorSet IS_ARRAY = UCONST64(1) << 20;
|
||||
const DecoratorSet IS_DEST_UNINITIALIZED = UCONST64(1) << 21;
|
||||
const DecoratorSet IS_NOT_NULL = UCONST64(1) << 22;
|
||||
const DecoratorSet IS_ARRAY = UCONST64(1) << 21;
|
||||
const DecoratorSet IS_DEST_UNINITIALIZED = UCONST64(1) << 22;
|
||||
const DecoratorSet IS_NOT_NULL = UCONST64(1) << 23;
|
||||
|
||||
// == Arraycopy Decorators ==
|
||||
// * ARRAYCOPY_CHECKCAST: This property means that the class of the objects in source
|
||||
@ -196,11 +198,11 @@ const DecoratorSet IS_NOT_NULL = UCONST64(1) << 22;
|
||||
// * ARRAYCOPY_ARRAYOF: The copy is in the arrayof form.
|
||||
// * ARRAYCOPY_ATOMIC: The accesses have to be atomic over the size of its elements.
|
||||
// * ARRAYCOPY_ALIGNED: The accesses have to be aligned on a HeapWord.
|
||||
const DecoratorSet ARRAYCOPY_CHECKCAST = UCONST64(1) << 23;
|
||||
const DecoratorSet ARRAYCOPY_DISJOINT = UCONST64(1) << 24;
|
||||
const DecoratorSet ARRAYCOPY_ARRAYOF = UCONST64(1) << 25;
|
||||
const DecoratorSet ARRAYCOPY_ATOMIC = UCONST64(1) << 26;
|
||||
const DecoratorSet ARRAYCOPY_ALIGNED = UCONST64(1) << 27;
|
||||
const DecoratorSet ARRAYCOPY_CHECKCAST = UCONST64(1) << 24;
|
||||
const DecoratorSet ARRAYCOPY_DISJOINT = UCONST64(1) << 25;
|
||||
const DecoratorSet ARRAYCOPY_ARRAYOF = UCONST64(1) << 26;
|
||||
const DecoratorSet ARRAYCOPY_ATOMIC = UCONST64(1) << 27;
|
||||
const DecoratorSet ARRAYCOPY_ALIGNED = UCONST64(1) << 28;
|
||||
const DecoratorSet ARRAYCOPY_DECORATOR_MASK = ARRAYCOPY_CHECKCAST | ARRAYCOPY_DISJOINT |
|
||||
ARRAYCOPY_DISJOINT | ARRAYCOPY_ARRAYOF |
|
||||
ARRAYCOPY_ATOMIC | ARRAYCOPY_ALIGNED;
|
||||
@ -209,11 +211,11 @@ const DecoratorSet ARRAYCOPY_DECORATOR_MASK = ARRAYCOPY_CHECKCAST | ARRAYC
|
||||
// * ACCESS_READ: Indicate that the resolved object is accessed read-only. This allows the GC
|
||||
// backend to use weaker and more efficient barriers.
|
||||
// * ACCESS_WRITE: Indicate that the resolved object is used for write access.
|
||||
const DecoratorSet ACCESS_READ = UCONST64(1) << 28;
|
||||
const DecoratorSet ACCESS_WRITE = UCONST64(1) << 29;
|
||||
const DecoratorSet ACCESS_READ = UCONST64(1) << 29;
|
||||
const DecoratorSet ACCESS_WRITE = UCONST64(1) << 30;
|
||||
|
||||
// Keep track of the last decorator.
|
||||
const DecoratorSet DECORATOR_LAST = UCONST64(1) << 29;
|
||||
const DecoratorSet DECORATOR_LAST = UCONST64(1) << 30;
|
||||
|
||||
namespace AccessInternal {
|
||||
// This class adds implied decorators that follow according to decorator rules.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user