< prev index next >

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

Print this page


   1 /*
   2  * Copyright (c) 2001, 2017, 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  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "jvm.h"
  27 #include "gc/g1/g1CollectedHeap.inline.hpp"
  28 #include "gc/g1/satbMarkQueue.hpp"
  29 #include "gc/shared/collectedHeap.hpp"
  30 #include "memory/allocation.inline.hpp"
  31 #include "oops/oop.inline.hpp"
  32 #include "runtime/mutexLocker.hpp"
  33 #include "runtime/safepoint.hpp"
  34 #include "runtime/thread.hpp"
  35 #include "runtime/threadSMR.hpp"
  36 #include "runtime/vmThread.hpp"
  37 
  38 SATBMarkQueue::SATBMarkQueue(SATBMarkQueueSet* qset, bool permanent) :
  39   // SATB queues are only active during marking cycles. We create
  40   // them with their active field set to false. If a thread is
  41   // created during a cycle and its SATB queue needs to be activated
  42   // before the thread starts running, we'll need to set its active
  43   // field to true. This is done in JavaThread::initialize_queues().

  44   PtrQueue(qset, permanent, false /* active */)
  45 { }
  46 
  47 void SATBMarkQueue::flush() {
  48   // Filter now to possibly save work later.  If filtering empties the
  49   // buffer then flush_impl can deallocate the buffer.
  50   filter();
  51   flush_impl();
  52 }
  53 
  54 // Return true if a SATB buffer entry refers to an object that
  55 // requires marking.
  56 //
  57 // The entry must point into the G1 heap.  In particular, it must not
  58 // be a NULL pointer.  NULL pointers are pre-filtered and never
  59 // inserted into a SATB buffer.
  60 //
  61 // An entry that is below the NTAMS pointer for the containing heap
  62 // region requires marking. Such an entry must point to a valid object.
  63 //


   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  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "jvm.h"
  27 #include "gc/g1/g1CollectedHeap.inline.hpp"
  28 #include "gc/g1/satbMarkQueue.hpp"
  29 #include "gc/shared/collectedHeap.hpp"
  30 #include "memory/allocation.inline.hpp"
  31 #include "oops/oop.inline.hpp"
  32 #include "runtime/mutexLocker.hpp"
  33 #include "runtime/safepoint.hpp"
  34 #include "runtime/thread.hpp"
  35 #include "runtime/threadSMR.hpp"
  36 #include "runtime/vmThread.hpp"
  37 
  38 SATBMarkQueue::SATBMarkQueue(SATBMarkQueueSet* qset, bool permanent) :
  39   // SATB queues are only active during marking cycles. We create
  40   // them with their active field set to false. If a thread is
  41   // created during a cycle and its SATB queue needs to be activated
  42   // before the thread starts running, we'll need to set its active
  43   // field to true. This is done in G1SATBCardTableLoggingModRefBS::
  44   // on_thread_create().
  45   PtrQueue(qset, permanent, false /* active */)
  46 { }
  47 
  48 void SATBMarkQueue::flush() {
  49   // Filter now to possibly save work later.  If filtering empties the
  50   // buffer then flush_impl can deallocate the buffer.
  51   filter();
  52   flush_impl();
  53 }
  54 
  55 // Return true if a SATB buffer entry refers to an object that
  56 // requires marking.
  57 //
  58 // The entry must point into the G1 heap.  In particular, it must not
  59 // be a NULL pointer.  NULL pointers are pre-filtered and never
  60 // inserted into a SATB buffer.
  61 //
  62 // An entry that is below the NTAMS pointer for the containing heap
  63 // region requires marking. Such an entry must point to a valid object.
  64 //


< prev index next >