Skip to content

Commit

Permalink
jsc/wasm32/wasm32.jsc: new code, unused
Browse files Browse the repository at this point in the history
  • Loading branch information
pipcet committed Feb 3, 2021
1 parent 0d0ff59 commit 11ec7cb
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions jsc/wasm32/wasm32.jsc
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,31 @@ Wasm32Symbol.prototype.add_reference = function (reference)
this.references.push(reference);
};

function Wasm32Modules()
{
this.by_path = {};
}

Wasm32Modules.prototype.bytes = async function (name)
{
let path;
if (name[0] === "/")
path = name;
else
path = os.getenv("WASMDIR") + "/wasm/" + name + ".wasm";
return os.readFile(path, "binary");
};

Wasm32Modules.prototype.module = async function (name)
{
if (!this.by_path[path])
this.by_path[path] = new Wasm32Module(await this.bytes(name), name);

return this.by_path[path];
};

var gWasm32Modules = new Wasm32Modules();

/* A link-map object. */
function Wasm32LM(vm)
{
Expand Down

0 comments on commit 11ec7cb

Please sign in to comment.