aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/source/luxc/lang/translation/jvm/runtime.lux
diff options
context:
space:
mode:
authorEduardo Julian2019-04-27 23:41:47 -0400
committerEduardo Julian2019-04-27 23:41:47 -0400
commitaf7f85c4eb724f2888ecce9c8b52d6d3bb1cd807 (patch)
tree9d2b80257b5c82ebcc9f17bd32e9771ea51cc708 /new-luxc/source/luxc/lang/translation/jvm/runtime.lux
parentaa7f1d12ae98da9726bf8bbdd3c494a671e3f94b (diff)
Moved JVM type machinery to stdlib.
Diffstat (limited to '')
-rw-r--r--new-luxc/source/luxc/lang/translation/jvm/runtime.lux38
1 files changed, 20 insertions, 18 deletions
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