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:
authordotnet-bot <dotnet-bot@microsoft.com>2017-04-07 19:15:14 +0300
committerdotnet-bot <dotnet-bot@microsoft.com>2017-04-07 19:15:14 +0300
commit2bbc0dce126b38922682fe7f5f46d805029d438f (patch)
treea3d3e15bf3150ac606b2334bc01ad917aeb7c105 /src/Native/Runtime/EHHelpers.cpp
parentecd7ae9edb94fe45cc28af6ce5437fbc428a2ae8 (diff)
ProjectX: Hook up class lib functions with type manager
The class lib functions are already hooked up to code manager. However, there are cases where we look for class lib functions from EEtype, such as GetClasslibException on an eeype. This change attaches the class lib function array to every type manager and sets up a runtime helper to get to the class lib function GetRuntimeException from an EEtype. [tfs-changeset: 1653592]
Diffstat (limited to 'src/Native/Runtime/EHHelpers.cpp')
-rw-r--r--src/Native/Runtime/EHHelpers.cpp29
1 files changed, 27 insertions, 2 deletions
diff --git a/src/Native/Runtime/EHHelpers.cpp b/src/Native/Runtime/EHHelpers.cpp
index 3e0887c64..64b5f27ce 100644
--- a/src/Native/Runtime/EHHelpers.cpp
+++ b/src/Native/Runtime/EHHelpers.cpp
@@ -25,6 +25,8 @@
#include "threadstore.h"
#include "threadstore.inl"
#include "stressLog.h"
+#include "rhbinder.h"
+#include "eetype.h"
// Find the code manager containing the given address, which might be a return address from a managed function. The
// address may be to another managed function, or it may be to an unmanaged function. The address may also refer to
@@ -38,7 +40,6 @@ static ICodeManager * FindCodeManagerForClasslibFunction(void * address)
if (pCodeManager != NULL)
return pCodeManager;
- // @TODO: CORERT: Do we need to make this work for CoreRT?
// Less common, we will look for the address in any of the sections of the module. This is slower, but is
// necessary for EEType pointers and jump stubs.
Module * pModule = pRI->FindModuleByAddress(address);
@@ -67,7 +68,7 @@ COOP_PINVOKE_HELPER(Boolean, RhpEHEnumNext, (EHEnum* pEHEnum, EHClause* pEHClaus
// Unmanaged helper to locate one of two classlib-provided functions that the runtime needs to
// implement throwing of exceptions out of Rtm, and fail-fast. This may return NULL if the classlib
// found via the provided address does not have the necessary exports.
-COOP_PINVOKE_HELPER(void *, RhpGetClasslibFunction, (void * address, ClasslibFunctionId functionId))
+COOP_PINVOKE_HELPER(void *, RhpGetClasslibFunctionFromCodeAddress, (void * address, ClasslibFunctionId functionId))
{
// Find the code manager for the given address, which is an address into some managed module. It could
// be code, or it could be an EEType. No matter what, it's an address into a managed module in some non-Rtm
@@ -83,6 +84,30 @@ COOP_PINVOKE_HELPER(void *, RhpGetClasslibFunction, (void * address, ClasslibFun
return pCodeManager->GetClasslibFunction(functionId);
}
+// Unmanaged helper to locate one of two classlib-provided functions that the runtime needs to
+// implement throwing of exceptions out of Rtm, and fail-fast. This may return NULL if the classlib
+// found via the provided address does not have the necessary exports.
+COOP_PINVOKE_HELPER(void *, RhpGetClasslibFunctionFromEEtype, (EEType * pEEtype, ClasslibFunctionId functionId))
+{
+ if (pEEtype->HasTypeManager())
+ {
+ return pEEtype->GetTypeManagerPtr()->AsTypeManager()->GetClasslibFunction(functionId);
+ }
+ else
+ {
+ RuntimeInstance * pRI = GetRuntimeInstance();
+ Module * pModule = pRI->FindModuleByAddress(pEEtype);
+ if (pModule != NULL)
+ {
+ return pModule->GetClasslibFunction(functionId);
+ }
+ else
+ {
+ return NULL;
+ }
+ }
+}
+
COOP_PINVOKE_HELPER(void, RhpValidateExInfoStack, ())
{
Thread * pThisThread = ThreadStore::GetCurrentThread();