diff options
| author | 2012-10-18 18:24:15 -0700 | |
|---|---|---|
| committer | 2012-10-18 18:24:15 -0700 | |
| commit | fc6a30e2fa8f0d44e6c95bbeb5deca4b499f67ce (patch) | |
| tree | 71bc7549ac42799a5625bfb9c228c499e6ceb4b4 | |
| parent | 2e92fd62b8b1e3a14be4642d4e77a022d863a94e (diff) | |
More MIPS fixes. Most basic tests pass.
IntMath works now. The only basic tests that aren't working are
ReferenceMap and StackWalk.
In this change:
- Fixed argument passing for compare float/double.
- Set method stubs for long multiply/divide/remainder.
- Store gp value on stack and reload after function call to preserve
value for exception delivery.
- Fixed argument passing to artThrowStackOverflowFromCode.
- Fixed assembly for unsigned shift right long.
Change-Id: I6e77454905c3620c9cfd1c089200a8dbe530df2e
| -rw-r--r-- | src/compiler/codegen/mips/FP/MipsFP.cc | 8 | ||||
| -rw-r--r-- | src/compiler/codegen/mips/MipsLIR.h | 2 | ||||
| -rw-r--r-- | src/oat/runtime/mips/oat_support_entrypoints_mips.cc | 9 | ||||
| -rw-r--r-- | src/oat/runtime/mips/runtime_support_mips.S | 28 |
4 files changed, 24 insertions, 23 deletions
diff --git a/src/compiler/codegen/mips/FP/MipsFP.cc b/src/compiler/codegen/mips/FP/MipsFP.cc index f121a5434f..437f1ed2d8 100644 --- a/src/compiler/codegen/mips/FP/MipsFP.cc +++ b/src/compiler/codegen/mips/FP/MipsFP.cc @@ -197,11 +197,11 @@ static bool genCmpFP(CompilationUnit *cUnit, Instruction::Code opcode, RegLocati oatFlushAllRegs(cUnit); oatLockCallTemps(cUnit); if (wide) { - loadValueDirectWideFixed(cUnit, rlSrc1, rARG0, rARG1); - loadValueDirectWideFixed(cUnit, rlSrc2, rARG2, rARG3); + loadValueDirectWideFixed(cUnit, rlSrc1, r_FARG0, r_FARG1); + loadValueDirectWideFixed(cUnit, rlSrc2, r_FARG2, r_FARG3); } else { - loadValueDirectFixed(cUnit, rlSrc1, rARG0); - loadValueDirectFixed(cUnit, rlSrc2, rARG1); + loadValueDirectFixed(cUnit, rlSrc1, r_FARG0); + loadValueDirectFixed(cUnit, rlSrc2, r_FARG2); } int rTgt = loadHelper(cUnit, offset); // NOTE: not a safepoint diff --git a/src/compiler/codegen/mips/MipsLIR.h b/src/compiler/codegen/mips/MipsLIR.h index 5e5147a96b..5077c9fa40 100644 --- a/src/compiler/codegen/mips/MipsLIR.h +++ b/src/compiler/codegen/mips/MipsLIR.h @@ -141,6 +141,8 @@ namespace art { /* These are the same for both big and little endian. */ #define r_FARG0 r_F12 #define r_FARG1 r_F13 +#define r_FARG2 r_F14 +#define r_FARG3 r_F15 #define r_FRESULT0 r_F0 #define r_FRESULT1 r_F1 diff --git a/src/oat/runtime/mips/oat_support_entrypoints_mips.cc b/src/oat/runtime/mips/oat_support_entrypoints_mips.cc index 334ca9585d..458933fc3e 100644 --- a/src/oat/runtime/mips/oat_support_entrypoints_mips.cc +++ b/src/oat/runtime/mips/oat_support_entrypoints_mips.cc @@ -84,6 +84,9 @@ extern int32_t CmpgDouble(double a, double b); extern int32_t CmplDouble(double a, double b); extern int32_t CmpgFloat(float a, float b); extern int32_t CmplFloat(float a, float b); +extern "C" int64_t artLmulFromCode(int64_t a, int64_t b); +extern "C" int64_t artLdivFromCode(int64_t a, int64_t b); +extern "C" int64_t artLdivmodFromCode(int64_t a, int64_t b); // Math conversions. extern "C" float __floatsisf(int op1); // INT_TO_FLOAT @@ -233,9 +236,9 @@ void InitEntryPoints(EntryPoints* points) { points->pIdivmod = NULL; points->pD2l = art_d2l; points->pF2l = art_f2l; - points->pLdiv = NULL; - points->pLdivmod = NULL; - points->pLmul = NULL; + points->pLdiv = artLdivFromCode; + points->pLdivmod = artLdivmodFromCode; + points->pLmul = artLmulFromCode; points->pShlLong = art_shl_long; points->pShrLong = art_shr_long; points->pUshrLong = art_ushr_long; diff --git a/src/oat/runtime/mips/runtime_support_mips.S b/src/oat/runtime/mips/runtime_support_mips.S index 574ebcca59..eafd380996 100644 --- a/src/oat/runtime/mips/runtime_support_mips.S +++ b/src/oat/runtime/mips/runtime_support_mips.S @@ -53,7 +53,7 @@ * Macro that sets up the callee save frame to conform with * Runtime::CreateCalleeSaveMethod(kRefsOnly). Restoration assumes non-moving GC. * Does not include rSUSPEND or rSELF - * callee-save: $s2-$s8 + $ra, 8 total + 4 words + extra args + * callee-save: $s2-$s8 + $ra, 8 total + 4 words + extra args + gp */ .macro SETUP_REF_ONLY_CALLEE_SAVE_FRAME addiu $sp, $sp, -64 @@ -65,10 +65,12 @@ sw $s4, 40($sp) sw $s3, 36($sp) sw $s2, 32($sp) - # 4 word for alignment and extra args, 4 open words for args $a0-$a3, bottom will hold Method* + sw $gp, 28($sp) + # 3 words for alignment and extra args, 4 open words for args $a0-$a3, bottom will hold Method* .endm .macro RESTORE_REF_ONLY_CALLEE_SAVE_FRAME + lw $gp, 28($sp) lw $ra, 60($sp) addiu $sp, $sp, 64 .endm @@ -304,9 +306,9 @@ art_throw_array_bounds_from_code: art_throw_stack_overflow_from_code: .cpload $25 SETUP_SAVE_ALL_CALLEE_SAVE_FRAME - move $a1, rSELF # pass Thread::Current - jal artThrowStackOverflowFromCode # artThrowStackOverflowFromCode(method, Thread*, $sp) - move $a2, $sp # pass $sp + move $a0, rSELF # pass Thread::Current + jal artThrowStackOverflowFromCode # artThrowStackOverflowFromCode(Thread*, $sp) + move $a1, $sp # pass $sp .global art_throw_no_such_method_from_code .extern artThrowNoSuchMethodFromCode @@ -409,13 +411,7 @@ art_handle_fill_data_from_code: move $a2, rSELF # pass Thread::Current jal artHandleFillArrayDataFromCode # (Array*, const DexFile::Payload*, Thread*, $sp) move $a3, $sp # pass $sp - RESTORE_REF_ONLY_CALLEE_SAVE_FRAME - bnez $v0, 1f # success? - nop - jr $ra # return on success - nop -1: - DELIVER_PENDING_EXCEPTION + RETURN_IF_ZERO .global art_lock_object_from_code .extern artLockObjectFromCode @@ -816,6 +812,7 @@ art_check_and_alloc_array_from_code_with_access_check: */ ALIGN_FUNCTION_ENTRY art_test_suspend: + .cpload $25 lh $a0, THREAD_FLAGS_OFFSET(rSELF) bnez $a0, 1f addi rSUSPEND, $zero, SUSPEND_CHECK_INTERVAL # reset rSUSPEND to SUSPEND_CHECK_INTERVAL @@ -919,7 +916,7 @@ art_shl_long: andi $a2, 0x20 # shift< shift & 0x20 movn $v1, $v0, $a2 # rhi<- rlo (if shift&0x20) jr $ra - movn $v0, $zero, $a2 # rlo<- 0 (if shift&0x20) + movn $v0, $zero, $a2 # rlo<- 0 (if shift&0x20) .global art_shr_long /* @@ -960,9 +957,8 @@ art_shr_long: /* ushr-long vAA, vBB, vCC */ ALIGN_FUNCTION_ENTRY art_ushr_long: - sra $v1, $a1, $a2 # rhi<- ahi >> (shift&31) + srl $v1, $a1, $a2 # rhi<- ahi >> (shift&31) srl $v0, $a0, $a2 # rlo<- alo >> (shift&31) - sra $a3, $a1, 31 # $a3<- sign(ah) not $a0, $a2 # alo<- 31-shift (shift is 5b) sll $a1, 1 sll $a1, $a0 # ahi<- ahi << (32-(shift&31)) @@ -970,7 +966,7 @@ art_ushr_long: andi $a2, 0x20 # shift & 0x20 movn $v0, $v1, $a2 # rlo<- rhi (if shift&0x20) jr $ra - movn $v1, $a3, $a2 # rhi<- sign(ahi) (if shift&0x20) + movn $v1, $zero, $a2 # rhi<- 0 (if shift&0x20) .global art_indexof ALIGN_FUNCTION_ENTRY |