diff options
| author | 2012-04-05 12:23:06 -0700 | |
|---|---|---|
| committer | 2012-04-05 18:11:20 -0700 | |
| commit | 141d62275f207bf68c55f583fb206fe586d857cf (patch) | |
| tree | 6263e12c9194e966d452658f54612fc7b3b7e410 | |
| parent | f3388e6ef460384a87c85bff72c961ebcd11ce0a (diff) | |
More X86 fixes.
Fix bugs in a few long entrypoints and with object validation being
enabled.
Change-Id: I18884fbbe6829b584b9fc92e338549577f925f14
| -rw-r--r-- | src/compiler/codegen/x86/Assemble.cc | 2 | ||||
| -rw-r--r-- | src/heap.cc | 1 | ||||
| -rw-r--r-- | src/oat/runtime/arm/oat_support_entrypoints_arm.cc | 5 | ||||
| -rw-r--r-- | src/oat/runtime/mips/oat_support_entrypoints_mips.cc | 5 | ||||
| -rw-r--r-- | src/oat/runtime/oat_support_entrypoints.h | 5 | ||||
| -rw-r--r-- | src/oat/runtime/x86/oat_support_entrypoints_x86.cc | 14 | ||||
| -rw-r--r-- | src/oat/runtime/x86/runtime_support_x86.S | 40 | ||||
| -rw-r--r-- | src/oatdump.cc | 5 | ||||
| -rw-r--r-- | src/runtime.cc | 4 |
9 files changed, 49 insertions, 32 deletions
diff --git a/src/compiler/codegen/x86/Assemble.cc b/src/compiler/codegen/x86/Assemble.cc index 2639057aa5..bad7142522 100644 --- a/src/compiler/codegen/x86/Assemble.cc +++ b/src/compiler/codegen/x86/Assemble.cc @@ -1079,7 +1079,7 @@ AssemblerStatus oatAssembleInstructions(CompilationUnit *cUnit, intptr_t startAd LIR *lir; AssemblerStatus res = kSuccess; // Assume success - const bool kVerbosePcFixup = cUnit->method_idx == 9703; + const bool kVerbosePcFixup = false; for (lir = (LIR *) cUnit->firstLIRInsn; lir; lir = NEXT_LIR(lir)) { if (lir->opcode < 0) { continue; diff --git a/src/heap.cc b/src/heap.cc index d2aada4053..8a7ab3dd3d 100644 --- a/src/heap.cc +++ b/src/heap.cc @@ -313,6 +313,7 @@ bool Heap::IsLiveObjectLocked(const Object* obj) { #if VERIFY_OBJECT_ENABLED void Heap::VerifyObject(const Object* obj) { if (this == NULL || !verify_objects_ || Runtime::Current()->IsShuttingDown() || + Thread::Current() == NULL || Runtime::Current()->GetThreadList()->GetLockOwner() == Thread::Current()->GetTid()) { return; } diff --git a/src/oat/runtime/arm/oat_support_entrypoints_arm.cc b/src/oat/runtime/arm/oat_support_entrypoints_arm.cc index 69e9c98d4c..f8a071f77c 100644 --- a/src/oat/runtime/arm/oat_support_entrypoints_arm.cc +++ b/src/oat/runtime/arm/oat_support_entrypoints_arm.cc @@ -218,14 +218,9 @@ void InitEntryPoints(EntryPoints* points) { points->pIdivmod = __aeabi_idivmod; points->pD2l = D2L; points->pF2l = F2L; - points->pLadd = NULL; - points->pLand = NULL; points->pLdiv = __aeabi_ldivmod; points->pLdivmod = __aeabi_ldivmod; // result returned in r2:r3 points->pLmul = __aeabi_lmul; - points->pLor = NULL; - points->pLsub = NULL; - points->pLxor = NULL; points->pShlLong = art_shl_long; points->pShrLong = art_shr_long; points->pUshrLong = art_ushr_long; diff --git a/src/oat/runtime/mips/oat_support_entrypoints_mips.cc b/src/oat/runtime/mips/oat_support_entrypoints_mips.cc index 62b20f2d25..a5cdc33796 100644 --- a/src/oat/runtime/mips/oat_support_entrypoints_mips.cc +++ b/src/oat/runtime/mips/oat_support_entrypoints_mips.cc @@ -216,14 +216,9 @@ void InitEntryPoints(EntryPoints* points) { points->pIdivmod = NULL; points->pD2l = D2L; points->pF2l = F2L; - points->pLadd = NULL; - points->pLand = NULL; points->pLdiv = NULL; points->pLdivmod = NULL; points->pLmul = NULL; - points->pLor = NULL; - points->pLsub = NULL; - points->pLxor = NULL; points->pShlLong = art_shl_long; points->pShrLong = art_shr_long; points->pUshrLong = art_ushr_long; diff --git a/src/oat/runtime/oat_support_entrypoints.h b/src/oat/runtime/oat_support_entrypoints.h index 1a8e67546e..af7fee3682 100644 --- a/src/oat/runtime/oat_support_entrypoints.h +++ b/src/oat/runtime/oat_support_entrypoints.h @@ -105,14 +105,9 @@ struct PACKED EntryPoints { int32_t (*pIdivmod)(int32_t, int32_t); int64_t (*pD2l)(double); int64_t (*pF2l)(float); - int64_t (*pLadd)(int64_t, int64_t); - int64_t (*pLand)(int64_t, int64_t); int64_t (*pLdiv)(int64_t, int64_t); int64_t (*pLdivmod)(int64_t, int64_t); int64_t (*pLmul)(int64_t, int64_t); - int64_t (*pLor)(int64_t, int64_t); - int64_t (*pLsub)(int64_t, int64_t); - int64_t (*pLxor)(int64_t, int64_t); uint64_t (*pShlLong)(uint64_t, uint32_t); uint64_t (*pShrLong)(uint64_t, uint32_t); uint64_t (*pUshrLong)(uint64_t, uint32_t); diff --git a/src/oat/runtime/x86/oat_support_entrypoints_x86.cc b/src/oat/runtime/x86/oat_support_entrypoints_x86.cc index dd139eedf3..735c2313a6 100644 --- a/src/oat/runtime/x86/oat_support_entrypoints_x86.cc +++ b/src/oat/runtime/x86/oat_support_entrypoints_x86.cc @@ -76,6 +76,9 @@ extern "C" int32_t art_idiv_from_code(int32_t, int32_t); extern "C" int32_t art_idivmod_from_code(int32_t, int32_t); extern "C" int64_t art_ldiv_from_code(int64_t, int64_t); extern "C" int64_t art_ldivmod_from_code(int64_t, int64_t); +extern "C" uint64_t art_lshl_from_code(uint64_t, uint32_t); +extern "C" uint64_t art_lshr_from_code(uint64_t, uint32_t); +extern "C" uint64_t art_lushr_from_code(uint64_t, uint32_t); // Intrinsic entrypoints. extern "C" int32_t art_memcmp16(void*, void*, int32_t); @@ -183,17 +186,12 @@ void InitEntryPoints(EntryPoints* points) { points->pIdivmod = art_idivmod_from_code; points->pD2l = D2L; points->pF2l = F2L; - points->pLadd = NULL; - points->pLand = NULL; points->pLdiv = art_ldiv_from_code; points->pLdivmod = art_ldivmod_from_code; points->pLmul = NULL; - points->pLor = NULL; - points->pLsub = NULL; - points->pLxor = NULL; - points->pShlLong = NULL; - points->pShrLong = NULL; - points->pUshrLong = NULL; + points->pShlLong = art_lshl_from_code; + points->pShrLong = art_lshr_from_code; + points->pUshrLong = art_lushr_from_code; // Intrinsics points->pIndexOf = art_indexof; diff --git a/src/oat/runtime/x86/runtime_support_x86.S b/src/oat/runtime/x86/runtime_support_x86.S index 0797da66b8..4f3d3349b5 100644 --- a/src/oat/runtime/x86/runtime_support_x86.S +++ b/src/oat/runtime/x86/runtime_support_x86.S @@ -414,7 +414,7 @@ DEFINE_FUNCTION art_idivmod_from_code ret DEFINE_FUNCTION art_ldiv_from_code - addl LITERAL(12), %esp // alignment padding + subl LITERAL(12), %esp // alignment padding pushl %ebx // pass arg4 pushl %edx // pass arg3 pushl %ecx // pass arg2 @@ -424,7 +424,7 @@ DEFINE_FUNCTION art_ldiv_from_code ret DEFINE_FUNCTION art_ldivmod_from_code - addl LITERAL(12), %esp // alignment padding + subl LITERAL(12), %esp // alignment padding pushl %ebx // pass arg4 pushl %edx // pass arg3 pushl %ecx // pass arg2 @@ -433,6 +433,42 @@ DEFINE_FUNCTION art_ldivmod_from_code addl LITERAL(28), %esp // pop arguments ret +DEFINE_FUNCTION art_lshl_from_code + // eax:ecx << edx + xchg %edx, %ecx + shld %cl,%eax,%edx + shl %cl,%eax + test LITERAL(32), %cl + jz 1f + mov %eax, %edx + xor %eax, %eax +1: + ret + +DEFINE_FUNCTION art_lshr_from_code + // eax:ecx >> edx + xchg %edx, %ecx + shrd %cl,%eax,%edx + sar %cl,%eax + test LITERAL(32),%cl + jz 1f + mov %edx, %eax + sar LITERAL(31), %edx +1: + ret + +DEFINE_FUNCTION art_lushr_from_code + // eax:ecx >>> edx + xchg %edx, %ecx + shrd %cl,%eax,%edx + shr %cl,%eax + test $0x20,%cl + jz 1f + mov %edx, %eax + xor %edx, %edx +1: + ret + DEFINE_FUNCTION art_can_put_array_element_from_code test %eax, %eax // Null is trivially storable jz 1f diff --git a/src/oatdump.cc b/src/oatdump.cc index 555e1bec37..aa63ef552c 100644 --- a/src/oatdump.cc +++ b/src/oatdump.cc @@ -205,14 +205,9 @@ class OatDumper { DUMP_ENTRY_POINT(pIdivmod); DUMP_ENTRY_POINT(pD2l); DUMP_ENTRY_POINT(pF2l); - DUMP_ENTRY_POINT(pLadd); - DUMP_ENTRY_POINT(pLand); DUMP_ENTRY_POINT(pLdiv); DUMP_ENTRY_POINT(pLdivmod); DUMP_ENTRY_POINT(pLmul); - DUMP_ENTRY_POINT(pLor); - DUMP_ENTRY_POINT(pLsub); - DUMP_ENTRY_POINT(pLxor); DUMP_ENTRY_POINT(pShlLong); DUMP_ENTRY_POINT(pShrLong); DUMP_ENTRY_POINT(pUshrLong); diff --git a/src/runtime.cc b/src/runtime.cc index c4a9bd7d0a..c013726ed6 100644 --- a/src/runtime.cc +++ b/src/runtime.cc @@ -634,7 +634,6 @@ bool Runtime::Init(const Options& raw_options, bool ignore_unrecognized) { options->heap_growth_limit_, options->heap_maximum_size_, options->image_); - heap_->EnableObjectValidation(); BlockSignals(); @@ -649,6 +648,9 @@ bool Runtime::Init(const Options& raw_options, bool ignore_unrecognized) { // Set us to runnable so tools using a runtime can allocate and GC by default Thread::Current()->SetState(Thread::kRunnable); + // Now we're attached, we can take the heap lock and validate the heap. + GetHeap()->EnableObjectValidation(); + CHECK_GE(GetHeap()->GetSpaces().size(), 1U); if (GetHeap()->GetSpaces()[0]->IsImageSpace()) { class_linker_ = ClassLinker::CreateFromImage(intern_table_); |