Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cgen: make .global.s work more according to spec #536

Merged
merged 1 commit into from
Feb 14, 2023

Commits on Feb 13, 2023

  1. cgen: make .global.s work more according to spec

    For the C target, globals defined inside procedures that are resource-
    like (i.e. have a user-defined or lifted destructor) are now
    initialized in a module's pre-init procedure, instead of each time
    control-flow reaches the definition. This mirrors what already happened
    for non-resource-like globals.
    
    In addition, globals defined in `inline` procedures no longer cause
    linking errors because of duplicated definitions in the generated C
    code.
    
    The globals are extracted before translating the AST to MIR code,
    making the workaround in `mirgen` (that didn't work anyway) obsolete.
    In order to work towards unifying the architecture of the back-ends,
    `vmbackend` now also makes use of the pre-extraction, no longer
    requiring extra logic in the code-generator.
    
    - the destructor injection pass is not run for the initializer
      expression of globals defined inside procedures
    - `.global.`s on the JS target still don't work according to
      specification
    zerbina committed Feb 13, 2023
    Configuration menu
    Copy the full SHA
    b114b8d View commit details
    Browse the repository at this point in the history