Mercurial > hg > truffle
comparison src/share/vm/oops/oop.inline.hpp @ 14443:3205e78d8193
8029396: PPC64 (part 212): Several memory ordering fixes in C-code.
Summary: memory ordering fixes in GC and other runtime code showing on PPC64.
Reviewed-by: kvn, coleenp
author | goetz |
---|---|
date | Mon, 02 Dec 2013 10:26:14 +0100 |
parents | 190899198332 |
children | 7f0e0366ec81 78bbf4d43a14 |
comparison
equal
deleted
inserted
replaced
14442:1174c8abbdb6 | 14443:3205e78d8193 |
---|---|
488 | 488 |
489 inline int oopDesc::size() { | 489 inline int oopDesc::size() { |
490 return size_given_klass(klass()); | 490 return size_given_klass(klass()); |
491 } | 491 } |
492 | 492 |
493 inline void update_barrier_set(void* p, oop v) { | 493 inline void update_barrier_set(void* p, oop v, bool release = false) { |
494 assert(oopDesc::bs() != NULL, "Uninitialized bs in oop!"); | 494 assert(oopDesc::bs() != NULL, "Uninitialized bs in oop!"); |
495 oopDesc::bs()->write_ref_field(p, v); | 495 oopDesc::bs()->write_ref_field(p, v, release); |
496 } | 496 } |
497 | 497 |
498 template <class T> inline void update_barrier_set_pre(T* p, oop v) { | 498 template <class T> inline void update_barrier_set_pre(T* p, oop v) { |
499 oopDesc::bs()->write_ref_field_pre(p, v); | 499 oopDesc::bs()->write_ref_field_pre(p, v); |
500 } | 500 } |
503 if (always_do_update_barrier) { | 503 if (always_do_update_barrier) { |
504 oop_store((volatile T*)p, v); | 504 oop_store((volatile T*)p, v); |
505 } else { | 505 } else { |
506 update_barrier_set_pre(p, v); | 506 update_barrier_set_pre(p, v); |
507 oopDesc::encode_store_heap_oop(p, v); | 507 oopDesc::encode_store_heap_oop(p, v); |
508 update_barrier_set((void*)p, v); // cast away type | 508 // always_do_update_barrier == false => |
509 // Either we are at a safepoint (in GC) or CMS is not used. In both | |
510 // cases it's unnecessary to mark the card as dirty with release sematics. | |
511 update_barrier_set((void*)p, v, false /* release */); // cast away type | |
509 } | 512 } |
510 } | 513 } |
511 | 514 |
512 template <class T> inline void oop_store(volatile T* p, oop v) { | 515 template <class T> inline void oop_store(volatile T* p, oop v) { |
513 update_barrier_set_pre((T*)p, v); // cast away volatile | 516 update_barrier_set_pre((T*)p, v); // cast away volatile |
514 // Used by release_obj_field_put, so use release_store_ptr. | 517 // Used by release_obj_field_put, so use release_store_ptr. |
515 oopDesc::release_encode_store_heap_oop(p, v); | 518 oopDesc::release_encode_store_heap_oop(p, v); |
516 update_barrier_set((void*)p, v); // cast away type | 519 // When using CMS we must mark the card corresponding to p as dirty |
520 // with release sematics to prevent that CMS sees the dirty card but | |
521 // not the new value v at p due to reordering of the two | |
522 // stores. Note that CMS has a concurrent precleaning phase, where | |
523 // it reads the card table while the Java threads are running. | |
524 update_barrier_set((void*)p, v, true /* release */); // cast away type | |
517 } | 525 } |
518 | 526 |
519 // Should replace *addr = oop assignments where addr type depends on UseCompressedOops | 527 // Should replace *addr = oop assignments where addr type depends on UseCompressedOops |
520 // (without having to remember the function name this calls). | 528 // (without having to remember the function name this calls). |
521 inline void oop_store_raw(HeapWord* addr, oop value) { | 529 inline void oop_store_raw(HeapWord* addr, oop value) { |