-
Notifications
You must be signed in to change notification settings - Fork 6.1k
8315771: [JVMCI] Resolution of bootstrap methods with int[] static arguments #15588
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
b0940de
2cdc0b4
b33ffed
093d0ce
4ec0a7b
079969c
d6aa593
d75e092
f4377fc
9e0627a
ea4aa98
7c27481
7a8d9f2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -549,21 +549,27 @@ static class CachedBSMArgs extends AbstractList<JavaConstant> { | |
| /** | ||
| * Lazily resolves and caches the argument at the given index and returns it. The method | ||
| * {@link CompilerToVM#bootstrapArgumentIndexAt} is used to obtain the constant pool | ||
| * index of the entry and the method {@link CompilerToVM#lookupConstantInPool} is used | ||
| * to resolve it. If the resolution failed, the index is returned as a | ||
| * index of the entry and the method {@link ConstantPool#lookupConstant} is used to | ||
| * resolve it. If the resolution failed, the index is returned as a | ||
| * {@link PrimitiveConstant}. | ||
| * | ||
| * @param index index of the element to return | ||
| * @return A {@link PrimitiveConstant} representing a {@code CONSTANT_Dynamic_info} | ||
| * entry or a {@link JavaConstant} representing the static argument requested | ||
| * @return A {@link PrimitiveConstant} representing an unresolved constant pool entry | ||
| * or a {@link JavaConstant} representing the static argument requested | ||
| */ | ||
| @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) { | ||
| Object object = cp.lookupConstant(argCpi, false); | ||
| if (object instanceof PrimitiveConstant primitiveConstant) { | ||
| res = runtime().getReflection().boxPrimitive(primitiveConstant); | ||
| } else if (object instanceof JavaConstant javaConstant) { | ||
| res = javaConstant; | ||
| } else if (object instanceof JavaType type) { | ||
| res = runtime().getReflection().forObject(type); | ||
| } else { | ||
| res = JavaConstant.forInt(argCpi); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Based on my understanding and my testing, this can only be reached for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think that's right based on the spec for |
||
| } | ||
| cache[index] = res; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or a {@link JavaConstant}a PrimitiveConstant is a JavaConstant isn't it?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it is, but since the primitives are returned in their boxed form, a PrimitiveConstant can only be a constant pool index, so I think it is better to specify the difference.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My point is that a PrimitiveConstant is a subtype of JavaConstant so the "or" does not make sense. It's like saying "an int or a number".