diff options
author | Nicolas Geoffray <ngeoffray@google.com> | 2014-08-13 03:40:45 +0100 |
---|---|---|
committer | Nicolas Geoffray <ngeoffray@google.com> | 2014-08-14 17:18:53 +0100 |
commit | 54accbca0b549b1b1ad3ef09655dad438bc1e104 (patch) | |
tree | 6354bddae9e09476380b9351b6c1a84636ac8154 /runtime | |
parent | e39a5e1ced3d2b87974c646678dd719c02a9a010 (diff) | |
download | art-54accbca0b549b1b1ad3ef09655dad438bc1e104.tar.gz art-54accbca0b549b1b1ad3ef09655dad438bc1e104.tar.bz2 art-54accbca0b549b1b1ad3ef09655dad438bc1e104.zip |
Fix bugs in the x86 and arm versions of generic JNI.
Also fix the run script of 116-nodex2oat to use the non-prebuild
script for target.
Bug: 17000769
Change-Id: I439fcd710fb8bb408f3288ff8fb34fef23890adb
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/arch/arm/quick_entrypoints_arm.S | 24 | ||||
-rw-r--r-- | runtime/arch/x86/quick_entrypoints_x86.S | 6 | ||||
-rw-r--r-- | runtime/common_runtime_test.h | 6 | ||||
-rw-r--r-- | runtime/entrypoints/quick/quick_trampoline_entrypoints.cc | 10 |
4 files changed, 35 insertions, 11 deletions
diff --git a/runtime/arch/arm/quick_entrypoints_arm.S b/runtime/arch/arm/quick_entrypoints_arm.S index 6c63a1afc1..5ab70ea7e3 100644 --- a/runtime/arch/arm/quick_entrypoints_arm.S +++ b/runtime/arch/arm/quick_entrypoints_arm.S @@ -1059,14 +1059,13 @@ ENTRY art_quick_generic_jni_trampoline // result sign extension is handled in C code // prepare for artQuickGenericJniEndTrampoline call // (Thread*, result, result_f) - // r0 r1,r2 r3,stack <= C calling convention + // r0 r2,r3 stack <= C calling convention // r11 r0,r1 r0,r1 <= where they are - sub sp, sp, #12 // Stack alignment. + sub sp, sp, #8 // Stack alignment. - push {r1} - mov r3, r0 - mov r2, r1 - mov r1, r0 + push {r0-r1} + mov r3, r1 + mov r2, r0 mov r0, r11 blx artQuickGenericJniEndTrampoline @@ -1083,7 +1082,18 @@ ENTRY art_quick_generic_jni_trampoline cbnz r2, .Lexception_in_native // Tear down the callee-save frame. - RESTORE_REF_AND_ARGS_CALLEE_SAVE_FRAME + add sp, #12 @ rewind sp + // Do not pop r0 and r1, they contain the return value. + pop {r2-r3, r5-r8, r10-r11, lr} @ 9 words of callee saves + .cfi_restore r2 + .cfi_restore r3 + .cfi_restore r5 + .cfi_restore r6 + .cfi_restore r7 + .cfi_restore r8 + .cfi_restore r10 + .cfi_restore r11 + .cfi_adjust_cfa_offset -48 bx lr // ret diff --git a/runtime/arch/x86/quick_entrypoints_x86.S b/runtime/arch/x86/quick_entrypoints_x86.S index dc4019d2a4..117738af9c 100644 --- a/runtime/arch/x86/quick_entrypoints_x86.S +++ b/runtime/arch/x86/quick_entrypoints_x86.S @@ -1183,10 +1183,10 @@ DEFINE_FUNCTION art_quick_generic_jni_trampoline // prepare for artQuickGenericJniEndTrampoline call // (Thread*, result, result_f) // (esp) 4(esp) 12(esp) <= C calling convention - // fs:... eax:edx xmm0 <= where they are + // fs:... eax:edx fp0 <= where they are subl LITERAL(20), %esp // Padding & pass float result. - movsd %xmm0, (%esp) + fstpl (%esp) pushl %edx // Pass int result. pushl %eax pushl %fs:THREAD_SELF_OFFSET // Pass Thread::Current(). @@ -1211,7 +1211,7 @@ DEFINE_FUNCTION art_quick_generic_jni_trampoline POP ebp // Restore callee saves POP esi POP edi - // store into fpr, for when it's a fpr return... + // Quick expects the return value to be in xmm0. movd %eax, %xmm0 movd %edx, %xmm1 punpckldq %xmm1, %xmm0 diff --git a/runtime/common_runtime_test.h b/runtime/common_runtime_test.h index 12c1241270..ddb6c81712 100644 --- a/runtime/common_runtime_test.h +++ b/runtime/common_runtime_test.h @@ -161,6 +161,12 @@ class CheckJniAbortCatcher { return; \ } +#define TEST_DISABLED_FOR_MIPS() \ + if (kRuntimeISA == kMips || kRuntimeISA == kMips64) { \ + printf("WARNING: TEST DISABLED FOR MIPS\n"); \ + return; \ + } + } // namespace art namespace std { diff --git a/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc b/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc index 4730701f2c..dfd2e11fc2 100644 --- a/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc +++ b/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc @@ -1699,7 +1699,15 @@ extern "C" uint64_t artQuickGenericJniEndTrampoline(Thread* self, jvalue result, artQuickGenericJniEndJNINonRef(self, cookie, lock); switch (return_shorty_char) { - case 'F': // Fall-through. + case 'F': { + if (kRuntimeISA == kX86) { + // Convert back the result to float. + double d = bit_cast<uint64_t, double>(result_f); + return bit_cast<float, uint32_t>(static_cast<float>(d)); + } else { + return result_f; + } + } case 'D': return result_f; case 'Z': |