Skip to content
This repository was archived by the owner on Nov 13, 2026. It is now read-only.

Merge changes from TFS - #1469

Merged
MichalStrehovsky merged 1 commit into
dotnet:nmirrorfrom
dotnet-bot:from-tfs
Jul 6, 2016
Merged

MichalStrehovsky merged 1 commit into
dotnet:nmirrorfrom
dotnet-bot:from-tfs

Conversation

@dotnet-bot

Copy link
Copy Markdown
Collaborator

No description provided.

   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]
@MichalStrehovsky
MichalStrehovsky merged commit 84c0db2 into dotnet:nmirror Jul 6, 2016
@dotnet-bot
dotnet-bot deleted the from-tfs branch July 6, 2016 01:10
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants