RFR: 8315771: [JVMCI] Resolution of bootstrap methods with int[] static arguments [v8]
Sacha Coppey
duke at openjdk.org
Wed Sep 13 15:01:34 UTC 2023
> 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;
> }
> }
Sacha Coppey has updated the pull request incrementally with one additional commit since the last revision:
Add undefined behavior documentation for bootstrapArgumentIndexAt and update documentation for @return of CachedBSMArgs.get
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/15588/files
- new: https://git.openjdk.org/jdk/pull/15588/files/d6aa5934..d75e0926
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=15588&range=07
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=15588&range=06-07
Stats: 6 lines in 2 files changed: 4 ins; 0 del; 2 mod
Patch: https://git.openjdk.org/jdk/pull/15588.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/15588/head:pull/15588
PR: https://git.openjdk.org/jdk/pull/15588
More information about the hotspot-compiler-dev
mailing list