Add classfile-api module: java.lang.classfile (JEP 484) parse, generate, transform with timing instrumentation, ASM 9.11.1 comparison, version limits, JDK 24/25/26 API diff
Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b4VQVEJWetTT1dYzyJ
This commit is contained in:
@@ -0,0 +1,121 @@
|
||||
$ javap -c -p demo.Target (original, as javac produced it; fib and boom only)
|
||||
public static int fib(int);
|
||||
Code:
|
||||
0: iload_0
|
||||
1: iconst_2
|
||||
2: if_icmpge 9
|
||||
5: iload_0
|
||||
6: goto 22
|
||||
9: iload_0
|
||||
10: iconst_1
|
||||
11: isub
|
||||
12: invokestatic #13 // Method fib:(I)I
|
||||
15: iload_0
|
||||
16: iconst_2
|
||||
17: isub
|
||||
18: invokestatic #13 // Method fib:(I)I
|
||||
21: iadd
|
||||
22: ireturn
|
||||
|
||||
public static void boom();
|
||||
Code:
|
||||
0: new #31 // class java/lang/IllegalStateException
|
||||
3: dup
|
||||
4: ldc #33 // String boom
|
||||
6: invokespecial #35 // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
|
||||
9: athrow
|
||||
|
||||
$ javap -c -p demo.Target (naive transform: records on normal return only)
|
||||
public static int fib(int);
|
||||
Code:
|
||||
0: invokestatic #74 // Method java/lang/System.nanoTime:()J
|
||||
3: lstore_1
|
||||
4: iload_0
|
||||
5: iconst_2
|
||||
6: if_icmpge 13
|
||||
9: iload_0
|
||||
10: goto 26
|
||||
13: iload_0
|
||||
14: iconst_1
|
||||
15: isub
|
||||
16: invokestatic #13 // Method fib:(I)I
|
||||
19: iload_0
|
||||
20: iconst_2
|
||||
21: isub
|
||||
22: invokestatic #13 // Method fib:(I)I
|
||||
25: iadd
|
||||
26: ldc #76 // String Target.fib
|
||||
28: invokestatic #74 // Method java/lang/System.nanoTime:()J
|
||||
31: lload_1
|
||||
32: lsub
|
||||
33: invokestatic #82 // Method demo/Timings.record:(Ljava/lang/String;J)V
|
||||
36: ireturn
|
||||
|
||||
public static void boom();
|
||||
Code:
|
||||
0: invokestatic #74 // Method java/lang/System.nanoTime:()J
|
||||
3: lstore_0
|
||||
4: new #31 // class java/lang/IllegalStateException
|
||||
7: dup
|
||||
8: ldc #33 // String boom
|
||||
10: invokespecial #35 // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
|
||||
13: athrow
|
||||
|
||||
$ javap -c -p demo.Target (full transform: plus a catch-all handler)
|
||||
public static int fib(int);
|
||||
Code:
|
||||
0: invokestatic #74 // Method java/lang/System.nanoTime:()J
|
||||
3: lstore_1
|
||||
4: iload_0
|
||||
5: iconst_2
|
||||
6: if_icmpge 13
|
||||
9: iload_0
|
||||
10: goto 26
|
||||
13: iload_0
|
||||
14: iconst_1
|
||||
15: isub
|
||||
16: invokestatic #13 // Method fib:(I)I
|
||||
19: iload_0
|
||||
20: iconst_2
|
||||
21: isub
|
||||
22: invokestatic #13 // Method fib:(I)I
|
||||
25: iadd
|
||||
26: ldc #76 // String Target.fib
|
||||
28: invokestatic #74 // Method java/lang/System.nanoTime:()J
|
||||
31: lload_1
|
||||
32: lsub
|
||||
33: invokestatic #82 // Method demo/Timings.record:(Ljava/lang/String;J)V
|
||||
36: ireturn
|
||||
37: astore_3
|
||||
38: ldc #76 // String Target.fib
|
||||
40: invokestatic #74 // Method java/lang/System.nanoTime:()J
|
||||
43: lload_1
|
||||
44: lsub
|
||||
45: invokestatic #82 // Method demo/Timings.record:(Ljava/lang/String;J)V
|
||||
48: aload_3
|
||||
49: athrow
|
||||
Exception table:
|
||||
from to target type
|
||||
4 37 37 any
|
||||
|
||||
public static void boom();
|
||||
Code:
|
||||
0: invokestatic #74 // Method java/lang/System.nanoTime:()J
|
||||
3: lstore_0
|
||||
4: new #31 // class java/lang/IllegalStateException
|
||||
7: dup
|
||||
8: ldc #33 // String boom
|
||||
10: invokespecial #35 // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
|
||||
13: athrow
|
||||
14: astore_2
|
||||
15: ldc #90 // String Target.boom
|
||||
17: invokestatic #74 // Method java/lang/System.nanoTime:()J
|
||||
20: lload_0
|
||||
21: lsub
|
||||
22: invokestatic #82 // Method demo/Timings.record:(Ljava/lang/String;J)V
|
||||
25: aload_2
|
||||
26: athrow
|
||||
Exception table:
|
||||
from to target type
|
||||
4 14 14 any
|
||||
|
||||
Reference in New Issue
Block a user