Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/corert.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFadi Hanna <fadim@microsoft.com>2017-08-30 22:53:17 +0300
committerFadi Hanna <fadim@microsoft.com>2017-08-30 22:53:17 +0300
commit4dad92cd3294a5511ba8ace84f7caf2379653935 (patch)
tree86b6fc2bb56e133f6a5d817cef0f6a0b096719e1 /src/Native/Runtime/RuntimeInstance.cpp
parent6a44a21cf36ac61890fca9507658c07ad786d1a3 (diff)
Fixing CI break caused by previous checkin of the unboxing stubs region to enable the RhGetCodeTarget API:
1) Stubs are still grouped, but by section now. Linker will merge/fold/sort the unboxing stubs by section name. 2) All unboxing stubs are delimited by __unbox_a and __unbox_z symbols 3) __unbox_a and __unbox_z works on all platforms (tested on ProjectN (no regressions verification), ProjectX single and multi-file, Windows CoreRT, Unbuntu CoreRT, and OSX CoreRT) 4) Implementation uses a registration mechanism for unboxing stubs regions, and is multi-file ready for CoreRT (uses a linked list of stub regions) 5) Deleting the R2R section of unboxing stubs since it doesn't work on non-windows. Using extern "C" variables instead. 6) Removing the module enumeration API exposed by the TypeLoaderCallbacks (no longer needed) [tfs-changeset: 1672333]
Diffstat (limited to 'src/Native/Runtime/RuntimeInstance.cpp')
-rw-r--r--src/Native/Runtime/RuntimeInstance.cpp43
1 files changed, 42 insertions, 1 deletions
diff --git a/src/Native/Runtime/RuntimeInstance.cpp b/src/Native/Runtime/RuntimeInstance.cpp
index 30dfc9328..b7254a401 100644
--- a/src/Native/Runtime/RuntimeInstance.cpp
+++ b/src/Native/Runtime/RuntimeInstance.cpp
@@ -297,7 +297,8 @@ RuntimeInstance::RuntimeInstance() :
m_pStaticGCRefsDescChunkList(NULL),
m_pThreadStaticGCRefsDescChunkList(NULL),
m_pGenericUnificationHashtable(NULL),
- m_conservativeStackReportingEnabled(false)
+ m_conservativeStackReportingEnabled(false),
+ m_pUnboxingStubsRegion(NULL)
{
}
@@ -430,6 +431,46 @@ extern "C" void __stdcall UnregisterCodeManager(ICodeManager * pCodeManager)
}
#endif
+bool RuntimeInstance::RegisterUnboxingStubs(PTR_VOID pvStartRange, UInt32 cbRange)
+{
+ ASSERT(pvStartRange != NULL && cbRange > 0);
+
+ UnboxingStubsRegion * pEntry = new (nothrow) UnboxingStubsRegion();
+ if (NULL == pEntry)
+ return false;
+
+ pEntry->m_pRegionStart = pvStartRange;
+ pEntry->m_cbRegion = cbRange;
+
+ do
+ {
+ pEntry->m_pNextRegion = m_pUnboxingStubsRegion;
+ }
+ while (PalInterlockedCompareExchangePointer((void *volatile *)&m_pUnboxingStubsRegion, pEntry, pEntry->m_pNextRegion) != pEntry->m_pNextRegion);
+
+ return true;
+}
+
+bool RuntimeInstance::IsUnboxingStub(UInt8* pCode)
+{
+ UnboxingStubsRegion * pCurrent = m_pUnboxingStubsRegion;
+ while (pCurrent != NULL)
+ {
+ UInt8* pUnboxingStubsRegion = dac_cast<UInt8*>(pCurrent->m_pRegionStart);
+ if (pCode >= pUnboxingStubsRegion && pCode < (pUnboxingStubsRegion + pCurrent->m_cbRegion))
+ return true;
+
+ pCurrent = pCurrent->m_pNextRegion;
+ }
+
+ return false;
+}
+
+extern "C" bool __stdcall RegisterUnboxingStubs(PTR_VOID pvStartRange, UInt32 cbRange)
+{
+ return GetRuntimeInstance()->RegisterUnboxingStubs(pvStartRange, cbRange);
+}
+
bool RuntimeInstance::RegisterTypeManager(TypeManager * pTypeManager)
{
TypeManagerEntry * pEntry = new (nothrow) TypeManagerEntry();