1
0
mirror of https://github.com/fluencelabs/assemblyscript synced 2025-06-21 02:31:41 +00:00

Move built-in declarations to actual sources; Remove declaration is null checks; Resolve calls

This commit is contained in:
dcodeIO
2018-02-09 02:31:48 +01:00
parent a7e815dcec
commit ad92d91f01
24 changed files with 655 additions and 502 deletions

@ -383,8 +383,7 @@ class Root {
// merge with current tail if adjacent
if (start - Block.INFO == tailRef) {
start -= Block.INFO;
let tail = changetype<Block>(tailRef);
tailInfo = tail.info;
tailInfo = changetype<Block>(tailRef).info;
}
} else
@ -407,7 +406,7 @@ class Root {
tail.info = 0 | LEFT_FREE;
this.tailRef = changetype<usize>(tail);
this.insert(left); // also sets jump
this.insert(left); // also merges with free left before tail / sets jump
return true;
}

5
examples/tlsf/index.js Normal file

@ -0,0 +1,5 @@
const fs = require("fs");
module.exports = new WebAssembly.Instance(
new WebAssembly.Module(fs.readFileSync(__dirname + "/tlsf.optimized.wasm")),
{ env: { abort: function() { throw Error("abort called"); } } }
).exports;

@ -5,7 +5,7 @@
"scripts": {
"build": "npm run build:untouched && npm run build:optimized",
"build:untouched": "asc assembly/tlsf.ts -t tlsf.untouched.wast -b tlsf.untouched.wasm --validate --sourceMap --measure",
"build:optimized": "asc -O3 assembly/tlsf.ts -b tlsf.optimized.wasm -t tlsf.optimized.wast --validate --noDebug --noAssert --sourceMap --measure",
"build:optimized": "asc assembly/tlsf.ts -t tlsf.optimized.wast -b tlsf.optimized.wasm --validate --sourceMap --measure --noDebug --noAssert --optimize",
"test": "node tests",
"test:forever": "node tests/forever"
}

@ -20,7 +20,7 @@ function test(file) {
return String.fromCharCode.apply(String, str);
}
runner(exports, 5, 20000); // picked so I/O isn't the bottleneck
runner(exports, 20, 20000); // picked so I/O isn't the bottleneck
console.log("mem final: " + exports.memory.buffer.byteLength);
console.log();
}