Skip to content

Commit 462869c

Browse files
committed
[MERGE #6208 @wyrichte] Better fix for #5950: only update ByteCodeUpwardExposedUsed when instr branches to its own bc offset when branch is also to a different block
Merge pull request #6208 from wyrichte:build/wyrichte/bcupwardexposedused
2 parents 4ed51ed + d7c1f53 commit 462869c

File tree

3 files changed

+80
-4
lines changed

3 files changed

+80
-4
lines changed

lib/Backend/BackwardPass.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2675,10 +2675,9 @@ BackwardPass::ProcessBailOutInfo(IR::Instr * instr, BailOutInfo * bailOutInfo)
26752675
uint32 targetOffset = target->GetByteCodeOffset();
26762676

26772677
// If the instr's label has the same bytecode offset as the instr then move the targetOffset
2678-
// to the next bytecode instr. This condition can be true on conditional branches, ex: a
2679-
// while loop with no body (passing the loop's condition would branch the IP back to executing
2680-
// the loop's condition), in these cases do not move the targetOffset.
2681-
if (targetOffset == instr->GetByteCodeOffset() && branchInstr->IsUnconditional())
2678+
// to the next bytecode instr. This can happen when we have airlock blocks or compensation
2679+
// code, but also for infinite loops. Don't do it for the latter.
2680+
if (targetOffset == instr->GetByteCodeOffset() && block != target->GetBasicBlock())
26822681
{
26832682
// This can happen if the target is a break or airlock block.
26842683
Assert(
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
//-------------------------------------------------------------------------------------------------------
2+
// Copyright (C) Microsoft. All rights reserved.
3+
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
4+
//-------------------------------------------------------------------------------------------------------
5+
6+
function test0() {
7+
var IntArr0 = [1];
8+
var strvar0 = '';
9+
function v1() {
10+
var __loopvar1000 = function () {
11+
try {
12+
} finally {
13+
}
14+
LABEL0:
15+
for (_strvar0 in IntArr0) {
16+
switch (strvar0) {
17+
default:
18+
break LABEL0;
19+
case 'Æ':
20+
}
21+
}
22+
}();
23+
}
24+
v1();
25+
}
26+
test0();
27+
test0();
28+
29+
function test1() {
30+
var IntArr0 = [];
31+
var VarArr0 = [''];
32+
var strvar0 = '';
33+
LABEL1:
34+
for (; ;) {
35+
for (var _strvar0 of IntArr0) {
36+
}
37+
switch (strvar0) {
38+
default:
39+
break LABEL1;
40+
case '+':
41+
}
42+
}
43+
async function func183() {
44+
class class35 {
45+
static func219(argMath271 = Math.acos(strvar0 + 21623524.9) - b) {
46+
class class42 extends BaseClass {
47+
constructor() {
48+
}
49+
func221() {
50+
if (false) {
51+
}
52+
}
53+
static func223() {
54+
fPolyProp = function () {
55+
if (undefined) {
56+
}
57+
};
58+
}
59+
}
60+
for (_strvar3 of VarArr0) {
61+
strvar7.concat(IntArr1.push(obj0, a instanceof ('AsyncFunction' ? func4 : Object), ary));
62+
}
63+
}
64+
}
65+
}
66+
}
67+
test1();
68+
test1();
69+
test1();
70+
71+
console.log("PASSED");

test/FlowGraph/rlexe.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,10 @@
2424
<compile-flags>-maxinterpretcount:1 -maxsimplejitruncount:1 -bgjit- -oopjit- -off:jitloopbody</compile-flags>
2525
</default>
2626
</test>
27+
<test>
28+
<default>
29+
<files>byteCodeUpwardExposedUsed.js</files>
30+
<compile-flags>-maxinterpretcount:1 -maxsimplejitruncount:1 -bgjit- -oopjit-</compile-flags>
31+
</default>
32+
</test>
2733
</regress-exe>

0 commit comments

Comments
 (0)