@phala/dcap-qvl-node
Advanced tools
Comparing version 0.1.0-beta.1 to 0.1.0-beta.2
@@ -7,2 +7,22 @@ | ||
const heap = new Array(128).fill(undefined); | ||
heap.push(undefined, null, true, false); | ||
function getObject(idx) { return heap[idx]; } | ||
let heap_next = heap.length; | ||
function dropObject(idx) { | ||
if (idx < 132) return; | ||
heap[idx] = heap_next; | ||
heap_next = idx; | ||
} | ||
function takeObject(idx) { | ||
const ret = getObject(idx); | ||
dropObject(idx); | ||
return ret; | ||
} | ||
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }); | ||
@@ -26,2 +46,11 @@ | ||
function addHeapObject(obj) { | ||
if (heap_next === heap.length) heap.push(heap.length + 1); | ||
const idx = heap_next; | ||
heap_next = heap[idx]; | ||
heap[idx] = obj; | ||
return idx; | ||
} | ||
function isLikeNone(x) { | ||
@@ -160,8 +189,2 @@ return x === undefined || x === null; | ||
} | ||
function takeFromExternrefTable0(idx) { | ||
const value = wasm.__wbindgen_export_2.get(idx); | ||
wasm.__externref_table_dealloc(idx); | ||
return value; | ||
} | ||
/** | ||
@@ -174,15 +197,17 @@ * @param {any} raw_quote | ||
module.exports.js_verify = function(raw_quote, quote_collateral, now) { | ||
const ret = wasm.js_verify(raw_quote, quote_collateral, now); | ||
if (ret[2]) { | ||
throw takeFromExternrefTable0(ret[1]); | ||
try { | ||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); | ||
wasm.js_verify(retptr, addHeapObject(raw_quote), addHeapObject(quote_collateral), now); | ||
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); | ||
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); | ||
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true); | ||
if (r2) { | ||
throw takeObject(r1); | ||
} | ||
return takeObject(r0); | ||
} finally { | ||
wasm.__wbindgen_add_to_stack_pointer(16); | ||
} | ||
return takeFromExternrefTable0(ret[0]); | ||
}; | ||
function addToExternrefTable0(obj) { | ||
const idx = wasm.__externref_table_alloc(); | ||
wasm.__wbindgen_export_2.set(idx, obj); | ||
return idx; | ||
} | ||
function handleError(f, args) { | ||
@@ -192,4 +217,3 @@ try { | ||
} catch (e) { | ||
const idx = addToExternrefTable0(e); | ||
wasm.__wbindgen_exn_store(idx); | ||
wasm.__wbindgen_exn_store(addHeapObject(e)); | ||
} | ||
@@ -202,5 +226,9 @@ } | ||
module.exports.__wbindgen_object_drop_ref = function(arg0) { | ||
takeObject(arg0); | ||
}; | ||
module.exports.__wbindgen_string_new = function(arg0, arg1) { | ||
const ret = getStringFromWasm0(arg0, arg1); | ||
return ret; | ||
return addHeapObject(ret); | ||
}; | ||
@@ -210,7 +238,7 @@ | ||
const ret = new Error(getStringFromWasm0(arg0, arg1)); | ||
return ret; | ||
return addHeapObject(ret); | ||
}; | ||
module.exports.__wbindgen_is_object = function(arg0) { | ||
const val = arg0; | ||
const val = getObject(arg0); | ||
const ret = typeof(val) === 'object' && val !== null; | ||
@@ -221,3 +249,3 @@ return ret; | ||
module.exports.__wbindgen_jsval_loose_eq = function(arg0, arg1) { | ||
const ret = arg0 == arg1; | ||
const ret = getObject(arg0) == getObject(arg1); | ||
return ret; | ||
@@ -227,3 +255,3 @@ }; | ||
module.exports.__wbindgen_boolean_get = function(arg0) { | ||
const v = arg0; | ||
const v = getObject(arg0); | ||
const ret = typeof(v) === 'boolean' ? (v ? 1 : 0) : 2; | ||
@@ -234,3 +262,3 @@ return ret; | ||
module.exports.__wbindgen_number_get = function(arg0, arg1) { | ||
const obj = arg1; | ||
const obj = getObject(arg1); | ||
const ret = typeof(obj) === 'number' ? obj : undefined; | ||
@@ -242,3 +270,3 @@ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true); | ||
module.exports.__wbindgen_string_get = function(arg0, arg1) { | ||
const obj = arg1; | ||
const obj = getObject(arg1); | ||
const ret = typeof(obj) === 'string' ? obj : undefined; | ||
@@ -253,16 +281,21 @@ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); | ||
const ret = arg0; | ||
return ret; | ||
return addHeapObject(ret); | ||
}; | ||
module.exports.__wbindgen_object_clone_ref = function(arg0) { | ||
const ret = getObject(arg0); | ||
return addHeapObject(ret); | ||
}; | ||
module.exports.__wbg_set_20cbc34131e76824 = function(arg0, arg1, arg2) { | ||
arg0[arg1] = arg2; | ||
getObject(arg0)[takeObject(arg1)] = takeObject(arg2); | ||
}; | ||
module.exports.__wbg_get_5419cf6b954aa11d = function(arg0, arg1) { | ||
const ret = arg0[arg1 >>> 0]; | ||
return ret; | ||
const ret = getObject(arg0)[arg1 >>> 0]; | ||
return addHeapObject(ret); | ||
}; | ||
module.exports.__wbg_length_f217bbbf7e8e4df4 = function(arg0) { | ||
const ret = arg0.length; | ||
const ret = getObject(arg0).length; | ||
return ret; | ||
@@ -273,7 +306,7 @@ }; | ||
const ret = new Array(); | ||
return ret; | ||
return addHeapObject(ret); | ||
}; | ||
module.exports.__wbindgen_is_function = function(arg0) { | ||
const ret = typeof(arg0) === 'function'; | ||
const ret = typeof(getObject(arg0)) === 'function'; | ||
return ret; | ||
@@ -283,13 +316,13 @@ }; | ||
module.exports.__wbg_next_13b477da1eaa3897 = function(arg0) { | ||
const ret = arg0.next; | ||
return ret; | ||
const ret = getObject(arg0).next; | ||
return addHeapObject(ret); | ||
}; | ||
module.exports.__wbg_next_b06e115d1b01e10b = function() { return handleError(function (arg0) { | ||
const ret = arg0.next(); | ||
return ret; | ||
const ret = getObject(arg0).next(); | ||
return addHeapObject(ret); | ||
}, arguments) }; | ||
module.exports.__wbg_done_983b5ffcaec8c583 = function(arg0) { | ||
const ret = arg0.done; | ||
const ret = getObject(arg0).done; | ||
return ret; | ||
@@ -299,4 +332,4 @@ }; | ||
module.exports.__wbg_value_2ab8a198c834c26a = function(arg0) { | ||
const ret = arg0.value; | ||
return ret; | ||
const ret = getObject(arg0).value; | ||
return addHeapObject(ret); | ||
}; | ||
@@ -306,13 +339,13 @@ | ||
const ret = Symbol.iterator; | ||
return ret; | ||
return addHeapObject(ret); | ||
}; | ||
module.exports.__wbg_get_ef828680c64da212 = function() { return handleError(function (arg0, arg1) { | ||
const ret = Reflect.get(arg0, arg1); | ||
return ret; | ||
const ret = Reflect.get(getObject(arg0), getObject(arg1)); | ||
return addHeapObject(ret); | ||
}, arguments) }; | ||
module.exports.__wbg_call_a9ef466721e824f2 = function() { return handleError(function (arg0, arg1) { | ||
const ret = arg0.call(arg1); | ||
return ret; | ||
const ret = getObject(arg0).call(getObject(arg1)); | ||
return addHeapObject(ret); | ||
}, arguments) }; | ||
@@ -322,11 +355,11 @@ | ||
const ret = new Object(); | ||
return ret; | ||
return addHeapObject(ret); | ||
}; | ||
module.exports.__wbg_set_425e70f7c64ac962 = function(arg0, arg1, arg2) { | ||
arg0[arg1 >>> 0] = arg2; | ||
getObject(arg0)[arg1 >>> 0] = takeObject(arg2); | ||
}; | ||
module.exports.__wbg_isArray_6f3b47f09adb61b5 = function(arg0) { | ||
const ret = Array.isArray(arg0); | ||
const ret = Array.isArray(getObject(arg0)); | ||
return ret; | ||
@@ -338,3 +371,3 @@ }; | ||
try { | ||
result = arg0 instanceof ArrayBuffer; | ||
result = getObject(arg0) instanceof ArrayBuffer; | ||
} catch (_) { | ||
@@ -348,3 +381,3 @@ result = false; | ||
module.exports.__wbg_isSafeInteger_b9dff570f01a9100 = function(arg0) { | ||
const ret = Number.isSafeInteger(arg0); | ||
const ret = Number.isSafeInteger(getObject(arg0)); | ||
return ret; | ||
@@ -354,22 +387,22 @@ }; | ||
module.exports.__wbg_buffer_ccaed51a635d8a2d = function(arg0) { | ||
const ret = arg0.buffer; | ||
return ret; | ||
const ret = getObject(arg0).buffer; | ||
return addHeapObject(ret); | ||
}; | ||
module.exports.__wbg_newwithbyteoffsetandlength_7e3eb787208af730 = function(arg0, arg1, arg2) { | ||
const ret = new Uint8Array(arg0, arg1 >>> 0, arg2 >>> 0); | ||
return ret; | ||
const ret = new Uint8Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0); | ||
return addHeapObject(ret); | ||
}; | ||
module.exports.__wbg_new_fec2611eb9180f95 = function(arg0) { | ||
const ret = new Uint8Array(arg0); | ||
return ret; | ||
const ret = new Uint8Array(getObject(arg0)); | ||
return addHeapObject(ret); | ||
}; | ||
module.exports.__wbg_set_ec2fcf81bc573fd9 = function(arg0, arg1, arg2) { | ||
arg0.set(arg1, arg2 >>> 0); | ||
getObject(arg0).set(getObject(arg1), arg2 >>> 0); | ||
}; | ||
module.exports.__wbg_length_9254c4bd3b9f23c4 = function(arg0) { | ||
const ret = arg0.length; | ||
const ret = getObject(arg0).length; | ||
return ret; | ||
@@ -381,3 +414,3 @@ }; | ||
try { | ||
result = arg0 instanceof Uint8Array; | ||
result = getObject(arg0) instanceof Uint8Array; | ||
} catch (_) { | ||
@@ -391,3 +424,3 @@ result = false; | ||
module.exports.__wbindgen_debug_string = function(arg0, arg1) { | ||
const ret = debugString(arg1); | ||
const ret = debugString(getObject(arg1)); | ||
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); | ||
@@ -405,16 +438,5 @@ const len1 = WASM_VECTOR_LEN; | ||
const ret = wasm.memory; | ||
return ret; | ||
return addHeapObject(ret); | ||
}; | ||
module.exports.__wbindgen_init_externref_table = function() { | ||
const table = wasm.__wbindgen_export_2; | ||
const offset = table.grow(4); | ||
table.set(0, undefined); | ||
table.set(offset + 0, undefined); | ||
table.set(offset + 1, null); | ||
table.set(offset + 2, true); | ||
table.set(offset + 3, false); | ||
; | ||
}; | ||
const path = require('path').join(__dirname, 'dcap-qvl-node_bg.wasm'); | ||
@@ -428,3 +450,1 @@ const bytes = require('fs').readFileSync(path); | ||
wasm.__wbindgen_start(); | ||
@@ -12,3 +12,3 @@ { | ||
"homepage": "https://github.com/Phala-Network/dcap-qvl", | ||
"version": "0.1.0-beta.1", | ||
"version": "0.1.0-beta.2", | ||
"license": "MIT", | ||
@@ -22,2 +22,2 @@ "files": [ | ||
"types": "dcap-qvl-node.d.ts" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
363
372108
0