< prev index next >
src/share/vm/gc/shared/gcId.cpp
Print this page
@@ -23,20 +23,34 @@
*/
#include "precompiled.hpp"
#include "gc/shared/gcId.hpp"
#include "runtime/safepoint.hpp"
+#include "runtime/thread.inline.hpp"
uint GCId::_next_id = 0;
-const GCId GCId::create() {
- return GCId(_next_id++);
+const uint GCId::create() {
+ return _next_id++;
}
-const GCId GCId::peek() {
- return GCId(_next_id);
+
+const uint GCId::current() {
+ assert(Thread::current()->gc_id() != undefined(), "Using undefined GC id.");
+ return current_raw();
+}
+
+const uint GCId::current_raw() {
+ return Thread::current()->gc_id();
+}
+
+GCIdMark::GCIdMark() : _gc_id(GCId::create()) {
+ Thread::current()->set_gc_id(_gc_id);
}
-const GCId GCId::undefined() {
- return GCId(UNDEFINED);
+
+GCIdMark::GCIdMark(uint gc_id) : _gc_id(gc_id) {
+ Thread::current()->set_gc_id(_gc_id);
}
-bool GCId::is_undefined() const {
- return _id == UNDEFINED;
+
+GCIdMark::~GCIdMark() {
+ Thread::current()->set_gc_id(GCId::undefined());
}
+
< prev index next >