diff options
Diffstat (limited to '')
6 files changed, 59 insertions, 82 deletions
diff --git a/new-luxc/source/luxc/lang/translation/jvm/case.lux b/new-luxc/source/luxc/lang/translation/jvm/case.lux index d676f2996..c157a5776 100644 --- a/new-luxc/source/luxc/lang/translation/jvm/case.lux +++ b/new-luxc/source/luxc/lang/translation/jvm/case.lux @@ -45,7 +45,7 @@ (def: pushI Inst - (|>> (_.INVOKESTATIC $Runtime "pm_push" (type.method [(list runtime.$Stack //.$Value) runtime.$Stack (list)]) #0))) + (|>> (_.INVOKESTATIC $Runtime "pm_push" (type.method [(list runtime.$Stack //.$Value) runtime.$Stack (list)])))) (def: (path' phase stack-depth @else @end path) (-> Phase Nat Label Label Path (Operation Inst)) @@ -82,8 +82,7 @@ (_.string value) (_.INVOKEVIRTUAL (type.class "java.lang.Object" (list)) "equals" - (type.method [(list //.$Value) type.boolean (list)]) - #0) + (type.method [(list //.$Value) type.boolean (list)])) (_.IFEQ @else))) (#synthesis.Then bodyS) @@ -101,7 +100,7 @@ (_.CHECKCAST //.$Variant) (_.int (.int (<prepare> idx))) <flag> - (_.INVOKESTATIC $Runtime "pm_variant" (type.method [(list //.$Variant runtime.$Tag runtime.$Flag) runtime.$Value (list)]) #0) + (_.INVOKESTATIC $Runtime "pm_variant" (type.method [(list //.$Variant runtime.$Tag runtime.$Flag) runtime.$Value (list)])) _.DUP (_.IFNULL @fail) (_.GOTO @success) @@ -119,7 +118,7 @@ _.AALOAD lefts - (_.INVOKESTATIC $Runtime "tuple_left" (type.method [(list //.$Tuple runtime.$Index) //.$Value (list)]) #0))] + (_.INVOKESTATIC $Runtime "tuple_left" (type.method [(list //.$Tuple runtime.$Index) //.$Value (list)])))] (|>> peekI (_.CHECKCAST //.$Tuple) (_.int (.int lefts)) @@ -130,7 +129,7 @@ (operation@wrap (|>> peekI (_.CHECKCAST //.$Tuple) (_.int (.int lefts)) - (_.INVOKESTATIC $Runtime "tuple_right" (type.method [(list //.$Tuple runtime.$Index) //.$Value (list)]) #0) + (_.INVOKESTATIC $Runtime "tuple_right" (type.method [(list //.$Tuple runtime.$Index) //.$Value (list)])) pushI)) ## Extra optimization @@ -156,7 +155,7 @@ (wrap (|>> peekI (_.CHECKCAST //.$Tuple) (_.int (.int lefts)) - (_.INVOKESTATIC $Runtime <getter> (type.method [(list //.$Tuple runtime.$Index) //.$Value (list)]) #0) + (_.INVOKESTATIC $Runtime <getter> (type.method [(list //.$Tuple runtime.$Index) //.$Value (list)])) (_.ASTORE register) then!)))) ([synthesis.member/left "tuple_left"] @@ -189,7 +188,7 @@ (wrap (|>> pathI (_.label @else) _.POP - (_.INVOKESTATIC $Runtime "pm_fail" (type.method [(list) type.void (list)]) #0) + (_.INVOKESTATIC $Runtime "pm_fail" (type.method [(list) type.void (list)])) _.NULL (_.GOTO @end))))) diff --git a/new-luxc/source/luxc/lang/translation/jvm/function.lux b/new-luxc/source/luxc/lang/translation/jvm/function.lux index 9592510ab..56ef21b46 100644 --- a/new-luxc/source/luxc/lang/translation/jvm/function.lux +++ b/new-luxc/source/luxc/lang/translation/jvm/function.lux @@ -86,7 +86,7 @@ function.identity)] (|>> (_.CHECKCAST //.$Function) (inputsI start max-args) - (_.INVOKEVIRTUAL //.$Function runtime.apply-method (runtime.apply-signature max-args) #0) + (_.INVOKEVIRTUAL //.$Function runtime.apply-method (runtime.apply-signature max-args)) later-applysI))) (def: (inc-intI by) @@ -129,7 +129,7 @@ _.DUP (_.fuse captureI+) argsI - (_.INVOKESPECIAL class "<init>" (init-method env arity) #0))))) + (_.INVOKESPECIAL class "<init>" (init-method env arity)))))) (def: (with-reset class arity env) (-> (Type Class) Arity Environment Def) @@ -150,7 +150,7 @@ _.DUP captureI argsI - (_.INVOKESPECIAL class "<init>" (init-method env arity) #0) + (_.INVOKESPECIAL class "<init>" (init-method env arity)) _.ARETURN)) (|>> (_.ALOAD 0) _.ARETURN)))) @@ -169,9 +169,9 @@ (-> Arity Nat Inst) (if (n.= 1 arity) (|>> (_.int +0) - (_.INVOKESPECIAL //.$Function "<init>" function-init-method #0)) + (_.INVOKESPECIAL //.$Function "<init>" function-init-method)) (|>> (_.ILOAD (inc env-size)) - (_.INVOKESPECIAL //.$Function "<init>" function-init-method #0)))) + (_.INVOKESPECIAL //.$Function "<init>" function-init-method)))) (def: (with-init class env arity) (-> (Type Class) Environment Arity Def) @@ -221,10 +221,10 @@ (|>> (_.label @label) (_.ALOAD 0) (when> [(new> (n.> 0 stage) [])] - [(_.INVOKEVIRTUAL class "reset" (reset-method class) #0)]) + [(_.INVOKEVIRTUAL class "reset" (reset-method class))]) load-partialsI (inputsI 1 apply-arity) - (_.INVOKEVIRTUAL class "impl" (implementation-method function-arity) #0) + (_.INVOKEVIRTUAL class "impl" (implementation-method function-arity)) _.ARETURN) (i.> arity-over-extent (.int stage)) @@ -232,10 +232,10 @@ args-left (|> apply-arity (n.- args-to-completion))] (|>> (_.label @label) (_.ALOAD 0) - (_.INVOKEVIRTUAL class "reset" (reset-method class) #0) + (_.INVOKEVIRTUAL class "reset" (reset-method class)) load-partialsI (inputsI 1 args-to-completion) - (_.INVOKEVIRTUAL class "impl" (implementation-method function-arity) #0) + (_.INVOKEVIRTUAL class "impl" (implementation-method function-arity)) (applysI (inc args-to-completion) args-left) _.ARETURN)) @@ -255,7 +255,7 @@ load-partialsI (inputsI 1 apply-arity) (nullsI (|> num-partials (n.- apply-arity) (n.- stage))) - (_.INVOKESPECIAL class "<init>" (init-method env function-arity) #0) + (_.INVOKESPECIAL class "<init>" (init-method env function-arity)) _.ARETURN)) )))) _.fuse)] @@ -264,7 +264,7 @@ (_.TABLESWITCH +0 (|> num-partials dec .int) @default @labels) casesI - (_.INVOKESTATIC runtime.$Runtime "apply_fail" (type.method [(list) type.void (list)]) #0) + (_.INVOKESTATIC runtime.$Runtime "apply_fail" (type.method [(list) type.void (list)])) _.NULL _.ARETURN )))) @@ -323,7 +323,7 @@ (list@map (.function (_ chunkI+) (|>> (_.CHECKCAST //.$Function) (_.fuse chunkI+) - (_.INVOKEVIRTUAL //.$Function runtime.apply-method (runtime.apply-signature (list.size chunkI+)) #0)))) + (_.INVOKEVIRTUAL //.$Function runtime.apply-method (runtime.apply-signature (list.size chunkI+)))))) _.fuse)]] (wrap (|>> functionI applyI)))) diff --git a/new-luxc/source/luxc/lang/translation/jvm/procedure/common.lux b/new-luxc/source/luxc/lang/translation/jvm/procedure/common.lux index 06ae2ba26..9ed40a99a 100644 --- a/new-luxc/source/luxc/lang/translation/jvm/procedure/common.lux +++ b/new-luxc/source/luxc/lang/translation/jvm/procedure/common.lux @@ -128,9 +128,7 @@ (Unary Inst) (|>> riskyI (_.CHECKCAST ///.$Function) - (_.INVOKESTATIC runtime.$Runtime "try" - (type.method [(list ///.$Function) ///.$Variant (list)]) - #0))) + (_.INVOKESTATIC runtime.$Runtime "try" (type.method [(list ///.$Function) ///.$Variant (list)])))) (template [<name> <op>] [(def: (<name> [maskI inputI]) @@ -212,20 +210,20 @@ [i64::f64 (_.unwrap type.long) (<| (_.wrap type.double) _.L2D)] [i64::char (_.unwrap type.long) - ((|>> _.L2I _.I2C (_.INVOKESTATIC (type.class "java.lang.Character" (list)) "toString" (type.method [(list type.char) $String (list)]) #0)))] + ((|>> _.L2I _.I2C (_.INVOKESTATIC (type.class "java.lang.Character" (list)) "toString" (type.method [(list type.char) $String (list)]))))] [f64::i64 (_.unwrap type.double) (<| (_.wrap type.long) _.D2L)] [f64::encode (_.unwrap type.double) - (_.INVOKESTATIC (type.class "java.lang.Double" (list)) "toString" (type.method [(list type.double) $String (list)]) #0)] + (_.INVOKESTATIC (type.class "java.lang.Double" (list)) "toString" (type.method [(list type.double) $String (list)]))] [f64::decode ..check-stringI - (_.INVOKESTATIC runtime.$Runtime "decode_frac" (type.method [(list $String) ///.$Variant (list)]) #0)] + (_.INVOKESTATIC runtime.$Runtime "decode_frac" (type.method [(list $String) ///.$Variant (list)]))] ) (def: (text::size inputI) (Unary Inst) (|>> inputI ..check-stringI - (_.INVOKEVIRTUAL $String "length" (type.method [(list) type.int (list)]) #0) + (_.INVOKEVIRTUAL $String "length" (type.method [(list) type.int (list)])) lux-intI)) (template [<name> <pre-subject> <pre-param> <op> <post>] @@ -236,13 +234,13 @@ <op> <post>))] [text::= (<|) (<|) - (_.INVOKEVIRTUAL $Object "equals" (type.method [(list $Object) type.boolean (list)]) #0) + (_.INVOKEVIRTUAL $Object "equals" (type.method [(list $Object) type.boolean (list)])) (_.wrap type.boolean)] [text::< ..check-stringI ..check-stringI - (_.INVOKEVIRTUAL $String "compareTo" (type.method [(list $String) type.int (list)]) #0) + (_.INVOKEVIRTUAL $String "compareTo" (type.method [(list $String) type.int (list)])) (predicateI _.IFLT)] [text::char ..check-stringI jvm-intI - (_.INVOKEVIRTUAL $String "charAt" (type.method [(list type.int) type.char (list)]) #0) + (_.INVOKEVIRTUAL $String "charAt" (type.method [(list type.int) type.char (list)])) lux-intI] ) @@ -250,14 +248,14 @@ (Binary Inst) (|>> leftI ..check-stringI rightI ..check-stringI - (_.INVOKEVIRTUAL $String "concat" (type.method [(list $String) $String (list)]) #0))) + (_.INVOKEVIRTUAL $String "concat" (type.method [(list $String) $String (list)])))) (def: (text::clip [startI endI subjectI]) (Trinary Inst) (|>> subjectI ..check-stringI startI jvm-intI endI jvm-intI - (_.INVOKEVIRTUAL $String "substring" (type.method [(list type.int type.int) $String (list)]) #0))) + (_.INVOKEVIRTUAL $String "substring" (type.method [(list type.int type.int) $String (list)])))) (def: index-method (type.method [(list $String type.int) type.int (list)])) (def: (text::index [startI partI textI]) @@ -267,7 +265,7 @@ (|>> textI ..check-stringI partI ..check-stringI startI jvm-intI - (_.INVOKEVIRTUAL $String "indexOf" index-method #0) + (_.INVOKEVIRTUAL $String "indexOf" index-method) _.DUP (_.int -1) (_.IF_ICMPEQ @not-found) @@ -286,7 +284,7 @@ (|>> (_.GETSTATIC $System "out" $PrintStream) messageI ..check-stringI - (_.INVOKEVIRTUAL $PrintStream "println" string-method #0) + (_.INVOKEVIRTUAL $PrintStream "println" string-method) unitI))) (def: (io::error messageI) @@ -296,18 +294,18 @@ _.DUP messageI ..check-stringI - (_.INVOKESPECIAL $Error "<init>" string-method #0) + (_.INVOKESPECIAL $Error "<init>" string-method) _.ATHROW))) (def: (io::exit codeI) (Unary Inst) (|>> codeI jvm-intI - (_.INVOKESTATIC $System "exit" (type.method [(list type.int) type.void (list)]) #0) + (_.INVOKESTATIC $System "exit" (type.method [(list type.int) type.void (list)])) _.NULL)) (def: (io::current-time _) (Nullary Inst) - (|>> (_.INVOKESTATIC $System "currentTimeMillis" (type.method [(list) type.long (list)]) #0) + (|>> (_.INVOKESTATIC $System "currentTimeMillis" (type.method [(list) type.long (list)])) (_.wrap type.long))) (def: bundle::lux diff --git a/new-luxc/source/luxc/lang/translation/jvm/procedure/host.lux b/new-luxc/source/luxc/lang/translation/jvm/procedure/host.lux index 58643797b..b01056479 100644 --- a/new-luxc/source/luxc/lang/translation/jvm/procedure/host.lux +++ b/new-luxc/source/luxc/lang/translation/jvm/procedure/host.lux @@ -534,11 +534,7 @@ (do phase.monad [] (wrap (|>> (_.string class) - (_.INVOKESTATIC $Class "forName" - (type.method [(list (type.class "java.lang.String" (list))) - $Class - (list)]) - false)))) + (_.INVOKESTATIC $Class "forName" (type.method [(list (type.class "java.lang.String" (list))) $Class (list)]))))) _ (phase.throw extension.invalid-syntax [extension-name %synthesis inputs]))) @@ -736,14 +732,10 @@ (do phase.monad [inputsTI (monad.map @ (generate-input generate) inputsTS)] (wrap (|>> (_.fuse (list@map product.right inputsTI)) - (_.INVOKESTATIC class method - (type.method [(list@map product.left inputsTI) - outputT - (list)]) - false) + (_.INVOKESTATIC class method (type.method [(list@map product.left inputsTI) outputT (list)])) (prepare-output outputT)))))])) -(template [<name> <invoke> <interface?>] +(template [<name> <invoke>] [(def: <name> Handler (..custom @@ -758,13 +750,12 @@ (<invoke> class method (type.method [(list@map product.left inputsTI) outputT - (list)]) - <interface?>) + (list)])) (prepare-output outputT)))))]))] - [invoke::virtual _.INVOKEVIRTUAL false] - [invoke::special _.INVOKESPECIAL false] - [invoke::interface _.INVOKEINTERFACE true] + [invoke::virtual _.INVOKEVIRTUAL] + [invoke::special _.INVOKESPECIAL] + [invoke::interface _.INVOKEINTERFACE] ) (def: invoke::constructor @@ -777,11 +768,7 @@ (wrap (|>> (_.NEW class) _.DUP (_.fuse (list@map product.right inputsTI)) - (_.INVOKESPECIAL class "<init>" - (type.method [(list@map product.left inputsTI) - type.void - (list)]) - false)))))])) + (_.INVOKESPECIAL class "<init>" (type.method [(list@map product.left inputsTI) type.void (list)]))))))])) (def: member Bundle @@ -931,12 +918,7 @@ (_def.method #$.Public $.noneM "<init>" (anonymous-init-method env) (|>> (_.ALOAD 0) ((_.fuse (list@map product.right inputsTI))) - (_.INVOKESPECIAL super-class - "<init>" - (type.method [(list@map product.left inputsTI) - type.void - (list)]) - #0) + (_.INVOKESPECIAL super-class "<init>" (type.method [(list@map product.left inputsTI) type.void (list)])) store-capturedI _.RETURN)))) @@ -947,7 +929,7 @@ (wrap (|>> (_.NEW class) _.DUP (_.fuse captureI+) - (_.INVOKESPECIAL class "<init>" (anonymous-init-method env) #0))))) + (_.INVOKESPECIAL class "<init>" (anonymous-init-method env)))))) (def: (returnI returnT) (-> (Type Return) Inst) diff --git a/new-luxc/source/luxc/lang/translation/jvm/runtime.lux b/new-luxc/source/luxc/lang/translation/jvm/runtime.lux index 594964be0..4297090b6 100644 --- a/new-luxc/source/luxc/lang/translation/jvm/runtime.lux +++ b/new-luxc/source/luxc/lang/translation/jvm/runtime.lux @@ -46,7 +46,7 @@ (let [PrintStream (type.class "java.io.PrintStream" (list)) outI (_.GETSTATIC (type.class "java.lang.System" (list)) "out" PrintStream) printI (function (_ method) - (_.INVOKEVIRTUAL PrintStream method (type.method [(list $Value) type.void (list)]) #0))] + (_.INVOKEVIRTUAL PrintStream method (type.method [(list $Value) type.void (list)])))] (|>> outI (_.string "LOG: ") (printI "print") outI _.SWAP (printI "println")))) @@ -55,7 +55,7 @@ (def: #export variantI Inst - (_.INVOKESTATIC (type.class //.runtime-class (list)) "variant_make" variant-method #0)) + (_.INVOKESTATIC (type.class //.runtime-class (list)) "variant_make" variant-method)) (def: #export leftI Inst @@ -99,7 +99,7 @@ (def: #export string-concatI Inst - (_.INVOKEVIRTUAL $Text "concat" (type.method [(list $Text) $Text (list)]) #0)) + (_.INVOKEVIRTUAL $Text "concat" (type.method [(list $Text) $Text (list)]))) (def: #export partials-field Text "partials") (def: #export apply-method Text "apply") @@ -130,7 +130,7 @@ (|>> ($d.method #$.Public $.staticM "decode_frac" (type.method [(list $Text) //.$Variant (list)]) (try-methodI (|>> (_.ALOAD 0) - (_.INVOKESTATIC (type.class "java.lang.Double" (list)) "parseDouble" (type.method [(list $Text) type.double (list)]) #0) + (_.INVOKESTATIC (type.class "java.lang.Double" (list)) "parseDouble" (type.method [(list $Text) type.double (list)])) (_.wrap type.double)))) )) @@ -149,7 +149,7 @@ (|>> (_.NEW IllegalStateException) _.DUP (_.string message) - (_.INVOKESPECIAL IllegalStateException "<init>" (type.method [(list $Text) type.void (list)]) #0)))) + (_.INVOKESPECIAL IllegalStateException "<init>" (type.method [(list $Text) type.void (list)]))))) (def: pm-methods Def @@ -263,8 +263,7 @@ (_.INVOKESTATIC (type.class "java.util.Arrays" (list)) "copyOfRange" (type.method [(list //.$Tuple $Index $Index) //.$Tuple - (list)]) - #0))]) + (list)])))]) (|>> (_.label @loop) last-rightI right-indexI _.DUP2 (_.IF_ICMPNE @not-tail) @@ -287,14 +286,14 @@ PrintWriter (type.class "java.io.PrintWriter" (list)) string-writerI (|>> (_.NEW StringWriter) _.DUP - (_.INVOKESPECIAL StringWriter "<init>" nullary-init-methodT #0)) + (_.INVOKESPECIAL StringWriter "<init>" nullary-init-methodT)) print-writerI (|>> (_.NEW PrintWriter) _.SWAP _.DUP2 _.POP _.SWAP (_.boolean true) - (_.INVOKESPECIAL PrintWriter "<init>" (type.method [(list (type.class "java.io.Writer" (list)) type.boolean) type.void (list)]) #0) + (_.INVOKESPECIAL PrintWriter "<init>" (type.method [(list (type.class "java.io.Writer" (list)) type.boolean) type.void (list)])) )] (|>> ($d.method #$.Public $.staticM "try" (type.method [(list //.$Function) //.$Variant (list)]) (<| _.with-label (function (_ @from)) @@ -304,7 +303,7 @@ (_.label @from) (_.ALOAD 0) _.NULL - (_.INVOKEVIRTUAL //.$Function apply-method (apply-signature 1) #0) + (_.INVOKEVIRTUAL //.$Function apply-method (apply-signature 1)) rightI _.ARETURN (_.label @to) @@ -312,8 +311,8 @@ string-writerI ## TW _.DUP2 ## TWTW print-writerI ## TWTP - (_.INVOKEVIRTUAL $Throwable "printStackTrace" (type.method [(list (type.class "java.io.PrintWriter" (list))) type.void (list)]) #0) ## TW - (_.INVOKEVIRTUAL StringWriter "toString" (type.method [(list) $Text (list)]) #0) ## TS + (_.INVOKEVIRTUAL $Throwable "printStackTrace" (type.method [(list (type.class "java.io.PrintWriter" (list))) type.void (list)])) ## TW + (_.INVOKEVIRTUAL StringWriter "toString" (type.method [(list) $Text (list)])) ## TS _.SWAP _.POP leftI _.ARETURN))) ))) @@ -338,10 +337,10 @@ (list@map _.ALOAD) _.fuse)] (|>> preI - (_.INVOKEVIRTUAL //.$Function apply-method (apply-signature (dec arity)) #0) + (_.INVOKEVIRTUAL //.$Function apply-method (apply-signature (dec arity))) (_.CHECKCAST //.$Function) (_.ALOAD arity) - (_.INVOKEVIRTUAL //.$Function apply-method (apply-signature 1) #0) + (_.INVOKEVIRTUAL //.$Function apply-method (apply-signature 1)) _.ARETURN))))) (list& ($d.abstract-method #$.Public $.noneM apply-method (apply-signature 1))) $d.fuse) @@ -350,7 +349,7 @@ (|>> ($d.field #$.Public $.finalF partials-field type.int) ($d.method #$.Public $.noneM "<init>" (type.method [(list type.int) type.void (list)]) (|>> (_.ALOAD 0) - (_.INVOKESPECIAL $Object "<init>" nullary-init-methodT #0) + (_.INVOKESPECIAL $Object "<init>" nullary-init-methodT) (_.ALOAD 0) (_.ILOAD 1) (_.PUTFIELD //.$Function partials-field type.int) diff --git a/new-luxc/source/luxc/lang/translation/jvm/structure.lux b/new-luxc/source/luxc/lang/translation/jvm/structure.lux index 81730e6bf..f7e66a75a 100644 --- a/new-luxc/source/luxc/lang/translation/jvm/structure.lux +++ b/new-luxc/source/luxc/lang/translation/jvm/structure.lux @@ -72,5 +72,4 @@ "variant_make" (type.method [(list //runtime.$Tag //runtime.$Flag //runtime.$Value) //.$Variant - (list)]) - #0))))) + (list)])))))) |