On Thu, 18 Apr 2024 13:53:34 GMT, Oussama Louati <d...@openjdk.org> wrote:
> An indify tool in j.l.i tests (also in vmTestBase) convert some source-code > private static methods with MT_ MH_, and INDY_ prefixes into MethodHandle, > MethodType, and CallSite constants. > ### Purpose of Indify > > - **Transformation Tool**: `Indify` transforms existing class files to > leverage `invokedynamic` and other JSR 292 features. This transformation > allows for dynamic method calls. > > ### Key Functions > > - **Method Handle and Method Type Constants**: > - **MH_x and MT_x Methods**: These methods are used to generate > `MethodHandle` and `MethodType` constants. The tool transforms calls to these > methods into `CONSTANT_MethodHandle` and `CONSTANT_MethodType` "ldc" (load > constant) instructions. > - **Invokedynamic Call Sites**: > - **INDY_x Methods**: These methods generate `invokedynamic` call sites. > Each `INDY_x` method starts with a call to an `MH_x` method, which acts as > the bootstrap method. This is followed by an `invokeExact` call. > - **Transformation**: The tool transforms pairs of calls (to `INDY_x` > followed by `invokeExact`) into `invokedynamic` instructions. This mimics the > JVM's handling of `invokedynamic` instructions, creating dynamic call sites > that are linked at runtime. > > It currently uses ad-hoc code to process class files and intends to migrate > to ASM; but since we have the Classfile API, we can migrate to Classfile API > instead. This pull request has been closed without being integrated. ------------- PR: https://git.openjdk.org/jdk/pull/18841