mirror of
https://github.com/syumai/workers.git
synced 2025-03-10 17:29:11 +00:00
update wasm_exec_go.js to latest
This commit is contained in:
parent
7689cff40e
commit
49949034c0
@ -19,8 +19,8 @@
|
|||||||
outputBuf += decoder.decode(buf);
|
outputBuf += decoder.decode(buf);
|
||||||
const nl = outputBuf.lastIndexOf("\n");
|
const nl = outputBuf.lastIndexOf("\n");
|
||||||
if (nl != -1) {
|
if (nl != -1) {
|
||||||
console.log(outputBuf.substr(0, nl));
|
console.log(outputBuf.substring(0, nl));
|
||||||
outputBuf = outputBuf.substr(nl + 1);
|
outputBuf = outputBuf.substring(nl + 1);
|
||||||
}
|
}
|
||||||
return buf.length;
|
return buf.length;
|
||||||
},
|
},
|
||||||
@ -113,6 +113,10 @@
|
|||||||
this.mem.setUint32(addr + 4, Math.floor(v / 4294967296), true);
|
this.mem.setUint32(addr + 4, Math.floor(v / 4294967296), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const setInt32 = (addr, v) => {
|
||||||
|
this.mem.setUint32(addr + 0, v, true);
|
||||||
|
}
|
||||||
|
|
||||||
const getInt64 = (addr) => {
|
const getInt64 = (addr) => {
|
||||||
const low = this.mem.getUint32(addr + 0, true);
|
const low = this.mem.getUint32(addr + 0, true);
|
||||||
const high = this.mem.getInt32(addr + 4, true);
|
const high = this.mem.getInt32(addr + 4, true);
|
||||||
@ -206,7 +210,10 @@
|
|||||||
|
|
||||||
const timeOrigin = Date.now() - performance.now();
|
const timeOrigin = Date.now() - performance.now();
|
||||||
this.importObject = {
|
this.importObject = {
|
||||||
go: {
|
_gotest: {
|
||||||
|
add: (a, b) => a + b,
|
||||||
|
},
|
||||||
|
gojs: {
|
||||||
// Go's SP does not change as long as no Go code is running. Some operations (e.g. calls, getters and setters)
|
// Go's SP does not change as long as no Go code is running. Some operations (e.g. calls, getters and setters)
|
||||||
// may synchronously trigger a Go event handler. This makes Go code get executed in the middle of the imported
|
// may synchronously trigger a Go event handler. This makes Go code get executed in the middle of the imported
|
||||||
// function. A goroutine can switch to a new stack if the current stack is too small (see morestack function).
|
// function. A goroutine can switch to a new stack if the current stack is too small (see morestack function).
|
||||||
@ -269,7 +276,7 @@
|
|||||||
this._resume();
|
this._resume();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
getInt64(sp + 8) + 1, // setTimeout has been seen to fire up to 1 millisecond early
|
getInt64(sp + 8),
|
||||||
));
|
));
|
||||||
this.mem.setInt32(sp + 16, id, true);
|
this.mem.setInt32(sp + 16, id, true);
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user