aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/source/luxc/lang/translation/jvm/runtime.jvm.lux
diff options
context:
space:
mode:
authorEduardo Julian2019-04-07 21:12:08 -0400
committerEduardo Julian2019-04-07 21:12:08 -0400
commitd4ded2084127fd8953d2889d72bab889213000a1 (patch)
tree687159e2055e598bdc1d16336532ee1d53edb838 /new-luxc/source/luxc/lang/translation/jvm/runtime.jvm.lux
parenta42c2004388ca204cae7bd1b3f4ef21d208f72b2 (diff)
Upgraded the tuple right-access mechanism to the new style.
Diffstat (limited to '')
-rw-r--r--new-luxc/source/luxc/lang/translation/jvm/runtime.jvm.lux44
1 files changed, 27 insertions, 17 deletions
diff --git a/new-luxc/source/luxc/lang/translation/jvm/runtime.jvm.lux b/new-luxc/source/luxc/lang/translation/jvm/runtime.jvm.lux
index 6ea00df21..973170d77 100644
--- a/new-luxc/source/luxc/lang/translation/jvm/runtime.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/jvm/runtime.jvm.lux
@@ -136,8 +136,6 @@
last-right-indexI (|>> tuple-sizeI (_.int +1) _.ISUB)
leftsI (_.ILOAD 1)
left-indexI leftsI
- accessI (|>> (_.ALOAD 0) left-indexI _.AALOAD)
- sub-leftsI (|>> _.SWAP _.ISUB)
sub-tupleI (|>> (_.ALOAD 0) last-right-indexI _.AALOAD (_.CHECKCAST ($t.descriptor $Tuple)))
expected-last-sizeI (|>> (_.ILOAD 1) (_.int +1) _.IADD)]
@@ -231,6 +229,8 @@
($d.method #$.Public $.staticM "tuple_left" ($t.method (list $Tuple $t.int) (#.Some $Object) (list))
(<| _.with-label (function (_ @begin))
_.with-label (function (_ @not-recursive))
+ (let [left-accessI (|>> (_.ALOAD 0) left-indexI _.AALOAD)
+ sub-leftsI (|>> _.SWAP _.ISUB)])
(|>> (_.label @begin)
last-right-indexI
leftsI
@@ -241,34 +241,44 @@
(_.GOTO @begin)
(_.label @not-recursive)
## _.POP2
- accessI
+ left-accessI
_.ARETURN)))
- ($d.method #$.Public $.staticM "pm_right" ($t.method (list $Tuple $t.int) (#.Some $Object) (list))
+ ($d.method #$.Public $.staticM "tuple_right" ($t.method (list $Tuple $t.int) (#.Some $Object) (list))
(<| _.with-label (function (_ @begin))
_.with-label (function (_ @tail))
_.with-label (function (_ @slice))
- (let [updated-idxI (|>> (_.ILOAD 1) (_.int +1) _.ISUB tuple-sizeI _.ISUB)
- sliceI (|>> (_.ALOAD 0) (_.ILOAD 1) tuple-sizeI
- (_.INVOKESTATIC "java.util.Arrays" "copyOfRange"
- ($t.method (list $Object-Array $t.int $t.int)
- (#.Some $Object-Array)
- (list))
- #0))])
+ (let [right-indexI (|>> leftsI
+ (_.int +1)
+ _.IADD)
+ right-accessI (|>> (_.ALOAD 0)
+ _.SWAP
+ _.AALOAD)
+ sub-rightI (|>> (_.ALOAD 0)
+ right-indexI
+ tuple-sizeI
+ (_.INVOKESTATIC "java.util.Arrays" "copyOfRange"
+ ($t.method (list $Object-Array $t.int $t.int)
+ (#.Some $Object-Array)
+ (list))
+ #0))
+ sub-leftsI (|>> leftsI
+ last-right-indexI
+ _.ISUB)])
(|>> (_.label @begin)
- tuple-sizeI
- expected-last-sizeI
+ last-right-indexI
+ right-indexI
_.DUP2 (_.IF_ICMPEQ @tail)
(_.IF_ICMPGT @slice)
## Must recurse
sub-tupleI (_.ASTORE 0)
- updated-idxI (_.ISTORE 1)
+ sub-leftsI (_.ISTORE 1)
(_.GOTO @begin)
(_.label @slice)
- sliceI
+ sub-rightI
_.ARETURN
(_.label @tail)
- ## _.POP2
- accessI
+ ## _.POP
+ right-accessI
_.ARETURN)))
)))