src/hotspot/share/jfr/recorder/checkpoint/types/jfrTypeManager.cpp
branchJEP-349-branch
changeset 57934 9c150f2b1fea
parent 57882 562f598d303c
child 57983 a57907813a83
--- a/src/hotspot/share/jfr/recorder/checkpoint/types/jfrTypeManager.cpp	Thu Aug 29 03:29:45 2019 +0200
+++ b/src/hotspot/share/jfr/recorder/checkpoint/types/jfrTypeManager.cpp	Thu Aug 29 12:53:05 2019 +0200
@@ -134,11 +134,15 @@
   }
 }
 
+static bool new_registration = false;
+
 void JfrTypeManager::write_types(JfrCheckpointWriter& writer) {
+  SerializerRegistrationGuard guard;
   const Iterator iter(types);
   while (iter.has_next()) {
     iter.next()->invoke(writer);
   }
+  new_registration = false;
 }
 
 static void serialize_threads(JfrCheckpointWriter& writer) {
@@ -235,8 +239,9 @@
   assert(!types.in_list(registration), "invariant");
   DEBUG_ONLY(assert_not_registered_twice(id, types);)
   if (Jfr::is_recording()) {
-    JfrCheckpointWriter writer;
+    JfrCheckpointWriter writer(STATICS);
     registration->invoke(writer);
+    new_registration = true;
   }
   types.prepend(registration);
   return true;
@@ -268,3 +273,12 @@
   SerializerRegistrationGuard guard;
   return register_type(id, permit_cache, serializer);
 }
+
+bool JfrTypeManager::is_new_constant_registered() {
+  if (new_registration) {
+    SerializerRegistrationGuard guard;
+    new_registration = false;
+    return true;
+  }
+  return false;
+}