mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-06-22 19:21:47 +00:00
llvm-like naming of __heap_base, definition fixes, update examples
This commit is contained in:
15
examples/game-of-life/build/optimized.d.ts
vendored
15
examples/game-of-life/build/optimized.d.ts
vendored
@ -8,17 +8,8 @@ declare module ASModule {
|
||||
type f32 = number;
|
||||
type f64 = number;
|
||||
type bool = any;
|
||||
namespace JSMath {
|
||||
function random(): f64;
|
||||
}
|
||||
var w: i32;
|
||||
var h: i32;
|
||||
var s: i32;
|
||||
function init(width: i32, height: i32): void;
|
||||
function step(): void;
|
||||
function fill(x: u32, y: u32, p: f64): void;
|
||||
var BGR_ALIVE: u32;
|
||||
var BGR_DEAD: u32;
|
||||
var BIT_ROT: u32;
|
||||
export function init(width: i32, height: i32): void;
|
||||
export function step(): void;
|
||||
export function fill(x: u32, y: u32, p: f64): void;
|
||||
}
|
||||
export default ASModule;
|
||||
|
@ -133,360 +133,364 @@
|
||||
i32.lt_s
|
||||
i32.eqz
|
||||
br_if $break|0
|
||||
block
|
||||
local.get $2
|
||||
i32.const 0
|
||||
i32.eq
|
||||
if (result i32)
|
||||
local.get $0
|
||||
else
|
||||
local.get $2
|
||||
i32.const 1
|
||||
i32.sub
|
||||
end
|
||||
local.set $3
|
||||
local.get $2
|
||||
local.get $2
|
||||
i32.const 0
|
||||
i32.eq
|
||||
if (result i32)
|
||||
local.get $0
|
||||
i32.eq
|
||||
if (result i32)
|
||||
else
|
||||
local.get $2
|
||||
i32.const 1
|
||||
i32.sub
|
||||
end
|
||||
local.set $3
|
||||
local.get $2
|
||||
local.get $0
|
||||
i32.eq
|
||||
if (result i32)
|
||||
i32.const 0
|
||||
else
|
||||
local.get $2
|
||||
i32.const 1
|
||||
i32.add
|
||||
end
|
||||
local.set $4
|
||||
block $break|1
|
||||
i32.const 0
|
||||
local.set $5
|
||||
loop $repeat|1
|
||||
local.get $5
|
||||
global.get $assembly/index/w
|
||||
i32.lt_s
|
||||
i32.eqz
|
||||
br_if $break|1
|
||||
local.get $5
|
||||
i32.const 0
|
||||
else
|
||||
local.get $2
|
||||
i32.const 1
|
||||
i32.add
|
||||
end
|
||||
local.set $4
|
||||
block $break|1
|
||||
i32.const 0
|
||||
local.set $5
|
||||
loop $repeat|1
|
||||
i32.eq
|
||||
if (result i32)
|
||||
local.get $1
|
||||
else
|
||||
local.get $5
|
||||
global.get $assembly/index/w
|
||||
i32.lt_s
|
||||
i32.eqz
|
||||
br_if $break|1
|
||||
block
|
||||
local.get $5
|
||||
i32.const 0
|
||||
i32.eq
|
||||
if (result i32)
|
||||
local.get $1
|
||||
else
|
||||
local.get $5
|
||||
i32.const 1
|
||||
i32.sub
|
||||
end
|
||||
local.set $6
|
||||
local.get $5
|
||||
local.get $1
|
||||
i32.eq
|
||||
if (result i32)
|
||||
i32.const 0
|
||||
else
|
||||
local.get $5
|
||||
i32.const 1
|
||||
i32.add
|
||||
end
|
||||
local.set $7
|
||||
block $assembly/index/get|inlined.0 (result i32)
|
||||
local.get $6
|
||||
local.set $9
|
||||
local.get $3
|
||||
local.set $8
|
||||
local.get $8
|
||||
global.get $assembly/index/w
|
||||
i32.mul
|
||||
local.get $9
|
||||
i32.add
|
||||
i32.const 2
|
||||
i32.shl
|
||||
i32.load
|
||||
end
|
||||
i32.const 1
|
||||
i32.and
|
||||
block $assembly/index/get|inlined.1 (result i32)
|
||||
local.get $5
|
||||
local.set $9
|
||||
local.get $3
|
||||
local.set $8
|
||||
local.get $8
|
||||
global.get $assembly/index/w
|
||||
i32.mul
|
||||
local.get $9
|
||||
i32.add
|
||||
i32.const 2
|
||||
i32.shl
|
||||
i32.load
|
||||
end
|
||||
i32.const 1
|
||||
i32.and
|
||||
i32.add
|
||||
block $assembly/index/get|inlined.2 (result i32)
|
||||
local.get $7
|
||||
local.set $9
|
||||
local.get $3
|
||||
local.set $8
|
||||
local.get $8
|
||||
global.get $assembly/index/w
|
||||
i32.mul
|
||||
local.get $9
|
||||
i32.add
|
||||
i32.const 2
|
||||
i32.shl
|
||||
i32.load
|
||||
end
|
||||
i32.const 1
|
||||
i32.and
|
||||
i32.add
|
||||
block $assembly/index/get|inlined.3 (result i32)
|
||||
local.get $6
|
||||
local.set $9
|
||||
local.get $2
|
||||
local.set $8
|
||||
local.get $8
|
||||
global.get $assembly/index/w
|
||||
i32.mul
|
||||
local.get $9
|
||||
i32.add
|
||||
i32.const 2
|
||||
i32.shl
|
||||
i32.load
|
||||
end
|
||||
i32.const 1
|
||||
i32.and
|
||||
i32.add
|
||||
block $assembly/index/get|inlined.4 (result i32)
|
||||
local.get $7
|
||||
local.set $9
|
||||
local.get $2
|
||||
local.set $8
|
||||
local.get $8
|
||||
global.get $assembly/index/w
|
||||
i32.mul
|
||||
local.get $9
|
||||
i32.add
|
||||
i32.const 2
|
||||
i32.shl
|
||||
i32.load
|
||||
end
|
||||
i32.const 1
|
||||
i32.and
|
||||
i32.add
|
||||
block $assembly/index/get|inlined.5 (result i32)
|
||||
local.get $6
|
||||
local.set $9
|
||||
local.get $4
|
||||
local.set $8
|
||||
local.get $8
|
||||
global.get $assembly/index/w
|
||||
i32.mul
|
||||
local.get $9
|
||||
i32.add
|
||||
i32.const 2
|
||||
i32.shl
|
||||
i32.load
|
||||
end
|
||||
i32.const 1
|
||||
i32.and
|
||||
i32.add
|
||||
block $assembly/index/get|inlined.6 (result i32)
|
||||
local.get $5
|
||||
local.set $9
|
||||
local.get $4
|
||||
local.set $8
|
||||
local.get $8
|
||||
global.get $assembly/index/w
|
||||
i32.mul
|
||||
local.get $9
|
||||
i32.add
|
||||
i32.const 2
|
||||
i32.shl
|
||||
i32.load
|
||||
end
|
||||
i32.const 1
|
||||
i32.and
|
||||
i32.add
|
||||
block $assembly/index/get|inlined.7 (result i32)
|
||||
local.get $7
|
||||
local.set $9
|
||||
local.get $4
|
||||
local.set $8
|
||||
local.get $8
|
||||
global.get $assembly/index/w
|
||||
i32.mul
|
||||
local.get $9
|
||||
i32.add
|
||||
i32.const 2
|
||||
i32.shl
|
||||
i32.load
|
||||
end
|
||||
i32.const 1
|
||||
i32.and
|
||||
i32.add
|
||||
local.set $8
|
||||
block $assembly/index/get|inlined.8 (result i32)
|
||||
local.get $5
|
||||
local.set $10
|
||||
local.get $2
|
||||
local.set $9
|
||||
local.get $9
|
||||
global.get $assembly/index/w
|
||||
i32.mul
|
||||
local.get $10
|
||||
i32.add
|
||||
i32.const 2
|
||||
i32.shl
|
||||
i32.load
|
||||
end
|
||||
local.set $9
|
||||
local.get $9
|
||||
i32.const 1
|
||||
i32.and
|
||||
if
|
||||
local.get $8
|
||||
i32.const 14
|
||||
i32.and
|
||||
i32.const 2
|
||||
i32.eq
|
||||
if
|
||||
local.get $5
|
||||
local.set $12
|
||||
local.get $2
|
||||
local.set $11
|
||||
local.get $9
|
||||
local.set $10
|
||||
local.get $10
|
||||
i32.const 24
|
||||
i32.shr_u
|
||||
global.get $assembly/config/BIT_ROT
|
||||
i32.sub
|
||||
local.tee $13
|
||||
i32.const 0
|
||||
local.tee $14
|
||||
local.get $13
|
||||
local.get $14
|
||||
i32.gt_s
|
||||
select
|
||||
local.set $13
|
||||
block $assembly/index/set|inlined.1
|
||||
local.get $13
|
||||
i32.const 24
|
||||
i32.shl
|
||||
local.get $10
|
||||
i32.const 16777215
|
||||
i32.and
|
||||
i32.or
|
||||
local.set $16
|
||||
global.get $assembly/index/s
|
||||
local.get $11
|
||||
global.get $assembly/index/w
|
||||
i32.mul
|
||||
i32.add
|
||||
local.get $12
|
||||
i32.add
|
||||
i32.const 2
|
||||
i32.shl
|
||||
local.get $16
|
||||
i32.store
|
||||
end
|
||||
else
|
||||
local.get $5
|
||||
local.set $11
|
||||
local.get $2
|
||||
local.set $10
|
||||
global.get $assembly/config/BGR_DEAD
|
||||
i32.const -16777216
|
||||
i32.or
|
||||
local.set $13
|
||||
global.get $assembly/index/s
|
||||
local.get $10
|
||||
global.get $assembly/index/w
|
||||
i32.mul
|
||||
i32.add
|
||||
local.get $11
|
||||
i32.add
|
||||
i32.const 2
|
||||
i32.shl
|
||||
local.get $13
|
||||
i32.store
|
||||
end
|
||||
else
|
||||
local.get $8
|
||||
i32.const 3
|
||||
i32.eq
|
||||
if
|
||||
local.get $5
|
||||
local.set $11
|
||||
local.get $2
|
||||
local.set $10
|
||||
global.get $assembly/config/BGR_ALIVE
|
||||
i32.const -16777216
|
||||
i32.or
|
||||
local.set $13
|
||||
global.get $assembly/index/s
|
||||
local.get $10
|
||||
global.get $assembly/index/w
|
||||
i32.mul
|
||||
i32.add
|
||||
local.get $11
|
||||
i32.add
|
||||
i32.const 2
|
||||
i32.shl
|
||||
local.get $13
|
||||
i32.store
|
||||
else
|
||||
local.get $5
|
||||
local.set $11
|
||||
local.get $2
|
||||
local.set $10
|
||||
local.get $9
|
||||
local.set $13
|
||||
local.get $13
|
||||
i32.const 24
|
||||
i32.shr_u
|
||||
global.get $assembly/config/BIT_ROT
|
||||
i32.sub
|
||||
local.tee $12
|
||||
i32.const 0
|
||||
local.tee $16
|
||||
local.get $12
|
||||
local.get $16
|
||||
i32.gt_s
|
||||
select
|
||||
local.set $12
|
||||
block $assembly/index/set|inlined.4
|
||||
local.get $12
|
||||
i32.const 24
|
||||
i32.shl
|
||||
local.get $13
|
||||
i32.const 16777215
|
||||
i32.and
|
||||
i32.or
|
||||
local.set $14
|
||||
global.get $assembly/index/s
|
||||
local.get $10
|
||||
global.get $assembly/index/w
|
||||
i32.mul
|
||||
i32.add
|
||||
local.get $11
|
||||
i32.add
|
||||
i32.const 2
|
||||
i32.shl
|
||||
local.get $14
|
||||
i32.store
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
i32.const 1
|
||||
i32.sub
|
||||
end
|
||||
local.set $6
|
||||
local.get $5
|
||||
local.get $1
|
||||
i32.eq
|
||||
if (result i32)
|
||||
i32.const 0
|
||||
else
|
||||
local.get $5
|
||||
i32.const 1
|
||||
i32.add
|
||||
local.set $5
|
||||
br $repeat|1
|
||||
unreachable
|
||||
end
|
||||
local.set $7
|
||||
block $assembly/index/get|inlined.0 (result i32)
|
||||
local.get $6
|
||||
local.set $9
|
||||
local.get $3
|
||||
local.set $8
|
||||
local.get $8
|
||||
global.get $assembly/index/w
|
||||
i32.mul
|
||||
local.get $9
|
||||
i32.add
|
||||
i32.const 2
|
||||
i32.shl
|
||||
i32.load
|
||||
end
|
||||
i32.const 1
|
||||
i32.and
|
||||
block $assembly/index/get|inlined.1 (result i32)
|
||||
local.get $5
|
||||
local.set $9
|
||||
local.get $3
|
||||
local.set $8
|
||||
local.get $8
|
||||
global.get $assembly/index/w
|
||||
i32.mul
|
||||
local.get $9
|
||||
i32.add
|
||||
i32.const 2
|
||||
i32.shl
|
||||
i32.load
|
||||
end
|
||||
i32.const 1
|
||||
i32.and
|
||||
i32.add
|
||||
block $assembly/index/get|inlined.2 (result i32)
|
||||
local.get $7
|
||||
local.set $9
|
||||
local.get $3
|
||||
local.set $8
|
||||
local.get $8
|
||||
global.get $assembly/index/w
|
||||
i32.mul
|
||||
local.get $9
|
||||
i32.add
|
||||
i32.const 2
|
||||
i32.shl
|
||||
i32.load
|
||||
end
|
||||
i32.const 1
|
||||
i32.and
|
||||
i32.add
|
||||
block $assembly/index/get|inlined.3 (result i32)
|
||||
local.get $6
|
||||
local.set $9
|
||||
local.get $2
|
||||
local.set $8
|
||||
local.get $8
|
||||
global.get $assembly/index/w
|
||||
i32.mul
|
||||
local.get $9
|
||||
i32.add
|
||||
i32.const 2
|
||||
i32.shl
|
||||
i32.load
|
||||
end
|
||||
i32.const 1
|
||||
i32.and
|
||||
i32.add
|
||||
block $assembly/index/get|inlined.4 (result i32)
|
||||
local.get $7
|
||||
local.set $9
|
||||
local.get $2
|
||||
local.set $8
|
||||
local.get $8
|
||||
global.get $assembly/index/w
|
||||
i32.mul
|
||||
local.get $9
|
||||
i32.add
|
||||
i32.const 2
|
||||
i32.shl
|
||||
i32.load
|
||||
end
|
||||
i32.const 1
|
||||
i32.and
|
||||
i32.add
|
||||
block $assembly/index/get|inlined.5 (result i32)
|
||||
local.get $6
|
||||
local.set $9
|
||||
local.get $4
|
||||
local.set $8
|
||||
local.get $8
|
||||
global.get $assembly/index/w
|
||||
i32.mul
|
||||
local.get $9
|
||||
i32.add
|
||||
i32.const 2
|
||||
i32.shl
|
||||
i32.load
|
||||
end
|
||||
i32.const 1
|
||||
i32.and
|
||||
i32.add
|
||||
block $assembly/index/get|inlined.6 (result i32)
|
||||
local.get $5
|
||||
local.set $9
|
||||
local.get $4
|
||||
local.set $8
|
||||
local.get $8
|
||||
global.get $assembly/index/w
|
||||
i32.mul
|
||||
local.get $9
|
||||
i32.add
|
||||
i32.const 2
|
||||
i32.shl
|
||||
i32.load
|
||||
end
|
||||
i32.const 1
|
||||
i32.and
|
||||
i32.add
|
||||
block $assembly/index/get|inlined.7 (result i32)
|
||||
local.get $7
|
||||
local.set $9
|
||||
local.get $4
|
||||
local.set $8
|
||||
local.get $8
|
||||
global.get $assembly/index/w
|
||||
i32.mul
|
||||
local.get $9
|
||||
i32.add
|
||||
i32.const 2
|
||||
i32.shl
|
||||
i32.load
|
||||
end
|
||||
i32.const 1
|
||||
i32.and
|
||||
i32.add
|
||||
local.set $9
|
||||
block $assembly/index/get|inlined.8 (result i32)
|
||||
local.get $5
|
||||
local.set $10
|
||||
local.get $2
|
||||
local.set $8
|
||||
local.get $8
|
||||
global.get $assembly/index/w
|
||||
i32.mul
|
||||
local.get $10
|
||||
i32.add
|
||||
i32.const 2
|
||||
i32.shl
|
||||
i32.load
|
||||
end
|
||||
local.set $10
|
||||
local.get $10
|
||||
i32.const 1
|
||||
i32.and
|
||||
if
|
||||
local.get $9
|
||||
i32.const 14
|
||||
i32.and
|
||||
i32.const 2
|
||||
i32.eq
|
||||
if
|
||||
local.get $5
|
||||
local.set $12
|
||||
local.get $2
|
||||
local.set $11
|
||||
local.get $10
|
||||
local.set $8
|
||||
local.get $8
|
||||
i32.const 24
|
||||
i32.shr_u
|
||||
global.get $assembly/config/BIT_ROT
|
||||
i32.sub
|
||||
local.tee $13
|
||||
i32.const 0
|
||||
local.tee $14
|
||||
local.get $13
|
||||
local.get $14
|
||||
i32.gt_s
|
||||
select
|
||||
local.set $13
|
||||
block $assembly/index/set|inlined.1
|
||||
local.get $12
|
||||
local.set $16
|
||||
local.get $11
|
||||
local.set $15
|
||||
local.get $13
|
||||
i32.const 24
|
||||
i32.shl
|
||||
local.get $8
|
||||
i32.const 16777215
|
||||
i32.and
|
||||
i32.or
|
||||
local.set $14
|
||||
global.get $assembly/index/s
|
||||
local.get $15
|
||||
global.get $assembly/index/w
|
||||
i32.mul
|
||||
i32.add
|
||||
local.get $16
|
||||
i32.add
|
||||
i32.const 2
|
||||
i32.shl
|
||||
local.get $14
|
||||
i32.store
|
||||
end
|
||||
else
|
||||
local.get $5
|
||||
local.set $16
|
||||
local.get $2
|
||||
local.set $15
|
||||
global.get $assembly/config/BGR_DEAD
|
||||
i32.const -16777216
|
||||
i32.or
|
||||
local.set $14
|
||||
global.get $assembly/index/s
|
||||
local.get $15
|
||||
global.get $assembly/index/w
|
||||
i32.mul
|
||||
i32.add
|
||||
local.get $16
|
||||
i32.add
|
||||
i32.const 2
|
||||
i32.shl
|
||||
local.get $14
|
||||
i32.store
|
||||
end
|
||||
else
|
||||
local.get $9
|
||||
i32.const 3
|
||||
i32.eq
|
||||
if
|
||||
local.get $5
|
||||
local.set $12
|
||||
local.get $2
|
||||
local.set $11
|
||||
global.get $assembly/config/BGR_ALIVE
|
||||
i32.const -16777216
|
||||
i32.or
|
||||
local.set $8
|
||||
global.get $assembly/index/s
|
||||
local.get $11
|
||||
global.get $assembly/index/w
|
||||
i32.mul
|
||||
i32.add
|
||||
local.get $12
|
||||
i32.add
|
||||
i32.const 2
|
||||
i32.shl
|
||||
local.get $8
|
||||
i32.store
|
||||
else
|
||||
local.get $5
|
||||
local.set $15
|
||||
local.get $2
|
||||
local.set $14
|
||||
local.get $10
|
||||
local.set $13
|
||||
local.get $13
|
||||
i32.const 24
|
||||
i32.shr_u
|
||||
global.get $assembly/config/BIT_ROT
|
||||
i32.sub
|
||||
local.tee $12
|
||||
i32.const 0
|
||||
local.tee $11
|
||||
local.get $12
|
||||
local.get $11
|
||||
i32.gt_s
|
||||
select
|
||||
local.set $12
|
||||
block $assembly/index/set|inlined.4
|
||||
local.get $15
|
||||
local.set $11
|
||||
local.get $14
|
||||
local.set $8
|
||||
local.get $12
|
||||
i32.const 24
|
||||
i32.shl
|
||||
local.get $13
|
||||
i32.const 16777215
|
||||
i32.and
|
||||
i32.or
|
||||
local.set $16
|
||||
global.get $assembly/index/s
|
||||
local.get $8
|
||||
global.get $assembly/index/w
|
||||
i32.mul
|
||||
i32.add
|
||||
local.get $11
|
||||
i32.add
|
||||
i32.const 2
|
||||
i32.shl
|
||||
local.get $16
|
||||
i32.store
|
||||
end
|
||||
end
|
||||
end
|
||||
local.get $5
|
||||
i32.const 1
|
||||
i32.add
|
||||
local.set $5
|
||||
br $repeat|1
|
||||
unreachable
|
||||
end
|
||||
unreachable
|
||||
end
|
||||
local.get $2
|
||||
i32.const 1
|
||||
|
@ -3,8 +3,8 @@
|
||||
"version": "1.0.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"asbuild:untouched": "asc assembly/index.ts -b build/untouched.wasm -t build/untouched.wat --use Math=JSMath --importMemory --sourceMap --debug --validate --measure",
|
||||
"asbuild:optimized": "asc assembly/index.ts -b build/optimized.wasm -t build/optimized.wat -d build/optimized.d.ts --use Math=JSMath -O3 --importMemory --sourceMap --validate --measure",
|
||||
"asbuild:untouched": "asc assembly/index.ts -b build/untouched.wasm -t build/untouched.wat --use Math=JSMath --runtime none --importMemory --sourceMap --debug --validate --measure",
|
||||
"asbuild:optimized": "asc assembly/index.ts -b build/optimized.wasm -t build/optimized.wat -d build/optimized.d.ts --use Math=JSMath -O3 --runtime none --importMemory --sourceMap --validate --measure",
|
||||
"asbuild": "npm run asbuild:untouched && npm run asbuild:optimized",
|
||||
"server": "http-server . -o -c-1"
|
||||
},
|
||||
|
Reference in New Issue
Block a user