Reintroduce builtin decorator so these can appear anywhere in stdlib again

Avoids wrapping an undocumented function within 'memory.size' for example.
This commit is contained in:
dcodeIO
2018-07-19 02:10:04 +02:00
parent 96411c7398
commit 26e46f6f86
80 changed files with 6889 additions and 7157 deletions

View File

@ -11,10 +11,10 @@
(global $assembly/index/w (mut i32) (i32.const 0))
(global $assembly/index/h (mut i32) (i32.const 0))
(global $assembly/index/s (mut i32) (i32.const 0))
(export "memory" (memory $0))
(export "init" (func $assembly/index/init))
(export "step" (func $assembly/index/step))
(export "fill" (func $assembly/index/fill))
(export "memory" (memory $0))
(func $assembly/index/init (; 1 ;) (type $iiv) (param $0 i32) (param $1 i32)
(local $2 i32)
;;@ assembly/index.ts:29:2

View File

@ -12,10 +12,10 @@
(global $assembly/index/h (mut i32) (i32.const 0))
(global $assembly/index/s (mut i32) (i32.const 0))
(global $HEAP_BASE i32 (i32.const 8))
(export "memory" (memory $0))
(export "init" (func $assembly/index/init))
(export "step" (func $assembly/index/step))
(export "fill" (func $assembly/index/fill))
(export "memory" (memory $0))
(func $assembly/index/init (; 1 ;) (type $iiv) (param $0 i32) (param $1 i32)
(local $2 i32)
(local $3 i32)

View File

@ -5,6 +5,7 @@
(global $assembly/i64/lo (mut i32) (i32.const 0))
(global $assembly/i64/hi (mut i32) (i32.const 0))
(memory $0 0)
(export "memory" (memory $0))
(export "getLo" (func $assembly/i64/getLo))
(export "getHi" (func $assembly/i64/getHi))
(export "clz" (func $assembly/i64/clz))
@ -36,7 +37,6 @@
(export "gt_u" (func $assembly/i64/gt_u))
(export "ge_s" (func $assembly/i64/ge_s))
(export "ge_u" (func $assembly/i64/ge_u))
(export "memory" (memory $0))
(func $assembly/i64/getLo (; 0 ;) (type $i) (result i32)
;;@ assembly/i64.ts:4:9
(get_global $assembly/i64/lo)

View File

@ -8,6 +8,7 @@
(global $Infinity f64 (f64.const inf))
(global $HEAP_BASE i32 (i32.const 8))
(memory $0 0)
(export "memory" (memory $0))
(export "getLo" (func $assembly/i64/getLo))
(export "getHi" (func $assembly/i64/getHi))
(export "clz" (func $assembly/i64/clz))
@ -39,7 +40,6 @@
(export "gt_u" (func $assembly/i64/gt_u))
(export "ge_s" (func $assembly/i64/ge_s))
(export "ge_u" (func $assembly/i64/ge_u))
(export "memory" (memory $0))
(func $assembly/i64/getLo (; 0 ;) (type $i) (result i32)
;;@ assembly/i64.ts:4:9
(get_global $assembly/i64/lo)

View File

@ -5,8 +5,8 @@
(import "JSMath" "log" (func $~lib/math/JSMath.log (param f64) (result f64)))
(import "JSMath" "LN2" (global $~lib/math/JSMath.LN2 f64))
(import "env" "memory" (memory $0 0))
(export "computeLine" (func $assembly/index/computeLine))
(export "memory" (memory $0))
(export "computeLine" (func $assembly/index/computeLine))
(func $assembly/index/computeLine (; 2 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
(local $4 f64)
(local $5 f64)

View File

@ -9,18 +9,18 @@
(import "env" "memory" (memory $0 0))
(global $assembly/index/NUM_COLORS i32 (i32.const 2048))
(global $HEAP_BASE i32 (i32.const 8))
(export "computeLine" (func $assembly/index/computeLine))
(export "memory" (memory $0))
(func $isFinite<f64> (; 2 ;) (type $Fi) (param $0 f64) (result i32)
;;@ ~lib/builtins.ts:26:26
(export "computeLine" (func $assembly/index/computeLine))
(func $~lib/builtins/isFinite<f64> (; 2 ;) (type $Fi) (param $0 f64) (result i32)
;;@ ~lib/builtins.ts:16:70
(f64.eq
;;@ ~lib/builtins.ts:26:9
;;@ ~lib/builtins.ts:16:53
(f64.sub
(get_local $0)
;;@ ~lib/builtins.ts:26:17
;;@ ~lib/builtins.ts:16:61
(get_local $0)
)
;;@ ~lib/builtins.ts:26:26
;;@ ~lib/builtins.ts:16:70
(f64.const 0)
)
)
@ -375,7 +375,7 @@
(set_local $17
;;@ assembly/index.ts:37:15
(if (result i32)
(call $isFinite<f64>
(call $~lib/builtins/isFinite<f64>
;;@ assembly/index.ts:37:24
(get_local $15)
)
@ -386,7 +386,7 @@
(f64.convert_s/i32
(i32.sub
;;@ assembly/index.ts:38:15
(i32.const 2048)
(get_global $assembly/index/NUM_COLORS)
;;@ assembly/index.ts:38:28
(i32.const 1)
)
@ -421,7 +421,7 @@
)
;;@ assembly/index.ts:39:8
(i32.sub
(i32.const 2048)
(get_global $assembly/index/NUM_COLORS)
;;@ assembly/index.ts:39:21
(i32.const 1)
)

View File

@ -24,7 +24,6 @@ function asmFunc(global, env, buffer) {
var $lib_allocator_arena_startOffset = 0;
var $lib_allocator_arena_offset = 0;
var assembly_index_system = 0;
var HEAP_BASE = 40;
var i64toi32_i32$HIGH_BITS = 0;
function $lib_allocator_arena___memory_allocate($0) {
$0 = $0 | 0;
@ -81,7 +80,7 @@ function asmFunc(global, env, buffer) {
return $0 | 0;
}
function $lib_memory_memory_fill($0, $1, $2) {
function $lib_memory_memset($0, $1, $2) {
$0 = $0 | 0;
$1 = $1 | 0;
$2 = $2 | 0;
@ -272,7 +271,7 @@ function asmFunc(global, env, buffer) {
wasm2asm_i32$0 = $0;
wasm2asm_i32$1 = $1;
HEAP32[(wasm2asm_i32$0 + 4 | 0) >> 2] = wasm2asm_i32$1;
$lib_memory_memory_fill($3 + 8 | 0 | 0, 0 | 0, $2 | 0);
$lib_memory_memset($3 + 8 | 0 | 0, 0 | 0, $2 | 0);
return $0 | 0;
}
@ -492,7 +491,7 @@ function asmFunc(global, env, buffer) {
}
function start() {
$lib_allocator_arena_startOffset = (HEAP_BASE + 7 | 0) & 4294967288 | 0;
$lib_allocator_arena_startOffset = 40;
$lib_allocator_arena_offset = $lib_allocator_arena_startOffset;
}
@ -522,10 +521,6 @@ function asmFunc(global, env, buffer) {
}
return {
init: assembly_index_init,
getBody: assembly_index_getBody,
step: assembly_index_step,
bench: assembly_index_bench,
memory: Object.create(Object.prototype, {
grow: {
value: __wasm_grow_memory
@ -536,6 +531,10 @@ function asmFunc(global, env, buffer) {
}
}
})
}),
init: assembly_index_init,
getBody: assembly_index_getBody,
step: assembly_index_step,
bench: assembly_index_bench
};
}

Binary file not shown.

View File

@ -13,14 +13,13 @@
(global $~lib/allocator/arena/startOffset (mut i32) (i32.const 0))
(global $~lib/allocator/arena/offset (mut i32) (i32.const 0))
(global $assembly/index/system (mut i32) (i32.const 0))
(global $HEAP_BASE i32 (i32.const 40))
(memory $0 1)
(data (i32.const 8) "\0d\00\00\00~\00l\00i\00b\00/\00a\00r\00r\00a\00y\00.\00t\00s")
(export "memory" (memory $0))
(export "init" (func $assembly/index/init))
(export "getBody" (func $assembly/index/getBody))
(export "step" (func $assembly/index/step))
(export "bench" (func $assembly/index/bench))
(export "memory" (memory $0))
(start $start)
(func $~lib/allocator/arena/__memory_allocate (; 1 ;) (type $ii) (param $0 i32) (result i32)
(local $1 i32)
@ -150,7 +149,7 @@
)
(get_local $0)
)
(func $~lib/memory/memory.fill (; 3 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
(func $~lib/memory/memset (; 3 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
(local $3 i32)
(local $4 i64)
(if
@ -549,7 +548,7 @@
(get_local $0)
(get_local $1)
)
(call $~lib/memory/memory.fill
(call $~lib/memory/memset
(i32.add
(get_local $3)
(i32.const 8)
@ -1403,13 +1402,7 @@
)
(func $start (; 12 ;) (type $v)
(set_global $~lib/allocator/arena/startOffset
(i32.and
(i32.add
(get_global $HEAP_BASE)
(i32.const 7)
)
(i32.const -8)
)
(i32.const 40)
)
(set_global $~lib/allocator/arena/offset
(get_global $~lib/allocator/arena/startOffset)

File diff suppressed because it is too large Load Diff

View File

@ -22,6 +22,7 @@
(import "pson" "onBinary" (func $assembly/pson/onBinary (param i32 i32)))
(global $assembly/pson/offset (mut i32) (i32.const 0))
(memory $0 0)
(export "memory" (memory $0))
(export "onNull" (func $assembly/pson/onNull))
(export "onTrue" (func $assembly/pson/onTrue))
(export "onFalse" (func $assembly/pson/onFalse))
@ -37,7 +38,6 @@
(export "onString" (func $assembly/pson/onString))
(export "onBinary" (func $assembly/pson/onBinary))
(export "decode" (func $assembly/pson/decode))
(export "memory" (memory $0))
(func $assembly/pson/readVarint32 (; 14 ;) (type $i) (result i32)
(local $0 i32)
(local $1 i32)
@ -190,54 +190,59 @@
(block $case3|0
(block $case2|0
(block $case1|0
(block $case0|0
(block $tablify|0
(if
;;@ assembly/pson.ts:46:28
(block (result i32)
(set_global $assembly/pson/offset
(i32.add
(tee_local $1
;;@ assembly/pson.ts:46:28
(get_global $assembly/pson/offset)
)
(i32.const 1)
)
)
(br_table $case0|0 $case1|0 $case2|0 $case3|0 $case4|0 $case5|0 $case6|0 $case7|0 $case8|0 $case9|0 $case10|0 $case11|0 $case12|0 $tablify|0
(i32.sub
(tee_local $1
;;@ assembly/pson.ts:46:2
(tee_local $0
;;@ assembly/pson.ts:46:19
(i32.load8_u
(get_local $1)
)
(i32.ne
(tee_local $1
;;@ assembly/pson.ts:46:2
(tee_local $0
;;@ assembly/pson.ts:46:19
(i32.load8_u
(get_local $1)
)
)
(i32.const 240)
)
(i32.const 240)
)
)
(br_if $case14|0
(i32.or
(block
(block $tablify|0
(br_table $case1|0 $case2|0 $case3|0 $case4|0 $case5|0 $case6|0 $case7|0 $case8|0 $case9|0 $case10|0 $case11|0 $case12|0 $tablify|0
(i32.sub
(get_local $1)
(i32.const 241)
)
)
)
(br_if $case14|0
(i32.or
(i32.eq
(get_local $1)
(i32.const 253)
)
(i32.eq
(get_local $1)
(i32.const 254)
)
)
)
(br_if $case15|0
(i32.eq
(get_local $1)
;;@ assembly/pson.ts:112:9
(i32.const 253)
)
(i32.eq
(get_local $1)
;;@ assembly/pson.ts:113:9
(i32.const 254)
(i32.const 255)
)
)
(br $case16|0)
)
(br_if $case15|0
(i32.eq
(get_local $1)
;;@ assembly/pson.ts:118:9
(i32.const 255)
)
)
(br $case16|0)
)
;;@ assembly/pson.ts:51:6
(call $assembly/pson/onNull)
@ -500,7 +505,6 @@
;;@ assembly/pson.ts:125:10
(i32.gt_u
(get_local $0)
;;@ assembly/pson.ts:125:18
(i32.const 239)
)
;;@ assembly/pson.ts:125:34

View File

@ -41,6 +41,7 @@
(global $assembly/pson/Token.BINARY i32 (i32.const 255))
(global $HEAP_BASE i32 (i32.const 8))
(memory $0 0)
(export "memory" (memory $0))
(export "onNull" (func $assembly/pson/onNull))
(export "onTrue" (func $assembly/pson/onTrue))
(export "onFalse" (func $assembly/pson/onFalse))
@ -56,7 +57,6 @@
(export "onString" (func $assembly/pson/onString))
(export "onBinary" (func $assembly/pson/onBinary))
(export "decode" (func $assembly/pson/decode))
(export "memory" (memory $0))
(func $assembly/pson/readVarint32 (; 14 ;) (type $i) (result i32)
(local $0 i32)
(local $1 i32)
@ -283,112 +283,112 @@
(i32.eq
(get_local $0)
;;@ assembly/pson.ts:50:9
(i32.const 240)
(get_global $assembly/pson/Token.NULL)
)
)
(br_if $case1|0
(i32.eq
(get_local $0)
;;@ assembly/pson.ts:54:9
(i32.const 241)
(get_global $assembly/pson/Token.TRUE)
)
)
(br_if $case2|0
(i32.eq
(get_local $0)
;;@ assembly/pson.ts:58:9
(i32.const 242)
(get_global $assembly/pson/Token.FALSE)
)
)
(br_if $case3|0
(i32.eq
(get_local $0)
;;@ assembly/pson.ts:62:9
(i32.const 243)
(get_global $assembly/pson/Token.EOBJECT)
)
)
(br_if $case4|0
(i32.eq
(get_local $0)
;;@ assembly/pson.ts:66:9
(i32.const 244)
(get_global $assembly/pson/Token.EARRAY)
)
)
(br_if $case5|0
(i32.eq
(get_local $0)
;;@ assembly/pson.ts:70:9
(i32.const 245)
(get_global $assembly/pson/Token.ESTRING)
)
)
(br_if $case6|0
(i32.eq
(get_local $0)
;;@ assembly/pson.ts:74:9
(i32.const 246)
(get_global $assembly/pson/Token.OBJECT)
)
)
(br_if $case7|0
(i32.eq
(get_local $0)
;;@ assembly/pson.ts:82:9
(i32.const 247)
(get_global $assembly/pson/Token.ARRAY)
)
)
(br_if $case8|0
(i32.eq
(get_local $0)
;;@ assembly/pson.ts:87:9
(i32.const 248)
(get_global $assembly/pson/Token.INTEGER)
)
)
(br_if $case9|0
(i32.eq
(get_local $0)
;;@ assembly/pson.ts:91:9
(i32.const 249)
(get_global $assembly/pson/Token.LONG)
)
)
(br_if $case10|0
(i32.eq
(get_local $0)
;;@ assembly/pson.ts:96:9
(i32.const 250)
(get_global $assembly/pson/Token.FLOAT)
)
)
(br_if $case11|0
(i32.eq
(get_local $0)
;;@ assembly/pson.ts:101:9
(i32.const 251)
(get_global $assembly/pson/Token.DOUBLE)
)
)
(br_if $case12|0
(i32.eq
(get_local $0)
;;@ assembly/pson.ts:106:9
(i32.const 252)
(get_global $assembly/pson/Token.STRING)
)
)
(br_if $case13|0
(i32.eq
(get_local $0)
;;@ assembly/pson.ts:112:9
(i32.const 253)
(get_global $assembly/pson/Token.STRING_ADD)
)
)
(br_if $case14|0
(i32.eq
(get_local $0)
;;@ assembly/pson.ts:113:9
(i32.const 254)
(get_global $assembly/pson/Token.STRING_GET)
)
)
(br_if $case15|0
(i32.eq
(get_local $0)
;;@ assembly/pson.ts:118:9
(i32.const 255)
(get_global $assembly/pson/Token.BINARY)
)
)
(br $case16|0)
@ -716,7 +716,7 @@
(i32.gt_u
(get_local $1)
;;@ assembly/pson.ts:125:18
(i32.const 239)
(get_global $assembly/pson/Token.MAX)
)
;;@ assembly/pson.ts:125:34
(unreachable)