Rename plugin pointer types#2813
Merged
stevenengler merged 4 commits intoshadow:mainfrom Mar 29, 2023
Merged
Conversation
sporksmith
approved these changes
Mar 29, 2023
Contributor
It's ok - mine still needs a little work, and I don't think the conflicts will be too bad |
Used the following commands, and a few manual fixes: ``` rg 'PluginPtr' --files-with-matches | xargs sed -i '/TypedPluginPtr/!s/PluginPtr/ForeignPtr/g' rg 'pluginPtr' --files-with-matches | xargs sed -i 's/pluginPtr/foreignPtr/g' rg 'plugin_ptr' --files-with-matches | xargs sed -i 's/plugin_ptr/foreign_ptr/g' rg 'pluginBufPtr' --files-with-matches | xargs sed -i 's/pluginBufPtr/foreignBufPtr/g' rg 'plugin pointer' --files-with-matches | xargs sed -i 's/plugin pointer/foreign pointer/g' ```
Used the following commands: ``` rg 'PluginVirtualPtr' --files-with-matches | xargs sed -i 's/PluginVirtualPtr/ForeignPtr/g' rg 'c::ForeignPtr' --files-with-matches | xargs sed -i 's/c::ForeignPtr/ForeignPtr/g' ```
Used the following command: ``` rg 'TypedPluginPtr' --files-with-matches | xargs sed -i 's/TypedPluginPtr/TypedArrayForeignPtr/g' ```
Used the following command: ``` rg 'PluginPhysicalPtr' --files-with-matches | xargs sed -i 's/PluginPhysicalPtr/ManagedPhysicalMemoryAddr/g' ```
stevenengler
added a commit
that referenced
this pull request
Apr 3, 2023
Follow-up to #2813. This makes `ForeignPtr` typed. There aren't many places where we need untyped pointers in Shadow, so making pointers typed should be the default. This also means that for a lot of pointers, we can define their type directly in the syscall handler. Pointer types should now be self-documenting, and it should be harder to accidentally access the pointers as the wrong type. An `UntypedForeignPtr` was added for compatibility with the C code. - added a generic type to `ForeignPtr` - added `UntypedForeignPtr` for C code which maps to `ForeignPtr<()>` in rust code - renamed `TypedArrayForeignPtr` to `ForeignArrayPtr` The intermediate commits have a lot of casts between pointer types so that each commit would build and run, but the final code should have only a few pointer type conversions. There are still some things that can be cleaned up, but I think this gets most of the code in.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PluginPtrtoForeignPtrPluginVirtualPtrtypedefTypedPluginPtrtoTypedArrayForeignPtrPluginPhysicalPtrtoManagedPhysicalMemoryAddrThis also renames some variables and function names to match.
@sporksmith If this ends up conflicting with your managed thread PR, let me know and I'll wait since it's probably easier for me to redo this than for you to deal with merge conflicts.