From af7f85c4eb724f2888ecce9c8b52d6d3bb1cd807 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sat, 27 Apr 2019 23:41:47 -0400 Subject: Moved JVM type machinery to stdlib. --- .../source/luxc/lang/translation/jvm/runtime.lux | 38 ++++++++++++---------- 1 file changed, 20 insertions(+), 18 deletions(-) (limited to 'new-luxc/source/luxc/lang/translation/jvm/runtime.lux') diff --git a/new-luxc/source/luxc/lang/translation/jvm/runtime.lux b/new-luxc/source/luxc/lang/translation/jvm/runtime.lux index d21729d0e..fa250e2bf 100644 --- a/new-luxc/source/luxc/lang/translation/jvm/runtime.lux +++ b/new-luxc/source/luxc/lang/translation/jvm/runtime.lux @@ -1,5 +1,5 @@ (.module: - [lux #* + [lux (#- Type) [abstract [monad (#+ do)]] [data @@ -8,6 +8,9 @@ [collection ["." list ("#/." functor)]]] ["." math] + [target + [jvm + ["$t" type (#+ Type Method)]]] [tool [compiler [analysis (#+ Arity)] @@ -17,24 +20,23 @@ [luxc [lang [host - ["$" jvm (#+ Label Inst Method Def Operation) - ["$t" type] + ["$" jvm (#+ Label Inst Def Operation) ["$d" def] ["_" inst]]]]] ["." // (#+ ByteCode)]) -(def: $Object $.Type ($t.class "java.lang.Object" (list))) -(def: $Object-Array $.Type ($t.array 1 $Object)) -(def: $String $.Type ($t.class "java.lang.String" (list))) -(def: #export $Stack $.Type ($t.array 1 $Object)) -(def: #export $Tuple $.Type $Object-Array) -(def: #export $Variant $.Type $Object-Array) -(def: #export $Tag $.Type $t.int) -(def: #export $Flag $.Type $Object) -(def: #export $Datum $.Type $Object) -(def: #export $Function $.Type ($t.class //.function-class (list))) -(def: $Throwable $.Type ($t.class "java.lang.Throwable" (list))) -(def: $Runtime $.Type ($t.class "java.lang.Runtime" (list))) +(def: $Object Type ($t.class "java.lang.Object" (list))) +(def: $Object-Array Type ($t.array 1 $Object)) +(def: $String Type ($t.class "java.lang.String" (list))) +(def: #export $Stack Type ($t.array 1 $Object)) +(def: #export $Tuple Type $Object-Array) +(def: #export $Variant Type $Object-Array) +(def: #export $Tag Type $t.int) +(def: #export $Flag Type $Object) +(def: #export $Datum Type $Object) +(def: #export $Function Type ($t.class //.function-class (list))) +(def: $Throwable Type ($t.class "java.lang.Throwable" (list))) +(def: $Runtime Type ($t.class "java.lang.Runtime" (list))) (def: #export logI Inst @@ -105,7 +107,7 @@ (def: adt-methods Def - (let [store-tagI (|>> _.DUP (_.int +0) (_.ILOAD 0) (_.wrap #$.Int) _.AASTORE) + (let [store-tagI (|>> _.DUP (_.int +0) (_.ILOAD 0) (_.wrap #$t.Int) _.AASTORE) store-flagI (|>> _.DUP (_.int +1) (_.ALOAD 1) _.AASTORE) store-valueI (|>> _.DUP (_.int +2) (_.ALOAD 2) _.AASTORE)] (|>> ($d.method #$.Public $.staticM "variant_make" @@ -127,7 +129,7 @@ (try-methodI (|>> (_.ALOAD 0) (_.INVOKESTATIC "java.lang.Double" "parseDouble" ($t.method (list $String) (#.Some $t.double) (list)) #0) - (_.wrap #$.Double)))) + (_.wrap #$t.Double)))) )) (def: pm-methods @@ -191,7 +193,7 @@ (function (_ idx) (|>> (_.int (.int idx)) _.AALOAD))) tagI (: Inst - (|>> (variant-partI 0) (_.unwrap #$.Int))) + (|>> (variant-partI 0) (_.unwrap #$t.Int))) flagI (variant-partI 1) datumI (variant-partI 2) shortenI (|>> (_.ALOAD 0) tagI ## Get tag -- cgit v1.2.3