From a40f40f230e6312ae432f06e7f73aa5945d8fa49 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sun, 18 Jul 2021 23:10:18 -0400 Subject: New JVM compiler can now compile JVM interfaces. --- lux-jvm/source/luxc/lang/translation/jvm.lux | 58 ++++++++++++++-------------- 1 file changed, 30 insertions(+), 28 deletions(-) (limited to 'lux-jvm/source/luxc/lang/translation/jvm.lux') diff --git a/lux-jvm/source/luxc/lang/translation/jvm.lux b/lux-jvm/source/luxc/lang/translation/jvm.lux index 0f6ba6744..425a259aa 100644 --- a/lux-jvm/source/luxc/lang/translation/jvm.lux +++ b/lux-jvm/source/luxc/lang/translation/jvm.lux @@ -122,7 +122,7 @@ ..value_field ..$Value) (def.method #jvm.Public ($_ jvm.++M jvm.staticM jvm.strictM) "" - (type.method [(list) type.void (list)]) + (type.method [(list) (list) type.void (list)]) (|>> valueI (inst.PUTSTATIC (type.class bytecode_name (list)) ..value_field ..$Value) inst.RETURN))))] @@ -155,35 +155,37 @@ value definition]))) (def: #export host - (IO Host) + (IO [java/lang/ClassLoader Host]) (io (let [library (loader.new_library []) loader (loader.memory library)] - (: Host - (implementation - (def: (evaluate! context valueI) - (\ try.monad map product.left - (..evaluate! library loader context valueI))) - - (def: execute! - (..execute! library loader)) - - (def: define! - (..define! library loader)) - - (def: (ingest context bytecode) - [(..class_name context) bytecode]) - - (def: (re_learn context custom [_ bytecode]) - (io.run - (loader.store (maybe.default (..class_name context) custom) bytecode library))) - - (def: (re_load context custom [_ bytecode]) - (io.run - (do (try.with io.monad) - [#let [class_name (maybe.default (..class_name context) custom)] - _ (loader.store class_name bytecode library) - class (loader.load class_name loader)] - (\ io.monad wrap (..class_value class_name class)))))))))) + [loader + (: Host + (implementation + (def: (evaluate! context valueI) + (\ try.monad map product.left + (..evaluate! library loader context valueI))) + + (def: execute! + (..execute! library loader)) + + (def: define! + (..define! library loader)) + + (def: (ingest context bytecode) + [(..class_name context) bytecode]) + + (def: (re_learn context custom [_ bytecode]) + (io.run + (loader.store (maybe.default (..class_name context) custom) bytecode library))) + + (def: (re_load context custom [directive_name bytecode]) + (io.run + (do (try.with io.monad) + [#let [class_name (maybe.default (..class_name context) + custom)] + _ (loader.store class_name bytecode library) + class (loader.load class_name loader)] + (\ io.monad wrap (..class_value class_name class)))))))]))) (def: #export $Variant (type.array ..$Value)) -- cgit v1.2.3