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-09-13 01:07:07 +0300
committerFadi Hanna <fadim@microsoft.com>2017-09-13 01:07:07 +0300
commit92a6a3b1ae4aff4b3a904fed104d253f7d863a36 (patch)
tree6933a7db8ebdb1ba0338019137e65b75dfe9a2a0 /src/Native/Runtime/unix
parent665c60acc7f188d4a5e81c96f39431de1352b901 (diff)
These changes provide a way for ProjectX/CoreRT to get the target of custom instantiating unboxing stubs.
The implementation uses a general purpose infrastructure that can associate custom data to methods with unwind info, given the fact that unwind info lookups are very fast. Similar to GC info and EH info, this implementation now provides a way to associate any custom data to methods, by adding a flag and a reloc to the data in the method's unwind info. The custom data that can be attached to methods begin with a flag (indicating what data follows), followed by data. Right now, the only custom data we have for methods are unboxing stub target pointers. The dependency analysis models this custom data using a new node type: MethodAssociatedDataNode. The custom data (when it exists) can be be retrieved using a new API on ICodeManager. The changes also include all the necessary plumbing to link custom data nodes symbols for PX (given that it's UTC that emits the unwind info) [tfs-changeset: 1673664]
Diffstat (limited to 'src/Native/Runtime/unix')
-rw-r--r--src/Native/Runtime/unix/UnixNativeCodeManager.cpp30
-rw-r--r--src/Native/Runtime/unix/UnixNativeCodeManager.h2
2 files changed, 29 insertions, 3 deletions
diff --git a/src/Native/Runtime/unix/UnixNativeCodeManager.cpp b/src/Native/Runtime/unix/UnixNativeCodeManager.cpp
index e60e60130..445b6e00a 100644
--- a/src/Native/Runtime/unix/UnixNativeCodeManager.cpp
+++ b/src/Native/Runtime/unix/UnixNativeCodeManager.cpp
@@ -25,9 +25,9 @@
#define UBF_FUNC_KIND_HANDLER 0x01
#define UBF_FUNC_KIND_FILTER 0x02
-#define UBF_FUNC_HAS_EHINFO 0x04
-
-#define UBF_FUNC_REVERSE_PINVOKE 0x08
+#define UBF_FUNC_HAS_EHINFO 0x04
+#define UBF_FUNC_REVERSE_PINVOKE 0x08
+#define UBF_FUNC_HAS_ASSOCIATED_DATA 0x10
struct UnixNativeMethodInfo
{
@@ -130,6 +130,9 @@ void UnixNativeCodeManager::EnumGcRefs(MethodInfo * pMethodInfo,
uint8_t unwindBlockFlags = *p++;
+ if ((unwindBlockFlags & UBF_FUNC_HAS_ASSOCIATED_DATA) != 0)
+ p += sizeof(int32_t);
+
if ((unwindBlockFlags & UBF_FUNC_HAS_EHINFO) != 0)
p += sizeof(int32_t);
@@ -176,6 +179,9 @@ bool UnixNativeCodeManager::UnwindStackFrame(MethodInfo * pMethodInfo,
uint8_t unwindBlockFlags = *p++;
+ if ((unwindBlockFlags & UBF_FUNC_HAS_ASSOCIATED_DATA) != 0)
+ p += sizeof(int32_t);
+
if ((unwindBlockFlags & UBF_FUNC_REVERSE_PINVOKE) != 0)
{
// Reverse PInvoke transition should on the main function body only
@@ -265,6 +271,9 @@ bool UnixNativeCodeManager::EHEnumInit(MethodInfo * pMethodInfo, PTR_VOID * pMet
uint8_t unwindBlockFlags = *p++;
+ if ((unwindBlockFlags & UBF_FUNC_HAS_ASSOCIATED_DATA) != 0)
+ p += sizeof(int32_t);
+
// return if there is no EH info associated with this method
if ((unwindBlockFlags & UBF_FUNC_HAS_EHINFO) == 0)
{
@@ -356,6 +365,21 @@ void * UnixNativeCodeManager::GetClasslibFunction(ClasslibFunctionId functionId)
return m_pClasslibFunctions[id];
}
+PTR_VOID UnixNativeCodeManager::GetAssociatedData(PTR_VOID ControlPC)
+{
+ UnixNativeMethodInfo methodInfo;
+ if (!FindMethodInfo(ControlPC, &methodInfo))
+ return NULL;
+
+ PTR_UInt8 p = methodInfo.pMainLSDA;
+
+ uint8_t unwindBlockFlags = *p++;
+ if ((unwindBlockFlags & UBF_FUNC_HAS_ASSOCIATED_DATA) == 0)
+ return NULL;
+
+ return dac_cast<PTR_VOID>(p + *dac_cast<PTR_Int32>(p));
+}
+
extern "C" bool __stdcall RegisterCodeManager(ICodeManager * pCodeManager, PTR_VOID pvStartRange, UInt32 cbRange);
extern "C" void __stdcall UnregisterCodeManager(ICodeManager * pCodeManager);
extern "C" bool __stdcall RegisterUnboxingStubs(PTR_VOID pvStartRange, UInt32 cbRange);
diff --git a/src/Native/Runtime/unix/UnixNativeCodeManager.h b/src/Native/Runtime/unix/UnixNativeCodeManager.h
index e424a559c..13333ee73 100644
--- a/src/Native/Runtime/unix/UnixNativeCodeManager.h
+++ b/src/Native/Runtime/unix/UnixNativeCodeManager.h
@@ -58,4 +58,6 @@ public:
PTR_VOID GetMethodStartAddress(MethodInfo * pMethodInfo);
void * GetClasslibFunction(ClasslibFunctionId functionId);
+
+ PTR_VOID GetAssociatedData(PTR_VOID ControlPC);
};