RFR: 6312651: Compiler should only use verified interface types for optimization [v2]

Vladimir Ivanov vlivanov at openjdk.org
Thu Nov 10 00:17:13 UTC 2022


On Tue, 8 Nov 2022 15:30:08 GMT, Roland Westrelin <roland at openjdk.org> wrote:

>> src/hotspot/share/ci/ciObjectFactory.cpp line 160:
>> 
>>> 158:     InstanceKlass* ik = vmClasses::name();                           \
>>> 159:     ciEnv::_##name = get_metadata(ik)->as_instance_klass();          \
>>> 160:     Array<InstanceKlass*>* interfaces = ik->transitive_interfaces(); \
>> 
>> What's the purpose of interface-related part of the code?
>
> ciInstanceKlass objects for the vm classes all need to be allocated from the same long lived arena that's created in ciObjectFactory::initialize() because they are shared between compilations. Without that code, the ciInstanceKlass for a particular vm class is in the long lived arena but the ciInstanceKlass objects for the interfaces are created later when they are needed in the arena of some compilation. Once that compilation is over the interface objects are destroyed but still referenced from shared types such as TypeInstPtr::MIRROR.

Thanks, got it now. Is it really needed considering there's `transitive_interfaces()` call later?

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

PR: https://git.openjdk.org/jdk/pull/10901


More information about the hotspot-compiler-dev mailing list