55
55
import com .oracle .graal .python .nodes .attributes .LookupAttributeInMRONode ;
56
56
import com .oracle .graal .python .nodes .call .special .CallUnaryMethodNode ;
57
57
import com .oracle .graal .python .nodes .object .IsBuiltinClassProfile ;
58
- import com .oracle .graal .python .nodes .util .CastToJavaIntLossyNode ;
59
58
import com .oracle .graal .python .runtime .exception .PException ;
60
59
import com .oracle .truffle .api .dsl .Cached ;
61
60
import com .oracle .truffle .api .dsl .GenerateNodeFactory ;
@@ -93,7 +92,6 @@ static int length(@SuppressWarnings({"unused"}) VirtualFrame frame, @SuppressWar
93
92
int length (VirtualFrame frame , Object iterable ,
94
93
@ CachedLibrary ("iterable" ) PythonObjectLibrary plib ,
95
94
@ CachedLibrary (limit = "3" ) PythonObjectLibrary toInt ,
96
- @ Cached CastToJavaIntLossyNode cast ,
97
95
@ Cached ("create(__LEN__)" ) LookupAttributeInMRONode lenNode ,
98
96
@ Cached ("create(__LENGTH_HINT__)" ) LookupAttributeInMRONode lenHintNode ,
99
97
@ Cached CallUnaryMethodNode dispatchGetattribute ,
@@ -112,7 +110,7 @@ int length(VirtualFrame frame, Object iterable,
112
110
}
113
111
if (len != null && len != PNotImplemented .NOT_IMPLEMENTED ) {
114
112
if (toInt .canBeIndex (len )) {
115
- int intLen = cast . execute ( toInt .asIndex (len ) );
113
+ int intLen = toInt .asSize (len );
116
114
if (intLen < 0 ) {
117
115
throw raiseNode .raise (TypeError , ErrorMessages .LEN_SHOULD_RETURN_MT_ZERO );
118
116
}
@@ -132,7 +130,7 @@ int length(VirtualFrame frame, Object iterable,
132
130
}
133
131
if (len != null && len != PNotImplemented .NOT_IMPLEMENTED ) {
134
132
if (toInt .canBeIndex (len )) {
135
- int intLen = cast . execute ( toInt .asIndex (len ) );
133
+ int intLen = toInt .asSize (len );
136
134
if (intLen < 0 ) {
137
135
throw raiseNode .raise (TypeError , ErrorMessages .LENGTH_HINT_SHOULD_RETURN_MT_ZERO );
138
136
}
0 commit comments