This is yet another cleanup removal of the AppDomain.
fpCallback(&frameData, pUserData);
}
- // update the current appdomain if necessary
- AppDomain * pRetDomain = pFrame->GetReturnDomain();
- if (pRetDomain != NULL)
- {
- pAppDomain = pRetDomain;
- }
-
// move on to the next internal frame
pFrame = pFrame->Next();
}
// Since we don't have chains anymore, this can always be false.
pFrameData->quicklyUnwound = false;
- AppDomain * pAppDomain = pCF->GetAppDomain();
- pFrameData->vmCurrentAppDomainToken.SetHostPtr(pAppDomain);
+ pFrameData->vmCurrentAppDomainToken.SetHostPtr(AppDomain::GetCurrentDomain());
if (ft == kNativeRuntimeUnwindableStackFrame)
{
RawGetFrameType(&simpleType, &detailedType);
dataFrame =
new (nothrow) ClrDataFrame(m_dac, simpleType, detailedType,
- m_frameIter.m_crawl.GetAppDomain(),
+ AppDomain::GetCurrentDomain(),
m_frameIter.m_crawl.GetFunction());
if (!dataFrame)
{
// Method associated w/a stub will never have a JitManager.
this->pIJM = NULL;
this->MethodToken = METHODTOKEN(NULL, 0);
- this->currentAppDomain = pCF->GetAppDomain();
+ this->currentAppDomain = AppDomain::GetCurrentDomain();
this->exactGenericArgsToken = NULL;
// Stub frames are mutually exclusive with chain markers.
// Record the appdomain that the thread was in when it
// was running code for this frame.
- d->info.currentAppDomain = pCF->GetAppDomain();
+ d->info.currentAppDomain = AppDomain::GetCurrentDomain();
// Grab all the info from CrawlFrame that we need to
// check for "Am I in an exeption code blob?" now.
BOOL foundMe;
MethodDesc* pFoundMethod;
MethodDesc* pPrevMethod;
- AppDomain* pAppDomain;
};
/*static*/
-MethodDesc* SystemDomain::GetCallersMethod(StackCrawlMark* stackMark,
- AppDomain **ppAppDomain/*=NULL*/)
+MethodDesc* SystemDomain::GetCallersMethod(StackCrawlMark* stackMark)
{
CONTRACTL
GetThread()->StackWalkFrames(CallersMethodCallbackWithStackMark, &cdata, FUNCTIONSONLY | LIGHTUNWIND);
if(cdata.pFoundMethod) {
- if (ppAppDomain)
- *ppAppDomain = cdata.pAppDomain;
return cdata.pFoundMethod;
} else
return NULL;
}
/*static*/
-MethodTable* SystemDomain::GetCallersType(StackCrawlMark* stackMark,
- AppDomain **ppAppDomain/*=NULL*/)
+MethodTable* SystemDomain::GetCallersType(StackCrawlMark* stackMark)
{
CONTRACTL
GetThread()->StackWalkFrames(CallersMethodCallbackWithStackMark, &cdata, FUNCTIONSONLY | LIGHTUNWIND);
if(cdata.pFoundMethod) {
- if (ppAppDomain)
- *ppAppDomain = cdata.pAppDomain;
return cdata.pFoundMethod->GetMethodTable();
} else
return NULL;
}
/*static*/
-Module* SystemDomain::GetCallersModule(StackCrawlMark* stackMark,
- AppDomain **ppAppDomain/*=NULL*/)
+Module* SystemDomain::GetCallersModule(StackCrawlMark* stackMark)
{
CONTRACTL
GetThread()->StackWalkFrames(CallersMethodCallbackWithStackMark, &cdata, FUNCTIONSONLY | LIGHTUNWIND);
if(cdata.pFoundMethod) {
- if (ppAppDomain)
- *ppAppDomain = cdata.pAppDomain;
return cdata.pFoundMethod->GetModule();
} else
return NULL;
};
/*static*/
-Assembly* SystemDomain::GetCallersAssembly(StackCrawlMark *stackMark,
- AppDomain **ppAppDomain/*=NULL*/)
+Assembly* SystemDomain::GetCallersAssembly(StackCrawlMark *stackMark)
{
WRAPPER_NO_CONTRACT;
- Module* mod = GetCallersModule(stackMark, ppAppDomain);
+ Module* mod = GetCallersModule(stackMark);
if (mod)
return mod->GetAssembly();
return NULL;
{
// save the current in case it is the one we want
pCaller->pPrevMethod = pFunc;
- pCaller->pAppDomain = pCf->GetAppDomain();
return SWA_CONTINUE;
}
if (!pCaller->stackMark)
{
pCaller->pFoundMethod = pFunc;
- pCaller->pAppDomain = pCf->GetAppDomain();
return SWA_ABORT;
}
return SWA_CONTINUE;
}
- // If remoting is not available, we only set the caller if the crawlframe is from the same domain.
- // Why? Because if the callerdomain is different from current domain,
- // there have to be interop/native frames in between.
- // For example, in the CORECLR, if we find the caller to be in a different domain, then the
- // call into reflection is due to an unmanaged call into mscorlib. For that
- // case, the caller really is an INTEROP method.
- // In general, if the caller is INTEROP, we set the caller/callerdomain to be NULL
- // (To be precise: they are already NULL and we don't change them).
- if (pCf->GetAppDomain() == GetAppDomain())
- // We must either be looking for the caller, or the caller's caller when
- // we've already found the caller (we used a non-null value in pFoundMethod
- // simply as a flag, the correct method to return in both case is the
- // current method).
- {
- pCaller->pFoundMethod = pFunc;
- pCaller->pAppDomain = pCf->GetAppDomain();
- }
+ pCaller->pFoundMethod = pFunc;
return SWA_ABORT;
}
//****************************************************************************************
// Methods used to get the callers module and hence assembly and app domain.
- static MethodDesc* GetCallersMethod(StackCrawlMark* stackMark, AppDomain **ppAppDomain = NULL);
- static MethodTable* GetCallersType(StackCrawlMark* stackMark, AppDomain **ppAppDomain = NULL);
- static Module* GetCallersModule(StackCrawlMark* stackMark, AppDomain **ppAppDomain = NULL);
- static Assembly* GetCallersAssembly(StackCrawlMark* stackMark, AppDomain **ppAppDomain = NULL);
+ static MethodDesc* GetCallersMethod(StackCrawlMark* stackMark);
+ static MethodTable* GetCallersType(StackCrawlMark* stackMark);
+ static Module* GetCallersModule(StackCrawlMark* stackMark);
+ static Assembly* GetCallersAssembly(StackCrawlMark* stackMark);
static bool IsReflectionInvocationMethod(MethodDesc* pMeth);
Assembly *pRetVal = NULL;
- AppDomain *pCallersDomain;
- MethodDesc *pmdEmitter = SystemDomain::GetCallersMethod(args->stackMark, &pCallersDomain);
+ MethodDesc *pmdEmitter = SystemDomain::GetCallersMethod(args->stackMark);
// Called either from interop or async delegate invocation. Rejecting because we don't
// know how to set the correct permission on the new dynamic assembly.
return (PCODE)(0x12345);
}
-Assembly * SystemDomain::GetCallersAssembly(StackCrawlMark * stackMark, AppDomain ** ppAppDomain)
+Assembly * SystemDomain::GetCallersAssembly(StackCrawlMark * stackMark)
{
return NULL;
}
GetStackFramesData* pData = (GetStackFramesData*)data;
- if (pData->pDomain != pCf->GetAppDomain())
- {
- return SWA_CONTINUE;
- }
-
if (pData->skip > 0)
{
pData->skip--;
/*******************************************************************/
/* sends a current stack trace to the debug window */
-const char* FormatSig(MethodDesc* pMD, AppDomain *pDomain, AllocMemTracker *pamTracker);
+const char* FormatSig(MethodDesc* pMD, AllocMemTracker *pamTracker);
struct PrintCallbackData {
BOOL toStdout;
_TRUNCATE,
W("%S %S "),
pMD->GetName(),
- FormatSig(pMD, pCF->GetAppDomain(), &dummyAmTracker));
+ FormatSig(pMD, &dummyAmTracker));
dummyAmTracker.SuppressRelease();
if (buffLen < 0 )
return (ptr != NULL) ? *PTR_PCODE(ptr) : NULL;
}
- AppDomain *GetReturnDomain()
- {
- LIMITED_METHOD_CONTRACT;
- return NULL;
- }
-
#ifndef DACCESS_COMPILE
virtual Object **GetReturnExecutionContextAddr()
{
}
/*******************************************************************/
-const char* FormatSig(MethodDesc* pMD, AppDomain *pDomain, AllocMemTracker *pamTracker)
+const char* FormatSig(MethodDesc* pMD, AllocMemTracker *pamTracker)
{
CONTRACTL
{
}
CONTRACTL_END;
- return FormatSig(pMD,pDomain->GetLowFrequencyHeap(),pamTracker);
+ return FormatSig(pMD,GetAppDomain()->GetLowFrequencyHeap(),pamTracker);
}
#endif
#endif
// Update app domain if this frame caused a transition
//
- AppDomain *pRetDomain = pFrame->GetReturnDomain();
- if (pRetDomain != NULL)
- pAppDomain = pRetDomain;
pFrame = pFrame->Next();
if (pFrame != FRAME_TOP)
}
m_crawl.pRD = pRegDisp;
- m_crawl.pAppDomain = pThread->GetDomain(INDEBUG(flags & PROFILER_DO_STACK_SNAPSHOT));
m_codeManFlags = (ICodeManagerFlags)((flags & QUICKUNWIND) ? 0 : UpdateAllRegs);
m_scanFlag = ExecutionManager::GetScanFlags();
m_crawl.pRD = pRegDisp;
- // we initialize the appdomain to be the current domain, but this nees to be updated below
- m_crawl.pAppDomain = m_crawl.pThread->GetDomain(INDEBUG(m_flags & PROFILER_DO_STACK_SNAPSHOT));
-
m_codeManFlags = (ICodeManagerFlags)((m_flags & QUICKUNWIND) ? 0 : UpdateAllRegs);
// make sure the REGDISPLAY is synchronized with the CONTEXT
_ASSERTE(!m_crawl.hasFaulted || !m_crawl.isIPadjusted); // both cant be set together
}
- //
- // Update app domain if this frame caused a transition.
- //
-
- AppDomain *retDomain = m_crawl.pFrame->GetReturnDomain();
- if (retDomain != NULL)
- {
- m_crawl.pAppDomain = retDomain;
- }
-
PCODE adr = m_crawl.pFrame->GetReturnAddress();
_ASSERTE(adr != (PCODE)POISONC);
return flags;
}
- AppDomain *GetAppDomain()
- {
- LIMITED_METHOD_DAC_CONTRACT;
-
- return pAppDomain;
- }
-
/* Is this frame at a safe spot for GC?
*/
bool IsGcSafe();
void CheckGSCookies();
+ inline Thread* GetThread()
+ {
+ LIMITED_METHOD_CONTRACT;
+ return pThread;
+ }
+
#if defined(FEATURE_EH_FUNCLETS)
bool IsFunclet()
{
MethodDesc *pFunc;
// the rest is only used for "frameless methods"
- AppDomain *pAppDomain;
PREGDISPLAY pRD; // "thread context"/"virtual register set"
EECodeInfo codeInfo;
DacGetThreadContext(this, &context);
}
+ if (flags != CLRDATA_ENUM_MEM_MINI && flags != CLRDATA_ENUM_MEM_TRIAGE)
+ {
+ AppDomain::GetCurrentDomain()->EnumMemoryRegions(flags, true);
+ }
+
FillRegDisplay(®Disp, &context);
frameIter.Init(this, NULL, ®Disp, 0);
while (frameIter.IsValid())
PCODE callEnd = GetControlPC(®Disp);
DacEnumCodeForStackwalk(callEnd);
- if (flags != CLRDATA_ENUM_MEM_MINI && flags != CLRDATA_ENUM_MEM_TRIAGE)
- {
- if (frameIter.m_crawl.GetAppDomain())
- {
- frameIter.m_crawl.GetAppDomain()->EnumMemoryRegions(flags, true);
- }
- }
-
// To stackwalk through funceval frames, we need to be sure to preserve the
// DebuggerModule's m_pRuntimeDomainFile. This is the only case that doesn't use the current
// vmDomainFile in code:DacDbiInterfaceImpl::EnumerateInternalFrames. The following