Skip to content

Commit 6cf9905

Browse files
committed
improve relooper debugging
1 parent d38a6d6 commit 6cf9905

File tree

2 files changed

+33
-47
lines changed

2 files changed

+33
-47
lines changed

src/relooper/Relooper.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -1029,12 +1029,12 @@ void Relooper::SetAsmJSMode(int On) {
10291029
void DebugDump(BlockSet &Blocks, const char *prefix) {
10301030
if (prefix) printf("%s ", prefix);
10311031
for (BlockSet::iterator iter = Blocks.begin(); iter != Blocks.end(); iter++) {
1032-
printf("%d:\n", (*iter)->Id);
1033-
for (BlockBranchMap::iterator iter2 = (*iter)->BranchesOut.begin(); iter2 != (*iter)->BranchesOut.end(); iter2++) {
1034-
printf(" OUT %d\n", iter2->first->Id);
1035-
}
1036-
for (BlockSet::iterator iter2 = (*iter)->BranchesIn.begin(); iter2 != (*iter)->BranchesIn.end(); iter2++) {
1037-
printf(" IN %d\n", (*iter2)->Id);
1032+
Block *Curr = *iter;
1033+
printf("%d:\n", Curr->Id);
1034+
for (BlockBranchMap::iterator iter2 = Curr->BranchesOut.begin(); iter2 != Curr->BranchesOut.end(); iter2++) {
1035+
Block *Other = iter2->first;
1036+
printf(" -> %d\n", Other->Id);
1037+
assert(Other->BranchesIn.find(Curr) != Other->BranchesIn.end());
10381038
}
10391039
}
10401040
}

src/relooper/test_debug.txt

+27-41
Original file line numberDiff line numberDiff line change
@@ -34,86 +34,72 @@ int main() {
3434
// Process() called
3535
// Process() running
3636
blocks : 1:
37-
OUT 2
38-
OUT 4
37+
-> 2
38+
-> 4
3939
2:
40-
OUT 3
41-
OUT 4
42-
IN 1
40+
-> 3
41+
-> 4
4342
3:
44-
OUT 4
45-
IN 2
43+
-> 4
4644
4:
47-
IN 1
48-
IN 2
49-
IN 3
5045
entries: 1:
51-
OUT 2
52-
OUT 4
46+
-> 2
47+
-> 4
5348
// creating simple block with block #1
5449
// Solipsizing branches into 2
5550
relevant to solipsize: 1:
56-
OUT 2
57-
OUT 4
51+
-> 2
52+
-> 4
5853
// eliminated branch from 1
5954
// Solipsizing branches into 4
6055
relevant to solipsize: 1:
61-
OUT 4
56+
-> 4
6257
// eliminated branch from 1
6358
// Process() running
6459
blocks : 2:
65-
OUT 3
66-
OUT 4
60+
-> 3
61+
-> 4
6762
3:
68-
OUT 4
69-
IN 2
63+
-> 4
7064
4:
71-
IN 2
72-
IN 3
7365
entries: 2:
74-
OUT 3
75-
OUT 4
66+
-> 3
67+
-> 4
7668
4:
77-
IN 2
78-
IN 3
7969
// Investigated independent groups:
8070
group: 2:
81-
OUT 3
82-
OUT 4
71+
-> 3
72+
-> 4
8373
3:
84-
OUT 4
85-
IN 2
74+
-> 4
8675
// Independent groups: 1
8776
// Handleable independent groups: 1
8877
// creating multiple block with 1 inner groups
8978
// multiple group with entry 2:
9079
2:
91-
OUT 3
92-
OUT 4
80+
-> 3
81+
-> 4
9382
3:
94-
OUT 4
95-
IN 2
83+
-> 4
9684
// Solipsizing branches into 4
9785
relevant to solipsize: 2:
98-
OUT 3
99-
OUT 4
86+
-> 3
87+
-> 4
10088
3:
101-
OUT 4
102-
IN 2
89+
-> 4
10390
// eliminated branch from 2
10491
// eliminated branch from 3
10592
// Process() called
10693
// Process() running
10794
blocks : 2:
108-
OUT 3
95+
-> 3
10996
3:
110-
IN 2
11197
entries: 2:
112-
OUT 3
98+
-> 3
11399
// creating simple block with block #2
114100
// Solipsizing branches into 3
115101
relevant to solipsize: 2:
116-
OUT 3
102+
-> 3
117103
// eliminated branch from 2
118104
// Process() running
119105
blocks : 3:

0 commit comments

Comments
 (0)