diff options
author | sergey ignatov <sergign60@mail.ru> | 2017-07-13 20:44:09 +0300 |
---|---|---|
committer | Jan Kotas <jkotas@microsoft.com> | 2017-07-13 20:44:09 +0300 |
commit | 26186b43ff1fc1b3fda3ab06d568fd35f6b46dcc (patch) | |
tree | ed508d2974647a2e601217ba6a1943bfeb9ff1a3 /src/Native/Runtime/arm | |
parent | 418c26528453eaa37be774aa9f51ee30ac6e3ece (diff) |
[armel tizen] Fixed RhpNewArray (#4144)
Diffstat (limited to 'src/Native/Runtime/arm')
-rw-r--r-- | src/Native/Runtime/arm/AllocFast.S | 44 |
1 files changed, 25 insertions, 19 deletions
diff --git a/src/Native/Runtime/arm/AllocFast.S b/src/Native/Runtime/arm/AllocFast.S index 155969318..f53cf0acf 100644 --- a/src/Native/Runtime/arm/AllocFast.S +++ b/src/Native/Runtime/arm/AllocFast.S @@ -113,7 +113,7 @@ NESTED_END RhpNewObject, _TEXT // r0 == EEType // r1 == element count LEAF_ENTRY RhpNewArray, _TEXT - PROLOG_PUSH "{r4,lr}" + PROLOG_PUSH "{r4-r6,lr}" // we want to limit the element count to the non-negative 32-bit int range movw r12, 0xffff movt r12, (0x7fff >> 16) @@ -137,14 +137,14 @@ LEAF_ENTRY RhpNewArray, _TEXT LOCAL_LABEL(ArrayAlignSize): bic r2, r2, #3 - mov r4, r0 // save EEType - + mov r4, r0 // Save EEType + mov r5, r1 // Save element count + mov r6, r2 // Save array size // r0 = GetThread() INLINE_GETTHREAD - // r4 == EEType - // r1 == element count - // r2 == array size + // r5 == element count + // r6 == array size // r0 == Thread* // Load potential new object address into r12. @@ -152,26 +152,26 @@ LOCAL_LABEL(ArrayAlignSize): // Determine whether the end of the object would lie outside of the current allocation context. If so, // we abandon the attempt to allocate the object directly and fall back to the slow helper. - adds r2, r12 + adds r6, r12 bcs LOCAL_LABEL(RhpNewArray_RarePath) // if we get a carry here, the array is too large to fit below 4 GB ldr r12, [r0, #OFFSETOF__Thread__m_alloc_context__alloc_limit] - cmp r2, r12 + cmp r6, r12 bhi LOCAL_LABEL(RhpNewArray_RarePath) // Reload new object address into r12. ldr r12, [r0, #OFFSETOF__Thread__m_alloc_context__alloc_ptr] // Update the alloc pointer to account for the allocation. - str r2, [r0, #OFFSETOF__Thread__m_alloc_context__alloc_ptr] + str r6, [r0, #OFFSETOF__Thread__m_alloc_context__alloc_ptr] // Set the new object's EEType pointer and element count. str r4, [r12, #OFFSETOF__Object__m_pEEType] - str r1, [r12, #OFFSETOF__Array__m_Length] + str r5, [r12, #OFFSETOF__Array__m_Length] // Return the object allocated in r0. mov r0, r12 - EPILOG_POP "{r4,pc}" + EPILOG_POP "{r4-r6,pc}" LOCAL_LABEL(ArraySizeBig): @@ -181,7 +181,7 @@ LOCAL_LABEL(ArraySizeBig): // we already have the component size in r2 umull r2, r3, r2, r1 cbnz r3, LOCAL_LABEL(ArrayOutOfMemoryFinal) - ldr r3, [r4, #OFFSETOF__EEType__m_uBaseSize] + ldr r3, [r0, #OFFSETOF__EEType__m_uBaseSize] adds r2, r3 bcs LOCAL_LABEL(ArrayOutOfMemoryFinal) adds r2, #3 @@ -190,9 +190,9 @@ LOCAL_LABEL(ArraySizeBig): LOCAL_LABEL(ArrayOutOfMemoryFinal): - mov r0, r4 // restore EEType + // EEType is in r0 already mov r1, #0 // Indicate that we should throw OOM. - EPILOG_POP "{r4,lr}" + EPILOG_POP "{r4-r6,lr}" b C_FUNC(RhExceptionHandling_FailedAllocation) LOCAL_LABEL(ArraySizeOverflow): @@ -200,15 +200,21 @@ LOCAL_LABEL(ArraySizeOverflow): // 32-bit value. We're going to tail-call to a managed helper that will throw // an overflow exception that the caller of this allocator understands. - mov r0, r4 // restore EEType + // EEType is in r0 already mov r1, #1 // Indicate that we should throw OverflowException - EPILOG_POP "{r4,lr}" + EPILOG_POP "{r4-r6,lr}" b C_FUNC(RhExceptionHandling_FailedAllocation) LOCAL_LABEL(RhpNewArray_RarePath): - mov r0, r4 // restore EEType - mov r1, #0 - EPILOG_POP "{r4,lr}" + mov r3, r0 + mov r0, r4 + mov r1, r5 + mov r2, r6 + // r0 == EEType + // r1 == element count + // r2 == array size + Thread::m_alloc_context::alloc_ptr + // r3 == Thread + EPILOG_POP "{r4-r6,lr}" b C_FUNC(RhpNewArrayRare) LEAF_END RhpNewArray, _TEXT |