8189871: Refactor GC barriers to use declarative semantics

Reviewed-by: pliden, rkennke, coleenp, dholmes, kbarrett, stefank
This commit is contained in:
Erik Österlund 2017-11-20 13:07:44 +01:00
parent 63122ba705
commit 3e5e2f03b1
45 changed files with 3458 additions and 806 deletions

View file

@ -38,10 +38,6 @@
//
// no virtual functions allowed
// store into oop with store check
template <class T> inline void oop_store(T* p, oop v);
template <class T> inline void oop_store(volatile T* p, oop v);
extern bool always_do_update_barrier;
// Forward declarations.
@ -65,9 +61,6 @@ class oopDesc {
narrowKlass _compressed_klass;
} _metadata;
// Fast access to barrier set. Must be initialized.
static BarrierSet* _bs;
public:
markOop mark() const { return _mark; }
markOop* mark_addr() const { return (markOop*) &_mark; }
@ -122,6 +115,9 @@ class oopDesc {
bool is_objArray_noinline() const;
bool is_typeArray_noinline() const;
protected:
inline oop as_oop() const { return const_cast<oopDesc*>(this); }
private:
// field addresses in oop
inline void* field_base(int offset) const;
@ -162,107 +158,93 @@ class oopDesc {
// Load an oop out of the Java heap as is without decoding.
// Called by GC to check for null before decoding.
static inline narrowOop load_heap_oop(narrowOop* p) { return *p; }
static inline oop load_heap_oop(oop* p) { return *p; }
static inline narrowOop load_heap_oop(narrowOop* p);
static inline oop load_heap_oop(oop* p);
// Load an oop out of Java heap and decode it to an uncompressed oop.
static inline oop load_decode_heap_oop_not_null(narrowOop* p);
static inline oop load_decode_heap_oop_not_null(oop* p) { return *p; }
static inline oop load_decode_heap_oop_not_null(oop* p);
static inline oop load_decode_heap_oop(narrowOop* p);
static inline oop load_decode_heap_oop(oop* p) { return *p; }
static inline oop load_decode_heap_oop(oop* p);
// Store already encoded heap oop into the heap.
static inline void store_heap_oop(narrowOop* p, narrowOop v) { *p = v; }
static inline void store_heap_oop(oop* p, oop v) { *p = v; }
static inline void store_heap_oop(narrowOop* p, narrowOop v);
static inline void store_heap_oop(oop* p, oop v);
// Encode oop if UseCompressedOops and store into the heap.
static inline void encode_store_heap_oop_not_null(narrowOop* p, oop v);
static inline void encode_store_heap_oop_not_null(oop* p, oop v) { *p = v; }
static inline void encode_store_heap_oop_not_null(oop* p, oop v);
static inline void encode_store_heap_oop(narrowOop* p, oop v);
static inline void encode_store_heap_oop(oop* p, oop v) { *p = v; }
static inline void release_store_heap_oop(volatile narrowOop* p, narrowOop v);
static inline void release_store_heap_oop(volatile oop* p, oop v);
static inline void release_encode_store_heap_oop_not_null(volatile narrowOop* p, oop v);
static inline void release_encode_store_heap_oop_not_null(volatile oop* p, oop v);
static inline void release_encode_store_heap_oop(volatile narrowOop* p, oop v);
static inline void release_encode_store_heap_oop(volatile oop* p, oop v);
static inline oop atomic_exchange_oop(oop exchange_value, volatile HeapWord *dest);
static inline oop atomic_compare_exchange_oop(oop exchange_value,
volatile HeapWord *dest,
oop compare_value,
bool prebarrier = false);
static inline void encode_store_heap_oop(oop* p, oop v);
// Access to fields in a instanceOop through these methods.
inline oop obj_field(int offset) const;
inline void obj_field_put(int offset, oop value);
inline void obj_field_put_raw(int offset, oop value);
inline void obj_field_put_volatile(int offset, oop value);
oop obj_field(int offset) const;
void obj_field_put(int offset, oop value);
void obj_field_put_raw(int offset, oop value);
void obj_field_put_volatile(int offset, oop value);
inline Metadata* metadata_field(int offset) const;
inline void metadata_field_put(int offset, Metadata* value);
Metadata* metadata_field(int offset) const;
void metadata_field_put(int offset, Metadata* value);
inline Metadata* metadata_field_acquire(int offset) const;
inline void release_metadata_field_put(int offset, Metadata* value);
Metadata* metadata_field_acquire(int offset) const;
void release_metadata_field_put(int offset, Metadata* value);
inline jbyte byte_field(int offset) const;
inline void byte_field_put(int offset, jbyte contents);
jbyte byte_field(int offset) const;
void byte_field_put(int offset, jbyte contents);
inline jchar char_field(int offset) const;
inline void char_field_put(int offset, jchar contents);
jchar char_field(int offset) const;
void char_field_put(int offset, jchar contents);
inline jboolean bool_field(int offset) const;
inline void bool_field_put(int offset, jboolean contents);
jboolean bool_field(int offset) const;
void bool_field_put(int offset, jboolean contents);
inline jint int_field(int offset) const;
inline void int_field_put(int offset, jint contents);
jint int_field(int offset) const;
void int_field_put(int offset, jint contents);
inline jshort short_field(int offset) const;
inline void short_field_put(int offset, jshort contents);
jshort short_field(int offset) const;
void short_field_put(int offset, jshort contents);
inline jlong long_field(int offset) const;
inline void long_field_put(int offset, jlong contents);
jlong long_field(int offset) const;
void long_field_put(int offset, jlong contents);
inline jfloat float_field(int offset) const;
inline void float_field_put(int offset, jfloat contents);
jfloat float_field(int offset) const;
void float_field_put(int offset, jfloat contents);
inline jdouble double_field(int offset) const;
inline void double_field_put(int offset, jdouble contents);
jdouble double_field(int offset) const;
void double_field_put(int offset, jdouble contents);
inline address address_field(int offset) const;
inline void address_field_put(int offset, address contents);
address address_field(int offset) const;
void address_field_put(int offset, address contents);
inline oop obj_field_acquire(int offset) const;
inline void release_obj_field_put(int offset, oop value);
oop obj_field_acquire(int offset) const;
void release_obj_field_put(int offset, oop value);
inline jbyte byte_field_acquire(int offset) const;
inline void release_byte_field_put(int offset, jbyte contents);
jbyte byte_field_acquire(int offset) const;
void release_byte_field_put(int offset, jbyte contents);
inline jchar char_field_acquire(int offset) const;
inline void release_char_field_put(int offset, jchar contents);
jchar char_field_acquire(int offset) const;
void release_char_field_put(int offset, jchar contents);
inline jboolean bool_field_acquire(int offset) const;
inline void release_bool_field_put(int offset, jboolean contents);
jboolean bool_field_acquire(int offset) const;
void release_bool_field_put(int offset, jboolean contents);
inline jint int_field_acquire(int offset) const;
inline void release_int_field_put(int offset, jint contents);
jint int_field_acquire(int offset) const;
void release_int_field_put(int offset, jint contents);
inline jshort short_field_acquire(int offset) const;
inline void release_short_field_put(int offset, jshort contents);
jshort short_field_acquire(int offset) const;
void release_short_field_put(int offset, jshort contents);
inline jlong long_field_acquire(int offset) const;
inline void release_long_field_put(int offset, jlong contents);
jlong long_field_acquire(int offset) const;
void release_long_field_put(int offset, jlong contents);
inline jfloat float_field_acquire(int offset) const;
inline void release_float_field_put(int offset, jfloat contents);
jfloat float_field_acquire(int offset) const;
void release_float_field_put(int offset, jfloat contents);
inline jdouble double_field_acquire(int offset) const;
inline void release_double_field_put(int offset, jdouble contents);
jdouble double_field_acquire(int offset) const;
void release_double_field_put(int offset, jdouble contents);
inline address address_field_acquire(int offset) const;
inline void release_address_field_put(int offset, address contents);
address address_field_acquire(int offset) const;
void release_address_field_put(int offset, address contents);
// printing functions for VM debugging
void print_on(outputStream* st) const; // First level print
@ -322,10 +304,6 @@ class oopDesc {
// mark-sweep support
void follow_body(int begin, int end);
// Fast access to barrier set
static BarrierSet* bs() { return _bs; }
static void set_bs(BarrierSet* bs) { _bs = bs; }
// Garbage Collection support
#if INCLUDE_ALL_GCS