Stack map generation problem

David Lloyd david.lloyd at redhat.com
Fri Dec 13 22:31:22 UTC 2024


I found the problem, and it is not specific to the backport per se: there
are several places where `==` is used to compare `ClassDesc`
instances, particularly in the stack map generator. This usually works on
JDK 24 or later, but fails on 23 or earlier. The critical clue was when I
accidentally ran the backport version of the test on JDK 24 and it passed -
telling me that the problem was a JDK behavioral difference.

On Thu, Dec 12, 2024 at 1:42 PM David Lloyd <david.lloyd at redhat.com> wrote:

> Hmm. I will try to come up with a more concise reproducer. Maybe it's a
> problem with my class hierarchy resolver, or some other configuration that
> I have locally.
>
> BTW the example class is from io.smallrye.reactive:mutiny:2.6.2, sorry I
> failed to specify that. Thanks for looking into it, I'll see if I can make
> a minimal reproducer.
>
> On Thu, Dec 12, 2024 at 1:32 PM Chen Liang <chen.l.liang at oracle.com>
> wrote:
>
>> Hmm, couldn't reproduce with a local JDK mainline build (25) and the
>> latest smallrye mutiny 2.7.0. (It also appears from bci that your example
>> is an older version of mutiny). I changed the class java/util/ServiceLoader
>> to Dummy in jshell and cannot reproduce this issue; cannot reproduce with
>> stack maps recomputation either. Here's the javap output of the transformed
>> results.
>>
>>   static {};
>>     descriptor: ()V
>>     flags: (0x0008) ACC_STATIC
>>     Code:
>>       stack=2, locals=3, args_size=0
>>          0: ldc_w         #304                // String
>> mutiny.disableCallBackDecorators
>>          3: invokestatic  #306                // Method
>> java/lang/Boolean.getBoolean:(Ljava/lang/String;)Z
>>          6: putstatic     #203                // Field
>> DISABLE_CALLBACK_DECORATORS:Z
>>          9: ldc_w         #312                // class
>> io/smallrye/mutiny/infrastructure/ExecutorConfiguration
>>         12: invokestatic  #561                // Method
>> Dummy.load:(Ljava/lang/Class;)Ljava/util/ServiceLoader;
>>         15: astore_0
>>         16: aload_0
>>         17: invokevirtual #212                // Method
>> java/util/ServiceLoader.iterator:()Ljava/util/Iterator;
>>         20: astore_1
>>         21: aload_1
>>         22: invokeinterface #216,  1          // InterfaceMethod
>> java/util/Iterator.hasNext:()Z
>>         27: ifeq          61
>>         30: aload_1
>>         31: invokeinterface #221,  1          // InterfaceMethod
>> java/util/Iterator.next:()Ljava/lang/Object;
>>         36: checkcast     #312                // class
>> io/smallrye/mutiny/infrastructure/ExecutorConfiguration
>>         39: astore_2
>>         40: aload_2
>>         41: invokeinterface #314,  1          // InterfaceMethod
>> io/smallrye/mutiny/infrastructure/ExecutorConfiguration.getDefaultWorkerExecutor:()Ljava/util/concurrent/Executor;
>>         46: ldc_w         #318                // String executor
>>         49: invokestatic  #167                // Method
>> io/smallrye/mutiny/helpers/ParameterValidation.nonNull:(Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object;
>>         52: checkcast     #320                // class
>> java/util/concurrent/Executor
>>         55: invokestatic  #32                 // Method
>> setDefaultExecutor:(Ljava/util/concurrent/Executor;)V
>>         58: goto          64
>>         61: invokestatic  #322                // Method
>> setDefaultExecutor:()V
>>         64: invokestatic  #324                // Method reload:()V
>>         67: invokestatic  #327                // Method
>> resetCanCallerThreadBeBlockedSupplier:()V
>>         70: getstatic     #241                // Field
>> io/smallrye/mutiny/infrastructure/Infrastructure$PrintAndDumpThrowableConsumer.INSTANCE:Lio/smallrye/mutiny/infrastructure/Infrastructure$PrintAndDumpThrowableConsumer;
>>         73: putstatic     #155                // Field
>> droppedExceptionHandler:Ljava/util/function/Consumer;
>>         76: getstatic     #271                // Field
>> io/smallrye/mutiny/infrastructure/Infrastructure$PrintOperatorEventOperatorLogger.INSTANCE:Lio/smallrye/mutiny/infrastructure/Infrastructure$PrintOperatorEventOperatorLogger;
>>         79: putstatic     #260                // Field
>> operatorLogger:Lio/smallrye/mutiny/infrastructure/Infrastructure$OperatorLogger;
>>         82: sipush        128
>>         85: putstatic     #16                 // Field
>> multiOverflowDefaultBufferSize:I
>>         88: bipush        32
>>         90: putstatic     #20                 // Field bufferSizeXs:I
>>         93: sipush        256
>>         96: putstatic     #23                 // Field bufferSizeS:I
>>         99: return
>>       LocalVariableTable:
>>         Start  Length  Slot  Name   Signature
>>            40      18     2  next
>> Lio/smallrye/mutiny/infrastructure/ExecutorConfiguration;
>>            16      54     0 executorLoader   Ljava/util/ServiceLoader;
>>            21      49     1 iterator   Ljava/util/Iterator;
>>       LocalVariableTypeTable:
>>         Start  Length  Slot  Name   Signature
>>            16      54     0 executorLoader
>> Ljava/util/ServiceLoader<Lio/smallrye/mutiny/infrastructure/ExecutorConfiguration;>;
>>            21      49     1 iterator
>> Ljava/util/Iterator<Lio/smallrye/mutiny/infrastructure/ExecutorConfiguration;>;
>>       LineNumberTable:
>>         line 39: 0
>>         line 42: 9
>>         line 43: 16
>>         line 44: 21
>>         line 45: 30
>>         line 46: 40
>>         line 47: 58
>>         line 48: 61
>>         line 51: 64
>>         line 53: 67
>>         line 63: 70
>>         line 65: 76
>>         line 67: 82
>>         line 69: 88
>>         line 70: 93
>>       StackMapTable: number_of_entries = 2
>>         frame_type = 253 /* append */
>>           offset_delta = 61
>>           locals = [ class java/util/ServiceLoader, class
>> java/util/Iterator ]
>>         frame_type = 2 /* same */
>>
>> Regards, Chen
>>
>>
>
> --
> - DML • he/him
>


-- 
- DML • he/him
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/classfile-api-dev/attachments/20241213/19df8dc3/attachment-0001.htm>


More information about the classfile-api-dev mailing list