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

Add support for the recover() builtin function #2331

Merged
merged 4 commits into from
Jun 16, 2022
Merged

Add support for the recover() builtin function #2331

merged 4 commits into from
Jun 16, 2022

Commits on Jun 15, 2022

  1. runtime: scan all writable program segments

    Previously we used to scan between _edata and _end. This is not correct:
    the .data section starts *before* _edata.
    
    Fixing this would mean changing _edata to _etext, but that didn't quite
    work either. It appears that there are inaccessible pages between _etext
    and _end on ARM. Therefore, a different solution was needed.
    
    What I've implemented is similar to Windows and MacOS: namely, finding
    writable segments by parsing the program header of the currently running
    program. It's a lot more verbose, but it should be correct on all
    architectures. It probably also reduces the globals to scan to those
    that _really_ need to be scanned.
    
    This bug didn't result in issues in CI, but did result in a bug in the
    recover branch: #2331. This
    patch fixes this bug.
    aykevl committed Jun 15, 2022
    Configuration menu
    Copy the full SHA
    fc28b11 View commit details
    Browse the repository at this point in the history
  2. compiler: fix basic block context

    llvm.AddBasicBlock should never be used. Instead, we should use the
    AddBasicBlock method of the current LLVM context.
    
    This didn't lead to any bugs... yet. But probably would, eventually.
    aykevl committed Jun 15, 2022
    Configuration menu
    Copy the full SHA
    405dd87 View commit details
    Browse the repository at this point in the history
  3. compiler: insert basic blocks at an appropriate location

    For example, this commit moves the 'throw' branch of an assertion (nil
    check, slice index check, etc) to the end of the function while
    inserting the "continue" branch right after the insert location. This
    makes the resulting IR easier to follow.
    
    For some reason, this also reduces code size a bit on average. The
    TinyGo smoke tests saw a reduction of 0.22%, mainly from WebAssembly.
    The drivers repo saw little average change in code size (-0.01%).
    
    This commit also adds a few compiler tests for the defer keyword.
    aykevl committed Jun 15, 2022
    Configuration menu
    Copy the full SHA
    f2fd452 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    5b3785c View commit details
    Browse the repository at this point in the history