mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-18 01:54:47 +02:00
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:
parent
1b2bf0be10
commit
46c4ef6572
16 changed files with 99 additions and 34 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue