2014-06-19 13:31:14 +02:00
|
|
|
/*
|
2015-05-13 15:16:06 +02:00
|
|
|
* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
|
2014-06-19 13:31:14 +02:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
|
|
*
|
|
|
|
* This code is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License version 2 only, as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
* version 2 for more details (a copy is included in the LICENSE file that
|
|
|
|
* accompanied this code).
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License version
|
|
|
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
|
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*
|
|
|
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
|
|
* or visit www.oracle.com if you need additional information or have any
|
|
|
|
* questions.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2015-05-13 15:16:06 +02:00
|
|
|
#ifndef SHARE_VM_GC_SHARED_GCID_HPP
|
|
|
|
#define SHARE_VM_GC_SHARED_GCID_HPP
|
2014-06-19 13:31:14 +02:00
|
|
|
|
|
|
|
#include "memory/allocation.hpp"
|
|
|
|
|
2015-09-30 09:07:21 +02:00
|
|
|
class GCId : public AllStatic {
|
|
|
|
friend class GCIdMark;
|
2015-10-08 12:44:12 +02:00
|
|
|
friend class GCIdMarkAndRestore;
|
2014-06-19 13:31:14 +02:00
|
|
|
static uint _next_id;
|
|
|
|
static const uint UNDEFINED = (uint)-1;
|
2015-09-30 09:07:21 +02:00
|
|
|
static const uint create();
|
2014-06-19 13:31:14 +02:00
|
|
|
|
|
|
|
public:
|
2015-09-30 09:07:21 +02:00
|
|
|
// Returns the currently active GC id. Asserts that there is an active GC id.
|
|
|
|
static const uint current();
|
|
|
|
// Same as current() but can return undefined() if no GC id is currently active
|
|
|
|
static const uint current_raw();
|
|
|
|
static const uint undefined() { return UNDEFINED; }
|
|
|
|
};
|
2014-06-19 13:31:14 +02:00
|
|
|
|
2015-09-30 09:07:21 +02:00
|
|
|
class GCIdMark : public StackObj {
|
|
|
|
uint _gc_id;
|
|
|
|
public:
|
|
|
|
GCIdMark();
|
|
|
|
GCIdMark(uint gc_id);
|
|
|
|
~GCIdMark();
|
2014-06-19 13:31:14 +02:00
|
|
|
};
|
|
|
|
|
2015-10-08 12:44:12 +02:00
|
|
|
class GCIdMarkAndRestore : public StackObj {
|
|
|
|
uint _gc_id;
|
|
|
|
uint _previous_gc_id;
|
|
|
|
public:
|
|
|
|
GCIdMarkAndRestore();
|
2015-10-09 20:31:56 +02:00
|
|
|
GCIdMarkAndRestore(uint gc_id);
|
2015-10-08 12:44:12 +02:00
|
|
|
~GCIdMarkAndRestore();
|
|
|
|
};
|
|
|
|
|
2015-05-13 15:16:06 +02:00
|
|
|
#endif // SHARE_VM_GC_SHARED_GCID_HPP
|