From e4bc4d0e2cd14a955530160c4fc7859e6c46874e Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Thu, 3 Feb 2022 05:55:42 -0400 Subject: Fixes for the pure-Lux JVM compiler machinery. [Part 13 / Done!] --- lux-jvm/source/luxc/lang/translation/jvm.lux | 85 ++++++++++----------- .../luxc/lang/translation/jvm/extension/host.lux | 4 +- .../source/luxc/lang/translation/jvm/function.lux | 7 +- .../source/luxc/lang/translation/jvm/program.lux | 50 +++++++------ .../source/luxc/lang/translation/jvm/runtime.lux | 87 +++++++++++----------- 5 files changed, 119 insertions(+), 114 deletions(-) (limited to 'lux-jvm/source/luxc/lang/translation') diff --git a/lux-jvm/source/luxc/lang/translation/jvm.lux b/lux-jvm/source/luxc/lang/translation/jvm.lux index c2f7cea68..e2bd46f5d 100644 --- a/lux-jvm/source/luxc/lang/translation/jvm.lux +++ b/lux-jvm/source/luxc/lang/translation/jvm.lux @@ -1,44 +1,45 @@ (.using - [library - [lux {"-" Definition} - ["[0]" ffi {"+" import: do_to object}] - [abstract - [monad {"+" do}]] - [control - pipe - ["[0]" maybe] - ["[0]" try {"+" Try}] - ["[0]" exception {"+" exception:}] - ["[0]" io {"+" IO io}] - [concurrency - ["[0]" atom {"+" Atom atom}]]] - [data - [binary {"+" Binary}] - ["[0]" product] - ["[0]" text ("[1]@[0]" hash) - ["%" format {"+" format}]] - [collection - ["[0]" array] - ["[0]" dictionary {"+" Dictionary}]]] - [target - [jvm - ["[0]" loader {"+" Library}] - ["[0]" type - ["[0]" descriptor]]]] - [tool - [compiler - [language - [lux - ["[0]" version] - ["[0]" generation]]] - [meta - [io {"+" lux_context}]]]]]] - [/// - [host - ["[0]" jvm {"+" Inst Definition Host State} - ["[0]" def] - ["[0]" inst]]]] - ) + [library + [lux {"-" Definition} + ["[0]" ffi {"+" import: do_to object}] + [abstract + [monad {"+" do}]] + [control + pipe + ["[0]" maybe] + ["[0]" try {"+" Try}] + ["[0]" exception {"+" exception:}] + ["[0]" io {"+" IO io}] + [concurrency + ["[0]" atom {"+" Atom atom}]]] + [data + [binary {"+" Binary}] + ["[0]" product] + ["[0]" text ("[1]@[0]" hash) + ["%" format {"+" format}]] + [collection + ["[0]" array] + ["[0]" dictionary {"+" Dictionary}]]] + [target + [jvm + ["[0]" loader {"+" Library}] + ["[0]" type + ["[0]" descriptor]]]] + [tool + [compiler + [language + [lux + ["[0]" version]]] + [meta + [io {"+" lux_context}] + [archive + ["[0]" unit]]]]]]] + [/// + [host + ["[0]" jvm {"+" Inst Definition Host State} + ["[0]" def] + ["[0]" inst]]]] + ) (import: java/lang/reflect/Field ["[1]::[0]" @@ -103,7 +104,7 @@ (text.replaced ..class_path_separator .module_separator)) (def: .public (class_name [module_id artifact_id]) - (-> generation.Context Text) + (-> unit.ID Text) (format lux_context ..class_path_separator (%.nat version.version) ..class_path_separator (%.nat module_id) @@ -146,7 +147,7 @@ (loader.load class_name loader)))) (def: (define! library loader context custom valueI) - (-> Library java/lang/ClassLoader generation.Context (Maybe Text) Inst (Try [Text Any Definition])) + (-> Library java/lang/ClassLoader unit.ID (Maybe Text) Inst (Try [Text Any Definition])) (do try.monad [[value definition] (evaluate! library loader (..class_name context) valueI)] (in [(maybe.else (..class_name context) diff --git a/lux-jvm/source/luxc/lang/translation/jvm/extension/host.lux b/lux-jvm/source/luxc/lang/translation/jvm/extension/host.lux index 28a5c34bc..ee6f243f2 100644 --- a/lux-jvm/source/luxc/lang/translation/jvm/extension/host.lux +++ b/lux-jvm/source/luxc/lang/translation/jvm/extension/host.lux @@ -40,7 +40,7 @@ ["[0]" variable {"+" Variable Register}]] [meta [archive {"+" Archive} - ["[0]" artifact]] + ["[0]" unit]] ["[0]" cache "_" ["[1]" artifact]]] [language @@ -1127,7 +1127,7 @@ (unwrap_primitive _.DRETURN type.double))))))) (def: (method_dependencies archive method) - (-> Archive (/.Overriden_Method Synthesis) (Operation (Set artifact.Dependency))) + (-> Archive (/.Overriden_Method Synthesis) (Operation (Set unit.ID))) (let [[_super _name _strict_fp? _annotations _t_vars _this _arguments _return _exceptions bodyS] method] diff --git a/lux-jvm/source/luxc/lang/translation/jvm/function.lux b/lux-jvm/source/luxc/lang/translation/jvm/function.lux index 2eb1894da..6c0e29730 100644 --- a/lux-jvm/source/luxc/lang/translation/jvm/function.lux +++ b/lux-jvm/source/luxc/lang/translation/jvm/function.lux @@ -31,9 +31,10 @@ [lux [analysis {"+" Environment}] [synthesis {"+" Synthesis Abstraction Apply}] - ["[0]" generation {"+" Context}]]] + ["[0]" generation]]] [meta - [archive {"+" Archive}] + [archive {"+" Archive} + ["[0]" unit]] ["[0]" cache "_" ["[1]" artifact]]]]]]] [luxc @@ -306,7 +307,7 @@ (in [functionD instanceI])))) (def: .public (function' forced_context generate archive [env arity bodyS]) - (-> (Maybe Context) (Generator Abstraction)) + (-> (Maybe unit.ID) (Generator Abstraction)) (do [! phase.monad] [@begin _.make_label dependencies (cache.dependencies archive bodyS) diff --git a/lux-jvm/source/luxc/lang/translation/jvm/program.lux b/lux-jvm/source/luxc/lang/translation/jvm/program.lux index 7e408ecc4..4efe0fd3d 100644 --- a/lux-jvm/source/luxc/lang/translation/jvm/program.lux +++ b/lux-jvm/source/luxc/lang/translation/jvm/program.lux @@ -1,32 +1,34 @@ (.using - [library - [lux "*" - [data - [text - ["%" format {"+" format}]]] - [target - [jvm - ["$t" type]]] - [tool - [compiler - [language - [lux - [generation {"+" Context}] - [program {"+" Program}]]]]]]] - [luxc - [lang - [host - ["_" jvm - ["$d" def] - ["$i" inst]]] - [translation - ["[0]" jvm - ["[0]" runtime]]]]]) + [library + [lux "*" + [data + [text + ["%" format {"+" format}]]] + [target + [jvm + ["$t" type]]] + [tool + [compiler + [language + [lux + [program {"+" Program}]]] + [meta + [archive + ["[0]" unit]]]]]]] + [luxc + [lang + [host + ["_" jvm + ["$d" def] + ["$i" inst]]] + [translation + ["[0]" jvm + ["[0]" runtime]]]]]) (def: ^Object ($t.class "java.lang.Object" (list))) (def: .public (program artifact_name context programI) - (-> (-> Context Text) (Program _.Inst _.Definition)) + (-> (-> unit.ID Text) (Program _.Inst _.Definition)) (let [nilI runtime.noneI num_inputsI (|>> ($i.ALOAD 0) $i.ARRAYLENGTH) --I (|>> ($i.int +1) $i.ISUB) diff --git a/lux-jvm/source/luxc/lang/translation/jvm/runtime.lux b/lux-jvm/source/luxc/lang/translation/jvm/runtime.lux index cec04d529..ee3e16ed8 100644 --- a/lux-jvm/source/luxc/lang/translation/jvm/runtime.lux +++ b/lux-jvm/source/luxc/lang/translation/jvm/runtime.lux @@ -1,45 +1,46 @@ (.using - [library - [lux {"-" Type Label Primitive try} - [abstract - [monad {"+" do}] - ["[0]" enum]] - [data - [binary {"+" Binary}] - ["[0]" product] - [text - ["%" format {"+" format}]] - [collection - ["[0]" list ("[1]@[0]" functor)] - ["[0]" sequence] - ["[0]" set]]] - ["[0]" math - [number - ["n" nat]]] - [target - [jvm - ["[0]" type {"+" Type} - ["[0]" category {"+" Void Value' Value Return' Return Primitive Object Class Array Var Parameter Method}] - ["[0]" reflection]]]] - [tool - [compiler - [arity {"+" Arity}] - ["[0]" phase] - [language - [lux - ["[0]" synthesis] - ["[0]" generation]]] - [meta - [archive {"+" Output} - ["[0]" artifact] - ["[0]" registry {"+" Registry}]]]]]]] - [luxc - [lang - [host - ["$" jvm {"+" Label Inst Def Operation} - ["$d" def] - ["_" inst]]]]] - ["[0]" // {"+" ByteCode}]) + [library + [lux {"-" Type Label Primitive try} + [abstract + [monad {"+" do}] + ["[0]" enum]] + [data + [binary {"+" Binary}] + ["[0]" product] + [text + ["%" format {"+" format}]] + [collection + ["[0]" list ("[1]@[0]" functor)] + ["[0]" sequence] + ["[0]" set]]] + ["[0]" math + [number + ["n" nat]]] + [target + [jvm + ["[0]" type {"+" Type} + ["[0]" category {"+" Void Value' Value Return' Return Primitive Object Class Array Var Parameter Method}] + ["[0]" reflection]]]] + [tool + [compiler + [arity {"+" Arity}] + ["[0]" phase] + [language + [lux + ["[0]" synthesis] + ["[0]" generation]]] + [meta + [archive {"+" Output} + ["[0]" artifact] + ["[0]" registry {"+" Registry}] + ["[0]" unit]]]]]]] + [luxc + [lang + [host + ["$" jvm {"+" Label Inst Def Operation} + ["$d" def] + ["_" inst]]]]] + ["[0]" // {"+" ByteCode}]) (def: $Text (type.class "java.lang.String" (list))) (def: .public $Lefts type.int) @@ -414,9 +415,9 @@ ... function_payload ..translate_function ] (in [(|> registry.empty - (registry.resource true artifact.no_dependencies) + (registry.resource true unit.none) product.right - ... (registry.resource true artifact.no_dependencies) + ... (registry.resource true unit.none) ... product.right ) (sequence.sequence runtime_payload -- cgit v1.2.3