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

Rewrite rest of the RTS in Rust #2210

Merged
merged 95 commits into from
Jan 19, 2021
Merged

Rewrite rest of the RTS in Rust #2210

merged 95 commits into from
Jan 19, 2021

Commits on Dec 21, 2020

  1. Move alloc_array to Rust

    Native uses of alloc_array are duplicated in the native test files.
    Those will be removed when the tests are ported to Rust.
    osa1 committed Dec 21, 2020
    Configuration menu
    Copy the full SHA
    b8aeb64 View commit details
    Browse the repository at this point in the history
  2. Move closure table to Rust

    This also changes how we store the next free index a little bit. The
    constant `FULL` is gone, when the next free location is equal to the
    array length that's how we know the table is full now. Also, `FREE_SLOT`
    no longer next free location shifted left, it holds the next free
    location directly (not shifted).
    osa1 committed Dec 21, 2020
    Configuration menu
    Copy the full SHA
    135517c View commit details
    Browse the repository at this point in the history
  3. Commit debug stuff

    osa1 committed Dec 21, 2020
    Configuration menu
    Copy the full SHA
    5eb1618 View commit details
    Browse the repository at this point in the history
  4. Move buf to Rust

    osa1 committed Dec 21, 2020
    Configuration menu
    Copy the full SHA
    822497d View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    cc5a954 View commit details
    Browse the repository at this point in the history

Commits on Dec 23, 2020

  1. Configuration menu
    Copy the full SHA
    8ff636b View commit details
    Browse the repository at this point in the history
  2. Move closure table tests to Rust

    osa1 committed Dec 23, 2020
    Configuration menu
    Copy the full SHA
    61a77c0 View commit details
    Browse the repository at this point in the history

Commits on Dec 24, 2020

  1. Configuration menu
    Copy the full SHA
    48cb96a View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    f0f068d View commit details
    Browse the repository at this point in the history

Commits on Dec 25, 2020

  1. Move more text functions to Rust, lots of refactoring

    - Introduced `as_blah` methods to convert a SkewedPtr or *Obj to other
      object types. These methods check the type in debug mode.
    
    - Improve error reporting, we know show details in assertion failures
    
    - Temporarily link with debug runtime to enable sanity checking by
      default for now
    osa1 committed Dec 25, 2020
    Configuration menu
    Copy the full SHA
    33e560f View commit details
    Browse the repository at this point in the history
  2. Move text_iter_next to Rust

    osa1 committed Dec 25, 2020
    Configuration menu
    Copy the full SHA
    63e2b87 View commit details
    Browse the repository at this point in the history
  3. Move rest of text.c to Rust

    osa1 committed Dec 25, 2020
    Configuration menu
    Copy the full SHA
    3d6cb55 View commit details
    Browse the repository at this point in the history
  4. Move char to Rust

    osa1 committed Dec 25, 2020
    Configuration menu
    Copy the full SHA
    6db438e View commit details
    Browse the repository at this point in the history
  5. Minor refactor

    osa1 committed Dec 25, 2020
    Configuration menu
    Copy the full SHA
    541c146 View commit details
    Browse the repository at this point in the history
  6. Move blob to Rust

    osa1 committed Dec 25, 2020
    Configuration menu
    Copy the full SHA
    1128ee5 View commit details
    Browse the repository at this point in the history
  7. Move utf8 stuff to Rust

    osa1 committed Dec 25, 2020
    Configuration menu
    Copy the full SHA
    fd013f2 View commit details
    Browse the repository at this point in the history
  8. Move leb128 stuff to Rust

    osa1 committed Dec 25, 2020
    Configuration menu
    Copy the full SHA
    6d214c0 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    bed0bcd View commit details
    Browse the repository at this point in the history
  10. Move (s)leb128 encoding to Rust

    osa1 committed Dec 25, 2020
    Configuration menu
    Copy the full SHA
    19972d9 View commit details
    Browse the repository at this point in the history
  11. Move float functions to Rust

    osa1 committed Dec 25, 2020
    Configuration menu
    Copy the full SHA
    496a63e View commit details
    Browse the repository at this point in the history
  12. Comments in alloc_blob

    osa1 committed Dec 25, 2020
    Configuration menu
    Copy the full SHA
    f0aabe0 View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    8cb19e2 View commit details
    Browse the repository at this point in the history
  14. Refactor Cargo files

    osa1 committed Dec 25, 2020
    Configuration menu
    Copy the full SHA
    3fc2b54 View commit details
    Browse the repository at this point in the history

Commits on Dec 26, 2020

  1. Configuration menu
    Copy the full SHA
    e7187ff View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    1a4941b View commit details
    Browse the repository at this point in the history

Commits on Dec 27, 2020

  1. Configuration menu
    Copy the full SHA
    aae504a View commit details
    Browse the repository at this point in the history
  2. Minor bug fix, refactor

    osa1 committed Dec 27, 2020
    Configuration menu
    Copy the full SHA
    2819827 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    1eaabbd View commit details
    Browse the repository at this point in the history

Commits on Dec 28, 2020

  1. Configuration menu
    Copy the full SHA
    3f59326 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    977aadf View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    6054532 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    d0bbd48 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    33dc04f View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    d8c0ca6 View commit details
    Browse the repository at this point in the history
  7. Simplify Makefiles, Cargo.tomls

    osa1 committed Dec 28, 2020
    Configuration menu
    Copy the full SHA
    f463930 View commit details
    Browse the repository at this point in the history
  8. More build simplifications

    osa1 committed Dec 28, 2020
    Configuration menu
    Copy the full SHA
    619912f View commit details
    Browse the repository at this point in the history
  9. More build simplifications

    osa1 committed Dec 28, 2020
    Configuration menu
    Copy the full SHA
    cfada21 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    77c501a View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    c66440e View commit details
    Browse the repository at this point in the history
  12. Drop utf8_width

    osa1 committed Dec 28, 2020
    Configuration menu
    Copy the full SHA
    3b9c244 View commit details
    Browse the repository at this point in the history
  13. Disable native tests for now

    osa1 committed Dec 28, 2020
    Configuration menu
    Copy the full SHA
    39d3c39 View commit details
    Browse the repository at this point in the history
  14. Use release build

    osa1 committed Dec 28, 2020
    Configuration menu
    Copy the full SHA
    1a23685 View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    d692a26 View commit details
    Browse the repository at this point in the history

Commits on Dec 29, 2020

  1. Move BigInt tests to Rust

    osa1 committed Dec 29, 2020
    Configuration menu
    Copy the full SHA
    bac8a8e View commit details
    Browse the repository at this point in the history
  2. Move UTF-8 tests to Rust

    osa1 committed Dec 29, 2020
    Configuration menu
    Copy the full SHA
    f5b0652 View commit details
    Browse the repository at this point in the history
  3. Move crc32 tests to Rust

    osa1 committed Dec 29, 2020
    Configuration menu
    Copy the full SHA
    b9de82e View commit details
    Browse the repository at this point in the history
  4. Move principal id tests to Rust

    osa1 committed Dec 29, 2020
    Configuration menu
    Copy the full SHA
    1440b3c View commit details
    Browse the repository at this point in the history
  5. Implement QC tests, found a bug

    osa1 committed Dec 29, 2020
    Configuration menu
    Copy the full SHA
    2f55974 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    4521f23 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    8b9f526 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    25fa89e View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    d544645 View commit details
    Browse the repository at this point in the history
  10. Update .gitignore

    osa1 committed Dec 29, 2020
    Configuration menu
    Copy the full SHA
    b917d2c View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    abe5da2 View commit details
    Browse the repository at this point in the history

Commits on Dec 30, 2020

  1. Remove hard-coded concat size

    osa1 committed Dec 30, 2020
    Configuration menu
    Copy the full SHA
    6c28fb4 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    42328e3 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    9efc3ba View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    7addce6 View commit details
    Browse the repository at this point in the history

Commits on Dec 31, 2020

  1. Zero the slop after adjusting blob size in principal functions

    Also refactors object_size slightly
    
    Fixes #2216
    osa1 committed Dec 31, 2020
    Configuration menu
    Copy the full SHA
    61cb041 View commit details
    Browse the repository at this point in the history

Commits on Jan 1, 2021

  1. Fix struct reprs

    After several hours of debugging I found out that this struct
    
        #[repr(C)]
        pub struct Bits64 {
            pub header: Obj,
            pub bits: u64,
        }
    
    is compiled with one word padding between the fields when compiled to
    wasm32 targets, but *not* when compiled to i386!
    
    (This is weird, but I think not a bug, as wasm32 doesn't have a standard
    ABI, it's just "whatever LLVM implements", and apparently LLVM decides
    to align fields when compiling to wasm32)
    
    As a result `size_of::<Bits64>` returned 4 words, not 3, which is
    inconsistent with the compiler's view of this type.
    
    This doesn't really break the garbage collector. This is because we
    don't care about the bit contents of this type in the GC, and it's fine
    to copy 4 bytes instead of 3 bytes for this object as long as the
    generated code will find the bit contents in the right place.
    
    In other words, if we generate this in the compiler
    
        | TAG_BITS64 | word1 | word2 |
    
    and the GC copies it as
    
        | TAG_BITS64 | word1 | word2 | <one word garbage> |
    
    to tospace, that's still fine for the generated code, as it can still
    find the contents in the right places.
    
    However it's a problem for `dump_heap` as it linearly scans the heap. If
    we generate the first layout above then call `dump_heap`, it skips over
    the next object's tag, thinking that `Bits64` is 4 words.
    
    Even if it was OK the RTS and compiler should be in sync about the
    object layouts.
    
    I now replaced all `repr(C)` with more precise `repr(transparent)` and
    `repr(packed)`. Relevant documentation:
    https://doc.rust-lang.org/nomicon/other-reprs.html
    
    I think this is a good idea even for the cases where repr(C) did not
    cause any problems, because repr(C) raises the question of "how would
    this be represented in C?". transparent and packed are much more
    precise:
    
    - packed: Don't align fields, don't add padding
    - transparent: Represent as if the struct (newtype) did not exist
      (newtypes are represented this way on most platforms anyway, see the
      linked documentation above)
    osa1 committed Jan 1, 2021
    Configuration menu
    Copy the full SHA
    4b45424 View commit details
    Browse the repository at this point in the history

Commits on Jan 4, 2021

  1. Configuration menu
    Copy the full SHA
    72e4663 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    21a5774 View commit details
    Browse the repository at this point in the history
  3. Update test messages

    osa1 committed Jan 4, 2021
    Configuration menu
    Copy the full SHA
    70ce96c View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    b7d2ecf View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    455f6c5 View commit details
    Browse the repository at this point in the history

Commits on Jan 5, 2021

  1. Typo fix in Concat debug print

    osa1 committed Jan 5, 2021
    Configuration menu
    Copy the full SHA
    1448a99 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    1ac6355 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    6d3e94d View commit details
    Browse the repository at this point in the history

Commits on Jan 11, 2021

  1. Configuration menu
    Copy the full SHA
    0fdc1bc View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    b7ecb34 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    e9a9748 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    8733104 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    37ac599 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    7e2c60b View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    4787991 View commit details
    Browse the repository at this point in the history
  8. Use alloc_array in text_iter

    osa1 committed Jan 11, 2021
    Configuration menu
    Copy the full SHA
    fdee600 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    9a4ffcc View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    7b3b504 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    e025135 View commit details
    Browse the repository at this point in the history

Commits on Jan 13, 2021

  1. Configuration menu
    Copy the full SHA
    b39bd2b View commit details
    Browse the repository at this point in the history

Commits on Jan 19, 2021

  1. stash

    nomeata committed Jan 19, 2021
    Configuration menu
    Copy the full SHA
    ed6b571 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    fadf397 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    071c39e View commit details
    Browse the repository at this point in the history
  4. Clean more

    nomeata committed Jan 19, 2021
    Configuration menu
    Copy the full SHA
    e20cbbd View commit details
    Browse the repository at this point in the history
  5. No RTS tests on darwin

    nomeata committed Jan 19, 2021
    Configuration menu
    Copy the full SHA
    e94bcfc View commit details
    Browse the repository at this point in the history
  6. Update vendor hash

    nomeata committed Jan 19, 2021
    Configuration menu
    Copy the full SHA
    2a1b04c View commit details
    Browse the repository at this point in the history
  7. fix shell

    nomeata committed Jan 19, 2021
    Configuration menu
    Copy the full SHA
    4e9524c View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    4023191 View commit details
    Browse the repository at this point in the history
  9. Run the RTS tests in wasmtime/WASI

    this is easier to build on all platforms, compared to building for 32bits.
    
    It also means we are testing things closer to what we really run.
    nomeata committed Jan 19, 2021
    Configuration menu
    Copy the full SHA
    c06a141 View commit details
    Browse the repository at this point in the history
  10. Use llvm-ar?

    nomeata committed Jan 19, 2021
    Configuration menu
    Copy the full SHA
    06fc768 View commit details
    Browse the repository at this point in the history
  11. Typo

    nomeata committed Jan 19, 2021
    Configuration menu
    Copy the full SHA
    05fa886 View commit details
    Browse the repository at this point in the history
  12. More typo

    nomeata committed Jan 19, 2021
    Configuration menu
    Copy the full SHA
    18d5351 View commit details
    Browse the repository at this point in the history
  13. Simplify Makefile

    nomeata committed Jan 19, 2021
    Configuration menu
    Copy the full SHA
    1d09658 View commit details
    Browse the repository at this point in the history
  14. Merge pull request #2265 from dfinity/joachim/rts-tests-via-wasm

    Run the RTS tests in wasmtime/WASI
    nomeata committed Jan 19, 2021
    Configuration menu
    Copy the full SHA
    0773ebc View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    8cf18d5 View commit details
    Browse the repository at this point in the history