--- a/src/hotspot/share/jfr/recorder/checkpoint/types/jfrTypeSet.cpp Wed Sep 18 11:40:01 2019 +0200
+++ b/src/hotspot/share/jfr/recorder/checkpoint/types/jfrTypeSet.cpp Wed Sep 18 12:17:27 2019 +0200
@@ -204,9 +204,14 @@
return write_klass(writer, klass, true);
}
+static bool is_implied(const Klass* klass) {
+ assert(klass != NULL, "invariant");
+ return klass->is_subclass_of(SystemDictionary::ClassLoader_klass()) || klass == SystemDictionary::Object_klass();
+}
+
static void do_implied(Klass* klass) {
assert(klass != NULL, "invariant");
- if (klass->is_subclass_of(SystemDictionary::ClassLoader_klass()) || klass == SystemDictionary::Object_klass()) {
+ if (is_implied(klass)) {
if (_leakp_writer != NULL) {
SET_LEAKP(klass);
}
@@ -259,6 +264,16 @@
typedef CompositeFunctor<KlassPtr, KlassWriter, KlassArtifactRegistrator> KlassWriterRegistration;
typedef JfrArtifactCallbackHost<KlassPtr, KlassWriterRegistration> KlassCallback;
+template <>
+class LeakPredicate<const Klass*> {
+public:
+ LeakPredicate(bool class_unload) {}
+ bool operator()(const Klass* klass) {
+ assert(klass != NULL, "invariant");
+ return IS_LEAKP(klass) || is_implied(klass);
+ }
+};
+
typedef LeakPredicate<KlassPtr> LeakKlassPredicate;
typedef JfrPredicatedTypeWriterImplHost<KlassPtr, LeakKlassPredicate, write__klass__leakp> LeakKlassWriterImpl;
typedef JfrTypeWriterHost<LeakKlassWriterImpl, TYPE_CLASS> LeakKlassWriter;