From d58ed6c8e3baa0ef9efae01e1d7a871385ded7d9 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Fri, 23 Feb 2024 12:07:49 -0800 Subject: [PATCH 1/6] work --- scripts/fuzz_opt.py | 7 +++++-- scripts/fuzz_shell.js | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/scripts/fuzz_opt.py b/scripts/fuzz_opt.py index 6705d79526c..c8ee39f283a 100755 --- a/scripts/fuzz_opt.py +++ b/scripts/fuzz_opt.py @@ -469,6 +469,9 @@ def pick_initial_contents(): # and also see the --dce workaround below that also links to those issues. V8_UNINITIALIZED_NONDEF_LOCAL = 'uninitialized non-defaultable local' +# JS exceptions are logged as exception: REASON +EXCEPTION_PREFIX = 'exception: ' + # given a call line that includes FUZZ_EXEC_CALL_PREFIX, return the export that # is called @@ -576,7 +579,7 @@ def fix_double(x): out = re.sub(r'f64\.const (-?[nanN:abcdefxIity\d+-.]+)', fix_double, out) # mark traps from wasm-opt as exceptions, even though they didn't run in a vm - out = out.replace(TRAP_PREFIX, 'exception: ' + TRAP_PREFIX) + out = out.replace(TRAP_PREFIX, EXCEPTION_PREFIX + TRAP_PREFIX) # funcref(0) has the index of the function in it, and optimizations can # change that index, so ignore it @@ -595,7 +598,7 @@ def fix_double(x): # developer can see it. print(line) lines[i] = None - elif 'exception' in line: + elif EXCEPTION_PREFIX in line: # exceptions may differ when optimizing, but an exception should # occur, so ignore their types (also js engines print them out # slightly differently) diff --git a/scripts/fuzz_shell.js b/scripts/fuzz_shell.js index 106c877aa0d..ea6594dd300 100644 --- a/scripts/fuzz_shell.js +++ b/scripts/fuzz_shell.js @@ -139,7 +139,7 @@ for (var e in exports) { console.log('[fuzz-exec] note result: ' + e + ' => ' + printed(result)); } } catch (e) { - console.log('exception!');// + [e, e.stack]); + console.log('exception: ' + e); } } From 82692cc7fe1d8583caa46dae1b9a028fd5ad7f83 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Thu, 29 Feb 2024 13:32:59 -0800 Subject: [PATCH 2/6] fix --- scripts/fuzz_opt.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/fuzz_opt.py b/scripts/fuzz_opt.py index 50edd3f6c11..e612bb696ca 100755 --- a/scripts/fuzz_opt.py +++ b/scripts/fuzz_opt.py @@ -597,6 +597,9 @@ def fix_double(x): # to "N". out = re.sub(r'i31ref\((-?\d+)\)', r'\1', out) + # Tag names may change due to opts, so canonicalize them. + out = re.sub(r' tag\$\d+', ' tag', out) + lines = out.splitlines() for i in range(len(lines)): line = lines[i] From fb8a65b3eba7c64a0773f3dbde05af4280838fd4 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Thu, 29 Feb 2024 13:37:30 -0800 Subject: [PATCH 3/6] fix --- scripts/fuzz_shell.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/fuzz_shell.js b/scripts/fuzz_shell.js index 4b940795caa..9a82cdcda49 100644 --- a/scripts/fuzz_shell.js +++ b/scripts/fuzz_shell.js @@ -143,7 +143,7 @@ for (var e in exports) { console.log('[fuzz-exec] note result: ' + e + ' => ' + printed(result)); } } catch (e) { - console.log('exception: ' + e); + console.log('exception thrown: ' + e); } } From e9be3c5b6d636265c19f89de20694ccafe109c76 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Thu, 29 Feb 2024 13:37:42 -0800 Subject: [PATCH 4/6] fix --- scripts/fuzz_opt.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/fuzz_opt.py b/scripts/fuzz_opt.py index e612bb696ca..494a8f7ede3 100755 --- a/scripts/fuzz_opt.py +++ b/scripts/fuzz_opt.py @@ -478,7 +478,7 @@ def pick_initial_contents(): V8_UNINITIALIZED_NONDEF_LOCAL = 'uninitialized non-defaultable local' # JS exceptions are logged as exception: REASON -EXCEPTION_PREFIX = 'exception: ' +EXCEPTION_PREFIX = 'exception thrown: ' # given a call line that includes FUZZ_EXEC_CALL_PREFIX, return the export that From 8f8519f523579afb8f57e710ef84c62b06286550 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Thu, 29 Feb 2024 13:55:37 -0800 Subject: [PATCH 5/6] fix --- scripts/fuzz_shell.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/fuzz_shell.js b/scripts/fuzz_shell.js index 9a82cdcda49..be65ce31c27 100644 --- a/scripts/fuzz_shell.js +++ b/scripts/fuzz_shell.js @@ -108,7 +108,7 @@ var instance; try { instance = new WebAssembly.Instance(module, imports); } catch (e) { - console.log('exception: failed to instantiate module'); + console.log('exception thrown: failed to instantiate module'); quit(); } From 06400d92eb5d6ca4930f2f86a74cc9d50f9e82e0 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Thu, 29 Feb 2024 13:58:26 -0800 Subject: [PATCH 6/6] comment --- scripts/fuzz_opt.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/fuzz_opt.py b/scripts/fuzz_opt.py index 494a8f7ede3..1b9f966c8af 100755 --- a/scripts/fuzz_opt.py +++ b/scripts/fuzz_opt.py @@ -477,7 +477,7 @@ def pick_initial_contents(): # and also see the --dce workaround below that also links to those issues. V8_UNINITIALIZED_NONDEF_LOCAL = 'uninitialized non-defaultable local' -# JS exceptions are logged as exception: REASON +# JS exceptions are logged as exception thrown: REASON EXCEPTION_PREFIX = 'exception thrown: '