Skip to content

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

Merged
sporksmith merged 5 commits intoshadow:mainfrom
sporksmith:drop-syscallhandler-ptrs
Feb 8, 2023
Merged

SysCallHandler: don't store pointers to Process and Thread#2731
sporksmith merged 5 commits intoshadow:mainfrom
sporksmith:drop-syscallhandler-ptrs

Conversation

@sporksmith
Copy link
Copy Markdown
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 sporksmith force-pushed the drop-syscallhandler-ptrs branch from 6cc124e to 60625e8 Compare February 7, 2023 22:30
@sporksmith
Copy link
Copy Markdown
Contributor Author

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

@sporksmith
Copy link
Copy Markdown
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.

2 participants