< prev index next >

src/hotspot/share/gc/g1/g1BarrierSet.cpp

Print this page
rev 53140 : [mq]: new_allocator
   1 /*
   2  * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  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  *


  38 #include "runtime/interfaceSupport.inline.hpp"
  39 #include "runtime/mutexLocker.hpp"
  40 #include "runtime/thread.inline.hpp"
  41 #include "utilities/macros.hpp"
  42 #ifdef COMPILER1
  43 #include "gc/g1/c1/g1BarrierSetC1.hpp"
  44 #endif
  45 #ifdef COMPILER2
  46 #include "gc/g1/c2/g1BarrierSetC2.hpp"
  47 #endif
  48 
  49 class G1BarrierSetC1;
  50 class G1BarrierSetC2;
  51 
  52 G1BarrierSet::G1BarrierSet(G1CardTable* card_table) :
  53   CardTableBarrierSet(make_barrier_set_assembler<G1BarrierSetAssembler>(),
  54                       make_barrier_set_c1<G1BarrierSetC1>(),
  55                       make_barrier_set_c2<G1BarrierSetC2>(),
  56                       card_table,
  57                       BarrierSet::FakeRtti(BarrierSet::G1BarrierSet)),
  58   _satb_mark_queue_buffer_allocator(G1SATBBufferSize, SATB_Q_FL_lock),
  59   _dirty_card_queue_buffer_allocator(G1UpdateBufferSize, DirtyCardQ_FL_lock),
  60   _satb_mark_queue_set(),
  61   _dirty_card_queue_set()
  62 {}
  63 
  64 void G1BarrierSet::enqueue(oop pre_val) {
  65   // Nulls should have been already filtered.
  66   assert(oopDesc::is_oop(pre_val, true), "Error");
  67 
  68   G1SATBMarkQueueSet& queue_set = satb_mark_queue_set();
  69   if (!queue_set.is_active()) {
  70     return;
  71   }
  72   Thread* thr = Thread::current();
  73   if (thr->is_Java_thread()) {
  74     G1ThreadLocalData::satb_mark_queue(thr).enqueue(pre_val);
  75   } else {
  76     MutexLockerEx x(Shared_SATB_Q_lock, Mutex::_no_safepoint_check_flag);
  77     queue_set.shared_satb_queue()->enqueue(pre_val);
  78   }
  79 }


   1 /*
   2  * Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  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  *


  38 #include "runtime/interfaceSupport.inline.hpp"
  39 #include "runtime/mutexLocker.hpp"
  40 #include "runtime/thread.inline.hpp"
  41 #include "utilities/macros.hpp"
  42 #ifdef COMPILER1
  43 #include "gc/g1/c1/g1BarrierSetC1.hpp"
  44 #endif
  45 #ifdef COMPILER2
  46 #include "gc/g1/c2/g1BarrierSetC2.hpp"
  47 #endif
  48 
  49 class G1BarrierSetC1;
  50 class G1BarrierSetC2;
  51 
  52 G1BarrierSet::G1BarrierSet(G1CardTable* card_table) :
  53   CardTableBarrierSet(make_barrier_set_assembler<G1BarrierSetAssembler>(),
  54                       make_barrier_set_c1<G1BarrierSetC1>(),
  55                       make_barrier_set_c2<G1BarrierSetC2>(),
  56                       card_table,
  57                       BarrierSet::FakeRtti(BarrierSet::G1BarrierSet)),
  58   _satb_mark_queue_buffer_allocator("SATB Buffer Allocator", G1SATBBufferSize),
  59   _dirty_card_queue_buffer_allocator("DC Buffer Allocator", G1UpdateBufferSize),
  60   _satb_mark_queue_set(),
  61   _dirty_card_queue_set()
  62 {}
  63 
  64 void G1BarrierSet::enqueue(oop pre_val) {
  65   // Nulls should have been already filtered.
  66   assert(oopDesc::is_oop(pre_val, true), "Error");
  67 
  68   G1SATBMarkQueueSet& queue_set = satb_mark_queue_set();
  69   if (!queue_set.is_active()) {
  70     return;
  71   }
  72   Thread* thr = Thread::current();
  73   if (thr->is_Java_thread()) {
  74     G1ThreadLocalData::satb_mark_queue(thr).enqueue(pre_val);
  75   } else {
  76     MutexLockerEx x(Shared_SATB_Q_lock, Mutex::_no_safepoint_check_flag);
  77     queue_set.shared_satb_queue()->enqueue(pre_val);
  78   }
  79 }


< prev index next >