Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 59714b6

Browse files
antofikjkotas
authored andcommitted
Remove AppDomainLeaks configuration option (#15956)
Removed all usages of AppDomainLeaks configuration option and CHECK_APP_DOMAIN_LEAKS feature Fix #12094
1 parent 3bd1610 commit 59714b6

35 files changed

+29
-1735
lines changed

src/gc/gcinterface.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -844,11 +844,11 @@ struct ScanContext
844844
uintptr_t stack_limit; // Lowest point on the thread stack that the scanning logic is permitted to read
845845
bool promotion; //TRUE: Promotion, FALSE: Relocation.
846846
bool concurrent; //TRUE: concurrent scanning
847-
#if CHECK_APP_DOMAIN_LEAKS || defined (FEATURE_APPDOMAIN_RESOURCE_MONITORING) || defined (DACCESS_COMPILE)
847+
#if defined (FEATURE_APPDOMAIN_RESOURCE_MONITORING) || defined (DACCESS_COMPILE)
848848
AppDomain *pCurrentDomain;
849849
#else
850850
void* _unused1;
851-
#endif //CHECK_APP_DOMAIN_LEAKS || FEATURE_APPDOMAIN_RESOURCE_MONITORING || DACCESS_COMPILE
851+
#endif //FEATURE_APPDOMAIN_RESOURCE_MONITORING || DACCESS_COMPILE
852852

853853
#if defined(GC_PROFILING) || defined (DACCESS_COMPILE)
854854
MethodDesc *pMD;

src/gc/handletable.cpp

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -368,15 +368,6 @@ void ValidateFetchObjrefForHandle(OBJECTREF objref, ADIndex appDomainIndex)
368368
_ASSERTE(pDomain != NULL);
369369
_ASSERTE(!pDomain->NoAccessToHandleTable());
370370

371-
#if CHECK_APP_DOMAIN_LEAKS
372-
if (g_pConfig->AppDomainLeaks() && objref != NULL)
373-
{
374-
if (appDomainIndex.m_dwIndex)
375-
objref->TryAssignAppDomain(pDomain);
376-
else
377-
objref->TrySetAppDomainAgile();
378-
}
379-
#endif
380371
END_DEBUG_ONLY_CODE;
381372
}
382373

@@ -398,15 +389,6 @@ void ValidateAssignObjrefForHandle(OBJECTREF objref, ADIndex appDomainIndex)
398389
_ASSERTE(pDomain != NULL);
399390
_ASSERTE(!pDomain->NoAccessToHandleTable());
400391

401-
#if CHECK_APP_DOMAIN_LEAKS
402-
if (g_pConfig->AppDomainLeaks() && objref != NULL)
403-
{
404-
if (appDomainIndex.m_dwIndex)
405-
objref->TryAssignAppDomain(pDomain);
406-
else
407-
objref->TrySetAppDomainAgile();
408-
}
409-
#endif
410392
END_DEBUG_ONLY_CODE;
411393
}
412394

src/inc/eetwain.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,7 @@
4040
#define HAS_QUICKUNWIND
4141
#endif
4242

43-
#if CHECK_APP_DOMAIN_LEAKS
44-
#define CHECK_APP_DOMAIN GC_CALL_CHECK_APP_DOMAIN
45-
#else
4643
#define CHECK_APP_DOMAIN 0
47-
#endif
4844

4945
#define NO_OVERRIDE_OFFSET (DWORD)-1
5046

src/strongname/api/common.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -246,11 +246,6 @@ inline void* memcpyUnsafe(void *dest, const void *src, size_t len)
246246
extern "C" void * __cdecl GCSafeMemCpy(void *, const void *, size_t);
247247
#define memcpy(dest, src, len) GCSafeMemCpy(dest, src, len)
248248
#endif // !defined(memcpy)
249-
250-
251-
#if !defined(CHECK_APP_DOMAIN_LEAKS)
252-
#define CHECK_APP_DOMAIN_LEAKS 1
253-
#endif
254249
#else // !_DEBUG && !DACCESS_COMPILE && !CROSSGEN_COMPILE
255250
inline void* memcpyNoGCRefs(void * dest, const void * src, size_t len) {
256251
WRAPPER_NO_CONTRACT;

src/vm/amd64/JitHelpers_Fast.asm

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -754,22 +754,6 @@ LEAF_ENTRY JIT_Stelem_Ref, _TEXT
754754
test r8, r8
755755
jz AssigningNull
756756

757-
ifdef CHECK_APP_DOMAIN_LEAKS
758-
; get Array TypeHandle
759-
mov r9, [r10 + OFFSETOF__MethodTable__m_ElementType] ; 10h -> typehandle offset
760-
; check for non-MT
761-
test r9, 2
762-
jnz NoCheck
763-
764-
; Check VMflags of element type
765-
mov r9, [r9 + OFFSETOF__MethodTable__m_pEEClass]
766-
mov r9d, dword ptr [r9 + OFFSETOF__EEClass__m_wAuxFlags]
767-
test r9d, EEClassFlags
768-
jnz ArrayStoreCheck_Helper
769-
770-
NoCheck:
771-
endif
772-
773757
mov r9, [r10 + OFFSETOF__MethodTable__m_ElementType] ; 10h -> typehandle offset
774758

775759
; check for exact match

src/vm/amd64/jithelpers_fast.S

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -410,22 +410,6 @@ LEAF_ENTRY JIT_Stelem_Ref, _TEXT
410410
test rdx, rdx
411411
jz LOCAL_LABEL(AssigningNull)
412412

413-
#ifdef CHECK_APP_DOMAIN_LEAKS
414-
// get Array TypeHandle
415-
mov rcx, [r10 + OFFSETOF__MethodTable__m_ElementType] // 10h -> typehandle offset,
416-
// check for non-MT
417-
test rcx, 2
418-
jnz LOCAL_LABEL(NoCheck)
419-
420-
// Check VMflags of element type
421-
mov rcx, [rcx + OFFSETOF__MethodTable__m_pEEClass]
422-
mov ecx, dword ptr [rcx + OFFSETOF__EEClass__m_wAuxFlags]
423-
test ecx, EEClassFlags
424-
jnz C_FUNC(ArrayStoreCheck_Helper)
425-
426-
LOCAL_LABEL(NoCheck):
427-
#endif
428-
429413
mov rcx, [r10 + OFFSETOF__MethodTable__m_ElementType] // 10h -> typehandle offset
430414

431415
// check for exact match

src/vm/appdomain.cpp

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2292,9 +2292,6 @@ void SystemDomain::PreallocateSpecialObjects()
22922292
_ASSERTE(g_pPreallocatedSentinelObject == NULL);
22932293

22942294
OBJECTREF pPreallocatedSentinalObject = AllocateObject(g_pObjectClass);
2295-
#if CHECK_APP_DOMAIN_LEAKS
2296-
pPreallocatedSentinalObject->SetSyncBlockAppDomainAgile();
2297-
#endif
22982295
g_pPreallocatedSentinelObject = CreatePinningHandle( pPreallocatedSentinalObject );
22992296

23002297
#ifdef FEATURE_PREJIT
@@ -2346,19 +2343,13 @@ void SystemDomain::CreatePreallocatedExceptions()
23462343

23472344

23482345
EXCEPTIONREF pRudeAbortException = (EXCEPTIONREF)AllocateObject(g_pThreadAbortExceptionClass);
2349-
#if CHECK_APP_DOMAIN_LEAKS
2350-
pRudeAbortException->SetSyncBlockAppDomainAgile();
2351-
#endif
23522346
pRudeAbortException->SetHResult(COR_E_THREADABORTED);
23532347
pRudeAbortException->SetXCode(EXCEPTION_COMPLUS);
23542348
_ASSERTE(g_pPreallocatedRudeThreadAbortException == NULL);
23552349
g_pPreallocatedRudeThreadAbortException = CreateHandle(pRudeAbortException);
23562350

23572351

23582352
EXCEPTIONREF pAbortException = (EXCEPTIONREF)AllocateObject(g_pThreadAbortExceptionClass);
2359-
#if CHECK_APP_DOMAIN_LEAKS
2360-
pAbortException->SetSyncBlockAppDomainAgile();
2361-
#endif
23622353
pAbortException->SetHResult(COR_E_THREADABORTED);
23632354
pAbortException->SetXCode(EXCEPTION_COMPLUS);
23642355
_ASSERTE(g_pPreallocatedThreadAbortException == NULL);
@@ -8200,12 +8191,6 @@ void AppDomain::Close()
82008191
LOG((LF_APPDOMAIN | LF_CORDB, LL_INFO10, "AppDomain::Domain [%d] %#08x %ls is collected.\n",
82018192
GetId().m_dwId, this, GetFriendlyNameForLogging()));
82028193

8203-
8204-
#if CHECK_APP_DOMAIN_LEAKS
8205-
if (g_pConfig->AppDomainLeaks())
8206-
// at this point shouldn't have any non-agile objects in the heap because we finalized all the non-agile ones.
8207-
SyncBlockCache::GetSyncBlockCache()->CheckForUnloadedInstances(GetIndex());
8208-
#endif // CHECK_APP_DOMAIN_LEAKS
82098194
{
82108195
GCX_PREEMP();
82118196
RemoveMemoryPressure();

src/vm/appdomain.hpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1290,10 +1290,6 @@ class BaseDomain
12901290
OBJECTHANDLE CreatePinningHandle(OBJECTREF object)
12911291
{
12921292
WRAPPER_NO_CONTRACT;
1293-
#if CHECK_APP_DOMAIN_LEAKS
1294-
if(IsAppDomain())
1295-
object->TryAssignAppDomain((AppDomain*)this,TRUE);
1296-
#endif
12971293
return ::CreatePinningHandle(m_handleStore, object);
12981294
}
12991295

src/vm/arm/stubs.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2512,11 +2512,6 @@ void InitJITHelpers1()
25122512
{
25132513
STANDARD_VM_CONTRACT;
25142514

2515-
#if CHECK_APP_DOMAIN_LEAKS
2516-
if(g_pConfig->AppDomainLeaks())
2517-
SetJitHelperFunction(CORINFO_HELP_ARRADDR_ST, JIT_Stelem_Ref_Portable);
2518-
#endif
2519-
25202515
// Allocation helpers, faster but non-logging.
25212516
if (!(TrackAllocationsEnabled()
25222517
|| LoggingOn(LF_GCALLOC, LL_INFO10)

src/vm/array.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ MethodTable* Module::CreateArrayMethodTable(TypeHandle elemTypeHnd, CorElementTy
432432
pClass->SetArrayElementType (elemType);
433433
pClass->SetMethodTable (pMT);
434434

435-
#if defined(CHECK_APP_DOMAIN_LEAKS) || defined(_DEBUG)
435+
#if defined(_DEBUG)
436436
// Non-covariant arrays of agile types are agile
437437
if (elemType != ELEMENT_TYPE_CLASS && elemTypeHnd.IsAppDomainAgile())
438438
pClass->SetAppDomainAgile();

0 commit comments

Comments
 (0)