Control flow evaluator; Support for block-level let/const variables

This commit is contained in:
dcodeIO
2018-01-18 23:34:12 +01:00
parent 1c4b0ddc57
commit 7be4f9fabb
54 changed files with 3285 additions and 13138 deletions

View File

@ -30,10 +30,8 @@
(i32.const 0)
)
)
(block
(set_local $1
(current_memory)
)
(set_local $1
(current_memory)
)
(if
(i32.gt_u
@ -82,10 +80,8 @@
(unreachable)
)
)
(block
(set_local $4
(get_global $std:heap/HEAP_OFFSET)
)
(set_local $4
(get_global $std:heap/HEAP_OFFSET)
)
(if
(i32.and
@ -2220,20 +2216,22 @@
(if
(get_local $2)
(block
(i32.store8
(i32.add
(get_local $0)
(tee_local $2
(i32.sub
(get_local $2)
(i32.const 1)
(block
(i32.store8
(i32.add
(get_local $0)
(tee_local $2
(i32.sub
(get_local $2)
(i32.const 1)
)
)
)
)
(i32.load8_u
(i32.add
(get_local $1)
(get_local $2)
(i32.load8_u
(i32.add
(get_local $1)
(get_local $2)
)
)
)
)
@ -2260,13 +2258,11 @@
)
(unreachable)
)
(block
(set_local $2
(call $std:heap/allocate_memory
(i32.mul
(get_local $1)
(i32.const 4)
)
(set_local $2
(call $std:heap/allocate_memory
(i32.mul
(get_local $1)
(i32.const 4)
)
)
)
@ -2430,11 +2426,9 @@
(local $3 i32)
(local $4 i32)
(local $5 i32)
(block
(set_local $2
(i32.load offset=4
(get_local $0)
)
(set_local $2
(i32.load offset=4
(get_local $0)
)
)
(if
@ -2445,16 +2439,14 @@
(get_local $2)
)
(block
(block
(set_local $3
(if (result i32)
(set_local $3
(if (result i32)
(get_local $2)
(i32.shl
(get_local $2)
(i32.shl
(get_local $2)
(i32.const 1)
)
(i32.const 1)
)
(i32.const 1)
)
)
(if
@ -2468,13 +2460,11 @@
)
(unreachable)
)
(block
(set_local $4
(call $std:heap/allocate_memory
(i32.mul
(get_local $3)
(i32.const 4)
)
(set_local $4
(call $std:heap/allocate_memory
(i32.mul
(get_local $3)
(i32.const 4)
)
)
)
@ -2648,15 +2638,13 @@
)
(return)
)
(block
(set_local $3
(i32.and
(i32.sub
(i32.const 0)
(get_local $0)
)
(i32.const 3)
(set_local $3
(i32.and
(i32.sub
(i32.const 0)
(get_local $0)
)
(i32.const 3)
)
)
(set_local $0
@ -2680,18 +2668,16 @@
)
)
)
(block
(set_local $4
(i32.mul
(i32.div_u
(i32.sub
(i32.const 0)
(i32.const 1)
)
(i32.const 255)
(set_local $4
(i32.mul
(i32.div_u
(i32.sub
(i32.const 0)
(i32.const 1)
)
(get_local $1)
(i32.const 255)
)
(get_local $1)
)
)
(i32.store
@ -2845,18 +2831,16 @@
(get_local $3)
)
)
(block
(set_local $5
(i64.or
(set_local $5
(i64.or
(i64.extend_u/i32
(get_local $4)
)
(i64.shl
(i64.extend_u/i32
(get_local $4)
)
(i64.shl
(i64.extend_u/i32
(get_local $4)
)
(i64.const 32)
)
(i64.const 32)
)
)
)
@ -2924,12 +2908,10 @@
)
(unreachable)
)
(block
(set_local $1
(set_local $1
(i32.load
(i32.load
(i32.load
(get_local $0)
)
(get_local $0)
)
)
)
@ -3010,17 +2992,15 @@
)
(block
(block
(block
(set_local $3
(i32.load
(i32.add
(i32.load
(get_local $0)
)
(i32.mul
(get_local $1)
(i32.const 4)
)
(set_local $3
(i32.load
(i32.add
(i32.load
(get_local $0)
)
(i32.mul
(get_local $1)
(i32.const 4)
)
)
)