aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/source/luxc/lang/translation/jvm
diff options
context:
space:
mode:
Diffstat (limited to 'new-luxc/source/luxc/lang/translation/jvm')
-rw-r--r--new-luxc/source/luxc/lang/translation/jvm/case.lux18
-rw-r--r--new-luxc/source/luxc/lang/translation/jvm/runtime.lux20
2 files changed, 11 insertions, 27 deletions
diff --git a/new-luxc/source/luxc/lang/translation/jvm/case.lux b/new-luxc/source/luxc/lang/translation/jvm/case.lux
index 3c50f6124..63d440c72 100644
--- a/new-luxc/source/luxc/lang/translation/jvm/case.lux
+++ b/new-luxc/source/luxc/lang/translation/jvm/case.lux
@@ -36,21 +36,7 @@
(def: peekI
Inst
(|>> _.DUP
- (_.INVOKESTATIC //.runtime-class
- "pm_peek"
- ($t.method (list runtime.$Stack)
- (#.Some $Object)
- (list))
- #0)))
-
-(def: popI
- Inst
- (|>> (_.INVOKESTATIC //.runtime-class
- "pm_pop"
- ($t.method (list runtime.$Stack)
- (#.Some runtime.$Stack)
- (list))
- #0)))
+ runtime.peekI))
(def: pushI
Inst
@@ -65,7 +51,7 @@
(-> Phase Nat Label Label Path (Operation Inst))
(.case path
#synthesis.Pop
- (operation@wrap popI)
+ (operation@wrap runtime.popI)
(#synthesis.Bind register)
(operation@wrap (|>> peekI
diff --git a/new-luxc/source/luxc/lang/translation/jvm/runtime.lux b/new-luxc/source/luxc/lang/translation/jvm/runtime.lux
index fa250e2bf..175a60e80 100644
--- a/new-luxc/source/luxc/lang/translation/jvm/runtime.lux
+++ b/new-luxc/source/luxc/lang/translation/jvm/runtime.lux
@@ -132,6 +132,15 @@
(_.wrap #$t.Double))))
))
+(def: #export popI
+ (|>> (_.int +0)
+ _.AALOAD
+ (_.CHECKCAST ($t.descriptor $Stack))))
+
+(def: #export peekI
+ (|>> (_.int +1)
+ _.AALOAD))
+
(def: pm-methods
Def
(let [tuple-sizeI (|>> (_.ALOAD 0) _.ARRAYLENGTH)
@@ -171,17 +180,6 @@
(_.ALOAD 1)
_.AASTORE
_.ARETURN))
- ($d.method #$.Public $.staticM "pm_pop" ($t.method (list $Stack) (#.Some $Stack) (list))
- (|>> (_.ALOAD 0)
- (_.int +0)
- _.AALOAD
- (_.CHECKCAST ($t.descriptor $Stack))
- _.ARETURN))
- ($d.method #$.Public $.staticM "pm_peek" ($t.method (list $Stack) (#.Some $Object) (list))
- (|>> (_.ALOAD 0)
- (_.int +1)
- _.AALOAD
- _.ARETURN))
($d.method #$.Public $.staticM "pm_variant" ($t.method (list $Variant $Tag $Flag) (#.Some $Object) (list))
(<| _.with-label (function (_ @loop))
_.with-label (function (_ @just-return))