@@ -1964,9 +1964,9 @@ private Object bytecodeLoop(VirtualFrame virtualFrame, Frame localFrame, Bytecod
1964
1964
@ ExplodeLoop
1965
1965
private void unboxVariables (Frame localFrame ) {
1966
1966
/*
1967
- * We keep some variables boxed in the interpreter, but unbox in the compiled code. After
1968
- * OSR we need to unbox existing variables for the compiled code. Should have no effect
1969
- * otherwise.
1967
+ * We keep some variables boxed in the interpreter, but unbox in the compiled code. When OSR
1968
+ * is entered, we need to unbox existing variables for the compiled code. Should have no
1969
+ * effect otherwise.
1970
1970
*/
1971
1971
for (int i = 0 ; i < variableTypes .length ; i ++) {
1972
1972
if (variableTypes [i ] != 0 && variableTypes [i ] != QuickeningTypes .OBJECT && localFrame .isObject (i )) {
@@ -2495,12 +2495,13 @@ private void bytecodeStoreFastAdaptive(VirtualFrame virtualFrame, Frame localFra
2495
2495
byte itemType = stackType ;
2496
2496
boolean unboxInIntepreter = (variableShouldUnbox [index ] & itemType ) != 0 ;
2497
2497
if (itemType == QuickeningTypes .OBJECT ) {
2498
- itemType = objectTypeId (virtualFrame .getObject (stackTop ));
2498
+ itemType = QuickeningTypes . fromObjectType (virtualFrame .getObject (stackTop ));
2499
2499
}
2500
- if (variableTypes [index ] == 0 ) {
2501
- variableTypes [index ] = itemType ;
2502
- } else if (variableTypes [index ] != itemType ) {
2503
- if (variableTypes [index ] != QuickeningTypes .OBJECT ) {
2500
+ byte variableType = variableTypes [index ];
2501
+ if (variableType == 0 ) {
2502
+ variableType = itemType ;
2503
+ } else if ((variableType & ~UNBOXED_IN_INTERPRETER ) != itemType ) {
2504
+ if (variableType != QuickeningTypes .OBJECT ) {
2504
2505
variableTypes [index ] = QuickeningTypes .OBJECT ;
2505
2506
generalizeVariableStores (index );
2506
2507
}
@@ -2512,17 +2513,19 @@ private void bytecodeStoreFastAdaptive(VirtualFrame virtualFrame, Frame localFra
2512
2513
bytecodeStoreFastO (virtualFrame , localFrame , stackTop , index );
2513
2514
return ;
2514
2515
}
2515
- assert variableTypes [index ] == itemType ;
2516
2516
if (itemType == QuickeningTypes .INT ) {
2517
2517
if (unboxInIntepreter && stackType == QuickeningTypes .INT ) {
2518
2518
localBC [bci ] = OpCodesConstants .STORE_FAST_I ;
2519
- variableTypes [index ] |= UNBOXED_IN_INTERPRETER ;
2519
+ variableType |= UNBOXED_IN_INTERPRETER ;
2520
+ variableTypes [index ] = variableType ;
2520
2521
bytecodeStoreFastI (virtualFrame , localFrame , stackTop , bci , index );
2521
2522
} else if (unboxInIntepreter ) {
2522
2523
localBC [bci ] = OpCodesConstants .STORE_FAST_UNBOX_I ;
2523
- variableTypes [index ] |= UNBOXED_IN_INTERPRETER ;
2524
+ variableType |= UNBOXED_IN_INTERPRETER ;
2525
+ variableTypes [index ] = variableType ;
2524
2526
bytecodeStoreFastUnboxI (virtualFrame , localFrame , stackTop , bci , index );
2525
2527
} else {
2528
+ variableTypes [index ] = variableType ;
2526
2529
if (stackType == QuickeningTypes .INT ) {
2527
2530
virtualFrame .setObject (stackTop , virtualFrame .getInt (stackTop ));
2528
2531
generalizeInputs (bci );
@@ -2534,13 +2537,16 @@ private void bytecodeStoreFastAdaptive(VirtualFrame virtualFrame, Frame localFra
2534
2537
} else if (itemType == QuickeningTypes .BOOLEAN ) {
2535
2538
if (unboxInIntepreter && stackType == QuickeningTypes .BOOLEAN ) {
2536
2539
localBC [bci ] = OpCodesConstants .STORE_FAST_B ;
2537
- variableTypes [index ] |= UNBOXED_IN_INTERPRETER ;
2540
+ variableType |= UNBOXED_IN_INTERPRETER ;
2541
+ variableTypes [index ] = variableType ;
2538
2542
bytecodeStoreFastB (virtualFrame , localFrame , stackTop , bci , index );
2539
2543
} else if (unboxInIntepreter ) {
2540
2544
localBC [bci ] = OpCodesConstants .STORE_FAST_UNBOX_B ;
2541
- variableTypes [index ] |= UNBOXED_IN_INTERPRETER ;
2545
+ variableType |= UNBOXED_IN_INTERPRETER ;
2546
+ variableTypes [index ] = variableType ;
2542
2547
bytecodeStoreFastUnboxB (virtualFrame , localFrame , stackTop , bci , index );
2543
2548
} else {
2549
+ variableTypes [index ] = variableType ;
2544
2550
if (stackType == QuickeningTypes .BOOLEAN ) {
2545
2551
virtualFrame .setObject (stackTop , virtualFrame .getBoolean (stackTop ));
2546
2552
generalizeInputs (bci );
@@ -2550,11 +2556,13 @@ private void bytecodeStoreFastAdaptive(VirtualFrame virtualFrame, Frame localFra
2550
2556
}
2551
2557
return ;
2552
2558
} else if (itemType == QuickeningTypes .OBJECT ) {
2559
+ variableTypes [index ] = variableType ;
2553
2560
localBC [bci ] = OpCodesConstants .STORE_FAST_O ;
2554
2561
bytecodeStoreFastO (virtualFrame , localFrame , stackTop , index );
2555
2562
return ;
2556
2563
}
2557
2564
// TODO other types
2565
+ variableTypes [index ] = QuickeningTypes .OBJECT ;
2558
2566
generalizeInputs (bci );
2559
2567
generalizeVariableStores (index );
2560
2568
virtualFrame .setObject (stackTop , virtualFrame .getValue (stackTop ));
@@ -2790,34 +2798,8 @@ private void bytecodeLoadFastO(VirtualFrame virtualFrame, Frame localFrame, int
2790
2798
virtualFrame .setObject (stackTop , value );
2791
2799
}
2792
2800
2793
- private byte stackSlotTypeToTypeId (VirtualFrame virtualFrame , int stackTop ) {
2794
- if (virtualFrame .isObject (stackTop )) {
2795
- return QuickeningTypes .OBJECT ;
2796
- } else if (virtualFrame .isInt (stackTop )) {
2797
- return QuickeningTypes .INT ;
2798
- } else if (virtualFrame .isLong (stackTop )) {
2799
- return QuickeningTypes .LONG ;
2800
- } else if (virtualFrame .isDouble (stackTop )) {
2801
- return QuickeningTypes .DOUBLE ;
2802
- } else if (virtualFrame .isBoolean (stackTop )) {
2803
- return QuickeningTypes .BOOLEAN ;
2804
- } else {
2805
- throw CompilerDirectives .shouldNotReachHere ("Unknown stack item type" );
2806
- }
2807
- }
2808
-
2809
- private byte objectTypeId (Object object ) {
2810
- if (object instanceof Integer ) {
2811
- return QuickeningTypes .INT ;
2812
- } else if (object instanceof Long ) {
2813
- return QuickeningTypes .LONG ;
2814
- } else if (object instanceof Double ) {
2815
- return QuickeningTypes .DOUBLE ;
2816
- } else if (object instanceof Boolean ) {
2817
- return QuickeningTypes .BOOLEAN ;
2818
- } else {
2819
- return QuickeningTypes .OBJECT ;
2820
- }
2801
+ private static byte stackSlotTypeToTypeId (VirtualFrame virtualFrame , int stackTop ) {
2802
+ return QuickeningTypes .fromFrameSlotTag (virtualFrame .getTag (stackTop ));
2821
2803
}
2822
2804
2823
2805
private void generalizeInputs (int beginBci ) {
0 commit comments