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

@ -1,6 +1,5 @@
(module
(type $ii (func (param i32) (result i32)))
(type $i (func (result i32)))
(type $v (func))
(global $~lib/allocator/arena/startOffset (mut i32) (i32.const 0))
(global $~lib/allocator/arena/offset (mut i32) (i32.const 0))
@ -18,15 +17,7 @@
(memory $0 0)
(export "memory" (memory $0))
(start $start)
(func $~lib/memory/memory.size (; 0 ;) (type $i) (result i32)
(current_memory)
)
(func $~lib/memory/memory.grow (; 1 ;) (type $ii) (param $0 i32) (result i32)
(grow_memory
(get_local $0)
)
)
(func $~lib/allocator/arena/__memory_allocate (; 2 ;) (type $ii) (param $0 i32) (result i32)
(func $~lib/allocator/arena/__memory_allocate (; 0 ;) (type $ii) (param $0 i32) (result i32)
(local $1 i32)
(local $2 i32)
(local $3 i32)
@ -58,14 +49,14 @@
)
(i32.shl
(tee_local $2
(call $~lib/memory/memory.size)
(current_memory)
)
(i32.const 16)
)
)
(if
(i32.lt_s
(call $~lib/memory/memory.grow
(grow_memory
(select
(get_local $2)
(tee_local $3
@ -93,7 +84,7 @@
)
(if
(i32.lt_s
(call $~lib/memory/memory.grow
(grow_memory
(get_local $3)
)
(i32.const 0)
@ -112,12 +103,12 @@
)
(i32.const 0)
)
(func $~lib/memory/memory.allocate (; 3 ;) (type $ii) (param $0 i32) (result i32)
(func $~lib/memory/memory.allocate (; 1 ;) (type $ii) (param $0 i32) (result i32)
(call $~lib/allocator/arena/__memory_allocate
(get_local $0)
)
)
(func $std/constructor/EmptyCtor#constructor (; 4 ;) (type $ii) (param $0 i32) (result i32)
(func $std/constructor/EmptyCtor#constructor (; 2 ;) (type $ii) (param $0 i32) (result i32)
(if (result i32)
(get_local $0)
(get_local $0)
@ -126,7 +117,7 @@
)
)
)
(func $std/constructor/EmptyCtorWithFieldInit#constructor (; 5 ;) (type $ii) (param $0 i32) (result i32)
(func $std/constructor/EmptyCtorWithFieldInit#constructor (; 3 ;) (type $ii) (param $0 i32) (result i32)
(if
(i32.eqz
(get_local $0)
@ -142,7 +133,7 @@
)
(get_local $0)
)
(func $std/constructor/EmptyCtorWithFieldNoInit#constructor (; 6 ;) (type $ii) (param $0 i32) (result i32)
(func $std/constructor/EmptyCtorWithFieldNoInit#constructor (; 4 ;) (type $ii) (param $0 i32) (result i32)
(if
(i32.eqz
(get_local $0)
@ -158,12 +149,12 @@
)
(get_local $0)
)
(func $std/constructor/CtorReturns#constructor (; 7 ;) (type $ii) (param $0 i32) (result i32)
(func $std/constructor/CtorReturns#constructor (; 5 ;) (type $ii) (param $0 i32) (result i32)
(call $~lib/memory/memory.allocate
(i32.const 0)
)
)
(func $std/constructor/CtorConditionallyReturns#constructor (; 8 ;) (type $ii) (param $0 i32) (result i32)
(func $std/constructor/CtorConditionallyReturns#constructor (; 6 ;) (type $ii) (param $0 i32) (result i32)
(if
(get_global $std/constructor/b)
(return
@ -180,7 +171,7 @@
)
)
)
(func $std/constructor/CtorConditionallyAllocates#constructor (; 9 ;) (type $ii) (param $0 i32) (result i32)
(func $std/constructor/CtorConditionallyAllocates#constructor (; 7 ;) (type $ii) (param $0 i32) (result i32)
(if
(get_global $std/constructor/b)
(if
@ -206,7 +197,7 @@
)
(get_local $0)
)
(func $start (; 10 ;) (type $v)
(func $start (; 8 ;) (type $v)
(local $0 i32)
(set_global $~lib/allocator/arena/startOffset
(i32.const 8)