aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/fastLong.js18
-rw-r--r--src/jsifier.js37
-rw-r--r--src/library.js2
-rw-r--r--src/modules.js3
-rw-r--r--src/parseTools.js10
-rw-r--r--src/relooper/Relooper.cpp10
-rw-r--r--src/relooper/test.txt108
-rw-r--r--src/relooper/test2.txt12
-rw-r--r--src/relooper/test3.txt34
-rw-r--r--src/relooper/test4.txt24
-rw-r--r--src/relooper/test5.txt46
-rw-r--r--src/relooper/test6.txt12
-rw-r--r--src/relooper/test_debug.txt12
-rw-r--r--src/relooper/test_fuzz1.txt40
-rw-r--r--src/relooper/test_fuzz2.txt10
-rw-r--r--src/relooper/test_fuzz3.txt2
-rw-r--r--src/relooper/test_fuzz4.txt16
-rw-r--r--src/relooper/test_fuzz5.txt82
-rw-r--r--src/relooper/test_fuzz6.txt186
-rw-r--r--src/relooper/test_inf.txt698
-rw-r--r--src/runtime.js6
21 files changed, 689 insertions, 679 deletions
diff --git a/src/fastLong.js b/src/fastLong.js
index d1ce5d39..4f6efd9f 100644
--- a/src/fastLong.js
+++ b/src/fastLong.js
@@ -5,12 +5,12 @@ function ___muldsi3($a, $b) {
var $1 = 0, $2 = 0, $3 = 0, $6 = 0, $8 = 0, $11 = 0, $12 = 0;
$1 = $a & 65535;
$2 = $b & 65535;
- $3 = Math.imul($2, $1);
+ $3 = Math.imul($2, $1) | 0;
$6 = $a >>> 16;
- $8 = ($3 >>> 16) + Math.imul($2, $6) | 0;
+ $8 = ($3 >>> 16) + (Math.imul($2, $6) | 0) | 0;
$11 = $b >>> 16;
- $12 = Math.imul($11, $1);
- return (tempRet0 = (($8 >>> 16) + Math.imul($11, $6) | 0) + ((($8 & 65535) + $12 | 0) >>> 16) | 0, 0 | ($8 + $12 << 16 | $3 & 65535)) | 0;
+ $12 = Math.imul($11, $1) | 0;
+ return (tempRet0 = (($8 >>> 16) + (Math.imul($11, $6) | 0) | 0) + ((($8 & 65535) + $12 | 0) >>> 16) | 0, 0 | ($8 + $12 << 16 | $3 & 65535)) | 0;
}
function ___divdi3($a$0, $a$1, $b$0, $b$1) {
$a$0 = $a$0 | 0;
@@ -47,7 +47,7 @@ function ___remdi3($a$0, $a$1, $b$0, $b$1) {
$4$0 = _i64Subtract($1$0 ^ $a$0, $1$1 ^ $a$1, $1$0, $1$1) | 0;
$4$1 = tempRet0;
$6$0 = _i64Subtract($2$0 ^ $b$0, $2$1 ^ $b$1, $2$0, $2$1) | 0;
- ___udivmoddi4($4$0, $4$1, $6$0, tempRet0, $rem);
+ ___udivmoddi4($4$0, $4$1, $6$0, tempRet0, $rem) | 0;
$10$0 = _i64Subtract(HEAP32[$rem >> 2] ^ $1$0, HEAP32[$rem + 4 >> 2] ^ $1$1, $1$0, $1$1) | 0;
$10$1 = tempRet0;
STACKTOP = __stackBase__;
@@ -63,8 +63,8 @@ function ___muldi3($a$0, $a$1, $b$0, $b$1) {
$y_sroa_0_0_extract_trunc = $b$0;
$1$0 = ___muldsi3($x_sroa_0_0_extract_trunc, $y_sroa_0_0_extract_trunc) | 0;
$1$1 = tempRet0;
- $2 = Math.imul($a$1, $y_sroa_0_0_extract_trunc);
- return (tempRet0 = (Math.imul($b$1, $x_sroa_0_0_extract_trunc) + $2 | 0) + $1$1 | $1$1 & 0, 0 | $1$0 & -1) | 0;
+ $2 = Math.imul($a$1, $y_sroa_0_0_extract_trunc) | 0;
+ return (tempRet0 = ((Math.imul($b$1, $x_sroa_0_0_extract_trunc) | 0) + $2 | 0) + $1$1 | $1$1 & 0, 0 | $1$0 & -1) | 0;
}
function ___udivdi3($a$0, $a$1, $b$0, $b$1) {
$a$0 = $a$0 | 0;
@@ -84,7 +84,7 @@ function ___uremdi3($a$0, $a$1, $b$0, $b$1) {
__stackBase__ = STACKTOP;
STACKTOP = STACKTOP + 8 | 0;
$rem = __stackBase__ | 0;
- ___udivmoddi4($a$0, $a$1, $b$0, $b$1, $rem);
+ ___udivmoddi4($a$0, $a$1, $b$0, $b$1, $rem) | 0;
STACKTOP = __stackBase__;
return (tempRet0 = HEAP32[$rem + 4 >> 2] | 0, HEAP32[$rem >> 2] | 0) | 0;
}
@@ -258,7 +258,7 @@ function ___udivmoddi4($a$0, $a$1, $b$0, $b$1, $rem) {
$149 = $carry_0203 | $q_sroa_0_1199 << 1;
$r_sroa_0_0_insert_insert42$0 = 0 | ($r_sroa_0_1201 << 1 | $q_sroa_1_1198 >>> 31);
$r_sroa_0_0_insert_insert42$1 = $r_sroa_0_1201 >>> 31 | $r_sroa_1_1200 << 1 | 0;
- _i64Subtract($137$0, $137$1, $r_sroa_0_0_insert_insert42$0, $r_sroa_0_0_insert_insert42$1);
+ _i64Subtract($137$0, $137$1, $r_sroa_0_0_insert_insert42$0, $r_sroa_0_0_insert_insert42$1) | 0;
$150$1 = tempRet0;
$151$0 = $150$1 >> 31 | (($150$1 | 0) < 0 ? -1 : 0) << 1;
$152 = $151$0 & 1;
diff --git a/src/jsifier.js b/src/jsifier.js
index 88b9d9f6..062bae6c 100644
--- a/src/jsifier.js
+++ b/src/jsifier.js
@@ -14,6 +14,8 @@ var asmLibraryFunctions = [];
var SETJMP_LABEL = -1;
+var INDENTATION = ' ';
+
// JSifier
function JSify(data, functionsOnly, givenFunctions) {
var mainPass = !functionsOnly;
@@ -591,13 +593,13 @@ function JSify(data, functionsOnly, givenFunctions) {
func.JS += 'function ' + func.ident + '(' + paramIdents.join(', ') + ') {\n';
if (PGO) {
- func.JS += ' PGOMonitor.called["' + func.ident + '"] = 1;\n';
+ func.JS += INDENTATION + 'PGOMonitor.called["' + func.ident + '"] = 1;\n';
}
if (ASM_JS) {
// spell out argument types
func.params.forEach(function(param) {
- func.JS += ' ' + param.ident + ' = ' + asmCoercion(param.ident, param.type) + ';\n';
+ func.JS += INDENTATION + param.ident + ' = ' + asmCoercion(param.ident, param.type) + ';\n';
});
// spell out local variables
@@ -611,7 +613,7 @@ function JSify(data, functionsOnly, givenFunctions) {
i += chunkSize;
}
for (i = 0; i < chunks.length; i++) {
- func.JS += ' var ' + chunks[i].map(function(v) {
+ func.JS += INDENTATION + 'var ' + chunks[i].map(function(v) {
var type = getImplementationType(v);
if (!isIllegalType(type) || v.ident.indexOf('$', 1) > 0) { // not illegal, or a broken up illegal
return v.ident + ' = ' + asmInitializer(type); //, func.variables[v.ident].impl);
@@ -627,7 +629,7 @@ function JSify(data, functionsOnly, givenFunctions) {
if (true) { // TODO: optimize away when not needed
if (CLOSURE_ANNOTATIONS) func.JS += '/** @type {number} */';
- func.JS += ' var label = 0;\n';
+ func.JS += INDENTATION + 'var label = 0;\n';
}
if (ASM_JS) {
@@ -636,12 +638,12 @@ function JSify(data, functionsOnly, givenFunctions) {
hasByVal = hasByVal || param.byVal;
});
if (hasByVal) {
- func.JS += ' var tempParam = 0;\n';
+ func.JS += INDENTATION + 'var tempParam = 0;\n';
}
}
// Prepare the stack, if we need one. If we have other stack allocations, force the stack to be set up.
- func.JS += ' ' + RuntimeGenerator.stackEnter(func.initialStack, func.otherStackAllocations) + ';\n';
+ func.JS += INDENTATION + RuntimeGenerator.stackEnter(func.initialStack, func.otherStackAllocations) + ';\n';
// Make copies of by-value params
// XXX It is not clear we actually need this. While without this we fail, it does look like
@@ -654,7 +656,7 @@ function JSify(data, functionsOnly, givenFunctions) {
if (param.byVal) {
var type = removePointing(param.type);
var typeInfo = Types.types[type];
- func.JS += ' ' + (ASM_JS ? '' : 'var ') + 'tempParam = ' + param.ident + '; ' + param.ident + ' = ' + RuntimeGenerator.stackAlloc(typeInfo.flatSize) + ';' +
+ func.JS += INDENTATION + (ASM_JS ? '' : 'var ') + 'tempParam = ' + param.ident + '; ' + param.ident + ' = ' + RuntimeGenerator.stackAlloc(typeInfo.flatSize) + ';' +
makeCopyValues(param.ident, 'tempParam', typeInfo.flatSize, 'null', null, param.byVal) + ';\n';
}
});
@@ -728,12 +730,12 @@ function JSify(data, functionsOnly, givenFunctions) {
}
ret += 'switch(' + asmCoercion('label', 'i32') + ') {\n';
ret += block.labels.map(function(label) {
- return indent + ' case ' + getLabelId(label.ident) + ': ' + (SHOW_LABELS ? '// ' + getOriginalLabelId(label.ident) : '') + '\n'
- + getLabelLines(label, indent + ' ');
+ return indent + INDENTATION + 'case ' + getLabelId(label.ident) + ': ' + (SHOW_LABELS ? '// ' + getOriginalLabelId(label.ident) : '') + '\n'
+ + getLabelLines(label, indent + INDENTATION + INDENTATION);
}).join('\n') + '\n';
if (func.setjmpTable && ASM_JS) {
// emit a label in which we write to the proper local variable, before jumping to the actual label
- ret += ' case ' + SETJMP_LABEL + ': ';
+ ret += INDENTATION + 'case ' + SETJMP_LABEL + ': ';
ret += func.setjmpTable.map(function(triple) { // original label, label we created for right after the setjmp, variable setjmp result goes into
return 'if ((setjmpLabel|0) == ' + getLabelId(triple.oldLabel) + ') { ' + triple.assignTo + ' = threwValue; label = ' + triple.newLabel + ' }\n';
}).join(' else ');
@@ -741,7 +743,7 @@ function JSify(data, functionsOnly, givenFunctions) {
ret += '__THREW__ = threwValue = 0;\n';
ret += 'break;\n';
}
- if (ASSERTIONS) ret += indent + ' default: assert(0' + (ASM_JS ? '' : ', "bad label: " + label') + ');\n';
+ if (ASSERTIONS) ret += indent + INDENTATION + 'default: assert(0' + (ASM_JS ? '' : ', "bad label: " + label') + ');\n';
ret += indent + '}\n';
if (func.setjmpTable && !ASM_JS) {
ret += ' } catch(e) { if (!e.longjmp || !(e.id in mySetjmpIds)) throw(e); setjmpTable[setjmpLabels[e.id]](e.value) }';
@@ -797,13 +799,13 @@ function JSify(data, functionsOnly, givenFunctions) {
}
return ret;
}
- func.JS += walkBlock(func.block, ' ');
+ func.JS += walkBlock(func.block, INDENTATION);
// Finalize function
if (LABEL_DEBUG && functionNameFilterTest(func.ident)) func.JS += " INDENT = INDENT.substr(0, INDENT.length-2);\n";
// Ensure a return in a function with a type that returns, even if it lacks a return (e.g., if it aborts())
if (RELOOP && func.lines.length > 0 && func.returnType != 'void') {
var returns = func.labels.filter(function(label) { return label.lines[label.lines.length-1].intertype == 'return' }).length;
- if (returns == 0) func.JS += ' return ' + asmCoercion('0', func.returnType);
+ if (returns == 0) func.JS += INDENTATION + 'return ' + asmCoercion('0', func.returnType);
}
func.JS += '}\n';
@@ -1121,7 +1123,7 @@ function JSify(data, functionsOnly, givenFunctions) {
ret += value + '{\n';
}
var phiSet = getPhiSetsForLabel(phiSets, targetLabel);
- ret += ' ' + phiSet + makeBranch(targetLabel, item.currLabelId || null) + '\n';
+ ret += INDENTATION + '' + phiSet + makeBranch(targetLabel, item.currLabelId || null) + '\n';
ret += '}\n';
if (RELOOP) {
item.groupedLabels.push({
@@ -1185,8 +1187,13 @@ function JSify(data, functionsOnly, givenFunctions) {
if (disabled) {
ret = call_ + ';';
} else if (ASM_JS) {
+ if (item.type != 'void') call_ = asmCoercion(call_, item.type); // ensure coercion to ffi in comma operator
call_ = call_.replace('; return', ''); // we auto-add returns when aborting, but do not need them here
- ret = '(__THREW__ = 0,' + call_ + ');';
+ if (item.type == 'void') {
+ ret = '__THREW__ = 0;' + call_ + ';';
+ } else {
+ ret = '(__THREW__ = 0,' + call_ + ');';
+ }
} else {
ret = '(function() { try { __THREW__ = 0; return '
+ call_ + ' '
diff --git a/src/library.js b/src/library.js
index 33dcbd5f..01a67804 100644
--- a/src/library.js
+++ b/src/library.js
@@ -4399,7 +4399,7 @@ LibraryManager.library = {
{{{ makeSetValueAsm('dest', 0, makeGetValueAsm('src', 0, 'i8'), 'i8') }}};
}
} else {
- _memcpy(dest, src, num);
+ _memcpy(dest, src, num) | 0;
}
},
llvm_memmove_i32: 'memmove',
diff --git a/src/modules.js b/src/modules.js
index b13ab3c5..d26acbd5 100644
--- a/src/modules.js
+++ b/src/modules.js
@@ -114,7 +114,8 @@ var Debugging = {
m = metadataToParentMetadata[m];
assert(m, 'Confused as to parent metadata for llvm #' + l + ', metadata !' + m);
}
- this.llvmLineToSourceFile[l] = metadataToFilename[m];
+ // Normalize Windows path slashes coming from LLVM metadata, so that forward slashes can be assumed as path delimiters.
+ this.llvmLineToSourceFile[l] = metadataToFilename[m].replace(/\\5C/g, '/');
}
this.on = true;
diff --git a/src/parseTools.js b/src/parseTools.js
index 687faaa8..0b83a12b 100644
--- a/src/parseTools.js
+++ b/src/parseTools.js
@@ -710,9 +710,9 @@ function splitI64(value, floatConversion) {
var lowInput = legalizedI64s ? value : 'VALUE';
if (floatConversion && ASM_JS) lowInput = asmFloatToInt(lowInput);
if (legalizedI64s) {
- return [lowInput + '>>>0', 'Math.min(Math.floor((' + value + ')/' + asmEnsureFloat(4294967296, 'float') + '), ' + asmEnsureFloat(4294967295, 'float') + ')>>>0'];
+ return [lowInput + '>>>0', asmCoercion('Math.min(' + asmCoercion('Math.floor((' + value + ')/' + asmEnsureFloat(4294967296, 'float') + ')', 'double') + ', ' + asmEnsureFloat(4294967295, 'float') + ')', 'i32') + '>>>0'];
} else {
- return makeInlineCalculation(makeI64(lowInput + '>>>0', 'Math.min(Math.floor(VALUE/' + asmEnsureFloat(4294967296, 'float') + '), ' + asmEnsureFloat(4294967295, 'float') + ')>>>0'), value, 'tempBigIntP');
+ return makeInlineCalculation(makeI64(lowInput + '>>>0', asmCoercion('Math.min(' + asmCoercion('Math.floor(VALUE/' + asmEnsureFloat(4294967296, 'float') + ')', 'double') + ', ' + asmEnsureFloat(4294967295, 'float') + ')', 'i32') + '>>>0'), value, 'tempBigIntP');
}
}
function mergeI64(value, unsigned) {
@@ -1049,7 +1049,7 @@ function getHeapOffset(offset, type, forceAsm) {
offset = '(' + offset + ')';
if (shifts != 0) {
if (CHECK_HEAP_ALIGN) {
- return '(CHECK_ALIGN_' + sz + '(' + offset + '|0)>>' + shifts + ')';
+ return '((CHECK_ALIGN_' + sz + '(' + offset + '|0)|0)>>' + shifts + ')';
} else {
return '(' + offset + '>>' + shifts + ')';
}
@@ -1383,7 +1383,7 @@ function makeCopyValues(dest, src, num, type, modifier, align, sep) {
if (!isNumber(num)) num = stripCorrections(num);
if (!isNumber(align)) align = stripCorrections(align);
if (!isNumber(num) || (parseInt(num)/align >= UNROLL_LOOP_MAX)) {
- return '_memcpy(' + dest + ', ' + src + ', ' + num + ')';
+ return '(_memcpy(' + dest + ', ' + src + ', ' + num + ')|0)';
}
num = parseInt(num);
if (ASM_JS) {
@@ -1465,7 +1465,7 @@ function getFastValue(a, op, b, type) {
if ((isNumber(a) && Math.abs(a) < TWO_TWENTY) || (isNumber(b) && Math.abs(b) < TWO_TWENTY) || (bits < 32 && !ASM_JS)) {
return '(((' + a + ')*(' + b + '))&' + ((Math.pow(2, bits)-1)|0) + ')'; // keep a non-eliminatable coercion directly on this
}
- return 'Math.imul(' + a + ',' + b + ')';
+ return '(Math.imul(' + a + ',' + b + ')|0)';
}
} else {
if (a == '0') {
diff --git a/src/relooper/Relooper.cpp b/src/relooper/Relooper.cpp
index 7ceeb2f8..aa7e71a1 100644
--- a/src/relooper/Relooper.cpp
+++ b/src/relooper/Relooper.cpp
@@ -18,6 +18,8 @@ static void PrintDebug(const char *Format, ...);
#define DebugDump(x, ...)
#endif
+#define INDENTATION 1
+
struct Indenter {
static int CurrIndent;
@@ -34,8 +36,8 @@ static int OutputBufferSize = 0;
void PrintIndented(const char *Format, ...) {
assert(OutputBuffer);
- assert(OutputBuffer + Indenter::CurrIndent*2 - OutputBufferRoot < OutputBufferSize);
- for (int i = 0; i < Indenter::CurrIndent*2; i++, OutputBuffer++) *OutputBuffer = ' ';
+ assert(OutputBuffer + Indenter::CurrIndent*INDENTATION - OutputBufferRoot < OutputBufferSize);
+ for (int i = 0; i < Indenter::CurrIndent*INDENTATION; i++, OutputBuffer++) *OutputBuffer = ' ';
va_list Args;
va_start(Args, Format);
int left = OutputBufferSize - (OutputBuffer - OutputBufferRoot);
@@ -47,8 +49,8 @@ void PrintIndented(const char *Format, ...) {
void PutIndented(const char *String) {
assert(OutputBuffer);
- assert(OutputBuffer + Indenter::CurrIndent*2 - OutputBufferRoot < OutputBufferSize);
- for (int i = 0; i < Indenter::CurrIndent*2; i++, OutputBuffer++) *OutputBuffer = ' ';
+ assert(OutputBuffer + Indenter::CurrIndent*INDENTATION - OutputBufferRoot < OutputBufferSize);
+ for (int i = 0; i < Indenter::CurrIndent*INDENTATION; i++, OutputBuffer++) *OutputBuffer = ' ';
int left = OutputBufferSize - (OutputBuffer - OutputBufferRoot);
int needed = strlen(String)+1;
assert(needed < left);
diff --git a/src/relooper/test.txt b/src/relooper/test.txt
index b3535592..6c910846 100644
--- a/src/relooper/test.txt
+++ b/src/relooper/test.txt
@@ -6,11 +6,11 @@
// block A
if (check == 10) {
- atob();
- // block B
- btoc();
+ atob();
+ // block B
+ btoc();
} else {
- atoc();
+ atoc();
}
// block C
@@ -22,9 +22,9 @@ if (check == 10) {
// block A
if (check == 15) {
- // block B
+ // block B
} else {
- // block C
+ // block C
}
// block D
@@ -35,12 +35,12 @@ if (check == 15) {
while(1) {
- // block A
- var check = maybe();
- // block B
- if (!(check == 41)) {
- break;
- }
+ // block A
+ var check = maybe();
+ // block B
+ if (!(check == 41)) {
+ break;
+ }
}
// block C
@@ -51,25 +51,25 @@ while(1) {
// code 1
var $i_0 = 0;var $x_0 = 5;
while(1) {
- // code 2
- if (!($2)) {
- var $x_1 = $x_0;
- label = 18;
- break;
- }
- // code 3
- if ($6) {
- break;
- } else {
- var $i_0 = $7;var $x_0 = $5;
- }
+ // code 2
+ if (!($2)) {
+ var $x_1 = $x_0;
+ label = 18;
+ break;
+ }
+ // code 3
+ if ($6) {
+ break;
+ } else {
+ var $i_0 = $7;var $x_0 = $5;
+ }
}
if (label == 18) {
- // code 7
+ // code 7
}
// code 4
if ($10) {
- // code 5
+ // code 5
}
// code 6
var $x_1 = $13;
@@ -83,15 +83,15 @@ var $x_1 = $13;
// block A...................................................................................................
if (chak()) {
- atob();
- // block B...................................................................................................
- btod();
- // block D
+ atob();
+ // block B...................................................................................................
+ btod();
+ // block D
} else {
- atoc();
- // block C...................................................................................................
- ctod2();
- // block D
+ atoc();
+ // block C...................................................................................................
+ ctod2();
+ // block D
}
@@ -102,11 +102,11 @@ if (chak()) {
// block A
if (!(check == 10)) {
- return C;
+ return C;
}
while(1) {
- // block B
- // block D
+ // block B
+ // block D
}
@@ -117,23 +117,23 @@ while(1) {
// block A
do {
- if (expensive()) {
- label = 33;
- } else {
- // block B
- if (expensive2()) {
- label = 33;
- break;
- }
- // block D
+ if (expensive()) {
+ label = 33;
+ } else {
+ // block B
+ if (expensive2()) {
+ label = 33;
+ break;
}
+ // block D
+ }
} while(0);
if (label == 33) {
- // block C;
+ // block C;
}
while(1) {
- // block E
- // block F
+ // block E
+ // block F
}
@@ -144,12 +144,12 @@ while(1) {
// block A
if (shouldLoop()) {
- while(1) {
- // block B
- if (!(moarLoop())) {
- break;
- }
+ while(1) {
+ // block B
+ if (!(moarLoop())) {
+ break;
}
+ }
}
// block C
diff --git a/src/relooper/test2.txt b/src/relooper/test2.txt
index c77ce491..2f3e5ca1 100644
--- a/src/relooper/test2.txt
+++ b/src/relooper/test2.txt
@@ -1,12 +1,12 @@
ep
do {
- if (ep -> LBB1) {
- LBB1
- if (!(LBB1 -> LBB2)) {
- break;
- }
- LBB2
+ if (ep -> LBB1) {
+ LBB1
+ if (!(LBB1 -> LBB2)) {
+ break;
}
+ LBB2
+ }
} while(0);
LBB3
diff --git a/src/relooper/test3.txt b/src/relooper/test3.txt
index 6049ee48..51199f72 100644
--- a/src/relooper/test3.txt
+++ b/src/relooper/test3.txt
@@ -1,27 +1,27 @@
ep
do {
- if (ep -> LBB1) {
- LBB1
- if (!(LBB1 -> LBB2)) {
- break;
- }
- LBB2
+ if (ep -> LBB1) {
+ LBB1
+ if (!(LBB1 -> LBB2)) {
+ break;
}
+ LBB2
+ }
} while(0);
LBB3
do {
- if (LBB3 -> LBB4) {
- LBB4
- if (!(LBB4 -> LBB5)) {
- break;
- }
- while(1) {
- LBB5
- if (LBB5 -> LBB6) {
- break;
- }
- }
+ if (LBB3 -> LBB4) {
+ LBB4
+ if (!(LBB4 -> LBB5)) {
+ break;
}
+ while(1) {
+ LBB5
+ if (LBB5 -> LBB6) {
+ break;
+ }
+ }
+ }
} while(0);
LBB6
diff --git a/src/relooper/test4.txt b/src/relooper/test4.txt
index 3427ff18..ab7051c1 100644
--- a/src/relooper/test4.txt
+++ b/src/relooper/test4.txt
@@ -1,23 +1,23 @@
//19
do {
- if ( 1 ) {
- //20
- if (!( 1 )) {
- label = 4;
- break;
- }
- //21
- } else {
- label = 4;
+ if ( 1 ) {
+ //20
+ if (!( 1 )) {
+ label = 4;
+ break;
}
+ //21
+ } else {
+ label = 4;
+ }
} while(0);
if (label == 4) {
- //22
+ //22
}
//23
if ( 1 ) {
- //24
+ //24
} else {
- //28
+ //28
}
diff --git a/src/relooper/test5.txt b/src/relooper/test5.txt
index ad769ae7..83755289 100644
--- a/src/relooper/test5.txt
+++ b/src/relooper/test5.txt
@@ -1,32 +1,32 @@
//0
if (check(0)) {
- while(1) {
- //1
- if (!(check(1))) {
- break;
- }
+ while(1) {
+ //1
+ if (!(check(1))) {
+ break;
}
- while(1) {
- //2
- if (!(check(2))) {
- break;
- }
+ }
+ while(1) {
+ //2
+ if (!(check(2))) {
+ break;
}
- //3
+ }
+ //3
} else {
- goingFrom0to4();
- while(1) {
- //4
- if (!(check(4))) {
- break;
- }
+ goingFrom0to4();
+ while(1) {
+ //4
+ if (!(check(4))) {
+ break;
}
- while(1) {
- //5
- if (check(5)) {
- break;
- }
+ }
+ while(1) {
+ //5
+ if (check(5)) {
+ break;
}
- //3
+ }
+ //3
}
diff --git a/src/relooper/test6.txt b/src/relooper/test6.txt
index c5effd08..4f29f292 100644
--- a/src/relooper/test6.txt
+++ b/src/relooper/test6.txt
@@ -1,12 +1,12 @@
//0
do {
- if (check(0)) {
- //1
- if (!(check(1))) {
- break;
- }
- //2
+ if (check(0)) {
+ //1
+ if (!(check(1))) {
+ break;
}
+ //2
+ }
} while(0);
//3
diff --git a/src/relooper/test_debug.txt b/src/relooper/test_debug.txt
index d18ed875..4a42e642 100644
--- a/src/relooper/test_debug.txt
+++ b/src/relooper/test_debug.txt
@@ -116,13 +116,13 @@ int main() {
// Fusing Multiple to Simple
ep
do {
- if (ep -> LBB1) {
- LBB1
- if (!(LBB1 -> LBB2)) {
- break;
- }
- LBB2
+ if (ep -> LBB1) {
+ LBB1
+ if (!(LBB1 -> LBB2)) {
+ break;
}
+ LBB2
+ }
} while(0);
LBB3
diff --git a/src/relooper/test_fuzz1.txt b/src/relooper/test_fuzz1.txt
index b278e240..becbc0d2 100644
--- a/src/relooper/test_fuzz1.txt
+++ b/src/relooper/test_fuzz1.txt
@@ -4,29 +4,29 @@ print('entry'); var label; var state; var decisions = [4, 1, 7, 2, 6, 6, 8]; var
print(5); state = check();
print(6); state = check();
if (state == 7) {
- print(7); state = check();
- label = 3;
+ print(7); state = check();
+ label = 3;
}
L5: while(1) {
- if (label == 3) {
- label = 0;
- print(2); state = check();
+ if (label == 3) {
+ label = 0;
+ print(2); state = check();
+ }
+ print(1); state = check();
+ while(1) {
+ print(3); state = check();
+ if (!(state == 8)) {
+ continue L5;
}
- print(1); state = check();
- while(1) {
- print(3); state = check();
- if (!(state == 8)) {
- continue L5;
- }
- print(8); state = check();
- if (!(state == 4)) {
- label = 3;
- continue L5;
- }
- print(4); state = check();
- if (!(state == 3)) {
- continue L5;
- }
+ print(8); state = check();
+ if (!(state == 4)) {
+ label = 3;
+ continue L5;
}
+ print(4); state = check();
+ if (!(state == 3)) {
+ continue L5;
+ }
+ }
}
diff --git a/src/relooper/test_fuzz2.txt b/src/relooper/test_fuzz2.txt
index 572e819d..02b2c83b 100644
--- a/src/relooper/test_fuzz2.txt
+++ b/src/relooper/test_fuzz2.txt
@@ -2,12 +2,12 @@
print('entry'); var label; var state; var decisions = [4, 1, 4, 3, 4, 1, 2, 5, 1, 3, 5, 5, 1, 5, 2, 4, 4, 3]; var index = 0; function check() { if (index == decisions.length) throw 'HALT'; return decisions[index++] }
if (state == 1) {
- while(1) {
- print(1); state = check();
- }
+ while(1) {
+ print(1); state = check();
+ }
}
while(1) {
- print(3); state = check();
- print(2); state = check();
+ print(3); state = check();
+ print(2); state = check();
}
diff --git a/src/relooper/test_fuzz3.txt b/src/relooper/test_fuzz3.txt
index aeeccf87..b4b1831d 100644
--- a/src/relooper/test_fuzz3.txt
+++ b/src/relooper/test_fuzz3.txt
@@ -4,6 +4,6 @@ print('entry'); var label; var state; var decisions = [3, 3, 4, 1, 2, 1, 2, 4, 4
print(1); state = check();
print(3); state = check();
while(1) {
- print(4); state = check();
+ print(4); state = check();
}
diff --git a/src/relooper/test_fuzz4.txt b/src/relooper/test_fuzz4.txt
index 05a70582..766ebdb6 100644
--- a/src/relooper/test_fuzz4.txt
+++ b/src/relooper/test_fuzz4.txt
@@ -2,18 +2,18 @@
print('entry'); var label; var state; var decisions = [2, 2, 1, 3, 2, 2, 1, 3, 2, 3, 3, 1, 3, 2, 1]; var index = 0; function check() { if (index == decisions.length) throw 'HALT'; return decisions[index++] }
if (state == 2) {
- while(1) {
- print(2); state = check();
- }
+ while(1) {
+ print(2); state = check();
+ }
}
while(1) {
- print(4); state = check();
- if (!(state == 4)) {
- break;
- }
+ print(4); state = check();
+ if (!(state == 4)) {
+ break;
+ }
}
print(3); state = check();
while(1) {
- print(1); state = check();
+ print(1); state = check();
}
diff --git a/src/relooper/test_fuzz5.txt b/src/relooper/test_fuzz5.txt
index 29b2dba4..0f76d1ed 100644
--- a/src/relooper/test_fuzz5.txt
+++ b/src/relooper/test_fuzz5.txt
@@ -2,51 +2,51 @@
print('entry'); var label; var state; var decisions = [133, 98, 134, 143, 162, 187, 130, 87, 91, 49, 102, 47, 9, 132, 179, 176, 157, 25, 64, 161, 57, 107, 16, 167, 185, 45, 191, 180, 23, 131]; var index = 0; function check() { if (index == decisions.length) throw 'HALT'; return decisions[index++] }
L1: while(1) {
- print(7); state = check();
- if (state % 3 == 1) {
- label = 3;
- } else if (state % 3 == 0) {
- print(8); state = check();
- if (state % 2 == 0) {
- label = 5;
- } else {
- label = 7;
- }
+ print(7); state = check();
+ if (state % 3 == 1) {
+ label = 3;
+ } else if (state % 3 == 0) {
+ print(8); state = check();
+ if (state % 2 == 0) {
+ label = 5;
} else {
- break;
+ label = 7;
}
- while(1) {
- if (label == 3) {
- label = 0;
- print(2); state = check();
- print(1); state = check();
- if (state % 2 == 0) {
- label = 5;
- continue;
- } else {
- label = 7;
- continue;
- }
- }
- else if (label == 5) {
- label = 0;
- print(4); state = check();
- label = 3;
- continue;
- }
- else if (label == 7) {
- label = 0;
- print(6); state = check();
- if (state % 2 == 0) {
- continue L1;
- } else {
- label = 7;
- continue;
- }
- }
+ } else {
+ break;
+ }
+ while(1) {
+ if (label == 3) {
+ label = 0;
+ print(2); state = check();
+ print(1); state = check();
+ if (state % 2 == 0) {
+ label = 5;
+ continue;
+ } else {
+ label = 7;
+ continue;
+ }
}
+ else if (label == 5) {
+ label = 0;
+ print(4); state = check();
+ label = 3;
+ continue;
+ }
+ else if (label == 7) {
+ label = 0;
+ print(6); state = check();
+ if (state % 2 == 0) {