src/hotspot/share/jfr/recorder/checkpoint/types/jfrTypeManager.cpp
branchJEP-349-branch
changeset 57934 9c150f2b1fea
parent 57882 562f598d303c
child 57983 a57907813a83
equal deleted inserted replaced
57922:6598f2825b1f 57934:9c150f2b1fea
   132     assert(registration != NULL, "invariant");
   132     assert(registration != NULL, "invariant");
   133     delete registration;
   133     delete registration;
   134   }
   134   }
   135 }
   135 }
   136 
   136 
       
   137 static bool new_registration = false;
       
   138 
   137 void JfrTypeManager::write_types(JfrCheckpointWriter& writer) {
   139 void JfrTypeManager::write_types(JfrCheckpointWriter& writer) {
       
   140   SerializerRegistrationGuard guard;
   138   const Iterator iter(types);
   141   const Iterator iter(types);
   139   while (iter.has_next()) {
   142   while (iter.has_next()) {
   140     iter.next()->invoke(writer);
   143     iter.next()->invoke(writer);
   141   }
   144   }
       
   145   new_registration = false;
   142 }
   146 }
   143 
   147 
   144 static void serialize_threads(JfrCheckpointWriter& writer) {
   148 static void serialize_threads(JfrCheckpointWriter& writer) {
   145   JfrThreadConstantSet thread_set;
   149   JfrThreadConstantSet thread_set;
   146   writer.write_type(TYPE_THREAD);
   150   writer.write_type(TYPE_THREAD);
   233   }
   237   }
   234 
   238 
   235   assert(!types.in_list(registration), "invariant");
   239   assert(!types.in_list(registration), "invariant");
   236   DEBUG_ONLY(assert_not_registered_twice(id, types);)
   240   DEBUG_ONLY(assert_not_registered_twice(id, types);)
   237   if (Jfr::is_recording()) {
   241   if (Jfr::is_recording()) {
   238     JfrCheckpointWriter writer;
   242     JfrCheckpointWriter writer(STATICS);
   239     registration->invoke(writer);
   243     registration->invoke(writer);
       
   244     new_registration = true;
   240   }
   245   }
   241   types.prepend(registration);
   246   types.prepend(registration);
   242   return true;
   247   return true;
   243 }
   248 }
   244 
   249 
   266 // implementation for the static registration function exposed in the JfrSerializer api
   271 // implementation for the static registration function exposed in the JfrSerializer api
   267 bool JfrSerializer::register_serializer(JfrTypeId id, bool permit_cache, JfrSerializer* serializer) {
   272 bool JfrSerializer::register_serializer(JfrTypeId id, bool permit_cache, JfrSerializer* serializer) {
   268   SerializerRegistrationGuard guard;
   273   SerializerRegistrationGuard guard;
   269   return register_type(id, permit_cache, serializer);
   274   return register_type(id, permit_cache, serializer);
   270 }
   275 }
       
   276 
       
   277 bool JfrTypeManager::is_new_constant_registered() {
       
   278   if (new_registration) {
       
   279     SerializerRegistrationGuard guard;
       
   280     new_registration = false;
       
   281     return true;
       
   282   }
       
   283   return false;
       
   284 }