Refactor push compilation in preparation for #1

This commit is contained in:
Remko Tronçon 2018-05-30 14:49:46 +02:00
parent 05d1ee8542
commit d6033e83ce

View file

@ -548,8 +548,7 @@
;; 6.1.1680
(func $i (param i32)
(if (i32.eqz (get_global $state)) (unreachable))
(call $emitGetLocal (i32.sub (get_global $currentLocal) (i32.const 1)))
(call $compilePush))
(call $compilePushLocal (i32.sub (get_global $currentLocal) (i32.const 1))))
(!def_word "I" "$i" !fImmediate)
;; 6.1.1700
@ -570,8 +569,7 @@
;; 6.1.1730
(func $j (param i32)
(if (i32.eqz (get_global $state)) (unreachable))
(call $emitGetLocal (i32.sub (get_global $currentLocal) (i32.const 3)))
(call $compilePush))
(call $compilePushLocal (i32.sub (get_global $currentLocal) (i32.const 3))))
(!def_word "J" "$j" !fImmediate)
;; 6.1.1750
@ -951,7 +949,11 @@ EOF
(func $compilePushConst (param $n i32)
(call $emitConst (get_local $n))
(call $compilePush))
(call $emitICall (i32.const 1) (i32.const !pushIndex)))
(func $compilePushLocal (param $n i32)
(call $emitGetLocal (get_local $n))
(call $emitICall (i32.const 1) (i32.const !pushIndex)))
(func $compileIf
(call $compilePop)
@ -1038,9 +1040,6 @@ EOF
(i32.store8 (get_global $cp) (i32.const 0x00))
(set_global $cp (i32.add (get_global $cp) (i32.const 1))))
(func $compilePush
(call $emitICall (i32.const 1) (i32.const !pushIndex)))
(func $compilePop
(call $emitICall (i32.const 2) (i32.const !popIndex)))