-
Notifications
You must be signed in to change notification settings - Fork 5k
[cDAC] Adds DAC like entrypoint with new COM interface #113899
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
Merged
Merged
Changes from all commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
573d12e
add DAC like entrypoint
c60292e
implement RuntimeInfo contract
238828d
convert to use IRuntimeInfo to fetch platform
95433f2
remove modifiers
bae1e05
add RuntimeInfo doc
5e06e14
improve error messages
7fec5a4
improve fetching runtimeinfo globals
26bea19
fix ContractDescriptorBuilder
20089c1
add RID define
1e6ed61
change runtimeinfo datastructures to be strings
5febe9b
fix managed portions of runtime info
717300d
implement runtime/cdac-built-tool portion of passing strings
abedd90
implement cdacreader portion of passing strings
bdf1a73
improve wording
f66fa9f
update contract doc
c13dfdf
rename cmake RID parameter
b39234c
add fallback entrypoint
08f557a
make it more clear we won't overrun buffer of GetThreadContext
40b78e0
remove trailing comma
a421798
add test for global string with escaped characters
9568f11
use portable RID value
4acb06c
update enum values
d11b62d
update example in contract descriptor
25e3da1
fix StressLogAnalyzer
1fc1289
improve docs using BNF
b1d5fd7
change error message in datadescriptors to point user in right direct…
54f186a
text
fe80a63
improve error message
6f83343
update doc
ca053e8
more doc
4de13eb
add note about undefined behavior
4880ec0
clean up BNF
d0a9e0b
fix macro expansion stringification
63de885
Merge remote-tracking branch 'origin/main' into cdac-new-entrypoint
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Contract RuntimeInfo | ||
|
||
This contract encapsulates support for fetching information about the target runtime. | ||
|
||
## APIs of contract | ||
|
||
```csharp | ||
public enum RuntimeInfoArchitecture : uint | ||
{ | ||
Unknown = 0, | ||
X86, | ||
Arm32, | ||
X64, | ||
Arm64, | ||
LoongArch64, | ||
RISCV, | ||
max-charlamb marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
public enum RuntimeInfoOperatingSystem : uint | ||
{ | ||
Unknown = 0, | ||
Win, | ||
Unix, | ||
max-charlamb marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
``` | ||
|
||
```csharp | ||
// Gets the targets architecture. If this information is not available returns Unknown. | ||
RuntimeInfoArchitecture GetTargetArchitecture(); | ||
|
||
// Gets the targets operating system. If this information is not available returns Unknown. | ||
RuntimeInfoOperatingSystem GetTargetOperatingSystem(); | ||
``` | ||
|
||
## Version 1 | ||
|
||
Global variables used: | ||
| Global Name | Type | Purpose | | ||
| --- | --- | --- | | ||
| Architecture | string | Target architecture | | ||
| OperatingSystem | string | Target operating system | | ||
|
||
The contract implementation simply returns the contract descriptor global values parsed as the respective enum case-insensitively. If these globals are not available, the contract returns Unknown. |
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#ifndef RUNTIME_INFO_CONFIGURE_H_INCLUDED | ||
#define RUNTIME_INFO_CONFIGURE_H_INCLUDED | ||
|
||
#define RID_STRING @CLR_DOTNET_RID@ | ||
|
||
#endif // RUNTIME_INFO_CONFIGURE_H_INCLUDED |
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This enum looks very similar to https://learn.microsoft.com/en-us/dotnet/api/system.runtime.interopservices.architecture
We may want to make the names exactly same (it can be still a separate enum to make versioning easier).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm happy to align with that enum.
I do have two follow-up questions:
Unknown
value in the enum in case the contract can't find the arch/OS. I could modifyUnknown
to be-1
instead of0
to use the exact same values asSystem.Runtime.InteropServices.Architecture
. If you don't care, I'd prefer to have0
because its the default value.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not care. I would just keep the exact same order and names.
This type is not an enum. It is a struct with a set of methods and it is soft-deprecated (we are not adding new members to this type for new OSes).
The actively maintained type is https://learn.microsoft.com/en-us/dotnet/api/system.operatingsystem.version?view=net-9.0 . Again, no enum there - just a bunch of
Is...
methods. If you are looking for something to align the managed OS names with, this one would be the managed type to align with.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. Under
System.OperatingSystem.Version
, there is thePlatformId
enum (https://learn.microsoft.com/en-us/dotnet/api/system.platformid?view=net-9.0) which usesWin32NT
for modern Windows.RuntimeInfoOperatingSystem
We could align with the
PlatformID
enum or keep the existing values.RuntimeInfoArchitecture
Based on previous comments, aligned with the
System.Runtime.InteropServices.Architecture
values +Unknown
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is soft-deprecated enum as well. It does not make sense to align with it.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PlatformID also has a number of issues with the actual implementation/usage in the runtimes, so I'd also recommend against trying to align with it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on feedback, I have settled on option 1 (above) for
RuntimeInfoOperatingSystem
and the listedRuntimeInfoArchitecture
enum.