summaryrefslogtreecommitdiff
path: root/compiler/optimizing/intrinsics_x86_64.cc
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/optimizing/intrinsics_x86_64.cc')
-rw-r--r--compiler/optimizing/intrinsics_x86_64.cc69
1 files changed, 23 insertions, 46 deletions
diff --git a/compiler/optimizing/intrinsics_x86_64.cc b/compiler/optimizing/intrinsics_x86_64.cc
index 3a441f3c3b..e18ef8ebfe 100644
--- a/compiler/optimizing/intrinsics_x86_64.cc
+++ b/compiler/optimizing/intrinsics_x86_64.cc
@@ -83,8 +83,7 @@ class ReadBarrierSystemArrayCopySlowPathX86_64 : public SlowPathCode {
<< "Unexpected instruction in read barrier arraycopy slow path: "
<< instruction_->DebugName();
DCHECK(instruction_->GetLocations()->Intrinsified());
- // TODO: Remove "OrNull".
- DCHECK_EQ(instruction_->AsInvokeOrNull()->GetIntrinsic(), Intrinsics::kSystemArrayCopy);
+ DCHECK_EQ(instruction_->AsInvoke()->GetIntrinsic(), Intrinsics::kSystemArrayCopy);
int32_t element_size = DataType::Size(DataType::Type::kReference);
@@ -664,15 +663,13 @@ static void CheckPosition(X86_64Assembler* assembler,
const uint32_t length_offset = mirror::Array::LengthOffset().Uint32Value();
if (pos.IsConstant()) {
- // TODO: Remove "OrNull".
- int32_t pos_const = pos.GetConstant()->AsIntConstantOrNull()->GetValue();
+ int32_t pos_const = pos.GetConstant()->AsIntConstant()->GetValue();
if (pos_const == 0) {
if (!length_is_input_length) {
// Check that length(input) >= length.
if (length.IsConstant()) {
__ cmpl(Address(input, length_offset),
- // TODO: Remove "OrNull".
- Immediate(length.GetConstant()->AsIntConstantOrNull()->GetValue()));
+ Immediate(length.GetConstant()->AsIntConstant()->GetValue()));
} else {
__ cmpl(Address(input, length_offset), length.AsRegister<CpuRegister>());
}
@@ -686,8 +683,7 @@ static void CheckPosition(X86_64Assembler* assembler,
// Check that (length(input) - pos) >= length.
if (length.IsConstant()) {
- // TODO: Remove "OrNull".
- __ cmpl(temp, Immediate(length.GetConstant()->AsIntConstantOrNull()->GetValue()));
+ __ cmpl(temp, Immediate(length.GetConstant()->AsIntConstant()->GetValue()));
} else {
__ cmpl(temp, length.AsRegister<CpuRegister>());
}
@@ -712,8 +708,7 @@ static void CheckPosition(X86_64Assembler* assembler,
__ movl(temp, Address(input, length_offset));
__ subl(temp, pos_reg);
if (length.IsConstant()) {
- // TODO: Remove "OrNull".
- __ cmpl(temp, Immediate(length.GetConstant()->AsIntConstantOrNull()->GetValue()));
+ __ cmpl(temp, Immediate(length.GetConstant()->AsIntConstant()->GetValue()));
} else {
__ cmpl(temp, length.AsRegister<CpuRegister>());
}
@@ -770,8 +765,7 @@ static void SystemArrayCopyPrimitive(HInvoke* invoke,
// We need the count in RCX.
if (length.IsConstant()) {
- // TODO: Remove "OrNull".
- __ movl(count, Immediate(length.GetConstant()->AsIntConstantOrNull()->GetValue()));
+ __ movl(count, Immediate(length.GetConstant()->AsIntConstant()->GetValue()));
} else {
__ movl(count, length.AsRegister<CpuRegister>());
}
@@ -783,15 +777,13 @@ static void SystemArrayCopyPrimitive(HInvoke* invoke,
const uint32_t data_offset = mirror::Array::DataOffset(data_size).Uint32Value();
if (src_pos.IsConstant()) {
- // TODO: Remove "OrNull".
- int32_t src_pos_const = src_pos.GetConstant()->AsIntConstantOrNull()->GetValue();
+ int32_t src_pos_const = src_pos.GetConstant()->AsIntConstant()->GetValue();
__ leal(src_base, Address(src, data_size * src_pos_const + data_offset));
} else {
__ leal(src_base, Address(src, src_pos.AsRegister<CpuRegister>(), scale_factor, data_offset));
}
if (dest_pos.IsConstant()) {
- // TODO: Remove "OrNull".
- int32_t dest_pos_const = dest_pos.GetConstant()->AsIntConstantOrNull()->GetValue();
+ int32_t dest_pos_const = dest_pos.GetConstant()->AsIntConstant()->GetValue();
__ leal(dest_base, Address(dest, data_size * dest_pos_const + data_offset));
} else {
__ leal(dest_base,
@@ -871,24 +863,21 @@ static void GenSystemArrayCopyAddresses(X86_64Assembler* assembler,
const uint32_t data_offset = mirror::Array::DataOffset(element_size).Uint32Value();
if (src_pos.IsConstant()) {
- // TODO: Remove "OrNull".
- int32_t constant = src_pos.GetConstant()->AsIntConstantOrNull()->GetValue();
+ int32_t constant = src_pos.GetConstant()->AsIntConstant()->GetValue();
__ leal(src_base, Address(src, element_size * constant + data_offset));
} else {
__ leal(src_base, Address(src, src_pos.AsRegister<CpuRegister>(), scale_factor, data_offset));
}
if (dst_pos.IsConstant()) {
- // TODO: Remove "OrNull".
- int32_t constant = dst_pos.GetConstant()->AsIntConstantOrNull()->GetValue();
+ int32_t constant = dst_pos.GetConstant()->AsIntConstant()->GetValue();
__ leal(dst_base, Address(dst, element_size * constant + data_offset));
} else {
__ leal(dst_base, Address(dst, dst_pos.AsRegister<CpuRegister>(), scale_factor, data_offset));
}
if (copy_length.IsConstant()) {
- // TODO: Remove "OrNull".
- int32_t constant = copy_length.GetConstant()->AsIntConstantOrNull()->GetValue();
+ int32_t constant = copy_length.GetConstant()->AsIntConstant()->GetValue();
__ leal(src_end, Address(src_base, element_size * constant));
} else {
__ leal(src_end, Address(src_base, copy_length.AsRegister<CpuRegister>(), scale_factor, 0));
@@ -932,11 +921,9 @@ void IntrinsicCodeGeneratorX86_64::VisitSystemArrayCopy(HInvoke* invoke) {
// If source and destination are the same, we go to slow path if we need to do
// forward copying.
if (src_pos.IsConstant()) {
- // TODO: Remove "OrNull".
- int32_t src_pos_constant = src_pos.GetConstant()->AsIntConstantOrNull()->GetValue();
+ int32_t src_pos_constant = src_pos.GetConstant()->AsIntConstant()->GetValue();
if (dest_pos.IsConstant()) {
- // TODO: Remove "OrNull".
- int32_t dest_pos_constant = dest_pos.GetConstant()->AsIntConstantOrNull()->GetValue();
+ int32_t dest_pos_constant = dest_pos.GetConstant()->AsIntConstant()->GetValue();
if (optimizations.GetDestinationIsSource()) {
// Checked when building locations.
DCHECK_GE(src_pos_constant, dest_pos_constant);
@@ -958,8 +945,7 @@ void IntrinsicCodeGeneratorX86_64::VisitSystemArrayCopy(HInvoke* invoke) {
__ j(kNotEqual, &conditions_on_positions_validated);
}
if (dest_pos.IsConstant()) {
- // TODO: Remove "OrNull".
- int32_t dest_pos_constant = dest_pos.GetConstant()->AsIntConstantOrNull()->GetValue();
+ int32_t dest_pos_constant = dest_pos.GetConstant()->AsIntConstant()->GetValue();
__ cmpl(src_pos.AsRegister<CpuRegister>(), Immediate(dest_pos_constant));
__ j(kLess, intrinsic_slow_path->GetEntryLabel());
} else {
@@ -1437,8 +1423,7 @@ static void GenerateStringIndexOf(HInvoke* invoke,
SlowPathCode* slow_path = nullptr;
HInstruction* code_point = invoke->InputAt(1);
if (code_point->IsIntConstant()) {
- // TODO: Remove "OrNull".
- if (static_cast<uint32_t>(code_point->AsIntConstantOrNull()->GetValue()) >
+ if (static_cast<uint32_t>(code_point->AsIntConstant()->GetValue()) >
std::numeric_limits<uint16_t>::max()) {
// Always needs the slow-path. We could directly dispatch to it, but this case should be
// rare, so for simplicity just put the full slow-path down and branch unconditionally.
@@ -1669,9 +1654,8 @@ void IntrinsicCodeGeneratorX86_64::VisitStringGetCharsNoCheck(HInvoke* invoke) {
// public void getChars(int srcBegin, int srcEnd, char[] dst, int dstBegin);
CpuRegister obj = locations->InAt(0).AsRegister<CpuRegister>();
Location srcBegin = locations->InAt(1);
- // TODO: Remove "OrNull".
int srcBegin_value =
- srcBegin.IsConstant() ? srcBegin.GetConstant()->AsIntConstantOrNull()->GetValue() : 0;
+ srcBegin.IsConstant() ? srcBegin.GetConstant()->AsIntConstant()->GetValue() : 0;
CpuRegister srcEnd = locations->InAt(2).AsRegister<CpuRegister>();
CpuRegister dst = locations->InAt(3).AsRegister<CpuRegister>();
CpuRegister dstBegin = locations->InAt(4).AsRegister<CpuRegister>();
@@ -1827,8 +1811,7 @@ static void GenPoke(LocationSummary* locations, DataType::Type size, X86_64Assem
break;
case DataType::Type::kInt64:
if (value.IsConstant()) {
- // TODO: Remove "OrNull".
- int64_t v = value.GetConstant()->AsLongConstantOrNull()->GetValue();
+ int64_t v = value.GetConstant()->AsLongConstant()->GetValue();
DCHECK(IsInt<32>(v));
int32_t v_32 = v;
__ movq(Address(address, 0), Immediate(v_32));
@@ -2755,8 +2738,7 @@ static void GenBitCount(X86_64Assembler* assembler,
if (invoke->InputAt(0)->IsConstant()) {
// Evaluate this at compile time.
- // TODO: Remove "OrNull".
- int64_t value = Int64FromConstant(invoke->InputAt(0)->AsConstantOrNull());
+ int64_t value = Int64FromConstant(invoke->InputAt(0)->AsConstant());
int32_t result = is_long
? POPCOUNT(static_cast<uint64_t>(value))
: POPCOUNT(static_cast<uint32_t>(value));
@@ -2814,8 +2796,7 @@ static void GenOneBit(X86_64Assembler* assembler,
if (invoke->InputAt(0)->IsConstant()) {
// Evaluate this at compile time.
- // TODO: Remove "OrNull".
- int64_t value = Int64FromConstant(invoke->InputAt(0)->AsConstantOrNull());
+ int64_t value = Int64FromConstant(invoke->InputAt(0)->AsConstant());
if (value == 0) {
__ xorl(out, out); // Clears upper bits too.
return;
@@ -2948,8 +2929,7 @@ static void GenLeadingZeros(X86_64Assembler* assembler,
int zero_value_result = is_long ? 64 : 32;
if (invoke->InputAt(0)->IsConstant()) {
// Evaluate this at compile time.
- // TODO: Remove "OrNull".
- int64_t value = Int64FromConstant(invoke->InputAt(0)->AsConstantOrNull());
+ int64_t value = Int64FromConstant(invoke->InputAt(0)->AsConstant());
if (value == 0) {
value = zero_value_result;
} else {
@@ -3022,8 +3002,7 @@ static void GenTrailingZeros(X86_64Assembler* assembler,
int zero_value_result = is_long ? 64 : 32;
if (invoke->InputAt(0)->IsConstant()) {
// Evaluate this at compile time.
- // TODO: Remove "OrNull".
- int64_t value = Int64FromConstant(invoke->InputAt(0)->AsConstantOrNull());
+ int64_t value = Int64FromConstant(invoke->InputAt(0)->AsConstant());
if (value == 0) {
value = zero_value_result;
} else {
@@ -3098,8 +3077,7 @@ void IntrinsicCodeGeneratorX86_64::VisitIntegerValueOf(HInvoke* invoke) {
CheckEntrypointTypes<kQuickAllocObjectWithChecks, void*, mirror::Class*>();
};
if (invoke->InputAt(0)->IsIntConstant()) {
- // TODO: Remove "OrNull".
- int32_t value = invoke->InputAt(0)->AsIntConstantOrNull()->GetValue();
+ int32_t value = invoke->InputAt(0)->AsIntConstant()->GetValue();
if (static_cast<uint32_t>(value - info.low) < info.length) {
// Just embed the j.l.Integer in the code.
DCHECK_NE(info.value_boot_image_reference, IntegerValueOfInfo::kInvalidReference);
@@ -3405,8 +3383,7 @@ class VarHandleSlowPathX86_64 : public IntrinsicSlowPathX86_64 {
private:
HInvoke* GetInvoke() const {
- // TODO: Remove "OrNull".
- return GetInstruction()->AsInvokeOrNull();
+ return GetInstruction()->AsInvoke();
}
mirror::VarHandle::AccessModeTemplate GetAccessModeTemplate() const {