5656import com .oracle .graal .python .builtins .objects .str .StringNodes ;
5757import com .oracle .graal .python .builtins .objects .type .PythonBuiltinClass ;
5858import com .oracle .graal .python .nodes .bytecode .PBytecodeGeneratorFunctionRootNode ;
59+ import com .oracle .graal .python .nodes .bytecode .PBytecodeRootNode ;
5960import com .oracle .graal .python .nodes .expression .BinaryOp ;
6061import com .oracle .graal .python .nodes .generator .GeneratorFunctionRootNode ;
6162import com .oracle .graal .python .runtime .PythonContext ;
@@ -216,7 +217,6 @@ static boolean doCode(PCode left, PCode right,
216217 RootCallTarget leftCt = getCt .execute (left );
217218 RootCallTarget rightCt = getCt .execute (right );
218219 if (leftCt != null && rightCt != null ) {
219- // TODO: handle splitting, i.e., cloned root nodes
220220 RootNode leftRootNode = leftCt .getRootNode ();
221221 RootNode rightRootNode = rightCt .getRootNode ();
222222 if (leftRootNode instanceof GeneratorFunctionRootNode ) {
@@ -229,6 +229,11 @@ static boolean doCode(PCode left, PCode right,
229229 } else if (rightRootNode instanceof PBytecodeGeneratorFunctionRootNode ) {
230230 rightRootNode = ((PBytecodeGeneratorFunctionRootNode ) rightRootNode ).getBytecodeRootNode ();
231231 }
232+ if (PythonContext .get (getCt ).getOption (PythonOptions .EnableBytecodeInterpreter )) {
233+ if (leftRootNode instanceof PBytecodeRootNode && rightRootNode instanceof PBytecodeRootNode ) {
234+ return ((PBytecodeRootNode ) leftRootNode ).getCodeUnit () == ((PBytecodeRootNode ) rightRootNode ).getCodeUnit ();
235+ }
236+ }
232237 return leftRootNode == rightRootNode ;
233238 } else {
234239 return false ;
0 commit comments