Merge "Revert "ART: Fix up some multi-image cases""
diff --git a/compiler/optimizing/code_generator_x86_64.cc b/compiler/optimizing/code_generator_x86_64.cc
index ffd8c42..7c94a8c 100644
--- a/compiler/optimizing/code_generator_x86_64.cc
+++ b/compiler/optimizing/code_generator_x86_64.cc
@@ -786,7 +786,7 @@
switch (invoke->GetMethodLoadKind()) {
case HInvokeStaticOrDirect::MethodLoadKind::kStringInit:
// temp = thread->string_init_entrypoint
- __ gs()->movl(temp.AsRegister<CpuRegister>(),
+ __ gs()->movq(temp.AsRegister<CpuRegister>(),
Address::Absolute(invoke->GetStringInitOffset(), /* no_rip */ true));
break;
case HInvokeStaticOrDirect::MethodLoadKind::kRecursive:
@@ -6385,7 +6385,7 @@
if (index != num_entries) {
// There are an odd number of entries. Handle the last one.
DCHECK_EQ(index + 1, num_entries);
- __ cmpl(value_reg_in, Immediate(lower_bound + index));
+ __ cmpl(value_reg_in, Immediate(static_cast<int32_t>(lower_bound + index)));
__ j(kEqual, codegen_->GetLabelOf(successors[index]));
}
diff --git a/compiler/utils/x86_64/assembler_x86_64.cc b/compiler/utils/x86_64/assembler_x86_64.cc
index 9eb5e67..db07267 100644
--- a/compiler/utils/x86_64/assembler_x86_64.cc
+++ b/compiler/utils/x86_64/assembler_x86_64.cc
@@ -1213,6 +1213,7 @@
void X86_64Assembler::cmpw(const Address& address, const Immediate& imm) {
AssemblerBuffer::EnsureCapacity ensured(&buffer_);
+ CHECK(imm.is_int32());
EmitOperandSizeOverride();
EmitOptionalRex32(address);
EmitComplex(7, address, imm);
@@ -1221,6 +1222,7 @@
void X86_64Assembler::cmpl(CpuRegister reg, const Immediate& imm) {
AssemblerBuffer::EnsureCapacity ensured(&buffer_);
+ CHECK(imm.is_int32());
EmitOptionalRex32(reg);
EmitComplex(7, Operand(reg), imm);
}
@@ -1252,6 +1254,7 @@
void X86_64Assembler::cmpl(const Address& address, const Immediate& imm) {
AssemblerBuffer::EnsureCapacity ensured(&buffer_);
+ CHECK(imm.is_int32());
EmitOptionalRex32(address);
EmitComplex(7, address, imm);
}
diff --git a/runtime/base/time_utils.cc b/runtime/base/time_utils.cc
index 48b0a09..b7cf207 100644
--- a/runtime/base/time_utils.cc
+++ b/runtime/base/time_utils.cc
@@ -174,8 +174,6 @@
}
void InitTimeSpec(bool absolute, int clock, int64_t ms, int32_t ns, timespec* ts) {
- int64_t endSec;
-
if (absolute) {
#if !defined(__APPLE__)
clock_gettime(clock, ts);
@@ -190,13 +188,13 @@
ts->tv_sec = 0;
ts->tv_nsec = 0;
}
- endSec = ts->tv_sec + ms / 1000;
- if (UNLIKELY(endSec >= 0x7fffffff)) {
- std::ostringstream ss;
- LOG(INFO) << "Note: end time exceeds epoch: " << ss.str();
- endSec = 0x7ffffffe;
+
+ int64_t end_sec = ts->tv_sec + ms / 1000;
+ if (UNLIKELY(end_sec >= 0x7fffffff)) {
+ LOG(INFO) << "Note: end time exceeds INT32_MAX: " << end_sec;
+ end_sec = 0x7ffffffe;
}
- ts->tv_sec = endSec;
+ ts->tv_sec = end_sec;
ts->tv_nsec = (ts->tv_nsec + (ms % 1000) * 1000000) + ns;
// Catch rollover.
diff --git a/runtime/debugger.cc b/runtime/debugger.cc
index e0211f5..f009fe6 100644
--- a/runtime/debugger.cc
+++ b/runtime/debugger.cc
@@ -730,7 +730,8 @@
if (o == nullptr) {
return JDWP::ERR_INVALID_OBJECT;
}
- expandBufAddObjectId(pReply, gRegistry->Add(o->GetClass()->GetClassLoader()));
+ DCHECK(o->IsClass());
+ expandBufAddObjectId(pReply, gRegistry->Add(o->AsClass()->GetClassLoader()));
return JDWP::ERR_NONE;
}
diff --git a/test/560-packed-switch/expected.txt b/test/560-packed-switch/expected.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/560-packed-switch/expected.txt
diff --git a/test/560-packed-switch/info.txt b/test/560-packed-switch/info.txt
new file mode 100644
index 0000000..41d4562
--- /dev/null
+++ b/test/560-packed-switch/info.txt
@@ -0,0 +1,2 @@
+Regression test for optimizing that used to emit wrong code
+for a HPackedSwitch.
diff --git a/test/560-packed-switch/src/Main.java b/test/560-packed-switch/src/Main.java
new file mode 100644
index 0000000..3b0b425
--- /dev/null
+++ b/test/560-packed-switch/src/Main.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public class Main {
+ public static void main(String[] args) {
+ switch (staticField) {
+ case -1:
+ return;
+ case -4:
+ // We add this case to make it an odd number of case/default.
+ // The code generation for it used to be bogus.
+ throw new Error("Cannot happen");
+ default:
+ throw new Error("Cannot happen");
+ }
+ }
+ static int staticField = -1;
+}
diff --git a/tools/libcore_failures.txt b/tools/libcore_failures.txt
index 9acc20e..880be26 100644
--- a/tools/libcore_failures.txt
+++ b/tools/libcore_failures.txt
@@ -236,7 +236,18 @@
"org.apache.harmony.tests.java.util.prefs.AbstractPreferencesTest#testExportSubtree",
"org.apache.harmony.tests.java.util.prefs.AbstractPreferencesTest#testFlush",
"org.apache.harmony.tests.java.util.prefs.AbstractPreferencesTest#testSync",
- "org.apache.harmony.tests.java.util.prefs.FilePreferencesImplTest#testPutGet"]
+ "org.apache.harmony.tests.java.util.prefs.FilePreferencesImplTest#testPutGet",
+ "libcore.java.util.CalendarTest#test_clear_45877",
+ "org.apache.harmony.crypto.tests.javax.crypto.spec.SecretKeySpecTest#testGetFormat",
+ "org.apache.harmony.tests.java.util.TimerTaskTest#test_scheduledExecutionTime"]
+},
+{
+ description: "Failing tests after enso move, only on arm32",
+ result: EXEC_FAILED,
+ bug: 26353151,
+ modes_variants: [[device, X32]],
+ names: ["org.apache.harmony.tests.java.text.DecimalFormatTest#test_formatDouble_withFieldPosition",
+ "org.apache.harmony.tests.java.text.DecimalFormatTest#test_formatToCharacterIterator_original"]
}
]