From: sergey ignatov Date: Wed, 14 Feb 2018 22:35:21 +0000 (+0300) Subject: [armel tizen] Fixed dynamic code allocation and code pitching for ARM (#16352) X-Git-Tag: accepted/tizen/unified/20190422.045933~2965 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7910a37a1cf5b963997994b6884475c224585e90;p=platform%2Fupstream%2Fcoreclr.git [armel tizen] Fixed dynamic code allocation and code pitching for ARM (#16352) * [armel tizen] Fixed dynamic code allocation for ARM * Added comment * Used ThumbCodeToDataPointer * Changed to PCODEToPINSTR --- diff --git a/src/vm/codepitchingmanager.cpp b/src/vm/codepitchingmanager.cpp index 521c101..6a937fb 100644 --- a/src/vm/codepitchingmanager.cpp +++ b/src/vm/codepitchingmanager.cpp @@ -241,7 +241,7 @@ static void LookupOrCreateInPitchingCandidate(MethodDesc* pMD, ULONG sizeOfCode) const char* szClassName = className.GetUTF8(scratch); const char* szMethodSig = methodSig.GetUTF8(scratch); - printf("Candidate %lld %s :: %s %s\n", + printf("Candidate %lu %s :: %s %s\n", sizeOfCode, szClassName, pMD->GetName(), szMethodSig); } #endif @@ -346,7 +346,7 @@ StackWalkAction StackWalkCallback(CrawlFrame* pCf, VOID* data) return CrawlFrameVisitor(pCf, (Thread *)data); } -static ULONGLONG s_PitchedMethodCounter = 0; +static ULONG s_PitchedMethodCounter = 0; void MethodDesc::PitchNativeCode() { WRAPPER_NO_CONTRACT; @@ -383,7 +383,7 @@ void MethodDesc::PitchNativeCode() MethodTable * pMT = GetMethodTable(); _ASSERTE(pMT != nullptr); - CodeHeader* pCH = ((CodeHeader*)(pCode & ~1)) - 1; + CodeHeader* pCH = dac_cast(PCODEToPINSTR(pCode)) - 1; _ASSERTE(pCH->GetMethodDesc() == this); HostCodeHeap* pHeap = HostCodeHeap::GetCodeHeap((TADDR)pCode); @@ -436,11 +436,8 @@ void MethodDesc::PitchNativeCode() const char* szClassName = className.GetUTF8(scratch); const char* szMethodSig = methodSig.GetUTF8(scratch); - if (CLRConfig::GetConfigValue(CLRConfig::INTERNAL_JitPitchPrintStat) != 0) - { - printf("Pitched %lld %lld %s :: %s %s\n", - s_PitchedMethodCounter, pitchedBytes, szClassName, GetName(), szMethodSig); - } + printf("Pitched %lu %lu %s :: %s %s\n", + s_PitchedMethodCounter, pitchedBytes, szClassName, GetName(), szMethodSig); } DACNotify::DoJITPitchingNotification(this); @@ -514,7 +511,7 @@ EXTERN_C void SavePitchingCandidate(MethodDesc* pMD, ULONG sizeOfCode) SimpleWriteLockHolder swlh(s_totalNCSizeLock); s_totalNCSize += sizeOfCode; if (CLRConfig::GetConfigValue(CLRConfig::INTERNAL_JitPitchPrintStat) != 0) - printf("jitted %lld (bytes) pitched %lld (bytes)\n", s_totalNCSize, s_jitPitchedBytes); + printf("jitted %lu (bytes) pitched %lu (bytes)\n", s_totalNCSize, s_jitPitchedBytes); } } #endif diff --git a/src/vm/dynamicmethod.cpp b/src/vm/dynamicmethod.cpp index c997565..806ab57 100644 --- a/src/vm/dynamicmethod.cpp +++ b/src/vm/dynamicmethod.cpp @@ -795,7 +795,7 @@ struct HostCodeHeap::TrackAllocation * HostCodeHeap::GetTrackAllocation(TADDR co { LIMITED_METHOD_CONTRACT; - CodeHeader * pHdr = dac_cast(codeStart) - 1; + CodeHeader * pHdr = dac_cast(PCODEToPINSTR(codeStart)) - 1; // Pointer to the TrackAllocation record is stored just before the code header return *((TrackAllocation **)(pHdr) - 1); diff --git a/src/vm/prestub.cpp b/src/vm/prestub.cpp index 7705dc0..5e9fc11 100644 --- a/src/vm/prestub.cpp +++ b/src/vm/prestub.cpp @@ -887,7 +887,7 @@ PCODE MethodDesc::JitCompileCodeLocked(PrepareCodeConfig* pConfig, JitListLockEn #if defined(FEATURE_JIT_PITCHING) else { - SavePitchingCandidate(this, sizeOfCode); + SavePitchingCandidate(this, *pSizeOfCode); } #endif }