61
61
import com .oracle .graal .python .nodes .attributes .SetAttributeNode ;
62
62
import com .oracle .graal .python .nodes .call .CallDispatchNode ;
63
63
import com .oracle .graal .python .nodes .call .special .LookupAndCallUnaryNode ;
64
+ import com .oracle .graal .python .nodes .datamodel .IsSequenceNode ;
64
65
import com .oracle .graal .python .nodes .expression .CastToListNode ;
65
66
import com .oracle .graal .python .nodes .interop .PForeignToPTypeNode ;
66
67
import com .oracle .graal .python .nodes .interop .PTypeToForeignNode ;
88
89
89
90
@ MessageResolution (receiverType = PythonObject .class )
90
91
public class PythonMessageResolution {
91
- private static final class IsSequence extends Node {
92
- @ Child private LookupInheritedAttributeNode getGetItemNode = LookupInheritedAttributeNode .create ();
93
- @ Child private LookupInheritedAttributeNode getLenNode = LookupInheritedAttributeNode .create ();
94
- final ConditionProfile lenProfile = ConditionProfile .createBinaryProfile ();
95
- final ConditionProfile getItemProfile = ConditionProfile .createBinaryProfile ();
96
-
97
- public boolean execute (Object object ) {
98
- Object len = getLenNode .execute (object , SpecialMethodNames .__LEN__ );
99
- if (lenProfile .profile (len != PNone .NO_VALUE )) {
100
- return getItemProfile .profile (getGetItemNode .execute (object , SpecialMethodNames .__GETITEM__ ) != PNone .NO_VALUE );
101
- }
102
- return false ;
103
- }
104
- }
105
-
106
92
private static final class HasSetItem extends Node {
107
93
@ Child private LookupInheritedAttributeNode getSetItemNode = LookupInheritedAttributeNode .create ();
108
94
final ConditionProfile profile = ConditionProfile .createBinaryProfile ();
@@ -122,7 +108,7 @@ public boolean execute(Object object) {
122
108
}
123
109
124
110
private static final class IsImmutable extends Node {
125
- @ Child private IsSequence isSequence = new IsSequence ();
111
+ @ Child private IsSequenceNode isSequence = IsSequenceNode . create ();
126
112
@ Child private HasSetItem hasSetItem = new HasSetItem ();
127
113
final ConditionProfile builtinProfile = ConditionProfile .createBinaryProfile ();
128
114
@@ -138,7 +124,7 @@ private static final class IsMapping extends Node {
138
124
@ Child private LookupInheritedAttributeNode getKeysNode = LookupInheritedAttributeNode .create ();
139
125
@ Child private LookupInheritedAttributeNode getItemsNode = LookupInheritedAttributeNode .create ();
140
126
@ Child private LookupInheritedAttributeNode getValuesNode = LookupInheritedAttributeNode .create ();
141
- @ Child private IsSequence isSequence = new IsSequence ();
127
+ @ Child private IsSequenceNode isSequence = IsSequenceNode . create ();
142
128
final ConditionProfile profile = ConditionProfile .createBinaryProfile ();
143
129
144
130
public boolean execute (Object object ) {
@@ -184,7 +170,7 @@ private static final class KeyForItemAccess extends KeyForForcedAccess {
184
170
private static final class ReadNode extends Node {
185
171
private static final Object NONEXISTING_IDENTIFIER = new Object ();
186
172
187
- @ Child private IsSequence isSequence = new IsSequence ();
173
+ @ Child private IsSequenceNode isSequence = IsSequenceNode . create ();
188
174
@ Child private GetAttributeNode readNode = GetAttributeNode .create ();
189
175
@ Child private GetItemNode getItemNode = GetItemNode .create ();
190
176
@ Child private KeyForAttributeAccess getAttributeKey = new KeyForAttributeAccess ();
@@ -480,7 +466,7 @@ public Object access(Object object) {
480
466
481
467
@ Resolve (message = "GET_SIZE" )
482
468
abstract static class PForeignGetSizeNode extends Node {
483
- @ Child IsSequence isSeq = new IsSequence ();
469
+ @ Child IsSequenceNode isSeq = IsSequenceNode . create ();
484
470
@ Child private BuiltinFunctions .LenNode lenNode = BuiltinFunctionsFactory .LenNodeFactory .create (null );
485
471
486
472
public Object access (Object object ) {
0 commit comments