On Thu, 12 Nov 2020 15:19:30 GMT, Jorn Vernee <jver...@openjdk.org> wrote:
> Also (as mentioned offline), while it's possible with the current API to > provide an `Object[]` as class data, and then load elements of that array > into CP entries using downstream condys (e.g. by creating an array access var > handle and then using that), I think it would be good to add a > `getArrayElement` BSM for doing that to `ConstantBootstraps` to make this > (seemingly) common case easier (maybe also a `getField` for loading instance > fields). This would help to address the case where multiple live constants > need to be injected. I am uncomfortable with adding `ConstantBootstraps::getArrayElement` because an array is modifiable and _not_ true constant. A final instance field can be modified via reflection and therefore it's not trusted as a constant either. ------------- PR: https://git.openjdk.java.net/jdk/pull/1171