|
|
@@ -1,8 +1,6 @@
|
|
|
|
|
|
let imports = {};
|
|
|
imports['__wbindgen_placeholder__'] = module.exports;
|
|
|
-let wasm;
|
|
|
-const { TextEncoder, TextDecoder } = require(`util`);
|
|
|
|
|
|
function debugString(val) {
|
|
|
// primitive types
|
|
|
@@ -80,20 +78,18 @@ function getUint8ArrayMemory0() {
|
|
|
return cachedUint8ArrayMemory0;
|
|
|
}
|
|
|
|
|
|
-const cachedTextEncoder = new TextEncoder('utf-8');
|
|
|
+const cachedTextEncoder = new TextEncoder();
|
|
|
|
|
|
-const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
|
|
|
- ? function (arg, view) {
|
|
|
- return cachedTextEncoder.encodeInto(arg, view);
|
|
|
+if (!('encodeInto' in cachedTextEncoder)) {
|
|
|
+ cachedTextEncoder.encodeInto = function (arg, view) {
|
|
|
+ const buf = cachedTextEncoder.encode(arg);
|
|
|
+ view.set(buf);
|
|
|
+ return {
|
|
|
+ read: arg.length,
|
|
|
+ written: buf.length
|
|
|
+ };
|
|
|
+ }
|
|
|
}
|
|
|
- : function (arg, view) {
|
|
|
- const buf = cachedTextEncoder.encode(arg);
|
|
|
- view.set(buf);
|
|
|
- return {
|
|
|
- read: arg.length,
|
|
|
- written: buf.length
|
|
|
- };
|
|
|
-});
|
|
|
|
|
|
function passStringToWasm0(arg, malloc, realloc) {
|
|
|
|
|
|
@@ -124,7 +120,7 @@ function passStringToWasm0(arg, malloc, realloc) {
|
|
|
}
|
|
|
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
|
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
|
- const ret = encodeString(arg, view);
|
|
|
+ const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
|
|
|
|
offset += ret.written;
|
|
|
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
|
@@ -170,7 +166,7 @@ function getArrayU8FromWasm0(ptr, len) {
|
|
|
* @param {string} source
|
|
|
* @returns {Uint8Array}
|
|
|
*/
|
|
|
-module.exports.assemble = function(source) {
|
|
|
+exports.assemble = function(source) {
|
|
|
const ptr0 = passStringToWasm0(source, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
|
const len0 = WASM_VECTOR_LEN;
|
|
|
const ret = wasm.assemble(ptr0, len0);
|
|
|
@@ -182,25 +178,25 @@ module.exports.assemble = function(source) {
|
|
|
return v2;
|
|
|
};
|
|
|
|
|
|
-module.exports.__wbg_new_07b483f72211fd66 = function() {
|
|
|
+exports.__wbg_new_19c25a3f2fa63a02 = function() {
|
|
|
const ret = new Object();
|
|
|
return ret;
|
|
|
};
|
|
|
|
|
|
-module.exports.__wbg_new_58353953ad2097cc = function() {
|
|
|
+exports.__wbg_new_1f3a344cf3123716 = function() {
|
|
|
const ret = new Array();
|
|
|
return ret;
|
|
|
};
|
|
|
|
|
|
-module.exports.__wbg_set_3f1d0b984ed272ed = function(arg0, arg1, arg2) {
|
|
|
+exports.__wbg_set_3f1d0b984ed272ed = function(arg0, arg1, arg2) {
|
|
|
arg0[arg1] = arg2;
|
|
|
};
|
|
|
|
|
|
-module.exports.__wbg_set_7422acbe992d64ab = function(arg0, arg1, arg2) {
|
|
|
+exports.__wbg_set_90f6c0f7bd8c0415 = function(arg0, arg1, arg2) {
|
|
|
arg0[arg1 >>> 0] = arg2;
|
|
|
};
|
|
|
|
|
|
-module.exports.__wbindgen_debug_string = function(arg0, arg1) {
|
|
|
+exports.__wbg_wbindgendebugstring_99ef257a3ddda34d = function(arg0, arg1) {
|
|
|
const ret = debugString(arg1);
|
|
|
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
|
const len1 = WASM_VECTOR_LEN;
|
|
|
@@ -208,7 +204,17 @@ module.exports.__wbindgen_debug_string = function(arg0, arg1) {
|
|
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
|
};
|
|
|
|
|
|
-module.exports.__wbindgen_init_externref_table = function() {
|
|
|
+exports.__wbg_wbindgenthrow_451ec1a8469d7eb6 = function(arg0, arg1) {
|
|
|
+ throw new Error(getStringFromWasm0(arg0, arg1));
|
|
|
+};
|
|
|
+
|
|
|
+exports.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
|
|
|
+ // Cast intrinsic for `Ref(String) -> Externref`.
|
|
|
+ const ret = getStringFromWasm0(arg0, arg1);
|
|
|
+ return ret;
|
|
|
+};
|
|
|
+
|
|
|
+exports.__wbindgen_init_externref_table = function() {
|
|
|
const table = wasm.__wbindgen_export_2;
|
|
|
const offset = table.grow(4);
|
|
|
table.set(0, undefined);
|
|
|
@@ -219,22 +225,10 @@ module.exports.__wbindgen_init_externref_table = function() {
|
|
|
;
|
|
|
};
|
|
|
|
|
|
-module.exports.__wbindgen_string_new = function(arg0, arg1) {
|
|
|
- const ret = getStringFromWasm0(arg0, arg1);
|
|
|
- return ret;
|
|
|
-};
|
|
|
-
|
|
|
-module.exports.__wbindgen_throw = function(arg0, arg1) {
|
|
|
- throw new Error(getStringFromWasm0(arg0, arg1));
|
|
|
-};
|
|
|
-
|
|
|
-const path = require('path').join(__dirname, 'sbpf_assembler_bg.wasm');
|
|
|
-const bytes = require('fs').readFileSync(path);
|
|
|
-
|
|
|
-const wasmModule = new WebAssembly.Module(bytes);
|
|
|
-const wasmInstance = new WebAssembly.Instance(wasmModule, imports);
|
|
|
-wasm = wasmInstance.exports;
|
|
|
-module.exports.__wasm = wasm;
|
|
|
+const wasmPath = `${__dirname}/sbpf_assembler_bg.wasm`;
|
|
|
+const wasmBytes = require('fs').readFileSync(wasmPath);
|
|
|
+const wasmModule = new WebAssembly.Module(wasmBytes);
|
|
|
+const wasm = exports.__wasm = new WebAssembly.Instance(wasmModule, imports).exports;
|
|
|
|
|
|
wasm.__wbindgen_start();
|
|
|
|