-
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 |
|---|---|---|
|
|
@@ -476,11 +476,20 @@ Object[] resolveBootstrapMethod(HotSpotConstantPool constantPool, int cpi) { | |
|
|
||
| private native Object[] resolveBootstrapMethod(HotSpotConstantPool constantPool, long constantPoolPointer, int cpi); | ||
|
|
||
| int bootstrapArgumentIndexAt(HotSpotConstantPool constantPool, int cpi) { | ||
| return bootstrapArgumentIndexAt(constantPool, constantPool.getConstantPoolPointer(), cpi); | ||
| /** | ||
| * Gets the constant pool index of a static argument of a bootstrap specifier. Used when the list | ||
| * of static arguments in the {@link BootstrapMethodInvocation} is an {@code int[]}. The list has | ||
| * two elements. The first one is the number of arguments and the second one is the {@code cpi}. | ||
| * | ||
| * @param cpi the index of a bootstrap specifier in the constant pool | ||
| * @param index the index of the static argument in the list of static arguments | ||
|
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. What happens when 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. Currently, it returns another constant pool index or a random number. I can add a check in the 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. Yes please. We should opt for exceptions over undefined behavior whenever possible. 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. After double checking, there is in fact already an 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. Is the assertion in code that can throw exceptions? 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. The assertion is here. I don't think we can throw exception there. I could check the size in 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. Ok. You should just add a note in the javadoc that the result is undefined if 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. Yes, it is only used in |
||
| * @return the constant pool index associated with the static argument | ||
| */ | ||
| int bootstrapArgumentIndexAt(HotSpotConstantPool constantPool, int cpi, int index) { | ||
| return bootstrapArgumentIndexAt(constantPool, constantPool.getConstantPoolPointer(), cpi, index); | ||
| } | ||
|
|
||
| private native int bootstrapArgumentIndexAt(HotSpotConstantPool constantPool, long constantPoolPointer, int cpi); | ||
| private native int bootstrapArgumentIndexAt(HotSpotConstantPool constantPool, long constantPoolPointer, int cpi, int index); | ||
|
|
||
| /** | ||
| * If {@code cpi} denotes an entry representing a signature polymorphic method ({@jvms 2.9}), | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -171,13 +171,15 @@ interface BootstrapMethodInvocation { | |
| } | ||
|
|
||
| /** | ||
|
||
| * Gets the constant pool index of the pool entry associated with the | ||
| * index in the static arguments list of a bootstrap method. | ||
| * Gets the constant pool index of a static argument of a bootstrap specifier. Used when the list | ||
| * of static arguments in the {@link BootstrapMethodInvocation} is an {@code int[]}. The list has | ||
| * two elements. The first one is the number of arguments and the second one is the {@code cpi}. | ||
|
||
| * | ||
| * @param index a constant pool index | ||
| * @param cpi the index of a bootstrap specifier in the constant pool | ||
|
||
| * @param index the index of the static argument in the list of static arguments | ||
| * @return the constant pool index associated with the static argument | ||
| */ | ||
| default int bootstrapArgumentIndexAt(int index) { | ||
| default int bootstrapArgumentIndexAt(int cpi, int index) { | ||
| throw new UnsupportedOperationException(); | ||
| } | ||
|
|
||
|
|
||
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.