Repository navigation
Enable native metadata generation - #916
Conversation
fa574e6 to
da3a7bc
Compare
| internal static uint RhGetLoadedModules(IntPtr[] resultArray) | ||
| { | ||
| // CORERT-TODO: This got broken within the last week or so. We don't care for single file. | ||
| if (resultArray != null) |
There was a problem hiding this comment.
@nattress is it possible that the multifile changes broke RhGetLoadedModules and RhGetModuleFromEEType? I'm pretty sure the first one used to work.
There was a problem hiding this comment.
Yes, this got changed because of there is no 1:1 mapping between OS .dll and library for the multi file work.
To fix it:
- Change
RhGetModuleFromEETypetoreturn *(this->m_ppModuleManager)under CORERT ifdef. - Change
FindBlobto something likereturn pModuleManager->GetModuleSection(300 + blobId). - Store pointers to metadata blobs and mapping tables via
ReadyToRunHeaderinNodeFactory.cs
Hopefully, these changes will make the whole thing much cleaner.
There was a problem hiding this comment.
Thanks! Yes, I was expecting something like that to be the long term plan.
How about RhGetLoadedModules? Right now it seems like the runtime doesn't care about the list of modules loaded into the process. Should that be maintained at the FX level in the array initialized at the process startup, or should the runtime maintain it?
There was a problem hiding this comment.
I think it is more appropriate for System.Private.CoreLib to maintain it - storing the array of modules to a static in StartupCodeHelpers.InitializeModules should do it with what we have.
0f899e4 to
92ad500
Compare
|
I took out the changes that actually light up reflection to a different branch for now. This pull request is now limited to the non-controversial parts (generating the blobs and initializing the reflection subsystem). Reflection will not work, but at least we will start exercising the code paths. @jkotas PTAL |
| { return (m_usFlags & IsGenericFlag) != 0; } | ||
|
|
||
| #if defined(CORERT) | ||
| ModuleManager* GetModule() |
There was a problem hiding this comment.
GetModuleManager may be a better name. Also, could you please change the one existing places that does *m_ppModuleManager to call this method instead?
There was a problem hiding this comment.
Do we really want to stick with ModuleManager? I was thinking about proposing to rename it to Module at some point, because ModuleManager makes me think of something that manages modules (this happened on multiple occasions before I got used to it). This thing represents a module, it doesn't manage them...
There was a problem hiding this comment.
(Or maybe ReadyToRunModule so that it doesn't clash with the Module that is already defined in Redhawk and corresponds to the OS module.)
There was a problem hiding this comment.
There are too many different existing things called module. I know that ModuleManager is not a great name ... I would love to have a better name, but I think it should be something more specific than Module.
There was a problem hiding this comment.
(One option may be TypeSystemManager - similar to CodeManager.)
There was a problem hiding this comment.
Renamed to GetModuleManager. It still feels funny though that a ModuleManager (or TypeSystemManager) would have a method called GetModuleSection that doesn't require the caller to specify what module to operate on, because the Manager is the Module. We also pretty much always store the ModuleManager in a variable called module...
Maybe the naming will become clear to me as we add more functionality to the Manager.
|
LGTM otherwise |
* Add code to generate a metadata blob containing type definition
metadata for all types that had an EEType generated in the current
compilation.
* Hook up Reflection.Execution by rooting the static constructor on
ReflectionExecution (this constructor is eager - just rooting it makes
it run).
* Add mock implementation of RhFindBlob that lets us find blob 13 -
metadata blob
This should be enough to support `Type.GetType("SomeType,
SomeAssembly")`. It's not enough to support things like
`foo.GetType().GetTypeInfo().FullName` - we need mapping table
generation for that.
EETypeRva field is now an EEType pointer.
92ad500 to
0745a41
Compare
|
Hmmm, this pull request has been in a permanent "build triggered" state for days. Asking dotnet bot to retest this doesn't help. I just pushed new commits to it and it still didn't change anything. Pull request 1017 I submitted after this is way ahead... @mmitche Any idea why? |
Enable native metadata generation
|
@MichalStrehovsky If you see a case like this, you can hit "Close Pull request" and then "Reopen pull request". |
metadata for all types that had an EEType generated in the current
compilation.
ReflectionExecution (this constructor is eager - just rooting it makes
it run).
metadata blob
This should be enough to support
Type.GetType("SomeType, SomeAssembly"). It's not enough to support things likefoo.GetType().GetTypeInfo().FullName- we need mapping tablegeneration for that.
Remaining work:
Not needed to pass CI, but needed to light up the feature: