-
Notifications
You must be signed in to change notification settings - Fork 70
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
Uninitialized Fields #57
Comments
In GitLab by @qinsoon on Jan 26, 2020, 11:45 mentioned in merge request !22 |
In GitLab by @qinsoon on Jan 26, 2020, 19:10 mentioned in merge request !23 |
This pull request removes `Plan.gc_init()`, and `Space.init()`. I think this can close the issue: #57, I am not aware of any occurrences of two-step initialisation in MMTk after this PR. Note that We eagerly set SFT for each space in their `Space.init()` if they are contiguous and SFT needs a non-moving reference to the `Space`. When we create a `Space`, the reference points to an address on the stack, and will be moved. So we cannot set SFT at creation. I added a method `Space.initialize_sft()` which is called after the `Space` has a fixed address. `initialize_sft()` is only used to set SFT, not any other post-creation initialisation.
We have gradually removed the pattern. I am not aware of any unnecessary two-step initialisation in our code base. I feel we can close this issue now. If you find anything that is related with this issue and hasn't been addressed, please reply to this issue. Otherwise, I will close this issue soon. |
Closed as above |
In GitLab by @qinsoon on Jan 26, 2020, 11:44
A lot of structs in Rust MMTk are initialized with some uninitialized fields. We are using empty values (such as
0
,OpaquePointer::EMPTY
),mem::uninitialized()
, orOption::None
for the uninitialized fields.The reasons why those uninitialized fields exist are:
init()
step to properly set values for those fields.I suggest we do these:
init()
so that all the fields are initialized properly innew()
. We should do this wherever possible.init()
, we should use a wrapper to properly indicate that this field might be uninitialized such asMaybeUninit<T>
.This issue is raised in code reviews for both https://gitlab.anu.edu.au/mmtk/mmtk/merge_requests/20 and https://gitlab.anu.edu.au/mmtk/mmtk/merge_requests/22.
The text was updated successfully, but these errors were encountered: