Skip to content

Commit

Permalink
Fix alpine-riscv64 build (#104920)
Browse files Browse the repository at this point in the history
  • Loading branch information
am11 authored Jul 16, 2024
1 parent 8e6df8d commit 75689b3
Show file tree
Hide file tree
Showing 12 changed files with 71 additions and 71 deletions.
2 changes: 1 addition & 1 deletion src/coreclr/vm/riscv64/cgencpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ inline TADDR GetMem(PCODE address, SIZE_T size, bool signExtend)
}
EX_CATCH
{
mem = NULL;
mem = (TADDR)NULL;
_ASSERTE(!"Memory read within jitted Code Failed, this should not happen!!!!");
}
EX_END_CATCH(SwallowAllExceptions);
Expand Down
10 changes: 5 additions & 5 deletions src/coreclr/vm/riscv64/stubs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ void LazyMachState::unwindLazyState(LazyMachState* baseState,
context.S11 = unwoundstate->captureCalleeSavedRegisters[11] = baseState->captureCalleeSavedRegisters[11];
context.Gp = unwoundstate->captureCalleeSavedRegisters[12] = baseState->captureCalleeSavedRegisters[12];
context.Tp = unwoundstate->captureCalleeSavedRegisters[13] = baseState->captureCalleeSavedRegisters[13];
context.Ra = NULL; // Filled by the unwinder
context.Ra = 0; // Filled by the unwinder

context.Sp = baseState->captureSp;
context.Pc = baseState->captureIp;
Expand All @@ -225,7 +225,7 @@ void LazyMachState::unwindLazyState(LazyMachState* baseState,
nonVolContextPtrs.S11 = &unwoundstate->captureCalleeSavedRegisters[11];
nonVolContextPtrs.Gp = &unwoundstate->captureCalleeSavedRegisters[12];
nonVolContextPtrs.Tp = &unwoundstate->captureCalleeSavedRegisters[13];
nonVolContextPtrs.Ra = NULL; // Filled by the unwinder
nonVolContextPtrs.Ra = 0; // Filled by the unwinder

#endif // DACCESS_COMPILE

Expand Down Expand Up @@ -384,7 +384,7 @@ void HelperMethodFrame::UpdateRegDisplay(const PREGDISPLAY pRD, bool updateFloat
pRD->pCurrentContext->S11 = (DWORD64)(pUnwoundState->captureCalleeSavedRegisters[11]);
pRD->pCurrentContext->Gp = (DWORD64)(pUnwoundState->captureCalleeSavedRegisters[12]);
pRD->pCurrentContext->Tp = (DWORD64)(pUnwoundState->captureCalleeSavedRegisters[13]);
pRD->pCurrentContext->Ra = NULL; // Unwind again to get Caller's PC
pRD->pCurrentContext->Ra = 0; // Unwind again to get Caller's PC

pRD->pCurrentContextPointers->Fp = pUnwoundState->ptrCalleeSavedRegisters[0];
pRD->pCurrentContextPointers->S1 = pUnwoundState->ptrCalleeSavedRegisters[1];
Expand Down Expand Up @@ -428,7 +428,7 @@ void HelperMethodFrame::UpdateRegDisplay(const PREGDISPLAY pRD, bool updateFloat
pRD->pCurrentContext->S11 = m_MachState.ptrCalleeSavedRegisters[11] ? *m_MachState.ptrCalleeSavedRegisters[11] : m_MachState.captureCalleeSavedRegisters[11];
pRD->pCurrentContext->Gp = m_MachState.ptrCalleeSavedRegisters[12] ? *m_MachState.ptrCalleeSavedRegisters[12] : m_MachState.captureCalleeSavedRegisters[12];
pRD->pCurrentContext->Tp = m_MachState.ptrCalleeSavedRegisters[13] ? *m_MachState.ptrCalleeSavedRegisters[13] : m_MachState.captureCalleeSavedRegisters[13];
pRD->pCurrentContext->Ra = NULL; // Unwind again to get Caller's PC
pRD->pCurrentContext->Ra = 0; // Unwind again to get Caller's PC
#else // TARGET_UNIX
pRD->pCurrentContext->Fp = *m_MachState.ptrCalleeSavedRegisters[0];
pRD->pCurrentContext->S1 = *m_MachState.ptrCalleeSavedRegisters[1];
Expand All @@ -444,7 +444,7 @@ void HelperMethodFrame::UpdateRegDisplay(const PREGDISPLAY pRD, bool updateFloat
pRD->pCurrentContext->S11 = *m_MachState.ptrCalleeSavedRegisters[11];
pRD->pCurrentContext->Gp = *m_MachState.ptrCalleeSavedRegisters[12];
pRD->pCurrentContext->Tp = *m_MachState.ptrCalleeSavedRegisters[13];
pRD->pCurrentContext->Ra = NULL; // Unwind again to get Caller's PC
pRD->pCurrentContext->Ra = 0; // Unwind again to get Caller's PC
#endif

#if !defined(DACCESS_COMPILE)
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/vm/riscv64/virtualcallstubcpu.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ struct ResolveHolder
_stub._resolveWorkerTarget = resolveWorkerTarget;

_ASSERTE(resolveWorkerTarget == (PCODE)ResolveWorkerChainLookupAsmStub);
_ASSERTE(patcherTarget == NULL);
_ASSERTE(patcherTarget == (PCODE)NULL);

#undef DATA_OFFSET
#undef PC_REL_OFFSET
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/vm/stubmgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1415,7 +1415,7 @@ static BOOL TraceManagedThunk(

#else
PORTABILITY_ASSERT("TraceManagedThunk");
destAddr = NULL;
destAddr = (PCODE)NULL;
#endif

LOG((LF_CORDB,LL_INFO10000, "TraceManagedThunk: ppbDest: %p\n", destAddr));
Expand Down
10 changes: 5 additions & 5 deletions src/coreclr/vm/stubmgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,7 @@ class StubManagerHelpers
return pContext->Lr;
#else
PORTABILITY_ASSERT("StubManagerHelpers::GetReturnAddress");
return NULL;
return (TADDR)NULL;
#endif
}

Expand Down Expand Up @@ -833,7 +833,7 @@ class StubManagerHelpers
return pContext->X12;
#else
PORTABILITY_ASSERT("StubManagerHelpers::GetTailCallTarget");
return NULL;
return (TADDR)NULL;
#endif
}

Expand All @@ -849,7 +849,7 @@ class StubManagerHelpers
return pContext->X12;
#else
PORTABILITY_ASSERT("StubManagerHelpers::GetHiddenArg");
return NULL;
return (TADDR)NULL;
#endif
}

Expand Down Expand Up @@ -879,7 +879,7 @@ class StubManagerHelpers
return *((PCODE *)pContext->Fp + 1);
#else
PORTABILITY_ASSERT("StubManagerHelpers::GetRetAddrFromMulticastILStubFrame");
return NULL;
return (TADDR)NULL;
#endif
}

Expand All @@ -899,7 +899,7 @@ class StubManagerHelpers
return pContext->X1;
#else
PORTABILITY_ASSERT("StubManagerHelpers::GetSecondArg");
return NULL;
return (TADDR)NULL;
#endif
}

Expand Down
36 changes: 18 additions & 18 deletions src/tests/profiler/native/eltprofiler/slowpatheltprofiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ void SlowPathELTProfiler::PrintBytes(const BYTE *bytes, size_t length)

bool SlowPathELTProfiler::ValidateInt(UINT_PTR ptr, int expected)
{
if (ptr == NULL)
if (ptr == (UINT_PTR)NULL)
{
return false;
}
Expand All @@ -625,7 +625,7 @@ bool SlowPathELTProfiler::ValidateInt(UINT_PTR ptr, int expected)

bool SlowPathELTProfiler::ValidateFloat(UINT_PTR ptr, float expected)
{
if (ptr == NULL)
if (ptr == (UINT_PTR)NULL)
{
return false;
}
Expand All @@ -635,7 +635,7 @@ bool SlowPathELTProfiler::ValidateFloat(UINT_PTR ptr, float expected)

bool SlowPathELTProfiler::ValidateDouble(UINT_PTR ptr, double expected)
{
if (ptr == NULL)
if (ptr == (UINT_PTR)NULL)
{
return false;
}
Expand All @@ -645,7 +645,7 @@ bool SlowPathELTProfiler::ValidateDouble(UINT_PTR ptr, double expected)

bool SlowPathELTProfiler::ValidateString(UINT_PTR ptr, const WCHAR *expected)
{
if (ptr == NULL || *(void **)ptr == NULL)
if (ptr == (UINT_PTR)NULL || *(void **)ptr == NULL)
{
return false;
}
Expand Down Expand Up @@ -673,7 +673,7 @@ bool SlowPathELTProfiler::ValidateString(UINT_PTR ptr, const WCHAR *expected)

bool SlowPathELTProfiler::ValidateMixedStruct(UINT_PTR ptr, MixedStruct expected)
{
if (ptr == NULL)
if (ptr == (UINT_PTR)NULL)
{
return false;
}
Expand All @@ -684,7 +684,7 @@ bool SlowPathELTProfiler::ValidateMixedStruct(UINT_PTR ptr, MixedStruct expected

bool SlowPathELTProfiler::ValidateLargeStruct(UINT_PTR ptr, LargeStruct expected)
{
if (ptr == NULL)
if (ptr == (UINT_PTR)NULL)
{
return false;
}
Expand All @@ -702,7 +702,7 @@ bool SlowPathELTProfiler::ValidateLargeStruct(UINT_PTR ptr, LargeStruct expected

bool SlowPathELTProfiler::ValidateFloatingPointStruct(UINT_PTR ptr, Fp32x2Struct expected)
{
if (ptr == NULL)
if (ptr == (UINT_PTR)NULL)
{
return false;
}
Expand All @@ -713,7 +713,7 @@ bool SlowPathELTProfiler::ValidateFloatingPointStruct(UINT_PTR ptr, Fp32x2Struct

bool SlowPathELTProfiler::ValidateFloatingPointStruct(UINT_PTR ptr, Fp32x3Struct expected)
{
if (ptr == NULL)
if (ptr == (UINT_PTR)NULL)
{
return false;
}
Expand All @@ -724,7 +724,7 @@ bool SlowPathELTProfiler::ValidateFloatingPointStruct(UINT_PTR ptr, Fp32x3Struct

bool SlowPathELTProfiler::ValidateFloatingPointStruct(UINT_PTR ptr, Fp32x4Struct expected)
{
if (ptr == NULL)
if (ptr == (UINT_PTR)NULL)
{
return false;
}
Expand All @@ -738,7 +738,7 @@ bool SlowPathELTProfiler::ValidateFloatingPointStruct(UINT_PTR ptr, Fp32x4Struct

bool SlowPathELTProfiler::ValidateFloatingPointStruct(UINT_PTR ptr, Fp64x2Struct expected)
{
if (ptr == NULL)
if (ptr == (UINT_PTR)NULL)
{
return false;
}
Expand All @@ -749,7 +749,7 @@ bool SlowPathELTProfiler::ValidateFloatingPointStruct(UINT_PTR ptr, Fp64x2Struct

bool SlowPathELTProfiler::ValidateFloatingPointStruct(UINT_PTR ptr, Fp64x3Struct expected)
{
if (ptr == NULL)
if (ptr == (UINT_PTR)NULL)
{
return false;
}
Expand All @@ -760,7 +760,7 @@ bool SlowPathELTProfiler::ValidateFloatingPointStruct(UINT_PTR ptr, Fp64x3Struct

bool SlowPathELTProfiler::ValidateFloatingPointStruct(UINT_PTR ptr, Fp64x4Struct expected)
{
if (ptr == NULL)
if (ptr == (UINT_PTR)NULL)
{
return false;
}
Expand All @@ -774,7 +774,7 @@ bool SlowPathELTProfiler::ValidateFloatingPointStruct(UINT_PTR ptr, Fp64x4Struct

bool SlowPathELTProfiler::ValidateIntegerStruct(UINT_PTR ptr, IntegerStruct expected)
{
if (ptr == NULL)
if (ptr == (UINT_PTR)NULL)
{
return false;
}
Expand All @@ -785,7 +785,7 @@ bool SlowPathELTProfiler::ValidateIntegerStruct(UINT_PTR ptr, IntegerStruct expe

bool SlowPathELTProfiler::ValidateIntegerSseStruct(UINT_PTR ptr, IntegerSseStruct expected)
{
if (ptr == NULL)
if (ptr == (UINT_PTR)NULL)
{
return false;
}
Expand All @@ -798,7 +798,7 @@ bool SlowPathELTProfiler::ValidateIntegerSseStruct(UINT_PTR ptr, IntegerSseStruc

bool SlowPathELTProfiler::ValidateSseIntegerStruct(UINT_PTR ptr, SseIntegerStruct expected)
{
if (ptr == NULL)
if (ptr == (UINT_PTR)NULL)
{
return false;
}
Expand All @@ -811,7 +811,7 @@ bool SlowPathELTProfiler::ValidateSseIntegerStruct(UINT_PTR ptr, SseIntegerStruc

bool SlowPathELTProfiler::ValidateMixedSseStruct(UINT_PTR ptr, MixedSseStruct expected)
{
if (ptr == NULL)
if (ptr == (UINT_PTR)NULL)
{
return false;
}
Expand All @@ -825,7 +825,7 @@ bool SlowPathELTProfiler::ValidateMixedSseStruct(UINT_PTR ptr, MixedSseStruct ex

bool SlowPathELTProfiler::ValidateSseMixedStruct(UINT_PTR ptr, SseMixedStruct expected)
{
if (ptr == NULL)
if (ptr == (UINT_PTR)NULL)
{
return false;
}
Expand All @@ -839,7 +839,7 @@ bool SlowPathELTProfiler::ValidateSseMixedStruct(UINT_PTR ptr, SseMixedStruct ex

bool SlowPathELTProfiler::ValidateMixedMixedStruct(UINT_PTR ptr, MixedMixedStruct expected)
{
if (ptr == NULL)
if (ptr == (UINT_PTR)NULL)
{
return false;
}
Expand Down
4 changes: 2 additions & 2 deletions src/tests/profiler/native/gcprofiler/gcprofiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ HRESULT GCProfiler::ObjectReferences(ObjectID objectId, ClassID classId, ULONG c
for (ULONG i = 0; i < cObjectRefs; ++i)
{
ObjectID obj = objectRefIds[i];
if (obj != NULL)
if (obj != 0)
{
_objectReferencesSeen.insert(obj);
}
Expand All @@ -131,7 +131,7 @@ HRESULT GCProfiler::RootReferences(ULONG cRootRefs, ObjectID rootRefIds[])
for (ULONG i = 0; i < cRootRefs; ++i)
{
ObjectID obj = rootRefIds[i];
if (obj != NULL)
if (obj != 0)
{
_rootReferencesSeen.insert(obj);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,8 @@ HRESULT GetAppDomainStaticAddress::ClassLoadFinished(ClassID classId, HRESULT hr

HRESULT hr = S_OK;

ThreadID threadId = NULL;
AppDomainID appDomainId = NULL;
ThreadID threadId = 0;
AppDomainID appDomainId = 0;
CorElementType baseElemType;
ClassID baseClassId;
ULONG cRank;
Expand Down Expand Up @@ -298,7 +298,7 @@ HRESULT GetAppDomainStaticAddress::ClassLoadFinished(ClassID classId, HRESULT hr
&modId,
NULL,
NULL,
NULL,
0,
NULL,
NULL);
if (FAILED(hr))
Expand Down Expand Up @@ -390,12 +390,12 @@ HRESULT GetAppDomainStaticAddress::GarbageCollectionFinished()
fflush(stdout);
}

ModuleID classModuleId = NULL;
ModuleID classModuleId = 0;
hr = pCorProfilerInfo->GetClassIDInfo2(classId,
&classModuleId,
NULL,
NULL,
NULL,
0,
NULL,
NULL);
if (FAILED(hr))
Expand Down Expand Up @@ -424,9 +424,9 @@ HRESULT GetAppDomainStaticAddress::GarbageCollectionFinished()
}

HCORENUM hEnum = NULL;
mdTypeDef token = NULL;
mdTypeDef token = 0;
mdFieldDef fieldTokens[SHORT_LENGTH];
ULONG cTokens = NULL;
ULONG cTokens = 0;

if (DEBUG_OUT)
{
Expand All @@ -439,7 +439,7 @@ HRESULT GetAppDomainStaticAddress::GarbageCollectionFinished()
NULL,
&token,
NULL,
NULL,
0,
NULL,
NULL);
if (hr == CORPROF_E_DATAINCOMPLETE)
Expand Down Expand Up @@ -469,13 +469,13 @@ HRESULT GetAppDomainStaticAddress::GarbageCollectionFinished()

for (ULONG i = 0; i < cTokens; i++)
{
mdTypeDef fieldClassToken = NULL;
mdTypeDef fieldClassToken = 0;
WCHAR tokenName[256];
ULONG nameLength = NULL;
DWORD fieldAttributes = NULL;
PCCOR_SIGNATURE pvSig = NULL;
ULONG cbSig = NULL;
DWORD corElementType = NULL;
ULONG nameLength = 0;
DWORD fieldAttributes = 0;
PCCOR_SIGNATURE pvSig = 0;
ULONG cbSig = 0;
DWORD corElementType = 0;

hr = pIMDImport->GetFieldProps(fieldTokens[i],
&fieldClassToken,
Expand Down
Loading

0 comments on commit 75689b3

Please sign in to comment.