提交 ab6e48fd 编写于 作者: D ddong

8227605: Kitchensink fails "assert((((klass)->trace_id() &...

8227605: Kitchensink fails "assert((((klass)->trace_id() & (JfrTraceIdEpoch::leakp_in_use_this_epoch_bit())) != 0)) failed: invariant"
Reviewed-by: dholmes, dcubed, egahlin
上级 97c6698d
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
#include "jfr/utilities/jfrTypes.hpp" #include "jfr/utilities/jfrTypes.hpp"
#include "runtime/atomic.inline.hpp" #include "runtime/atomic.inline.hpp"
#include "runtime/orderAccess.inline.hpp"
#include "utilities/macros.hpp" #include "utilities/macros.hpp"
#ifdef VM_LITTLE_ENDIAN #ifdef VM_LITTLE_ENDIAN
...@@ -40,46 +39,45 @@ static const int leakp_offset = low_offset - 1; ...@@ -40,46 +39,45 @@ static const int leakp_offset = low_offset - 1;
inline void set_bits(jbyte bits, jbyte* const dest) { inline void set_bits(jbyte bits, jbyte* const dest) {
assert(dest != NULL, "invariant"); assert(dest != NULL, "invariant");
const jbyte current = OrderAccess::load_acquire(dest); if (bits != (*dest & bits)) {
if (bits != (current & bits)) {
*dest |= bits; *dest |= bits;
} }
} }
inline void set_mask(jbyte mask, jbyte* const dest) { inline jbyte traceid_and(jbyte current, jbyte bits) {
assert(dest != NULL, "invariant"); return current & bits;
const jbyte current = OrderAccess::load_acquire(dest);
if (mask != (current & mask)) {
*dest &= mask;
}
} }
inline void set_bits_cas(jbyte bits, jbyte* const dest) { inline jbyte traceid_or(jbyte current, jbyte bits) {
return current | bits;
}
inline jbyte traceid_xor(jbyte current, jbyte bits) {
return current ^ bits;
}
template <jbyte op(jbyte, jbyte)>
inline void set_bits_cas_form(jbyte bits, jbyte* const dest) {
assert(dest != NULL, "invariant"); assert(dest != NULL, "invariant");
do { do {
const jbyte current = OrderAccess::load_acquire(dest); const jbyte current = *dest;
if (bits == (current & bits)) { const jbyte new_value = op(current, bits);
return;
}
const jbyte new_value = current | bits;
if (Atomic::cmpxchg(new_value, dest, current) == current) { if (Atomic::cmpxchg(new_value, dest, current) == current) {
return; return;
} }
} while (true); } while (true);
} }
inline void set_bits_cas(jbyte bits, jbyte* const dest) {
set_bits_cas_form<traceid_or>(bits, dest);
}
inline void clear_bits_cas(jbyte bits, jbyte* const dest) { inline void clear_bits_cas(jbyte bits, jbyte* const dest) {
assert(dest != NULL, "invariant"); set_bits_cas_form<traceid_xor>(bits, dest);
do { }
const jbyte current = OrderAccess::load_acquire(dest);
if (bits != (current & bits)) { inline void set_mask(jbyte mask, jbyte* const dest) {
return; set_bits_cas_form<traceid_and>(mask, dest);
}
const jbyte new_value = current ^ bits;
if (Atomic::cmpxchg(new_value, dest, current) == current) {
return;
}
} while (true);
} }
inline void set_traceid_bits(jbyte bits, traceid* dest) { inline void set_traceid_bits(jbyte bits, traceid* dest) {
......
...@@ -108,7 +108,7 @@ ...@@ -108,7 +108,7 @@
#define SET_USED_THIS_EPOCH(ptr) (SET_TAG(ptr, IN_USE_THIS_EPOCH_BIT)) #define SET_USED_THIS_EPOCH(ptr) (SET_TAG(ptr, IN_USE_THIS_EPOCH_BIT))
#define SET_USED_PREV_EPOCH(ptr) (SET_TAG_CAS(ptr, IN_USE_PREV_EPOCH_BIT)) #define SET_USED_PREV_EPOCH(ptr) (SET_TAG_CAS(ptr, IN_USE_PREV_EPOCH_BIT))
#define SET_LEAKP_USED_THIS_EPOCH(ptr) (SET_LEAKP_TAG(ptr, IN_USE_THIS_EPOCH_BIT)) #define SET_LEAKP_USED_THIS_EPOCH(ptr) (SET_LEAKP_TAG(ptr, IN_USE_THIS_EPOCH_BIT))
#define SET_LEAKP_USED_PREV_EPOCH(ptr) (SET_LEAKP_TAG(ptr, IN_USE_PREV_EPOCH_BIT)) #define SET_LEAKP_USED_PREV_EPOCH(ptr) (SET_LEAKP_TAG_CAS(ptr, IN_USE_PREV_EPOCH_BIT))
#define SET_METHOD_AND_CLASS_USED_THIS_EPOCH(kls) (SET_TAG(kls, METHOD_AND_CLASS_IN_USE_THIS_EPOCH_BITS)) #define SET_METHOD_AND_CLASS_USED_THIS_EPOCH(kls) (SET_TAG(kls, METHOD_AND_CLASS_IN_USE_THIS_EPOCH_BITS))
#define USED_THIS_EPOCH(ptr) (((ptr)->trace_id() & IN_USE_THIS_EPOCH_BIT) != 0) #define USED_THIS_EPOCH(ptr) (((ptr)->trace_id() & IN_USE_THIS_EPOCH_BIT) != 0)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册