Skip to content

Introduce separate bytecode for applying combinator #11

@Abhiroop

Description

@Abhiroop

Issue by Abhiroop
Friday Apr 30, 2021 at 09:57 GMT
Originally opened as svenssonjoel/Sense-VM#11


Currently, in the VM a combinator is represented on the heap using a dummy value

(combinator_label, 4294967295) // the dummy value is UINT_MAX

Represented here in the code: https://github.com/svenssonjoel/Sense-VM/blob/master/backend/src/CAM.c#L1110-L1115

Later when evaluating an APP bytecode a runtime check is done to determine if applying on a combinator or a closure done here: https://github.com/svenssonjoel/Sense-VM/blob/master/backend/src/CAM.c#L372-L418

This runtime check is expensive. Instead, we should try to generate an APPCOMB separate bytecode when applying a combinator to avoid the runtime check. The peephole optimisation should be extended to add rules with APPCOMB etc

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions