Skip to content
This repository has been archived by the owner on Oct 28, 2022. It is now read-only.

Uncurry optimization #24

Open
vaivaswatha opened this issue Nov 20, 2019 · 0 comments
Open

Uncurry optimization #24

vaivaswatha opened this issue Nov 20, 2019 · 0 comments
Labels
optimization code optimization - run time improvements

Comments

@vaivaswatha
Copy link
Contributor

vaivaswatha commented Nov 20, 2019

Scilla's semantics for function applications follows currying semantics.

i.e., when we have let foo = fun (a : Int32) => fun (b : Int32) => ... and an application foo a b, then it is evaluated as "apply a to foo to get function, and b is applied to this result function". In the case of foo never being applied partially, we should replace the curried functions with a single function that takes two arguments fun (a : Int32, b : Int32).

PR #25 defines types and AST to accommodate functions (and function types) that take multiple arguments. Passes after it (ex: closure conversion) are already designed to work on functions with multiple arguments (and type applications having non-currying semantics).

Therefore, an optimization is needed to combine curried functions without partial application uses.

This requires

  1. An analysis to figure out which functions aren't partially applied.
  2. Combine the function funs into a single definition taking multiple arguments.
  3. Combine App sequences (which represent a sequence of partial applications: see Explicitize partial applications of functions. #23, Define an AST with no currying semantics and translate to it #25 ) into an App with multiple arguments.

The transformation can likely be written in Uncurry.ml, after the translation into Uncurried_Syntax.

@vaivaswatha vaivaswatha added the optimization code optimization - run time improvements label Nov 20, 2019
@vaivaswatha vaivaswatha changed the title Non currying semantics for functions without partial application Decurry optimization Nov 21, 2019
@vaivaswatha vaivaswatha changed the title Decurry optimization Uncurry optimization Nov 21, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
optimization code optimization - run time improvements
Projects
None yet
Development

No branches or pull requests

1 participant