@@ -3410,4 +3410,124 @@ public void test125_verifier(boolean warmup) {
3410
3410
test125 (testValue1 );
3411
3411
test125 (null );
3412
3412
}
3413
+
3414
+ // Test inline type that can only be scalarized after loop opts
3415
+ @ Test (failOn = ALLOC + LOAD + STORE )
3416
+ @ Warmup (10000 )
3417
+ public long test126 (boolean trap ) {
3418
+ MyValue2 nonNull = MyValue2 .createWithFieldsInline (rI , rD );
3419
+ MyValue2 .ref val = null ;
3420
+
3421
+ for (int i = 0 ; i < 4 ; i ++) {
3422
+ if ((i % 2 ) == 0 ) {
3423
+ val = nonNull ;
3424
+ }
3425
+ }
3426
+ // 'val' is always non-null here but that's only known after loop opts
3427
+ if (trap ) {
3428
+ // Uncommon trap with an inline input that can only be scalarized after loop opts
3429
+ return val .hash ();
3430
+ }
3431
+ return 0 ;
3432
+ }
3433
+
3434
+ @ DontCompile
3435
+ public void test126_verifier (boolean warmup ) {
3436
+ long res = test126 (false );
3437
+ Asserts .assertEquals (res , 0L );
3438
+ if (!warmup ) {
3439
+ res = test126 (true );
3440
+ Asserts .assertEquals (res , testValue2 .hash ());
3441
+ }
3442
+ }
3443
+
3444
+ // Same as test126 but with interface type
3445
+ @ Test (failOn = ALLOC + LOAD + STORE )
3446
+ @ Warmup (10000 )
3447
+ public long test127 (boolean trap ) {
3448
+ MyValue2 nonNull = MyValue2 .createWithFieldsInline (rI , rD );
3449
+ MyInterface val = null ;
3450
+
3451
+ for (int i = 0 ; i < 4 ; i ++) {
3452
+ if ((i % 2 ) == 0 ) {
3453
+ val = nonNull ;
3454
+ }
3455
+ }
3456
+ // 'val' is always non-null here but that's only known after loop opts
3457
+ if (trap ) {
3458
+ // Uncommon trap with an inline input that can only be scalarized after loop opts
3459
+ return val .hash ();
3460
+ }
3461
+ return 0 ;
3462
+ }
3463
+
3464
+ @ DontCompile
3465
+ public void test127_verifier (boolean warmup ) {
3466
+ long res = test127 (false );
3467
+ Asserts .assertEquals (res , 0L );
3468
+ if (!warmup ) {
3469
+ res = test127 (true );
3470
+ Asserts .assertEquals (res , testValue2 .hash ());
3471
+ }
3472
+ }
3473
+
3474
+ // Test inline type that can only be scalarized after CCP
3475
+ @ Test (failOn = ALLOC + LOAD + STORE )
3476
+ @ Warmup (10000 )
3477
+ public long test128 (boolean trap ) {
3478
+ MyValue2 nonNull = MyValue2 .createWithFieldsInline (rI , rD );
3479
+ MyValue2 .ref val = null ;
3480
+
3481
+ int limit = 2 ;
3482
+ for (; limit < 4 ; limit *= 2 );
3483
+ for (int i = 2 ; i < limit ; i ++) {
3484
+ val = nonNull ;
3485
+ }
3486
+ // 'val' is always non-null here but that's only known after CCP
3487
+ if (trap ) {
3488
+ // Uncommon trap with an inline input that can only be scalarized after CCP
3489
+ return val .hash ();
3490
+ }
3491
+ return 0 ;
3492
+ }
3493
+
3494
+ @ DontCompile
3495
+ public void test128_verifier (boolean warmup ) {
3496
+ long res = test128 (false );
3497
+ Asserts .assertEquals (res , 0L );
3498
+ if (!warmup ) {
3499
+ res = test128 (true );
3500
+ Asserts .assertEquals (res , testValue2 .hash ());
3501
+ }
3502
+ }
3503
+
3504
+ // Same as test128 but with interface type
3505
+ @ Test (failOn = ALLOC + LOAD + STORE )
3506
+ @ Warmup (10000 )
3507
+ public long test129 (boolean trap ) {
3508
+ MyValue2 nonNull = MyValue2 .createWithFieldsInline (rI , rD );
3509
+ MyInterface val = null ;
3510
+
3511
+ int limit = 2 ;
3512
+ for (; limit < 4 ; limit *= 2 );
3513
+ for (int i = 0 ; i < limit ; i ++) {
3514
+ val = nonNull ;
3515
+ }
3516
+ // 'val' is always non-null here but that's only known after CCP
3517
+ if (trap ) {
3518
+ // Uncommon trap with an inline input that can only be scalarized after CCP
3519
+ return val .hash ();
3520
+ }
3521
+ return 0 ;
3522
+ }
3523
+
3524
+ @ DontCompile
3525
+ public void test129_verifier (boolean warmup ) {
3526
+ long res = test129 (false );
3527
+ Asserts .assertEquals (res , 0L );
3528
+ if (!warmup ) {
3529
+ res = test129 (true );
3530
+ Asserts .assertEquals (res , testValue2 .hash ());
3531
+ }
3532
+ }
3413
3533
}
0 commit comments