Skip to content

Commit 07f6b92

Browse files
committed
[GR-31126] Add fast paths for binary arithmetic operations
PullRequest: graalpython/1781
2 parents d6910bc + 90e02bc commit 07f6b92

File tree

99 files changed

+1288
-2263
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+1288
-2263
lines changed

graalpython/com.oracle.graal.python.test/testData/goldenFiles/AssignmentTests/assignment03.tast

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,8 @@ ModuleRootNode Name: <module 'assignment03'> SourceSection: [0,25]`a = 0↵b = a
2222
SideEffect:
2323
WriteNameNodeGen SourceSection: [12,25]`c = a + a + b`
2424
Identifier: c
25-
BinaryArithmeticExpression SourceSection: [16,25]`a + a + b`
26-
LookupAndCallBinaryNodeGen SourceSection: None
27-
Op: __add__
28-
BinaryArithmeticExpression SourceSection: [16,21]`a + a`
29-
LookupAndCallBinaryNodeGen SourceSection: None
30-
Op: __add__
25+
AddNodeGen SourceSection: [16,25]`a + a + b`
26+
AddNodeGen SourceSection: [16,21]`a + a`
3127
ReadNameNodeGen SourceSection: [16,17]`a`
3228
Identifier: a
3329
IsBuiltinClassProfile SourceSection: None

graalpython/com.oracle.graal.python.test/testData/goldenFiles/BasicTests/binaryOp01.tast

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ ModuleRootNode Name: <module 'binaryOp01'> SourceSection: [0,6]`1 + 10`
55
FrameDescriptor: Empty
66
Documentation: None
77
InnerRootNode SourceSection: [0,6]`1 + 10`
8-
BinaryArithmeticExpression SourceSection: [0,6]`1 + 10`
9-
LookupAndCallBinaryNodeGen SourceSection: None
10-
Op: __add__
8+
AddNodeGen SourceSection: [0,6]`1 + 10`
119
IntegerLiteralNode SourceSection: [0,1]`1`
1210
Value: 1
1311
IntegerLiteralNode SourceSection: [4,6]`10`

graalpython/com.oracle.graal.python.test/testData/goldenFiles/BasicTests/binaryOp02.tast

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ ModuleRootNode Name: <module 'binaryOp02'> SourceSection: [0,11]`'ahoj' + 10`
55
FrameDescriptor: Empty
66
Documentation: None
77
InnerRootNode SourceSection: [0,11]`'ahoj' + 10`
8-
BinaryArithmeticExpression SourceSection: [0,11]`'ahoj' + 10`
9-
LookupAndCallBinaryNodeGen SourceSection: None
10-
Op: __add__
8+
AddNodeGen SourceSection: [0,11]`'ahoj' + 10`
119
StringLiteralNode SourceSection: [0,6]`'ahoj'`
1210
IntegerLiteralNode SourceSection: [9,11]`10`
1311
Value: 10

graalpython/com.oracle.graal.python.test/testData/goldenFiles/BasicTests/binaryOp03.tast

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ ModuleRootNode Name: <module 'binaryOp03'> SourceSection: [0,6]`3 ** 2`
55
FrameDescriptor: Empty
66
Documentation: None
77
InnerRootNode SourceSection: [0,6]`3 ** 2`
8-
BinaryArithmeticExpression SourceSection: [0,6]`3 ** 2`
9-
LookupAndCallBinaryNodeGen SourceSection: None
10-
Op: __pow__
8+
PowNodeGen SourceSection: [0,6]`3 ** 2`
119
IntegerLiteralNode SourceSection: [0,1]`3`
1210
Value: 3
1311
IntegerLiteralNode SourceSection: [5,6]`2`

graalpython/com.oracle.graal.python.test/testData/goldenFiles/BasicTests/binaryOp04.tast

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,10 @@ ModuleRootNode Name: <module 'binaryOp04'> SourceSection: [0,11]`3 ** 2 ** 2`
55
FrameDescriptor: Empty
66
Documentation: None
77
InnerRootNode SourceSection: [0,11]`3 ** 2 ** 2`
8-
BinaryArithmeticExpression SourceSection: [0,11]`3 ** 2 ** 2`
9-
LookupAndCallBinaryNodeGen SourceSection: None
10-
Op: __pow__
8+
PowNodeGen SourceSection: [0,11]`3 ** 2 ** 2`
119
IntegerLiteralNode SourceSection: [0,1]`3`
1210
Value: 3
13-
BinaryArithmeticExpression SourceSection: [5,11]`2 ** 2`
14-
LookupAndCallBinaryNodeGen SourceSection: None
15-
Op: __pow__
11+
PowNodeGen SourceSection: [5,11]`2 ** 2`
1612
IntegerLiteralNode SourceSection: [5,6]`2`
1713
Value: 2
1814
IntegerLiteralNode SourceSection: [10,11]`2`

graalpython/com.oracle.graal.python.test/testData/goldenFiles/BasicTests/for07.tast

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@ ModuleRootNode Name: <module 'for07'> SourceSection: [0,68]`for x in range(10):
2020
IfNode SourceSection: [24,60]`if x % 2 == 0:↵ ...`
2121
YesNodeGen SourceSection: None
2222
EqNodeGen SourceSection: [27,37]`x % 2 == 0`
23-
BinaryArithmeticExpression SourceSection: [27,32]`x % 2`
24-
LookupAndCallBinaryNodeGen SourceSection: None
25-
Op: __mod__
23+
ModNodeGen SourceSection: [27,32]`x % 2`
2624
ReadNameNodeGen SourceSection: [27,28]`x`
2725
Identifier: x
2826
IsBuiltinClassProfile SourceSection: None

graalpython/com.oracle.graal.python.test/testData/goldenFiles/BasicTests/inline01.tast

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
BinaryArithmeticExpression SourceSection: [0,5]`a + b`
2-
LookupAndCallBinaryNodeGen SourceSection: None
3-
Op: __add__
1+
AddNodeGen SourceSection: [0,5]`a + b`
42
ReadLocalVariableNodeGen SourceSection: [0,1]`a`
53
Frame: [0,a,Illegal]
64
ReadLocalVariableNodeGen SourceSection: [4,5]`b`

graalpython/com.oracle.graal.python.test/testData/goldenFiles/BasicTests/try10.tast

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,7 @@ ModuleRootNode Name: <module 'try10'> SourceSection: [0,214]`def divide(x, y):
5252
WriteLocalVariableNodeGen SourceSection: [35,49]`result = x / y`
5353
Identifier: result
5454
Frame: [2,result,Illegal]
55-
BinaryArithmeticExpression SourceSection: [44,49]`x / y`
56-
LookupAndCallBinaryNodeGen SourceSection: None
57-
Op: __truediv__
55+
TrueDivNodeGen SourceSection: [44,49]`x / y`
5856
ReadLocalVariableNodeGen SourceSection: [44,45]`x`
5957
Frame: [0,x,Illegal]
6058
ReadLocalVariableNodeGen SourceSection: [48,49]`y`

graalpython/com.oracle.graal.python.test/testData/goldenFiles/ClassDefTests/classDef08.tast

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,7 @@ ModuleRootNode Name: <module 'classDef08'> SourceSection: [0,129]`class Test():
8585
WriteLocalVariableNodeGen SourceSection: None
8686
Identifier: <return_val>
8787
Frame: [1,<return_val>,Illegal]
88-
BinaryArithmeticExpression SourceSection: [51,64]`format % args`
89-
LookupAndCallBinaryNodeGen SourceSection: None
90-
Op: __mod__
88+
ModNodeGen SourceSection: [51,64]`format % args`
9189
ReadLocalVariableNodeGen SourceSection: [51,57]`format`
9290
Frame: [0,format,Illegal]
9391
ReadGlobalOrBuiltinNodeGen SourceSection: [60,64]`args`

graalpython/com.oracle.graal.python.test/testData/goldenFiles/ClassDefTests/classDef10.tast

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,7 @@ ModuleRootNode Name: <module 'classDef10'> SourceSection: [0,83]`def test(arg):
9999
ReadGlobalOrBuiltinNodeGen SourceSection: [72,76]`test`
100100
Identifier: test
101101
ReadAttributeFromObjectNotTypeNodeGen SourceSection: None
102-
BinaryArithmeticExpression SourceSection: [77,82]`arg+1`
103-
LookupAndCallBinaryNodeGen SourceSection: None
104-
Op: __add__
102+
AddNodeGen SourceSection: [77,82]`arg+1`
105103
ReadLocalVariableNodeGen SourceSection: [77,80]`arg`
106104
Frame: [1,arg,Illegal]
107105
IntegerLiteralNode SourceSection: [81,82]`1`

0 commit comments

Comments
 (0)