Quantcast

Re: aot compiler halts when there exists an infinite loop in clinit()

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: aot compiler halts when there exists an infinite loop in clinit()

David Holmes
Redirecting to hotspot-compiler-dev, please do not reply to jdk9-dev.

Thanks,
David

On 18/04/2017 11:43 AM, Yuting Chen wrote:

> If I moved the infinite loop to any other method (e.g., main), the
> class can then be compiled. I guess jaotc runs clinit when it compiles
> clinit.
>
> On Mon, Apr 17, 2017 at 6:14 PM, Yuting Chen <[hidden email]> wrote:
>> Hi, I recently met a problem: when I tried to compile a class whose
>> clinit method contains an infinite loop, the aotc waits and fails to
>> response....
>>
>> It seems that the aotc performs some static analysis before the
>> compilation, while the analysis may not stop (when an infinite loop is
>> there).
>>
>> The bytecode is shown as follows:
>>
>> public class Vector1
>>   minor version: 0
>>   major version: 52
>>   flags: ACC_PUBLIC, ACC_SUPER
>> Constant pool:
>>    #1 = Utf8               Vector1
>>    #2 = Class              #1             // Vector1
>>    #3 = Utf8               java/lang/Object
>>    #4 = Class              #3             // java/lang/Object
>>    #5 = Utf8               serialVersionUID
>>    #6 = Utf8               J
>>    #7 = Long               -2767605614048989439l
>>    #9 = Utf8               <clinit>
>>   #10 = Utf8               ()V
>>   #11 = NameAndType        #5:#6          // serialVersionUID:J
>>   #12 = Fieldref           #2.#11         // Vector1.serialVersionUID:J
>>   #13 = Utf8               main
>>   #14 = Utf8               ([Ljava/lang/String;)V
>>   #15 = Utf8               ConstantValue
>>   #16 = Utf8               Code
>>   #17 = Utf8               StackMapTable
>> {
>>   public static {};
>>     descriptor: ()V
>>     flags: ACC_PUBLIC, ACC_STATIC
>>     Code:
>>       stack=2, locals=0, args_size=0
>>          0: ldc2_w        #7                  // long -2767605614048989439l
>>          3: putstatic     #12                 // Field serialVersionUID:J
>>          6: iconst_1
>>          7: iconst_m1
>>          8: iadd
>>          9: ifge          0
>>         12: return
>>       StackMapTable: number_of_entries = 1
>>         frame_type = 0 /* same */
>>
>>   public static void main(java.lang.String[]);
>>     descriptor: ([Ljava/lang/String;)V
>>     flags: ACC_PUBLIC, ACC_STATIC
>>     Code:
>>       stack=0, locals=1, args_size=1
>>          0: return
>> }
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: aot compiler halts when there exists an infinite loop in clinit()

Yuting Chen-2
Hi, are there any comments to this case? I found that the clinit
method will be compiled if it does not contain the infinite loop. Does
it mean that clinit will run before it is compiled.

Re-paste the bytecode:

public class Vector1
  minor version: 0
  major version: 52
  flags: ACC_PUBLIC, ACC_SUPER
Constant pool:
   #1 = Utf8               Vector1
   #2 = Class              #1             // Vector1
   #3 = Utf8               java/lang/Object
   #4 = Class              #3             // java/lang/Object
   #5 = Utf8               serialVersionUID
   #6 = Utf8               J
   #7 = Long               -2767605614048989439l
   #9 = Utf8               <clinit>
  #10 = Utf8               ()V
  #11 = NameAndType        #5:#6          // serialVersionUID:J
  #12 = Fieldref           #2.#11         // Vector1.serialVersionUID:J
  #13 = Utf8               main
  #14 = Utf8               ([Ljava/lang/String;)V
  #15 = Utf8               ConstantValue
  #16 = Utf8               Code
  #17 = Utf8               StackMapTable
{
  public static {};
    descriptor: ()V
    flags: ACC_PUBLIC, ACC_STATIC
    Code:
      stack=2, locals=0, args_size=0
         0: ldc2_w        #7                  // long -2767605614048989439l
         3: putstatic     #12                 // Field serialVersionUID:J
         6: iconst_1
         7: iconst_m1
         8: iadd
         9: ifge          0
        12: return
      StackMapTable: number_of_entries = 1
        frame_type = 0 /* same */

  public static void main(java.lang.String[]);
    descriptor: ([Ljava/lang/String;)V
    flags: ACC_PUBLIC, ACC_STATIC
    Code:
      stack=0, locals=1, args_size=1
         0: return
}

On Tue, Apr 18, 2017 at 9:41 AM, Yuting Chen <[hidden email]> wrote:

> Hi, are there any comments to this case? I found that the clinit
> method will be compiled if it does not contain the infinite loop. It's
> weird.
>
> The bytecode is shown as follows:
>
>  public class Vector1
>    minor version: 0
>    major version: 52
>    flags: ACC_PUBLIC, ACC_SUPER
>  Constant pool:
>     #1 = Utf8               Vector1
>     #2 = Class              #1             // Vector1
>     #3 = Utf8               java/lang/Object
>     #4 = Class              #3             // java/lang/Object
>     #5 = Utf8               serialVersionUID
>     #6 = Utf8               J
>     #7 = Long               -2767605614048989439l
>     #9 = Utf8               <clinit>
>    #10 = Utf8               ()V
>    #11 = NameAndType        #5:#6          // serialVersionUID:J
>    #12 = Fieldref           #2.#11         // Vector1.serialVersionUID:J
>    #13 = Utf8               main
>    #14 = Utf8               ([Ljava/lang/String;)V
>    #15 = Utf8               ConstantValue
>    #16 = Utf8               Code
>    #17 = Utf8               StackMapTable
>  {
>    public static {};
>      descriptor: ()V
>      flags: ACC_PUBLIC, ACC_STATIC
>      Code:
>        stack=2, locals=0, args_size=0
>           0: ldc2_w        #7                  // long -2767605614048989439l
>           3: putstatic     #12                 // Field serialVersionUID:J
>           6: iconst_1
>           7: iconst_m1
>           8: iadd
>           9: ifge          0
>          12: return
>        StackMapTable: number_of_entries = 1
>          frame_type = 0 /* same */
>
>    public static void main(java.lang.String[]);
>      descriptor: ([Ljava/lang/String;)V
>      flags: ACC_PUBLIC, ACC_STATIC
>      Code:
>        stack=0, locals=1, args_size=1
>           0: return
>  }
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: aot compiler halts when there exists an infinite loop in clinit()

Vladimir Kozlov
On 4/18/17 2:20 PM, Yuting Chen wrote:
> Hi, are there any comments to this case? I found that the clinit
> method will be compiled if it does not contain the infinite loop. Does
> it mean that clinit will run before it is compiled.

Yes, AOT compiler will run class initializer since it needs to access
static fields and other values.

Vladimir

>
> Re-paste the bytecode:
>
> public class Vector1
>   minor version: 0
>   major version: 52
>   flags: ACC_PUBLIC, ACC_SUPER
> Constant pool:
>    #1 = Utf8               Vector1
>    #2 = Class              #1             // Vector1
>    #3 = Utf8               java/lang/Object
>    #4 = Class              #3             // java/lang/Object
>    #5 = Utf8               serialVersionUID
>    #6 = Utf8               J
>    #7 = Long               -2767605614048989439l
>    #9 = Utf8               <clinit>
>   #10 = Utf8               ()V
>   #11 = NameAndType        #5:#6          // serialVersionUID:J
>   #12 = Fieldref           #2.#11         // Vector1.serialVersionUID:J
>   #13 = Utf8               main
>   #14 = Utf8               ([Ljava/lang/String;)V
>   #15 = Utf8               ConstantValue
>   #16 = Utf8               Code
>   #17 = Utf8               StackMapTable
> {
>   public static {};
>     descriptor: ()V
>     flags: ACC_PUBLIC, ACC_STATIC
>     Code:
>       stack=2, locals=0, args_size=0
>          0: ldc2_w        #7                  // long -2767605614048989439l
>          3: putstatic     #12                 // Field serialVersionUID:J
>          6: iconst_1
>          7: iconst_m1
>          8: iadd
>          9: ifge          0
>         12: return
>       StackMapTable: number_of_entries = 1
>         frame_type = 0 /* same */
>
>   public static void main(java.lang.String[]);
>     descriptor: ([Ljava/lang/String;)V
>     flags: ACC_PUBLIC, ACC_STATIC
>     Code:
>       stack=0, locals=1, args_size=1
>          0: return
> }
>
> On Tue, Apr 18, 2017 at 9:41 AM, Yuting Chen <[hidden email]> wrote:
>> Hi, are there any comments to this case? I found that the clinit
>> method will be compiled if it does not contain the infinite loop. It's
>> weird.
>>
>> The bytecode is shown as follows:
>>
>>  public class Vector1
>>    minor version: 0
>>    major version: 52
>>    flags: ACC_PUBLIC, ACC_SUPER
>>  Constant pool:
>>     #1 = Utf8               Vector1
>>     #2 = Class              #1             // Vector1
>>     #3 = Utf8               java/lang/Object
>>     #4 = Class              #3             // java/lang/Object
>>     #5 = Utf8               serialVersionUID
>>     #6 = Utf8               J
>>     #7 = Long               -2767605614048989439l
>>     #9 = Utf8               <clinit>
>>    #10 = Utf8               ()V
>>    #11 = NameAndType        #5:#6          // serialVersionUID:J
>>    #12 = Fieldref           #2.#11         // Vector1.serialVersionUID:J
>>    #13 = Utf8               main
>>    #14 = Utf8               ([Ljava/lang/String;)V
>>    #15 = Utf8               ConstantValue
>>    #16 = Utf8               Code
>>    #17 = Utf8               StackMapTable
>>  {
>>    public static {};
>>      descriptor: ()V
>>      flags: ACC_PUBLIC, ACC_STATIC
>>      Code:
>>        stack=2, locals=0, args_size=0
>>           0: ldc2_w        #7                  // long -2767605614048989439l
>>           3: putstatic     #12                 // Field serialVersionUID:J
>>           6: iconst_1
>>           7: iconst_m1
>>           8: iadd
>>           9: ifge          0
>>          12: return
>>        StackMapTable: number_of_entries = 1
>>          frame_type = 0 /* same */
>>
>>    public static void main(java.lang.String[]);
>>      descriptor: ([Ljava/lang/String;)V
>>      flags: ACC_PUBLIC, ACC_STATIC
>>      Code:
>>        stack=0, locals=1, args_size=1
>>           0: return
>>  }
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: aot compiler halts when there exists an infinite loop in clinit()

Yuting Chen-2
Thank you, Vladimir. Should it be better if the compiler can report a
timeout error for such a class initializer?

On Tue, Apr 18, 2017 at 4:46 PM, Vladimir Kozlov
<[hidden email]> wrote:

> On 4/18/17 2:20 PM, Yuting Chen wrote:
>>
>> Hi, are there any comments to this case? I found that the clinit
>> method will be compiled if it does not contain the infinite loop. Does
>> it mean that clinit will run before it is compiled.
>
>
> Yes, AOT compiler will run class initializer since it needs to access static
> fields and other values.
>
> Vladimir
>
>
>>
>> Re-paste the bytecode:
>>
>> public class Vector1
>>   minor version: 0
>>   major version: 52
>>   flags: ACC_PUBLIC, ACC_SUPER
>> Constant pool:
>>    #1 = Utf8               Vector1
>>    #2 = Class              #1             // Vector1
>>    #3 = Utf8               java/lang/Object
>>    #4 = Class              #3             // java/lang/Object
>>    #5 = Utf8               serialVersionUID
>>    #6 = Utf8               J
>>    #7 = Long               -2767605614048989439l
>>    #9 = Utf8               <clinit>
>>   #10 = Utf8               ()V
>>   #11 = NameAndType        #5:#6          // serialVersionUID:J
>>   #12 = Fieldref           #2.#11         // Vector1.serialVersionUID:J
>>   #13 = Utf8               main
>>   #14 = Utf8               ([Ljava/lang/String;)V
>>   #15 = Utf8               ConstantValue
>>   #16 = Utf8               Code
>>   #17 = Utf8               StackMapTable
>> {
>>   public static {};
>>     descriptor: ()V
>>     flags: ACC_PUBLIC, ACC_STATIC
>>     Code:
>>       stack=2, locals=0, args_size=0
>>          0: ldc2_w        #7                  // long
>> -2767605614048989439l
>>          3: putstatic     #12                 // Field serialVersionUID:J
>>          6: iconst_1
>>          7: iconst_m1
>>          8: iadd
>>          9: ifge          0
>>         12: return
>>       StackMapTable: number_of_entries = 1
>>         frame_type = 0 /* same */
>>
>>   public static void main(java.lang.String[]);
>>     descriptor: ([Ljava/lang/String;)V
>>     flags: ACC_PUBLIC, ACC_STATIC
>>     Code:
>>       stack=0, locals=1, args_size=1
>>          0: return
>> }
>>
>> On Tue, Apr 18, 2017 at 9:41 AM, Yuting Chen <[hidden email]>
>> wrote:
>>>
>>> Hi, are there any comments to this case? I found that the clinit
>>> method will be compiled if it does not contain the infinite loop. It's
>>> weird.
>>>
>>> The bytecode is shown as follows:
>>>
>>>  public class Vector1
>>>    minor version: 0
>>>    major version: 52
>>>    flags: ACC_PUBLIC, ACC_SUPER
>>>  Constant pool:
>>>     #1 = Utf8               Vector1
>>>     #2 = Class              #1             // Vector1
>>>     #3 = Utf8               java/lang/Object
>>>     #4 = Class              #3             // java/lang/Object
>>>     #5 = Utf8               serialVersionUID
>>>     #6 = Utf8               J
>>>     #7 = Long               -2767605614048989439l
>>>     #9 = Utf8               <clinit>
>>>    #10 = Utf8               ()V
>>>    #11 = NameAndType        #5:#6          // serialVersionUID:J
>>>    #12 = Fieldref           #2.#11         // Vector1.serialVersionUID:J
>>>    #13 = Utf8               main
>>>    #14 = Utf8               ([Ljava/lang/String;)V
>>>    #15 = Utf8               ConstantValue
>>>    #16 = Utf8               Code
>>>    #17 = Utf8               StackMapTable
>>>  {
>>>    public static {};
>>>      descriptor: ()V
>>>      flags: ACC_PUBLIC, ACC_STATIC
>>>      Code:
>>>        stack=2, locals=0, args_size=0
>>>           0: ldc2_w        #7                  // long
>>> -2767605614048989439l
>>>           3: putstatic     #12                 // Field
>>> serialVersionUID:J
>>>           6: iconst_1
>>>           7: iconst_m1
>>>           8: iadd
>>>           9: ifge          0
>>>          12: return
>>>        StackMapTable: number_of_entries = 1
>>>          frame_type = 0 /* same */
>>>
>>>    public static void main(java.lang.String[]);
>>>      descriptor: ([Ljava/lang/String;)V
>>>      flags: ACC_PUBLIC, ACC_STATIC
>>>      Code:
>>>        stack=0, locals=1, args_size=1
>>>           0: return
>>>  }
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: aot compiler halts when there exists an infinite loop in clinit()

Yuting Chen-2
Besides,  if a class initializer writes into an external file (or make
some computations), the compiler will have side effects when compiling
the corresponding class, :).

On Tue, Apr 18, 2017 at 5:17 PM, Yuting Chen <[hidden email]> wrote:

> Thank you, Vladimir. Should it be better if the compiler can report a
> timeout error for such a class initializer?
>
> On Tue, Apr 18, 2017 at 4:46 PM, Vladimir Kozlov
> <[hidden email]> wrote:
>> On 4/18/17 2:20 PM, Yuting Chen wrote:
>>>
>>> Hi, are there any comments to this case? I found that the clinit
>>> method will be compiled if it does not contain the infinite loop. Does
>>> it mean that clinit will run before it is compiled.
>>
>>
>> Yes, AOT compiler will run class initializer since it needs to access static
>> fields and other values.
>>
>> Vladimir
>>
>>
>>>
>>> Re-paste the bytecode:
>>>
>>> public class Vector1
>>>   minor version: 0
>>>   major version: 52
>>>   flags: ACC_PUBLIC, ACC_SUPER
>>> Constant pool:
>>>    #1 = Utf8               Vector1
>>>    #2 = Class              #1             // Vector1
>>>    #3 = Utf8               java/lang/Object
>>>    #4 = Class              #3             // java/lang/Object
>>>    #5 = Utf8               serialVersionUID
>>>    #6 = Utf8               J
>>>    #7 = Long               -2767605614048989439l
>>>    #9 = Utf8               <clinit>
>>>   #10 = Utf8               ()V
>>>   #11 = NameAndType        #5:#6          // serialVersionUID:J
>>>   #12 = Fieldref           #2.#11         // Vector1.serialVersionUID:J
>>>   #13 = Utf8               main
>>>   #14 = Utf8               ([Ljava/lang/String;)V
>>>   #15 = Utf8               ConstantValue
>>>   #16 = Utf8               Code
>>>   #17 = Utf8               StackMapTable
>>> {
>>>   public static {};
>>>     descriptor: ()V
>>>     flags: ACC_PUBLIC, ACC_STATIC
>>>     Code:
>>>       stack=2, locals=0, args_size=0
>>>          0: ldc2_w        #7                  // long
>>> -2767605614048989439l
>>>          3: putstatic     #12                 // Field serialVersionUID:J
>>>          6: iconst_1
>>>          7: iconst_m1
>>>          8: iadd
>>>          9: ifge          0
>>>         12: return
>>>       StackMapTable: number_of_entries = 1
>>>         frame_type = 0 /* same */
>>>
>>>   public static void main(java.lang.String[]);
>>>     descriptor: ([Ljava/lang/String;)V
>>>     flags: ACC_PUBLIC, ACC_STATIC
>>>     Code:
>>>       stack=0, locals=1, args_size=1
>>>          0: return
>>> }
>>>
>>> On Tue, Apr 18, 2017 at 9:41 AM, Yuting Chen <[hidden email]>
>>> wrote:
>>>>
>>>> Hi, are there any comments to this case? I found that the clinit
>>>> method will be compiled if it does not contain the infinite loop. It's
>>>> weird.
>>>>
>>>> The bytecode is shown as follows:
>>>>
>>>>  public class Vector1
>>>>    minor version: 0
>>>>    major version: 52
>>>>    flags: ACC_PUBLIC, ACC_SUPER
>>>>  Constant pool:
>>>>     #1 = Utf8               Vector1
>>>>     #2 = Class              #1             // Vector1
>>>>     #3 = Utf8               java/lang/Object
>>>>     #4 = Class              #3             // java/lang/Object
>>>>     #5 = Utf8               serialVersionUID
>>>>     #6 = Utf8               J
>>>>     #7 = Long               -2767605614048989439l
>>>>     #9 = Utf8               <clinit>
>>>>    #10 = Utf8               ()V
>>>>    #11 = NameAndType        #5:#6          // serialVersionUID:J
>>>>    #12 = Fieldref           #2.#11         // Vector1.serialVersionUID:J
>>>>    #13 = Utf8               main
>>>>    #14 = Utf8               ([Ljava/lang/String;)V
>>>>    #15 = Utf8               ConstantValue
>>>>    #16 = Utf8               Code
>>>>    #17 = Utf8               StackMapTable
>>>>  {
>>>>    public static {};
>>>>      descriptor: ()V
>>>>      flags: ACC_PUBLIC, ACC_STATIC
>>>>      Code:
>>>>        stack=2, locals=0, args_size=0
>>>>           0: ldc2_w        #7                  // long
>>>> -2767605614048989439l
>>>>           3: putstatic     #12                 // Field
>>>> serialVersionUID:J
>>>>           6: iconst_1
>>>>           7: iconst_m1
>>>>           8: iadd
>>>>           9: ifge          0
>>>>          12: return
>>>>        StackMapTable: number_of_entries = 1
>>>>          frame_type = 0 /* same */
>>>>
>>>>    public static void main(java.lang.String[]);
>>>>      descriptor: ([Ljava/lang/String;)V
>>>>      flags: ACC_PUBLIC, ACC_STATIC
>>>>      Code:
>>>>        stack=0, locals=1, args_size=1
>>>>           0: return
>>>>  }
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: aot compiler halts when there exists an infinite loop in clinit()

Igor Veresov
We know :)



igor

On Apr 18, 2017, at 7:09 PM, Yuting Chen <[hidden email]> wrote:

Besides,  if a class initializer writes into an external file (or make
some computations), the compiler will have side effects when compiling
the corresponding class, :).

On Tue, Apr 18, 2017 at 5:17 PM, Yuting Chen <[hidden email]> wrote:
Thank you, Vladimir. Should it be better if the compiler can report a
timeout error for such a class initializer?

On Tue, Apr 18, 2017 at 4:46 PM, Vladimir Kozlov
<[hidden email]> wrote:
On 4/18/17 2:20 PM, Yuting Chen wrote:

Hi, are there any comments to this case? I found that the clinit
method will be compiled if it does not contain the infinite loop. Does
it mean that clinit will run before it is compiled.


Yes, AOT compiler will run class initializer since it needs to access static
fields and other values.

Vladimir



Re-paste the bytecode:

public class Vector1
 minor version: 0
 major version: 52
 flags: ACC_PUBLIC, ACC_SUPER
Constant pool:
  #1 = Utf8               Vector1
  #2 = Class              #1             // Vector1
  #3 = Utf8               java/lang/Object
  #4 = Class              #3             // java/lang/Object
  #5 = Utf8               serialVersionUID
  #6 = Utf8               J
  #7 = Long               -2767605614048989439l
  #9 = Utf8               <clinit>
 #10 = Utf8               ()V
 #11 = NameAndType        #5:#6          // serialVersionUID:J
 #12 = Fieldref           #2.#11         // Vector1.serialVersionUID:J
 #13 = Utf8               main
 #14 = Utf8               ([Ljava/lang/String;)V
 #15 = Utf8               ConstantValue
 #16 = Utf8               Code
 #17 = Utf8               StackMapTable
{
 public static {};
   descriptor: ()V
   flags: ACC_PUBLIC, ACC_STATIC
   Code:
     stack=2, locals=0, args_size=0
        0: ldc2_w        #7                  // long
-2767605614048989439l
        3: putstatic     #12                 // Field serialVersionUID:J
        6: iconst_1
        7: iconst_m1
        8: iadd
        9: ifge          0
       12: return
     StackMapTable: number_of_entries = 1
       frame_type = 0 /* same */

 public static void main(java.lang.String[]);
   descriptor: ([Ljava/lang/String;)V
   flags: ACC_PUBLIC, ACC_STATIC
   Code:
     stack=0, locals=1, args_size=1
        0: return
}

On Tue, Apr 18, 2017 at 9:41 AM, Yuting Chen <[hidden email]>
wrote:

Hi, are there any comments to this case? I found that the clinit
method will be compiled if it does not contain the infinite loop. It's
weird.

The bytecode is shown as follows:

public class Vector1
  minor version: 0
  major version: 52
  flags: ACC_PUBLIC, ACC_SUPER
Constant pool:
   #1 = Utf8               Vector1
   #2 = Class              #1             // Vector1
   #3 = Utf8               java/lang/Object
   #4 = Class              #3             // java/lang/Object
   #5 = Utf8               serialVersionUID
   #6 = Utf8               J
   #7 = Long               -2767605614048989439l
   #9 = Utf8               <clinit>
  #10 = Utf8               ()V
  #11 = NameAndType        #5:#6          // serialVersionUID:J
  #12 = Fieldref           #2.#11         // Vector1.serialVersionUID:J
  #13 = Utf8               main
  #14 = Utf8               ([Ljava/lang/String;)V
  #15 = Utf8               ConstantValue
  #16 = Utf8               Code
  #17 = Utf8               StackMapTable
{
  public static {};
    descriptor: ()V
    flags: ACC_PUBLIC, ACC_STATIC
    Code:
      stack=2, locals=0, args_size=0
         0: ldc2_w        #7                  // long
-2767605614048989439l
         3: putstatic     #12                 // Field
serialVersionUID:J
         6: iconst_1
         7: iconst_m1
         8: iadd
         9: ifge          0
        12: return
      StackMapTable: number_of_entries = 1
        frame_type = 0 /* same */

  public static void main(java.lang.String[]);
    descriptor: ([Ljava/lang/String;)V
    flags: ACC_PUBLIC, ACC_STATIC
    Code:
      stack=0, locals=1, args_size=1
         0: return
}

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: aot compiler halts when there exists an infinite loop in clinit()

Yuting Chen-2
Thank you, Igor. I can understand now:)

I'd expect that some timeout messages will be provided if the compiler
hangs (a quick patch?). I compiled some pieces of bytecode and waited
for the whole night...

Regards,
Yuting

On Tue, Apr 18, 2017 at 8:15 PM, Igor Veresov <[hidden email]> wrote:

> We know :)
>
> https://bugs.openjdk.java.net/browse/JDK-8146201
>
>
> igor
>
> On Apr 18, 2017, at 7:09 PM, Yuting Chen <[hidden email]> wrote:
>
> Besides,  if a class initializer writes into an external file (or make
> some computations), the compiler will have side effects when compiling
> the corresponding class, :).
>
> On Tue, Apr 18, 2017 at 5:17 PM, Yuting Chen <[hidden email]>
> wrote:
>
> Thank you, Vladimir. Should it be better if the compiler can report a
> timeout error for such a class initializer?
>
> On Tue, Apr 18, 2017 at 4:46 PM, Vladimir Kozlov
> <[hidden email]> wrote:
>
> On 4/18/17 2:20 PM, Yuting Chen wrote:
>
>
> Hi, are there any comments to this case? I found that the clinit
> method will be compiled if it does not contain the infinite loop. Does
> it mean that clinit will run before it is compiled.
>
>
>
> Yes, AOT compiler will run class initializer since it needs to access static
> fields and other values.
>
> Vladimir
>
>
>
> Re-paste the bytecode:
>
> public class Vector1
>  minor version: 0
>  major version: 52
>  flags: ACC_PUBLIC, ACC_SUPER
> Constant pool:
>   #1 = Utf8               Vector1
>   #2 = Class              #1             // Vector1
>   #3 = Utf8               java/lang/Object
>   #4 = Class              #3             // java/lang/Object
>   #5 = Utf8               serialVersionUID
>   #6 = Utf8               J
>   #7 = Long               -2767605614048989439l
>   #9 = Utf8               <clinit>
>  #10 = Utf8               ()V
>  #11 = NameAndType        #5:#6          // serialVersionUID:J
>  #12 = Fieldref           #2.#11         // Vector1.serialVersionUID:J
>  #13 = Utf8               main
>  #14 = Utf8               ([Ljava/lang/String;)V
>  #15 = Utf8               ConstantValue
>  #16 = Utf8               Code
>  #17 = Utf8               StackMapTable
> {
>  public static {};
>    descriptor: ()V
>    flags: ACC_PUBLIC, ACC_STATIC
>    Code:
>      stack=2, locals=0, args_size=0
>         0: ldc2_w        #7                  // long
> -2767605614048989439l
>         3: putstatic     #12                 // Field serialVersionUID:J
>         6: iconst_1
>         7: iconst_m1
>         8: iadd
>         9: ifge          0
>        12: return
>      StackMapTable: number_of_entries = 1
>        frame_type = 0 /* same */
>
>  public static void main(java.lang.String[]);
>    descriptor: ([Ljava/lang/String;)V
>    flags: ACC_PUBLIC, ACC_STATIC
>    Code:
>      stack=0, locals=1, args_size=1
>         0: return
> }
>
> On Tue, Apr 18, 2017 at 9:41 AM, Yuting Chen <[hidden email]>
> wrote:
>
>
> Hi, are there any comments to this case? I found that the clinit
> method will be compiled if it does not contain the infinite loop. It's
> weird.
>
> The bytecode is shown as follows:
>
> public class Vector1
>   minor version: 0
>   major version: 52
>   flags: ACC_PUBLIC, ACC_SUPER
> Constant pool:
>    #1 = Utf8               Vector1
>    #2 = Class              #1             // Vector1
>    #3 = Utf8               java/lang/Object
>    #4 = Class              #3             // java/lang/Object
>    #5 = Utf8               serialVersionUID
>    #6 = Utf8               J
>    #7 = Long               -2767605614048989439l
>    #9 = Utf8               <clinit>
>   #10 = Utf8               ()V
>   #11 = NameAndType        #5:#6          // serialVersionUID:J
>   #12 = Fieldref           #2.#11         // Vector1.serialVersionUID:J
>   #13 = Utf8               main
>   #14 = Utf8               ([Ljava/lang/String;)V
>   #15 = Utf8               ConstantValue
>   #16 = Utf8               Code
>   #17 = Utf8               StackMapTable
> {
>   public static {};
>     descriptor: ()V
>     flags: ACC_PUBLIC, ACC_STATIC
>     Code:
>       stack=2, locals=0, args_size=0
>          0: ldc2_w        #7                  // long
> -2767605614048989439l
>          3: putstatic     #12                 // Field
> serialVersionUID:J
>          6: iconst_1
>          7: iconst_m1
>          8: iadd
>          9: ifge          0
>         12: return
>       StackMapTable: number_of_entries = 1
>         frame_type = 0 /* same */
>
>   public static void main(java.lang.String[]);
>     descriptor: ([Ljava/lang/String;)V
>     flags: ACC_PUBLIC, ACC_STATIC
>     Code:
>       stack=0, locals=1, args_size=1
>          0: return
> }
>
>
Loading...