summaryrefslogtreecommitdiff
path: root/src/vm/appdomain.cpp
diff options
context:
space:
mode:
authorJiyoung Yun <jy910.yun@samsung.com>2016-12-27 16:46:08 +0900
committerJiyoung Yun <jy910.yun@samsung.com>2016-12-27 16:46:08 +0900
commitdb20f3f1bb8595633a7e16c8900fd401a453a6b5 (patch)
treee5435159cd1bf0519276363a6fe1663d1721bed3 /src/vm/appdomain.cpp
parent4b4aad7217d3292650e77eec2cf4c198ea9c3b4b (diff)
downloadcoreclr-db20f3f1bb8595633a7e16c8900fd401a453a6b5.tar.gz
coreclr-db20f3f1bb8595633a7e16c8900fd401a453a6b5.tar.bz2
coreclr-db20f3f1bb8595633a7e16c8900fd401a453a6b5.zip
Imported Upstream version 1.0.0.9127upstream/1.0.0.9127
Diffstat (limited to 'src/vm/appdomain.cpp')
-rw-r--r--src/vm/appdomain.cpp53
1 files changed, 35 insertions, 18 deletions
diff --git a/src/vm/appdomain.cpp b/src/vm/appdomain.cpp
index 0ec2c5f2fc..34da344c94 100644
--- a/src/vm/appdomain.cpp
+++ b/src/vm/appdomain.cpp
@@ -12,7 +12,7 @@
#include "strongnameinternal.h"
#include "excep.h"
#include "eeconfig.h"
-#include "gc.h"
+#include "gcheaputilities.h"
#include "eventtrace.h"
#ifdef FEATURE_FUSION
#include "assemblysink.h"
@@ -2652,8 +2652,8 @@ void AppDomain::CreateADUnloadStartEvent()
// If the thread is in cooperative mode, it must have been suspended for the GC so a delete
// can't happen.
- _ASSERTE(GCHeap::IsGCInProgress() &&
- GCHeap::IsServerHeap() &&
+ _ASSERTE(GCHeapUtilities::IsGCInProgress() &&
+ GCHeapUtilities::IsServerHeap() &&
IsGCSpecialThread());
SystemDomain* sysDomain = SystemDomain::System();
@@ -2691,7 +2691,7 @@ void SystemDomain::ResetADSurvivedBytes()
}
CONTRACT_END;
- _ASSERTE(GCHeap::IsGCInProgress());
+ _ASSERTE(GCHeapUtilities::IsGCInProgress());
SystemDomain* sysDomain = SystemDomain::System();
if (sysDomain)
@@ -2870,6 +2870,11 @@ void SystemDomain::LoadBaseSystemClasses()
// the SZArrayHelper class here.
g_pSZArrayHelperClass = MscorlibBinder::GetClass(CLASS__SZARRAYHELPER);
+#ifdef FEATURE_SPAN_OF_T
+ // Load ByReference class
+ g_pByReferenceClass = MscorlibBinder::GetClass(CLASS__BYREFERENCE);
+#endif
+
// Load Nullable class
g_pNullableClass = MscorlibBinder::GetClass(CLASS__NULLABLE);
@@ -2943,6 +2948,7 @@ void SystemDomain::LoadBaseSystemClasses()
g_pExecutionEngineExceptionClass = MscorlibBinder::GetException(kExecutionEngineException);
g_pThreadAbortExceptionClass = MscorlibBinder::GetException(kThreadAbortException);
+#ifdef FEATURE_CER
// Used for determining whether a class has a critical finalizer
// To determine whether a class has a critical finalizer, we
// currently will simply see if it's parent class has a critical
@@ -2951,6 +2957,7 @@ void SystemDomain::LoadBaseSystemClasses()
// here.
g_pCriticalFinalizerObjectClass = MscorlibBinder::GetClass(CLASS__CRITICAL_FINALIZER_OBJECT);
_ASSERTE(g_pCriticalFinalizerObjectClass->HasCriticalFinalizer());
+#endif
// used by gc to handle predefined agility checking
g_pThreadClass = MscorlibBinder::GetClass(CLASS__THREAD);
@@ -2980,7 +2987,9 @@ void SystemDomain::LoadBaseSystemClasses()
// Load a special marker method used to detect Constrained Execution Regions
// at jit time.
+#ifdef FEATURE_CER
g_pPrepareConstrainedRegionsMethod = MscorlibBinder::GetMethod(METHOD__RUNTIME_HELPERS__PREPARE_CONSTRAINED_REGIONS);
+#endif
g_pExecuteBackoutCodeHelperMethod = MscorlibBinder::GetMethod(METHOD__RUNTIME_HELPERS__EXECUTE_BACKOUT_CODE_HELPER);
// Make sure that FCall mapping for Monitor.Enter is initialized. We need it in case Monitor.Enter is used only as JIT helper.
@@ -3824,7 +3833,7 @@ HRESULT SystemDomain::RunDllMain(HINSTANCE hInst, DWORD dwReason, LPVOID lpReser
return S_OK;
// ExitProcess is called while a thread is doing GC.
- if (dwReason == DLL_PROCESS_DETACH && GCHeap::IsGCInProgress())
+ if (dwReason == DLL_PROCESS_DETACH && GCHeapUtilities::IsGCInProgress())
return S_OK;
// ExitProcess is called on a thread that we don't know about
@@ -5107,7 +5116,7 @@ void AppDomain::Init()
// Ref_CreateHandleTableBucket, this is because AD::Init() can race with GC
// and once we add ourselves to the handle table map the GC can start walking
// our handles and calling AD::RecordSurvivedBytes() which touches ARM data.
- if (GCHeap::IsServerHeap())
+ if (GCHeapUtilities::IsServerHeap())
m_dwNumHeaps = CPUGroupInfo::CanEnableGCCPUGroups() ?
CPUGroupInfo::GetNumActiveProcessors() :
GetCurrentProcessCpuCount();
@@ -8084,6 +8093,13 @@ BOOL AppDomain::IsCached(AssemblySpec *pSpec)
return m_AssemblyCache.Contains(pSpec);
}
+#ifdef FEATURE_CORECLR
+void AppDomain::GetCacheAssemblyList(SetSHash<PTR_DomainAssembly>& assemblyList)
+{
+ CrstHolder holder(&m_DomainCacheCrst);
+ m_AssemblyCache.GetAllAssemblies(assemblyList);
+}
+#endif
PEAssembly* AppDomain::FindCachedFile(AssemblySpec* pSpec, BOOL fThrow /*=TRUE*/)
{
@@ -8241,7 +8257,7 @@ public:
}
else
{
- IfFailRet(FString::Utf8_Unicode(szName, bIsAscii, wzBuffer, cchBuffer));
+ IfFailRet(FString::Utf8_Unicode(szName, bIsAscii, wzBuffer, cchName));
if (pcchBuffer != nullptr)
{
*pcchBuffer = cchName;
@@ -11110,7 +11126,7 @@ void AppDomain::Unload(BOOL fForceUnload)
}
if(bForceGC)
{
- GCHeap::GetGCHeap()->GarbageCollect();
+ GCHeapUtilities::GetGCHeap()->GarbageCollect();
FinalizerThread::FinalizerThreadWait();
SetStage(STAGE_COLLECTED);
Close(); //NOTHROW!
@@ -11128,14 +11144,14 @@ void AppDomain::Unload(BOOL fForceUnload)
if (takeSnapShot)
{
char buffer[1024];
- sprintf(buffer, "vadump -p %d -o > vadump.%d", GetCurrentProcessId(), unloadCount);
+ sprintf_s(buffer, _countof(buffer), "vadump -p %d -o > vadump.%d", GetCurrentProcessId(), unloadCount);
system(buffer);
- sprintf(buffer, "umdh -p:%d -d -i:1 -f:umdh.%d", GetCurrentProcessId(), unloadCount);
+ sprintf_s(buffer, _countof(buffer), "umdh -p:%d -d -i:1 -f:umdh.%d", GetCurrentProcessId(), unloadCount);
system(buffer);
int takeDHSnapShot = CLRConfig::GetConfigValue(CLRConfig::INTERNAL_ADTakeDHSnapShot);
if (takeDHSnapShot)
{
- sprintf(buffer, "dh -p %d -s -g -h -b -f dh.%d", GetCurrentProcessId(), unloadCount);
+ sprintf_s(buffer, _countof(buffer), "dh -p %d -s -g -h -b -f dh.%d", GetCurrentProcessId(), unloadCount);
system(buffer);
}
}
@@ -11146,7 +11162,7 @@ void AppDomain::Unload(BOOL fForceUnload)
{
// do extra finalizer wait to remove any leftover sb entries
FinalizerThread::FinalizerThreadWait();
- GCHeap::GetGCHeap()->GarbageCollect();
+ GCHeapUtilities::GetGCHeap()->GarbageCollect();
FinalizerThread::FinalizerThreadWait();
LogSpewAlways("Done unload %3.3d\n", unloadCount);
DumpSyncBlockCache();
@@ -11548,7 +11564,7 @@ void AppDomain::ClearGCHandles()
SetStage(STAGE_HANDLETABLE_NOACCESS);
- GCHeap::GetGCHeap()->WaitUntilConcurrentGCComplete();
+ GCHeapUtilities::GetGCHeap()->WaitUntilConcurrentGCComplete();
// Keep async pin handles alive by moving them to default domain
HandleAsyncPinHandles();
@@ -12567,11 +12583,13 @@ AppDomain::RaiseAssemblyResolveEvent(
{
if (pSpec->GetParentAssembly() != NULL)
{
+#ifndef FEATURE_CORECLR
if ( pSpec->IsIntrospectionOnly()
#ifdef FEATURE_FUSION
|| pSpec->GetParentLoadContext() == LOADCTX_TYPE_UNKNOWN
#endif
)
+#endif // FEATURE_CORECLR
{
gc.AssemblyRef=pSpec->GetParentAssembly()->GetExposedAssemblyObject();
}
@@ -13516,8 +13534,8 @@ void SystemDomain::ProcessDelayedUnloadDomains()
}
CONTRACTL_END;
- int iGCRefPoint=GCHeap::GetGCHeap()->CollectionCount(GCHeap::GetGCHeap()->GetMaxGeneration());
- if (GCHeap::GetGCHeap()->IsConcurrentGCInProgress())
+ int iGCRefPoint=GCHeapUtilities::GetGCHeap()->CollectionCount(GCHeapUtilities::GetGCHeap()->GetMaxGeneration());
+ if (GCHeapUtilities::GetGCHeap()->IsConcurrentGCInProgress())
iGCRefPoint--;
BOOL bAppDomainToCleanup = FALSE;
@@ -13695,7 +13713,6 @@ ULONG ADUnloadSink::Release()
if (ulRef == 0)
{
delete this;
- return 0;
}
return ulRef;
};
@@ -13735,8 +13752,8 @@ void AppDomain::EnumStaticGCRefs(promote_func* fn, ScanContext* sc)
}
CONTRACT_END;
- _ASSERTE(GCHeap::IsGCInProgress() &&
- GCHeap::IsServerHeap() &&
+ _ASSERTE(GCHeapUtilities::IsGCInProgress() &&
+ GCHeapUtilities::IsServerHeap() &&
IsGCSpecialThread());
AppDomain::AssemblyIterator asmIterator = IterateAssembliesEx((AssemblyIterationFlags)(kIncludeLoaded | kIncludeExecution));