78
78
import com .oracle .graal .python .nodes .function .builtins .PythonUnaryBuiltinNode ;
79
79
import com .oracle .graal .python .nodes .truffle .PythonArithmeticTypes ;
80
80
import com .oracle .graal .python .nodes .util .CannotCastException ;
81
- import com .oracle .graal .python .nodes .util .CastToJavaIntNode ;
81
+ import com .oracle .graal .python .nodes .util .CastToJavaIntExactNode ;
82
82
import com .oracle .graal .python .nodes .util .CastToJavaStringNode ;
83
83
import com .oracle .graal .python .runtime .PythonCore ;
84
84
import com .oracle .graal .python .runtime .exception .PException ;
@@ -233,7 +233,7 @@ Object socket(LazyPythonClass cls, @SuppressWarnings("unused") PNone family, @Su
233
233
234
234
@ Specialization (guards = {"isNoValue(family)" , "isNoValue(type)" , "isNoValue(proto)" , "!isNoValue(fileno)" })
235
235
Object socket (VirtualFrame frame , LazyPythonClass cls , @ SuppressWarnings ("unused" ) PNone family , @ SuppressWarnings ("unused" ) PNone type , @ SuppressWarnings ("unused" ) PNone proto , Object fileno ,
236
- @ Cached CastToJavaIntNode cast ) {
236
+ @ Cached CastToJavaIntExactNode cast ) {
237
237
try {
238
238
return createSocketInternal (frame , cls , -1 , -1 , -1 , cast .execute (fileno ));
239
239
} catch (CannotCastException e ) {
@@ -243,7 +243,7 @@ Object socket(VirtualFrame frame, LazyPythonClass cls, @SuppressWarnings("unused
243
243
244
244
@ Specialization (guards = {"!isNoValue(family)" , "isNoValue(type)" , "isNoValue(proto)" , "isNoValue(fileno)" })
245
245
Object socket (LazyPythonClass cls , Object family , @ SuppressWarnings ("unused" ) PNone type , @ SuppressWarnings ("unused" ) PNone proto , @ SuppressWarnings ("unused" ) PNone fileno ,
246
- @ Cached CastToJavaIntNode cast ) {
246
+ @ Cached CastToJavaIntExactNode cast ) {
247
247
try {
248
248
return createSocketInternal (cls , cast .execute (family ), PSocket .SOCK_STREAM , 0 );
249
249
} catch (CannotCastException e ) {
@@ -253,7 +253,7 @@ Object socket(LazyPythonClass cls, Object family, @SuppressWarnings("unused") PN
253
253
254
254
@ Specialization (guards = {"!isNoValue(family)" , "!isNoValue(type)" , "isNoValue(proto)" , "isNoValue(fileno)" })
255
255
Object socket (LazyPythonClass cls , Object family , Object type , @ SuppressWarnings ("unused" ) PNone proto , @ SuppressWarnings ("unused" ) PNone fileno ,
256
- @ Cached CastToJavaIntNode cast ) {
256
+ @ Cached CastToJavaIntExactNode cast ) {
257
257
try {
258
258
return createSocketInternal (cls , cast .execute (family ), cast .execute (type ), 0 );
259
259
} catch (CannotCastException e ) {
@@ -263,7 +263,7 @@ Object socket(LazyPythonClass cls, Object family, Object type, @SuppressWarnings
263
263
264
264
@ Specialization (guards = {"!isNoValue(family)" , "!isNoValue(type)" , "!isNoValue(proto)" , "isNoValue(fileno)" })
265
265
Object socket (LazyPythonClass cls , Object family , Object type , Object proto , @ SuppressWarnings ("unused" ) PNone fileno ,
266
- @ Cached CastToJavaIntNode cast ) {
266
+ @ Cached CastToJavaIntExactNode cast ) {
267
267
try {
268
268
return createSocketInternal (cls , cast .execute (family ), cast .execute (type ), cast .execute (proto ));
269
269
} catch (CannotCastException e ) {
@@ -273,7 +273,7 @@ Object socket(LazyPythonClass cls, Object family, Object type, Object proto, @Su
273
273
274
274
@ Specialization (guards = {"!isNoValue(family)" , "!isNoValue(type)" , "!isNoValue(proto)" , "!isNoValue(fileno)" })
275
275
Object socket (VirtualFrame frame , LazyPythonClass cls , Object family , Object type , Object proto , Object fileno ,
276
- @ Cached CastToJavaIntNode cast ) {
276
+ @ Cached CastToJavaIntExactNode cast ) {
277
277
try {
278
278
return createSocketInternal (frame , cls , cast .execute (family ), cast .execute (type ), cast .execute (proto ), cast .execute (fileno ));
279
279
} catch (CannotCastException e ) {
@@ -490,11 +490,11 @@ Object getServByPort(int port, String protocolName) {
490
490
public abstract static class GetNameInfoNode extends PythonBuiltinNode {
491
491
@ Specialization
492
492
Object getNameInfo (VirtualFrame frame , PTuple sockaddr , Object flagArg ,
493
- @ Cached CastToJavaIntNode castFlags ,
493
+ @ Cached CastToJavaIntExactNode castFlags ,
494
494
@ Cached SequenceStorageNodes .LenNode lenNode ,
495
495
@ Cached SequenceStorageNodes .GetItemNode getItem ,
496
496
@ Cached CastToJavaStringNode castAddress ,
497
- @ Cached CastToJavaIntNode castPort ) {
497
+ @ Cached CastToJavaIntExactNode castPort ) {
498
498
int flags = castFlags .execute (flagArg );
499
499
SequenceStorage addr = sockaddr .getSequenceStorage ();
500
500
int addLen = lenNode .execute (addr );
@@ -548,19 +548,19 @@ public abstract static class GetAddrInfoNode extends PythonBuiltinNode {
548
548
549
549
@ Specialization
550
550
Object getAddrInfoPString (PString host , Object port , Object family , Object type , Object proto , Object flags ,
551
- @ Cached CastToJavaIntNode cast ) {
551
+ @ Cached CastToJavaIntExactNode cast ) {
552
552
return getAddrInfoString (host .getValue (), port , family , type , proto , flags , cast );
553
553
}
554
554
555
555
@ Specialization
556
556
Object getAddrInfoNone (@ SuppressWarnings ("unused" ) PNone host , Object port , Object family , Object type , Object proto , Object flags ,
557
- @ Cached CastToJavaIntNode cast ) {
557
+ @ Cached CastToJavaIntExactNode cast ) {
558
558
return getAddrInfoString ("localhost" , port , family , type , proto , flags , cast );
559
559
}
560
560
561
561
@ Specialization
562
562
Object getAddrInfoString (String host , Object port , Object family , Object type , Object proto , Object flags ,
563
- @ Cached CastToJavaIntNode cast ) {
563
+ @ Cached CastToJavaIntExactNode cast ) {
564
564
InetAddress [] addresses ;
565
565
try {
566
566
addresses = getAllByName (host );
@@ -786,7 +786,7 @@ static BytesNodes.ToBytesNode createToBytes() {
786
786
abstract static class InetPtoNNode extends PythonBinaryBuiltinNode {
787
787
@ Specialization
788
788
PBytes doConvert (@ SuppressWarnings ("unused" ) VirtualFrame frame , Object addrFamily , String addr ,
789
- @ Cached CastToJavaIntNode castToJavaIntNode ) {
789
+ @ Cached CastToJavaIntExactNode castToJavaIntNode ) {
790
790
return factory ().createBytes (aton (castToJavaIntNode .execute (addrFamily ), addr ));
791
791
}
792
792
0 commit comments