diff options
author | Eduardo Julian | 2018-04-06 08:32:41 -0400 |
---|---|---|
committer | Eduardo Julian | 2018-04-06 08:32:41 -0400 |
commit | ca238f9c89d3156842b0a3d5fe24a5d69b2eedb0 (patch) | |
tree | 50ba106541f2357daf27393df28e8b263f7311e1 /new-luxc/source/luxc/lang/translation/jvm/runtime.jvm.lux | |
parent | 84d7e87817cd2c074653b34d028c8fa807febc7f (diff) |
- Adapted new-luxc's code to latest stdlib changes.
Diffstat (limited to 'new-luxc/source/luxc/lang/translation/jvm/runtime.jvm.lux')
-rw-r--r-- | new-luxc/source/luxc/lang/translation/jvm/runtime.jvm.lux | 96 |
1 files changed, 48 insertions, 48 deletions
diff --git a/new-luxc/source/luxc/lang/translation/jvm/runtime.jvm.lux b/new-luxc/source/luxc/lang/translation/jvm/runtime.jvm.lux index 2cd1c75a9..b394a7f53 100644 --- a/new-luxc/source/luxc/lang/translation/jvm/runtime.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/jvm/runtime.jvm.lux @@ -32,7 +32,7 @@ (def: #export logI $.Inst (let [outI ($i.GETSTATIC "java.lang.System" "out" ($t.class "java.io.PrintStream" (list))) - printI (function [method] ($i.INVOKEVIRTUAL "java.io.PrintStream" method ($t.method (list $Object) #.None (list)) false))] + printI (function (_ method) ($i.INVOKEVIRTUAL "java.io.PrintStream" method ($t.method (list $Object) #.None (list)) false))] (|>> outI ($i.string "LOG: ") (printI "print") outI $i.SWAP (printI "println")))) @@ -71,9 +71,9 @@ (def: (try-methodI unsafeI) (-> $.Inst $.Inst) - (<| $i.with-label (function [@from]) - $i.with-label (function [@to]) - $i.with-label (function [@handler]) + (<| $i.with-label (function (_ @from)) + $i.with-label (function (_ @to)) + $i.with-label (function (_ @handler)) (|>> ($i.try @from @to @handler "java.lang.Exception") ($i.label @from) unsafeI @@ -103,13 +103,13 @@ store-valueI (|>> $i.DUP ($i.int 2) ($i.ALOAD +2) $i.AASTORE) force-textMT ($t.method (list $Object) (#.Some $String) (list))] (|>> ($d.method #$.Public $.staticM "force_text" force-textMT - (<| $i.with-label (function [@is-null]) - $i.with-label (function [@normal-object]) - $i.with-label (function [@array-loop]) - $i.with-label (function [@within-bounds]) - $i.with-label (function [@is-first]) - $i.with-label (function [@elem-end]) - $i.with-label (function [@fold-end]) + (<| $i.with-label (function (_ @is-null)) + $i.with-label (function (_ @normal-object)) + $i.with-label (function (_ @array-loop)) + $i.with-label (function (_ @within-bounds)) + $i.with-label (function (_ @is-first)) + $i.with-label (function (_ @elem-end)) + $i.with-label (function (_ @fold-end)) (let [on-normal-objectI (|>> ($i.ALOAD +0) ($i.INVOKEVIRTUAL "java.lang.Object" "toString" ($t.method (list) (#.Some $String) (list)) false)) on-null-objectI ($i.string "NULL") @@ -170,7 +170,7 @@ (def: nat-methods $.Def (let [compare-nat-method ($t.method (list $t.long $t.long) (#.Some $t.int) (list)) - less-thanI (function [@where] (|>> ($i.INVOKESTATIC hostL.runtime-class "compare_nat" compare-nat-method false) ($i.IFLT @where))) + less-thanI (function (_ @where) (|>> ($i.INVOKESTATIC hostL.runtime-class "compare_nat" compare-nat-method false) ($i.IFLT @where))) $BigInteger ($t.class "java.math.BigInteger" (list)) upcast-method ($t.method (list $t.long) (#.Some $BigInteger) (list)) div-method ($t.method (list $t.long $t.long) (#.Some $t.long) (list)) @@ -178,14 +178,14 @@ downcastI ($i.INVOKEVIRTUAL "java.math.BigInteger" "longValue" ($t.method (list) (#.Some $t.long) (list)) false)] (|>> ($d.method #$.Public $.staticM "_toUnsignedBigInteger" upcast-method (let [upcastI ($i.INVOKESTATIC "java.math.BigInteger" "valueOf" upcast-method false) - discernI (function [@where] (|>> ($i.LLOAD +0) ($i.long 0) $i.LCMP ($i.IFGE @where))) + discernI (function (_ @where) (|>> ($i.LLOAD +0) ($i.long 0) $i.LCMP ($i.IFGE @where))) prepare-upperI (|>> ($i.LLOAD +0) ($i.int 32) $i.LUSHR upcastI ($i.int 32) ($i.INVOKEVIRTUAL "java.math.BigInteger" "shiftLeft" ($t.method (list $t.int) (#.Some $BigInteger) (list)) false)) prepare-lowerI (|>> ($i.LLOAD +0) ($i.int 32) $i.LSHL ($i.int 32) $i.LUSHR upcastI)] - (<| $i.with-label (function [@simple]) + (<| $i.with-label (function (_ @simple)) (|>> (discernI @simple) ## else prepare-upperI @@ -204,13 +204,13 @@ $i.LCMP $i.IRETURN))) ($d.method #$.Public $.staticM "div_nat" div-method - (let [is-param-largeI (function [@where] (|>> ($i.LLOAD +2) ($i.long 0) $i.LCMP ($i.IFLT @where))) - is-subject-smallI (function [@where] (|>> ($i.LLOAD +0) ($i.long 0) $i.LCMP ($i.IFGT @where))) + (let [is-param-largeI (function (_ @where) (|>> ($i.LLOAD +2) ($i.long 0) $i.LCMP ($i.IFLT @where))) + is-subject-smallI (function (_ @where) (|>> ($i.LLOAD +0) ($i.long 0) $i.LCMP ($i.IFGT @where))) small-division (|>> ($i.LLOAD +0) ($i.LLOAD +2) $i.LDIV $i.LRETURN) big-divisionI ($i.INVOKEVIRTUAL "java.math.BigInteger" "divide" ($t.method (list $BigInteger) (#.Some $BigInteger) (list)) false)] - (<| $i.with-label (function [@is-zero]) - $i.with-label (function [@param-is-large]) - $i.with-label (function [@subject-is-small]) + (<| $i.with-label (function (_ @is-zero)) + $i.with-label (function (_ @param-is-large)) + $i.with-label (function (_ @subject-is-small)) (|>> (is-param-largeI @param-is-large) ## Param is not too large (is-subject-smallI @subject-is-small) @@ -233,12 +233,12 @@ ($i.label @is-zero) ($i.long 0) $i.LRETURN)))) ($d.method #$.Public $.staticM "rem_nat" div-method - (let [is-subject-largeI (function [@where] (|>> ($i.LLOAD +0) ($i.long 0) $i.LCMP ($i.IFLE @where))) - is-param-largeI (function [@where] (|>> ($i.LLOAD +2) ($i.long 0) $i.LCMP ($i.IFLE @where))) + (let [is-subject-largeI (function (_ @where) (|>> ($i.LLOAD +0) ($i.long 0) $i.LCMP ($i.IFLE @where))) + is-param-largeI (function (_ @where) (|>> ($i.LLOAD +2) ($i.long 0) $i.LCMP ($i.IFLE @where))) small-remainderI (|>> ($i.LLOAD +0) ($i.LLOAD +2) $i.LREM $i.LRETURN) big-remainderI ($i.INVOKEVIRTUAL "java.math.BigInteger" "remainder" ($t.method (list $BigInteger) (#.Some $BigInteger) (list)) false)] - (<| $i.with-label (function [@large-number]) - $i.with-label (function [@subject-is-smaller-than-param]) + (<| $i.with-label (function (_ @large-number)) + $i.with-label (function (_ @subject-is-smaller-than-param)) (|>> (is-subject-largeI @large-number) (is-param-largeI @large-number) small-remainderI @@ -315,11 +315,11 @@ topI $i.LADD $i.LRETURN))) ($d.method #$.Public $.staticM "count_leading_zeros" clz-method - (let [when-zeroI (function [@where] (|>> ($i.long 0) $i.LCMP ($i.IFEQ @where))) - shift-rightI (function [amount] (|>> ($i.int amount) $i.LUSHR)) + (let [when-zeroI (function (_ @where) (|>> ($i.long 0) $i.LCMP ($i.IFEQ @where))) + shift-rightI (function (_ amount) (|>> ($i.int amount) $i.LUSHR)) decI (|>> ($i.int 1) $i.ISUB)] - (<| $i.with-label (function [@start]) - $i.with-label (function [@done]) + (<| $i.with-label (function (_ @start)) + $i.with-label (function (_ @done)) (|>> ($i.int 64) ($i.label @start) ($i.LLOAD +0) (when-zeroI @done) @@ -329,10 +329,10 @@ ($i.label @done) $i.IRETURN)))) ($d.method #$.Public $.staticM "div_deg" deg-method - (<| $i.with-label (function [@same]) + (<| $i.with-label (function (_ @same)) (let [subjectI ($i.LLOAD +0) paramI ($i.LLOAD +2) - equal?I (function [@where] (|>> $i.LCMP ($i.IFEQ @where))) + equal?I (function (_ @where) (|>> $i.LCMP ($i.IFEQ @where))) count-leading-zerosI ($i.INVOKESTATIC hostL.runtime-class "count_leading_zeros" clz-method false) calc-max-shiftI (|>> subjectI count-leading-zerosI paramI count-leading-zerosI @@ -424,14 +424,14 @@ $i.AALOAD $i.ARETURN)) ($d.method #$.Public $.staticM "pm_variant" ($t.method (list $Variant $Tag $Flag) (#.Some $Object) (list)) - (<| $i.with-label (function [@begin]) - $i.with-label (function [@just-return]) - $i.with-label (function [@then]) - $i.with-label (function [@further]) - $i.with-label (function [@shorten]) - $i.with-label (function [@wrong]) + (<| $i.with-label (function (_ @begin)) + $i.with-label (function (_ @just-return)) + $i.with-label (function (_ @then)) + $i.with-label (function (_ @further)) + $i.with-label (function (_ @shorten)) + $i.with-label (function (_ @wrong)) (let [variant-partI (: (-> Nat $.Inst) - (function [idx] + (function (_ idx) (|>> ($i.int (nat-to-int idx)) $i.AALOAD))) tagI (: $.Inst (|>> (variant-partI +0) ($i.unwrap #$.Int))) @@ -476,8 +476,8 @@ ## $i.POP2 failureI))) ($d.method #$.Public $.staticM "pm_left" ($t.method (list $Tuple $t.int) (#.Some $Object) (list)) - (<| $i.with-label (function [@begin]) - $i.with-label (function [@not-recursive]) + (<| $i.with-label (function (_ @begin)) + $i.with-label (function (_ @not-recursive)) (let [updated-idxI (|>> $i.SWAP $i.ISUB)]) (|>> ($i.label @begin) tuple-sizeI @@ -492,9 +492,9 @@ tuple-elemI $i.ARETURN))) ($d.method #$.Public $.staticM "pm_right" ($t.method (list $Tuple $t.int) (#.Some $Object) (list)) - (<| $i.with-label (function [@begin]) - $i.with-label (function [@tail]) - $i.with-label (function [@slice]) + (<| $i.with-label (function (_ @begin)) + $i.with-label (function (_ @tail)) + $i.with-label (function (_ @slice)) (let [updated-idxI (|>> ($i.ILOAD +1) ($i.int 1) $i.IADD tuple-sizeI $i.ISUB) sliceI (|>> ($i.ALOAD +0) ($i.ILOAD +1) tuple-sizeI ($i.INVOKESTATIC "java.util.Arrays" "copyOfRange" ($t.method (list $Object-Array $t.int $t.int) (#.Some $Object-Array) (list)) false))]) @@ -530,9 +530,9 @@ ($i.INVOKESPECIAL "java.io.PrintWriter" "<init>" ($t.method (list ($t.class "java.io.Writer" (list)) $t.boolean) #.None (list)) false) )] (|>> ($d.method #$.Public $.staticM "try" ($t.method (list $Function) (#.Some $Variant) (list)) - (<| $i.with-label (function [@from]) - $i.with-label (function [@to]) - $i.with-label (function [@handler]) + (<| $i.with-label (function (_ @from)) + $i.with-label (function (_ @to)) + $i.with-label (function (_ @handler)) (|>> ($i.try @from @to @handler "java.lang.Throwable") ($i.label @from) ($i.ALOAD +0) @@ -559,13 +559,13 @@ endI (|>> ($i.string hostL.unit) $i.ARETURN) runnableI (: (-> $.Inst $.Inst) - (function [functionI] + (function (_ functionI) (|>> ($i.NEW hostL.runnable-class) $i.DUP functionI ($i.INVOKESPECIAL hostL.runnable-class "<init>" ($t.method (list $Function) #.None (list)) false)))) threadI (: (-> $.Inst $.Inst) - (function [runnableI] + (function (_ runnableI) (|>> ($i.NEW "java.lang.Thread") $i.DUP runnableI @@ -604,7 +604,7 @@ schedule-immediatelyI (|>> executorI (runnableI ($i.ALOAD +2)) ($i.INVOKEVIRTUAL executor-class "execute" ($t.method (list $Runnable) #.None (list)) false))] - (<| $i.with-label (function [@immediately]) + (<| $i.with-label (function (_ @immediately)) (|>> immediacy-checkI ($i.IFEQ @immediately) schedule-laterI @@ -635,7 +635,7 @@ (do macro.Monad<Meta> [_ (wrap []) #let [applyI (|> (list.n/range +2 num-apply-variants) - (list/map (function [arity] + (list/map (function (_ arity) ($d.method #$.Public $.noneM apply-method (apply-signature arity) (let [preI (|> (list.n/range +0 (n/dec arity)) (list/map $i.ALOAD) |