Skip to content

Commit 4ad1843

Browse files
committed
[GR-28698] Reduce number of shapes created for multiple contexts.
PullRequest: graalpython/1522
2 parents cf9bf13 + 52309a4 commit 4ad1843

38 files changed

+1208
-256
lines changed

graalpython/com.oracle.graal.python.test/src/com/oracle/graal/python/test/parser/DictAndSetTests.java

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,36 @@ public void dict11() throws Exception {
100100
checkTreeResult("{**{\"a\": \"hello\", \"b\": \"world\"}, 1:2, **{3:4, 5:6}}");
101101
}
102102

103+
@Test
104+
public void dict12() throws Exception {
105+
checkTreeResult("{'a':'b',}");
106+
}
107+
108+
@Test
109+
public void dict13() throws Exception {
110+
checkTreeResult("{'a':'b'}");
111+
}
112+
113+
@Test
114+
public void dict14() throws Exception {
115+
checkTreeResult("{'a':'b','c':14}");
116+
}
117+
118+
@Test
119+
public void dict15() throws Exception {
120+
checkTreeResult("{1:'b','c':14}");
121+
}
122+
123+
@Test
124+
public void dict16() throws Exception {
125+
checkTreeResult("{'a':'b',c:14}");
126+
}
127+
128+
@Test
129+
public void dict17() throws Exception {
130+
checkTreeResult("{'a':'b','c':14,'d':1234,'g':h}");
131+
}
132+
103133
@Test
104134
public void set01() throws Exception {
105135
checkTreeResult("{2}");

graalpython/com.oracle.graal.python.test/testData/goldenFiles/DictAndSetTests/dict01.tast

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ ModuleRootNode Name: <module 'dict01'> SourceSection: [0,2]`{}`
55
FrameDescriptor: Empty
66
Documentation: None
77
InnerRootNode SourceSection: [0,2]`{}`
8-
DictLiteralNodeGen SourceSection: [0,2]`{}`
8+
EmptyDictLiteralNode SourceSection: [0,2]`{}`
99
PythonObjectFactoryNodeGen SourceSection: None

graalpython/com.oracle.graal.python.test/testData/goldenFiles/DictAndSetTests/dict02.tast

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ ModuleRootNode Name: <module 'dict02'> SourceSection: [0,5]`{a:b}`
55
FrameDescriptor: Empty
66
Documentation: None
77
InnerRootNode SourceSection: [0,5]`{a:b}`
8-
DictLiteralNodeGen SourceSection: [0,5]`{a:b}`
8+
DynamicDictLiteralNodeGen SourceSection: [0,5]`{a:b}`
99
PythonObjectFactoryNodeGen SourceSection: None
1010
ReadNameNodeGen SourceSection: [1,2]`a`
1111
Identifier: a
@@ -15,3 +15,4 @@ ModuleRootNode Name: <module 'dict02'> SourceSection: [0,5]`{a:b}`
1515
Identifier: b
1616
IsBuiltinClassProfile SourceSection: None
1717
CachedDispatchFirst SourceSection: None
18+
CachedDispatchFirst SourceSection: None

graalpython/com.oracle.graal.python.test/testData/goldenFiles/DictAndSetTests/dict03.tast

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ ModuleRootNode Name: <module 'dict03'> SourceSection: [0,6]`{a:b,}`
55
FrameDescriptor: Empty
66
Documentation: None
77
InnerRootNode SourceSection: [0,6]`{a:b,}`
8-
DictLiteralNodeGen SourceSection: [0,6]`{a:b,}`
8+
DynamicDictLiteralNodeGen SourceSection: [0,6]`{a:b,}`
99
PythonObjectFactoryNodeGen SourceSection: None
1010
ReadNameNodeGen SourceSection: [1,2]`a`
1111
Identifier: a
@@ -15,3 +15,4 @@ ModuleRootNode Name: <module 'dict03'> SourceSection: [0,6]`{a:b,}`
1515
Identifier: b
1616
IsBuiltinClassProfile SourceSection: None
1717
CachedDispatchFirst SourceSection: None
18+
CachedDispatchFirst SourceSection: None

graalpython/com.oracle.graal.python.test/testData/goldenFiles/DictAndSetTests/dict04.tast

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ ModuleRootNode Name: <module 'dict04'> SourceSection: [0,10]`{a:b, c:d}`
55
FrameDescriptor: Empty
66
Documentation: None
77
InnerRootNode SourceSection: [0,10]`{a:b, c:d}`
8-
DictLiteralNodeGen SourceSection: [0,10]`{a:b, c:d}`
8+
DynamicDictLiteralNodeGen SourceSection: [0,10]`{a:b, c:d}`
99
PythonObjectFactoryNodeGen SourceSection: None
1010
ReadNameNodeGen SourceSection: [1,2]`a`
1111
Identifier: a
@@ -23,3 +23,5 @@ ModuleRootNode Name: <module 'dict04'> SourceSection: [0,10]`{a:b, c:d}`
2323
Identifier: d
2424
IsBuiltinClassProfile SourceSection: None
2525
CachedDispatchFirst SourceSection: None
26+
CachedDispatchFirst SourceSection: None
27+
CachedDispatchFirst SourceSection: None

graalpython/com.oracle.graal.python.test/testData/goldenFiles/DictAndSetTests/dict05.tast

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ ModuleRootNode Name: <module 'dict05'> SourceSection: [0,12]`{a:b, c:d, }`
55
FrameDescriptor: Empty
66
Documentation: None
77
InnerRootNode SourceSection: [0,12]`{a:b, c:d, }`
8-
DictLiteralNodeGen SourceSection: [0,12]`{a:b, c:d, }`
8+
DynamicDictLiteralNodeGen SourceSection: [0,12]`{a:b, c:d, }`
99
PythonObjectFactoryNodeGen SourceSection: None
1010
ReadNameNodeGen SourceSection: [1,2]`a`
1111
Identifier: a
@@ -23,3 +23,5 @@ ModuleRootNode Name: <module 'dict05'> SourceSection: [0,12]`{a:b, c:d, }`
2323
Identifier: d
2424
IsBuiltinClassProfile SourceSection: None
2525
CachedDispatchFirst SourceSection: None
26+
CachedDispatchFirst SourceSection: None
27+
CachedDispatchFirst SourceSection: None

graalpython/com.oracle.graal.python.test/testData/goldenFiles/DictAndSetTests/dict06.tast

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ ModuleRootNode Name: <module 'dict06'> SourceSection: [0,6]`{**{}}`
66
Documentation: None
77
InnerRootNode SourceSection: [0,6]`{**{}}`
88
DictConcatNodeGen SourceSection: [0,6]`{**{}}`
9-
DictLiteralNodeGen SourceSection: None
9+
EmptyDictLiteralNode SourceSection: None
1010
PythonObjectFactoryNodeGen SourceSection: None
11-
DictLiteralNodeGen SourceSection: [3,5]`{}`
11+
EmptyDictLiteralNode SourceSection: [3,5]`{}`
1212
PythonObjectFactoryNodeGen SourceSection: None

graalpython/com.oracle.graal.python.test/testData/goldenFiles/DictAndSetTests/dict07.tast

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,18 @@ ModuleRootNode Name: <module 'dict07'> SourceSection: [0,25]`{**{}, 3:4, **{5:6,
66
Documentation: None
77
InnerRootNode SourceSection: [0,25]`{**{}, 3:4, **{5:6, ...`
88
DictConcatNodeGen SourceSection: [0,25]`{**{}, 3:4, **{5:6, ...`
9-
DictLiteralNodeGen SourceSection: None
9+
EmptyDictLiteralNode SourceSection: None
1010
PythonObjectFactoryNodeGen SourceSection: None
11-
DictLiteralNodeGen SourceSection: [3,5]`{}`
11+
EmptyDictLiteralNode SourceSection: [3,5]`{}`
1212
PythonObjectFactoryNodeGen SourceSection: None
13-
DictLiteralNodeGen SourceSection: None
13+
DynamicDictLiteralNodeGen SourceSection: None
1414
PythonObjectFactoryNodeGen SourceSection: None
1515
IntegerLiteralNode SourceSection: [7,8]`3`
1616
Value: 3
1717
IntegerLiteralNode SourceSection: [9,10]`4`
1818
Value: 4
19-
DictLiteralNodeGen SourceSection: [14,24]`{5:6, 7:8}`
19+
CachedDispatchFirst SourceSection: None
20+
DynamicDictLiteralNodeGen SourceSection: [14,24]`{5:6, 7:8}`
2021
PythonObjectFactoryNodeGen SourceSection: None
2122
IntegerLiteralNode SourceSection: [15,16]`5`
2223
Value: 5
@@ -26,3 +27,5 @@ ModuleRootNode Name: <module 'dict07'> SourceSection: [0,25]`{**{}, 3:4, **{5:6,
2627
Value: 6
2728
IntegerLiteralNode SourceSection: [22,23]`8`
2829
Value: 8
30+
CachedDispatchFirst SourceSection: None
31+
CachedDispatchFirst SourceSection: None

graalpython/com.oracle.graal.python.test/testData/goldenFiles/DictAndSetTests/dict08.tast

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,23 @@ ModuleRootNode Name: <module 'dict08'> SourceSection: [0,30]`{1:2, **{}, 3:4, **
66
Documentation: None
77
InnerRootNode SourceSection: [0,30]`{1:2, **{}, 3:4, **{...`
88
DictConcatNodeGen SourceSection: [0,30]`{1:2, **{}, 3:4, **{...`
9-
DictLiteralNodeGen SourceSection: None
9+
DynamicDictLiteralNodeGen SourceSection: None
1010
PythonObjectFactoryNodeGen SourceSection: None
1111
IntegerLiteralNode SourceSection: [1,2]`1`
1212
Value: 1
1313
IntegerLiteralNode SourceSection: [3,4]`2`
1414
Value: 2
15-
DictLiteralNodeGen SourceSection: [8,10]`{}`
15+
CachedDispatchFirst SourceSection: None
16+
EmptyDictLiteralNode SourceSection: [8,10]`{}`
1617
PythonObjectFactoryNodeGen SourceSection: None
17-
DictLiteralNodeGen SourceSection: None
18+
DynamicDictLiteralNodeGen SourceSection: None
1819
PythonObjectFactoryNodeGen SourceSection: None
1920
IntegerLiteralNode SourceSection: [12,13]`3`
2021
Value: 3
2122
IntegerLiteralNode SourceSection: [14,15]`4`
2223
Value: 4
23-
DictLiteralNodeGen SourceSection: [19,29]`{5:6, 7:8}`
24+
CachedDispatchFirst SourceSection: None
25+
DynamicDictLiteralNodeGen SourceSection: [19,29]`{5:6, 7:8}`
2426
PythonObjectFactoryNodeGen SourceSection: None
2527
IntegerLiteralNode SourceSection: [20,21]`5`
2628
Value: 5
@@ -30,3 +32,5 @@ ModuleRootNode Name: <module 'dict08'> SourceSection: [0,30]`{1:2, **{}, 3:4, **
3032
Value: 6
3133
IntegerLiteralNode SourceSection: [27,28]`8`
3234
Value: 8
35+
CachedDispatchFirst SourceSection: None
36+
CachedDispatchFirst SourceSection: None

graalpython/com.oracle.graal.python.test/testData/goldenFiles/DictAndSetTests/dict09.tast

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@ ModuleRootNode Name: <module 'dict09'> SourceSection: [0,11]`{**{}, 3:4}`
66
Documentation: None
77
InnerRootNode SourceSection: [0,11]`{**{}, 3:4}`
88
DictConcatNodeGen SourceSection: [0,11]`{**{}, 3:4}`
9-
DictLiteralNodeGen SourceSection: None
9+
EmptyDictLiteralNode SourceSection: None
1010
PythonObjectFactoryNodeGen SourceSection: None
11-
DictLiteralNodeGen SourceSection: [3,5]`{}`
11+
EmptyDictLiteralNode SourceSection: [3,5]`{}`
1212
PythonObjectFactoryNodeGen SourceSection: None
13-
DictLiteralNodeGen SourceSection: None
13+
DynamicDictLiteralNodeGen SourceSection: None
1414
PythonObjectFactoryNodeGen SourceSection: None
1515
IntegerLiteralNode SourceSection: [7,8]`3`
1616
Value: 3
1717
IntegerLiteralNode SourceSection: [9,10]`4`
1818
Value: 4
19+
CachedDispatchFirst SourceSection: None

0 commit comments

Comments
 (0)