aoqi@0: /* aoqi@0: * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. aoqi@0: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. aoqi@0: * aoqi@0: * This code is free software; you can redistribute it and/or modify it aoqi@0: * under the terms of the GNU General Public License version 2 only, as aoqi@0: * published by the Free Software Foundation. aoqi@0: * aoqi@0: * This code is distributed in the hope that it will be useful, but WITHOUT aoqi@0: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or aoqi@0: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License aoqi@0: * version 2 for more details (a copy is included in the LICENSE file that aoqi@0: * accompanied this code). aoqi@0: * aoqi@0: * You should have received a copy of the GNU General Public License version aoqi@0: * 2 along with this work; if not, write to the Free Software Foundation, aoqi@0: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. aoqi@0: * aoqi@0: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA aoqi@0: * or visit www.oracle.com if you need additional information or have any aoqi@0: * questions. aoqi@0: * aoqi@0: */ aoqi@0: aoqi@0: #include "precompiled.hpp" aoqi@0: #include "gc_implementation/g1/g1CollectedHeap.inline.hpp" aoqi@0: #include "gc_implementation/g1/g1OopClosures.inline.hpp" tschatzl@6939: #include "gc_implementation/g1/g1ParScanThreadState.hpp" aoqi@0: aoqi@0: G1ParCopyHelper::G1ParCopyHelper(G1CollectedHeap* g1, G1ParScanThreadState* par_scan_state) : aoqi@0: G1ParClosureSuper(g1, par_scan_state), _scanned_klass(NULL), aoqi@0: _cm(_g1->concurrent_mark()) {} tschatzl@6937: tschatzl@6939: G1ParClosureSuper::G1ParClosureSuper(G1CollectedHeap* g1) : tschatzl@6939: _g1(g1), _par_scan_state(NULL), _worker_id(UINT_MAX) { } tschatzl@6939: tschatzl@6937: G1ParClosureSuper::G1ParClosureSuper(G1CollectedHeap* g1, G1ParScanThreadState* par_scan_state) : tschatzl@6939: _g1(g1), _par_scan_state(NULL), tschatzl@6939: _worker_id(UINT_MAX) { tschatzl@6939: set_par_scan_thread_state(par_scan_state); tschatzl@6939: } tschatzl@6939: tschatzl@6939: void G1ParClosureSuper::set_par_scan_thread_state(G1ParScanThreadState* par_scan_state) { tschatzl@6939: assert(_par_scan_state == NULL, "_par_scan_state must only be set once"); tschatzl@6939: assert(par_scan_state != NULL, "Must set par_scan_state to non-NULL."); tschatzl@6939: tschatzl@6939: _par_scan_state = par_scan_state; tschatzl@6939: _worker_id = par_scan_state->queue_num(); tschatzl@6939: tschatzl@6939: assert(_worker_id < MAX2((uint)ParallelGCThreads, 1u), tschatzl@6939: err_msg("The given worker id %u must be less than the number of threads %u", _worker_id, MAX2((uint)ParallelGCThreads, 1u))); tschatzl@6939: }