llvm-like naming of __heap_base, definition fixes, update examples

This commit is contained in:
dcode 2019-06-01 01:14:04 +02:00
parent b19005f5bb
commit e65d875ebc
81 changed files with 3135 additions and 1995 deletions

View File

@ -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;

View File

@ -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

View File

@ -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"
},

View File

@ -8,10 +8,6 @@ declare module ASModule {
type f32 = number;
type f64 = number;
type bool = any;
const NaN: f64;
const Infinity: f64;
var lo: u32;
var hi: u32;
function getLo(): u32;
function getHi(): u32;
function clz(loLeft: u32, hiLeft: u32): void;

View File

@ -17,8 +17,8 @@
},
"scripts": {
"asbuild": "npm run asbuild:untouched && npm run asbuild:optimized",
"asbuild:untouched": "asc assembly/i64.ts -t build/untouched.wat -b build/untouched.wasm --validate --sourceMap --debug --measure",
"asbuild:optimized": "asc -O assembly/i64.ts -b build/optimized.wasm -t build/optimized.wat -d build/optimized.d.ts --validate --sourceMap --measure",
"asbuild:untouched": "asc assembly/i64.ts -t build/untouched.wat -b build/untouched.wasm --runtime none --validate --sourceMap --debug --measure",
"asbuild:optimized": "asc assembly/i64.ts -b build/optimized.wasm -t build/optimized.wat -d build/optimized.d.ts -O3 --runtime none --validate --sourceMap --measure",
"test": "node tests"
},
"files": [

View File

@ -8,11 +8,6 @@ declare module ASModule {
type f32 = number;
type f64 = number;
type bool = any;
namespace JSMath {
function log(x: f64): f64;
function log2(x: f64): f64;
}
var NUM_COLORS: i32;
function computeLine(y: u32, width: u32, height: u32, limit: u32): void;
}
export default ASModule;

View File

@ -94,159 +94,153 @@
i32.lt_u
i32.eqz
br_if $break|0
block
local.get $12
f64.convert_i32_u
local.get $6
f64.mul
local.get $8
f64.sub
local.set $13
f64.const 0
local.set $14
f64.const 0
local.set $15
i32.const 0
local.set $18
block $break|1
loop $continue|1
local.get $14
local.get $14
f64.mul
local.tee $16
local.get $15
local.get $15
f64.mul
local.tee $17
f64.add
f64.const 4
f64.le
if
block
f64.const 2
local.get $14
f64.mul
local.get $15
f64.mul
local.get $7
f64.add
local.set $15
local.get $16
local.get $17
f64.sub
local.get $13
f64.add
local.set $14
local.get $18
local.get $3
i32.ge_u
if
br $break|1
end
local.get $18
i32.const 1
i32.add
local.set $18
end
br $continue|1
end
end
end
block $break|2
loop $continue|2
local.get $18
f64.convert_i32_u
local.get $11
f64.lt
if
block
local.get $14
local.get $14
f64.mul
local.get $15
local.get $15
f64.mul
f64.sub
local.get $13
f64.add
local.set $19
f64.const 2
local.get $14
f64.mul
local.get $15
f64.mul
local.get $7
f64.add
local.set $15
local.get $19
local.set $14
local.get $18
i32.const 1
i32.add
local.set $18
end
br $continue|2
end
end
end
global.get $assembly/index/NUM_COLORS
i32.const 1
i32.sub
local.set $20
local.get $14
local.get $14
f64.mul
local.get $15
local.get $15
f64.mul
f64.add
local.set $19
local.get $19
f64.const 1
f64.gt
if
f64.const 0.5
local.get $19
call $~lib/bindings/Math/log
local.get $12
f64.convert_i32_u
local.get $6
f64.mul
local.get $8
f64.sub
local.set $13
f64.const 0
local.set $14
f64.const 0
local.set $15
i32.const 0
local.set $18
block $break|1
loop $continue|1
local.get $14
local.get $14
f64.mul
call $~lib/bindings/Math/log2
local.set $21
global.get $assembly/index/NUM_COLORS
i32.const 1
i32.sub
f64.convert_i32_s
block $assembly/index/clamp<f64>|inlined.0 (result f64)
local.tee $16
local.get $15
local.get $15
f64.mul
local.tee $17
f64.add
f64.const 4
f64.le
if
f64.const 2
local.get $14
f64.mul
local.get $15
f64.mul
local.get $7
f64.add
local.set $15
local.get $16
local.get $17
f64.sub
local.get $13
f64.add
local.set $14
local.get $18
local.get $3
i32.ge_u
if
br $break|1
end
local.get $18
i32.const 1
i32.add
f64.convert_i32_u
local.get $21
f64.sub
local.get $10
f64.mul
local.set $24
f64.const 0
local.set $23
f64.const 1
local.set $22
local.get $24
local.get $23
f64.max
local.get $22
f64.min
local.set $18
br $continue|1
end
f64.mul
i32.trunc_f64_u
local.set $20
end
local.get $9
local.get $12
i32.const 1
i32.shl
i32.add
local.get $20
i32.store16
end
block $break|2
loop $continue|2
local.get $18
f64.convert_i32_u
local.get $11
f64.lt
if
local.get $14
local.get $14
f64.mul
local.get $15
local.get $15
f64.mul
f64.sub
local.get $13
f64.add
local.set $19
f64.const 2
local.get $14
f64.mul
local.get $15
f64.mul
local.get $7
f64.add
local.set $15
local.get $19
local.set $14
local.get $18
i32.const 1
i32.add
local.set $18
br $continue|2
end
end
end
global.get $assembly/index/NUM_COLORS
i32.const 1
i32.sub
local.set $20
local.get $14
local.get $14
f64.mul
local.get $15
local.get $15
f64.mul
f64.add
local.set $19
local.get $19
f64.const 1
f64.gt
if
f64.const 0.5
local.get $19
call $~lib/bindings/Math/log
f64.mul
call $~lib/bindings/Math/log2
local.set $21
global.get $assembly/index/NUM_COLORS
i32.const 1
i32.sub
f64.convert_i32_s
block $assembly/index/clamp<f64>|inlined.0 (result f64)
local.get $18
i32.const 1
i32.add
f64.convert_i32_u
local.get $21
f64.sub
local.get $10
f64.mul
local.set $24
f64.const 0
local.set $23
f64.const 1
local.set $22
local.get $24
local.get $23
f64.max
local.get $22
f64.min
end
f64.mul
i32.trunc_f64_u
local.set $20
end
local.get $9
local.get $12
i32.const 1
i32.shl
i32.add
local.get $20
i32.store16
local.get $12
i32.const 1
i32.add

View File

@ -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 --runtime none -O3 --importMemory --sourceMap --validate --measure",
"asbuild": "npm run asbuild:untouched && npm run asbuild:optimized",
"server": "http-server . -o -c-1"
},

View File

@ -1,5 +1,3 @@
import "allocator/arena";
// From The Computer Language Benchmarks Game
// http://benchmarksgame.alioth.debian.org

View File

@ -1,3 +1,4 @@
function asmFunc(global, env, buffer) {
"almost asm";
var HEAP8 = new global.Int8Array(buffer);
@ -21,314 +22,230 @@ function asmFunc(global, env, buffer) {
var nan = global.NaN;
var infinity = global.Infinity;
var assembly_index_system = 0;
var $lib_allocator_arena_startOffset = 0;
var $lib_allocator_arena_offset = 0;
var i64toi32_i32$HIGH_BITS = 0;
function $lib_allocator_arena___mem_allocate($0) {
$0 = $0 | 0;
var $1 = 0, $2 = 0, $3 = 0, wasm2js_i32$0 = 0, wasm2js_i32$1 = 0, wasm2js_i32$2 = 0;
if ($0 >>> 0 > 1073741824 >>> 0) abort();
$1 = $lib_allocator_arena_offset;
$0 = (($1 + (wasm2js_i32$0 = $0, wasm2js_i32$1 = 1, wasm2js_i32$2 = $0 >>> 0 > 1 >>> 0, wasm2js_i32$2 ? wasm2js_i32$0 : wasm2js_i32$1) | 0) + 7 | 0) & 4294967288 | 0;
$2 = __wasm_current_memory();
if ($0 >>> 0 > ($2 << 16 | 0) >>> 0) {
$3 = ((($0 - $1 | 0) + 65535 | 0) & 4294901760 | 0) >>> 16 | 0;
if ((__wasm_grow_memory((wasm2js_i32$0 = $2, wasm2js_i32$1 = $3, wasm2js_i32$2 = ($2 | 0) > ($3 | 0), wasm2js_i32$2 ? wasm2js_i32$0 : wasm2js_i32$1) | 0) | 0) < (0 | 0)) if ((__wasm_grow_memory($3 | 0) | 0) < (0 | 0)) abort();;
var $lib_rt_stub_startOffset = 0;
var $lib_rt_stub_offset = 0;
function $lib_rt_stub___alloc($0, $1) {
var $2 = 0, $3 = 0, $4 = 0, $5 = 0;
if ($0 >>> 0 > 1073741808 >>> 0) {
abort()
}
$lib_allocator_arena_offset = $0;
return $1 | 0;
}
function $lib_util_runtime_allocate($0) {
$0 = $0 | 0;
var $1 = 0, wasm2js_i32$0 = 0, wasm2js_i32$1 = 0;
$1 = $lib_allocator_arena___mem_allocate(1 << (32 - Math_clz32($0 + 15 | 0) | 0) | 0 | 0) | 0;
wasm2js_i32$0 = $1;
wasm2js_i32$1 = 2774420247;
HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1;
wasm2js_i32$0 = $1;
wasm2js_i32$1 = $0;
HEAP32[(wasm2js_i32$0 + 4 | 0) >> 2] = wasm2js_i32$1;
return $1 + 16 | 0 | 0;
$3 = $lib_rt_stub_offset + 16 | 0;
$2 = (($3 + ($0 >>> 0 > 1 >>> 0 ? $0 : 1) | 0) + 15 | 0) & -16 | 0;
$4 = __wasm_memory_size();
if ($2 >>> 0 > ($4 << 16 | 0) >>> 0) {
$5 = ((($2 - $3 | 0) + 65535 | 0) & -65536 | 0) >>> 16 | 0;
if ((__wasm_memory_grow((($4 | 0) > ($5 | 0) ? $4 : $5) | 0) | 0) < (0 | 0)) {
if ((__wasm_memory_grow($5 | 0) | 0) < (0 | 0)) {
abort()
}
}
}
$lib_rt_stub_offset = $2;
$2 = $3 - 16 | 0;
HEAP32[($2 + 8 | 0) >> 2] = $1;
HEAP32[($2 + 12 | 0) >> 2] = $0;
return $3;
}
function assembly_index_NBodySystem_constructor($0) {
$0 = $0 | 0;
var $1 = 0, $2 = 0, $3 = 0.0, $4 = 0.0, $5 = 0.0, $6 = 0.0, $7 = 0, wasm2js_i32$0 = 0, wasm2js_f64$0 = 0.0, wasm2js_i32$1 = 0;
$7 = HEAP32[($0 + 12 | 0) >> 2] | 0;
repeat_0 : do {
var $1 = 0, $2 = 0, $3 = 0.0, $4 = 0.0, $5 = 0.0, $6 = 0.0, $7 = 0;
$7 = HEAP32[($0 + 12 | 0) >> 2];
repeat_0 : while (1) {
if (($1 | 0) < ($7 | 0)) {
$2 = HEAPU32[((HEAPU32[($0 + 4 | 0) >> 2] | 0) + ($1 << 2 | 0) | 0) >> 2] | 0;
$3 = +HEAPF64[($2 + 48 | 0) >> 3];
$4 = $4 + +HEAPF64[($2 + 24 | 0) >> 3] * $3;
$5 = $5 + +HEAPF64[($2 + 32 | 0) >> 3] * $3;
$6 = $6 + +HEAPF64[($2 + 40 | 0) >> 3] * $3;
$2 = HEAP32[(HEAP32[($0 + 4 | 0) >> 2] + ($1 << 2 | 0) | 0) >> 2];
$3 = HEAPF64[($2 + 48 | 0) >> 3];
$4 = $4 + HEAPF64[($2 + 24 | 0) >> 3] * $3;
$5 = $5 + HEAPF64[($2 + 32 | 0) >> 3] * $3;
$6 = $6 + HEAPF64[($2 + 40 | 0) >> 3] * $3;
$1 = $1 + 1 | 0;
continue repeat_0;
}
break repeat_0;
} while (1);
$1 = HEAPU32[(HEAPU32[($0 + 4 | 0) >> 2] | 0) >> 2] | 0;
wasm2js_i32$0 = $1;
wasm2js_f64$0 = -$4 / 39.47841760435743;
HEAPF64[(wasm2js_i32$0 + 24 | 0) >> 3] = wasm2js_f64$0;
wasm2js_i32$0 = $1;
wasm2js_f64$0 = -$5 / 39.47841760435743;
HEAPF64[(wasm2js_i32$0 + 32 | 0) >> 3] = wasm2js_f64$0;
wasm2js_i32$0 = $1;
wasm2js_f64$0 = -$6 / 39.47841760435743;
HEAPF64[(wasm2js_i32$0 + 40 | 0) >> 3] = wasm2js_f64$0;
$1 = $lib_util_runtime_allocate(4 | 0) | 0;
wasm2js_i32$0 = $1 - 16 | 0;
wasm2js_i32$1 = 17;
HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1;
wasm2js_i32$0 = $1;
wasm2js_i32$1 = $0;
HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1;
return $1 | 0;
};
$1 = HEAP32[HEAP32[($0 + 4 | 0) >> 2] >> 2];
HEAPF64[($1 + 24 | 0) >> 3] = -$4 / 39.47841760435743;
HEAPF64[($1 + 32 | 0) >> 3] = -$5 / 39.47841760435743;
HEAPF64[($1 + 40 | 0) >> 3] = -$6 / 39.47841760435743;
$1 = $lib_rt_stub___alloc(4, 3);
HEAP32[$1 >> 2] = $0;
return $1;
}
function assembly_index_Body_constructor($0, $1, $2, $3, $4, $5, $6) {
$0 = +$0;
$1 = +$1;
$2 = +$2;
$3 = +$3;
$4 = +$4;
$5 = +$5;
$6 = +$6;
var $7 = 0, wasm2js_i32$0 = 0, wasm2js_i32$1 = 0, wasm2js_f64$0 = 0.0;
$7 = $lib_util_runtime_allocate(56 | 0) | 0;
wasm2js_i32$0 = $7 - 16 | 0;
wasm2js_i32$1 = 18;
HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1;
wasm2js_i32$0 = $7;
wasm2js_f64$0 = $0;
HEAPF64[wasm2js_i32$0 >> 3] = wasm2js_f64$0;
wasm2js_i32$0 = $7;
wasm2js_f64$0 = $1;
HEAPF64[(wasm2js_i32$0 + 8 | 0) >> 3] = wasm2js_f64$0;
wasm2js_i32$0 = $7;
wasm2js_f64$0 = $2;
HEAPF64[(wasm2js_i32$0 + 16 | 0) >> 3] = wasm2js_f64$0;
wasm2js_i32$0 = $7;
wasm2js_f64$0 = $3;
HEAPF64[(wasm2js_i32$0 + 24 | 0) >> 3] = wasm2js_f64$0;
wasm2js_i32$0 = $7;
wasm2js_f64$0 = $4;
HEAPF64[(wasm2js_i32$0 + 32 | 0) >> 3] = wasm2js_f64$0;
wasm2js_i32$0 = $7;
wasm2js_f64$0 = $5;
HEAPF64[(wasm2js_i32$0 + 40 | 0) >> 3] = wasm2js_f64$0;
wasm2js_i32$0 = $7;
wasm2js_f64$0 = $6;
HEAPF64[(wasm2js_i32$0 + 48 | 0) >> 3] = wasm2js_f64$0;
return $7 | 0;
var $7 = 0;
$7 = $lib_rt_stub___alloc(56, 4);
HEAPF64[$7 >> 3] = $0;
HEAPF64[($7 + 8 | 0) >> 3] = $1;
HEAPF64[($7 + 16 | 0) >> 3] = $2;
HEAPF64[($7 + 24 | 0) >> 3] = $3;
HEAPF64[($7 + 32 | 0) >> 3] = $4;
HEAPF64[($7 + 40 | 0) >> 3] = $5;
HEAPF64[($7 + 48 | 0) >> 3] = $6;
return $7;
}
function $lib_util_runtime_makeArray() {
var $0 = 0, $1 = 0, wasm2js_i32$0 = 0, wasm2js_i32$1 = 0;
$0 = $lib_util_runtime_allocate(16 | 0) | 0;
wasm2js_i32$0 = $0 - 16 | 0;
wasm2js_i32$1 = 19;
HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1;
$1 = $lib_util_runtime_allocate(20 | 0) | 0;
wasm2js_i32$0 = $1 - 16 | 0;
wasm2js_i32$1 = 15;
HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1;
wasm2js_i32$0 = $0;
wasm2js_i32$1 = $1;
HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1;
wasm2js_i32$0 = $0;
wasm2js_i32$1 = $1;
HEAP32[(wasm2js_i32$0 + 4 | 0) >> 2] = wasm2js_i32$1;
wasm2js_i32$0 = $0;
wasm2js_i32$1 = 20;
HEAP32[(wasm2js_i32$0 + 8 | 0) >> 2] = wasm2js_i32$1;
wasm2js_i32$0 = $0;
wasm2js_i32$1 = 5;
HEAP32[(wasm2js_i32$0 + 12 | 0) >> 2] = wasm2js_i32$1;
return $0 | 0;
function $lib_rt___allocArray() {
var $0 = 0, $1 = 0;
$0 = $lib_rt_stub___alloc(16, 5);
$1 = $lib_rt_stub___alloc(20, 0);
HEAP32[$0 >> 2] = $1;
HEAP32[($0 + 4 | 0) >> 2] = $1;
HEAP32[($0 + 8 | 0) >> 2] = 20;
HEAP32[($0 + 12 | 0) >> 2] = 5;
return $0;
}
function assembly_index_init() {
var $0 = 0, $1 = 0, wasm2js_i32$0 = 0, wasm2js_i32$1 = 0;
$1 = $lib_util_runtime_makeArray() | 0;
$0 = HEAPU32[($1 + 4 | 0) >> 2] | 0;
wasm2js_i32$0 = $0;
wasm2js_i32$1 = assembly_index_Body_constructor(+(0.0), +(0.0), +(0.0), +(0.0), +(0.0), +(0.0), +(39.47841760435743)) | 0;
HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1;
wasm2js_i32$0 = $0;
wasm2js_i32$1 = assembly_index_Body_constructor(+(4.841431442464721), +(-1.1603200440274284), +(-.10362204447112311), +(.606326392995832), +(2.81198684491626), +(-.02521836165988763), +(.03769367487038949)) | 0;
HEAP32[(wasm2js_i32$0 + 4 | 0) >> 2] = wasm2js_i32$1;
wasm2js_i32$0 = $0;
wasm2js_i32$1 = assembly_index_Body_constructor(+(8.34336671824458), +(4.124798564124305), +(-.4035234171143214), +(-1.0107743461787924), +(1.8256623712304119), +(.008415761376584154), +(.011286326131968767)) | 0;
HEAP32[(wasm2js_i32$0 + 8 | 0) >> 2] = wasm2js_i32$1;
wasm2js_i32$0 = $0;
wasm2js_i32$1 = assembly_index_Body_constructor(+(12.894369562139131), +(-15.111151401698631), +(-.22330757889265573), +(1.0827910064415354), +(.8687130181696082), +(-.010832637401363636), +(1.7237240570597112e-03)) | 0;
HEAP32[(wasm2js_i32$0 + 12 | 0) >> 2] = wasm2js_i32$1;
wasm2js_i32$0 = $0;
wasm2js_i32$1 = assembly_index_Body_constructor(+(15.379697114850917), +(-25.919314609987964), +(.17925877295037118), +(.979090732243898), +(.5946989986476762), +(-.034755955504078104), +(2.0336868699246304e-03)) | 0;
HEAP32[(wasm2js_i32$0 + 16 | 0) >> 2] = wasm2js_i32$1;
assembly_index_system = assembly_index_NBodySystem_constructor($1 | 0) | 0;
$1 = $lib_rt___allocArray();
$0 = HEAP32[($1 + 4 | 0) >> 2];
(wasm2js_i32$0 = $0, wasm2js_i32$1 = assembly_index_Body_constructor(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 39.47841760435743)), HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1;
(wasm2js_i32$0 = $0, wasm2js_i32$1 = assembly_index_Body_constructor(4.841431442464721, -1.1603200440274284, -.10362204447112311, .606326392995832, 2.81198684491626, -.02521836165988763, .03769367487038949)), HEAP32[(wasm2js_i32$0 + 4 | 0) >> 2] = wasm2js_i32$1;
(wasm2js_i32$0 = $0, wasm2js_i32$1 = assembly_index_Body_constructor(8.34336671824458, 4.124798564124305, -.4035234171143214, -1.0107743461787924, 1.8256623712304119, .008415761376584154, .011286326131968767)), HEAP32[(wasm2js_i32$0 + 8 | 0) >> 2] = wasm2js_i32$1;
(wasm2js_i32$0 = $0, wasm2js_i32$1 = assembly_index_Body_constructor(12.894369562139131, -15.111151401698631, -.22330757889265573, 1.0827910064415354, .8687130181696082, -.010832637401363636, 1.7237240570597112e-03)), HEAP32[(wasm2js_i32$0 + 12 | 0) >> 2] = wasm2js_i32$1;
(wasm2js_i32$0 = $0, wasm2js_i32$1 = assembly_index_Body_constructor(15.379697114850917, -25.919314609987964, .17925877295037118, .979090732243898, .5946989986476762, -.034755955504078104, 2.0336868699246304e-03)), HEAP32[(wasm2js_i32$0 + 16 | 0) >> 2] = wasm2js_i32$1;
assembly_index_system = assembly_index_NBodySystem_constructor($1);
}
function assembly_index_NBodySystem_advance($0) {
$0 = $0 | 0;
var $1 = 0, $2 = 0.0, $8 = 0.0, $3 = 0, $4 = 0.0, $5 = 0.0, $6 = 0.0, $7 = 0, $9 = 0.0, $10 = 0.0, $11 = 0.0, $12 = 0, $13 = 0, $14 = 0.0, $15 = 0.0, $16 = 0.0, $17 = 0.0, $107 = 0.0, wasm2js_i32$0 = 0, wasm2js_f64$0 = 0.0;
$12 = HEAPU32[$0 >> 2] | 0;
$13 = HEAP32[($12 + 12 | 0) >> 2] | 0;
repeat_0 : do {
if ($3 >>> 0 < $13 >>> 0) {
$0 = HEAPU32[((HEAPU32[($12 + 4 | 0) >> 2] | 0) + ($3 << 2 | 0) | 0) >> 2] | 0;
$14 = +HEAPF64[$0 >> 3];
$15 = +HEAPF64[($0 + 8 | 0) >> 3];
$16 = +HEAPF64[($0 + 16 | 0) >> 3];
$4 = +HEAPF64[($0 + 24 | 0) >> 3];
$5 = +HEAPF64[($0 + 32 | 0) >> 3];
$6 = +HEAPF64[($0 + 40 | 0) >> 3];
$17 = +HEAPF64[($0 + 48 | 0) >> 3];
$7 = $3 + 1 | 0;
repeat_1 : do {
if ($7 >>> 0 < $13 >>> 0) {
$1 = HEAPU32[((HEAPU32[($12 + 4 | 0) >> 2] | 0) + ($7 << 2 | 0) | 0) >> 2] | 0;
$2 = $14 - +HEAPF64[$1 >> 3];
$9 = $15 - +HEAPF64[($1 + 8 | 0) >> 3];
$10 = $16 - +HEAPF64[($1 + 16 | 0) >> 3];
$8 = $2 * $2 + $9 * $9 + $10 * $10;
$11 = Math_sqrt($8);
$11 = .01 / ($8 * $11);
$8 = +HEAPF64[($1 + 48 | 0) >> 3] * $11;
$4 = $4 - $2 * $8;
$5 = $5 - $9 * $8;
$6 = $6 - $10 * $8;
$107 = $2;
var $1 = 0, $2 = 0.0, $3 = 0.0, $4 = 0, $5 = 0.0, $6 = 0.0, $7 = 0.0, $8 = 0, $9 = 0.0, $10 = 0.0, $11 = 0.0, $12 = 0, $13 = 0, $14 = 0.0, $15 = 0.0, $16 = 0.0, $17 = 0.0;
$12 = HEAP32[$0 >> 2];
$13 = HEAP32[($12 + 12 | 0) >> 2];
repeat_0 : while (1) {
if ($4 >>> 0 < $13 >>> 0) {
$0 = HEAP32[(HEAP32[($12 + 4 | 0) >> 2] + ($4 << 2 | 0) | 0) >> 2];
$14 = HEAPF64[$0 >> 3];
$15 = HEAPF64[($0 + 8 | 0) >> 3];
$16 = HEAPF64[($0 + 16 | 0) >> 3];
$5 = HEAPF64[($0 + 24 | 0) >> 3];
$6 = HEAPF64[($0 + 32 | 0) >> 3];
$7 = HEAPF64[($0 + 40 | 0) >> 3];
$17 = HEAPF64[($0 + 48 | 0) >> 3];
$8 = $4 + 1 | 0;
repeat_1 : while (1) {
if ($8 >>> 0 < $13 >>> 0) {
$1 = HEAP32[(HEAP32[($12 + 4 | 0) >> 2] + ($8 << 2 | 0) | 0) >> 2];
$2 = $14 - HEAPF64[$1 >> 3];
$9 = $15 - HEAPF64[($1 + 8 | 0) >> 3];
$10 = $16 - HEAPF64[($1 + 16 | 0) >> 3];
$3 = $2 * $2 + $9 * $9 + $10 * $10;
$11 = Math_sqrt($3);
$11 = .01 / ($3 * $11);
$3 = HEAPF64[($1 + 48 | 0) >> 3] * $11;
$5 = $5 - $2 * $3;
$6 = $6 - $9 * $3;
$7 = $7 - $10 * $3;
$3 = $2;
$2 = $17 * $11;
wasm2js_i32$0 = $1;
wasm2js_f64$0 = +HEAPF64[($1 + 24 | 0) >> 3] + $107 * $2;
HEAPF64[(wasm2js_i32$0 + 24 | 0) >> 3] = wasm2js_f64$0;
wasm2js_i32$0 = $1;
wasm2js_f64$0 = +HEAPF64[($1 + 32 | 0) >> 3] + $9 * $2;
HEAPF64[(wasm2js_i32$0 + 32 | 0) >> 3] = wasm2js_f64$0;
wasm2js_i32$0 = $1;
wasm2js_f64$0 = +HEAPF64[($1 + 40 | 0) >> 3] + $10 * $2;
HEAPF64[(wasm2js_i32$0 + 40 | 0) >> 3] = wasm2js_f64$0;
$7 = $7 + 1 | 0;
HEAPF64[($1 + 24 | 0) >> 3] = HEAPF64[($1 + 24 | 0) >> 3] + $3 * $2;
HEAPF64[($1 + 32 | 0) >> 3] = HEAPF64[($1 + 32 | 0) >> 3] + $9 * $2;
HEAPF64[($1 + 40 | 0) >> 3] = HEAPF64[($1 + 40 | 0) >> 3] + $10 * $2;
$8 = $8 + 1 | 0;
continue repeat_1;
}
break repeat_1;
} while (1);
wasm2js_i32$0 = $0;
wasm2js_f64$0 = $4;
HEAPF64[(wasm2js_i32$0 + 24 | 0) >> 3] = wasm2js_f64$0;
wasm2js_i32$0 = $0;
wasm2js_f64$0 = $5;
HEAPF64[(wasm2js_i32$0 + 32 | 0) >> 3] = wasm2js_f64$0;
wasm2js_i32$0 = $0;
wasm2js_f64$0 = $6;
HEAPF64[(wasm2js_i32$0 + 40 | 0) >> 3] = wasm2js_f64$0;
wasm2js_i32$0 = $0;
wasm2js_f64$0 = +HEAPF64[$0 >> 3] + .01 * $4;
HEAPF64[wasm2js_i32$0 >> 3] = wasm2js_f64$0;
wasm2js_i32$0 = $0;
wasm2js_f64$0 = +HEAPF64[($0 + 8 | 0) >> 3] + .01 * $5;
HEAPF64[(wasm2js_i32$0 + 8 | 0) >> 3] = wasm2js_f64$0;
wasm2js_i32$0 = $0;
wasm2js_f64$0 = +HEAPF64[($0 + 16 | 0) >> 3] + .01 * $6;
HEAPF64[(wasm2js_i32$0 + 16 | 0) >> 3] = wasm2js_f64$0;
$3 = $3 + 1 | 0;
};
HEAPF64[($0 + 24 | 0) >> 3] = $5;
HEAPF64[($0 + 32 | 0) >> 3] = $6;
HEAPF64[($0 + 40 | 0) >> 3] = $7;
HEAPF64[$0 >> 3] = HEAPF64[$0 >> 3] + .01 * $5;
HEAPF64[($0 + 8 | 0) >> 3] = HEAPF64[($0 + 8 | 0) >> 3] + .01 * $6;
HEAPF64[($0 + 16 | 0) >> 3] = HEAPF64[($0 + 16 | 0) >> 3] + .01 * $7;
$4 = $4 + 1 | 0;
continue repeat_0;
}
break repeat_0;
} while (1);
};
}
function assembly_index_NBodySystem_energy($0) {
$0 = $0 | 0;
var $1 = 0.0, $2 = 0, $3 = 0, $4 = 0, $5 = 0, $10 = 0.0, $6 = 0.0, $7 = 0.0, $8 = 0.0, $9 = 0.0, $30 = 0.0, $39 = 0.0, $45 = 0.0, $69 = 0.0, $84 = 0.0;
$4 = HEAPU32[$0 >> 2] | 0;
$5 = HEAP32[($4 + 12 | 0) >> 2] | 0;
repeat_0 : do {
if ($2 >>> 0 < $5 >>> 0) {
$0 = HEAPU32[((HEAPU32[($4 + 4 | 0) >> 2] | 0) + ($2 << 2 | 0) | 0) >> 2] | 0;
$7 = +HEAPF64[$0 >> 3];
$8 = +HEAPF64[($0 + 8 | 0) >> 3];
$9 = +HEAPF64[($0 + 16 | 0) >> 3];
$30 = $1;
$10 = +HEAPF64[($0 + 48 | 0) >> 3];
$1 = +HEAPF64[($0 + 24 | 0) >> 3];
$39 = $1 * $1;
$1 = +HEAPF64[($0 + 32 | 0) >> 3];
$45 = $39 + $1 * $1;
$1 = +HEAPF64[($0 + 40 | 0) >> 3];
$1 = $30 + .5 * $10 * ($45 + $1 * $1);
$0 = $2 + 1 | 0;
repeat_1 : do {
if ($0 >>> 0 < $5 >>> 0) {
$3 = HEAPU32[((HEAPU32[($4 + 4 | 0) >> 2] | 0) + ($0 << 2 | 0) | 0) >> 2] | 0;
$6 = $7 - +HEAPF64[$3 >> 3];
$69 = $1;
$1 = $8 - +HEAPF64[($3 + 8 | 0) >> 3];
$84 = $6 * $6 + $1 * $1;
$1 = $9 - +HEAPF64[($3 + 16 | 0) >> 3];
$1 = $69 - $10 * +HEAPF64[($3 + 48 | 0) >> 3] / Math_sqrt($84 + $1 * $1);
var $1 = 0.0, $2 = 0.0, $3 = 0, $4 = 0, $5 = 0, $6 = 0.0, $7 = 0, $8 = 0.0, $9 = 0.0, $10 = 0.0, $11 = 0.0;
$5 = HEAP32[$0 >> 2];
$7 = HEAP32[($5 + 12 | 0) >> 2];
repeat_0 : while (1) {
if ($3 >>> 0 < $7 >>> 0) {
$0 = HEAP32[(HEAP32[($5 + 4 | 0) >> 2] + ($3 << 2 | 0) | 0) >> 2];
$9 = HEAPF64[$0 >> 3];
$10 = HEAPF64[($0 + 8 | 0) >> 3];
$11 = HEAPF64[($0 + 16 | 0) >> 3];
$6 = $1;
$8 = HEAPF64[($0 + 48 | 0) >> 3];
$1 = HEAPF64[($0 + 24 | 0) >> 3];
$2 = $1 * $1;
$1 = HEAPF64[($0 + 32 | 0) >> 3];
$2 = $2 + $1 * $1;
$1 = HEAPF64[($0 + 40 | 0) >> 3];
$1 = $6 + .5 * $8 * ($2 + $1 * $1);
$0 = $3 + 1 | 0;
repeat_1 : while (1) {
if ($0 >>> 0 < $7 >>> 0) {
$4 = HEAP32[(HEAP32[($5 + 4 | 0) >> 2] + ($0 << 2 | 0) | 0) >> 2];
$6 = $1;
$1 = $9 - HEAPF64[$4 >> 3];
$2 = $1 * $1;
$1 = $10 - HEAPF64[($4 + 8 | 0) >> 3];
$2 = $2 + $1 * $1;
$1 = $11 - HEAPF64[($4 + 16 | 0) >> 3];
$1 = $6 - $8 * HEAPF64[($4 + 48 | 0) >> 3] / Math_sqrt($2 + $1 * $1);
$0 = $0 + 1 | 0;
continue repeat_1;
}
break repeat_1;
} while (1);
$2 = $2 + 1 | 0;
};
$3 = $3 + 1 | 0;
continue repeat_0;
}
break repeat_0;
} while (1);
return +$1;
};
return $1;
}
function assembly_index_step() {
assembly_index_NBodySystem_advance(assembly_index_system | 0);
return +(+assembly_index_NBodySystem_energy(assembly_index_system | 0));
assembly_index_NBodySystem_advance(assembly_index_system);
return +assembly_index_NBodySystem_energy(assembly_index_system);
}
function assembly_index_bench($0) {
$0 = $0 | 0;
var $1 = 0;
break_0 : {
repeat_0 : do {
if ($1 >>> 0 >= $0 >>> 0) break break_0;
assembly_index_NBodySystem_advance(assembly_index_system | 0);
repeat_0 : while (1) {
if (!($1 >>> 0 >= $0 >>> 0)) {
assembly_index_NBodySystem_advance(assembly_index_system);
$1 = $1 + 1 | 0;
continue repeat_0;
break repeat_0;
} while (1);
}
break repeat_0;
};
}
function assembly_index_getBody($0) {
$0 = $0 | 0;
var $1 = 0, $14 = 0;
$1 = HEAPU32[assembly_index_system >> 2] | 0;
if ($0 >>> 0 < (HEAP32[($1 + 12 | 0) >> 2] | 0) >>> 0) $14 = HEAPU32[((HEAPU32[($1 + 4 | 0) >> 2] | 0) + ($0 << 2 | 0) | 0) >> 2] | 0; else $14 = 0;
return $14 | 0;
var $1 = 0;
$1 = HEAP32[assembly_index_system >> 2];
if ($0 >>> 0 < HEAP32[($1 + 12 | 0) >> 2] >>> 0) {
$0 = HEAP32[(HEAP32[($1 + 4 | 0) >> 2] + ($0 << 2 | 0) | 0) >> 2]
} else {
$0 = 0
}
return $0 | 0;
}
function start() {
$lib_allocator_arena_startOffset = 8;
$lib_allocator_arena_offset = $lib_allocator_arena_startOffset;
$lib_rt_stub_startOffset = 16;
$lib_rt_stub_offset = $lib_rt_stub_startOffset;
}
function null_() {
}
function __wasm_grow_memory(pagesToAdd) {
var FUNCTION_TABLE = [];
function __wasm_memory_grow(pagesToAdd) {
pagesToAdd = pagesToAdd | 0;
var oldPages = __wasm_current_memory() | 0;
var oldPages = __wasm_memory_size() | 0;
var newPages = oldPages + pagesToAdd | 0;
if ((oldPages < newPages) && (newPages < 65536)) {
var newBuffer = new ArrayBuffer(Math_imul(newPages, 65536));
var newHEAP8 = new global.Int8Array(newBuffer);
newHEAP8.set(HEAP8);
HEAP8 = newHEAP8;
HEAP8 = new global.Int8Array(newBuffer);
HEAP16 = new global.Int16Array(newBuffer);
HEAP32 = new global.Int32Array(newBuffer);
HEAPU8 = new global.Uint8Array(newBuffer);
@ -341,32 +258,33 @@ function asmFunc(global, env, buffer) {
return oldPages;
}
function __wasm_current_memory() {
function __wasm_memory_size() {
return buffer.byteLength / 65536 | 0;
}
return {
memory: Object.create(Object.prototype, {
grow: {
value: __wasm_grow_memory
"memory": Object.create(Object.prototype, {
"grow": {
"value": __wasm_memory_grow
},
buffer: {
get: function () {
"buffer": {
"get": function () {
return buffer;
}
}
}),
init: assembly_index_init,
step: assembly_index_step,
bench: assembly_index_bench,
getBody: assembly_index_getBody
"init": assembly_index_init,
"step": assembly_index_step,
"bench": assembly_index_bench,
"getBody": assembly_index_getBody
};
}
const memasmFunc = new ArrayBuffer(65536);
const retasmFunc = asmFunc({Math,Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,NaN,Infinity}, {abort:function() { throw new Error('abort'); }},memasmFunc);
export const memory = retasmFunc.memory;
export const init = retasmFunc.init;
export const step = retasmFunc.step;
export const bench = retasmFunc.bench;
var memasmFunc = new ArrayBuffer(65536);
var retasmFunc = asmFunc({Math,Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,NaN,Infinity}, {abort:function() { throw new Error('abort'); }},memasmFunc);
exports.memory = retasmFunc.memory;
exports.init = retasmFunc.init;
exports.step = retasmFunc.step;
exports.bench = retasmFunc.bench;
exports.getBody = retasmFunc.getBody;

Binary file not shown.

View File

@ -1,33 +1,37 @@
(module
(type $FUNCSIG$v (func))
(type $FUNCSIG$iii (func (param i32 i32) (result i32)))
(type $FUNCSIG$ii (func (param i32) (result i32)))
(type $FUNCSIG$vi (func (param i32)))
(type $FUNCSIG$d (func (result f64)))
(type $FUNCSIG$di (func (param i32) (result f64)))
(type $FUNCSIG$vi (func (param i32)))
(type $FUNCSIG$iddddddd (func (param f64 f64 f64 f64 f64 f64 f64) (result i32)))
(type $FUNCSIG$i (func (result i32)))
(import "env" "memory" (memory $0 0))
(global $assembly/index/system (mut i32) (i32.const 0))
(global $~lib/allocator/arena/startOffset (mut i32) (i32.const 0))
(global $~lib/allocator/arena/offset (mut i32) (i32.const 0))
(global $~lib/rt/stub/startOffset (mut i32) (i32.const 0))
(global $~lib/rt/stub/offset (mut i32) (i32.const 0))
(export "memory" (memory $0))
(export "init" (func $assembly/index/init))
(export "step" (func $assembly/index/step))
(export "bench" (func $assembly/index/bench))
(export "getBody" (func $assembly/index/getBody))
(start $start)
(func $~lib/allocator/arena/__mem_allocate (; 0 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
(func $~lib/rt/stub/__alloc (; 0 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
(local $3 i32)
(local $4 i32)
(local $5 i32)
local.get $0
i32.const 1073741824
i32.const 1073741808
i32.gt_u
if
unreachable
end
global.get $~lib/allocator/arena/offset
local.tee $1
global.get $~lib/rt/stub/offset
i32.const 16
i32.add
local.tee $3
local.get $0
i32.const 1
local.get $0
@ -35,20 +39,20 @@
i32.gt_u
select
i32.add
i32.const 7
i32.const 15
i32.add
i32.const -8
i32.const -16
i32.and
local.tee $0
current_memory
local.tee $2
memory.size
local.tee $4
i32.const 16
i32.shl
i32.gt_u
if
local.get $4
local.get $2
local.get $0
local.get $1
local.get $3
i32.sub
i32.const 65535
i32.add
@ -56,17 +60,17 @@
i32.and
i32.const 16
i32.shr_u
local.tee $3
local.get $2
local.get $3
local.tee $5
local.get $4
local.get $5
i32.gt_s
select
grow_memory
memory.grow
i32.const 0
i32.lt_s
if
local.get $3
grow_memory
local.get $5
memory.grow
i32.const 0
i32.lt_s
if
@ -74,32 +78,20 @@
end
end
end
local.get $0
global.set $~lib/allocator/arena/offset
local.get $1
)
(func $~lib/util/runtime/allocate (; 1 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
i32.const 1
i32.const 32
local.get $0
i32.const 15
i32.add
i32.clz
i32.sub
i32.shl
call $~lib/allocator/arena/__mem_allocate
local.tee $1
i32.const -1520547049
i32.store
local.get $1
local.get $0
i32.store offset=4
local.get $1
local.get $2
global.set $~lib/rt/stub/offset
local.get $3
i32.const 16
i32.add
i32.sub
local.tee $2
local.get $1
i32.store offset=8
local.get $2
local.get $0
i32.store offset=12
local.get $3
)
(func $assembly/index/NBodySystem#constructor (; 2 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(func $assembly/index/NBodySystem#constructor (; 1 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
(local $2 i32)
(local $3 f64)
@ -175,27 +167,19 @@
f64.div
f64.store offset=40
i32.const 4
call $~lib/util/runtime/allocate
i32.const 3
call $~lib/rt/stub/__alloc
local.tee $1
i32.const 16
i32.sub
i32.const 17
i32.store
local.get $1
local.get $0
i32.store
local.get $1
)
(func $assembly/index/Body#constructor (; 3 ;) (type $FUNCSIG$iddddddd) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 f64) (param $4 f64) (param $5 f64) (param $6 f64) (result i32)
(func $assembly/index/Body#constructor (; 2 ;) (type $FUNCSIG$iddddddd) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 f64) (param $4 f64) (param $5 f64) (param $6 f64) (result i32)
(local $7 i32)
i32.const 56
call $~lib/util/runtime/allocate
i32.const 4
call $~lib/rt/stub/__alloc
local.tee $7
i32.const 16
i32.sub
i32.const 18
i32.store
local.get $7
local.get $0
f64.store
local.get $7
@ -218,25 +202,17 @@
f64.store offset=48
local.get $7
)
(func $~lib/util/runtime/makeArray (; 4 ;) (type $FUNCSIG$i) (result i32)
(func $~lib/rt/__allocArray (; 3 ;) (type $FUNCSIG$i) (result i32)
(local $0 i32)
(local $1 i32)
i32.const 16
call $~lib/util/runtime/allocate
i32.const 5
call $~lib/rt/stub/__alloc
local.tee $0
i32.const 16
i32.sub
i32.const 19
i32.store
i32.const 20
call $~lib/util/runtime/allocate
i32.const 0
call $~lib/rt/stub/__alloc
local.tee $1
i32.const 16
i32.sub
i32.const 15
i32.store
local.get $0
local.get $1
i32.store
local.get $0
local.get $1
@ -249,10 +225,10 @@
i32.store offset=12
local.get $0
)
(func $assembly/index/init (; 5 ;) (type $FUNCSIG$v)
(func $assembly/index/init (; 4 ;) (type $FUNCSIG$v)
(local $0 i32)
(local $1 i32)
call $~lib/util/runtime/makeArray
call $~lib/rt/__allocArray
local.tee $1
i32.load offset=4
local.tee $0
@ -309,7 +285,7 @@
call $assembly/index/NBodySystem#constructor
global.set $assembly/index/system
)
(func $assembly/index/NBodySystem#advance (; 6 ;) (type $FUNCSIG$vi) (param $0 i32)
(func $assembly/index/NBodySystem#advance (; 5 ;) (type $FUNCSIG$vi) (param $0 i32)
(local $1 i32)
(local $2 f64)
(local $3 i32)
@ -509,7 +485,7 @@
end
end
)
(func $assembly/index/NBodySystem#energy (; 7 ;) (type $FUNCSIG$di) (param $0 i32) (result f64)
(func $assembly/index/NBodySystem#energy (; 6 ;) (type $FUNCSIG$di) (param $0 i32) (result f64)
(local $1 f64)
(local $2 i32)
(local $3 i32)
@ -637,13 +613,13 @@
end
local.get $1
)
(func $assembly/index/step (; 8 ;) (type $FUNCSIG$d) (result f64)
(func $assembly/index/step (; 7 ;) (type $FUNCSIG$d) (result f64)
global.get $assembly/index/system
call $assembly/index/NBodySystem#advance
global.get $assembly/index/system
call $assembly/index/NBodySystem#energy
)
(func $assembly/index/bench (; 9 ;) (type $FUNCSIG$vi) (param $0 i32)
(func $assembly/index/bench (; 8 ;) (type $FUNCSIG$vi) (param $0 i32)
(local $1 i32)
block $break|0
loop $repeat|0
@ -663,7 +639,7 @@
unreachable
end
)
(func $assembly/index/getBody (; 10 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(func $assembly/index/getBody (; 9 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
local.get $0
global.get $assembly/index/system
@ -683,13 +659,13 @@
i32.const 0
end
)
(func $start (; 11 ;) (type $FUNCSIG$v)
i32.const 8
global.set $~lib/allocator/arena/startOffset
global.get $~lib/allocator/arena/startOffset
global.set $~lib/allocator/arena/offset
(func $start (; 10 ;) (type $FUNCSIG$v)
i32.const 16
global.set $~lib/rt/stub/startOffset
global.get $~lib/rt/stub/startOffset
global.set $~lib/rt/stub/offset
)
(func $null (; 12 ;) (type $FUNCSIG$v)
(func $null (; 11 ;) (type $FUNCSIG$v)
nop
)
)

File diff suppressed because it is too large Load Diff

View File

@ -3,9 +3,9 @@
"version": "1.0.0",
"private": true,
"scripts": {
"asbuild:untouched": "asc assembly/index.ts -b build/untouched.wasm -t build/untouched.wat --sourceMap --debug --validate --importMemory",
"asbuild:optimized": "asc assembly/index.ts -b build/optimized.wasm -t build/optimized.wat -O3 --validate --noAssert --importMemory",
"asbuild:asmjs": "asc assembly/index.ts -a build/index.asm.js -O3 --validate --noAssert",
"asbuild:untouched": "asc assembly/index.ts -b build/untouched.wasm -t build/untouched.wat --sourceMap --debug --validate --runtime none --importMemory",
"asbuild:optimized": "asc assembly/index.ts -b build/optimized.wasm -t build/optimized.wat -O3 --validate --runtime none --noAssert --importMemory",
"asbuild:asmjs": "asc assembly/index.ts -a build/index.asm.js -O3 --validate --runtime none --noAssert && node scripts/postprocess-asmjs",
"asbuild": "npm run asbuild:untouched && npm run asbuild:optimized && npm run asbuild:asmjs",
"tsbuild": "tsc -p assembly -t ES2017 -m commonjs --outDir build",
"build": "npm run asbuild && npm run tsbuild",

View File

@ -0,0 +1,7 @@
const fs = require("fs");
const path = require("path");
const filename = path.join(__dirname, "..", "build" , "index.asm.js");
var source = fs.readFileSync(filename, { encoding: "utf8" });
source = source.replace(/^export var ([^ ]+) =/mg, ($0, $1) => "exports." + $1 + " = ");
fs.writeFileSync(filename, source);

View File

@ -85,7 +85,7 @@ function postInstantiate(baseModule, instance) {
const table = rawExports.table;
const alloc = rawExports["__alloc"];
const retain = rawExports["__retain"];
const rtti = rawExports["__rtti"] || ~0; // oob if not present
const rttiBase = rawExports["__rtti_base"] || ~0; // oob if not present
// Provide views for all sorts of basic values
var buffer, I8, U8, I16, U16, I32, U32, F32, F64, I64, U64;
@ -113,16 +113,16 @@ function postInstantiate(baseModule, instance) {
/** Gets the runtime type info for the given id. */
function getInfo(id) {
const count = U32[rtti >>> 2];
const count = U32[rttiBase >>> 2];
if ((id >>>= 0) >= count) throw Error("invalid id: " + id);
return U32[(rtti + 4 >>> 2) + id * 2];
return U32[(rttiBase + 4 >>> 2) + id * 2];
}
/** Gets the runtime base id for the given id. */
function getBase(id) {
const count = U32[rtti >>> 2];
const count = U32[rttiBase >>> 2];
if ((id >>>= 0) >= count) throw Error("invalid id: " + id);
return U32[(rtti + 4 >>> 2) + id * 2 + 1];
return U32[(rttiBase + 4 >>> 2) + id * 2 + 1];
}
/** Gets the runtime alignment of a collection's values or keys. */
@ -217,7 +217,7 @@ function postInstantiate(baseModule, instance) {
/** Tests whether an object is an instance of the class represented by the specified base id. */
function __instanceof(ref, baseId) {
var id = U32[(ref + ID_OFFSET) >>> 2];
if (id <= U32[rtti >>> 2]) {
if (id <= U32[rttiBase >>> 2]) {
do if (id == baseId) return true;
while (id = getBase(id));
}
@ -308,7 +308,11 @@ function demangle(exports, baseModule) {
let ctor = function(...args) {
return ctor.wrap(ctor.prototype.constructor(0, ...args));
};
ctor.prototype = {};
ctor.prototype = {
valueOf: function valueOf() {
return this[THIS];
}
};
ctor.wrap = function(thisValue) {
return Object.create(ctor.prototype, { [THIS]: { value: thisValue, writable: false } });
};

View File

@ -111,6 +111,7 @@ car.openDoors();
assert.strictEqual(car.isDoorsOpen, 1);
car.closeDoors();
assert.strictEqual(car.isDoorsOpen, 0);
module.__release(car); // uses Car.prototype.valueOf to obtain `thisPtr`
// should be able to use trace
module.dotrace(42);

View File

@ -300,16 +300,16 @@
i32.lt_u
if
call $assembly/index/readVaruint
local.set $2
local.set $4
call $assembly/index/readVaruint
local.set $3
i32.const 0
local.set $4
i32.const 0
local.set $5
local.get $2
i32.const 0
local.set $2
local.get $4
if
local.get $2
local.get $4
i32.const 11
i32.gt_u
if
@ -319,10 +319,9 @@
global.get $assembly/index/off
local.set $6
call $assembly/index/readVaruint
local.set $5
local.get $5
local.tee $2
global.get $assembly/index/off
local.tee $4
local.tee $5
i32.add
global.set $assembly/index/off
local.get $3
@ -332,12 +331,12 @@
i32.sub
local.set $3
end
local.get $2
local.get $4
global.get $assembly/index/off
local.tee $6
local.get $3
local.get $4
local.get $5
local.get $2
call $assembly/options/onSection
if
block $break|1
@ -351,16 +350,16 @@
block $case3|1
block $case2|1
block $case1|1
local.get $2
local.get $4
i32.const 1
i32.ne
if
local.get $2
local.get $4
i32.const 2
i32.eq
br_if $case1|1
block $tablify|0
local.get $2
local.get $4
br_table $case8|1 $tablify|0 $tablify|0 $case2|1 $case3|1 $case4|1 $case5|1 $case6|1 $case7|1 $case11|1 $case11|1 $case11|1 $tablify|0
end
br $case12|1
@ -368,13 +367,13 @@
call $assembly/index/readVaruint
local.set $4
i32.const 0
local.set $3
local.set $2
loop $repeat|2
local.get $3
local.get $2
local.get $4
i32.lt_u
if
local.get $3
local.get $2
i32.const 7
call $assembly/index/readVarint
i32.const 127
@ -383,53 +382,53 @@
call $assembly/index/readVaruint
local.set $5
i32.const 0
local.set $2
local.set $3
loop $repeat|3
local.get $2
local.get $3
local.get $5
i32.lt_u
if
local.get $3
local.get $2
local.get $3
i32.const 7
call $assembly/index/readVarint
i32.const 127
i32.and
call $assembly/options/onTypeParam
local.get $2
local.get $3
i32.const 1
i32.add
local.set $2
local.set $3
br $repeat|3
end
end
call $assembly/index/readVaruint
local.set $5
i32.const 0
local.set $2
local.set $3
loop $repeat|4
local.get $2
local.get $3
local.get $5
i32.lt_u
if
local.get $3
local.get $2
local.get $3
i32.const 7
call $assembly/index/readVarint
i32.const 127
i32.and
call $assembly/options/onTypeReturn
local.get $2
local.get $3
i32.const 1
i32.add
local.set $2
local.set $3
br $repeat|4
end
end
local.get $3
local.get $2
i32.const 1
i32.add
local.set $3
local.set $2
br $repeat|2
end
end
@ -438,14 +437,14 @@
call $assembly/index/readVaruint
local.set $7
i32.const 0
local.set $3
local.set $4
loop $repeat|5
local.get $3
local.get $4
local.get $7
i32.lt_u
if
call $assembly/index/readVaruint
local.tee $4
local.tee $3
global.get $assembly/index/off
local.tee $5
i32.add
@ -464,10 +463,10 @@
i32.const 1
i32.add
global.set $assembly/index/off
local.get $3
local.get $4
local.get $2
local.get $5
local.get $4
local.get $3
local.get $8
local.get $6
call $assembly/options/onImport
@ -483,11 +482,11 @@
i32.sub
br_table $case1|6 $case2|6 $case3|6 $case4|6
end
local.get $0
local.get $10
local.tee $2
i32.const 1
i32.add
local.set $0
local.set $10
local.get $2
call $assembly/index/readVaruint
call $assembly/options/onFunctionImport
@ -497,16 +496,16 @@
call $assembly/index/readVarint
i32.const 127
i32.and
local.set $4
local.set $3
call $assembly/index/readVaruint
local.set $5
local.get $10
local.get $0
local.tee $2
i32.const 1
i32.add
local.set $10
local.set $0
local.get $2
local.get $4
local.get $3
call $assembly/index/readVaruint
local.get $5
i32.const 1
@ -521,7 +520,7 @@
br $break|6
end
call $assembly/index/readVaruint
local.set $4
local.set $3
local.get $11
local.tee $2
i32.const 1
@ -529,7 +528,7 @@
local.set $11
local.get $2
call $assembly/index/readVaruint
local.get $4
local.get $3
i32.const 1
i32.and
if (result i32)
@ -537,7 +536,7 @@
else
i32.const 65535
end
local.get $4
local.get $3
call $assembly/options/onMemoryImport
br $break|6
end
@ -557,10 +556,10 @@
end
unreachable
end
local.get $3
local.get $4
i32.const 1
i32.add
local.set $3
local.set $4
br $repeat|5
end
end
@ -575,11 +574,11 @@
local.get $4
i32.lt_u
if
local.get $0
local.get $10
local.tee $2
i32.const 1
i32.add
local.set $0
local.set $10
local.get $2
call $assembly/index/readVaruint
call $assembly/options/onFunction
@ -595,25 +594,25 @@
call $assembly/index/readVaruint
local.set $7
i32.const 0
local.set $3
local.set $4
loop $repeat|8
local.get $3
local.get $4
local.get $7
i32.lt_u
if
call $assembly/index/readVaruint
i32.const 127
i32.and
local.set $4
local.set $3
call $assembly/index/readVaruint
local.set $5
local.get $10
local.get $0
local.tee $2
i32.const 1
i32.add
local.set $10
local.set $0
local.get $2
local.get $4
local.get $3
call $assembly/index/readVaruint
local.get $5
i32.const 1
@ -625,10 +624,10 @@
end
local.get $5
call $assembly/options/onTable
local.get $3
local.get $4
i32.const 1
i32.add
local.set $3
local.set $4
br $repeat|8
end
end
@ -707,12 +706,12 @@
br $break|1
end
call $assembly/index/readVaruint
local.set $2
i32.const 0
local.set $3
i32.const 0
local.set $2
loop $repeat|11
local.get $3
local.get $2
local.get $3
i32.lt_u
if
call $assembly/index/readVaruint
@ -729,16 +728,16 @@
i32.const 1
i32.add
global.set $assembly/index/off
local.get $3
local.get $2
local.get $7
call $assembly/index/readVaruint
local.get $5
local.get $4
call $assembly/options/onExport
local.get $3
local.get $2
i32.const 1
i32.add
local.set $3
local.set $2
br $repeat|11
end
end
@ -748,11 +747,11 @@
call $assembly/options/onStart
br $break|1
end
local.get $5
local.get $2
i32.const 4
i32.eq
if (result i32)
local.get $4
local.get $5
i32.load
i32.const 1701667182
i32.eq
@ -790,12 +789,12 @@
br $break|12
end
call $assembly/index/readVaruint
local.set $3
i32.const 0
local.set $2
i32.const 0
local.set $3
loop $repeat|13
local.get $2
local.get $3
local.get $2
i32.lt_u
if
call $assembly/index/readVaruint
@ -810,10 +809,10 @@
local.get $8
local.get $7
call $assembly/options/onFunctionName
local.get $2
local.get $3
i32.const 1
i32.add
local.set $2
local.set $3
br $repeat|13
end
end
@ -876,11 +875,11 @@
global.set $assembly/index/off
br $break|1
else
local.get $5
local.get $2
i32.const 16
i32.eq
if (result i32)
local.get $4
local.get $5
i64.load
i64.const 7011371672682196851
i64.eq
@ -888,7 +887,7 @@
i32.const 0
end
if (result i32)
local.get $4
local.get $5
i32.const 8
i32.add
i64.load

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -5,7 +5,7 @@
"main": "index.js",
"types": "index.d.ts",
"scripts": {
"asbuild": "asc assembly/index.ts -O3 -b build/index.wasm -t build/index.wat --importMemory --sourceMap --validate",
"asbuild": "asc assembly/index.ts -O3 -b build/index.wasm -t build/index.wat --importMemory --runtime none --sourceMap --validate",
"build": "npm run asbuild && webpack --mode production --display-modules",
"test": "ts-node tests/"
},

View File

@ -467,8 +467,8 @@ export namespace BuiltinSymbols {
export const v8x16_shuffle = "~lib/builtins/v8x16.shuffle";
// internals
export const HEAP_BASE = "~lib/heap/HEAP_BASE";
export const RTTI_BASE = "~lib/rt/RTTI_BASE";
export const heap_base = "~lib/heap/__heap_base";
export const rtti_base = "~lib/rt/__rtti_base";
export const visit_globals = "~lib/rt/__visit_globals";
export const visit_members = "~lib/rt/__visit_members";
@ -4198,9 +4198,9 @@ export function compileRTTI(compiler: Compiler): void {
var segment = compiler.addMemorySegment(data);
if (usizeType.size == 8) {
let offset = segment.offset;
module.addGlobal(BuiltinSymbols.RTTI_BASE, NativeType.I64, false, module.i64(i64_low(offset), i64_high(offset)));
module.addGlobal(BuiltinSymbols.rtti_base, NativeType.I64, false, module.i64(i64_low(offset), i64_high(offset)));
} else {
module.addGlobal(BuiltinSymbols.RTTI_BASE, NativeType.I32, false, module.i32(i64_low(segment.offset)));
module.addGlobal(BuiltinSymbols.rtti_base, NativeType.I32, false, module.i32(i64_low(segment.offset)));
}
}

View File

@ -254,9 +254,9 @@ export const enum ContextualFlags {
/** Runtime features to be activated by the compiler. */
export const enum RuntimeFeatures {
NONE = 0,
/** Requires HEAP_BASE and heap setup. */
/** Requires heap setup. */
HEAP = 1 << 0,
/** Requires RTTI_BASE and RTTI setup. */
/** Requires runtime type information setup. */
RTTI = 1 << 1,
/** Requires the built-in globals visitor. */
visitGlobals = 1 << 2,
@ -349,11 +349,11 @@ export class Compiler extends DiagnosticEmitter {
// add a mutable heap and rtti base dummies
if (options.isWasm64) {
module.addGlobal(BuiltinSymbols.HEAP_BASE, NativeType.I64, true, module.i64(0));
module.addGlobal(BuiltinSymbols.RTTI_BASE, NativeType.I64, true, module.i64(0));
module.addGlobal(BuiltinSymbols.heap_base, NativeType.I64, true, module.i64(0));
module.addGlobal(BuiltinSymbols.rtti_base, NativeType.I64, true, module.i64(0));
} else {
module.addGlobal(BuiltinSymbols.HEAP_BASE, NativeType.I32, true, module.i32(0));
module.addGlobal(BuiltinSymbols.RTTI_BASE, NativeType.I32, true, module.i32(0));
module.addGlobal(BuiltinSymbols.heap_base, NativeType.I32, true, module.i32(0));
module.addGlobal(BuiltinSymbols.rtti_base, NativeType.I32, true, module.i32(0));
}
// compile entry file(s) while traversing reachable elements
@ -386,25 +386,25 @@ export class Compiler extends DiagnosticEmitter {
// compile runtime features
if (this.runtimeFeatures & RuntimeFeatures.visitGlobals) compileVisitGlobals(this);
if (this.runtimeFeatures & RuntimeFeatures.visitMembers) compileVisitMembers(this);
module.removeGlobal(BuiltinSymbols.RTTI_BASE);
module.removeGlobal(BuiltinSymbols.rtti_base);
if (this.runtimeFeatures & RuntimeFeatures.RTTI) compileRTTI(this);
// update the heap base pointer
var memoryOffset = this.memoryOffset;
memoryOffset = i64_align(memoryOffset, options.usizeType.byteSize);
this.memoryOffset = memoryOffset;
module.removeGlobal(BuiltinSymbols.HEAP_BASE);
module.removeGlobal(BuiltinSymbols.heap_base);
if (this.runtimeFeatures & RuntimeFeatures.HEAP) {
if (options.isWasm64) {
module.addGlobal(
BuiltinSymbols.HEAP_BASE,
BuiltinSymbols.heap_base,
NativeType.I64,
false,
module.i64(i64_low(memoryOffset), i64_high(memoryOffset))
);
} else {
module.addGlobal(
BuiltinSymbols.HEAP_BASE,
BuiltinSymbols.heap_base,
NativeType.I32,
false,
module.i32(i64_low(memoryOffset))
@ -823,10 +823,10 @@ export class Compiler extends DiagnosticEmitter {
}
}
// Handle ambient builtins like 'HEAP_BASE' that need to be resolved but are added explicitly
// Handle ambient builtins like '__heap_base' that need to be resolved but are added explicitly
if (global.is(CommonFlags.AMBIENT) && global.hasDecorator(DecoratorFlags.BUILTIN)) {
if (global.internalName == BuiltinSymbols.HEAP_BASE) this.runtimeFeatures |= RuntimeFeatures.HEAP;
else if (global.internalName == BuiltinSymbols.RTTI_BASE) this.runtimeFeatures |= RuntimeFeatures.RTTI;
if (global.internalName == BuiltinSymbols.heap_base) this.runtimeFeatures |= RuntimeFeatures.HEAP;
else if (global.internalName == BuiltinSymbols.rtti_base) this.runtimeFeatures |= RuntimeFeatures.RTTI;
return true;
}

View File

@ -3,7 +3,7 @@
* @module definitions
*//***/
import {
import {
CommonFlags
} from "./common";
@ -23,7 +23,8 @@ import {
ConstantValueKind,
Interface,
Property,
PropertyPrototype
PropertyPrototype,
File
} from "./program";
import {
@ -42,10 +43,8 @@ abstract class ExportsWalker {
program: Program;
/** Whether to include private members */
includePrivate: bool;
/** Elements still to do. */
todo: Element[] = [];
/** Already seen elements. */
seen: Set<Element> = new Set();
seen: Map<Element,string> = new Map();
/** Constructs a new Element walker. */
constructor(program: Program, includePrivate: bool = false) {
@ -56,57 +55,66 @@ abstract class ExportsWalker {
/** Walks all elements and calls the respective handlers. */
walk(): void {
for (let file of this.program.filesByName.values()) {
let members = file.members;
if (!members) continue;
for (let member of members.values()) {
// FIXME: doesn't honor the actual externally visible name
this.visitElement(member);
}
if (file.source.isEntry) this.visitFile(file);
}
}
/** Visits all exported elements of a file. */
visitFile(file: File): void {
var members = file.exports;
if (members) {
for (let [name, member] of members) this.visitElement(name, member);
}
var exportsStar = file.exportsStar;
if (exportsStar) {
for (let exportStar of exportsStar) this.visitFile(exportStar);
}
var todo = this.todo;
for (let i = 0; i < todo.length; ) this.visitElement(todo[i]);
}
/** Visits an element.*/
visitElement(element: Element): void {
visitElement(name: string, element: Element): void {
if (element.is(CommonFlags.PRIVATE) && !this.includePrivate) return;
if (this.seen.has(element)) return;
this.seen.add(element);
var seen = this.seen;
if (seen.has(element)) {
this.visitAlias(name, element, <string>seen.get(element));
return;
}
seen.set(element, name);
switch (element.kind) {
case ElementKind.GLOBAL: {
if (element.is(CommonFlags.COMPILED)) this.visitGlobal(<Global>element);
if (element.is(CommonFlags.COMPILED)) this.visitGlobal(name, <Global>element);
break;
}
case ElementKind.ENUM: {
if (element.is(CommonFlags.COMPILED)) this.visitEnum(<Enum>element);
if (element.is(CommonFlags.COMPILED)) this.visitEnum(name, <Enum>element);
break;
}
case ElementKind.FUNCTION_PROTOTYPE: {
this.visitFunctionInstances(<FunctionPrototype>element);
this.visitFunctionInstances(name, <FunctionPrototype>element);
break;
}
case ElementKind.CLASS_PROTOTYPE: {
this.visitClassInstances(<ClassPrototype>element);
this.visitClassInstances(name, <ClassPrototype>element);
break;
}
case ElementKind.FIELD: {
if ((<Field>element).is(CommonFlags.COMPILED)) this.visitField(<Field>element);
if ((<Field>element).is(CommonFlags.COMPILED)) this.visitField(name, <Field>element);
break;
}
case ElementKind.PROPERTY_PROTOTYPE: {
this.visitPropertyInstances(<PropertyPrototype>element);
this.visitPropertyInstances(name, <PropertyPrototype>element);
break;
}
case ElementKind.PROPERTY: {
let prop = <Property>element;
let getter = prop.getterInstance;
if (getter) this.visitFunction(getter);
if (getter) this.visitFunction(name, getter);
let setter = prop.setterInstance;
if (setter) this.visitFunction(setter);
if (setter) this.visitFunction(name, setter);
break;
}
case ElementKind.NAMESPACE: {
if (hasCompiledMember(element)) this.visitNamespace(element);
if (hasCompiledMember(element)) this.visitNamespace(name, element);
break;
}
case ElementKind.TYPEDEFINITION: break;
@ -114,25 +122,25 @@ abstract class ExportsWalker {
}
}
private visitFunctionInstances(element: FunctionPrototype): void {
private visitFunctionInstances(name: string, element: FunctionPrototype): void {
var instances = element.instances;
if (instances) {
for (let instance of instances.values()) {
if (instance.is(CommonFlags.COMPILED)) this.visitFunction(<Function>instance);
if (instance.is(CommonFlags.COMPILED)) this.visitFunction(name, <Function>instance);
}
}
}
private visitClassInstances(element: ClassPrototype): void {
private visitClassInstances(name: string, element: ClassPrototype): void {
var instances = element.instances;
if (instances) {
for (let instance of instances.values()) {
if (instance.is(CommonFlags.COMPILED)) this.visitClass(<Class>instance);
if (instance.is(CommonFlags.COMPILED)) this.visitClass(name, <Class>instance);
}
}
}
private visitPropertyInstances(element: PropertyPrototype): void {
private visitPropertyInstances(name: string, element: PropertyPrototype): void {
// var instances = element.instances;
// if (instances) {
// for (let instance of instances.values()) {
@ -142,13 +150,14 @@ abstract class ExportsWalker {
assert(false);
}
abstract visitGlobal(element: Global): void;
abstract visitEnum(element: Enum): void;
abstract visitFunction(element: Function): void;
abstract visitClass(element: Class): void;
abstract visitInterface(element: Interface): void;
abstract visitField(element: Field): void;
abstract visitNamespace(element: Element): void;
abstract visitGlobal(name: string, element: Global): void;
abstract visitEnum(name: string, element: Enum): void;
abstract visitFunction(name: string, element: Function): void;
abstract visitClass(name: string, element: Class): void;
abstract visitInterface(name: string, element: Interface): void;
abstract visitField(name: string, element: Field): void;
abstract visitNamespace(name: string, element: Element): void;
abstract visitAlias(name: string, element: Element, originalName: string): void;
}
/** A WebIDL definitions builder. */
@ -167,14 +176,14 @@ export class IDLBuilder extends ExportsWalker {
super(program, includePrivate);
}
visitGlobal(element: Global): void {
visitGlobal(name: string, element: Global): void {
var sb = this.sb;
var isConst = element.is(CommonFlags.INLINED);
indent(sb, this.indentLevel);
if (isConst) sb.push("const ");
sb.push(this.typeToString(element.type));
sb.push(" ");
sb.push(element.name);
sb.push(name);
if (isConst) {
switch (element.constantValueKind) {
case ConstantValueKind.INTEGER: {
@ -193,11 +202,11 @@ export class IDLBuilder extends ExportsWalker {
sb.push(";\n");
}
visitEnum(element: Enum): void {
visitEnum(name: string, element: Enum): void {
var sb = this.sb;
indent(sb, this.indentLevel++);
sb.push("interface ");
sb.push(element.name);
sb.push(name);
sb.push(" {\n");
var members = element.members;
if (members) {
@ -218,20 +227,20 @@ export class IDLBuilder extends ExportsWalker {
}
}
for (let member of members.values()) {
if (member.kind != ElementKind.ENUMVALUE) this.visitElement(member);
if (member.kind != ElementKind.ENUMVALUE) this.visitElement(member.name, member);
}
}
indent(sb, --this.indentLevel);
sb.push("}\n");
}
visitFunction(element: Function): void {
visitFunction(name: string, element: Function): void {
var sb = this.sb;
var signature = element.signature;
indent(sb, this.indentLevel);
sb.push(this.typeToString(signature.returnType));
sb.push(" ");
sb.push(element.name);
sb.push(name);
sb.push("(");
var parameters = signature.parameterTypes;
var numParameters = parameters.length;
@ -250,45 +259,49 @@ export class IDLBuilder extends ExportsWalker {
sb.push("interface ");
sb.push(element.name);
sb.push(" {\n");
for (let member of members.values()) this.visitElement(member);
for (let member of members.values()) this.visitElement(member.name, member);
indent(sb, --this.indentLevel);
sb.push("}\n");
}
}
visitClass(element: Class): void {
visitClass(name: string, element: Class): void {
var sb = this.sb;
indent(sb, this.indentLevel++);
sb.push("interface ");
sb.push(element.name);
sb.push(name);
sb.push(" {\n");
// TODO
indent(sb, --this.indentLevel);
sb.push("}\n");
}
visitInterface(element: Interface): void {
this.visitClass(element);
visitInterface(name: string, element: Interface): void {
this.visitClass(name, element);
}
visitField(element: Field): void {
visitField(name: string, element: Field): void {
// TODO
}
visitNamespace(element: Namespace): void {
visitNamespace(name: string, element: Namespace): void {
var sb = this.sb;
indent(sb, this.indentLevel++);
sb.push("interface ");
sb.push(element.name);
sb.push(name);
sb.push(" {\n");
var members = element.members;
if (members) {
for (let member of members.values()) this.visitElement(member);
for (let member of members.values()) this.visitElement(member.name, member);
}
indent(sb, --this.indentLevel);
sb.push("}\n");
}
visitAlias(name: string, element: Element, originalName: string): void {
// TODO
}
typeToString(type: Type): string {
switch (type.kind) {
case TypeKind.I8: return "byte";
@ -335,13 +348,14 @@ export class TSDBuilder extends ExportsWalker {
private sb: string[] = [];
private indentLevel: i32 = 0;
private unknown: Set<string> = new Set();
/** Constructs a new WebIDL builder. */
constructor(program: Program, includePrivate: bool = false) {
super(program, includePrivate);
}
visitGlobal(element: Global): void {
visitGlobal(name: string, element: Global): void {
var sb = this.sb;
var isConst = element.is(CommonFlags.INLINED);
indent(sb, this.indentLevel);
@ -349,21 +363,21 @@ export class TSDBuilder extends ExportsWalker {
if (isConst) sb.push("static readonly ");
else sb.push("static ");
} else {
if (isConst) sb.push("const ");
else sb.push("var ");
if (isConst) sb.push("export const ");
else sb.push("export var ");
}
sb.push(element.name);
sb.push(name);
sb.push(": ");
sb.push(this.typeToString(element.type));
sb.push(";\n");
this.visitNamespace(element);
this.visitNamespace(name, element);
}
visitEnum(element: Enum): void {
visitEnum(name: string, element: Enum): void {
var sb = this.sb;
indent(sb, this.indentLevel++);
sb.push("enum ");
sb.push(element.name);
sb.push("export enum ");
sb.push(name);
sb.push(" {\n");
var members = element.members;
if (members) {
@ -381,13 +395,13 @@ export class TSDBuilder extends ExportsWalker {
--numMembers;
}
}
if (numMembers) this.visitNamespace(element);
if (numMembers) this.visitNamespace(name, element);
}
indent(sb, --this.indentLevel);
sb.push("}\n");
}
visitFunction(element: Function): void {
visitFunction(name: string, element: Function): void {
if (element.isAny(CommonFlags.PRIVATE | CommonFlags.SET)) return;
var sb = this.sb;
var signature = element.signature;
@ -395,14 +409,15 @@ export class TSDBuilder extends ExportsWalker {
if (element.is(CommonFlags.PROTECTED)) sb.push("protected ");
if (element.is(CommonFlags.STATIC)) sb.push("static ");
if (element.is(CommonFlags.GET)) {
sb.push(element.identifierNode.text); // 'get:funcName' internally
sb.push(": ");
sb.push("get ");
sb.push(name); // 'get:funcName' internally
sb.push("(): ");
sb.push(this.typeToString(signature.returnType));
sb.push(";\n");
return;
} else {
if (!element.isAny(CommonFlags.STATIC | CommonFlags.INSTANCE)) sb.push("function ");
sb.push(element.name);
if (!element.isAny(CommonFlags.STATIC | CommonFlags.INSTANCE)) sb.push("export function ");
sb.push(name);
}
sb.push("(");
var parameters = signature.parameterTypes;
@ -422,73 +437,79 @@ export class TSDBuilder extends ExportsWalker {
sb.push(this.typeToString(signature.returnType));
}
sb.push(";\n");
this.visitNamespace(element);
this.visitNamespace(name, element);
}
visitClass(element: Class): void {
visitClass(name: string, element: Class): void {
var sb = this.sb;
var isInterface = element.kind == ElementKind.INTERFACE;
indent(sb, this.indentLevel++);
if (isInterface) {
sb.push("interface ");
sb.push("export interface ");
} else {
if (element.is(CommonFlags.ABSTRACT)) sb.push("abstract ");
sb.push("class ");
}
sb.push(element.name);
var base = element.base;
if (base && base.is(CommonFlags.COMPILED | CommonFlags.MODULE_EXPORT)) {
sb.push(" extends ");
sb.push(base.name); // TODO: fqn
sb.push("export class ");
}
sb.push(name);
// var base = element.base;
// if (base && base.is(CommonFlags.COMPILED | CommonFlags.MODULE_EXPORT)) {
// sb.push(" extends ");
// sb.push(base.name); // TODO: fqn
// }
sb.push(" {\n");
var members = element.parent.members; // static
if (members) {
for (let member of members.values()) {
this.visitElement(member);
}
var staticMembers = element.prototype.members;
if (staticMembers) {
for (let member of staticMembers.values()) this.visitElement(member.name, member);
}
var ctor = element.constructorInstance;
if (ctor) this.visitFunction(ctor);
members = element.members; // instance
if (members) {
for (let member of members.values()) this.visitElement(member);
var instanceMembers = element.members;
if (instanceMembers) {
for (let member of instanceMembers.values()) this.visitElement(member.name, member);
}
indent(sb, --this.indentLevel);
sb.push("}\n");
}
visitInterface(element: Interface): void {
this.visitClass(element);
visitInterface(name: string, element: Interface): void {
this.visitClass(name, element);
}
visitField(element: Field): void {
visitField(name: string, element: Field): void {
if (element.is(CommonFlags.PRIVATE)) return;
var sb = this.sb;
indent(sb, this.indentLevel);
if (element.is(CommonFlags.PROTECTED)) sb.push("protected ");
if (element.is(CommonFlags.STATIC)) sb.push("static ");
if (element.is(CommonFlags.READONLY)) sb.push("readonly ");
sb.push(element.name);
sb.push(name);
sb.push(": ");
sb.push(this.typeToString(element.type));
sb.push(";\n");
}
visitNamespace(element: Element): void {
visitNamespace(name: string, element: Element): void {
var members = element.members;
if (members && members.size) {
let sb = this.sb;
indent(sb, this.indentLevel++);
sb.push("namespace ");
sb.push(element.name);
sb.push("export namespace ");
sb.push(name);
sb.push(" {\n");
for (let member of members.values()) this.visitElement(member);
for (let member of members.values()) this.visitElement(member.name, member);
indent(sb, --this.indentLevel);
sb.push("}\n");
}
}
visitAlias(name: string, element: Element, originalName: string): void {
var sb = this.sb;
indent(sb, this.indentLevel);
sb.push("export const ");
sb.push(name);
sb.push(" = typeof ");
sb.push(originalName);
sb.push(";\n");
}
typeToString(type: Type): string {
switch (type.kind) {
case TypeKind.I8: return "i8";
@ -510,7 +531,7 @@ export class TSDBuilder extends ExportsWalker {
case TypeKind.VOID: return "void";
default: {
assert(false);
return "";
return "any";
}
}
}

View File

@ -1,3 +1,3 @@
// @ts-ignore: decorator
@builtin
export declare const HEAP_BASE: usize;
export declare const __heap_base: usize;

View File

@ -105,7 +105,7 @@ declare const NaN: f32 | f64;
/** Positive infinity as a 32-bit or 64-bit float depending on context. */
declare const Infinity: f32 | f64;
/** Heap base offset. */
declare const HEAP_BASE: usize;
declare const __heap_base: usize;
/** Determines the byte size of the specified underlying core type. Compiles to a constant. */
declare function sizeof<T>(): usize;
/** Determines the alignment (log2) of the specified underlying core type. Compiles to a constant. */
@ -539,7 +539,7 @@ declare namespace v128 {
export function mul<T>(a: v128, b: v128): v128; // except i64
/** Divides each lane of two 128-bit vectors. */
export function div<T = f32 | f64>(a: v128, b: v128): v128;
/** Negates each lane of a 128-bit vector */
/** Negates each lane of a 128-bit vector. */
export function neg<T>(a: v128): v128;
/** Adds each lane of two 128-bit vectors using saturation. */
export function add_saturate<T>(a: v128, b: v128): v128;

View File

@ -5,7 +5,7 @@ import { ArrayBufferView } from "./arraybuffer";
// @ts-ignore: decorator
@builtin
export declare const RTTI_BASE: usize;
export declare const __rtti_base: usize;
// @ts-ignore: decorator
@builtin @unsafe
@ -18,7 +18,7 @@ export declare function __visit_members(ref: usize, cookie: u32): void;
// @ts-ignore: decorator
@unsafe
export function __typeinfo(id: u32): TypeinfoFlags {
var ptr = RTTI_BASE;
var ptr = __rtti_base;
if (id > load<u32>(ptr)) throw new Error(E_INDEXOUTOFRANGE);
return changetype<Typeinfo>(ptr + sizeof<u32>() + id * offsetof<Typeinfo>()).flags;
}
@ -27,7 +27,7 @@ export function __typeinfo(id: u32): TypeinfoFlags {
@unsafe
export function __instanceof(ref: usize, superId: u32): bool { // keyword
var id = changetype<BLOCK>(ref - BLOCK_OVERHEAD).rtId;
var ptr = RTTI_BASE;
var ptr = __rtti_base;
if (id <= load<u32>(ptr)) {
do if (id == superId) return true;
while (id = changetype<Typeinfo>(ptr + sizeof<u32>() + id * offsetof<Typeinfo>()).base);

View File

@ -1,3 +1,3 @@
export { __alloc } from "rt/tlsf";
export { __retain, __release, __collect } from "rt/pure";
export { RTTI_BASE as __rtti } from "rt";
export { __rtti_base } from "rt";

View File

@ -1,2 +1,2 @@
export { __alloc, __retain, __release, __collect } from "rt/stub";
export { RTTI_BASE as __rtti } from "rt";
export { __rtti_base } from "rt";

View File

@ -64,7 +64,7 @@ import { onincrement, ondecrement, onfree, onalloc } from "./rtrace";
// @ts-ignore: decorator
@global @unsafe
function __visit(ref: usize, cookie: i32): void {
if (ref < HEAP_BASE) return;
if (ref < __heap_base) return;
var s = changetype<Block>(ref - BLOCK_OVERHEAD);
switch (cookie) {
case VISIT_DECREMENT: {
@ -251,12 +251,12 @@ function collectWhite(s: Block): void {
// @ts-ignore: decorator
@global @unsafe
export function __retain(ref: usize): usize {
if (ref > HEAP_BASE) increment(changetype<Block>(ref - BLOCK_OVERHEAD));
if (ref > __heap_base) increment(changetype<Block>(ref - BLOCK_OVERHEAD));
return ref;
}
// @ts-ignore: decorator
@global @unsafe
export function __release(ref: usize): void {
if (ref > HEAP_BASE) decrement(changetype<Block>(ref - BLOCK_OVERHEAD));
if (ref > __heap_base) decrement(changetype<Block>(ref - BLOCK_OVERHEAD));
}

View File

@ -2,7 +2,7 @@ import { AL_MASK, BLOCK, BLOCK_OVERHEAD, BLOCK_MAXSIZE } from "rt/common";
// @ts-ignore: decorator
@lazy
var startOffset: usize = (HEAP_BASE + AL_MASK) & ~AL_MASK;
var startOffset: usize = (__heap_base + AL_MASK) & ~AL_MASK;
// @ts-ignore: decorator
@lazy

View File

@ -450,7 +450,7 @@ function prepareSize(size: usize): usize {
/** Initilizes the root structure. */
export function initializeRoot(): void {
var rootOffset = (HEAP_BASE + AL_MASK) & ~AL_MASK;
var rootOffset = (__heap_base + AL_MASK) & ~AL_MASK;
var pagesBefore = memory.size();
var pagesNeeded = <i32>((((rootOffset + ROOT_SIZE) + 0xffff) & ~0xffff) >>> 16);
if (pagesNeeded > pagesBefore && memory.grow(pagesNeeded - pagesBefore) < 0) unreachable();

View File

@ -3,7 +3,7 @@
// ╒═══════════════════ Typeinfo interpretation ═══════════════════╕
// 3 2 1
// 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 bits
// ├─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┤ ◄─ RTTI_BASE
// ├─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┤ ◄─ __rtti_base
// │ count │
// ╞═══════════════════════════════════════════════════════════════╡ ┐
// │ Typeinfo#flags [id=0] │ id < count

View File

@ -89,7 +89,7 @@ class List {
* for that size. The bucket at index 0 corresponds to an allocation size of
* MAX_ALLOC (i.e. the whole address space).
*/
var BUCKETS_START: usize = HEAP_BASE;
var BUCKETS_START: usize = __heap_base;
var BUCKETS_END: usize = BUCKETS_START + BUCKET_COUNT * List.SIZE;
function buckets$get(index: usize): List {

View File

@ -30,7 +30,7 @@
(global $assembly/buddy/base_ptr (mut i32) (i32.const 0))
(global $assembly/buddy/max_ptr (mut i32) (i32.const 0))
(global $~lib/ASC_SHRINK_LEVEL i32 (i32.const 0))
(global $~lib/heap/HEAP_BASE i32 (i32.const 156))
(global $~lib/heap/__heap_base i32 (i32.const 156))
(export "memory" (memory $0))
(export "memory.copy" (func $~lib/memory/memory.copy))
(export "memory.init" (func $~lib/memory/memory.init))
@ -41,7 +41,7 @@
(export "__free" (func $assembly/buddy/__mem_free))
(start $start)
(func $start:assembly/buddy (; 1 ;) (type $FUNCSIG$v)
global.get $~lib/heap/HEAP_BASE
global.get $~lib/heap/__heap_base
global.set $assembly/buddy/BUCKETS_START
global.get $assembly/buddy/BUCKETS_START
global.get $assembly/buddy/BUCKET_COUNT

View File

@ -20,13 +20,13 @@
(global $~lib/rt/pure/CUR (mut i32) (i32.const 0))
(global $~lib/rt/pure/END (mut i32) (i32.const 0))
(global $~lib/rt/pure/ROOTS (mut i32) (i32.const 0))
(global $~lib/rt/RTTI_BASE i32 (i32.const 304))
(global $~lib/rt/__rtti_base i32 (i32.const 304))
(export "memory" (memory $0))
(export "__alloc" (func $~lib/rt/tlsf/__alloc))
(export "__retain" (func $~lib/rt/pure/__retain))
(export "__release" (func $~lib/rt/pure/__release))
(export "__collect" (func $~lib/rt/pure/__collect))
(export "__rtti" (global $~lib/rt/RTTI_BASE))
(export "__rtti_base" (global $~lib/rt/__rtti_base))
(export "memory.copy" (func $~lib/memory/memory.copy))
(export "memory.init" (func $~lib/memory/memory.init))
(export "memory.drop" (func $~lib/memory/memory.drop))

View File

@ -24,14 +24,14 @@
(global $~lib/rt/pure/END (mut i32) (i32.const 0))
(global $~lib/rt/pure/ROOTS (mut i32) (i32.const 0))
(global $~lib/ASC_SHRINK_LEVEL i32 (i32.const 0))
(global $~lib/rt/RTTI_BASE i32 (i32.const 352))
(global $~lib/heap/HEAP_BASE i32 (i32.const 380))
(global $~lib/rt/__rtti_base i32 (i32.const 352))
(global $~lib/heap/__heap_base i32 (i32.const 380))
(export "memory" (memory $0))
(export "__alloc" (func $~lib/rt/tlsf/__alloc))
(export "__retain" (func $~lib/rt/pure/__retain))
(export "__release" (func $~lib/rt/pure/__release))
(export "__collect" (func $~lib/rt/pure/__collect))
(export "__rtti" (global $~lib/rt/RTTI_BASE))
(export "__rtti_base" (global $~lib/rt/__rtti_base))
(export "memory.copy" (func $~lib/memory/memory.copy))
(export "memory.init" (func $~lib/memory/memory.init))
(export "memory.drop" (func $~lib/memory/memory.drop))
@ -216,30 +216,30 @@
i32.add
i32.load offset=4
end
local.set $8
local.set $9
block $~lib/rt/tlsf/SETSL|inlined.1
local.get $0
local.set $11
local.set $8
local.get $4
local.set $10
local.get $8
local.set $11
local.get $9
i32.const 1
local.get $5
i32.shl
i32.const -1
i32.xor
i32.and
local.tee $8
local.set $9
local.tee $9
local.set $10
local.get $8
local.get $11
local.get $10
i32.const 2
i32.shl
i32.add
local.get $9
local.get $10
i32.store offset=4
end
local.get $8
local.get $9
i32.eqz
if
local.get $0
@ -371,17 +371,17 @@
if
block $~lib/rt/tlsf/GETFREELEFT|inlined.0 (result i32)
local.get $1
local.set $3
local.get $3
local.set $6
local.get $6
i32.const 4
i32.sub
i32.load
end
local.set $3
local.get $3
i32.load
local.set $6
local.get $6
i32.load
local.set $3
local.get $3
i32.const 1
i32.and
i32.eqz
@ -393,7 +393,7 @@
call $~lib/builtins/abort
unreachable
end
local.get $6
local.get $3
i32.const 3
i32.const -1
i32.xor
@ -412,17 +412,17 @@
i32.lt_u
if
local.get $0
local.get $3
call $~lib/rt/tlsf/removeBlock
local.get $3
local.get $6
call $~lib/rt/tlsf/removeBlock
local.get $6
local.get $3
i32.const 3
i32.and
local.get $7
i32.or
local.tee $2
i32.store
local.get $3
local.get $6
local.set $1
end
end
@ -531,16 +531,16 @@
end
block $~lib/rt/tlsf/GETHEAD|inlined.1 (result i32)
local.get $0
local.set $3
local.get $9
local.set $6
local.get $10
local.set $7
local.get $9
local.set $3
local.get $10
local.set $6
local.get $7
local.get $3
local.get $6
i32.const 4
i32.shl
local.get $7
local.get $6
i32.add
i32.const 2
i32.shl
@ -564,21 +564,21 @@
local.get $0
local.set $12
local.get $9
local.set $3
local.get $10
local.set $6
local.get $1
local.set $7
local.get $10
local.set $3
local.get $1
local.set $6
local.get $12
local.get $3
local.get $7
i32.const 4
i32.shl
local.get $6
local.get $3
i32.add
i32.const 2
i32.shl
i32.add
local.get $7
local.get $6
i32.store offset=96
end
local.get $0
@ -591,16 +591,16 @@
i32.store
block $~lib/rt/tlsf/SETSL|inlined.2
local.get $0
local.set $3
local.set $13
local.get $9
local.set $6
local.set $12
block $~lib/rt/tlsf/GETSL|inlined.1 (result i32)
local.get $0
local.set $13
local.set $3
local.get $9
local.set $12
local.get $13
local.get $12
local.set $6
local.get $3
local.get $6
i32.const 2
i32.shl
i32.add
@ -611,8 +611,8 @@
i32.shl
i32.or
local.set $7
local.get $3
local.get $6
local.get $13
local.get $12
i32.const 2
i32.shl
i32.add
@ -783,7 +783,7 @@
(local $7 i32)
(local $8 i32)
(local $9 i32)
global.get $~lib/heap/HEAP_BASE
global.get $~lib/heap/__heap_base
i32.const 15
i32.add
i32.const 15
@ -837,9 +837,9 @@
end
block $break|0
i32.const 0
local.set $4
local.set $5
loop $repeat|0
local.get $4
local.get $5
i32.const 23
i32.lt_u
i32.eqz
@ -847,23 +847,23 @@
block $~lib/rt/tlsf/SETSL|inlined.0
local.get $3
local.set $7
local.get $4
local.get $5
local.set $6
i32.const 0
local.set $5
local.set $4
local.get $7
local.get $6
i32.const 2
i32.shl
i32.add
local.get $5
local.get $4
i32.store offset=4
end
block $break|1
i32.const 0
local.set $5
local.set $7
loop $repeat|1
local.get $5
local.get $7
i32.const 16
i32.lt_u
i32.eqz
@ -871,37 +871,37 @@
block $~lib/rt/tlsf/SETHEAD|inlined.0
local.get $3
local.set $9
local.get $4
local.set $8
local.get $5
local.set $7
i32.const 0
local.set $8
local.get $7
local.set $6
i32.const 0
local.set $4
local.get $9
local.get $8
i32.const 4
i32.shl
local.get $7
local.get $6
i32.add
i32.const 2
i32.shl
i32.add
local.get $6
local.get $4
i32.store offset=96
end
local.get $5
local.get $7
i32.const 1
i32.add
local.set $5
local.set $7
br $repeat|1
unreachable
end
unreachable
end
local.get $4
local.get $5
i32.const 1
i32.add
local.set $4
local.set $5
br $repeat|0
unreachable
end
@ -1067,23 +1067,23 @@
i32.add
i32.shl
i32.and
local.set $4
local.get $4
local.set $5
local.get $5
i32.eqz
if
i32.const 0
local.set $7
else
local.get $4
local.get $5
i32.ctz
local.set $2
block $~lib/rt/tlsf/GETSL|inlined.3 (result i32)
local.get $0
local.set $8
local.get $2
local.set $5
local.set $4
local.get $8
local.get $5
local.get $4
i32.const 2
i32.shl
i32.add
@ -1107,12 +1107,12 @@
local.set $8
local.get $6
i32.ctz
local.set $5
local.set $4
local.get $9
local.get $8
i32.const 4
i32.shl
local.get $5
local.get $4
i32.add
i32.const 2
i32.shl
@ -1124,14 +1124,14 @@
else
block $~lib/rt/tlsf/GETHEAD|inlined.3 (result i32)
local.get $0
local.set $8
local.set $9
local.get $2
local.set $5
local.set $8
local.get $6
i32.ctz
local.set $4
local.get $9
local.get $8
local.get $5
i32.const 4
i32.shl
local.get $4
@ -1432,7 +1432,7 @@
)
(func $~lib/rt/pure/__retain (; 12 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
local.get $0
global.get $~lib/heap/HEAP_BASE
global.get $~lib/heap/__heap_base
i32.gt_u
if
local.get $0
@ -1471,7 +1471,7 @@
)
(func $~lib/rt/__typeinfo (; 14 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
global.get $~lib/rt/RTTI_BASE
global.get $~lib/rt/__rtti_base
local.set $1
local.get $0
local.get $1
@ -3123,7 +3123,7 @@
)
(func $~lib/rt/pure/__release (; 21 ;) (type $FUNCSIG$vi) (param $0 i32)
local.get $0
global.get $~lib/heap/HEAP_BASE
global.get $~lib/heap/__heap_base
i32.gt_u
if
local.get $0
@ -3510,7 +3510,7 @@
(local $2 i32)
(local $3 i32)
local.get $0
global.get $~lib/heap/HEAP_BASE
global.get $~lib/heap/__heap_base
i32.lt_u
if
return

View File

@ -13,13 +13,13 @@
(data (i32.const 104) "\03\00\00\00\10\00\00\00\00\00\00\00\10\00\00\00\00\00\00\00\10")
(global $~lib/rt/stub/startOffset (mut i32) (i32.const 0))
(global $~lib/rt/stub/offset (mut i32) (i32.const 0))
(global $~lib/rt/RTTI_BASE i32 (i32.const 104))
(global $~lib/rt/__rtti_base i32 (i32.const 104))
(export "memory" (memory $0))
(export "__alloc" (func $~lib/rt/stub/__alloc))
(export "__retain" (func $~lib/rt/stub/__retain))
(export "__release" (func $~lib/rt/stub/__release))
(export "__collect" (func $~lib/rt/stub/__collect))
(export "__rtti" (global $~lib/rt/RTTI_BASE))
(export "__rtti_base" (global $~lib/rt/__rtti_base))
(export "memory.copy" (func $~lib/memory/memory.copy))
(export "memory.init" (func $~lib/memory/memory.init))
(export "memory.drop" (func $~lib/memory/memory.drop))

View File

@ -16,14 +16,14 @@
(global $~lib/rt/stub/startOffset (mut i32) (i32.const 0))
(global $~lib/rt/stub/offset (mut i32) (i32.const 0))
(global $~lib/ASC_SHRINK_LEVEL i32 (i32.const 0))
(global $~lib/rt/RTTI_BASE i32 (i32.const 104))
(global $~lib/heap/HEAP_BASE i32 (i32.const 132))
(global $~lib/rt/__rtti_base i32 (i32.const 104))
(global $~lib/heap/__heap_base i32 (i32.const 132))
(export "memory" (memory $0))
(export "__alloc" (func $~lib/rt/stub/__alloc))
(export "__retain" (func $~lib/rt/stub/__retain))
(export "__release" (func $~lib/rt/stub/__release))
(export "__collect" (func $~lib/rt/stub/__collect))
(export "__rtti" (global $~lib/rt/RTTI_BASE))
(export "__rtti_base" (global $~lib/rt/__rtti_base))
(export "memory.copy" (func $~lib/memory/memory.copy))
(export "memory.init" (func $~lib/memory/memory.init))
(export "memory.drop" (func $~lib/memory/memory.drop))
@ -1666,7 +1666,7 @@
global.set $~lib/rt/stub/offset
)
(func $start (; 13 ;) (type $FUNCSIG$v)
global.get $~lib/heap/HEAP_BASE
global.get $~lib/heap/__heap_base
i32.const 15
i32.add
i32.const 15

View File

@ -11,7 +11,7 @@
(elem (i32.const 0) $null)
(global $~lib/rt/stub/startOffset (mut i32) (i32.const 0))
(global $~lib/rt/stub/offset (mut i32) (i32.const 0))
(global $~lib/heap/HEAP_BASE i32 (i32.const 52))
(global $~lib/heap/__heap_base i32 (i32.const 52))
(export "memory" (memory $0))
(start $start)
(func $~lib/rt/stub/__alloc (; 1 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
@ -538,7 +538,7 @@
call $~lib/rt/stub/__release
)
(func $start:call-super (; 19 ;) (type $FUNCSIG$v)
global.get $~lib/heap/HEAP_BASE
global.get $~lib/heap/__heap_base
i32.const 15
i32.add
i32.const 15

View File

@ -18,7 +18,7 @@
(global $constructor/ctorConditionallyReturns (mut i32) (i32.const 0))
(global $constructor/ctorAllocates (mut i32) (i32.const 0))
(global $constructor/ctorConditionallyAllocates (mut i32) (i32.const 0))
(global $~lib/heap/HEAP_BASE i32 (i32.const 8))
(global $~lib/heap/__heap_base i32 (i32.const 8))
(export "memory" (memory $0))
(start $start)
(func $~lib/rt/stub/__alloc (; 0 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
@ -267,7 +267,7 @@
local.get $0
)
(func $start:constructor (; 12 ;) (type $FUNCSIG$v)
global.get $~lib/heap/HEAP_BASE
global.get $~lib/heap/__heap_base
i32.const 15
i32.add
i32.const 15

View File

@ -1,6 +1,6 @@
{
"asc_flags": [
"--runtime half",
"--runtime none",
"--use ASC_RTRACE=1"
]
}

View File

@ -17,7 +17,7 @@
(global $exports/outer.inner.a i32 (i32.const 42))
(global $~lib/rt/stub/startOffset (mut i32) (i32.const 0))
(global $~lib/rt/stub/offset (mut i32) (i32.const 0))
(global $~lib/heap/HEAP_BASE i32 (i32.const 8))
(global $~lib/heap/__heap_base i32 (i32.const 8))
(global $~lib/argc (mut i32) (i32.const 0))
(global $exports/Car i32 (i32.const 3))
(global $exports/vehicles.Car i32 (i32.const 4))
@ -231,7 +231,7 @@
nop
)
(func $start (; 15 ;) (type $FUNCSIG$v)
global.get $~lib/heap/HEAP_BASE
global.get $~lib/heap/__heap_base
i32.const 15
i32.add
i32.const 15

View File

@ -10,7 +10,7 @@
(global $~lib/rt/stub/startOffset (mut i32) (i32.const 0))
(global $~lib/rt/stub/offset (mut i32) (i32.const 0))
(global $~lib/argc (mut i32) (i32.const 0))
(global $~lib/heap/HEAP_BASE i32 (i32.const 8))
(global $~lib/heap/__heap_base i32 (i32.const 8))
(export "memory" (memory $0))
(export "test" (func $getter-call/test))
(start $start)
@ -149,7 +149,7 @@
local.get $1
)
(func $start (; 7 ;) (type $FUNCSIG$v)
global.get $~lib/heap/HEAP_BASE
global.get $~lib/heap/__heap_base
i32.const 15
i32.add
i32.const 15

View File

@ -14,7 +14,7 @@
(global $~lib/argc (mut i32) (i32.const 0))
(global $~lib/rt/stub/startOffset (mut i32) (i32.const 0))
(global $~lib/rt/stub/offset (mut i32) (i32.const 0))
(global $~lib/heap/HEAP_BASE i32 (i32.const 48))
(global $~lib/heap/__heap_base i32 (i32.const 48))
(export "memory" (memory $0))
(export "test" (func $inlining/test))
(start $start)
@ -518,7 +518,7 @@
unreachable
end
call $inlining/test_funcs
global.get $~lib/heap/HEAP_BASE
global.get $~lib/heap/__heap_base
i32.const 15
i32.add
i32.const 15

View File

@ -66,7 +66,7 @@ function memset(dest: usize, c: u8, n: usize): usize {
return ret;
}
var dest = HEAP_BASE;
var dest = __heap_base;
memset(dest, 1, 16);
assert(load<u8>(dest) == 1);

View File

@ -8,7 +8,7 @@
(table $0 1 funcref)
(elem (i32.const 0) $null)
(global $memset/dest (mut i32) (i32.const 0))
(global $~lib/heap/HEAP_BASE i32 (i32.const 44))
(global $~lib/heap/__heap_base i32 (i32.const 44))
(export "memory" (memory $0))
(start $start)
(func $memset/memset (; 1 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32)
@ -274,7 +274,7 @@
local.get $3
)
(func $start:memset (; 2 ;) (type $FUNCSIG$v)
global.get $~lib/heap/HEAP_BASE
global.get $~lib/heap/__heap_base
global.set $memset/dest
global.get $memset/dest
i32.const 1

View File

@ -58,7 +58,7 @@
(global $~lib/builtins/f64.MIN_SAFE_INTEGER f64 (f64.const -9007199254740991))
(global $~lib/builtins/f64.MAX_SAFE_INTEGER f64 (f64.const 9007199254740991))
(global $~lib/builtins/f64.EPSILON f64 (f64.const 2.220446049250313e-16))
(global $~lib/heap/HEAP_BASE i32 (i32.const 1956))
(global $~lib/heap/__heap_base i32 (i32.const 1956))
(export "memory" (memory $0))
(start $start)
(func $~lib/rt/stub/__retain (; 1 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
@ -3636,7 +3636,7 @@
(local $8 i32)
(local $9 i32)
(local $10 i32)
global.get $~lib/heap/HEAP_BASE
global.get $~lib/heap/__heap_base
i32.const 15
i32.add
i32.const 15

View File

@ -11,7 +11,7 @@
(global $~lib/rt/stub/offset (mut i32) (i32.const 0))
(global $optional-typeparameters/tConcrete (mut i32) (i32.const 0))
(global $optional-typeparameters/tDerived (mut i32) (i32.const 0))
(global $~lib/heap/HEAP_BASE i32 (i32.const 8))
(global $~lib/heap/__heap_base i32 (i32.const 8))
(export "memory" (memory $0))
(start $start)
(func $optional-typeparameters/testConcrete<i32,i32> (; 0 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
@ -156,7 +156,7 @@
i32.const 2
call $optional-typeparameters/testDerived<i32,i32>
drop
global.get $~lib/heap/HEAP_BASE
global.get $~lib/heap/__heap_base
i32.const 15
i32.add
i32.const 15

View File

@ -30,8 +30,8 @@
(global $~lib/rt/pure/END (mut i32) (i32.const 0))
(global $~lib/rt/pure/ROOTS (mut i32) (i32.const 0))
(global $~lib/ASC_SHRINK_LEVEL i32 (i32.const 0))
(global $~lib/rt/RTTI_BASE i32 (i32.const 272))
(global $~lib/heap/HEAP_BASE i32 (i32.const 300))
(global $~lib/rt/__rtti_base i32 (i32.const 272))
(global $~lib/heap/__heap_base i32 (i32.const 300))
(export "memory" (memory $0))
(start $start)
(func $~lib/rt/pure/increment (; 5 ;) (type $FUNCSIG$vi) (param $0 i32)
@ -85,7 +85,7 @@
)
(func $~lib/rt/pure/__retain (; 6 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
local.get $0
global.get $~lib/heap/HEAP_BASE
global.get $~lib/heap/__heap_base
i32.gt_u
if
local.get $0
@ -712,7 +712,7 @@
)
(func $~lib/rt/__typeinfo (; 11 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
global.get $~lib/rt/RTTI_BASE
global.get $~lib/rt/__rtti_base
local.set $1
local.get $0
local.get $1
@ -898,7 +898,7 @@
(local $7 i32)
(local $8 i32)
(local $9 i32)
global.get $~lib/heap/HEAP_BASE
global.get $~lib/heap/__heap_base
i32.const 15
i32.add
i32.const 15
@ -3139,7 +3139,7 @@
)
(func $~lib/rt/pure/__release (; 26 ;) (type $FUNCSIG$vi) (param $0 i32)
local.get $0
global.get $~lib/heap/HEAP_BASE
global.get $~lib/heap/__heap_base
i32.gt_u
if
local.get $0
@ -3314,7 +3314,7 @@
(local $2 i32)
(local $3 i32)
local.get $0
global.get $~lib/heap/HEAP_BASE
global.get $~lib/heap/__heap_base
i32.lt_u
if
return

View File

@ -28,8 +28,8 @@
(global $~lib/rt/pure/END (mut i32) (i32.const 0))
(global $~lib/rt/pure/ROOTS (mut i32) (i32.const 0))
(global $~lib/ASC_SHRINK_LEVEL i32 (i32.const 0))
(global $~lib/rt/RTTI_BASE i32 (i32.const 272))
(global $~lib/heap/HEAP_BASE i32 (i32.const 308))
(global $~lib/rt/__rtti_base i32 (i32.const 272))
(global $~lib/heap/__heap_base i32 (i32.const 308))
(export "memory" (memory $0))
(start $start)
(func $~lib/rt/pure/increment (; 5 ;) (type $FUNCSIG$vi) (param $0 i32)
@ -83,7 +83,7 @@
)
(func $~lib/rt/pure/__retain (; 6 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
local.get $0
global.get $~lib/heap/HEAP_BASE
global.get $~lib/heap/__heap_base
i32.gt_u
if
local.get $0
@ -706,7 +706,7 @@
)
(func $~lib/rt/__typeinfo (; 10 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
global.get $~lib/rt/RTTI_BASE
global.get $~lib/rt/__rtti_base
local.set $1
local.get $0
local.get $1
@ -892,7 +892,7 @@
(local $7 i32)
(local $8 i32)
(local $9 i32)
global.get $~lib/heap/HEAP_BASE
global.get $~lib/heap/__heap_base
i32.const 15
i32.add
i32.const 15
@ -3133,7 +3133,7 @@
)
(func $~lib/rt/pure/__release (; 25 ;) (type $FUNCSIG$vi) (param $0 i32)
local.get $0
global.get $~lib/heap/HEAP_BASE
global.get $~lib/heap/__heap_base
i32.gt_u
if
local.get $0
@ -3307,7 +3307,7 @@
(local $2 i32)
(local $3 i32)
local.get $0
global.get $~lib/heap/HEAP_BASE
global.get $~lib/heap/__heap_base
i32.lt_u
if
return

View File

@ -28,8 +28,8 @@
(global $~lib/rt/pure/END (mut i32) (i32.const 0))
(global $~lib/rt/pure/ROOTS (mut i32) (i32.const 0))
(global $~lib/ASC_SHRINK_LEVEL i32 (i32.const 0))
(global $~lib/rt/RTTI_BASE i32 (i32.const 256))
(global $~lib/heap/HEAP_BASE i32 (i32.const 292))
(global $~lib/rt/__rtti_base i32 (i32.const 256))
(global $~lib/heap/__heap_base i32 (i32.const 292))
(export "memory" (memory $0))
(start $start)
(func $~lib/rt/tlsf/removeBlock (; 5 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32)
@ -777,7 +777,7 @@
(local $7 i32)
(local $8 i32)
(local $9 i32)
global.get $~lib/heap/HEAP_BASE
global.get $~lib/heap/__heap_base
i32.const 15
i32.add
i32.const 15
@ -1430,7 +1430,7 @@
)
(func $~lib/rt/pure/__retain (; 16 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
local.get $0
global.get $~lib/heap/HEAP_BASE
global.get $~lib/heap/__heap_base
i32.gt_u
if
local.get $0
@ -1487,7 +1487,7 @@
)
(func $~lib/rt/__typeinfo (; 20 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
global.get $~lib/rt/RTTI_BASE
global.get $~lib/rt/__rtti_base
local.set $1
local.get $0
local.get $1
@ -3149,7 +3149,7 @@
)
(func $~lib/rt/pure/__release (; 27 ;) (type $FUNCSIG$vi) (param $0 i32)
local.get $0
global.get $~lib/heap/HEAP_BASE
global.get $~lib/heap/__heap_base
i32.gt_u
if
local.get $0
@ -3347,7 +3347,7 @@
(local $2 i32)
(local $3 i32)
local.get $0
global.get $~lib/heap/HEAP_BASE
global.get $~lib/heap/__heap_base
i32.lt_u
if
return

View File

@ -28,8 +28,8 @@
(global $~lib/rt/pure/END (mut i32) (i32.const 0))
(global $~lib/rt/pure/ROOTS (mut i32) (i32.const 0))
(global $~lib/ASC_SHRINK_LEVEL i32 (i32.const 0))
(global $~lib/rt/RTTI_BASE i32 (i32.const 256))
(global $~lib/heap/HEAP_BASE i32 (i32.const 292))
(global $~lib/rt/__rtti_base i32 (i32.const 256))
(global $~lib/heap/__heap_base i32 (i32.const 292))
(export "memory" (memory $0))
(start $start)
(func $~lib/rt/tlsf/removeBlock (; 5 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32)
@ -777,7 +777,7 @@
(local $7 i32)
(local $8 i32)
(local $9 i32)
global.get $~lib/heap/HEAP_BASE
global.get $~lib/heap/__heap_base
i32.const 15
i32.add
i32.const 15
@ -1430,7 +1430,7 @@
)
(func $~lib/rt/pure/__retain (; 16 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
local.get $0
global.get $~lib/heap/HEAP_BASE
global.get $~lib/heap/__heap_base
i32.gt_u
if
local.get $0
@ -1487,7 +1487,7 @@
)
(func $~lib/rt/__typeinfo (; 20 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
global.get $~lib/rt/RTTI_BASE
global.get $~lib/rt/__rtti_base
local.set $1
local.get $0
local.get $1
@ -3149,7 +3149,7 @@
)
(func $~lib/rt/pure/__release (; 27 ;) (type $FUNCSIG$vi) (param $0 i32)
local.get $0
global.get $~lib/heap/HEAP_BASE
global.get $~lib/heap/__heap_base
i32.gt_u
if
local.get $0
@ -3347,7 +3347,7 @@
(local $2 i32)
(local $3 i32)
local.get $0
global.get $~lib/heap/HEAP_BASE
global.get $~lib/heap/__heap_base
i32.lt_u
if
return

View File

@ -18,13 +18,13 @@
(global $~lib/rt/pure/CUR (mut i32) (i32.const 0))
(global $~lib/rt/pure/END (mut i32) (i32.const 0))
(global $~lib/rt/pure/ROOTS (mut i32) (i32.const 0))
(global $~lib/rt/RTTI_BASE i32 (i32.const 256))
(global $~lib/rt/__rtti_base i32 (i32.const 256))
(export "memory" (memory $0))
(export "__alloc" (func $~lib/rt/tlsf/__alloc))
(export "__retain" (func $~lib/rt/pure/__retain))
(export "__release" (func $~lib/rt/pure/__release))
(export "__collect" (func $~lib/rt/pure/__collect))
(export "__rtti" (global $~lib/rt/RTTI_BASE))
(export "__rtti_base" (global $~lib/rt/__rtti_base))
(start $start)
(func $~lib/rt/tlsf/removeBlock (; 1 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32)
(local $2 i32)

View File

@ -23,14 +23,14 @@
(global $~lib/rt/pure/END (mut i32) (i32.const 0))
(global $~lib/rt/pure/ROOTS (mut i32) (i32.const 0))
(global $~lib/ASC_SHRINK_LEVEL i32 (i32.const 0))
(global $~lib/rt/RTTI_BASE i32 (i32.const 256))
(global $~lib/heap/HEAP_BASE i32 (i32.const 292))
(global $~lib/rt/__rtti_base i32 (i32.const 256))
(global $~lib/heap/__heap_base i32 (i32.const 292))
(export "memory" (memory $0))
(export "__alloc" (func $~lib/rt/tlsf/__alloc))
(export "__retain" (func $~lib/rt/pure/__retain))
(export "__release" (func $~lib/rt/pure/__release))
(export "__collect" (func $~lib/rt/pure/__collect))
(export "__rtti" (global $~lib/rt/RTTI_BASE))
(export "__rtti_base" (global $~lib/rt/__rtti_base))
(start $start)
(func $~lib/rt/tlsf/removeBlock (; 1 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32)
(local $2 i32)
@ -777,7 +777,7 @@
(local $7 i32)
(local $8 i32)
(local $9 i32)
global.get $~lib/heap/HEAP_BASE
global.get $~lib/heap/__heap_base
i32.const 15
i32.add
i32.const 15
@ -1426,7 +1426,7 @@
)
(func $~lib/rt/pure/__retain (; 12 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
local.get $0
global.get $~lib/heap/HEAP_BASE
global.get $~lib/heap/__heap_base
i32.gt_u
if
local.get $0
@ -1465,7 +1465,7 @@
)
(func $~lib/rt/__typeinfo (; 14 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
global.get $~lib/rt/RTTI_BASE
global.get $~lib/rt/__rtti_base
local.set $1
local.get $0
local.get $1
@ -3117,7 +3117,7 @@
)
(func $~lib/rt/pure/__release (; 21 ;) (type $FUNCSIG$vi) (param $0 i32)
local.get $0
global.get $~lib/heap/HEAP_BASE
global.get $~lib/heap/__heap_base
i32.gt_u
if
local.get $0
@ -3423,7 +3423,7 @@
(local $2 i32)
(local $3 i32)
local.get $0
global.get $~lib/heap/HEAP_BASE
global.get $~lib/heap/__heap_base
i32.lt_u
if
return

View File

@ -28,8 +28,8 @@
(global $~lib/rt/pure/END (mut i32) (i32.const 0))
(global $~lib/rt/pure/ROOTS (mut i32) (i32.const 0))
(global $~lib/ASC_SHRINK_LEVEL i32 (i32.const 0))
(global $~lib/rt/RTTI_BASE i32 (i32.const 256))
(global $~lib/heap/HEAP_BASE i32 (i32.const 292))
(global $~lib/rt/__rtti_base i32 (i32.const 256))
(global $~lib/heap/__heap_base i32 (i32.const 292))
(export "memory" (memory $0))
(export "test1" (func $rc/ternary-mismatch/test1))
(export "test2" (func $rc/ternary-mismatch/test2))
@ -779,7 +779,7 @@
(local $7 i32)
(local $8 i32)
(local $9 i32)
global.get $~lib/heap/HEAP_BASE
global.get $~lib/heap/__heap_base
i32.const 15
i32.add
i32.const 15
@ -1432,7 +1432,7 @@
)
(func $~lib/rt/pure/__retain (; 16 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
local.get $0
global.get $~lib/heap/HEAP_BASE
global.get $~lib/heap/__heap_base
i32.gt_u
if
local.get $0
@ -1498,7 +1498,7 @@
)
(func $~lib/rt/__typeinfo (; 21 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
global.get $~lib/rt/RTTI_BASE
global.get $~lib/rt/__rtti_base
local.set $1
local.get $0
local.get $1
@ -3160,7 +3160,7 @@
)
(func $~lib/rt/pure/__release (; 28 ;) (type $FUNCSIG$vi) (param $0 i32)
local.get $0
global.get $~lib/heap/HEAP_BASE
global.get $~lib/heap/__heap_base
i32.gt_u
if
local.get $0
@ -3323,7 +3323,7 @@
(local $2 i32)
(local $3 i32)
local.get $0
global.get $~lib/heap/HEAP_BASE
global.get $~lib/heap/__heap_base
i32.lt_u
if
return

View File

@ -37,8 +37,8 @@
(global $~lib/rt/pure/ROOTS (mut i32) (i32.const 0))
(global $~lib/ASC_SHRINK_LEVEL i32 (i32.const 0))
(global $~lib/started (mut i32) (i32.const 0))
(global $~lib/rt/RTTI_BASE i32 (i32.const 680))
(global $~lib/heap/HEAP_BASE i32 (i32.const 748))
(global $~lib/rt/__rtti_base i32 (i32.const 680))
(global $~lib/heap/__heap_base i32 (i32.const 748))
(export "memory" (memory $0))
(export "main" (func $retain-release-sanity/main))
(func $~lib/rt/tlsf/removeBlock (; 5 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32)
@ -786,7 +786,7 @@
(local $7 i32)
(local $8 i32)
(local $9 i32)
global.get $~lib/heap/HEAP_BASE
global.get $~lib/heap/__heap_base
i32.const 15
i32.add
i32.const 15
@ -1439,7 +1439,7 @@
)
(func $~lib/rt/pure/__retain (; 16 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
local.get $0
global.get $~lib/heap/HEAP_BASE
global.get $~lib/heap/__heap_base
i32.gt_u
if
local.get $0
@ -1480,7 +1480,7 @@
)
(func $~lib/rt/__typeinfo (; 18 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
global.get $~lib/rt/RTTI_BASE
global.get $~lib/rt/__rtti_base
local.set $1
local.get $0
local.get $1
@ -3142,7 +3142,7 @@
)
(func $~lib/rt/pure/__release (; 25 ;) (type $FUNCSIG$vi) (param $0 i32)
local.get $0
global.get $~lib/heap/HEAP_BASE
global.get $~lib/heap/__heap_base
i32.gt_u
if
local.get $0
@ -4587,7 +4587,7 @@
(local $2 i32)
(local $3 i32)
local.get $0
global.get $~lib/heap/HEAP_BASE
global.get $~lib/heap/__heap_base
i32.lt_u
if
return

View File

@ -17,7 +17,7 @@
(global $retain-release/glo (mut i32) (i32.const 0))
(global $retain-release/TARGET (mut i32) (i32.const 0))
(global $~lib/argc (mut i32) (i32.const 0))
(global $~lib/heap/HEAP_BASE i32 (i32.const 92))
(global $~lib/heap/__heap_base i32 (i32.const 92))
(export "memory" (memory $0))
(export "returnRef" (func $retain-release/returnRef))
(export "receiveRef" (func $retain-release/receiveRef))
@ -177,7 +177,7 @@
local.get $0
)
(func $start:retain-release (; 5 ;) (type $FUNCSIG$v)
global.get $~lib/heap/HEAP_BASE
global.get $~lib/heap/__heap_base
i32.const 15
i32.add
i32.const 15

View File

@ -13,12 +13,12 @@
(elem (i32.const 0) $null)
(global $rt/flags/VALUE_ALIGN_REF i32 (i32.const 128))
(global $rt/flags/KEY_ALIGN_REF i32 (i32.const 65536))
(global $~lib/rt/RTTI_BASE i32 (i32.const 144))
(global $~lib/rt/__rtti_base i32 (i32.const 144))
(export "memory" (memory $0))
(start $start)
(func $~lib/rt/__typeinfo (; 1 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
global.get $~lib/rt/RTTI_BASE
global.get $~lib/rt/__rtti_base
local.set $1
local.get $0
local.get $1

View File

@ -21,8 +21,8 @@
(global $rt/instanceof/nullCat (mut i32) (i32.const 0))
(global $rt/instanceof/nullBlackcat (mut i32) (i32.const 0))
(global $~lib/started (mut i32) (i32.const 0))
(global $~lib/rt/RTTI_BASE i32 (i32.const 56))
(global $~lib/heap/HEAP_BASE i32 (i32.const 108))
(global $~lib/rt/__rtti_base i32 (i32.const 56))
(global $~lib/heap/__heap_base i32 (i32.const 108))
(export "memory" (memory $0))
(export "main" (func $rt/instanceof/main))
(func $~lib/rt/stub/__alloc (; 1 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
@ -174,7 +174,7 @@
i32.sub
i32.load offset=8
local.set $2
global.get $~lib/rt/RTTI_BASE
global.get $~lib/rt/__rtti_base
local.set $3
local.get $2
local.get $3
@ -205,7 +205,7 @@
)
(func $start:rt/instanceof (; 7 ;) (type $FUNCSIG$v)
(local $0 i32)
global.get $~lib/heap/HEAP_BASE
global.get $~lib/heap/__heap_base
i32.const 15
i32.add
i32.const 15

View File

@ -18,13 +18,13 @@
(global $~lib/rt/pure/CUR (mut i32) (i32.const 0))
(global $~lib/rt/pure/END (mut i32) (i32.const 0))
(global $~lib/rt/pure/ROOTS (mut i32) (i32.const 0))
(global $~lib/rt/RTTI_BASE i32 (i32.const 256))
(global $~lib/rt/__rtti_base i32 (i32.const 256))
(export "memory" (memory $0))
(export "__alloc" (func $~lib/rt/tlsf/__alloc))
(export "__retain" (func $~lib/rt/pure/__retain))
(export "__release" (func $~lib/rt/pure/__release))
(export "__collect" (func $~lib/rt/pure/__collect))
(export "__rtti" (global $~lib/rt/RTTI_BASE))
(export "__rtti_base" (global $~lib/rt/__rtti_base))
(func $~lib/rt/tlsf/removeBlock (; 1 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32)
(local $2 i32)
(local $3 i32)

View File

@ -22,14 +22,14 @@
(global $~lib/rt/pure/END (mut i32) (i32.const 0))
(global $~lib/rt/pure/ROOTS (mut i32) (i32.const 0))
(global $~lib/ASC_SHRINK_LEVEL i32 (i32.const 0))
(global $~lib/rt/RTTI_BASE i32 (i32.const 256))
(global $~lib/heap/HEAP_BASE i32 (i32.const 284))
(global $~lib/rt/__rtti_base i32 (i32.const 256))
(global $~lib/heap/__heap_base i32 (i32.const 284))
(export "memory" (memory $0))
(export "__alloc" (func $~lib/rt/tlsf/__alloc))
(export "__retain" (func $~lib/rt/pure/__retain))
(export "__release" (func $~lib/rt/pure/__release))
(export "__collect" (func $~lib/rt/pure/__collect))
(export "__rtti" (global $~lib/rt/RTTI_BASE))
(export "__rtti_base" (global $~lib/rt/__rtti_base))
(func $~lib/rt/tlsf/removeBlock (; 1 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32)
(local $2 i32)
(local $3 i32)
@ -775,7 +775,7 @@
(local $7 i32)
(local $8 i32)
(local $9 i32)
global.get $~lib/heap/HEAP_BASE
global.get $~lib/heap/__heap_base
i32.const 15
i32.add
i32.const 15
@ -1424,7 +1424,7 @@
)
(func $~lib/rt/pure/__retain (; 12 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
local.get $0
global.get $~lib/heap/HEAP_BASE
global.get $~lib/heap/__heap_base
i32.gt_u
if
local.get $0
@ -1463,7 +1463,7 @@
)
(func $~lib/rt/__typeinfo (; 14 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
global.get $~lib/rt/RTTI_BASE
global.get $~lib/rt/__rtti_base
local.set $1
local.get $0
local.get $1
@ -3115,7 +3115,7 @@
)
(func $~lib/rt/pure/__release (; 21 ;) (type $FUNCSIG$vi) (param $0 i32)
local.get $0
global.get $~lib/heap/HEAP_BASE
global.get $~lib/heap/__heap_base
i32.gt_u
if
local.get $0
@ -3395,7 +3395,7 @@
(local $2 i32)
(local $3 i32)
local.get $0
global.get $~lib/heap/HEAP_BASE
global.get $~lib/heap/__heap_base
i32.lt_u
if
return

View File

@ -7,13 +7,13 @@
(data (i32.const 8) "\03\00\00\00\10\00\00\00\00\00\00\00\10\00\00\00\00\00\00\00\10")
(global $~lib/rt/stub/startOffset (mut i32) (i32.const 0))
(global $~lib/rt/stub/offset (mut i32) (i32.const 0))
(global $~lib/rt/RTTI_BASE i32 (i32.const 8))
(global $~lib/rt/__rtti_base i32 (i32.const 8))
(export "memory" (memory $0))
(export "__alloc" (func $~lib/rt/stub/__alloc))
(export "__retain" (func $~lib/rt/stub/__retain))
(export "__release" (func $~lib/rt/stub/__release))
(export "__collect" (func $~lib/rt/stub/__collect))
(export "__rtti" (global $~lib/rt/RTTI_BASE))
(export "__rtti_base" (global $~lib/rt/__rtti_base))
(start $start)
(func $~lib/rt/stub/__alloc (; 0 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)

View File

@ -9,14 +9,14 @@
(elem (i32.const 0) $null)
(global $~lib/rt/stub/startOffset (mut i32) (i32.const 0))
(global $~lib/rt/stub/offset (mut i32) (i32.const 0))
(global $~lib/rt/RTTI_BASE i32 (i32.const 8))
(global $~lib/heap/HEAP_BASE i32 (i32.const 36))
(global $~lib/rt/__rtti_base i32 (i32.const 8))
(global $~lib/heap/__heap_base i32 (i32.const 36))
(export "memory" (memory $0))
(export "__alloc" (func $~lib/rt/stub/__alloc))
(export "__retain" (func $~lib/rt/stub/__retain))
(export "__release" (func $~lib/rt/stub/__release))
(export "__collect" (func $~lib/rt/stub/__collect))
(export "__rtti" (global $~lib/rt/RTTI_BASE))
(export "__rtti_base" (global $~lib/rt/__rtti_base))
(start $start)
(func $~lib/rt/stub/__alloc (; 0 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
@ -120,7 +120,7 @@
nop
)
(func $start (; 4 ;) (type $FUNCSIG$v)
global.get $~lib/heap/HEAP_BASE
global.get $~lib/heap/__heap_base
i32.const 15
i32.add
i32.const 15

View File

@ -43,8 +43,8 @@
(global $~lib/rt/pure/CUR (mut i32) (i32.const 0))
(global $~lib/rt/pure/END (mut i32) (i32.const 0))
(global $~lib/rt/pure/ROOTS (mut i32) (i32.const 0))
(global $~lib/rt/RTTI_BASE i32 (i32.const 528))
(global $~lib/heap/HEAP_BASE i32 (i32.const 604))
(global $~lib/rt/__rtti_base i32 (i32.const 528))
(global $~lib/heap/__heap_base i32 (i32.const 604))
(export "memory" (memory $0))
(start $start)
(func $~lib/array/Array<i8>#get:length (; 5 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
@ -856,7 +856,7 @@
(local $7 i32)
(local $8 i32)
(local $9 i32)
global.get $~lib/heap/HEAP_BASE
global.get $~lib/heap/__heap_base
i32.const 15
i32.add
i32.const 15
@ -1509,7 +1509,7 @@
)
(func $~lib/rt/pure/__retain (; 22 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
local.get $0
global.get $~lib/heap/HEAP_BASE
global.get $~lib/heap/__heap_base
i32.gt_u
if
local.get $0
@ -3038,7 +3038,7 @@
)
(func $~lib/rt/__typeinfo (; 31 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
global.get $~lib/rt/RTTI_BASE
global.get $~lib/rt/__rtti_base
local.set $1
local.get $0
local.get $1
@ -3282,7 +3282,7 @@
)
(func $~lib/rt/pure/__release (; 36 ;) (type $FUNCSIG$vi) (param $0 i32)
local.get $0
global.get $~lib/heap/HEAP_BASE
global.get $~lib/heap/__heap_base
i32.gt_u
if
local.get $0
@ -3850,7 +3850,7 @@
(local $2 i32)
(local $3 i32)
local.get $0
global.get $~lib/heap/HEAP_BASE
global.get $~lib/heap/__heap_base
i32.lt_u
if
return

View File

@ -232,13 +232,13 @@
(global $~lib/util/number/_frc_pow (mut i64) (i64.const 0))
(global $~lib/util/number/_exp_pow (mut i32) (i32.const 0))
(global $~lib/started (mut i32) (i32.const 0))
(global $~lib/rt/RTTI_BASE i32 (i32.const 7248))
(global $~lib/rt/__rtti_base i32 (i32.const 7248))
(export "memory" (memory $0))
(export "__alloc" (func $~lib/rt/tlsf/__alloc))
(export "__retain" (func $~lib/rt/pure/__retain))
(export "__release" (func $~lib/rt/pure/__release))
(export "__collect" (func $~lib/rt/pure/__collect))
(export "__rtti" (global $~lib/rt/RTTI_BASE))
(export "__rtti_base" (global $~lib/rt/__rtti_base))
(export "main" (func $std/array/main))
(func $~lib/rt/tlsf/removeBlock (; 6 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32)
(local $2 i32)

View File

@ -235,14 +235,14 @@
(global $~lib/builtins/u32.MAX_VALUE i32 (i32.const -1))
(global $~lib/builtins/i64.MAX_VALUE i64 (i64.const 9223372036854775807))
(global $~lib/started (mut i32) (i32.const 0))
(global $~lib/rt/RTTI_BASE i32 (i32.const 7696))
(global $~lib/heap/HEAP_BASE i32 (i32.const 7908))
(global $~lib/rt/__rtti_base i32 (i32.const 7696))
(global $~lib/heap/__heap_base i32 (i32.const 7908))
(export "memory" (memory $0))
(export "__alloc" (func $~lib/rt/tlsf/__alloc))
(export "__retain" (func $~lib/rt/pure/__retain))
(export "__release" (func $~lib/rt/pure/__release))
(export "__collect" (func $~lib/rt/pure/__collect))
(export "__rtti" (global $~lib/rt/RTTI_BASE))
(export "__rtti_base" (global $~lib/rt/__rtti_base))
(export "main" (func $std/array/main))
(func $~lib/rt/tlsf/removeBlock (; 6 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32)
(local $2 i32)
@ -989,7 +989,7 @@
(local $7 i32)
(local $8 i32)
(local $9 i32)
global.get $~lib/heap/HEAP_BASE
global.get $~lib/heap/__heap_base
i32.const 15
i32.add
i32.const 15
@ -1642,7 +1642,7 @@
)
(func $~lib/rt/pure/__retain (; 17 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
local.get $0
global.get $~lib/heap/HEAP_BASE
global.get $~lib/heap/__heap_base
i32.gt_u
if
local.get $0
@ -1683,7 +1683,7 @@
)
(func $~lib/rt/__typeinfo (; 19 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
global.get $~lib/rt/RTTI_BASE
global.get $~lib/rt/__rtti_base
local.set $1
local.get $0
local.get $1
@ -3345,7 +3345,7 @@
)
(func $~lib/rt/pure/__release (; 26 ;) (type $FUNCSIG$vi) (param $0 i32)
local.get $0
global.get $~lib/heap/HEAP_BASE
global.get $~lib/heap/__heap_base
i32.gt_u
if
local.get $0
@ -24031,7 +24031,7 @@
(local $2 i32)
(local $3 i32)
local.get $0
global.get $~lib/heap/HEAP_BASE
global.get $~lib/heap/__heap_base
i32.lt_u
if
return

View File

@ -23,7 +23,7 @@
(global $std/arraybuffer/sliced (mut i32) (i32.const 0))
(global $std/arraybuffer/arr8 (mut i32) (i32.const 0))
(global $~lib/argc (mut i32) (i32.const 0))
(global $~lib/heap/HEAP_BASE i32 (i32.const 240))
(global $~lib/heap/__heap_base i32 (i32.const 240))
(export "memory" (memory $0))
(start $start)
(func $~lib/rt/stub/__alloc (; 1 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
@ -2974,7 +2974,7 @@
(local $1 i32)
(local $2 i32)
(local $3 i32)
global.get $~lib/heap/HEAP_BASE
global.get $~lib/heap/__heap_base
i32.const 15
i32.add
i32.const 15

View File

@ -29,7 +29,7 @@
(global $std/dataview/array (mut i32) (i32.const 0))
(global $std/dataview/view (mut i32) (i32.const 0))
(global $~lib/argc (mut i32) (i32.const 0))
(global $~lib/heap/HEAP_BASE i32 (i32.const 320))
(global $~lib/heap/__heap_base i32 (i32.const 320))
(export "memory" (memory $0))
(start $start)
(func $~lib/rt/stub/__alloc (; 1 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
@ -1141,7 +1141,7 @@
(local $0 i32)
(local $1 i32)
(local $2 i32)
global.get $~lib/heap/HEAP_BASE
global.get $~lib/heap/__heap_base
i32.const 15
i32.add
i32.const 15

View File

@ -19,7 +19,7 @@
(global $~lib/rt/stub/startOffset (mut i32) (i32.const 0))
(global $~lib/rt/stub/offset (mut i32) (i32.const 0))
(global $std/date/date (mut i32) (i32.const 0))
(global $~lib/heap/HEAP_BASE i32 (i32.const 48))
(global $~lib/heap/__heap_base i32 (i32.const 48))
(export "memory" (memory $0))
(start $start)
(func $~lib/rt/stub/__alloc (; 3 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
@ -283,7 +283,7 @@
call $~lib/builtins/abort
unreachable
end
global.get $~lib/heap/HEAP_BASE
global.get $~lib/heap/__heap_base
i32.const 15
i32.add
i32.const 15

View File

@ -39,8 +39,8 @@
(global $~lib/rt/pure/CUR (mut i32) (i32.const 0))
(global $~lib/rt/pure/END (mut i32) (i32.const 0))
(global $~lib/rt/pure/ROOTS (mut i32) (i32.const 0))
(global $~lib/rt/RTTI_BASE i32 (i32.const 400))
(global $~lib/heap/HEAP_BASE i32 (i32.const 508))
(global $~lib/rt/__rtti_base i32 (i32.const 400))
(global $~lib/heap/__heap_base i32 (i32.const 508))
(export "memory" (memory $0))
(start $start)
(func $~lib/rt/tlsf/removeBlock (; 5 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32)
@ -788,7 +788,7 @@
(local $7 i32)
(local $8 i32)
(local $9 i32)
global.get $~lib/heap/HEAP_BASE
global.get $~lib/heap/__heap_base
i32.const 15
i32.add
i32.const 15
@ -1441,7 +1441,7 @@
)
(func $~lib/rt/pure/__retain (; 16 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
local.get $0
global.get $~lib/heap/HEAP_BASE
global.get $~lib/heap/__heap_base
i32.gt_u
if
local.get $0
@ -1769,7 +1769,7 @@
)
(func $~lib/rt/__typeinfo (; 20 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
global.get $~lib/rt/RTTI_BASE
global.get $~lib/rt/__rtti_base
local.set $1
local.get $0
local.get $1
@ -3431,7 +3431,7 @@
)
(func $~lib/rt/pure/__release (; 27 ;) (type $FUNCSIG$vi) (param $0 i32)
local.get $0
global.get $~lib/heap/HEAP_BASE
global.get $~lib/heap/__heap_base
i32.gt_u
if
local.get $0
@ -12561,7 +12561,7 @@
(local $2 i32)
(local $3 i32)
local.get $0
global.get $~lib/heap/HEAP_BASE
global.get $~lib/heap/__heap_base
i32.lt_u
if
return

View File

@ -10,7 +10,7 @@
(global $~lib/rt/stub/startOffset (mut i32) (i32.const 0))
(global $~lib/rt/stub/offset (mut i32) (i32.const 0))
(global $std/new/aClass (mut i32) (i32.const 0))
(global $~lib/heap/HEAP_BASE i32 (i32.const 8))
(global $~lib/heap/__heap_base i32 (i32.const 8))
(export "memory" (memory $0))
(start $start)
(func $~lib/rt/stub/__alloc (; 0 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
@ -138,7 +138,7 @@
local.get $0
)
(func $start:std/new (; 3 ;) (type $FUNCSIG$v)
global.get $~lib/heap/HEAP_BASE
global.get $~lib/heap/__heap_base
i32.const 15
i32.add
i32.const 15

View File

@ -13,7 +13,7 @@
(elem (i32.const 0) $null)
(global $~lib/rt/stub/startOffset (mut i32) (i32.const 0))
(global $~lib/rt/stub/offset (mut i32) (i32.const 0))
(global $~lib/heap/HEAP_BASE i32 (i32.const 108))
(global $~lib/heap/__heap_base i32 (i32.const 108))
(export "memory" (memory $0))
(start $start)
(func $~lib/rt/stub/__alloc (; 1 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
@ -331,7 +331,7 @@
(local $0 i32)
(local $1 i32)
(local $2 i32)
global.get $~lib/heap/HEAP_BASE
global.get $~lib/heap/__heap_base
i32.const 15
i32.add
i32.const 15

View File

@ -81,7 +81,7 @@
(global $std/operator-overloading/aii1 (mut i32) (i32.const 0))
(global $std/operator-overloading/aii2 (mut i32) (i32.const 0))
(global $std/operator-overloading/aii (mut i32) (i32.const 0))
(global $~lib/heap/HEAP_BASE i32 (i32.const 80))
(global $~lib/heap/__heap_base i32 (i32.const 80))
(export "memory" (memory $0))
(start $start)
(func $~lib/rt/stub/__alloc (; 1 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
@ -2129,7 +2129,7 @@
(local $21 i32)
(local $22 i32)
(local $23 i32)
global.get $~lib/heap/HEAP_BASE
global.get $~lib/heap/__heap_base
i32.const 15
i32.add
i32.const 15

View File

@ -39,8 +39,8 @@
(global $~lib/rt/pure/CUR (mut i32) (i32.const 0))
(global $~lib/rt/pure/END (mut i32) (i32.const 0))
(global $~lib/rt/pure/ROOTS (mut i32) (i32.const 0))
(global $~lib/rt/RTTI_BASE i32 (i32.const 400))
(global $~lib/heap/HEAP_BASE i32 (i32.const 508))
(global $~lib/rt/__rtti_base i32 (i32.const 400))
(global $~lib/heap/__heap_base i32 (i32.const 508))
(export "memory" (memory $0))
(start $start)
(func $~lib/rt/tlsf/removeBlock (; 5 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32)
@ -788,7 +788,7 @@
(local $7 i32)
(local $8 i32)
(local $9 i32)
global.get $~lib/heap/HEAP_BASE
global.get $~lib/heap/__heap_base
i32.const 15
i32.add
i32.const 15
@ -1441,7 +1441,7 @@
)
(func $~lib/rt/pure/__retain (; 16 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
local.get $0
global.get $~lib/heap/HEAP_BASE
global.get $~lib/heap/__heap_base
i32.gt_u
if
local.get $0
@ -1769,7 +1769,7 @@
)
(func $~lib/rt/__typeinfo (; 20 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
global.get $~lib/rt/RTTI_BASE
global.get $~lib/rt/__rtti_base
local.set $1
local.get $0
local.get $1
@ -3431,7 +3431,7 @@
)
(func $~lib/rt/pure/__release (; 27 ;) (type $FUNCSIG$vi) (param $0 i32)
local.get $0
global.get $~lib/heap/HEAP_BASE
global.get $~lib/heap/__heap_base
i32.gt_u
if
local.get $0
@ -11325,7 +11325,7 @@
(local $2 i32)
(local $3 i32)
local.get $0
global.get $~lib/heap/HEAP_BASE
global.get $~lib/heap/__heap_base
i32.lt_u
if
return

View File

@ -33,7 +33,7 @@
(global $~lib/rt/stub/startOffset (mut i32) (i32.const 0))
(global $~lib/rt/stub/offset (mut i32) (i32.const 0))
(global $~lib/ASC_SHRINK_LEVEL i32 (i32.const 0))
(global $~lib/heap/HEAP_BASE i32 (i32.const 452))
(global $~lib/heap/__heap_base i32 (i32.const 452))
(export "memory" (memory $0))
(start $start)
(func $~lib/array/Array<i32>#get:length (; 1 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
@ -2224,7 +2224,7 @@
call $~lib/builtins/abort
unreachable
end
global.get $~lib/heap/HEAP_BASE
global.get $~lib/heap/__heap_base
i32.const 15
i32.add
i32.const 15

View File

@ -24,7 +24,7 @@
(global $~lib/rt/stub/offset (mut i32) (i32.const 0))
(global $std/string-utf8/ptr (mut i32) (i32.const 0))
(global $~lib/ASC_SHRINK_LEVEL i32 (i32.const 0))
(global $~lib/heap/HEAP_BASE i32 (i32.const 252))
(global $~lib/heap/__heap_base i32 (i32.const 252))
(export "memory" (memory $0))
(start $start)
(func $~lib/string/String#get:length (; 1 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
@ -2341,7 +2341,7 @@
call $~lib/builtins/abort
unreachable
end
global.get $~lib/heap/HEAP_BASE
global.get $~lib/heap/__heap_base
i32.const 15
i32.add
i32.const 15

View File

@ -208,8 +208,8 @@
(global $~lib/builtins/f64.EPSILON f64 (f64.const 2.220446049250313e-16))
(global $~lib/builtins/f64.MAX_VALUE f64 (f64.const 1797693134862315708145274e284))
(global $~lib/started (mut i32) (i32.const 0))
(global $~lib/rt/RTTI_BASE i32 (i32.const 7032))
(global $~lib/heap/HEAP_BASE i32 (i32.const 7100))
(global $~lib/rt/__rtti_base i32 (i32.const 7032))
(global $~lib/heap/__heap_base i32 (i32.const 7100))
(export "memory" (memory $0))
(export "getString" (func $std/string/getString))
(export "main" (func $std/string/main))
@ -288,7 +288,7 @@
)
(func $~lib/rt/pure/__retain (; 8 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
local.get $0
global.get $~lib/heap/HEAP_BASE
global.get $~lib/heap/__heap_base
i32.gt_u
if
local.get $0
@ -911,7 +911,7 @@
)
(func $~lib/rt/__typeinfo (; 12 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
global.get $~lib/rt/RTTI_BASE
global.get $~lib/rt/__rtti_base
local.set $1
local.get $0
local.get $1
@ -1097,7 +1097,7 @@
(local $7 i32)
(local $8 i32)
(local $9 i32)
global.get $~lib/heap/HEAP_BASE
global.get $~lib/heap/__heap_base
i32.const 15
i32.add
i32.const 15
@ -3338,7 +3338,7 @@
)
(func $~lib/rt/pure/__release (; 27 ;) (type $FUNCSIG$vi) (param $0 i32)
local.get $0
global.get $~lib/heap/HEAP_BASE
global.get $~lib/heap/__heap_base
i32.gt_u
if
local.get $0
@ -12315,7 +12315,7 @@
(local $2 i32)
(local $3 i32)
local.get $0
global.get $~lib/heap/HEAP_BASE
global.get $~lib/heap/__heap_base
i32.lt_u
if
return

View File

@ -53,7 +53,7 @@
(global $std/symbol/hasInstance (mut i32) (i32.const 0))
(global $~lib/symbol/_Symbol.isConcatSpreadable i32 (i32.const 2))
(global $std/symbol/isConcatSpreadable (mut i32) (i32.const 0))
(global $~lib/heap/HEAP_BASE i32 (i32.const 884))
(global $~lib/heap/__heap_base i32 (i32.const 884))
(export "memory" (memory $0))
(start $start)
(func $~lib/rt/stub/__retain (; 1 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
@ -3654,7 +3654,7 @@
call $~lib/builtins/abort
unreachable
end
global.get $~lib/heap/HEAP_BASE
global.get $~lib/heap/__heap_base
i32.const 15
i32.add
i32.const 15

View File

@ -102,8 +102,8 @@
(global $std/typedarray/forEachValues (mut i32) (i32.const 1112))
(global $std/typedarray/testArrayReverseValues (mut i32) (i32.const 1480))
(global $~lib/started (mut i32) (i32.const 0))
(global $~lib/rt/RTTI_BASE i32 (i32.const 1688))
(global $~lib/heap/HEAP_BASE i32 (i32.const 1820))
(global $~lib/rt/__rtti_base i32 (i32.const 1688))
(global $~lib/heap/__heap_base i32 (i32.const 1820))
(export "memory" (memory $0))
(export "main" (func $std/typedarray/main))
(func $~lib/rt/tlsf/removeBlock (; 5 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32)
@ -851,7 +851,7 @@
(local $7 i32)
(local $8 i32)
(local $9 i32)
global.get $~lib/heap/HEAP_BASE
global.get $~lib/heap/__heap_base
i32.const 15
i32.add
i32.const 15
@ -1504,7 +1504,7 @@
)
(func $~lib/rt/pure/__retain (; 16 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
local.get $0
global.get $~lib/heap/HEAP_BASE
global.get $~lib/heap/__heap_base
i32.gt_u
if
local.get $0
@ -1545,7 +1545,7 @@
)
(func $~lib/rt/__typeinfo (; 18 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
global.get $~lib/rt/RTTI_BASE
global.get $~lib/rt/__rtti_base
local.set $1
local.get $0
local.get $1
@ -3207,7 +3207,7 @@
)
(func $~lib/rt/pure/__release (; 25 ;) (type $FUNCSIG$vi) (param $0 i32)
local.get $0
global.get $~lib/heap/HEAP_BASE
global.get $~lib/heap/__heap_base
i32.gt_u
if
local.get $0
@ -23600,7 +23600,7 @@
(local $2 i32)
(local $3 i32)
local.get $0
global.get $~lib/heap/HEAP_BASE
global.get $~lib/heap/__heap_base
i32.lt_u
if
return