Skip to content

Commit 4ef6faf

Browse files
committed
Fixing problem with removing slots in FrameDescriptor in ClassScope
Satisfying spotbugs
1 parent 87bcfb2 commit 4ef6faf

File tree

16 files changed

+89
-48
lines changed

16 files changed

+89
-48
lines changed
Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
BinaryArithmeticExpression SourceSection: [0,5]`a + b`
22
LookupAndCallBinaryNodeGen SourceSection: None
33
Op: __add__
4-
ReadNameNodeGen SourceSection: [0,1]`a`
5-
Identifier: a
6-
ReadNameNodeGen SourceSection: [4,5]`b`
7-
Identifier: b
4+
ReadLocalVariableNode SourceSection: [0,1]`a`
5+
Frame: [0,a,Illegal]
6+
ReadVariableFromFrameNodeGen SourceSection: None
7+
ReadLocalVariableNode SourceSection: [4,5]`b`
8+
Frame: [1,b,Illegal]
9+
ReadVariableFromFrameNodeGen SourceSection: None

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ ModuleRootNode Name: <module 'classDef11'> SourceSection: [0,282]`def make_named
111111
ReadAttributeFromObjectNotTypeNodeGen SourceSection: None
112112
ReadLocalCellNodeGen SourceSection: None
113113
ReadLocalVariableNode SourceSection: None
114-
Frame: [8,name,Illegal]
114+
Frame: [4,name,Illegal]
115115
ReadVariableFromFrameNodeGen SourceSection: None
116116
ReadFromCellNodeGen SourceSection: None
117117
SetItemNodeGen SourceSection: [104,135]`n_sequence_fields = ...`
@@ -134,7 +134,7 @@ ModuleRootNode Name: <module 'classDef11'> SourceSection: [0,282]`def make_named
134134
ReadAttributeFromObjectNotTypeNodeGen SourceSection: None
135135
ReadLocalCellNodeGen SourceSection: None
136136
ReadLocalVariableNode SourceSection: None
137-
Frame: [6,fields,Illegal]
137+
Frame: [2,fields,Illegal]
138138
ReadVariableFromFrameNodeGen SourceSection: None
139139
ReadFromCellNodeGen SourceSection: None
140140
ReadClassAttributeNodeGen SourceSection: None
@@ -162,7 +162,7 @@ ModuleRootNode Name: <module 'classDef11'> SourceSection: [0,282]`def make_named
162162
ReadAttributeFromObjectNotTypeNodeGen SourceSection: None
163163
ReadLocalCellNodeGen SourceSection: None
164164
ReadLocalVariableNode SourceSection: None
165-
Frame: [6,fields,Illegal]
165+
Frame: [2,fields,Illegal]
166166
ReadVariableFromFrameNodeGen SourceSection: None
167167
ReadFromCellNodeGen SourceSection: None
168168
SetItemNodeGen SourceSection: [168,264]`def __repr__(self):↵...`

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ ModuleRootNode Name: <module 'localMember02'> SourceSection: [0,156]`def fn():
127127
ReadAttributeFromObjectNotTypeNodeGen SourceSection: None
128128
ReadLocalCellNodeGen SourceSection: None
129129
ReadLocalVariableNode SourceSection: None
130-
Frame: [2,a_local_var_out,Illegal]
130+
Frame: [1,a_local_var_out,Illegal]
131131
ReadVariableFromFrameNodeGen SourceSection: None
132132
ReadFromCellNodeGen SourceSection: None
133133
Return Expresssion: ObjectLiteralNode SourceSection: None

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ ModuleRootNode Name: <module 'localMember03'> SourceSection: [0,210]`def fn():
127127
ReadAttributeFromObjectNotTypeNodeGen SourceSection: None
128128
ReadLocalCellNodeGen SourceSection: None
129129
ReadLocalVariableNode SourceSection: None
130-
Frame: [2,a_local_var,Illegal]
130+
Frame: [0,a_local_var,Illegal]
131131
ReadVariableFromFrameNodeGen SourceSection: None
132132
ReadFromCellNodeGen SourceSection: None
133133
SetItemNodeGen SourceSection: [131,190]`def method01():↵ ...`

graalpython/com.oracle.graal.python.test/testData/testFiles/RuntimeFileTests/_descriptor.tast

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ ModuleRootNode Name: <module '_descriptor'> SourceSection: [0,3601]`# Copyright
164164
ReadAttributeFromObjectNotTypeNodeGen SourceSection: None
165165
ReadLocalCellNodeGen SourceSection: None
166166
ReadLocalVariableNode SourceSection: None
167-
Frame: [10,name,Illegal]
167+
Frame: [5,name,Illegal]
168168
ReadVariableFromFrameNodeGen SourceSection: None
169169
ReadFromCellNodeGen SourceSection: None
170170
SetItemNodeGen SourceSection: [2179,2210]`n_sequence_fields = ...`
@@ -187,7 +187,7 @@ ModuleRootNode Name: <module '_descriptor'> SourceSection: [0,3601]`# Copyright
187187
ReadAttributeFromObjectNotTypeNodeGen SourceSection: None
188188
ReadLocalCellNodeGen SourceSection: None
189189
ReadLocalVariableNode SourceSection: None
190-
Frame: [7,fields,Illegal]
190+
Frame: [2,fields,Illegal]
191191
ReadVariableFromFrameNodeGen SourceSection: None
192192
ReadFromCellNodeGen SourceSection: None
193193
ReadClassAttributeNodeGen SourceSection: None
@@ -215,7 +215,7 @@ ModuleRootNode Name: <module '_descriptor'> SourceSection: [0,3601]`# Copyright
215215
ReadAttributeFromObjectNotTypeNodeGen SourceSection: None
216216
ReadLocalCellNodeGen SourceSection: None
217217
ReadLocalVariableNode SourceSection: None
218-
Frame: [7,fields,Illegal]
218+
Frame: [2,fields,Illegal]
219219
ReadVariableFromFrameNodeGen SourceSection: None
220220
ReadFromCellNodeGen SourceSection: None
221221
SetItemNodeGen SourceSection: [2244,2307]`def __str__(self):↵ ...`

graalpython/com.oracle.graal.python.test/testData/testFiles/RuntimeFileTests/collections__init__.scope

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -800,7 +800,7 @@ Scope: []
800800
FreeVars: Empty
801801
Scope: OrderedDict
802802
Kind: Class
803-
FrameDescriptor: [move_to_end, fromkeys, keys, setdefault, values, update, __delitem__, pop, __update, __marker, popitem, copy, __reduce__, <>temp47, __iter__, clear, __reversed__, __eq__, __class__, __setitem__, __sizeof__, __repr__, __doc__, __init__, items, __ne__]
803+
FrameDescriptor: [move_to_end, fromkeys, keys, setdefault, values, update, __delitem__, pop, __update, __marker, popitem, copy, __reduce__, <>temp24, __iter__, clear, __reversed__, __eq__, __class__, __setitem__, __sizeof__, __repr__, __doc__, __init__, items, __ne__]
804804
CellVars: [__class__]
805805
FreeVars: Empty
806806
Scope: __eq__

graalpython/com.oracle.graal.python.test/testData/testFiles/RuntimeFileTests/collections__init__.tast

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -808,7 +808,7 @@ ModuleRootNode Name: <module 'collections__init__'> SourceSection: [0,47650]`'''
808808
CelVars: __class__
809809
FreeVars: None
810810
NeedsCellFrame: False
811-
FrameDescriptor: 26 slots [__init__, __setitem__, __delitem__, __iter__, __reversed__, clear, popitem, move_to_end, __sizeof__, update, __update, keys, items, values, __ne__, __marker, pop, setdefault, __repr__, __reduce__, copy, fromkeys, __eq__, __class__, <>temp47, __doc__]
811+
FrameDescriptor: 26 slots [__init__, __setitem__, __delitem__, __iter__, __reversed__, clear, popitem, move_to_end, __sizeof__, update, __update, keys, items, values, __ne__, __marker, pop, setdefault, __repr__, __reduce__, copy, fromkeys, __eq__, __class__, <>temp24, __doc__]
812812
ExecutionSlots:
813813
FreeVarsSlots: None
814814
CellVarsSlots: __class__,
@@ -2447,9 +2447,9 @@ ModuleRootNode Name: <module 'collections__init__'> SourceSection: [0,47650]`'''
24472447
CalleeContext SourceSection: None
24482448
BlockNode SourceSection: [8311,8369]`update = __update = ...`
24492449
WriteLocalVariableNodeGen SourceSection: None
2450-
Identifier: <>temp47
2450+
Identifier: <>temp24
24512451
WriteLocalFrameSlotNodeGen SourceSection: None
2452-
Frame: [47,<>temp47,Illegal]
2452+
Frame: [24,<>temp24,Illegal]
24532453
GetAttributeNodeGen SourceSection: [8331,8369]`_collections_abc.Mut...`
24542454
GetFixedAttributeNodeGen SourceSection: None
24552455
Key: update
@@ -2475,15 +2475,15 @@ ModuleRootNode Name: <module 'collections__init__'> SourceSection: [0,47650]`'''
24752475
Index: 0
24762476
StringLiteralNode SourceSection: None
24772477
ReadLocalVariableNode SourceSection: None
2478-
Frame: [47,<>temp47,Illegal]
2478+
Frame: [24,<>temp24,Illegal]
24792479
ReadVariableFromFrameNodeGen SourceSection: None
24802480
SetItemNodeGen SourceSection: None
24812481
ArgumentExpressionNode SourceSection: None
24822482
ReadIndexedArgumentNodeGen SourceSection: None
24832483
Index: 0
24842484
StringLiteralNode SourceSection: None
24852485
ReadLocalVariableNode SourceSection: None
2486-
Frame: [47,<>temp47,Illegal]
2486+
Frame: [24,<>temp24,Illegal]
24872487
ReadVariableFromFrameNodeGen SourceSection: None
24882488
SetItemNodeGen SourceSection: [8375,8507]`def keys(self):↵ ...`
24892489
ArgumentExpressionNode SourceSection: None

graalpython/com.oracle.graal.python.test/testData/testFiles/RuntimeFileTests/initCollectionsPart1.scope

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ Scope: []
165165
FreeVars: Empty
166166
Scope: OrderedDict
167167
Kind: Class
168-
FrameDescriptor: [move_to_end, fromkeys, keys, setdefault, values, update, __delitem__, pop, __update, __marker, popitem, copy, __reduce__, <>temp47, __iter__, clear, __reversed__, __eq__, __class__, __setitem__, __sizeof__, __repr__, __doc__, __init__, items, __ne__]
168+
FrameDescriptor: [move_to_end, fromkeys, keys, setdefault, values, update, __delitem__, pop, __update, __marker, popitem, copy, __reduce__, <>temp24, __iter__, clear, __reversed__, __eq__, __class__, __setitem__, __sizeof__, __repr__, __doc__, __init__, items, __ne__]
169169
CellVars: [__class__]
170170
FreeVars: Empty
171171
Scope: __eq__

graalpython/com.oracle.graal.python.test/testData/testFiles/RuntimeFileTests/initCollectionsPart1.tast

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -808,7 +808,7 @@ ModuleRootNode Name: <module 'initCollectionsPart1'> SourceSection: [0,32029]`''
808808
CelVars: __class__
809809
FreeVars: None
810810
NeedsCellFrame: False
811-
FrameDescriptor: 26 slots [__init__, __setitem__, __delitem__, __iter__, __reversed__, clear, popitem, move_to_end, __sizeof__, update, __update, keys, items, values, __ne__, __marker, pop, setdefault, __repr__, __reduce__, copy, fromkeys, __eq__, __class__, <>temp47, __doc__]
811+
FrameDescriptor: 26 slots [__init__, __setitem__, __delitem__, __iter__, __reversed__, clear, popitem, move_to_end, __sizeof__, update, __update, keys, items, values, __ne__, __marker, pop, setdefault, __repr__, __reduce__, copy, fromkeys, __eq__, __class__, <>temp24, __doc__]
812812
ExecutionSlots:
813813
FreeVarsSlots: None
814814
CellVarsSlots: __class__,
@@ -2447,9 +2447,9 @@ ModuleRootNode Name: <module 'initCollectionsPart1'> SourceSection: [0,32029]`''
24472447
CalleeContext SourceSection: None
24482448
BlockNode SourceSection: [8311,8369]`update = __update = ...`
24492449
WriteLocalVariableNodeGen SourceSection: None
2450-
Identifier: <>temp47
2450+
Identifier: <>temp24
24512451
WriteLocalFrameSlotNodeGen SourceSection: None
2452-
Frame: [47,<>temp47,Illegal]
2452+
Frame: [24,<>temp24,Illegal]
24532453
GetAttributeNodeGen SourceSection: [8331,8369]`_collections_abc.Mut...`
24542454
GetFixedAttributeNodeGen SourceSection: None
24552455
Key: update
@@ -2475,15 +2475,15 @@ ModuleRootNode Name: <module 'initCollectionsPart1'> SourceSection: [0,32029]`''
24752475
Index: 0
24762476
StringLiteralNode SourceSection: None
24772477
ReadLocalVariableNode SourceSection: None
2478-
Frame: [47,<>temp47,Illegal]
2478+
Frame: [24,<>temp24,Illegal]
24792479
ReadVariableFromFrameNodeGen SourceSection: None
24802480
SetItemNodeGen SourceSection: None
24812481
ArgumentExpressionNode SourceSection: None
24822482
ReadIndexedArgumentNodeGen SourceSection: None
24832483
Index: 0
24842484
StringLiteralNode SourceSection: None
24852485
ReadLocalVariableNode SourceSection: None
2486-
Frame: [47,<>temp47,Illegal]
2486+
Frame: [24,<>temp24,Illegal]
24872487
ReadVariableFromFrameNodeGen SourceSection: None
24882488
SetItemNodeGen SourceSection: [8375,8507]`def keys(self):↵ ...`
24892489
ArgumentExpressionNode SourceSection: None

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/parser/PythonParserImpl.java

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public final class PythonParserImpl implements PythonParser {
5353
private final int timeStatistics;
5454
private long timeInParser = 0;
5555
private long numberOfFiles = 0;
56-
56+
5757
public PythonParserImpl(Env env) {
5858
this.useExperimentalParser = env.getOptions().get(PythonOptions.UseExperimentalParser);
5959
this.logFiles = env.getOptions().get(PythonOptions.ParserLogFiles);
@@ -77,13 +77,7 @@ private static Python3NewParser getPython3NewParser(Source source, ParserErrorCa
7777
parser.setErrorHandler(new PythonErrorStrategy());
7878
return parser;
7979
}
80-
81-
private ParserRuleContext lastTree;
82-
83-
public ParserRuleContext getLastAntlrTree() {
84-
return lastTree;
85-
}
86-
80+
8781
private ScopeInfo lastGlobalScope;
8882

8983
public ScopeInfo getLastGlobaScope() {

0 commit comments

Comments
 (0)