Skip to content

Commit b8622e9

Browse files
committed
remove CastToBooleanNode from ListBuiltins
1 parent eb299a3 commit b8622e9

File tree

1 file changed

+5
-3
lines changed
  • graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/list

1 file changed

+5
-3
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/list/ListBuiltins.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,14 @@
6262
import com.oracle.graal.python.builtins.objects.common.IndexNodes.NormalizeIndexNode;
6363
import com.oracle.graal.python.builtins.objects.common.SequenceStorageNodes;
6464
import com.oracle.graal.python.builtins.objects.common.SequenceStorageNodes.ListGeneralizationNode;
65+
import com.oracle.graal.python.builtins.objects.function.PArguments;
6566
import com.oracle.graal.python.builtins.objects.ints.PInt;
6667
import com.oracle.graal.python.builtins.objects.iterator.PDoubleSequenceIterator;
6768
import com.oracle.graal.python.builtins.objects.iterator.PIntegerSequenceIterator;
6869
import com.oracle.graal.python.builtins.objects.iterator.PLongSequenceIterator;
6970
import com.oracle.graal.python.builtins.objects.iterator.PSequenceIterator;
7071
import com.oracle.graal.python.builtins.objects.list.ListBuiltinsFactory.ListReverseNodeFactory;
72+
import com.oracle.graal.python.builtins.objects.object.PythonObjectLibrary;
7173
import com.oracle.graal.python.builtins.objects.range.PRange;
7274
import com.oracle.graal.python.builtins.objects.str.PString;
7375
import com.oracle.graal.python.builtins.objects.tuple.PTuple;
@@ -80,7 +82,6 @@
8082
import com.oracle.graal.python.nodes.call.special.LookupAndCallUnaryNode;
8183
import com.oracle.graal.python.nodes.control.GetIteratorExpressionNode.GetIteratorNode;
8284
import com.oracle.graal.python.nodes.expression.BinaryComparisonNode;
83-
import com.oracle.graal.python.nodes.expression.CastToBooleanNode;
8485
import com.oracle.graal.python.nodes.function.PythonBuiltinBaseNode;
8586
import com.oracle.graal.python.nodes.function.PythonBuiltinNode;
8687
import com.oracle.graal.python.nodes.function.builtins.PythonBinaryBuiltinNode;
@@ -105,6 +106,7 @@
105106
import com.oracle.truffle.api.dsl.Specialization;
106107
import com.oracle.truffle.api.dsl.TypeSystemReference;
107108
import com.oracle.truffle.api.frame.VirtualFrame;
109+
import com.oracle.truffle.api.library.CachedLibrary;
108110
import com.oracle.truffle.api.profiles.ConditionProfile;
109111

110112
@CoreFunctions(extendClasses = PythonBuiltinClassType.PList)
@@ -478,13 +480,13 @@ PNone remove(VirtualFrame frame, PList list, Object value,
478480
@Cached("createNotNormalized()") SequenceStorageNodes.GetItemNode getItemNode,
479481
@Cached("create()") SequenceStorageNodes.DeleteNode deleteNode,
480482
@Cached("create()") SequenceStorageNodes.LenNode lenNode,
481-
@Cached("createIfTrueNode()") CastToBooleanNode castToBooleanNode,
483+
@CachedLibrary(limit = "getCallSiteInlineCacheMaxDepth()") PythonObjectLibrary lib,
482484
@Cached("create(__EQ__, __EQ__, __EQ__)") BinaryComparisonNode eqNode) {
483485
SequenceStorage listStore = list.getSequenceStorage();
484486
int len = lenNode.execute(listStore);
485487
for (int i = 0; i < len; i++) {
486488
Object object = getItemNode.execute(frame, listStore, i);
487-
if (castToBooleanNode.executeBoolean(frame, eqNode.executeWith(frame, object, value))) {
489+
if (lib.isTrueWithState(eqNode.executeWith(frame, object, value), PArguments.getThreadState(frame))) {
488490
deleteNode.execute(frame, listStore, i);
489491
return PNone.NONE;
490492
}

0 commit comments

Comments
 (0)