src/hotspot/share/jfr/recorder/checkpoint/types/jfrTypeSet.cpp
changeset 58863 c16ac7a2eba4
parent 58836 31ec3e55fa3d
equal deleted inserted replaced
58861:2c3cc4b01880 58863:c16ac7a2eba4
    71 static traceid create_symbol_id(traceid artifact_id) {
    71 static traceid create_symbol_id(traceid artifact_id) {
    72   return artifact_id != 0 ? CREATE_SYMBOL_ID(artifact_id) : 0;
    72   return artifact_id != 0 ? CREATE_SYMBOL_ID(artifact_id) : 0;
    73 }
    73 }
    74 
    74 
    75 static bool current_epoch() {
    75 static bool current_epoch() {
    76   return _class_unload;
    76   return _class_unload || _flushpoint;
    77 }
    77 }
    78 
    78 
    79 static bool previous_epoch() {
    79 static bool previous_epoch() {
    80   return !current_epoch();
    80   return !current_epoch();
    81 }
    81 }
   244 }
   244 }
   245 
   245 
   246 static void do_klass(Klass* klass) {
   246 static void do_klass(Klass* klass) {
   247   assert(klass != NULL, "invariant");
   247   assert(klass != NULL, "invariant");
   248   assert(_subsystem_callback != NULL, "invariant");
   248   assert(_subsystem_callback != NULL, "invariant");
   249   if (current_epoch()) {
   249   if (_flushpoint) {
   250     if (USED_THIS_EPOCH(klass)) {
   250     if (USED_THIS_EPOCH(klass)) {
   251       _subsystem_callback->do_artifact(klass);
   251       _subsystem_callback->do_artifact(klass);
   252       return;
   252       return;
   253     }
   253     }
   254   } else {
   254   } else {
   909     ++checkpoint_id;
   909     ++checkpoint_id;
   910   }
   910   }
   911   return total_count;
   911   return total_count;
   912 }
   912 }
   913 
   913 
   914 static void setup(JfrCheckpointWriter* writer, JfrCheckpointWriter* leakp_writer, bool class_unload) {
   914 static void setup(JfrCheckpointWriter* writer, JfrCheckpointWriter* leakp_writer, bool class_unload, bool flushpoint) {
   915   _writer = writer;
   915   _writer = writer;
   916   _leakp_writer = leakp_writer;
   916   _leakp_writer = leakp_writer;
   917   _class_unload = class_unload;
   917   _class_unload = class_unload;
       
   918   _flushpoint = flushpoint;
   918   if (_artifacts == NULL) {
   919   if (_artifacts == NULL) {
   919     _artifacts = new JfrArtifactSet(class_unload);
   920     _artifacts = new JfrArtifactSet(class_unload);
   920   } else {
   921   } else {
   921     _artifacts->initialize(class_unload, clear_artifacts);
   922     _artifacts->initialize(class_unload, clear_artifacts);
   922   }
   923   }
   926 }
   927 }
   927 
   928 
   928 /**
   929 /**
   929  * Write all "tagged" (in-use) constant artifacts and their dependencies.
   930  * Write all "tagged" (in-use) constant artifacts and their dependencies.
   930  */
   931  */
   931 size_t JfrTypeSet::serialize(JfrCheckpointWriter* writer, JfrCheckpointWriter* leakp_writer, bool class_unload) {
   932 size_t JfrTypeSet::serialize(JfrCheckpointWriter* writer, JfrCheckpointWriter* leakp_writer, bool class_unload, bool flushpoint) {
   932   assert(writer != NULL, "invariant");
   933   assert(writer != NULL, "invariant");
   933   ResourceMark rm;
   934   ResourceMark rm;
   934   setup(writer, leakp_writer, class_unload);
   935   setup(writer, leakp_writer, class_unload, flushpoint);
   935   // write order is important because an individual write step
   936   // write order is important because an individual write step
   936   // might tag an artifact to be written in a subsequent step
   937   // might tag an artifact to be written in a subsequent step
   937   if (!write_klasses()) {
   938   if (!write_klasses()) {
   938     return 0;
   939     return 0;
   939   }
   940   }