From 09a29c952edb851e13edd454bd118c1c1ae83ade Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Fri, 25 Nov 2022 01:26:00 -0400 Subject: Added support for saturation arithmetic. --- lux-lua/source/program.lux | 41 ++++++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 21 deletions(-) (limited to 'lux-lua') diff --git a/lux-lua/source/program.lux b/lux-lua/source/program.lux index f16ed850f..f6ba0278e 100644 --- a/lux-lua/source/program.lux +++ b/lux-lua/source/program.lux @@ -45,7 +45,6 @@ [macro (.only Expander)]] [phase ["[0]" extension (.only Extender Handler) - ["[1]/[0]" bundle] ["[0]" analysis ["[1]" lua]] ["[0]" translation @@ -783,6 +782,13 @@ [_ (run! content)] (run! (_.return (_.var (reference.artifact context)))))))))))))) +(def (phase_wrapper to_host) + (-> (-> Any java/lang/Object) + phase.Wrapper) + (for @.old (..lua_function to_host) + @.jvm (..lua_function to_host) + @.lua (|>>))) + (with_expansions [ (these (def (to_host it) (-> Any java/lang/Object) (`` (<| (,, (with_template [ ] @@ -816,12 +822,11 @@ [handler (try.of_maybe (..ensure_function handler)) output (net/sandius/rembulan/exec/DirectCallExecutor::call state_context (as java/lang/Object handler) - (|> (array.empty 5) - (array.has! 0 name) - (array.has! 1 (as java/lang/Object (phase_wrapper phase))) - (array.has! 2 (..to_host archive)) - (array.has! 3 (..to_host parameters)) - (array.has! 4 (..to_host state))) + (|> (array.empty 4) + (array.has! 0 (as java/lang/Object (phase_wrapper ..to_host phase))) + (array.has! 1 (..to_host archive)) + (array.has! 2 (..to_host parameters)) + (array.has! 3 (..to_host state))) executor)] (|> output (array.item 0) @@ -832,15 +837,9 @@ @.jvm (these ) @.lua - (def (extender phase_wrapper handler) - (-> phase.Wrapper Extender) - (as_expected handler)))) - -(def phase_wrapper - phase.Wrapper - (for @.old (..lua_function ..to_host) - @.jvm (..lua_function ..to_host) - @.lua (|>>))) + (def extender + Extender + (|>> as_expected)))) (with_expansions [ (def platform (IO [Baggage (Platform [Register _.Label] _.Expression _.Statement)]) @@ -849,9 +848,9 @@ (in [baggage [platform.#file_system (file.async file.default) platform.#host host - platform.#phase lua.translate + platform.#phase lua.expression platform.#runtime runtime.translate - platform.#phase_wrapper ..phase_wrapper + platform.#phase_wrapper (..phase_wrapper ..to_host) platform.#write (|>> _.code (at utf8.codec encoded))]])))] (for @.old @.jvm @@ -861,9 +860,9 @@ [host ..host] (in [platform.#file_system (file.async file.default) platform.#host host - platform.#phase lua.translate + platform.#phase lua.expression platform.#runtime runtime.translate - platform.#phase_wrapper ..phase_wrapper + platform.#phase_wrapper (..phase_wrapper ..to_host) platform.#write (|>> _.code (at utf8.codec encoded))]))))) (def (lux_program context program) @@ -898,7 +897,7 @@ analysis.bundle (io.io platform) translation.bundle - extension/bundle.empty + extension.empty ..lux_program (reference.constant lua/reference.system) (for @.old (..extender baggage) -- cgit v1.2.3