8029396: PPC64 (part 212): Several memory ordering fixes in C-code

Memory ordering fixes in GC and other runtime code showing on PPC64.

Reviewed-by: kvn, coleenp
This commit is contained in:
Goetz Lindenmaier 2013-12-02 10:26:14 +01:00
parent 1b2bf0be10
commit 46c4ef6572
16 changed files with 99 additions and 34 deletions

View file

@ -490,9 +490,9 @@ inline int oopDesc::size() {
return size_given_klass(klass());
}
inline void update_barrier_set(void* p, oop v) {
inline void update_barrier_set(void* p, oop v, bool release = false) {
assert(oopDesc::bs() != NULL, "Uninitialized bs in oop!");
oopDesc::bs()->write_ref_field(p, v);
oopDesc::bs()->write_ref_field(p, v, release);
}
template <class T> inline void update_barrier_set_pre(T* p, oop v) {
@ -505,7 +505,10 @@ template <class T> inline void oop_store(T* p, oop v) {
} else {
update_barrier_set_pre(p, v);
oopDesc::encode_store_heap_oop(p, v);
update_barrier_set((void*)p, v); // cast away type
// always_do_update_barrier == false =>
// Either we are at a safepoint (in GC) or CMS is not used. In both
// cases it's unnecessary to mark the card as dirty with release sematics.
update_barrier_set((void*)p, v, false /* release */); // cast away type
}
}
@ -513,7 +516,12 @@ template <class T> inline void oop_store(volatile T* p, oop v) {
update_barrier_set_pre((T*)p, v); // cast away volatile
// Used by release_obj_field_put, so use release_store_ptr.
oopDesc::release_encode_store_heap_oop(p, v);
update_barrier_set((void*)p, v); // cast away type
// When using CMS we must mark the card corresponding to p as dirty
// with release sematics to prevent that CMS sees the dirty card but
// not the new value v at p due to reordering of the two
// stores. Note that CMS has a concurrent precleaning phase, where
// it reads the card table while the Java threads are running.
update_barrier_set((void*)p, v, true /* release */); // cast away type
}
// Should replace *addr = oop assignments where addr type depends on UseCompressedOops