53
53
import com .oracle .graal .python .builtins .objects .type .LazyPythonClass ;
54
54
import com .oracle .graal .python .nodes .function .PythonBuiltinBaseNode ;
55
55
import com .oracle .graal .python .nodes .function .PythonBuiltinNode ;
56
+ import com .oracle .graal .python .nodes .util .CastToIndexNode ;
56
57
import com .oracle .graal .python .runtime .exception .PythonErrorType ;
57
58
import com .oracle .truffle .api .CompilerDirectives .TruffleBoundary ;
59
+ import com .oracle .truffle .api .dsl .Cached ;
58
60
import com .oracle .truffle .api .dsl .GenerateNodeFactory ;
59
61
import com .oracle .truffle .api .dsl .NodeFactory ;
60
62
import com .oracle .truffle .api .dsl .Specialization ;
@@ -77,18 +79,21 @@ Object socket(LazyPythonClass cls, @SuppressWarnings("unused") PNone family, @Su
77
79
}
78
80
79
81
@ Specialization (guards = {"isNoValue(type)" , "isNoValue(proto)" , "isNoValue(fileno)" })
80
- Object socket (LazyPythonClass cls , int family , @ SuppressWarnings ("unused" ) PNone type , @ SuppressWarnings ("unused" ) PNone proto , @ SuppressWarnings ("unused" ) PNone fileno ) {
81
- return createSocketInternal (cls , family , PSocket .SOCK_STREAM , 0 );
82
+ Object socket (LazyPythonClass cls , Object family , @ SuppressWarnings ("unused" ) PNone type , @ SuppressWarnings ("unused" ) PNone proto , @ SuppressWarnings ("unused" ) PNone fileno ,
83
+ @ Cached CastToIndexNode cast ) {
84
+ return createSocketInternal (cls , cast .execute (family ), PSocket .SOCK_STREAM , 0 );
82
85
}
83
86
84
87
@ Specialization (guards = {"isNoValue(proto)" , "isNoValue(fileno)" })
85
- Object socket (LazyPythonClass cls , int family , int type , @ SuppressWarnings ("unused" ) PNone proto , @ SuppressWarnings ("unused" ) PNone fileno ) {
86
- return createSocketInternal (cls , family , type , 0 );
88
+ Object socket (LazyPythonClass cls , Object family , Object type , @ SuppressWarnings ("unused" ) PNone proto , @ SuppressWarnings ("unused" ) PNone fileno ,
89
+ @ Cached CastToIndexNode cast ) {
90
+ return createSocketInternal (cls , cast .execute (family ), cast .execute (type ), 0 );
87
91
}
88
92
89
93
@ Specialization (guards = {"isNoValue(fileno)" })
90
- Object socket (LazyPythonClass cls , int family , int type , int proto , @ SuppressWarnings ("unused" ) PNone fileno ) {
91
- return createSocketInternal (cls , family , type , proto );
94
+ Object socket (LazyPythonClass cls , Object family , Object type , Object proto , @ SuppressWarnings ("unused" ) PNone fileno ,
95
+ @ Cached CastToIndexNode cast ) {
96
+ return createSocketInternal (cls , cast .execute (family ), cast .execute (type ), cast .execute (proto ));
92
97
}
93
98
94
99
private Object createSocketInternal (LazyPythonClass cls , int family , int type , int proto ) {
0 commit comments