diff --git a/src/hotspot/share/classfile/javaClasses.cpp b/src/hotspot/share/classfile/javaClasses.cpp index d3662d5d5f4..b2932cd7e88 100644 --- a/src/hotspot/share/classfile/javaClasses.cpp +++ b/src/hotspot/share/classfile/javaClasses.cpp @@ -4782,9 +4782,9 @@ void JavaClasses::compute_hard_coded_offsets() { // Compute non-hard-coded field offsets of all the classes in this file void JavaClasses::compute_offsets() { if (UseSharedSpaces) { - assert(JvmtiExport::is_early_phase() && !(JvmtiExport::should_post_class_file_load_hook() && - JvmtiExport::has_early_class_hook_env()), - "JavaClasses::compute_offsets() must be called in early JVMTI phase."); + JVMTI_ONLY(assert(JvmtiExport::is_early_phase() && !(JvmtiExport::should_post_class_file_load_hook() && + JvmtiExport::has_early_class_hook_env()), + "JavaClasses::compute_offsets() must be called in early JVMTI phase.")); // None of the classes used by the rest of this function can be replaced by // JMVTI ClassFileLoadHook. // We are safe to use the archived offsets, which have already been restored diff --git a/src/hotspot/share/classfile/systemDictionary.cpp b/src/hotspot/share/classfile/systemDictionary.cpp index b4bf3fe8758..2d60154b6bf 100644 --- a/src/hotspot/share/classfile/systemDictionary.cpp +++ b/src/hotspot/share/classfile/systemDictionary.cpp @@ -2070,8 +2070,8 @@ void SystemDictionary::resolve_well_known_classes(TRAPS) { #ifdef ASSERT if (UseSharedSpaces) { - assert(JvmtiExport::is_early_phase(), - "All well known classes must be resolved in JVMTI early phase"); + JVMTI_ONLY(assert(JvmtiExport::is_early_phase(), + "All well known classes must be resolved in JVMTI early phase")); for (int i = FIRST_WKID; i < last; i++) { InstanceKlass* k = _well_known_klasses[i]; assert(k->is_shared(), "must not be replaced by JVMTI class file load hook");