Skip to content

Static initialization of SFT Map #531

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

Closed
qinsoon opened this issue Jan 28, 2022 · 0 comments · Fixed by #632
Closed

Static initialization of SFT Map #531

qinsoon opened this issue Jan 28, 2022 · 0 comments · Fixed by #632
Labels
A-heap Area: Heap (including Mmapper, VMMap) C-bug Category: Bug

Comments

@qinsoon
Copy link
Member

qinsoon commented Jan 28, 2022

Currently we allocate and initialize SFTMap during MMTK::new(). This takes roughly 100ms and can make the VM start up time noticeably slower.

Ideally we could directly allocate and initialize a static SFTMap:

pub static mut SFT_MAP: SFTMap<'static> = SFTMap {
    sft: [&EMPTY_SPACE_SFT; MAX_CHUNKS]
};

However, doing this at the moment will cause really bad build time (~5min to 10min for debug build). This seems to be a known issue for large arrays in Rust (e.g. rust-lang/rust#49330).

There is some discussion mentioning that if we initialize large arrays of value 0, that wouldn't be an issue.

We probably either wait for Rust to fix this (however, it seems unlikely in a short time), or change our implementation to work around the issue.

@qinsoon qinsoon added C-bug Category: Bug A-heap Area: Heap (including Mmapper, VMMap) labels Jan 28, 2022
qinsoon added a commit that referenced this issue Sep 28, 2022
This pull request adds an SFT map implementation for 64 bits systems, which maps one MMTk space to an entry in the SFT map. This closes #219 and closes #531.

This PR fixes the large memory usage and slow boot time caused by the sparse SFT map on 64bits.

* move SFT and SFT map code from the `space` module to separate `sft` and `sft_map` modules.
* rename the current `struct SFTMap` to `struct SFTSparseChunkMap`
* add `struct SFTSpaceMap`
* add `struct SFTDenseChunkMap`
* add `trait SFTMap`. Both `SFTSpaceMap` and `SFTChunkMap` implement `trait SFTMap`
* add feature `malloc_mark_sweep`
* it depends on the build which `SFTMap` implementation is used:
  * for 32 bits, use `SFTSparseChunkMap`.
  * for 64 bits with `malloc_mark_sweep`, use `SFTDenseChunkMap`.
  * for 64 bits without `mallco_mark_sweep`, use `SFTSpaceMap`.
k-sareen pushed a commit to k-sareen/mmtk-core that referenced this issue Sep 30, 2022
This pull request adds an SFT map implementation for 64 bits systems, which maps one MMTk space to an entry in the SFT map. This closes mmtk#219 and closes mmtk#531.

This PR fixes the large memory usage and slow boot time caused by the sparse SFT map on 64bits.

* move SFT and SFT map code from the `space` module to separate `sft` and `sft_map` modules.
* rename the current `struct SFTMap` to `struct SFTSparseChunkMap`
* add `struct SFTSpaceMap`
* add `struct SFTDenseChunkMap`
* add `trait SFTMap`. Both `SFTSpaceMap` and `SFTChunkMap` implement `trait SFTMap`
* add feature `malloc_mark_sweep`
* it depends on the build which `SFTMap` implementation is used:
  * for 32 bits, use `SFTSparseChunkMap`.
  * for 64 bits with `malloc_mark_sweep`, use `SFTDenseChunkMap`.
  * for 64 bits without `mallco_mark_sweep`, use `SFTSpaceMap`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-heap Area: Heap (including Mmapper, VMMap) C-bug Category: Bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant