8193063: Enabling narrowOop values for RawAccess accesses
Reviewed-by: pliden, kbarrett
This commit is contained in:
parent
1cf8169a2e
commit
c5f5601b1c
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 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
|
||||
@ -27,7 +27,6 @@
|
||||
|
||||
#include "gc/shared/accessBarrierSupport.inline.hpp"
|
||||
#include "gc/g1/g1SATBCardTableModRefBS.hpp"
|
||||
#include "oops/oop.inline.hpp"
|
||||
|
||||
template <DecoratorSet decorators, typename T>
|
||||
inline void G1SATBCardTableModRefBS::write_ref_field_pre(T* field) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 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
|
||||
@ -147,9 +147,8 @@ public:
|
||||
// 3) Provide specializations for BarrierSet::GetName and BarrierSet::GetType.
|
||||
template <DecoratorSet decorators, typename BarrierSetT>
|
||||
class AccessBarrier: protected RawAccessBarrier<decorators> {
|
||||
protected:
|
||||
private:
|
||||
typedef RawAccessBarrier<decorators> Raw;
|
||||
typedef typename BarrierSetT::template AccessBarrier<decorators> CRTPAccessBarrier;
|
||||
|
||||
public:
|
||||
// Primitive heap accesses. These accessors get resolved when
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2017, 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
|
||||
@ -342,7 +342,7 @@ class Access: public AllStatic {
|
||||
template <DecoratorSet expected_mo_decorators>
|
||||
static void verify_primitive_decorators() {
|
||||
const DecoratorSet primitive_decorators = (AS_DECORATOR_MASK ^ AS_NO_KEEPALIVE) | IN_HEAP |
|
||||
IN_HEAP_ARRAY | MO_DECORATOR_MASK;
|
||||
IN_HEAP_ARRAY;
|
||||
verify_decorators<expected_mo_decorators | primitive_decorators>();
|
||||
}
|
||||
|
||||
@ -350,7 +350,7 @@ class Access: public AllStatic {
|
||||
static void verify_oop_decorators() {
|
||||
const DecoratorSet oop_decorators = AS_DECORATOR_MASK | IN_DECORATOR_MASK |
|
||||
(ON_DECORATOR_MASK ^ ON_UNKNOWN_OOP_REF) | // no unknown oop refs outside of the heap
|
||||
OOP_DECORATOR_MASK | MO_DECORATOR_MASK;
|
||||
OOP_DECORATOR_MASK;
|
||||
verify_decorators<expected_mo_decorators | oop_decorators>();
|
||||
}
|
||||
|
||||
@ -358,8 +358,7 @@ class Access: public AllStatic {
|
||||
static void verify_heap_oop_decorators() {
|
||||
const DecoratorSet heap_oop_decorators = AS_DECORATOR_MASK | ON_DECORATOR_MASK |
|
||||
OOP_DECORATOR_MASK | (IN_DECORATOR_MASK ^
|
||||
(IN_ROOT ^ IN_CONCURRENT_ROOT)) | // no root accesses in the heap
|
||||
MO_DECORATOR_MASK;
|
||||
(IN_ROOT | IN_CONCURRENT_ROOT)); // no root accesses in the heap
|
||||
verify_decorators<expected_mo_decorators | heap_oop_decorators>();
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2017, 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
|
||||
@ -491,11 +491,12 @@ namespace AccessInternal {
|
||||
// not possible.
|
||||
struct PreRuntimeDispatch: AllStatic {
|
||||
template<DecoratorSet decorators>
|
||||
static bool can_hardwire_raw() {
|
||||
return !HasDecorator<decorators, INTERNAL_VALUE_IS_OOP>::value || // primitive access
|
||||
!HasDecorator<decorators, INTERNAL_CONVERT_COMPRESSED_OOP>::value || // don't care about compressed oops (oop* address)
|
||||
HasDecorator<decorators, INTERNAL_RT_USE_COMPRESSED_OOPS>::value; // we can infer we use compressed oops (narrowOop* address)
|
||||
}
|
||||
struct CanHardwireRaw: public IntegralConstant<
|
||||
bool,
|
||||
!HasDecorator<decorators, INTERNAL_VALUE_IS_OOP>::value || // primitive access
|
||||
!HasDecorator<decorators, INTERNAL_CONVERT_COMPRESSED_OOP>::value || // don't care about compressed oops (oop* address)
|
||||
HasDecorator<decorators, INTERNAL_RT_USE_COMPRESSED_OOPS>::value> // we can infer we use compressed oops (narrowOop* address)
|
||||
{};
|
||||
|
||||
static const DecoratorSet convert_compressed_oops = INTERNAL_RT_USE_COMPRESSED_OOPS | INTERNAL_CONVERT_COMPRESSED_OOP;
|
||||
|
||||
@ -507,16 +508,21 @@ namespace AccessInternal {
|
||||
|
||||
template <DecoratorSet decorators, typename T>
|
||||
inline static typename EnableIf<
|
||||
HasDecorator<decorators, AS_RAW>::value>::type
|
||||
HasDecorator<decorators, AS_RAW>::value && CanHardwireRaw<decorators>::value>::type
|
||||
store(void* addr, T value) {
|
||||
typedef RawAccessBarrier<decorators & RAW_DECORATOR_MASK> Raw;
|
||||
if (can_hardwire_raw<decorators>()) {
|
||||
if (HasDecorator<decorators, INTERNAL_VALUE_IS_OOP>::value) {
|
||||
Raw::oop_store(addr, value);
|
||||
} else {
|
||||
Raw::store(addr, value);
|
||||
}
|
||||
} else if (UseCompressedOops) {
|
||||
if (HasDecorator<decorators, INTERNAL_VALUE_IS_OOP>::value) {
|
||||
Raw::oop_store(addr, value);
|
||||
} else {
|
||||
Raw::store(addr, value);
|
||||
}
|
||||
}
|
||||
|
||||
template <DecoratorSet decorators, typename T>
|
||||
inline static typename EnableIf<
|
||||
HasDecorator<decorators, AS_RAW>::value && !CanHardwireRaw<decorators>::value>::type
|
||||
store(void* addr, T value) {
|
||||
if (UseCompressedOops) {
|
||||
const DecoratorSet expanded_decorators = decorators | convert_compressed_oops;
|
||||
PreRuntimeDispatch::store<expanded_decorators>(addr, value);
|
||||
} else {
|
||||
@ -558,16 +564,21 @@ namespace AccessInternal {
|
||||
|
||||
template <DecoratorSet decorators, typename T>
|
||||
inline static typename EnableIf<
|
||||
HasDecorator<decorators, AS_RAW>::value, T>::type
|
||||
HasDecorator<decorators, AS_RAW>::value && CanHardwireRaw<decorators>::value, T>::type
|
||||
load(void* addr) {
|
||||
typedef RawAccessBarrier<decorators & RAW_DECORATOR_MASK> Raw;
|
||||
if (can_hardwire_raw<decorators>()) {
|
||||
if (HasDecorator<decorators, INTERNAL_VALUE_IS_OOP>::value) {
|
||||
return Raw::template oop_load<T>(addr);
|
||||
} else {
|
||||
return Raw::template load<T>(addr);
|
||||
}
|
||||
} else if (UseCompressedOops) {
|
||||
if (HasDecorator<decorators, INTERNAL_VALUE_IS_OOP>::value) {
|
||||
return Raw::template oop_load<T>(addr);
|
||||
} else {
|
||||
return Raw::template load<T>(addr);
|
||||
}
|
||||
}
|
||||
|
||||
template <DecoratorSet decorators, typename T>
|
||||
inline static typename EnableIf<
|
||||
HasDecorator<decorators, AS_RAW>::value && !CanHardwireRaw<decorators>::value, T>::type
|
||||
load(void* addr) {
|
||||
if (UseCompressedOops) {
|
||||
const DecoratorSet expanded_decorators = decorators | convert_compressed_oops;
|
||||
return PreRuntimeDispatch::load<expanded_decorators, T>(addr);
|
||||
} else {
|
||||
@ -609,16 +620,21 @@ namespace AccessInternal {
|
||||
|
||||
template <DecoratorSet decorators, typename T>
|
||||
inline static typename EnableIf<
|
||||
HasDecorator<decorators, AS_RAW>::value, T>::type
|
||||
HasDecorator<decorators, AS_RAW>::value && CanHardwireRaw<decorators>::value, T>::type
|
||||
atomic_cmpxchg(T new_value, void* addr, T compare_value) {
|
||||
typedef RawAccessBarrier<decorators & RAW_DECORATOR_MASK> Raw;
|
||||
if (can_hardwire_raw<decorators>()) {
|
||||
if (HasDecorator<decorators, INTERNAL_VALUE_IS_OOP>::value) {
|
||||
return Raw::oop_atomic_cmpxchg(new_value, addr, compare_value);
|
||||
} else {
|
||||
return Raw::atomic_cmpxchg(new_value, addr, compare_value);
|
||||
}
|
||||
} else if (UseCompressedOops) {
|
||||
if (HasDecorator<decorators, INTERNAL_VALUE_IS_OOP>::value) {
|
||||
return Raw::oop_atomic_cmpxchg(new_value, addr, compare_value);
|
||||
} else {
|
||||
return Raw::atomic_cmpxchg(new_value, addr, compare_value);
|
||||
}
|
||||
}
|
||||
|
||||
template <DecoratorSet decorators, typename T>
|
||||
inline static typename EnableIf<
|
||||
HasDecorator<decorators, AS_RAW>::value && !CanHardwireRaw<decorators>::value, T>::type
|
||||
atomic_cmpxchg(T new_value, void* addr, T compare_value) {
|
||||
if (UseCompressedOops) {
|
||||
const DecoratorSet expanded_decorators = decorators | convert_compressed_oops;
|
||||
return PreRuntimeDispatch::atomic_cmpxchg<expanded_decorators>(new_value, addr, compare_value);
|
||||
} else {
|
||||
@ -661,16 +677,21 @@ namespace AccessInternal {
|
||||
|
||||
template <DecoratorSet decorators, typename T>
|
||||
inline static typename EnableIf<
|
||||
HasDecorator<decorators, AS_RAW>::value, T>::type
|
||||
HasDecorator<decorators, AS_RAW>::value && CanHardwireRaw<decorators>::value, T>::type
|
||||
atomic_xchg(T new_value, void* addr) {
|
||||
typedef RawAccessBarrier<decorators & RAW_DECORATOR_MASK> Raw;
|
||||
if (can_hardwire_raw<decorators>()) {
|
||||
if (HasDecorator<decorators, INTERNAL_VALUE_IS_OOP>::value) {
|
||||
return Raw::oop_atomic_xchg(new_value, addr);
|
||||
} else {
|
||||
return Raw::atomic_xchg(new_value, addr);
|
||||
}
|
||||
} else if (UseCompressedOops) {
|
||||
if (HasDecorator<decorators, INTERNAL_VALUE_IS_OOP>::value) {
|
||||
return Raw::oop_atomic_xchg(new_value, addr);
|
||||
} else {
|
||||
return Raw::atomic_xchg(new_value, addr);
|
||||
}
|
||||
}
|
||||
|
||||
template <DecoratorSet decorators, typename T>
|
||||
inline static typename EnableIf<
|
||||
HasDecorator<decorators, AS_RAW>::value && !CanHardwireRaw<decorators>::value, T>::type
|
||||
atomic_xchg(T new_value, void* addr) {
|
||||
if (UseCompressedOops) {
|
||||
const DecoratorSet expanded_decorators = decorators | convert_compressed_oops;
|
||||
return PreRuntimeDispatch::atomic_xchg<expanded_decorators>(new_value, addr);
|
||||
} else {
|
||||
@ -797,6 +818,13 @@ namespace AccessInternal {
|
||||
PreRuntimeDispatch::store<expanded_decorators>(addr, value);
|
||||
}
|
||||
|
||||
template <DecoratorSet decorators>
|
||||
inline void store_reduce_types(narrowOop* addr, narrowOop value) {
|
||||
const DecoratorSet expanded_decorators = decorators | INTERNAL_CONVERT_COMPRESSED_OOP |
|
||||
INTERNAL_RT_USE_COMPRESSED_OOPS;
|
||||
PreRuntimeDispatch::store<expanded_decorators>(addr, value);
|
||||
}
|
||||
|
||||
template <DecoratorSet decorators>
|
||||
inline void store_reduce_types(HeapWord* addr, oop value) {
|
||||
const DecoratorSet expanded_decorators = decorators | INTERNAL_CONVERT_COMPRESSED_OOP;
|
||||
@ -816,7 +844,16 @@ namespace AccessInternal {
|
||||
}
|
||||
|
||||
template <DecoratorSet decorators>
|
||||
inline oop atomic_cmpxchg_reduce_types(oop new_value, HeapWord* addr, oop compare_value) {
|
||||
inline narrowOop atomic_cmpxchg_reduce_types(narrowOop new_value, narrowOop* addr, narrowOop compare_value) {
|
||||
const DecoratorSet expanded_decorators = decorators | INTERNAL_CONVERT_COMPRESSED_OOP |
|
||||
INTERNAL_RT_USE_COMPRESSED_OOPS;
|
||||
return PreRuntimeDispatch::atomic_cmpxchg<expanded_decorators>(new_value, addr, compare_value);
|
||||
}
|
||||
|
||||
template <DecoratorSet decorators>
|
||||
inline oop atomic_cmpxchg_reduce_types(oop new_value,
|
||||
HeapWord* addr,
|
||||
oop compare_value) {
|
||||
const DecoratorSet expanded_decorators = decorators | INTERNAL_CONVERT_COMPRESSED_OOP;
|
||||
return PreRuntimeDispatch::atomic_cmpxchg<expanded_decorators>(new_value, addr, compare_value);
|
||||
}
|
||||
@ -834,6 +871,13 @@ namespace AccessInternal {
|
||||
return PreRuntimeDispatch::atomic_xchg<expanded_decorators>(new_value, addr);
|
||||
}
|
||||
|
||||
template <DecoratorSet decorators>
|
||||
inline narrowOop atomic_xchg_reduce_types(narrowOop new_value, narrowOop* addr) {
|
||||
const DecoratorSet expanded_decorators = decorators | INTERNAL_CONVERT_COMPRESSED_OOP |
|
||||
INTERNAL_RT_USE_COMPRESSED_OOPS;
|
||||
return PreRuntimeDispatch::atomic_xchg<expanded_decorators>(new_value, addr);
|
||||
}
|
||||
|
||||
template <DecoratorSet decorators>
|
||||
inline oop atomic_xchg_reduce_types(oop new_value, HeapWord* addr) {
|
||||
const DecoratorSet expanded_decorators = decorators | INTERNAL_CONVERT_COMPRESSED_OOP;
|
||||
@ -846,9 +890,10 @@ namespace AccessInternal {
|
||||
}
|
||||
|
||||
template <DecoratorSet decorators, typename T>
|
||||
inline oop load_reduce_types(narrowOop* addr) {
|
||||
const DecoratorSet expanded_decorators = decorators | INTERNAL_CONVERT_COMPRESSED_OOP | INTERNAL_RT_USE_COMPRESSED_OOPS;
|
||||
return PreRuntimeDispatch::load<expanded_decorators, oop>(addr);
|
||||
inline typename OopOrNarrowOop<T>::type load_reduce_types(narrowOop* addr) {
|
||||
const DecoratorSet expanded_decorators = decorators | INTERNAL_CONVERT_COMPRESSED_OOP |
|
||||
INTERNAL_RT_USE_COMPRESSED_OOPS;
|
||||
return PreRuntimeDispatch::load<expanded_decorators, typename OopOrNarrowOop<T>::type>(addr);
|
||||
}
|
||||
|
||||
template <DecoratorSet decorators, typename T>
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2017, 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
|
||||
@ -28,6 +28,7 @@
|
||||
#include "metaprogramming/conditional.hpp"
|
||||
#include "metaprogramming/enableIf.hpp"
|
||||
#include "metaprogramming/integralConstant.hpp"
|
||||
#include "metaprogramming/isSame.hpp"
|
||||
#include "utilities/debug.hpp"
|
||||
#include "utilities/globalDefinitions.hpp"
|
||||
|
||||
@ -54,11 +55,11 @@ namespace AccessInternal {
|
||||
BARRIER_CLONE
|
||||
};
|
||||
|
||||
template <DecoratorSet decorators>
|
||||
template <DecoratorSet decorators, typename T>
|
||||
struct MustConvertCompressedOop: public IntegralConstant<bool,
|
||||
HasDecorator<decorators, INTERNAL_VALUE_IS_OOP>::value &&
|
||||
HasDecorator<decorators, INTERNAL_CONVERT_COMPRESSED_OOP>::value &&
|
||||
HasDecorator<decorators, INTERNAL_RT_USE_COMPRESSED_OOPS>::value> {};
|
||||
IsSame<typename HeapOopType<decorators>::type, narrowOop>::value &&
|
||||
IsSame<T, oop>::value> {};
|
||||
|
||||
// This metafunction returns an appropriate oop type if the value is oop-like
|
||||
// and otherwise returns the same type T.
|
||||
@ -172,13 +173,13 @@ protected:
|
||||
// Only encode if INTERNAL_VALUE_IS_OOP
|
||||
template <DecoratorSet idecorators, typename T>
|
||||
static inline typename EnableIf<
|
||||
AccessInternal::MustConvertCompressedOop<idecorators>::value,
|
||||
AccessInternal::MustConvertCompressedOop<idecorators, T>::value,
|
||||
typename HeapOopType<idecorators>::type>::type
|
||||
encode_internal(T value);
|
||||
|
||||
template <DecoratorSet idecorators, typename T>
|
||||
static inline typename EnableIf<
|
||||
!AccessInternal::MustConvertCompressedOop<idecorators>::value, T>::type
|
||||
!AccessInternal::MustConvertCompressedOop<idecorators, T>::value, T>::type
|
||||
encode_internal(T value) {
|
||||
return value;
|
||||
}
|
||||
@ -192,12 +193,12 @@ protected:
|
||||
// Only decode if INTERNAL_VALUE_IS_OOP
|
||||
template <DecoratorSet idecorators, typename T>
|
||||
static inline typename EnableIf<
|
||||
AccessInternal::MustConvertCompressedOop<idecorators>::value, T>::type
|
||||
AccessInternal::MustConvertCompressedOop<idecorators, T>::value, T>::type
|
||||
decode_internal(typename HeapOopType<idecorators>::type value);
|
||||
|
||||
template <DecoratorSet idecorators, typename T>
|
||||
static inline typename EnableIf<
|
||||
!AccessInternal::MustConvertCompressedOop<idecorators>::value, T>::type
|
||||
!AccessInternal::MustConvertCompressedOop<idecorators, T>::value, T>::type
|
||||
decode_internal(T value) {
|
||||
return value;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2017, 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
|
||||
@ -32,7 +32,7 @@
|
||||
template <DecoratorSet decorators>
|
||||
template <DecoratorSet idecorators, typename T>
|
||||
inline typename EnableIf<
|
||||
AccessInternal::MustConvertCompressedOop<idecorators>::value, T>::type
|
||||
AccessInternal::MustConvertCompressedOop<idecorators, T>::value, T>::type
|
||||
RawAccessBarrier<decorators>::decode_internal(typename HeapOopType<idecorators>::type value) {
|
||||
if (HasDecorator<decorators, OOP_NOT_NULL>::value) {
|
||||
return oopDesc::decode_heap_oop_not_null(value);
|
||||
@ -44,7 +44,7 @@ RawAccessBarrier<decorators>::decode_internal(typename HeapOopType<idecorators>:
|
||||
template <DecoratorSet decorators>
|
||||
template <DecoratorSet idecorators, typename T>
|
||||
inline typename EnableIf<
|
||||
AccessInternal::MustConvertCompressedOop<idecorators>::value,
|
||||
AccessInternal::MustConvertCompressedOop<idecorators, T>::value,
|
||||
typename HeapOopType<idecorators>::type>::type
|
||||
RawAccessBarrier<decorators>::encode_internal(T value) {
|
||||
if (HasDecorator<decorators, OOP_NOT_NULL>::value) {
|
||||
|
Loading…
Reference in New Issue
Block a user