101
101
import com .oracle .graal .python .builtins .objects .dict .PDict ;
102
102
import com .oracle .graal .python .builtins .objects .exception .PBaseException ;
103
103
import com .oracle .graal .python .builtins .objects .frame .PFrame ;
104
- import com .oracle .graal .python .builtins .objects .function .Arity ;
104
+ import com .oracle .graal .python .builtins .objects .function .Signature ;
105
105
import com .oracle .graal .python .builtins .objects .function .PArguments ;
106
106
import com .oracle .graal .python .builtins .objects .function .PBuiltinFunction ;
107
107
import com .oracle .graal .python .builtins .objects .function .PFunction ;
@@ -330,37 +330,37 @@ Object runWithoutCWrapper(PBuiltinFunction descriptor, Object self) {
330
330
@ GenerateNodeFactory
331
331
@ TypeSystemReference (PythonArithmeticTypes .class )
332
332
abstract static class CreateFunctionNode extends PythonBuiltinNode {
333
- private static final Arity ARITY = Arity .createVarArgsAndKwArgsOnly ();
333
+ private static final Signature SIGNATURE = Signature .createVarArgsAndKwArgsOnly ();
334
334
335
335
@ Specialization (guards = "isNoValue(cwrapper)" )
336
336
@ TruffleBoundary
337
337
PBuiltinFunction runWithoutCWrapper (String name , TruffleObject callable , @ SuppressWarnings ("unused" ) PNone cwrapper , LazyPythonClass type ) {
338
338
CompilerDirectives .transferToInterpreter ();
339
- RootCallTarget callTarget = Truffle .getRuntime ().createCallTarget (new ExternalFunctionNode (getRootNode ().getLanguage (PythonLanguage .class ), name , null , callable , ARITY ));
339
+ RootCallTarget callTarget = Truffle .getRuntime ().createCallTarget (new ExternalFunctionNode (getRootNode ().getLanguage (PythonLanguage .class ), name , null , callable , SIGNATURE ));
340
340
return factory ().createBuiltinFunction (name , type , 0 , callTarget );
341
341
}
342
342
343
343
@ Specialization (guards = {"isNoValue(cwrapper)" , "isNoValue(type)" })
344
344
@ TruffleBoundary
345
345
PBuiltinFunction runWithoutCWrapper (String name , TruffleObject callable , @ SuppressWarnings ("unused" ) PNone cwrapper , @ SuppressWarnings ("unused" ) PNone type ) {
346
346
CompilerDirectives .transferToInterpreter ();
347
- RootCallTarget callTarget = Truffle .getRuntime ().createCallTarget (new ExternalFunctionNode (getRootNode ().getLanguage (PythonLanguage .class ), name , null , callable , ARITY ));
347
+ RootCallTarget callTarget = Truffle .getRuntime ().createCallTarget (new ExternalFunctionNode (getRootNode ().getLanguage (PythonLanguage .class ), name , null , callable , SIGNATURE ));
348
348
return factory ().createBuiltinFunction (name , null , 0 , callTarget );
349
349
}
350
350
351
351
@ Specialization (guards = {"!isNoValue(cwrapper)" , "isNoValue(type)" })
352
352
@ TruffleBoundary
353
353
PBuiltinFunction runWithoutCWrapper (String name , TruffleObject callable , TruffleObject cwrapper , @ SuppressWarnings ("unused" ) PNone type ) {
354
354
CompilerDirectives .transferToInterpreter ();
355
- RootCallTarget callTarget = Truffle .getRuntime ().createCallTarget (new ExternalFunctionNode (getRootNode ().getLanguage (PythonLanguage .class ), name , cwrapper , callable , ARITY ));
355
+ RootCallTarget callTarget = Truffle .getRuntime ().createCallTarget (new ExternalFunctionNode (getRootNode ().getLanguage (PythonLanguage .class ), name , cwrapper , callable , SIGNATURE ));
356
356
return factory ().createBuiltinFunction (name , null , 0 , callTarget );
357
357
}
358
358
359
359
@ Specialization (guards = "!isNoValue(cwrapper)" )
360
360
@ TruffleBoundary
361
361
PBuiltinFunction run (String name , TruffleObject callable , TruffleObject cwrapper , LazyPythonClass type ) {
362
362
CompilerDirectives .transferToInterpreter ();
363
- RootCallTarget callTarget = Truffle .getRuntime ().createCallTarget (new ExternalFunctionNode (getRootNode ().getLanguage (PythonLanguage .class ), name , cwrapper , callable , ARITY ));
363
+ RootCallTarget callTarget = Truffle .getRuntime ().createCallTarget (new ExternalFunctionNode (getRootNode ().getLanguage (PythonLanguage .class ), name , cwrapper , callable , SIGNATURE ));
364
364
return factory ().createBuiltinFunction (name , type , 0 , callTarget );
365
365
}
366
366
}
@@ -669,7 +669,7 @@ public static CheckFunctionResultNode create() {
669
669
}
670
670
671
671
static class ExternalFunctionNode extends PRootNode {
672
- private final Arity arity ;
672
+ private final Signature signature ;
673
673
private final TruffleObject cwrapper ;
674
674
private final TruffleObject callable ;
675
675
private final String name ;
@@ -680,9 +680,9 @@ static class ExternalFunctionNode extends PRootNode {
680
680
@ Child private CheckFunctionResultNode checkResultNode = CheckFunctionResultNode .create ();
681
681
@ Child private PForeignToPTypeNode fromForeign = PForeignToPTypeNode .create ();
682
682
683
- ExternalFunctionNode (PythonLanguage lang , String name , TruffleObject cwrapper , TruffleObject callable , Arity arity ) {
683
+ ExternalFunctionNode (PythonLanguage lang , String name , TruffleObject cwrapper , TruffleObject callable , Signature signature ) {
684
684
super (lang );
685
- this .arity = arity ;
685
+ this .signature = signature ;
686
686
this .name = name ;
687
687
this .cwrapper = cwrapper ;
688
688
this .callable = callable ;
@@ -758,8 +758,8 @@ public boolean isCloningAllowed() {
758
758
}
759
759
760
760
@ Override
761
- public Arity getArity () {
762
- return arity ;
761
+ public Signature getSignature () {
762
+ return signature ;
763
763
}
764
764
}
765
765
@@ -1537,7 +1537,7 @@ public String toString() {
1537
1537
}
1538
1538
1539
1539
static class MethKeywordsRoot extends MethodDescriptorRoot {
1540
- private static final Arity ARITY = new Arity (true , 1 , false , new String []{"self" }, new String [0 ]);
1540
+ private static final Signature SIGNATURE = new Signature (true , 1 , false , new String []{"self" }, new String [0 ]);
1541
1541
1542
1542
@ Child private ReadVarArgsNode readVarargsNode ;
1543
1543
@ Child private ReadVarKeywordsNode readKwargsNode ;
@@ -1559,13 +1559,13 @@ public Object execute(VirtualFrame frame) {
1559
1559
}
1560
1560
1561
1561
@ Override
1562
- public Arity getArity () {
1563
- return ARITY ;
1562
+ public Signature getSignature () {
1563
+ return SIGNATURE ;
1564
1564
}
1565
1565
}
1566
1566
1567
1567
static class MethVarargsRoot extends MethodDescriptorRoot {
1568
- private static final Arity ARITY = new Arity (false , 1 , false , new String []{"self" }, new String [0 ]);
1568
+ private static final Signature SIGNATURE = new Signature (false , 1 , false , new String []{"self" }, new String [0 ]);
1569
1569
1570
1570
@ Child private ReadVarArgsNode readVarargsNode ;
1571
1571
@@ -1584,13 +1584,13 @@ public Object execute(VirtualFrame frame) {
1584
1584
}
1585
1585
1586
1586
@ Override
1587
- public Arity getArity () {
1588
- return ARITY ;
1587
+ public Signature getSignature () {
1588
+ return SIGNATURE ;
1589
1589
}
1590
1590
}
1591
1591
1592
1592
static class MethNoargsRoot extends MethodDescriptorRoot {
1593
- private static final Arity ARITY = new Arity (false , -1 , false , new String []{"self" }, new String [0 ]);
1593
+ private static final Signature SIGNATURE = new Signature (false , -1 , false , new String []{"self" }, new String [0 ]);
1594
1594
1595
1595
protected MethNoargsRoot (PythonLanguage language , PythonObjectFactory factory , CallTarget callTarget ) {
1596
1596
super (language , factory , callTarget );
@@ -1605,13 +1605,13 @@ public Object execute(VirtualFrame frame) {
1605
1605
}
1606
1606
1607
1607
@ Override
1608
- public Arity getArity () {
1609
- return ARITY ;
1608
+ public Signature getSignature () {
1609
+ return SIGNATURE ;
1610
1610
}
1611
1611
}
1612
1612
1613
1613
static class MethORoot extends MethodDescriptorRoot {
1614
- private static final Arity ARITY = new Arity (false , -1 , false , new String []{"self" , "arg" }, new String [0 ]);
1614
+ private static final Signature SIGNATURE = new Signature (false , -1 , false , new String []{"self" , "arg" }, new String [0 ]);
1615
1615
1616
1616
@ Child private ReadIndexedArgumentNode readArgNode ;
1617
1617
@@ -1630,13 +1630,13 @@ public Object execute(VirtualFrame frame) {
1630
1630
}
1631
1631
1632
1632
@ Override
1633
- public Arity getArity () {
1634
- return ARITY ;
1633
+ public Signature getSignature () {
1634
+ return SIGNATURE ;
1635
1635
}
1636
1636
}
1637
1637
1638
1638
static class MethFastcallRoot extends MethodDescriptorRoot {
1639
- private static final Arity ARITY = new Arity (true , 1 , false , new String []{"self" }, new String [0 ]);
1639
+ private static final Signature SIGNATURE = new Signature (true , 1 , false , new String []{"self" }, new String [0 ]);
1640
1640
1641
1641
@ Child private ReadVarArgsNode readVarargsNode ;
1642
1642
@ Child private ReadVarKeywordsNode readKwargsNode ;
@@ -1658,8 +1658,8 @@ public Object execute(VirtualFrame frame) {
1658
1658
}
1659
1659
1660
1660
@ Override
1661
- public Arity getArity () {
1662
- return ARITY ;
1661
+ public Signature getSignature () {
1662
+ return SIGNATURE ;
1663
1663
}
1664
1664
}
1665
1665
@@ -1943,9 +1943,9 @@ public boolean visit(Node node) {
1943
1943
});
1944
1944
1945
1945
RootNode rootNode = null ;
1946
- Arity funcArity = func .getArity ();
1947
- if (funcArity .takesPositionalOnly ()) {
1948
- switch (funcArity .getMaxNumOfPositionalArgs ()) {
1946
+ Signature funcSignature = func .getSignature ();
1947
+ if (funcSignature .takesPositionalOnly ()) {
1948
+ switch (funcSignature .getMaxNumOfPositionalArgs ()) {
1949
1949
case 1 :
1950
1950
rootNode = new BuiltinFunctionRootNode (getRootNode ().getLanguage (PythonLanguage .class ), unaryBuiltin ,
1951
1951
new MayRaiseNodeFactory <PythonUnaryBuiltinNode >(MayRaiseUnaryNodeGen .create (func , errorResult )),
0 commit comments