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

Uncurry optimization #24

@vaivaswatha

Description

@vaivaswatha

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    optimizationcode optimization - run time improvements

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions