On Sat, 22 Jun 2024 09:39:46 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.
>> 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.
>
> Oussama Louati has updated the pull request incrementally with six additional 
> commits since the last revision:
> 
>  - Update test/jdk/java/lang/invoke/indify/Indify.java
>    
>    Co-authored-by: ExE Boss <3889017+exe-b...@users.noreply.github.com>
>  - Update test/jdk/java/lang/invoke/indify/Indify.java
>    
>    Co-authored-by: ExE Boss <3889017+exe-b...@users.noreply.github.com>
>  - Update test/jdk/java/lang/invoke/indify/Indify.java
>    
>    Co-authored-by: ExE Boss <3889017+exe-b...@users.noreply.github.com>
>  - Update test/jdk/java/lang/invoke/indify/Indify.java
>    
>    Co-authored-by: ExE Boss <3889017+exe-b...@users.noreply.github.com>
>  - Update test/jdk/java/lang/invoke/indify/Indify.java
>    
>    Co-authored-by: ExE Boss <3889017+exe-b...@users.noreply.github.com>
>  - fix: work done

test/jdk/java/lang/invoke/indify/Indify.java line 378:

> 376: 
> 377:     void writeNewClassFile(ClassModel newClassModel, Boolean changed, 
> File sourceFile) throws IOException {
> 378:         byte[] new_bytes = transformToBytes(newClassModel);

`newBytes`

test/jdk/java/lang/invoke/indify/Indify.java line 379:

> 377:     void writeNewClassFile(ClassModel newClassModel, Boolean changed, 
> File sourceFile) throws IOException {
> 378:         byte[] new_bytes = transformToBytes(newClassModel);
> 379:         if(changed || all){

If you are using idea, select this whole method body and run ctrl+alt+L to 
format the code. A few improper formatting.

test/jdk/java/lang/invoke/indify/Indify.java line 478:

> 476:             Logic logic = new Logic(model);
> 477:             Boolean changed = logic.transform();
> 478:             if (verbose && changed) System.err.println("(no change)");

Suggestion:

            if (verbose && !changed) System.err.println("(no change)");

test/jdk/java/lang/invoke/indify/Indify.java line 480:

> 478:             if (verbose && changed) System.err.println("(no change)");
> 479:             logic.reportPatternMethods(!verbose, keepgoing);
> 480:             byte[] new_Bytes = transformToBytes(logic.classModel);

`newBytes`

test/jdk/java/lang/invoke/indify/Indify.java line 501:

> 499:             if (!findPatternMethods()) return false;
> 500: 
> 501:             Stack<PoolEntry> pendingIndy = new Stack<>(); // stack to 
> hold the pending invokedynamic constant to replace the invokeExact

Please use `Deque` and `ArrayDeque` instead.

test/jdk/java/lang/invoke/indify/Indify.java line 536:

> 534:                         pendingIndy.push(newConstant);
> 535:                         if (!quiet) {
> 536:                             System.err.println(":::Transforming the 
> Method Class for: " + ((InvokeInstruction) e).method().name() +

Suggestion:

                            System.err.println(":::Transforming the Method 
Class for: " + invokeInstruction.method().name() +

test/jdk/java/lang/invoke/indify/Indify.java line 545:

> 543:                     } else {
> 544:                         if (!quiet) {
> 545:                             System.err.println(":::Transforming the 
> Method Call of: " + ((InvokeInstruction) e).method().name() +

Suggestion:

                            System.err.println(":::Transforming the Method Call 
of: " + invokeInstruction.method().name() +

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

PR Review Comment: https://git.openjdk.org/jdk/pull/18841#discussion_r1649697535
PR Review Comment: https://git.openjdk.org/jdk/pull/18841#discussion_r1649697624
PR Review Comment: https://git.openjdk.org/jdk/pull/18841#discussion_r1649697501
PR Review Comment: https://git.openjdk.org/jdk/pull/18841#discussion_r1649697679
PR Review Comment: https://git.openjdk.org/jdk/pull/18841#discussion_r1649698078
PR Review Comment: https://git.openjdk.org/jdk/pull/18841#discussion_r1649699193
PR Review Comment: https://git.openjdk.org/jdk/pull/18841#discussion_r1649699115

Reply via email to