Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/coreclr/vm/appdomain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -903,7 +903,7 @@ OBJECTREF AppDomain::GetMissingObject()
// Retrieve the value static field and store it.
OBJECTHANDLE hndMissing = CreateHandle(pValueFD->GetStaticOBJECTREF());

if (FastInterlockCompareExchangePointer(&m_hndMissing, hndMissing, NULL) != NULL)
if (InterlockedCompareExchangeT(&m_hndMissing, hndMissing, NULL) != NULL)
{
// Exchanged failed. The m_hndMissing did not equal NULL and was returned.
DestroyHandle(hndMissing);
Expand Down Expand Up @@ -2390,7 +2390,7 @@ void FileLoadLock::SetError(Exception *ex)
void FileLoadLock::AddRef()
{
LIMITED_METHOD_CONTRACT;
FastInterlockIncrement((LONG *) &m_dwRefCount);
InterlockedIncrement((LONG *) &m_dwRefCount);
}

UINT32 FileLoadLock::Release()
Expand All @@ -2403,7 +2403,7 @@ UINT32 FileLoadLock::Release()
}
CONTRACTL_END;

LONG count = FastInterlockDecrement((LONG *) &m_dwRefCount);
LONG count = InterlockedDecrement((LONG *) &m_dwRefCount);
if (count == 0)
delete this;

Expand Down Expand Up @@ -4034,7 +4034,7 @@ RCWRefCache *AppDomain::GetRCWRefCache()

if (!m_pRCWRefCache) {
NewHolder<RCWRefCache> pRCWRefCache = new RCWRefCache(this);
if (FastInterlockCompareExchangePointer(&m_pRCWRefCache, (RCWRefCache *)pRCWRefCache, NULL) == NULL)
if (InterlockedCompareExchangeT(&m_pRCWRefCache, (RCWRefCache *)pRCWRefCache, NULL) == NULL)
{
pRCWRefCache.SuppressRelease();
}
Expand Down
6 changes: 3 additions & 3 deletions src/coreclr/vm/appdomain.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2001,14 +2001,14 @@ class AppDomain : public BaseDomain
{
LIMITED_METHOD_CONTRACT;
_ASSERTE(m_dwIterHolders);
FastInterlockDecrement(&m_dwIterHolders);
InterlockedDecrement(&m_dwIterHolders);
}


void IteratorAcquire()
{
LIMITED_METHOD_CONTRACT;
FastInterlockIncrement(&m_dwIterHolders);
InterlockedIncrement(&m_dwIterHolders);
}

#endif
Expand Down Expand Up @@ -2152,7 +2152,7 @@ class AppDomain : public BaseDomain
STRESS_LOG1(LF_APPDOMAIN, LL_INFO100,"Updating AD stage, stage=%d\n",stage);
Stage lastStage=m_Stage;
while (lastStage !=stage)
lastStage = (Stage)FastInterlockCompareExchange((LONG*)&m_Stage,stage,lastStage);
lastStage = (Stage)InterlockedCompareExchange((LONG*)&m_Stage,stage,lastStage);
};

// List of unloaded LoaderAllocators, protected by code:GetLoaderAllocatorReferencesLock (for now)
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/vm/arm/cgencpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -1064,7 +1064,7 @@ struct ThisPtrRetBufPrecode {
CONTRACTL_END;

ExecutableWriterHolder<ThisPtrRetBufPrecode> precodeWriterHolder(this, sizeof(ThisPtrRetBufPrecode));
return FastInterlockCompareExchange((LONG*)&precodeWriterHolder.GetRW()->m_pTarget, (LONG)target, (LONG)expected) == (LONG)expected;
return InterlockedCompareExchange((LONG*)&precodeWriterHolder.GetRW()->m_pTarget, (LONG)target, (LONG)expected) == (LONG)expected;
}
#endif // !DACCESS_COMPILE
};
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/vm/array.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1183,7 +1183,7 @@ class ArrayStubCache : public StubCacheBase
if (s_pArrayStubCache == NULL)
{
ArrayStubCache * pArrayStubCache = new ArrayStubCache(SystemDomain::GetGlobalLoaderAllocator()->GetStubHeap());
if (FastInterlockCompareExchangePointer(&s_pArrayStubCache, pArrayStubCache, NULL) != NULL)
if (InterlockedCompareExchangeT(&s_pArrayStubCache, pArrayStubCache, NULL) != NULL)
delete pArrayStubCache;
}

Expand Down
6 changes: 3 additions & 3 deletions src/coreclr/vm/assembly.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ void Assembly::Init(AllocMemTracker *pamTracker, LoaderAllocator *pLoaderAllocat
else
m_pModule = Module::Create(this, mdFileNil, pPEAssembly, pamTracker);

FastInterlockIncrement((LONG*)&g_cAssemblies);
InterlockedIncrement((LONG*)&g_cAssemblies);

PrepareModuleForAssembly(m_pModule, pamTracker);

Expand Down Expand Up @@ -312,7 +312,7 @@ void Assembly::Terminate( BOOL signalProfiler )
m_pClassLoader = NULL;
}

FastInterlockDecrement((LONG*)&g_cAssemblies);
InterlockedDecrement((LONG*)&g_cAssemblies);

#ifdef PROFILING_SUPPORTED
if (CORProfilerTrackAssemblyLoads())
Expand Down Expand Up @@ -1084,7 +1084,7 @@ void Assembly::PublishModuleIntoAssembly(Module *module)
CONTRACTL_END

GetModule()->EnsuredStoreFile(module->GetModuleRef(), module);
FastInterlockIncrement((LONG*)&m_pClassLoader->m_cUnhashedModules);
InterlockedIncrement((LONG*)&m_pClassLoader->m_cUnhashedModules);
}


Expand Down
28 changes: 14 additions & 14 deletions src/coreclr/vm/ceeload.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ BOOL Module::SetTransientFlagInterlocked(DWORD dwFlag)
DWORD dwTransientFlags = m_dwTransientFlags;
if ((dwTransientFlags & dwFlag) != 0)
return FALSE;
if ((DWORD)FastInterlockCompareExchange((LONG*)&m_dwTransientFlags, dwTransientFlags | dwFlag, dwTransientFlags) == dwTransientFlags)
if ((DWORD)InterlockedCompareExchange((LONG*)&m_dwTransientFlags, dwTransientFlags | dwFlag, dwTransientFlags) == dwTransientFlags)
return TRUE;
}
}
Expand Down Expand Up @@ -434,7 +434,7 @@ void Module::Initialize(AllocMemTracker *pamTracker, LPCWSTR szName)
#ifdef FEATURE_COLLECTIBLE_TYPES
if (GetAssembly()->IsCollectible())
{
FastInterlockOr(&m_dwPersistedFlags, COLLECTIBLE_MODULE);
InterlockedOr((LONG*)&m_dwPersistedFlags, COLLECTIBLE_MODULE);
}
#endif // FEATURE_COLLECTIBLE_TYPES

Expand Down Expand Up @@ -962,7 +962,7 @@ MethodTable *Module::GetGlobalMethodTable()
ClassLoader::FailIfUninstDefOrRef).AsMethodTable();
}

FastInterlockOr(&m_dwPersistedFlags, COMPUTED_GLOBAL_CLASS);
InterlockedOr((LONG*)&m_dwPersistedFlags, COMPUTED_GLOBAL_CLASS);
RETURN pMT;
}
else
Expand Down Expand Up @@ -1580,11 +1580,11 @@ BOOL Module::HasDefaultDllImportSearchPathsAttribute()
attributeIsFound = GetDefaultDllImportSearchPathsAttributeValue(this, TokenFromRid(1, mdtAssembly),&m_DefaultDllImportSearchPathsAttributeValue);
if(attributeIsFound)
{
FastInterlockOr(&m_dwPersistedFlags, DEFAULT_DLL_IMPORT_SEARCH_PATHS_IS_CACHED | DEFAULT_DLL_IMPORT_SEARCH_PATHS_STATUS);
InterlockedOr((LONG*)&m_dwPersistedFlags, DEFAULT_DLL_IMPORT_SEARCH_PATHS_IS_CACHED | DEFAULT_DLL_IMPORT_SEARCH_PATHS_STATUS);
}
else
{
FastInterlockOr(&m_dwPersistedFlags, DEFAULT_DLL_IMPORT_SEARCH_PATHS_IS_CACHED);
InterlockedOr((LONG*)&m_dwPersistedFlags, DEFAULT_DLL_IMPORT_SEARCH_PATHS_IS_CACHED);
}

return (m_dwPersistedFlags & DEFAULT_DLL_IMPORT_SEARCH_PATHS_STATUS) != 0 ;
Expand Down Expand Up @@ -1644,7 +1644,7 @@ BOOL Module::IsRuntimeWrapExceptions()
fRuntimeWrapExceptions = TRUE;
}
ErrExit:
FastInterlockOr(&m_dwPersistedFlags, COMPUTED_WRAP_EXCEPTIONS |
InterlockedOr((LONG*)&m_dwPersistedFlags, COMPUTED_WRAP_EXCEPTIONS |
(fRuntimeWrapExceptions ? WRAP_EXCEPTIONS : 0));
}

Expand Down Expand Up @@ -1681,7 +1681,7 @@ BOOL Module::IsRuntimeMarshallingEnabled()
(const void**)&pVal, &cbVal);
}

FastInterlockOr(&m_dwPersistedFlags, RUNTIME_MARSHALLING_ENABLED_IS_CACHED |
InterlockedOr((LONG*)&m_dwPersistedFlags, RUNTIME_MARSHALLING_ENABLED_IS_CACHED |
(hr == S_OK ? 0 : RUNTIME_MARSHALLING_ENABLED));

return hr != S_OK;
Expand Down Expand Up @@ -1712,7 +1712,7 @@ BOOL Module::IsPreV4Assembly()
}
}

FastInterlockOr(&m_dwPersistedFlags, COMPUTED_IS_PRE_V4_ASSEMBLY |
InterlockedOr((LONG*)&m_dwPersistedFlags, COMPUTED_IS_PRE_V4_ASSEMBLY |
(fIsPreV4Assembly ? IS_PRE_V4_ASSEMBLY : 0));
}

Expand All @@ -1731,7 +1731,7 @@ DWORD Module::AllocateDynamicEntry(MethodTable *pMT)
}
CONTRACTL_END;

DWORD newId = FastInterlockExchangeAdd((LONG*)&m_cDynamicEntries, 1);
DWORD newId = InterlockedExchangeAdd((LONG*)&m_cDynamicEntries, 1);

if (newId >= VolatileLoad(&m_maxDynamicEntries))
{
Expand Down Expand Up @@ -2123,7 +2123,7 @@ void Module::FreeClassTables()
if (m_dwTransientFlags & CLASSES_FREED)
return;

FastInterlockOr(&m_dwTransientFlags, CLASSES_FREED);
InterlockedOr((LONG*)&m_dwTransientFlags, CLASSES_FREED);

#if _DEBUG
DebugLogRidMapOccupancy();
Expand Down Expand Up @@ -2698,7 +2698,7 @@ ILStubCache* Module::GetILStubCache()
{
ILStubCache *pILStubCache = new ILStubCache(GetLoaderAllocator()->GetHighFrequencyHeap());

if (FastInterlockCompareExchangePointer(&m_pILStubCache, pILStubCache, NULL) != NULL)
if (InterlockedCompareExchangeT(&m_pILStubCache, pILStubCache, NULL) != NULL)
{
// some thread swooped in and set the field
delete pILStubCache;
Expand Down Expand Up @@ -4398,7 +4398,7 @@ LoaderHeap *Module::GetThunkHeap()
ThunkHeapStubManager::g_pManager->GetRangeList(),
UnlockedLoaderHeap::HeapKind::Executable);

if (FastInterlockCompareExchangePointer(&m_pThunkHeap, pNewHeap, 0) != 0)
if (InterlockedCompareExchangeT(&m_pThunkHeap, pNewHeap, 0) != 0)
{
delete pNewHeap;
}
Expand Down Expand Up @@ -4732,15 +4732,15 @@ void SaveManagedCommandLine(LPCWSTR pwzAssemblyPath, int argc, LPCWSTR *argv)
void Module::SetIsIJWFixedUp()
{
LIMITED_METHOD_CONTRACT;
FastInterlockOr(&m_dwTransientFlags, IS_IJW_FIXED_UP);
InterlockedOr((LONG*)&m_dwTransientFlags, IS_IJW_FIXED_UP);
}
#endif // !DACCESS_COMPILE

#ifndef DACCESS_COMPILE
void Module::SetBeingUnloaded()
{
LIMITED_METHOD_CONTRACT;
FastInterlockOr((ULONG*)&m_dwTransientFlags, IS_BEING_UNLOADED);
InterlockedOr((LONG*)&m_dwTransientFlags, IS_BEING_UNLOADED);
}

// ===========================================================================
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/vm/ceeload.h
Original file line number Diff line number Diff line change
Expand Up @@ -891,7 +891,7 @@ class Module
VOID SetIsTenured()
{
LIMITED_METHOD_CONTRACT;
FastInterlockOr(&m_dwTransientFlags, MODULE_IS_TENURED);
InterlockedOr((LONG*)&m_dwTransientFlags, MODULE_IS_TENURED);
}
#endif // !DACCESS_COMPILE

Expand All @@ -909,7 +909,7 @@ class Module
VOID SetIsReadyForTypeLoad()
{
LIMITED_METHOD_CONTRACT;
FastInterlockOr(&m_dwTransientFlags, MODULE_READY_FOR_TYPELOAD);
InterlockedOr((LONG*)&m_dwTransientFlags, MODULE_READY_FOR_TYPELOAD);
}
#endif

Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/vm/ceemain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1528,7 +1528,7 @@ void STDMETHODCALLTYPE EEShutDown(BOOL fIsDllUnloading)

if (!fIsDllUnloading)
{
if (FastInterlockIncrement(&OnlyOne) != 0)
if (InterlockedIncrement(&OnlyOne) != 0)
{
// I'm in a regular shutdown -- but another thread got here first.
// It's a race if I return from here -- I'll call ExitProcess next, and
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/vm/class.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2192,7 +2192,7 @@ void EEClass::GetBestFitMapping(MethodTable * pMT, BOOL *pfBestFitMapping, BOOL
if (*pfBestFitMapping) flags |= VMFLAG_BESTFITMAPPING;
if (*pfThrowOnUnmappableChar) flags |= VMFLAG_THROWONUNMAPPABLECHAR;

FastInterlockOr(&pClass->m_VMFlags, flags);
InterlockedOr((LONG*)&pClass->m_VMFlags, flags);
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/vm/class.h
Original file line number Diff line number Diff line change
Expand Up @@ -1198,7 +1198,7 @@ class EEClass // DO NOT CREATE A NEW EEClass USING NEW!
inline void SetHasNoGuid()
{
WRAPPER_NO_CONTRACT;
FastInterlockOr(&m_VMFlags, VMFLAG_NO_GUID);
InterlockedOr((LONG*)&m_VMFlags, VMFLAG_NO_GUID);
}

public:
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/vm/clsload.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -894,7 +894,7 @@ void ClassLoader::LazyPopulateCaseInsensitiveHashTables()

amTracker.SuppressRelease();
pModule->SetAvailableClassCaseInsHash(pNewClassCaseInsHash);
FastInterlockDecrement((LONG*)&m_cUnhashedModules);
InterlockedDecrement((LONG*)&m_cUnhashedModules);

_ASSERT(m_cUnhashedModules >= 0);
}
Expand Down
10 changes: 5 additions & 5 deletions src/coreclr/vm/codeman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ ExecutionManager::ReaderLockHolder::ReaderLockHolder(HostCallPreference hostCall

IncCantAllocCount();

FastInterlockIncrement(&m_dwReaderCount);
InterlockedIncrement(&m_dwReaderCount);

EE_LOCK_TAKEN(GetPtrForLockContract());

Expand Down Expand Up @@ -687,7 +687,7 @@ ExecutionManager::ReaderLockHolder::~ReaderLockHolder()
}
CONTRACTL_END;

FastInterlockDecrement(&m_dwReaderCount);
InterlockedDecrement(&m_dwReaderCount);
DecCantAllocCount();

EE_LOCK_RELEASED(GetPtrForLockContract());
Expand Down Expand Up @@ -725,10 +725,10 @@ ExecutionManager::WriterLockHolder::WriterLockHolder()
// or allow a profiler to walk its stack
Thread::IncForbidSuspendThread();

FastInterlockIncrement(&m_dwWriterLock);
InterlockedIncrement(&m_dwWriterLock);
if (m_dwReaderCount == 0)
break;
FastInterlockDecrement(&m_dwWriterLock);
InterlockedDecrement(&m_dwWriterLock);

// Before we loop and retry, it's safe to suspend or hijack and inspect
// this thread
Expand All @@ -743,7 +743,7 @@ ExecutionManager::WriterLockHolder::~WriterLockHolder()
{
LIMITED_METHOD_CONTRACT;

FastInterlockDecrement(&m_dwWriterLock);
InterlockedDecrement(&m_dwWriterLock);

// Writer lock released, so it's safe again for this thread to be
// suspended or have its stack walked by a profiler
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/vm/codepitchingmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ static void CreateRWLock(SimpleRWLock** lock)
void *pLockSpace = SystemDomain::GetGlobalLoaderAllocator()->GetLowFrequencyHeap()->AllocMem(S_SIZE_T(sizeof(SimpleRWLock)));
SimpleRWLock *pLock = new (pLockSpace) SimpleRWLock(COOPERATIVE_OR_PREEMPTIVE, LOCK_TYPE_DEFAULT);

if (FastInterlockCompareExchangePointer(lock, pLock, NULL) != NULL)
if (InterlockedCompareExchangeT(lock, pLock, NULL) != NULL)
SystemDomain::GetGlobalLoaderAllocator()->GetLowFrequencyHeap()->BackoutMem(pLockSpace, sizeof(SimpleRWLock));
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/vm/codeversion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ NativeCodeVersionId NativeCodeVersionNode::GetVersionId() const
BOOL NativeCodeVersionNode::SetNativeCodeInterlocked(PCODE pCode, PCODE pExpected)
{
LIMITED_METHOD_CONTRACT;
return FastInterlockCompareExchangePointer(&m_pNativeCode,
return InterlockedCompareExchangeT(&m_pNativeCode,
(TADDR&)pCode, (TADDR&)pExpected) == (TADDR&)pExpected;
}
#endif
Expand Down
6 changes: 3 additions & 3 deletions src/coreclr/vm/comcache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1100,7 +1100,7 @@ HRESULT IUnkEntry::MarshalIUnknownToStream()

// Try to set the stream in the IUnkEntry. If another thread already set it,
// then we need to release the stream we just set up.
if (FastInterlockCompareExchangePointer(&m_pStream, pStream, NULL) != NULL)
if (InterlockedCompareExchangeT(&m_pStream, pStream, NULL) != NULL)
SafeReleaseStream(pStream);

return hr;
Expand Down Expand Up @@ -1248,7 +1248,7 @@ DWORD CtxEntry::AddRef()
}
CONTRACTL_END;

ULONG cbRef = FastInterlockIncrement((LONG*)&m_dwRefCount);
ULONG cbRef = InterlockedIncrement((LONG*)&m_dwRefCount);
LOG((LF_INTEROP, LL_INFO100, "CtxEntry::Addref %8.8x with %d\n", this, cbRef));
return cbRef;
}
Expand All @@ -1269,7 +1269,7 @@ DWORD CtxEntry::Release()

LPVOID pCtxCookie = m_pCtxCookie;

LONG cbRef = FastInterlockDecrement((LONG*)&m_dwRefCount);
LONG cbRef = InterlockedDecrement((LONG*)&m_dwRefCount);
LOG((LF_INTEROP, LL_INFO100, "CtxEntry::Release %8.8x with %d\n", this, cbRef));

// If the ref count falls to 0, try and delete the ctx entry.
Expand Down
Loading