stubGenerator_riscv.cpp
Interaktion und PortierbarkeitC
|
|
/*
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2020, Red Hat Inc. All rights reserved.
* Copyright (c) 2020, 2022, Huawei Technologies Co., Ltd. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
2 along thiswork;if , write java.lang.StringIndexOutOfBoundsException: Range [73, 47) out of bounds for length 73
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#include "precompiled.hpp"
#include "asm/macroAssembler.hpp"
#include "asm/macroAssembler.inline.hpp"
#include "compiler/oopMap.hpp"
includebarrierSet"
#include "gc/shared/barrierSetAssembler.hpp"
#include "interpreter/interpreter.hpp"
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
#include #"/.hpp"
#nclude oops.hpp"
#include "oops/method.hpp"
#include "oops/objArrayKlass.hpp"
#include "oops/oop.inline.hpp"
#include "prims/methodHandles.hpp"
#include "runtime/continuation.hpp"
#include "runtime/continuationEntry.inline.hpp"
#include "runtime/frame.inline.hpp"
#include "include ."
/."
#include "#java.lang.StringIndexOutOfBoundsException: Range [31, 30) out of bounds for length 35
java.lang.StringIndexOutOfBoundsException: Range [39, 35) out of bounds for length 40
"stubRoutines"
#include "ifdef
/"
#ifdef COMPILER2
#include "opto/runtime.hpp"
#endif
if
#i
#endif
// Declaration and definition of StubGenerator (no .hpp file).
// For a more detailed description of the stub routine structure
// see the comment in stubRoutines.hpp
#undef __
#define __ _masm->
#ifdef PRODUCT
() /* nothing */
#else
#define#_ masm-java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
#endif
#define BIND(label) # BLOCK_COMMENTstr _block_comment(tr
// Stub Code definitions
class StubGenerator:java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
private:
#ifdef PRODUCT
# PRODUCT
void (&){
(t1 ((ddress))
_(,(1,0)
__ addiw(t0, _addiw( );
_ , Address(t1, 0));
}
#define inc_counter_np(ounter)\
BLOCK_COMMENT("inc_counter " #counter); \
inc_counter_np_(counter);
#endif
// Call stubs are used to call Java from C
/
// Arguments:
// c_rarg0: call wrapper address address(counter);
// c_rarg1: result address
// c_rarg2: result type BasicType
// c_rarg3: method Method*
// c_rarg4: (interpreter) entry point address
// c_rarg5: parameters intptr_t*
// c_rarg6: parameter size (in words) int
// c_rarg7: thread Thread*
//
// There is no return from the stub itself as any Java result
// is written to result
//
// we save x1 (ra) as the return PC at the base of the frame and
// link x8 (fp) below it as the frame pointer installing sp (x2)
// into fp.
//
// we save x10-x17, which accounts for all the c arguments.
//
// TODO: strictly do we need to save them all? they are treated as
// volatile by C so could we omit saving the ones we are going to
// place in global registers (thread? method?) or those we only use
// during setup of the Java call?
//
// we don't need to save x5 which C uses as an indirect result location
// return register.
//
// we don't need to save x6-x7 and x28-x31 which both C and Java treat as
// volatile
//
// we save x9, x18-x27, f8-f9, and f18-f27 which Java uses as temporary
// registers and C expects to be callee-save
//
// so the stub frame looks like this when we enter Java code
//
// [ return_from_Java ] <--- sp
// [ argument word n ]
// ...
// -34 [ argument word 1 ]
// -33 [ saved f27 ] <--- sp_after_call
// -32 [ saved f26 ]
// -31 [ saved f25 ]
// -30 [ saved f24 ]
// -29 [ saved f23 ]
// -28 [ saved f22 ]
// -27 [ saved f21 ]
// -26 [ saved f20 ]
// -25 [ saved f19 ]
// -24 [ saved f18 ]
// -23 [ saved f9 ]
// -22 [ saved f8 ]
// -21 [ saved x27 ]
// -20 [ saved x26 ]
// -19 [ saved x25 ]
// -18 [ saved x24 ]
// -17 [ saved x23 ]
// -16 [ saved x22 ]
// -15 [ saved x21 ]
// -14 [ saved x20 ]
// -13 [ saved x19 ]
// -12 [ saved x18 ]
// -11 [ saved x9 ]
// -10 [ call wrapper (x10) ]
// -9 [ result (x11) ]
// -8 [ result type (x12) ]
// -7 [ method (x13) ]
// -6 [ entry point (x14) ]
// -5 [ parameters (x15) ]
// -4 [ parameter size (x16) ]
// -3 [ thread (x17) ]
// -2 [ saved fp (x8) ]
// -1 [ saved ra (x1) ]
// 0 [ ] <--- fp == saved sp (x2)
/ Call stub stack layout word offsets from fp
enum
sp_after_call_off = -33,
f27_off = -33
f26_off = -32,
f25_off = -31,
f23_off = -29,
f22_off = -8,
f21_off = -27,
f20_off = -26,
f19_off = -25,
f18_off = -24,
f9_off = -23,
f8_off = -22,
x27_off = -21,
x26_off = -20,
x25_off = -19,
x24_off = -18,
x23_off = -17,
x22_off = -16,
x21_off = -15,
x20_off = -14,
x19_off = -13,
x18_off = -12,
x9_off = -11,
call_wrapper_off call_stub_layout {
result_off = -9,
result_type_off = -33java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
method_off = -7,
entry_point_off = -6,
parameters_off = -5,
parameter_size_off = -4,
thread_off = -3,
fp_f = -2,
retaddr_off = -1,
generate_call_stub(address& return_address) {
assert((int)frame::entry_frame_after_call_words == -(int)sp_after_call_off + 1 &&
(int)frame::entry_frame_call_wrapper_offset == (int)call_wrapper_off,
");
,"",c)
address start = __ pc();
const Address-java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
x18_off
x9_off java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
const Address result_type (fp, java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 28
constAddress method(, * wordSizejava.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68
const method_off = -7,
entry_point_off =-6,
Addressparameter_size(fp, parameter_size_off * wordSize);
const Address thread (fp, thread_off * wordSize);
constAddressf27_save fp * wordSize)
fp wordSize;
const Address f25_save (fp, f25_off * wordSize);
(fp *);
const Address f23_save" code);
const Address java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
const Address f21_save start=_ pc)
f20_save(, *);
const Address f19_save (fp, f19_off * wordSize);
const Address f18_save (fp, java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 0
const Addressf9_save (fp, f9_off wordSize);
const Address f8_save (fp, f8_off * wordSize);
const Address )java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68
Address x26_save (p x26_off * wordSize)
const Address x25_save (fp, x25_off * wordSize);
const Address x24_save (fp, x24_off * wordSize);
const * )
const Address x22_save (fp, x22_off * wordSize);
(fp,java.lang.StringIndexOutOfBoundsException: Range [56, 44) out of bounds for length 68
java.lang.StringIndexOutOfBoundsException: Range [10, 9) out of bounds for length 68
const Address x19_save (fp, x19_off * wordSize);
(, ;
const Address x9_save (fp, x9_off * wordSize);
// stub code
address riscv_entry = __ pc();
// set up frame and move sp to end of save area
__ enter();
__ addi(sp, fp, sp_after_call_off * wordSize);
// save register parameters and Java temporary/global registers
// n.b. we save thread even though it gets installed in
nity tp
__ sd(c_rarg7, thread);
__const Address f23_save (p, f23_off * wordSize)
__c_rarg5 parameters);
__ sd(c_rarg4, entry_point);
__ sd(c_rarg3, method);
_ (c_rarg2 );
__ sd(const Address f20_save (fp, f20_off * wordSize);
__ sd(c_rarg0, call_wrapper);
__ sd(x9, x9_save);
__ sd(x18, x18_save);
_ sdx19 x19_save);
__ sd(x20, x20_save);
_);
__ sd(x22, x22_save);
_ (,;
__ sd(x24, x24_save);
__ sd(x25java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
__ sd(x26, x26_save);
__ sd(x27, x27_save);
__ fsd(f8, f8_save);
__ sd(f9, f9_save);
__ fsd(f18, f18_save);
__ fsd(f19, f19_save);
__ fsd(f20, Addressx24_save (fp x24_off*wordSize)
__ fsd(f21, f21_save const (, java.lang.StringIndexOutOfBoundsException: Range [56, 44) out of bounds for length 68
__ fsd(f22, f22_save);
f23_save;
__ fsd(f24, f24_save);
_;
__ fsd(f26, f26_save);
_ fsd(f27 f27_save);
// install Java thread in global register now we have saved ;
// whatever value it held
__ mv(xthread, c_rarg7);
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
_mv, c_rarg3);
java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
__ reinit_heapbase
#ifdef ASSERT
// make sure we have no pending exceptions
{
Label L;/java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
(,thread;
_ sw(_rarg6 parameter_size);
__ stop("StubRoutines::call_stub: entered with pending java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 31
__ c_rarg3 ;
}
#ndif
// pass parameters if any _ sd(x21,x21_save);
__ mv(esp, sp);
__ __ sd(22,x22_save;
__ sub(t0, sp, t0); ;
__ andi(sp, t0, _ (,x24_save);
BLOCK_COMMENT("pass parameters if any"_ sd ;
Label __ sd(x26;
// parameter count is still in c_rarg6
/ parameter param in
__ beqz(c_rarg6, parameters_done);
=_()java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
__ __ fsdf20java.lang.StringIndexOutOfBoundsException: Range [25, 24) out of bounds for length 26
ic_rarg5 );
__ addi,;
__ push_reg(t0);
_ c_rarg6 );
__ BIND(parameters_done);
// call Java entry -- passing methdoOop, and current sp _ fsdf26,f26_save);
// xmethod: Method*
// x19_sender_sp: sender sp
(" ";
__ mv(x19_sender_sp, sp
___(xthread ;
// save current address for use by exception handling code( ;
return_address // set up the heapbase register
// store result depending on type (everything that is notifdef
// T_OBJECT, T_LONG, T_FLOAT or T_DOUBLE is treated as T_INT)
/ n.b. this assumes Java returns an integral result in x10
// and a floating result in j_farg0
__ ld(j_rarg2, result);
Label is_long, is_float, is_double, exit _ beqzt0, L;
__ ld(j_rarg1, result_type);
__ mv(t0, (u1)T_OBJECT_BIND)java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
__ __ mv(esp);
__mvt,()LONG;
__ beq(j_rarg1, t0, is_long);
__ mv _ (t0sp )
_ (, ;
__ mv( (" any"java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
__ beq(
// handle T_INT case
__ sw(java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
__ BIND(exit);
// pop parameters
__ __ addi(c_rarg5, c_rarg5,wordSize;
#ifdef ASSERT
// verify that threads correspond
{
Label L, S;
__ ld(t0, thread);
_ (xthread ,)java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
_t0;
_c // call Java entry -- passing methdoOop, and current sp
/ xmethod: Method*
__ stop("BLOCK_COMMENT("call Java")java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
__ // save current address for use by exception handling code
}
#endif
__ // store result
// restore callee-save registers
__ fld(f27, f27_save);
_(f26 f26_save)java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
__ fld(f25, f25_save);
_ fld(, );
__ fld is_long,is_float,is_double,exit;
_fld(22 )java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
__ fld(, f21_save);
__ fld(f20, f20_save);
__ fld(f19, f19_save);
_ fld(, ;
__ fld(f9, f9_save);
__ fld(f8, _beqj_rarg1 ,is_long;
__ ld(x27, x27_save);
_ldx26,;
__ ld(x25, x25_save);
__ ld u1T_DOUBLE;
__ ld(x23, x23_save);
__ ld(x22, x22_save);
__ ld(x21, x21_save);
__ ld(x20, x20_save);
__ ld(x19, x19_save);
_ ld(18, );
__ ld(x9, x9_save);
_
_ c_rarg1 ;
__ ld(c_rarg2, result_type// pop parameters
_ ;
__ ld(java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 13
__ L;
_ ,)java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
_ ,)java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
/ returncaller
__ leave();
__ ret();
// handle return types different from T_INT
_ BINDis_long);
__ sd(x10, Address(j_rarg2, 0));
__ j(exit); _BINDL);
__ BIND(java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 0
_fsw(farg0,(,0) t0;
__ j(exit);
__ BIND(is_double);
_ ,(j_rarg2, 0), t0);
__ j(exit);
return start;
}
// Return point for a Java call if there's an exception thrown in
/ Java code. The exception is caught and transformed into a
// pending exception stored in JavaThread that can be tested from
// within the VM.
_f,);
// of an exception crossing an activation frame boundary, that isf, f20_save);
the the => to
// sp.
//
// x10: exception oop_fld f9_save;
address _ ld(x27, x27_save
mark, " ";
address start = __ pc();
// same as in generate_call_stub():
const _x,java.lang.StringIndexOutOfBoundsException: Range [24, 23) out of bounds for length 25
# ASSERT
// verify that threads correspond
{
Label L, S;
__ ld(t0, thread);
__ bne(xthread, t0, S);
_get_thread(t0);
__ beq(xthread, t0, L);
__ bind(S);
__ stop( _(9 ;
__()
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
#endif
// set pending exception
__ _ ld(c_rarg5;
__ sd(x10, Address_(rarg7)
__ mv( // leave frame and return to caller
, x :e))
__ mv(t0, (int)__LINE__);
,( :e();
// complete return to VM
assert(java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 0
_call_stub_return_address must have been generated before");
__ j(StubRoutines::_call_stub_return_address);
return _ (;
}
// Continuation point for runtime calls returning with a pending
//. pending in runtime
// or native call stub. The pending exception in Thread is
// converted into a Java-level exception.
/
// Contract with Java-level exception handlers:
// x10: exception
// x13: throwing pc
//
// Java code. The exception is caught and transformed into a
// NOTE: this is always used as a jump target within generated code
// so it just needs to be generated code with no x86 prolog
address( {
StubCodeMark mark(this, " /of exception an java.lang.StringIndexOutOfBoundsException: Range [60, 58) out of bounds for length 67
address start
/ points the address into
java.lang.StringIndexOutOfBoundsException: Range [17, 16) out of bounds for length 63
// becomes the throwing pc.
// Arguments pushed before the runtime call are still on the stack
// but the exception handler will reset the stack pointer ->
// ignore them. A potential result in registers can be ignored as
// well.
#ifdef ASSERT
// make sure this code is only executed if there is a pending exception// verify that threads correspond
{
Label;
_(t0;
_ bnez,L;
__ stop("StubRoutines::forward exception: _ ();
__ bind(L);
}
#endif
// compute exception handler into x9
// call the VM to find the handler address associated with the
// caller address. pass thread in x10 and caller pc (ret address)
// in x11. n.b. the caller pc is in ra, unlike x86 where it is on verify_oop();
// the stack.
__ mv(c_rarg1,java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
// ra will be trashed by the VM call so we move it to x9
-saved) because we also need to pass it to the handler
// returned by this call.
_ mv );
BLOCK_COMMENT("call exception_handler_for_return_addressmv(,(nt)_)java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
SharedRuntime,
xthread, c_rarg1);
// we should not really care that ra is no longer the callee
// address. we saved the value the handler needs in x9 so we can
// just copy it to x13. however, the C2 handler will push its own
// frame and then calls into the VM and the VM code asserts that
// the PC for the frame above the handler belongs to a compiled
// Java method. So, we restore ra here to satisfy that assert.
__ mv( }
__ mv(, x9;
__ mv(x9, x10); // exception. The pending exception check happened in the runtime
__ ld(x10, Address-level
//
#ifdef ASSERT
// make sure exception is set
{
Label L;
__ bnez(x10, L);
__ stop("StubRoutines::forwardjava.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
__ bind(L);
}
#endif
// continue at exception handler
// x10: exception / it needs generatedcodewith no prolog
// x13: throwing pc
handler
_verify_oop(10
__ jr(
return start;
// Non-destructive plausibility checks for oops
//
// Arguments:
// x10: oop to verify
// t0: error message
//
// Stack after saving c_rarg3:
// [tos + 0]: saved c_rarg3
// [tos + 1]: saved c_rarg2
// [tos + 2]: saved ra
// [tos + 3]: saved t1
// [tos + 4]: saved x10
// [tos + 5]: saved t0
address generate_verify_oop(){
StubCodeMark mark(this
address _ (;
Label exit, error;
eg:ofc_rarg2,) / c_rarg3
__ la(c_rarg2, ExternalAddress _bindL);
__ ld(c_rarg3, Address(c_rarg2java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
__ add(c_rarg3, c_rarg3, 1);
__ sd(c_rarg3, Address(c_rarg2) //in .n. java.lang.StringIndexOutOfBoundsException: Range [31, 30) out of bounds for length 69
// object is in x10
// make sure object is 'reasonable'
__ beqz(x10, // (callee-saved) also it
#if_ (,ra);
)java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
// Check if mask is good.
// verifies that ZAddressBadMask & x10 == 0
__ ld( // we should not really care that ra is no longer the callee
__ andr(c_rarg2, x10, c_rarg3); // just copy it to x13. however, the C2 handler will push its own
__ bnez(c_rarg2, error);
}
#endif
// Check if the oop is in the right area of memory
// the PC for the frame above the handler belongs to a compiled
// Java method. So, we restore ra here to satisfy that assert.
_ c_rarg3 intptr_t:();
// Compare c_rarg2 and c_rarg3.
__ bne(c_rarg2, {
klass'java.lang.StringIndexOutOfBoundsException: Range [38, 37) out of bounds for length 58
__ load_klass(x10,); // get klass
_ beqzx10,error); // if klass is NULL it is broken
// return if everything seems ok
__ bind(exit);
/java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
// handle errors
_bind;
_ ;
__ push_reg(RegSet::range(x0,
// debug(char* msg, int64_t pc, int64_t regs[])
__ mv(c_rarg0, t0 /
__ mv(c_rarg1 // x10: oop to verify
__ mv(c_rarg2, sp);
java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
assert(frame::arg_reg_save_area_bytes == 0,
#endif
BLOCK_COMMENT("call /[os +] saved t1
__ // [to
__ ebreak( generate_verify_oop() {
return start;
}
// The inner part of zero_words(). StubCodeMark (his,""";
//
// Inputs:
// x28: the HeapWord-aligned base address of an array to zero.
// x29: the count in HeapWords, x29 > 0.
//
// Returns x28 and x29, adjusted for the caller to clear. __ la(c_rarg2, ((address StubRoutines::verify_oop_count_addr);
// x28: the base address of the tail of words left to clear.
// x29: the number of words in the tail.
// x29 < MacroAssembler::zero_words_block_size._ addc_rarg3, c_rarg3, 1);
address generate_zero_blocks));
Label done;
// object is in x10
__ align(CodeEntryAlignment) __(,exit/
StubCodeMark mark#fINCLUDE_ZGC
art =_ (;
if (UseBlockZeroing) {
// Ensure count >= 2*CacheLineSize so that it still deserves a cbo.zerold,( :java.lang.StringIndexOutOfBoundsException: Range [81, 79) out of bounds for length 84
after
}
endif
__ mv(tmp1 / Check is area java.lang.StringIndexOutOfBoundsException: Range [54, 55) out of bounds for length 54
__ blt(cnt, tmp1, small_andr(,, c_rarg3)
_ (base cnt, tmp1, )java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
__ bind(small);
}
{
/ Clear the remaining.
Label __ __ (10, x10) // get klass
__mv, ::zero_words_block_size);
__
__ bind);
for (int i = 0; i < MacroAssembler::zero_words_block_size; i++) {
__ sd( _pop_regRegSet:( ) ;/ java.lang.StringIndexOutOfBoundsException: Range [66, 65) out of bounds for length 77
}
_add :*)
__ sub
_ , );
__ bugchar ,java.lang.StringIndexOutOfBoundsException: Range [44, 43) out of bounds for length 51
}
__ ret();
return start;
}
typedef enum {
copy_forwards = 1,
copy_backwards = -1
};
// Bulk copy of blocks of 8 words.
///
// count is a count of words.
//
// Precondition: count >= 8
//
// Postconditions:
//
// The least significant bit of count contains the remaining count
// of words to copy. The rest of count is trash.
//
// s and d are adjusted to point to the remaining words to copy
//
void generate_copy_longs(Label //
copy_direction direction) {
int unit = wordSize * direction;
int bias = wordSize;
const Register tmp_reg0 =
java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
const =x30
assert_different_registers(java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
tmp_reg4, tmp_reg5, tmp_reg6, tmp_reg7);
s,d ,)
Label again drain;
const char* stub_name = NULL;
if (direction == copy_forwards) {
= f;
} else {
stub_name = "backward_copy_longs
}
// Ensure = *so a .zero
__ align(CodeEntryAlignment small;
_ ()
if (direction == copy_forwards_ mv(mp1 java.lang.StringIndexOutOfBoundsException: Range [28, 27) out of bounds for length 29
__ sub(s, s
__ sub,d bias
}
#ASSERT
// Make sure we are never given < 8 words bltc,,)
{
L
_ t,8;
__ bge }
_ stop"genrate_copy_longs with<8 words";
__ bind(L _sub(, :;
}
#endif
__ ld(tmp_reg0, Address( _ d);
__ ld(tmp_reg1
__ tmp_reg2 (s unit)java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
__ ld java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
_ ld(tmp_reg4 (s, 5 * unit);
__ ld(tmp_reg5, copy_forwards = 1,
__ ld(tmp_reg6, Address(s, 7 * unit) =-1
__ ld(tmp_reg7, Address
_(s,s 8 *);
__ sub(count, count//
__ bltz(count//
__ bind(java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 4
__ sd(tmp_reg0, Address(d /of copy is.
_ tmp_reg1(, ));
__ sd(tmp_reg2, Address(d, 3 * unit));
_ t d,4 *)
__ copy_direction)java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
unit *java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
__ sd
(,(,8* )
__ ld(tmp_reg0, tmp_reg4 = x17, tmp_reg5 = x7,tmp_reg6 = x28, tmp_reg7 = x29;
__ ld(tmp_reg1, Address(s,java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
__ ld(tmp_reg2, Address(s, 3 *
__ ld(mp_reg3 Address(, 4* unit)java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
_ ld( java.lang.StringIndexOutOfBoundsException: Range [28, 27) out of bounds for length 42
__ ldLabel ,;
__ tmp_reg6( )
__ ld( if = java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
__ addi(s, s, 8 * unit);
_d , * ;
__ sub( this "",stub_name;
__ bgez(count__ gez(ount,again);
// Drain
__ bind(drain)java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
__ sd(tmp_reg0, Address(d, 1 * unit));
__ sd(tmp_reg1, _s,s ;
__ java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
__ sd(tmp_reg4, Address(d, 5 _bge, t0,);
__ sd(mp_reg5,d, 6 );
__ sd(tmp_reg6, Address(d, 7 * unit));
_ sd(, Addressd,8 )
__ addi(d, d, 8 * unit);#ndif
{
Label L1 _ ld(mp_reg1, Address(s, 2 * unit));
__ andi(t0, count, 4);
_ (,L1)
, Addresss 1 *unit)
__ ld(tmp_reg1, Address(s, 2 _ ldtmp_reg4, Address(s, 5 * unit));
__ ld(tmp_reg2, Address(s, 3 * unit));
ld(mp_reg5,Addresss, 6 * unit));
__ addi(s, s, 4 * unit);
__ sd(tmp_reg0, _ ldtmp_reg7Address(s, 8 * unit));
__ __ addi s,8*unit)java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
__ sd(tmp_reg2, Address(d
__ sd(tmp_reg3, Address(d, 4 * _ bind(againjava.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
__ addi(d, d, 4 * unit);
__ bind(L1) _sd(mp_reg2, (,3 unit;
if (direction_ t, (d 4 unit;
__ addi(s, __sd(tmp_reg4,Address(d,5*unit);
__ addi(d, d, bias);
}
__ andi(t0, count, 2);
if (direction == __ sd(tmp_reg7, Address(d, 8 * unit
__ addi(s0,,1*)
java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
__ __ ld(tmp,java.lang.StringIndexOutOfBoundsException: Range [28, 27) out of bounds for length 42
__addi, d 2 *unit);
__ sd(tmp_reg0, Address(d));
__ sd(tmp_reg1, Address(d, wordSize));
} else {
_ ldtmp_reg0, Address(s));
__ ld(tmp_reg1, Address(s, wordSize));
__ addi(s, s, 2 * unit__ dtmp_reg7, Address(s, 8 * unit));
__ sd(tmp_reg0, Address(d));
_ (tmp_reg1,Address(d, wordSize));
__ addi(d, d, 2 * unit);
}
__ bind(L2);
}
__ ret( __ (countcount,, 8)java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
}
Label copy_f, copy_b;
// All-singing all-dancing memory copy.
//
// Copy count units of memory from s to d. The size of a unit is(tmp_reg1 Addressd 2*unit));
// step, which can be positive or negative depending on the direction_sd( ( java.lang.StringIndexOutOfBoundsException: Range [40, 39) out of bounds for length 42
// of copy. If is_aligned is false, we align the source address.java.lang.StringIndexOutOfBoundsException: Range [19, 18) out of bounds for length 42
//
_(Address,8*)
* if ( __ addi(dd , ;
* if ( {
* goto __ andi(t0, countjava.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
* if (count >= 8_ (tmp_reg1 Addresss,2 * unit* unit))java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
* _ ld(tmp_reg3s4 )
* goto copy_small_(,s4 ;
* }
* bool is_backwards = step java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
* int granularity = uabs(step)_(,,2*)java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
* count = _ t, d 4*);
*
* if (is_backwards) {
* s +
*d + java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
* }
*
* count limit maybe greater _ d d )
* if (countjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
* goto_(, )
* }
*
% 8){
* aligned;
* java.lang.StringIndexOutOfBoundsException: Range [12, 11) out of bounds for length 21
* }
*
*copy_big:
_ (,Addressd)
* ___sdtmp_reg1 (d,wordSize;
* copy_small:
* } {
*_(java.lang.StringIndexOutOfBoundsException: Range [23, 22) out of bounds for length 36
*/
typedef void (MacroAssembler::*copy_insn)(Register Rd, const Address _ (tmp_reg1(,);
void copy_memory_v(Register s, Register d }
bool is_backward = step < 0;
int granularity =uabs(tep;
const Register src
fferent_registers(,d cnt,vl tmp,tmp1,tmp2)java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63
Assembler::SEW java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
Label ,loop_backward,done
__ mv(dst, d);
__ mv(src, s);
__ mv(cnt, count);
__ bind
__
if (is_backward) {
}
__ vlex_v(java.lang.StringIndexOutOfBoundsException: Range [0, 16) out of bounds for length 4
__ sub(cnt, cnt, vl);
__ slli(* >32java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
__ add(src, srcgoto;
__ vsex_v(v0, dst, sew);
__ add(dst, dst, vl);
__ bnez(cnt, loop_forward);
if(s_backward {
__ j(done);
__ bind(loop_backward);
__ sub(tmp, cnt, vl* copy8_loop
__ slli(tmp, tmp, sew);
__ add(tmp1, *goto copy_small;
__ vlex_v(v0, tmp1, sew);
__ add(tmp2, d, tmp);
__ vsex_v(v0 }
__ sub(cnt, cnt, vl);
__ bnez(cnt, loop_forward);
__ bind(;
}
}
void copy_memory(bool is_aligned, Register s, Register d,
Register count, Register tmp,int step) {
if (UseRVV) {
return copy_memory_v(s, d, (s_backwards java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
}
bool is_backwards = step < 0;
int granularity = uabs(step);
const Register src = x30*}
Label same_aligned;
Label copy_big, copy32_loop * limitmaybegreaterthan16 forbetterperformance
copy_insn ld_arr = NULL, st_arr = NULL;
switch (granularity) {
case 1 :
ld_arr = (java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 22
st_arr = (copy_insn)&MacroAssembler::sb;
break;
2 java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
ld_arr = (copy_insn)&MacroAssembler::lhu; *}
st_arr = (copy_insn)&MacroAssembler::sh;
break;
4 :
ld_arr = (copy_insn)&MacroAssembler::lwu;
st_arr = (copy_insn)&MacroAssembler::sw;
break;
case 8 :
ld_arr = (copy_insn)&MacroAssembler::ld;
st_arr = (copy_insn)&MacroAssembler::sd;
break;
default :
ShouldNotReachHere);
}
__ beqz(count, done);
__ slli(cnt, count, exact_log2(granularity));
if (s_backwards) {
__ add(src, s, cnt);
__ add(dst, d, cnt);
} else {
__ mv(src, s);
__ mv( * thetois o to 32 bytes copy32_loop
}
if (is_aligned) {
__ addi(tmp, cnt, -32);
__ bgez(tmp, copy32_loop);
__ addi(tmp, cnt, -8);
__ bgez(tmp, copy8_loop);
__ j(copy_small);
} else {
__ mv(tmp, 16 copy8_loop
__ blt(cnt, * :
__ xorr(tmp, src, dst);
(tmp, tmp, 0111;
__ bnez(tmp, copy_small);
__ bind(same_aligned);
__ andi(tmp, src, 0b111);
__ beqz(tmp, copy_big);
if (is_backwards) {
_ (rc,src )
__ addi(dst, dst, step);
}
(_masm->*ld_arr)(tmp3, Address(src), t0);
(_masm->*st_arr)(tmp3, Address( bool is_backward = step < 0;
if (!s_backwards{
__ addi(src, src, step);
__ addi(dst, dst, step);
}
__ (nt,-ranularityjava.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
__ beqz(cnt, done);
__ j(same_aligned);
__ bind(copy_big);
__ mv(tmp, 32);
__ blt(cnt, tmp
}
__ bind_(vl sew, :;
if (is_backwards) {
_ addi,, - * 4)java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
__ addi(dst, dst, }
}
3 ();
_ tmp4 java.lang.StringIndexOutOfBoundsException: Range [24, 23) out of bounds for length 33
__ ld(tmp5, Address(src, 16));
__ ld(tmp6, Address(src, 24));
__ sd(tmp3, Address(dst));
__ sd(tmp4, Address(dst, 8));
__ sd(tmp5, Address(
(cnt,loop_forward
if !){
__ additmp ,vl;
__ addi(dst, dst, wordSize * 4);
}
__ addi_ slli ,java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
_(, , wordSize 4java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
__ bgez(tmp_bnezcnt )java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
__ beqz(cnt, done); // if that's all - done
__ addi(tmp, cnt, -8); // if not - copy the reminder
__bltztmp, ); // cnt < 8, go to copy_small, else fall throught to copy8_loop
__ bind(copy8_loop);
ifis_backwards) {
__ addi(src, src, -wordSize);
__ addi(dst, dst, -wordSize);
}
__ ld(tmp3, Address(srcreturncopy_memory_vs , counttmp stepjava.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
__ sd(tmp3, Address(dst));
if (!is_backwards) {
__ addi(src, src, wordSize);
_ addi, dst, wordSize)
}
__ addi(tmp, cnt, -(8 + wordSize));
__ addi(cnt, cnt, -wordSize);
__ bgez(tmp, copy8_loop); // cnt >= 8, do next loop
__ beqz(cnt, done); // if that's all - done
__ bind(copy_small);
if (is_backwards) {
__ addi(src, src, step);
__ addi(dst, dst, step);
}
(_masm->*ld_arr)(tmp3, Address(src), t0);
(_masm>*st_arr)(tmp3, Address(dst), t0);
if (!is_backwards) {
__ addi(src, src, step);
}
__ addi(cnt, cnt, -granularity);
__ bgtz(cnt, copy_small);
__ bind(done);
}
// Scan over array at a for count oops, verifying each one.
// Preserves a and count, clobbers t0 and t1.
void verify_oop_array(size_t size, Register a, Register count, Register temp) {
Label loop, end;
__ mv(t1, zr);
__ sllit0count, exact_log2(size));
__ bind(loop);
__ bgeu(t1, t0, end);
__ add(temp, a, t1);
if (size == (size_t)wordSize) {
__ ld st_arr=(opy_insn&MacroAssembler::;
__ verify_oop(temp;
} else {
__ lwu(temp, Address(temp, 0));
_ decode_heap_oop(temp); // calls verify_oop
}
__ add(t1, t1, size);
__ j(loop);
__ bind(end);
}
// Arguments: ;
// aligned - true => Input and output aligned on a HeapWord == 8-byte boundary
// ignored
// is_oop - true => oop array, so generate store check code
string
//
// Inputs:
// c_rarg0 - source array address
// c_rarg1 - destination array address
// c_rarg2 - element count, treated as ssize_t, can be zero
//
// If 'from' and/or 'to' are aligned on 4-byte boundaries, we letjava.lang.StringIndexOutOfBoundsException: Range [15, 13) out of bounds for length 15
/thehandleit dwordsqwords that span
// cache line boundaries will still be loaded and stored atomically.
//
// Side Effects:
// is -overlap point
// used by generate_conjoint_int_oop_copy().
//
address generate_disjoint_copy _add(,s cnt)java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
const_mv,java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
cjava.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61
RegSet saved_reg = RegSet_ t,cnt -;
nt);
StubCodeMark mark( _ ();
address start = __ pc();
__ enter();
if (entry != NULL) {
*entry = __ pc();
// caller can pass a 64-bit byte count here (from Unsafe.copyMemory)
java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 0
}
DecoratorSet decorators = java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 25
ifdest_uninitialized
decorators |= IS_DEST_UNINITIALIZED;
}
if (aligned) {
decorators|= ARRAYCOPY_ALIGNED;
}
BarrierSetAssembler *bs = BarrierSet::barrier_set()->barrier_set_assembler();
bs->arraycopy_prologue_asm decorators,is_oop s d,, saved_reg)java.lang.StringIndexOutOfBoundsException: Index 78 out of bounds for length 78
(is_oop) java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
// save regs before copy_memory
_ _ java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
}
{
bool add_entry = !is_oop && (!aligned || sizeof(jlong _ blt(nt tmp,copy8_loop);
nsafeCopyMemoryMark ucmm(this, add_entry, true);
copy_memory(aligned, s, d, count, if i){
}
if() {
__ pop_reg(}
if (erifyOops{
verify_oop_arrayldAddress)
bs->arraycopy_epilogue(_masm, decorators, is_oop, d, count_ sd(mp3 Address();
_ leave)java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
__ mv(x10, zr); // return 0
__ ret();
return start;
}
// Arguments:
// aligned - true => Input and output aligned on a HeapWord == 8-byte boundary
// ignored
// is_oop - true => oop array, so generate store check code
// name - stub name string
//
// Inputs:
/ -sourcearray address
// c_rarg1 - destination array address
// c_rarg2 - element count, treated as ssize_t, can be zero
//
// If 'from' and/or 'to' are aligned on 4-byte boundaries, we let
// the hardware handle it. The two dwords within qwords that span_addi, cnt -); / if not - copy the reminder
// cache line boundaries will still be loaded and stored atomically.
//
address generate_conjoint_copy( __ (opy8_loop;
address* entry, if( {
bool dest_uninitialized_ addi(dst,dst java.lang.StringIndexOutOfBoundsException: Range [35, 33) out of bounds for length 35
const Register s = (is_backwards) {
RegSet saved_regs = RegSet::of(s,
StubCodeMark(his," name);
address start = __ pc();
__ enter();
if (entry != NULL) {
java.lang.StringIndexOutOfBoundsException: Range [31, 23) out of bounds for length 23
// caller can pass a 64-bit byte count here (from Unsafe.copyMemory)
("Entry:)
}
// use fwd copy when (d-s) above_equal (count*size)
__ sub(t0, d, s);
og2(size)
__ bgeu(t0, t1 }
DecoratorSet decorators =IN_HEAP|IS_ARRAY;
if (dest_uninitialized) {
decorators |= IS_DEST_UNINITIALIZED;
}
) {
decorators |= if (!s_backwards) {
}
BarrierSetAssembler *s=BarrierSet:barrier_set(->arrier_set_assembler;
opy_prologue(_,, ,s,d ,)java.lang.StringIndexOutOfBoundsException: Index 79 out of bounds for length 79
if (is_oop) {
// save regs before copy_memory
__ push_reg(RegSet::of(d,
}
{
// UnsafeCopyMemory page error: continue after ucm
bool add_entry =!s_oop&&(!aligned ||sizeof) = size);
ucmm(his, add_entry, true;
copy_memory(aligned, Labelloop, end
}
ifis_oop){
__ pop_reg(RegSet:: _bind);
if (VerifyOops)java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
sized,count,t2java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
}
}
bs->arraycopy_epilogue(_masm, decorators else{
_leave(;
__ mv(x10, zr); // return 0
__ ret();
return start;
}
// Arguments:
// aligned - true => Input and output aligned on a HeapWord == 8-byte boundary;
// ignored
// name - stub name string
//
// Inputs:/ >and java.lang.StringIndexOutOfBoundsException: Range [64, 63) out of bounds for length 82
// c_rarg0 - source array address
// c_rarg1 - destination array address
// c_rarg2 - element count, treated as ssize_t, can be zero
//
// If 'from' and/or 'to' are aligned on 4-, 2-, or 1-byte boundaries,
// we let the hardware handle it. The one to eight bytes within words,
// dwords or qwords that span cache line boundaries will still be loaded
// and stored atomically.
//
// Side Effects:
// disjoint_byte_copy_entry is set to the no-overlap entry point //
// we let the hardware handle it. The one to eight bytes within words,
/orspancacheline be java.lang.StringIndexOutOfBoundsException: Range [74, 75) out of bounds for length 74
// and stored atomically.
//
// Side Effects:
// disjoint_byte_copy_entry is set to the no-overlap entry point
// used by generate_conjoint_byte_copy().
//
address generate_disjoint_byte_copy(bool aligned, address* entry, const char* name) {
const bool not_oop = false;
return generate_disjoint_copy(sizeof (java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 28
}
// Arguments:
// aligned - true => Input and output aligned on a HeapWord == 8-byte boundary
// ignored
// name - stub name string
//
// Inputs:
/
// c_rarg1 - destination array address
count,treated as ssize_t, can be zero
//
// If 'from' and/or 'to' are aligned on 4-, 2-, or 1-byte boundaries,
// we let the hardware handle it. The one to eight bytes within words,
// dwords or qwords that span cache line boundaries will still be loaded
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
* char) java.lang.StringIndexOutOfBoundsException: Index 73 out of bounds for length 73
return generate_conjoint_copy(java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
// Arguments:
// aligned - true => Input and output aligned on a HeapWord == 8-byte boundary
// ignored
// name - stub name string
//
// c_rarg0 - source array address
// c_rarg1 - destination array address
// c_rarg2 - element count, treated as ssize_t, can be zero
//
// If 'from' and/or 'to' are aligned on 4- or 2-byte boundaries, we: java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
}
// or qwords that span cache line boundaries will still be loaded
// and stored atomically.
//
// Side Effects:
//disjoint_short_copy_entry to no-verlappoint
// used by generate_conjoint_short_copy().
//
address generate_disjoint_short_copy(bool aligned,
const bool not_oop = false;
return generate_disjoint_copy(sizeof (jshort), aligned, not_oop, entry, name
}
// Arguments:
// aligned - true => Input and output aligned on a HeapWord == 8-byte boundary
// ignored
// name - stub name string
//
// Inputs:
// c_rarg0 - source array address
// c_rarg1 - destination array address
// c_rarg2 - element count, treated as ssize_t, can be zero
//
// If 'from' and/or 'to' are aligned on 4- or 2-byte boundaries, we
// let the hardware handle it. The two or four words within dwords
// or qwords that span cache line boundaries will still be loaded
// and stored atomically.
//
address generate_conjoint_short_copy(bool aligned, address
*entry,constchar*name{
const bool not_oop = false;
return generate_conjoint_copy(sizeof (jshort), aligned, not_oop, nooverlap_target, entry, name);
}
// Arguments:
// aligned - true => Input and output aligned on a HeapWord == 8-byte boundary
java.lang.StringIndexOutOfBoundsException: Range [24, 25) out of bounds for length 24
// name - stub name string
//
// Inputs:
// c_rarg0 - source array address address start=__ pc(;
// c_rarg1 - destination array address
// c_rarg2 - element count, treated as ssize_t, can be zero
//
// If 'from' and/or 'to' are aligned on 4-byte boundaries, we let
// the hardware handle it. The two dwords within qwords that span
/ cache line boundaries will still be loaded and stored atomically.
//
// Side Effects:
// disjoint_int_copy_entry is set to the no-overlap entry point
// used by generate_conjoint_int_oop_copy().
//
address generate_disjoint_int_copy(bool _sub(,d,);
const * name,bool dest_uninitialized =false java.lang.StringIndexOutOfBoundsException: Index 89 out of bounds for length 89
const bool not_oop = DecoratorSet decorators = I ;
return generate_disjoint_copy(sizeof (jint), aligned, not_oop,decorators = IS_DEST_UNINITIALIZED
}
// Arguments:
// aligned - true => Input and output aligned on a HeapWord == 8-byte boundary
// ignored
// name - stub name string
//
// Inputs:
// c_rarg0 - source array address
// c_rarg1 - destination array address// save regs before copy_memory
/ elementcount as , bezero
//
// If 'from' and/or 'to' are aligned on 4-byte boundaries, we let
// the hardware handle it. The two dwords within qwords that span
// cache line boundaries will still be loaded and stored atomically.
//
address generate_conjoint_int_copy(bool aligned, address nooverlap_target,
* const char* ,
dest_uninitialized = ) java.lang.StringIndexOutOfBoundsException: Index 71 out of bounds for length 71
const bool not_oop = false;
return generate_conjoint_copy( }
}
// Arguments:
// aligned - true => Input and output aligned on a HeapWord boundary == 8 bytes (size, d, count, t2);
// ignored
// name - stub name string-arraycopy_epilogue(masm, decorators is_oop,,, ,RegSet)java.lang.StringIndexOutOfBoundsException: Index 78 out of bounds for length 78
//
/
// c_rarg0 - source array address
// c_rarg1 - destination array address
// c_rarg2 - element count, treated as size_t, can be zero
//
// Side Effects:
// disjoint_oop_copy_entry or disjoint_long_copy_entry is set to the
// no-overlap entry point used by generate_conjoint_long_oop_copy().
//
address generate_disjoint_long_copy/
// c_rarg0 - source array address
const bool not_oop = false;
return generate_disjoint_copy(sizeof (jlong, aligned, not_oop entry, name);
}
// Arguments:
// aligned - true => Input and output aligned on a HeapWord boundary == 8 bytes
// ignored
// name - stub name string
//
// Inputs:
// c_rarg0 - source array address
// c_rarg1 - destination array address
// c_rarg2 - element count, treated as size_t, can be zero
//
address // If 'from' and/or 'to' are aligned-or 1byte boundaries
/ let hardwarehandle. one to bytes words,
const / dwords spancache line still loaded
const bool not_oop
return generate_conjoint_copy
}
// Arguments:
// aligned - true => Input and output aligned on a HeapWord boundary == 8 bytes
// ignored
// name - stub name string
//
// Inputs:
// c_rarg0 - source array address
// c_rarg1 - destination array address
// c_rarg2 - element count, treated as size_t, can be zero
//
// Side Effects:
// disjoint_oop_copy_entry or disjoint_long_copy_entry is set to the
// no-overlap entry point used by generate_conjoint_long_oop_copy().
//
address generate_disjoint_oop_copy(bool aligned, java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 39
// c_rarg2 - element count, treated as ssize_t, can be zero
const bool is_oop = true;
const size_t size = UseCompressedOops ? sizeof (jint) : sizeof (jlong);
// we let the hardware handle it. The one to eight bytes within words,
/ dwords or qwords that span cache line boundaries will still be loaded
// Arguments:
// aligned - true => Input and output aligned on a HeapWord boundary == 8 bytes
// ignored
// name - stub name string
//
// Inputs:
// c_rarg0 - source array address
// c_rarg1 - destination array address
// c_rarg2 - element count, treated as size_t, can be zero
//
address generate_conjoint_oop_copy(bool
address nooverlap_target, // aligned - true => Input and output aligned on a HeapWord ==boundary
const char* name, bool dest_uninitialized // name - stub name string
const bool is_oop = true;
const size_t // c_rarg2 - element count, treated as ssize_t, can be zero
return generate_conjoint_copy(size, aligned, is_oop, nooverlap_target//java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
name, dest_uninitialized);// and stored atomically.
}
// Helper for generating a dynamic type check.
// Smashes t0, t1.
void generate_type_check( ( aligned,
,
Register super_klass,
Label& java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 31
java.lang.StringIndexOutOfBoundsException: Range [31, 30) out of bounds for length 75
BLOCK_COMMENT
Label L_miss;
__ java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 33
java.lang.StringIndexOutOfBoundsException: Index 93 out of bounds for length 93
// Fall through on failure!
__ BIND(L_miss);
}
//
// Generate checkcasting array copy stub
//
// Input:
// c_rarg1 - destination array address
// c_rarg2 - element count, treated as ssize_t, can be zero
// c_rarg3 - size_t ckoff (super_check_offset)
// c_rarg4 - oop ckval (super_klass)
//
// Output:
// x10 == 0 - success
// x10 == -1^K - failure, where K is partial transfer count
//
address generate_checkcast_copy(java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 3
bool
// ignored
// Input registers (after setup_arg_regs)
const Register from// c_rarg0 - source array address
const Register to = c_rarg1; // destination array address// c_rarg2 - element count, treated as ssize_t, can be zero
const Register count = c_rarg2; // elementscount
const Register ckoff = c_rarg3; // super_check_offset
const Register ckval = c_rarg4;//
RegSet wb_pre_saved_regs = RegSet::range(c_rarg0, c_rarg4);
RegSet wb_post_saved_regs = RegSet::of
// Registers used as temps (x7, x9, x18 are save-on-entry)
constcount_savex19
const Register start_to = x18; // destination array start address
constRegister copied_oop ; // actual oop copied
const Register r9_klass = x9; // oop._klass
//---------------------------------------------------------------
// Assembler stub will be used for this call to arraycopy
// if the two arrays are subtypes of Object[] but the
// destination array type is not equal to or a supertype
// of the source type. Each element must be separately
// checked.
assert_different_registers// c_rarg2 - element count, treated as ssize_t, can be zero
java.lang.StringIndexOutOfBoundsException: Range [0, 41) out of bounds for length 4
__ align(CodeEntryAlignment// cache line boundaries will still be loaded and stored atomically.
tubCodeMark(this,"name;
address start = _ address generate_conjoint_int_copy aligned, address nooverlap_target,
__(;/ requiredforproper stackwalkingofRuntimeStub frame
// Caller of this entry point must set up the argument registers.
if (entry != NULL) {
*entry = __ pc();
BLOCK_COMMENT("Entry:");
// Empty array: Nothing to do
__ beqz(count
__ push_reg(egSet:( ,x19,sp;
#ifdef ASSERT
BLOCK_COMMENT("assert consistent ckoff/ckval");
// The ckoff and ckval must be mutually consistent,
// even though caller generates both.
{ Label// c_rarg1 - destination array address
int sco_offset = in_bytes(Klass::super_check_offset_offset());
__ lwu / Side Effects:
__ beq(ckoff, start_to, L);
__stopsuper_check_offset inconsistent";
__ bind(L);
}
#endif //ASSERT
AYCOPY_CHECKCAST | ARRAYCOPY_DISJOINT
bool is_oop = true;
java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
| IS_DEST_UNINITIALIZED
}
BarrierSetAssembler *bs
bs->java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 15
// save the original count
__ mv(count_save, count);
// Copy from low to high addresses
__ puts:
__ j(L_load_element);
// ======== begin loop ========
// (Loop is rotated; its entry is L_load_element.)
// Loop control:
// for count to 0 do
// copied_oop = load_heap_oop(from++)
// ... generate_type_check ...
// store_heap_oop(to++, copied_oop)
// end
_ (OptoLoopAlignment)java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
_)java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
__ store_heap_oop(Address( const = false;
_ add(to,to,UseCompressedOops 4:8;
__ subjava.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
__ beqz(count, / aligned - true => Input and output aligned on a HeapWord boundary == 8 bytes
// ======== loop entry is here ========
__ load_heap_oopjava.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
__ add(from, // c_rarg2 - element
__ beqz(copied_oop, L_store_element);
__ disjoint_long_copy_entry tothe
generate_type_check(// no-overlap entry point
// ======== end loop ========
/java.lang.StringIndexOutOfBoundsException: Index 75 out of bounds for length 75
// Register count = remaining oops, count_orig = total oops.
// Emit GC store barriers for the oops we have copied and report
// their number to the caller.
__ sub(count, count_save is_oop true
_xoricount, 1;// (-1^) caller
__ beqz(count, L_done_pop);
__ BIND(L_do_card_marks);
bs->arraycopy_epilogue(_masm, decorators, is_oop
__ bind(L_done_pop);
__ pop_reg(RegSet::of(x7, x9, x18, x19) / name- stub name string
inc_counter_np(SharedRuntime::_checkcast_array_copy_ctr);
__ bind(L_done);
__ mv -destination address
__ leave()
__ ret();
return start;
}
/ Perform range checks on the proposed arraycopy.
// Kills temp, but nothing else.
// Also, clean the sign bits of src_pos and dst_pos.
src// source array oop (c_rarg0)
Register src_pos, // source position (c_rarg1)
Register dst, // destination array oo (c_rarg2)
Register dst_pos, // destination position (c_rarg3)
Register length,
Register Register ,
Label& L_failedRegister super_check_offset,
BLOCK_COMMENT("arraycopy_range_checks:");
assert_different_registers(t0Label& L_success java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
// if [src_pos + length > arrayOop(src)->length()] then FAIL
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Range [12, 11) out of bounds for length 35
_java.lang.StringIndexOutOfBoundsException: Range [37, 36) out of bounds for length 93
// if [dst_pos + length > arrayOop(dst)->length()] then FAIL)
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
__ addw(temp, length, dst_pos);
__ bgtu(temp, t0, L_failed);
// Have to clean up high 32 bits of 'src_pos' and 'dst_pos'.
__ zero_extend(src_pos, src_pos, 32);
__ zero_extend(dst_pos, dst_pos, 32);
BLOCK_COMMENT( // c_rarg1 - destination array address
}
//
// Generate 'unsafe' array copy stub
// Though just as safe as the other stubs, it takes an unscaled
// size_t argument instead of an element count.
//
// Input:
// c_rarg0 - source array address
/ c_rarg1 -destination array address
// c_rarg2 - byte count, treated as ssize_t, can be zero
//
// Examines the alignment of the operands and dispatches
// to a long, int, short, or byte copy loop.
//
address generate_unsafe_copy(const char* LabelL_load_element,L_store_element, L_do_card_marks, L_done, L_done_pop;
address java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 0
short_copy_entry,
address int_copy_entry,
assert_cond(byte_copy_entry != ;
int_copy_entry =NULL& != NULLjava.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 67
Label L_long_aligned, L_int_aligned, L_short_aligned;
const Register s = RegSet:c_rarg0,c_rarg4)
_java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
StubCodeMark mark(this, " // orig elementscount
start=_ pc);
__ enter(); // required for proper stackwalking of RuntimeStub frame
// bump this on entry, not on exit:
inc_counter_np(SharedRuntime::_unsafe_array_copy_ctr);
__ orr(t0, s, d);
__ orr(t0, t0, count);
__ andi(t0, t0, // destination array type is equaltoor
__ beqz(t0, L_long_aligned);
__ andi(t0, t0, BytesPerInt - 1);
_ (0 L_int_aligned
__ copied_oop,r9_klass );
__ _align(;
__ j(RuntimeAddress , "java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
__ BIND(L_short_aligned);
__ srli(count, count, LogBytesPerShort // Caller of this entry point must set up the argument registers.
__ j(RuntimeAddress(short_copy_entry));
__ BIND(L_int_aligned "ntry";
__ srli(java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
__ j(RuntimeAddress(nt_copy_entry);
__ BIND(L_long_aligned);
__ srli(count, count, LogBytesPerLong); // size => long_count
(;
return start;
}
//
// Generate generic array copy stubs// The ckoff and ckval must be mutually consistent,
//
// Input:
// c_rarg0 - src oop
// c_rarg1 - src_pos (32-bits)
// c_rarg2 - dst oop
// c_rarg3 - dst_pos (32-bits)
/ - count (32-bits)
//
// Output:
// x10 == 0 - success
// x10 == -1^K - failure, where K is partial transfer count
//
address generate_generic_copy(#endif //ASSERT
address byte_copy_entry, address short_copy_entry,
oop_copy_entry
long_copy_entry ) java.lang.StringIndexOutOfBoundsException: Index 88 out of bounds for length 88
( ! &&short_copy_entry=NULL&java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70
int_copy_entry != NULL &java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
long_copy_entry != NULL && checkcast_copy_entry != NULL);
Label bs->arraycopy_prologue_,decorators,is_oop,from to count,wb_pre_saved_regs);
Label L_copy_bytes, L_copy_shorts, L_copy_ints, L_copy_longs;
// save the original count
const Register src = c_rarg0; / source array oop
//Copy low high addresses
_mvstart_to,to;// Savedestinationstart address
Register // destination position
const
// Registers used as temps
_ align();
StubCodeMark mark(this, "StubRoutines", name);
address start = __ pc();
__ enter(); // required for proper stackwalking of RuntimeStub frame
// bump this on entry, not on exit:
inc_counter_np(SharedRuntime::_generic_array_copy_ctr);
//-----------------------------------------------------------------------
// Assembler stub will be used for this call to arraycopy
// if the following conditions are met:
/
// (1) src and dst must not be null.
// (2) src_pos must not be negative.
// (3) dst_pos must not be negative.
// (4) length must not be negative.
// (5) src klass and dst klass should be the same and not NULL.// ======== loop entry is here ========
// (6) src and dst should be arrays. _copied_oop (rom noreg, ); // load the oop
// (7) src_pos + length must not exceed length of src.
// (8) dst_pos + length must not exceed length of dst.
//
/
__ beqz(src, L_failed);
// if [src_pos < 0] then return -1
// i.e. sign bit set
__ andi U <<31)
__ bnez(t0, // Register count ,count_orig total oops.
// if [dst == NULL] then return -1
__ beqz(dst, L_failed);
// if [dst_pos < 0] then return -1_java.lang.StringIndexOutOfBoundsException: Range [12, 11) out of bounds for length 75
// i.e. sign bit set
__ andi(t0, dst_pos, 1UL <java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
__ bnezt0 L_failed);
// registers used as temp
am, ,,java.lang.StringIndexOutOfBoundsException: Range [75, 74) out of bounds for length 100
const Register _ bindL_done_pop)java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
const Register lh = x30; // layout helper
// if [length < 0] then return -1
__ addw(scratch_length, length, zr); // length (elements count, 32-bits value)
// i.e. sign bit set
__ andi(t0, scratch_length, 1UL << 31);
__ bnez(t0, L_failed);
__ load_klass(scratch_src_klass, src);
#ifdef ASSERT
{
BLOCK_COMMENT("assert/
Label L1, L2;
_, L2); // it is broken if klass is NULL
__ bind(L1);
__ stop("broken null klass");
__ (L2;
__ load_klass(t0, dst, t1);
__ beqz(t0, L1); // this would be broken also
BLOCK_COMMENT("} assert klasses not null done");
}
#endif
// Load layout helper (32-bits)
//
// |array_tag| | header_size | element_type | |log2_element_size|
// 32 30 24 16 8 2 0
//
// array_tag: typeArray = 0x3, objArray = 0x2, non-array = 0x0
//
const int lh_offset = in_bytes(Klass::
/
const jint objArray_lh _ addw(, length, );
__ lw(lh, Address(scratch_src_klass,lh_offset));
__ mvw(t0, objArray_lh);
__ beq(lh, t0, L_objArray);
// if [src->klass() != dst->klass()] then return -1
__ load_klass(t1, dst);
__ bne(t1, scratch_src_klass, L_failed);
// if [src->is_Array() != NULL] then return -1
// i.e. (lh >= 0)
_ / Have to clean up high 32 bits of 'src_pos' and 'dst_pos'.
__ beqz(t0,L_failed;
// At this point, it is known to be a typeArray (array_tag 0x3).
#ifdef ASSERT
{
BLOCK_COMMENT("assert primitive array {");
Label L;
__ mvw//
__ bge(lh, t1, L);
__ stop("must be a primitive array");
__ ind(L);
BLOCK_COMMENT("} assert primitive array done");
}
#endif
arraycopy_range_checks(src, src_pos, dst // c_rarg1 - destination array address
t1,L_failed);
// TypeArrayKlass
//
// src_addr = (src + array_header_in_bytes()) + (src_pos << log2elemsize)
// dst_addr = (dst + array_header_in_bytes()) + (dst_pos << log2elemsize)
//
const Register t0_offset = t0; // array offset
const Register x22_elsize = lh; // element size
// Get array_header_in_bytes()
int lh_header_size_width = exact_log2(Klass::_lh_header_size_mask + 1);
int lh_header_size_msb = Klass::_lh_header_size_shift + lh_header_size_width;
address long_copy_entry) {
__ srli(t0_offset, t0_offset, XLEN - lh_header_size_width); // array_offset
__ add(src, src, t0_offset); // src array offset
_ add(dst, dst,t0_offset); // dst array offset
BLOCK_COMMENT("choose copy loop based on BLOCK_COMMENT("choose copy loop based on element;
// next registers should be set before the jump to corresponding stub
constfrom ;
const Register to = c_rarg1; // destination array address
const Register count = c_rarg2; // elements count
// 'from', 'to', 'count' registers should be set in such order
// since they are the same as 'src', 'src_pos', 'dst'.
assert(Klass::_lh_log2_element_size_shift == 0, "fix thisjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
elsize are 0-3, ie exact_log2(element
// size in bytes). We do a simple bitwise binary search.
__(L_copy_bytes
_ andit0,x22_elsize, 2)
__ java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
__t0 x22_elsize 1;
__ bnez(t0, L_copy_shorts);
_ _ andi(t0,,BytesPerInt 1)java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
_ addto, dst dst_pos); // dst_addr
__ addw(count, scratch_length, zr); // length
__ j(RuntimeAddress(byte_copy_entry));
_(0)java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
__ shadd(from, src_pos, src, t0, 1) _ BINDL_short_aligned);
__ shadd(to, dst_pos, dst, t0, 1); // dst_addr
__ addw(count _ srlicount, count LogBytesPerShort); // size => short_count
__ j(RuntimeAddress(short_copy_entry)) _ j(RuntimeAddress();
__ BIND(L_copy_ints);
__ andi(t0, x22_elsize, 1);
__ _ srli(ount, count, LogBytesPerInt; // size => int_count
__ shadd(from, src_pos, src, t0, 2); // src_addr
__ shadd(to, dst_pos, dst, t0, 2); // dst_addr
__ __ srli, count LogBytesPerLong; // size => long_count
__j((int_copy_entry;
__ BINDL_copy_longs);
#ifdef ASSERT
{
BLOCK_COMMENT("
Label L;
__ andi(lh, lh, Klass (32bits
__ addw(lh, lh, zr);
/
/
__"belong copy,butelsize iswrong";
__ bind(L java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4
BLOCK_COMMENT("} assert long copy done");
}
#endif
__ shadd(from, src_pos, src, t0, 3); address long_copy_entry, address checkcast_copy_entry) {
__ shadd(to, dst_pos,nt_copy_entry != & ! &&
__ addw(count, !N ! )
__ j(RuntimeAddress(long_copy_entry)java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
// ObjArrayKlass
__ BIND(L_objArray);
// live at this point: scratch_src_klass, scratch_length, src[_pos], dst[_pos]
Label L_plain_copy, L_checkcast_copy;
// test array classes for subtyping
__ const Register =c_rarg5
__ );
// Identically typed arrays can be copied without element-wise checks.
arraycopy_range_checks(src, src_pos, dst, dst_pos, addressstart = __ pc();
t1, L_failed);
__ shadd(from, src_pos, src,java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
__ add( inc_counter_np(::_);
__ shadd(to
_ addto,to, arrayOopDesc:base_offset_in_bytes());
__ addw(count, scratch_length, zr); // Assembler stub will be used for this call to arraycopy
__ BIND(L_plain_copy);
__ j(RuntimeAddressjava.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
__ BIND(L_checkcast_copy);
// live at this point: scratch_src_klass, scratch_length, t2 (dst_klass)
{
// Before looking at dst.length, make sure dst is also an objArray.
__ // (7) sjava.lang.StringIndexOutOfBoundsException: Range [19, 18) out of bounds for length 58
__ mvw(t1, objArray_lh);
__ bne(t0, t1, L_failed);
// It is safe to examine both src.length and dst.length.
arraycopy_range_checks(src, src_pos /
t2, L_failed);
__ load_klassjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
// Marshal the base address arguments now, freeing registers.
_ from,src_pos src,t0,LogBytesPerHeapOop;
__ add(from, from, arrayOopDesc::base_offset_in_bytes(T_OBJECT));
__ shadd/java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
__ add(to, to, arrayOopDesc::base_offset_in_bytes(T_OBJECT));
__ addw // if [dst_pos < 0] then return -1
const // i.e. sign bit set
assert_different_registers,to ,,
dst_klass, scratch_src_klass);
// Generate the type check.
const int sco_offset // registers used as
(dst_klass, sco_offset)java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
// Smashes t0, t1constlh =x30
generate_type_checkjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
klass from header.
int ek_offset = in_bytes(ObjArrayKlass::java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 24
__ ld(dst_klass, Address(dst_klass, ek_offset));
__ lwu(sco_temp, Address(dst_klass, sco_offsetjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
// the checkcast_copy loop needs two extra arguments:
assertCBLOCK_COMMENTassert klassesnull {)java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
// Set up arguments for checkcast_copy_entry.
__ mv(c_rarg4, dst_klass); // dst.klass.element_klass
__ j(RuntimeAddress(checkcast_copy_entry));
}
__ BIND(L_failed);
__ mv(x10, -1);
__ leave(); // required for proper stackwalking of RuntimeStub frame
__ ret(;
return#ndif
}
/java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4
// Generate stub for array fill. If "aligned" is true, the
// "to" address is assumed to be heapword aligned.
//
// Arguments for generated stub:
// to: c_rarg0
// value: c_rarg1
// count: c_rarg2 treated as signed
//
address
__ align(CodeEntryAlignment);
StubCodeMark mark(this, "StubRoutines", name);
address start = __ pc();
BLOCK_COMMENT
; // source array address
const Register value = c_rarg1; // value
const_( );
const Register bz_base = x28; // base for block_zero routine
const Register cnt_words = x29; // temp register
const
__ enter();
Label L_fill_elements, L_exit1;
int shift = -1 /java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68
switch (t) {
case(" primitive ")
shift = 0;
// Zero extend value
// 8 bit -> 16 bit
__ andi(value, value, 0xff);
__ mv(tmp_reg,
/ TypeArrayKlass
__ orr(value, value, tmp_reg);
// 16 bit -> 32 bit
__ slli(tmp_reg, tmp_reg const =t0java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
__ orr(value, java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 0
/ Short <8bytes) fill by element
__ bltu(count, tmp_reg, L_fill_elements);
break;
case T_SHORT:
shift=;
// Zero extend value
// 16 bit -> 32 bit
__ andi(value, value, 0xffff);
__(mp_reg, value;
__ slli(tmp_reg, tmp_reg, 16// dst array offset
__ orr(value, value, tmp_reg);
// Short arrays (< 8 bytes) fill by element
__ mv(tmp_reg, 8 >> shift);
__ bltu(count, tmp_reg, L_fill_elements);
break;
case T_INT:
shift = 2;
// Short arrays (< 8 bytes) fill by element
__ mv(tmp_reg, 8 >> shift);
__ bltu(count, tmp_reg, L_fill_elements);
break;
default: ShouldNotReachHere();
}
// Align source address at 8 bytes address boundary.
Label L_skip_align1, L_skip_align2, L_skip_align4;
java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
switch (t) {
case T_BYTE:
// One byte misalignment happens only for byte arrays.
__ andi(t0, to_ andit0 x22_elsize, 1)
_ ( L_skip_align1;
__ sb(value, Address(to, 0));
__ addi(to, to, 1);
_ __addto, dst, dst_pos;// dst_addr
_ bind(L_skip_align1)
// Fallthrough
case T_SHORT:
// Two bytes misalignment happens only for byte and short (char) arrays.
__ shadd(, src_pos, src, t0, 1); // src_addr
__ beqz(t0, L_skip_align2);
__sh( Address(to,0);
__ addi(to, to, 2);
_>> shift));
__ bind(L_skip_align2);
// Fallthrough
case T_INT:
// Align to 8 bytes, we know we are 4 byte aligned to start.
__ andi(t0, to, 4);
__ beqz(t0, L_skip_align4);
__ sw_ bnezt0, L_copy_longs);
__ addi(to, to, 4);
_ addiw(count , -(4 >> shift);
lign4;
break;
: ShouldNotReachHere();
}
}
//
// Fill large chunks
//
__ srliw(cnt_words, java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 13
//32 bit-64bit
__ andi(value, value, 0xffffffff);
__ mv(tmp_reg, value);
__ slli(tmp_reg, tmp_reg, 32);
__ orr(value, value, tmp_reg);
_ sllitmp_reg,, cnt_words,3 -shift;
__ subw(count, count, tmp_reg);
{
_fill_words(to,cnt_words, alue;
}
// Remaining count is less than 8 bytes. Fill it by a single store.
// Note that the total length is no less than 8 bytes.
if (t == T_BYTE || t == T_SHORT) {
_ beqz(countL_exit1)java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
__ shadd(to, count, to, tmp_reg, shift); // points to the end
__sdvalue, Address(to -)); // overwrite some elements
__ bind(L_exit1);
_ leave);
__ ret();
}
// Handle copies less than 8 bytes.
_ j(RuntimeAddress(long_copy_entry));
__ bind(L_fill_elements);
switch (t) {
case T_BYTE:
(t0, count,1;
__ beqz(t0, L_fill_2);
__ sb(value, Address(to, 0));
__ addi(to, to, 1);
__ bind(L_fill_2);
__ andi(t0, count, 2);
__ beqz(t0, L_fill_4);
__ sh(value, Address(to, 0));
__ addi(to, to, 2);
__ bind(L_fill_4);
__ andi(t0, count, 4);
__ beqz(t0 typed canbe elementwise .
_sw(value Address(,0)
break;
case T_SHORT:
__ andi(t0, count, 1);
__ beqz(t0, L_fill_4);
__ sh(value, Address(to, 0));
);
__ bind(L_fill_4);
__ andi(t0, count, 2);
__ beqz(t0, L_exit2);
_ sw(value, Address(to, 0));
break;
case T_INT:
__ beqz(count, L_exit2);
__ sw(value, Address(to, 0));
break;
default L_checkcast_copy
}
_ (L_exit2);
__ leave();
__ ret();
return start;
}
() {
address __ bne(t0_(t0 );
address entry_jbyte_arraycopy = NULL;
address entry_jshort_arraycopy = NULL;
address entry_jint_arraycopy = NULL;
address entry_oop_arraycopy = NULL;
address entry_jlong_arraycopy = NULL;
address _ (fromfrom :T);
generate_copy_longs(copy_f, c_rarg0, c_rarg1, t1, copy_forwards);
(copy_b, c_rarg0, c_rarg1, t1, copy_backwards);
StubRoutines::riscv::_zero_blocks = generate_zero_blocks(); _ (ount , zr) // length (reloaded)
//*** jbyte
// Always need aligned and unaligned versions
StubRoutines::_jbyte_disjoint_arraycopy = generate_disjoint_byte_copy(false, &entry,
"jbyte_disjoint_arraycopy");
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
&entry_jbyte_arraycopy,
"jbyte_arraycopy");
:_ =(, &,
"arrayof_jbyte_disjoint_arraycopy");
StubRoutines:_ java.lang.StringIndexOutOfBoundsException: Range [83, 82) out of bounds for length 101
"arrayof_jbyte_arraycopy"java.lang.StringIndexOutOfBoundsException: Index 110 out of bounds for length 110
//*** jshort
// Always need aligned and unaligned versions
StubRoutines::_java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 5
"jshort_disjoint_arraycopy");
_leave(; // required for proper stackwalking of RuntimeStub frame
(;
}
java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 0
"arrayof_jshort_arraycopy");
//*** jint
// Aligned versions
StubRoutines::_arrayof_jint_disjoint_arraycopy = generate_disjoint_int_copy(true, &entry,
"arrayof_jint_disjoint_arraycopy");
StubRoutines::_arrayof_jint_arraycopy = generate_conjoint_int_copy(true, entry, &entry_jint_arraycopy,
;
// In 64 bit we need both aligned and unaligned versions of jint arraycopy.":");
// entry_jint_arraycopy always points to the unaligned version
StubRoutines::_ const Register to = c_rarg0; / array
;
StubRoutines::_jint_arraycopy = generate_conjoint_int_copy(false, entry,
&entry_jint_arraycopy,
Register x29// temp register
//*** jlong
Label L_fill_elements,L_exit1java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
StubRoutines::_arrayof_jlong_disjoint_arraycopy = java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 19
(t) {
StubRoutines::_arrayof_jlong_arraycopy = generate_conjoint_long_copy(true, entry, &entry_jlong_arraycopy,
");
StubRoutines:
StubRoutines::_jlong_arraycopy = StubRoutines::_arrayof_jlong_arraycopy
//*** oops
{
// With compressed oops we need unaligned versions; notice thatmvtmp_reg, ;
// we overwrite entry_oop_arraycopy.
bool aligned = !UseCompressedOops;
StubRoutines::_arrayof_oop_disjoint_arraycopy
= generate_disjoint_oop_copy(aligned, &entry, "arrayof_oop_disjoint_arraycopy",
/*dest_uninitialized*/false);
StubRoutines::_arrayof_oop_arraycopy
= generate_conjoint_oop_copy(aligned, entry, &entry_oop_arraycopy, "arrayof_oop_arraycopy",
/*dest_uninitialized*/false);
// Aligned versions without pre-barriers __ mv(tmp_reg 8 >> shift);// Short arrays (< 8 bytes) fill by element
StubRoutines::_rrayof_oop_disjoint_arraycopy_uninit
= generate_disjoint_oop_copy(aligned, &entry, "arrayof_oop_disjoint_arraycopy_uninit",
/*dest_uninitialized*/true);
StubRoutines::_arrayof_oop_arraycopy_uninit
= generate_conjoint_oop_copy(aligned, entry, NULL, "arrayof_oop_arraycopy_uninit",
/*dest_uninitialized*/true);
}
:java.lang.StringIndexOutOfBoundsException: Range [53, 41) out of bounds for length 101
_op_arraycopy =:_arrayof_oop_arraycopyjava.lang.StringIndexOutOfBoundsException: Index 92 out of bounds for length 92
StubRoutines::_oop_disjoint_arraycopy_uninit = StubRoutines / Short arrays (< 8 bytes) fill by element
StubRoutines: __ 8> shift;
StubRoutines::_checkcast_arraycopy = generate_checkcast_copy("java.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 14
java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 0
/*dest_uninitialized*/true);
StubRoutines::_unsafe_arraycopy = generate_unsafe_copy("unsafe_arraycopy",
:ShouldNotReachHere();
entry_jshort_arraycopy,
entry_jint_arraycopy,
java.lang.StringIndexOutOfBoundsException: Index 79 out of bounds for length 19
generic_arraycopy =generate_generic_copy(generic_arraycopy",
entry_jbyte_arraycopy,
entry_jshort_arraycopy,
entry_jint_arraycopy,
entry_oop_arraycopy,
,
entry_checkcast_arraycopy);
StubRoutines::_jbyte_fill = generate_fill(T_BYTE, false, "jbyte_fillandit0, );
: =(,false j")
StubRoutines::_jint_fill _ shvalue Address(to,0)java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
StubRoutines addiw(,count, ( > )
StubRoutines::_ __ bind(L_skip_align2
StubRoutines::_arrayof_jint_fill = generate_fill(T_INT, caseT_INT:
}
// code for comparing 16 bytes of strings with same encoding
void compare_string_16_bytes_same_swvalue,(to,0)
const result=10, str1 cnt1 , x13, =x28 tmp2=,tmp4 =,tmp5 ;
__ addiw,count ( >shiftjava.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
__ addi(str1, str1, 8);
__ xorr(tmp4, tmp1, tmp2);
__ ld(cnt1, Address(str2));
__ addi(str2, str2, 8);
__ bnez(tmp4, DIFF1);
__ ld(tmp1, Address(str1));
__ addi(str1, str1, 8);
__ xorr(tmp4, tmp5, cnt1);
__ ld(tmp2, Address(str2));
__ addi(str2, str2, 8);
);
}
// code for comparing 8 characters of strings with Latin1 and Utf16 encoding
compare_string_8_x_LU(egister tmpL Register , LabelDIFF1,
Label &DIFF2) {
const Register strU = x12, curU = x7, strL = x29, tmp = x30;
__ ld(tmpL, Address(strL));
__ addi(strL, strL, 8);
__ ld(tmpU, Address(java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 0
__ addi(strU, strU, 8);
__ inflate_lo32, tmpL);
__ mv(t0, tmp);
_ xorr(,curU, t0)
__ bnez(tmp, DIFF2_ beqz L_exit1;
__ ld(curU, Address(strU)) _ (to, to,, shift;// points to the end
_ addi, strU 8java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
__ inflate_hi32(tmp, tmpL);
__ mv(t0, tmp);
__ xorr(tmp, tmpU, t0);
__ bnez(tmp, DIFF1);
}
// x10 = result
// x11 = str1
// x12 = cnt1
// x13 = str2
// x14 = cnt2
// x28 = tmp1
// x29 = tmp2
// x30 = tmp3
address generate_compare_long_string_different_encoding(bool isLU) {
__ align(CodeEntryAlignment);
"StubRoutines", isLU ?"compare_long_string_different_encoding LU :"compare_long_string_different_encoding UL");
address entry = __ pc();
Label SMALL_LOOP, TAIL, TAIL_LOAD_16, LOAD_LAST, DIFF1, DIFF2,
DONE, CALCULATE_DIFFERENCE _ addi(to, to,1;
const Register _(t0, ,2java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
tmp1 = x28, tmp2 = x29, tmp3 = x30, tmp4 = x7, tmp5 = x31;
RegSet spilled_regs = RegSet::of(java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 30
// cnt2 == amount of characters left to compare
// Check already loaded first 4 symbols;
__ inflate_lo32(tmp3, isLU ? tmp1 : tmp2);
__ );
__ addi(str1, str1, isLU ? wordSize / 2 : wordSize__ to ,)
__ _ (fill_4
_(cnt2, cnt2,8; 4 . java.lang.StringIndexOutOfBoundsException: Range [74, 73) out of bounds for length 79
__ push_reg(spilled_regs, sp);
if (isLU) {
__ add(str1, str1, cnt2);
__ shadd(str2, cnt2, str2, t0, 1);
} else {
__ shadd(str1, cnt2, str1, t0, 1);
__ add__ L_exit2;
}
_ leave();
__ mv(tmp5, tmp2);
__ bnez(tmp3, CALCULATE_DIFFERENCE);
Register strU = isLU ? str2 : str1,
strL = isLU ? str1 : str2,
tmpU = isLU ? tmp5 : address entry_jshort_arraycopy entry_jshort_arraycopy =NULL;
tmpL = isLU ? tmp1 : tmp5; // where to keep L for comparison
__ addres=java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
__ slli(t0, cnt2, 1);
_ subcnt1, trUt0);// strU pointer to load from
__ ld(tmp4, Address(cnt1));
__ addi(cnt1, cnt1, 8);
__ beqz(cnt2, LOAD_LAST); // no characters left except last load
__ sub(cnt2, cnt2, 16);
__ bltz(cnt2, TAIL);
__ bind(SMALL_LOOP); // smaller loop
__ sub(cnt2, cnt2, 16);
compare_string_8_x_LU(tmpL, tmpU, DIFF1, DIFF2);
compare_string_8_x_LU(tmpL, tmpU, DIFF1, DIFF2);
__ bgez(cnt2, SMALL_LOOP);
_ addi(t0, cnt2 16;
__ beqz(t0, LOAD_LAST &entry_jbyte_arraycopy,
__ bind( "jbyte_arraycopy);
// Address of 8 bytes before last 4 characters in UTF-16 string
_StubRoutines:arrayof_jbyte_disjoint_arraycopygenerate_disjoint_byte_copytruee,
// Address of 16 bytes before last 4 characters in Latin1 string
__ add(tmp2, tmp2, cnt2);
__ ld(tmp4, Address(cnt1, -8StubRoutines:_ =generate_conjoint_byte_copy, entry, ,
// last 16 characters before last load
compare_string_8_x_LU(tmpL, tmpU, DIFF1, DIFF2);
compare_string_8_x_LU(tmpL, tmpU, DIFF1, DIFF2);
__ j(LOAD_LAST);
__ bind(DIFF2);
__ mv(tmpU, tmp4);
_ (DIFF1);
"jshort_disjoint_arraycopy");
__ j(CALCULATE_DIFFERENCE);
__ bind(LOAD_LAST);
StubRoutines:_jshort_arraycopy = generate_conjoint_short_copy(false, entry,
// No need to load it again
__ mv(tmpU, tmp4);
__ ld(tmpL, Address(strL));
__ inflate_lo32(tmp3, tmpL);
__ mv(tmpL, tmp3);
__ xorr(tmp3, tmpU, tmpL);
_ beqz(tmp3, DONE)java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
// Find the first different characters in the longwords and
// compute their difference.
__ bind(CALCULATE_DIFFERENCE);
__ ctzc_bit(tmp4,tmp3);
__ srl(tmp1, tmp1, tmp4);
__ srl(tmp5, java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 0
__ andi(tmp1, tmp1, 0xFFFF);
__ andi(tmp5, tmp5, 0xFFFF);
_ "arrayof_jint_disjoint_arraycopy");
__ bind(DONE);
__ pop_reg(spilled_regs, sp);
__ret();
return entry;
}
address generate_method_entry_barrier() {
__ align(CodeEntryAlignment);
StubCodeMark mark(this, "StubRoutines", "nmethod_entry_barrier") StubRoutines:_ =(alse, &ntry,
Label deoptimize_label;
address start = __ pc();
&entry_jint_arraycopy,
if (bs_asm->nmethod_patching_type() == NMethodPatchingType::"jint_arraycopy");
BarrierSetNMethod* bs_nm = BarrierSet
Address java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
_ la(1 ExternalAddress(bs_asm-patching_epoch_addr());
__ lwu(t1, t1)java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
__ sw(t1, thread_epoch_addr);
(__LoadLoad);
"arrayof_jlong_arraycopy");
__ set_last_Java_frame(sp, fp, ra, t0);
__ enter();
_ t1,, )java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
__ sub(sp, sp, 4 * wordSize);
__ push_call_clobbered_registers(.
__ mv(c_rarg0, t1);
_ java.lang.StringIndexOutOfBoundsException: Range [65, 19) out of bounds for length 97
_(true
__ mv(t0, x10);
__ pop_call_clobbered_registers();
__ bnez(t0, deoptimize_label);
StubRoutines_arrayof_oop_disjoint_arraycopy_uninit
=generate_disjoint_oop_copy(aligned, &entry, "arrayof_oop_disjoint_arraycopy_uninit",
__ BIND(deoptimize_label);
__ StubRoutines::_arrayof_oop_arraycopy_uninit
__ ld= generate_conjoint_oop_copyaligned ,, "",
_ (ra (p wordSize * 2)java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
__ ld(t1, java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 5
_mv(,t0);
__ jr(t1);
return StubRoutines:=StubRoutines::;
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
// x10 = result
// x11 = str1
// x12 = cnt1
// x13 = str2
// x14 = cnt2
// x28 = tmp1
// x29 = tmp2
// x30 = tmp3
// x31 = tmp4
address generate_compare_long_string_same_encoding(bool isLL) {
_ alignCodeEntryAlignment));
StubCodeMark mark(this, "StubRoutines", isLL ?
"compare_long_string_same_encoding ,
address entry = __ pc();
Label java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
LENGTH_DIFF, DIFF, LAST_CHECK_AND_LENGTH_DIFF;
const Register result = x10, str1 = x11, cnt1 = x12, str2 = x13, cnt2 = x14,
tmp1 = x28, tmp2 = x29, tmp3 = x30, tmp4 = x7, tmp5 = x31;
RegSet spilled_regs = RegSet::of(tmp4, tmp5);
// cnt1/cnt2 contains amount of characters to compare. cnt1 can be re-used
// update cnt2 counter with already loaded 8 bytes
__ sub(cnt2, cnt2, wordSize entry_jlong_arraycopy
// update pointers, because of previous read
__ add(str1, str1, wordSize);
__ add(str2, str2, wordSize);
// less than 16 bytes left?
__ sub(cnt2, cnt2, isLL StubRoutines::_short_fill generate_fill(_, false "")
__ ush_regspilled_regs,sp;
__ bltz(cnt2, TAIL);
__ bind(SMALL_LOOP);
compare_string_16_bytes_same(, DIFF2);
__ sub(cnt2, cnt2, isLL ? 16 : 8);
__ bgez(cnt2, SMALL_LOOP);
__ bind(TAIL);
__ addi(cnt2, cnt2, isLL ? 16 : 8);
__ beqz(cnt2, LAST_CHECK_AND_LENGTH_DIFF);
__ // code for comparing 16 bytes of strings with same encoding
__ blez(cnt2, CHECK_LASTvoidcompare_string_16_bytes_same(abel DIFF1Label &IFF2
_ xorr(,tmp1, );
__ bnez(tmp4, DIFF);
_ (,Address(str1);
__ addi(str1, str1, 8);
__ ld(tmp2, Address(str2));
__ addi(str2, str2, 8);
_ sub(cnt2 cnt2,isLL ? 8 : 4);
__ bind(CHECK_LAST);
if !)
_ add(, cnt2,;// now in bytes
}
__ xorr(tmp4, tmp1, tmp2);
__ bnez(tmp4, DIFF);
__ add(str1, str1, cnt2);
__ ld(tmp5, Address(str1));
__ add(str2, str2, cnt2);
__ ld(cnt1, Address(str2));
__ xorr(tmp4, tmp5, cnt1);
__ beqz(tmp4, LENGTH_DIFF);
// Find the first different characters in the longwords and
// compute their difference.
__ bind(DIFF2);
__ ctzc_bit(tmp3, tmp4, isLL); // count zero from lsb to msb
__ srl(void compare_string_8_x_LU(RegistertmpL,Register tmpU, Label &DIFF1,
__ srl(cnt1, cnt1, tmp3);
if (isLL) {
_ );
__ andi(cnt1, cnt1, 0xFF);
}else {
__ andi( _ addis,strL 8);
__ andi(cnt1, cnt1, 0xFFFF);
}
_ subr, tmp5,cnt1)
ENGTH_DIFFjava.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
__ bind(DIFF);
__ ctzc_bit(tmp3, tmp4, isLL); // count zero from lsb to msb
__ srl(tmp1, ld( Address(strU)java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
__ srl(tmp2, tmp2, tmp3 _inflate_hi32,);
if (isLL) {
__ andi(tmp1, tmp1, 0xFF);
__ andi(tmp2, java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 3
} else {
__ andi(tmp1, tmp1, 0xFFFF);
__ andi(tmp2, tmp2, 0xFFFF);
}
__ ub(result, tmp1, tmp2);
__ j(LENGTH_DIFF);
__ bind(LAST_CHECK_AND_LENGTH_DIFF);
__ xorr(tmp4, tmp1, tmp2);
__ bnez(tmp4, DIFF);
__ bind(LENGTH_DIFF);
__ mark(his, "StubRoutines,isLU?compare_long_string_different_encoding LU" : "compare_long_string_different_encoding UL");
__ ret address =__pc()
return;
}
voidgenerate_compare_long_strings() {
StubRoutines::riscv::_compare_long_string_LL = generate_compare_long_string_same_encoding(true);
StubRoutines:riscv:_compare_long_string_UU = generate_compare_long_string_same_encoding(false);
StubRoutines::riscv::_compare_long_string_LU = generate_compare_long_string_different_encoding RegSet = RegSet:oftmp4,tmp5;
StubRoutines::riscv::_compare_long_string_UL = generate_compare_long_string_different_encoding(false);
}
// x10 result
// x11 src
// x12 src count
// x13 pattern
// x14 pattern count
address generate_string_indexof_linear(bool needle_isL, bool haystack_isL)
const char* stubName = needle_isL
(aystack_isL ?"" : "indexof_linear_ul)
_ push_regspilled_regs sp)java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
__ if (isLU){
StubCodeMark (this,"StubRoutines", stubName);
address entry = __ pc();
int needle_chr_size = needle_isL ? 1 : 2;
int haystack_chr_size = haystack_isL ? 1 : 2;
needle_chr_shift = needle_isL ? 0 : 1;
int haystack_chr_shift = haystack_isL ? 0 : 1;
bool isL = needle_isL && haystack_isL }
// parameters
Register result = x10, haystack = x11, haystack_len = x12, needle = x13, needle_len = x14;
// temporary registers
= first=x22,trailing_zeros = x24 tmp=x25;
// redefinitions
Register ch1 = x28, ch2 = x29;
RegSet spilled_regs = RegSet::range(x20, x25) + RegSet::range(x28, x29);
, sp
Label L_LOOP, L_LOOP_PROCEED, L_SMALL, L_HAS_ZERO,
L_HAS_ZERO_LOOP, L_CMP_LOOP, __ sub(tmp2, strL, cnt2); // strL pointer to load fro
L_SMALL_HAS_ZERO_LOOP, L_SMALL_CMP_LOOP_NOMATCH, L_SMALL_CMP_LOOP,
L_POST_LOOP, L_CMP_LOOP_LAST_CMP, L_HAS_ZERO_LOOP_NOMATCH,
L_SMALL_CMP_LOOP_LAST_CMP, L_SMALL_CMP_LOOP_LAST_CMP2 _ (mp4Addresscnt1);
L_CMP_LOOP_LAST_CMP2 _( ;
__ ld _(cnt2 )// no characters left except last load
__ ld(ch2, Address(haystack));
// src.length - pattern.length
__ sub(haystack_len, haystack_len, needle_len);
// first is needle[0]
__ andi(first, ch1, needle_isL_(
uint64_t mask0101 =UCONST64(0x0101010101010101);
uint64_t mask0001 = UCONST64 _ beqz(t0LOAD_LAST)
__ mvmask1 ?mask0101:mask0001)java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
__ mul(first __ (cnt1,cnt2, cnt1, t0 1;
uint64_t mask7f7f = UCONST64(0x7f7f7f7f7f7f7f7f);
uint64_t mask7fff = UCONST64(0x7fff7fff7fff7fff);
__ mv(mask2, haystack_isL _ ld( Addressc, 8)java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
if(eedle_isL != haystack_isL) {
__ mv(tmp, ch1);
}
bhaystack_len, haystack_len, wordSize / haystack_chr_size - 1);
__ blez(haystack_len_bind(DIFF2);
if (needle_isL != haystack_isL) {
__ _ (tmpL, t0;
}
// xorr, sub, orr, notr, andr
/
// eg:
// first: aa aa aa aa aa aa aa aa
// ch2: aa aa li nx jd ka aa aa
// match_mask: 80 80 00 00 00 00 80 80
__ compute_match_mask(ch2, java.lang.StringIndexOutOfBoundsException: Range [6, 36) out of bounds for length 24
// search first char of needle, if success, goto L_HAS_ZERO;
__ bnez(match_mask, L_HAS_ZERO);
__ sub(haystack_len, haystack_len, wordSize / haystack_chr_size);
_bindCALCULATE_DIFFERENCE
, java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
__ bltz(__srl(tmp5, tmp5, tmp4;
__ bind(L_LOOP);
__ ld(ch2, Address(haystack));
__ compute_match_mask(ch2, first, match_mask, mask1, mask2);
__ bnez(match_mask, L_HAS_ZERO);
__ bind(L_LOOP_PROCEED);
__ sub(haystack_len, haystack_len, wordSize / haystack_chr_size ____(spilled_regs, sp);
__ add(haystack, haystack, wordSize);
__ add(result, result, wordSize / haystack_chr_size);
__ bgez(haystack_len, L_LOOP);
__ bind(L_POST_LOOP);
__ mv(ch2, __align(CodeEntryAlignment);
__ ble(haystack_len, ch2, NOMATCH); // no extra characters to check
__ ld(ch2, Address(haystack));
__ slli(haystack_len, haystack_len, LogBitsPerByte + haystack_chr_shift);
__ neg(haystack_len,haystack_len);
__ xorr(ch2, first, ch2);
__ sub(match_mask, ch2, mask1);
__ orr(ch2, ch2, mask2);
__ mv(trailing_zeros, -1); // all bits set
);
__ align(OptoLoopAlignment);
__ bind(_SMALL)java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
__ , LogBitsPerByte+haystack_chr_shift)java.lang.StringIndexOutOfBoundsException: Index 77 out of bounds for length 77
__ neg(haystack_len, haystack_len);
if (needle_isL != haystack_isL) {
__ inflate_lo32(ch1, tmp, match_mask, trailing_zeros);
}
_xorr(ch2, ,ch2)
__ sub(match_mask _(__ )java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
__ orr(ch2,
_mv( - // all bits set
__ bind(L_SMALL_PROCEED);
__srltrailing_zeros, trailing_zeros, haystack_len); // mask. zeroes on useless bits.
__ notr(ch2, ch2);
__ andr(match_mask,
__ andr(match_mask, match_mask, __sub(sp, sp, 4 * wordSize);
__ beqz(match_mask, NOMATCH);
__ bind(L_SMALL_HAS_ZERO_LOOP);
__ ctzc_bit(trailing_zeros, match_mask _ mv(c_rarg0, t1);
_ trailing_zeros, trailing_zeroshaystack_isL 7 :15)
__ mv(ch2, wordSize / java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 0
__ble( , )java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
_ (, trailing_zeros match_mask, resultch2 tmptmp,haystack_isL);
__ mv(trailing_zeros, wordSize / haystack_chr_size);
__ bne(ch1, ch2, L_SMALL_CMP_LOOP_NOMATCH);
__ java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
__ shadd(first _ ret)java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
__ shadd(ch2, trailing_zeros, haystack, ch2, haystack_chr_shift);
needle_isL ? __ lbu(first, Address(first)) : __ lhu(first, Address(first));
haystack_isL ? __ _ ld, Address(sp );
__ (trailing_zeros, trailing_zeros, 1);
__ bge(trailing_zeros, needle_len, L_SMALL_CMP_LOOP_LAST_CMP);
__ beq(first, ch2, L_SMALL_CMP_LOOP);
_ java.lang.StringIndexOutOfBoundsException: Range [38, 11) out of bounds for length 38
__ beqz(match_mask, NOMATCH);
__ ctzc_bit(trailing_zeros, match_mask, haystack_isL, tmp, ch2
__ addi(trailing_zeros, trailing_zeros, haystack_isL ? 7 : 15);
__ add(result
__ add(haystack, haystack, haystack_chr_size// x11 = str1
__ j(L_SMALL_HAS_ZERO_LOOP);
__ align(OptoLoopAlignment);
__
__ bne(first, address generate_compare_long_string_same_encoding(bool isLL) {
__ j(DONE);
__ align(OptoLoopAlignment);
__ bind(L_SMALL_CMP_LOOP_LAST_CMP2);
__ compute_index(haystack, trailing_zeros, match_mask, result, ch2, tmp, java.lang.StringIndexOutOfBoundsException: Index 81 out of bounds for length 46
__ bne(ch1, ch2, L_SMALL_CMP_LOOP_NOMATCH);
__ align(OptoLoopAlignment);
__ bind(L_HAS_ZERO);
_java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
__ addi(trailing_zeros, trailing_zeros, haystack_isL ? 7 : 15);
__ slli(needle_len, needle_len, BitsPerByte * wordSize / __ (cnt2 ,wordSize // (sLL? 1:));
__ orr(haystack_len, haystack_len, needle_len); // restore needle_len(32bits) // update pointers, because of previous read
__ sub(result, result, 1); // array index from 0, so result -= 1
__(needle_lenwordSize /haystack_chr_size;
__ srli(ch2, haystack_len, BitsPerByte * wordSize / 2);
__ bge(needle_len, ch2, L_CMP_LOOP_LAST_CMP2);
// load next 8 bytes from haystack, and increase result index
__ compute_index(haystack, trailing_zeros, cnt2 isLL 16 8);
_ (esult result, )
__ mv(trailing_zeros, wordSize / haystack_chr_size) _ bindTAIL;
__ bne(ch1, ch2, L_CMP_LOOP_NOMATCH);
// compare one char
__ bind(L_CMP_LOOP);
__ shadd( __ beqz(cnt2);
_ (, (): _ lhuneedle_len,Addressneedle_len);
__ shadd(ch2, trailing_zeros, java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 32
haystack_isL ? __ lbu(ch2, Address(ch2)) : __ lhu(ch2, Address(ch2));
__ add(trailing_zeros, trailing_zeros, 1); _ (tmp1,Address(str1);
_ (tmp, haystack_len, BitsPerByte wordSize / 2);
__ bge(trailing_zeros, tmp, L_CMP_LOOP_LAST_CMP);
__ beq(needle_len, ch2, L_CMP_LOOP);
__ bind(L_CMP_LOOP_NOMATCH _ (nt2cnt2,isLL :4java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
__ beqz(match_mask, L_HAS_ZERO_LOOP_NOMATCH);
__ ctzc_bit(trailing_zeros, match_mask, haystack_isL, needle_len, ch2); // find next "first" char index
__addi(trailing_zeros, trailing_zeros, haystack_isL ? 7 : 15);
__ add(haystack, haystack, haystack_chr_size);
__ j(L_HAS_ZERO_LOOP);
__ align(OptoLoopAlignment);
_ bind(L_CMP_LOOP_LAST_CMP;
__ bne(needle_len, ch2, L_CMP_LOOP_NOMATCH__ (tmp5 Address(str1));
__ j(DONE);
__ align(OptoLoopAlignment);
__ bind(L_CMP_LOOP_LAST_CMP2);
_ (haystack trailing_zerosmatch_mask,, ch2,tmp )
__ add(result, result, 1);
__ bne(ch1, ch2, L_CMP_LOOP_NOMATCH);
__ j(DONE);
__ align(OptoLoopAlignment);
__ bind(L_HAS_ZERO_LOOP_NOMATCH);
// 1) Restore "result" index. Index was wordSize/str2_chr_size * N until
// L_HAS_ZERO block. Byte octet was analyzed in L_HAS_ZERO_LOOP,
// so, result was increased at max by wordSize/str2_chr_size - 1, so,
// respective high bit wasn't changed. L_LOOP_PROCEED will increase
// result by analyzed characters value, so, we can just reset lower bits
// in result here. Clear 2 lower bits for UU/UL and 3 bits for LL
// 2) restore needle_len and haystack_len values from "compressed" haystack_len
// 3) advance haystack value to represent next haystack octet. result & 7/3 is _andi(,tmp5, 0)
/indexof last analyzedsubstring currentoctet ,haystack
// respective start address. We need to advance it to next octet
__ andi(match_mask, result, wordSize / haystack_chr_size - 1);
_bind();
__ andi(result, result, haystack_isL ? -8 : - __ ctzc_bit(tmp3, tmp4,isLL;// count zero from lsb to msb
__ slli(tmp, match_mask, haystack_chr_shift);
__ sub(haystack, __ srl(tmp2, tmp2, tmp3
__ addw(haystack_len, haystack_len, zr);
_ j(L_LOOP_PROCEED);
__ align(OptoLoopAlignment);
__ bind(NOMATCH);
__ mv(result, -1);
__ bind(DONE);
_pop_reg(spilled_regs, sp);
__ ret();
return entry;
}
void generate_string_indexof_stubs()
bindjava.lang.StringIndexOutOfBoundsException: Range [39, 38) out of bounds for length 40
StubRoutines::riscv::_string_indexof_linear_ll = java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 25
StubRoutines::riscv::_string_indexof_linear_uu = generate_string_indexof_linear(false, false);
StubRoutines return;
}
#ifdef COMPILER2
addressgenerate_mulAdd()
{
__ align(CodeEntryAlignment);
mark, "" m";
constRegister =x10;
const Register in = x11;
const Register offset = x12;
const Register len = x13;
const Register k = x14;
const Register tmp = x28;
BLOCK_COMMENT// x13 pattern
enter(;
__ mul_add(out, in, offset, len, k, tmp);
__ leave();
__ ();
returnentryjava.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
}
/**CodeEntryAlignment);
:
*
* java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
* c_rarg0 - x address
*c_rarg1 - xlength
* c_rarg2 - y address
* c_rarg3 - y length
* c_rarg4 - z address
* c_rarg5 - z length
*/
address generate_multiplyToLen()
{
__ align(CodeEntryAlignment);
StubCodeMark mark(this, "StubRoutines", / redefinitions
address = _ )
const Register x = x10;
const Register xlen = x11;
const Register = x12;
const Register ylen = x13;
const Register z = x14;
const Register zlen = x15;
const Register tmp1 = x16;
const L_SMALL_HAS_ZERO_LOOPL_SMALL_CMP_LOOP_NOMATCH,L_SMALL_CMP_LOOPjava.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 76
const Register tmp3 = LAST_CMP,,
constRegister tmp4=x28;
const Register tmp5 = x29;
constRegister tmp6 = x30;
const Register _ ld(ch2 Addresshaystack);
BLOCK_COMMENT("Entry:");
__ enter(); // required for proper stackwalking of RuntimeStub frame
,,,zlen , ,java.lang.StringIndexOutOfBoundsException: Range [85, 72) out of bounds for length 92
__ leave(); // required for proper stackwalking of RuntimeStub frame
__ __ mv, ? mask0101 )java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
returnentry;
}
address generate_squareToLen()
{
__ align(CodeEntryAlignment);
StubCodeMark mark(this, "StubRoutines", "squareToLen_ (mp ch1)java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
addressentry=__pc;
const Register x = x10;
const Register = x11java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
const Register z =x12;
const Register zlen = x13;
const Register y = x14; // == x
const Register ylen = x15; // == xlen
const Register tmp1 = x16;
const Register tmp2 = x17;
const Register tmp3 = x7;
const Register tmp4 = x28;
const Register tmp5 = x29;
const _ compute_match_mask(ch2first match_mask, mask1, mask2);
const Register tmp7 = x31;
BLOCK_COMMENT("Entry:);
__ enter();
__ mv(y, x);
__ mv(ylen, xlen);
__ multiply_to_len(x, xlen, y, ylen, z, zlen, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7);
__ leave();
__ ret();
return entry;
}
// Arguments:
//
// Input:
// c_rarg0 - newArr address
// c_rarg1 - oldArr address
// c_rarg2 - newIdx_ sub(aystack_len, haystack_len /haystack_chr_size);
c_rarg3 - shiftCount
// c_rarg4 - numIter
//
() {
__ align(CodeEntryAlignment);
StubCodeMark__bgezhaystack_len L_LOOP;
address entry = __ pc();
, exit
Register newArr = c_rarg0;
Register oldArr =c_rarg1;
Register newIdx = c_rarg2;
Register shiftCount = c_rarg3;
Register numIter = c_rarg4;
Register shiftRevCount = c_rarg5;
Register oldArrNext = t1;
__ beqz(numIter, exit);
__ shadd( __ j(L_SMALL_PROCEED);
__ mv(shiftRevCount, 32);
__alignOptoLoopAlignment)
_ (loop);
__ addi(oldArrNext, oldArr, 4);
__ vsetvli(t0, numIter, Assembler::e32, Assembler::m4);
__ vle32_v(v0, oldArr);
__vle32_v(v4, oldArrNext);
__ vsll_vx(v0, v0, shiftCount);
__ vsrl_vx(v4, v4, shiftRevCount);
__ vor_vv(v0, v0, v4);
_ vse32_vv0 newArr;
__ sub(numIter, numIter, t0);
__ shadd(oldArr, t0, oldArr, t1, 2);
_ shadd(newArr, t0, newArr, t1, 2);
__ bnez(numIter, loop);
__ bind(exit);
__ ret();
return entry;
}
// Arguments:
//
// Input:
// c_rarg0 - newArr address
// c_rarg1 - oldArr address
// c_rarg2 - newIdx
ftCount
// c_rarg4 - numIter
//
address generate_bigIntegerRightShift() {
__ align(CodeEntryAlignment);
StubCodeMark mark(this, "StubRoutines", "bigIntegerRightShiftWorker");
address entry= __ pc();
Label loop, exit;
_ bleneedle_len,ch2,L_SMALL_CMP_LOOP_LAST_CMP2)
Register oldArr = c_rarg1;
Register newIdx = c_rarg2;
Register shiftCount = c_rarg3;
Register numIter = c_rarg4;
= numIter;
Register shiftRevCount = c_rarg5;
Register oldArrNext = c_rarg6;
Register newArrCur = t0;
Register oldArrCur = t1;
__ beqz(idx, exit);
__ shadd(newArr, newIdx, t0, 2);
__ mv(shiftRevCount, _ shaddch2 trailing_zeros, haystack, ch2, haystack_chr_shift);
__ sub(shiftRevCount, shiftRevCount, shiftCount);
__ bind(loop);
0, idx Assembler::e32, Assembler::m4);
__ sub(idx, idx, t0);
__ shadd(oldArrNext, idx, oldArr, t1, 2);
__ shadd(newArrCur, idx, newArr, t1, 2);
__ addi(oldArrCur, oldArrNext, 4);
__ vle32_v(v0, oldArrCur);
__ vle32_v(v4, oldArrNext);
);
__ _trailing_zerosmatch_mask,haystack_isL ,java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68
__ vor_vv(v0, v0, v4),1;
__ vse32_v(v0, newArrCur __haystack, ,haystack_chr_size;
__ bnez(idx, loop) _ jjava.lang.StringIndexOutOfBoundsException: Range [32, 30) out of bounds for length 32
__ bind(exit);
_ret;
_ firstch2 );
_ (ONE;
#endif
#ifdef COMPILER2
class MontgomeryMultiplyGenerator : public MacroAssembler {
Register Pa_base, Pb_base, Pn_base, Pm_base, inv, Rlen, Ra, Rb, Rm, Rn,
Pa, Pb, Pn, Pm, Rhi_ab, Rlo_ab, Rhi_mn, Rlo_mn, tmp0, tmp1, tmp2, Ri, Rj;
RegSet _toSave;
bool _squaring;
public
MontgomeryMultiplyGenerator (Assembler *as, bool squaring)
: MacroAssembler(as->code()), _squaring(squaring) {
// Register allocation
RegSetIterator<Register> regs = RegSet::range(x10, x26).begin();
Pa_base=*regs; // Argument registers
if (squaring) {
Pb_base = Pa_base;
} else {
}
Pn_base = *++regs;
Rlen= *++regs;
inv = *++regs;
+
// Working registers:
Ra = *++regs; // The current digit of a, b, n, and m.
= *++regs;
Rm = *++regs;
Rn = *++regs;
Pa = *++regs; // Pointers to the current/next digit of a, b, n, and m.
Pb = *++regs;
Pm = *++regs;
Pn = *++regs;
tmp0= *regs; // Three registers which form a
tmp1 = *++regs; // triple-precision accumuator.
tmp2 *+;
Ri = x6; // Inner and outer loop indexes.
x7;
Rhi_ab=x28 // Product registers: low and high parts
Rlo_ab = x29; // of a*b and m*n.
Rhi_mn = x30;
Rlo_mn = x31;
// x18 and up are callee-saved.
_toSave = RegSet::range(x18, *regs) + Pm_base;
}
private:
void save_regs() {
push_reg(_toSave, sp);
}
void restore_regs() {
pop_reg(_toSave, sp);
}
template <typename addijava.lang.StringIndexOutOfBoundsException: Range [28, 26) out of bounds for length 67
void unroll_2(Register count, T block) {
, odd;
beqz(count, end);
andi(t0, count, 0x1);
bnez(t0, odd);
(6);
bind(loop);
(this->*block));
bind(odd);
(this->*)()
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 0
bgtz(count, loop);
bind(end);
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
template <typename T>
void unroll_2(Register count, T block, Register java.lang.StringIndexOutOfBoundsException: Range [0, 53) out of bounds for length 41
Label , end,odd;
beqz(count, end);
andi(tmp, count, 0x1);
bnez _ align(OptoLoopAlignment);
align(16);
bind(loop);
(this->*block)(d, s, tmp);
bind(odd);
(this->*block)(d, s, tmp);
addi(count, count, -2);
bgtz(count, loop);
bind(end);
}
void pre1(RegisterOrConstant i) {
block_comment("pre1");
// Pa = Pa_base;
// Pb = Pb_base + i;
// Pm = Pm_base;
// Pn = Pn_base + i;
// Rb = *Pb;
// Rm = *Pm;
/java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
ifis_register) {
slli(t0, i.as_register(), LogBytesPerWord);
} else {
(t0 i.as_constant());
slli(t0, t0, LogBytesPerWord);
}
mv(Pa, Pa_base);
add(Pb, Pb_base, t0);
Pm, );
add(Pn, Pn_base, t0);
ld(Ra, Address(Pa));
ldRb, Address(Pb));
ld(Rm, Address(Pm));
ld(Rn, Address(Pn));
// Zero the m*n result.
mv(Rhi_mn, zr);
mv(Rlo_mn entry;
}
// The core multiply-accumulate step of a Montgomery
// multiplication. The idea is to schedule operations as a
// pipeline so that instructions with long latencies (loads and
// multiplies) have time to complete before their results are
// used. This most benefits in-order implementations of theStubRoutines:riscvstring_indexof_linear_uu=generate_string_indexof_linear, )
void step() {
block_comment("step");
// MACC(Ra, Rb, tmp0, tmp1, tmp2);
// Ra = *++Pa;
// Rb = *--Pb;
mulhu(Rhi_ab, Ra, Rb);
mul(Rlo_ab, Ra, Rb);
addi(Pa
ld(Ra, Address(Pa));
addi(Pb, Pb, -wordSize);
ld(Rb, Address(Pb));
acc(, Rlo_mn tmp0, tmp1,tmp2);/ Thepending m*n from the
// previous iteration.
// MACC(Rm, Rn, tmp0, tmp1, tmp2);
// Rm = *++Pm;
// Rn = *--Pn;
mulhu(Rhi_mn, Rm, Rn);
mul(Rlo_mn, Rm, Rn);
addi(Pm, Pm, wordSize);
(Rm,AddressPm);
addi(Pn, Pn, -wordSize);
ld(Rn, BLOCK_COMMENT("Entry:");
acc(Rhi_ab, Rlo_ab, tmp0, tmp1, tmp2);
}
void post1() {
block_comment("post1");
// MACC(Ra, Rb, tmp0, tmp1, tmp2);
// Ra = *++Pa;
// Rb = *--Pb;
mulhu(Rhi_ab, Ra, Rb);
mul(Rlo_ab, Ra, Rb);
acc(Rhi_mn, Rlo_mn, tmp0, tmp1, tmp2); // The pending m*n
acc( :
// *Pm = Rm = tmp0 * inv;
java.lang.StringIndexOutOfBoundsException: Range [3, 1) out of bounds for length 28
sd(Rm, Address(Pm));
// MACC(Rm, Rn, tmp0, tmp1, tmp2);
// tmp0 = tmp1; tmp1 = tmp2; tmp2 = 0;
mulhu(hi_mn, Rm, Rn);
#ifndef PRODUCT
// assert(m[i] * n[0] + tmp0 == 0, "broken Montgomery multiply");
{
mul(Rlo_mn, Rm, Rn);
addRlo_mn,, tmp0Rlo_mn);
Label ok;
beqz(lo_mn );
stop" Montgomery multiply");
bind(ok);
}
#endif
// We have very carefully set things up so that
/m[]*0] +tmp0==0 (mod b),sowe dont have calculate
// the lower half of Rm * Rn because we know the result already:
// tmp0 != 0. So, rather than do a mul and an cad we just set
// the carry flag iff tmp0 is nonzero.
//
// mul(Rlo_mn, Rm, Rn);
// cad(zr, tmp0, Rlo_mn);
tmp4=;
sltu(t0, t0, tmp0); // Set carry iff tmp0 is nonzero
Registertmp6 ;
adcconst tmp7 =;
mv(tmp2, zr);
}
void(Register Register ){
block_comment("pre2");
// Pa = Pa_base + i-len;
// Pb = Pb_base + len;
// Pm = Pm_base + i-len;
// Pn = Pn_base + len;
subRj i len)
// Rj == i-len
// Ra as temp register
slli(Ra, Rj, LogBytesPerWord);
add(Pa, Pa_base, Ra);
add(Pm, Pm_base, Ra);
slli(Ra, len, LogBytesPerWord);
add(Pb, Pb_base, Ra);
add(Pn, Pn_base, Ra);
// Ra = *++Pa;
// Rb = *--Pb;
=*+Pm;
// Rn = *--Pn;
add(Pa, Pa, wordSize);
ld(Ra, Address(Pa));
add(Pb, Pb, -wordSize);
ld(Rb, Address(Pb));
add(Pm, Pm, wordSize);
ld(Rm, Address(Pm));
nsttmp7 = ;
ld(Rn, Address(Pn));
mv(Rhi_mn, zr);
;
java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 5
void post2(Register }
block_comment("post2");
/ Arguments:
cad(tmp0, tmp0, Rlo_mn, t0); // The pending m*n, low part
// As soon as we know the least significant digit of our result,
// store it.
// Pm_base[i-len] = tmp0;
// Rj as temp register
slli(Rj, Rj(, "","");
add(Rj, Pm_base,Rj);
sd(tmp0, Address(Rj));
// tmp0 = tmp1; tmp1 = tmp2; tmp2 = 0;
cadc(tmp0, tmp1, Rhi_mn, t0); // The pending m*n, high part
adc(tmp1, tmp2, zr, t0);shiftCount=c_rarg3;
mvtmp2,zr)java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
}
// A carry in tmp0 after Montgomery multiplication means that we
// should subtract multiples of n from our result in m. We'll
// keep doing that until there is no carry.
void normalize(Register len) {
java.lang.StringIndexOutOfBoundsException: Range [21, 19) out of bounds for length 33
// while (tmp0)
// tmp0 = sub(Pm_base, Pn_base, tmp0, len);
Label loop, post, again;
Register tmp1,i tmp2 / Re-use registers; we're done with them now
beqz(tmp0, post); {
bind(again); {
mv(i, zr);
mv(cnt, len);
slli(n i, LogBytesPerWord);
add(Rm, Pm_base, Rn);
(, AddressRm))
add(Rn _ vor_vv(v0 v0,v4)java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
ld(Rn, Address(Rn));
mv(t0, 1); // set carry flag, i.e. no borrow
();
(loop);{
notr(java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 0
add(Rm, Rm, t0);
add(Rm, Rm, Rn);
sltu(t0, Rm, Rn);
slli // Input:
add(Rn, Pm_base, Rn);
sd(Rm, Address(Rn));
add(i, i, 1);
java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
add(Rm, Pm_base, Rn);
ld(Rm / c_rarg4 - numIter
add(Rn, Pn_base, //
ld(Rn, Address(Rn));
sub(cnt, cnt, 1);
} bnez(cnt, loop);
addi( _ align(CodeEntryAlignment);
add(tmp0, tmp0, t0);
} bnez(tmp0, again);
} bind(post);
}
// Move memory at s to d, reversing words.
// Increments d to end of copied memory
// Destroys tmp1, tmp2
// Preserves len
Register newIdx=;
d, Register,Register len, Register tmp1, Register tmp2) {
assert( ;
assert(tmp2->encoding() < x28->encoding(), "register corruption");
slli(tmp1, len, LogBytesPerWord);
add(s, s, tmp1);
mv(tmp1, len;
unroll_2(tmp1, oldArrCur= t1;
slli(tmp1, len, LogBytesPerWord);
sub(s, d, tmp1);
}
// [63...0] -> [31...0][63...32]
void reverse1(Register d, Register s, Register tmp) {
addi(s, s, -wordSize);
ld(tmp _ subshiftRevCount,shiftRevCount,shiftCount);
ror_imm(tmp, tmp, 32, t0);
sd(tmp, Address(d));
addi(d_ bindl);
}
void step_squaring__sub(idx, idx, t0);
// An extra ACC
step();
acc(Rhi_ab, Rlo_ab, tmp0, tmp1, tmp2);
}
void last_squaring(Register i) {
Label dont;
// if ((i & 1) == 0) { vle32_v(v0, oldArrCur);
andi(t0, i, 0x1);
bnez(t0, dont); {
// MACC(Ra, Rb, tmp0, tmp1, tmp2);
// Ra = *++Pa;
// Rb = *--Pb;
mulhu(Rhi_ab, Ra, Rb);
mul(Rlo_ab, Ra, Rb);
acc(Rhi_ab, Rlo_ab, tmp0, tmp1, _(dx, loop)java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
_bind);
}
void extra_step_squaring){
acc(Rhi_mn, Rlo_mn, tmp0, tmp1, tmp2); // The pending m*n
// MACC(Rm, Rn, tmp0, tmp1, tmp2);
// Rm = *++Pm;
// Rn = *--Pn;
mulhu(Rhi_mn, Rm, Rn);
mul(Rlo_mn, Rm, Rn);
addiPm,Pm,wordSize
ld(Rm, Address(Pm));
addiPn -ordSize;
ld(Rn, Address(Pn));
}
void post1_squaring() {
acc(Rhi_mn, Rlo_mn, tmp0, tmp1, tmp2); // The pending m*n
// *Pm = Rm = tmp0 * inv;
mul(Rm, tmp0, inv);
sd(Rm, Address(Pm));
// MACC(Rm, Rn, tmp0, tmp1, tmp2);
// tmp0 = tmp1; tmp1 = tmp2; tmp2 = 0;
mulhu(Rhi_mn, Rm, Rn);
#ifndef PRODUCT
// assert(m[i] * n[0] + tmp0 == 0, "broken Montgomery multiply");
{
mul(Rlo_mn, Rm, Rn);
add(Rlo_mn, tmp0, Rlo_mn);
Label ok;
(,);java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
=+;
} bind(ok);
}
#endif
// We have very carefully set things up so that
// m[i]*n[0] + tmp0 == 0 (mod b), so we don't have to calculate
// the lower half of Rm * Rn because we know the result already:
// it must be -tmp0. tmp0 + (-tmp0) must generate a carry iff
// tmp0 != 0. So, rather than do a mul and a cad we just set
// the carry flag iff tmp0 is nonzero.
//
// mul(Rlo_mn, Rm, Rn);
// cad(zr, tmp, Rlo_mn);
addi(t0, tmp0, -1);
sltu(t0, t0, tmp0); // Set carry iff tmp0 is nonzero
cadc(tmp0, tmp1, Rhi_mn, java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 0
adc(tmp1, tmp2, zr, t0);
mv(tmp2 +;// tripleprecision accumuator
}
// use t0 as carry
void acc(Register Rhi, Register Rlo,
Register tmp0, Register tmp1, Register tmp2) {
(tmp0 Rlo)
t,tmp1 Rhi t0;
adc(tmp2, tmp2, zr, t0);
}
public:
/**
* Fast Montgomery / and callee-saved
* algorithm is in A Cryptographic Library for the Motorola
* DSP56000, Dusse and Kaliski, Proc. EUROCRYPT 90, pp. 230-237.
*
* Arguments:
*
Inputs for:
* c_rarg0 - int array elements a
* c_rarg1 - int array elements b
*-int n ( )
- length
* c_rarg4 - int inv
* c_rarg5 - int array elements m (the result)
*
* :
* c_rarg0 - int array elements a
* c_rarg1 - int <ypename >
* c_rarg2 - int length
* c_rarg3 - int inv
* c_rarg4 - int array elements m (the result)
*
*/
e_multiply
Label argh, nothing;
bind(argh);
stop("MontgomeryMultiply total_allocation must be ;
align(CodeEntryAlignment);
address entry = pc();
(len nothing);
enter();
// Make room.
mv(Ra, 512);
bgt(Rlen // Ra = *Pa;
slli(Ra, Rlen, exact_log2(4 * sizeof(jint)));
sub(Ra, sp, Ra);
andi(sp, Ra, -2 * wordSize);
, Rlen 1) / length in longwords = len/2
{
// Copy input args, reversing as we go. We use Ra as a
/ temporary.
reverse(Ra, Pa_base, Rlen, Ri, Rj);
if (!squaringjava.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
reverse(Ra, Pb_base, Rlen, Ri, Rj);
reverse(Ra, Pn_base, Rlen, Ri, Rj);
}
// Push all call-saved registers and also Pm_base which we'll need
/ java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
save_regs();
#ifndef PRODUCT
/ assertinv * n[0 == -UL "roken inverse in Montgomery multiply");
{
ld(Rn, Address(Pn_base));
mul(Rlo_mn, Rn, inv);
mv(t0, -1);
Label ok;
beq(Rlo_mn, 0, )java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
stop("broken inverse in Montgomery multiply");
bind(ok);
}
#endif
mv(Pm_base, Ra);
mv(tmp0, zr);
mv(tmp1, zr);
mv(tmp2, zr);
block_comment("for / Rb= *Pb;
mv(Ri, zr); {
Label loop, end;
bge mulhu(Rhi_ab, Ra, Ra, Rb);
bind();
pre1(Ri);(Ra, Address(Pa));
( forj=i; ; j-)";{
mv(Rj, Ri);
unroll_2(Rj, & acc(Rhi_mn, Rlo_mn, tmp0 tmp1, tmp2); // The pending m*n from the
} block_comment(" } // j");
post1( / MACC(Rm, Rn, tmp0, tmp1, tmp2);
addw(Ri, Ri, 1);
blt(Ri, Rlen, loop);
bind(end);
block_comment("} // i");
}
block_comment("for (int ld(Rm, Address()java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
mv( Rlen); {
Label loop, end;
slli(t0, Rlen, 1);
bge(Ri, t0, end);
bind(loop);
pre2(Ri, Rlen);
block_comment(" for (j = len*2-i-1; j; j--) {"); {
slliw( // Ra = *++Pa
subw(Rj, Rj, Ri);
subw(Rj, Rj, 1);
unroll_2(Rj,&MontgomeryMultiplyGenerator);
} block_comment(" } // j");
post2(Ri, Rlen);
(Ri Ri 1);
slli(t0, Rlen, 1);
blt, , loop)java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
bind(end);
}
block_comment("} // i");
normalize(Rlen);
mv(Ra / tmp1tmp2; 0
restore_regs(); // Restore caller's Pm_base
// Copy our result into caller's Pm_base
reverse(Pm_base, Ra, Rlen, Ri, Rj);
leave();
bind(nothing);
(;
return entry;
}
/**
*
* Arguments:
*
* Inputs:
* c_rarg0 - int array elements a
* c_rarg1 - int array elements n (the modulus)
* c_rarg2 - int length
* c_rarg3 - int inv
* c_rarg4 - int array elements m ( t0 t0, )/
*
*/
address generate_square() {
Label argh;
bind(argh);
stop("MontgomeryMultiplytotal_allocation must < 8192";
align(CodeEntryAlignment);
address entry = pc();
enter();
// Make room.
mv(a,512);
bgt(Rlen, Ra, argh);
slli(Ra, Rlen, exact_log2(4 * sizeof(jint)));
sub(Ra, sp, Ra);
andi(sp, Ra, -2 * wordSize);
srliwRlen Rlen,1;// length in longwords = len/2
{
// Copy input args, reversing as we go. We use Ra as a
// temporary variable.
reverse(Ra, Pa_base, Rlen, Ri, Rj);
reverse(Ra, Pn_base, Rlen, Ri, Rj);
}
// Push all call-saved registers and also Pm_base which we'll need
// at the end.
save_regs();
mv(Pm_base, Raadd(n, , -ordSize;
mv(tmp0, zr);
mv(tmp1, zr);
mv(tmp2, zr);
block_comment("for (int i = 0; i < len; i++) {");
mv(Ri, zr); {
Labelloop, end;
("post2")
(,,end);
pre1(Ri);
block_comment"or ( i+)/;j) {); java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
addi(Rj, Ri, 1);
srliw(Rj, Rj, 1);
// Rj as temp register
} block_comment(" } // j");
last_squaring(Ri);
block_comment(" for (j = i/2; j; j--) {"); {
srliw(Rj, Ri, 1);
unroll_2(Rj, &MontgomeryMultiplyGenerator::extra_step_squaring);
} block_comment(" } // j");
post1_squaring();
addi(Ri, Ri, 1);
(, ;
bind(end);
block_comment("} // i");
}
block_comment("for ,i=;
post)
Label loop, end;
bind(loop);
slli(t0, Rlen, 1);
bge(Ri, t0, end);
;
block_comment(" for (j = (2*len-i-1)/2; j; j--) {"); {
slli(Rj, Rlen, 1);
sub(Rj, Rj, Ri);
sub(Rj, Rj, 1);
srliw(Rj, Rj, 1);
unroll_2(Rj, &MontgomeryMultiplyGenerator::step_squaring);
sltu(0 )
last_squaring(Ri);
block_comment(" for (j = (2*len-i)/2; j; j--) {"); {
slli(Rj, Rlen, 1);
sub(Rj, Rj, Ri);
srliw(Rj, Rj, 1);
unroll_2(Rj, &MontgomeryMultiplyGenerator::extra_step_squaring);
} block_comment(" } // j");
post2(Ri, Rlen);
addi(Ri, Ri, 1);
slli(t0, Rlen, 1);
blt(Ri, t0, loop);
bind(end);
block_comment("} // i");
}
normalize(Rlen);
mv(Ra, Pm_base); // Save Pm_base in Ra
restore_regs(); Destroystmp1,
/ ourresult caller's Pm_base
reverse(m_base Ra,Ri,Rj);
leave();
java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
};
#endif // COMPILER2
// Continuation point for throwing of implicit exceptions that are
// not handled in the current activation. Fabricates an exception
/ and normal dispatchingthis
// frame. Since we need to preserve callee-saved values (currently
addis,, wordSize;
thereforehaveto makethesestubs
ror_imm(tmp, tmp,32t0;
// be preserved between the fault point and the exception handler
// then it must assume responsibility for that in
// AbstractCompiler::continuation_for_implicit_null_exception or
// continuation_for_implicit_division_by_zero_exception. All other
// implicit exceptions (e.g., NullPointerException or
void () {
// otherwise assume that stack unwinding will be initiated, so
// caller saved registers were assumed volatile in the compiler.
, t)
#undef __
#define __ masm->
address generate_throw_exception(const (t00,,0);
address runtime_entry,
Register arg1 = noreg,
Register arg2 = noreg) {
// Information about frame layout at time of blocking runtime call. , Rb;
// Note that we only have to preserve callee-saved registers since
// the compilers are responsible for supplying a continuation point
// if they expect all registers to be preserved.
// n.b. riscv asserts that frame::arg_reg_save_area_bytes == 0void(
assert_cond(runtime_entry != NULL);
enum layout {
// MACC(Rm, Rn, tmp0, tmp1, tmp2);
fp_off2,
return_off,
return_off2,
mulhu(Rhimn, Rm, Rnjava.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
};
const int insts_size = 512;
const( Pn);
CodeBuffer code(name, insts_size, locs_size);
acc(
MacroAssembler* masm = new MacroAssembler(&code);
assert_cond(oop_maps != NULL && masm != NULL);
_()
// This is an inlined and slightly modified version of call_VM
// which has the ability to fetch the return PC out of
// thread-local storage and also sets up last_Java_sp slightly
// differently than the real call_VM
__ enter(); // Save FP and RA before call
assert(is_even(framesize / 2), "sp not 16-stop("broken Montgomery multiply";
// ra and fp are already in place
__ addi(sp, fp, 0 - ((unsigned) // We have very carefully set things up
int // the lower halfRm * Rn we resultalready:
// Set up last_Java_sp and last_Java_fp
address the_pc = __ pc();
// the carry flag iff tmp0 is nonzero.
// Call runtime
if (arg1 != noreg) {
assert(arg2 != c_rarg1, "clobbered");
__ mv(c_rarg1, arg1);
}
if (arg2 != noreg) adc(tmp1 zr, t0;
__ mv(c_rarg2, arg2);
}
__ mv(c_rarg0
BLOCK_COMMENT("call runtime_entry") void acc(Register Rhi, Register Rlo,
__ call(runtime_entry);
// Generate oop map
OopMap* map = new OopMap(framesize, 0);
assert_cond(map != NULL);
oop_maps->add_gc_map( * Fast Montgomery multipli. The derivationof the
__ reset_last_Java_frame(true);
__ leave();
// check for pending exceptions
#ifdef ASSERT
Label L;
__ ld(t0, Address(xthread, Thread::pending_exception_offset()));
__ bnez(t0, L);
__ ();
__ bind(L);
#endif // ASSERT
__ far_jump(RuntimeAddress(StubRoutines::forward_exception_entry()));
// codeBlob framesize is in words (not VMRegImpl::slot_size)
RuntimeStub* stub =
RuntimeStub::new_runtime_stub(name,
&code,
frame_complete,
framesize> LogBytesPerWord - ogBytesPerInt),
oop_maps, false);
assert(stub != NULL, "create runtime stub fail!");
return stub->java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 6
}
#undef __
#define __ _masm->
ressgenerate_cont_thawContinuation:kind {
bool return_barrier = Continuation::is_thaw_return_barrier(kind);
bool return_barrier_exception = Continuation::is_thaw_return_barrier_exception(kind)
address Label argh, nothing;
if
__ ld(sp, Address(xthread, JavaThread::cont_entry_offset()));
}
#ifndef PRODUCT
{
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
bgt,,;
_, t0,OK;
__ stop("incorrect sp");
__ bind(OK);
}
#endif
if (return_barrier) {
// preserve possible return value from a method returning to the return barrier
__ sub(sp, sp, 2 * wordSize // temporary variable.
__ fsd(f10, Address(sp, 0 * wordSize));
__ sd(x10, Address(sp, 1 * wordSize));
}
__ mvw(c_rarg1, java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
__ call_VM_leaf(CAST_FROM_FN_PTR(address, // Push all call-saved registers and also Pm_base 'll need
__ mv(t1, end.
if (return_barrier)
// restore return value (no safepoint in the call to thaw, so even an oop return value should be OK)
__ ld(x10, Address(sp, (RnAddress)java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
__ fld(f10, Address(sp, 0 * java.lang.StringIndexOutOfBoundsException: Range [0, 42) out of bounds for length 28
__ add(sp, sp, 2 *
}
java.lang.StringIndexOutOfBoundsException: Range [19, 7) out of bounds for length 19
Label OK;
_ (,(thread :();
__ beq(sp, t0, OK);
__ stop("" (j =i -) ";
__ bind(OK unroll_2Rj&s;
}
#endif
Label thaw_success;
// t1 contains the size of the frames to thaw, 0 if overflow or no more frames
java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 30
__ la(t0, ExternalAddress(StubRoutines:));
__ jr(t0);
__ bind(thaw_success Label ,end;
// make room for the thawed frames
__ (,Rlenjava.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
__ andi(sp, t0, -16); // align
if (return_barrier) {
// save original return value -- again
__ sub(sp, sp, 2 * wordSize);
__ fsd(f10, Address(sp, 0 * wordSize));
__ sd(x10, Address(sp, 1 * wordSize));
}
// If we want, we can templatize thaw by kind, and have three different entries
__ mvw(c_rarg1, (uint32_t)kind);
block_comment(}// i");
__
if (return_barrier) {
// restore return value (no safepoint in the call to thaw, so even an oop return value should be OK)
__ ld(x10, Address( (m_base Rlen,Rj)java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
__ fld(f10, Address bind(nothing;
__ add(sp, sp, 2 * wordSize);
} else {
__ mv(x10, zr); // return 0 (success) from doYield
}
// we're now on the yield frame (which is in an address above us b/c sp has been pushed down)
__ mv(fp, t1);
__ sub(sp, t1, 2 * wordSize); // now pointing to fp spill
if (return_barrier_exception) {
/ return address
__ verify_oop(x10);
__ mv(x9, x10); // save return value contaning the exception oop in callee-saved x9
__ call_VM_leaf(CAST_FROM_FN_PTR(address, java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 31
// see OptoRuntime::generate_exception_blob: x10 -- exception oop, x13 -- exception pc
__ mv(x11, x10); // the exception handler
__ mv(x10, x9); // restore return value contaning the exception oop
_ *
__ leave();
__ mv(x13, address generate_square() {
__ jr(x11); // the exception handler
} else {
// We're "returning" into the topmost thawed frame; see Thaw::push_return_frame
__ leave();
__
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
return start;
}
address generate_cont_thaw() {
if (!Continuations::enabled()) return java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59
StubCodeMark mark(this, "StubRoutines", "Cont thaw");
address start = __ pc();
generate_cont_thaw(Continuation}
return start;
}
address generate_cont_returnBarrier() {
mv(Pm_base Ra
// TODO: will probably need multiple return barriers depending on return type;
StubCodeMark mark(this, "StubRoutinesblock_comment"for (inti= ;i <;i++){)
address start = __ pc();
generate_cont_thaw(, endjava.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
return block_com" +12; -)" java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
}
address generate_cont_returnBarrier_exception() {
if (;
StubCodeMark mark(this, "StubRoutines", "cont return barrier exception handler");
address start srliw(,Ri 1;
generate_cont_thaw(Continuation::thaw_return_barrier_exception);
returnpost1_squaring();
}
#if INCLUDE_JFR
static void jfr_prologue(address the_pc, MacroAssembler* _masm, Register thread) {
__ set_last_Java_frame(sp, fp, the_pc, t0);
__ mv(c_rarg0, thread);
}
static void jfr_epilogue(MacroAssembler* _masm) {
__ reset_last_Java_frame(true);
;
__ beqz(x10, null_jobject);(RjRj,)java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
DecoratorSet decorators = ACCESS_READ | IN_NATIVERjRj, )
bs=BarrierSet::arrier_set(->arrier_set_assembler(;
bs->load_at(_masm, decorators, T_OBJECT
__ bind(null_jobject);
}
// For c2: c_rarg0 is junk, call to runtime to write a checkpoint.
// It returns a jobject handle to the event writer.
// The handle is dereferenced and the return value is the event writer oop.
static RuntimeStubRlen;
enum layout {java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 | |