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
4 changes: 4 additions & 0 deletions eng/native/configureplatform.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,10 @@ if(NOT CLR_CMAKE_TARGET_BROWSER AND NOT CLR_CMAKE_TARGET_WASI)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
else()
if(CLR_CMAKE_RUNTIME_CORECLR)
if(NOT CLR_CROSS_COMPONENTS_BUILD)
# CoreCLR does not use throwing exception object destructors.
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-fassume-nothrow-exception-dtor>)
endif()
if(CLR_CMAKE_TARGET_BROWSER AND NOT CLR_CROSS_COMPONENTS_BUILD)
add_link_options(-fwasm-exceptions)
add_link_options(-sWASM_LEGACY_EXCEPTIONS=0)
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/binder/assemblyname.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ namespace BINDER_SPACE
return InterlockedIncrement(&m_cRef);
}

ULONG AssemblyName::Release()
ULONG AssemblyName::Release() noexcept
{
ULONG ulRef = InterlockedDecrement(&m_cRef);
if (ulRef == 0)
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/binder/inc/assemblyname.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ namespace BINDER_SPACE
HRESULT Init(const AssemblyNameData &data);

ULONG AddRef();
ULONG Release();
ULONG Release() noexcept;

// Getters/Setters
inline const SString &GetSimpleName();
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/debug/daccess/reimpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ DacGetThread(ULONG32 osThread)
return NULL;
}

Thread* GetThread()
Thread* GetThread() noexcept
{
// In dac mode it's unlikely that the thread calling dac
// is actually the same "current thread" that the runtime cares
Expand All @@ -75,7 +75,7 @@ Thread* GetThread()
return NULL;
}

Thread* GetThreadNULLOk()
Thread* GetThreadNULLOk() noexcept
{
return GetThread();
}
Expand Down
16 changes: 16 additions & 0 deletions src/coreclr/gc/env/volatile.h
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,11 @@ T VolatileLoad(T const * pt)
template<typename T>
inline
T VolatileLoadWithoutBarrier(T const * pt)
#ifndef DACCESS_COMPILE
noexcept(noexcept(T(*(T volatile const*)pt)))
#else
noexcept(noexcept(T(*pt)))
#endif
{
#ifndef DACCESS_COMPILE
T val = *(T volatile const *)pt;
Expand Down Expand Up @@ -268,6 +273,11 @@ void VolatileStore(T* pt, T val)
template<typename T>
inline
void VolatileStoreWithoutBarrier(T* pt, T val)
#ifndef DACCESS_COMPILE
noexcept(noexcept(*(T volatile*)pt = val))
#else
noexcept(noexcept(*pt = val))
#endif
{
#ifndef DACCESS_COMPILE
*(T volatile *)pt = val;
Expand Down Expand Up @@ -330,6 +340,9 @@ class Volatile
// Loads the value of the volatile variable atomically without erecting the memory barrier.
//
inline T LoadWithoutBarrier() const
#ifndef DACCESS_COMPILE
noexcept(noexcept(T((volatile T&)m_val)))
#endif
{
return ((volatile T &)m_val);
}
Expand All @@ -348,6 +361,9 @@ class Volatile
// Stores a new value to the volatile variable atomically without erecting the memory barrier.
//
inline void StoreWithoutBarrier(const T& val) const
#ifndef DACCESS_COMPILE
noexcept(noexcept(((volatile T&)m_val) = val))
#endif
{
((volatile T &)m_val) = val;
}
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/inc/arraylist.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class ArrayListBase
enum { NOT_FOUND = -1 };
DWORD FindElement(DWORD start, PTR_VOID element) const;

void Clear();
void Clear() noexcept;

void Init()
{
Expand All @@ -109,7 +109,7 @@ class ArrayListBase
m_firstBlock.m_blockSize = ARRAY_BLOCK_SIZE_START;
}

void Destroy()
void Destroy() noexcept
{
WRAPPER_NO_CONTRACT;
Clear();
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/inc/clrconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ class CLRConfig
static BOOL IsConfigOptionSpecified(LPCWSTR name);

// Free a string returned by GetConfigValue
static void FreeConfigString(_In_ _In_z_ LPWSTR name);
static void FreeConfigString(_In_ _In_z_ LPWSTR name) noexcept;

// Initialize the configuration.
static void Initialize();
Expand All @@ -154,7 +154,7 @@ struct CLRConfigStringTraits final
{
using Type = LPWSTR;
static constexpr Type Default() { return NULL; }
static void Free(Type value) { CLRConfig::FreeConfigString(value); }
static void Free(Type value) noexcept { CLRConfig::FreeConfigString(value); }
};

using CLRConfigStringHolder = LifetimeHolder<CLRConfigStringTraits>;
Expand Down
10 changes: 5 additions & 5 deletions src/coreclr/inc/clrhost.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ using std::nothrow;

struct PreserveLastErrorHolder
{
PreserveLastErrorHolder()
PreserveLastErrorHolder() noexcept
{
m_dwLastError = ::GetLastError();
}

~PreserveLastErrorHolder()
~PreserveLastErrorHolder() noexcept
{
::SetLastError(m_dwLastError);
}
Expand Down Expand Up @@ -78,7 +78,7 @@ HANDLE ClrGetProcessExecutableHeap();
CRITSEC_COOKIE ClrCreateCriticalSection(CrstType type, CrstFlags flags);
void ClrDeleteCriticalSection(CRITSEC_COOKIE cookie);
void ClrEnterCriticalSection(CRITSEC_COOKIE cookie);
void ClrLeaveCriticalSection(CRITSEC_COOKIE cookie);
void ClrLeaveCriticalSection(CRITSEC_COOKIE cookie) noexcept;

// Rather than use the above APIs directly, it is recommended that holder classes
// be used. This guarantees that the locks will be vacated when the scope is popped,
Expand Down Expand Up @@ -150,12 +150,12 @@ extern thread_local size_t t_CantStopCount;

// For debugging, we can track arbitrary Can't-Stop regions.
// In V1.0, this was on the Thread object, but we need to track this for threads w/o a Thread object.
FORCEINLINE void IncCantStopCount()
FORCEINLINE void IncCantStopCount() noexcept
{
t_CantStopCount++;
}

FORCEINLINE void DecCantStopCount()
FORCEINLINE void DecCantStopCount() noexcept
{
t_CantStopCount--;
}
Expand Down
16 changes: 8 additions & 8 deletions src/coreclr/inc/ex.h
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ class Exception

public:
Exception() {LIMITED_METHOD_DAC_CONTRACT; m_innerException = NULL;}
virtual ~Exception() {LIMITED_METHOD_DAC_CONTRACT; if (m_innerException != NULL) Exception::Delete(m_innerException); }
virtual ~Exception() noexcept {LIMITED_METHOD_DAC_CONTRACT; if (m_innerException != NULL) Exception::Delete(m_innerException); }
#ifdef DACCESS_COMPILE
void * operator new(size_t size);
void operator delete(void* ptr);
Expand Down Expand Up @@ -232,7 +232,7 @@ class Exception

HandlerState();

void CleanupTry();
void CleanupTry() noexcept;
void SetupCatch(INDEBUG_COMMA(_In_z_ const char * szFile) int lineNum);
void SucceedCatch();

Expand All @@ -258,10 +258,10 @@ class Exception
// Preallocated exceptions: If there is a preallocated instance of some
// subclass of Exception, override this function and return a correct
// value. The default implementation returns constant FALSE
virtual BOOL IsPreallocatedException();
virtual BOOL IsPreallocatedException() noexcept;
BOOL IsPreallocatedOOMException();

static void Delete(Exception* pvMemory);
static void Delete(Exception* pvMemory) noexcept;

protected:

Expand All @@ -285,7 +285,7 @@ struct ExceptionTraits final
{
using Type = Exception*;
static constexpr Type Default() { return NULL; }
static void Free(Type value)
static void Free(Type value) noexcept
{
STATIC_CONTRACT_WRAPPER;
Exception::Delete(value);
Expand Down Expand Up @@ -523,7 +523,7 @@ class OutOfMemoryException : public Exception

virtual Exception *Clone();

virtual BOOL IsPreallocatedException() { return bIsPreallocated; }
virtual BOOL IsPreallocatedException() noexcept { return bIsPreallocated; }
};

template <typename STATETYPE>
Expand All @@ -546,7 +546,7 @@ class CAutoTryCleanup
#endif
}

DEBUG_NOINLINE ~CAutoTryCleanup()
DEBUG_NOINLINE ~CAutoTryCleanup() noexcept
{
WRAPPER_NO_CONTRACT;

Expand Down Expand Up @@ -1116,7 +1116,7 @@ inline Exception::HandlerState::HandlerState()
#endif
}

inline void Exception::HandlerState::CleanupTry()
inline void Exception::HandlerState::CleanupTry() noexcept
{
LIMITED_METHOD_DAC_CONTRACT;
}
Expand Down
12 changes: 6 additions & 6 deletions src/coreclr/inc/executableallocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ class ExecutableAllocator
static bool IsDoubleMappingEnabled();

// Release memory allocated via DoubleMapping for either templates or normal double mapped data
void ReleaseWorker(void* pRX, bool releaseTemplate);
void ReleaseWorker(void* pRX, bool releaseTemplate) noexcept;

// Initialize the allocator instance
bool Initialize();
Expand Down Expand Up @@ -211,7 +211,7 @@ class ExecutableAllocator
#endif

// Return the ExecuteAllocator singleton instance
static ExecutableAllocator* Instance();
static ExecutableAllocator* Instance() noexcept;

// Initialize the static members of the Executable allocator and allocate
// and initialize the instance of it.
Expand Down Expand Up @@ -258,13 +258,13 @@ class ExecutableAllocator

// Release the executable memory block starting at the passed in address that was allocated
// by one of the ReserveXXX methods.
void Release(void* pRX);
void Release(void* pRX) noexcept;

// Map the specified block of executable memory as RW
void* MapRW(void* pRX, size_t size, CacheableMapping cacheMapping);

// Unmap the RW mapping at the specified address
void UnmapRW(void* pRW);
void UnmapRW(void* pRW) noexcept;

// Allocate thunks from a template. pTemplate is the return value from CreateTemplate
void* AllocateThunksFromTemplate(void *pTemplate, size_t templateSize, void (*dataPageGenerator)(uint8_t* pageBase, size_t size));
Expand Down Expand Up @@ -298,7 +298,7 @@ class ExecutableWriterHolder
other.m_addressRW = NULL;
}

void Unmap()
void Unmap() noexcept
{
#if defined(HOST_APPLE) && defined(HOST_ARM64) && !defined(DACCESS_COMPILE)
if (m_addressRX != NULL)
Expand Down Expand Up @@ -344,7 +344,7 @@ class ExecutableWriterHolder
#endif
}

~ExecutableWriterHolder()
~ExecutableWriterHolder() noexcept
{
Unmap();
}
Expand Down
18 changes: 9 additions & 9 deletions src/coreclr/inc/holder.h
Original file line number Diff line number Diff line change
Expand Up @@ -996,7 +996,7 @@ struct ReleaseHolderTraits final
{
using Type = TYPE*;
static constexpr Type Default() { return NULL; }
static void Free(Type value)
static void Free(Type value) noexcept
{
CONTRACTL
{
Expand All @@ -1021,7 +1021,7 @@ struct HandleTraits final
{
using Type = HANDLE;
static Type Default() { return INVALID_HANDLE_VALUE; }
static void Free(Type h)
static void Free(Type h) noexcept
{
STATIC_CONTRACT_WRAPPER;
if (h != NULL && h != Default())
Expand All @@ -1034,7 +1034,7 @@ struct MapViewTraits final
{
using Type = void*;
static constexpr Type Default() { return NULL; }
static void Free(Type h)
static void Free(Type h) noexcept
{
STATIC_CONTRACT_WRAPPER;
if (h != NULL)
Expand All @@ -1049,7 +1049,7 @@ struct LocalAllocTraits final
{
using Type = T;
static constexpr Type Default() { return NULL; }
static void Free(Type h)
static void Free(Type h) noexcept
{
STATIC_CONTRACT_WRAPPER;
#ifdef HOST_WINDOWS
Expand All @@ -1068,7 +1068,7 @@ struct HModuleTraits final
{
using Type = HMODULE;
static constexpr Type Default() { return NULL; }
static void Free(Type h)
static void Free(Type h) noexcept
{
STATIC_CONTRACT_WRAPPER;
if (h != NULL)
Expand All @@ -1092,7 +1092,7 @@ struct ResetPointerTraits final
{
using Type = T*;
static constexpr Type Default() { return NULL; }
static void Free(Type p)
static void Free(Type p) noexcept
{
STATIC_CONTRACT_WRAPPER;
if (p == NULL)
Expand Down Expand Up @@ -1121,7 +1121,7 @@ struct CoTaskMemTraits final
{
using Type = T*;
static constexpr Type Default() { return NULL; }
static void Free(Type value)
static void Free(Type value) noexcept
{
STATIC_CONTRACT_WRAPPER;
if (value != NULL)
Expand Down Expand Up @@ -1176,7 +1176,7 @@ struct HKEYTraits final
{
using Type = HKEY;
static constexpr Type Default() { return NULL; }
static void Free(Type h)
static void Free(Type h) noexcept
{
STATIC_CONTRACT_WRAPPER;
if (h != NULL)
Expand All @@ -1192,7 +1192,7 @@ struct BSTRTraits final
{
using Type = BSTR;
static constexpr Type Default() { return NULL; }
static void Free(Type h)
static void Free(Type h) noexcept
{
STATIC_CONTRACT_WRAPPER;
if (h != NULL)
Expand Down
6 changes: 4 additions & 2 deletions src/coreclr/inc/metadata.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ struct HENUMInternal

// This will only clear the content of enum and will not free the memory of enum
static void ClearEnum(
HENUMInternal *pmdEnum);
HENUMInternal *pmdEnum) noexcept;

// create a HENUMInternal. This will allocate the memory
__checkReturn
Expand Down Expand Up @@ -293,6 +293,8 @@ EXTERN_GUID(IID_IMDInternalImport, 0x1b119f60, 0xc507, 0x4024, 0xbb, 0x39, 0xf8,
#define INTERFACE IMDInternalImport
DECLARE_INTERFACE_(IMDInternalImport, IUnknown)
{
STDMETHOD_(ULONG, Release)() noexcept PURE;

//*****************************************************************************
// return the count of entries of a given kind in a scope
// For example, pass in mdtMethodDef will tell you how many MethodDef
Expand Down Expand Up @@ -403,7 +405,7 @@ DECLARE_INTERFACE_(IMDInternalImport, IUnknown)
} // MDInternalRW::EnumReset

void EnumClose(
HENUMInternal *phEnum) // [IN] the enumerator to be closed
HENUMInternal *phEnum) noexcept // [IN] the enumerator to be closed
{
_ASSERTE( phEnum->m_EnumType == MDSimpleEnum ||
phEnum->m_EnumType == MDDynamicArrayEnum);
Expand Down
Loading
Loading