src/hotspot/share/jfr/recorder/checkpoint/types/jfrTypeSetWriter.hpp
branchJEP-349-branch
changeset 57360 5d043a159d5c
parent 53897 0abec72a3ac2
equal deleted inserted replaced
57359:4cab5edc2950 57360:5d043a159d5c
    39   int _count;
    39   int _count;
    40   bool _skip_header;
    40   bool _skip_header;
    41  public:
    41  public:
    42   JfrArtifactWriterHost(JfrCheckpointWriter* writer,
    42   JfrArtifactWriterHost(JfrCheckpointWriter* writer,
    43                         JfrArtifactSet* artifacts,
    43                         JfrArtifactSet* artifacts,
    44                         bool class_unload,
    44                         bool current_epoch,
    45                         bool skip_header = false) : _impl(writer, artifacts, class_unload),
    45                         bool skip_header = false) : _impl(writer, artifacts, current_epoch),
    46                                                     _writer(writer),
    46                                                     _writer(writer),
    47                                                     _ctx(writer->context()),
    47                                                     _ctx(writer->context()),
    48                                                     _count(0),
    48                                                     _count(0),
    49                                                     _skip_header(skip_header) {
    49                                                     _skip_header(skip_header) {
    50     assert(_writer != NULL, "invariant");
    50     assert(_writer != NULL, "invariant");
    80 template <typename T, artifact_write_operation op>
    80 template <typename T, artifact_write_operation op>
    81 class JfrArtifactWriterImplHost {
    81 class JfrArtifactWriterImplHost {
    82  private:
    82  private:
    83   JfrCheckpointWriter* _writer;
    83   JfrCheckpointWriter* _writer;
    84   JfrArtifactSet* _artifacts;
    84   JfrArtifactSet* _artifacts;
    85   bool _class_unload;
    85   bool _current_epoch;
    86  public:
    86  public:
    87   typedef T Type;
    87   typedef T Type;
    88   JfrArtifactWriterImplHost(JfrCheckpointWriter* writer, JfrArtifactSet* artifacts, bool class_unload) :
    88   JfrArtifactWriterImplHost(JfrCheckpointWriter* writer, JfrArtifactSet* artifacts, bool current_epoch) :
    89     _writer(writer), _artifacts(artifacts), _class_unload(class_unload) {}
    89     _writer(writer), _artifacts(artifacts), _current_epoch(current_epoch) {}
    90   int operator()(T const& value) {
    90   int operator()(T const& value) {
    91     return op(this->_writer, this->_artifacts, value);
    91     return op(this->_writer, this->_artifacts, value);
    92   }
    92   }
    93 };
    93 };
    94 
    94 
    96 class JfrPredicatedArtifactWriterImplHost : public JfrArtifactWriterImplHost<T, op> {
    96 class JfrPredicatedArtifactWriterImplHost : public JfrArtifactWriterImplHost<T, op> {
    97  private:
    97  private:
    98   Predicate _predicate;
    98   Predicate _predicate;
    99   typedef JfrArtifactWriterImplHost<T, op> Parent;
    99   typedef JfrArtifactWriterImplHost<T, op> Parent;
   100  public:
   100  public:
   101   JfrPredicatedArtifactWriterImplHost(JfrCheckpointWriter* writer, JfrArtifactSet* artifacts, bool class_unload) :
   101   JfrPredicatedArtifactWriterImplHost(JfrCheckpointWriter* writer, JfrArtifactSet* artifacts, bool current_epoch) :
   102     Parent(writer, artifacts, class_unload), _predicate(class_unload) {}
   102     Parent(writer, artifacts, current_epoch), _predicate(current_epoch) {}
   103   int operator()(T const& value) {
   103   int operator()(T const& value) {
   104     return _predicate(value) ? Parent::operator()(value) : 0;
   104     return _predicate(value) ? Parent::operator()(value) : 0;
   105   }
   105   }
   106 };
   106 };
   107 
   107