RFR: 8376295: "assert(BytecodeVerificationRemote) failed: Should not be here" when running class redefinition test with -XX:-BytecodeVerificationRemote
Leonid Mesnik
lmesnik at openjdk.org
Thu Jan 29 07:04:11 UTC 2026
On Thu, 29 Jan 2026 02:30:19 GMT, David Holmes <dholmes at openjdk.org> wrote:
>> Hi
>>
>> Please review following fix that remove incorrect assertion.
>>
>> Verification should be always done for redefined classes, and is called
>> `bool Verifier::verify(InstanceKlass* klass, bool should_verify_class, TRAPS)`
>> where `should_verify_class` and `is_eligible_for_verification` define if verification should be done or not.
>> Thus, seems it doesn't make a sense to check `BytecodeVerificationRemote` during verification.
>>
>> Verified that class redefinition tests pass now with TEST_VM_OPTS="-XX:-BytecodeVerificationRemote" and fastdebug
>
> src/hotspot/share/classfile/verifier.cpp line 625:
>
>> 623:
>> 624: // Either verifying both local and remote classes or just remote classes.
>> 625: assert(BytecodeVerificationRemote, "Should not be here");
>
> Rather than deleting the assertion can we expand it:
>
> assert(BytecodeVerificationRemote || _klass->should_verify_class(), "Should not be here");
>
> ?
The
`_klass->should_verify_class()`
is false when class is redefined.
The '_klass' in fresh "scratch class". So the `bool Verifier::verify(InstanceKlass* klass, bool should_verify_class)` is called for "scratch_class" with `should_verify_class = true`.
The `should_verify_class = true` is needed because it is not possible to just call
`scratch_class->set_should_verify_class(true);`
in the safepoint.
The stacktrace:
ClassVerifier::verify_class(JavaThread* (verifier.cpp:625)
Verifier::verify(InstanceKlass*, bool`should_verify_class = true` , JavaThread*) (verifier.cpp:223)
VM_RedefineClasses::load_new_class_versions() (jvmtiRedefineClasses.cpp:1459)
VM_RedefineClasses::doit_prologue() (jvmtiRedefineClasses.cpp:1334)
VMThread::execute(VM_Operation*) (vmThread.cpp:541)
JvmtiEnv::RedefineClasses(int, jvmtiClassDefinition const*)+0x18a (jvmtiEnv.cpp:505)
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/29476#discussion_r2740235533
More information about the hotspot-runtime-dev
mailing list