aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/source/luxc/lang/host/jvm/inst.lux
diff options
context:
space:
mode:
authorEduardo Julian2018-06-15 00:11:33 -0400
committerEduardo Julian2018-06-15 00:11:33 -0400
commitbcd3d9ee8f6797f758a2abea98d5cb6a74cc7df0 (patch)
treeb122b9ecf2d5333ba97cffbadfeee00eba2e1cf8 /new-luxc/source/luxc/lang/host/jvm/inst.lux
parent0190e084c6f44be32ea2bc5a89ef55b52bdc789b (diff)
- WIP: Adjustments to new-luxc based on recent changes to stdlib.
Diffstat (limited to '')
-rw-r--r--new-luxc/source/luxc/lang/host/jvm/inst.lux126
1 files changed, 63 insertions, 63 deletions
diff --git a/new-luxc/source/luxc/lang/host/jvm/inst.lux b/new-luxc/source/luxc/lang/host/jvm/inst.lux
index d088c5324..671a2bb3c 100644
--- a/new-luxc/source/luxc/lang/host/jvm/inst.lux
+++ b/new-luxc/source/luxc/lang/host/jvm/inst.lux
@@ -1,5 +1,5 @@
(.module:
- [lux #- char]
+ [lux #- int char]
(lux (control monad
["p" parser])
(data [maybe]
@@ -11,8 +11,8 @@
(macro [code]
["s" syntax #+ syntax:])
[function])
- ["$" //]
- (// ["$t" type]))
+ [//]
+ [//type])
## [Host]
(host.import #long java/lang/Object)
@@ -117,12 +117,12 @@
(#e.Success [compiler (Label::new [])])))
(def: #export (with-label action)
- (-> (-> Label $.Inst) $.Inst)
+ (-> (-> Label //.Inst) //.Inst)
(action (Label::new [])))
(do-template [<name> <type> <prepare>]
[(def: #export (<name> value)
- (-> <type> $.Inst)
+ (-> <type> //.Inst)
(function (_ visitor)
(do-to visitor
(MethodVisitor::visitLdcInsn [(<prepare> value)]))))]
@@ -131,7 +131,7 @@
[int Int host.long-to-int]
[long Int id]
[double Frac id]
- [char Nat (|>> nat-to-int host.long-to-int host.int-to-char)]
+ [char Nat (|>> .int host.long-to-int host.int-to-char)]
[string Text id]
)
@@ -139,14 +139,14 @@
(wrap (list (code.local-symbol (format "Opcodes::" base)))))
(def: #export NULL
- $.Inst
+ //.Inst
(function (_ visitor)
(do-to visitor
(MethodVisitor::visitInsn [(prefix ACONST_NULL)]))))
(do-template [<name>]
[(def: #export <name>
- $.Inst
+ //.Inst
(function (_ visitor)
(do-to visitor
(MethodVisitor::visitInsn [(prefix <name>)]))))]
@@ -207,10 +207,10 @@
(do-template [<name>]
[(def: #export (<name> register)
- (-> Nat $.Inst)
+ (-> Nat //.Inst)
(function (_ visitor)
(do-to visitor
- (MethodVisitor::visitVarInsn [(prefix <name>) (nat-to-int register)]))))]
+ (MethodVisitor::visitVarInsn [(prefix <name>) (.int register)]))))]
[ILOAD] [LLOAD] [DLOAD] [ALOAD]
[ISTORE] [LSTORE] [ASTORE]
@@ -218,10 +218,10 @@
(do-template [<name> <inst>]
[(def: #export (<name> class field type)
- (-> Text Text $.Type $.Inst)
+ (-> Text Text //.Type //.Inst)
(function (_ visitor)
(do-to visitor
- (MethodVisitor::visitFieldInsn [<inst> ($t.binary-name class) field ($t.descriptor type)]))))]
+ (MethodVisitor::visitFieldInsn [<inst> (//type.binary-name class) field (//type.descriptor type)]))))]
[GETSTATIC Opcodes::GETSTATIC]
[PUTSTATIC Opcodes::PUTSTATIC]
@@ -232,10 +232,10 @@
(do-template [<name> <inst>]
[(def: #export (<name> class)
- (-> Text $.Inst)
+ (-> Text //.Inst)
(function (_ visitor)
(do-to visitor
- (MethodVisitor::visitTypeInsn [<inst> ($t.binary-name class)]))))]
+ (MethodVisitor::visitTypeInsn [<inst> (//type.binary-name class)]))))]
[CHECKCAST Opcodes::CHECKCAST]
[NEW Opcodes::NEW]
@@ -244,25 +244,25 @@
)
(def: #export (NEWARRAY type)
- (-> $.Primitive $.Inst)
+ (-> //.Primitive //.Inst)
(function (_ visitor)
(do-to visitor
(MethodVisitor::visitIntInsn [Opcodes::NEWARRAY (case type
- #$.Boolean Opcodes::T_BOOLEAN
- #$.Byte Opcodes::T_BYTE
- #$.Short Opcodes::T_SHORT
- #$.Int Opcodes::T_INT
- #$.Long Opcodes::T_LONG
- #$.Float Opcodes::T_FLOAT
- #$.Double Opcodes::T_DOUBLE
- #$.Char Opcodes::T_CHAR)]))))
+ #//.Boolean Opcodes::T_BOOLEAN
+ #//.Byte Opcodes::T_BYTE
+ #//.Short Opcodes::T_SHORT
+ #//.Int Opcodes::T_INT
+ #//.Long Opcodes::T_LONG
+ #//.Float Opcodes::T_FLOAT
+ #//.Double Opcodes::T_DOUBLE
+ #//.Char Opcodes::T_CHAR)]))))
(do-template [<name> <inst>]
[(def: #export (<name> class method-name method-signature interface?)
- (-> Text Text $.Method Bool $.Inst)
+ (-> Text Text //.Method Bool //.Inst)
(function (_ visitor)
(do-to visitor
- (MethodVisitor::visitMethodInsn [<inst> ($t.binary-name class) method-name ($t.method-descriptor method-signature) interface?]))))]
+ (MethodVisitor::visitMethodInsn [<inst> (//type.binary-name class) method-name (//type.method-descriptor method-signature) interface?]))))]
[INVOKESTATIC Opcodes::INVOKESTATIC]
[INVOKEVIRTUAL Opcodes::INVOKEVIRTUAL]
@@ -272,7 +272,7 @@
(do-template [<name>]
[(def: #export (<name> @where)
- (-> $.Label $.Inst)
+ (-> //.Label //.Inst)
(function (_ visitor)
(do-to visitor
(MethodVisitor::visitJumpInsn [(prefix <name>) @where]))))]
@@ -283,7 +283,7 @@
)
(def: #export (TABLESWITCH min max default labels)
- (-> Int Int $.Label (List $.Label) $.Inst)
+ (-> Int Int //.Label (List //.Label) //.Inst)
(function (_ visitor)
(let [num-labels (list.size labels)
labels-array (host.array Label num-labels)
@@ -292,84 +292,84 @@
(exec (host.array-write idx
(maybe.assume (list.nth idx labels))
labels-array)
- (recur (n/inc idx)))
+ (recur (inc idx)))
[]))]
(do-to visitor
(MethodVisitor::visitTableSwitchInsn [min max default labels-array])))))
(def: #export (try @from @to @handler exception)
- (-> $.Label $.Label $.Label Text $.Inst)
+ (-> //.Label //.Label //.Label Text //.Inst)
(function (_ visitor)
(do-to visitor
- (MethodVisitor::visitTryCatchBlock [@from @to @handler ($t.binary-name exception)]))))
+ (MethodVisitor::visitTryCatchBlock [@from @to @handler (//type.binary-name exception)]))))
(def: #export (label @label)
- (-> $.Label $.Inst)
+ (-> //.Label //.Inst)
(function (_ visitor)
(do-to visitor
(MethodVisitor::visitLabel [@label]))))
(def: #export (array type)
- (-> $.Type $.Inst)
+ (-> //.Type //.Inst)
(case type
- (#$.Primitive prim)
+ (#//.Primitive prim)
(NEWARRAY prim)
- (#$.Generic generic)
+ (#//.Generic generic)
(let [elem-class (case generic
- (#$.Class class params)
- ($t.binary-name class)
+ (#//.Class class params)
+ (//type.binary-name class)
_
- ($t.binary-name "java.lang.Object"))]
+ (//type.binary-name "java.lang.Object"))]
(ANEWARRAY elem-class))
_
- (ANEWARRAY ($t.descriptor type))))
+ (ANEWARRAY (//type.descriptor type))))
(def: (primitive-wrapper type)
- (-> $.Primitive Text)
+ (-> //.Primitive Text)
(case type
- #$.Boolean "java.lang.Boolean"
- #$.Byte "java.lang.Byte"
- #$.Short "java.lang.Short"
- #$.Int "java.lang.Integer"
- #$.Long "java.lang.Long"
- #$.Float "java.lang.Float"
- #$.Double "java.lang.Double"
- #$.Char "java.lang.Character"))
+ #//.Boolean "java.lang.Boolean"
+ #//.Byte "java.lang.Byte"
+ #//.Short "java.lang.Short"
+ #//.Int "java.lang.Integer"
+ #//.Long "java.lang.Long"
+ #//.Float "java.lang.Float"
+ #//.Double "java.lang.Double"
+ #//.Char "java.lang.Character"))
(def: (primitive-unwrap type)
- (-> $.Primitive Text)
+ (-> //.Primitive Text)
(case type
- #$.Boolean "booleanValue"
- #$.Byte "byteValue"
- #$.Short "shortValue"
- #$.Int "intValue"
- #$.Long "longValue"
- #$.Float "floatValue"
- #$.Double "doubleValue"
- #$.Char "charValue"))
+ #//.Boolean "booleanValue"
+ #//.Byte "byteValue"
+ #//.Short "shortValue"
+ #//.Int "intValue"
+ #//.Long "longValue"
+ #//.Float "floatValue"
+ #//.Double "doubleValue"
+ #//.Char "charValue"))
(def: #export (wrap type)
- (-> $.Primitive $.Inst)
+ (-> //.Primitive //.Inst)
(let [class (primitive-wrapper type)]
(|>> (INVOKESTATIC class "valueOf"
- ($t.method (list (#$.Primitive type))
- (#.Some ($t.class class (list)))
- (list))
+ (//type.method (list (#//.Primitive type))
+ (#.Some (//type.class class (list)))
+ (list))
false))))
(def: #export (unwrap type)
- (-> $.Primitive $.Inst)
+ (-> //.Primitive //.Inst)
(let [class (primitive-wrapper type)]
(|>> (CHECKCAST class)
(INVOKEVIRTUAL class (primitive-unwrap type)
- ($t.method (list) (#.Some (#$.Primitive type)) (list))
+ (//type.method (list) (#.Some (#//.Primitive type)) (list))
false))))
(def: #export (fuse insts)
- (-> (List $.Inst) $.Inst)
+ (-> (List //.Inst) //.Inst)
(case insts
#.Nil
id