From a6987ad82f107df49853e1601b73076d030d6fc8 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Mon, 1 Jun 2020 20:16:32 -0400 Subject: Implemented an optimization for getting fields/slots from records in the new compiler. --- .../source/luxc/lang/translation/jvm/extension/host.lux | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'lux-jvm/source/luxc/lang/translation/jvm/extension/host.lux') 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 -- cgit v1.2.3