|
|
|
|
SSL intrinsics_x86_64.cc
Interaktion und PortierbarkeitC
|
|
/*
* 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.
*/
#include "intrinsics_x86_64.h"
#include <limits>
#include "arch/x86_64/instruction_set_features_x86_64.h"
#include "arch/x86_64/registers_x86_64.h"
#include "art_method.h"
#include "base/bit_utils.h"
#include "code_generator_x86_64.h"
#include "dex/modifiers.h"
#include "entrypoints/quick/quick_entrypoints.h"
#include "entrypoints/quick/quick_entrypoints_enum.h"
#include "heap_poisoning.h"
#include "intrinsic_objects.h"
#include "intrinsics.h"
#include "intrinsics_utils.h"
#include "lock_word.h"
#include "mirror/array-inl.h"
#include "mirror/method_handle_impl.h"
#include "mirror/object_array-inl.h"
#include "mirror/reference.h"
#include "mirror/string.h"
#include "optimizing/code_generator.h"
#include "optimizing/data_type.h"
#include "optimizing/locations.h"
#include "scoped_thread_state_change-inl.h"
#include "thread-current-inl.h"
#include "utils/x86_64/assembler_x86_64.h"
#include "utils/x86_64/constants_x86_64.h"
#include "well_known_classes.h"
namespace art HIDDEN {
namespace x86_64 {
IntrinsicLocationsBuilderX86_64::IntrinsicLocationsBuilderX86_64(const CodeGeneratorX86_64* codegen)
: allocator_(codegen->GetGraph()->GetAllocator()), codegen_(codegen) {
}
X86_64Assembler* IntrinsicCodeGeneratorX86_64::GetAssembler() {
return down_cast<X86_64Assembler*>(codegen_->GetAssembler());
}
ArenaAllocator* IntrinsicCodeGeneratorX86_64::GetAllocator() {
return codegen_->GetGraph()->GetAllocator();
}
bool IntrinsicLocationsBuilderX86_64::TryDispatch(HInvoke* invoke) {
Dispatch(invoke);
LocationSummary* res = invoke->GetLocations();
if (res == nullptr) {
return false;
}
return res->Intrinsified();
}
using IntrinsicSlowPathX86_64 = IntrinsicSlowPath<InvokeDexCallingConventionVisitorX86_64>;
#define __ assembler->
static void GenArrayAddress(X86_64Assembler* assembler,
CpuRegister dest,
CpuRegister base,
Location pos,
DataType::Type type,
uint32_t data_offset) {
// Note: The heap is in low 4GiB, so we're using LEAL rather than LEAQ to save on code size.
if (pos.IsConstant()) {
int32_t constant = pos.GetConstant()->AsIntConstant()->GetValue();
__ leal(dest, Address(base, DataType::Size(type) * constant + data_offset));
} else {
const ScaleFactor scale_factor = static_cast<ScaleFactor>(DataType::SizeShift(type));
__ leal(dest, Address(base, pos.AsCoreRegister<CpuRegister>(), scale_factor, data_offset));
}
}
// Slow path implementing the SystemArrayCopy intrinsic copy loop with read barriers.
class ReadBarrierSystemArrayCopySlowPathX86_64 : public SlowPathCode {
public:
explicit ReadBarrierSystemArrayCopySlowPathX86_64(HInstruction* instruction)
: SlowPathCode(instruction) {
}
void EmitNativeCode(CodeGenerator* codegen) override {
DCHECK(codegen->EmitBakerReadBarrier());
CodeGeneratorX86_64* x86_64_codegen = down_cast<CodeGeneratorX86_64*>(codegen);
X86_64Assembler* assembler = x86_64_codegen->GetAssembler();
LocationSummary* locations = instruction_->GetLocations();
DCHECK(locations->CanCall());
DCHECK(instruction_->IsInvokeStaticOrDirect())
<< "Unexpected instruction in read barrier arraycopy slow path: "
<< instruction_->DebugName();
DCHECK(instruction_->GetLocations()->Intrinsified());
DCHECK_EQ(instruction_->AsInvoke()->GetIntrinsic(), Intrinsics::kSystemArrayCopy);
Location length = locations->InAt(4);
const DataType::Type type = DataType::Type::kReference;
const int32_t element_size = DataType::Size(type);
CpuRegister src_curr_addr = locations->GetTemp(0).AsCoreRegister<CpuRegister>();
CpuRegister dst_curr_addr = locations->GetTemp(1).AsCoreRegister<CpuRegister>();
CpuRegister src_stop_addr = locations->GetTemp(2).AsCoreRegister<CpuRegister>();
__ Bind(GetEntryLabel());
// The `src_curr_addr` and `dst_curr_addr` were initialized before entering the slow-path.
GenArrayAddress(assembler, src_stop_addr, src_curr_addr, length, type, /*data_offset=*/ 0u);
NearLabel loop;
__ Bind(&loop);
__ movl(CpuRegister(TMP), Address(src_curr_addr, 0));
__ MaybeUnpoisonHeapReference(CpuRegister(TMP));
// TODO: Inline the mark bit check before calling the runtime?
// TMP = ReadBarrier::Mark(TMP);
// No need to save live registers; it's taken care of by the
// entrypoint. Also, there is no need to update the stack mask,
// as this runtime call will not trigger a garbage collection.
int32_t entry_point_offset = Thread::ReadBarrierMarkEntryPointsOffset<kX86_64PointerSize>(TMP);
// This runtime call does not require a stack map.
x86_64_codegen->InvokeRuntimeWithoutRecordingPcInfo(entry_point_offset, instruction_, this);
__ MaybePoisonHeapReference(CpuRegister(TMP));
__ movl(Address(dst_curr_addr, 0), CpuRegister(TMP));
__ addl(src_curr_addr, Immediate(element_size));
__ addl(dst_curr_addr, Immediate(element_size));
__ cmpl(src_curr_addr, src_stop_addr);
__ j(kNotEqual, &loop);
__ jmp(GetExitLabel());
}
const char* GetDescription() const override { return "ReadBarrierSystemArrayCopySlowPathX86_64"; }
private:
DISALLOW_COPY_AND_ASSIGN(ReadBarrierSystemArrayCopySlowPathX86_64);
};
// The MethodHandle.invokeExact intrinsic sets up arguments to match the target method call. If we
// need to go to the slow path, we call art_quick_invoke_polymorphic_with_hidden_receiver, which
// expects the MethodHandle object in RDI (in place of the actual ArtMethod).
class InvokePolymorphicSlowPathX86_64 : public SlowPathCode {
public:
InvokePolymorphicSlowPathX86_64(HInstruction* instruction, CpuRegister method_handle)
: SlowPathCode(instruction), method_handle_(method_handle) {
DCHECK(instruction->IsInvokePolymorphic());
}
void EmitNativeCode(CodeGenerator* codegen) override {
CodeGeneratorX86_64* x86_64_codegen = down_cast<CodeGeneratorX86_64*>(codegen);
X86_64Assembler* assembler = x86_64_codegen->GetAssembler();
__ Bind(GetEntryLabel());
SaveLiveRegisters(codegen, instruction_->GetLocations());
// Passing `MethodHandle` object as hidden argument.
__ movl(CpuRegister(RDI), method_handle_);
x86_64_codegen->InvokeRuntime(QuickEntrypointEnum::kQuickInvokePolymorphicWithHiddenReceiver,
instruction_);
RestoreLiveRegisters(codegen, instruction_->GetLocations());
__ jmp(GetExitLabel());
}
const char* GetDescription() const override { return "InvokePolymorphicSlowPathX86_64"; }
private:
const CpuRegister method_handle_;
DISALLOW_COPY_AND_ASSIGN(InvokePolymorphicSlowPathX86_64);
};
static void CreateFPToIntLocations(ArenaAllocator* allocator, HInvoke* invoke) {
LocationSummary* locations = LocationSummary::CreateNoCall(allocator, invoke, kIntrinsified);
locations->SetInAt(0, Location::RequiresFpuRegister());
locations->SetOut(Location::RequiresCoreRegister());
}
static void CreateIntToFPLocations(ArenaAllocator* allocator, HInvoke* invoke) {
LocationSummary* locations = LocationSummary::CreateNoCall(allocator, invoke, kIntrinsified);
locations->SetInAt(0, Location::RequiresCoreRegister());
locations->SetOut(Location::RequiresFpuRegister());
}
static void MoveFPToInt(
CpuRegister dst, XmmRegister src, bool is64bit, X86_64Assembler* assembler) {
if (is64bit) {
__ movq(dst, src);
} else {
__ movd(dst, src);
}
}
static void MoveIntToFP(
XmmRegister dst, CpuRegister src, bool is64bit, X86_64Assembler* assembler) {
if (is64bit) {
__ movq(dst, src);
} else {
__ movd(dst, src);
}
}
static void MoveFPToInt(LocationSummary* locations, bool is64bit, X86_64Assembler* assembler) {
XmmRegister input = locations->InAt(0).AsFpuRegister<XmmRegister>();
CpuRegister output = locations->Out().AsCoreRegister<CpuRegister>();
MoveFPToInt(output, input, is64bit, assembler);
}
static void MoveIntToFP(LocationSummary* locations, bool is64bit, X86_64Assembler* assembler) {
CpuRegister input = locations->InAt(0).AsCoreRegister<CpuRegister>();
XmmRegister output = locations->Out().AsFpuRegister<XmmRegister>();
MoveIntToFP(output, input, is64bit, assembler);
}
void IntrinsicLocationsBuilderX86_64::VisitDoubleDoubleToRawLongBits(HInvoke* invoke) {
CreateFPToIntLocations(allocator_, invoke);
}
void IntrinsicLocationsBuilderX86_64::VisitDoubleLongBitsToDouble(HInvoke* invoke) {
CreateIntToFPLocations(allocator_, invoke);
}
void IntrinsicCodeGeneratorX86_64::VisitDoubleDoubleToRawLongBits(HInvoke* invoke) {
MoveFPToInt(invoke->GetLocations(), /* is64bit= */ true, GetAssembler());
}
void IntrinsicCodeGeneratorX86_64::VisitDoubleLongBitsToDouble(HInvoke* invoke) {
MoveIntToFP(invoke->GetLocations(), /* is64bit= */ true, GetAssembler());
}
void IntrinsicLocationsBuilderX86_64::VisitFloatFloatToRawIntBits(HInvoke* invoke) {
CreateFPToIntLocations(allocator_, invoke);
}
void IntrinsicLocationsBuilderX86_64::VisitFloatIntBitsToFloat(HInvoke* invoke) {
CreateIntToFPLocations(allocator_, invoke);
}
void IntrinsicCodeGeneratorX86_64::VisitFloatFloatToRawIntBits(HInvoke* invoke) {
MoveFPToInt(invoke->GetLocations(), /* is64bit= */ false, GetAssembler());
}
void IntrinsicCodeGeneratorX86_64::VisitFloatIntBitsToFloat(HInvoke* invoke) {
MoveIntToFP(invoke->GetLocations(), /* is64bit= */ false, GetAssembler());
}
static void CreateIntToIntLocations(ArenaAllocator* allocator, HInvoke* invoke) {
LocationSummary* locations = LocationSummary::CreateNoCall(allocator, invoke, kIntrinsified);
locations->SetInAt(0, Location::RequiresCoreRegister());
locations->SetOut(Location::SameAsFirstInput());
}
void IntrinsicLocationsBuilderX86_64::VisitIntegerReverseBytes(HInvoke* invoke) {
CreateIntToIntLocations(allocator_, invoke);
}
void IntrinsicCodeGeneratorX86_64::VisitIntegerReverseBytes(HInvoke* invoke) {
codegen_->GetInstructionCodegen()->Bswap(invoke->GetLocations()->Out(), DataType::Type::kInt32);
}
void IntrinsicLocationsBuilderX86_64::VisitLongReverseBytes(HInvoke* invoke) {
CreateIntToIntLocations(allocator_, invoke);
}
void IntrinsicCodeGeneratorX86_64::VisitLongReverseBytes(HInvoke* invoke) {
codegen_->GetInstructionCodegen()->Bswap(invoke->GetLocations()->Out(), DataType::Type::kInt64);
}
void IntrinsicLocationsBuilderX86_64::VisitShortReverseBytes(HInvoke* invoke) {
CreateIntToIntLocations(allocator_, invoke);
}
void IntrinsicCodeGeneratorX86_64::VisitShortReverseBytes(HInvoke* invoke) {
codegen_->GetInstructionCodegen()->Bswap(invoke->GetLocations()->Out(), DataType::Type::kInt16);
}
static void GenIsInfinite(LocationSummary* locations,
bool is64bit,
CodeGeneratorX86_64* codegen) {
X86_64Assembler* assembler = codegen->GetAssembler();
XmmRegister input = locations->InAt(0).AsFpuRegister<XmmRegister>();
CpuRegister output = locations->Out().AsCoreRegister<CpuRegister>();
NearLabel done1, done2;
if (is64bit) {
double kPositiveInfinity = std::numeric_limits<double>::infinity();
double kNegativeInfinity = -1 * kPositiveInfinity;
__ xorq(output, output);
__ comisd(input, codegen->LiteralDoubleAddress(kPositiveInfinity));
__ j(kNotEqual, &done1);
__ j(kParityEven, &done2);
__ movq(output, Immediate(1));
__ jmp(&done2);
__ Bind(&done1);
__ comisd(input, codegen->LiteralDoubleAddress(kNegativeInfinity));
__ j(kNotEqual, &done2);
__ j(kParityEven, &done2);
__ movq(output, Immediate(1));
__ Bind(&done2);
} else {
float kPositiveInfinity = std::numeric_limits<float>::infinity();
float kNegativeInfinity = -1 * kPositiveInfinity;
__ xorl(output, output);
__ comiss(input, codegen->LiteralFloatAddress(kPositiveInfinity));
__ j(kNotEqual, &done1);
__ j(kParityEven, &done2);
__ movl(output, Immediate(1));
__ jmp(&done2);
__ Bind(&done1);
__ comiss(input, codegen->LiteralFloatAddress(kNegativeInfinity));
__ j(kNotEqual, &done2);
__ j(kParityEven, &done2);
__ movl(output, Immediate(1));
__ Bind(&done2);
}
}
void IntrinsicLocationsBuilderX86_64::VisitFloatIsInfinite(HInvoke* invoke) {
CreateFPToIntLocations(allocator_, invoke);
}
void IntrinsicCodeGeneratorX86_64::VisitFloatIsInfinite(HInvoke* invoke) {
GenIsInfinite(invoke->GetLocations(), /* is64bit=*/ false, codegen_);
}
void IntrinsicLocationsBuilderX86_64::VisitDoubleIsInfinite(HInvoke* invoke) {
CreateFPToIntLocations(allocator_, invoke);
}
void IntrinsicCodeGeneratorX86_64::VisitDoubleIsInfinite(HInvoke* invoke) {
GenIsInfinite(invoke->GetLocations(), /* is64bit=*/ true, codegen_);
}
static void CreateFPToFPLocations(ArenaAllocator* allocator, HInvoke* invoke) {
LocationSummary* locations = LocationSummary::CreateNoCall(allocator, invoke, kIntrinsified);
locations->SetInAt(0, Location::RequiresFpuRegister());
locations->SetOut(Location::RequiresFpuRegister(), Location::kNoOutputOverlap);
}
void IntrinsicLocationsBuilderX86_64::VisitMathSqrt(HInvoke* invoke) {
CreateFPToFPLocations(allocator_, invoke);
}
void IntrinsicCodeGeneratorX86_64::VisitMathSqrt(HInvoke* invoke) {
LocationSummary* locations = invoke->GetLocations();
XmmRegister in = locations->InAt(0).AsFpuRegister<XmmRegister>();
XmmRegister out = locations->Out().AsFpuRegister<XmmRegister>();
GetAssembler()->sqrtsd(out, in);
}
static void CreateSSE41FPToFPLocations(ArenaAllocator* allocator,
HInvoke* invoke,
const CodeGeneratorX86_64* codegen) {
// Do we have instruction support?
if (!codegen->GetInstructionSetFeatures().HasSSE4_1()) {
return;
}
CreateFPToFPLocations(allocator, invoke);
}
static void GenSSE41FPToFPIntrinsic(HInvoke* invoke, X86_64Assembler* assembler, int round_mode) {
LocationSummary* locations = invoke->GetLocations();
DCHECK(!locations->WillCall());
XmmRegister in = locations->InAt(0).AsFpuRegister<XmmRegister>();
XmmRegister out = locations->Out().AsFpuRegister<XmmRegister>();
__ roundsd(out, in, Immediate(round_mode));
}
void IntrinsicLocationsBuilderX86_64::VisitMathCeil(HInvoke* invoke) {
CreateSSE41FPToFPLocations(allocator_, invoke, codegen_);
}
void IntrinsicCodeGeneratorX86_64::VisitMathCeil(HInvoke* invoke) {
GenSSE41FPToFPIntrinsic(invoke, GetAssembler(), 2);
}
void IntrinsicLocationsBuilderX86_64::VisitMathFloor(HInvoke* invoke) {
CreateSSE41FPToFPLocations(allocator_, invoke, codegen_);
}
void IntrinsicCodeGeneratorX86_64::VisitMathFloor(HInvoke* invoke) {
GenSSE41FPToFPIntrinsic(invoke, GetAssembler(), 1);
}
void IntrinsicLocationsBuilderX86_64::VisitMathRint(HInvoke* invoke) {
CreateSSE41FPToFPLocations(allocator_, invoke, codegen_);
}
void IntrinsicCodeGeneratorX86_64::VisitMathRint(HInvoke* invoke) {
GenSSE41FPToFPIntrinsic(invoke, GetAssembler(), 0);
}
static void CreateSSE41FPToIntLocations(ArenaAllocator* allocator,
HInvoke* invoke,
const CodeGeneratorX86_64* codegen) {
// Do we have instruction support?
if (!codegen->GetInstructionSetFeatures().HasSSE4_1()) {
return;
}
LocationSummary* locations = LocationSummary::CreateNoCall(allocator, invoke, kIntrinsified);
locations->SetInAt(0, Location::RequiresFpuRegister());
locations->SetOut(Location::RequiresCoreRegister());
locations->AddTemp(Location::RequiresFpuRegister());
locations->AddTemp(Location::RequiresFpuRegister());
}
void IntrinsicLocationsBuilderX86_64::VisitMathRoundFloat(HInvoke* invoke) {
CreateSSE41FPToIntLocations(allocator_, invoke, codegen_);
}
void IntrinsicCodeGeneratorX86_64::VisitMathRoundFloat(HInvoke* invoke) {
LocationSummary* locations = invoke->GetLocations();
DCHECK(!locations->WillCall());
XmmRegister in = locations->InAt(0).AsFpuRegister<XmmRegister>();
CpuRegister out = locations->Out().AsCoreRegister<CpuRegister>();
XmmRegister t1 = locations->GetTemp(0).AsFpuRegister<XmmRegister>();
XmmRegister t2 = locations->GetTemp(1).AsFpuRegister<XmmRegister>();
NearLabel skip_incr, done;
X86_64Assembler* assembler = GetAssembler();
// Since no direct x86 rounding instruction matches the required semantics,
// this intrinsic is implemented as follows:
// result = floor(in);
// if (in - result >= 0.5f)
// result = result + 1.0f;
__ movss(t2, in);
__ roundss(t1, in, Immediate(1));
__ subss(t2, t1);
__ comiss(t2, codegen_->LiteralFloatAddress(0
__ j(kBelow,&);
_addss, codegen_->LiteralFloatAddress(1.0f));
__ Bind(&skip_incr);
// Final conversion to an integer. Unfortunately this also does not have a
// direct x86 instruction, since NaN should map to 0 and large positive
// values need to be clipped to the extreme value.
codegen_->Load32BitValue(out, kPrimIntMax);
__ cvtsi2ss(t2, out);
_ comiss(t1,t2)java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
not jumpon unordered
__ movl(out, Immediate(0 *distributed the isdistributed onan" "BASIS,
__ j(kUnordered, &done); // NaN mapped to 0 (just moved in out)
, t1)
_ (done;
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
oidIntrinsicLocationsBuilderX86_64:
include "base/bit_utilsjava.lang.StringIndexOutOfBoundsException: Range [27, 28) out of bounds for length 27
IntrinsicCodeGeneratorX86_64::VisitMathRoundDouble(HInvoke* invoke) {
LocationSummary* locations = invoke->GetLocations();
"//."
XmmRegister in = locations-java.lang.StringIndexOutOfBoundsException: Range [9, 8) out of bounds for length 30
java.lang.StringIndexOutOfBoundsException: Range [14, 13) out of bounds for length 67
XmmRegister locations>()AsFpuRegisterjava.lang.StringIndexOutOfBoundsException: Range [68, 66) out of bounds for length 70
(1)AsFpuRegisterXmmRegister(;
(;
X86_64Assemblerassembler=GetAssembler();
/ nodirect x86 roundingjava.lang.StringIndexOutOfBoundsException: Range [46, 45) out of bounds for length 77
i asfollows
// if (in - result >= 0.5)
// result = result + 1.0f;
__ movsd( CpuRegisterbase
__ roundsd(t1, in,DataType:ype ,
__ subsduint32_t data_offset java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
_comisdt2, >(.5)
_ kBelow skip_incr;
_ t1, codegen_-LiteralDoubleAddress10);
__ Bind(&skip_incr);
// Final conversion to an integer. Unfortunately this also does not have a
//x86 ,sinceNaN 0 andpositive
// values need to be clipped to the extreme value.
codegen_->Load64BitValue(out, kPrimLongMax);
__ cvtsi2sd(t2, out, /* is64bit= */ true);
__ comisd(t1, t2);
__ j(kAboveEqual, &done); // clipped to max (already in out), does not jump on unordered
_movl(out,Immediate0); // does not change flags, implicit zero extension to 64-bit
_jkUnordered,&;// NaN mapped to 0 (just moved in out)
_cvttsd2siout,t1, /* is64bit= */ true);
_ Bind&;
static void CreateFPToFPCallLocations(ArenaAllocator* allocator, HInvoke* invoke) X86_64Assembler ->(;
LocationSummaryDCHECKlocations>CanCall);
LocationSummary:Createallocator LocationSummary:,kIntrinsified;
<< "Unexpected in read barrier arraycopy slow path: "
locations->SetInAt(0, Location::FpuRegister(calling_convention.GetFpuRegisterAt(0)));
locations->SetOut(Location::FpuRegister(XMM0));
CodeGeneratorX86_64::BlockNonVolatileXmmRegisters(locations);
}
static void GenFPToFPCall(HInvoke* invoke, CodeGeneratorX86_64* codegen,
QuickEntrypointEnum entry) {
LocationSummary* locations = invoke->GetLocations();
DCHECK(locations->WillCall());
DCHECK(invoke->IsInvokeStaticOrDirect());
codegen->InvokeRuntime(entry, invoke);
}
void IntrinsicLocationsBuilderX86_64::VisitMathCos(HInvoke* invoke) {
CreateFPToFPCallLocations(allocator_, invoke);
}
void IntrinsicCodeGeneratorX86_64::VisitMathCos(HInvoke* invoke) {
GenFPToFPCall(invoke, codegen_, kQuickCos);
}
void IntrinsicLocationsBuilderX86_64::VisitMathSin(HInvoke* invoke) {
CreateFPToFPCallLocations(allocator_, invoke);
}
void IntrinsicCodeGeneratorX86_64::VisitMathSin(HInvoke* invoke) {
GenFPToFPCall(invoke, codegen_, kQuickSin);
}
void IntrinsicLocationsBuilderX86_64::VisitMathAcos(HInvoke* invoke) {
CreateFPToFPCallLocations(allocator_, invoke);
}
void IntrinsicCodeGeneratorX86_64: DCHECK(instruction_->GetLocations()->Intrinsified());
GenFPToFPCall(invoke, codegen_, kQuickAcos DCHECK_EQ(nstruction_-AsInvoke(-GetIntrinsic(), Intrinsics::kSystemArrayCopy);
}
void IntrinsicLocationsBuilderX86_64::VisitMathAsin(HInvoke* invoke) {
CreateFPToFPCallLocations(allocator_, invoke);
}
IntrinsicCodeGeneratorX86_64:VisitMathAsin(HInvoke* invoke) {
GenFPToFPCall(invoke, codegen_, kQuickAsin);
}
void const int32_t element_size :t);
(llocator_,invoke)
CpuRegisterdst_curr_addr=-GetTemp(1).AsCoreRegister<CpuRegister>();
voidIntrinsicCodeGeneratorX86_64:(HInvoke*invoke){
GenFPToFPCall(invoke, codegen_, java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 0
}
void IntrinsicLocationsBuilderX86_64::VisitMathCbrt(HInvoke* invoke) {
__ Bind(&loop);
}
void IntrinsicCodeGeneratorX86_64::VisitMathCbrt(HInvoke* invoke) {
GenFPToFPCall(invoke, codegen_, kQuickCbrt);
}
void IntrinsicLocationsBuilderX86_64:VisitMathCosh(HInvoke* invoke) {
CreateFPToFPCallLocations( // TODO: Inline the mark bit check calling the?
}
void IntrinsicCodeGeneratorX86_64: //java.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64
}
void IntrinsicLocationsBuilderX86_64::VisitMathExp(HInvoke* invoke) {
CreateFPToFPCallLocations(allocator_, invoke);
}
void IntrinsicCodeGeneratorX86_64::VisitMathExp(java.lang.StringIndexOutOfBoundsException: Range [0, 55) out of bounds for length 54
( ,;
}
void _MaybePoisonHeapReference((MP)java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
__ addl(src_curr_addr, Immediate(element_size));
}
void _ src_curr_addr,src_stop_addr);
G(invoke ,kQuickExpm1;
}
void IntrinsicLocationsBuilderX86_64::java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 3
(allocator_ )
}
void // The MethodHandle.invokeExact intrinsic sets up arguments // expects the MethodHandle object in RDI (lass InvokePolymorphicSlowPathX86_64:public {
( codegen_, kQuickLog;
}
::VisitMathLog10(*invoke) {
_Bind(etEntryLabel()
}
void IntrinsicCodeGeneratorX86_64::VisitMathLog10(HInvoke* invoke) {
GenFPToFPCall(invoke, GenFPToFPCall(invoke, codegen_
}
void const charGetDescription()const override return InvokePolymorphicSlowPathX86_64"; }
CreateFPToFPCallLocations(java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
void java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 9
GenFPToFPCall DISALLOW_COPY_AND_ASSIGN(nvokePolymorphicSlowPathX86_64
sCreateFPToIntLocations* ,java.lang.StringIndexOutOfBoundsException: Range [70, 69) out of bounds for length 80
void IntrinsicLocationsBuilderX86_64::VisitMathTan(HInvoke* invoke) {
CreateFPToFPCallLocations(allocator_, invoke);
}
void IntrinsicCodeGeneratorX86_64::VisitMathTan(HInvoke* invoke) {
java.lang.StringIndexOutOfBoundsException: Range [57, 20) out of bounds for length 57
}
void IntrinsicLocationsBuilderX86_64::VisitMathTanh(HInvoke* invoke) {
CreateFPToFPCallLocations(allocator_, invoke);
}
void IntrinsicCodeGeneratorX86_64::VisitMathTanh(HInvoke* invoke) {
GenFPToFPCall(invoke, codegen_, kQuickTanh);
}
static void CreateFPFPToFPCallLocations(ArenaAllocator* allocator, HInvoke* invoke) {
LocationSummary* }
LocationSummary::java.lang.StringIndexOutOfBoundsException: Range [0, 29) out of bounds for length 0
calling_convention
locations->SetInAt LocationSummary*locations =LocationSummary::(,invoke,kIntrinsified)
->SetInAt(,Location:FpuRegister(alling_convention(1);
->etOut(:FpuRegisterXMM0)java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
CpuRegister ,XmmRegistersrc, bool is64bit, X86_64Assembler*assembler){
}
static if is64bit {
DCHECK_EQ(-GetNumberOfArguments) 3U;
LocationSummary* locations = LocationSummary::CreateNoCall(allocator, invoke, kIntrinsified);
InvokeRuntimeCallingConvention calling_convention;
locations->SetInAt(0, Location::RequiresFpuRegister());
locations->SetInAt(1, Location::RequiresFpuRegister());
locations->SetInAt(2, Location::RequiresFpuRegister());
locations->SetOut(Location:SameAsFirstInput);
}
void IntrinsicLocationsBuilderX86_64::VisitMathAtan2 XmmRegister dst,CpuRegister src,bool java.lang.StringIndexOutOfBoundsException: Range [68, 50) out of bounds for length 81
CallLocations(allocator_, invoke);
}
void IntrinsicCodeGeneratorX86_64::VisitMathAtan2(HInvoke* java.lang.StringIndexOutOfBoundsException: Range [0, 65) out of bounds for length 10
GenFPToFPCall(invoke,codegen_,)java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 1
oid::H*invoke) java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
(allocator_, invoke);
}
void IntrinsicCodeGeneratorX86_64::VisitMathPow(HInvoke* invoke) {
GenFPToFPCall(invoke, codegen_, kQuickPow);
}
void IntrinsicLocationsBuilderX86_64::VisitMathHypot(HInvoke* invoke) {
(allocator_, invokeinvoke);
}
void IntrinsicCodeGeneratorX86_64::VisitMathHypot(HInvoke* invoke) {
,,kQuickHypot;
}
void IntrinsicLocationsBuilderX86_64
, invoke;
}
void IntrinsicCodeGeneratorX86_64::VisitMathNextAfter(HInvoke* invoke) {
GenFPToFPCall(invoke, codegen_, kQuickNextAfter);
}
static void CreateSystemArrayCopyLocations(HInvoke* invoke) {
constexpr int32_t copy_threshold = -1; // negative value means "ignore threshold"
constexpr size_t kInitialNumTemps = 0u; // we need specific temporary register (added below)
LocationSummary* locations = CodeGenerator::CreateSystemArrayCopyLocationSummary(
ns =nullptr){
// And we need some temporaries. We will use REP MOVS{B,W,L}, so we need fixed registers.
->ddTempLocation::oreRegister())
IntrinsicLocationsBuilderX86_64VisitFloatFloatToRawIntBits(Invoke invoke {
locations-AddTemp(ocation:CoreRegister();
voidIntrinsicLocationsBuilderX86_64:VisitFloatIntBitsToFloatHInvoke* invoke) {
}
template <typename LhsType>
void EmitCmplJLessX86_64Assembler ,
rhs
Label*label){
static_assert(std::is_same_v<LhsType, CpuRegister>}
()){
int32_t rhs_constant = rhs. int32_t rhs_constant = rhs.GetConstant */ false, GetAssembler)java.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 76
_ cmpllhs Immediaterhs_constant);
} else {
__ __ -SetInAt( -SetOut(Location:SameAsFirstInput()java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
}
__ j(kLess, label);
}
static CheckSystemArrayCopyPositionX8664Assembler*assembler,
CpuRegister array,
posjava.lang.StringIndexOutOfBoundsException: Range [54, 55) out of bounds for length 54
Location CreateIntToIntLocationsa )java.lang.StringIndexOutOfBoundsException: Range [46, 47) out of bounds for length 46
SlowPathCode* slow_path,
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
)
bool) {
// Where is the length in the Array?
const uint32_t length_offset = mirror::Array::LengthOffset().Uint32Value();
if codegen_->etInstructionCodegen)>(-GetLocations-Out) :Type:);
void GenIsInfiniteLocationSummary locations,
if (pos_const == 0) {
if (! is64bit
// Check that length(array) >= length.
EmitCmplJLessassembler, Addressarray,length_offset) length, slow_path-GetEntryLabel);
}else{
length(rray)-posjava.lang.StringIndexOutOfBoundsException: Range [39, 40) out of bounds for length 39
// Both operands are known to be non-negative `int32_t`, so the difference cannot underflow
// as `int32_t`. If the result is negative, the JL below shall go to the slow path. done1 done2;
__ movl(temp, Address(arrayjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
_(temp Immediate(os_const)java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
// Check that (length(array) - pos) >= length.
EmitCmplJLess,,,slow_path>()java.lang.StringIndexOutOfBoundsException: Index 73 out of bounds for length 73
_ (kNotEqual done1;
}ength){
// The only way the copy can succeed is if pos is zero.
CpuRegister_ (,Immediate(1)
(pos_reg,pos_reg;
_j(kNotEqual slow_path>()
} __ c(,codegen>();
// Check that pos >= 0.
CpuRegister, &one2;
if (!position_sign_checked_ kParityEven,)
_testlp,pos_reg);
_ (Less -GetEntryLabel)java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
}
// Calculate length(array) - pos.
/Both knowntobe non- int32_t,so
// as `int32_t`. If the result is negative, the JL below shall go to the slow path.
_( );
__ (, pos_reg);
/ that(engtharray ) >length
(,temp ,slow_path->GetEntryLabel);
}
}
static void CheckSystemArrayCopyNullOrOverlap( _ j(, &one2;
__ (utput ())
* ,
CpuRegister src,
CpuRegister dest,
Location src_posjava.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63
Locationdest_pos
Locationlength)java.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64
java.lang.StringIndexOutOfBoundsException: Range [31, 30) out of bounds for length 53
validated;
// If source and destination are the same, then the copied arrays may overlap.
/ For overlapping arrays we can only guarantee correctness if `src_pos >= dst_pos`, otherwise
// copying the elements at the beginning of source array may clobber the elements at the end.void:VisitDoubleIsInfinite*){
if(optimizations.()) {
if (src_pos
int32_tsrc_pos_constant=src_pos.->AsIntConstant()->GetValue();
if (dest_pos.IsConstant()) {
int32_t dest_pos_constant = dest_pos.GetConstant()->AsIntConstant()->GetValue();
if (optimizations.GetDestinationIsSource()) {
LocationSummary* =LocationSummary:CreateNoCallallocator ,)java.lang.StringIndexOutOfBoundsException: Range [95, 96) out of bounds for length 95
DCHECK_GElocations-SetOut(Location:RequiresFpuRegister,Location::);
}elseif src_pos_constant ){
__ cmpl(src, dest);
, slow_path-GetEntryLabel()java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
}
} LocationSu locations=invoke-GetLocations()
etDestinationIsSource(){
__ cmpl(src, dest);
__ j( XmmRegister out >().XmmRegister()
} ()-sqrtsdo,in;
_cmpl(est_posAsCoreRegisterCpuRegister>() ());
__ j(kGreater, slow_path->GetEntryLabel()*invoke,
}
} else {
if (optimizationsGetDestinationIsSource()) {
__ cmpl(src, // Do we have instructi?
__ );
turn;
CpuRegister (allocator,invoke)
void GenSSE41FPToFPIntrinsic*invoke,X86_64Assembler*,int ){
}
}
__ Bind(& DCHECK(!locations->WillCall!locations>()java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
if (!optimizations.GetSourceIsNotNull()) {
//Bailoutif source .
roundsdo,in, Immediateround_mode);
__ j(kEqual, slow_path->java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 1
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
ifvoid ::isitMathCeilHInvoke
__ testl(dest,}
__ j(kEqual, slow_path->GetEntryLabel());
}
If the is ,bail out.
}
if (length.sConstant)&java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
!.()){
__ testl(length.AsCoreRegister<CpuRegister>(), length.AsCoreRegister<CpuRegister( () ;
_ (Less, ->GetEntryLabel());
}
}
staticHInvoke* invoke,
X86_64Assembler* assembler CodeGeneratorX86_64 odegen) {
CodeGeneratorX86_64* codegen,
DataType::Type type) {
LocationSummary* java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
CpuRegister src CpuRegister src (,Location:RequiresFpuRegister);
Locationsrc_pos= locations-InAt1;
CpuRegister dest = locations->InAt(2).AsCoreRegister<CpuRegister>()}
Location IntrinsicLocationsBuilderX86_64V(HInvoke* invoke
Location length = locations-> CreateSSE41FPToIntLocations(allocator ,codegen_)
// Temporaries that we need for MOVSB/W/L.
CpuRegister src_base = = locations->GetTemp(0).AsCoreRegister<CpuRegister>();
DCHECK_EQ(src_base.AsRegister(), RSI);
CpuRegisterdest_base =-G(1)AsCoreRegister<CpuRegister(;
java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 0
CpuRegister count CpuRegister out =locations-Out(.<>)
(.(, )java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
skip_incr done;
-AddSlowPaths);
// Check that source and position are different, or if they are the same check that copy
// direction is backward. Also check for null pointers.
__ roundss(t1, in, Immediate;
invoke, _(,codegen_-(05f)
// Check that source position is within bounds. Use src_base as a temporary register.
(assemblerjava.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
,
src_pos,
length,
,
_comisst1 t2);
/*length_is_array_length=*/ false,
/*position_sign_checked=*/ false);
// Check that destination position is within bounds. Use src_base as a temporary register. done;// NaN mapped to 0 (just moved in out)
(assembler,
dest,
dest_pos}
length,
slow_path,
src_base,
ength=/false,
// We need the count in RCX.
if (length.IsConstant()) {
__ movl(count, Immediatejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
} else {
_ (, .AsCoreRegister<CpuRegister()
}
-InAt0.<XmmRegister(;
/Check thatsizeofChar used inscaling belowbelow.
data_size=DataType:Size(ype;
= ::rray:DataOffset(data_size.Uint32Value()
GenArrayAddress X86_64Assembler =GetAssembler)java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
GenArrayAddress( GenArrayAddress(assembler as :
// Do the move.
switch (type) {
case ,Immediate();
__ rep_movsb();
break;
_ subsd(t2 );
_ (;
break;
java.lang.StringIndexOutOfBoundsException: Range [18, 4) out of bounds for length 32
__ rep_movsl( /java.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 76
break;
:
LOG)< Unexpected datatype or"
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
__ ind(low_path-GetExitLabel();
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
void __ cvttsd2si(out,t1,/* is64bit= */ true);
CreateSystemArrayCopyLocations()
}
::VisitSystemArrayCopyChar(*invoke){
X86_64Assembler* assembler = GetAssembler();
SystemArrayCopyPrimitive(invoke, assembler, codegen_, DataType::Type::kUint16);
}
void IntrinsicCodeGeneratorX86_64::VisitSystemArrayCopyByte InvokeRuntimeCallingConvention ;
= ()
locations->SetOut(Location::FpuRegister(XMM0));
}
void IntrinsicLocationsBuilderX86_64:VisitSystemArrayCopyByteHInvoke* invoke){
CreateSystemArrayCopyLocations(
}
void IntrinsicCodeGeneratorX86_64::VisitSystemArrayCopyInt(HInvoke*
= (;
(invoke assembler, ,DataType:Type:kInt32)java.lang.StringIndexOutOfBoundsException: Range [80, 81) out of bounds for length 80
}
void ::(HInvoke*invoke){
CreateSystemArrayCopyLocations(invoke);
}
void IntrinsicLocationsBuilderX86_64::VisitSystemArrayCopyvoid IntrinsicCodeGeneratorX86_64:VisitMathCos(Invoke*){
// The only read barrier implementation supporting the
// SystemArrayCopy intrinsic is the Baker-style read barriers.
if codegen_-EmitNonBakerReadBarrier) java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
return;
}
constexpr int32_t kLengthThreshold = -1; // No cut-off - handle large arrays in intrinsic code.
We shallallocate .
LocationSummaryCreateFPToFPCallLocationsallocator_,invoke)java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
invoke,kLengthThreshold,);
if (locations != nullptr) {
// Add temporaries. We will use REP MOVSL, so we need fixed registers.invoke,codegen_,kQuickAcos;
DCHECK_EQ(locations->GetTempCount(,kInitialNumTemps);
-AddTemp(RSI))java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
locations-AddTemp(Location:())
locations-AddTemp(ocation:())
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
void IntrinsicCodeGeneratorX86_64::VisitSystemArrayCopy(HInvoke* invoke) {
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
// SystemArrayCopy intrinsic is the Baker-style read barriers.
GenFPToFPCall(invoke, codegen_, kQuickAtan);
X86_64Assembler*assembler =GetAssembler();
LocationSummary* IntrinsicLocationsBuilderX86_64V(*invoke){
uint32_t class_offset = java.lang.StringIndexOutOfBoundsException: Range [0, 32) out of bounds for length 1
:Class:SuperClassOffset(.Int32Value(;
uint32_t = mirror:Class::()Int32Value()
uint32_t void IntrinsicLocationsBuil:(Invoke*invoke){
uint32_t monitor_offset = mirror::Object::java.lang.StringIndexOutOfBoundsException: Range [0, 57) out of bounds for length 48
(0).CpuRegister>)java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
Location -InAt(1);
}
Location dest_pos = locations->java.lang.StringIndexOutOfBoundsException: Range [0, 37) out of bounds for length 0
Location length = locations->InAt(4);
Location temp1_loc = locations->GetTemp(0);
CpuRegister temp1 = temp1_loc.AsCoreRegister<CpuRegister>();
Location temp2_loc = locations->GetTemp(1);
CpuRegister temp2 = temp2_loc.AsCoreRegister<CpuRegister>();
Location temp3_loc = locations->GetTemp(2);
= temp3_loc.AsCoreRegister<CpuRegister>(;
SlowPathCode* =
new (codegen_->GetScopedAllocator()) IntrinsicSlowPathX86_64(invoke);
codegen_->AddSlowPath(intrinsic_slow_path);
// Check that source and position are different, or if they are the same check that copy
// direction is backward. Also check for null pointers.
CheckSystemArrayCopyNullOrOverlap(
invoke, assembler, intrinsic_slow_path, src, dest, src_pos, dest_pos, length);
SystemArrayCopyOptimizations optimizations(invoke);
// Check that source position is within bounds.
CheckSystemArrayCopyPosition(assembler,
src,
src_pos,
length,
intrinsic_slow_path,
temp1,
optimizations.GetCountIsSourceLength(),
/*position_sign_checked=*/ false);
// Check that destination position is within bounds.
bool dest_position_sign_checked = optimizations.GetSourcePositionIsDestinationPosition();
CheckSystemArrayCopyPosition(assembler,
dest,
dest_pos,
length,
intrinsic_slow_path,
temp1,
optimizationsGetCountIsDestinationLength(,
dest_position_sign_checked);
auto void :VisitMathExpm1HInvoke* invoke){
// No read barrier is needed for reading a chain of constant references for comparing
, or for reading primitive ,see``.
// /* HeapReference<Class> */ temp = klass->component_type_
__ CreateFPToFPCallLocations(allocator_, invoke);
__ java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 1
// Check that the component type is not null.
_ (emp,temp)java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
_ j(Equal,intrinsic_slow_path-GetEntryLabel()
that not a primitive.
__ cmpw(Primitive:kPrimNot))
__ j GenFPToFPCall(,codegen_,kQuickLog10)java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
}
!.GetDoesNotNeedTypeCheck(){
// Check whether all elements of the source array are assignable to the component
/ type thedestinationarray.We two :the are same,
is Object[]. If none of these checks succeed, we go to the
void IntrinsicLocationsBuilderX86_64:VisitMathTan(Invoke*invoke) java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
if (odegen_-EmitBakerReadBarrier() java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
// /* HeapReference<Class> */ temp1 = dest->klass_
codegen_->enerateFieldLoadWithBakerReadBarrier(
invoke, temp1_loc, CreateFPToFPCallLocations(allocator_ invoke)
// Register `temp1` is not trashed by the read barrier emittedIntrinsicCodeGeneratorX86_64::VisitMathTanh(Invoke* invoke) {
/byGenerateFieldLoadWithBakerReadBarrier below, as that
// method produces a call to a ReadBarrierMarkRegX entry point,
// which saves all potentially live registers, including
// temporaries such a `temp1`.
// /* HeapReference<Class> */ temp2 = src->klass_
codegen_->GenerateFieldLoadWithBakerReadBarrier(
invoke, ( invoke LocationSummary:, kIntrinsified);
// If heap poisoning is enabled, `temp1` and `temp2` have been unpoisoned
// by the previous calls to GenerateFieldLoadWithBakerReadBarrier.
else java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
// /* HeapReference<Class> */ temp1 = dest->klass_
_movl(temp1,Address(est,class_offset))
__ CodeGeneratorX86_64:BlockNonVolatileXmmRegisters(ocations);
// /* HeapReference<Class> */ temp2 = src->klass_
_ movl(, (rc,class_offset);
__ MaybeUnpoisonHeapReference(temp2);
}
__ cmpl(temp1, temp2);
if (LocationSummary =LocationSummary:CreateNoCall(,invoke, kIntrinsified;
iveArray());
NearLabel do_copy -SetInAt(,Location:RequiresFpuRegister);
skip thesource regardlessof optimization .
locationsSetInAt(,Location::());
/No read barrier for reading of references
// for comparing with null, see `ReadBarrierOption`.
// /* HeapReference<Class> */ temp1 = temp1->component_type_
_ movl(temp1,Address(, component_offset);
__ MaybeUnpoisonHeapReference(temp1);
// No need to unpoison the following heap reference load, as
ntrinsicCodeGeneratorX86_64:VisitMathAtan2(Invoke* ){
_ cmpl(Address(,super_offset) Immediate();
_ (,intrinsic_slow_path>()java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60
/Bail if the is a primitive .
if (!optimizations.java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
check_non_primitive_array_class(temp2 (,codegen_,kQuickPow)java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
}
__ Bind(&do_copy);
} else {
DCHECK(optimizations.();
}
void :VisitMathNextAfter(*invoke)
__ j( CreateFPFPToFPCallLocations(allocator_, invoke);
if (!optimizations.GetDestinationIsNonPrimitiveArray() &&
!optimizations.GetSourceIsNonPrimitiveArray()) {
check_non_primitive_array_class(temp2, CpuRegister(TMP));
}
}
} java.lang.StringIndexOutOfBoundsException: Range [56, 8) out of bounds for length 61
DCHECK.()java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62
// Bail out if the source is not a non primitive array.
// No read barrier is needed for reading a chain of constant references for comparing
a primitivevalue, R`.
// /* HeapReference<Class> */ temp1 = src->klass_ * locations=CodeGenerator:CreateSystemArrayCopyLocationSummary
_
__ MaybeUnpoisonHeapReference(temp1);
(temp1, CpuRegister();
locations-AddTempL:CoreRegister();
if (length.IsConstant() && length.GetConstant()->AsIntConstant()->GetValue() == 0) { java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
//Nullconstant :not need emit loopcode .
} else {
const DataType:Type DataType:Type:kReferencejava.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59
element_size = ::ize()java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
= :Array:DataOffset(element_size)Uint32Value)
NearLabel skip_copy_and_write_barrier _ cmpl(,Immediater));
if (!length.IsConstant()) {
__ _ (hs .<>);
_ (,label)
}
// Compute base source address, base destination address, and end
` respectively.
GenArrayAddress(assembler, temp1, src, src_pos, type, data_offset);
GenArrayAddress(,temp2, , , type, data_offset);
SlowPathCode*read_barrier_slow_path = ;
if (codegen_->EmitBakerReadBarrier()) {
// SystemArrayCopy implementation for Baker read barriers (see* slow_path,
// also CodeGeneratorX86_64::GenerateReferenceLoadWithBakerReadBarrier):
//
,
// uint32_t rb_state = Lockword(src->monitor_).ReadBarrierState();
/
// bool is_gray = (rb_state == ReadBarrier::GrayState());
// if (is_gray) {
// // Slow-path copy.
/do java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
// *dest_ptr++ = MaybePoison(ReadBarrier::Mark(MaybeUnpoison(*src_ptr++)));
// } while (src_ptr != end_ptr)// Check that length(array) >= length.
// } else {
// // Fast-path copy.
// do {
java.lang.StringIndexOutOfBoundsException: Range [10, 6) out of bounds for length 42
// } while (src_ptr != end_ptr)
// }
// }
// Given the numeric representation, it's enough to check the low bit of the rb_state.
static_assert(:NonGrayState( =0 Expectingnon-ray have 0";
static_assert(ReadBarrier::GrayState() == 1, "Expecting gray to have value _ subl(,Immediate(os_const)java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
constexpr = :kReadBarrierStateShift/kBitsPerByte;
java.lang.StringIndexOutOfBoundsException: Range [5, 6) out of bounds for length 5
// Theonly can succeed is if pos is zero.
// if (rb_state == ReadBarrier::GrayState())
// goto slow_path;
/ At this point, just do the "if" and make sure that flags are preserved until the branch.
_testb(ddress(src ),Immediate(test_value);
// Load fence to prevent load-load reordering.
// Note that this is a no-op, thanks to the x86-64 memory model.
codegen_-GenerateMemoryBarrierM::LoadAny)
`src` is .
java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 5
new (odegen_-GetScopedAllocator())ReadBarrierSystemArrayCopySlowPathX86_64(invoke);
codegen_->AddSlowPath(read_barrier_slow_path);
// We have done the "if" of the gray bit check above, now branch based on the flags.
__ j(kNotZero, read_barrier_slow_path->GetEntryLabel());
}
if (length.IsConstant()) {
__ movl(temp3, Immediate(length.GetConstant()->AsIntConstant()->GetValue()));
} else {
__ movl(temp3, length.AsCoreRegister<CpuRegister>());
}
// Iterate over the arrays and do a raw copy of the objects. We don't need to poison/unpoison.
DCHECK_EQ(temp1.AsRegister(), RSI);
DCHECK_EQ(temp2.AsRegister(), RDI);
DCHECK_EQ(temp3.AsRegister(), RCX);
__ rep_movsl();
if (read_barrier_slow_path != nullptr) {
DCHECK(codegen_->EmitBakerReadBarrier());
__ Bind(read_barrier_slow_path->GetExitLabel());
}
// We only need one card marking on the destination array.
codegen_->MarkGCCard(temp1, temp2, dest);
__ Bind(&skip_copy_and_write_barrier);
}
__ Bind(intrinsic_slow_path->GetExitLabel());
}
void IntrinsicLocationsBuilderX86_64::VisitStringCompareTo(HInvoke* invoke) {
LocationSummary* locations = LocationSummary::Create(
allocator_, invoke, LocationSummary::kCallOnMainAndSlowPath, kIntrinsified);
InvokeRuntimeCallingConvention calling_convention;
locations->SetInAt(0, Location::CoreRegister(calling_convention.GetRegisterAt(0)));
locations->SetInAt(1, Location::CoreRegister(calling_convention.GetRegisterAt(1)));
locations->SetOut(Location::CoreRegister(RAX));
}
void IntrinsicCodeGeneratorX86_64::VisitStringCompareTo(HInvoke* invoke) {
X86_64Assembler* assembler = GetAssembler();
LocationSummary* locations = invoke->GetLocations();
// Note that the null check must have been done earlier.
DCHECK(!invoke-CanDoImplicitNullCheckOn(invoke-InputAt(0)));
CpuRegister argument = locations- _ (temp,Address(rray,length_offset));
_testl(argument, argument)
java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 0
codegen_>();
__ j(kEqual, slow_path->GetEntryLabel());
codegen_->InvokeRuntime
->GetExitLabel());
}
) {
LocationSummary* locations = LocationSummary::CreateNoCall(allocator_ * slow_path,
ocations-SetInAt(,Location:RequiresCoreRegister);
-SetInAt(1,Location:R())
/ Request temporary registers, RCX and RDI needed for repe_cmpsq instruction.
-AddTemp(Location:CoreRegister(RCX);
locations->AddTemp(Location::CoreRegister(RDI));
/ Set output, RSI needed for repe_cmpsq instruction anyways.
locations->SetOut(Location::CoreRegister(RSI), Location::kOutputOverlap);
}
void IntrinsicCodeGeneratorX86_64::VisitStringEquals(HInvoke* invoke) {
X86_64Assembler* assembler = GetAssembler();
LocationSummary* locations = invoke->GetLocations();
CpuRegister str = locations->InAt(0).AsCoreRegister<CpuRegister>();
CpuRegister arg = locations->InAt(1).AsCoreRegister<CpuRegister>();
CpuRegister rcx = locations->GetTemp(0).AsCoreRegister<CpuRegister>();
CpuRegister rdi = locations-> // If source and destination are the same, then the copied arrays may overlap.
CpuRegister rsi = locations- / copying the elements at the beginning of source array may clobber the elements at the end.
NearLabel , return_true, ;
, value,and class fields within a string object.
const uint32_t count_offset = mirror::String::CountOffset().Uint32Value();
const uint32_t value_offset = mirror::String::ValueOffset().Uint32Value();
const uint32_t class_offset = mirror::Object::ClassOffset().Uint32Value();
// Note that the null check must have been done earlier.
DCHECK(!invoke->(invoke->nputAt0);
StringEqualsOptimizations optimizations(invoke);
if (!optimizations. int32_t dest_pos_constant dest_pos.)-AsIntConstant)>etValue(;
// Check if input is null, return false if it is.
__ testl(arg, arg); (rc_pos_constant,);
_j(kEqual, &eturn_false);
_ (rc,dest)
if }else java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
/ Instanceof check for the argument by comparing class fields.
// All string objects must have the same type since String cannot be subclassed.
// Receiver must be a string object, so its class field is equal to all strings' class fields.
// If the argument is a string object, its class field must be equal to receiver's class field.
//
// As the String class is expected to be non-movable, we can read the class
/ field from String.equals' arguments without read barriers.
AssertNonMovableStringClass (optimizations.etDestinationIsSource) java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
// Also, because we use the loaded class references only to compare them, we
// don't need to unpoison them.
// /* HeapReference<Class> */ rcx = str->klass_src_pos_reg = src_pos.AsCoreRegister<CpuRegister>(;
__ movl(rcx, Address(str, class_offset));
// if (rcx != /* HeapReference<Class> */ arg->klass_) return false
__ cmpl(rcx, Address(arg, class_offset));
__ j(kNotEqual, &return_false);
}
// Reference equality check, return true if same reference.
__ cmpl(str, arg);
_ j(kEqual,)
/Load length and compression flag receiver .
__ movl(,Address(tr ))
__ testl(src,src)java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
/ stringswill always
// compression style is decided on alloc. if !optimizations.( &!.()){
__ cmpl(rcx, Address _()java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
__ j(kNotEqual
// Return true if both strings are empty. Even with string compression `count == 0` means empty.
if (!length.I()&&
"Expecting 0=compressed, 1=uncompressed");
__ jrcxz(&return_true);
if (mirror::kUseStringCompression) {
;
// Extract length and differentiate between both compressed or both uncompressed.()){
__ shrl( j(Less,slow_path>();
__ j(}
// Divide string length by 2, rounding up, and continue as if uncompressed.
// Merge clearing the compression flag with +1 for rounding. void (HInvoke*invoke,
__ addl(rcx, Immediate(1));
__ shrl(rcx, Immediate(1));
__ Bind(&string_uncompressed);
}
// Load starting addresses of string values into RSI/RDI as required for repe_cmpsq instruction.*locations invoke-();
_ (,Address(,value_offset
__ leal(rdi, Address(arg, value_offset));
/ Divide string length by 4 and adjust for lengths not divisible by 4.
__ addl(rcx, Immediate(3));
_ shrl(cx,Immediate();
/ Assertions that must hold in order to compare strings 4 characters (uncompressed)
(compressed) at a time.
// Temporaries that we need for MOVSB/W/L.
(IsAligned<>kObjectAlignment) Stringis not zero padded";
// Loop to compare strings four characters at a time starting at the beginning of the string.
__ repe_cmpsq();
// If strings are not equal, zero flag will be cleared.
__ j(kNotEqual, &return_false);
// Return true and exit the function.
// If loop does not result in false,we true.
__ Bind(&return_true);
_ (si,Immediate();
_ (&end;
// Return false and exit the function.
__ Bind(&return_false);
__ (,rsi)
__ Bind(& // direction is backward. Also check for null pointers.
} ,assembler,,src,dest ,dest_pos )
static void CreateStringIndexOfLocations(HInvoke* invoke,
ArenaAllocator*allocator,
bool start_at_zero) {
* java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
java.lang.StringIndexOutOfBoundsException: Range [65, 31) out of bounds for length 65
// The data needs to be in RDI for scasw. So request that the string is there, anyways.
-SetInAt(,:C(RDI);
// If we look for a constant char, we'll still have to copy it into RAX. So just request the
java.lang.StringIndexOutOfBoundsException: Range [0, 74) out of bounds for length 36
// of the instruction explicitly.
// Note: This works as we don't clobber RAX anywhere.,
locations->SetInAt(1, Location::CoreRegister( java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
if (!start_at_zero) {
locations->SetInAt(2, Location::java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 28
}
// As we clobber RDI during execution anyways, also use it as the output.
locationscount .<>);
//repne asthe.
locations / Okay, everything checks out. Finally time to do the copy.
// Need another temporary to be able to compute the result.
>(ocation:();
constuint32_t :Array:.Uint32Value(;
void (HInvoke*invokejava.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
X86_64Assembler* assembler,
java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 33
bool start_at_zero;
LocationSummary _ (;
(ATAL)<<" "
DCHECK(!invoke-> __ Bind(slow_path->GetExitLabel;
string_obj locations-InAt0.<>();
CpuRegister search_value = locations->InAt(1).AsCoreRegister<CpuRegister>();
CpuRegister =locations-GetTemp0.<>)
CpuRegister IntrinsicCodeGeneratorX86_64VisitSystemArrayCopyCharH*invoke java.lang.StringIndexOutOfBoundsException: Index 78 out of bounds for length 78
= -Out).AsCoreRegister<puRegister>)
void IntrinsicCodeGeneratorX86_64::VisitSystemArrayCopyByte(HInvoke* invoke) {
(string_obj.(, RDI)
java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 0
DCHECK_EQ(counter.AsRegister(), RCX) (;
DCHECK_EQ
// Check for code points > 0xFFFF. Either a slow-path check when we don't know statically,
// or directly dispatch for a large constant, or omit slow-path for a small constant or a char.
*slow_path=nullptr;
HInstruction* code_point = invoke->InputAt(1);
if (code_point->IsIntConstant_64::(HInvoke ){
if (static_cast<uint32_t>(code_pointCreateSystemArrayCopyLocations)
java.lang.StringIndexOutOfBoundsException: Range [15, 6) out of bounds for length 94
// rare, so for simplicity just put the full slow-path down and branch unconditionally.
slow_path = new (codegen->GetScopedAllocator()) IntrinsicSlowPathX86_64(invoke);
codegen->AddSlowPath(slow_path);
__ jmp(slow_path->GetEntryLabel());
__ Bind(slow_path->GetExitLabel());
return;
}
} else if ( } else if (code_point implementation supporting
__ cmpl( (codegen_->EmitNonBakerReadBarrier) {
slow_path = new (codegen->java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 11
codegen>AddSlowPathslow_path)
0u /java.lang.StringIndexOutOfBoundsException: Index 81 out of bounds for length 81
// From here down, we know that we are looking for a char that fits in
// 16 bits (uncompressed) or 8 bits (compressed).
// Location of reference to data array within the String object.
int32_t value_offset = mirror::String::ValueOffset().Int32Value();
locations->AddTemp(Location::CoreRegister(RSI));
locations>ddTemp(:CoreRegister(DI)java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
// Load the count field of the string containing the length and compression flag.
));
// Do a zero-length check. Even with string compression `count == 0` means empty.
// TODO: Support jecxz.
NearLabel not_found_label;
(string_length );
__ j(kEqual, ¬_found_label);
if (mirror::kUseStringCompression) {
// Use TMP to keep string_length_flagged.
__ movl(CpuRegister(TMP), string_length);
// Mask out first bit used as compression flag.
__ shrl(string_length, Immediate(1));
}
if (start_at_zero) {
// Number of chars to scan is the same as the string length.
__ movl(counter, string_length);
// Move to the start of the string.
__ addq(string_obj, Immediate(value_offset));
} else {
CpuRegister start_index = locations->InAt(2).AsCoreRegister<CpuRegister>();
// Do a start_index check.uint32_tsuper_offset =mirror:::uperClassOffset()Int32Value)java.lang.StringIndexOutOfBoundsException: Range [73, 74) out of bounds for length 73
__ cmpl(start_index, string_length);
_ j(java.lang.StringIndexOutOfBoundsException: Range [23, 22) out of bounds for length 42
// Ensure we have a start index >= 0;
__ xorl(counter, counter);
__ cmpl(start_index, Immediate(0));
__ cmov(kGreater, counter, start_index, /* is64bit= */ false); // 32-bit copy is enough.
if (mirror::kUseStringCompression) {
NearLabel modify_counter, offset_uncompressed_label;
__ testl(CpuRegister(TMP), Immediate(1));
__ j(kNotZero, &offset_uncompressed_label);
__ leaq(string_obj, Address(string_obj, counter, ScaleFactor::TIMES_1, value_offset));
__ jmp(&modify_counter);
// Move to the start of the string: string_obj + value_offset + 2 * start_index.
__ Bind(&offset_uncompressed_label);
__ leaq(string_obj, Address(java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
__ Bind(&modify_counter);
} {
__ leaq(string_obj, Address(string_obj, counter, ScaleFactor::TIMES_2, value_offset));
}
// Now update ecx, the work counter: it's gonna be string.length - start_index.
__ negq( length=-InAt4;
_leaq(ounter,Addresss,counter :TIMES_1, 0)java.lang.StringIndexOutOfBoundsException: Index 79 out of bounds for length 79
}
if (mirror::kUseStringCompression) {
NearLabel ;
NearLabel comparison_done;
__ testl(CpuRegister(TMP), Immediate(1));
__ j(kNotZero, &uncompressed_string_comparison);
// Check if RAX (search_value) is ASCII.
__ cmpl(search_value, Immediate(127 Location temp3_loc =locations->GetTemp(2);
__ j(kGreater, ¬_found_label);
// Comparing byte-per-byte.
__ repne_scasb();
_jmp(comparison_done;
/ Everything is up repne:
// * Comparison address in RDI.
-AddSlowPathintrinsic_slow_path;
__ Bind(&uncompressed_string_comparison);
__ repne_scasw();
__ Bind(&comparison_done);
} else {
__ repne_scasw();
}
// Did we find a match?
__ j(kNotEqual, ¬_found_label);
// Yes, we matched. Compute the index of the result.
__ subl(string_length, counter);
__ leal(out, Address(string_length, -1));
NearLabel done;
__ jmp(&done);
// Failed to match; return -1.
__ Bind(¬_found_label);
__ movl(out, Immediate(-1));
// And join up at the end.
__ Bind(&done);
if (slow_path != nullptr) {
__ Bind(slow_path->GetExitLabel());
}
}
void IntrinsicLocationsBuilderX86_64::VisitStringIndexOf(HInvoke* invoke) {
CreateStringIndexOfLocations(invoke, allocator_, /* start_at_zero= */ true);
}
void IntrinsicCodeGeneratorX86_64::VisitStringIndexOf(HInvoke* invoke) {
GenerateStringIndexOf(invoke, GetAssembler(), codegen_, /* start_at_zero= */ true);
}
void IntrinsicLocationsBuilderX86_64::VisitStringIndexOfAfter(HInvoke* invoke) {
CreateStringIndexOfLocations(invoke, allocator_, /* start_at_zero= */ false);
}
void IntrinsicCodeGeneratorX86_64::VisitStringIndexOfAfter(HInvoke* invoke) {
GenerateStringIndexOf(invoke, GetAssembler(), codegen_, /* start_at_zero= */ false);
}
void IntrinsicLocationsBuilderX86_64::VisitStringNewStringFromBytes(HInvoke* invoke) {
LocationSummary* locations = LocationSummary::Create(
allocator_, invoke, ::CallOnMainAndSlowPath, kIntrinsified;
InvokeRuntimeCallingConvention calling_convention;
locations->SetInAt(0, Location::CoreRegister(calling_convention.GetRegisterAt(0)));
locations->SetInAt(1, Location::CoreRegister / direction is backward. Also check for null pointers.
locations->SetInAt(2, Location:: invoke, assembler, intrinsic_slow_path, ,dest , ,length;
locations-SetInAt(3, Location::CoreRegister(calling_convention.GetRegisterAt(3)));
locations->SetOut(Location::CoreRegister(RAX));
}
void src
X86_64Assembler* assembler = GetAssembler();
LocationSummary* locations = invoke- ,
CpuRegisterbyte_array=locations-InAt<>(;
__ testl(byte_array, byte_array);
SlowPathCode* slow_path = new (codegen_->GetScopedAllocator()) IntrinsicSlowPathX86_64(invoke);
codegen_->AddSlowPath(slow_path);
__ j(kEqual, slow_path->GetEntryLabel());
codegen_->InvokeRuntime(java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 0
CheckEntrypointTypes<kQuickAllocStringFromBytes, void*, void*, int32_t, int32_t, int32_t>();
__ Bind(slow_path->GetExitLabel());
}
void IntrinsicLocationsBuilderX86_64::VisitStringNewStringFromChars(HInvoke* invoke) {
LocationSummary* locations =
LocationSummary::Create(allocator_, invoke, LocationSummary::kCallOnMainOnly, kIntrinsified);
InvokeRuntimeCallingConvention calling_convention;
locations->SetInAt(0, Location::CoreRegister(calling_convention.GetRegisterAt(0)));
locations->SetInAt(1, Location::CoreRegister(calling_convention.GetRegisterAt(1)));
locations->SetInAt(2, Location::CoreRegister(calling_convention.GetRegisterAt(2)));
(Location:CoreRegister(RAX));
}
void IntrinsicCodeGeneratorX86_64::VisitStringNewStringFromChars(void IntrinsicCodeGeneratorX86_64::VisitStringNewStringFromChars(HInvoke
// No need to emit code checking whether `locations->InAt(2)` is a nulldest_pos
// pointer, as callers of the native method
//
ingFromCharsint ,int,char[ data)
//
// all include a null check on `data` before calling that method.
codegen_->InvokeRuntime
<kQuickAllocStringFromCharsvoid,,int32_t void*(;
} // No read barrier is needed for reading a chain of constant references for comparing
void IntrinsicLocationsBuilderX86_64 _ (,Addressklass component_offset);
LocationSummary*locations=LocationSummary:Createjava.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
allocator_, invoke, LocationSummary::kCallOnMainAndSlowPath // Check that the component type is not a primitive.
InvokeRuntimeCallingConvention calling_convention;
locations->SetInAt(0, Location::CoreRegister(calling_convention.GetRegisterAt(0)));
locations->SetOut(Location::CoreRegister(RAX));
}
void IntrinsicCodeGeneratorX86_64::VisitStringNewStringFromString(HInvoke* invoke) {
X86_64Assembler* assembler = GetAssembler();
LocationSummary* locations = invoke->GetLocations();
CpuRegister string_to_copy = locations->InAt(0).AsCoreRegister<CpuRegister>();
__ testl(string_to_copy, string_to_copy);
SlowPathCode* slow_path = new (codegen_->GetScopedAllocator() IntrinsicSlowPathX86_64(java.lang.StringIndexOutOfBoundsException: Range [97, 98) out of bounds for length 97
codegen_-()
__ j(java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
codegen_->InvokeRuntime(kQuickAllocStringFromString, // type of the destination array. We do two checks: the thesame,
CheckEntrypointTypes<java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 17
_ (low_path-());
}
void IntrinsicLocationsBuilderX86_64:: invoke ,dest class_offset/ = * )java.lang.StringIndexOutOfBoundsException: Index 80 out of bounds for length 80
// public void getChars(int srcBegin, int srcEnd, char[] dst, int dstBegin);
LocationSummary* locations = // which saves all potentially live registers, including
locations->SetInAt(0, Location::RequiresCoreRegister());
locations->SetInAt(2, Location::codegen_->GenerateFieldLoadWithBakerReadBarrier
locations-SetInAt(3,Location:RequiresCoreRegister);
// Ifheappoisoning is ,`temp1` and `temp2` have been
// And we need some temporaries. We will use REP MOVSW, so we need fixed registers.
locations->AddTemp(Location::CoreRegister(RSI)) __movl(,Address(est,class_offset)java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
locations->AddTemp(Location::CoreRegister_ (temp2 (,class_offset)java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
locations->AddTemp(
}
java.lang.StringIndexOutOfBoundsException: Range [24, 4) out of bounds for length 80
LocationSummary* _j(Equal,&)
= DataType:SizeD:Type::kUint16;
// Location of data in char array buffer.
const // /* HeapReference
//Location of chararraydatainstring
::String:ValueOffset).Uint32Value(;
// we're comparing against null.
CpuRegister __cmpl(ddresst,),(0);
->nAt()java.lang.StringIndexOutOfBoundsException: Range [41, 42) out of bounds for length 41
intsrcBegin_valuejava.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
srcBegin.IsConstant() ? srcBegin }
CpuRegister srcEnd = java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 12
CpuRegister dst=locations>()AsCoreRegisterCpuRegister>()
CpuRegisterdstBegin java.lang.StringIndexOutOfBoundsException: Range [35, 34) out of bounds for length 74
// Check assumption that sizeof(Char) is 2 (used in scaling below).
const size_t char_size = DataType::Size(if (!optimizations.GetDestinationIsNonPrimitiveArray
(char_size,2)java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
NearLabel done;
ute chars (words) to move.
__ movl(CpuRegister(RCX), srcEnd);
if (srcBegin.IsConstant()) {
__ subl(CpuRegister(RCX), Immediate(srcBegin_value));
} else {
DCHECK(srcBegin.IsCoreRegister());
__ subl(CpuRegister(RCX), srcBegin.AsCoreRegister<CpuRegister>());
}
if (mirror::kUseStringCompression) {
NearLabel copy_uncompressed, copy_loop;
const size_t c_char_size = DataType::Size(DataType::Type::kInt8);
DCHECK_EQ(c_char_size, 1u);
// Location of count in string.
const uint32_t count_offset = mirror::String::CountOffset().Uint32Value();
__ testl(Address(obj, count_offset), Immediate(1));
static_assert(static_cast<uint32_t>(mirror::StringCompressionFlag::kCompressed) == 0u,
"Expecting 0=compressed, 1=uncompressed");
__ j(kNotZero, ©_uncompressed);
// Compute the address of the source string by adding the number of chars from
// the source beginning to the value offset of a string.
__ leaq(CpuRegister(RSI),
CodeGeneratorX86_64::ArrayAddress(obj, srcBegin, TIMES_1, value_offset));
// Start the loop to copy String's value to Array of Char.
__ leaq(CpuRegister(RDI), Address(dst, dstBegin, ScaleFactor::TIMES_2, data_offset));
__ Bind(©_loop);
__ jrcxz(&done);
// Use TMP as temporary (convert byte from RSI to word).
// TODO: Selecting RAX as the temporary and using LODSB/STOSW.
__ movzxb(CpuRegister(TMP), Address(CpuRegister(RSI), 0));
__ movw(Address(CpuRegister(RDI), 0), CpuRegister(TMP));
__ leaq(CpuRegister(RDI), Address(CpuRegister(RDI), char_size));
__ leaq(CpuRegister(RSI), Address(CpuRegister(RSI), c_char_size));
// TODO: Add support for LOOP to X86_64Assembler.
__ subl(CpuRegister(RCX), Immediate(1));
__ jmp(©_loop);
__ Bind(©_uncompressed);
}
__ leaq(CpuRegister(RSI),
CodeGeneratorX86_64::ArrayAddress(obj, srcBegin, TIMES_2, value_offset));
// Compute the address of the destination buffer.
__ leaq(CpuRegister(RDI), Address(dst, dstBegin, ScaleFactor::TIMES_2, data_offset));
// Do the move.
__ rep_movsw();
__ Bind(&done);
}
static void GenPeek(LocationSummary* locations, DataType::Type size, X86_64Assembler* assembler) {
CpuRegister address = locations->InAt(0).AsCoreRegister<CpuRegister>();
CpuRegister out = locations->Out().AsCoreRegister<CpuRegister>();
// x86 allows unaligned access. We do not have to check the input or use specific instructions
// to avoid a SIGBUS.
switch (size) {
case DataType::Type::kInt8:
__ movsxb(out, Address(address, 0));
break;
case DataType::Type::kInt16:
__ movsxw(out, Address(address, 0));
break;
case DataType::Type::kInt32:
__ movl(out, Address(address, 0));
break;
case DataType::Type::kInt64:
__ movq(out, Address(address, 0));
break;
default:
LOG(FATAL) << "Type not recognized for peek: " << size;
UNREACHABLE();
}
}
void IntrinsicLocationsBuilderX86_64::VisitMemoryPeekByte(HInvoke* invoke) {
CreateIntToIntLocations(allocator_, invoke);
}
void IntrinsicCodeGeneratorX86_64::VisitMemoryPeekByte(HInvoke* invoke) {
GenPeek(invoke->DCHECK(optimizations.GetDestinationIsNonPrimitiveArray);
}
void IntrinsicLocationsBuilderX86_64::VisitMemoryPeekIntNative(HInvoke* invoke) {
CreateIntToIntLocations( // No read barrier is neededfor reading a chain of constant references for comparing
}
void IntrinsicCodeGeneratorX86_64::VisitMemoryPeekIntNative(HInvoke* invoke) {
GenPeek(invoke->GetLocations(), DataType::Type::kInt32, GetAssembler());
}
void IntrinsicLocationsBuilderX86_64::VisitMemoryPeekLongNative(HInvoke* invoke) {
CreateIntToIntLocations(allocator_, invoke);
}
void IntrinsicCodeGeneratorX86_64::VisitMemoryPeekLongNative(HInvoke* invoke) {
GenPeek(invoke->GetLocations(), DataType::Type::kInt64, GetAssembler());
}
void IntrinsicLocationsBuilderX86_64::VisitMemoryPeekShortNative(HInvoke* invoke __movl(emp1,Addresss,c))
CreateIntToIntLocations(allocator_, invokecheck_non_primitive_array_class(emp1,CpuRegister((TMP));
}
voidIntrinsicCodeGeneratorX86_64:(HInvoke*invoke) {
GenPeek(nvoke>() DataType::ype:kInt16,()java.lang.StringIndexOutOfBoundsException: Range [74, 75) out of bounds for length 74
}
static void CreateIntIntToVoidLocations(ArenaAllocator* allocator, HInvoke* invoke) {
LocationSummary* locations = LocationSummary:: NearLabel ;
locations->SetInAt(0, Location::RequiresCoreRegister( _testl(ength.<>) .AsCoreRegisterCpuRegister>);
locations->SetInAt(1, Location: }
}
static void GenPoke( // source address in `temp1`
= locations-InAt().sCoreRegister<puRegister(;
Location value = locations->InAt(1);
or use
// to avoid a SIGBUS.
switch (size) if codegen_-EmitBakerReadBarrier) {
case DataType::Type::kInt8:
if value.sConstant(){
__ movb(Address //
} else {
// ;/ orartificialdata topreventloadload
}
break // // Slow-path copy.
DataType:Type::
///Fastpathcopy
__ movw(Address(address // *dest_ptr++ = *src_ptr++;
Immediate(CodeGenerator::GetInt16ValueOf(java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 12
}elsejava.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
_ ((,0,.<CpuRegister>);
}
break;
DataType:ype:kInt32
if (alue.() java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
_ movl(address,0)
Immediate
} else {
}
break;
case DataType::Type::
if (value.IsConstant()) {
v=value.(-AsLongConstant(;
DCHECK(IsInt<32>(v));
int32_t v_32 = v;
__ movq( =
} else {
_movqAaddress 0) .<>())
break;
default:
LOG) < "Type not for poke:" < java.lang.StringIndexOutOfBoundsException: Range [61, 60) out of bounds for length 61
UNREACHABLE();
}
}
void::isitMemoryPokeByteHInvoke* invoke java.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 76
CreateIntIntToVoidLocations
}
void::(
->GetLocations),DataType::kInt8 ()java.lang.StringIndexOutOfBoundsException: Range [73, 74) out of bounds for length 73
}
voidDCHECKcodegen_-EmitBakerReadBarrier()
(allocator_ )
}
void codegen_->MarkGCCard,temp2dest;
GenPoke(invoke->GetLocations(), DataType::Type::kInt32, GetAssembler());
}
void
CreateIntIntToVoidLocationsallocator_,)java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
} java.lang.StringIndexOutOfBoundsException: Range [37, 36) out of bounds for length 77
invoke) {
(,:Typek ())java.lang.StringIndexOutOfBoundsException: Range [74, 75) out of bounds for length 74
}
:java.lang.StringIndexOutOfBoundsException: Range [65, 64) out of bounds for length 83
CreateIntIntToVoidLocations(allocator_, invoke);
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
void IntrinsicCodeGeneratorX86_64: assembler =java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
GenPoke(invoke->java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 0
}(invoke-CanDoImplicitNullCheckOninvoke>InputAt();
* invoke) java.lang.StringIndexOutOfBoundsException: Index 81 out of bounds for length 81
LocationSummarySslow_path = new (codegen_->GetScopedAllocator() IntrinsicSlowPathX86_64i)
locations->SetOut(Location: __j(,-GetEntryLabel)java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
}
_Binds-()
CpuRegisterjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
GetAssembler()-> LocationSummary* l =:CreateNoCall(;
:(:<(,
no_rip /true)
}
static void GenUnsafeGet(HInvoke* invoke,
DataType::Type type,
[[maybe_unused]] bool locations->SetOut(Location::CoreRegister(RSI), Location:)
CodeGeneratorX86_64*void :( ){
X86_64Assembler* assembler = *=-(;
LocationSummary* locations = invoke->GetLocations();
Locationbase_loc -(java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
CpuRegister base = base_loc.AsCoreRegister< CpuRegister rcx = locations->GetTemp(0).AsCoreRegister<CpuRegister>();
_ locations-InAt(2)
= .<CpuRegister>()java.lang.StringIndexOutOfBoundsException: Range [64, 65) out of bounds for length 64
Location output_loc = locations->Out();
CpuRegister output = output_loc.AsCoreRegister<CpuRegister>( =mirror:String:)(;
switch t) {
::kInt8
__ movsxb(output / Note that the null check must have been done earlier.
;
case DataType::Typeif(optimizations.()java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
__ movl(output, Address(java.lang.StringIndexOutOfBoundsException: Range [0, 34) out of bounds for length 32
break;
caseDataType:kReference{
if (codegen//Instanceof for theargument by fields.
if (kUseBakerReadBarrier) {
Address src(base, offset, ScaleFactor::TIMES_1, 0)
codegen->GenerateReferenceLoadWithBakerReadBarrier(
invoke, /field from .quals withoutreadbarriers
} else {
// don't need to unpoison them.
codegen->GenerateReadBarrierSlow(
invoke, output_loc, /if (cx! /* HeapReference<Class> */ arg->klass_) return false
}
} else {
__ movl(output, Address(base, offset, ScaleFactor::TIMES_1, 0));
__ MaybeUnpoisonHeapReference(output);
}
break;
}
case DataType::Type::kInt64:
__ movq(output, Address(base, offset, ScaleFactor::TIMES_1, 0));
break;
default:
LOG(FATAL) << "Unsupported op size " << type;
UNREACHABLE();
}
}
static void GenUnsafeGetAbsolute(HInvoke* invoke,
DataType::Type type,
CodeGeneratorX86_64* codegen) {
X86_64Assembler* assembler = down_cast<X86_64Assembler*>(codegen->GetAssembler());
LocationSummary* locations = invoke->GetLocations();
Location address_loc = locations->InAt(1);
Address address = Address(address_loc.AsCoreRegister<CpuRegister>(), 0);
Location output_loc = locations->Out();
CpuRegister output = output_loc.AsCoreRegister<CpuRegister>();
switch (type) {
case DataType::Type::kInt8:
__ movsxb(output, address);
break;
case DataType::Type::kInt32:
__ movl(output, address);
break;
case DataType::Type::kInt64:
__ movq(output, address);
break;
default:
LOG(FATAL) << "Unsupported op size " << type;
UNREACHABLE();
}
}
static void CreateIntIntToIntLocations(ArenaAllocator* allocator, HInvoke* invoke) {
LocationSummary* locations = LocationSummary::CreateNoCall(allocator, invoke, kIntrinsified);
locations->SetInAt(0, Location::NoLocation()); // Unused receiver.
locations->SetInAt(1, Location::RequiresCoreRegister());
locations->SetOut(Location::RequiresCoreRegister(), Location::kNoOutputOverlap);
}
static void CreateIntIntIntToIntLocations(ArenaAllocator* allocator,
HInvoke* invoke,
const CodeGeneratorX86_64* codegen) {
bool can_call = codegen->EmitReadBarrier() && IsUnsafeGetReference(invoke);
LocationSummary* locations = LocationSummary::Create(
allocator,
invoke,
can_call ? LocationSummary::kCallOnSlowPath : LocationSummary::kNoCall,
kIntrinsified);
if (can_call && kUseBakerReadBarrier) {
locations->SetCustomSlowPathCallerSaves(RegisterSet::Empty()); // No caller-save registers.
}
locations->SetInAt(0, Location::NoLocation()); // Unused receiver.
locations->SetInAt(1, Location::RequiresCoreRegister());
locations->SetInAt(2, Location::RequiresCoreRegister());
locations-> __ shrl(rcx (rcx1)
(can_call ? Location::kOutputOverlap : Location::kNoOutputOverlap));
}
void IntrinsicLocationsBuilderX86_64:: }
VisitJdkUnsafeGet(invoke);
}
void :*
VisitJdkUnsafeGetAbsolute(invoke);/java.lang.StringIndexOutOfBoundsException: Index 73 out of bounds for length 73
}
voidIntrinsicLocationsBuilderX86_64:VisitUnsafeGetVolatile(*invoke){
VisitJdkUnsafeGetVolatile(invoke);
}
void /or 8( tatimejava.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
VisitJdkUnsafeGetLong(invoke);
}
void // Loop to compare strings time starting at .
VisitJdkUnsafeGetLongVolatile(invoke);
}
void IntrinsicLocationsBuilderX86_64::java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 33
VisitJdkUnsafeGetReference(invoke);
}
void __ Bind(&return_truejava.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 15
}
void _ Bind(&return_false
VisitJdkUnsafeGetByte();
}
void IntrinsicLocationsBuilderX86_64
CreateIntIntIntToIntLocations(static void CreateStringIndexOfLocations(HInvoke* invoke,
}
void IntrinsicLocationsBuilderX86_64:
java.lang.StringIndexOutOfBoundsException: Range [40, 39) out of bounds for length 49
}
void // The data needs to beRDIforscasw. s,.
CreateIntIntIntToIntLocations(allocator_, invoke, codegen_);
}
void java.lang.StringIndexOutOfBoundsException: Range [61, 38) out of bounds for length 61
void GenerateStringIndexOf
}
void IntrinsicLocationsBuilderX86_64::VisitJdkUnsafeGetLong(HInvoke* java.lang.StringIndexOutOfBoundsException: Index 74 out of bounds for length 55
CreateIntIntIntToIntLocations(allocator_, invoke, codegen_);
}
void :VisitJdkUnsafeGetLongVolatileHInvoke invoke) {
java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 0
}
void:java.lang.StringIndexOutOfBoundsException: Range [67, 66) out of bounds for length 85
java.lang.StringIndexOutOfBoundsException: Range [32, 31) out of bounds for length 62
}
void IntrinsicLocationsBuilderX86_64::VisitJdkUnsafeGetReference(HInvoke* invoke) {
CreateIntIntIntToIntLocations(allocator_ CpuRegister out =locations-Out)>;
}
void IntrinsicLocationsBuilderX86_64::VisitJdkUnsafeGetReferenceVolatile(HInvoke* invoke) {
CreateIntIntIntToIntLocations(allocator_, invoke, codegen_);
}
java.lang.StringIndexOutOfBoundsException: Range [37, 36) out of bounds for length 90
CreateIntIntIntToIntLocations(allocator_, invoke, java.lang.StringIndexOutOfBoundsException: Range [0, 60) out of bounds for length 0
}
void IntrinsicLocationsBuilderX86_64:: java.lang.StringIndexOutOfBoundsException: Range [19, 17) out of bounds for length 54
(allocator_,invoke codegen_)
}
void IntrinsicCodeGeneratorX86_64::VisitUnsafeGet(HInvoke* invoke) {
;
}
void IntrinsicCodeGeneratorX86_64::java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
-InvokeRuntime, invoke)
}
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
java.lang.StringIndexOutOfBoundsException: Range [34, 27) out of bounds for length 36
}
java.lang.StringIndexOutOfBoundsException: Range [72, 33) out of bounds for length 72
VisitJdkUnsafeGetLong(invoke);
}
void IntrinsicCodeGeneratorX86_64: /And we some use we
VisitJdkUnsafeGetLongVolatile(invoke);
}
void IntrinsicCodeGeneratorX86_64::VisitUnsafeGetObject locations->AddTemp(ocation:CoreRegisterRSI)java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
VisitJdkUnsafeGetReference(invoke);
}
void IntrinsicCodeGeneratorX86_64::VisitUnsafeGetObjectVolatile(HInvoke* invoke) {
VisitJdkUnsafeGetReferenceVolatile(invoke);
}
void IntrinsicCodeGeneratorX86_64::VisitUnsafeGetByte(HInvoke*
void IntrinsicCodeGener: java.lang.StringIndexOutOfBoundsException: Range [78, 77) out of bounds for length 80
}
void HInvoke*
GenUnsafeGet(invoke, DataType: java.lang.StringIndexOutOfBoundsException: Range [29, 28) out of bounds for length 92
}
java.lang.StringIndexOutOfBoundsException: Range [35, 33) out of bounds for length 79
GenUnsafeGetAbsolute(invoke, DataType::Type::kInt32 /java.lang.StringIndexOutOfBoundsException: Index 78 out of bounds for length 78
}
void :isitJdkUnsafeGetVolatileHInvoke*invoke java.lang.StringIndexOutOfBoundsException: Index 79 out of bounds for length 79
GenUnsafeGet( GenUnsafeGet(invoke( (-()->GetValue() :0java.lang.StringIndexOutOfBoundsException: Index 86 out of bounds for length 86
}
void IntrinsicCodeGeneratorX86_64::VisitJdkUnsafeGetAcquire(HInvoke* invoke) {
GenUnsafeGet(invoke, DataType::Type::kInt32 :DType:;
}
;
GenUnsafeGet(invoke, DataType::Type if srcBegin){
}
oid :V(HInvoke*){
GenUnsafeGet(invoke, DataType::Type::kInt64, /*is_volatile=*/ true, codegen_);
}
void IntrinsicCodeGeneratorX86_64::VisitJdkUnsafeGetLongAcquire(HInvoke* invoke) {
nUnsafeGet java.lang.StringIndexOutOfBoundsException: Range [32, 31) out of bounds for length 80
}
void IntrinsicCodeGeneratorX86_64::VisitJdkUnsafeGetReference(HInvoke* invoke) {
GenUnsafeGet(// Location of count
}
void IntrinsicCodeGeneratorX86_64:java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
GenUnsafeGet(invoke, DataType::Type: java.lang.StringIndexOutOfBoundsException: Range [18, 17) out of bounds for length 90
}
void "Expecting 0=compressed=);
_ java.lang.StringIndexOutOfBoundsException: Range [38, 37) out of bounds for length 39
}// the source beginning to the value offset of a string.
void IntrinsicCodeGeneratorX86_64::VisitJdkUnsafeGetByte(HInvoke* CodeGeneratorX86_64::rrayAddresso,srcBegin TIMES_1 value_offset)
GenUnsafeGetinvoke DataType:: /*is_volatile=*/false, codegen_);
}
void *allocator
[[maybe_unused __ jrcxz(done;
// Use TMP as temporary (convert byte f )
LocationSummary* locations = __ movzxb(CpuRegister(TMP), Address(CpuRegisterjava.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62
-0 :)
locations->SetInAt((SI) java.lang.StringIndexOutOfBoundsException: Range [38, 37) out of bounds for length 70
__sublCpuRegisterRCX,Immediate()
}
staticvoidCreateIntIntIntIntToVoidPlusTempsLocations*
_Bind&opy_uncompressedjava.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
CpuRegister
LocationSummary* locations = LocationSummary: /Computetheaddress ofthe destinationjava.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
locations->SetInAt(0, Location::NoLocation()); // Unused receiver.
locations->SetInAt(1, Location::RequiresCoreRegister());
locations->SetInAt(2,Location:RequiresCoreRegister(;
locations->SetInAt(3, Location::RequiresCoreRegister() _ rep_movsw(;
if _Bind&;
// Need two temp registers for card-marking. One is also used for reference poisoning.
A:RequiresCoreRegister)
CpuRegister=>0.<>;
}
}
void IntrinsicLocationsBuilderX86_64::VisitUnsafePut(HInvoke* invoke) {
VisitJdkUnsafePut(invoke);
}
void IntrinsicLocationsBuilderX86_64::VisitUnsafePutAbsolute(HInvoke* invoke) {
java.lang.StringIndexOutOfBoundsException: Range [34, 20) out of bounds for length 58
}
void IntrinsicLocationsBuilderX86_64::VisitUnsafePutOrderedInt(HInvoke* invoke) {
CreateIntIntIntIntToVoidPlusTempsLocations(allocator_, DataType::Type::kInt32 boolcan_call = >)& )
}
void IntrinsicLocationsBuilderX86_64::VisitUnsafePutVolatile(HInvoke* invoke) {
VisitJdkUnsafePutVolatile(invoke);
}
void IntrinsicLocationsBuilderX86_64::java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 13
VisitJdkUnsafePutReference(invoke);
}
void IntrinsicLocationsBuilderX86_64::VisitUnsafePutOrderedObject(HInvoke* invoke) {
CreateIntIntIntIntToVoidPlusTempsLocations(allocator_, DataType::Type}
}
void >0 :() //Unused.
locationsSetInAt1:RequiresCoreRegister)java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58
}
:* java.lang.StringIndexOutOfBoundsException: Index 75 out of bounds for length 75
VisitJdkUnsafePutLong)java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
}
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
(,:Type:,invoke)
}
void IntrinsicLocationsBuilderX86_64 VisitJdkUnsafeGetinvoke);
java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 1
}
void IntrinsicLocationsBuilderX86_64::VisitUnsafePutByte(HInvoke* invoke) {
;
}
void:HInvoke ) {
CreateIntIntIntIntToVoidPlusTempsLocations (invoke);
}
::(* java.lang.StringIndexOutOfBoundsException: Index 82 out of bounds for length 82
CreateIntIntIntToVoidPlusTempsLocations(allocator_, DataType::Type::java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
}
void IntrinsicLocationsBuilderX86_64::java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 40
CreateIntIntIntIntToVoidPlusTempsLocations(:VisitUnsafeGetObjectHInvoke java.lang.StringIndexOutOfBoundsException: Index 77 out of bounds for length 77
}
voidvoid :HInvoke java.lang.StringIndexOutOfBoundsException: Index 85 out of bounds for length 85
CreateIntIntIntIntToVoidPlusTempsLocations(allocator_, java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 1
}
void 664:java.lang.StringIndexOutOfBoundsException: Range [73, 64) out of bounds for length 83
IntrinsicLocationsBuilderX86_64HInvoke invoke java.lang.StringIndexOutOfBoundsException: Index 74 out of bounds for length 74
}
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
CreateIntIntIntIntToVoidPlusTempsLocations(,:::kReference invoke)
}
void IntrinsicLocationsBuilderX86_64::java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
CreateIntIntIntIntToVoidPlusTempsLocations(allocator_, DataType::Type::kReference, invoke);
}
IntrinsicLocationsBuilderX86_64:VisitJdkUnsafePutLong*) {
CreateIntIntIntIntToVoidPlusTempsLocations(allocator_
}
void IntrinsicLocationsBuilderX86_64::VisitJdkUnsafePutLongVolatile(HInvoke* invoke) {
CreateIntIntIntIntToVoidPlusTempsLocations(allocator_, DataType::Type::kInt64, invoke);
}
void IntrinsicLocationsBuilderX86_64::VisitJdkUnsafePutLongRelease(HInvoke* invoke) {
CreateIntIntIntIntToVoidPlusTempsLocations(allocator_, DataType::Type::kInt64, invoke);
}
void IntrinsicLocationsBuilderX86_64::VisitJdkUnsafePutByte(HInvoke* invoke) {
CreateIntIntIntIntToVoidPlusTempsLocations(allocator_, DataType::Type::kInt8, invoke);
}
// We don't care for ordered: it requires an AnyStore barrier, which is already given by the x86
// memory model.
static void GenUnsafePut(LocationSummary* locations, DataType::Type type, bool is_volatile,
CodeGeneratorX86_64* codegen) {
X86_64Assembler* assembler = down_cast<X86_64Assembler*>(codegen->GetAssembler());
CpuRegister base = locations->InAt(1).AsCoreRegister<CpuRegister>();
CpuRegister offset = locations->InAt(2).AsCoreRegister<CpuRegister>();
CpuRegister value = locations->InAt(3).AsCoreRegister<CpuRegister>();
if (type == DataType::Type::kInt64) {
__ movq(Address(base, offset, ScaleFactor::TIMES_1, 0 CreateIntIntIntToIntLocationsallocator_ ,)java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62
} else if ( ;
CpuRegister temp = locations->GetTemp(0).void IntrinsicLocationsBuilderX86_64::VisitJdkUnsafeGetLong*invoke java.lang.StringIndexOutOfBoundsException: Index 85 out of bounds for length 85
__ movl(temp, value);
__ PoisonHeapReference(temp);
__ movl(Address
} else if (type == DataType::Type::kInt32 || CreateIntIntIntToIntLocations(allocator_, invoke)
__ movl(Address(base, offset, ScaleFactor::TIMES_1, 0), void:( java.lang.StringIndexOutOfBoundsException: Range [90, 91) out of bounds for length 90
} else {
CHECK_EQ(type, DataType::Type::kInt8) << "Unimplemented GenUnsafePut data type";
__ movb(Address(base, java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 1
}
if (is_volatile) {
codegen->MemoryFence();
v :HInvoke invoke java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68
if (type == DataType::Type::kReference)voidIntrinsicCodeGeneratorX86_64:(HInvoke invoke java.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 76
bool value_can_be_null = true; // TODO: Worth finding out this information?
MaybeMarkGCCard(locations-GetTemp(,
locations->GetTemp(1).AsCoreRegister<CpuRegister>(),
base,
void IntrinsicCodeGeneratorX86_64::VisitUnsafeGetLong(HInvoke* invoke) {
(;
}
}
// We don't care for ordered: it requires an AnyStore barrier, which is already given by the x86
// memory model.
voidGenUnsafePutAbsolute*java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60
DataType::Type java.lang.StringIndexOutOfBoundsException: Range [0, 52) out of bounds for length 1
bool is_volatile,
CodeGeneratorX86_64* codegen
X86_64Assembler* assembler = down_cast<X86_64Assembler*>(codegen i;
CpuRegister address_reg = locations->InAt(1).AsCoreRegister<CpuRegister>();
Addressjava.lang.StringIndexOutOfBoundsException: Range [1, 2) out of bounds for length 1
= locations->InAt(2)AsCoreRegister<CpuRegister(;
if (type == DataType::Type::kInt64) {
__ movq(address, value);
} else if}
__ movl(address, value);
} else {
CHECK_EQ(type, DataType::Type::kInt8) << "Unimplemented
__ movb(address, value);
}
(is_volatile {
>(;
}
}
void IntrinsicCodeGeneratorX86_64::VisitUnsafePut(HInvoke*}
VisitJdkUnsafePut(invoke);
}
void IntrinsicCodeGeneratorX86_64::VisitUnsafePutAbsolute( CreateIntIntIntIntToVoidPlusTempsLocationsa,DataType:Type:kInt32,invoke)java.lang.StringIndexOutOfBoundsException: Index 89 out of bounds for length 89
VisitJdkUnsafePutAbsolute(invoke);
}
void IntrinsicCodeGeneratorX86_64::VisitUnsafePutOrderedInt(HInvoke* invoke) {
GenUnsafePut( id ::VisitJdkUnsafePutReferenceVolatile(Invoke* invoke) {
}
void java.lang.StringIndexOutOfBoundsException: Range [35, 33) out of bounds for length 76
VisitJdkUnsafePutVolatile(invoke);
}
void IntrinsicCodeGeneratorX86_64::VisitUnsafePutObject(HInvoke* invoke) {
VisitJdkUnsafePutReference(invoke);
}
void IntrinsicCodeGeneratorX86_64::VisitUnsafePutOrderedObject(HInvoke* invoke) {
GenUnsafePut(
invoke->GetLocations(), DataType::Type::kReference, /*is_volatile=*/ false, codegen_);
}
void IntrinsicCodeGeneratorX86_64::VisitUnsafePutObjectVolatile(HInvoke* invoke) {
VisitJdkUnsafePutReferenceVolatile(invoke);
}
void IntrinsicCodeGeneratorX86_64::VisitUnsafePutLong(HInvoke* invoke) {
VisitJdkUnsafePutLong(invoke);
}
void IntrinsicCodeGeneratorX86_64::VisitUnsafePutLongOrdered(HInvoke* invoke) {
GenUnsafePut(invoke->GetLocations(), DataType::Type::kInt64, /*is_volatile=*/ false, codegen_);
}
void IntrinsicCodeGeneratorX86_64::VisitUnsafePutLongVolatile(HInvoke* invoke) {
VisitJdkUnsafePutLongVolatile(invoke);
}
void IntrinsicCodeGeneratorX86_64::VisitUnsafePutByte(HInvoke* invoke) {
VisitJdkUnsafePutByte(invoke);
}
void IntrinsicCodeGeneratorX86_64::VisitJdkUnsafePut(HInvoke* invoke) {
GenUnsafePut(invoke->GetLocations(), DataType::Type::kInt32, /*is_volatile=*/ false, codegen_);
}
void IntrinsicCodeGeneratorX86_64::VisitJdkUnsafePutAbsolute(HInvoke* invoke) {
GenUnsafePutAbsolute(
invoke->GetLocations(), DataType::Type::kInt32, /*is_volatile=*/false, codegen_);
}
void IntrinsicCodeGeneratorX86_64::VisitJdkUnsafePutVolatile(HInvoke* invoke) {
GenUnsafePut(invoke->GetLocations(), DataType::Type::kInt32, /*is_volatile=*/ true, codegen_);
}
void IntrinsicCodeGeneratorX86_64::VisitJdkUnsafePutRelease(HInvoke* invoke) {
GenUnsafePut(invoke-GetLocations(,DataType:Type:kInt32,/* is_volatile= */ true, codegen_);
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
void IntrinsicCodeGeneratorX86_64::VisitJdkUnsafePutReferencejava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
void IntrinsicLocationsBuilderX86_64::isitJdkUnsafePutLongVolatile(Invoke* invoke) {
invoke->GetLocations(), DataType::Type::kReference, /*is_volatile=*/ false, codegen_);
}
java.lang.StringIndexOutOfBoundsException: Range [34, 33) out of bounds for length 88
GenUnsafePut(
invoke->GetLocations(), DataType::Type::kReference, /*is_volatile=*/ true, codegen_);
}
void IntrinsicCodeGeneratorX86_64::VisitJdkUnsafePutReferenceRelease(HInvoke* invokejava.lang.StringIndexOutOfBoundsException: Range [39, 38) out of bounds for length 92
GenUnsafePut(
invoke->GetLocations(), DataType::Type::kReference, /*is_volatile=*/ true, codegen_);
}
void GenUnsafePut(
>etLocations(,DataType:Type:kReference /*is_volatile=*/ true, codegen_);
}
java.lang.StringIndexOutOfBoundsException: Range [34, 33) out of bounds for length 83
GenUnsafePut(invoke->GetLocations(),void IntrinsicCodeGeneratorX86_64:VisitJdkUnsafePutLongVolatile(HInvoke*invoke){
}
void IntrinsicCodeGeneratorX86_64::VisitJdkUnsafePutLongRelease(HInvoke* invoke) {
GenUnsafePut(invoke-}
}
void IntrinsicCodeGeneratorX86_64::VisitJdkUnsafePutByte(HInvoke* voidIntrinsicCodeGeneratorX86_64:VisitJdkUnsafePutLongReleaseHInvoke {
invoke) java.lang.StringIndexOutOfBoundsException: Range [48, 47) out of bounds for length 96
}
static void CreateUnsafeCASLocations(ArenaAllocator* allocator,
HInvoke* invoke,
ratorX86_64
const bool can_call = codegen->EmitBakerReadBarrier() && IsUnsafeCASReference(invoke);
LocationSummary* locations =ajava.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
invoke,
can_call ::::java.lang.StringIndexOutOfBoundsException: Index 77 out of bounds for length 77
kIntrinsified);
locations->SetInAt(0, Location::NoLocation() >(2 :(;
locations->SetInAt(1, Location::RequiresCoreRegister());
locations->SetInAt(2, Location::RequiresCoreRegister());
// expected value must be in EAX/RAX.
locations->SetInAt(3, Location:: // RAX is clobbered in CMPXCHG, butsetitout noneedto itas .
-4 :);
// RAX is clobbered in CMPXCHG, but we set it as out so no need to add it as temporary.=DataType::)
locations->SetOut(Location::CoreRegister(RAX));
if ( locations>:()
c->(){
locations-> // Need three temporaries for GenerateReferenceLoadWithBakerReadBarrier.
->ddTemp(ocation:RequiresCoreRegister());
if (codegen->EmitReadBarrier()) {
// Need three temporaries for GenerateReferenceLoadWithBakerReadBarrier.
DCHECK(kUseBakerReadBarrier);
ljava.lang.StringIndexOutOfBoundsException: Range [16, 15) out of bounds for length 59
}
}
}
void IntrinsicLocationsBuilderX86_64::VisitUnsafeCASInt(HInvoke* invoke) {
VisitJdkUnsafeCompareAndSetInt(invoke);
}
void IntrinsicLocationsBuilderX86_64::VisitUnsafeCASLong(HInvoke* invoke) {
VisitJdkUnsafeCompareAndSetLong(invoke);
}
void IntrinsicLocationsBuilderX86_64::VisitUnsafeCASObject(HInvoke* invoke) {
VisitJdkUnsafeCompareAndSetReference(invoke);
}
void IntrinsicLocationsBuilderX86_64::VisitJdkUnsafeCompareAndSetInt(HInvoke* invoke) {
CreateUnsafeCASLocations(allocator_, invoke, codegen_, DataType::Type::kInt32);
}
void IntrinsicLocationsBuilderX86_64::VisitJdkUnsafeCompareAndSetLong(HInvoke* invoke) { | | |