Skip to content

Commit 8592cb8

Browse files
committed
sort frame contents in parser test output
1 parent fcb2944 commit 8592cb8

File tree

445 files changed

+2837
-2821
lines changed

Some content is hidden

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

445 files changed

+2837
-2821
lines changed

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

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@
4141

4242
package com.oracle.graal.python.test.parser;
4343

44+
import java.util.Collection;
4445
import java.util.Set;
46+
import java.util.TreeSet;
4547

4648
import com.oracle.graal.python.builtins.objects.function.Signature;
4749
import com.oracle.graal.python.nodes.ModuleRootNode;
@@ -486,20 +488,18 @@ private void addSignature(Signature signature) {
486488
private void addFrameDescriptor(FrameDescriptor fd) {
487489
indent(level);
488490
sb.append("FrameDescriptor: ");
489-
if (fd.getSlots().size() == 0) {
491+
Set<Object> identifiers = fd.getIdentifiers();
492+
if (identifiers.isEmpty()) {
490493
sb.append(" Empty");
491494
newLine();
492495
return;
493496
}
494-
sb.append(fd.getSlots().size()).append(" slots [");
495-
Set<Object> identifiers = fd.getIdentifiers();
496-
String[] names = new String[identifiers.size()];
497-
int i = 0;
498-
String name;
497+
sb.append(identifiers.size()).append(" slots [");
498+
TreeSet<String> names = new TreeSet<>();
499499
for (Object identifier : identifiers) {
500-
name = identifier.toString();
500+
String name = identifier.toString();
501501
if (printTmpSlots || (!printTmpSlots && !name.startsWith("<>temp"))) {
502-
names[i++] = name;
502+
names.add(name);
503503
}
504504
}
505505
add(names);
@@ -535,6 +535,22 @@ private void add(String[] array) {
535535
}
536536
}
537537

538+
private void add(Collection<String> array) {
539+
if (array == null || array.isEmpty()) {
540+
sb.append("None");
541+
} else {
542+
boolean first = true;
543+
for (String text : array) {
544+
if (!first) {
545+
sb.append(", ");
546+
} else {
547+
first = false;
548+
}
549+
sb.append(text);
550+
}
551+
}
552+
}
553+
538554
private void add(FrameSlot[] slots) {
539555
if (slots == null || slots.length == 0) {
540556
sb.append("None");

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
import java.util.HashSet;
5252
import java.util.List;
5353
import java.util.Set;
54+
import java.util.TreeSet;
5455

5556
import org.junit.Assert;
5657
import org.junit.Test;
@@ -1381,7 +1382,7 @@ private static void printScope(ScopeInfo scope, StringBuilder sb, int indent) {
13811382
});
13821383
indent(sb, indent + 1);
13831384
sb.append("FrameDescriptor: ");
1384-
printSet(sb, names);
1385+
printSet(sb, new TreeSet<>(names));
13851386
sb.append("\n");
13861387
indent(sb, indent + 1);
13871388
sb.append("CellVars: ");
@@ -1405,13 +1406,13 @@ public void compareDeSerializationAndParsing() throws Exception {
14051406
* Processor Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz Memory 32801MB Operating System
14061407
* Ubuntu 18.04.2 LTS the result should be : Memory times: parsing: 6,674,919,690ns (100%)
14071408
* serialization: 435,290,014ns(+6%) deserialization: 2,220,701,051ns (-67%)
1408-
*
1409+
*
14091410
* Average times: parsing: 4,171,824ns (100%) serialization: 272,056ns (+6%)
14101411
* deserialization: 1,387,938ns(-67%)
1411-
*
1412+
*
14121413
* Times with file operations: parsing: 6,879,809,367ns (100%) serialization:
14131414
* 583,667,690ns(+8%) deserialization: 2,270,131,909ns (-68%)
1414-
*
1415+
*
14151416
* Average times: parsing: 4,299,880ns (100%) serialization: 364,792ns (+8%)
14161417
* deserialization: 1,418,832ns(-68%)
14171418
*/

graalpython/com.oracle.graal.python.test/testData/goldenFiles/AssignmentTests/annotationType02.scope

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ Scope: []
55
FreeVars: Empty
66
Scope: fn
77
Kind: Function
8-
FrameDescriptor: [index, <return_val>]
8+
FrameDescriptor: [<return_val>, index]
99
CellVars: Empty
1010
FreeVars: Empty

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ ModuleRootNode Name: <module 'annotationType02'> SourceSection: [0,28]`def fn():
2525
CelVars: None
2626
FreeVars: None
2727
NeedsCellFrame: False
28-
FrameDescriptor: 2 slots [index, <return_val>]
28+
FrameDescriptor: 2 slots [<return_val>, index]
2929
ExecutionSlots:
3030
FreeVarsSlots: None
3131
CellVarsSlots: None

graalpython/com.oracle.graal.python.test/testData/goldenFiles/AssignmentTests/assignment06.scope

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ Scope: []
55
FreeVars: Empty
66
Scope: fn
77
Kind: Function
8-
FrameDescriptor: [a, b, c, d, <>temp4, <return_val>]
8+
FrameDescriptor: [<>temp4, <return_val>, a, b, c, d]
99
CellVars: Empty
1010
FreeVars: Empty

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ ModuleRootNode Name: <module 'assignment06'> SourceSection: [0,29]`def fn():↵
2525
CelVars: None
2626
FreeVars: None
2727
NeedsCellFrame: False
28-
FrameDescriptor: 6 slots [a, b, c, d, <>temp4, <return_val>]
28+
FrameDescriptor: 6 slots [<>temp4, <return_val>, a, b, c, d]
2929
ExecutionSlots:
3030
FreeVarsSlots: None
3131
CellVarsSlots: None

graalpython/com.oracle.graal.python.test/testData/goldenFiles/AssignmentTests/assignment07.scope

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ Scope: []
55
FreeVars: Empty
66
Scope: fn
77
Kind: Function
8-
FrameDescriptor: [a, b, c, <>temp3, <>temp4, <>temp5, <return_val>]
8+
FrameDescriptor: [<>temp3, <>temp4, <>temp5, <return_val>, a, b, c]
99
CellVars: Empty
1010
FreeVars: Empty

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ ModuleRootNode Name: <module 'assignment07'> SourceSection: [0,29]`def fn():↵
2525
CelVars: None
2626
FreeVars: None
2727
NeedsCellFrame: False
28-
FrameDescriptor: 7 slots [a, b, c, <>temp3, <>temp4, <>temp5, <return_val>]
28+
FrameDescriptor: 7 slots [<>temp3, <>temp4, <>temp5, <return_val>, a, b, c]
2929
ExecutionSlots:
3030
FreeVarsSlots: None
3131
CellVarsSlots: None

graalpython/com.oracle.graal.python.test/testData/goldenFiles/AssignmentTests/augassign13.scope

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ Scope: []
55
FreeVars: Empty
66
Scope: fn
77
Kind: Function
8-
FrameDescriptor: [x, <return_val>]
8+
FrameDescriptor: [<return_val>, x]
99
CellVars: Empty
1010
FreeVars: Empty

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ ModuleRootNode Name: <module 'augassign13'> SourceSection: [0,17]`def fn (): x +
2525
CelVars: None
2626
FreeVars: None
2727
NeedsCellFrame: False
28-
FrameDescriptor: 2 slots [x, <return_val>]
28+
FrameDescriptor: 2 slots [<return_val>, x]
2929
ExecutionSlots:
3030
FreeVarsSlots: None
3131
CellVarsSlots: None

0 commit comments

Comments
 (0)