From: Rahul Kumar Date: Thu, 5 May 2016 22:53:07 +0000 (-0700) Subject: [Arm64] Helpers for ReadyToRun X-Git-Tag: submit/tizen/20210909.063632~11030^2~10583^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a8c07ec58339ad529d23982641f8ffe1ab2dcbb9;p=platform%2Fupstream%2Fdotnet%2Fruntime.git [Arm64] Helpers for ReadyToRun Commit migrated from https://github.com/dotnet/coreclr/commit/559719a62aa7134da929d22f40c3c772e5d06348 --- diff --git a/src/coreclr/src/vm/arm64/stubs.cpp b/src/coreclr/src/vm/arm64/stubs.cpp index e7700f5..426093b 100644 --- a/src/coreclr/src/vm/arm64/stubs.cpp +++ b/src/coreclr/src/vm/arm64/stubs.cpp @@ -1709,53 +1709,283 @@ void StubLinkerCPU::EmitUnboxMethodStub(MethodDesc *pMD) EmitCallManagedMethod(pMD, TRUE /* tail call */); } -#endif // CROSSGEN_COMPILE +#ifdef FEATURE_READYTORUN -#endif // #ifndef DACCESS_COMPILE +// +// Allocation of dynamic helpers +// + +#define DYNAMIC_HELPER_ALIGNMENT sizeof(TADDR) + +#define BEGIN_DYNAMIC_HELPER_EMIT(size) \ + SIZE_T cb = size; \ + SIZE_T cbAligned = ALIGN_UP(cb, DYNAMIC_HELPER_ALIGNMENT); \ + BYTE * pStart = (BYTE *)(void *)pAllocator->GetDynamicHelpersHeap()->AllocAlignedMem(cbAligned, DYNAMIC_HELPER_ALIGNMENT); \ + BYTE * p = pStart; + +#define END_DYNAMIC_HELPER_EMIT() \ + _ASSERTE(pStart + cb == p); \ + while (p < pStart + cbAligned) { *(DWORD*)p = 0xBADC0DF0; p += 4; }\ + ClrFlushInstructionCache(pStart, cbAligned); \ + return (PCODE)pStart + +// Uses x8 as scratch register to store address of data label +// After load x8 is increment to point to next data +// only accepts positive offsets +static void LoadRegPair(BYTE* p, int reg1, int reg2, UINT32 offset) +{ + LIMITED_METHOD_CONTRACT; + + // adr x8,