Skip to content

feat: support function inlining in ZkC #1632

@DavePearce

Description

@DavePearce

(see also #1630)

Summary

The goal of this feature is to support function inlining in ZkC directed by an @inline attribute.

Minimal Example

fn f(x:u32) -> (y:u32) {
   y = 2 * g(x)
}

@inline
fn g(x:u32) -> (y:u32) {
   y = x + 1
}

Then, the compiler is responsible for automatically converting the above into the following form:

n f(x:u32) -> (y:u32) {
   y = 2 * (x + 1)
}

As usual, the goal of this optimisation is to reduce the overhead of function's. In ZkC these can be more expensive than in a generate compute setting, since functions correspond with modules in the final AIR constraints.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestzkcIssues related to ZkC language

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions