diff options
Diffstat (limited to 'new-luxc/source/luxc/lang/translation/jvm/procedure/host.jvm.lux')
-rw-r--r-- | new-luxc/source/luxc/lang/translation/jvm/procedure/host.jvm.lux | 366 |
1 files changed, 183 insertions, 183 deletions
diff --git a/new-luxc/source/luxc/lang/translation/jvm/procedure/host.jvm.lux b/new-luxc/source/luxc/lang/translation/jvm/procedure/host.jvm.lux index ddf345a13..370f07f82 100644 --- a/new-luxc/source/luxc/lang/translation/jvm/procedure/host.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/jvm/procedure/host.jvm.lux @@ -19,7 +19,7 @@ (host ["$" jvm] (jvm ["$t" type] ["$d" def] - ["$i" inst])) + ["_" inst])) ["la" analysis] (extension (analysis ["&." host])) ["ls" synthesis])) @@ -38,47 +38,47 @@ $.Inst <inst>)] - [L2S (|>> $i.L2I $i.I2S)] - [L2B (|>> $i.L2I $i.I2B)] - [L2C (|>> $i.L2I $i.I2C)] + [L2S (|>> _.L2I _.I2S)] + [L2B (|>> _.L2I _.I2B)] + [L2C (|>> _.L2I _.I2C)] ) (do-template [<name> <unwrap> <conversion> <wrap>] [(def: (<name> inputI) @.Unary - (if (is? $i.NOP <conversion>) + (if (is? _.NOP <conversion>) (|>> inputI - ($i.unwrap <unwrap>) - ($i.wrap <wrap>)) + (_.unwrap <unwrap>) + (_.wrap <wrap>)) (|>> inputI - ($i.unwrap <unwrap>) + (_.unwrap <unwrap>) <conversion> - ($i.wrap <wrap>))))] + (_.wrap <wrap>))))] - [convert//double-to-float #$.Double $i.D2F #$.Float] - [convert//double-to-int #$.Double $i.D2I #$.Int] - [convert//double-to-long #$.Double $i.D2L #$.Long] - [convert//float-to-double #$.Float $i.F2D #$.Double] - [convert//float-to-int #$.Float $i.F2I #$.Int] - [convert//float-to-long #$.Float $i.F2L #$.Long] - [convert//int-to-byte #$.Int $i.I2B #$.Byte] - [convert//int-to-char #$.Int $i.I2C #$.Char] - [convert//int-to-double #$.Int $i.I2D #$.Double] - [convert//int-to-float #$.Int $i.I2F #$.Float] - [convert//int-to-long #$.Int $i.I2L #$.Long] - [convert//int-to-short #$.Int $i.I2S #$.Short] - [convert//long-to-double #$.Long $i.L2D #$.Double] - [convert//long-to-float #$.Long $i.L2F #$.Float] - [convert//long-to-int #$.Long $i.L2I #$.Int] + [convert//double-to-float #$.Double _.D2F #$.Float] + [convert//double-to-int #$.Double _.D2I #$.Int] + [convert//double-to-long #$.Double _.D2L #$.Long] + [convert//float-to-double #$.Float _.F2D #$.Double] + [convert//float-to-int #$.Float _.F2I #$.Int] + [convert//float-to-long #$.Float _.F2L #$.Long] + [convert//int-to-byte #$.Int _.I2B #$.Byte] + [convert//int-to-char #$.Int _.I2C #$.Char] + [convert//int-to-double #$.Int _.I2D #$.Double] + [convert//int-to-float #$.Int _.I2F #$.Float] + [convert//int-to-long #$.Int _.I2L #$.Long] + [convert//int-to-short #$.Int _.I2S #$.Short] + [convert//long-to-double #$.Long _.L2D #$.Double] + [convert//long-to-float #$.Long _.L2F #$.Float] + [convert//long-to-int #$.Long _.L2I #$.Int] [convert//long-to-short #$.Long L2S #$.Short] [convert//long-to-byte #$.Long L2B #$.Byte] [convert//long-to-char #$.Long L2C #$.Char] - [convert//char-to-byte #$.Char $i.I2B #$.Byte] - [convert//char-to-short #$.Char $i.I2S #$.Short] - [convert//char-to-int #$.Char $i.NOP #$.Int] - [convert//char-to-long #$.Char $i.I2L #$.Long] - [convert//byte-to-long #$.Byte $i.I2L #$.Long] - [convert//short-to-long #$.Short $i.I2L #$.Long] + [convert//char-to-byte #$.Char _.I2B #$.Byte] + [convert//char-to-short #$.Char _.I2S #$.Short] + [convert//char-to-int #$.Char _.NOP #$.Int] + [convert//char-to-long #$.Char _.I2L #$.Long] + [convert//byte-to-long #$.Byte _.I2L #$.Long] + [convert//short-to-long #$.Short _.I2L #$.Long] ) (def: conversion-procs @@ -114,96 +114,96 @@ (do-template [<name> <op> <unwrapX> <unwrapY> <wrap>] [(def: (<name> [xI yI]) @.Binary - (|>> xI ($i.unwrap <unwrapX>) - yI ($i.unwrap <unwrapY>) - <op> ($i.wrap <wrap>)))] - - [int//+ $i.IADD #$.Int #$.Int #$.Int] - [int//- $i.ISUB #$.Int #$.Int #$.Int] - [int//* $i.IMUL #$.Int #$.Int #$.Int] - [int/// $i.IDIV #$.Int #$.Int #$.Int] - [int//% $i.IREM #$.Int #$.Int #$.Int] - [int//and $i.IAND #$.Int #$.Int #$.Int] - [int//or $i.IOR #$.Int #$.Int #$.Int] - [int//xor $i.IXOR #$.Int #$.Int #$.Int] - [int//shl $i.ISHL #$.Int #$.Int #$.Int] - [int//shr $i.ISHR #$.Int #$.Int #$.Int] - [int//ushr $i.IUSHR #$.Int #$.Int #$.Int] + (|>> xI (_.unwrap <unwrapX>) + yI (_.unwrap <unwrapY>) + <op> (_.wrap <wrap>)))] + + [int//+ _.IADD #$.Int #$.Int #$.Int] + [int//- _.ISUB #$.Int #$.Int #$.Int] + [int//* _.IMUL #$.Int #$.Int #$.Int] + [int/// _.IDIV #$.Int #$.Int #$.Int] + [int//% _.IREM #$.Int #$.Int #$.Int] + [int//and _.IAND #$.Int #$.Int #$.Int] + [int//or _.IOR #$.Int #$.Int #$.Int] + [int//xor _.IXOR #$.Int #$.Int #$.Int] + [int//shl _.ISHL #$.Int #$.Int #$.Int] + [int//shr _.ISHR #$.Int #$.Int #$.Int] + [int//ushr _.IUSHR #$.Int #$.Int #$.Int] - [long//+ $i.LADD #$.Long #$.Long #$.Long] - [long//- $i.LSUB #$.Long #$.Long #$.Long] - [long//* $i.LMUL #$.Long #$.Long #$.Long] - [long/// $i.LDIV #$.Long #$.Long #$.Long] - [long//% $i.LREM #$.Long #$.Long #$.Long] - [long//and $i.LAND #$.Long #$.Long #$.Long] - [long//or $i.LOR #$.Long #$.Long #$.Long] - [long//xor $i.LXOR #$.Long #$.Long #$.Long] - [long//shl $i.LSHL #$.Long #$.Int #$.Long] - [long//shr $i.LSHR #$.Long #$.Int #$.Long] - [long//ushr $i.LUSHR #$.Long #$.Int #$.Long] - - [float//+ $i.FADD #$.Float #$.Float #$.Float] - [float//- $i.FSUB #$.Float #$.Float #$.Float] - [float//* $i.FMUL #$.Float #$.Float #$.Float] - [float/// $i.FDIV #$.Float #$.Float #$.Float] - [float//% $i.FREM #$.Float #$.Float #$.Float] + [long//+ _.LADD #$.Long #$.Long #$.Long] + [long//- _.LSUB #$.Long #$.Long #$.Long] + [long//* _.LMUL #$.Long #$.Long #$.Long] + [long/// _.LDIV #$.Long #$.Long #$.Long] + [long//% _.LREM #$.Long #$.Long #$.Long] + [long//and _.LAND #$.Long #$.Long #$.Long] + [long//or _.LOR #$.Long #$.Long #$.Long] + [long//xor _.LXOR #$.Long #$.Long #$.Long] + [long//shl _.LSHL #$.Long #$.Int #$.Long] + [long//shr _.LSHR #$.Long #$.Int #$.Long] + [long//ushr _.LUSHR #$.Long #$.Int #$.Long] + + [float//+ _.FADD #$.Float #$.Float #$.Float] + [float//- _.FSUB #$.Float #$.Float #$.Float] + [float//* _.FMUL #$.Float #$.Float #$.Float] + [float/// _.FDIV #$.Float #$.Float #$.Float] + [float//% _.FREM #$.Float #$.Float #$.Float] - [double//+ $i.DADD #$.Double #$.Double #$.Double] - [double//- $i.DSUB #$.Double #$.Double #$.Double] - [double//* $i.DMUL #$.Double #$.Double #$.Double] - [double/// $i.DDIV #$.Double #$.Double #$.Double] - [double//% $i.DREM #$.Double #$.Double #$.Double] + [double//+ _.DADD #$.Double #$.Double #$.Double] + [double//- _.DSUB #$.Double #$.Double #$.Double] + [double//* _.DMUL #$.Double #$.Double #$.Double] + [double/// _.DDIV #$.Double #$.Double #$.Double] + [double//% _.DREM #$.Double #$.Double #$.Double] ) (def: boolean-class ($t.class "java.lang.Boolean" (list))) -(def: falseI ($i.GETSTATIC "java.lang.Boolean" "FALSE" boolean-class)) -(def: trueI ($i.GETSTATIC "java.lang.Boolean" "TRUE" boolean-class)) +(def: falseI (_.GETSTATIC "java.lang.Boolean" "FALSE" boolean-class)) +(def: trueI (_.GETSTATIC "java.lang.Boolean" "TRUE" boolean-class)) (do-template [<name> <op> <unwrapX> <unwrapY> <wrap>] [(def: (<name> [xI yI]) @.Binary - (<| $i.with-label (function (_ @then)) - $i.with-label (function (_ @end)) - (|>> xI ($i.unwrap <unwrapX>) - yI ($i.unwrap <unwrapY>) + (<| _.with-label (function (_ @then)) + _.with-label (function (_ @end)) + (|>> xI (_.unwrap <unwrapX>) + yI (_.unwrap <unwrapY>) (<op> @then) falseI - ($i.GOTO @end) - ($i.label @then) + (_.GOTO @end) + (_.label @then) trueI - ($i.label @end))))] + (_.label @end))))] - [int//= $i.IF_ICMPEQ #$.Int #$.Int #$.Boolean] - [int//< $i.IF_ICMPLT #$.Int #$.Int #$.Boolean] + [int//= _.IF_ICMPEQ #$.Int #$.Int #$.Boolean] + [int//< _.IF_ICMPLT #$.Int #$.Int #$.Boolean] - [char//= $i.IF_ICMPEQ #$.Char #$.Char #$.Boolean] - [char//< $i.IF_ICMPLT #$.Char #$.Char #$.Boolean] + [char//= _.IF_ICMPEQ #$.Char #$.Char #$.Boolean] + [char//< _.IF_ICMPLT #$.Char #$.Char #$.Boolean] ) (do-template [<name> <op> <reference> <unwrapX> <unwrapY> <wrap>] [(def: (<name> [xI yI]) @.Binary - (<| $i.with-label (function (_ @then)) - $i.with-label (function (_ @end)) - (|>> xI ($i.unwrap <unwrapX>) - yI ($i.unwrap <unwrapY>) + (<| _.with-label (function (_ @then)) + _.with-label (function (_ @end)) + (|>> xI (_.unwrap <unwrapX>) + yI (_.unwrap <unwrapY>) <op> - ($i.int <reference>) - ($i.IF_ICMPEQ @then) + (_.int <reference>) + (_.IF_ICMPEQ @then) falseI - ($i.GOTO @end) - ($i.label @then) + (_.GOTO @end) + (_.label @then) trueI - ($i.label @end))))] + (_.label @end))))] - [long//= $i.LCMP 0 #$.Long #$.Long #$.Boolean] - [long//< $i.LCMP -1 #$.Long #$.Long #$.Boolean] + [long//= _.LCMP 0 #$.Long #$.Long #$.Boolean] + [long//< _.LCMP -1 #$.Long #$.Long #$.Boolean] - [float//= $i.FCMPG 0 #$.Float #$.Float #$.Boolean] - [float//< $i.FCMPG -1 #$.Float #$.Float #$.Boolean] + [float//= _.FCMPG 0 #$.Float #$.Float #$.Boolean] + [float//< _.FCMPG -1 #$.Float #$.Float #$.Boolean] - [double//= $i.DCMPG 0 #$.Double #$.Double #$.Boolean] - [double//< $i.DCMPG -1 #$.Double #$.Double #$.Boolean] + [double//= _.DCMPG 0 #$.Double #$.Double #$.Boolean] + [double//< _.DCMPG -1 #$.Double #$.Double #$.Boolean] ) (def: int-procs @@ -281,9 +281,9 @@ (def: (array//length arrayI) @.Unary (|>> arrayI - $i.ARRAYLENGTH - $i.I2L - ($i.wrap #$.Long))) + _.ARRAYLENGTH + _.I2L + (_.wrap #$.Long))) (def: (array//new proc translate inputs) (-> Text @.Proc) @@ -302,9 +302,9 @@ "char" $t.char _ ($t.class class (list))))]] (wrap (|>> lengthI - ($i.unwrap #$.Long) - $i.L2I - ($i.array arrayJT)))) + (_.unwrap #$.Long) + _.L2I + (_.array arrayJT)))) _ (&.throw @.Wrong-Syntax (@.wrong-syntax proc inputs)))) @@ -317,19 +317,19 @@ [arrayI (translate arrayS) idxI (translate idxS) #let [loadI (case class - "boolean" (|>> $i.BALOAD ($i.wrap #$.Boolean)) - "byte" (|>> $i.BALOAD ($i.wrap #$.Byte)) - "short" (|>> $i.SALOAD ($i.wrap #$.Short)) - "int" (|>> $i.IALOAD ($i.wrap #$.Int)) - "long" (|>> $i.LALOAD ($i.wrap #$.Long)) - "float" (|>> $i.FALOAD ($i.wrap #$.Float)) - "double" (|>> $i.DALOAD ($i.wrap #$.Double)) - "char" (|>> $i.CALOAD ($i.wrap #$.Char)) - _ $i.AALOAD)]] + "boolean" (|>> _.BALOAD (_.wrap #$.Boolean)) + "byte" (|>> _.BALOAD (_.wrap #$.Byte)) + "short" (|>> _.SALOAD (_.wrap #$.Short)) + "int" (|>> _.IALOAD (_.wrap #$.Int)) + "long" (|>> _.LALOAD (_.wrap #$.Long)) + "float" (|>> _.FALOAD (_.wrap #$.Float)) + "double" (|>> _.DALOAD (_.wrap #$.Double)) + "char" (|>> _.CALOAD (_.wrap #$.Char)) + _ _.AALOAD)]] (wrap (|>> arrayI idxI - ($i.unwrap #$.Long) - $i.L2I + (_.unwrap #$.Long) + _.L2I loadI))) _ @@ -344,20 +344,20 @@ idxI (translate idxS) valueI (translate valueS) #let [storeI (case class - "boolean" (|>> ($i.unwrap #$.Boolean) $i.BASTORE) - "byte" (|>> ($i.unwrap #$.Byte) $i.BASTORE) - "short" (|>> ($i.unwrap #$.Short) $i.SASTORE) - "int" (|>> ($i.unwrap #$.Int) $i.IASTORE) - "long" (|>> ($i.unwrap #$.Long) $i.LASTORE) - "float" (|>> ($i.unwrap #$.Float) $i.FASTORE) - "double" (|>> ($i.unwrap #$.Double) $i.DASTORE) - "char" (|>> ($i.unwrap #$.Char) $i.CASTORE) - _ $i.AASTORE)]] + "boolean" (|>> (_.unwrap #$.Boolean) _.BASTORE) + "byte" (|>> (_.unwrap #$.Byte) _.BASTORE) + "short" (|>> (_.unwrap #$.Short) _.SASTORE) + "int" (|>> (_.unwrap #$.Int) _.IASTORE) + "long" (|>> (_.unwrap #$.Long) _.LASTORE) + "float" (|>> (_.unwrap #$.Float) _.FASTORE) + "double" (|>> (_.unwrap #$.Double) _.DASTORE) + "char" (|>> (_.unwrap #$.Char) _.CASTORE) + _ _.AASTORE)]] (wrap (|>> arrayI - $i.DUP + _.DUP idxI - ($i.unwrap #$.Long) - $i.L2I + (_.unwrap #$.Long) + _.L2I valueI storeI))) @@ -376,33 +376,33 @@ (def: (object//null _) @.Nullary - $i.NULL) + _.NULL) (def: (object//null? objectI) @.Unary - (<| $i.with-label (function (_ @then)) - $i.with-label (function (_ @end)) + (<| _.with-label (function (_ @then)) + _.with-label (function (_ @end)) (|>> objectI - ($i.IFNULL @then) + (_.IFNULL @then) falseI - ($i.GOTO @end) - ($i.label @then) + (_.GOTO @end) + (_.label @then) trueI - ($i.label @end)))) + (_.label @end)))) (def: (object//synchronized [monitorI exprI]) @.Binary (|>> monitorI - $i.DUP - $i.MONITORENTER + _.DUP + _.MONITORENTER exprI - $i.SWAP - $i.MONITOREXIT)) + _.SWAP + _.MONITOREXIT)) (def: (object//throw exceptionI) @.Unary (|>> exceptionI - $i.ATHROW)) + _.ATHROW)) (def: (object//class proc translate inputs) (-> Text @.Proc) @@ -410,12 +410,12 @@ (^ (list [_ (#.Text class)])) (do macro.Monad<Meta> [] - (wrap (|>> ($i.string class) - ($i.INVOKESTATIC "java.lang.Class" "forName" - ($t.method (list ($t.class "java.lang.String" (list))) - (#.Some ($t.class "java.lang.Class" (list))) - (list)) - #0)))) + (wrap (|>> (_.string class) + (_.INVOKESTATIC "java.lang.Class" "forName" + ($t.method (list ($t.class "java.lang.String" (list))) + (#.Some ($t.class "java.lang.Class" (list))) + (list)) + #0)))) _ (&.throw @.Wrong-Syntax (@.wrong-syntax proc inputs)))) @@ -427,8 +427,8 @@ (do macro.Monad<Meta> [objectI (translate objectS)] (wrap (|>> objectI - ($i.INSTANCEOF class) - ($i.wrap #$.Boolean)))) + (_.INSTANCEOF class) + (_.wrap #$.Boolean)))) _ (&.throw @.Wrong-Syntax (@.wrong-syntax proc inputs)))) @@ -443,10 +443,10 @@ ## Wrap (^template [<primitive> <object> <type>] [<primitive> <object>] - (wrap (|>> valueI ($i.wrap <type>))) + (wrap (|>> valueI (_.wrap <type>))) [<object> <primitive>] - (wrap (|>> valueI ($i.unwrap <type>)))) + (wrap (|>> valueI (_.unwrap <type>)))) (["boolean" "java.lang.Boolean" #$.Boolean] ["byte" "java.lang.Byte" #$.Byte] ["short" "java.lang.Short" #$.Short] @@ -505,11 +505,11 @@ "double" #$.Double "char" #$.Char _ (undefined))] - (wrap (|>> ($i.GETSTATIC class field (#$.Primitive primitive)) - ($i.wrap primitive)))) + (wrap (|>> (_.GETSTATIC class field (#$.Primitive primitive)) + (_.wrap primitive)))) #.None - (wrap ($i.GETSTATIC class field ($t.class unboxed (list)))))) + (wrap (_.GETSTATIC class field ($t.class unboxed (list)))))) _ (&.throw @.Wrong-Syntax (@.wrong-syntax proc inputs)))) @@ -533,15 +533,15 @@ "char" #$.Char _ (undefined))] (wrap (|>> valueI - ($i.unwrap primitive) - ($i.PUTSTATIC class field (#$.Primitive primitive)) - ($i.string hostL.unit)))) + (_.unwrap primitive) + (_.PUTSTATIC class field (#$.Primitive primitive)) + (_.string hostL.unit)))) #.None (wrap (|>> valueI - ($i.CHECKCAST class) - ($i.PUTSTATIC class field ($t.class class (list))) - ($i.string hostL.unit))))) + (_.CHECKCAST class) + (_.PUTSTATIC class field ($t.class class (list))) + (_.string hostL.unit))))) _ (&.throw @.Wrong-Syntax (@.wrong-syntax proc inputs)))) @@ -565,14 +565,14 @@ "char" #$.Char _ (undefined))] (wrap (|>> objectI - ($i.CHECKCAST class) - ($i.GETFIELD class field (#$.Primitive primitive)) - ($i.wrap primitive)))) + (_.CHECKCAST class) + (_.GETFIELD class field (#$.Primitive primitive)) + (_.wrap primitive)))) #.None (wrap (|>> objectI - ($i.CHECKCAST class) - ($i.GETFIELD class field ($t.class unboxed (list))))))) + (_.CHECKCAST class) + (_.GETFIELD class field ($t.class unboxed (list))))))) _ (&.throw @.Wrong-Syntax (@.wrong-syntax proc inputs)))) @@ -597,19 +597,19 @@ "char" #$.Char _ (undefined))] (wrap (|>> objectI - ($i.CHECKCAST class) - $i.DUP + (_.CHECKCAST class) + _.DUP valueI - ($i.unwrap primitive) - ($i.PUTFIELD class field (#$.Primitive primitive))))) + (_.unwrap primitive) + (_.PUTFIELD class field (#$.Primitive primitive))))) #.None (wrap (|>> objectI - ($i.CHECKCAST class) - $i.DUP + (_.CHECKCAST class) + _.DUP valueI - ($i.CHECKCAST unboxed) - ($i.PUTFIELD class field ($t.class unboxed (list))))))) + (_.CHECKCAST unboxed) + (_.PUTFIELD class field ($t.class unboxed (list))))))) _ (&.throw @.Wrong-Syntax (@.wrong-syntax proc inputs)))) @@ -676,10 +676,10 @@ (do macro.Monad<Meta> [argsTI (monad.map @ (translate-arg translate) argsS) returnT (method-return-type unboxed)] - (wrap (|>> ($i.fuse (list/map product.right argsTI)) - ($i.INVOKESTATIC class method - ($t.method (list/map product.left argsTI) returnT (list)) - #0)))) + (wrap (|>> (_.fuse (list/map product.right argsTI)) + (_.INVOKESTATIC class method + ($t.method (list/map product.left argsTI) returnT (list)) + #0)))) _ (&.throw @.Wrong-Syntax (@.wrong-syntax proc inputs)))) @@ -695,8 +695,8 @@ argsTI (monad.map @ (translate-arg translate) argsS) returnT (method-return-type unboxed)] (wrap (|>> objectI - ($i.CHECKCAST class) - ($i.fuse (list/map product.right argsTI)) + (_.CHECKCAST class) + (_.fuse (list/map product.right argsTI)) (<invoke> class method ($t.method (list/map product.left argsTI) returnT (list)) <interface?>)))) @@ -704,9 +704,9 @@ _ (&.throw @.Wrong-Syntax (@.wrong-syntax proc inputs))))] - [invoke//virtual $i.INVOKEVIRTUAL #0] - [invoke//special $i.INVOKESPECIAL #0] - [invoke//interface $i.INVOKEINTERFACE #1] + [invoke//virtual _.INVOKEVIRTUAL #0] + [invoke//special _.INVOKESPECIAL #0] + [invoke//interface _.INVOKEINTERFACE #1] ) (def: (invoke//constructor proc translate inputs) @@ -715,12 +715,12 @@ (^ (list& [_ (#.Text class)] argsS)) (do macro.Monad<Meta> [argsTI (monad.map @ (translate-arg translate) argsS)] - (wrap (|>> ($i.NEW class) - $i.DUP - ($i.fuse (list/map product.right argsTI)) - ($i.INVOKESPECIAL class "<init>" - ($t.method (list/map product.left argsTI) #.None (list)) - #0)))) + (wrap (|>> (_.NEW class) + _.DUP + (_.fuse (list/map product.right argsTI)) + (_.INVOKESPECIAL class "<init>" + ($t.method (list/map product.left argsTI) #.None (list)) + #0)))) _ (&.throw @.Wrong-Syntax (@.wrong-syntax proc inputs)))) |