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

Add DNMD into src/native #107961

Draft
wants to merge 148 commits into
base: main
Choose a base branch
from
Draft

Conversation

jkoritzinsky
Copy link
Member

@jkoritzinsky jkoritzinsky commented Sep 17, 2024

Add dnmd into the dotnet/runtime repo for usage by cDAC (and in the future, usage as the native ECMA-335 metadata library for the repo as a whole).

Depends on #107889, #108999

Static lib for reading ECMA-335 metadata
Confirmed works against all .NET 6.0 BCL
assemblies.
Update dnmd.h for compiling in C++
Add a debugging process for validating
using the correct enumeration when using
an enumeration column index.
Portable PDB support can be enabled by building
with the DNMD_PORTABLE_PDB define.
Still fails to compile on non-WIndows due to
missing PE image data structures.
Udate public API and remove CorTokenType
Builds with no obvious regressions
in the mddump scenario.
library for dnmd_interfaces
Implemented minimal IMetaDataDispenser
Testing for several methods on IMetaDataImport
Add test for ResetEnum
Update HCORENUM implementation to be
  a singly linked list to reduce allocations.
Remove md_row_distance()
Change low level UserStrings API
Add walk UserStrings heap API
Use "userstring" instead of "wchar" for APIs.
New API for reverse mapping from range to
  root in mapping table.
@jkoritzinsky
Copy link
Member Author

jkoritzinsky commented Sep 21, 2024

for usage by cDAC

Is it actually going to be a net win to use unmanaged metadata reader in cDAC?

For cDAC in particular, the idea was to use DNMD for the IMetaDataImport exposure from CLRDataModule.

usage as the native ECMA-335 metadata library for the repo as a whole

It would make more sense to me to focus on this part: prove that this metadata reader is at least as good as the existing runtime reader and replace the current the runtime reader.

I'd like to eventually use DNMD throughout the repo, but I plan to do more perf work in actual CoreCLR and Mono scenarios (after merging this preferably as doing actual testing in the runtime will require some corresponding runtime changes).

@jkotas
Copy link
Member

jkotas commented Sep 21, 2024

For cDAC in particular, the idea was to use DNMD for the IMetaDataImport exposure from CLRDataModule.

Is IMetaDataImport interface exposed by this? I only see several custom enumerators.

Also, we have discussed the possibility of cDac world no longer supporting some of the redundant DAC interfaces like IXCLRData... that are only used by windbg for historic reasons and where fixing windbg may be a better long-term path.

@jkoritzinsky
Copy link
Member Author

It is through a "poor-man's COM Aggregation" implementation in the QueryInterface implementation.

@davidwrighton asked about using DNMD for this case (which is why I looked at doing this for the hackathon now).

@jkoritzinsky
Copy link
Member Author

Coming back to this: With some changes to DNMD, I was able to match (and seemingly beat) the performance of the current reader in CoreCLR in my local testing for read-only scenarios.

@jkoritzinsky
Copy link
Member Author

I re-written the history and cleaned up this PR to not add as many commits to the history and utilize already-merged work from various PRs (including the perf improvements added to DNMD from experimenting with CoreCLR).

@jkoritzinsky
Copy link
Member Author

/azp run runtime

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Convert testing harness to C++11.
Convert DNMD PALs to use the minipal and the COM minipal.
Integrate DNMD testing into the CLR_Tools_Tests job.
…ce a .data() member, matching the C++20 design for span<T>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Infrastructure Hackathon Issues picked for Hackathon NO-MERGE The PR is not ready for merge yet (see discussion for detailed reasons) NO-REVIEW Experimental/testing PR, do NOT review it
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

4 participants