From aa42fde49c66d73f41b17d4939a9226671442a8a Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Wed, 24 Jun 2020 22:31:02 -0400 Subject: Last bug fixes to get the new JVM compiler to fully process the standard library and its tests. --- lux-jvm/source/luxc/lang/translation/jvm/case.lux | 2 +- .../source/luxc/lang/translation/jvm/runtime.lux | 34 +++++++++++++--------- 2 files changed, 21 insertions(+), 15 deletions(-) (limited to 'lux-jvm/source/luxc/lang/translation/jvm') diff --git a/lux-jvm/source/luxc/lang/translation/jvm/case.lux b/lux-jvm/source/luxc/lang/translation/jvm/case.lux index 573e9764b..d77e747fd 100644 --- a/lux-jvm/source/luxc/lang/translation/jvm/case.lux +++ b/lux-jvm/source/luxc/lang/translation/jvm/case.lux @@ -260,7 +260,7 @@ (..right-projection lefts))] (|>> so-far next))) recordG - path)))) + (list.reverse path))))) (def: #export (case phase archive [valueS path]) (Generator [Synthesis Path]) diff --git a/lux-jvm/source/luxc/lang/translation/jvm/runtime.lux b/lux-jvm/source/luxc/lang/translation/jvm/runtime.lux index a657a7a38..1cad5569f 100644 --- a/lux-jvm/source/luxc/lang/translation/jvm/runtime.lux +++ b/lux-jvm/source/luxc/lang/translation/jvm/runtime.lux @@ -67,7 +67,7 @@ (def: #export leftI Inst - (|>> (_.int +0) + (|>> _.ICONST_0 _.NULL _.DUP2_X1 _.POP2 @@ -75,7 +75,7 @@ (def: #export rightI Inst - (|>> (_.int +1) + (|>> _.ICONST_1 (_.string "") _.DUP2_X1 _.POP2 @@ -85,7 +85,7 @@ (def: #export noneI Inst - (|>> (_.int +0) + (|>> _.ICONST_0 _.NULL (_.string synthesis.unit) variantI)) @@ -115,12 +115,12 @@ (def: adt-methods Def - (let [store-tagI (|>> _.DUP (_.int +0) (_.ILOAD 0) (_.wrap type.int) _.AASTORE) - store-flagI (|>> _.DUP (_.int +1) (_.ALOAD 1) _.AASTORE) - store-valueI (|>> _.DUP (_.int +2) (_.ALOAD 2) _.AASTORE)] + (let [store-tagI (|>> _.DUP _.ICONST_0 (_.ILOAD 0) (_.wrap type.int) _.AASTORE) + store-flagI (|>> _.DUP _.ICONST_1 (_.ALOAD 1) _.AASTORE) + store-valueI (|>> _.DUP _.ICONST_2 (_.ALOAD 2) _.AASTORE)] (|>> ($d.method #$.Public $.staticM "variant_make" (type.method [(list $Tag $Flag $Value) //.$Variant (list)]) - (|>> (_.int +3) + (|>> _.ICONST_3 (_.ANEWARRAY $Value) store-tagI store-flagI @@ -146,14 +146,20 @@ (def: pm-methods Def - (let [tuple-sizeI (|>> (_.ALOAD 0) _.ARRAYLENGTH) - last-rightI (|>> tuple-sizeI (_.int +1) _.ISUB) + (let [tuple-sizeI (|>> (_.ALOAD 0) + _.ARRAYLENGTH) + last-rightI (|>> tuple-sizeI + _.ICONST_1 + _.ISUB) leftsI (_.ILOAD 1) left-indexI leftsI sub-leftsI (|>> leftsI last-rightI _.ISUB) - sub-tupleI (|>> (_.ALOAD 0) last-rightI _.AALOAD (_.CHECKCAST //.$Tuple)) + sub-tupleI (|>> (_.ALOAD 0) + last-rightI + _.AALOAD + (_.CHECKCAST //.$Tuple)) recurI (: (-> Label Inst) (function (_ @loop) (|>> sub-leftsI (_.ISTORE 1) @@ -166,14 +172,14 @@ (|>> (illegal-state-exception "Error while applying function.") _.ATHROW)) ($d.method #$.Public $.staticM "pm_push" (type.method [(list $Stack $Value) $Stack (list)]) - (|>> (_.int +2) + (|>> _.ICONST_2 (_.ANEWARRAY $Value) _.DUP - (_.int +1) + _.ICONST_1 (_.ALOAD 0) _.AASTORE _.DUP - (_.int +0) + _.ICONST_0 (_.ALOAD 1) _.AASTORE _.ARETURN)) @@ -253,7 +259,7 @@ _.with-label (function (_ @not-tail)) _.with-label (function (_ @slice)) (let [right-indexI (|>> leftsI - (_.int +1) + _.ICONST_1 _.IADD) right-accessI (|>> (_.ALOAD 0) _.SWAP -- cgit v1.2.3