diff src/hotspot/share/gc/shared/gcId.cpp @ 49210:e4a0cc16b050

8198369: Clean up GCId and GCIdMark Reviewed-by: stefank, eosterlund
author pliden
date Wed, 21 Feb 2018 07:50:33 +0100
parents 1817d118ff66
children
line wrap: on
line diff
--- a/src/hotspot/share/gc/shared/gcId.cpp	Wed Feb 21 07:46:40 2018 +0100
+++ b/src/hotspot/share/gc/shared/gcId.cpp	Wed Feb 21 07:50:33 2018 +0100
@@ -35,21 +35,21 @@
   return (NamedThread*)Thread::current();
 }
 
-const uint GCId::create() {
+uint GCId::create() {
   return _next_id++;
 }
 
-const uint GCId::peek() {
+uint GCId::peek() {
   return _next_id;
 }
 
-const uint GCId::current() {
+uint GCId::current() {
   const uint gc_id = currentNamedthread()->gc_id();
   assert(gc_id != undefined(), "Using undefined GC id.");
   return gc_id;
 }
 
-const uint GCId::current_or_undefined() {
+uint GCId::current_or_undefined() {
   return Thread::current()->is_Named_thread() ? currentNamedthread()->gc_id() : undefined();
 }
 
@@ -66,28 +66,14 @@
   return 0;
 }
 
-GCIdMark::GCIdMark() : _gc_id(GCId::create()) {
-  currentNamedthread()->set_gc_id(_gc_id);
+GCIdMark::GCIdMark() : _previous_gc_id(currentNamedthread()->gc_id()) {
+  currentNamedthread()->set_gc_id(GCId::create());
 }
 
-GCIdMark::GCIdMark(uint gc_id) : _gc_id(gc_id) {
-  currentNamedthread()->set_gc_id(_gc_id);
+GCIdMark::GCIdMark(uint gc_id) : _previous_gc_id(currentNamedthread()->gc_id()) {
+  currentNamedthread()->set_gc_id(gc_id);
 }
 
 GCIdMark::~GCIdMark() {
-  currentNamedthread()->set_gc_id(GCId::undefined());
-}
-
-GCIdMarkAndRestore::GCIdMarkAndRestore() : _gc_id(GCId::create()) {
-  _previous_gc_id = currentNamedthread()->gc_id();
-  currentNamedthread()->set_gc_id(_gc_id);
-}
-
-GCIdMarkAndRestore::GCIdMarkAndRestore(uint gc_id) : _gc_id(gc_id) {
-  _previous_gc_id = currentNamedthread()->gc_id();
-  currentNamedthread()->set_gc_id(_gc_id);
-}
-
-GCIdMarkAndRestore::~GCIdMarkAndRestore() {
   currentNamedthread()->set_gc_id(_previous_gc_id);
 }