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:
authorScott Mosier <smosier@microsoft.com>2016-06-15 01:58:38 +0300
committerScott Mosier <smosier@microsoft.com>2016-06-15 01:58:38 +0300
commita0124b03284c2f790a36d1e671c72a6a186b7a7a (patch)
treed0cd5e970391825ee453ccf553df5b204772f919 /src/Native/Runtime/windows
parent1c852985291c3828c169264408f81bbe1fd9c4c7 (diff)
ICodeManager refactoring to support separated funclets
Today, we assume that funclets are separate methods, in the sense that they get unique unwind information, but that's where the separation ends. They are still tightly coupled to their "parent method" in other ways. One of those couplings is the fact that they must be laid out contiguously with the parent method. These changes update the EH dispatcher and the ICodeManager abstraction to allow for funclets to be disconnected from their parent method. This mostly falls into the category of using addresses instead of offsets when referring to handlers and when handling the special case of "remapping" a hardware fault location to a safe point in an associated handler. [tfs-changeset: 1612757]
Diffstat (limited to 'src/Native/Runtime/windows')
-rw-r--r--src/Native/Runtime/windows/CoffNativeCodeManager.cpp28
-rw-r--r--src/Native/Runtime/windows/CoffNativeCodeManager.h9
2 files changed, 15 insertions, 22 deletions
diff --git a/src/Native/Runtime/windows/CoffNativeCodeManager.cpp b/src/Native/Runtime/windows/CoffNativeCodeManager.cpp
index 277ec8985..d0a18c37d 100644
--- a/src/Native/Runtime/windows/CoffNativeCodeManager.cpp
+++ b/src/Native/Runtime/windows/CoffNativeCodeManager.cpp
@@ -197,8 +197,7 @@ struct CoffNativeMethodInfo
static_assert(sizeof(CoffNativeMethodInfo) <= sizeof(MethodInfo), "CoffNativeMethodInfo too big");
bool CoffNativeCodeManager::FindMethodInfo(PTR_VOID ControlPC,
- MethodInfo * pMethodInfoOut,
- UInt32 * pCodeOffset)
+ MethodInfo * pMethodInfoOut)
{
CoffNativeMethodInfo * pMethodInfo = (CoffNativeMethodInfo *)pMethodInfoOut;
@@ -231,8 +230,6 @@ bool CoffNativeCodeManager::FindMethodInfo(PTR_VOID ControlPC,
pMethodInfo->executionAborted = false;
- *pCodeOffset = (UInt32)(relativePC - pMethodInfo->mainRuntimeFunction->BeginAddress);
-
return true;
}
@@ -271,9 +268,9 @@ PTR_VOID CoffNativeCodeManager::GetFramePointer(MethodInfo * pMethInfo,
// void EnumGCRefs(PTR_VOID pGCInfo, UINT32 curOffs, REGDISPLAY * pRD, GCEnumContext * hCallback, bool executionAborted);
void CoffNativeCodeManager::EnumGcRefs(MethodInfo * pMethodInfo,
- UInt32 codeOffset,
- REGDISPLAY * pRegisterSet,
- GCEnumContext * hCallback)
+ PTR_VOID safePointAddress,
+ REGDISPLAY * pRegisterSet,
+ GCEnumContext * hCallback)
{
// @TODO: CORERT: PInvoke transitions
@@ -298,7 +295,6 @@ UIntNative CoffNativeCodeManager::GetConservativeUpperBoundForOutgoingArgs(Metho
}
bool CoffNativeCodeManager::UnwindStackFrame(MethodInfo * pMethodInfo,
- UInt32 codeOffset,
REGDISPLAY * pRegisterSet, // in/out
PTR_VOID * ppPreviousTransitionFrame) // out
{
@@ -361,7 +357,6 @@ bool CoffNativeCodeManager::UnwindStackFrame(MethodInfo * pMethodInfo,
}
bool CoffNativeCodeManager::GetReturnAddressHijackInfo(MethodInfo * pMethodInfo,
- UInt32 codeOffset,
REGDISPLAY * pRegisterSet, // in
PTR_PTR_VOID * ppvRetAddrLocation, // out
GCRefKind * pRetValueKind) // out
@@ -375,7 +370,7 @@ void CoffNativeCodeManager::UnsynchronizedHijackMethodLoops(MethodInfo * pMethod
// @TODO: CORERT: UnsynchronizedHijackMethodLoops
}
-void CoffNativeCodeManager::RemapHardwareFaultToGCSafePoint(MethodInfo * pMethodInfo, UInt32 * pCodeOffset)
+PTR_VOID CoffNativeCodeManager::RemapHardwareFaultToGCSafePoint(MethodInfo * pMethodInfo, PTR_VOID controlPC)
{
// GCInfo decoder needs to know whether execution of the method is aborted
// while querying for gc-info. But ICodeManager::EnumGCRef() doesn't receive any
@@ -388,11 +383,12 @@ void CoffNativeCodeManager::RemapHardwareFaultToGCSafePoint(MethodInfo * pMethod
CoffNativeMethodInfo * pNativeMethodInfo = (CoffNativeMethodInfo *)pMethodInfo;
pNativeMethodInfo->executionAborted = true;
- return;
+ return controlPC;
}
struct CoffEHEnumState
{
+ PTR_UInt8 pMethodStartAddress;
PTR_UInt8 pEHInfo;
UInt32 uClause;
UInt32 nClauses;
@@ -422,7 +418,7 @@ bool CoffNativeCodeManager::EHEnumInit(MethodInfo * pMethodInfo, PTR_VOID * pMet
}
*pMethodStartAddress = dac_cast<PTR_VOID>(m_moduleBase + pNativeMethodInfo->mainRuntimeFunction->BeginAddress);
-
+ pEnumState->pMethodStartAddress = dac_cast<PTR_UInt8>(*pMethodStartAddress);
pEnumState->pEHInfo = dac_cast<PTR_UInt8>(pUnwindDataBlob) + unwindDataBlobSize + 1;
pEnumState->uClause = 0;
pEnumState->nClauses = VarInt::ReadUnsigned(pEnumState->pEHInfo);
@@ -458,7 +454,7 @@ bool CoffNativeCodeManager::EHEnumNext(EHEnumState * pEHEnumState, EHClause * pE
switch (pEHClauseOut->m_clauseKind)
{
case EH_CLAUSE_TYPED:
- pEHClauseOut->m_handlerOffset = VarInt::ReadUnsigned(pEnumState->pEHInfo);
+ pEHClauseOut->m_handlerAddress = pEnumState->pMethodStartAddress + VarInt::ReadUnsigned(pEnumState->pEHInfo);
// Read target type
{
@@ -469,11 +465,11 @@ bool CoffNativeCodeManager::EHEnumNext(EHEnumState * pEHEnumState, EHClause * pE
}
break;
case EH_CLAUSE_FAULT:
- pEHClauseOut->m_handlerOffset = VarInt::ReadUnsigned(pEnumState->pEHInfo);
+ pEHClauseOut->m_handlerAddress = pEnumState->pMethodStartAddress + VarInt::ReadUnsigned(pEnumState->pEHInfo);
break;
case EH_CLAUSE_FILTER:
- pEHClauseOut->m_handlerOffset = VarInt::ReadUnsigned(pEnumState->pEHInfo);
- pEHClauseOut->m_filterOffset = VarInt::ReadUnsigned(pEnumState->pEHInfo);
+ pEHClauseOut->m_handlerAddress = pEnumState->pMethodStartAddress + VarInt::ReadUnsigned(pEnumState->pEHInfo);
+ pEHClauseOut->m_filterAddress = pEnumState->pMethodStartAddress + VarInt::ReadUnsigned(pEnumState->pEHInfo);
break;
default:
UNREACHABLE_MSG("unexpected EHClauseKind");
diff --git a/src/Native/Runtime/windows/CoffNativeCodeManager.h b/src/Native/Runtime/windows/CoffNativeCodeManager.h
index 6bbac6017..73acfdffa 100644
--- a/src/Native/Runtime/windows/CoffNativeCodeManager.h
+++ b/src/Native/Runtime/windows/CoffNativeCodeManager.h
@@ -57,8 +57,7 @@ public:
//
bool FindMethodInfo(PTR_VOID ControlPC,
- MethodInfo * pMethodInfoOut,
- UInt32 * pCodeOffset);
+ MethodInfo * pMethodInfoOut);
bool IsFunclet(MethodInfo * pMethodInfo);
@@ -66,12 +65,11 @@ public:
REGDISPLAY * pRegisterSet);
void EnumGcRefs(MethodInfo * pMethodInfo,
- UInt32 codeOffset,
+ PTR_VOID safePointAddress,
REGDISPLAY * pRegisterSet,
GCEnumContext * hCallback);
bool UnwindStackFrame(MethodInfo * pMethodInfo,
- UInt32 codeOffset,
REGDISPLAY * pRegisterSet, // in/out
PTR_VOID * ppPreviousTransitionFrame); // out
@@ -79,14 +77,13 @@ public:
REGDISPLAY * pRegisterSet);
bool GetReturnAddressHijackInfo(MethodInfo * pMethodInfo,
- UInt32 codeOffset,
REGDISPLAY * pRegisterSet, // in
PTR_PTR_VOID * ppvRetAddrLocation, // out
GCRefKind * pRetValueKind); // out
void UnsynchronizedHijackMethodLoops(MethodInfo * pMethodInfo);
- void RemapHardwareFaultToGCSafePoint(MethodInfo * pMethodInfo, UInt32 * pCodeOffset);
+ PTR_VOID RemapHardwareFaultToGCSafePoint(MethodInfo * pMethodInfo, PTR_VOID controlPC);
bool EHEnumInit(MethodInfo * pMethodInfo, PTR_VOID * pMethodStartAddress, EHEnumState * pEHEnumState);