Eine aufbereitete Darstellung der Quelle

 
     
 
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung


Quelle  intrinsics_x86_64.cc   Sprache: C

 


 * Copyright_j( skip_incr
 *
_ (t1codegen_>java.lang.StringIndexOutOfBoundsException: Range [45, 44) out of bounds for length 52
 * _t1 ;
 * 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,   __ j(kAboveEqual, &done);  // clipped to max (already in out), does on
 *under the License    ASIS BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS 
 * See the __ cvttss2si(out)
 * limitations  _Bind&)
 */

#include "}

#include <limits>

#include "
arch/x86_64/instruction_set_features_x86_64.h"
#include "
arch
#include "art_method. ntrinsicLocationsBuilderX86_64:VisitMathRoundDouble(HInvoke*invoke){
#.h"

#include "code_generator_x86_64.h"
#include #include "dex
#includevoid java.lang.StringIndexOutOfBoundsException: Range [74, 33) out of bounds for length 74
nclude "
ntrypoints/uick/uick_entrypoints_enumh"
#includejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
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_  CpuRegister out = locations->Out().AsCoreRegister<CpuRegister>();
}

   t1= ->etTemp0.AsFpuRegister<XmmRegister>();
  return codegen_->GetGraph()->GetAllocator();
}

bool   XmmRegister t2 = locations->GetTemp)AsFpuRegister<XmmRegister>);
  Dispatch(invoke);
  LocationSummary*res=invoke->GetLocations()
  if (res ==  *   GetAssembler();
    return false;
  
  return res  /Since no  x86  instruction matches the required semantics,
}

using IntrinsicSlowPathX86_64  //this intrinsic is mplemented as follows:

 //  result = floor(in);

static void   //  if (in - result >= 0.5)
                            CpuRegister   //    result = result + 1.0f;
                             base,
                            Location pos,
                           :T type,
                             ){
  // Note: The heap is in low 4GiB, so we're using LEAL rather than LEAQ to save on code size.
  if  _ (codegen_-LiteralDoubleAddress(0);
    int32_t constant   _j(,&);
    __ leal  _addsd(, codegen_-LiteralDoubleAddress(.f)java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
  } else {
    const ScaleFactor scale_factor  /direct instruction,since  shouldmapto   large 
    __ 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_ ,Immediate())
 public:
  explicit ReadBarrierSystemArrayCopySlowPathX86_64(_ j(,&done)  // NaN mapped to 0 (just moved in out)
_ ( t1/* is64bit= */ true);
  }

  void EmitNativeCode_Bind(done)
    DCHECK(codegen->
    java.lang.StringIndexOutOfBoundsException: Range [0, 23) out of bounds for length 0
   *assembler=x86_64_codegenGetAssembler()
    LocationSummary* locations = instruction_->GetLocations();
    (->CanCall();
    DCHECK(instruction_-      :Create(,invoke, :kCallOnMainOnly )
         instruction in
        java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
java.lang.StringIndexOutOfBoundsException: Range [24, 23) out of bounds for length 57
   i>)>java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70
    Location void:HInvoke java.lang.StringIndexOutOfBoundsException: Range [66, 64) out of bounds for length 67

    const DataType:java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
     =DataType:Size(ype

    CpuRegister    CpuRegister llLocations(,invoke;
      locations>java.lang.StringIndexOutOfBoundsException: Range [51, 50) out of bounds for length 84
    CpuRegister :VisitMathAtan(HInvoke*invoke)java.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 67

    __ Bind(GetEntryLabel());
    // The `src_curr_addr` and `dst_curr_addr` were initialized before entering the slow-path.
    GenArrayAddress(assembler, src_stop_addr,}

    NearLabel java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
java.lang.StringIndexOutOfBoundsException: Range [16, 15) out of bounds for length 46
    _:java.lang.StringIndexOutOfBoundsException: Range [52, 51) out of bounds for length 70
     beforecalling the runtimejava.lang.StringIndexOutOfBoundsException: Range [66, 67) out of bounds for length 66
    java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    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.
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    // This runtime call does not require a stack map.
    x86_64_codegen->InvokeRuntimeWithoutRecordingPcInfo(entry_point_offset,GenFPToFPCallinvoke,codegen_ kQuickExp)java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
_ MaybePoisonHeapReference(CpuRegister();
    __ movl(Address(dst_curr_addr, 0), CpuRegister(TMP));
java.lang.StringIndexOutOfBoundsException: Range [11, 4) out of bounds for length 52
    __ addl(java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 1
    _cmpl(,src_stop_addr);
    __ j(kNotEqual  enFPToFPCall,codegen_ )
    _java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1


  const char* GetDescription() const override { CreateFPToFPCallLocations,invoke;

 private:
  
};

// 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).
  SlowPathCode{
 public:
  InvokePolymorphicSlowPathX86_64(HInstruction* GenFPToFPCallinvoke,codegen_, )
      : SlowPathCode(instruction), method_handle_(method_handle) {
    DCHECK(instruction->IsInvokePolymorphic());
  }

  void EmitNativeCode(CodeGenerator* codegen) override {
    CodeGeneratorX86_64* x86_64_codegen 
    X86_64Assembler* void IntrinsicLocationsBuilderX86_64HInvoke ) {
_ (etEntryLabel();
    SaveLiveRegisters(codegen, instruction_->GetLocations());

    // Passing `MethodHandle` object as hidden argument.
    __ movl(CpuRegister(RDI), method_handle_);
    x86_64_codegen->InvokeRuntime(QuickEntrypointEnum::kQuickInvokePolymorphicWithHiddenReceiver,
                                  java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1

    RestoreLiveRegisters(codegen, instruction_-}
    __ jmp
  }

* )override{"
java.lang.StringIndexOutOfBoundsException: Range [88, 87) out of bounds for length 91

 private:
  const CpuRegister method_handle_;
 ();
};

tatic void (ArenaAllocatorallocator HInvoke* invoke) {
  LocationSummary* locations = LocationSummary::java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 0
  locations->SetInAt(0, Location::RequiresFpuRegister());
  locations->SetOutjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1

static void CreateIntToFPLocations(ArenaAllocator* allocator, HInvoke*  InvokeRuntimeCallingConvention;
LocationSummary*locations LocationSummary:CreateNoCallallocator,invoke kIntrinsified)
  locations>( Location:FpuRegister(alling_convention.GetFpuRegisterAt1))
   locationsS(ocation:();
}

static void MoveFPToInt(
    CpuRegister dst XmmRegister  assembler java.lang.StringIndexOutOfBoundsException: Index 81 out of bounds for length 81
  if(){
    __ movq(dst, src)  invoke>(,3)
  } else {
    __ movd(dst, src);
  }
}

:();
      src  is64bit, X86_64Assembler* assembler) {
  if (is64bit) {
    __ movq(dst,java.lang.StringIndexOutOfBoundsException: Range [50, 29) out of bounds for length 50
  } else {
    __ movd(dst, src);
  }
}

static( codegen_,kQuickAtan2;
  XmmRegister input = locations->InAt(0).AsFpuRegister<
  CpuRegister output
  MoveFPToInt(output, inputvoid IntrinsicLocationsBuilderX86_64VisitMathPow(Invoke*invoke) {
}

static CreateFPFPToFPCallLocations ;
  java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 1
  XmmRegister output = locationsCreateFPFPToFPCallLocations )
  MoveIntToFP(output, java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
}

GenFPToFPCall(invoke,codegen_ )
  CreateFPToIntLocations(java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 1
}
void CreateFPFPToFPCallLocations(allocator_)
  CreateIntToFPLocationsjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
}

void 
  MoveFPToInt!  
}
 // And we need some temporaries.  We will use REP MOVS{B,W,L}, so we need fixed registers.
  MoveIntToFP(    locations>(:CRSI;
}

void::(*){
  CreateFPToIntLocations(allocator_>L:RCX)
}
void :(java.lang.StringIndexOutOfBoundsException: Range [71, 70) out of bounds for length 81
  CreateIntToFPLocations(allocator_,staticvoid (*assembler
}

void IntrinsicCodeGeneratorX86_64: Location,
                )java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
}
void if (rhs.IsConstant java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
s64bit=();
}

static void CreateIntToIntLocations(ArenaAllocator* allocator, HInvoke* invoke) {
  LocationSummary* locations _(,()java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
ions>(, Location::RequiresCoreRegister());
locations>:);
}

void IntrinsicLocationsBuilderX86_64::VisitIntegerReverseBytesjava.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
  
}

void IntrinsicCodeGeneratorX86_64void(_Assembler java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68
  codegen_->GetInstructionCodegen()-> Location,
}

void IntrinsicLocationsBuilderX86_64::VisitLongReverseBytes(HInvoke* invoke) {
CreateIntToIntLocations(llocator_,invoke);
}

void IntrinsicCodeGeneratorX86_64::VisitLongReverseBytes(HInvoke* invoke) {
  codegen_->GetInstructionCodegen()->Bswap(invoke->GetLocations()->Out
}

void IntrinsicLocationsBuilderX86_64::VisitShortReverseBytes(HInvoke* invoke) {
oke)
}

void IntrinsicCodeGeneratorX86_64:                                          position_sign_checked {
>(-Bswapinvoke>()>(,DataType:::kInt16;
}

static GenIsInfinite(* locationsjava.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
  boolis64bit,
                          CodeGeneratorX86_64* codegen) {
  X86_64Assembler* assembler = codegen->        (, ( length_offset, length,slow_path>()

  XmmRegister input      {
  CpuRegister       // Calculate(rray  .

  NearLabel,done2java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25

  if (is64bit) {
    double kPositiveInfinity      _ subl(temp,Immediate();
    double kNegativeInfinity = -1 * kPositiveInfinity;

    __ xorq(output, output      (assembler,temp, length slow_path-GetEntryLabel);
    __ comisd(input, codegen->LiteralDoubleAddress(kPositiveInfinity));
   _j(kNotEqual,&)
    __ j( else if (length_is_array_l)java.lang.StringIndexOutOfBoundsException: Range [38, 39) out of bounds for length 38
    _movq(utput Immediate(1);
    __ __ testlpos_reg, )
    __ Bind(&done1)_ j(, slow_path-GetEntryLabel(;
omisdinput -LiteralDoubleAddresskNegativeInfinity)java.lang.StringIndexOutOfBoundsException: Index 71 out of bounds for length 71
ual &)java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
    _j( &done2;
    __ movq(output, Immediate_ testl(os_reg,pos_reg);
    __j(, slow_path>();
  } else {
    float kPositiveInfinity = std::numeric_limits<float>::java.lang.StringIndexOutOfBoundsException: Range [0, 66) out of bounds for length 5
    float kNegativeInfinity = -1 */  operandsare   be negative`` the differencecannotunderflow

    __ xorl(output, output);
    __    _ movl(temp, Address(array,length_offset))
    _    __ subltemp, pos_reg);
    _ 
    __ movl(output,//Check (()-pos) > .
    _ EmitCmplJLessassembler ,length,slow_path>GetEntryLabel()
  }
    __ comissjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
   _kNotEqual&)
    __ j(kParityEven, &done2);
    _movlo,Immediate1;
    __ Bind(&done2                                              SlowPathCode slow_pathjava.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70
  }
}

void IntrinsicLocationsBuilderX86_64::VisitFloatIsInfinite(HInvoke*                                               ,
  CreateFPToIntLocations(allocator_, invoke);
}                                              Location ,

                                               length){
  SystemArrayCopyOptimizations optimizations(invoke);
}

void   NearLabel conditions_on_positions_java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
  CreateFPToIntLocations(allocator_, invoke/java.lang.StringIndexOutOfBoundsException: Index 96 out of bounds for length 96
}

void IntrinsicCodeGeneratorX86_64:(HInvoke invoke 
  GenIsInfinite(invoke->GetLocations(), /* is64bit=*/  true, codegen_); !optimizationsGetSourcePositionIsDestinationPosition)) {
}

static          src_posGetConstant()java.lang.StringIndexOutOfBoundsException: Range [85, 84) out of bounds for length 88
ocationSummarylocations :(,invoke kIntrinsified;
  locations->SetInAt(0, Location::RequiresFpuRegister());
  -SetOut(:() :kNoOutputOverlap
}

void          if (( <dest_pos_constant java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58
  __ j(kEqual>);
}

void IntrinsicCodeGeneratorX86_64::VisitMathSqrt(HInvoke*        
mmary*  invoke-GetLocations()
  XmmRegister in =         if (!optimizations.G) java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
 =locations-Out(sFpuRegister<mmRegister>)

embler)>(ut )
}

static  _ (.<>(,Immediatesrc_pos_constantjava.lang.StringIndexOutOfBoundsException: Index 85 out of bounds for length 85
                                       HInvoke invokejava.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
                                       const CodeGeneratorX86_64 (optimizations.GetDestinationIsSource) {
on support
  if (!codegen-> j(kNotEqual, &conditions_on_positions_validated
turn;
  }

  CreateFPToFPLocationsallocator ;
}

static(HInvoke ,X86_64Assembler*assembler int round_mode java.lang.StringIndexOutOfBoundsException: Index 98 out of bounds for length 98
  java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 0
  DCHECK(-WillCall);
  XmmRegister in = locations->InAt(0).AsFpuRegister<java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 0
  XmmRegister out = locations->Out    /   the isnull
 (ut,in, (round_mode)java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
}

void IntrinsicLocationsBuilderX86_64::VisitMathCeil(HInvoke* invoke}
  CreateSSE41FPToFPLocations(allocator_
}

void IntrinsicCodeGeneratorX86_64:(*invoke){
  GenSSE41FPToFPIntrinsic(invoke, GetAssembler// Bail out if the destination is null.
java.lang.StringIndexOutOfBoundsException: Range [1, 2) out of bounds for length 1

void java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 3
    // thelength is negative bail out.
}

void(length.( &
  GenSSE41FPToFPIntrinsic(invoke, GetAssembler(), 1);
}

void IntrinsicLocationsBuilderX86_64::VisitMathRint(HInvoke* invoke) {
  CreateSSE41FPToFPLocations(allocator_, invoke, codegen_);
}

void IntrinsicCodeGeneratorX86_64::VisitMathRint(HInvoke* invoke!ptimizations.etCountIsDestinationLength java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
  GenSSE41FPToFPIntrinsicinvoke,GetAssembler() 0)
}

_jk,slow_pathjava.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
                                        
                                        const*c) {
  // Do we have instruction support?
  if (!codegen->                          java.lang.StringIndexOutOfBoundsException: Range [57, 56) out of bounds for length 66
    return;
  }

  LocationSummary* locations = LocationSummary::CreateNoCall(allocator, invoke, kIntrinsified);
At0,Location:()
  locations->SetOut(Location::RequiresCoreRegister());
  locations->AddTemp(Location::RequiresFpuRegister());
  locations->AddTemp    = locations-()java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1

void::isitMathRoundFloatHInvoke){
  _,invoke codegen_)
}

java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
  LocationSummary* locations =  CpuRegister src_basejava.lang.StringIndexOutOfBoundsException: Range [35, 34) out of bounds for length 77
  DCHECK(!  =locations>etTemp1.AsCoreRegister<>)

  XmmRegister in = locations->InAt(0).AsFpuRegister<XmmRegister>();
  CpuRegister  -Out)AsCoreRegisterCpuRegister(;
  XmmRegister t1 = locations- DCHECK_EQcountAsRegister) RCX;
  XmmRegister t2 = locations->GetTemp(1)
NearLabel,done;
  X86_64Assembler* assembler  codegen>(low_path;

  
  // this intrinsic is implemented as follows:
  //  result = floor(in);
  //  if (in - result >= 0.5f)
  //    result = result + 1.0f;
  __ movss(t2, in);
  _1));
  __ subss(t2, t1);
_ comisst2 codegen_-LiteralFloatAddress.f);
  __ j(kBelow, &java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  _CheckSystemArrayCopyPosition,
  __ Bind(&skip_incr);

                               src,
  // 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);slow_path
  __ cvtsi2ss(t2, out);
_ (,t2);
  __ j(kAboveEqual, &done);                               /*length_is_array_length=*/ false,
  __ movl(out, Immediate(0));  // does not change flags
  __ j(kUnordered,&)  
  __ cvttss2si(out, t1);
  __ Bind(&done);yCopyPositionassemblerjava.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
java.lang.StringIndexOutOfBoundsException: Range [1, 2) out of bounds for length 1

void IntrinsicLocationsBuilderX86_64::java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 41
  CreateSSE41FPToIntLocations(allocator_, invoke, =/false,
}/*position_sign_checked=*/ false);

void IntrinsicCodeGeneratorX86_64::VisitMathRoundDouble(HInvoke* invoke) {
  LocationSummary* locations =    _movlcount,length>);
  DCHECK(!locations->WillCall());

XmmRegisterin=locations>()AsFpuRegister>(;
  CpuRegister out = locations->Out()/ Checkassumption  () is2(sed in  )
    const size_t  :Sizet)
  XmmRegister t2 =   const uint32_t data_offsetmirror:::DataOffset)Uint32Value)
  NearLabel skip_incr, done;
 *assembler (;

  // Since no direct x86 rounding instruction matches the required semantics,
ementedfollows
  //  result = floor(in);
  //  if (in - result >= 0.5)
  //    result = result + 1.0f;
  __ movsd(t2, in);
  __ roundsd(t1,in Immediate()java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
  _subsd(t2,t1);
  __ comisd(t2,       _rep_movsw)
         ;
  __ addsd(t1,     case DataType::Type::kInt32:
  __ 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
  default
  codegen_->       (FATAL <" f intrinsic"
  _}
  __ comisd(t1, t2);
  __ j(kAboveEqualBs-GetExitLabel);
  __ movl}
  __ j(kUnordered, &done);  // NaN mapped to 0 (just moved in out)
    /* is64bit= */ true);
  __ Bind(&  CreateSystemArrayCopyLocationsinvoke;
}

static voidIntrinsicCodeGeneratorX86_64:VisitSystemArrayCopyCharHInvoke*invoke)java.lang.StringIndexOutOfBoundsException: Index 78 out of bounds for length 78
  LocationSummary* locations =
      LocationSummary::Create(java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 0
 InvokeRuntimeCallingConventioncalling_convention
  locations->SetInAt(0, X86_64Assembler* assemblerGetAssembler;
  java.lang.StringIndexOutOfBoundsException: Range [28, 11) out of bounds for length 49

  
}:( invoke java.lang.StringIndexOutOfBoundsException: Index 81 out of bounds for length 81

static void GenFPToFPCall
                          java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 0

  DCHECK(locations->X86_64Assembler* assemblerGetAssembler)
  DCHECK(invokeSystemArrayCopyPrimitive,,codegen_ ::Int32;

  codegen->InvokeRuntime(entry, invoke);
}

void IntrinsicLocationsBuilderX86_64
  IntrinsicLocationsBuilderX86_64VisitSystemArrayCopyInt*)java.lang.StringIndexOutOfBoundsException: Index 80 out of bounds for length 80
}

:(*invoke java.lang.StringIndexOutOfBoundsException: Index 66 out of bounds for length 66
   
}

void(>(){
  CreateFPToFPCallLocations(allocator_, invoke);
}

void IntrinsicCodeGeneratorX86_64: }
  GenFPToFPCall(invoke,java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}

void IntrinsicLocationsBuilderX86_64::  constexpr size_t kInitialNumTemps = 0u;  // tempsexplicitly
  ( ;
}

void IntrinsicCodeGeneratorX86_64::VisitMathAcos(HInvoke*        kLengthThreshold kInitialNumTempsjava.lang.StringIndexOutOfBoundsException: Range [50, 51) out of bounds for length 50
  GenFPToFPCall(,codegen_ )
}

voidDCHECK_EQ) );
  CreateFPToFPCallLocations(allocator_locations>(Location::CoreRegisterRSI);
}

void IntrinsicCodeGeneratorX86_64::    -(:CoreRegisterRDI)
      >L:CoreRegisterRCX))
}

void IntrinsicLocationsBuilderX86_64::VisitMathAtan(HInvoke* invoke) {
  CreateFPToFPCallLocationsjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}

void IntrinsicCodeGeneratorX86_64::VisitMathAtan(HInvoke* invoke// SystemArrayCopy intrinsic is the Baker-style read barriers.
  java.lang.StringIndexOutOfBoundsException: Range [16, 15) out of bounds for length 46
}
*  java.lang.StringIndexOutOfBoundsException: Range [44, 43) out of bounds for length 46
void::isitMathCbrtHInvoke  
  CreateFPToFPCallLocations(java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 0
}

void IntrinsicCodeGeneratorX86_64::VisitMathCbrt(HInvoke* invokeuint32_tsuper_offset=mirror::SuperClassOffset)Int32Value)
  component_offset:::ComponentTypeOffset.(;
}

derX86_64:VisitMathCosh(*invoke java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70
  CreateFPToFPCallLocations(allocator_, invoke);
}

void   CpuRegister src = locations->InAtAsCoreRegister<puRegister(;
  GenFPToFPCall(invoke, codegen_, kQuickCosh);  Locationsrc_pos=locations>nAt1;
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1

void IntrinsicLocationsBuilderX86_64::VisitMathExp(HInvoke* invoke) {
  CpuRegistertemp3 AsCoreRegisterCpuRegister(
}

voidSlowPathCodeintrinsic_slow_path
  java.lang.StringIndexOutOfBoundsException: Range [36, 7) out of bounds for length 36
}

void IntrinsicLocationsBuilderX86_64::VisitMathExpm1.(java.lang.StringIndexOutOfBoundsException: Index 75 out of bounds for length 75
  CreateFPToFPCallLocations(allocator_, invoke);
}

IntrinsicCodeGeneratorX86_64:(invoke){
  GenFPToFPCall(invoke,
}

void     // with nullor readingaconstantprimitivevalue  ReadBarrierOptionjava.lang.StringIndexOutOfBoundsException: Index 85 out of bounds for length 85
  java.lang.StringIndexOutOfBoundsException: Range [28, 27) out of bounds for length 48
}

void IntrinsicCodeGeneratorX86_64::VisitMathLog(HInvoke* invoke) {
  GenFPToFPCall(invoke, codegen_, kQuickLog);    _testlt,temp;
}

void_k intrinsic_slow_path>etEntryLabel))
  CreateFPToFPCallLocations(allocator_, invoke);
}

void // Checkthatthecomponenttypeisnota(Address(temp, primitive_offset), Immediate:);
GenFPToFPCallinvoke  ;
}

void IntrinsicLocationsBuilderX86_64::VisitMathSinh(  }
  CreateFPToFPCallLocations(allocator_, invoke  if(optimizationsGetDoesNotNeedTypeCheck) 
}

void IntrinsicCodeGeneratorX86_64::VisitMathSinh    /of   dotwochecks classesarethesame
  // or the destination
}

voidIntrinsicLocationsBuilderX86_64:H*){
  CreateFPToFPCallLocations(allocator_, invoke);
}

void IntrinsicCodeGeneratorX86_64::VisitMathTanif(-EmitBakerReadBarrier){
  GenFPToFPCall(invoke, codegen_, kQuickTan);
}

void      >
  ,;
}

void :(
  GenFPToFPCall(invoke, codegen_,  /  java.lang.StringIndexOutOfBoundsException: Range [50, 49) out of bounds for length 64
}

static void CreateFPFPToFPCallLocations(ArenaAllocator* // /* HeapReference<Class> */ temp2 = src->klass_
  LocationSummary* locations =
LocationSummary::Createallocator,invoke,:kCallOnMainOnlyjava.lang.StringIndexOutOfBoundsException: Range [97, 96) out of bounds for length 98
  InvokeRuntimeCallingConvention calling_convention // by the previous calls to GenerateFieldLoadWithBakerReadBarrier.
   }{
  locations->SetInAt(1, Location::FpuRegister(calling_convention.GetFpuRegisterAt(1)));
  locations->SetOut(Location: _ temp1 d );

:(ocations
}

static void CreateFPFPFPToFPCallLocations(ArenaAllocator*      _movltemp2,Addresss,class_offset)java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
  DCHECK_EQ
  *locations=:(llocator,, )
  InvokeRuntimeCallingConvention       DCHECK(optimizations.GetDestinationIsNonPrimit;
locations>0 :()
  locations->SetInAt(1,       // For class match, we can typecheck theoptimizationflag
  ->2 :RequiresFpuRegister);
  locations- / readisneededreadingachainofconstant
}

void IntrinsicLocationsBuilderX86_64 
      _movltemp1 temp1)java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
}

:Hinvoke {
  GenFPToFPCall(invoke, codegen__cmplAddresstemp1 )Immediate0)
 _jkNotEqual -GetEntryLabel);

void IntrinsicLocationsBuilderX86_64::VisitMathPow(HInvoke* invoke) {
  CreateFPFPToFPCallLocations(allocator_/ out thesourceisnotanonprimitivearray
}

void IntrinsicCodeGeneratorX86_64::VisitMathPow(HInvoke* invoke) {
GenFPToFPCallinvoke  ;
}

void IntrinsicLocationsBuilderX86_64::VisitMathHypot(HInvoke* invoke) {
  CreateFPFPToFPCallLocations(allocator_, invoke);
}

void      java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
  GenFPToFPCall(invoke, codegen_      !GetDestinationIsTypedObjectArray);
}

voidIntrinsicLocationsBuilderX86_64:isitMathNextAfterHInvoke*){
java.lang.StringIndexOutOfBoundsException: Range [58, 10) out of bounds for length 58
}

void else if (!optimizations.GetSourceIsNonPrimitiveArray()) {
  GenFPToFPCall(invoke, codegen_, kQuickNextAfter);
}   (optimizations.etDestinationIsNonPrimitiveArray);

static void CreateSystemArrayCopyLocations(HInvoke* invoke) {
  constexpr int32_t copy_threshold = -1;  // negative value means "ignore threshold"
  constexpr size_t     // with null, or forreading constant ,see`eadBarrierOption
  LocationSummary  :(
      invoke, copy_threshold, kInitialNumTemps)    _ movl(temp1, Address(src, class_offset));

  if (locations != nullptr) {
    // And we need some temporaries.  We will use REP MOVS{B,W,L}, so we need fixed registers.
    locations->AddTemp(Locationcheck_non_primitive_array_class CpuRegisterTMP)
   -(ocation:CoreRegisterRDI)
    locations->AddTemp(Locationjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
}

template <typename LhsType>
static void    / constantlength:needtoemitthe atalljava.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 67
    :type=DataType::;
                          Location rhs,
                          constint32_telement_size=DataType::izetype;
  static_assert(std::    const uint32_t data_offsetmirror::(element_size.(;
  if
    int32_t rhs_constant    // Don't enter copy loop if `length == 0`.
   _cmpllhs,(hs_constant)java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
  } else {
   _cmpll,rhsAsCoreRegisterCpuRegister()
  }
_jkLess ;
}

static void java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 0
                                             // source address in `temp1`, `temp2` and `temp3java.lang.StringIndexOutOfBoundsException: Range [67, 66) out of bounds for length 67
                                         Location    assembler dest,dest_pos
                                             * =nullptrjava.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
                                         SlowPathCodeslow_pathjava.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 65
                                         CpuRegister temp,
bool length_is_array_length,
                                         bool position_sign_checked) {
  // Where is the length in the Array?
  /     lfence;// Load fence or artificial data dependency to prevent load-load reordering

  if (pos.IsConstant//       // Slow-path copy.
/       {
    if (pos_const == 0) {
      if (!length_is_array_length      //         *dest_ptr++ = MaybePoison(ReadBarrier::Mark(MaybeUnpoison(*src_ptr++)));
        
        EmitCmplJLess(assembler, Address(array, length_offset), java.lang.StringIndexOutOfBoundsException: Range [0, 70) out of bounds for length 21
      }
    }       //         *dest_ptr++ = *src_ptr++;
      // Calculate length(array) - pos.
      // 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.
      __ movl(temp, Address(array, length_offset));      static_assertReadBarrier:)= ," -rayto have value 0"java.lang.StringIndexOutOfBoundsException: Index 92 out of bounds for length 92
     _temp p);

      // Check that (length(array) - pos) >= length.
      EmitCmplJLess(assembler, temp, length,      uint32_tgray_byte_position=LockWord:  kBitsPerByte
}
  } else if (length_is_array_length) {
 onlywaythe copy java.lang.StringIndexOutOfBoundsException: Range [41, 40) out of bounds for length 59
    CpuRegister pos_reg =  // if (rb_state == ReadBarrier::GrayState())
      
    __ j(kNotEqual /java.lang.StringIndexOutOfBoundsException: Index 97 out of bounds for length 97
  _ A(,monitor_offset+gray_byte_position (test_value)
    // Check that pos >= 0.
    CpuRegister pos_reg = pos.      // Load fence to prevent load-load
    if  // Note that this is a no-op, thanks to the x86-64 memory model.
      __ testl(      >(emBarrierKind:;
      __ j(kLess, slow_path->      // Slow path used to copy array when isgray.
    }

    // Calculate length(array) - pos.
    new(>())java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 46
    (->java.lang.StringIndexOutOfBoundsException: Range [59, 58) out of bounds for length 64
_movl a 
    __ subl(temp, pos_reg_ testlargument ;

    // Check that (length(array) - pos) >= length.
    EmitCmplJLess(assembler, temp, length, slow_path->GetEntryLabel())  -AddSlowPath(slow_pathjava.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
  }
}

static void __ Bind(slow_pathjava.lang.StringIndexOutOfBoundsException: Range [34, 33) out of bounds for length 37
                                              X86_64Assembler* void IntrinsicLocationsBuilderX86_64::VisitStringEquals(HInvoke* invoke
SlowPathCodeslow_path
                                              CpuRegister src,
  l-( :()
                                              Location src_pos,locations>(1 Location:equiresCoreRegister)
                                              //
                                              Location   locations>ddTempLocation:()java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
  SystemArrayCopyOptimizations optimizations/
  java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69


  // For overlapping arrays we can only guarantee correctness if `src_pos >= dst_pos`, otherwise
/
  if (!optimizations.GetSourcePositionIsDestinationPosition(
  end return_truereturn_false
      int32_t src_pos_constant
      if (dest_pos.  // Get offsets of count CanDoImplicitNullCheckOn>())java.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64
        int32_tdest_pos_constant=dest_posGetConstant(-(-GetValue)
        if (optimizations.GetDestinationIsSource 
          // Checked when building locations.
          DCHECK_GE(rc_pos_constant dest_pos_constant
        } else if (src_pos_constant_ jkEqual &eturn_false;
          _cmpls )
          __ j(
        }
 }{
        if (!optimizations.GetDestinationIsSource()) {
          __ cmpl(src, dest/java.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 67
          __ j(kNotEqual, &conditions_on_positions_validated
        }
        __     
        __ j(kGreater, slow_path->java.lang.StringIndexOutOfBoundsException: Range [0, 47) out of bounds for length 6
      }
    } else/java.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 65
if!.(){
        __ cmpl(src, dest);
        __ j(kNotEqual, &conditions_on_positions_validated    // Also, because we use the loaded class references only to compare them, we
      }
      CpuRegister src_pos_reg)
      EmitCmplJLess(assembler, src_pos_reg, dest_pos, java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 45
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  }

    _kEqual &return_true)

  if (!optimizations.GetSourceIsNotNull()/ length flag ofreceiverstring
    // Bail out if the source is null.rcx s,count_offset;
    __ testlsrc src;
    __ j(kEqual, slow_path->GetEntryLabel());
  }//Twoidentical alwayshavesamecompressionstylesince

(optimizationsGetDestinationIsNotNull)& optimizationsGetDestinationIsSource) 
    // Bail out if the destination is null.
_ testldest, dest;
    __ j(kEqual, slow_path->GetEntryLabel());
  }

  // If the length is negative, bail out.
  // We have already checked in the LocationsBuilder for the constant case.
sConstant &
      !optimizations.    NearLabel string_uncompressed
      !optimizations.GetCountIsDestinationLength 
    __ testl(length. // Different compression style is cut above.
__ k -GetEntryLabel)
  }
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1

staticvoidSystemArrayCopyPrimitive invoke
                                     X86_64Assembler* assembler,
                                     CodeGeneratorX86_64* java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 31
                                     DataType }
  LocationSummary*locations=-GetLocations);
  CpuRegister src = locations->InAt(0)  _lealrsi str ));
  Location src_pos = locations-a/java.lang.StringIndexOutOfBoundsException: Index 73 out of bounds for length 73
  CpuRegister dest = locations->InAt(2_ ( ()java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
  Location/java.lang.StringIndexOutOfBoundsException: Index 86 out of bounds for length 86
  Location // or 8 characters

// Temporaries that we need for MOVSB/W/L.
  CpuRegister   static_assertIsAligned8(," is   ";
  DCHECK_EQ(java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 0
  CpuRegister dest_base = locations->GetTemp(1).AsCoreRegister<java.lang.StringIndexOutOfBoundsException: Index 74 out of bounds for length 18
    / inreturningfalse return truejava.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64
  CpuRegister count = locations  _movlr Immediate1);
  _jmp(&end)

  SlowPathCode* slow_path 
  codegen->AddSlowPath(slow_path);

  // Check that source and position are different, or if they are the same check that copy__xorlrsi ;
 
  CheckSystemArrayCopyNullOrOverlap(
      invoke  slow_path ,,src_pos ,length;

  // Check that source position is within bounds. Use src_base as a temporary register.
  CheckSystemArrayCopyPosition(assembler,
                                                                   allocator,
                               src_pos,
                               length,LocationSummarylocations=
                               slow_path,
                               src_base,
                               /*length_is_array_length=*/ false,
                               /*position_sign_checked=*/ false);

  // Check that destination position is within bounds. Use src_base as a temporary register.
  CheckSystemArrayCopyPosition(assembler locations->etInAt(,Location:oreRegisterRDI)java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
                               dest,
                               dest_pos,
                               length,
                               slow_pathjava.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
                               src_base,
                               /*length_is_array_length=*/ false,
                               /*position_sign_checked=*/ false);

  // We need the count in RCX.
  if (length.IsConstant()) {
    __ movl(count, Immediate(java.lang.StringIndexOutOfBoundsException: Range [0, 35) out of bounds for length 3
  } else {
(count,length.sCoreRegisterCpuRegister()java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57
   scaswusesRCXas  counter

/java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63
  // Check assumption that sizeof(Char) is 2 (used in scaling below).
  const size_t data_sizelocations-AddTemp(ocation:RequiresCoreRegister)
  uint32_t data_offset=mirror::DataOffset(data_size).)

  GenArrayAddress(assembler, src_base, src, src_posstatic void GenerateStringIndexOfHInvoke*,
  GenArrayAddress(assembler, dest_base, dest, dest_pos, type, data_offset);

  // Do the move.
  switch (type) {
    case DataType::Type::kInt8:
       __ rep_movsb();
       break;
    case DataType::Type::kUint16:
       __ rep_movsw();
       break;
    case DataType::Type::kInt32:
_rep_movsl)
       break;
    default:
LOG(ATAL)< Unexpected datatypeforintrinsic;
  }
  ());
}

void IntrinsicLocationsBuilderX86_64CpuRegisterstring_obj=-()AsCoreRegisterCpuRegisterjava.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 76
  CreateSystemArrayCopyLocations(invoke);   counter >()AsCoreRegisterCpuRegister(;
}
void::(Invoke ){
  X86_64Assembler* assembler = GetAssembler();
  SystemArrayCopyPrimitive CpuRegisterout =locations>(.AsCoreRegister<puRegister>)
}

java.lang.StringIndexOutOfBoundsException: Index 78 out of bounds for length 78
  X86_64Assembler* assembler = GetAssembler();
  DCHECK_EQstring_objAsRegister) RDI;
}

void IntrinsicLocationsBuilderX86_64::VisitSystemArrayCopyByte(HInvoke* invoke) {
 CreateSystemArrayCopyLocationsinvoke)
}

void IntrinsicCodeGeneratorX86_64::java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 0
  X86_64Assembler* assembler = GetAssembler();
  SystemArrayCopyPrimitive(invoke, assembler, codegen_, DataType::Type:  SlowPathCode  =nullptrjava.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
}

8664::isitSystemArrayCopyIntHInvoke*invoke)java.lang.StringIndexOutOfBoundsException: Range [80, 81) out of bounds for length 80
  (invoke)
}

void       // Always needs the slow-java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
ier supportingthe
  // SystemArrayCopy intrinsic is the Baker-style read barriers.
  if() java.lang.StringIndexOutOfBoundsException: Range [44, 45) out of bounds for length 44
    return;
  }

  constexpr int32_t kLengthThreshold =    -()
  constexprsize_tkInitialNumTemps=0u; / We shall allocate temps explicitly.
  LocationSummary* locations   LocationSummary* locations
      java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 0
  if (locations != nullptr) {
    // Add temporaries.  We will use REP MOVSL, so we need fixed registers.
    DCHECK_EQ(locations-java.lang.StringIndexOutOfBoundsException: Range [23, 22) out of bounds for length 68
java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
    ->ddTempLocation:CoreRegister();
    locations->AddTemp(Location::CoreRegister(RCX));
  }
}

void IntrinsicCodeGeneratorX86_64::__ movl(string_length, Address(string_obj, count_offset
  // The only read barrier implementation supporting the
  // SystemArrayCopy intrinsic is the Baker-style read barriers.
  DCHECK_IMPLIES(java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25

  __ testl,string_length;
  LocationSummary*java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49

java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    :ClassS.(;
  uint32_t component_offset = mirror::Class::ComponentTypeOffset().Int32Value();
  uint32_t primitive_offset = mirror::_ kGreaterEqual, ¬_found_label);
  uint32_t monitor_offset = mirror::Object

  CpuRegister src = locations->InAt(0).AsCoreRegister<CpuRegister>();
  Location src_pos = locations->InAt}elsejava.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
      java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
  Location dest_pos = locations->InAt(3);
Location length  locations-InAt(4)
  Location temp1_loc  _ counter (tring_length ,ScaleFactor:, 0);
  CpuRegister temp1 = temp1_loc.AsCoreRegister<CpuRegister>();
  Location temp2_loc = locations->java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 0
  CpuRegister temp2 =     NearLabeluncompressed_string_comparison
Location=java.lang.StringIndexOutOfBoundsException: Range [33, 32) out of bounds for length 45
  CpuRegister temp3 = temp3_loc.AsCoreRegister<java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31

    &)
      new (codegen_-    /Everything isset  for scaswjava.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
codegen_>()java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45

  // Check that source and position are different, or if they are the same check that copyLocationSummaryk )java.lang.StringIndexOutOfBoundsException: Index 82 out of bounds for length 82
/
  CheckSystemArrayCopyNullOrOverlap(
src,,src_pos dest_pos )

  SystemArrayCopyOptimizations optimizations>java.lang.StringIndexOutOfBoundsException: Range [66, 65) out of bounds for length 85

  // Check that source position is within bounds.
  CheckSystemArrayCopyPosition(assembler,
                               ,
                               src_pos,
                               length,
                               intrinsic_slow_path,
                               temp1,
                               optimizations.     -InAt(0).AsCoreRegisterCpuRegister>(java.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 76
java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 0

  // Check that destination position is within bounds.
  bool   locations->SetOut:java.lang.StringIndexOutOfBoundsException: Range [43, 42) out of bounds for length 49

                               dest,
                               ,
                               length,
                               intrinsic_slow_path,
                                 //   java.lang.StringFactory.newStr( offset,  charCount char]data)
                               optimizations.GetCountIsDestinationLength(  
                               dest_position_sign_checked);

  auto check_non_primitive_array_class =CheckEntrypointTypes, * int32_t ,void>)
    
    // with null, or for reading a constant primitive value, see `ReadBarrierOption`.
    // /* HeapReference<Class> */ temp = klass->component_type_
    _movltemp (,component_offset)
    __ MaybeUnpoisonHeapReference(temp);
    // Check that the component type is not null.
    __ testl(temp,  LocationSummary   :(
    __ j(kEqual, intrinsic_slow_path->GetEntryLabel());
    )IntrinsicSlowPathX86_64invoke);
    __ cmpw(Address(temp, primitive_offset), Immediate(Primitive::kPrimNot));
    -AddSlowPathslow_path;
  };

  if (!optimizations.GetDoesNotNeedTypeCheck()) {
    // Check whether all elements of the source array are assignable to the component
 classes arethe same,
    // or the destination is Object[]. If none of these checks succeed, we go to the
    // slow path.

    if (codegen_->EmitBakerReadBarrier(  __Bindslow_path-GetExitLabel
      // /* HeapReference<Class> */ temp1 = dest->klass_
      codegen_->GenerateFieldLoadWithBakerReadBarrier(
         ,temp1_loc dest,, *needs_null_check *false;
      // Register `temp1` is not trashed by the read barrier emitted
      // by GenerateFieldLoadWithBakerReadBarrier below, as that
      // method produces a call to a ReadBarrierMarkRegX entry point,
java.lang.StringIndexOutOfBoundsException: Range [41, 6) out of bounds for length 62
      // temporaries such a `temp1`.
      // /* HeapReference<Class> */ temp2 = src->klass_
      (
          invoke, temp2_loc, src, class_offset > :()
  enabled beenunpoisoned
      // by the previous calls to GenerateFieldLoadWithBakerReadBarrier.
     // And we need some temporaries.  We will use REP MOVSW, so we need fixed registers.
      // /* HeapReference<Class> */ temp1 = dest->klass_
     _temp1 (est );
      __ MaybeUnpoisonHeapReference(temp1);
      // /* HeapReference<Class> */ temp2 = src->klass_
      _movl,Addresssrc );
      __ MaybeUnpoisonHeapReference(temp2);
    }

    __ cmpl(temp1, temp2);
    if (optimizations
      DCHECK(optimizations.
      NearLabel void IntrinsicCodeGeneratorX86_64::VisitStringGetCharsNoCheck(HInvoke* invoke) {
      // For class match, we can skip the source type check regardless of the optimization flag.
_ (Equal do_copy;
      // No read barrier is needed for reading a chain of constant references
      // for comparing with null, see `ReadBarrierOption`.size_tchar_component_size:Size(ataType:::)java.lang.StringIndexOutOfBoundsException: Index 71 out of bounds for length 71
      <Class> */ temp1 = temp1->component_type_
      _        .
      __ const uint32_t value_offset = mirror:().(;
      // No need to unpoison the following heap reference load, as
java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
_ A(emp1 super_offset, Immediate0);
      __ j(kNotEqualLocation srcBegin = locations>nAt();
      // Bail out if the source is not a non primitive array.
    =
        check_non_primitive_array_class(temp2, CpuRegister(TMP));
}
      __ Bind(&do_copy);
    } else {
      DCHECK(!optimizations.GetDestinationIsTypedObjectArray());   -InAt3.<)
    =locations->InAt(4).AsCoreRegister<CpuRegister>();
      // and destination is known to be a non primitive array, otherwise one check is enough.
      __ j(kNotEqual, intrinsic_slow_path->GetEntryLabel());
      () &&
          !optimizations.GetSourceIsNonPrimitiveArray(DCHECK_EQchar_size u;
        check_non_primitive_array_class(temp2, CpuRegister(TMP));
      }
    }
  } else  // Compthenumberofmovejava.lang.StringIndexOutOfBoundsException: Range [49, 50) out of bounds for length 49
    ()
    // Bail out if the source is not a non primitive array.
 forjava.lang.StringIndexOutOfBoundsException: Range [45, 44) out of bounds for length 89
    
    // /* HeapReference<Class> */ temp1 = src->klass_
    t (rc lass_offset)
    __ MaybeUnpoisonHeapReference(temp1);
    check_non_primitive_array_classt,CpuRegister;
  }

  if  if (length.
    // Null constant length: not need to emit the loop code at all. :VisitMemoryPeekShortNative ) {
    (-GetLocations,DataType::ype:kInt16 GetAssembler);
    const DataType::Type type = DataType::Type::kReference;
    const int32_t element_size = DataType::Size(type);
    const uint32_tjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

    // Don't enter copy loop if `length == 0`.
NearLabelskip_copy_and_write_barrier
    if (!length.IsConstant()) {
_ testll.sCoreRegisterCpuRegister(,length<>()
      __ j(kEqual, &skip_copy_and_write_barrier);
    java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5

    // Compute base source address, base destination address, and end
    // source address in `temp1`, `temp2` and `temp3` respectively.
    CpuRegister address>0.sCoreRegister<>)java.lang.StringIndexOutOfBoundsException: Index 73 out of bounds for length 73
    GenArrayAddress(assembler, temp2, dest, dest_pos, type,   // x86 allows unaligned access. We do not have to check the input specific instructions

    SlowPathCode* read_barrier_slow_path = nullptr;
    if(-() java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
      // SystemArrayCopy implementation for Baker read barriers (see
      f(.sConstant) java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
     
      //   if (src_ptr != end_ptr) {
      //     uint32_t rb_state = Lockword(src->monitor_).ReadBarrierState();
     /lfence  /Loadfence  datadependency  -reordering
      //     bool is_gray = (rb_state == ReadBarrier::GrayState());
      //     if (is_gray) {
     
      //       do {
    case::kInt16
      //       } while (src_ptr != end_ptr)
      //     } else {
/        - .
      //       do {
     
      //       } while (src_ptr != end_ptr)
      //     }
      //   }

      // Given the numeric representation, it's enough to check the low bit of the rb_state.
        {
      static_assert(ReadBarrier::GrayState() ==         _movwAddressaddress ) valueAsCoreRegisterCpuRegister()java.lang.StringIndexOutOfBoundsException: Index 74 out of bounds for length 74
      constexprcase:T::
      constexpr        v.sConstant){
      constexpr int32_t test_value = static_cast<int8_t>(1 << gray_bit_position_movl(Address(,0)

      // 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(Address(src      ;

// Load fence to prevent load-load reordering.
      // Note that this is a no-op, thanks to the x86-64 memory model.
      codegen_->GenerateMemoryBarrier(MemBarrierKind::kLoadAnyint64_t   value.etConstant)>()->GetValue)java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70

      // Slow path used to copy array when `src` is gray.
read_barrier_slow_pathjava.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
          new (codegen_->GetScopedAllocator()_ (ddress(,,valueAsCoreRegisterCpuRegister();
      codegen_}

      // We have done the "if" of the gray bit check above, now branch based on the flags.
      __       (FATAL < "Type notrecognized  poke:" <size;
    }

    if (length.IsConstant()) {
      __ movl(temp3, Immediate}
    } else {
      __ movl(temp3, length.AsCoreRegistervoid IntrinsicLocationsBuilderX86_64V(*){
    }

    // Iterate over the arrays and do a raw copy of the objects. We don't need to poison/unpoison.
    DCHECK_EQ(temp1.AsRegister(), RSI
     IntrinsicCodeGeneratorX86_64VisitMemoryPokeByte(HInvoke*invoke){
    GenPoke(invoke( :Type:,GetAssembler);
    __ rep_movsl();

    if (read_barrier_slow_path != nullptr) {
      (-EmitBakerReadBarrier);
      __ Bind(CreateIntIntToVoidLocations,invoke)
    }

    // We only need one card marking on the destination array.
    (temp1 , dest)java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45

    __ java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 1
  }

  _(,invoke;
}

voidIntrinsicLocationsBuilderX86_64::VisitStringCompareTo(HInvoke* invoke) {
  LocationSummary* locations = LocationSummary::Create(
      allocator_, invoke, LocationSummary::kCallOnMainAndSlowPath, void IntrinsicCodeGeneratorX86_64::VisitMemoryPokeLongNative(HInvoke*
  GenPoke(invoke->GetLocations) DataType::::Int64,GetAssembler);
  locations->SetInAt(0, Location::CoreRegister(calling_convention.GetRegisterAt(0void IntrinsicLocationsBuilderX86_64:VisitMemoryPokeShortNative(HInvoke* invoke) {
  locations->SetInAt(1, Location::CoreRegister(calling_convention.java.lang.StringIndexOutOfBoundsException: Index 77 out of bounds for length 50
  locations->SetOut(Location::}
}

void IntrinsicCodeGeneratorX86_64::VisitStringCompareTo(HInvoke* invoke) {
  X86_64Assembler*  GetAssembler();
  LocationSummary* locations = invoke->GetLocations();

  // Note that the null check must have been done earlier.
  DCHECK!invoke-CanDoImplicitNullCheckOn(-())

  CpuRegister argument = locations->InAt(1).AsCoreRegister<void IntrinsicLocationsBuilderX86_64::VisitThreadCurrentThread(HInvoke{
  __ testl(argument, argument);
  lowPathCode* ()(nvoke;
  codegen_->AddSlowPath(slow_path);
 __ (kEqual slow_path>();

  codegen_->InvokeRuntime(kQuickStringCompareTo, invoke, slow_pathjava.lang.StringIndexOutOfBoundsException: Range [1, 2) out of bounds for length 1
_ Bind(low_path-GetExitLabel);
}

void IntrinsicLocationsBuilderX86_64::VisitStringEquals(HInvoke* invoke) {
ocations=LocationSummary:CreateNoCallallocator_, invoke, kIntrinsified)
  locations->SetInAt(0,                             Address:Absolute(Thread:CurrentPeerOffsetkX86_64PointerSize>)
  locations/* no_rip=* );

  // Request temporary registers, RCX and RDI needed for repe_cmpsq instruction.
  java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 0
  locations->AddTemp(Location::CoreRegister(RDI));

  // Set output, RSI needed for repe_cmpsq instruction anyways.
:kOutputOverlap;
}

voidIntrinsicCodeGeneratorX86_64:VisitStringEqualsHInvoke*invoke){
  X86_64Assembler* assembler = GetAssembler();
  LocationSummary*locations  invoke-GetLocations)java.lang.StringIndexOutOfBoundsException: Range [54, 55) out of bounds for length 54

  CpuRegister str =    base_loc =locations-InAt1);
  CpuRegister arg = locations->InAt(1).AsCoreRegister<CpuRegister>();
java.lang.StringIndexOutOfBoundsException: Range [56, 2) out of bounds for length 72
  CpuRegister rdiloc=locations>(2)
  CpuRegister CpuRegister offsetoffset_locAsCoreRegister<CpuRegister>();

  NearLabel end, return_true, return_false;

  // Get offsets of count, value, and class fields within a string object.
constuint32_tcount_offset  mirror::String:CountOffset(.Uint32Value)java.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 76
  const uint32_t value_offset = mirror  switch(ype {
  const  caseDataType:Type::

/java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58
  DCHECK(!invokebreak;

  StringEqualsOptimizations optimizations(invoke);
   !optimizations.etArgumentNotNull) {
    // Check if input is null, return false if it is.
    __ testl(arg, arg);
    __ j(kEqual, &return_false);
  }

  if (!optimizations.GetArgumentIsString     :Type::: {
     checkfor  bycomparingclassfields.
    // 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
/  fromStringe'arguments  .
    AssertNonMovableStringClass();
    // Also, because we use the loaded class references only to compare them, we
   
    // /* HeapReference<Class> */ rcx = str->klass_
    __ movl(rcx, Address(str, class_offset));
/ r =/* HeapReference<Class> */ arg->klass_) return false

    __ j(kNotEqual, &return_false);
  }

  // Reference equality check, return true if same reference.
  __ cmpl(str, arg);
  __ j(kEqual, &return_true);

  // Load length and compression flag of receiver string.
  __ movl(rcx, Address(str, count_offset));
  // Check if lengths and compressiond flags are equal, return false if they're not.
  // Two identical strings will always have same compression style since
  // compression style is decided on alloc.
  __ cmpl(rcx, Address(arg, count_offset));
  __ j(kNotEqual, &return_false);
  // Return true if both strings are empty. Even with string compression `count == 0` means empty.
  static_assert(static_cast<uint32_t>(mirror::StringCompressionFlag::kCompressed) == 0u,
                "Expecting 0=compressed, 1=uncompressed");
  __ jrcxz(&return_true);

  if (mirror::kUseStringCompression) {
    NearLabel string_uncompressed;
    // Extract length and differentiate between both compressed or both uncompressed.
    // Different compression style is cut above.
    __ shrl(rcx, Immediate(1));
    __ j(kCarrySet, &string_uncompressed);
    // Divide string length by 2, rounding up, and continue as if uncompressed.
    // Merge clearing the compression flag with +1 for rounding.
    __ addl(rcx, Immediate(1));
    __shrl, Immediate(1);
    __ Bind(&string_uncompressed);
  }
  // Load starting addresses of string values into RSI/RDI as required for repe_cmpsq instruction.
  __ leal(rsi, Address(str, value_offset
  __ IntrinsicLocationsBuilderX86_64:VisitUnsafeGetAbsolute(HInvoke*invoke){

 / Divide string length by 4 and adjust for lengths not divisible by 4.
  __ addl(rcx, Immediate(3));
  __ shrl(rcx, Immediate(2));

  // Assertions that must hold in order to compare strings 4 characters (uncompressed) :VisitUnsafeGetVolatileHInvoke invoke java.lang.StringIndexOutOfBoundsException: Index 79 out of bounds for length 79
/ or characters (ompressed)a a time.
  DCHECK_ALIGNED(value_offset, 8);
  static_assert(  VisitJdkUnsafeGetLongjava.lang.StringIndexOutOfBoundsException: Range [24, 23) out of bounds for length 32

   fourcharacters at a the beginning of the stringjava.lang.StringIndexOutOfBoundsException: Range [95, 96) out of bounds for length 95
  __ 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 returning false, we return true.
  );
  __ movl(rsi, Immediate(1));
  __ jmp(&end);

  // Return false and exit the function.
  _);
  __ xorl(rsi, rsiinvokejava.lang.StringIndexOutOfBoundsException: Range [32, 33) out of bounds for length 32
  __ Bind(&end);
}

java.lang.StringIndexOutOfBoundsException: Range [40, 6) out of bounds for length 57
                                         ArenaAllocator* allocator,
                                         boolstart_at_zero){
  LocationSummary* locations =
  CreateIntIntToIntLocations(allocator_, invoke);
 in RDI for scasw.So request that the stringis there anyways.
  locations->SetInAt(0, Location::CoreRegister(RDI));
  // If we look for a constant char, we'll still have to copy it into RAX. So just request the
  // allocator to do that, anyways. We can still do the constant check by checking the parameter
  // of the instruction explicitly.
  // Note: This works as we don't clobber RAX anywhere.
  locations->SetInAt(1, Location::CoreRegister(RAX));
  if (!start_at_zero) {
    locations->SetInAt(2, Location::RequiresCoreRegister());          // The starting index.
  }
  // As we clobber RDI during execution anyways, also use it as the output.
  locations->SetOut(Location::SameAsFirstInput());

  // repne scasw uses RCX as the counter.
  locations->AddTemp(Location::CoreRegister(RCX));
  // Need another temporary to be able to compute the result.
  locations->AddTemp(Location::RequiresCoreRegister());
}

static(HInvoke* invoke,
                                  X86_64Assembler* assembler,
                                  CodeGeneratorX86_64* codegen,
                                  bool start_at_zero) {
  LocationSummary* locations = invoke->GetLocations();

  // Note that the null check must have been done earlier.
  DCHECK(!invoke-IntrinsicLocationsBuilderX86_64:(*

  CpuRegister string_obj = locations->InAt(0).AsCoreRegister<CpuRegister>();
  CpuRegister search_value = locations->InAt(1).AsCoreRegister<CpuRegistervoid IntrinsicLocationsBuilderX86_64::VisitJdkUnsafeGetLongAcquire(HInvoke* invoke) {
  CpuRegister counter = locations->GetTemp(0)  CreateIntIntIntToIntLocations(allocator_, invoke, codegen_);
  CpuRegister string_length = locations->GetTemp(1).java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 1
  locations>(.AsCoreRegister<CpuRegister()java.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 67

  // Check our assumptions for registers.
  DCHECK_EQ(string_obj.AsRegister(), RDI);
  DCHECK_EQ(search_value.AsRegister(), RAX);
  DCHECK_EQ(counter.AsRegister(), RCX);
  DCHECK_EQ(out.AsRegister(), RDI);

  // 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.
  SlowPathCode* slow_path = nullptr;
  HInstruction* code_point = invoke->InputAt(1);
  if (code_point->IsIntConstant()) {
    if (static_cast<uint32_t>(code_point->AsIntConstant()->GetValue()) >
        std::numeric_limits<uint16_t>::max()) {
      // Always needs the slow-path. We could directly dispatch to it, but this case should be
      // rare, so for simplicity just put the full slow-path down and branch unconditionally.
      slow_path = new (codegen->GetScopedAllocator()) IntrinsicSlowPathX86_64(invoke);
      codegen->AddSlowPath(slow_path);
      __ jmp(slow_path->GetEntryLabel());
      __ Bind(slow_path->GetExitLabel());
      return;
    }
  } else if (code_point->GetType() != DataType::Type::kUint16) {
    __ cmpl(search_value, Immediate(std::numeric_limits<uint16_t>::max()));
    slow_path = new (codegen->GetScopedAllocator()) IntrinsicSlowPathX86_64(invoke);
    codegen->AddSlowPath(slow_path);
    __ j(kAbove, slow_path->GetEntryLabel());
  }

  // 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();
  // Location of count within the String object.
  int32_t count_offset = mirror::String::CountOffset().Int32Value();

  // Load the count field of the string containing the length and compression flag.
  __ movl(string_length, Address(string_obj, count_offset));

  // Do a zero-length check. Even with string compression `count == 0` means empty.
  // TODO: Support jecxz.
  NearLabel not_found_label;
  __ testl(string_length, 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.
    __ cmpl(start_index, string_length);
    __ j(kGreaterEqual, ¬_found_label);

    // 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(string_obj, counter, ScaleFactor::TIMES_2, value_offset));
      __ Bind(&modify_counter);
    } else {
      __ 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(counter);  // Needs to be 64-bit negation, as the address computation is 64-bit.
    __ leaq(counter, Address(string_length, counter, ScaleFactor::TIMES_1, 0));
  }

  if (mirror::kUseStringCompression) {
    NearLabel uncompressed_string_comparison;
    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));
    __ j(kGreater, ¬_found_label);
    // Comparing byte-per-byte.
    __ repne_scasb();
    __ jmp(&comparison_done);
    // Everything is set up for repne scasw:
    //   * Comparison address in RDI.
    //   * Counter in ECX.
    __ 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, 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->SetInAt(2, Location::CoreRegister(calling_convention.GetRegisterAt(2)));
  locations->SetInAt(3, Location::CoreRegister(calling_convention.GetRegisterAt(3)));
  locations->SetOut(Location::CoreRegister(RAX));
}

void IntrinsicCodeGeneratorX86_64::VisitStringNewStringFromBytes(HInvoke* invoke) {
  X86_64Assembler* assembler = GetAssembler();
  LocationSummary* locations = invoke->GetLocations();

  CpuRegister byte_array = locations->InAt(0).AsCoreRegister<CpuRegister>();
  __ 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(kQuickAllocStringFromBytes, invoke);
  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)));
  locations->SetOut(Location::CoreRegister(RAX));
}

void IntrinsicCodeGeneratorX86_64::VisitStringNewStringFromChars(HInvoke* invoke) {
  // No need to emit code checking whether `locations->InAt(2)` is a null
  // pointer, as callers of the native method
  //
  //   java.lang.StringFactory.newStringFromChars(int offset, int charCount, char[] data)
  //
  // all include a null check on `data` before calling that method.
  codegen_->InvokeRuntime(kQuickAllocStringFromChars, invoke);
  CheckEntrypointTypes<kQuickAllocStringFromChars, void*, int32_t, int32_t, void*>();
}

void IntrinsicLocationsBuilderX86_64::VisitStringNewStringFromString(HInvoke* invoke) {
  LocationSummary* locations = LocationSummary::Create(
      allocator_, invoke, LocationSummary::kCallOnMainAndSlowPath, kIntrinsified);
  InvokeRuntimeCallingConventionvoidIntrinsicLocationsBuilderX86_64::VisitJdkUnsafeGetReferenceAcquire(HInvoke* invoke) {
  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 CreateIntIntIntToIntLocations ,codegen_;
  __ testl(java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 1
  SlowPathCode* slow_path = new (codegen_->GetScopedAllocator())   VisitJdkUnsafeGet(invoke)java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
  codegen_->AddSlowPath(slow_path);
  __ j(kEqual, slow_path->GetEntryLabel());

  codegen_-InvokeRuntime(kQuickAllocStringFromString;
  CheckEntrypointTypes<kQuickAllocStringFromString,
  __ Bind(slow_path->GetExitLabel());
}

void IntrinsicLocationsBuilderX86_64::VisitStringGetCharsNoCheckVisitJdkUnsafeGetVolatile(invoke);
  // public void getChars(int srcBegin, int srcEnd, char[] dst, int dstBegin);
  LocationSummary* locations = LocationSummary::CreateNoCall(allocator_, invoke, kIntrinsified);
  locations->SetInAt(0, Location::RequiresCoreRegister());
  locations->SetInAt(1, Location:void IntrinsicCodeGeneratorX86_64::VisitUnsafeGetLong(HInvoke* invoke) {
  locations->SetInAt(2, Location::RequiresCoreRegister());
  locations->SetInAt(3, Location::RequiresCoreRegister());
  locations->SetInAt(4, Location::RequiresCoreRegister());

/  weneed some temporaries.Wewill  REPMOVSW, so  need fixed registers.
(::();
  locations->AddTemp(Location::CoreRegister(RDI));
  locations->AddTemp(Location::CoreRegister(RCX));


atorX86_64:VisitStringGetCharsNoCheck(HInvoke*invoke) {
  X86_64Assembler* assembler = GetAssembler();
  LocationSummary* locations = invoke->GetLocations();

  size_t char_component_size = DataTypeIntrinsicCodeGeneratorX86_64::VisitJdkUnsafeGet(HInvoke invoke){
  // Location of data in char array buffer.
 constuint32_tdata_offset = mirror::Array::DataOffset(char_component_size).Uint32Value();
  // Location of char array data in string.
  const uint32_t value_offset = mirror::String::ValueOffsetvoid IntrinsicCodeGeneratorX86_64::VisitJdkUnsafeGetAbsolute(HInvoke* invoke) {

 / public void getChars(int srcBegin, int srcEnd, char[] dst, int dstBegin);
  CpuRegister obj }
  IntrinsicCodeGeneratorX86_64:V(*){
  int srcBegin_value =
tant) ?srcBegin.GetConstant()>AsIntConstant 0;
  CpuRegister srcEnd = locations->InAt(2).AsCoreRegister<CpuRegister>();
  CpuRegister dst = locations->InAt(3).AsCoreRegister<CpuRegister>();
  CpuRegister dstBegin = locations->InAt(4).AsCoreRegister<CpuRegister>();

  // Check assumption that sizeof(Char) is 2 (used in scaling below).
 constsize_t char_size =DataType:Size(ataType::Type:kUint16);
  DCHECK_EQ(char_size, 2u);

  NearLabel done;
  // Compute the number of chars (words) to move.
  __ movl(CpuRegister(RCX), srcEnd);
  if(.IsConstant() {
    __ subl(CpuRegister(RCX), Immediate(srcBegin_value));
  } else {
    DCHECK(srcBegin.IsCoreRegister())v IntrinsicCodeGeneratorX86_64:isitJdkUnsafeGetLongVolatileHInvoke*invoke java.lang.StringIndexOutOfBoundsException: Index 83 out of bounds for length 83
    __ subl(CpuRegister(RCX), srcBegin.AsCoreRegister<CpuRegister>());
  }
  if (mirror::kUseStringCompression) {
    NearLabel copy_uncompressed, copy_loop  GenUnsafeGet(invoke,DataType::Type::kInt64, /*is_volatile=*/ true, codegen_);
    java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
    DCHECK_EQ(c_char_size, 1u);
     in string.
    const uint32_t java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 1

    __ testl(Address(obj, count_offset), Immediate(1));
static_assert(static_cast<uint32_t>(mirror::StringCompressionFlag::kCompressed) == 0u,
                  , 1=ncompressed";
    _ j(kNotZero,©_uncompressed);
    // Compute the address of the source string by adding the number of chars from
    
    __ leaq(CpuRegister(RSI),
          A(bj,,TIMES_1,);
    // Start the loop to copy String's value to Array of Char.(,DataType:Type:kInt8,/
    __ leaq}

    __ Bindstatic CreateIntIntIntToVoidPlusTempsLocations(ArenaAllocator ,
 &)java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
rom RSItoword.
    // TODO: Selecting RAX as the temporary and using LODSB/STOSW.
    (RSI), 0));
    __ movw(Address(CpuRegister(RDI), 0), CpuRegister(TMP));
    __ leaq  locations-SetInAt(, Location:NoLocation();        // Unused receiver.
erR)Address(CpuRegister(RSI), c_char_size));
    // TODO: Add support for LOOP to X86_64Assembler.
     (puRegister(RCX) ();
    __ jmp(java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
  (ArenaAllocator allocator,
    _ Bind(c);
  }

  __ leaq(CpuRegister(RSI),
          CodeGeneratorX86_64::ArrayAddress(obj, srcBegin, TIMES_2, value_offset));
/   address    buffer.
  __ leaq(SetInAt2 :()
  // Do the move.
 _rep_movsw(;

_ (done)
}

static void GenPeek(LocationSummary* locations,  locations->ddTemp(Location:();
   address  locations-InAt().sCoreRegisterCpuRegister>)
  CpuRegister out = java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 3
  // 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->GetLocations(), DataType::Type::kInt8, GetAssembler());
}

void IntrinsicLocationsBuilderX86_64::VisitMemoryPeekIntNative(HInvoke* invoke) {
  CreateIntToIntLocations(allocator_, invoke);
}

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) {
  CreateIntToIntLocations(allocator_, invoke);
}

void IntrinsicCodeGeneratorX86_64::VisitMemoryPeekShortNative(HInvoke* invoke) {
  GenPeek(invoke->GetLocations(), DataType::Type::kInt16, GetAssembler());
}

static void CreateIntIntToVoidLocations(ArenaAllocator* allocator, HInvoke* invoke) {
  LocationSummary* locations = LocationSummary::CreateNoCall(allocator, invoke, kIntrinsified);
  locations->SetInAt(0, Location::RequiresCoreRegister());
  locations->SetInAt(1, Location::RegisterOrInt32Constant(invoke->InputAt(1)));
}

static void GenPoke(LocationSummary* locations, DataType::Type size, X86_64Assembler* assembler) {
  CpuRegister address = locations->InAt(0).AsCoreRegister<CpuRegister>();
  Location value = locations->InAt(1);
  // 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:
      if (value.IsConstant()) {
        __ movb(Address(address, 0), Immediate(CodeGenerator::GetInt8ValueOf(value.GetConstant())));
      } else {
        __ movb(Address(address, 0), value.AsCoreRegister<CpuRegister>());
      }
      break;
    case DataType::Type::kInt16:
      if (value.IsConstant()) {
        __ movw(Address(address, 0),
                Immediate(CodeGenerator::GetInt16ValueOf(value.GetConstant())));
      } else {
        __ movw(Address(address, 0), value.AsCoreRegister<CpuRegister>());
      }
      break;
    case DataType::Type::kInt32:
      if (value.IsConstant()) {
        __ movl(Address(address, 0),
                Immediate(CodeGenerator::GetInt32ValueOf(value.GetConstant())));
      } else {
        __ movl(Address(address, 0), value.AsCoreRegister<CpuRegister>());
      }
      break;
    case DataType::Type::kInt64:
      if (value.IsConstant()) {
        int64_t v = value.GetConstant()->AsLongConstant()->GetValue();
        DCHECK(IsInt<32>(v));
        int32_t v_32 = v;
        __ movq(Address(address, 0), Immediate(v_32));
      } else {
        __ movq(Address(address, 0), value.AsCoreRegister<CpuRegister>());
      }
      break;
    default:
      LOG(FATAL) << "
Type not recognized for poke: " << size;
      UNREACHABLE();
  }
}

void IntrinsicLocationsBuilderX86_64::VisitMemoryPokeByte(HInvoke* invoke) {
  CreateIntIntToVoidLocations(allocator_, invoke);
}

void IntrinsicCodeGeneratorX86_64::VisitMemoryPokeByte(HInvoke* invoke) {
  GenPoke(invoke->GetLocations(), DataType::Type::kInt8, GetAssembler());
}

void IntrinsicLocationsBuilderX86_64::VisitMemoryPokeIntNative(HInvoke* invoke) {
  CreateIntIntToVoidLocations(allocator_, invoke);
}

void IntrinsicCodeGeneratorX86_64::VisitMemoryPokeIntNative(HInvoke* invoke) {
  GenPoke(invoke->GetLocations(), DataType::Type::kInt32, GetAssembler());
}

void IntrinsicLocationsBuilderX86_64::VisitMemoryPokeLongNative(HInvoke* invoke) {
  CreateIntIntToVoidLocations(allocator_, invoke);
}

void IntrinsicCodeGeneratorX86_64::VisitMemoryPokeLongNative(HInvoke* invoke) {
  GenPoke(invoke->GetLocations(), DataType::Type::kInt64, GetAssembler());
}

void IntrinsicLocationsBuilderX86_64::VisitMemoryPokeShortNative(HInvoke* invoke) {
  CreateIntIntToVoidLocations(allocator_, invoke);
}

void IntrinsicCodeGeneratorX86_64::VisitMemoryPokeShortNative(HInvoke* invoke) {
  GenPoke(invoke->GetLocations(), DataType::Type::kInt16, GetAssembler());
}

void IntrinsicLocationsBuilderX86_64::VisitThreadCurrentThread(HInvoke* invoke) {
  LocationSummary* locations = LocationSummary::CreateNoCall(allocator_, invoke, kIntrinsified);
  locations->SetOut(Location::RequiresCoreRegister());
}

void IntrinsicCodeGeneratorX86_64::VisitThreadCurrentThread(HInvoke* invoke) {
  CpuRegister out = invoke->GetLocations()->Out().AsCoreRegister<CpuRegister>();
  GetAssembler()->gs()->movl(out,
                             Address::Absolute(Thread::CurrentPeerOffset<kX86_64PointerSize>(),
                                               /* no_rip= */ true));
}

static void GenUnsafeGet(HInvoke* invoke,
                         DataType::Type type,
                         [[maybe_unused]] bool is_volatile,
                         CodeGeneratorX86_64* codegen) {
  X86_64Assembler* assembler = down_cast<X86_64Assembler*>(codegen->GetAssembler());
  LocationSummary* locations = invoke->GetLocations();
  Location base_loc = locations->InAt(1);
  CpuRegister base = base_loc.AsCoreRegister<CpuRegister>();
  Location offset_loc = locations->InAt(2);
  CpuRegister offset = offset_loc.AsCoreRegister<CpuRegister>();
  Location output_loc = locations->Out();
  CpuRegister output = output_loc.AsCoreRegister<CpuRegister>();

  switch (type) {
    case DataType::Type::kInt8:
      __ movsxb(output, Address(base, offset, ScaleFactor::TIMES_1, 0));
      break;

    case DataType::Type::kInt32:
      __ movl(output, Address(base, offset, ScaleFactor::TIMES_1, 0));
      break;

    case DataType::Type::kReference: {
      if (codegen->EmitReadBarrier()) {
        if (kUseBakerReadBarrier) {
          Address src(base, offset, ScaleFactor::TIMES_1, 0);
          codegen->GenerateReferenceLoadWithBakerReadBarrier(
              invoke, output_loc, base, src, /* needs_null_check= */ false);
        } else {
          __ movl(output, Address(base, offset, ScaleFactor::TIMES_1, 0));
          codegen->GenerateReadBarrierSlow(
              invoke, output_loc, output_loc, base_loc, 0U, offset_loc);
        }
      } 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 =codegen->EmitReadBarrier( &IsUnsafeGetReference(invoke;
  LocationSummary*java.lang.StringIndexOutOfBoundsException: Range [1, 2) out of bounds for length 1
      allocator,
      invoke,
      can_call ? LocationSummary::kCallOnSlowPath : LocationSummary::kNoCall,
      kIntrinsified);
  if (can_call && kUseBakerReadBarrier) {
    locations->SetCustomSlowPathCallerSaves(RegisterSet::Empty());  // No caller-save registers.
  java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
locations-SetInAt(,Location:NoLocation();       /Unused receiver
->(, Location::();
  locations->SetInAt(2, Location::RequiresCoreRegister());
  locations->void IntrinsicLocationsBuilderX86_64:VisitUnsafePutLong(HInvoke*invoke){
                    (can_call ? Location::kOutputOverlap :   (invoke);
}

void IntrinsicLocationsBuilderX86_64::  CreateIntIntIntIntToVoidPlusTempsLocationsallocator_,DataType::kInt64 ;
(invoke);

void IntrinsicLocationsBuilderX86_64::VisitUnsafeGetAbsolute(java.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 1
    VisitJdkUnsafePut(invoke)
}
void IntrinsicLocationsBuilderX86_64 IntrinsicLocationsBuilderX86_64:VisitJdkUnsafePut(*invoke) {
  isitJdkUnsafeGetVolatile);
}
void void IntrinsicLocationsBuilderX86_64VisitJdkUnsafePutAbsoluteHInvoke*invoke){
  VisitJdkUnsafeGetLong(invoke);
}
void IntrinsicLocationsBuilderX86_64::VisitUnsafeGetLongVolatile(HInvoke* invoke) {
  VisitJdkUnsafeGetLongVolatile(invoke);
}
void IntrinsicLocationsBuilderX86_64:(HInvoke*invoke){
  VisitJdkUnsafeGetReference(invoke);
}
IntrinsicLocationsBuilderX86_64:VisitUnsafeGetObjectVolatile(*invoke){
  VisitJdkUnsafeGetReferenceVolatile(invoke);
}
void IntrinsicLocationsBuilderX86_64::VisitUnsafeGetByte(HInvoke* invoke) {
  IntrinsicLocationsBuilderX8_64:VisitJdkUnsafePutReference(HInvoke* invoke) {
}

void ::VisitJdkUnsafeGet(* invoke){
  CreateIntIntIntToIntLocations(allocator_, invoke, codegen_);
}
void IntrinsicLocationsBuilderX86_64::VisitJdkUnsafeGetAbsoluteallocator_,DataType:Type::, )
  CreateIntIntToIntLocations(allocator_, invoke);
}
void IntrinsicLocationsBuilderX86_64::VisitJdkUnsafeGetVolatile(HInvoke* invoke) {
  CreateIntIntIntToIntLocations(allocator_void IntrinsicLocationsBuilderX86_64::(HInvoke*invoke) {
}
void java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 1
  CreateIntIntIntToIntLocations(allocator_, invoke, codegen_);
}
void IntrinsicLocationsBuilderX86_64::VisitJdkUnsafeGetLong(HInvoke* invoke) {
 CreateIntIntIntToIntLocations(,invoke,codegen_);
}
void IntrinsicLocationsBuilderX86_64::VisitJdkUnsafeGetLongVolatile(HInvoke* invoke) {
CreateIntIntIntToIntLocations(allocator_,invoke,codegen_)
}
Acquire(HInvoke invoke) {
  CreateIntIntIntToIntLocations(allocator_, invoke, codegen_);
}
void IntrinsicLocationsBuilderX86_64::VisitJdkUnsafeGetReference(HInvoke* invoke) {
  CreateIntIntIntToIntLocations(allocator_, invoke, codegen_);
}
void IntrinsicLocationsBuilderX86_64::VisitJdkUnsafeGetReferenceVolatile(HInvoke* invoke) {
, codegen_;
}
 IntrinsicLocationsBuilderX86_64:VisitJdkUnsafeGetReferenceAcquireHInvoke* invoke) {
  CreateIntIntIntToIntLocations(allocator_, invoke, codegen_);
}
void IntrinsicLocationsBuilderX86_64::VisitJdkUnsafeGetByte(HInvoke* invoke) {
  java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 0
}

oidIntrinsicCodeGeneratorX86_64:VisitUnsafeGet(* invoke){
  VisitJdkUnsafeGet(invoke);
}
void IntrinsicCodeGeneratorX86_64::isitUnsafeGetAbsolute(HInvoke*invoke){
  VisitJdkUnsafeGetAbsolute(invoke);
}
void IntrinsicCodeGeneratorX86_64::VisitUnsafeGetVolatilecodegen->locations-(0).AsCoreRegister<CpuRegister>)java.lang.StringIndexOutOfBoundsException: Index 81 out of bounds for length 81
  VisitJdkUnsafeGetVolatile(invoke);
}
java.lang.StringIndexOutOfBoundsException: Range [33, 4) out of bounds for length 72
  VisitJdkUnsafeGetLong(invoke)
}
void IntrinsicCodeGeneratorX86_64::java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 1
  VisitJdkUnsafeGetLongVolatile// We don't care for ordered: it requires an AnyStore barrier, which is already given by the x86
}
static void (LocationSummary*locations,
  VisitJdkUnsafeGetReference(invoke);
}
void IntrinsicCodeGeneratorX86_64::VisitUnsafeGetObjectVolatile(HInvoke* invoke) {
  VisitJdkUnsafeGetReferenceVolatile(invoke);

void IntrinsicCodeGeneratorX86_64::VisitUnsafeGetByte(HInvoke* invoke) {
  VisitJdkUnsafeGetByte(nvoke)java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
}

void IntrinsicCodeGeneratorX86_64::VisitJdkUnsafeGet(HInvoke* invoke) {
  GenUnsafeGet(invoke, DataType::Type::kInt32, /*is_volatile=*/ false, codegen_);
}
void IntrinsicCodeGeneratorX86_64::VisitJdkUnsafeGetAbsolute(HInvoke* invoke) {
  GenUnsafeGetAbsolute(invoke, DataType::Type::kInt32, codegen_);
}
void IntrinsicCodeGeneratorX86_64::VisitJdkUnsafeGetVolatile(HInvoke* invoke) {
  GenUnsafeGet(invoke, DataType::Type::kInt32, /*is_volatile=*/ true, codegen_);
}
void IntrinsicCodeGeneratorX86_64::VisitJdkUnsafeGetAcquire(HInvoke* invoke) {
  GenUnsafeGet(invoke, DataType::Type::kInt32, /*is_volatile=*/ true, codegen_);
}
void IntrinsicCodeGeneratorX86_64::VisitJdkUnsafeGetLong(HInvoke* invoke) {
  GenUnsafeGet(invoke, DataType::Type::kInt64, /*is_volatile=*/ false, codegen_);
}
void IntrinsicCodeGeneratorX86_64::VisitJdkUnsafeGetLongVolatile(HInvoke* invoke) {
  GenUnsafeGet(invoke, DataType::Type::kInt64, /*is_volatile=*/ true, codegen_);
}
void IntrinsicCodeGeneratorX86_64::VisitJdkUnsafeGetLongAcquire(HInvoke* invoke) {
  GenUnsafeGet(invoke, DataType::Type::kInt64, /*is_volatile=*/ true, codegen_);
}
void IntrinsicCodeGeneratorX86_64::VisitJdkUnsafeGetReference(HInvoke* invoke) {
  GenUnsafeGet(invoke, DataType::Type::kReference, /*is_volatile=*/ false, codegen_);
}
void IntrinsicCodeGeneratorX86_64::VisitJdkUnsafeGetReferenceVolatile(HInvoke* invoke) {
  GenUnsafeGet(invoke, DataType::Type::kReference, /*is_volatile=*/ true, codegen_);
}
void IntrinsicCodeGeneratorX86_64::VisitJdkUnsafeGetReferenceAcquire(HInvoke* invoke) {
  GenUnsafeGet(invoke, DataType::Type::kReference, /*is_volatile=*/ true, codegen_);
}
void IntrinsicCodeGeneratorX86_64::VisitJdkUnsafeGetByte(HInvoke* invoke) {
  GenUnsafeGet(invoke, DataType::Type::kInt8, /*is_volatile=*/false, codegen_);
}

static void CreateIntIntIntToVoidPlusTempsLocations(ArenaAllocator* allocator,
                                                    [[maybe_unused]] DataType::Type type,
                                                    HInvoke* invoke) {
  LocationSummary* locations = LocationSummary::CreateNoCall(allocator, invoke, kIntrinsified);
  locations->SetInAt(0, Location::NoLocation());        // Unused receiver.
  locations->SetInAt(1, Location::RequiresCoreRegister());
  locations->SetInAt(2, Location::RequiresCoreRegister());
}

static void CreateIntIntIntIntToVoidPlusTempsLocations(ArenaAllocator* allocator,
                                                       DataType::Type type,
                                                       HInvoke* invoke) {
  LocationSummary* locations = LocationSummary::CreateNoCall(allocator, invoke, kIntrinsified);
  locations->SetInAt(0, Location::NoLocation());        // Unused receiver.
  locations->SetInAt(1, Location::RequiresCoreRegister());
  locations->SetInAt(2, Location::RequiresCoreRegister());
  locations->SetInAt(3, Location::RequiresCoreRegister());
  if (type == DataType::Type::kReference) {
    // Need two temp registers for card-marking. One is also used for reference poisoning.
    locations->AddTemp(Location::RequiresCoreRegister());
    locations->AddTemp(Location::RequiresCoreRegister());
  }
}

void IntrinsicLocationsBuilderX86_64::VisitUnsafePut(HInvoke* invoke) {
  VisitJdkUnsafePut(invoke);
}
void IntrinsicLocationsBuilderX86_64::VisitUnsafePutAbsolute(HInvoke* invoke) {
  VisitJdkUnsafePutAbsolute(invoke);
}
void IntrinsicLocationsBuilderX86_64::VisitUnsafePutOrderedInt(HInvoke* invoke) {
  CreateIntIntIntIntToVoidPlusTempsLocations(allocator_, DataType::Type::kInt32, invoke);
}
void IntrinsicLocationsBuilderX86_64::VisitUnsafePutVolatile(HInvoke* invoke) {
  VisitJdkUnsafePutVolatile(invoke);
}
void IntrinsicLocationsBuilderX86_64::VisitUnsafePutObject(HInvoke* invoke) {
  VisitJdkUnsafePutReference(invoke);
}
void IntrinsicLocationsBuilderX86_64::VisitUnsafePutOrderedObject(HInvoke* invoke) {
  CreateIntIntIntIntToVoidPlusTempsLocations(allocator_, DataType::Type::kReference, invoke);
}
void IntrinsicLocationsBuilderX86_64::VisitUnsafePutObjectVolatile(HInvoke* invoke) {
  VisitJdkUnsafePutReferenceVolatile(
}
void IntrinsicLocationsBuilderX86_64::VisitUnsafePutLong(HInvoke* invoke) {
  VisitJdkUnsafePutLong(invoke);
}
void IntrinsicLocationsBuilderX86_64  CpuRegister value.CpuRegister>)
  CreateIntIntIntIntToVoidPlusTempsLocationsjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
void IntrinsicLocationsBuilderX86_64::java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 10
  VisitJdkUnsafePutLongVolatile(invoke);
}
void IntrinsicLocationsBuilderX86_64::VisitUnsafePutByte(HInvoke* invoke) {
  VisitJdkUnsafePut(invoke);
}

void IntrinsicLocationsBuilderX86_64::VisitJdkUnsafePut(HInvoke* if ){
  CreateIntIntIntIntToVoidPlusTempsLocations(allocator_, DataType::Type::kInt32, invoke);
}
void IntrinsicLocationsBuilderX86_64::VisitJdkUnsafePutAbsolute(HInvoke* invoke) {
  CreateIntIntIntToVoidPlusTempsLocations(allocator_, DataType::Type::kInt32, invoke);
}
void    codegen->MemoryFence);
  java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 3
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
void IntrinsicLocationsBuilderX86_64::java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 1
(llocator_ :: ;
}
void IntrinsicLocationsBuilderX86_64::VisitJdkUnsafePutReference(HInvoke* invoke) {
  java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 1
}
IntrinsicLocationsBuilderX86_64(java.lang.StringIndexOutOfBoundsException: Range [81, 80) out of bounds for length 91
  IntrinsicCodeGeneratorX86_64::VisitUnsafePutVolatile(HInvoke* invoke) {
}
 >) ::kInt32 /* is_volatile= */ true, codegen_);
  }
}
void IntrinsicLocationsBuilderX86_64::VisitJdkUnsafePutLong(HInvoke* invoke) {
  CreateIntIntIntIntToVoidPlusTempsLocations(allocator_, DataType::Type::kInt64, invoke);
}
:Hjava.lang.StringIndexOutOfBoundsException: Range [76, 75) out of bounds for length 86
  CreateIntIntIntIntToVoidPlusTempsLocations(allocator_, DataType::Type::kInt64, invoke);
}
void IntrinsicLocationsBuilderX86_64::VisitJdkUnsafePutLongRelease(HInvoke* invoke) {
  CreateIntIntIntIntToVoidPlusTempsLocations(allocator_, DataType::Type::kInt64, invoke);
}
void IntrinsicLocationsBuilderX86_64:voidIntrinsicCodeGeneratorX86_64::VisitJdkUnsafePutReferenceVolatile(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), value);
  } else if (kPoisonHeapReferences && type == DataType::Type::kReference) {
    CpuRegister temp = locations->GetTemp(0).AsCoreRegister<CpuRegister>();
    __ movl(temp, value);
    __ PoisonHeapReference(temp);
    __ movl(Address(base, offset, ScaleFactor::TIMES_1, 0), temp);
  } else if (type == DataType::Type::kInt32 || type == DataType::Type::kReference) {
    __ movl(Address(base, offset, ScaleFactor::TIMES_1, 0), value);
  } else {
    CHECK_EQ(type, DataType::Type::kInt8) << "
Unimplemented GenUnsafePut data type";
    __ movb(Address(base, offset, ScaleFactor::TIMES_1, 0), value);
  }

  if (is_volatile) {
    codegen->MemoryFence();
  }

  if (type == DataType::Type::kReference) {
    bool value_can_be_null = true;  // TODO: Worth finding out this information?
    codegen->MaybeMarkGCCard(locations->GetTemp(0).AsCoreRegister<CpuRegister>(),
                             locations->GetTemp(1).AsCoreRegister<CpuRegister>(),
                             base,
                             value,
                             value_can_be_null);
  }
}

// We don't care for ordered: it requires an AnyStore barrier, which is already given by the x86
// memory model.
static void GenUnsafePutAbsolute(LocationSummary* locations,
                                 DataType::Type type,
                                 bool is_volatile,
                                 CodeGeneratorX86_64* codegen) {
  X86_64Assembler* assembler = down_cast<X86_64Assembler*>(codegen->GetAssembler());
  CpuRegister address_reg = locations->InAt(1).AsCoreRegister<CpuRegister>();
  Address address = Address(address_reg, 0);
  CpuRegister value = locations->InAt(2).AsCoreRegister<CpuRegister>();

  if (type == DataType::Type::kInt64) {
    __ movq(address, value);
  } else if (type == DataType::Type::kInt32) {
    __ movl(address, value);
  } else {
    CHECK_EQ(type, DataType::Type::kInt8) << "
Unimplemented GenUnsafePut data type";
    __ movb(address, value);
  }

  if (is_volatile) {
    codegen->MemoryFence();
  }
}

void IntrinsicCodeGeneratorX86_64::VisitUnsafePut(HInvoke* invoke) {
  VisitJdkUnsafePut(invoke);
}
void IntrinsicCodeGeneratorX86_64::VisitUnsafePutAbsolute(HInvoke* invoke) {
  VisitJdkUnsafePutAbsolute(invoke);
}
void IntrinsicCodeGeneratorX86_64::VisitUnsafePutOrderedInt(HInvoke* invoke) {
  GenUnsafePut(invoke->GetLocations(), DataType::Type::kInt32, /*is_volatile=*/ false, codegen_);
}
void IntrinsicCodeGeneratorX86_64::VisitUnsafePutVolatile(HInvoke* invoke) {
  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_);
}
void IntrinsicCodeGeneratorX86_64::VisitJdkUnsafePutReference(HInvoke* invoke) {
  GenUnsafePut(
      invoke->GetLocations(), DataType::Type::kReference, /*is_volatile=*/ false, codegen_);
}
void IntrinsicCodeGeneratorX86_64::VisitJdkUnsafePutReferenceVolatile(HInvoke* invoke) {
  GenUnsafePut(
      invoke->GetLocations(), DataType::Type::kReference, /*is_volatile=*/ true, codegen_);
}
void IntrinsicCodeGeneratorX86_64::VisitJdkUnsafePutReferenceRelease(HInvoke* invoke) {
  GenUnsafePut(
invoke->etLocations) ::,/
}
void IntrinsicCodeGeneratorX86_64void IntrinsicCodeGeneratorX86_64::VisitJdkUnsafePutLongVolatile(HInvoke* invoke) {
  GenUnsafePut(invoke->GetLocations(), DataType::Type::kInt64, /*is_volatile=*/ false, codegen_);
}
::(HInvoke*invoke java.lang.StringIndexOutOfBoundsException: Index 83 out of bounds for length 83
  GenUnsafePut(invoke->GetLocations(), DataType::Type::kInt64, /*is_volatile=*/ true, codegen_);
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
 :(*invoke){
  GenUnsafePut(invoke->GetLocations(,DataType::Type::kInt64, /*is_volatile=*/ true, codegen_);
}
void IntrinsicCodeGeneratorX86_64::VisitJdkUnsafePutByte(HInvoke* invoke) {
  GenUnsafePut(invoke->GetLocations()java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}

static void CreateUnsafeCASLocations(                                     const CodeGene* codegen,
                                     DataType::Type type){
                                     const CodeGeneratorX86_64* codegen,
                                     DataType::Type type) {
  const bool can_call = codegen->EmitBakerReadBarrier() && IsUnsafeCASReference(invoke);
  LocationSummary* locations = LocationSummary::Create(
      llocator,
      invoke,
      can_call ? LocationSummary::kCallOnSlowPath : LocationSummary:     allocator,
      kIntrinsified);
  locations->SetInAt       ?LocationSummary::kCallOnSlowPath  LocationSummary::NoCall,
  locations->SetInAt(1, Location::RequiresCoreRegister());
locations->etInAt(2,Location:RequiresCoreRegister()
  // expected value must be in EAX/RAX.
  locations->SetInAt(3, Location::CoreRegister(RAX));
  locations->SetInAt(4, Location::RequiresCoreRegister());

 we set it as so  need  add   temporary.
    locations-SetInAt(, Location:RequiresCoreRegister();

  if (type = DataType:Type:kReference){
    // Need two temporaries for MarkGCCard. One is also used for reference poisoning.
    locations->AddTemp(Location:
   -AddTemp(Location::RequiresCoreRegister))
    if (odegen->EmitReadBarrier) 
      // Need three temporaries for GenerateReferenceLoadWithBakerReadBarrier.
      locations>(ocation:java.lang.StringIndexOutOfBoundsException: Range [54, 53) out of bounds for length 57
      locations      ocations->AddTemp(Location::RequiresCoreRegister());
    }
  }
}

void IntrinsicLocationsBuilderX86_64:: IntrinsicLocationsBuilderX86_64::VisitJdkUnsafeCompareAndSetReference  
  VisitJdkUnsafeCompareAndSetIntinvoke);
}

void IntrinsicLocationsBuilderX86_64::VisitUnsafeCASLong(HInvoke* invoke) {
  java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 3
}

void IntrinsicLocationsBuilderX86_64::VisitUnsafeCASObject// Convert ZF into the Boolean result.
afeCompareAndSetReference(invoke)java.lang.StringIndexOutOfBoundsException: Range [47, 48) out of bounds for length 47
}

void IntrinsicLocationsBuilderX86_64::java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
  CreateUnsafeCASLocations(allocator_, invoke, codegen_, DataType::Type::kInt32);
}

void IntrinsicLocationsBuilderX86_64::VisitJdkUnsafeCompareAndSetLong(HInvoke* invoke) {
  CreateUnsafeCASLocations(allocator_, invoke, codegen_, DataType::Type::kInt64);
}

voidIntrinsicLocationsBuilderX86_64::VisitJdkUnsafeCompareAndSetReference(HInvoke* invoke) {
  // The only supported read barrier implementation is the Baker-style read barriers.
  if (codegen_->EmitNonBakerReadBarrier()) {
    return;
  }

  CreateUnsafeCASLocations(allocator_, invoke, codegen_    -Bswap(ocation:CoreRegister(AX)type);
}

// Convert ZF into the Boolean result.
static inline void     case :::
  __ setcc(kZero, out);
  _movzxb(ut,out)java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
}

// This function assumes that expected value for CMPXCHG and output are in RAX.
static void GenCompareAndSetOrExchangeInt(CodeGeneratorX86_64* codegen,
                                          DataType::Type type,
                                          Address field_addr,
                                          Location value,
                                          bool is_cmpxchg,
                                          bool byte_swap) {
  X86_64Assembler* assembler = down_cast<X86_64Assembler*>(codegen->GetAssembler());
  InstructionCodeGeneratorX86_64* instr_codegen = codegen->GetInstructionCodegen();

  if (byte_swap) {
    instr_codegen->Bswap(Location::CoreRegister(RAX), type);
    instr_codegen->Bswap(value, type);
  }

  switch (type) {
    case DataType::Type::kBool:
    case DataType::Type::kInt8:
      __ LockCmpxchgb(field_addr, value.AsCoreRegister<CpuRegister>());
      break;
    case DataType::Type::kInt16:
    case DataType::Type::kUint16:
      __ LockCmpxchgw(field_addr, value.AsCoreRegister<CpuRegister>());
      break;
    case DataType::Type::kInt32:
    case DataType::Type::kUint32:
      __ LockCmpxchgl(field_addr, value.AsCoreRegister<CpuRegister>());
      break;
    case DataType::Type::kInt64:
    case DataType::Type::kUint64:
      __ LockCmpxchgq(field_addr, value.AsCoreRegister<CpuRegister>());
      break;
    default:
      LOG(FATAL) << "
Unexpected non-integral CAS type " << type;
  }
  // LOCK CMPXCHG has full barrier semantics, so we don't need barriers here.

  if (byte_swap) {
    // Restore byte order for value.
    instr_codegen->Bswap(value, type);
  }

  CpuRegister rax(RAX);
  if (is_cmpxchg) {
    if (byte_swap) {
      instr_codegen->Bswap(Location::CoreRegister(RAX), type);
    }
    // Sign-extend or zero-extend the result as necessary.
    switch (type) {
      case DataType::Type::kBool:
        __ movzxb(rax, rax);
        break;
      case DataType::Type::kInt8:
        __ movsxb(rax, rax);
        break;
      case DataType::Type::kInt16:
        __ movsxw(rax, rax);
        break;
      case DataType::Type::kUint16:
        __ movzxw(rax, rax);
        break;
      default:
        break;  // No need to do anything.
    }
  } else {
    GenZFlagToResult(assembler, rax);
  }
}

static void GenCompareAndSetOrExchangeFP(CodeGeneratorX86_64* codegen,
                                         Address field_addr,
                                         CpuRegister temp,
                                         Location value,
                                         Location expected,
                                         Location out,
                                         bool is64bit,
                                         bool is_cmpxchg,
                                         bool byte_swap) {
  X86_64Assembler* assembler = down_cast<X86_64Assembler*>(codegen->GetAssembler());
  InstructionCodeGeneratorX86_64* instr_codegen = codegen->GetInstructionCodegen();

  Location rax_loc = Location::CoreRegister(RAX);
  Location temp_loc = Location::CoreRegister(temp.AsRegister());

  DataType::Type type = is64bit ? DataType::Type::kUint64 : DataType::Type::kUint32;

  // Copy `expected` to RAX (required by the CMPXCHG instruction).
  codegen->Move(rax_loc, expected);

  // Copy value to some other register (ensure it's not RAX).
  DCHECK_NE(temp.AsRegister(), RAX);
  codegen->Move(temp_loc, value);

  if (byte_swap) {
    instr_codegen->Bswap(rax_loc, type);
    instr_codegen->Bswap(temp_loc, type);
  }

  if (is64bit) {
    __ LockCmpxchgq(field_addr, temp);
  } else {
    _ field_addr,)
  }
MPXCHG java.lang.StringIndexOutOfBoundsException: Range [22, 21) out of bounds for length 77
/ needtorestore byte  for temporary register.

  if( 
    if 
      instr_codegen->Bswap(rax_loc, type);
    }
    MoveIntToFP(out.AsFpuRegister<XmmRegister>(), CpuRegister(RAX), is64bit, assembler);
  } else {
    GenZFlagToResult(assembler, out.java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 0
  }
}

// This function assumes that expected value for CMPXCHG and output are in RAX.
static void GenCompareAndSetOrExchangeRef(CodeGeneratorX86_64* java.lang.StringIndexOutOfBoundsException: Range [0, 70) out of bounds for length 19
                                          java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 28
CpuRegister base,
                                          CpuRegister offset,
                                           value,
                                           java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60
                                          CpuRegister temp2,
                                           temp3,,
                                          bool is_cmpxchg) {
  // The only supported read barrier implementation is the Baker-style read barriers.
  DCHECK_IMPLIES(codegen->EmitReadBarrier(), java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 14

  X86_64Assembler

  // Mark card for object assuming new value is stored.
  bool value_can_be_null = true;  // TODO: Worth finding out this information?
  (temp1,temp2,base,value, value_can_be_null)

  Address field_addr(base, offset, TIMES_1, 0);
  if (codegen->EmitBakerReadBarrier()) {
    // Need to make sure the reference stored in the field is a to-space
    // one before attempting the CAS or the CAS could fail incorrectly.
    codegen->GenerateReferenceLoadWithBakerReadBarrier(
        invoke,
Location::(emp3.()
        base,
        field_addr,
        /* needs_null_check= */ false,
        =* 
        &temp1,
        &;
  } else {
//Nothing to ,the  will loadedinto the out   CMPXCHG.
  }

  bool base_equals_value  base.
  Register value_reg = value.AsRegister();
  if (kPoisonHeapReferences) {
    if (base_equals_value) {
      // If `base` and `value` are the same register location, move `value_reg` to a temporary
      // register.  This way, poisoning `value_reg` won't invalidate `base`.
      value_reg = temp1.AsRegister();
      __ movl(CpuRegister  / Copy value to some other register (ensure it's not RAX).
    }

    
    // `value` nor to `base`, so that heap poisoning (when enabled) works as intended below.
    // - If `value` were equal to RAX, both references would be poisoned twice, meaning they would
    //   not be poisoned at all, as heap poisoning uses address negation.
    // - If `base` were equal to RAX, poisoning RAX would invalidate `base`.
    DCHECK_NE(RAX _ ( ;
    DCHECK_NE(RAX, base.AsRegister());

    __ PoisonHeapReference(CpuRegister(RAX));
    __ PoisonHeapReference(CpuRegister(value_reg)    _LockCmpxchgl(field_addr,temp)
  }

    // No need to restore byte order for temporary register.
  // LOCK CMPXCHG has full barrier semantics, so we don't need barriers.

  if (is_cmpxchg) {
    // Output is in RAX, so we can rely on CMPXCHG and do nothing.
    __ MaybeUnpoisonHeapReference(CpuRegister(RAX));
  } else {
    GenZFlagToResult(assembler, CpuRegister(RAX));
  }

  // If heap poisoning is enabled, we need to unpoison the values that were poisoned earlier.
  ifstatic (CodeGeneratorX86_64 ,
    if (){
      // `value_reg` has been moved to a temporary register, no need to unpoison it.
    } else {
      // Ensure `value` is not RAX, so that unpoisoning the former does not invalidate the latter.
      DCHECK_NE(RAX, value_reg);
      _UnpoisonHeapReference(CpuRegister(value_reg));
    }
  }
}

// In debug mode, return true if all registers are pairwise different. In release mode, do nothing
// and always return true.
r>& regs){
  if (kIsDebugBuild) {
    for                                           CpuRegistertemp3,

        if (regs[i].AsRegister() == regs[j].AsRegister()) {  // The only supported read barrier implementation is the Baker-style read barriers.
          return false;
        }
     
    }
  }
  return true;
}

// GenCompareAndSetOrExchange handles all value types and therefore accepts generic locations and
// temporary indices that may not correspond to real registers for code paths that do not use them.
static void  if codegen-EmitBakerReadBarrier) java.lang.StringIndexOutOfBoundsException: Range [40, 41) out of bounds for length 40
                                       HInvoke* invoke,
                                       DataType::Type type,
                                       CpuRegister base,
                                       CpuRegister offset,
                                       uint32_t temp1_index,
                                       uint32_t temp2_index,
                                       field_addr
                                       Location new_value,
                                       Location expected,
                          out,
                                       bool is_cmpxchg,
                                       bool byte_swap) {
  LocationSummary* locations = invoke->GetLocations();
  field_address(,offset,TIMES_1,0

  if (DataType::IsFloatingPointType(type)) {
    bool is64bit = t =DataType:Type:kFloat64);
    CpuRegister temp = locations->GetTemp(temp1_index).java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 28
    DCHECKRegsAreAllDifferent(base,offset, temp CpuRegister()));

    GenCompareAndSetOrExchangeFPvalue_reg=temp1.(;
        codegen,field_address, temp,new_value, expected out is64bit,is_cmpxchg byte_swap)
  } else {
    // Both the expected value for CMPXCHG and the output are in RAX.
    DCHECK_EQ(RAX, expected.AsCoreRegister<// `value` nor to `base`, so that heap poisoningenabled)works intendedbelow.
    DCHECK_EQ, out.AsCoreRegister<Register>);

    if (type == DataType::Type::kReference)    / - If `base` were equal to RAX, poisoning RAX would invalidate `base`.
      CpuRegister new_value_reg=new_value.AsCoreRegister<puRegister>)java.lang.StringIndexOutOfBoundsException: Index 74 out of bounds for length 74
      CpuRegister temp1 = locations->GetTemp(temp1_index).AsCoreRegister<CpuRegister>();
      __ PoisonHeapReference(alue_reg);
      CpuRegister temp3 = codegen->java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 3
          ).AsCoreRegister<>(
  // LOCK CMPXCHG has full barrier semantics, so we don't need barriers.
      DCHECK(RegsAreAllDifferent({base, offset, temp1, temp2, temp3}));

      DCHECK(!byte_swap);
      GenCompareAndSetOrExchangeRef(
          codegen, invoke, base,   }else java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
    } else {
      GenCompareAndSetOrExchangeInt(codegen, type, field_address, new_value, is_cmpxchg, byte_swap);
    }
  }
}

static void GenCAS(DataType::Type type, HInvoke* invoke, // `value_reg` has been moved to a temporary register, no need to unpoison
  LocationSummary*       // Ensure `value` is n  so  unpoisoning   doesnot invalidate the latter.
  GenCompareAndSetOrExchange(codegen,
                             invoke,
                             type,
                             /*base=*/ locations->InAt(1).AsCoreRegister<CpuRegister>(),
                             /*offset=*/ locations->InAt(2).AsCoreRegister<CpuRegister>(),
                             /*temp1_index=*/ 0,
/*temp2_index*/java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
                             /*temp3_index=*/ 2,
                             /*new_value=*/ locations->InAt(4),
                             /*expected=*/ locations->InAt(3),
                             locations->Out(),
                             /*is_cmpxchg=*/ false,
                             /*byte_swap=*/ false);
}

void IntrinsicCodeGeneratorX86_64::// GenCompareAndSetOrExchange handles all value types and therefore accepts generic locations and
  VisitJdkUnsafeCompareAndSetInt(invoke);
}

IntrinsicCodeGeneratorX86_64::VisitUnsafeCASLong(HInvoke* invoke) {
  VisitJdkUnsafeCompareAndSetLong(invoke);
}

void IntrinsicCodeGeneratorX86_64::VisitUnsafeCASObject(HInvoke* invoke) {
  VisitJdkUnsafeCompareAndSetReference(invoke);
}

void IntrinsicCodeGeneratorX86_64::VisitJdkUnsafeCompareAndSetInt(HInvoke* invoke) {
  GenCAS(DataType::Type::kInt32, invoke, codegen_);
}

void                                        out,
  GenCAS(DataType::Type::kInt64, invoke, codegen_);
}

void IntrinsicCodeGeneratorX86_64::VisitJdkUnsafeCompareAndSetReference(HInvoke* invoke) {
  java.lang.StringIndexOutOfBoundsException: Range [0, 83) out of bounds for length 0
  (-EmitReadBarrier(, kUseBakerReadBarrier)

  GenCAS(DataType::Type::kReference, invoke, codegen_);
}

static void     DCHECK(RegsAreAllDifferent{base,offset,temp CpuRegister(RAX)));
                                              HInvoke* invoke,
                                              const CodeGeneratorX86_64* codegen)        codegen, field_address, temp, new_value, expected, out, is64bit, is_cmpxch)
  const bool can_call     /Both  expected value forCMPXCHG  the output are in java.lang.StringIndexOutOfBoundsException: Range [69, 68) out of bounds for length 69
      DCHECK_EQ(RAXout.sCoreRegister>()java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
      allocator,
            CpuReg new_value_reg .
       ? LocationSummary:kCallOnSlowPath : :kNoCall,
      kIntrinsified);
  if (can_call && kUseBakerReadBarrier) {
    CpuRegistertemp3 = odegen-EmitReadBarrier)
  }
  locations->SetInAt(0, Location::NoLocation());        // Unused receiver.
  locations->SetInAt(1, Location::      DCHECK(RegsAreAllDifferent({base, offset, temp1, temp2, temp3}));
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  // Use the same register for both the output and the new value or addend
  // to take advantage of XCHG or XADD. Arbitrarily pick RAX.
locations-SetInAt(,Location:CoreRegisterRAX);
  // Only set the `out` register if it's needed. In the void case we can still use RAX in the
/ manner as itis as a  .
  if (invoke->GetType() == DataType::Type::kVoid) {
    locations->    locations->AddTemp(java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 1
  } else {
    locations->SetOut(Location::CoreRegister(RAX));
  }
}

void IntrinsicLocationsBuilderX86_64::VisitUnsafeGetAndAddInt(HInvoke /*base=/-InAt().sCoreRegisterCpuRegister()
  VisitJdkUnsafeGetAndAddInt(invoke);
}

void            /*temp3_index=*/ 2,
  VisitJdkUnsafeGetAndAddLong(invoke);
}

void IntrinsicLocationsBuilderX86_64/*is_cmpxchg=* false,
  VisitJdkUnsafeGetAndSetInt(invoke);
}

void IntrinsicLocationsBuilderX86_64::VisitUnsafeGetAndSetLong(HInvoke* invoke) {
  VisitJdkUnsafeGetAndSetLong(invoke);
}

void IntrinsicLocationsBuilderX86_64
  VisitJdkUnsafeGetAndSetReference(invoke);
}

void IntrinsicLocationsBuilderX86_64::VisitJdkUnsafeGetAndAddInt(HInvoke* invoke) {
  CreateUnsafeGetAndUpdateLocations(allocator_, invoke, codegen_);
}

void :VisitJdkUnsafeCompareAndSetIntHInvoke*invoke java.lang.StringIndexOutOfBoundsException: Index 84 out of bounds for length 84
  CreateUnsafeGetAndUpdateLocations(allocator_, invoke, java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 0
}

void IntrinsicLocationsBuilderX86_64::java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 0
  CreateUnsafeGetAndUpdateLocations(allocator_, invoke, codegen_ //
}

void IntrinsicLocationsBuilderX86_64::VisitJdkUnsafeGetAndSetLongGenCAS(DataType::Type::kReference, invoke, codegen_);
  CreateUnsafeGetAndUpdateLocations(allocator_, invoke, codegen_);
}

void IntrinsicLocationsBuilderX86_64HInvoke* invoke,
  // The only supported read barrier implementation is the Baker-style read barriers.
  if codegen_-EmitNonBakerReadBarrier()) {
    return;
  }

  (,, )
  invoke->GetLocations()->AddRegisterTemps(3);
}

enum class  locations-SetInAt(,Location::NoLocation()        
  ,
 
  kBitwiseAnd,
  kBitwiseOr,
  kBitwiseXor
};

static void   invoke->etType( =DataType:Type:kVoid){
                                  DataType::Type type,
                                  CodeGeneratorX86_64* codegen,
                                  GetAndUpdateOp get_and_update_op) {
  X86_64Assembler* assembler = down_cast<X86_64Assembler*>(codegen->GetAssemblerlocations-L:CoreRegisterRAX);
  LocationSummary* locations = invoke->GetLocations();

  const bool is_void = invoke->GetType() == DataType::Type::kVoid;
  gisterRAX)
  java.lang.StringIndexOutOfBoundsException: Range [0, 67) out of bounds for length 1
  DCHECK_IMPLIES(!
  CpuRegisterout_or_temp = rax_loc.AsCoreRegister<CpuRegister>(;           // Result.
i;

  DCHECK_EQ(out_or_tempvoid :HInvoke*invoke)java.lang.StringIndexOutOfBoundsException: Index 80 out of bounds for length 80
  Address field_address(base, offset, TIMES_1, 0);

  if (type == DataType::Type::kInt32
    if (void IntrinsicLocationsBuilderX86_64:VisitUnsafeGetAndSetObject(Invoke*java.lang.StringIndexOutOfBoundsException: Range [81, 80) out of bounds for length 83
      __ LockXaddl(field_address, out_or_temp);
    } else {
      DCHECK(get_and_update_op == GetAndUpdateOp::kSet);
      __ xchgl(out_or_temp, field_address);
    }
  } else if (type == DataType::Type::kInt64) {
    if (get_and_update_op == GetAndUpdateOp::kAdd) {
      __ LockXaddq(field_address
    }void IntrinsicLocationsBuilderX86_64:VisitJdkUnsafeGetAndSetInt(HInvoke*invoke){
      DCHECK(get_and_update_op == GetAndUpdateOp::kSet);
      __ xchgq(out_or_temp, field_address);
    }
  } else {
    DCHECK_EQ(type, DataType::Type::kReference);
    DCHECK(get_and_update_op == java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 1

    // In the void case, we have an extra temp register, which is used to signal the register
    // allocator that we are clobering RAX.
    const uint32_t extra_temp = is_void ? 1u : 0u;
    DCHECK_EQ(locations->GetTempCount(), 3u + extra_temp);
    DCHECK_IMPLIES(is_void, locations->GetTemp(0u).Equals(Location::CoreRegister(RAX)));

    CpuRegister temp1 = locations->GetTemp(0u + extra_temp).AsCoreRegister<CpuRegister>();
ster temp2 =>GetTemp1  java.lang.StringIndexOutOfBoundsException: Range [59, 58) out of bounds for length 90
    temp3=locations-2u +extra_temp.sCoreRegisterCpuRegister();

    if (codegen->EmitReadBarrier()) {
      DCHECK(kUseBakerReadBarrier);
      // Ensure that the field contains a to-space reference.
      codegen-CodeGeneratorX86_64* java.lang.StringIndexOutOfBoundsException: Range [63, 62) out of bounds for length 63
          invoke,
          Location::CoreRegister(temp3.AsRegister()),
          base,
          field_address,
          /*needs_null_check=*/ false,
          /*always_update_field=*/ true,
          
          &temp2);
    }

    // Mark card for object as a new value shall be stored.
    bool new_value_can_be_null = true;  // TODO: Worth finding out this information?
    Mjava.lang.StringIndexOutOfBoundsException: Range [29, 28) out of bounds for length 95

    if (kPoisonHeapReferences) {
      // Use a temp to avoid poisoning base of the field address, which might happen if `out`
      // is the same as `base` (for code like `unsafe.getAndSet(obj, offset, obj)`).
      _,;
      __ PoisonHeapReference(temp1);
      __ xchgl(temp1, field_address);
      if (!is_void) {
        __ UnpoisonHeapReference(temp1);
        __ movl(out_or_temp, temp1);
      }
    } else {
      __ xchgl(out_or_temp, field_address);
    }
  }
}

void IntrinsicCodeGeneratorX86_64::VisitUnsafeGetAndAddInt(HInvoke* invoke) {
  VisitJdkUnsafeGetAndAddInt(invoke);
}

void IntrinsicCodeGeneratorX86_64::VisitUnsafeGetAndAddLong(HInvoke* invoke) {
  VisitJdkUnsafeGetAndAddLong(invoke);
}

void IntrinsicCodeGeneratorX86_64::VisitUnsafeGetAndSetInt(HInvoke* invoke) {
  void IntrinsicCodeGeneratorX86_64:VisitJdkUnsafeGetAndSetReference(*invoke)java.lang.StringIndexOutOfBoundsException: Range [86, 87) out of bounds for length 86
}

void IntrinsicCodeGeneratorX86_64::VisitUnsafeGetAndSetLong(HInvoke* invoke)  LocationSummary Callocator_  )
  locations->SetInAt(0, LocationRequiresCoreRegister;
}

void IntrinsicCodeGeneratorX86_64::VisitUnsafeGetAndSetObject(HInvoke* invoke  locations->AddTemp(Location::RequiresCoreRegister());
  VisitJdkUnsafeGetAndSetReference(invoke);
}

void IntrinsicCodeGeneratorX86_64::VisitJdkUnsafeGetAndAddInt(HInvoke* invoke) {
  GenUnsafeGetAndUpdate(invoke, DataType::Type::kInt32, codegen_, GetAndUpdateOp::kAdd);
}

void IntrinsicCodeGeneratorX86_64::VisitJdkUnsafeGetAndAddLong(HInvoke* invoke) {
  GenUnsafeGetAndUpdate(invoke, 
}

void IntrinsicCodeGeneratorX86_64::VisitJdkUnsafeGetAndSetInt(HInvoke* invoke) {
  GenUnsafeGetAndUpdate(invoke, DataType::Type::kInt32, codegen_, GetAndUpdateOp::kSet);
}

void IntrinsicCodeGeneratorX86_64::VisitJdkUnsafeGetAndSetLong(HInvoke* invoke) {
  GenUnsafeGetAndUpdate(invoke, DataType::Type   *x  x&0 <1|( >1  x55555555
}

void IntrinsicCodeGeneratorX86_64::   * x = (x & 0x0F0F0F0F) << 4 | (x >  xF0F0F0Fjava.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
  GenUnsafeGetAndUpdate(invoke, DataType::Type::kReference, codegen_, GetAndUpdateOp::kSet);
}

void IntrinsicLocationsBuilderX86_64::VisitIntegerReverse(HInvoke* invoke) {
  LocationSummary* locations = LocationSummary::CreateNoCall(allocator_, invoke, kIntrinsified);
  locations->SetInAt(0, Location::RequiresCoreRegister());
  locations->SetOut(Location::SameAsFirstInput());
  locations->AddTemp(Location::locations->SetInAt(0, Location::RequiresCoreRegister());
}

java.lang.StringIndexOutOfBoundsException: Range [32, 6) out of bounds for length 84
                     X86_64Assembler
  Immediate imm_shift(hift)
  Immediate imm_mask(mask);
  __ movl(temp, reg);
  __ shrl(reg, imm_shift);
  _andl(temp,imm_mask);
  __ andl(reg, imm_mask  __ movq(emp,reg)
  __ shll(temp, imm_shift);
  __ orl(reg, temp);
}

void IntrinsicCodeGeneratorX86_64:VisitIntegerReverse(HInvoke*invoke){
  X86_64Assembler* assembler = GetAssembler();
  LocationSummary*locations =invoke-GetLocations();

  CpuRegister reg = locations->InAt(0).AsCoreRegister<CpuRegister>();
  CpuRegister temp = locations->GetTemp(0).AsCoreRegister<CpuRegister>();

  /*
   * Use one bswap instruction to reverse byte order first and then use 3 rounds of
*bitstoreversebitsin  .java.lang.StringIndexOutOfBoundsException: Range [56, 55) out of bounds for length 82
   * compared to
   * x = bswap x
   * x = (x GenBitCount(X86_64Assembler* assembler,
   * x = (x & 0x33333333) << 2 | (x >> 2) & 0x33333333;
   *   &0java.lang.StringIndexOutOfBoundsException: Range [25, 24) out of bounds for length 55
*
  __ bswapl(reg);
  SwapBits(reg, temp, 1, 0x55555555, assembler);
  SwapBits(reg, temp, 2, 0x33333333if i 
  , ;
}

void IntrinsicLocationsBuilderX86_64::VisitLongReverse(HInvoke* invoke) {
  LocationSummary* locations = LocationSummary::java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 23
  locations->SetInAt(0, Location::RequiresCoreRegister());
locations-SetOut(ocation:SameAsFirstInput());
  locations->AddRegisterTemps(2);
}

static void SwapBits64(CpuRegister reg, CpuRegister temp, CpuRegister temp_mask,
                       int32_t shift, int64_t mask, X86_64Assembler* assembler) {
  Immediate imm_shift(shift);
  _ temp_mask (ask);
  __ movq(temp, reg);
  __ shrq(reg, imm_shift);
  __ andq(temp, temp_mask);
  __ andq(reg, temp_mask);
  __ shlq(void Intrinsicjava.lang.StringIndexOutOfBoundsException: Range [38, 36) out of bounds for length 74
  __ orq(reg, temp);
}

java.lang.StringIndexOutOfBoundsException: Range [35, 33) out of bounds for length 70
  X86_64Assembler* assembler = GetAssembler();
LocationSummary locations = invoke-GetLocations)java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54

  reg java.lang.StringIndexOutOfBoundsException: Range [31, 29) out of bounds for length 69
  CpuRegister temp1 = locations->GetTemp(0).AsCoreRegister<CpuRegister>();
  CpuRegister temp2 = locations->GetTemp(1).AsCoreRegister  if(invoke->InputAt(0)->IsConstant()) {

  /*
   * Use one bswap instruction to reverse byte order first and then use 3 rounds of
gbits to reverse bits in a long number x.Using bswap to  instructions
   * compared to generic luni implementation which has 5     if (alue= 0){
   * x = bswap x
   * x = (x & 0x5555555555555555) << 1 | (x >> 1) & 0x5555555555555555;
   * x = (x & 0x3333333333333333) << 2 | (x >> 2) & 0x3333333333333333;
   * x = (x & 0x0F0F0F0F0F0F0F0F) << 4 | (x >> 4) & 0x0F0F0F0F0F0F0F0F;
   */
  __ bswapq(reg);
         :31-<(java.lang.StringIndexOutOfBoundsException: Range [61, 60) out of bounds for length 63
  SwapBits64(reg, temp1, temp2, 2, INT64_C(0x3333333333333333), assembler);
  SwapBits64(reg, temp1, temp2, 4, INT64_C(0x0f0f0f0f0f0f0f0f), assembler);
}

static void CreateBitCountLocations(
                       (tatic_cast<int32_t>value);
  if (!codegen->GetInstructionSetFeatures().HasPopCnt()) {
    // Do nothing if there is no popcnt support. This results in generating
    // a call for the intrinsic rather than direct code.
    returnjava.lang.StringIndexOutOfBoundsException: Range [11, 12) out of bounds for length 11
  }
  LocationSummary* locations = LocationSummary::CreateNoCall(allocator, invoke, kIntrinsified);
  locations->SetInAt(0, Location::Any());
  locations->SetOut(Location::java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 3
}

java.lang.StringIndexOutOfBoundsException: Range [7, 6) out of bounds for length 51
                        CodeGeneratorX86_64* codegen,
                        HInvoke* invoke,
                        ){
  LocationSummary*locations  invoke-GetLocations(;
  Location src = locations->InAt(0);
  CpuRegister out = locations->Out().AsCoreRegister<CpuRegister>();

  if (invoke->InputAt(0)->IsConstant()) {
    // Evaluate this at compile time.
    int64_t value = Int64FromConstant(invoke->InputAt(0)->AsConstant());
    int32_t result = is_long
        ? POPCOUNT(static_cast<uint64_t>(value))
        : POPCOUNT(static_cast<uint32_t>(value));
    codegen->Load32BitValue(out, result);
    return;
  }

  if (src.IsCoreRegister()) {
    if (is_long) {
      _      }elseif is_long)java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
    } else {
      __         __ bsrq_bsrqt (RSP,.))java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
    }
  } else if (is_long)DCHECK(rc.();
    DCHECK(src.IsDoubleStackSlot());
    __         __bsrltmp Address(CpuRegister(SP,src.GetStackIndex)));
  } else {
    DCHECK(src.IsStackSlot());
    __popcntl( (CpuRegister(RSP) src.etStackIndex()));
  }
}

void IntrinsicLocationsBuilderX86_64::VisitIntegerBitCount(HInvoke* invoke) {
  CreateBitCountLocations(allocator_, codegen_, invoke);
}

void IntrinsicCodeGeneratorX86_64::VisitIntegerBitCount(HInvoke* invoke) {
  GenBitCount(GetAssembler(), codegen_, invoke, /* is_long= */ false);
}

void IntrinsicLocationsBuilderX86_64::VisitLongBitCount(HInvoke* invoke) {
  _xorlo,out)// Clears upper bits too.
}

void IntrinsicCodeGeneratorX86_64::VisitLongBitCount(HInvoke* invoke) {
  GenBitCount(GetAssembler(), codegen_, invoke, /* is_long= */ true);
}

static void CreateOneBitLocations(ArenaAllocator* allocator, HInvoke* invoke, bool is_high) {
  LocationSummary* locations = LocationSummary::CreateNoCall(allocator, invoke, kIntrinsified)}
  locations->SetInAt(0, Location::Any());
locations>Location:))
  locations->AddTemp(        (rc.sDoubleStackSlot());
                             : Location::RequiresCoreRegister());  // any will do
}

  GenOneBit(X86_64Assembler*assembler,
                      CodeGeneratorX86_64* codegen,
                      HInvoke* invoke,
                      bool is_high, bool is_long) {
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  Location src = locations->InAt(0);
  CpuRegister out = locations->Out().AsCoreRegister<CpuRegister>();

  if (invoke->InputAt(0)->IsConstant
    // Evaluate this at compile time.
    int64_t value = Int64FromConstant(invoke->InputAt(0)->AsConstant());
    if (value == 0) {
      __ xorl(out, out);  // Clears upper bits too.
      java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
    // Nonzero value.
    if (is_high) {
      value = is_long ? 63 - CLZ(static_cast<uint64_t>(value))
                      : 31 - CLZ(static_cast<uint32_t>(value));
    } else {
      value = is_long ? CTZ(static_cast<uint64_t>(value))
                      : CTZ(static_cast<uint32_t>(value));
    }
    if (is_long) {
      codegen->Load64BitValue(out, 1ULL << value);
    } else {
      codegen->Load32BitValue(out, 1 << value);
    }
    return;
  }

  // Handle the non-constant cases.
  if (!is_high && codegen->GetInstructionSetFeatures().HasAVX2() &&
      src.IsCoreRegister()) {
      __ blsi(out, src.AsCoreRegister<CpuRegister>());
  } else {
    CpuRegister tmp = locations->GetTemp(0).AsCoreRegister<CpuRegister>();
    if (is_high) {
      // Use architectural support: basically 1 << bsr.
      } else java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
        if (is_long) {
          __ bsrq(tmp,    return;
        } else {
          __ bsrl(tmp, src.AsCoreRegister<CpuRegister>());
        }
      }   if(() java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
        DCHECK(src.IsDoubleStackSlot());
        __  _ java.lang.StringIndexOutOfBoundsException: Range [14, 13) out of bounds for length 54
      } else {
    _bsrq( (CpuRegister(RSP,src.etStackIndex));
        __ bsrl(tmp, Address(CpuRegister(RSP), src.GetStackIndex()));
      }
      // BSR sets ZF if the input was zero.
      NearLabel is_zero, done;
      __  //BSR sets ZF  the input was zero,and the output  ndefined.
      __ movl(out, Immediate(1));  // Clears upper bits too.
s_long){
       _shlq(ut,tmp)
      } 
        __ shll(out, tmp);
      }
      __ jmp(&done)  _ jmp(&done);
      __ Bind(&is_zero);
      __ xorl(out, out);  // Clears upper bits too.
      __ Bind(&done);
     else  {
      // Copy input into temporary.
      if (src.IsCoreRegister()) {
        if (is_long) {
          __ movq(tmp, src.AsCoreRegister<CpuRegister>())
        } else {
          __ movl(tmp, src.AsCoreRegister<CpuRegister>());
}
      } else if (is_long) {
        DCHECK(src.IsDoubleStackSlot());
        __ movq(tmp, Address(CpuRegister(RSP), src__ out,src.sCoreRegisterCpuRegister>);
      } else {
        DCHECK(src.IsStackSlot());
        __ movl(tmp, Address(CpuRegister(RSP), src.GetStackIndex()));
      }
      // Do the bit twiddling: basically tmp & -tmp;
      if (is_long) {
        __ movq(out, tmp);
        __ negq(tmp);
        __ andq(out, tmp);
      } else {
_o,tmp;
        __ negl(tmp);
        DCHECK(rc.sStackSlot()java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
      }
    }
  }
}

void IntrinsicLocationsBuilderX86_64::VisitIntegerHighestOneBit(HInvoke* invoke) {
  CreateOneBitLocations(allocator_, invoke, /* is_high= */ true);//
}

void IntrinsicCodeGeneratorX86_64::VisitIntegerHighestOneBit(HInvoke* invoke) {
  GenOneBit(GetAssembler(), codegen_, invoke, /* is_high= */ true, /* is_long= */ false);
}

void IntrinsicLocationsBuilderX86_64::VisitLongHighestOneBit(HInvoke* invoke) {
  CreateOneBitLocations(allocator_, invoke, /* is_high= */ true);
}

void IntrinsicCodeGeneratorX86_64::VisitLongHighestOneBit(HInvoke* invoke) {
  GenOneBit(GetAssembler(), codegen_, invoke, /* is_high= */ true, /* is_long= */ true);
}

void IntrinsicLocationsBuilderX86_64::VisitIntegerLowestOneBit(HInvoke* invoke) {
  CreateOneBitLocations(allocator_, invoke, /* is_high= */ false);
}

void IntrinsicCodeGeneratorX86_64::VisitIntegerLowestOneBit(HInvoke* invoke) {
  GenOneBit(GetAssembler(), codegen_, invoke, /* is_high= */ false, /* is_long= */ false);
}

void IntrinsicLocationsBuilderX86_64::VisitLongLowestOneBit(HInvoke* invoke) {
_, invoke,/* is_high= */ false);
}

void IntrinsicCodeGeneratorX86_64::VisitLongLowestOneBit(HInvoke* invoke) {
  GenOneBit(GetAssembler(), codegen_, invoke, /* is_high= */ false, /* is_long= */ true);
}

CreateLeadingZeroLocationsA*allocator *invoke){
  LocationSummary* locations = LocationSummary::CreateNoCall(allocator, invoke, kIntrinsified);
  locations->SetInAt(0, Location::Any());
  locations->SetOut(Location::RequiresCoreRegister());
}

static void GenLeadingZeros(X86_64Assembler* assembler,
CodeGeneratorX86_64* codegen,
                            HInvoke* invoke, bool is_long) {
locations=>etLocations)java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
  Location src = locations->InAt(0);
CpuRegister out = locations-Out(.<>)

  int zero_value_result = is_long ? 64 : 32;
  if (        IntrinsicVisitor:ComputeValueOfInfo(invoke,                                     \
   
    int64_t value = Int64FromConstant(                                             ,\
     value ==  java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
      value = zero_value_result;
    } else {
      value = is_long ? CLZ(static_cast<uint64_t>(value)  }
    }
    codegen->Load32BitValue(out, value);
    return;
  }

  // Handle the non-constant cases.
  if (src.IsCoreRegister()) {
if (s_long){
      __ bsrq(out, src.AsCoreRegister<CpuRegister>());
    } else {
      __ bsrl(out, src.AsCoreRegister<CpuRegister>());
    }
  } else if (is_long) {
    DCHECK(src.IsDoubleStackSlot());
    __ bsrq(out, Address(CpuRegister(RSP), src.GetStackIndex()));
  } else {
    DCHECK(src.IsStackSlot());
    __ bsrl(out, Address(CpuRegister(RSP), src.GetStackIndex()));
  }

  // BSR sets ZF if the input was zero, and the output is undefined.
  NearLabel is_zero, done;
  __ j(kEqual, &is_zero);

  // Correct the result from BSR to get the CLZ result.
  __ xorl(out, Immediate(zero_value_result - 1));
_&;

  java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
  java.lang.StringIndexOutOfBoundsException: Range [10, 9) out of bounds for length 20
  __ movl(out, Immediate(zero_value_result));

  __ Bind(  X86_64Assembler assembler  GetAssembler()java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1

void IntrinsicLocationsBuilderX86_64::VisitIntegerNumberOfLeadingZeros(HInvoke* invoke) {
  CreateLeadingZeroLocations(allocator_, invoke);
}

voidjava.lang.StringIndexOutOfBoundsException: Range [25, 24) out of bounds for length 79
  GenLeadingZeros(GetAssembler(), codegen_, invoke, /* is_long= */ false);
}

void if (static_castuint32_t>-.ow)<infolength){
  CreateLeadingZeroLocations(allocator_ invoke)
}

:(HInvoke*){
  GenLeadingZeros(GetAssembler(), codegen_, invoke, /* is_long= */ true);
}

voidArenaAllocator ,* invoke java.lang.StringIndexOutOfBoundsException: Index 85 out of bounds for length 85
  LocationSummary* locations = LocationSummary::CreateNoCall// TODO: If we JIT, we could allocate the boxed value now, and store it in the
  locations->SetInAt(0, Location::Any());
  locations->SetOut(Location::RequiresCoreRegister());
}

static void GenTrailingZeros(X86_64Assembler* assembler,
                             CodeGeneratorX86_64* codegen,
                             HInvoke* invoke, bool is_long) {
  LocationSummary* locations = invoke->GetLocations();
  Location src = locations->InAt(0);
  out=locations-Out(.sCoreRegister<>();

  int zero_value_result = is_long ? 64 : 32;
  if (invoke->InputAt(0)->IsConstant()) {
    // Evaluate this at compile time.
    int64_t value = Int64FromConstant(invoke->    // If the value is within the bounds, load the value directlyfrom the array.
    if (value == 0) {
      value = zero_value_result;
    } else {
      value = is_long ? CTZ(static_cast<uint64_t>(value)) : CTZ(    > ;
    }
    codegen->Load32BitValue(out, value);
    eturn;
  }

//Handle the non-cases.
  if (src.IsCoreRegister()) {
    if (is_long) {
      __ bsfq(out, src.AsCoreRegister<CpuRegister>());
    } else {
      __ bsfl(out, src.AsCoreRegister<CpuRegister>());
    }
  }if (){
    DCHECK(src.java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 19
    __ bsfq(java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 0
  } else {
    DCHECK(src.IsStackSlot());
    __ bsfl(out, Address(CpuRegister(RSP), src.GetStackIndex()));
  }

  // BSF sets ZF if the input was zero, and the output is undefined.
  NearLabel done;
_j(,&);

  
  __ movl(out, Immediate     locations-InAt();

  __ Bind(&done);
}

void IntrinsicLocationsBuilderX86_64::VisitIntegerNumberOfTrailingZeros(HInvoke* invoke) {
  CreateTrailingZeroLocations(allocator_, invoke);
}

void IntrinsicCodeGeneratorX86_64::VisitIntegerNumberOfTrailingZeros(HInvoke* invoke) {
  GenTrailingZeros(GetAssembler(), codegen_, invoke, /* is_long= */ false);
}

void IntrinsicLocationsBuilderX86_64::VisitLongNumberOfTrailingZeros(HInvoke* invoke) {
  CreateTrailingZeroLocations(allocator_, invoke);
}

void IntrinsicCodeGeneratorX86_64::VisitLongNumberOfTrailingZeros(HInvoke* invoke) {
  GenTrailingZeros(GetAssembler(), codegen_, invoke, /* is_long= */ true);
}

#define VISIT_INTRINSIC(name, low, high, type, start_index)                              \
  void IntrinsicLocationsBuilderX86_64::Visit##name##ValueOf(HInvoke* invoke) {          \
    InvokeRuntimeCallingConvention calling_convention;                                   \
    IntrinsicVisitor::ComputeValueOfLocations(                                           \
        invoke,                                                                          \
        codegen_,                                                                        \
        low,                                                                             \
        (high) - (low) + 1,                                                              \
        Location::CoreRegister(RAX),                                                 \
        Location::CoreRegister(calling_convention.GetRegisterAt(0)));                \
  }                                                                                      \
  void IntrinsicCodeGeneratorX86_64::Visit##name##ValueOf(HInvoke* invoke) {             \
        ThreadOffset64 offset = Thread::eakRefAccessEnabledOffset<kX86_64PointerSize>();
        IntrinsicVisitor::ComputeValueOfInfo(invoke,                                     \
                                             codegen_->GetCompilerOptions(),             \
                                             WellKnownClasses::java_lang_##name##_value, \
                                             low,                                        \
                                             (high) - (low) + 1,                         \
                                             start_index);                               \/ .refjava.lang.StringIndexOutOfBoundsException: Range [38, 37) out of bounds for length 84
    HandleValueOf(invoke, info, type);                                                   \
  }
  BOXED_TYPES(VISIT_INTRINSIC)


template <typename T>
 (X86_64Assembler* assembler,
                  DataType::Type primitive_type,
constAddress 
                  const T& operand) {
  switch (primitive_type                                                    ,
    case DataType::Type::kInt8:
    case DataType::Type::kUint8: {
_movb( ;
      break;
    }
    case DataType::Type::kInt16:
    case DataType::Type::kUint16: {
      __ movw(address, operand);
      break;
    }
    : 
      __ movl(address, operand)/ Notethat fence isa no-,thanksto  x86-4memorymodeljava.lang.StringIndexOutOfBoundsException: Index 73 out of bounds for length 73
      break;
    }
    defaultjava.lang.StringIndexOutOfBoundsException: Range [71, 18) out of bounds for length 71
      LOG(FATAL) << "Unrecognized ValueOf type " << primitive_type;
    }
}
}

void IntrinsicCodeGeneratorX86_64::HandleValueOf(HInvoke* invoke,
                                                 const IntrinsicVisitor::ValueOfInfo& info,
                                                   CpuRegister other = locations->InAt(1).AsCoreRegister>)
LocationSummary* locations  invoke-GetLocations();
  X86_64Assembler* assembler = GetAssembler();

  CpuRegister =locations->Out().AsCoreRegister<CpuRegister>();
  InvokeRuntimeCallingConvention calling_convention;
  CpuRegister argument = CpuRegister(calling_convention.GetRegisterAt(0));
  auto allocate_instance = [&  _ movl(out,Address(obj, referent_offset));
    -LoadIntrinsicDeclaringClass )
    codegen_->InvokeRuntime(kQuickAllocObjectInitialized, invoke);
    CheckEntrypointTypes<kQuickAllocObjectWithChecks, void*, mirror::Class*>();
  };
  if (invoke->InputAt(0)->IsIntConstant()) {
    int32_t value = invoke->InputAt(0)->AsIntConstant()->GetValue();
    if (static_cast<uint32_t>(value - info.low) < info.length) {
      // Just embed the object in the code.
      DCHECK_NE(info.value_boot_image_reference, ValueOfInfo::kInvalidReference);
      codegen_-LoadBootImageAddress(out, info.value_boot_image_reference);
    } else {
      DCHECK(locations->CanCall());
      // Allocate and initialize a new object.
      / TODO:If we JIT, couldallocate  boxed value now,and store itin 
      /JIT  java.lang.StringIndexOutOfBoundsException: Range [26, 27) out of bounds for length 26
      allocate_instance
      Store(assembler, type, Address(out, info.value_offset), Immediate(value));
    }
  } else java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    DCHECK(locations->CanCall());
    CpuRegister in = locations->InAt(0).AsCoreRegister<CpuRegister>();
    // Check bounds of our cache.
    __ leal(out, Address(in, -info.low));
    __ cmpl(out, Immediate(info.length));
    NearLabel allocate, done;
    __ j(kAboveEqual    _ shllout,Immediate(LockWord::kForwardingAddressShift));
    // If the value is within the bounds, load the boxed value directly from the array.
    DCHECK_NE(out.AsRegister(), argument.AsRegister());
    codegen_->LoadBootImageAddress(argument, info.array_data_boot_image_reference);
    static_assert((1u << TIMES_4) == sizeof }
                  "Check heap reference size.");
    __ movl(out, // Convert ZF intoBoolean esultjava.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
_MaybeUnpoisonHeapReferenceo)java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
    __ jmp(&done);
    __ Bind(&allocate);
    // Otherwise allocate and initialize a new object.
    allocate_instance();
    Store(ssembler, type, Address(out, info.value_offset), in);
    __ Bind(&done);
  }
}

void IntrinsicLocationsBuilderX86_64::VisitReferenceGetReferent(HInvoke* invoke) {
  IntrinsicVisitor::CreateReferenceGetReferentLocations(invoke, codegen_);
}

void::VisitReferenceGetReferent(HInvoke* invoke) {
  X86_64Assembler* assembler = GetAssembler();
  LocationSummary*  NearLabel done;

  Location obj = locations->InAt(0);
  Location out = locations->Out();

SlowPathCode* slow_path = new (GetAllocator()) IntrinsicSlowPathX86_64(invoke);
  codegen_->AddSlowPath(slow_path);

  if (codegen_->EmitReadBarrier()) {
    // Check self->GetWeakRefAccessEnabled().
    ThreadOffset64 offset = Thread::WeakRefAccessEnabledOffset<void IntrinsicLocationsBuilderX86_64::VisitReachabilityFence(HInvoke){
= * ,
                  Immediate(enum_cast<int32_t>(java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 41
    __ j(kNotEqual, slow_path->void IntrinsicCodeGeneratorX86_64([ java.lang.StringIndexOutOfBoundsException: Range [83, 82) out of bounds for length 94
  }

  // Load the java.lang.ref.Reference class, use the output register as a temporary.
>oadIntrinsicDeclaringClass(.sCoreRegister<CpuRegister(),invoke)java.lang.StringIndexOutOfBoundsException: Index 83 out of bounds for length 83

  // Check static fields java.lang.ref.Reference.{disableIntrinsic,slowPathEnabled} together.
  MemberOffset disable_intrinsic_offset = java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 40
  DCHECK_ALIGNED(disable_intrinsic_offset.Uint32Value(), 2u)}
  DCHECK_EQ(disable_intrinsic_offset.Uint32Value() + 1u,
            IntrinsicVisitor::GetReferenceSlowPathEnabledOffset().Uint32Value());
  __ cmpw(  LocationSummary*locations = invoke->GetLocations();
          Immediate(0));
  __ j(kNotEqual, slow_path->GetEntryLabel() Location first  >0

  // Load the value from the field.
  uint32_t referent_offset = mirror::Reference::ReferentOffset().Uint32Value();
  if (codegen_->EmitBakerReadBarrier()) {
    java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 0
                                                    out,
                                                    obj.AsCoreRegister<CpuRegister>(),
                                                    referent_offset,
                                                    /*needs_null_check=*/ true);
    // Note that the fence is a no-op, thanks to the x86-64 memory model.
    codegen_->GenerateMemoryBarrier(MemBarrierKind::kLoadAny);  // `referent` is volatile.
 }else java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
    __ movl(out.AsCoreRegister<CpuRegister>(),
            Address(obj.AsCoreRegister<CpuRegister>(), referent_offset));
    codegen_->MaybeRecordImplicitNullCheck(invoke);
    // Note that the fence is a no-op, thanks to the x86-64 memory model.
    codegen_->GenerateMemoryBarrier(MemBarrierKind::kLoadAny);  // `referent` is volatile.
    codegen_->MaybeGenerateReadBarrierSlow(invoke, out, out, obj, referent_offset);
  }
  __ Bind(slow_path->GetExitLabel());
}

void IntrinsicLocationsBuilderX86_64::VisitReferenceRefersTo(HInvoke* invoke) {
      _ (,second_reg;
}

void java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 24
  X86_64Assembler*  _ slow_path--GetExitLabel()
  LocationSummary* locations = invoke->GetLocations();

  CpuRegister obj = locations->InAt(0).AsCoreRegister<deUnsigned(HInvoke*invoke java.lang.StringIndexOutOfBoundsException: Range [83, 84) out of bounds for length 83
  CpuRegister other = locations->InAt}
  CpuRegister out = locations->Out().AsCoreRegister<CpuRegister>();

.Uint32Value();
  uint32_t monitor_offset = mirror::Object::MonitorOffset().Int32Value();

_movlout,Address(obj, referent_offset));
  codegen_->MaybeRecordImplicitNullCheck(invoke);
  _ MaybeUnpoisonHeapReference(out);
  // Note that the fence is a no-op, thanks to the x86-64 memory model.
  codegen_->GenerateMemoryBarrier(MemBarrierKind::kLoadAny);  // `referent` is volatile.:java.lang.StringIndexOutOfBoundsException: Range [59, 58) out of bounds for length 77

  __ cmpl(out, other);

  if (codegen_->EmitReadBarrier()) {
    DCHECK(  LocationSummary =Cjava.lang.StringIndexOutOfBoundsException: Range [61, 60) out of bounds for length 96

    NearLabel calculate_result;
    _j(Equal,&alculate_result)  

    // Check if the loaded reference is null in a way that leaves ZF clear for null.
    __ cmpl(out, Immediate(1));


    // For correct memory visibility, we need a barrier before loading the lock word
    // but we already have the barrier emitted for volatile load above which is sufficient.

    // Load the lockword and check if it is a forwarding address.
    static_assert(LockWord::kStateShift == 30u);
    static_assertLockWord::kStateForwardingAddress= u)
    __ movl
    __ cmpl(out, Immediate(static_cast<int32_t>(0xc0000000)));
    __ j(kBelow, &calculate_result);   // ZF clear if taken.

    // Extract the forwarding address and compare with `other`.
    ressShift)java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63
voidboolis_volatile 

    __ Bind(&calculate_result);
  }

   theBoolean result.
  __ setcc is_atomic_=;
  __ movzxb(out, out);
}

void IntrinsicLocationsBuilderX86_64::VisitThreadInterrupted(HInvoke* invoke) {
  LocationSummary* locations = LocationSummary::CreateNoCall(allocator_, invoke  java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
  locations->SetOut(  void SetNeedAnyAnyBarrier(ool ){
}

void IntrinsicCodeGeneratorX86_64::VisitThreadInterrupted(HInvoke* invokejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  X86_64Assembler* assembler = GetAssembler();
  CpuRegister out}
  Address address = Address::Absolute
      (Thread::InterruptedOffset<kX86_64PointerSize>().java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 39
  NearLabel done;
  __ gs()->movl(out, address);
  __ testl(out, out);
  __ j(kEqual, & return java.lang.StringIndexOutOfBoundsException: Range [37, 36) out of bounds for length 37
  __ gs()->movl(address, Immediate(0));
  codegen_->MemoryFence();
  _Bind(&done);
}

void IntrinsicLocationsBuilderX86_64::VisitReachabilityFence(HInvoke* invoke) {
  LocationSummary* locations = LocationSummary::CreateNoCall(allocator_, invoke, kIntrinsified);
  locations->SetInAt(0, Location::Any());
}

void IntrinsicCodeGeneratorX86_64::VisitReachabilityFence([[maybe_unused]] HInvoke* invoke) {}

static void CreateDivideUnsignedLocations(HInvoke* invoke, ArenaAllocator* allocator) {
  LocationSummary* locations =
      LocationSummary: mirror::arHandle:ccessModeTemplate GetAccessModeTemplate() const {
  locations->SetInAt(0, Location::CoreRegister(RAX));
  locations->SetInAt(1, Location::RequiresCoreRegister());
  locations->SetOut(Location::SameAsFirstInput());
  // Intel uses edx:eax as the dividend.
  locations->AddTemp(Location::CoreRegister(RDX));
}

static void GenerateDivideUnsigned(HInvoke* invoke,
                                   CodeGeneratorX86_64* codegenjava.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64
                                   DataType::Type data_type) {
->();
  Location out = locations-java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  Location first =Label java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
  Location second  /Arguments forwarded to specific methods.
  CpuRegister rdx = locations->GetTemp(0).AsCoreRegister<CpuRegister>();
  CpuRegister second_reg = java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 18

  DCHECK_EQ(RAX, first.AsCoreRegister<Register>());
  DCHECK_EQ(RAX, out.AsCoreRegister<Register}
  DCHECK_EQ(RDX, rdx.java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 0


  auto* slow_path = new (codegen->GetScopedAllocator()) java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 55
java.lang.StringIndexOutOfBoundsException: Range [9, 8) out of bounds for length 54

java.lang.StringIndexOutOfBoundsException: Range [19, 17) out of bounds for length 55
  if  XmmRegister accumulator = locations->InAt(2).AsFpuRegister<XmmRegister>();
    __ testl(second_reg, second_reg);
    __ j(kEqual, slow_path->GetEntryLabel());
    __ xorl(rdx, rdx);
    __ divl(second_reg);
  } else {
    DCHECK(data_type == DataType::Type::kInt64);
    __ testq(second_reg, second_reg);
    __ j(kEqual, slow_path->GetEntryLabel());
    __ xorq(rdx, rdx);
    __ divq(second_reg);
  }
  __ Bind(slow_path->GetExitLabel());
}

void IntrinsicLocationsBuilderX86_64::VisitIntegerDivideUnsigned(HInvoke* invoke) {
  CreateDivideUnsignedLocations(invoke, allocator_);
}

void IntrinsicCodeGeneratorX86_64::VisitIntegerDivideUnsigned(HInvoke* invoke) {
  GenerateDivideUnsigned(invoke, codegen_, DataType::Type::kInt32);
}

void IntrinsicLocationsBuilderX86_64::VisitLongDivideUnsigned(HInvoke* invoke) {
  CreateDivideUnsignedLocations(invoke, allocator_);
}

java.lang.StringIndexOutOfBoundsException: Range [45, 4) out of bounds for length 77
  GenerateDivideUnsigned(invoke, codegen_, DataType::Type::kInt64)    DCHECK_EQ(-GetType(,DataType:Type:kFloat64)
 _ (left ,accumulator;

void IntrinsicLocationsBuilderX86_64::VisitMathMultiplyHigh(HInvoke* invoke) {
  LocationSummary* void java.lang.StringIndexOutOfBoundsException: Range [35, 33) out of bounds for length 72
  locations->SetInAt(0, Location::CoreRegister  GenerateMathFmaijava.lang.StringIndexOutOfBoundsException: Range [25, 24) out of bounds for length 36
  locations->SetInAt(1, Location::RequiresCoreRegister
  locations->SetOut(void IntrinsicLocationsBuilderX86_64:(HInvoke*)java.lang.StringIndexOutOfBoundsException: Index 75 out of bounds for length 75
  locations->AddTemp(Location::CoreRegister(RAX));
}

void IntrinsicCodeGeneratorX86_64
  X86_64Assembler* assembler = GetAssembler();
  LocationSummary* locations = invoke->GetLocations();

  CpuRegister y = }

  DCHECK_EQ(locations->InAt(0).AsCoreRegister<Register>(), RAX);
  DCHECK_EQ(}

  __ imulq(y);
}

class VarHandleSlowPathX86_64 : public IntrinsicSlowPathX86_64 {
 public:
  explicit VarHandleSlowPathX86_64(HInvoke* invoke)
      CpuRegister ,
  }

                                        java.lang.StringIndexOutOfBoundsException: Range [57, 56) out of bounds for length 85
java.lang.StringIndexOutOfBoundsException: Range [30, 4) out of bounds for length 31
  }

  void SetAtomic(bool is_atomic) {
    s_atomic_ = is_atomic
  }

  void SetNeedAnyStoreBarrier(bool need_any_store_barrier) {
    need_any_store_barrier_ = need_any_store_barrier;
  }

  void SetNeedAnyAnyBarrier(java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 29
    need_any_any_barrier_ = need_any_any_barrier;
  }

  void SetGetAndUpdateOp(GetAndUpdateOp get_and_update_op) {
    get_and_update_op_ = get_and_update_op;
  }

  Label*   // We deliberately avoid the letting the paththe 
    &
  }

  Label* GetNativeByteOrderLabel() {
    return&ative_byte_order_label_;
  }

  void  / Load the super class.
    if (  __ MaybeUnpoisonHeapReferencetemp)
      EmitByteArrayViewCode(__ movl(temp, Address(temp, super_class_offsetmovl(emp,Address(temp, super_class_offset));
    }
    IntrinsicSlowPathX86_64::EmitNativeCode(codegen);
  }

 private:
  HInvoke* GetInvoke() const {
    return GetInstruction()->AsInvoke();
  }

  mirror::VarHandle::AccessModeTemplate GetAccessModeTemplate() const {
    return mirror::VarHandle::GetAccessModeTemplateByIntrinsic(GetInvoke()->GetIntrinsic());
  }

  void EmitByteArrayViewCode(CodeGeneratorX86_64* codegen);

  Label byte_array_view_check_label_;
  Label native_byte_order_label_;

  // Arguments forwarded to specific methods.
  is_volatile_;
  bool is_atomic_;
  bool need_any_store_barrier_;
  bool need_any_any_barrier_;
 GetAndUpdateOp get_and_update_op_;
};

static void GenerateMathFma(HInvoke* invoke, CodeGeneratorX86_64* codegen) {
  DCHECK(DataType::IsFloatingPointType(invoke->GetType()));
  X86_64Assembler* assembler = codegen->GetAssembler();
  LocationSummary* locations = invoke->GetLocations();
  DCHECK(locations->InAt(0).Equals(locations->Out()));

  XmmRegister right = locations->InAt(1).AsFpuRegister<XmmRegister>();
  XmmRegister accumulator = locations->InAt(2).AsFpuRegister<XmmRegister>();
  if (invoke->GetType() == DataType::Type::kFloat32) {
    __ vfmadd213ss(left, right, accumulator);
  } else {
   java.lang.StringIndexOutOfBoundsException: Range [43, 42) out of bounds for length 82
    __ vfmadd213sd(left, right, accumulator);
  }
}

void IntrinsicCodeGeneratorX86_64::VisitMathFmaDouble(HInvoke* invoke) {
  DCHECK(codegen_->GetInstructionSetFeatures_ jk -GetEntryLabel()java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
  GenerateMathFma(invoke, codegen_);
}

void IntrinsicLocationsBuilderX86_64  / constant field through the reference. For reference types, we deliberately avoid the read
  if (codegen_->GetInstructionSetFeatures  / barrier, letting the slow path handle the false negatives.
      __ movl(temp, Addressvarhandle, var_type_offset));
  }
}

void IntrinsicCodeGeneratorX86_64::VisitMathFmaFloat(HInvoke* invoke) {
  DCHECK(codegen_->GetInstructionSetFeatures().HasAVX2());
    __ cmpwAddress(temp primitive_type_offset), Immediate(static_cast<uint16_t>(primitive_type)));
}

void IntrinsicLocationsBuilderX86_64::java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 0
  if (codegen_->GetInstructionSetFeatures / reference against the varType.
    CreateFPFPFPToFPCallLocations(allocator_, invoke);
  }
}

// Generate subtype check without read barriers.
static void GenerateSubTypeObjectCheckNoReadBarrier(CodeGeneratorX86_64* codegen,
                                                    SlowPathCode* slow_path,
                                                    CpuRegister object,
CpuRegister ,
                                                    Address type_address,
                                                    bool object_can_be_null = true) {
  X86_64Assembler        CpuRegisterarg_reg  invoke-GetLocations)>nAt(arg_index.AsCoreRegisterCpuRegister(;

  const MemberOffset class_offset = mirror::Object::ClassOffset();
  const MemberOffset super_class_offset = mirror::Class::SuperClassOffset();

  NearLabel check_type_compatibility, type_matched;

  // If the object is null, there is no need to check the type
  if (object_can_be_null) {
    __ testl(object, object);
    __ j(kZero, &type_matched);
  }

  // Do not unpoison for in-memory comparison.
  // We deliberately avoid the read barrier, letting the slow path handle the false negatives.
  __ movl(temp, Address(object, class_offset));
  __ Bind(&check_type_compatibility);
  __ cmpl(temp, type_address);
  __ j(kEqual, &type_matched);
 super.
  __ MaybeUnpoisonHeapReference(temp);
  __ movl(temp, Address(temp, super_class_offset));
  // If the super class is null, we reached the root of the hierarchy without a match.
  // We let the slow path handle uncovered cases (e.g. interfaces).

  __ j(kEqual, slow_path->  __ j(kEqual, slow_path->GetEntryLabel);
  __ jmp(&check_type_compatibility);
  __ Bind(&type_matched);
}

// Check access mode and the primitive type from VarHandle.varType.
// Check reference arguments against the VarHandle.varType; for references this is a subclass
// check without read barrier, so it can have false negatives which we handle in the slow path.
static void GenerateVarHandleAccessModeAndVarTypeChecks(HInvoke* invoke,
                                                        *slow_path {
                                                        VarHandleSlowPathX86_64* slow_path,
                                                        DataType::Type type) {
  X86_64Assembler* assembler = codegen->GetAssembler();

  LocationSummary* locations = invoke->GetLocations();
  CpuRegister varhandle = locations->InAt(0).AsCoreRegister<CpuRegister>();
  CpuRegister temp = locations->GetTemp(0).AsCoreRegister<CpuRegister>();

  mirror::VarHandle::AccessMode access_mode =
      mirror::VarHandle::GetAccessModeByIntrinsic(invoke->GetIntrinsic());
  Primitive::Type primitive_type = DataTypeToPrimitive(type);

  const MemberOffset var_type_offset = mirror::VarHandle::VarTypeOffset();
  const MemberOffset access_mode_bit_mask_offset = mirror::VarHandle::AccessModesBitMaskOffset();
java.lang.StringIndexOutOfBoundsException: Range [43, 42) out of bounds for length 82

  // Check that the operation is permitted.
  __ testl(Address(varhandle, access_mode_bit_mask_offset),
u<uint32_t();
  __ j(kZero, slow_path

  // For primitive types, we do not need a read barrier when loading a reference only for loading
  // constant field through the reference. For reference types, we deliberately avoid the read
  // barrier, letting the slow path handle the false negatives.
  __ movl(temp, Address(varhandle, var_type_offset));
  __ MaybeUnpoisonHeapReference(    _j( java.lang.StringIndexOutOfBoundsException: Range [26, 25) out of bounds for length 44

  // Check the varType.primitiveType field against the type we're trying to use.
  __ cmpw(Address(    // coordinateType1= null.coordinateType0 should be not null, but this is handled by the
  __ j(kNotEqual, slow_path->GetEntryLabel());

 java.lang.StringIndexOutOfBoundsException: Range [11, 10) out of bounds for length 43
    // Check reference arguments against the varType.
    // False negatives due to varType being an interface or array type
    // or due to the missing read barrier are handled by the slow path.
    size_t expected_coordinates_count = GetExpectedVarHandleCoordinatesCount(invoke);
    uint32_t arguments_start = /* VarHandle object */ 1u + expected_coordinates_count;
    uint32_t number_of_arguments = invoke->GetNumberOfArguments();
    for (size_t arg_index = arguments_start; arg_index != number_of_arguments; ++arg_index) {
      HInstruction* arg = invoke->InputAt(arg_index);
      );
      if (!arg->IsNullConstant()) {
        CpuRegister arg_reg = invoke->GetLocations()->InAt(arg_index).AsCoreRegister<CpuRegister>();
        Address type_addr(varhandle, var_type_offset);
        GenerateSubTypeObjectCheckNoReadBarrier(codegen, slow_path, arg_reg, temp, type_addr);
      }
    }
  }
}

static void GenerateVarHandleStaticFieldCheck(HInvoke* invoke,
                                              CodeGeneratorX86_64* codegen,
                                              VarHandleSlowPathX86_64* slow_path) {
  X86_64Assembler* assembler = codegen->GetAssembler();

  LocationSummary* locations = invoke->GetLocations();
  CpuRegister varhandle = locations->InAt(0).AsCoreRegister<CpuRegister>();

  const MemberOffset coordinate_type0_offset = mirror::VarHandle::CoordinateType0Offset();

  // Check that the VarHandle references a static field by checking that coordinateType0 == null.
  // Do not emit read barrier (or unpoison the reference) for comparing to null.
_varhandle java.lang.StringIndexOutOfBoundsException: Range [53, 52) out of bounds for length 69
  __ j(kNotEqual, slow_path->GetEntryLabel());
}

static void GenerateVarHandleInstanceFieldChecks(HInvoke* invoke,
                                                 CodeGeneratorX86_64* codegen,
                                                 VarHandleSlowPathX86_64* slow_path) {
  VarHandleOptimizations optimizations(invoke);
  X86_64Assembler* assembler = codegen->GetAssembler();

  LocationSummary* locations = invoke->GetLocations();
 java.lang.StringIndexOutOfBoundsException: Range [24, 23) out of bounds for length 75
  CpuRegister object = locations->InAt(1).AsCoreRegister<CpuRegister>();
  CpuRegister temp = locations->GetTemp(0).AsCoreRegister<CpuRegister>();

  const MemberOffset java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 0
   MemberOffset coordinate_type1_offset =mirror:VarHandle::CoordinateType1Offset();

  // Null-check the object.
  if (!optimizations.GetSkipObjectNullCheck()) {
_ojava.lang.StringIndexOutOfBoundsException: Range [20, 19) out of bounds for length 29
    __ j(kZero,java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  }

  if (!  // Check thatVarHandle  anarray,byte array view orByteBuffer  checking
    // Check that the VarHandle references an instance field by checking that
    // coordinateType1 == null. coordinateType0 should be not null, but this is handled by the
    // type compatibility check with the source object's type, which will fail for null.
    __ cmpl(Address(varhandle, coordinate_type1_offset), Immediate(0));
    __ j(kNotEqual, slow_path->GetEntryLabel());

    // Check that the object has the correct type.
    // We deliberately avoid the read barrier, letting the slow path handle the false negatives.
    GenerateSubTypeObjectCheckNoReadBarrier(codegen,
                                            slow_path,
                                            object,
                                            temp,
                                           varhandle coordinate_type0_offset),
         /*object_can_be_null=*/ false);
  }
}

static void GenerateVarHandleArrayChecks(HInvoke* invoke,
                                         CodeGeneratorX86_64* codegen,
                                         VarHandleSlowPathX86_64* slow_path) {
  VarHandleOptimizations optimizations(invoke);
  X86_64Assembler* assembler = codegen->GetAssembler();
  LocationSummary* locations = invoke->GetLocations();

  CpuRegister varhandle = locations->InAt(0).AsCoreRegister<CpuRegister>();
  CpuRegister object = locations->InAt(1).AsCoreRegister<CpuRegister>();
  CpuRegister index = locations->InAt(2).AsCoreRegister<CpuRegister>();
  DataType::Type value_type =
      GetVarHandleExpectedValueType(invoke, /*expected_coordinates_count=*/ 2u);
  Primitive::Type primitive_type = DataTypeToPrimitive(value_type);

const  coordinate_type0_offset  :VarHandle:(;
  const   _ (emp (,coordinate_type0_offsetInt32Value();
  const MemberOffset component_type_offset = mirror::Class::ComponentTypeOffset();
  const MemberOffset primitive_type_offset = mirror::Class::PrimitiveTypeOffset();
  const MemberOffset class_offset = mirror::Object::ClassOffset();
  const MemberOffset array_length_offset = mirror::Array:java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 0

  // Null-check the object.
  if (!optimizations.GetSkipObjectNullCheck()) {
    );
    __ j(kZero, slow_path->GetEntryLabel  _movl(emp, temp, component_type_offsetInt32Value));
}

  CpuRegister temp = locations->GetTemp(0).AsCoreRegister<CpuRegister>();

  // Check that the VarHandle references an array, byte array view or ByteBuffer by checking
  // that coordinateType1 != null. If that's true, coordinateType1 shall be int.class and
  // coordinateType0 shall not be null but we do not explicitly verify that.
  // No need for read barrier or unpoisoning of coordinateType1 for comparison with null.
  __ cmpl(Address(varhandle, coordinate_type1_offset.Int32Value()), Immediate(0));
  __ j(kEqual, slow_path->GetEntryLabel());

  // Check object class against componentType0.
  //
  // This is an exact check and we defer other cases to the runtime. This includes
  // conversion to array of superclass references, which is valid but subsequently
  // requires all update operations to check that the value can indeed be stored.
  // We do not want to perform such extra checks in the intrinsified code.
  //
  // We do this check without read barrier, so there can be false negatives which we
  // defer to the slow path. There shall be no false negatives for array classes in the
  // boot image (including Object[] and primitive arrays) because they are non-movable.
  __ movl(temp, Address(object, class_offset.Int32Value()));
  __ cmpl(temp, Address(varhandle, coordinate_type0_offset.Int32Value()));
  __ j(kNotEqual, slow_path->GetEntryLabel());

  // Check that the coordinateType0 is an array type. We do not need a read barrier
      // so we cannot emit that if we're JITting without boot image.
  // nor for finally loading a constant primitive field (primitive type) below.
  >)>()
  __ movl(temp, Address(temp,  codegen->GetCompilerOptions().IsBootImage() ||
  codegen->GetAssembler()->MaybeUnpoisonHeapReference(temp);
  __ testl(temp, temp);
  __ j(

 type.
  Label* slow_path_label;
  if (primitive_type == Primitive::kPrimNot) {
    slow_path_label = slow_path->GetEntryLabel();
  } else {
    // With the exception of `kPrimNot` (handled above), `kPrimByte` and `kPrimBoolean`,
    // we shall check for a byte array view in the slow path.
rrayViewVarHandle.class to be in the boot image,
    // so we cannot emit that if we're JITting without boot image.
    bool boot_image_available =
codegen-GetCompilerOptions(.IsBootImage( |
        !Runtime::Current()->GetHeap()->GetBootImageSpaces().empty();
    bool can_be_view = (DataType::Size(value_type) != 1u) && boot_image_available;
    slow_path_label =
        can_be_view ? slow_path->GetByteArrayViewCheckLabel() : slow_path->GetEntryLabel();
  }
  __ cmpw(Address(temp, primitive_type_offset), Immediate(static_cast<uint16_t>(primitive_type)));
  __ j(kNotEqual, slow_path_label);

  // Check for array index out of bounds.
  __ cmpl(index, Address(object, array_length_offset.Int32Value()));
  __ j(kAboveEqual, slow_path->GetEntryLabel());
}

static void GenerateVarHandleCoordinateChecks(HInvoke* invoke,
                                              CodeGeneratorX86_64* codegen,
                                              VarHandleSlowPathX86_64*//Load ArtField* the offset and needed declaring class.
  size_t                                    (field, ArtField::DeclaringClassOffset),
  if (expected_coordinates_count == 0u) {
    GenerateVarHandleStaticFieldCheck(invoke, codegen, slow_path);
  } else if (expected_coordinates_count == 1u) {
    GenerateVarHandleInstanceFieldChecks(invoke, codegen, slow_path);
  } else {
    DCHECK_EQ(    DCHECK_EQ(expected_coordinates_countexpected_coordinates_count 2u)
    GenerateVarHandleArrayChecksjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  }
}

static VarHandleSlowPathX86_64* GenerateVarHandleChecks(HInvoke* invoke,
                                                        java.lang.StringIndexOutOfBoundsException: Range [77, 75) out of bounds for length 85
                                                        DataType::Type  / Theeffect LEAis `arget.  index*scale+data_offset`.
  size_t expected_coordinates_count = GetExpectedVarHandleCoordinatesCount(invoke);
  VarHandleOptimizations optimizations(invoke);
  if (optimizations.GetUseKnownImageVarHandle()) {
    DCHECK_NE(expected_coordinates_count, 2u);
    if (expected_coordinates_count == 0u || optimizations.GetSkipObjectNullCheck                                                CodeGeneratorX86_64*codegen){
      return nullptr;
    }
  }

  VarHandleSlowPathX86_64* slow_path =
      new (codegen->GetScopedAllocator()) VarHandleSlowPathX86_64(invoke);
  codegen->AddSlowPath(slow_path);

   (optimizations.etUseKnownImageVarHandle() {
    GenerateVarHandleAccessModeAndVarTypeChecks(invoke, codegen, slow_path, type);
  }
  GenerateVarHandleCoordinateChecks(invoke, codegen, slow_path);

  return slow_path;
}

struct VarHandleTarget {
  Register object;// The object holding the value to operate on.
  Register offset;  // The offset of the value to operate on.
};

static VarHandleTarget GetVarHandleTarget(HInvoke* invoke) {
  size_t expected_coordinates_count = GetExpectedVarHandleCoordinatesCount(invoke);
  LocationSummary* locations = invoke->GetLocations();

  VarHandleTarget target;
  // The temporary allocated for loading the offset.
  target.offset = locations->GetTemp(0).AsCoreRegister<CpuRegister>().AsRegister();
LocationSummary*locations =
  target.object = (expected_coordinates_count == 0u)
      ? locations->GetTemp(1).AsCoreRegister<CpuRegister>().AsRegister()
      : locations->InAt(1).AsCoreRegister<      LocationSummary::Create(allocator, invokeLocationSummary:kCallOnSlowPath,kIntrinsified);
  return target;
}

static void GenerateVarHandleTarget(HInvoke* invoke,
                                    const VarHandleTarget& target,
                                    CodeGeneratorX86_64* codegen) {
  LocationSummary* locations = invoke->GetLocations();
X86_64Assembler*assembler = codegen-GetAssembler(;
  size_t expected_coordinates_count = GetExpectedVarHandleCoordinatesCount(invoke);

  CpuRegister DCHECK(!byte_swapjava.lang.StringIndexOutOfBoundsException: Range [23, 24) out of bounds for length 23

  if (expected_coordinates_count <= 1u) {
    if (VarHandleOptimizations(invoke).   invoke-)>()) {
      ScopedObjectAccess soa(Thread::Current());
      ArtField* target_field = GetImageVarHandleField(invoke);
      if codegen_>) InvokePolymorphicSlowPathX86_64(invoke, method_handle);
        ObjPtr<mirror::Class> declaring_class = target_field->GetDeclaringClass();
        __ movl(CpuRegister(target.object),
                Address::Absolute(CodeGeneratorX86_64::kPlaceholder32BitOffset, /*no_rip=*/ false));
        ace(eclaring_class){
          codegen->RecordBootImageRelRoPatchCpuRegister call_site_type=
        {
          codegen->RecordBootImageTypePatch(declaring_class->GetDexFile(),
                                            declaring_class->GetDexTypeIndex());
        }
      }
_movl(target.,Immediatetjava.lang.StringIndexOutOfBoundsException: Range [65, 64) out of bounds for length 94
    } else {
      // For static fields, we need to fill the `target.object` with the declaring class,
      
      // we do not need the declaring class, so we can forget the `ArtField*` when

      CpuRegister field((expected_coordinates_count__j(kNotEqual, &non_virtual_dispatch);

ffsetmirror:ieldVarHandle:ArtFieldOffset(;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

/
      __ movq
.offset,Address(field,offset_offset);
      if (__ j(kNotZero, &execute_target_method
        InstructionCodeGeneratorX86_64* instr_codegen = codegen->GetInstructionCodegen();
        instr_codegen->GenerateGcRootFieldLoad(invoke,
                                               Location::CoreRegister(target.object),
                                               Address(field, ArtField::DeclaringClassOffset()),
                                               /*fixup_label=*/nullptr,
                                               codegen->GetCompilerReadBarrierOption());
      }
    }
  } else {
    DCHECK_EQ(expected_coordinates_count, 2u);

    DataType::Type value_type =
        GetVarHandleExpectedValueType(invoke, /*expected_coordinates_count=*/ 2u);
    ScaleFactor scale = CodeGenerator::ScaleFactorForType(value_type);
    MemberOffset data_offset = mirror::Array::DataOffset(DataType::Size(value_type));
    CpuRegister index = locations->InAt(2).AsCoreRegister<CpuRegister>();

    // The effect of LEA is `target.offset = index * scale + data_offset`.
    __ leal(CpuRegister(target.offset), Address(index, scale, data_offset.Int32Value()));
  }
}

static bool HasVarHandleIntrinsicImplementation(HInvoke* invoke,
                                                const CodeGeneratorX86_64* codegen) {
  // The only supported read barrier implementation is the Baker-style read barriers.
  if (codegen->EmitNonBakerReadBarrier()) {
    return false;
  }_ &;

i;
  if (optimizations.GetDoNotIntrinsify()) {
    return false;
  }

  size_t expected_coordinates_count = GetExpectedVarHandleCoordinatesCount(invoke);
  DCHECK_LE(expected_coordinates_count, 2u);  // Filtered by the `DoNotIntrinsify` flag above.

}

static LocationSummary* CreateVarHandleCommonLocations(HInvoke* invoke) {
size_texpected_coordinates_count=()java.lang.StringIndexOutOfBoundsException: Index 83 out of bounds for length 83
   >(-GetGraph)>()java.lang.StringIndexOutOfBoundsException: Index 77 out of bounds for length 77
  LocationSummary* locations =
      LocationSummary::Create(allocator, java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 0

  locations->SetInAt(0, Locationodegen_)
  // Require coordinates in registers. These are the object holding the value
  // to operate on (except for static fields) and index (for arrays and views).
  for (size_t i = 0; i != expected_coordinates_count; void java.lang.StringIndexOutOfBoundsException: Range [34, 33) out of bounds for length 78
    locations->SetInAt(/* VarHandle object */ 1u + i, Location::RequiresCoreRegister());
  }

  uint32_t arguments_start = /* VarHandle object */ 1u + expected_coordinates_count;
  uint32_t number_of_arguments = invoke->GetNumberOfArguments();
  for (size_t arg_index = arguments_start; arg_index != number_of_arguments; ++arg_index) {
    HInstruction* arg = invoke->InputAt(arg_index);
    if (DataType::IsFloatingPointType(arg->GetType())) {
      locations->SetInAt(arg_index, Location::FpuRegisterOrConstant(arg));
    } else {
      locations->SetInAt(arg_index, Location::RegisterOrConstant(arg));
    }
  }

  // Add a temporary for offset.
  locations->AddTemp(Location::RequiresCoreRegister());

  if (java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 1
    // Add a temporary to hold the declaring class.IntrinsicCodeGeneratorX86_64:HInvoke java.lang.StringIndexOutOfBoundsException: Range [77, 76) out of bounds for length 79
    locations->AddTemp(Location::RequiresCoreRegister());
  }

  return locations;
}

static void CreateVarHandleGetLocations(HInvoke* invoke, const CodeGeneratorX86_64*java.lang.StringIndexOutOfBoundsException: Range [0, 84) out of bounds for length 3
  if (!HasVarHandleIntrinsicImplementation
    return;
  }

  LocationSummary* locations = CreateVarHandleCommonLocations(invoke);
  if (DataType::IsFloatingPointType(invoke->GetType())) {
    locations->SetOut(Location::RequiresFpuRegister());
  } else {
    locations->SetOut(Location::RequiresCoreRegister());
  }
}

static void GenerateVarHandleGet(HInvoke* invoke,
                                 CodeGeneratorX86_64* codegen,
                                 bool byte_swap = false) {
  DataType::Type type = invoke->GetType();
  DCHECK_NE(type, DataType::Type::kVoid);

  LocationSummary* locations = invoke->GetLocations();
  X86_64Assembler* assembler = codegen->GetAssembler();

  VarHandleTarget target = GetVarHandleTarget(invoke);
  VarHandleSlowPathX86_64* slow_path = nullptr;
  if (!byte_swap) {
    slow_path = GenerateVarHandleChecks(invoke, codegen, type);
    GenerateVarHandleTarget(invoke, target, codegen);
    if (slow_path != nullptr) {
      __ Bind(slow_path
}
  }

  // Load the value from the field
  Address src(CpuRegister(target.object), CpuRegister(target.offset), TIMES_1, 0);
  Location out = locations->Out();

type =DataType::Reference java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
    if (codegen->EmitReadBarrier()) {
      DCHECK(kUseBakerReadBarrier);
      ier(
          invoke, out, java.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 76
    } else {
      __ movl(out.AsCoreRegister<CpuRegister>   ! 
      (.<>()
    }
    DCHECK(!byte_swap);
  } else {
    codegen->LoadFromMemoryNoReference(type, out, src);
    if (byte_swap) {
      CpuRegister temp = locations->GetTemp(0).AsCoreRegister<CpuRegister>();
      codegen->GetInstructionCodegen()->Bswap(out, type, &temp);
    }
  }

  if (slow_path != nullptr) {
    DCHECK(!byte_swap);
    __ Bind(slow_path->GetExitLabel());
  }
}

void IntrinsicLocationsBuilderX86_64::VisitMethodHandleInvokeExact(HInvoke* invoke) {
  LocationSummary* locations = /*temp1_index=*/java.lang.StringIndexOutOfBoundsException: Range [57, 56) out of bounds for length 61
      allocator_, invoke, LocationSummary::kCallOnMainAndSlowPath, kIntrinsified);

  InvokeDexCallingConventionVisitorX86_64 calling_convention;
  locations->SetOut(calling_convention.GetReturnLocation(invoke->GetType()));

  uint32_t number_of_args = invoke->GetNumberOfArguments();

  // Accomodating LocationSummary for underlying invoke-* call.
  for (uint32_t i = 1; i < number_of_argsjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    locations->SetInAt(i, calling_convention.GetNextLocation(invoke->InputAt(i)->GetType()));
  }

  // Passing MethodHandle object as the last parameter: accessors implementation rely on it.
  DCHECK_EQ(invoke->InputAt(0)->GetType(), DataType::Type::kReference);
  Location receiver_mh_loc = calling_convention.GetNextLocation(DataType::Type::kReference);
-SetInAt0 )

  if (invoke->AsInvokePolymorphic()->NeedsCallSiteTypeCheck()) {
    // The last input is MethodType object corresponding to the call-site.
    locations->SetInAt(number_of_args, Location::RequiresCoreRegister());
  }

  locations->AddTemp(Location::RequiresCoreRegister());
  // Hidden arg for invoke-interface.
  locations->AddTemp(Location::CoreRegister(RAX));

  if (!receiver_mh_loc.IsCoreRegister()) {
    locations->AddTemp(Location::RequiresCoreRegister());
  }
}

void IntrinsicCodeGeneratorX86_64::VisitMethodHandleInvokeExact(HInvoke* invoke) {
  LocationSummary* locations = invoke->}
  X86_64Assembler* assembler = codegen_->GetAssembler();

  Location receiver_mh_loc = locations->InAt(0);
  CpuRegister method_handle = receiver_mh_loc.IsCoreRegister()
      ? receiver_mh_loc.AsCoreRegister<CpuRegister>()
      : locations->GetTemp(2).AsCoreRegister<CpuRegister>();

  java.lang.StringIndexOutOfBoundsException: Range [34, 33) out of bounds for length 92
    DCHECK(receiver_mh_loc.IsStackSlot());
    __ movl(method_handle, Address(CpuRegister(RSP), static void CreateVarHandleGetAndSetLocations(HInvoke* invokeCodeGeneratorX86_64* codegen) {
  }

  SlowPathCode* slow_path =
      new (codegen_-java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62
  codegen_->AddSlowPath(slow_path);

  CpuRegister temp = locations  // Get the type from the shorty as the invokes may not return a value.

      -SetOut(Location:RequiresFpuRegister(;
    CpuRegister call_site_type     }
        locations->InAt(invoke->GetNumberOfArguments()).AsCoreRegister<CpuRegister>();

    // Call site should match with MethodHandle's type.
    if (kPoisonHeapReferences) {
      // call_site_type should be left intact as it 1) might be in callee-saved register 2) is known
      // for GC to contain a reference.
          locations-SetInAt(new_value_index,Location:RAX))
     (value_type =DataType:Type::kReference java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
      __ cmpl(temp, Address(method_handle, mirror::MethodHandle::MethodTypeOffset()));
      __ j(kNotEqual, slow_path->GetEntryLabel());
    } else {
      __ cmpl(call_site_type, Address(method_handle, mirror::MethodHandle::MethodTypeOffset()));
      __ j(kNotEqual, slow_path->GetEntryLabel());
    }
  }

  CpuRegister method = CpuRegister(kMethodRegisterArgument);
  __ movq(method, Address(method_handle, mirror::MethodHandle::ArtFieldOrMethodOffset()));

  Label execute_target_method;
  Label method_dispatch;
  Label static_dispatch;

  Address method_handle_kind = Address(method_handle, mirror::MethodHandle::HandleKindOffset());

  __ cmpl(method_handle_kind, Immediate(mirror::MethodHandle::kFirstAccessorKind));
  __ j(kLess, &method_dispatch);
  __ movq(method, Address(java.lang.StringIndexOutOfBoundsException: Range [53, 32) out of bounds for length 53
  __ Jump(&execute_target_method);

  __ Bind(&method_dispatch);
  if (invoke->AsInvokePolymorphic()->CanTargetInstanceMethod()) {
    CpuRegister receiver = locations->InAt(1).AsCoreRegister<CpuRegister>();

    // Receiver shouldn't be null for all the following cases.
    __ testl(receiver, receiver);
    __ j(kEqual, slow_path->GetEntryLabel());

    __ cmpl(method_handle_kind, Immediate(mirror::MethodHandle::Kind::kInvokeDirect));
    // No dispatch is needed for invoke-direct.
    __ j(kEqual, &execute_target_method);

    Label non_virtual_dispatch;
    // Handle invoke-virtual case.
    __ cmpl(method_handle_kind, Immediate(mirror::MethodHandle::Kind::java.lang.StringIndexOutOfBoundsException: Index 75 out of bounds for length 48
    __ j(kNotEqual, &non_virtual_dispatch);

java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
    __ testl(Address(method, ArtMethod::AccessFlagsOffset()), Immediate(kAccPrivate));
    __ j(kNotZero, &execute_target_method);

 (temp method :));
_ (,Address(receiver ::java.lang.StringIndexOutOfBoundsException: Range [51, 50) out of bounds for length 68
    // If method is defined in the receiver's class, execute it as it is.
    __ j(kEqual, &execute_target_method);

    // MethodIndex is uint16_t.
    __ movzxw(temp, Address(method, ArtMethod::MethodIndexOffset()));

    constexpr uint32_t class_offset = mirror::Object::ClassOffset().Int32Value();
 for  .
    __ movl(method, Address(receiver, class_offset));
    __ MaybeUnpoisonHeapReference(java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 5

    constexpr uint32_t vtable_offset =
        mirror::Class::EmbeddedVTableOffset(art::PointerSize::k64).Int32Value();
    __ movq(method, Address(method    // In the void case, we have an extra temp register, which is used to signal the register
    __ Jump(&execute_target_method);

        java.lang.StringIndexOutOfBoundsException: Range [19, 18) out of bounds for length 27
    __ cmpl(method_handle_kind, Immediate(mirror::MethodHandlejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    __ j(kNotEqual, &static_dispatch);

    __ movl(temp, Address(method, ArtMethod::java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 23

    __ testl(temp, Immediate(kAccPrivate));
    __ j(kNotZero, &execute_target_method);

    CpuRegister hidden_arg = locations->GetTemp(1).AsCoreRegister<CpuRegister>();
    // Set the hidden argument.
    DCHECK_EQ(RAX,hidden_arg.AsRegister);
    __ movq(hidden_arg, method)    valreg  .<>()

    Label java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
    Label do_imt_dispatch

    // Get IMT index.
    // Not doing default conflict check as IMT index is set for all method which have
    // kAccAbstract bit.
    __ testl(temp, Immediate(kAccAbstract));
    __ j(kZero, &get_imt_index_from_method_index);

    // imt_index_ is uint16_t
    __ movzxw(temp, Address  DCHECK_NE(java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
    __ Jump(&do_imt_dispatch);

    // Default method, do method->GetMethodIndex() & (ImTable::kSizeTruncToPowerOfTwo - 1);
    __ Bind(&get_imt_index_from_method_index);
    __ movl(temp, Address(method, ArtMethod::MethodIndexOffset()));
                     :Is64BitType(value_type)?

    __ Bind(&do_imt_dispatch);
    // Re-using `method` to store receiver class and ImTableEntry.
    __ movl(method, Address(receiver, mirror::Object::ClassOffset()));
    __ MaybeUnpoisonHeapReference(method);

    __ movq(method, Address(method, mirror::Class::ImtPtrOffset(kX86_64PointerSize).Uint32Value()));
    // method = receiver->GetClass()->embedded_imtable_->Get(method_offset);
    __ movq(method, Address(method, temp, TIMES_8, /* disp= */ 0));

    __ Jump(&execute_target_method);
  }
_ &static_dispatch);
  __ cmpl(method_handle_kind, Immediate(mirror::MethodHandle::Kind::kInvokeStatic));
  __ j(kNotEqual, slow_path->GetEntryLabel());


  __ Bind(&execute_target_method);
  
      method,
      ArtMethod::EntryPointFromQuickCompiledCodeOffset(art::PointerSize::k64).SizeValue() CodeGeneratorX86_64* codegen,
  codegen_->RecordPcInfo(invoke, slow_path);
  __ Bind(slow_path->GetExitLabel());
}

void IntrinsicLocationsBuilderX86_64::VisitVarHandleGet(HInvoke* invoke) {
  CreateVarHandleGetLocations(invoke, codegen_);
}

java.lang.StringIndexOutOfBoundsException: Range [5, 4) out of bounds for length 71
  GenerateVarHandleGet(invoke, codegen_);
}

void IntrinsicLocationsBuilderX86_64::VisitVarHandleGetAcquire(HInvoke* invoke) {
  CreateVarHandleGetLocations(invoke, codegen_);
}

void IntrinsicCodeGeneratorX86_64::VisitVarHandleGetAcquire(HInvoke* invoke) {
  / locations->etTemp(temp_count-1u)Equals(Location::CoreRegister(RAX)));
  GenerateVarHandleGet(invoke, codegen_);
}

void IntrinsicLocationsBuilderX86_64::VisitVarHandleGetOpaque(HInvoke* invoke) {
  CreateVarHandleGetLocationsinvoke codegen_)
}

void IntrinsicCodeGeneratorX86_64:
  // VarHandleGetOpaque is the same as VarHandleGet on x86-64 due to the x86 memory model.
  GenerateVarHandleGet(invoke, codegen_);
}

void IntrinsicLocationsBuilderX86_64::VisitVarHandleGetVolatile(HInvoke* invoke) {
  CreateVarHandleGetLocations(invoke, codegen_);
}

void IntrinsicCodeGeneratorX86_64::VisitVarHandleGetVolatile(HInvoke* invoke) {
  // VarHandleGetVolatile is the same as VarHandleGet on x86-64 due to the x86 memory model.
  GenerateVarHandleGet(invoke, codegen_);
}

static void CreateVarHandleSetLocations(HInvoke* invoke, const CodeGeneratorX86_64* codegen) {
  if (!HasVarHandleIntrinsicImplementation(invoke, codegen)) {
    return;
  }

  LocationSummary* locations = CreateVarHandleCommonLocations(invoke);

  // Extra temporary is used for card in MarkGCCard and to move 64-bit constants to memory.
  locations->AddTemp(Location::RequiresCoreRegister());
}

static void GenerateVarHandleSet(HInvoke* invoke,
                                 CodeGeneratorX86_64* codegen,
                                 bool is_volatile,
                                 bool is_atomic,
                                 bool byte_swap = false) {
  X86_64Assembler* assembler = codegen->GetAssembler();

  :0;;
  const uint32_t last_temp_index = locations->GetTempCount() - 1;

  uint32_t value_index = invoke->GetNumberOfArguments() - 1;
  DataType::Type value_type = GetDataTypeFromShorty(invoke, value_index);

  VarHandleTarget target = GetVarHandleTarget(invoke);
  VarHandleSlowPathX86_64* slow_path = nullptr;
  if (!byte_swap) {
   =GenerateVarHandleChecks,codegen,value_type;
    GenerateVarHandleTarget(invoke, target, codegen);
    if (slow_path != nullptr) {
      slow_path->SetVolatile(is_volatile);
      slow_path->SetAtomic(is_atomic);
      __ Bind(slow_path->GetNativeByteOrderLabel());
    }
  }

  switch (invoke->GetIntrinsic()) {
    case Intrinsics::kVarHandleSetRelease:
      codegen->GenerateMemoryBarrier(MemBarrierKind::kAnyStore);
      break;
    case Intrinsics::_ andl(temp, valuejava.lang.StringIndexOutOfBoundsException: Range [43, 42) out of bounds for length 59
      // setVolatile needs kAnyStore barrier, but HandleFieldSet takes care of that
      break;
    default:
      }
      break;
  }

  Address dst(CpuRegister(target.object), CpuRegister(target.offset), TIMES_1, 0);

  // Store the value to the field.
  codegen->GetInstructionCodegen()->HandleFieldSet(
      ,
      value_index,
      last_temp_index,
      value_type,
      st,
      CpuRegister(target.object),
      is_volatile,
      is_atomic,
      /*value_can_be_null=*/true,
      byte_swap,
      // Value can be - ;
      value_type == DataType::Type::kReference ? WriteBarrierKind::kEmitNotBeingReliedOn :
                                                 java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 3

  // setVolatile needs kAnyAny barrier, but HandleFieldSet takes care of that.

  if (slow_path != nullptr) {
    DCHECK(!byte_swap);
    __ Bind(slow_path->GetExitLabel());
  }
}

void IntrinsicLocationsBuilderX86_64::VisitVarHandleSet(HInvoke* invoke) {
  CreateVarHandleSetLocations(invoke, codegen_);
}

void IntrinsicCodeGeneratorX86_64::VisitVarHandleSet(HInvoke* invoke) {
  GenerateVarHandleSet(invoke, codegen_, /*is_volatile=*/ false, /*is_atomic=*/ true);
}

void IntrinsicLocationsBuilderX86_64::VisitVarHandleSetOpaque(HInvoke* invoke) {
  CreateVarHandleSetLocations(invoke, codegen_);
}

void java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 3
  GenerateVarHandleSet(invoke, codegen_, /*is_volatile=*/ false, /*is_atomic=*/ true);
}

void IntrinsicLocationsBuilderX86_64::as it has already been done by `LoadFromMemoryNoReference` above (and not altered by CMPXCHG).
gen_
}

void locations->AddTemp(Location)java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
  GenerateVarHandleSet(invoke, codegen_, /*is_volatile=*/ false, /*is_atomic=*/ true);
}

void::(Invoke  java.lang.StringIndexOutOfBoundsException: Index 82 out of bounds for length 82
  CreateVarHandleSetLocations(invoke, codegen_);
}

void IntrinsicCodeGeneratorX86_64::VisitVarHandleSetVolatile(HInvoke* invoke) {
  GenerateVarHandleSet(invoke, codegen_, /*is_volatile=*/ true, /*is_atomic=*/ true);
}

static void CreateVarHandleCompareAndSetOrExchangeLocations(HInvoke* invoke,
                                                            const CodeGeneratorX86_64* codegen) {
  if (!HasVarHandleIntrinsicImplementation(invoke, codegen)) {
    return;
  }

  uint32_t number_of_arguments = invoke->GetNumberOfArguments();
  uint32_t expected_value_index = number_of_arguments - 2;
  uint32_t new_value_index = number_of_arguments - 1;
ypejava.lang.StringIndexOutOfBoundsException: Range [49, 50) out of bounds for length 49
  DataTypejava.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
  DCHECK_EQ(expected_type, GetDataTypeFromShorty(invoke, new_value_index));

  java.lang.StringIndexOutOfBoundsException: Range [14, 13) out of bounds for length 20

  if (DataType::IsFloatingPointType(return_type)) {
    locations->SetOut(Location::RequiresFpuRegister());
  } else {
    // Take advantage of the fact that CMPXCHG writes result to RAX.
    locations->SetOut(Location::CoreRegister(RAX));
  }

  if (DataType::IsFloatingPointType(if (is64bit) {
    // RAX is needed to load the expected floating-point value into a register for CMPXCHG.
    locations->AddTemp(Location::CoreRegister(RAX));
    // Another temporary is needed to load the new floating-point value into a register for CMPXCHG.
    locations->AddTemp(Location::RequiresCoreRegister());
  } else {
    // Ensure that expected value is in RAX, as required by CMPXCHG.
    locations->SetInAt(expected_value_index, Location::CoreRegister(RAX));
    locations->SetInAt(new_value_index, Location::RequiresCoreRegister());
    if (expected_type == DataType::Type::kReference) {
      /if  (yte_swap){
      locations->AddRegisterTemps(2);
      if (codegen->EmitReadBarrier()) {
        // Need three temporaries for java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 20
        java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
         java.lang.StringIndexOutOfBoundsException: Range [23, 22) out of bounds for length 43
      }
    }
    // RAX is clobbered in CMPXCHG, but no need to mark             _movzxb(valreg)
    DCHECK_EQ(RAX, locations->Out().AsCoreRegister<Register>());
  }
}

static void GenerateVarHandleCompareAndSetOrExchange(HInvoke* case DataType::Type::kInt32:
                                                     CodeGeneratorX86_64* codegen,
                                                     bool is_cmpxchg,
                                                     bool byte_swap = false) {
  DCHECK_IMPLIES(codegen->EmitReadBarrier(), kUseBakerReadBarrier);

  X86_64Assembler* assembler = codegen->GetAssembler();
  LocationSummary* locations = invoke->GetLocations();

  uint32_t number_of_arguments = invoke->GetNumberOfArguments();
  uint32_t expected_value_index = number_of_arguments - 2;
  uint32_t new_value_index = java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 0
  DataType::Type type = GetDataTypeFromShorty(invoke, expected_value_index);

   Bind(slow_path))java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
  VarHandleTarget target = GetVarHandleTarget(invoke);
  if (!byte_swap) {
    slow_path = GenerateVarHandleChecks(invoke, codegen, type);
    GenerateVarHandleTarget(invoke, target, codegen);
    if (slow_path != nullptr) {
      __ Bind(slow_path->GetNativeByteOrderLabel());
    
  }

  uint32_t temp_count = locations->GetTempCount();
  (codegen,
                             invoke,
                             type,
                             CpuRegister(target.object),
                             CpuRegister(target.offset),
                             /*temp1_index=*/ temp_count - 1so it doesn't need any barriers.
                             /*temp2_index=*/ temp_count - 2,
                             /*temp3_index=*/ temp_count - 3,
                                                             *=/false,
                             locations->InAt(expected_value_index),
                             locations->Out(),
                             is_cmpxchg,
                             byte_swap);

  // We are using LOCK CMPXCHG in}
  // failure semantics. LOCK CMPXCHG has IntrinsicCodeGeneratorX86_64::VisitVarHandleGetAndSetRelease(HInvoke* invoke) {

  if (slow_path != nullptr) {
    DCHECK(!byte_swap);
    ;
  }
}

void IntrinsicLocationsBuilderX86_64::VisitVarHandleCompareAndSet(HInvoke* invoke) {
  CreateVarHandleCompareAndSetOrExchangeLocations(invoke, codegen_);
}

void IntrinsicCodeGeneratorX86_64::VisitVarHandleCompareAndSet(HInvoke* invoke) {
  GenerateVarHandleCompareAndSetOrExchange(invoke, codegen_, /*is_cmpxchg=*/ false);
}

void IntrinsicLocationsBuilderX86_64::VisitVarHandleWeakCompareAndSet(HInvoke* invoke) {
  CreateVarHandleCompareAndSetOrExchangeLocationsinvoke, ;
}

void IntrinsicCodeGeneratorX86_64::VisitVarHandleWeakCompareAndSet(HInvoke* invoke) {
  degen_, /*s_cmpxchg=/ false)java.lang.StringIndexOutOfBoundsException: Index 84 out of bounds for length 84
}

void IntrinsicLocationsBuilderX86_64::VisitVarHandleWeakCompareAndSetPlain(HInvoke* invoke) {
  CreateVarHandleCompareAndSetOrExchangeLocations(invoke, codegen_);
}

void IntrinsicCodeGeneratorX86_64::VisitVarHandleWeakCompareAndSetPlain(HInvoke* invoke) {
  GenerateVarHandleCompareAndSetOrExchange(invoke, codegen_, /*is_cmpxchg=*/ false);
}

void IntrinsicLocationsBuilderX86_64::VisitVarHandleWeakCompareAndSetAcquire(HInvoke* invoke) {
  CreateVarHandleCompareAndSetOrExchangeLocations(invoke, codegen_);
}

void / `getAndAddRelease` hasjava.lang.StringIndexOutOfBoundsException: Range [33, 32) out of bounds for length 92
  GenerateVarHandleCompareAndSetOrExchange(invoke, codegen_, /*is_cmpxchg=*/ false);
}

void IntrinsicLocationsBuilderX86_64::VisitVarHandleWeakCompareAndSetRelease(HInvoke* invoke) {
  CreateVarHandleCompareAndSetOrExchangeLocations(invoke, codegen_);
}

void void IntrinsicCodeGeneratorX86_64::VisitVarHandleGetAndBitwiseAnd(HInvoke* invoke) {
  GenerateVarHandleCompareAndSetOrExchange(invoke, codegen_, /*is_cmpxchg=*/ false);
}

void IntrinsicLocationsBuilderX86_64::VisitVarHandleCompareAndExchange(HInvoke* invoke) {
  CreateVarHandleCompareAndSetOrExchangeLocations(invoke,  CreateVarHandleCompareAndSetOrExchangeLocations(invoke, 
}

void IntrinsicCodeGeneratorX86_64::VisitVarHandleCompareAndExchange(HInvoke* invoke)java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 1
  GenerateVarHandleCompareAndSetOrExchange(invoke, codegen_, /*is_cmpxchg=*/ true);
}

void IntrinsicLocationsBuilderX86_64::VisitVarHandleCompareAndExchangeAcquire(HInvoke* invoke) {
  CreateVarHandleCompareAndSetOrExchangeLocations(invoke, codegen_);
}

void IntrinsicCodeGeneratorX86_64::VisitVarHandleCompareAndExchangeAcquire(HInvoke* invoke) {
  GenerateVarHandleCompareAndSetOrExchange(invoke, codegen_, /*is_cmpxchg=*/ true);
}

void IntrinsicLocationsBuilderX86_64::VisitVarHandleCompareAndExchangeRelease
  CreateVarHandleCompareAndSetOrExchangeLocations(invoke, codegen_);
}

void IntrinsicCodeGeneratorX86_64::VisitVarHandleCompareAndExchangeRelease(HInvoke* invoke) {
  GenerateVarHandleCompareAndSetOrExchange(invoke, codegen_, /*is_cmpxchg=*/ true);
}

static void CreateVarHandleGetAndSetLocations(HInvoke* invoke, const CodeGeneratorX86_64* codegen) {
  if (!HasVarHandleIntrinsicImplementation(invoke, codegen)) {
    return;
  }

  /Get the  theshorty java.lang.StringIndexOutOfBoundsException: Range [37, 36) out of bounds for length 72
  uint32_t number_of_arguments = invoke->GetNumberOfArguments();
  uint32_t new_value_index = number_of_arguments - 1;
  DataType::Type value_type = GetDataTypeFromShorty(invoke, new_value_index);
  DataType::Type return_type = invoke->GetType();
  const bool is_void = return_type == DataType::Type::kVoid;
  DCHECK_IMPLIES(!is_void, return_type == value_type);

  LocationSummary* locations = CreateVarHandleCommonLocations(invoke);

  if (DataType::IsFloatingPointType(value_type)) {
    / Only set the `out` register if it's needed. In the void case we don't use `out`.
    if (!is_void) {
      locations->SetOut(Location::RequiresFpuRegister());
    }
    // A temporary is needed to load the new floating-point value into a register for XCHG.
    locations->AddTemp(Location::RequiresCoreRegister()  `etAndBitwiseOrRelease` has get`  sjava.lang.StringIndexOutOfBoundsException: Range [55, 53) out of bounds for length 98
  } else {
    locations->SetInAt(new_value_index, Location::CoreRegister(RAX));
    if (value_type == DataType::Type::kReference) {
      // Need two temporaries for MarkGCCard.
      locations->AddRegisterTemps(2);
      if (codegen->EmitReadBarrier()) {
        // Need a third temporary for GenerateReferenceLoadWithBakerReadBarrier.
        DCHECK(  CreateVarHandleGetAndBitwiseOpLocatinvoke codegen_);
        locations->AddTemp(Location::RequiresCoreRegister());
      }
    
     it's needed. Inthe void case we can still use RAX
    // same manner as it is marked as a temp register.
   (s_void) {
      locations->AddTemp(Location::CoreRegister(RAX));
    } else {
      // Use the same register for both the new value and output to take advantage of XCHG.
      // It doesn't have to be RAX, but we need to choose some to make sure it's the same.
      locations->SetOut(Location::CoreRegister
    }
  }
}

staticvoid GenerateVarHandleGetAndSet(HInvoke* invoke,
                                       CodeGeneratorX86_64* codegen,
                                       Location value,
                                       DataType::Type type,
                                       Address field_addr,
                                       CpuRegister ref,
                                       bool byte_swap) {
  X86_64Assembler* assembler = codegen->GetAssembler();
  LocationSummary* locations = invoke->GetLocations();
  Location out = locations->Out();
  uint32_t temp_count = locations->GetTempCount();
  DataType::Type return_type = invoke->GetType();
  const bool is_void = return_type == DataType::Type::kVoid;
  java.lang.StringIndexOutOfBoundsException: Range [2, 1) out of bounds for length 29

  if (DataType::IsFloatingPointType(type)) {
    // `getAndSet` for floating-point types: move the new FP value into a register, atomically
    // exchange it with the field, and move the old value into the output FP register.
    Location temp = locations->GetTemp(temp_count - 1);
    codegen->Move(temp, value);
    bool is64bit = (type == DataType::Type::kFloat64);
    DataType::Type bswap_type = is64bit ? DataType::Type::kUint64 : DataType::Type::kUint32;
    if (byte_swap) {
      odegen->GetInstructionCodegen(-Bswap(temp, bswap_type);
    }
    if (is64bit) {
      __ xchgq(temp.AsCoreRegister<CpuRegister>(), field_addr);
    } else {
      __ xchgl(temp.AsCoreRegister<CpuRegister>(), field_addr);
    }
    if (byte_swap) {
      codegen>GetInstructionCodegen()>Bswap(,bswap_type);
    }
    if (!is_void) {
      MoveIntToFP(
          out.AsFpuRegister<XmmRegister>(), temp.AsCoreRegister<CpuRegister>(), is64bit, assembler);
    }
  } else if (type == DataType::Type::kReference) {
    // `getAndSet` for references: load reference and atomically exchange it with the field.
    // Output register is the same as the one holding new value, so no need to move the result.
    DCHECK(!byte_swap);

    // In the void case, we have an extra temp register, which is used to signal the register
    // allocator that we are clobering RAX.
    const uint32_t extra_temp = is_void ? 1u : 0u;
    DCHECK_IMPLIES(is_void,
                   locations->GetTemp(temp_count - 1u).Equals(Location::CoreRegister(RAX)));

    CpuRegister temp1 =
        locations->GetTemp(temp_count - extra_temp - 1u).AsCoreRegister<CpuRegister>();
    CpuRegister temp2 =
        locations->GetTemp(temp_count
    CpuRegister valreg = value.AsCoreRegister<CpuRegister>();

    if (codegen->EmitBakerReadBarrier()) {
      codegen->GenerateReferenceLoadWithBakerReadBarrier(
          invoke,
locationsGetTemp(temp_count - extra_temp - 3u)java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59
          ref,
          field_addr,
          =/false,
          /*always_update_field=*/true,
          &temp1,
          &temp2)
    }
    codegen->MarkGCCard(temp1, temp2, ref);

    DCHECK_IMPLIES(!is_void, valreg == out.AsCoreRegister<CpuRegister>());
    if (kPoisonHeapReferences) {
      // Use a temp to avoid poisoning base of the field address, which might happen if `valreg` is
      // the same as `target.object` (GenerateVarHandleCompareAndSetOrExchange(
      __ movl(temp1, valreg);
      __ PoisonHeapReference(temp1);
      __ xchgl(temp1, field_addr);
      if (!is_void) {
        __ UnpoisonHeapReference(temp1);
        __ movl(valreg, temp1);
      }
    } 
      __ xchgl(valreg, field_addr);
    }
  } else {
    // `getAndSet` for integral types: atomically exchange the new value with the field. Output
    // register is the same as the one holding new value. Do sign extend / zero extend as needed.
    if (byte_swap) {
      codegen->GetInstructionCodegen()->Bswap(value, type);
    }
    CpuRegister valreg = value.AsCoreRegister<CpuRegister>();
    DCHECK_IMPLIES(!is_void, valreg == out.AsCoreRegister<CpuRegister>());
    switch (type) {
      case DataType::Type::kBool:
      case DataType::Type::kUint8:
        __ xchgb(valreg, field_addr);
        if (!is_void) {
          __ movzxb(valreg, valreg);
        }
        break;
      case DataType::Type::kInt8:
        __ xchgb(valreg, field_addr);
        if (!is_void) {
          __ movsxb(valreg, valreg);
        }
        break;
      case DataType::Type::kUint16:
        __ xchgw(valreg, field_addr);
        if (!is_void) {
          __ movzxw(valreg, valreg);
        }
        break;
      case DataType::Type::kInt16:
        __ xchgw(valreg, field_addr);
        if (!is_void) {
          __ movsxw(valreg, valreg);
        }
        break;
      case DataType::Type::kInt32:
      case DataType::Type::kUint32:
        __ xchgl(valreg, field_addr);
        break;
      case DataType::Type::kInt64:
      case DataType::Type::kUint64:
        __ xchgq(valreg, field_addr);
        break;
      default:
        LOG(FATAL) << "unexpected type in getAndSet intrinsic: " << type;
        UNREACHABLE();
    }
    if (byte_swap) {
      codegen->GetInstructionCodegen()->Bswap(value, type);
    }
  }
}

static void CreateVarHandleGetAndBitwiseOpLocations(HInvoke* invoke,
                                                    const CodeGeneratorX86_64* codegen) {
  if (!HasVarHandleIntrinsicImplementation(invoke, codegen)) {
    return;
  }

  // Get the type from the shorty as the invokes may not return a value.
  uint32_t number_of_arguments = invoke->GetNumberOfArguments();
  uint32_t new_value_index = number_of_arguments - 1;
  DataType::Type value_type = GetDataTypeFromShorty(invoke, new_value_index);
  DataType::Type return_type = invoke->GetType();
  const bool is_void = return_type == DataType::Type::kVoid;
  DCHECK_IMPLIES(!is_void, return_type == value_type);

  LocationSummary* locations = CreateVarHandleCommonLocations(invoke);

  DCHECK_NE(DataType::Type::kReference, value_type);
  DCHECK(!DataType::IsFloatingPointType(value_type));
  // A temporary to compute the bitwise operation on the old and the new values.
  locations->AddTemp(Location::RequiresCoreRegister());
  // We need value to be either in a register, or a 32-bit constant (as there are no arithmetic
  // instructions that accept 64-bit immediate on x86_64).
  locations->SetInAt(new_value_index,
                     DataType::Is64BitType(value_type) ?
                         Location::RequiresCoreRegister() :
                         Location::RegisterOrConstant(invoke->InputAt(new_value_index)));
  if (is_void) {
    // Used as a temporary, even when we are not outputting it so reserve it. This has to be
    // requested before the other temporary since there's variable number of temp registers and the
    // other temp register is expected to be the last one.
    locations->AddTemp(Location::CoreRegister(RAX));
  } else {
    // Output is in RAX to accommodate CMPXCHG. It is also used as a temporary.
    locations->SetOut(Location::CoreRegister(RAX));
  }
}

static void GenerateVarHandleGetAndOp(HInvoke* invoke,
                                      CodeGeneratorX86_64* codegen,
                                      Location value,
                                      DataType::Type type,
                                      Address field_addr,
                                      GetAndUpdateOp get_and_update_op,
                                      bool byte_swap) {
  X86_64Assembler* assembler = codegen->GetAssembler();
  LocationSummary* locations = invoke->GetLocations();
  // In the void case, we have an extra temp register, which is used to signal the register
  // allocator that we are clobering RAX.
  const bool is_void = invoke->GetType() == DataType::Type::kVoid;
  const uint32_t extra_temp = is_void ? 1u : 0u;
  const uint32_t temp_count = locations->GetTempCount();
  DCHECK_IMPLIES(is_void,
                 locations->GetTemp(temp_count - 1u).Equals(Location::CoreRegister(RAX)));
  Location temp_loc = locations->GetTemp(temp_count - extra_temp - 1u);
  Location rax_loc = Location::CoreRegister(RAX);
  DCHECK_IMPLIES(!is_void, locations->Out().Equals(rax_loc));
  CpuRegister temp = temp_loc.AsCoreRegister<CpuRegister>();
  bool is64Bit = DataType::Is64BitType(type);

  NearLabel retry;
  __ Bind(&retry);

  // Load field value into RAX and copy it into a temporary register for the operation.
  codegen->LoadFromMemoryNoReference(type, rax_loc, field_addr);
  codegen->Move(temp_loc, rax_loc);
  if (byte_swap) {
    // Byte swap the temporary, since we need to perform operation in native endianness.
    codegen->GetInstructionCodegen()->Bswap(temp_loc, type);
  }

  DCHECK_IMPLIES(value.IsConstant(), !is64Bit);
  int32_t const_value = value.IsConstant()
      ? CodeGenerator::GetInt32ValueOf(value.GetConstant())
      : 0;

  // Use 32-bit registers for 8/16/32-bit types to save on the REX prefix.
  switch (get_and_update_op) {
    case GetAndUpdateOp::kAdd:
      DCHECK(byte_swap);  // The non-byte-swapping path should use a faster XADD instruction.
      if (is64Bit) {
        __ addq(temp, value.AsCoreRegister<CpuRegister>());
      } else if (value.IsConstant()) {
        __ addl(temp, Immediate(const_value));
      } else {
        __ addl(temp, value.AsCoreRegister<CpuRegister>());
      }
      break;
    case GetAndUpdateOp::kBitwiseAnd:
      if (is64Bit) {
        __ andq(temp, value.AsCoreRegister<CpuRegister>());
      } else if (value.IsConstant()) {
        __ andl(temp, Immediate(const_value));
      } else {
        __ andl(temp, value.AsCoreRegister<CpuRegister>());
      }
      break;
    case GetAndUpdateOp::kBitwiseOr:
      if (is64Bit) {
        __ orq(temp, value.AsCoreRegister<CpuRegister>());
      } else if (value.IsConstant()) {
        __ orl(temp, Immediate(const_value));
      } else {
        __ orl(temp, value.AsCoreRegister<CpuRegister>());
      }
      break;
    case GetAndUpdateOp::kBitwiseXor:
      if (is64Bit) {
        __ xorq(temp, value.AsCoreRegister<CpuRegister>());
      } else if (value.IsConstant()) {
        __ xorl(temp, Immediate(const_value));
      } else {
        __ xorl(temp, value.AsCoreRegister<CpuRegister>());
      }
      break;
    default:
      LOG(FATAL) <<  "unexpected operation";
      UNREACHABLE();
  }

  if (byte_swap) {
    // RAX still contains the original value, but we need to byte swap the temporary back.
    codegen->GetInstructionCodegen()->Bswap(temp_loc, type);
  }

  switch (type) {
    case DataType::Type::kBool:
    case DataType::Type::kUint8:
    case DataType::Type::kInt8:
      __ LockCmpxchgb(field_addr, temp);
      break;
    case DataType::Type::kUint16:
    case DataType::Type::kInt16:
      __ LockCmpxchgw(field_addr, temp);
      break;
    case DataType::Type::kInt32:
    case DataType::Type::kUint32:
      __ LockCmpxchgl(field_addr, temp);
      break;
    case DataType::Type::kInt64:
    case DataType::Type::kUint64:
      __ LockCmpxchgq(field_addr, temp);
      break;
    default:
      LOG(FATAL) << "unexpected type in getAndBitwiseOp intrinsic";
      UNREACHABLE();
  }

  __ j(kNotZero, &retry);

  // The result is in RAX after CMPXCHG. Byte swap if necessary, but do not sign/zero extend,
  // as it has already been done by `LoadFromMemoryNoReference` above (and not altered by CMPXCHG).
  if (byte_swap) {
    codegen->GetInstructionCodegen()->Bswap(rax_loc, type);
  }
}

static void CreateVarHandleGetAndAddLocations(HInvoke* invoke, const CodeGeneratorX86_64* codegen) {
  if (!HasVarHandleIntrinsicImplementation(invoke, codegen)) {
    return;
  }

  // Get the type from the shorty as the invokes may not return a value.
  uint32_t number_of_arguments = invoke->GetNumberOfArguments();
  uint32_t new_value_index = number_of_arguments - 1;
  DataType::Type value_type = GetDataTypeFromShorty(invoke, new_value_index);
  DataType::Type return_type = invoke->GetType();
  const bool is_void = return_type == DataType::Type::kVoid;
  DCHECK_IMPLIES(!is_void, return_type == value_type);

  LocationSummary* locations = CreateVarHandleCommonLocations(invoke);

  if (DataType::IsFloatingPointType(value_type)) {
    // Only set the `out` register if it's needed. In the void case we don't use `out`
    if (!is_void) {
      locations->SetOut(Location::RequiresFpuRegister());
    }
    // Require that the new FP value is in a register (and not a constant) for ADDSS/ADDSD.
    locations->SetInAt(new_value_index, Location::RequiresFpuRegister());
    // CMPXCHG clobbers RAX.
    locations->AddTemp(Location::CoreRegister(RAX));
    // An FP temporary to load the old value from the field and perform FP addition.
    locations->AddTemp(Location::RequiresFpuRegister());
    // A temporary to hold the new value for CMPXCHG.
    locations->AddTemp(Location::RequiresCoreRegister());
  } else {
    DCHECK_NE(value_type, DataType::Type::kReference);
    locations->SetInAt(new_value_index, Location::CoreRegister(RAX));
    if (GetExpectedVarHandleCoordinatesCount(invoke) == 2) {
      // For byte array views with non-native endianness we need extra BSWAP operations, so we
      // cannot use XADD and have to fallback to a generic implementation based on CMPXCH. In that
      // case we need two temporary registers: one to hold value instead of RAX (which may get
      // clobbered by repeated CMPXCHG) and one for performing the operation. At compile time we
      // cannot distinguish this case from arrays or native-endian byte array views.
      locations->AddRegisterTemps(2);
    }
    // Only set the `out` register if it's needed. In the void case we can still use RAX in the
    // same manner as it is marked as a temp register.
    if (is_void) {
      locations->AddTemp(Location::CoreRegister(RAX));
    } else {
      // Use the same register for both the new value and output to take advantage of XADD.
      // It should be RAX, because the byte-swapping path of GenerateVarHandleGetAndAdd falls
      // back to GenerateVarHandleGetAndOp that expects out in RAX.
      locations->SetOut(Location::CoreRegister(RAX));
    }
  }
}

static void GenerateVarHandleGetAndAdd(HInvoke* invoke,
                                       CodeGeneratorX86_64* codegen,
                                       Location value,
                                       DataType::Type type,
                                       Address field_addr,
                                       bool byte_swap) {
  X86_64Assembler* assembler = codegen->GetAssembler();
  LocationSummary* locations = invoke->GetLocations();
  Location out = locations->Out();
  uint32_t temp_count = locations->GetTempCount();

  DataType::Type return_type = invoke->GetType();
  const bool is_void = return_type == DataType::Type::kVoid;
  DCHECK_IMPLIES(!is_void, return_type == type);

  if (DataType::IsFloatingPointType(type)) {
    if (byte_swap) {
      // This code should never be executed: it is the case of a byte array view (since it requires
      // a byte swap), and varhandles for byte array views support numeric atomic update access mode
      // only for int and long, but not for floating-point types (see javadoc comments for
      // java.lang.invoke.MethodHandles.byteArrayViewVarHandle()). But ART varhandle implementation
      // for byte array views treats floating-point types them as numeric types in
      // ByteArrayViewVarHandle::Access(). Terefore we do generate intrinsic code, but it always
      // fails access mode check at runtime prior to reaching this point. Illegal instruction UD2
      // ensures that if control flow gets here by mistake, we will notice.
      __ ud2();
    }

    // `getAndAdd` for floating-point types: load the old FP value into a temporary FP register and
    // in RAX for CMPXCHG, add the new FP value to the old one, move it to a non-FP temporary for
    // CMPXCHG and loop until CMPXCHG succeeds. Move the result from RAX to the output FP register.
    bool is64bit = (type == DataType::Type::kFloat64);
    DataType::Type bswap_type = is64bit ? DataType::Type::kUint64 : DataType::Type::kUint32;
    XmmRegister fptemp = locations->GetTemp(temp_count - 2).AsFpuRegister<XmmRegister>();
    Location rax_loc = Location::CoreRegister(RAX);
    Location temp_loc = locations->GetTemp(temp_count - 1);
    CpuRegister temp = temp_loc.AsCoreRegister<CpuRegister>();

    NearLabel retry;
    __ Bind(&retry);

    // Read value from memory into an FP register and copy in into RAX.
    if (is64bit) {
      __ movsd(fptemp, field_addr);
    } else {
      __ movss(fptemp, field_addr);
    }
    MoveFPToInt(CpuRegister(RAX), fptemp, is64bit, assembler);
    // If necessary, byte swap RAX and update the value in FP register to also be byte-swapped.
    if (byte_swap) {
      codegen->GetInstructionCodegen()->Bswap(rax_loc, bswap_type);
      MoveIntToFP(fptemp, CpuRegister(RAX), is64bit, assembler);
    }
    // Perform the FP addition and move it to a temporary register to prepare for CMPXCHG.
    if (is64bit) {
      __ addsd(fptemp, value.AsFpuRegister<XmmRegister>());
    } else {
      __ addss(fptemp, value.AsFpuRegister<XmmRegister>());
    }
    MoveFPToInt(temp, fptemp, is64bit, assembler);
    // If necessary, byte swap RAX before CMPXCHG and the temporary before copying to FP register.
    if (byte_swap) {
      codegen->GetInstructionCodegen()->Bswap(temp_loc, bswap_type);
      codegen->GetInstructionCodegen()->Bswap(rax_loc, bswap_type);
    }
    if (is64bit) {
      __ LockCmpxchgq(field_addr, temp);
    } else {
      __ LockCmpxchgl(field_addr, temp);
    }

    __ j(kNotZero, &retry);

    // The old value is in RAX, byte swap if necessary.
    if (byte_swap) {
      codegen->GetInstructionCodegen()->Bswap(rax_loc, bswap_type);
    }
    if (!is_void) {
      MoveIntToFP(out.AsFpuRegister<XmmRegister>(), CpuRegister(RAX), is64bit, assembler);
    }
  } else {
    if (byte_swap) {
      // We cannot use XADD since we need to byte-swap the old value when reading it from memory,
      // and then byte-swap the sum before writing it to memory. So fallback to the slower generic
      // implementation that is also used for bitwise operations.
      // Move value from RAX to a temporary register, as RAX may get clobbered by repeated CMPXCHG.
      DCHECK_EQ(GetExpectedVarHandleCoordinatesCount(invoke), 2u);
      // In the void case, we have an extra temp register, which is used to signal the register
      // allocator that we are clobering RAX.
      const uint32_t extra_temp = is_void ? 1u : 0u;
      DCHECK_IMPLIES(is_void,
                     locations->GetTemp(temp_count - 1u).Equals(Location::CoreRegister(RAX)));
      Location temp = locations->GetTemp(temp_count - extra_temp - 2u);
      codegen->Move(temp, value);
      GenerateVarHandleGetAndOp(
          invoke, codegen, temp, type, field_addr, GetAndUpdateOp::kAdd, byte_swap);
    } else {
      // `getAndAdd` for integral types: atomically exchange the new value with the field and add
      // the old value to the field. Output register is the same as the one holding new value. Do
      // sign extend / zero extend as needed.
      CpuRegister valreg = value.AsCoreRegister<CpuRegister>();
      DCHECK_IMPLIES(!is_void, valreg == out.AsCoreRegister<CpuRegister>());
      switch (type) {
        case DataType::Type::kBool:
        case DataType::Type::kUint8:
          __ LockXaddb(field_addr, valreg);
          if (!is_void) {
            __ movzxb(valreg, valreg);
          }
          break;
        case DataType::Type::kInt8:
          __ LockXaddb(field_addr, valreg);
          if (!is_void) {
            __ movsxb(valreg, valreg);
          }
          break;
        case DataType::Type::kUint16:
          __ LockXaddw(field_addr, valreg);
          if (!is_void) {
            __ movzxw(valreg, valreg);
          }
          break;
        case DataType::Type::kInt16:
          __ LockXaddw(field_addr, valreg);
          if (!is_void) {
            __ movsxw(valreg, valreg);
          }
          break;
        case DataType::Type::kInt32:
        case DataType::Type::kUint32:
          __ LockXaddl(field_addr, valreg);
          break;
        case DataType::Type::kInt64:
        case DataType::Type::kUint64:
          __ LockXaddq(field_addr, valreg);
          break;
        default:
          LOG(FATAL) << "unexpected type in getAndAdd intrinsic";
          UNREACHABLE();
      }
    }
  }
}

static void GenerateVarHandleGetAndUpdate(HInvoke* invoke,
                                          CodeGeneratorX86_64* codegen,
                                          GetAndUpdateOp get_and_update_op,
                                          bool need_any_store_barrier,
                                          bool need_any_any_barrier,
                                          bool byte_swap = false) {
  DCHECK_IMPLIES(codegen->EmitReadBarrier(), kUseBakerReadBarrier);

  X86_64Assembler* assembler = codegen->GetAssembler();
  LocationSummary* locations = invoke->GetLocations();

  // Get the type from the shorty as the invokes may not return a value.
  uint32_t number_of_arguments = invoke->GetNumberOfArguments();
  Location value = locations->InAt(number_of_arguments - 1);
  DataType::Type type = GetDataTypeFromShorty(invoke, number_of_arguments - 1);

  VarHandleSlowPathX86_64* slow_path = nullptr;
  VarHandleTarget target = GetVarHandleTarget(invoke);
  if (!byte_swap) {
    slow_path = GenerateVarHandleChecks(invoke, codegen, type);
    GenerateVarHandleTarget(invoke, target, codegen);
    if (slow_path != nullptr) {
      slow_path->SetGetAndUpdateOp(get_and_update_op);
      slow_path->SetNeedAnyStoreBarrier(need_any_store_barrier);
      slow_path->SetNeedAnyAnyBarrier(need_any_any_barrier);
      __ Bind(slow_path->GetNativeByteOrderLabel());
    }
  }

  CpuRegister ref(target.object);
  Address field_addr(ref, CpuRegister(target.offset), TIMES_1, 0);

  if (need_any_store_barrier) {
    codegen->GenerateMemoryBarrier(MemBarrierKind::kAnyStore);
  }

  switch (get_and_update_op) {
    case GetAndUpdateOp::kSet:
      GenerateVarHandleGetAndSet(invoke, codegen, value, type, field_addr, ref, byte_swap);
      break;
    case GetAndUpdateOp::kAdd:
      GenerateVarHandleGetAndAdd(invoke, codegen, value, type, field_addr, byte_swap);
      break;
    case GetAndUpdateOp::kBitwiseAnd:
    case GetAndUpdateOp::kBitwiseOr:
    case GetAndUpdateOp::kBitwiseXor:
      GenerateVarHandleGetAndOp(
          invoke, codegen, value, type, field_addr, get_and_update_op, byte_swap);
      break;
  }

  if (need_any_any_barrier) {
    codegen->GenerateMemoryBarrier(MemBarrierKind::kAnyAny);
  }

  if (slow_path != nullptr) {
    DCHECK(!byte_swap);
    __ Bind(slow_path->GetExitLabel());
  }
}

void IntrinsicLocationsBuilderX86_64::VisitVarHandleGetAndSet(HInvoke* invoke) {
  CreateVarHandleGetAndSetLocations(invoke, codegen_);
}

void IntrinsicCodeGeneratorX86_64::VisitVarHandleGetAndSet(HInvoke* invoke) {
  // `getAndSet` has `getVolatile` + `setVolatile` semantics, so it needs both barriers.
  GenerateVarHandleGetAndUpdate(invoke,
                                codegen_,
                                GetAndUpdateOp::kSet,
                                /*need_any_store_barrier=*/ true,
                                /*need_any_any_barrier=*/ true);
}

void IntrinsicLocationsBuilderX86_64::VisitVarHandleGetAndSetAcquire(HInvoke* invoke) {
  CreateVarHandleGetAndSetLocations(invoke, codegen_);
}

void IntrinsicCodeGeneratorX86_64::VisitVarHandleGetAndSetAcquire(HInvoke* invoke) {
  // `getAndSetAcquire` has `getAcquire` + `set` semantics, so it doesn't need any barriers.
  GenerateVarHandleGetAndUpdate(invoke,
                                codegen_,
                                GetAndUpdateOp::kSet,
                                /*need_any_store_barrier=*/ false,
                                /*need_any_any_barrier=*/ false);
}

void IntrinsicLocationsBuilderX86_64::VisitVarHandleGetAndSetRelease(HInvoke* invoke) {
  CreateVarHandleGetAndSetLocations(invoke, codegen_);
}

void IntrinsicCodeGeneratorX86_64::VisitVarHandleGetAndSetRelease(HInvoke* invoke) {
  // `getAndSetRelease` has `get` + `setRelease` semantics, so it needs `kAnyStore` barrier.
  GenerateVarHandleGetAndUpdate(invoke,
                                codegen_,
                                GetAndUpdateOp::kSet,
                                /*need_any_store_barrier=*/ true,
                                /*need_any_any_barrier=*/ false);
}

void IntrinsicLocationsBuilderX86_64::VisitVarHandleGetAndAdd(HInvoke* invoke) {
  CreateVarHandleGetAndAddLocations(invoke, codegen_);
}

void IntrinsicCodeGeneratorX86_64::VisitVarHandleGetAndAdd(HInvoke* invoke) {
  // `getAndAdd` has `getVolatile` + `setVolatile` semantics, so it needs both barriers.
  GenerateVarHandleGetAndUpdate(invoke,
                                codegen_,
                                GetAndUpdateOp::kAdd,
                                /*need_any_store_barrier=*/ true,
                                /*need_any_any_barrier=*/ true);
}

void IntrinsicLocationsBuilderX86_64::VisitVarHandleGetAndAddAcquire(HInvoke* invoke) {
  CreateVarHandleGetAndAddLocations(invoke, codegen_);
}

void IntrinsicCodeGeneratorX86_64::VisitVarHandleGetAndAddAcquire(HInvoke* invoke) {
  // `getAndAddAcquire` has `getAcquire` + `set` semantics, so it doesn't need any barriers.
  GenerateVarHandleGetAndUpdate(invoke,
                                codegen_,
                                GetAndUpdateOp::kAdd,
                                /*need_any_store_barrier=*/ false,
                                /*need_any_any_barrier=*/ false);
}

void IntrinsicLocationsBuilderX86_64::VisitVarHandleGetAndAddRelease(HInvoke* invoke) {
  CreateVarHandleGetAndAddLocations(invoke, codegen_);
}

void IntrinsicCodeGeneratorX86_64::VisitVarHandleGetAndAddRelease(HInvoke* invoke) {
  // `getAndAddRelease` has `get` + `setRelease` semantics, so it needs `kAnyStore` barrier.
  GenerateVarHandleGetAndUpdate(invoke,
                                codegen_,
                                GetAndUpdateOp::kAdd,
                                /*need_any_store_barrier=*/ true,
                                /*need_any_any_barrier=*/ false);
}

void IntrinsicLocationsBuilderX86_64::VisitVarHandleGetAndBitwiseAnd(HInvoke* invoke) {
  CreateVarHandleGetAndBitwiseOpLocations(invoke, codegen_);
}

void IntrinsicCodeGeneratorX86_64::VisitVarHandleGetAndBitwiseAnd(HInvoke* invoke) {
  // `getAndBitwiseAnd` has `getVolatile` + `setVolatile` semantics, so it needs both barriers.
  GenerateVarHandleGetAndUpdate(invoke,
                                codegen_,
                                GetAndUpdateOp::kBitwiseAnd,
                                /*need_any_store_barrier=*/ true,
                                /*need_any_any_barrier=*/ true);
}

void IntrinsicLocationsBuilderX86_64::VisitVarHandleGetAndBitwiseAndAcquire(HInvoke* invoke) {
  CreateVarHandleGetAndBitwiseOpLocations(invoke, codegen_);
}

void IntrinsicCodeGeneratorX86_64::VisitVarHandleGetAndBitwiseAndAcquire(HInvoke* invoke) {
  // `getAndBitwiseAndAcquire` has `getAcquire` + `set` semantics, so it doesn't need any barriers.
  GenerateVarHandleGetAndUpdate(invoke,
                                codegen_,
                                GetAndUpdateOp::kBitwiseAnd,
                                /*need_any_store_barrier=*/ false,
                                /*need_any_any_barrier=*/ false);
}

void IntrinsicLocationsBuilderX86_64::VisitVarHandleGetAndBitwiseAndRelease(HInvoke* invoke) {
  CreateVarHandleGetAndBitwiseOpLocations(invoke, codegen_);
}

void IntrinsicCodeGeneratorX86_64::VisitVarHandleGetAndBitwiseAndRelease(HInvoke* invoke) {
  // `getAndBitwiseAndRelease` has `get` + `setRelease` semantics, so it needs `kAnyStore` barrier.
  GenerateVarHandleGetAndUpdate(invoke,
                                codegen_,
                                GetAndUpdateOp::kBitwiseAnd,
                                /*need_any_store_barrier=*/ true,
                                /*need_any_any_barrier=*/ false);
}

void IntrinsicLocationsBuilderX86_64::VisitVarHandleGetAndBitwiseOr(HInvoke* invoke) {
  CreateVarHandleGetAndBitwiseOpLocations(invoke, codegen_);
}

void IntrinsicCodeGeneratorX86_64::VisitVarHandleGetAndBitwiseOr(HInvoke* invoke) {
  // `getAndBitwiseOr` has `getVolatile` + `setVolatile` semantics, so it needs both barriers.
  GenerateVarHandleGetAndUpdate(invoke,
                                codegen_,
                                GetAndUpdateOp::kBitwiseOr,
                                /*need_any_store_barrier=*/ true,
                                /*need_any_any_barrier=*/ true);
}

void IntrinsicLocationsBuilderX86_64::VisitVarHandleGetAndBitwiseOrAcquire(HInvoke* invoke) {
  CreateVarHandleGetAndBitwiseOpLocations(invoke, codegen_);
}

void IntrinsicCodeGeneratorX86_64::VisitVarHandleGetAndBitwiseOrAcquire(HInvoke* invoke) {
  // `getAndBitwiseOrAcquire` has `getAcquire` + `set` semantics, so it doesn't need any barriers.
  GenerateVarHandleGetAndUpdate(invoke,
                                codegen_,
                                GetAndUpdateOp::kBitwiseOr,
                                /*need_any_store_barrier=*/ false,
                                /*need_any_any_barrier=*/ false);
}

void IntrinsicLocationsBuilderX86_64::VisitVarHandleGetAndBitwiseOrRelease(HInvoke* invoke) {
  CreateVarHandleGetAndBitwiseOpLocations(invoke, codegen_);
}

void IntrinsicCodeGeneratorX86_64::VisitVarHandleGetAndBitwiseOrRelease(HInvoke* invoke) {
  // `getAndBitwiseOrRelease` has `get` + `setRelease` semantics, so it needs `kAnyStore` barrier.
  GenerateVarHandleGetAndUpdate(invoke,
                                codegen_,
                                GetAndUpdateOp::kBitwiseOr,
                                /*need_any_store_barrier=*/ true,
                                /*need_any_any_barrier=*/ false);
}

void IntrinsicLocationsBuilderX86_64::VisitVarHandleGetAndBitwiseXor(HInvoke* invoke) {
  CreateVarHandleGetAndBitwiseOpLocations(invoke, codegen_);
}

void IntrinsicCodeGeneratorX86_64::VisitVarHandleGetAndBitwiseXor(HInvoke* invoke) {
  // `getAndBitwiseXor` has `getVolatile` + `setVolatile` semantics, so it needs both barriers.
  GenerateVarHandleGetAndUpdate(invoke,
                                codegen_,
                                GetAndUpdateOp::kBitwiseXor,
                                /*need_any_store_barrier=*/ true,
                                /*need_any_any_barrier=*/ true);
}

void IntrinsicLocationsBuilderX86_64::VisitVarHandleGetAndBitwiseXorAcquire(HInvoke* invoke) {
  CreateVarHandleGetAndBitwiseOpLocations(invoke, codegen_);
}

void IntrinsicCodeGeneratorX86_64::VisitVarHandleGetAndBitwiseXorAcquire(HInvoke* invoke) {
  // `getAndBitwiseXorAcquire` has `getAcquire` + `set` semantics, so it doesn't need any barriers.
  GenerateVarHandleGetAndUpdate(invoke,
                                codegen_,
                                GetAndUpdateOp::kBitwiseXor,
                                /*need_any_store_barrier=*/ false,
                                /*need_any_any_barrier=*/ false);
}

void IntrinsicLocationsBuilderX86_64::VisitVarHandleGetAndBitwiseXorRelease(HInvoke* invoke) {
  CreateVarHandleGetAndBitwiseOpLocations(invoke, codegen_);
}

void IntrinsicCodeGeneratorX86_64::VisitVarHandleGetAndBitwiseXorRelease(HInvoke* invoke) {
  // `getAndBitwiseXorRelease` has `get` + `setRelease` semantics, so it needs `kAnyStore` barrier.
  GenerateVarHandleGetAndUpdate(invoke,
                                codegen_,
                                GetAndUpdateOp::kBitwiseXor,
                                /*need_any_store_barrier=*/ true,
                                /*need_any_any_barrier=*/ false);
}

void VarHandleSlowPathX86_64::EmitByteArrayViewCode(CodeGeneratorX86_64* codegen) {
  DCHECK(GetByteArrayViewCheckLabel()->IsLinked());
  X86_64Assembler* assembler = codegen->GetAssembler();

  HInvoke* invoke = GetInvoke();
  LocationSummary* locations = invoke->GetLocations();
  mirror::VarHandle::AccessModeTemplate access_mode_template = GetAccessModeTemplate();
  DataType::Type value_type =
      GetVarHandleExpectedValueType(invoke, /*expected_coordinates_count=*/ 2u);
  DCHECK_NE(value_type, DataType::Type::kReference);
  size_t size = DataType::Size(value_type);
  DCHECK_GT(size, 1u);

  CpuRegister varhandle = locations->InAt(0).AsCoreRegister<CpuRegister>();
  CpuRegister object = locations->InAt(1).AsCoreRegister<CpuRegister>();
  CpuRegister index = locations->InAt(2).AsCoreRegister<CpuRegister>();
  CpuRegister temp =
      locations->GetTemp(locations->GetTempCount() - 1u).AsCoreRegister<CpuRegister>();

  MemberOffset class_offset = mirror::Object::ClassOffset();
  MemberOffset array_length_offset = mirror::Array::LengthOffset();
  MemberOffset data_offset = mirror::Array::DataOffset(Primitive::kPrimByte);
  MemberOffset native_byte_order_offset = mirror::ByteArrayViewVarHandle::NativeByteOrderOffset();

  VarHandleTarget target = GetVarHandleTarget(invoke);

  __ Bind(GetByteArrayViewCheckLabel());

  // The main path checked that the coordinateType0 is an array class that matches
  // the class of the actual coordinate argument but it does not match the value type.
  // Check if the `varhandle` references a ByteArrayViewVarHandle instance.
  codegen->LoadClassRootForIntrinsic(temp, ClassRoot::kJavaLangInvokeByteArrayViewVarHandle);
  assembler->MaybePoisonHeapReference(temp);
  __ cmpl(temp, Address(varhandle, class_offset.Int32Value()));
  __ j(kNotEqual, GetEntryLabel());

  // Check for array index out of bounds.
  __ movl(temp, Address(object, array_length_offset.Int32Value()));
  // SUB sets flags in the same way as CMP.
  __ subl(temp, index);
  __ j(kBelowEqual, GetEntryLabel());
  // The difference between index and array length must be enough for the `value_type` size.
  __ cmpl(temp, Immediate(size));
  __ j(kBelow, GetEntryLabel());

  // Construct the target.
  __ leal(CpuRegister(target.offset), Address(index, TIMES_1, data_offset.Int32Value()));

  // Alignment check. For unaligned access, go to the runtime.
  DCHECK(IsPowerOfTwo(size));
  __ testl(CpuRegister(target.offset), Immediate(size - 1u));
  __ j(kNotZero, GetEntryLabel());

  // Byte order check. For native byte order return to the main path.
  if (access_mode_template == mirror::VarHandle::AccessModeTemplate::kSet &&
      IsZeroBitPattern(invoke->InputAt(invoke->GetNumberOfArguments() - 1u))) {
    // There is no reason to differentiate between native byte order and byte-swap
    // for setting a zero bit pattern. Just return to the main path.
    __ jmp(GetNativeByteOrderLabel());
    return;
  }
  __ cmpb(Address(varhandle, native_byte_order_offset.Int32Value()), Immediate(0));
  __ j(kNotEqual, GetNativeByteOrderLabel());

  switch (access_mode_template) {
    case mirror::VarHandle::AccessModeTemplate::kGet:
      GenerateVarHandleGet(invoke, codegen, /*byte_swap=*/ true);
      break;
    case mirror::VarHandle::AccessModeTemplate::kSet:
      GenerateVarHandleSet(invoke, codegen, is_volatile_, is_atomic_, /*byte_swap=*/ true);
      break;
    case mirror::VarHandle::AccessModeTemplate::kCompareAndSet:
      GenerateVarHandleCompareAndSetOrExchange(
          invoke, codegen, /*is_cmpxchg=*/ false, /*byte_swap=*/ true);
      break;
    case mirror::VarHandle::AccessModeTemplate::kCompareAndExchange:
      GenerateVarHandleCompareAndSetOrExchange(
          invoke, codegen, /*is_cmpxchg=*/ true, /*byte_swap=*/ true);
      break;
    case mirror::VarHandle::AccessModeTemplate::kGetAndUpdate:
      GenerateVarHandleGetAndUpdate(invoke,
                                    codegen,
                                    get_and_update_op_,
                                    need_any_store_barrier_,
                                    need_any_any_barrier_,
                                    /*byte_swap=*/ true);
      break;
  }

  __ jmp(GetExitLabel());
}

#define MARK_UNIMPLEMENTED(Name) UNIMPLEMENTED_INTRINSIC(X86_64, Name)
UNIMPLEMENTED_INTRINSIC_LIST_X86_64(MARK_UNIMPLEMENTED);
#undef MARK_UNIMPLEMENTED

UNREACHABLE_INTRINSICS(X86_64)

#undef __

}  // namespace x86_64
}  // namespace art

Messung
CHZG
909710095

¤ Dauer der Verarbeitung: 0.381 Sekunden  ¤

*© Formatika GbR, Deutschland







                                                                                                                                                                                                                                                                                                                                                                                                     

 

Neuigkeiten

Aktuelles
Motto des Tages

Open Source Software


Gedichte
Musik
Bilder

Jenseits des Üblichen

Besucherstatistik

Besucherstatistik

Statistik
#Sources=1,188,066
#Domains=861,778