100100import com .oracle .graal .python .builtins .objects .slice .PSlice ;
101101import com .oracle .graal .python .builtins .objects .slice .SliceNodes .CreateSliceNode ;
102102import com .oracle .graal .python .builtins .objects .slice .SliceNodesFactory .CreateSliceNodeGen ;
103- import com .oracle .graal .python .lib .RichCmpOp ;
104103import com .oracle .graal .python .compiler .BinaryOpsConstants ;
105104import com .oracle .graal .python .compiler .CodeUnit ;
106105import com .oracle .graal .python .compiler .FormatOptions ;
164163import com .oracle .graal .python .lib .PyObjectSizeNodeGen ;
165164import com .oracle .graal .python .lib .PyObjectStrAsObjectNode ;
166165import com .oracle .graal .python .lib .PyObjectStrAsObjectNodeGen ;
166+ import com .oracle .graal .python .lib .RichCmpOp ;
167167import com .oracle .graal .python .nodes .ErrorMessages ;
168168import com .oracle .graal .python .nodes .PRaiseNode ;
169169import com .oracle .graal .python .nodes .PRootNode ;
@@ -1965,7 +1965,9 @@ private Object bytecodeLoop(VirtualFrame virtualFrame, Frame localFrame, Bytecod
19651965 generalizePopAndJumpIfFalseB (bci );
19661966 continue ;
19671967 }
1968- if (profileCondition (!virtualFrame .getBoolean (stackTop --), localBC , bci , useCachedNodes )) {
1968+ boolean cond = virtualFrame .getBoolean (stackTop );
1969+ clearInCompiledCode (virtualFrame , stackTop --);
1970+ if (profileCondition (!cond , localBC , bci , useCachedNodes )) {
19691971 oparg |= Byte .toUnsignedInt (localBC [bci + 1 ]);
19701972 bci += oparg ;
19711973 oparg = 0 ;
@@ -1981,7 +1983,9 @@ private Object bytecodeLoop(VirtualFrame virtualFrame, Frame localFrame, Bytecod
19811983 generalizePopAndJumpIfTrueB (bci );
19821984 continue ;
19831985 }
1984- if (profileCondition (virtualFrame .getBoolean (stackTop --), localBC , bci , useCachedNodes )) {
1986+ boolean cond = virtualFrame .getBoolean (stackTop );
1987+ clearInCompiledCode (virtualFrame , stackTop --);
1988+ if (profileCondition (cond , localBC , bci , useCachedNodes )) {
19851989 oparg |= Byte .toUnsignedInt (localBC [bci + 1 ]);
19861990 bci += oparg ;
19871991 oparg = 0 ;
@@ -3031,7 +3035,7 @@ private int bytecodeBinarySubscrSeqIO(VirtualFrame virtualFrame, int stackTop, i
30313035 } catch (QuickeningGeneralizeException e ) {
30323036 return generalizeBinarySubscrSeq (virtualFrame , stackTop , bci , localNodes , e );
30333037 }
3034- virtualFrame . setObject ( stackTop --, null );
3038+ clearInCompiledCode ( virtualFrame , stackTop --);
30353039 virtualFrame .setObject (stackTop , value );
30363040 return stackTop ;
30373041 }
@@ -3050,7 +3054,7 @@ private int bytecodeBinarySubscrSeqII(VirtualFrame virtualFrame, int stackTop, i
30503054 } catch (QuickeningGeneralizeException e ) {
30513055 return generalizeBinarySubscrSeq (virtualFrame , stackTop , bci , localNodes , e );
30523056 }
3053- virtualFrame . setObject ( stackTop --, null );
3057+ clearInCompiledCode ( virtualFrame , stackTop --);
30543058 virtualFrame .setInt (stackTop , value );
30553059 return stackTop ;
30563060 }
@@ -3069,7 +3073,7 @@ private int bytecodeBinarySubscrSeqID(VirtualFrame virtualFrame, int stackTop, i
30693073 } catch (QuickeningGeneralizeException e ) {
30703074 return generalizeBinarySubscrSeq (virtualFrame , stackTop , bci , localNodes , e );
30713075 }
3072- virtualFrame . setObject ( stackTop --, null );
3076+ clearInCompiledCode ( virtualFrame , stackTop --);
30733077 virtualFrame .setDouble (stackTop , value );
30743078 return stackTop ;
30753079 }
@@ -3276,6 +3280,12 @@ private PException raiseUnknownBytecodeError(byte bc) {
32763280 throw PRaiseNode .raiseStatic (this , SystemError , format , OpCodes .fromOpCode (bc ));
32773281 }
32783282
3283+ private static void clearInCompiledCode (VirtualFrame virtualFrame , int stackTop ) {
3284+ if (CompilerDirectives .inCompiledCode ()) {
3285+ virtualFrame .clear (stackTop );
3286+ }
3287+ }
3288+
32793289 private void generalizeForIterI (int bci , QuickeningGeneralizeException e ) {
32803290 CompilerDirectives .transferToInterpreterAndInvalidate ();
32813291 if (e .type == QuickeningTypes .OBJECT ) {
@@ -3468,6 +3478,7 @@ private void bytecodeBinaryOpIIB(VirtualFrame virtualFrame, int stackTop, int bc
34683478 default :
34693479 throw CompilerDirectives .shouldNotReachHere ("Invalid operation for BINARY_OP_II_B" );
34703480 }
3481+ clearInCompiledCode (virtualFrame , stackTop );
34713482 virtualFrame .setBoolean (stackTop - 1 , result );
34723483 }
34733484
@@ -3562,7 +3573,7 @@ private void bytecodeBinaryOpIIO(VirtualFrame virtualFrame, int stackTop, int bc
35623573 default :
35633574 throw CompilerDirectives .shouldNotReachHere ("Invalid operation for BINARY_OP_II_O" );
35643575 }
3565- virtualFrame . setObject ( stackTop , null );
3576+ clearInCompiledCode ( virtualFrame , stackTop );
35663577 virtualFrame .setObject (stackTop - 1 , result );
35673578 }
35683579
@@ -3655,6 +3666,7 @@ private void bytecodeBinaryOpIII(VirtualFrame virtualFrame, int stackTop, int bc
36553666 generalizeBinaryOpIIIOverflow (virtualFrame , stackTop , bci , localNodes , op );
36563667 return ;
36573668 }
3669+ clearInCompiledCode (virtualFrame , stackTop );
36583670 virtualFrame .setInt (stackTop - 1 , result );
36593671 }
36603672
@@ -3707,6 +3719,7 @@ private void bytecodeBinaryOpDDD(VirtualFrame virtualFrame, int stackTop, int bc
37073719 generalizeBinaryOpDDDOverflow (virtualFrame , stackTop , bci , localNodes , op , useCachedNodes );
37083720 return ;
37093721 }
3722+ clearInCompiledCode (virtualFrame , stackTop );
37103723 virtualFrame .setDouble (stackTop - 1 , result );
37113724 }
37123725
@@ -3743,6 +3756,7 @@ private void bytecodeBinaryOpDDB(VirtualFrame virtualFrame, int stackTop, int bc
37433756 default :
37443757 throw CompilerDirectives .shouldNotReachHere ("Invalid operation for BINARY_OP_DD_B" );
37453758 }
3759+ clearInCompiledCode (virtualFrame , stackTop );
37463760 virtualFrame .setBoolean (stackTop - 1 , result );
37473761 }
37483762
@@ -3804,7 +3818,7 @@ private void bytecodeBinaryOpDDO(VirtualFrame virtualFrame, int stackTop, int bc
38043818 default :
38053819 throw CompilerDirectives .shouldNotReachHere ("Invalid operation for BINARY_OP_DD_O" );
38063820 }
3807- virtualFrame . setObject ( stackTop , null );
3821+ clearInCompiledCode ( virtualFrame , stackTop );
38083822 virtualFrame .setObject (stackTop - 1 , result );
38093823 }
38103824
@@ -4191,6 +4205,7 @@ private void bytecodeStoreFastAdaptive(VirtualFrame virtualFrame, Frame localFra
41914205 private void bytecodeStoreFastI (VirtualFrame virtualFrame , Frame localFrame , int stackTop , int bci , int index ) {
41924206 if (virtualFrame .isInt (stackTop )) {
41934207 localFrame .setInt (index , virtualFrame .getInt (stackTop ));
4208+ clearInCompiledCode (virtualFrame , stackTop );
41944209 } else {
41954210 generalizeStoreFast (virtualFrame , localFrame , stackTop , bci , index );
41964211 }
@@ -4240,6 +4255,7 @@ private void bytecodeStoreFastBoxedI(VirtualFrame virtualFrame, Frame localFrame
42404255 private void bytecodeStoreFastL (VirtualFrame virtualFrame , Frame localFrame , int stackTop , int bci , int index ) {
42414256 if (virtualFrame .isLong (stackTop )) {
42424257 localFrame .setLong (index , virtualFrame .getLong (stackTop ));
4258+ clearInCompiledCode (virtualFrame , stackTop );
42434259 } else {
42444260 generalizeStoreFast (virtualFrame , localFrame , stackTop , bci , index );
42454261 }
@@ -4289,6 +4305,7 @@ private void bytecodeStoreFastBoxedL(VirtualFrame virtualFrame, Frame localFrame
42894305 private void bytecodeStoreFastD (VirtualFrame virtualFrame , Frame localFrame , int stackTop , int bci , int index ) {
42904306 if (virtualFrame .isDouble (stackTop )) {
42914307 localFrame .setDouble (index , virtualFrame .getDouble (stackTop ));
4308+ clearInCompiledCode (virtualFrame , stackTop );
42924309 } else {
42934310 generalizeStoreFast (virtualFrame , localFrame , stackTop , bci , index );
42944311 }
@@ -4338,6 +4355,7 @@ private void bytecodeStoreFastBoxedD(VirtualFrame virtualFrame, Frame localFrame
43384355 private void bytecodeStoreFastB (VirtualFrame virtualFrame , Frame localFrame , int stackTop , int bci , int index ) {
43394356 if (virtualFrame .isBoolean (stackTop )) {
43404357 localFrame .setBoolean (index , virtualFrame .getBoolean (stackTop ));
4358+ clearInCompiledCode (virtualFrame , stackTop );
43414359 } else {
43424360 generalizeStoreFast (virtualFrame , localFrame , stackTop , bci , index );
43434361 }
@@ -4927,7 +4945,7 @@ private int bytecodeStoreSubscrSeqIOO(VirtualFrame virtualFrame, int stackTop, i
49274945 } catch (QuickeningGeneralizeException e ) {
49284946 return generalizeStoreSubscr (virtualFrame , stackTop , bci , localNodes , useCachedNodes );
49294947 }
4930- virtualFrame . setObject ( stackTop --, null );
4948+ clearInCompiledCode ( virtualFrame , stackTop --);
49314949 virtualFrame .setObject (stackTop --, null );
49324950 virtualFrame .setObject (stackTop --, null );
49334951 return stackTop ;
@@ -4950,9 +4968,9 @@ private int bytecodeStoreSubscrSeqIIO(VirtualFrame virtualFrame, int stackTop, i
49504968 } catch (QuickeningGeneralizeException e ) {
49514969 return generalizeStoreSubscr (virtualFrame , stackTop , bci , localNodes , useCachedNodes );
49524970 }
4971+ clearInCompiledCode (virtualFrame , stackTop --);
49534972 virtualFrame .setObject (stackTop --, null );
4954- virtualFrame .setObject (stackTop --, null );
4955- virtualFrame .setObject (stackTop --, null );
4973+ clearInCompiledCode (virtualFrame , stackTop --);
49564974 return stackTop ;
49574975 }
49584976
@@ -4973,9 +4991,9 @@ private int bytecodeStoreSubscrSeqIDO(VirtualFrame virtualFrame, int stackTop, i
49734991 } catch (QuickeningGeneralizeException e ) {
49744992 return generalizeStoreSubscr (virtualFrame , stackTop , bci , localNodes , useCachedNodes );
49754993 }
4994+ clearInCompiledCode (virtualFrame , stackTop --);
49764995 virtualFrame .setObject (stackTop --, null );
4977- virtualFrame .setObject (stackTop --, null );
4978- virtualFrame .setObject (stackTop --, null );
4996+ clearInCompiledCode (virtualFrame , stackTop --);
49794997 return stackTop ;
49804998 }
49814999
0 commit comments