src/hotspot/share/gc/g1/g1FullGCMarker.hpp
changeset 47885 5caa1d5f74c1
child 51332 c25572739e7c
equal deleted inserted replaced
47884:3cfab71d6c81 47885:5caa1d5f74c1
       
     1 /*
       
     2  * Copyright (c) 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 #ifndef SHARE_GC_G1_G1FULLGCMARKER_HPP
       
    26 #define SHARE_GC_G1_G1FULLGCMARKER_HPP
       
    27 
       
    28 #include "gc/g1/g1FullGCOopClosures.hpp"
       
    29 #include "gc/shared/preservedMarks.hpp"
       
    30 #include "gc/shared/taskqueue.hpp"
       
    31 #include "memory/iterator.hpp"
       
    32 #include "oops/markOop.hpp"
       
    33 #include "oops/oop.hpp"
       
    34 #include "runtime/timer.hpp"
       
    35 #include "utilities/chunkedList.hpp"
       
    36 #include "utilities/growableArray.hpp"
       
    37 #include "utilities/stack.hpp"
       
    38 
       
    39 typedef OverflowTaskQueue<oop, mtGC>                 OopQueue;
       
    40 typedef OverflowTaskQueue<ObjArrayTask, mtGC>        ObjArrayTaskQueue;
       
    41 
       
    42 typedef GenericTaskQueueSet<OopQueue, mtGC>          OopQueueSet;
       
    43 typedef GenericTaskQueueSet<ObjArrayTaskQueue, mtGC> ObjArrayTaskQueueSet;
       
    44 
       
    45 class G1CMBitMap;
       
    46 
       
    47 class G1FullGCMarker : public CHeapObj<mtGC> {
       
    48 private:
       
    49   uint               _worker_id;
       
    50   // Backing mark bitmap
       
    51   G1CMBitMap*        _bitmap;
       
    52 
       
    53   // Mark stack
       
    54   OopQueue           _oop_stack;
       
    55   ObjArrayTaskQueue  _objarray_stack;
       
    56   PreservedMarks*    _preserved_stack;
       
    57 
       
    58   // Marking closures
       
    59   G1MarkAndPushClosure _mark_closure;
       
    60   G1VerifyOopClosure   _verify_closure;
       
    61   G1FollowStackClosure _stack_closure;
       
    62   CLDToOopClosure      _cld_closure;
       
    63 
       
    64   inline bool is_empty();
       
    65   inline bool pop_object(oop& obj);
       
    66   inline bool pop_objarray(ObjArrayTask& array);
       
    67   inline void push_objarray(oop obj, size_t index);
       
    68   inline bool mark_object(oop obj);
       
    69 
       
    70   // Marking helpers
       
    71   inline void follow_object(oop obj);
       
    72   inline void follow_array(objArrayOop array);
       
    73   inline void follow_array_chunk(objArrayOop array, int index);
       
    74 public:
       
    75   G1FullGCMarker(uint worker_id, PreservedMarks* preserved_stack, G1CMBitMap* bitmap);
       
    76   ~G1FullGCMarker();
       
    77 
       
    78   // Stack getters
       
    79   OopQueue*          oop_stack()       { return &_oop_stack; }
       
    80   ObjArrayTaskQueue* objarray_stack()  { return &_objarray_stack; }
       
    81   PreservedMarks*    preserved_stack() { return _preserved_stack; }
       
    82 
       
    83   // Marking entry points
       
    84   template <class T> inline void mark_and_push(T* p);
       
    85   inline void follow_klass(Klass* k);
       
    86   inline void follow_cld(ClassLoaderData* cld);
       
    87 
       
    88   inline void drain_stack();
       
    89   void complete_marking(OopQueueSet* oop_stacks,
       
    90                         ObjArrayTaskQueueSet* array_stacks,
       
    91                         ParallelTaskTerminator* terminator);
       
    92 
       
    93   // Closure getters
       
    94   CLDToOopClosure*      cld_closure()   { return &_cld_closure; }
       
    95   G1MarkAndPushClosure* mark_closure()  { return &_mark_closure; }
       
    96   G1FollowStackClosure* stack_closure() { return &_stack_closure; }
       
    97 };
       
    98 
       
    99 #endif // SHARE_GC_G1_G1FULLGCMARKER_HPP