RFR: 8293979: Resolve JVM_CONSTANT_Class references at CDS dump time [v3]
Coleen Phillimore
coleenp at openjdk.org
Tue Oct 18 20:51:06 UTC 2022
On Tue, 18 Oct 2022 15:39:08 GMT, Ioi Lam <iklam at openjdk.org> wrote:
>> Some `JVM_CONSTANT_Class` entries are guaranteed to resolve to the same value at both CDS dump time and run time:
>>
>> - Classes that are resolved during `vmClasses::resolve_all()`. These classes cannot be replaced by JVMTI agents at run time.
>> - Supertypes -- at run time, a class `C` can be loaded from the CDS archive only if all of `C`'s super types are also loaded from the CDS archive. Therefore, we know that a `JVM_CONSTANT_Class` reference to a supertype of `C` must resolved to the same value at both CDS dump time and run time.
>>
>> By doing the resolution at dump time, we can speed up run time start-up by a little bit.
>>
>> The `ClassPrelinker` class added by this PR will also be used in future REFs for pre-resolving other constant pool entries. The ultimate goal is to resolve `invokedynamic` and `invokehandle` so we can significantly improve the start-up time of features such as Lambda expressions and String concatenation. See [JDK-8293336](https://bugs.openjdk.org/browse/JDK-8293336)
>
> Ioi Lam has updated the pull request incrementally with one additional commit since the last revision:
>
> fixed product build
src/hotspot/share/cds/classPrelinker.hpp line 51:
> 49: // if all of its supertypes are loaded from the CDS archive.
> 50: class ClassPrelinker : public StackObj {
> 51: typedef ResourceHashtable<InstanceKlass*, bool, 15889, ResourceObj::C_HEAP, mtClassShared> ClassesTable;
You can use the new shiny using ClassesTable = ResourceHashtable<etc> instead.
src/hotspot/share/oops/constantPool.cpp line 404:
> 402: }
> 403:
> 404: bool ConstantPool::maybe_archive_resolved_klass_at(int cp_index) {
yes, I think this is better here.
-------------
PR: https://git.openjdk.org/jdk/pull/10330
More information about the hotspot-dev
mailing list