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

[cdac] Read/store globals from contract descriptor #101450

Merged
merged 12 commits into from
Apr 26, 2024

Conversation

elinor-fung
Copy link
Member

@elinor-fung elinor-fung commented Apr 23, 2024

  • Map indirect global values to corresponding values in pointer_data array from contract descriptor
  • Add [Try]Read<T>, [Try]ReadPointer, [Try]ReadGlobal<T> and [Try]ReadGlobalPointer to Target
  • Make cDAC implementation of ISOSDacInterface9.GetBreakingChangeVersion read value from globals
  • Create test helpers for mocking out reading from the target and providing a contract descriptor for different bitness/endianness
  • Add unit tests for reading global values (direct and indirect)

Contributes to #99298

Copy link
Contributor

Tagging subscribers to this area: @tommcdon
See info in area-owners.md if you want to be subscribed.

value = pointerData[value].Value;
}

globals[name] = (value, global.Type);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just using the (optional) type string for now. I expect we'll do some mapping that isn't just string-based once we also read in the types.

Copy link
Member

@lambdageek lambdageek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly LGTM

  1. I'm not sure we want to do global type validation on every read. But it doesn't seem like we have enough info to know if there's a better place to do it in contracts. ok for now.
  2. nit: I like validation methods in unit tests to include the name of the failing test (and possibly line info) of the actual test, not just the validation method, right in the message, not only in the stack trace

src/native/managed/cdacreader/src/Target.cs Outdated Show resolved Hide resolved
src/native/managed/cdacreader/tests/TargetTests.cs Outdated Show resolved Hide resolved
elinor-fung and others added 2 commits April 25, 2024 09:44
Co-authored-by: Aaron Robinson <arobins@microsoft.com>
@elinor-fung elinor-fung merged commit 2d335f3 into dotnet:main Apr 26, 2024
143 of 150 checks passed
@elinor-fung elinor-fung deleted the cdac-read-globals branch April 26, 2024 03:30
matouskozak pushed a commit to matouskozak/runtime that referenced this pull request Apr 30, 2024
- Map indirect global values to corresponding values in `pointer_data` array from contract descriptor
- Add `[Try]Read<T>`, `[Try]ReadPointer`, `[Try]ReadGlobal<T>` and `[Try]ReadGlobalPointer` to `Target`
- Make cDAC implementation of `ISOSDacInterface9.GetBreakingChangeVersion` read value from globals
- Create test helpers for mocking out reading from the target and providing a contract descriptor for different bitness/endianness
- Add unit tests for reading global values (direct and indirect)
michaelgsharp pushed a commit to michaelgsharp/runtime that referenced this pull request May 9, 2024
- Map indirect global values to corresponding values in `pointer_data` array from contract descriptor
- Add `[Try]Read<T>`, `[Try]ReadPointer`, `[Try]ReadGlobal<T>` and `[Try]ReadGlobalPointer` to `Target`
- Make cDAC implementation of `ISOSDacInterface9.GetBreakingChangeVersion` read value from globals
- Create test helpers for mocking out reading from the target and providing a contract descriptor for different bitness/endianness
- Add unit tests for reading global values (direct and indirect)
@github-actions github-actions bot locked and limited conversation to collaborators May 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants