diff options
| -rw-r--r-- | compiler/optimizing/code_generator_x86_64.cc | 4 | ||||
| -rw-r--r-- | compiler/utils/x86_64/assembler_x86_64.cc | 3 | ||||
| -rw-r--r-- | runtime/base/time_utils.cc | 14 | ||||
| -rw-r--r-- | runtime/debugger.cc | 3 | ||||
| -rw-r--r-- | test/560-packed-switch/expected.txt | 0 | ||||
| -rw-r--r-- | test/560-packed-switch/info.txt | 2 | ||||
| -rw-r--r-- | test/560-packed-switch/src/Main.java | 31 | ||||
| -rw-r--r-- | tools/libcore_failures.txt | 13 |
8 files changed, 58 insertions, 12 deletions
diff --git a/compiler/optimizing/code_generator_x86_64.cc b/compiler/optimizing/code_generator_x86_64.cc index ffd8c42e20..7c94a8cc71 100644 --- a/compiler/optimizing/code_generator_x86_64.cc +++ b/compiler/optimizing/code_generator_x86_64.cc @@ -786,7 +786,7 @@ void CodeGeneratorX86_64::GenerateStaticOrDirectCall(HInvokeStaticOrDirect* invo 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 @@ void InstructionCodeGeneratorX86_64::VisitPackedSwitch(HPackedSwitch* switch_ins 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 9eb5e67041..db072678ef 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::xchgl(CpuRegister reg, const Address& address) { 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::cmpw(const Address& address, const Immediate& imm) { 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, CpuRegister reg) { 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 48b0a090ce..b7cf2072dc 100644 --- a/runtime/base/time_utils.cc +++ b/runtime/base/time_utils.cc @@ -174,8 +174,6 @@ void NanoSleep(uint64_t ns) { } 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 @@ void InitTimeSpec(bool absolute, int clock, int64_t ms, int32_t ns, timespec* ts 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 e0211f5e38..f009fe6acc 100644 --- a/runtime/debugger.cc +++ b/runtime/debugger.cc @@ -730,7 +730,8 @@ JDWP::JdwpError Dbg::GetClassLoader(JDWP::RefTypeId id, JDWP::ExpandBuf* pReply) 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 0000000000..e69de29bb2 --- /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 0000000000..41d4562d04 --- /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 0000000000..3b0b425c86 --- /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 9acc20e3e6..880be26792 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"] } ] |