< prev index next >

src/hotspot/share/gc/g1/g1BarrierSet.inline.hpp

Print this page




  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef SHARE_VM_GC_G1_G1BARRIERSET_INLINE_HPP
  26 #define SHARE_VM_GC_G1_G1BARRIERSET_INLINE_HPP
  27 
  28 #include "gc/g1/g1BarrierSet.hpp"
  29 #include "gc/g1/g1CardTable.hpp"
  30 #include "gc/shared/accessBarrierSupport.inline.hpp"
  31 #include "oops/oop.inline.hpp"


  32 
  33 template <DecoratorSet decorators, typename T>
  34 inline void G1BarrierSet::write_ref_field_pre(T* field) {
  35   if (HasDecorator<decorators, AS_DEST_NOT_INITIALIZED>::value ||
  36       HasDecorator<decorators, AS_NO_KEEPALIVE>::value) {
  37     return;
  38   }
  39 
  40   T heap_oop = RawAccess<MO_VOLATILE>::oop_load(field);
  41   if (!oopDesc::is_null(heap_oop)) {
  42     enqueue(oopDesc::decode_heap_oop_not_null(heap_oop));
  43   }
  44 }
  45 
  46 template <DecoratorSet decorators, typename T>
  47 inline void G1BarrierSet::write_ref_field_post(T* field, oop new_val) {
  48   volatile jbyte* byte = _card_table->byte_for(field);
  49   if (*byte != G1CardTable::g1_young_card_val()) {
  50     // Take a slow path for cards in old
  51     write_ref_field_post_slow(byte);
  52   }
  53 }
  54 
  55 inline void G1BarrierSet::enqueue_if_weak_or_archive(DecoratorSet decorators, oop value) {
  56   assert((decorators & ON_UNKNOWN_OOP_REF) == 0, "Reference strength must be known");
  57   // Archive roots need to be enqueued since they add subgraphs to the
  58   // Java heap that were not there at the snapshot when marking started.
  59   // Weak and phantom references also need enqueueing for similar reasons.
  60   const bool in_archive_root   = (decorators & IN_ARCHIVE_ROOT) != 0;
  61   const bool on_strong_oop_ref = (decorators & ON_STRONG_OOP_REF) != 0;
  62   const bool peek              = (decorators & AS_NO_KEEPALIVE) != 0;




  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef SHARE_VM_GC_G1_G1BARRIERSET_INLINE_HPP
  26 #define SHARE_VM_GC_G1_G1BARRIERSET_INLINE_HPP
  27 
  28 #include "gc/g1/g1BarrierSet.hpp"
  29 #include "gc/g1/g1CardTable.hpp"
  30 #include "gc/shared/accessBarrierSupport.inline.hpp"
  31 #include "oops/access.inline.hpp"
  32 #include "oops/compressedOops.inline.hpp"
  33 #include "oops/oop.hpp"
  34 
  35 template <DecoratorSet decorators, typename T>
  36 inline void G1BarrierSet::write_ref_field_pre(T* field) {
  37   if (HasDecorator<decorators, AS_DEST_NOT_INITIALIZED>::value ||
  38       HasDecorator<decorators, AS_NO_KEEPALIVE>::value) {
  39     return;
  40   }
  41 
  42   T heap_oop = RawAccess<MO_VOLATILE>::oop_load(field);
  43   if (!CompressedOops::is_null(heap_oop)) {
  44     enqueue(CompressedOops::decode_not_null(heap_oop));
  45   }
  46 }
  47 
  48 template <DecoratorSet decorators, typename T>
  49 inline void G1BarrierSet::write_ref_field_post(T* field, oop new_val) {
  50   volatile jbyte* byte = _card_table->byte_for(field);
  51   if (*byte != G1CardTable::g1_young_card_val()) {
  52     // Take a slow path for cards in old
  53     write_ref_field_post_slow(byte);
  54   }
  55 }
  56 
  57 inline void G1BarrierSet::enqueue_if_weak_or_archive(DecoratorSet decorators, oop value) {
  58   assert((decorators & ON_UNKNOWN_OOP_REF) == 0, "Reference strength must be known");
  59   // Archive roots need to be enqueued since they add subgraphs to the
  60   // Java heap that were not there at the snapshot when marking started.
  61   // Weak and phantom references also need enqueueing for similar reasons.
  62   const bool in_archive_root   = (decorators & IN_ARCHIVE_ROOT) != 0;
  63   const bool on_strong_oop_ref = (decorators & ON_STRONG_OOP_REF) != 0;
  64   const bool peek              = (decorators & AS_NO_KEEPALIVE) != 0;


< prev index next >