More X86 fixes.
Fix bugs in a few long entrypoints and with object validation being
enabled.
Change-Id: I18884fbbe6829b584b9fc92e338549577f925f14
diff --git a/src/compiler/codegen/x86/Assemble.cc b/src/compiler/codegen/x86/Assemble.cc
index 2639057..bad7142 100644
--- a/src/compiler/codegen/x86/Assemble.cc
+++ b/src/compiler/codegen/x86/Assemble.cc
@@ -1079,7 +1079,7 @@
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 d2aada4..8a7ab3d 100644
--- a/src/heap.cc
+++ b/src/heap.cc
@@ -313,6 +313,7 @@
#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 69e9c98..f8a071f 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 @@
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 62b20f2..a5cdc33 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 @@
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 1a8e675..af7fee3 100644
--- a/src/oat/runtime/oat_support_entrypoints.h
+++ b/src/oat/runtime/oat_support_entrypoints.h
@@ -105,14 +105,9 @@
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 dd139ee..735c231 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_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 @@
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 0797da6..4f3d334 100644
--- a/src/oat/runtime/x86/runtime_support_x86.S
+++ b/src/oat/runtime/x86/runtime_support_x86.S
@@ -414,7 +414,7 @@
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 @@
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 @@
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 555e1be..aa63ef5 100644
--- a/src/oatdump.cc
+++ b/src/oatdump.cc
@@ -205,14 +205,9 @@
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 c4a9bd7..c013726 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -634,7 +634,6 @@
options->heap_growth_limit_,
options->heap_maximum_size_,
options->image_);
- heap_->EnableObjectValidation();
BlockSignals();
@@ -649,6 +648,9 @@
// 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_);