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

Merge nmirror to master#3421

Merged
MichalStrehovsky merged 4 commits intomasterfrom
nmirror
Apr 25, 2017
Merged

Merge nmirror to master#3421
MichalStrehovsky merged 4 commits intomasterfrom
nmirror

Conversation

@jkotas
Copy link
Member

@jkotas jkotas commented Apr 25, 2017

No description provided.

luqunl and others added 2 commits April 24, 2017 17:46
 Change Description:
     For Pinvoke function, Currently Mcg will try to resolve its 'real' native exported function name through lib file. This add a hard dependency on Lib files to allow pinvoke works correctly
     If one of its lib file doesn't exists,
         if UseDefaultPInvoke is set, then the app may fail to launch
         if UseDefaultPInvoke isn't set, then throw exception if someone try to call this function during runtime.

     The change will to use LoadLibrary/GetProcAddress to fetch native function during runtime when passing IFS:UseLoadLibraryForPInvoke to ilc.
     Also since it isn't clear whether Windows will allow to use LoadLibrary/GetProcAddress in UWP, so add  LoadLibrary/GetProcAddress support code into Mcg Code template

     Changes:
     1. Move McgGeneratedNativeCallCodeAttribute from S.P.Interop to S.P.Corelib
         The LoadLibray/GetProcAddress support itself need to call some pinvokes(CoTaskMemAlloc/CoTaskMemFree), thus Mcg should skip these these pinvokes(CoTaskMemAlloc/CoTaskMemFree).
     2. Add IFS:UseLoadLibraryForPInvoke to enable LoadLibrary Support. By default, don't use LoadLibrary
     3. Add EntryPointNotFoundException and DllNotFoundException as wellknown type, since mcg generated code depends on these two types

     Remaining:
     1. Stdcall convention support for missing lib case

[tfs-changeset: 1655835]
MichalStrehovsky and others added 2 commits April 24, 2017 17:58
…l definition"

(For a quick intro on what I'm doing here, look at the changes in the object writer.)

The `Offset` property on `ISymbolNode` used to mean "the offset from the beginning of the `ObjectNode` that defines this `ISymbolNode`". This means that when referring to a symbol defined elsewhere, the `Offset` property was unused - it was only used when the `ISymbolNode` meant "definition".

We found out very early in our CoreRT multi module effort that the existing structure where `ISymbolNode` is both a definition and a reference is very awkward. COMDAT sections can only define a single symbol, but we would like to refer to multiple things within the object node package. We have a bunch of places where the inability of having a node that represents "symbol+delta" leads to awkward code that needs to pass the delta separately.

With this change I'm introducing a `ISymbolDefinitionNode`. The new world looks like this:

* `ISymbolDefinitionNode.Offset` means "the offset from the beginning of object data where the symbol should be defined".
* `ISymbolNode.Offset` now means "the delta from symbol with this name".

Whoever implements `ISymbolDefinitionNode` should also implement `ISymbolNode`, so that the symbol can be used as a reference. I chose to name both of the properties `Offset`, because it makes implementing the common case (Offset = 0) require less boilerplate.

As an example where this can be used (I'm not doing it now to keep the diffs as small as possible) is the `NonGCStaticsNode`: with this infrastructure in place, we can now have a separate `ISymbolNode` for the cctor context that doesn't define a new symbol, but can be used to refer to the cctor context anywhere we use `ISymbolNode`. Similar simplification is now possible around fat function pointers.

[tfs-changeset: 1655840]
@MichalStrehovsky MichalStrehovsky merged commit f092870 into master Apr 25, 2017
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