aboutsummaryrefslogtreecommitdiff
path: root/lux-lua
diff options
context:
space:
mode:
authorEduardo Julian2022-11-25 01:26:00 -0400
committerEduardo Julian2022-11-25 01:26:00 -0400
commit09a29c952edb851e13edd454bd118c1c1ae83ade (patch)
treec27287569bdb0ffd190549a4bb1eb1899b9b20f4 /lux-lua
parent44cff1dcbd6cd23ef455923b707104302dde1aad (diff)
Added support for saturation arithmetic.
Diffstat (limited to 'lux-lua')
-rw-r--r--lux-lua/source/program.lux41
1 files changed, 20 insertions, 21 deletions
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 [<jvm> (these (def (to_host it)
(-> Any java/lang/Object)
(`` (<| (,, (with_template [<jvm> <lua>]
@@ -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 <jvm>)
@.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 [<jvm> (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>
@.jvm <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)