diff options
author | Ruben Ayrapetyan <ruben-ayrapetyan@users.noreply.github.com> | 2017-06-27 00:18:19 +0300 |
---|---|---|
committer | Jan Kotas <jkotas@microsoft.com> | 2017-06-26 14:18:19 -0700 |
commit | 8cc7e35dd0a625a3b883703387291739a148e8c8 (patch) | |
tree | 33ea4e95260aba8be3bc63f6ec789dea8c4a9bc0 /src/vm/amd64/JitHelpers_InlineGetThread.asm | |
parent | 959dacc9f0b09eb9f8c418eabb1b9180ceb6f5ac (diff) | |
download | coreclr-8cc7e35dd0a625a3b883703387291739a148e8c8.tar.gz coreclr-8cc7e35dd0a625a3b883703387291739a148e8c8.tar.bz2 coreclr-8cc7e35dd0a625a3b883703387291739a148e8c8.zip |
Replace array type handle with method table in arguments of array allocation helpers (#12369)
* Remove direct usage of type handle in JIT_NewArr1, with except of retrieving template method table.
* Assert that array type descriptor is loaded when array object's method table is set.
* Pass template method tables instead of array type descriptors to array allocation helpers.
Diffstat (limited to 'src/vm/amd64/JitHelpers_InlineGetThread.asm')
-rw-r--r-- | src/vm/amd64/JitHelpers_InlineGetThread.asm | 39 |
1 files changed, 9 insertions, 30 deletions
diff --git a/src/vm/amd64/JitHelpers_InlineGetThread.asm b/src/vm/amd64/JitHelpers_InlineGetThread.asm index 700c3b393c..022ec675df 100644 --- a/src/vm/amd64/JitHelpers_InlineGetThread.asm +++ b/src/vm/amd64/JitHelpers_InlineGetThread.asm @@ -147,15 +147,6 @@ align 16 jmp JIT_Box NESTED_END JIT_BoxFastMP_InlineGetThread, _TEXT -FIX_INDIRECTION macro Reg -ifdef FEATURE_PREJIT - test Reg, 1 - jz @F - mov Reg, [Reg-1] - @@: -endif -endm - LEAF_ENTRY AllocateStringFastMP_InlineGetThread, _TEXT ; We were passed the number of characters in ECX @@ -203,10 +194,9 @@ endif ; _DEBUG jmp FramedAllocateString LEAF_END AllocateStringFastMP_InlineGetThread, _TEXT -; HCIMPL2(Object*, JIT_NewArr1, CORINFO_CLASS_HANDLE arrayTypeHnd_, INT_PTR size) +; HCIMPL2(Object*, JIT_NewArr1VC_MP_InlineGetThread, CORINFO_CLASS_HANDLE arrayMT, INT_PTR size) LEAF_ENTRY JIT_NewArr1VC_MP_InlineGetThread, _TEXT - ; We were passed a type descriptor in RCX, which contains the (shared) - ; array method table and the element type. + ; We were passed a (shared) method table in RCX, which contains the element type. ; The element count is in RDX @@ -223,17 +213,12 @@ LEAF_ENTRY JIT_NewArr1VC_MP_InlineGetThread, _TEXT ; In both cases we do a final overflow check after adding to the alloc_ptr. - ; we need to load the true method table from the type desc - mov r9, [rcx + OFFSETOF__ArrayTypeDesc__m_TemplateMT - 2] - - FIX_INDIRECTION r9 - cmp rdx, (65535 - 256) jae OversizedArray - movzx r8d, word ptr [r9 + OFFSETOF__MethodTable__m_dwFlags] ; component size is low 16 bits + movzx r8d, word ptr [rcx + OFFSETOF__MethodTable__m_dwFlags] ; component size is low 16 bits imul r8d, edx - add r8d, dword ptr [r9 + OFFSET__MethodTable__m_BaseSize] + add r8d, dword ptr [rcx + OFFSET__MethodTable__m_BaseSize] ; round the size to a multiple of 8 @@ -252,7 +237,7 @@ LEAF_ENTRY JIT_NewArr1VC_MP_InlineGetThread, _TEXT ja AllocFailed mov [r11 + OFFSET__Thread__m_alloc_context__alloc_ptr], r8 - mov [rax], r9 + mov [rax], rcx mov dword ptr [rax + OFFSETOF__ArrayBase__m_NumComponents], edx @@ -268,10 +253,9 @@ endif ; _DEBUG LEAF_END JIT_NewArr1VC_MP_InlineGetThread, _TEXT -; HCIMPL2(Object*, JIT_NewArr1, CORINFO_CLASS_HANDLE arrayTypeHnd_, INT_PTR size) +; HCIMPL2(Object*, JIT_NewArr1OBJ_MP_InlineGetThread, CORINFO_CLASS_HANDLE arrayMT, INT_PTR size) LEAF_ENTRY JIT_NewArr1OBJ_MP_InlineGetThread, _TEXT - ; We were passed a type descriptor in RCX, which contains the (shared) - ; array method table and the element type. + ; We were passed a (shared) method table in RCX, which contains the element type. ; The element count is in RDX @@ -285,16 +269,11 @@ LEAF_ENTRY JIT_NewArr1OBJ_MP_InlineGetThread, _TEXT cmp rdx, (ASM_LARGE_OBJECT_SIZE - 256)/8 ; sizeof(void*) jae OversizedArray - ; we need to load the true method table from the type desc - mov r9, [rcx + OFFSETOF__ArrayTypeDesc__m_TemplateMT - 2] - - FIX_INDIRECTION r9 - ; In this case we know the element size is sizeof(void *), or 8 for x64 ; This helps us in two ways - we can shift instead of multiplying, and ; there's no need to align the size either - mov r8d, dword ptr [r9 + OFFSET__MethodTable__m_BaseSize] + mov r8d, dword ptr [rcx + OFFSET__MethodTable__m_BaseSize] lea r8d, [r8d + edx * 8] ; No need for rounding in this case - element size is 8, and m_BaseSize is guaranteed @@ -310,7 +289,7 @@ LEAF_ENTRY JIT_NewArr1OBJ_MP_InlineGetThread, _TEXT ja AllocFailed mov [r11 + OFFSET__Thread__m_alloc_context__alloc_ptr], r8 - mov [rax], r9 + mov [rax], rcx mov dword ptr [rax + OFFSETOF__ArrayBase__m_NumComponents], edx |