From b14102eaa2a80f51f160ba293ec01928dbe683c3 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sun, 22 Jul 2018 02:52:46 -0400 Subject: - Some fixes due to recent changes in stdlib. - Removed some (now) useless modules. --- .../lang/translation/jvm/procedure/common.jvm.lux | 282 ++++++++++----------- 1 file changed, 141 insertions(+), 141 deletions(-) (limited to 'new-luxc/source/luxc/lang/translation/jvm/procedure/common.jvm.lux') diff --git a/new-luxc/source/luxc/lang/translation/jvm/procedure/common.jvm.lux b/new-luxc/source/luxc/lang/translation/jvm/procedure/common.jvm.lux index 6447ec20a..2334f9cc2 100644 --- a/new-luxc/source/luxc/lang/translation/jvm/procedure/common.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/jvm/procedure/common.jvm.lux @@ -20,7 +20,7 @@ (host ["$" jvm] (jvm ["$t" type] ["$d" def] - ["$i" inst])))) + ["_" inst])))) (/// [".T" runtime] [".T" case] [".T" function] @@ -110,32 +110,32 @@ (wrap (proc inputsI)))))) ## [Instructions] -(def: lux-intI $.Inst (|>> $i.I2L ($i.wrap #$.Long))) -(def: jvm-intI $.Inst (|>> ($i.unwrap #$.Long) $i.L2I)) +(def: lux-intI $.Inst (|>> _.I2L (_.wrap #$.Long))) +(def: jvm-intI $.Inst (|>> (_.unwrap #$.Long) _.L2I)) (def: (array-writeI arrayI idxI elemI) (-> $.Inst $.Inst $.Inst $.Inst) - (|>> arrayI ($i.CHECKCAST ($t.descriptor $Object-Array)) - $i.DUP + (|>> arrayI (_.CHECKCAST ($t.descriptor $Object-Array)) + _.DUP idxI jvm-intI elemI - $i.AASTORE)) + _.AASTORE)) (def: (predicateI tester) (-> (-> $.Label $.Inst) $.Inst) - (<| $i.with-label (function (_ @then)) - $i.with-label (function (_ @end)) + (<| _.with-label (function (_ @then)) + _.with-label (function (_ @end)) (|>> (tester @then) - ($i.GETSTATIC "java.lang.Boolean" "FALSE" ($t.class "java.lang.Boolean" (list))) - ($i.GOTO @end) - ($i.label @then) - ($i.GETSTATIC "java.lang.Boolean" "TRUE" ($t.class "java.lang.Boolean" (list))) - ($i.label @end) + (_.GETSTATIC "java.lang.Boolean" "FALSE" ($t.class "java.lang.Boolean" (list))) + (_.GOTO @end) + (_.label @then) + (_.GETSTATIC "java.lang.Boolean" "TRUE" ($t.class "java.lang.Boolean" (list))) + (_.label @end) ))) -(def: unitI $.Inst ($i.string hostL.unit)) +(def: unitI $.Inst (_.string hostL.unit)) ## [Procedures] ## [[Lux]] @@ -143,7 +143,7 @@ Binary (|>> leftI rightI - (predicateI $i.IF_ACMPEQ))) + (predicateI _.IF_ACMPEQ))) (def: (lux//if [testI thenI elseI]) Trinary @@ -152,10 +152,10 @@ (def: (lux//try riskyI) Unary (|>> riskyI - ($i.CHECKCAST hostL.function-class) - ($i.INVOKESTATIC hostL.runtime-class "try" - ($t.method (list $Function) (#.Some $Object-Array) (list)) - #0))) + (_.CHECKCAST hostL.function-class) + (_.INVOKESTATIC hostL.runtime-class "try" + ($t.method (list $Function) (#.Some $Object-Array) (list)) + #0))) (exception: #export (Wrong-Syntax {message Text}) message) @@ -187,48 +187,48 @@ (do-template [ ] [(def: ( [inputI maskI]) Binary - (|>> inputI ($i.unwrap #$.Long) - maskI ($i.unwrap #$.Long) - ($i.wrap #$.Long)))] + (|>> inputI (_.unwrap #$.Long) + maskI (_.unwrap #$.Long) + (_.wrap #$.Long)))] - [bit//and $i.LAND] - [bit//or $i.LOR] - [bit//xor $i.LXOR] + [bit//and _.LAND] + [bit//or _.LOR] + [bit//xor _.LXOR] ) (do-template [ ] [(def: ( [inputI shiftI]) Binary - (|>> inputI ($i.unwrap #$.Long) + (|>> inputI (_.unwrap #$.Long) shiftI jvm-intI - ($i.wrap #$.Long)))] + (_.wrap #$.Long)))] - [bit//left-shift $i.LSHL] - [bit//arithmetic-right-shift $i.LSHR] - [bit//logical-right-shift $i.LUSHR] + [bit//left-shift _.LSHL] + [bit//arithmetic-right-shift _.LSHR] + [bit//logical-right-shift _.LUSHR] ) ## [[Arrays]] (def: (array//new lengthI) Unary - (|>> lengthI jvm-intI ($i.ANEWARRAY ($t.binary-name "java.lang.Object")))) + (|>> lengthI jvm-intI (_.ANEWARRAY ($t.binary-name "java.lang.Object")))) (def: (array//get [arrayI idxI]) Binary - (<| $i.with-label (function (_ @is-null)) - $i.with-label (function (_ @end)) - (|>> arrayI ($i.CHECKCAST ($t.descriptor $Object-Array)) + (<| _.with-label (function (_ @is-null)) + _.with-label (function (_ @end)) + (|>> arrayI (_.CHECKCAST ($t.descriptor $Object-Array)) idxI jvm-intI - $i.AALOAD - $i.DUP - ($i.IFNULL @is-null) + _.AALOAD + _.DUP + (_.IFNULL @is-null) runtimeT.someI - ($i.GOTO @end) - ($i.label @is-null) - $i.POP + (_.GOTO @end) + (_.label @is-null) + _.POP runtimeT.noneI - ($i.label @end)))) + (_.label @end)))) (def: (array//put [arrayI idxI elemI]) Trinary @@ -236,12 +236,12 @@ (def: (array//remove [arrayI idxI]) Binary - (array-writeI arrayI idxI $i.NULL)) + (array-writeI arrayI idxI _.NULL)) (def: (array//size arrayI) Unary - (|>> arrayI ($i.CHECKCAST ($t.descriptor $Object-Array)) - $i.ARRAYLENGTH + (|>> arrayI (_.CHECKCAST ($t.descriptor $Object-Array)) + _.ARRAYLENGTH lux-intI)) ## [[Numbers]] @@ -252,32 +252,32 @@ (do-template [ ] [(def: ( _) Nullary - (|>> ($i.wrap )))] + (|>> (_.wrap )))] - [frac//smallest ($i.double Double::MIN_VALUE) #$.Double] - [frac//min ($i.double (f/* -1.0 Double::MAX_VALUE)) #$.Double] - [frac//max ($i.double Double::MAX_VALUE) #$.Double] + [frac//smallest (_.double Double::MIN_VALUE) #$.Double] + [frac//min (_.double (f/* -1.0 Double::MAX_VALUE)) #$.Double] + [frac//max (_.double Double::MAX_VALUE) #$.Double] ) (do-template [ ] [(def: ( [subjectI paramI]) Binary - (|>> subjectI ($i.unwrap ) - paramI ($i.unwrap ) + (|>> subjectI (_.unwrap ) + paramI (_.unwrap ) - ($i.wrap )))] + (_.wrap )))] - [int//add #$.Long $i.LADD] - [int//sub #$.Long $i.LSUB] - [int//mul #$.Long $i.LMUL] - [int//div #$.Long $i.LDIV] - [int//rem #$.Long $i.LREM] + [int//add #$.Long _.LADD] + [int//sub #$.Long _.LSUB] + [int//mul #$.Long _.LMUL] + [int//div #$.Long _.LDIV] + [int//rem #$.Long _.LREM] - [frac//add #$.Double $i.DADD] - [frac//sub #$.Double $i.DSUB] - [frac//mul #$.Double $i.DMUL] - [frac//div #$.Double $i.DDIV] - [frac//rem #$.Double $i.DREM] + [frac//add #$.Double _.DADD] + [frac//sub #$.Double _.DSUB] + [frac//mul #$.Double _.DMUL] + [frac//div #$.Double _.DDIV] + [frac//rem #$.Double _.DREM] ) (do-template [ ] @@ -287,13 +287,13 @@ (|>> subjectI paramI - ($i.int ) - (predicateI $i.IF_ICMPEQ)))] + (_.int ) + (predicateI _.IF_ICMPEQ)))] [ 0] [ -1])] - [int//eq int//lt ($i.unwrap #$.Long) $i.LCMP] - [frac//eq frac//lt ($i.unwrap #$.Double) $i.DCMPG] + [int//eq int//lt (_.unwrap #$.Long) _.LCMP] + [frac//eq frac//lt (_.unwrap #$.Double) _.DCMPG] ) (do-template [ ] @@ -301,15 +301,15 @@ Unary (|>> inputI ))] - [int//to-frac ($i.unwrap #$.Long) (<| ($i.wrap #$.Double) $i.L2D)] - [int//char ($i.unwrap #$.Long) - ((|>> $i.L2I $i.I2C ($i.INVOKESTATIC "java.lang.Character" "toString" ($t.method (list $t.char) (#.Some $String) (list)) #0)))] + [int//to-frac (_.unwrap #$.Long) (<| (_.wrap #$.Double) _.L2D)] + [int//char (_.unwrap #$.Long) + ((|>> _.L2I _.I2C (_.INVOKESTATIC "java.lang.Character" "toString" ($t.method (list $t.char) (#.Some $String) (list)) #0)))] - [frac//to-int ($i.unwrap #$.Double) (<| ($i.wrap #$.Long) $i.D2L)] - [frac//encode ($i.unwrap #$.Double) - ($i.INVOKESTATIC "java.lang.Double" "toString" ($t.method (list $t.double) (#.Some $String) (list)) #0)] - [frac//decode ($i.CHECKCAST "java.lang.String") - ($i.INVOKESTATIC hostL.runtime-class "decode_frac" ($t.method (list $String) (#.Some $Object-Array) (list)) #0)] + [frac//to-int (_.unwrap #$.Double) (<| (_.wrap #$.Long) _.D2L)] + [frac//encode (_.unwrap #$.Double) + (_.INVOKESTATIC "java.lang.Double" "toString" ($t.method (list $t.double) (#.Some $String) (list)) #0)] + [frac//decode (_.CHECKCAST "java.lang.String") + (_.INVOKESTATIC hostL.runtime-class "decode_frac" ($t.method (list $String) (#.Some $Object-Array) (list)) #0)] ) ## [[Text]] @@ -317,8 +317,8 @@ [(def: ( inputI) Unary (|>> inputI - ($i.CHECKCAST "java.lang.String") - ($i.INVOKEVIRTUAL ($t.method (list) (#.Some ) (list)) #0) + (_.CHECKCAST "java.lang.String") + (_.INVOKEVIRTUAL ($t.method (list) (#.Some ) (list)) #0) ))] [text//size "java.lang.String" "length" lux-intI $t.int] @@ -332,16 +332,16 @@ ))] [text//eq id id - ($i.INVOKEVIRTUAL "java.lang.Object" "equals" ($t.method (list $Object) (#.Some $t.boolean) (list)) #0) - ($i.wrap #$.Boolean)] - [text//lt ($i.CHECKCAST "java.lang.String") ($i.CHECKCAST "java.lang.String") - ($i.INVOKEVIRTUAL "java.lang.String" "compareTo" ($t.method (list $String) (#.Some $t.int) (list)) #0) - (<| (predicateI $i.IF_ICMPEQ) ($i.int -1))] - [text//concat ($i.CHECKCAST "java.lang.String") ($i.CHECKCAST "java.lang.String") - ($i.INVOKEVIRTUAL "java.lang.String" "concat" ($t.method (list $String) (#.Some $String) (list)) #0) + (_.INVOKEVIRTUAL "java.lang.Object" "equals" ($t.method (list $Object) (#.Some $t.boolean) (list)) #0) + (_.wrap #$.Boolean)] + [text//lt (_.CHECKCAST "java.lang.String") (_.CHECKCAST "java.lang.String") + (_.INVOKEVIRTUAL "java.lang.String" "compareTo" ($t.method (list $String) (#.Some $t.int) (list)) #0) + (<| (predicateI _.IF_ICMPEQ) (_.int -1))] + [text//concat (_.CHECKCAST "java.lang.String") (_.CHECKCAST "java.lang.String") + (_.INVOKEVIRTUAL "java.lang.String" "concat" ($t.method (list $String) (#.Some $String) (list)) #0) id] - [text//char ($i.CHECKCAST "java.lang.String") jvm-intI - ($i.INVOKESTATIC hostL.runtime-class "text_char" ($t.method (list $String $t.int) (#.Some $Variant) (list)) #0) + [text//char (_.CHECKCAST "java.lang.String") jvm-intI + (_.INVOKESTATIC hostL.runtime-class "text_char" ($t.method (list $String $t.int) (#.Some $Variant) (list)) #0) id] ) @@ -353,30 +353,30 @@ extraI ))] - [text//clip ($i.CHECKCAST "java.lang.String") jvm-intI jvm-intI - ($i.INVOKESTATIC hostL.runtime-class "text_clip" - ($t.method (list $String $t.int $t.int) (#.Some $Variant) (list)) #0)] + [text//clip (_.CHECKCAST "java.lang.String") jvm-intI jvm-intI + (_.INVOKESTATIC hostL.runtime-class "text_clip" + ($t.method (list $String $t.int $t.int) (#.Some $Variant) (list)) #0)] ) (def: index-method $.Method ($t.method (list $String $t.int) (#.Some $t.int) (list))) (def: (text//index [textI partI startI]) Trinary - (<| $i.with-label (function (_ @not-found)) - $i.with-label (function (_ @end)) - (|>> textI ($i.CHECKCAST "java.lang.String") - partI ($i.CHECKCAST "java.lang.String") + (<| _.with-label (function (_ @not-found)) + _.with-label (function (_ @end)) + (|>> textI (_.CHECKCAST "java.lang.String") + partI (_.CHECKCAST "java.lang.String") startI jvm-intI - ($i.INVOKEVIRTUAL "java.lang.String" "indexOf" index-method #0) - $i.DUP - ($i.int -1) - ($i.IF_ICMPEQ @not-found) + (_.INVOKEVIRTUAL "java.lang.String" "indexOf" index-method #0) + _.DUP + (_.int -1) + (_.IF_ICMPEQ @not-found) lux-intI runtimeT.someI - ($i.GOTO @end) - ($i.label @not-found) - $i.POP + (_.GOTO @end) + (_.label @not-found) + _.POP runtimeT.noneI - ($i.label @end)))) + (_.label @end)))) ## [[Math]] (def: math-unary-method ($t.method (list $t.double) (#.Some $t.double) (list))) @@ -386,9 +386,9 @@ [(def: ( inputI) Unary (|>> inputI - ($i.unwrap #$.Double) - ($i.INVOKESTATIC "java.lang.Math" math-unary-method #0) - ($i.wrap #$.Double)))] + (_.unwrap #$.Double) + (_.INVOKESTATIC "java.lang.Math" math-unary-method #0) + (_.wrap #$.Double)))] [math//cos "cos"] [math//sin "sin"] @@ -408,10 +408,10 @@ (do-template [ ] [(def: ( [inputI paramI]) Binary - (|>> inputI ($i.unwrap #$.Double) - paramI ($i.unwrap #$.Double) - ($i.INVOKESTATIC "java.lang.Math" math-binary-method #0) - ($i.wrap #$.Double)))] + (|>> inputI (_.unwrap #$.Double) + paramI (_.unwrap #$.Double) + (_.INVOKESTATIC "java.lang.Math" math-binary-method #0) + (_.wrap #$.Double)))] [math//atan2 "atan2"] [math//pow "pow"] @@ -420,103 +420,103 @@ (def: (math//round inputI) Unary (|>> inputI - ($i.unwrap #$.Double) - ($i.INVOKESTATIC "java.lang.Math" "round" ($t.method (list $t.double) (#.Some $t.long) (list)) #0) - $i.L2D - ($i.wrap #$.Double))) + (_.unwrap #$.Double) + (_.INVOKESTATIC "java.lang.Math" "round" ($t.method (list $t.double) (#.Some $t.long) (list)) #0) + _.L2D + (_.wrap #$.Double))) ## [[IO]] (def: string-method $.Method ($t.method (list $String) #.None (list))) (def: (io//log messageI) Unary - (|>> ($i.GETSTATIC "java.lang.System" "out" ($t.class "java.io.PrintStream" (list))) + (|>> (_.GETSTATIC "java.lang.System" "out" ($t.class "java.io.PrintStream" (list))) messageI - ($i.CHECKCAST "java.lang.String") - ($i.INVOKEVIRTUAL "java.io.PrintStream" "println" string-method #0) + (_.CHECKCAST "java.lang.String") + (_.INVOKEVIRTUAL "java.io.PrintStream" "println" string-method #0) unitI)) (def: (io//error messageI) Unary - (|>> ($i.NEW "java.lang.Error") - $i.DUP + (|>> (_.NEW "java.lang.Error") + _.DUP messageI - ($i.CHECKCAST "java.lang.String") - ($i.INVOKESPECIAL "java.lang.Error" "" string-method #0) - $i.ATHROW)) + (_.CHECKCAST "java.lang.String") + (_.INVOKESPECIAL "java.lang.Error" "" string-method #0) + _.ATHROW)) (def: (io//exit codeI) Unary (|>> codeI jvm-intI - ($i.INVOKESTATIC "java.lang.System" "exit" ($t.method (list $t.int) #.None (list)) #0) - $i.NULL)) + (_.INVOKESTATIC "java.lang.System" "exit" ($t.method (list $t.int) #.None (list)) #0) + _.NULL)) (def: (io//current-time []) Nullary - (|>> ($i.INVOKESTATIC "java.lang.System" "currentTimeMillis" ($t.method (list) (#.Some $t.long) (list)) #0) - ($i.wrap #$.Long))) + (|>> (_.INVOKESTATIC "java.lang.System" "currentTimeMillis" ($t.method (list) (#.Some $t.long) (list)) #0) + (_.wrap #$.Long))) ## [[Atoms]] (def: atom-class Text "java.util.concurrent.atomic.AtomicReference") (def: (atom//new initI) Unary - (|>> ($i.NEW atom-class) - $i.DUP + (|>> (_.NEW atom-class) + _.DUP initI - ($i.INVOKESPECIAL atom-class "" ($t.method (list $Object) #.None (list)) #0))) + (_.INVOKESPECIAL atom-class "" ($t.method (list $Object) #.None (list)) #0))) (def: (atom//read atomI) Unary (|>> atomI - ($i.CHECKCAST atom-class) - ($i.INVOKEVIRTUAL atom-class "get" ($t.method (list) (#.Some $Object) (list)) #0))) + (_.CHECKCAST atom-class) + (_.INVOKEVIRTUAL atom-class "get" ($t.method (list) (#.Some $Object) (list)) #0))) (def: (atom//compare-and-swap [atomI oldI newI]) Trinary (|>> atomI - ($i.CHECKCAST atom-class) + (_.CHECKCAST atom-class) oldI newI - ($i.INVOKEVIRTUAL atom-class "compareAndSet" ($t.method (list $Object $Object) (#.Some $t.boolean) (list)) #0) - ($i.wrap #$.Boolean))) + (_.INVOKEVIRTUAL atom-class "compareAndSet" ($t.method (list $Object $Object) (#.Some $t.boolean) (list)) #0) + (_.wrap #$.Boolean))) ## [[Box]] (def: empty-boxI $.Inst - (|>> ($i.int 1) ($i.ANEWARRAY ($t.binary-name "java.lang.Object")))) + (|>> (_.int 1) (_.ANEWARRAY ($t.binary-name "java.lang.Object")))) (def: check-boxI $.Inst - ($i.CHECKCAST ($t.descriptor $Object-Array))) + (_.CHECKCAST ($t.descriptor $Object-Array))) (def: (box//new initI) Unary (|>> empty-boxI - $i.DUP ($i.int 0) initI $i.AASTORE)) + _.DUP (_.int 0) initI _.AASTORE)) (def: (box//read boxI) Unary (|>> boxI check-boxI - ($i.int 0) $i.AALOAD)) + (_.int 0) _.AALOAD)) (def: (box//write [valueI boxI]) Binary (|>> boxI check-boxI - ($i.int 0) valueI $i.AASTORE + (_.int 0) valueI _.AASTORE unitI)) ## [[Processes]] (def: (process//parallelism-level []) Nullary - (|>> ($i.INVOKESTATIC "java.lang.Runtime" "getRuntime" ($t.method (list) (#.Some ($t.class "java.lang.Runtime" (list))) (list)) #0) - ($i.INVOKEVIRTUAL "java.lang.Runtime" "availableProcessors" ($t.method (list) (#.Some $t.int) (list)) #0) + (|>> (_.INVOKESTATIC "java.lang.Runtime" "getRuntime" ($t.method (list) (#.Some ($t.class "java.lang.Runtime" (list))) (list)) #0) + (_.INVOKEVIRTUAL "java.lang.Runtime" "availableProcessors" ($t.method (list) (#.Some $t.int) (list)) #0) lux-intI)) (def: (process//schedule [millisecondsI procedureI]) Binary - (|>> millisecondsI ($i.unwrap #$.Long) - procedureI ($i.CHECKCAST hostL.function-class) - ($i.INVOKESTATIC hostL.runtime-class "schedule" - ($t.method (list $t.long $Function) (#.Some $Object) (list)) #0))) + (|>> millisecondsI (_.unwrap #$.Long) + procedureI (_.CHECKCAST hostL.function-class) + (_.INVOKESTATIC hostL.runtime-class "schedule" + ($t.method (list $t.long $Function) (#.Some $Object) (list)) #0))) ## [Bundles] (def: lux-procs -- cgit v1.2.3