On Fri, 18 Mar 2022 21:05:01 GMT, altrisi <d...@openjdk.java.net> wrote:

> Note that there's a class in tests (or something similar) that extends 
> CallSite directly: 
> https://github.com/openjdk/jdk/blob/d8893fad23d1ee6841336b96c34599643edb81ce/test/hotspot/jtreg/vmTestbase/vm/mlvm/patches/java.base/java/lang/invoke/NewInvokeSpecialCallSite.java

Appears it's exclusively used by `GenManyIndyCorrectBootstrap`. Looking at that 
code, it's just used to create random indy instructions to stuff the constant 
pool:

        if (Env.getRNG().nextBoolean()) {
            bsm = new Handle(Opcodes.H_NEWINVOKESPECIAL,
                    NEW_INVOKE_SPECIAL_CLASS_NAME,
                    INIT_METHOD_NAME,
                    NEW_INVOKE_SPECIAL_BOOTSTRAP_METHOD_SIGNATURE);
        } else {
            bsm = new Handle(Opcodes.H_INVOKESTATIC,
                    this.fullClassName,
                    BOOTSTRAP_METHOD_NAME,
                    BOOTSTRAP_METHOD_SIGNATURE);
        }

Appears we can just remove the randomization and always use a standard 
reference to the generated class' bootstrap method, and extending `CallSite` 
directly for such tiny functionality is overkill. If my approach is not 
desired, please speak out and suggest changes. Thanks!

-------------

PR: https://git.openjdk.java.net/jdk/pull/7840

Reply via email to