This repository was archived by the owner on Nov 13, 2026. It is now read-only.
Repository navigation
Merge nmirror to master - #1488
Merged
Merged
Conversation
Merge nmirror to master
There is a bug in my previous checkin found by precheckin---The access modifier for McgCompilationUnit property in workitem is public and thus it can be accessed by other workitem through McgIRType. When composing app CompilationUnit during shared mode, this will allow a marshaller in app CompilationUnit to access outputdom in shared interop CompilationUnit and even to add a type into shared interop OutputDom. The fix is to change McgCompilationUnit property access modifier from public to protected. so only workitem itself can access its own OutputDom.
With above change, another issue hit--WinRTDelegate marshaller needs to generate its calli delegate for invoke stub function into correct CompilationUnit/OutputDom.
For example, IReference<AsyncActionCompletedHandler> is a type in app CompilationUnit and AsyncActionCompletedHandler is a type in shared CompilationUnit.
when generating IReference__AsyncActionCompletedHandler__impl's stub class in app CompilationUnit, WinRTDelegateMarshaller will fetch AsyncActionCompletedHandler workitem and then it can get its typehandle/delegate invoke method pointer and also generate calli delegate for delegate invoke method. The calli delegate should be generated in app CompilationUnit instead of shared CompilationUnit, but all these marshaller doesn't know which CompilationUnit is working on.
Here are some possible solutions for this.
a. pass CompilationUnit into marshaller
con: it's hard to maintain/debug if something goes wrong.
b. add a static CurrentCompilationUnit
pro: close the one before my change: MCG.CompilationUnit
con: need to make sure CurrentCompilationUnit is correctly set.
c. [Current]Don't pass InvokeStub Function Pointer in McgMarshal.ComInterfaceToDelegate. Store InvokeStub function pointer into mcg data and fetch it through mcgmodulemanager.
pro: Delegate Stub can be shared stub and each CompilationUnit is more isolated.
con: during runtime, it will take more time to get delegate invoke stub function pointer.
Details:
1. remove MCG.CompilationUnit
2. remove MCG.CompilationUnitCollection
3. rename mcgmodule.cs into mcgdatamodule.cs
4. refactor methods in McgDataModule from static to instance--avoid pass a bunch of arguments
5. refactor outputdom:
a. previous we will generate method (such as "ConvertStringToBSTR") dynamically
now just add ConvertStringToBSTR into mcghelpers.cs
b. remove all these exception string/replace
c. move some attributes into wellknown attributes
6.. add a private field in workitembase: m_compilationUnit and protected property to access it, each workitem instance can only access its own compilationUnit.
7. add a new field DelegateInvokeStub into McgInterfaceData, this will allow Delegate Stub can be shared too.
6. other small changes.
[tfs-changeset: 1616205]
Merge changes from TFS
I didn't bother unifying CorElementType enum because this should really be fixed with #478 so that we can stop wasting bits on EEType. [tfs-changeset: 1616408]
I didn't bother unifying CorElementType enum because this should really be fixed with #478 so that we can stop wasting bits on EEType. [tfs-changeset: 1616408]
[tfs-changeset: 1616430]
Merge changes from TFS
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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
No description provided.