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

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