add_compile_options(-Wno-uninitialized)
add_compile_options(-Wno-strict-aliasing)
add_compile_options(-Wno-array-bounds)
- add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-Wno-class-memaccess>)
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-Wno-misleading-indentation>)
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-Wno-stringop-overflow>)
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-Wno-restrict>)
EXCEPTIONREF refExceptionForWatsonBucketing;
STRINGREF refErrorSourceString;
} gc;
- ZeroMemory(&gc, sizeof(gc));
-
- GCPROTECT_BEGIN(gc);
-
gc.refMesgString = refMesgString;
gc.refExceptionForWatsonBucketing = refExceptionForWatsonBucketing;
gc.refErrorSourceString = refErrorSourceString;
+ GCPROTECT_BEGIN(gc);
+
// Managed code injected FailFast maps onto the unmanaged version
// (EEPolicy::HandleFatalError) in the following manner: the exit code is
// always set to COR_E_FAILFAST and the address passed (usually a failing
SOSDacEnter();
- memset(oomData, 0, sizeof(DacpOomData));
+ *oomData = {};
if (!GCHeapUtilities::IsServerHeap())
{
return E_INVALIDARG;
SOSDacEnter();
- memset(data, 0, sizeof(DacpOomData));
+ *data = {};
if (!GCHeapUtilities::IsServerHeap())
hr = E_FAIL; // doesn't make sense to call this on WKS mode
static_assert_no_msg(DAC_MAX_GC_MECHANISM_BITS_COUNT == MAX_GC_MECHANISM_BITS_COUNT);
SOSDacEnter();
- memset(data, 0, sizeof(DacpGCInterestingInfoData));
+ *data = {};
if (g_heap_type != GC_HEAP_SVR)
{
return E_INVALIDARG;
SOSDacEnter();
- memset(data, 0, sizeof(DacpGCInterestingInfoData));
+ *data = {};
if (!GCHeapUtilities::IsServerHeap())
hr = E_FAIL; // doesn't make sense to call this on WKS mode
// field_offset = g_gcDacGlobals->gc_heap_field_offsets
// p_field_offset = field_offset[field_index]
-// p_field = BASE + p_field_offset
+// p_field = BASE + p_field_offset
// field_index++
#define LOAD_BASE(field_name, field_type) \
DPTR(int) p_##field_name##_offset = TableIndex(field_offsets, field_index, sizeof(int)); \
inline dac_gc_heap
LoadGcHeapData(TADDR heap)
{
- dac_gc_heap result;
- memset(&result, 0, sizeof(dac_gc_heap));
+ dac_gc_heap result = {};
DPTR(int) field_offsets = g_gcDacGlobals->gc_heap_field_offsets;
int field_index = 0;
inline dac_generation
LoadGeneration(TADDR generation)
{
- dac_generation result;
- memset(&result, 0, sizeof(dac_generation));
-
+ dac_generation result = {};
DPTR(int) field_offsets = g_gcDacGlobals->generation_field_offsets;
int field_index = 0;
DbgTransportTarget *g_pDbgTransportTarget = NULL;
DbgTransportTarget::DbgTransportTarget()
+ : m_pProcessList{}
+ , m_sLock{}
{
- memset(this, 0, sizeof(*this));
}
// Initialization routine called only by the DbgTransportManager.
// Invalidate the active frame.
m_activeFound = false;
- memset(&(m_activeFrame), 0, sizeof(m_activeFrame));
+ m_activeFrame = {};
m_activeFrame.fp = LEAF_MOST_FRAME;
}
ThrowHR(COR_E_OVERFLOW);
}
FuncEvalArgInfo * pFEArgInfo = (FuncEvalArgInfo *)_alloca(cbAllocSize);
- memset(pFEArgInfo, 0, cbAllocSize);
+ *pFEArgInfo = {};
GatherFuncEvalArgInfo(pDE, mSig, argData, pFEArgInfo);
ThrowHR(COR_E_OVERFLOW);
}
OBJECTREF * pObjectRefArray = (OBJECTREF*)_alloca(cbAllocSize);
- memset(pObjectRefArray, 0, cbAllocSize);
+ *pObjectRefArray = {};
GCPROTECT_ARRAY_BEGIN(*pObjectRefArray, pDE->m_argCount);
//
pADInfo->FreeEntry();
#ifdef _DEBUG
- memset(pADInfo, 0, sizeof(AppDomainInfo));
+ *pADInfo = {};
#endif
// decrement the used slot count
{
public:
// No real work done in the constructor. Use Init() instead.
- DbgTransportSession();
+ DbgTransportSession() = default;
// Cleanup what is allocated/created in Init()
~DbgTransportSession();
// error is raised) and which incoming messages are valid.
enum SessionState
{
- SS_Closed, // No session and no attempt is being made to form one
+ SS_Closed = 0, // No session and no attempt is being made to form one
SS_Opening_NC, // Session is being formed but no connection is established yet
SS_Opening, // Session is being formed, the low level connection is in place
SS_Open, // Session is fully formed and normal transport messages can be sent and received
#include "ddmarshalutil.h"
#endif // !RIGHT_SIDE_COMPILE
-// No real work done in the constructor. Use Init() instead.
-DbgTransportSession::DbgTransportSession()
-{
- m_ref = 1;
- m_eState = SS_Closed;
-}
-
DbgTransportSession::~DbgTransportSession()
{
DbgTransportLog(LC_Proxy, "DbgTransportSession::~DbgTransportSession() called");
// Start with a blank slate so that Shutdown() on a partially initialized instance will only do the
// cleanup necessary.
- memset(this, 0, sizeof(*this));
+ *this = {};
// Because of the above memset the embedded classes/structs need to be reinitialized especially
// the two way pipe; it expects the in/out handles to be -1 instead of 0.
memset (full_gc_counts, 0, sizeof (full_gc_counts));
- memset (&last_ephemeral_gc_info, 0, sizeof (last_ephemeral_gc_info));
- memset (&last_full_blocking_gc_info, 0, sizeof (last_full_blocking_gc_info));
+ last_ephemeral_gc_info = {};
+ last_full_blocking_gc_info = {};
#ifdef BACKGROUND_GC
memset (&last_bgc_info, 0, sizeof (last_bgc_info));
#endif //BACKGROUND_GC
#ifdef MULTIPLE_HEAPS
#ifdef _DEBUG
memset (committed_by_oh_per_heap, 0, sizeof (committed_by_oh_per_heap));
-#endif
+#endif
g_heaps [h_number] = this;
// The no_gc mode was already in progress yet we triggered another GC,
// this effectively exits the no_gc mode.
restore_data_for_no_gc();
-
+
memset (¤t_no_gc_region_info, 0, sizeof (current_no_gc_region_info));
}
else
#ifdef FEATURE_EVENT_TRACE
void gc_heap::init_bucket_info()
{
- memset (bucket_info, 0, sizeof (bucket_info));
+ *bucket_info = {};
}
void gc_heap::add_plug_in_condemned_info (generation* gen, size_t plug_size)
uint32_t count;
size_t size;
- etw_bucket_info() {}
+ etw_bucket_info() = default;
void set (uint16_t _index, uint32_t _count, size_t _size)
{
if (pTable == NULL)
return NULL;
- memset (pTable, 0, dwSize);
+ memset ((void*)pTable, 0, dwSize);
// allocate the initial handle segment
pTable->pSegmentList = SegmentAlloc(pTable);
Assembler* pAsm = (Assembler*)m_pAssembler;
if(tmp==NULL)
{
- tmp = new AsmManFile;
+ tmp = new (nothrow) AsmManFile();
if(tmp==NULL)
{
pAsm->report->error("\nOut of memory!\n");
return;
}
- memset(tmp,0,sizeof(AsmManFile));
if((dwAttr & 0x80000000)!=0) pAsm->m_fEntryPointPresent = TRUE;
tmp->szName = szName;
tmp->dwAttr = dwAttr;
}
else
{
- if((m_pCurAsmRef = new AsmManAssembly))
+ if((m_pCurAsmRef = new (nothrow) AsmManAssembly()))
{
- memset(m_pCurAsmRef,0,sizeof(AsmManAssembly));
m_pCurAsmRef->usVerMajor = (USHORT)0xFFFF;
m_pCurAsmRef->usVerMinor = (USHORT)0xFFFF;
m_pCurAsmRef->usBuild = (USHORT)0xFFFF;
void AsmMan::StartComType(_In_ __nullterminated char* szName, DWORD dwAttr)
{
- if((m_pCurComType = new AsmManComType))
+ if((m_pCurComType = new (nothrow) AsmManComType()))
{
- memset(m_pCurComType,0,sizeof(AsmManComType));
m_pCurComType->szName = szName;
m_pCurComType->dwAttr = dwAttr;
m_pCurComType->m_fNew = TRUE;
BinStr* pHash;
BOOL m_fNew;
CustomDescrList m_CustomDescrList;
- AsmManFile()
- {
- szName = NULL;
- pHash = NULL;
- m_fNew = TRUE;
- }
+ AsmManFile() = default;
~AsmManFile()
{
if(szName) delete szName;
USHORT usVerMinor;
USHORT usBuild;
USHORT usRevision;
- AsmManAssembly()
+ AsmManAssembly() = default;
+ ~AsmManAssembly()
{
- /*
- usVerMajor = usVerMinor = usBuild = usRevision = 0xFFFF;
- szName = szAlias = NULL;
- dwAlias = dwAttr = 0;
- tkTok = 0;
- pPublicKey = pPublicKeyToken =pHashBlob = pLocale = NULL;
- ulHashAlgorithm = 0;
- m_fNew = TRUE;
- isAutodetect = isRef = FALSE;
- */
+ if(szAlias && (szAlias != szName)) delete [] szAlias;
+ if(szName) delete [] szName;
+ if(pPublicKey) delete pPublicKey;
+ if(pPublicKeyToken) delete pPublicKeyToken;
+ if(pHashBlob) delete pHashBlob;
+ if(pLocale) delete pLocale;
}
- ~AsmManAssembly()
- {
- if(szAlias && (szAlias != szName)) delete [] szAlias;
- if(szName) delete [] szName;
- if(pPublicKey) delete pPublicKey;
- if(pPublicKeyToken) delete pPublicKeyToken;
- if(pHashBlob) delete pHashBlob;
- if(pLocale) delete pLocale;
- }
int ComparedTo(AsmManAssembly* pX){ return strcmp(szAlias,pX->szAlias); }
};
//typedef SORTEDARRAY<AsmManAssembly> AsmManAssemblyList;
{
alloc_count++;
pRet = &bucket[i];
- memset(pRet, 0, sizeof(RBNODE<T>));
+ *pRet = {};
pRet->dwInUse = 1;
return pRet;
}
RBNODEBUCKET<T> base;
public:
- RBNODEPOOL()
- {
- memset(&base,0,sizeof(RBNODEBUCKET<T>));
- };
+ RBNODEPOOL() = default;
RBNODE<T>* AllocNode()
{
};
public:
- RBTREE()
+ RBTREE() : NodePool{}
{
pRoot = NodePool.AllocNode();
InitSpecNode(pRoot);
void Assembler::NewSEHDescriptor(void) //sets m_SEHD
{
m_SEHDstack.PUSH(m_SEHD);
- m_SEHD = new SEH_Descriptor;
+ m_SEHD = new (nothrow) SEH_Descriptor();
if(m_SEHD == NULL) report->error("Failed to allocate SEH descriptor\n");
}
/**************************************************************************/
report->error("Event '%s...' -- name too long (%d characters).\n",szName,strlen(szName));
szName[MAX_CLASSNAME_LENGTH-1] = c;
}
- if((m_pCurEvent = new EventDescriptor))
+ if((m_pCurEvent = new (nothrow) EventDescriptor()))
{
- memset(m_pCurEvent,0,sizeof(EventDescriptor));
m_pCurEvent->m_tdClass = m_pCurClass->m_cl;
m_pCurEvent->m_szName = szName;
m_pCurEvent->m_dwAttr = dwAttr;
report->error("Property '%s...' -- name too long (%d characters).\n",szName,strlen(szName));
szName[MAX_CLASSNAME_LENGTH-1] = c;
}
- m_pCurProp = new PropDescriptor;
+ m_pCurProp = new (nothrow) PropDescriptor();
if(m_pCurProp == NULL)
{
report->error("Failed to allocate Property Descriptor\n");
return;
}
- memset(m_pCurProp,0,sizeof(PropDescriptor));
m_pCurProp->m_tdClass = m_pCurClass->m_cl;
m_pCurProp->m_szName = szName;
m_pCurProp->m_dwAttr = dwAttr;
mdTypeRef cException; // what to catch
};
- SEH_Descriptor()
- {
- memset(this, 0, sizeof(*this));
- }
+ SEH_Descriptor() = default;
};
mdEvent m_edEventTok;
BOOL m_fNew;
CustomDescrList m_CustomDescrList;
+ EventDescriptor() = default;
~EventDescriptor() { m_tklOthers.RESET(false); };
};
typedef FIFO<EventDescriptor> EventDList;
mdProperty m_pdPropTok;
BOOL m_fNew;
CustomDescrList m_CustomDescrList;
+ PropDescriptor() = default;
~PropDescriptor() { m_tklOthers.RESET(false); };
};
typedef FIFO<PropDescriptor> PropDList;
mdToken tkImplementation;
WCHAR* wzName;
DWORD dwFlags;
- LocalComTypeDescr() { wzName=NULL; };
+ LocalComTypeDescr(mdExportedType exportedType, mdTypeDef typeDef, mdToken impl, WCHAR* name, DWORD flags)
+ : tkComTypeTok{exportedType}
+ , tkTypeDef{typeDef}
+ , tkImplementation{impl}
+ , wzName{name}
+ , dwFlags{flags}
+ { };
~LocalComTypeDescr() { if(wzName) SDELETE(wzName); };
};
&tkTypeDef, // [OUT] TypeDef token within the file.
&dwFlags))) // [OUT] Flags.
{
- LocalComTypeDescr* pCTD = new LocalComTypeDescr;
- memset(pCTD,0,sizeof(LocalComTypeDescr));
- pCTD->tkComTypeTok = rComTypeTok[ix];
- pCTD->tkTypeDef = tkTypeDef;
- pCTD->tkImplementation = tkImplementation;
- pCTD->wzName = new WCHAR[ulNameLen+1];
+ LocalComTypeDescr* pCTD = new LocalComTypeDescr(rComTypeTok[ix], tkTypeDef, tkImplementation, new WCHAR[ulNameLen+1], dwFlags);
memcpy(pCTD->wzName,wzName,ulNameLen*sizeof(WCHAR));
pCTD->wzName[ulNameLen] = 0;
- pCTD->dwFlags = dwFlags;
if (g_pLocalComType == NULL)
{
return m_block != NULL;
}
+#ifndef DACCESS_COMPILE
void ClearUnusedMemory()
{
if (m_remaining < m_block->m_blockSize)
- ZeroMemory(&(m_block->m_array[m_remaining]), (m_block->m_blockSize - m_remaining) * sizeof(void*));
+ ZeroMemory(m_block->m_array + m_remaining, (m_block->m_blockSize - m_remaining) * sizeof(void*));
#ifdef HOST_64BIT
m_block->m_padding = 0;
-#endif
+#endif // HOST_64BIT
}
+#endif // DACCESS_COMPILE
void **GetNextPtr()
{
void __stdcall DecoderInit(void *pThis, COR_ILMETHOD *header)
{
+ memset(pThis, 0, sizeof(COR_ILMETHOD_DECODER));
COR_ILMETHOD_DECODER *decoder = (COR_ILMETHOD_DECODER *)pThis;
- memset(decoder, 0, sizeof(COR_ILMETHOD_DECODER));
if (header->Tiny.IsTiny())
{
decoder->SetMaxStack(header->Tiny.GetMaxStack());
// TODO-Throughput: The following memset is pretty expensive - do something else?
// Note that some fields have to be initialized to 0 (like bbFPStateX87)
- memset(block, 0, sizeof(*block));
+ memset((void*)block, 0, sizeof(*block));
// scopeInfo needs to be able to differentiate between blocks which
// correspond to some instrs (and so may have some LocalVarInfo
void Compiler::compInitOptions(JitFlags* jitFlags)
{
-#ifdef UNIX_AMD64_ABI
- opts.compNeedToAlignFrame = false;
-#endif // UNIX_AMD64_ABI
- memset(&opts, 0, sizeof(opts));
+ opts = {};
if (compIsForInlining())
{
// Next, display the unconditional branch
// Reset the local instrDesc
- memset(&idJmp, 0, sizeof(idJmp));
+ memset(pidJmp, 0, sizeof(instrDescJmp));
pidJmp->idIns(INS_b);
pidJmp->idInsFmt(IF_T2_J2);
noway_assert(opts.OptEnabled(CLFLG_INLINING));
// This is the InlineInfo struct representing a method to be inlined.
- InlineInfo inlineInfo;
- memset(&inlineInfo, 0, sizeof(inlineInfo));
+ InlineInfo inlineInfo{};
CORINFO_METHOD_HANDLE fncHandle = call->gtCallMethHnd;
inlineInfo.fncHandle = fncHandle;
else
{
result = new (compiler, CMK_hashBv) hashBv(compiler);
- memset(result, 0, sizeof(hashBv));
+ memset((void*)result, 0, sizeof(hashBv));
result->nodeArr = result->initialVector;
}
lvaTable = getAllocator(CMK_LvaTable).allocate<LclVarDsc>(lvaTableCnt);
size_t tableSize = lvaTableCnt * sizeof(*lvaTable);
- memset(lvaTable, 0, tableSize);
+ memset((void*)lvaTable, 0, tableSize);
for (unsigned i = 0; i < lvaTableCnt; i++)
{
new (&lvaTable[i], jitstd::placement_t()) LclVarDsc(); // call the constructor.
// Undo some changes made in anticipation of inlining...
// Zero out the used locals
- memset(lvaTable + startVars, 0, (lvaCount - startVars) * sizeof(*lvaTable));
+ memset((void*)(lvaTable + startVars), 0, (lvaCount - startVars) * sizeof(*lvaTable));
for (unsigned i = startVars; i < lvaCount; i++)
{
new (&lvaTable[i], jitstd::placement_t()) LclVarDsc(); // call the constructor.
OBJECTREF innerExceptionObj;
STRINGREF exceptionMessageRef;
} gc;
- ZeroMemory(&gc, sizeof(gc));
+ gc.exceptionObj = NULL;
+ gc.innerExceptionObj = NULL;
+ gc.exceptionMessageRef = NULL;
GCPROTECT_BEGIN(gc);
gc.exceptionObj = pThread->GetThrowable();
MachState()
{
LIMITED_METHOD_DAC_CONTRACT;
- INDEBUG(memset(this, 0xCC, sizeof(MachState));)
+ INDEBUG(memset((void*)this, 0xCC, sizeof(MachState));)
}
bool isValid() { LIMITED_METHOD_DAC_CONTRACT; _ASSERTE(dac_cast<TADDR>(_pRetAddr) != INVALID_POINTER_CC); return(_pRetAddr != 0); }
{
if (CoreLibBinder::GetField(FIELD__ASSEMBLYLOADCONTEXT__ASSEMBLY_LOAD)->GetStaticOBJECTREF() != NULL)
{
- struct _gc {
+ struct {
OBJECTREF orThis;
} gc;
- ZeroMemory(&gc, sizeof(gc));
+ gc.orThis = NULL;
ARG_SLOT args[1];
GCPROTECT_BEGIN(gc);
if (orDelegate == NULL)
return FALSE;
- struct _gc {
+ struct {
OBJECTREF Delegate;
OBJECTREF Sender;
} gc;
- ZeroMemory(&gc, sizeof(gc));
+ gc.Delegate = orDelegate;
+ gc.Sender = NULL;
GCPROTECT_BEGIN(gc);
- gc.Delegate = orDelegate;
if (orDelegate != NULL)
{
DistributeUnhandledExceptionReliably(&gc.Delegate, &gc.Sender, pThrowable, isTerminating);
GCX_COOP();
- struct _gc {
+ struct {
OBJECTREF AssemblyRef;
STRINGREF str;
} gc;
- ZeroMemory(&gc, sizeof(gc));
+ gc.AssemblyRef = NULL;
+ gc.str = NULL;
GCPROTECT_BEGIN(gc);
GCX_COOP();
- struct _gc {
+ struct {
OBJECTREF AssemblyRef;
STRINGREF str;
} gc;
- ZeroMemory(&gc, sizeof(gc));
+ gc.AssemblyRef = NULL;
+ gc.str = NULL;
GCPROTECT_BEGIN(gc);
Assembly* pAssembly = NULL;
- struct _gc {
+ struct {
OBJECTREF AssemblyRef;
STRINGREF str;
} gc;
- ZeroMemory(&gc, sizeof(gc));
+ gc.AssemblyRef = NULL;
+ gc.str = NULL;
GCPROTECT_BEGIN(gc);
{
{
FCALL_CONTRACT;
- struct _gc
+ struct
{
PTRARRAYREF AsmArray;
} gc;
void AssemblyBinder::DeclareDependencyOnMvid(LPCUTF8 simpleName, GUID mvid, bool compositeComponent, LPCUTF8 imageName)
{
_ASSERTE(imageName != NULL);
-
+
// If the table is empty, then we didn't fill it with all the loaded assemblies as they were loaded. Record this detail, and fix after adding the dependency
bool addAllLoadedModules = false;
if (m_assemblySimpleNameMvidCheckHash.GetCount() == 0)
OBJECTREF* alc = reinterpret_cast<OBJECTREF*>(managedALC);
GCX_COOP();
- struct _gc {
+ struct {
STRINGREF alcName;
} gc;
- ZeroMemory(&gc, sizeof(gc));
+ gc.alcName = NULL;
GCPROTECT_BEGIN(gc);
{
FCALL_CONTRACT;
- struct _gc {
+ struct {
PTRARRAYREF ItemArray;
ASSEMBLYNAMEREF pObj;
ASSEMBLYREF refAssembly;
} gc;
- ZeroMemory(&gc, sizeof(gc));
-
+ gc.ItemArray = NULL;
+ gc.pObj = NULL;
gc.refAssembly = (ASSEMBLYREF)ObjectToOBJECTREF(pAssemblyUNSAFE);
if (gc.refAssembly == NULL)
tempPtr = new (nothrow) CacheLine();
if (tempPtr != NULL)
{
- tempPtr->Init64();
tempPtr->m_pAddr[0] = pv;
m_registryList.InsertHead(tempPtr);
}
CONTRACT_END;
LPCacheLine tempPtr = m_freeList64.RemoveHead();
- if (tempPtr != NULL)
+ if (tempPtr == NULL)
{
- // initialize the bucket before returning
- tempPtr->Init64();
- RETURN tempPtr;
- }
-
-#define AllocSize (4096*16)
-
- ////////////////////////////////'
- /// Virtual Allocation for some more cache lines
+ const ULONG AllocSize = 4096 * 16;
- BYTE* ptr = (BYTE*)VAlloc(AllocSize);
-
- if(!ptr)
- RETURN NULL;
+ // Virtual Allocation for some more cache lines
+ BYTE* ptr = (BYTE*)VAlloc(AllocSize);
+ if(!ptr)
+ RETURN NULL;
+ tempPtr = (LPCacheLine)ptr;
+ // Link all the buckets
+ tempPtr = tempPtr+1;
+ LPCacheLine maxPtr = (LPCacheLine)(ptr + AllocSize);
- tempPtr = (LPCacheLine)ptr;
- // Link all the buckets
- tempPtr = tempPtr+1;
- LPCacheLine maxPtr = (LPCacheLine)(ptr + AllocSize);
+ while(tempPtr < maxPtr)
+ {
+ m_freeList64.InsertHead(tempPtr);
+ tempPtr++;
+ }
- while(tempPtr < maxPtr)
- {
- m_freeList64.InsertHead(tempPtr);
- tempPtr++;
+ // return the first block
+ tempPtr = (LPCacheLine)ptr;
}
- // return the first block
- tempPtr = (LPCacheLine)ptr;
- tempPtr->Init64();
+ // initialize cacheline, 64 bytes
+ memset((void*)tempPtr,0,64);
RETURN tempPtr;
}
LPCacheLine tempPtr = m_freeList32.RemoveHead();
if (tempPtr != NULL)
{
- // initialize the bucket before returning
- tempPtr->Init32();
+ // initialize cacheline, 32 bytes
+ memset((void*)tempPtr,0,32);
RETURN tempPtr;
}
tempPtr = (LPCacheLine)GetCacheLine64();
numValidBytes = numEntries * sizeof(void *)
};
- // store next pointer and the entries
+ // store next pointer and the entries - total of 16 pointers
SLink m_Link;
union
{
BYTE m_xxx[numValidBytes];
};
- // init
- void Init32()
- {
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- MODE_ANY;
- }
- CONTRACTL_END;
-
- // initialize cacheline
- memset(&m_Link,0,32);
- }
-
- void Init64()
- {
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- MODE_ANY;
- }
- CONTRACTL_END;
-
- // initialize cacheline
- memset(&m_Link,0,64);
- }
-
CacheLine()
{
CONTRACTL
CONTRACTL_END;
// initialize cacheline
- memset(&m_Link,0,sizeof(CacheLine));
+ m_Link = {};
+ memset(m_xxx,0,numValidBytes);
}
};
+static_assert(sizeof(CacheLine) == (16 * sizeof(void*)), "Cacheline should be exactly 16 pointers in size");
#include <poppack.h>
typedef CacheLine* LPCacheLine;
}
CONTRACTL_END;
- struct _gc
+ struct
{
PTRARRAYREF Args;
PTRARRAYREF ArgsTypes;
OBJECTREF CurrArgType;
OBJECTREF CurrArg;
} gc;
- ZeroMemory(&gc, sizeof(gc));
+ gc.Args = NULL;
+ gc.ArgsTypes = NULL;
+ gc.ArgsIsByRef = NULL;
+ gc.CurrArgType = NULL;
+ gc.CurrArg = NULL;
GCPROTECT_BEGIN(gc);
{
// Ensure the sig is in a known state
}
CONTRACTL_END;
- struct _gc
+ struct
{
OBJECTREF RetVal;
PTRARRAYREF OutArgs;
OBJECTREF CurrArg;
} gc;
- ZeroMemory(&gc, sizeof(gc));
- gc.OutArgs = outArgs;
gc.RetVal = retVal;
+ gc.OutArgs = outArgs;
+ gc.CurrArg = NULL;
GCPROTECT_BEGIN(gc);
{
FramedMethodFrame *frame = callsite.Frame;
// EEArgumentException is an EE exception subclass representing a bad argument
// ---------------------------------------------------------------------------
-typedef struct {
- OBJECTREF pThrowable;
- STRINGREF s1;
- OBJECTREF pTmpThrowable;
-} ProtectArgsStruct;
-
OBJECTREF EEArgumentException::CreateThrowable()
{
_ASSERTE(GetThreadNULLOk() != NULL);
- ProtectArgsStruct prot;
- memset(&prot, 0, sizeof(ProtectArgsStruct));
- ResMgrGetString(m_resourceName, &prot.s1);
- GCPROTECT_BEGIN(prot);
+ struct
+ {
+ OBJECTREF pThrowable;
+ STRINGREF s1;
+ OBJECTREF pTmpThrowable;
+ } gc;
+ gc.pThrowable = NULL;
+ gc.s1 = NULL;
+ gc.pTmpThrowable = NULL;
+ ResMgrGetString(m_resourceName, &gc.s1);
+ GCPROTECT_BEGIN(gc);
MethodTable *pMT = CoreLibBinder::GetException(m_kind);
- prot.pThrowable = AllocateObject(pMT);
+ gc.pThrowable = AllocateObject(pMT);
- MethodDesc* pMD = MemberLoader::FindMethod(prot.pThrowable->GetMethodTable(),
+ MethodDesc* pMD = MemberLoader::FindMethod(gc.pThrowable->GetMethodTable(),
COR_CTOR_METHOD_NAME, &gsig_IM_Str_Str_RetVoid);
if (!pMD)
if (m_kind == kArgumentException)
{
ARG_SLOT args1[] = {
- ObjToArgSlot(prot.pThrowable),
- ObjToArgSlot(prot.s1),
+ ObjToArgSlot(gc.pThrowable),
+ ObjToArgSlot(gc.s1),
ObjToArgSlot(argName),
};
exceptionCtor.Call(args1);
else
{
ARG_SLOT args1[] = {
- ObjToArgSlot(prot.pThrowable),
+ ObjToArgSlot(gc.pThrowable),
ObjToArgSlot(argName),
- ObjToArgSlot(prot.s1),
+ ObjToArgSlot(gc.s1),
};
exceptionCtor.Call(args1);
}
GCPROTECT_END(); //Prot
- return prot.pThrowable;
+ return gc.pThrowable;
}
MethodTable *pMT = CoreLibBinder::GetException(kTypeLoadException);
- struct _gc {
+ struct {
OBJECTREF pNewException;
STRINGREF pNewAssemblyString;
STRINGREF pNewClassString;
STRINGREF pNewMessageArgString;
} gc;
- ZeroMemory(&gc, sizeof(gc));
+ gc.pNewException = NULL;
+ gc.pNewAssemblyString = NULL;
+ gc.pNewClassString = NULL;
+ gc.pNewMessageArgString = NULL;
GCPROTECT_BEGIN(gc);
gc.pNewClassString = StringObject::NewString(m_fullName);
}
CONTRACTL_END;
- struct _gc {
+ struct {
OBJECTREF pNewException;
STRINGREF pNewFileString;
} gc;
- ZeroMemory(&gc, sizeof(gc));
+ gc.pNewException = NULL;
+ gc.pNewFileString = NULL;
GCPROTECT_BEGIN(gc);
gc.pNewFileString = StringObject::NewString(m_name);
}
CONTRACTL_END;
- struct _gc {
+ struct {
OBJECTREF EventProviderTypeObj;
OBJECTREF EventProviderObj;
OBJECTREF ThisObj;
} gc;
- ZeroMemory(&gc, sizeof(gc));
-
+ gc.EventProviderTypeObj = NULL;
+ gc.EventProviderObj = NULL;
+ gc.ThisObj = NULL;
LOG((LF_STUBS, LL_INFO1000, "Calling CLRToCOMEventCallWorker %s::%s \n", pMD->m_pszDebugClassName, pMD->m_pszDebugMethodName));
OBJECTREF RetValType;
OBJECTREF RetVal;
} gc;
- ZeroMemory(&gc, sizeof(gc));
+ gc.MemberName = NULL;
+ gc.ItfTypeObj = NULL;
+ gc.Args = NULL;
+ gc.ArgsIsByRef = NULL;
+ gc.ArgsTypes = NULL;
+ gc.ArgsWrapperTypes = NULL;
+ gc.RetValType = NULL;
+ gc.RetVal = NULL;
GCPROTECT_BEGIN(gc);
{
// Retrieve the exposed type object for the interface.
EX_TRY
{
- struct _gc
+ struct
{
PTRARRAYREF Array;
OBJECTREF InnerDelegate;
OBJECTREF EventArgs;
} gc;
- ZeroMemory(&gc, sizeof(gc));
+ gc.Array = NULL;
+ gc.InnerDelegate = NULL;
+ gc.EventArgs = NULL;
GCPROTECT_BEGIN(gc);
ASSERT(pStackTraceUnsafe != NULL);
ASSERT(pDynamicMethodsUnsafe != NULL);
- struct _gc
+ struct
{
StackTraceArray stackTrace;
StackTraceArray stackTraceCopy;
EXCEPTIONREF refException;
PTRARRAYREF dynamicMethodsArray; // Object array of Managed Resolvers
PTRARRAYREF dynamicMethodsArrayCopy; // Copy of the object array of Managed Resolvers
- };
- _gc gc;
- ZeroMemory(&gc, sizeof(gc));
+ } gc;
+ gc.refException = NULL;
+ gc.dynamicMethodsArray = NULL;
+ gc.dynamicMethodsArrayCopy = NULL;
// GC protect the array reference
HELPER_METHOD_FRAME_BEGIN_PROTECT(gc);
ASSERT(pExceptionObjectUnsafe != NULL);
- struct _gc
+ struct
{
StackTraceArray stackTrace;
EXCEPTIONREF refException;
PTRARRAYREF dynamicMethodsArray; // Object array of Managed Resolvers
- };
- _gc gc;
- ZeroMemory(&gc, sizeof(gc));
+ } gc;
+ gc.refException = NULL;
+ gc.dynamicMethodsArray = NULL;
// GC protect the array reference
HELPER_METHOD_FRAME_BEGIN_PROTECT(gc);
WRAPPER_NO_CONTRACT;
CustomAttributeManagedValues gc;
- ZeroMemory(&gc, sizeof(gc));
+ gc.string = NULL;
+ gc.array = NULL;
GCPROTECT_BEGIN(gc)
{
CorSerializationType type = pCaVal->type.tag;
EXCEPTIONREF ex;
STRINGREF remoteStackTraceString;
} gc;
- ZeroMemory(&gc, sizeof(gc));
gc.exObj = exObj;
gc.ex = (EXCEPTIONREF)exObj;
+ gc.remoteStackTraceString = NULL;
GCPROTECT_BEGIN(gc);
OBJECTREF innerExceptionObj;
STRINGREF exceptionMessageRef;
} gc;
- ZeroMemory(&gc, sizeof(gc));
+ gc.exceptionObj = NULL;
+ gc.innerExceptionObj = NULL;
+ gc.exceptionMessageRef = NULL;
GCPROTECT_BEGIN(gc);
gc.exceptionObj = pThread->GetThrowable();
#define SZ_UNHANDLED_EXCEPTION W("Unhandled exception.")
#define SZ_UNHANDLED_EXCEPTION_CHARLEN ((sizeof(SZ_UNHANDLED_EXCEPTION) / sizeof(WCHAR)))
-
-typedef struct {
- OBJECTREF pThrowable;
- STRINGREF s1;
- OBJECTREF pTmpThrowable;
-} ProtectArgsStruct;
-
PEXCEPTION_REGISTRATION_RECORD GetCurrentSEHRecord();
BOOL IsUnmanagedToManagedSEHHandler(EXCEPTION_REGISTRATION_RECORD*);
{
OBJECTREF oThrowable;
} gc;
- ZeroMemory(&gc, sizeof(gc));
+ gc.oThrowable = NULL;
GCPROTECT_BEGIN(gc);
// Get the throwable to be used
{
OBJECTREF oThrowable;
} gc;
- ZeroMemory(&gc, sizeof(gc));
+ gc.oThrowable = NULL;
GCPROTECT_BEGIN(gc);
// Get the throwable corresponding to the escaping exception
OBJECTREF oThrowable;
U1ARRAYREF oBuckets;
} gc;
- ZeroMemory(&gc, sizeof(gc));
+ gc.oThrowable = NULL;
+ gc.oBuckets = NULL;
GCPROTECT_BEGIN(gc);
gc.oThrowable = fUseLastThrownObject ? pThread->LastThrownObject() : pThread->GetThrowable();
{
OBJECTREF oThrowable;
} gc;
- ZeroMemory(&gc, sizeof(gc));
- GCPROTECT_BEGIN(gc);
-
gc.oThrowable = oThrowable;
+ GCPROTECT_BEGIN(gc);
fIsTAE = IsExceptionOfType(kThreadAbortException, &gc.oThrowable);
{
OBJECTREF oPreAllocThrowable;
} gc;
- ZeroMemory(&gc, sizeof(gc));
- GCPROTECT_BEGIN(gc);
-
gc.oPreAllocThrowable = oPreAllocThrowable;
+ GCPROTECT_BEGIN(gc);
// Start walking the list to find the tracker corresponding
// to the preallocated exception object.
{
OBJECTREF oPreAllocThrowable;
} gc;
- ZeroMemory(&gc, sizeof(gc));
- GCPROTECT_BEGIN(gc);
-
gc.oPreAllocThrowable = oPreAllocThrowable;
+ GCPROTECT_BEGIN(gc);
// Before doing anything, check if this is a thread abort exception. If it is,
// then simply return the reference to the UE watson bucket tracker since it
OBJECTREF oInnerMostExceptionThrowable;
U1ARRAYREF oBuckets;
} gc;
- ZeroMemory(&gc, sizeof(gc));
- GCPROTECT_BEGIN(gc);
gc.refException = refException;
+ gc.oInnerMostExceptionThrowable = NULL;
+ gc.oBuckets = NULL;
+ GCPROTECT_BEGIN(gc);
Thread *pThread = GetThread();
OBJECTREF oInnerMostExceptionThrowable;
U1ARRAYREF refSourceWatsonBucketArray;
} gc;
- ZeroMemory(&gc, sizeof(gc));
+ gc.oCurrentThrowable = NULL;
+ gc.oInnerMostExceptionThrowable = NULL;
+ gc.refSourceWatsonBucketArray = NULL;
GCPROTECT_BEGIN(gc);
OBJECTREF oInnerMostExceptionThrowable;
U1ARRAYREF refSourceWatsonBucketArray;
} gc;
- ZeroMemory(&gc, sizeof(gc));
+ gc.oCurrentThrowable = NULL;
+ gc.oInnerMostExceptionThrowable = NULL;
+ gc.refSourceWatsonBucketArray = NULL;
GCPROTECT_BEGIN(gc);
Thread* pThread = GetThread();
OBJECTREF oCurrentThrowable;
OBJECTREF oCurAppDomain;
} gc;
- ZeroMemory(&gc, sizeof(gc));
+ gc.oNotificationDelegate = NULL;
+ gc.arrDelegates = NULL;
+ gc.oInnerDelegate = NULL;
+ gc.oEventArgs = NULL;
+ gc.oCurrentThrowable = NULL;
+ gc.oCurAppDomain = NULL;
// This will hold the MethodDesc of the callback that will be invoked.
MethodDesc *pMDDelegate = NULL;
}
CONTRACTL_END;
- INDEBUG(memset(pcfThisFrame, 0xCC, sizeof(*pcfThisFrame)));
-
// Clear various flags
pcfThisFrame->isFrameless = false;
pcfThisFrame->isInterrupted = false;
}
CONTRACTL_END;
- INDEBUG(memset(pcfThisFrame, 0xCC, sizeof(*pcfThisFrame)));
pcfThisFrame->pRD = pRD;
// Clear various flags
PTRARRAYREF arrRefTmp;
PTRARRAYREF arrRef;
} gc;
- ::ZeroMemory(&gc, sizeof(gc));
+ gc.arrRefTmp = NULL;
+ gc.arrRef = NULL;
GCPROTECT_BEGIN(gc);
// Only add objects that are in the correct thread
OBJECTREF implRef;
OBJECTREF instRef;
} gc;
- ::ZeroMemory(&gc, sizeof(gc));
- GCPROTECT_BEGIN(gc);
-
gc.implRef = impl;
gc.instRef = instance;
+ GCPROTECT_BEGIN(gc);
// Check the object's SyncBlock for a managed object wrapper.
SyncBlock* syncBlock = gc.instRef->GetSyncBlock();
OBJECTREF wrapperMaybeRef;
OBJECTREF objRefMaybe;
} gc;
- ::ZeroMemory(&gc, sizeof(gc));
+ gc.implRef = impl;
+ gc.wrapperMaybeRef = wrapperMaybe;
+ gc.objRefMaybe = NULL;
GCPROTECT_BEGIN(gc);
STRESS_LOG4(LF_INTEROP, LL_INFO1000, "Get or Create EOC: (Identity: 0x%p) (Flags: %x) (Maybe: 0x%p) (ID: %lld)\n", identity, flags, OBJECTREFToObject(wrapperMaybe), wrapperId);
- gc.implRef = impl;
- gc.wrapperMaybeRef = wrapperMaybe;
-
ExtObjCxtCache* cache = ExtObjCxtCache::GetInstance();
InteropLib::OBJECTHANDLE handle = NULL;
OBJECTREF implRef;
OBJECTREF objsEnumRef;
} gc;
- ::ZeroMemory(&gc, sizeof(gc));
- GCPROTECT_BEGIN(gc);
-
gc.implRef = NULL; // Use the globally registered implementation.
+ gc.objsEnumRef = NULL;
+ GCPROTECT_BEGIN(gc);
// Pass the objects along to get released.
ExtObjCxtCache* cache = ExtObjCxtCache::GetInstanceNoThrow();
OBJECTREF wrapperMaybeRef;
OBJECTREF objRef;
} gc;
- ::ZeroMemory(&gc, sizeof(gc));
- GCPROTECT_BEGIN(gc);
-
gc.implRef = NULL; // Use the globally registered implementation.
gc.wrapperMaybeRef = NULL; // No supplied wrapper here.
+ gc.objRef = NULL;
+ GCPROTECT_BEGIN(gc);
// Get wrapper for external object
bool success = TryGetOrCreateObjectForComInstanceInternal(
{
OBJECTREF objRef;
} gc;
- ::ZeroMemory(&gc, sizeof(gc));
+ gc.objRef = NULL;
GCPROTECT_BEGIN(gc);
// Get the target of the external object's reference.
{
OBJECTREF objRef;
} gc;
- ::ZeroMemory(&gc, sizeof(gc));
+ gc.objRef = NULL;
GCPROTECT_BEGIN(gc);
gc.objRef = obj.Get();
OBJECTREF throwableRef;
REFLECTMETHODREF methodRef;
} gc;
- ::ZeroMemory(&gc, sizeof(gc));
+ gc.throwableRef = NULL;
+ gc.methodRef = NULL;
GCPROTECT_BEGIN(gc);
// Creating the StubMethodInfo isn't cheap, so check
OBJECTREF o;
STRINGREF str;
} gc;
- ZeroMemory(&gc, sizeof(gc));
+ gc.o = NULL;
+ gc.str = NULL;
MethodTable *pVMClassLoadExcept = CoreLibBinder::GetException(kReflectionTypeLoadException);
gc.o = AllocateObject(pVMClassLoadExcept);
LOADERHANDLE retVal;
- struct _gc
+ struct
{
OBJECTREF value;
LOADERALLOCATORREF loaderAllocator;
PTRARRAYREF handleTable;
PTRARRAYREF handleTableOld;
} gc;
-
- ZeroMemory(&gc, sizeof(gc));
+ gc.value = NULL;
+ gc.loaderAllocator = NULL;
+ gc.handleTable = NULL;
+ gc.handleTableOld = NULL;
GCPROTECT_BEGIN(gc);
OBJECTREF retVal;
- struct _gc
+ struct
{
OBJECTREF value;
OBJECTREF compare;
OBJECTREF previous;
} gc;
+ gc.value = NULL;
+ gc.compare = NULL;
+ gc.previous = NULL;
- ZeroMemory(&gc, sizeof(gc));
GCPROTECT_BEGIN(gc);
gc.value = valueUNSAFE;
}
ModuleRecord::ModuleRecord(unsigned lenName, unsigned lenAsmName)
+ : version{}
+ , jitMethodCount{}
+ , wLoadLevel{}
{
LIMITED_METHOD_CONTRACT;
- memset(this, 0, sizeof(ModuleRecord));
-
recordID = Pack8_24(MULTICOREJIT_MODULE_RECORD_ID, sizeof(ModuleRecord));
- wLoadLevel = 0;
// Extra data
lenModuleName = (unsigned short) lenName;
lenAssemblyName = (unsigned short) lenAsmName;
_ASSERTE (VolatileLoad(&pEntry->m_dwRefCount) == 0);
#ifdef _DEBUG
- memset (pEntry, 0xc, sizeof(StringLiteralEntry));
-#endif
-
-#ifdef _DEBUG
+ memset (&pEntry->m_pStringObj, 0xc, sizeof(pEntry->m_pStringObj));
pEntry->m_bDeleted = TRUE;
#endif
#endif // !TARGET_UNIX
InteropSyncBlockInfo()
+ : m_pUMEntryThunk{}
+#ifdef FEATURE_COMINTEROP
+ , m_pCCW{}
+#ifdef FEATURE_COMINTEROP_UNMANAGED_ACTIVATION
+ , m_pCCF{}
+#endif // FEATURE_COMINTEROP_UNMANAGED_ACTIVATION
+ , m_pRCW{}
+#endif // FEATURE_COMINTEROP
+#ifdef FEATURE_COMWRAPPERS
+ , m_externalComObjectContext{}
+ , m_managedObjectComWrapperLock{}
+ , m_managedObjectComWrapperMap{}
+#endif // FEATURE_COMWRAPPERS
+#ifdef FEATURE_OBJCMARSHAL
+ , m_taggedMemory{}
+ , m_taggedAlloc{}
+#endif // FEATURE_OBJCMARSHAL
{
LIMITED_METHOD_CONTRACT;
- ZeroMemory(this, sizeof(InteropSyncBlockInfo));
#if defined(FEATURE_COMWRAPPERS)
// The GC thread does enumerate these objects so add CRST_UNSAFE_COOPGC.
_ASSERTE(GetThreadNULLOk() != NULL);
- struct ProtectArgs
+ struct
{
OBJECTREF pThrowable;
OBJECTREF pReason;
- } args;
- memset(&args, 0, sizeof(ProtectArgs));
+ } gc;
+ gc.pThrowable = NULL;
+ gc.pReason = NULL;
- GCPROTECT_BEGIN(args);
+ GCPROTECT_BEGIN(gc);
MethodTable *pMT = CoreLibBinder::GetException(kThreadStartException);
- args.pThrowable = AllocateObject(pMT);
+ gc.pThrowable = AllocateObject(pMT);
MethodDescCallSite exceptionCtor(METHOD__THREAD_START_EXCEPTION__EX_CTOR);
if (m_pExceptionDuringStartup)
{
- args.pReason = CLRException::GetThrowableFromException(m_pExceptionDuringStartup);
+ gc.pReason = CLRException::GetThrowableFromException(m_pExceptionDuringStartup);
Exception::Delete(m_pExceptionDuringStartup);
m_pExceptionDuringStartup = NULL;
}
ARG_SLOT args1[] = {
- ObjToArgSlot(args.pThrowable),
- ObjToArgSlot(args.pReason),
+ ObjToArgSlot(gc.pThrowable),
+ ObjToArgSlot(gc.pReason),
};
exceptionCtor.Call(args1);
GCPROTECT_END(); //Prot
- RaiseTheExceptionInternalOnly(args.pThrowable, FALSE);
+ RaiseTheExceptionInternalOnly(gc.pThrowable, FALSE);
}
#ifndef TARGET_UNIX
OBJECTREF rcw;
OBJECTREF target;
} gc;
- ZeroMemory(&gc, sizeof(gc));
gc.weakReference = weakReference;
+ gc.rcw = NULL;
+ gc.target = NULL;
FC_INNER_PROLOG_NO_ME_SETUP();
HELPER_METHOD_FRAME_BEGIN_RET_ATTRIB_PROTECT(Frame::FRAME_ATTR_EXACT_DEPTH|Frame::FRAME_ATTR_CAPTURE_DEPTH_2, gc);