Runtime changes for IJW Activation (dotnet/coreclr#22636)
authorJeremy Koritzinsky <jkoritzinsky@gmail.com>
Thu, 21 Mar 2019 05:59:29 +0000 (22:59 -0700)
committerGitHub <noreply@github.com>
Thu, 21 Mar 2019 05:59:29 +0000 (22:59 -0700)
commit6f7a2a26ef8de0f908474545ec8f0c6306bf838c
tree5bbbc31043774803c41c053d39b9192bf3d5cdf7
parent0d7aa54bfd8cab8d8eca151a611084e572a240e4
Runtime changes for IJW Activation (dotnet/coreclr#22636)

* Implement loading an assembly from an HMODULE on Windows.

* Use the native runtime to execute the main method so I don't have to replicate all of the startup behavior.

* If ijwhost is loaded, then call back into ijwhost to resolve tokens for vtable entries.

* Refactor our various component loaders (COM and IJW) and have IJW load components into separate ALCs when loaded from native.

* Move VTableFixups after DeliverSyncEvents in our incremental load. We need the module to be loaded to at least FILE_LOAD_DELIVER_EVENTS when resolving dependencies loaded via VTableFixups, otherwise they try to load into the default ALC.

* Only try to get ijwhost module handle on Windows.

* Use defined() instead of ifndef

* Fix off-Windows build break and fix unvalid comment.

* ComponentLoadContext->IsolatedComponentLoadContext

* Only build InMemoryAssemblyLoader when targeting windows.

* Add doc comments for IsolatedComponentLoadContext.

* Rename qcall.

* Add comment for boolean parameter.

* Add null check for managed ExecuteMainMethod entrypoint.

* Add comments in ceeload.cpp for the ijwhost method resolution.

* Add test verifying runtime callback to IJW host.

* Add test for InMemoryAssemblyLoader.LoadInMemoryAssembly.

* Fix x86 behavior rel. loading symbols by name and stdcall mangling.

* Remove exe entrypoints. The executable case for mixed-mode will go through the normal .NET Core app model (no special hosting support needed).

* Clean up whitespace

* Add test verifying M->N->M ALC switch behavior with IJW.

* Resolve the ijwhost module by probing the PE for the IJW assembly instead of hardcoding the name.

* Remove static caching in GetTokenGetterFromHostModule.

* Disable new IJW tests on Win7.

* PR Feedback.

* Cleanup extra copy of function.

* Use old-style environment checking in LoadIjwFromModuleHandle since we reference S.P.CL directly.

* Fix break in rebase

* Clean up fake mscoree code.

* Only validate that a CLR header exists. The OS verifies everything else.

* Make ijw host resolution code static to ceeload.cpp

* Use bracketed include for xplatform.h

* Update comment on _CorDllMain

* PR feedback.

* Remove .def file.

* PR feedback.

* Verify we export correctly on x86 and x64.

* Fix path to ijwhostmock for CopyConstructorMarshaler

* Disable IJW tests on arm32 nightly. Can't repro the dependency load failures. Fixes dotnet/coreclr#23358

Commit migrated from https://github.com/dotnet/coreclr/commit/ea10aaccb09fe30f0444b821fd8d90d9257dd402
29 files changed:
src/coreclr/src/System.Private.CoreLib/System.Private.CoreLib.csproj
src/coreclr/src/System.Private.CoreLib/src/Internal/Runtime/InteropServices/ComActivator.cs
src/coreclr/src/System.Private.CoreLib/src/Internal/Runtime/InteropServices/InMemoryAssemblyLoader.cs [new file with mode: 0644]
src/coreclr/src/System.Private.CoreLib/src/Internal/Runtime/InteropServices/IsolatedComponentLoadContext.cs [new file with mode: 0644]
src/coreclr/src/System.Private.CoreLib/src/System/Runtime/Loader/AssemblyLoadContext.CoreCLR.cs
src/coreclr/src/vm/appdomain.cpp
src/coreclr/src/vm/assemblynative.cpp
src/coreclr/src/vm/assemblynative.hpp
src/coreclr/src/vm/ceeload.cpp
src/coreclr/src/vm/domainfile.cpp
src/coreclr/src/vm/domainfile.h
src/coreclr/src/vm/ecalllist.h
src/coreclr/tests/issues.targets
src/coreclr/tests/src/Interop/CMakeLists.txt
src/coreclr/tests/src/Interop/IJW/CopyConstructorMarshaler/CopyConstructorMarshaler.csproj
src/coreclr/tests/src/Interop/IJW/FakeMscoree/mscoree.cpp [deleted file]
src/coreclr/tests/src/Interop/IJW/FakeMscoree/mscoree.def [deleted file]
src/coreclr/tests/src/Interop/IJW/FixupCallsHostWhenLoaded/FixupCallsHostWhenLoaded.cs [new file with mode: 0644]
src/coreclr/tests/src/Interop/IJW/FixupCallsHostWhenLoaded/FixupCallsHostWhenLoaded.csproj [new file with mode: 0644]
src/coreclr/tests/src/Interop/IJW/IjwNativeCallingManagedDll/CMakeLists.txt [moved from src/coreclr/tests/src/Interop/IJW/NativeCallingManaged/IjwNativeCallingManagedDll/CMakeLists.txt with 100% similarity]
src/coreclr/tests/src/Interop/IJW/IjwNativeCallingManagedDll/IjwNativeCallingManagedDll.cpp [moved from src/coreclr/tests/src/Interop/IJW/NativeCallingManaged/IjwNativeCallingManagedDll/IjwNativeCallingManagedDll.cpp with 53% similarity]
src/coreclr/tests/src/Interop/IJW/IjwNativeDll/CMakeLists.txt [moved from src/coreclr/tests/src/Interop/IJW/ManagedCallingNative/IjwNativeDll/CMakeLists.txt with 100% similarity]
src/coreclr/tests/src/Interop/IJW/IjwNativeDll/IjwNativeDll.cpp [moved from src/coreclr/tests/src/Interop/IJW/ManagedCallingNative/IjwNativeDll/IjwNativeDll.cpp with 100% similarity]
src/coreclr/tests/src/Interop/IJW/LoadIjwFromModuleHandle/LoadIjwFromModuleHandle.cs [new file with mode: 0644]
src/coreclr/tests/src/Interop/IJW/LoadIjwFromModuleHandle/LoadIjwFromModuleHandle.csproj [new file with mode: 0644]
src/coreclr/tests/src/Interop/IJW/ManagedCallingNative/ManagedCallingNative.csproj
src/coreclr/tests/src/Interop/IJW/NativeCallingManaged/NativeCallingManaged.csproj
src/coreclr/tests/src/Interop/IJW/ijwhostmock/CMakeLists.txt [moved from src/coreclr/tests/src/Interop/IJW/FakeMscoree/CMakeLists.txt with 88% similarity]
src/coreclr/tests/src/Interop/IJW/ijwhostmock/mscoree.cpp [new file with mode: 0644]