Skip to content

Instantly share code, notes, and snippets.

var b;
b ||= typeof Module != 'undefined' ? Module : {};
var f = "object" == typeof window, g = "function" == typeof importScripts,
h = "object" == typeof process && "object" == typeof process.versions &&
"string" == typeof process.versions.node,
k = Object.assign({}, b), l = (a, c) => { throw c; }, m = "";
function n() {
var a = p;
return b.locateFile ? b.locateFile(a, m) : m + a
}
[
{
id: 'Block',
fields: [
{
form: 'CHILD_VECTOR',
name: 'list',
},
{
form: 'SCOPE_NAME_DEF',
@kripken
kripken / diff.diff
Created February 22, 2024 20:49
Binaryen wasm-opt.js pthreads build
diff --git a/CMakeLists.txt b/CMakeLists.txt
index def330b27..01ac747b9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -336,12 +336,12 @@ if(EMSCRIPTEN)
add_link_flag("-sALLOW_MEMORY_GROWTH")
add_link_flag("-sSTACK_SIZE=5MB")
- if(EMSCRIPTEN_ENABLE_WASM_EH)
- add_compile_flag("-fwasm-exceptions")
// Auto-generated C API
// Block
BINARYEN_API BinaryenExpressionRef BinaryenBlockGetListAt(BinaryenExpressionRef expr, BinaryenIndex index);
// If
BINARYEN_API BinaryenExpressionRef BinaryenIfGetIfTrue(BinaryenExpressionRef expr);
BINARYEN_API BinaryenExpressionRef BinaryenIfGetCondition(BinaryenExpressionRef expr);
// Loop
@kripken
kripken / a.c
Last active February 1, 2024 22:20
#include <emscripten.h>
extern void launch_missiles();
extern void foo_checkin();
extern void bar_checkin();
void (*mutable_global)() = &launch_missiles;
void benign() {}
--- a.out.js 2024-01-31 09:42:57.311326787 -0800
+++ b.out.js 2024-01-31 09:43:14.131501278 -0800
@@ -1,40 +1,38 @@
var Module = typeof Module != "undefined" ? Module : {};
var moduleOverrides = Object.assign({}, Module);
var arguments_ = [];
var thisProgram = "./this.program";
diff --git a/test/lit/passes/once-reduction.wast b/test/lit/passes/once-reduction.wast
index dd15da5da..7feae8857 100644
--- a/test/lit/passes/once-reduction.wast
+++ b/test/lit/passes/once-reduction.wast
@@ -1349,311 +1349,311 @@
)
;; Corner case: Exported mutable global. We cannot optimize it, since the
;; outside may read and write it.
(module
#include <atomic>
#include <cassert>
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <emscripten.h>
#include <emscripten/threading.h>
#include <emscripten/console.h>
#include <unistd.h>
diff --git a/src/wasm/wasm-s-parser.cpp b/src/wasm/wasm-s-parser.cpp
index dec9249c3..b56348b31 100644
--- a/src/wasm/wasm-s-parser.cpp
+++ b/src/wasm/wasm-s-parser.cpp
@@ -42,70 +42,76 @@ int unhex(char c) {
}
if (c >= 'A' && c <= 'F') {
return c - 'A' + 10;
}
throw wasm::ParseException("invalid hexadecimal");
<script>
var module = WebAssembly.instantiateStreaming(fetch("linked_list.wasm"), {});
</script>