aboutsummaryrefslogtreecommitdiff
path: root/lux-jvm/source/luxc/lang/translation/jvm/extension
diff options
context:
space:
mode:
authorEduardo Julian2020-06-01 20:16:32 -0400
committerEduardo Julian2020-06-01 20:16:32 -0400
commita6987ad82f107df49853e1601b73076d030d6fc8 (patch)
treeb5562ec12fcee4a87b0c6ca4d485e7ac82ffbfec /lux-jvm/source/luxc/lang/translation/jvm/extension
parent1546feb83e8e821ee8bbf3dea736a49a072bcd52 (diff)
Implemented an optimization for getting fields/slots from records in the new compiler.
Diffstat (limited to 'lux-jvm/source/luxc/lang/translation/jvm/extension')
-rw-r--r--lux-jvm/source/luxc/lang/translation/jvm/extension/host.lux16
1 files changed, 10 insertions, 6 deletions
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 7b90a8e4f..482521e34 100644
--- a/lux-jvm/source/luxc/lang/translation/jvm/extension/host.lux
+++ b/lux-jvm/source/luxc/lang/translation/jvm/extension/host.lux
@@ -30,8 +30,9 @@
["." parser]]]]
[tool
[compiler
- ["." reference (#+ Variable)]
["." phase ("#@." monad)]
+ [reference (#+)
+ ["." variable (#+ Variable)]]
[meta
[archive (#+ Archive)]]
[language
@@ -864,6 +865,9 @@
(^ (synthesis.branch/if [testS thenS elseS]))
(synthesis.branch/if [(recur testS) (recur thenS) (recur elseS)])
+ (^ (synthesis.branch/get [path recordS]))
+ (synthesis.branch/get [path (recur recordS)])
+
(^ (synthesis.loop/scope [offset initsS+ bodyS]))
(synthesis.loop/scope [offset (list@map recur initsS+) (recur bodyS)])
@@ -969,14 +973,14 @@
## Combine them.
list@join
## Remove duplicates.
- (set.from-list reference.hash)
+ (set.from-list variable.hash)
set.to-list)
global-mapping (|> total-environment
## Give them names as "foreign" variables.
list.enumerate
(list@map (function (_ [id capture])
- [capture (#reference.Foreign id)]))
- (dictionary.from-list reference.hash))
+ [capture (#variable.Foreign id)]))
+ (dictionary.from-list variable.hash))
normalized-methods (list@map (function (_ [environment
[ownerT name
strict-fp? annotations vars
@@ -985,11 +989,11 @@
(let [local-mapping (|> environment
list.enumerate
(list@map (function (_ [foreign-id capture])
- [(#reference.Foreign foreign-id)
+ [(#variable.Foreign foreign-id)
(|> global-mapping
(dictionary.get capture)
maybe.assume)]))
- (dictionary.from-list reference.hash))]
+ (dictionary.from-list variable.hash))]
[ownerT name
strict-fp? annotations vars
self-name arguments returnT exceptionsT