RFR: 8330578: The VM creates instance of abstract class VirtualMachineError [v3]

Coleen Phillimore coleenp at openjdk.org
Fri Apr 19 13:09:31 UTC 2024


On Fri, 19 Apr 2024 12:35:43 GMT, Doug Simon <dnsimon at openjdk.org> wrote:

>> Coleen Phillimore has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   We don't need to link and initialize VirtualMachineError class because the lines just below it that link and initialize and create an instance of StackOverflowError will do that, since VME is a subclass of SOE.
>
> src/hotspot/share/classfile/verifier.cpp line 257:
> 
>> 255:         // or one of it's superclasses, we're in trouble and are going
>> 256:         // to infinitely recurse when we try to initialize the exception.
>> 257:         // So bail out here by throwing the preallocated VM error.
> 
> The comment looks wrong now as I think `THROW_MSG_` creates a new object.

You're right - that's a good observation.  This code is hard to reach (tried to write a test case yesterday).  It might need a class file load hook for the java/lang/Error class, in which case, the whole VM is probably going to be useless.  But I will maintain throwing a preallocated instance.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/18847#discussion_r1572341041


More information about the hotspot-dev mailing list