summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/fuzz_opt.py38
-rw-r--r--scripts/fuzz_shell.js72
2 files changed, 55 insertions, 55 deletions
diff --git a/scripts/fuzz_opt.py b/scripts/fuzz_opt.py
index 7410d4262..110d457a1 100644
--- a/scripts/fuzz_opt.py
+++ b/scripts/fuzz_opt.py
@@ -245,7 +245,7 @@ class Wasm2JS(TestCaseHandler):
return out
-class Bysyncify(TestCaseHandler):
+class Asyncify(TestCaseHandler):
def handle_pair(self, before_wasm, after_wasm, opts):
# we must legalize in order to run in JS
run([in_bin('wasm-opt'), before_wasm, '--legalize-js-interface', '-o', before_wasm] + FEATURE_OPTS)
@@ -255,10 +255,10 @@ class Bysyncify(TestCaseHandler):
# TODO: also something that actually does async sleeps in the code, say
# on the logging commands?
- # --remove-unused-module-elements removes the bysyncify intrinsics, which are not valid to call
+ # --remove-unused-module-elements removes the asyncify intrinsics, which are not valid to call
- def do_bysyncify(wasm):
- cmd = [in_bin('wasm-opt'), wasm, '--bysyncify', '-o', 't.wasm']
+ def do_asyncify(wasm):
+ cmd = [in_bin('wasm-opt'), wasm, '--asyncify', '-o', 't.wasm']
if random.random() < 0.5:
cmd += ['--optimize-level=%d' % random.randint(1, 3)]
if random.random() < 0.5:
@@ -266,25 +266,25 @@ class Bysyncify(TestCaseHandler):
cmd += FEATURE_OPTS
run(cmd)
out = run_d8('t.wasm')
- # emit some status logging from bysyncify
+ # emit some status logging from asyncify
print(out.splitlines()[-1])
- # ignore the output from the new bysyncify API calls - the ones with asserts will trap, too
- for ignore in ['[fuzz-exec] calling $bysyncify_start_unwind\nexception!\n',
- '[fuzz-exec] calling $bysyncify_start_unwind\n',
- '[fuzz-exec] calling $bysyncify_start_rewind\nexception!\n',
- '[fuzz-exec] calling $bysyncify_start_rewind\n',
- '[fuzz-exec] calling $bysyncify_stop_rewind\n',
- '[fuzz-exec] calling $bysyncify_stop_unwind\n']:
+ # ignore the output from the new asyncify API calls - the ones with asserts will trap, too
+ for ignore in ['[fuzz-exec] calling $asyncify_start_unwind\nexception!\n',
+ '[fuzz-exec] calling $asyncify_start_unwind\n',
+ '[fuzz-exec] calling $asyncify_start_rewind\nexception!\n',
+ '[fuzz-exec] calling $asyncify_start_rewind\n',
+ '[fuzz-exec] calling $asyncify_stop_rewind\n',
+ '[fuzz-exec] calling $asyncify_stop_unwind\n']:
out = out.replace(ignore, '')
- out = '\n'.join([l for l in out.splitlines() if 'bysyncify: ' not in l])
+ out = '\n'.join([l for l in out.splitlines() if 'asyncify: ' not in l])
return fix_output(out)
- before_bysyncify = do_bysyncify(before_wasm)
- after_bysyncify = do_bysyncify(after_wasm)
+ before_asyncify = do_asyncify(before_wasm)
+ after_asyncify = do_asyncify(after_wasm)
- compare(before, after, 'Bysyncify (before/after)')
- compare(before, before_bysyncify, 'Bysyncify (before/before_bysyncify)')
- compare(before, after_bysyncify, 'Bysyncify (before/after_bysyncify)')
+ compare(before, after, 'Asyncify (before/after)')
+ compare(before, before_asyncify, 'Asyncify (before/before_asyncify)')
+ compare(before, after_asyncify, 'Asyncify (before/after_asyncify)')
# The global list of all test case handlers
@@ -293,7 +293,7 @@ testcase_handlers = [
FuzzExec(),
CheckDeterminism(),
Wasm2JS(),
- Bysyncify(),
+ Asyncify(),
]
diff --git a/scripts/fuzz_shell.js b/scripts/fuzz_shell.js
index a596bc494..671a054c4 100644
--- a/scripts/fuzz_shell.js
+++ b/scripts/fuzz_shell.js
@@ -38,8 +38,8 @@ var detrand = (function() {
};
})();
-// Bysyncify integration.
-var Bysyncify = {
+// Asyncify integration.
+var Asyncify = {
sleeping: false,
sleepingFunction: null,
sleeps: 0,
@@ -55,43 +55,43 @@ var Bysyncify = {
if (typeof imports[module][i] === 'function') {
(function(module, i) {
ret[module][i] = function() {
- if (!Bysyncify.sleeping) {
- // Sleep if bysyncify support is present, and at a certain
+ if (!Asyncify.sleeping) {
+ // Sleep if asyncify support is present, and at a certain
// probability.
- if (exports.bysyncify_start_unwind &&
+ if (exports.asyncify_start_unwind &&
detrand() < 0.5) {
// We are called in order to start a sleep/unwind.
- console.log('bysyncify: sleep in ' + i + '...');
- Bysyncify.sleepingFunction = i;
- Bysyncify.sleeps++;
+ console.log('asyncify: sleep in ' + i + '...');
+ Asyncify.sleepingFunction = i;
+ Asyncify.sleeps++;
var depth = new Error().stack.split('\n').length - 6;
- Bysyncify.maxDepth = Math.max(Bysyncify.maxDepth, depth);
+ Asyncify.maxDepth = Math.max(Asyncify.maxDepth, depth);
// Save the memory we use for data, so after we restore it later, the
// sleep/resume appears to have had no change to memory.
- Bysyncify.savedMemory = new Int32Array(view.subarray(Bysyncify.DATA_ADDR >> 2, Bysyncify.DATA_MAX >> 2));
+ Asyncify.savedMemory = new Int32Array(view.subarray(Asyncify.DATA_ADDR >> 2, Asyncify.DATA_MAX >> 2));
// Unwinding.
// Fill in the data structure. The first value has the stack location,
// which for simplicity we can start right after the data structure itself.
- view[Bysyncify.DATA_ADDR >> 2] = Bysyncify.DATA_ADDR + 8;
+ view[Asyncify.DATA_ADDR >> 2] = Asyncify.DATA_ADDR + 8;
// The end of the stack will not be reached here anyhow.
- view[Bysyncify.DATA_ADDR + 4 >> 2] = Bysyncify.DATA_MAX;
- exports.bysyncify_start_unwind(Bysyncify.DATA_ADDR);
- Bysyncify.sleeping = true;
+ view[Asyncify.DATA_ADDR + 4 >> 2] = Asyncify.DATA_MAX;
+ exports.asyncify_start_unwind(Asyncify.DATA_ADDR);
+ Asyncify.sleeping = true;
} else {
// Don't sleep, normal execution.
return imports[module][i].apply(null, arguments);
}
} else {
// We are called as part of a resume/rewind. Stop sleeping.
- console.log('bysyncify: resume in ' + i + '...');
- assert(Bysyncify.sleepingFunction === i);
- exports.bysyncify_stop_rewind();
+ console.log('asyncify: resume in ' + i + '...');
+ assert(Asyncify.sleepingFunction === i);
+ exports.asyncify_stop_rewind();
// The stack should have been all used up, and so returned to the original state.
- assert(view[Bysyncify.DATA_ADDR >> 2] == Bysyncify.DATA_ADDR + 8);
- assert(view[Bysyncify.DATA_ADDR + 4 >> 2] == Bysyncify.DATA_MAX);
- Bysyncify.sleeping = false;
+ assert(view[Asyncify.DATA_ADDR >> 2] == Asyncify.DATA_ADDR + 8);
+ assert(view[Asyncify.DATA_ADDR + 4 >> 2] == Asyncify.DATA_MAX);
+ Asyncify.sleeping = false;
// Restore the memory to the state from before we slept.
- view.set(Bysyncify.savedMemory, Bysyncify.DATA_ADDR >> 2);
+ view.set(Asyncify.savedMemory, Asyncify.DATA_ADDR >> 2);
return imports[module][i].apply(null, arguments);
}
};
@@ -101,7 +101,7 @@ var Bysyncify = {
}
}
}
- // Add ignored.print, which is ignored by bysyncify, and allows debugging of bysyncified code.
+ // Add ignored.print, which is ignored by asyncify, and allows debugging of asyncified code.
ret['ignored'] = { 'print': function(x, y) { console.log(x, y) } };
return ret;
},
@@ -109,19 +109,19 @@ var Bysyncify = {
var ret = {};
for (var e in exports) {
if (typeof exports[e] === 'function' &&
- !e.startsWith('bysyncify_')) {
+ !e.startsWith('asyncify_')) {
(function(e) {
ret[e] = function() {
while (1) {
var ret = exports[e].apply(null, arguments);
// If we are sleeping, then the stack was unwound; rewind it.
- if (Bysyncify.sleeping) {
- console.log('bysyncify: stop unwind; rewind');
+ if (Asyncify.sleeping) {
+ console.log('asyncify: stop unwind; rewind');
assert(!ret, 'results during sleep are meaningless, just 0');
- //console.log('bysyncify: after unwind', view[Bysyncify.DATA_ADDR >> 2], view[Bysyncify.DATA_ADDR + 4 >> 2]);
+ //console.log('asyncify: after unwind', view[Asyncify.DATA_ADDR >> 2], view[Asyncify.DATA_ADDR + 4 >> 2]);
try {
- exports.bysyncify_stop_unwind();
- exports.bysyncify_start_rewind(Bysyncify.DATA_ADDR);
+ exports.asyncify_stop_unwind();
+ exports.asyncify_start_rewind(Asyncify.DATA_ADDR);
} catch (e) {
console.log('error in unwind/rewind switch', e);
}
@@ -138,11 +138,11 @@ var Bysyncify = {
return ret;
},
check: function() {
- assert(!Bysyncify.sleeping);
+ assert(!Asyncify.sleeping);
},
finish: function() {
- if (Bysyncify.sleeps > 0) {
- print('bysyncify:', 'sleeps:', Bysyncify.sleeps, 'max depth:', Bysyncify.maxDepth);
+ if (Asyncify.sleeps > 0) {
+ print('asyncify:', 'sleeps:', Asyncify.sleeps, 'max depth:', Asyncify.maxDepth);
}
},
};
@@ -170,14 +170,14 @@ var imports = {
},
};
-imports = Bysyncify.instrumentImports(imports);
+imports = Asyncify.instrumentImports(imports);
// Create the wasm.
var instance = new WebAssembly.Instance(new WebAssembly.Module(binary), imports);
// Handle the exports.
var exports = instance.exports;
-exports = Bysyncify.instrumentExports(exports);
+exports = Asyncify.instrumentExports(exports);
if (exports.memory) {
var view = new Int32Array(exports.memory.buffer);
}
@@ -190,10 +190,10 @@ for (var e in exports) {
sortedExports.sort();
sortedExports = sortedExports.filter(function(e) {
// Filter special intrinsic functions.
- return !e.startsWith('bysyncify_');
+ return !e.startsWith('asyncify_');
});
sortedExports.forEach(function(e) {
- Bysyncify.check();
+ Asyncify.check();
if (typeof exports[e] !== 'function') return;
try {
console.log('[fuzz-exec] calling $' + e);
@@ -207,5 +207,5 @@ sortedExports.forEach(function(e) {
});
// Finish up
-Bysyncify.finish();
+Asyncify.finish();