RFR: 8315771: [JVMCI] Resolution of bootstrap methods with int[] static arguments [v5]
Doug Simon
dnsimon at openjdk.org
Fri Sep 8 13:33:41 UTC 2023
On Fri, 8 Sep 2023 12:22:18 GMT, Sacha Coppey <duke at openjdk.org> wrote:
>> Currently, jdk.vm.ci.meta.ConstantPool.lookupBootstrapMethodInvocation does not support static arguments of type int[].
>>
>> Supporting those static arguments allows to correctly lookup the BootstrapMethodInvocation of some DynamicConstant.
>>
>> To lookup the constant at the index in the static arguments index list, an overloaded version of this method is required:
>>
>>
>> /**
>> * Gets the constant pool index of the pool entry associated with the
>> * index in the static arguments list of a bootstrap method.
>> *
>> * @param index a constant pool index
>> * @return the constant pool index associated with the static argument
>> */
>> int bootstrapArgumentIndexAt(int index)
>
> Sacha Coppey has updated the pull request incrementally with one additional commit since the last revision:
>
> Add CachedBSMArgs to resolve arguments lazily instead of letting the user do so
@PaulSandoz it would be great if you could have a look at this PR or suggest another domain expert who might be willing to look at it.
@Zeavee please keep the PR description up to date with the current changes.
src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/CompilerToVM.java line 488:
> 486: *
> 487: * @param cpi the index of a {@code CONSTANT_Dynamic_info} or @{code CONSTANT_InvokeDynamic_info} entry
> 488: * @param index the index of the static argument in the list of static arguments
What happens when `index` is out of bounds?
src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotConstantPool.java line 532:
> 530: }
> 531:
> 532: static class CachedBSMArgs extends AbstractList<JavaConstant> {
This class needs documentation.
src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/meta/ConstantPool.java line 168:
> 166: * Gets the static arguments with which the bootstrap method will be invoked.
> 167: *
> 168: * An argument of type {@link PrimitiveConstant} represents a {@code CONSTANT_Dynamic_info}
Can it not be an index to any valid LDC constant? This is implied by this code in your Graal PR:
if (constant instanceof PrimitiveConstant primitiveConstant) {
int argCpi = primitiveConstant.asInt();
Object argConstant = lookupConstant(argCpi, opcode == Opcodes.INVOKEDYNAMIC ? Opcodes.LDC : opcode, allowBootstrapMethodInvocation);
-------------
PR Comment: https://git.openjdk.org/jdk/pull/15588#issuecomment-1711677506
PR Comment: https://git.openjdk.org/jdk/pull/15588#issuecomment-1711678508
PR Review Comment: https://git.openjdk.org/jdk/pull/15588#discussion_r1319862320
PR Review Comment: https://git.openjdk.org/jdk/pull/15588#discussion_r1319873967
PR Review Comment: https://git.openjdk.org/jdk/pull/15588#discussion_r1319867458
More information about the hotspot-compiler-dev
mailing list