Skip to content

Commit bcbdf90

Browse files
author
Markus Grönlund
committed
8373062: JFR build failure with CDS disabled
Reviewed-by: egahlin
1 parent b5970c9 commit bcbdf90

File tree

5 files changed

+18
-13
lines changed

5 files changed

+18
-13
lines changed

src/hotspot/share/classfile/systemDictionary.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1146,17 +1146,6 @@ void SystemDictionary::load_shared_class_misc(InstanceKlass* ik, ClassLoaderData
11461146
}
11471147
}
11481148

1149-
#if INCLUDE_JFR
1150-
void SystemDictionary::post_class_load_event(EventClassLoad* event, const InstanceKlass* k, const ClassLoaderData* init_cld) {
1151-
assert(event != nullptr, "invariant");
1152-
assert(k != nullptr, "invariant");
1153-
event->set_loadedClass(k);
1154-
event->set_definingClassLoader(k->class_loader_data());
1155-
event->set_initiatingClassLoader(init_cld);
1156-
event->commit();
1157-
}
1158-
#endif // INCLUDE_JFR
1159-
11601149
// This is much more lightweight than SystemDictionary::resolve_or_null
11611150
// - There's only a single Java thread at this point. No need for placeholder.
11621151
// - All supertypes of ik have been loaded
@@ -1217,6 +1206,17 @@ void SystemDictionary::preload_class(Handle class_loader, InstanceKlass* ik, TRA
12171206

12181207
#endif // INCLUDE_CDS
12191208

1209+
#if INCLUDE_JFR
1210+
void SystemDictionary::post_class_load_event(EventClassLoad* event, const InstanceKlass* k, const ClassLoaderData* init_cld) {
1211+
assert(event != nullptr, "invariant");
1212+
assert(k != nullptr, "invariant");
1213+
event->set_loadedClass(k);
1214+
event->set_definingClassLoader(k->class_loader_data());
1215+
event->set_initiatingClassLoader(init_cld);
1216+
event->commit();
1217+
}
1218+
#endif // INCLUDE_JFR
1219+
12201220
InstanceKlass* SystemDictionary::load_instance_class_impl(Symbol* class_name, Handle class_loader, TRAPS) {
12211221

12221222
if (class_loader.is_null()) {

src/hotspot/share/jfr/jfr.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,10 +173,12 @@ bool Jfr::on_start_flight_recording_option(const JavaVMOption** option, char* de
173173
return JfrOptionSet::parse_start_flight_recording_option(option, delimiter);
174174
}
175175

176+
#if INCLUDE_CDS
176177
void Jfr::on_restoration(const Klass* k, JavaThread* jt) {
177178
assert(k != nullptr, "invariant");
178179
JfrTraceId::restore(k);
179180
if (k->is_instance_klass()) {
180181
JfrClassDefineEvent::on_restoration(InstanceKlass::cast(k), jt);
181182
}
182183
}
184+
#endif

src/hotspot/share/jfr/jfr.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ class Jfr : AllStatic {
7979
static void initialize_main_thread(JavaThread* jt);
8080
static bool has_sample_request(JavaThread* jt);
8181
static void check_and_process_sample_request(JavaThread* jt);
82-
static void on_restoration(const Klass* k, JavaThread* jt);
82+
CDS_ONLY(static void on_restoration(const Klass* k, JavaThread* jt);)
8383
};
8484

8585
#endif // SHARE_JFR_JFR_HPP

src/hotspot/share/jfr/support/jfrClassDefineEvent.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ void JfrClassDefineEvent::on_creation(const InstanceKlass* ik, const ClassFilePa
171171
}
172172
}
173173

174+
#if INCLUDE_CDS
174175
void JfrClassDefineEvent::on_restoration(const InstanceKlass* ik, JavaThread* jt) {
175176
assert(ik != nullptr, "invariant");
176177
assert(ik->trace_id() != 0, "invariant");
@@ -186,3 +187,4 @@ void JfrClassDefineEvent::on_restoration(const InstanceKlass* ik, JavaThread* jt
186187
send_event(ik, cl->is_modules_image() ? module_path(ik, jt) : get_source(cl, jt));
187188
}
188189
}
190+
#endif

src/hotspot/share/jfr/support/jfrClassDefineEvent.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#define SHARE_JFR_SUPPORT_JFRCLASSDEFINEEVENT_HPP
2727

2828
#include "memory/allStatic.hpp"
29+
#include "utilities/macros.hpp"
2930

3031
class ClassFileParser;
3132
class InstanceKlass;
@@ -34,7 +35,7 @@ class JavaThread;
3435
class JfrClassDefineEvent : AllStatic {
3536
public:
3637
static void on_creation(const InstanceKlass* ik, const ClassFileParser& parser, JavaThread* jt);
37-
static void on_restoration(const InstanceKlass* ik, JavaThread* jt);
38+
CDS_ONLY(static void on_restoration(const InstanceKlass* ik, JavaThread* jt);)
3839
};
3940

4041
#endif // SHARE_JFR_SUPPORT_JFRCLASSDEFINEEVENT_HPP

0 commit comments

Comments
 (0)