AaronRobinsonMSFT / DNMD

Reimplementation of ECMA-335 metadata APIs
MIT License
16 stars 3 forks source link

Primary use cases? #23

Closed xoofx closed 1 year ago

xoofx commented 1 year ago

Hey, I stumbled on this library and I'm really curious about understanding the rationale behind this part of the readme:

The primary goal of DNMD is to explore the benefits of a rewrite of the metadata APIs found in dotnet/runtime.

What are the primary use cases you have in mind to use this library?

I could infer that we have lots of C++ code in dotnet/runtime that is parsing the metadata (mainly in the JIT?). Is it for this particular case first?

Thanks! 🙂

AaronRobinsonMSFT commented 1 year ago

What are the primary use cases you have in mind to use this library?

The clearest non-dotnet/runtime related use case is to fold it into a profiler, code coverage tool, or perhaps debugger that requires being written in unmanaged code. The runtime does provide all interfaces for these tools, but this library permits creation of more self contained tools. I have been asked by tool authors that are restricted to unmanaged code for these types of projects.

have lots of C++ code in dotnet/runtime that is parsing the metadata (mainly in the JIT?).

The JIT defers to the VM, where it is exposed through the JIT interface. You can find the source under src/coreclr/md, which is very old. The VM itself does a lot of metadata reading during type loading.

@jkoritzinsky and I are exploring the feasibility of replacing the current dotnet/runtime implementation. If you read the constraints in the readme, it aligns not only with coreclr but could also potentially apply to mono.

xoofx commented 1 year ago

Makes senses, thanks for the details!