< prev index next >

src/share/vm/gc/shared/gcId.cpp

Print this page

        

@@ -22,21 +22,30 @@
  *
  */
 
 #include "precompiled.hpp"
 #include "gc/shared/gcId.hpp"
-#include "runtime/safepoint.hpp"
 
 uint GCId::_next_id = 0;
+uint GCId::_current_id = UNDEFINED;
 
-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(_current_id != UNDEFINED, "Using undefined GC ID");
+  return _current_id;
 }
-const GCId GCId::undefined() {
-  return GCId(UNDEFINED);
+
+GCIdMark::GCIdMark() {
+  _previous_gc_id = GCId::_current_id;
+  uint gc_id = GCId::create();
+  GCId::set_current(gc_id);
+  DEBUG_ONLY(_gc_id = gc_id;)
 }
-bool GCId::is_undefined() const {
-  return _id == UNDEFINED;
+
+GCIdMark::~GCIdMark() {
+  assert(_gc_id == GCId::_current_id, err_msg("GCIdMarks for %u and %u overlap.", _gc_id, GCId::_current_id));
+  GCId::set_current(_previous_gc_id);
 }
+
< prev index next >