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

SysCallHandler: don't store pointers to Process and Thread #2731

Merged
merged 5 commits into from
Feb 8, 2023

Conversation

sporksmith
Copy link
Contributor

These circular references otherwise somewhat complicate migrating Thread to Rust.

To facilitate getting rid of these, I added back worker_getCurrentProcess and worker_getCurrentThread. These are easier to implement safely now that they are wrapped in RootedRc objects, and we aren't trying to provide mutable access to the Rust objects. I tentatively still think it's better to prefer passing explicitly where possible, particularly in Rust code, but these are helpful in C code and for interop with C code during the migration.

@github-actions github-actions bot added the Component: Main Composing the core Shadow executable label Feb 7, 2023
This still has the MemoryCopier depending on the Worker and its active
Process, but a little better than having to ~incorrectly change the
current active thread just to be able to pass its native tid to the
MemoryCopier.
This removes circular references, which otherwise complicate the C->Rust
migtration of Thread.
@sporksmith
Copy link
Contributor Author

Queued a benchmark since this is somewhat hot-path https://github.com/shadow/benchmark/actions/runs/4118911692

@sporksmith
Copy link
Contributor Author

Benchmark results are a hair slower than the last nightly, but within the confidence interval of the weekly. https://github.com/shadow/benchmark-results/blob/master/tor/2023-02-08-T04-41-19/plots/run_time.png

@sporksmith sporksmith merged commit 793409b into shadow:main Feb 8, 2023
@sporksmith sporksmith deleted the drop-syscallhandler-ptrs branch February 8, 2023 16:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Main Composing the core Shadow executable
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants