summaryrefslogtreecommitdiff
path: root/src/vm/arm64
diff options
context:
space:
mode:
authorRahul Kumar <rahku@microsoft.com>2016-08-04 11:43:21 -0700
committerRahul Kumar <rahku@microsoft.com>2016-08-10 11:47:03 -0700
commit1fcecafd7adbc050a951b02d5fe429a70acd3214 (patch)
treefdb5ee7eb02cddaa9a3bb286140da80776d573cd /src/vm/arm64
parentdeb00ad58acf627763b6c0a7833fa789e3bb1cd0 (diff)
downloadcoreclr-1fcecafd7adbc050a951b02d5fe429a70acd3214.tar.gz
coreclr-1fcecafd7adbc050a951b02d5fe429a70acd3214.tar.bz2
coreclr-1fcecafd7adbc050a951b02d5fe429a70acd3214.zip
ARM64: Fix for ARM64TODO
Diffstat (limited to 'src/vm/arm64')
-rw-r--r--src/vm/arm64/CallDescrWorkerARM64.asm1
-rw-r--r--src/vm/arm64/asmhelpers.asm60
-rw-r--r--src/vm/arm64/cgencpu.h68
-rw-r--r--src/vm/arm64/stubs.cpp138
4 files changed, 90 insertions, 177 deletions
diff --git a/src/vm/arm64/CallDescrWorkerARM64.asm b/src/vm/arm64/CallDescrWorkerARM64.asm
index 464640157e..b9f8a6090d 100644
--- a/src/vm/arm64/CallDescrWorkerARM64.asm
+++ b/src/vm/arm64/CallDescrWorkerARM64.asm
@@ -72,7 +72,6 @@ LNoFloatingPoint
ldp x6, x7, [x9, #48]
ldr x8, [x9, #64]
- ;; ARM64TODO: => see if anything special needs to be done for remoting
;; call pTarget
ldr x9, [x19,#CallDescrData__pTarget]
blr x9
diff --git a/src/vm/arm64/asmhelpers.asm b/src/vm/arm64/asmhelpers.asm
index 1369bd80d7..eacc08f9d9 100644
--- a/src/vm/arm64/asmhelpers.asm
+++ b/src/vm/arm64/asmhelpers.asm
@@ -272,15 +272,13 @@ ThePreStubPatchLabel
; x15 : trashed
;
WRITE_BARRIER_ENTRY JIT_CheckedWriteBarrier
-;; ARM64TODO: Temporary indirect access till support for :lo12:symbol is added
- ldr x12, =g_lowest_address
- ldr x12, [x12]
+ adrp x12, g_lowest_address
+ ldr x12, [x12, g_lowest_address]
cmp x14, x12
blt NotInHeap
-;; ARM64TODO: Temporary indirect access till support for :lo12:symbol is added
- ldr x12, =g_highest_address
- ldr x12, [x12]
+ adrp x12, g_highest_address
+ ldr x12, [x12, g_highest_address]
cmp x14, x12
blt JIT_WriteBarrier
@@ -305,22 +303,19 @@ NotInHeap
; Branch to Exit if the reference is not in the Gen0 heap
;
-;; ARM64TODO: Temporary indirect access till support for :lo12:symbol is added
- ldr x12, =g_ephemeral_low
- ldr x12, [x12]
+ adrp x12, g_ephemeral_low
+ ldr x12, [x12, g_ephemeral_low]
cmp x15, x12
blt Exit
-;; ARM64TODO: Temporary indirect access till support for :lo12:symbol is added
- ldr x12, =g_ephemeral_high
- ldr x12, [x12]
+ adrp x12, g_ephemeral_high
+ ldr x12, [x12, g_ephemeral_high]
cmp x15, x12
bgt Exit
; Check if we need to update the card table
-;; ARM64TODO: Temporary indirect access till support for :lo12:symbol is added
- ldr x12, =g_card_table
- ldr x12, [x12]
+ adrp x12, g_card_table
+ ldr x12, [x12, g_card_table]
add x15, x12, x14 lsr #11
ldrb w12, [x15]
cmp x12, 0xFF
@@ -1208,11 +1203,44 @@ Fail
mov x9, x0
EPILOG_WITH_TRANSITION_BLOCK_TAILCALL
-
+ PATCH_LABEL StubDispatchFixupPatchLabel
EPILOG_BRANCH_REG x9
NESTED_END
#endif
+#ifdef FEATURE_COMINTEROP
+; ------------------------------------------------------------------
+; Function used by COM interop to get floating point return value (since it's not in the same
+; register(s) as non-floating point values).
+;
+; On entry;
+; x0 : size of the FP result (4 or 8 bytes)
+; x1 : pointer to 64-bit buffer to receive result
+;
+; On exit:
+; buffer pointed to by x1 on entry contains the float or double argument as appropriate
+;
+ LEAF_ENTRY getFPReturn
+ str d0, [x1]
+ LEAF_END
+
+; ------------------------------------------------------------------
+; Function used by COM interop to set floating point return value (since it's not in the same
+; register(s) as non-floating point values).
+;
+; On entry:
+; x0 : size of the FP result (4 or 8 bytes)
+; x1 : 32-bit or 64-bit FP result
+;
+; On exit:
+; s0 : float result if x0 == 4
+; d0 : double result if x0 == 8
+;
+ LEAF_ENTRY setFPReturn
+ fmov d0, x1
+ LEAF_END
+#endif
+
; Must be at very end of file
END \ No newline at end of file
diff --git a/src/vm/arm64/cgencpu.h b/src/vm/arm64/cgencpu.h
index 20b39c440d..f55dfc17c8 100644
--- a/src/vm/arm64/cgencpu.h
+++ b/src/vm/arm64/cgencpu.h
@@ -38,20 +38,14 @@ class ComCallMethodDesc;
#define USE_INDIRECT_CODEHEADER
-#ifdef FEATURE_REMOTING
-#define HAS_REMOTING_PRECODE 1
-#endif
-
-//ARM64TODO: Enable it once we complete work on precode
//#define HAS_FIXUP_PRECODE 1
//#define HAS_FIXUP_PRECODE_CHUNKS 1
// ThisPtrRetBufPrecode one is necessary for closed delegates over static methods with return buffer
#define HAS_THISPTR_RETBUF_PRECODE 1
-//ARM64TODO: verify this
#define CODE_SIZE_ALIGN 8
-#define CACHE_LINE_SIZE 32 // As per Intel Optimization Manual the cache line size is 32 bytes
+#define CACHE_LINE_SIZE 64
#define LOG2SLOT LOG2_PTRSIZE
#define ENREGISTERED_RETURNTYPE_MAXSIZE 32 // bytes (four FP registers: d0,d1,d2 and d3)
@@ -71,7 +65,6 @@ class ComCallMethodDesc;
// as large as the largest FieldMarshaler subclass. This requirement
// is guarded by an assert.
//=======================================================================
-//ARM64TODO: verify this
#define MAXFIELDMARSHALERSIZE 40
//**********************************************************************
@@ -320,8 +313,8 @@ inline PCODE decodeBackToBackJump(PCODE pBuffer)
inline BOOL IsUnmanagedValueTypeReturnedByRef(UINT sizeofvaluetype)
{
-// ARM64TODO : Check if we need to consider HFA
- return (sizeofvaluetype > 8);
+ // ARM64TODO: Does this need to care about HFA. It does not for ARM32
+ return (sizeofvaluetype > ENREGISTERED_RETURNTYPE_INTEGER_MAXSIZE);
}
@@ -476,10 +469,8 @@ extern "C" void SinglecastDelegateInvokeStub();
// preferred alignment for data
-//ARM64TODO: double check
#define DATA_ALIGNMENT 8
-
struct DECLSPEC_ALIGN(16) UMEntryThunkCode
{
DWORD m_code[4];
@@ -716,57 +707,4 @@ struct ThisPtrRetBufPrecode {
};
typedef DPTR(ThisPtrRetBufPrecode) PTR_ThisPtrRetBufPrecode;
-
-#ifdef HAS_REMOTING_PRECODE
-
-// Precode with embedded remoting interceptor
-struct RemotingPrecode {
-
- static const int Type = 0x02;
-
- // push {r1,lr}
- // ldr r1, [pc, #16] ; =m_pPrecodeRemotingThunk
- // blx r1
- // pop {r1,lr}
- // ldr pc, [pc, #12] ; =m_pLocalTarget
- // nop ; padding for alignment
- // dcd m_pMethodDesc
- // dcd m_pPrecodeRemotingThunk
- // dcd m_pLocalTarget
- WORD m_rgCode[8];
- TADDR m_pMethodDesc;
- TADDR m_pPrecodeRemotingThunk;
- TADDR m_pLocalTarget;
-
- void Init(MethodDesc* pMD, LoaderAllocator *pLoaderAllocator = NULL);
-
- TADDR GetMethodDesc()
- {
- _ASSERTE(!"ARM64:NYI");
- return NULL;
- }
-
- PCODE GetTarget()
- {
- _ASSERTE(!"ARM64:NYI");
- return NULL;
- }
-
- BOOL SetTargetInterlocked(TADDR target, TADDR expected)
- {
- _ASSERTE(!"ARM64:NYI");
- return NULL;
- }
-
-#ifdef FEATURE_PREJIT
- void Fixup(DataImage *image, ZapNode *pCodeNode);
-#endif
-};
-typedef DPTR(RemotingPrecode) PTR_RemotingPrecode;
-
-EXTERN_C void PrecodeRemotingThunk();
-
-#endif // HAS_REMOTING_PRECODE
-
-
#endif // __cgencpu_h__
diff --git a/src/vm/arm64/stubs.cpp b/src/vm/arm64/stubs.cpp
index 2b239cdaff..6c5e1b6432 100644
--- a/src/vm/arm64/stubs.cpp
+++ b/src/vm/arm64/stubs.cpp
@@ -613,29 +613,6 @@ void ThisPtrRetBufPrecode::Init(MethodDesc* pMD, LoaderAllocator *pLoaderAllocat
m_pMethodDesc = (TADDR)pMD;
}
-
-#ifdef HAS_REMOTING_PRECODE
-
-void RemotingPrecode::Init(MethodDesc* pMD, LoaderAllocator *pLoaderAllocator)
-{
- _ASSERTE(!"ARM64:NYI");
-}
-
-#ifdef FEATURE_NATIVE_IMAGE_GENERATION
-void RemotingPrecode::Fixup(DataImage *image, ZapNode *pCodeNode)
-{
- _ASSERTE(!"ARM64:NYI");
-}
-#endif // FEATURE_NATIVE_IMAGE_GENERATION
-
-void CTPMethodTable::ActivatePrecodeRemotingThunk()
-{
- _ASSERTE(!"ARM64:NYI");
-}
-
-#endif // HAS_REMOTING_PRECODE
-
-
#ifndef CROSSGEN_COMPILE
BOOL DoesSlotCallPrestub(PCODE pCode)
{
@@ -866,43 +843,48 @@ void HijackFrame::UpdateRegDisplay(const PREGDISPLAY pRD)
{
LIMITED_METHOD_CONTRACT;
- _ASSERTE(!"ARM64:NYI");
+ pRD->IsCallerContextValid = FALSE;
+ pRD->IsCallerSPValid = FALSE;
+
+ pRD->pCurrentContext->Pc = m_ReturnAddress;
+ size_t s = sizeof(struct HijackArgs);
+ _ASSERTE(s%8 == 0); // HijackArgs contains register values and hence will be a multiple of 8
+ // stack must be multiple of 16. So if s is not multiple of 16 then there must be padding of 8 bytes
+ s = s + s%16;
+ pRD->pCurrentContext->Sp = PTR_TO_TADDR(m_Args) + s ;
+
+ pRD->pCurrentContext->X0 = m_Args->X0;
+
+ pRD->pCurrentContext->X19 = m_Args->X19;
+ pRD->pCurrentContext->X20 = m_Args->X20;
+ pRD->pCurrentContext->X21 = m_Args->X21;
+ pRD->pCurrentContext->X22 = m_Args->X22;
+ pRD->pCurrentContext->X23 = m_Args->X23;
+ pRD->pCurrentContext->X24 = m_Args->X24;
+ pRD->pCurrentContext->X25 = m_Args->X25;
+ pRD->pCurrentContext->X26 = m_Args->X26;
+ pRD->pCurrentContext->X27 = m_Args->X27;
+ pRD->pCurrentContext->X28 = m_Args->X28;
+ pRD->pCurrentContext->Fp = m_Args->X29;
+ pRD->pCurrentContext->Lr = m_Args->Lr;
+
+ pRD->pCurrentContextPointers->X19 = &m_Args->X19;
+ pRD->pCurrentContextPointers->X20 = &m_Args->X20;
+ pRD->pCurrentContextPointers->X21 = &m_Args->X21;
+ pRD->pCurrentContextPointers->X22 = &m_Args->X22;
+ pRD->pCurrentContextPointers->X23 = &m_Args->X23;
+ pRD->pCurrentContextPointers->X24 = &m_Args->X24;
+ pRD->pCurrentContextPointers->X25 = &m_Args->X25;
+ pRD->pCurrentContextPointers->X26 = &m_Args->X26;
+ pRD->pCurrentContextPointers->X27 = &m_Args->X27;
+ pRD->pCurrentContextPointers->X28 = &m_Args->X28;
+ pRD->pCurrentContextPointers->Fp = &m_Args->X29;
+ pRD->pCurrentContextPointers->Lr = NULL;
+
+ SyncRegDisplayToCurrentContext(pRD);
}
#endif // FEATURE_HIJACK
-#if defined(FEATURE_REMOTING) && !defined(CROSSGEN_COMPILE)
-
-#ifndef DACCESS_COMPILE
-PCODE CTPMethodTable::CreateThunkForVirtualMethod(DWORD dwSlot, BYTE *startaddr)
-{
- _ASSERTE(!"ARM64:NYI");
- return NULL;
-}
-#endif // DACCESS_COMPILE
-
-BOOL CVirtualThunkMgr::IsThunkByASM(PCODE startaddr)
-{
- _ASSERTE(!"ARM64:NYI");
- return FALSE;
-}
-
-MethodDesc *CVirtualThunkMgr::GetMethodDescByASM(PCODE startaddr, MethodTable *pMT)
-{
- _ASSERTE(!"ARM64:NYI");
- return NULL;
-}
-
-#ifndef DACCESS_COMPILE
-
-BOOL CVirtualThunkMgr::DoTraceStub(PCODE stubStartAddress, TraceDestination *trace)
-{
- _ASSERTE(!"ARM64:NYI");
- return FALSE;
-}
-#endif // !DACCESS_COMPILE
-
-#endif // FEATURE_REMOTING && !CROSSGEN_COMPILE
-
#ifdef FEATURE_COMINTEROP
void emitCOMStubCall (ComCallMethodDesc *pCOMMethod, PCODE target)
@@ -946,12 +928,6 @@ void JIT_TailCall()
_ASSERTE(!"ARM64:NYI");
}
-extern "C" void * ClrFlsGetBlock()
-{
- _ASSERTE(!"ARM64:NYI");
- return NULL;
-}
-
void InitJITHelpers1()
{
return;
@@ -990,7 +966,8 @@ PTR_CONTEXT GetCONTEXTFromRedirectedStubStackFrame(T_CONTEXT * pContext)
void RedirectForThreadAbort()
{
- _ASSERTE(!"ARM64:NYI");
+ // ThreadAbort is not supported in .net core
+ throw "NYI";
}
#if !defined(DACCESS_COMPILE) && !defined (CROSSGEN_COMPILE)
@@ -1059,24 +1036,11 @@ AdjustContextForVirtualStub(
#ifdef FEATURE_COMINTEROP
extern "C" void GenericComPlusCallStub(void)
{
- _ASSERTE(!"ARM64:NYI");
+ // This is not required for coreclr scenarios
+ throw "GenericComPlusCallStub is not implemented yet.";
}
#endif // FEATURE_COMINTEROP
-//ARM64TODO: check if this should be amd64 and win64
-#ifdef _WIN64
-extern "C" void PInvokeStubForHostInner(DWORD dwStackSize, LPVOID pStackFrame, LPVOID pTarget)
-{
- _ASSERTE(!"ARM64:NYI");
-}
-#endif
-
-void PInvokeStubForHost(void)
-{
- // Hosted P/Invoke is not implemented on ARM64
- UNREACHABLE();
-}
-
UMEntryThunk * UMEntryThunk::Decode(void *pCallback)
{
_ASSERTE(offsetof(UMEntryThunkCode, m_code) == 0);
@@ -1175,34 +1139,18 @@ VOID ResetCurrentContext()
}
#endif
-extern "C" void StubDispatchFixupPatchLabel()
-{
- _ASSERTE(!"ARM64:NYI");
-}
-
LONG CLRNoCatchHandler(EXCEPTION_POINTERS* pExceptionInfo, PVOID pv)
{
return EXCEPTION_CONTINUE_SEARCH;
}
-extern "C" void setFPReturn(int fpSize, INT64 retVal)
-{
- _ASSERTE(!"ARM64:NYI");
-}
-extern "C" void getFPReturn(int fpSize, INT64 *retval)
-{
- _ASSERTE(!"ARM64:NYI");
-}
-
void StompWriteBarrierEphemeral(bool isRuntimeSuspended)
{
- //ARM64TODO: implement this
return;
}
void StompWriteBarrierResize(bool isRuntimeSuspended, bool bReqUpperBoundsCheck)
{
- //ARM64TODO: implement this
return;
}