Skip to content

Commit

Permalink
removed GO extensions in wasp.js
Browse files Browse the repository at this point in the history
  • Loading branch information
pannous committed Jan 1, 2024
1 parent 1620e19 commit debbc64
Showing 1 changed file with 2 additions and 72 deletions.
74 changes: 2 additions & 72 deletions source/wasp.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ function new_int(val) {
}



function new_long(val) {
// memory.setUint32(addr + 0, val, true);
// memory.setUint32(addr + 4, Math.floor(val / 4294967296), true);
Expand Down Expand Up @@ -274,52 +275,6 @@ function read_int64(pointer, mem) { // little endian
return buffer[0]
}

// function read_float(pointer, mem) {}
function storeValue_go(pointer, mem) {
let typeFlag = 0;
switch (typeof v) {
case "object":
if (v !== null) {
typeFlag = 1;
}
break;
case "string":
typeFlag = 2;
break;
case "symbol":
typeFlag = 3;
break;
case "function":
typeFlag = 4;
break;
}
this.mem.setUint32(addr + 4, nanHead | typeFlag, true);
this.mem.setUint32(addr, id, true);
}

// // func valueGet(v ref, p string) ref
// "syscall/js.valueGet": (sp) => {
// sp >>>= 0;
// const result = Reflect.get(loadValue(sp + 8), loadString(sp + 16));
// sp = this._inst.exports.getsp() >>> 0; // see comment above
// storeValue(sp + 32, result);
// },
//
// // func valueSet(v ref, p string, x ref)
// "syscall/js.valueSet": (sp) => {
// sp >>>= 0;
// Reflect.set(loadValue(sp + 8), loadString(sp + 16), loadValue(sp + 32));
// },
// func valueInvoke(v ref, args []ref) (ref, bool)
// "syscall/js.valueInvoke": (sp) => {
// const v = loadValue(sp + 8);
// const args = loadSliceOfValues(sp + 16);
// const result = Reflect.apply(v, undefined, args);
// sp = this._inst.exports.getsp() >>> 0; // see comment above
// storeValue(sp + 40, result);
// this.mem.setUint8(sp + 48, 1);


// reset at each run, discard previous data!
// NOT COMPATIBLE WITH ASYNC CALLS!
function reset_heap() {
Expand Down Expand Up @@ -747,10 +702,6 @@ function load_runtime() {
if (main) {
console.log("got main")
result = main()
// if (this.exited) {
// this._resolveExitPromise();
// }
// await this._exitPromise;
} else {
console.error("missing main function in wasp module!")
result = instance.exports//show what we've got
Expand All @@ -759,29 +710,8 @@ function load_runtime() {
wasp_ready()
}
)
}


// _resume() {
// if (this.exited) {
// throw new Error("Go program has already exited");
// }
// this._inst.exports.resume();
// if (this.exited) {
// this._resolveExitPromise();
// }
// }
//
// _makeFuncWrapper(id) {
// const go = this;
// return function () {
// const event = { id: id, this: this, args: arguments };
// go._pendingEvent = event;
// go._resume();
// return event.result;
// };
// }

}

async function run_wasm(buf_pointer, buf_size) {
let wasm_buffer = buffer.subarray(buf_pointer, buf_pointer + buf_size)
Expand Down

0 comments on commit debbc64

Please sign in to comment.