aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/source/luxc/lang/translation/jvm/case.lux
diff options
context:
space:
mode:
authorEduardo Julian2019-10-17 20:07:19 -0400
committerEduardo Julian2019-10-17 20:07:19 -0400
commit299908a885d00ec735070a937f9720410fe224a9 (patch)
tree1504b8fc46eade6654673e91bf5aa94636de9217 /new-luxc/source/luxc/lang/translation/jvm/case.lux
parentde9d57c45da46cdae9e21ff1d9747952e0815b32 (diff)
Ported JVM pattern-matching & loop generation to the new JVM bytecode machinery.
Diffstat (limited to 'new-luxc/source/luxc/lang/translation/jvm/case.lux')
-rw-r--r--new-luxc/source/luxc/lang/translation/jvm/case.lux12
1 files changed, 9 insertions, 3 deletions
diff --git a/new-luxc/source/luxc/lang/translation/jvm/case.lux b/new-luxc/source/luxc/lang/translation/jvm/case.lux
index 484604323..7ea571450 100644
--- a/new-luxc/source/luxc/lang/translation/jvm/case.lux
+++ b/new-luxc/source/luxc/lang/translation/jvm/case.lux
@@ -39,17 +39,23 @@
(def: peekI
Inst
(|>> _.DUP
- runtime.peekI))
+ (_.int +0)
+ _.AALOAD))
(def: pushI
Inst
- (|>> (_.INVOKESTATIC //.$Runtime "pm_push" (type.method [(list runtime.$Stack //.$Value) runtime.$Stack (list)]))))
+ (_.INVOKESTATIC //.$Runtime "pm_push" (type.method [(list runtime.$Stack //.$Value) runtime.$Stack (list)])))
+
+(def: popI
+ (|>> (_.int +1)
+ _.AALOAD
+ (_.CHECKCAST runtime.$Stack)))
(def: (path' phase stack-depth @else @end path)
(-> Phase Nat Label Label Path (Operation Inst))
(.case path
#synthesis.Pop
- (operation@wrap runtime.popI)
+ (operation@wrap ..popI)
(#synthesis.Bind register)
(operation@wrap (|>> peekI