Integrated: 8315771: [JVMCI] Resolution of bootstrap methods with int[] static arguments
Sacha Coppey
duke at openjdk.org
Thu Sep 21 17:03:53 UTC 2023
On Wed, 6 Sep 2023 11:24:10 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 `InvokeDynamic` and `DynamicConstant`.
>
> To lookup the constant at the index in the static arguments index list, a new class is introduced, allowing to lazily resolve the constant or obtain the constant pool index of the arguments:
>
>
> static class CachedBSMArgs extends AbstractList<JavaConstant> {
> private final JavaConstant[] cache;
> private final HotSpotConstantPool cp;
> private final int bssIndex;
>
> CachedBSMArgs(HotSpotConstantPool cp, int bssIndex, int size) {
> this.cp = cp;
> this.bssIndex = bssIndex;
> this.cache = new JavaConstant[size];
> }
>
> @Override
> public JavaConstant get(int index) {
> JavaConstant res = cache[index];
> if (res == null) {
> int argCpi = compilerToVM().bootstrapArgumentIndexAt(cp, bssIndex, index);
> res = compilerToVM().lookupConstantInPool(cp, argCpi, false);
> if (res == null) {
> res = JavaConstant.forInt(argCpi);
> }
> cache[index] = res;
> }
> return res;
> }
>
> @Override
> public int size() {
> return cache.length;
> }
> }
This pull request has now been integrated.
Changeset: 015f6f5d
Author: Sacha Coppey <sacha.coppey at oracle.com>
Committer: Doug Simon <dnsimon at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/015f6f5d9497b8cef9ba2e789799a28bcd454341
Stats: 202 lines in 5 files changed: 184 ins; 8 del; 10 mod
8315771: [JVMCI] Resolution of bootstrap methods with int[] static arguments
Reviewed-by: dnsimon, psandoz
-------------
PR: https://git.openjdk.org/jdk/pull/15588
More information about the hotspot-compiler-dev
mailing list