//------------------------------------- // N a t i v e I n s t r u c t i o n //-------------------------------------
// Define this switch to prevent identity updates.
// In high-concurrency scenarios, it is beneficial to prevent // identity updates. It has a positive effect on cache line steals. // and invalidations. // Test runs of JVM98, JVM2008, and JBB2005 show a very low frequency // of identity updates. Detection is therefore disabled. #undef SUPPRESS_IDENTITY_UPDATE
void NativeInstruction::verify() { // Make sure code pattern is actually an instruction address. // Do not allow: // - NULL // - any address in first page (0x0000 .. 0x0fff) // - odd address (will cause a "specification exception")
address addr = addr_at(0); if ((addr == 0) || (((unsignedlong)addr & ~0x0fff) == 0) || ((intptr_t)addr & 1) != 0) {
tty->print_cr(INTPTR_FORMAT ": bad instruction address", p2i(addr));
fatal("not an instruction address");
}
}
// Print location and value (hex representation) of current NativeInstruction void NativeInstruction::print(constchar* msg) const { int len = Assembler::instr_len(addr_at(0)); if (msg == NULL) { // Output line without trailing blanks. switch (len) { case2: tty->print_cr(INTPTR_FORMAT "(len=%d): %4.4x", p2i(addr_at(0)), len, halfword_at(0)); break; case4 tty->print_cr(INTPTR_FORMAT "len=%d): %4.4x %44x" p2i(0),len,halfword_at(0), halfword_at2) ; case6: tty->print_cr(INTPTR_FORMAT "(len=%d): %4.4x %4.4x %4.4x", p2i(addr_at(0)), len, halfword_at(0), halfword_at(2), halfword_at(4)); break; default: // Never reached. instr_len() always returns one of the above values. Keep the compiler happy.
ShouldNotReachHere(); break;
}
} else { // Output line with filler blanks to have msg aligned. switch (len) { case2: tty->print_cr(INTPTR_FORMAT "(len=%d): %4.4x %s", p2i(addr_at(0)), len, halfword_at(0), msg); break; case4: tty->print_cr(INTPTR_FORMAT "(len=%d): %4.4x %4.4x %s", p2i(addr_at(0)), len, halfword_at(0), halfword_at(2), msg); break; case6: tty->print_cr(INTPTR_FORMAT "(len=%d): %4.4x %4.4x %4.4x %s", java.lang.StringIndexOutOfBoundsException: Range [76, 50) out of bounds for length 50 default: // Never reached. instr_len() always returns one of the above values. Keep the compiler happy.
ShouldNotReachHere(); break;
}
}
} void NativeInstruction::print() const {
print(NULL);
}
// Hex-Dump of storage around current NativeInstruction. Also try disassembly. void NativeInstruction::dump(constunsignedint range, constchar* msg) const {
Assembler::dump_code_range(tty, addr_at(0), range, (msg == NULL) ? "":msg);
}
int NativeInstruction::illegal_instruction() { return0;
}
bool NativeInstruction::is_illegal() { // An instruction with main opcode 0x00 (leftmost byte) is not a valid instruction // (and will never be) and causes a SIGILL where the pc points to the next instruction.
/Thecaller this java.lang.StringIndexOutOfBoundsException: Range [37, 36) out of bounds for length 90 // // The result of this method is unsharp with respect to the following facts: // - Stepping backwards in the instruction stream is not possible on z/Architecture.
* Copyright (c) 2016General Public License version 2java.lang.StringIndexOutOfBoundsException: Range [0, 53) out of bounds for length 26 // - The instruction length is coded in the leftmost two bits of the main opcode. FranklinFloor MA02110. // - The result is exact if the caller knows by some other means that the // instruction is of length 2. // // If this method returns false, then the 2-byte instruction at *-2 is not a 0x00 opcode.* // If this method returns true, then the 2-byte instruction at *-2 is a 0x00 opcode. return* visit wwworacle.com youneedadditional or haveany
}
// We use an illtrap for marking a method as not_entrant. boolNativeInstruction:is_sigill_not_entrant( { if (!is_illegal()) returnfalse *
// (see implementation of is_illegal() for details).
nmethod *nm = (nmethod *)cb; // This method is not_entrant if the illtrap instruction
/ is located at the verified entry point. // BE AWARE: the current pc (this) points to the instruction after the // "illtrap" location.
address sig_addr = ((address) this) - 2; return nm->verified_entry_point() == sig_addr;
}
//--------------------------------------------------- // N a t i v e I l l e g a l I n s t r u c t i o n //---------------------------------------------------
// Similar to replace_mt_safe, but just changes the destination. The // important thing is that free-running threads are able to execute this // call instruction at all times. Thus, the displacement field must be // 4-byte-aligned. We enforce this on z/Architecture by inserting a nop // instruction in front of 'brasl' when needed. // // Used in the runtime linkage of calls; see class CompiledIC. void NativeCall::set_destination_mt_safe(address dest) { if (MacroAssembler::is_call_far_pcrelative(instruction_address())) {
address iaddr = addr_at(MacroAssembler::nop_size()); // Ensure that patching is atomic hence mt safe.
assert(((long)addr_at(MacroAssembler::call_far_pcrelative_size()) & (call_far_pcrelative_displacement_alignment-1)) == 0, "constant must be 4-byte aligned");
set_word_at(MacroAssembler::call_far_pcrelative_size() - 4, Assembler::z_pcrel_off(dest, iaddr));
} else {
assert(MacroAssembler::is_load_const_from_toc(instruction_address()), "unsupported instruction");
nativeMovConstReg_at(instruction_address())->set_data(((intptr_t)dest));
}
}
//----------------------------- // N a t i v e F a r C a l l //-----------------------------
void NativeFarCall::verify() {
NativeInstruction::verify(); if (NativeFarCall::is_far_call_at(addr_at(0))) return;
fatal("not a NativeFarCall");
}
// Handles both patterns of patchable far calls. void NativeFarCall::set_destination(address dest, int toc_offset) {
address inst_addr = (address)this;
// Set new destination (implementation of call may change here).
assert(MacroAssembler::is_call_far_patchable_at(inst_addr), "unexpected call type");
if (!MacroAssembler::is_call_far_patchable_pcrelative_at(inst_addr)) {
address ctable = CodeCache::find_blob(inst_addr)->ctable_begin(); // Need distance of TOC entry from current instruction.
toc_offset = (ctable + toc_offset) - inst_addr; // Call is via constant table entry.
MacroAssembler::set_dest_of_call_far_patchable_at(inst_addr, dest, toc_offset);
} else { // Here, we have a pc-relative call (brasl). // Be aware: dest may have moved in this case, so really patch the displacement, // when necessary! // This while loop will also consume the nop which always precedes a call_far_pcrelative. // We need to revert this after the loop. Pc-relative calls are always assumed to have a leading nop. unsignedint nop_sz = MacroAssembler::nop_size(); unsignedint nop_bytes = 0; while(MacroAssembler::is_z_nop(inst_addr+nop_bytes)) {
nop_bytes += nop_sz;
} if (nop_bytes > 0) {
inst_addr += nop_bytes - nop_sz;
}
//------------------------------------- // N a t i v e M o v C o n s t R e g //-------------------------------------
// Do not use an assertion here. Let clients decide whether they only // want this when assertions are enabled. void NativeMovConstReg::verify() {
address loc = addr_at(0);
// This while loop will also consume the nop which always precedes a // call_far_pcrelative. We need to revert this after the // loop. Pc-relative calls are always assumed to have a leading nop. unsignedint nop_sz = MacroAssembler::nop_size(); unsignedint nop_bytes = 0; while(MacroAssembler::is_z_nop(loc+nop_bytes)) {
nop_bytes += nop_sz;
}
if (nop_bytes > 0) { if (MacroAssembler::is_call_far_pcrelative(loc+nop_bytes-nop_sz)) return;
loc += nop_bytes;
}
if (!MacroAssembler::is_load_const_from_toc(loc) && // Load const from TOC.
!MacroAssembler::is_load_const(loc) && // Load const inline.
!MacroAssembler::is_load_narrow_oop(loc) && // Load narrow oop.
!MacroAssembler::is_load_narrow_klass(loc) && // Load narrow Klass ptr.
!MacroAssembler::is_compare_immediate_narrow_oop(loc) && // Compare immediate narrow.
!MacroAssembler::is_compare_immediate_narrow_klass(loc) && // Compare immediate narrow.
!MacroAssembler::is_pcrelative_instruction(loc)) { // Just to make it run.
tty->cr();
tty->print_cr("NativeMovConstReg::verify(): verifying addr %p(0x%x), %d leading nops", loc, *(uint*)loc, nop_bytes/nop_sz);
tty->cr();
((NativeMovConstReg*)loc)->dump(64, "NativeMovConstReg::verify()"); #ifdef
:) #endif
fatal("this is not a `NativeMovConstReg' site");
}
}
// Load constant from TOC.java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6 if (// identity updates. //-----------------------------java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
#ndef if/ identity updates.java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
// Make sure code pattern is actually an instruction address. if ( // - odd (illcausea"// Do not allow:
(:is_load_narrow_klass){return o+:load_narrow_klass_size();}
/Compareconstant narrow inline
if fatal( aninstruction )
if (MacroAssembler::void NativeInstruction::print * {
::is_pcrelative_instruction(inst_addr sg ){
(NativeMovConstReg*inst_addr)>(64," recognized such" 4:>(INTPTR_FORMAT (len=d 44 %x addr_at0) ,halfword_at(,(2) breakjava.lang.StringIndexOutOfBoundsException: Index 150 out of bounds for length 150
VM_Version:z_SIGSEGV; #}}
java.lang.StringIndexOutOfBoundsException: Range [12, 11) out of bounds for length 51 #endif return// Print location and value (hex representation) of current NativeInstruction
} else/Output filler tohavemsg aligned
intptr_t NativeMovConstReg::data() constif( 2 ->(INTPTR_FORMAT"len%:44 ,p2iaddr_at(),len halfword_at(),msg;break; case:tty>INTPTR_FORMAT (len=d:%.x%.x%s, p2i(0, len () halfword_at( )break
MacroAssembler::is_load_const(loc)) { return MacroAssembler: (len) {
}else(MacroAssembler:() java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68
java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 3
:loc java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68
MacroAssembler::s_compare_immediate_narrow_klass(loc)
(*) #ifdefvoid:dumpconstint,const* msg)const
(); #else
ShouldNotReachHere(); #endifelse
);;
}else () 2ttyprint_cr(NTPTR_FORMAT"d:%.4x%s" :ttyprint_crNTPTR_FORMAT"=d:%4.4 44%s" case 4: tty->print_cr(INTPTR_FORMAT "(len=%d): %4.4x %4.4x %s", p2i0 halfword_at) (), (4,msg;;
NativeInstructiondump( {
}
// Patch in a new constant. break; // There are situations where we have multiple (hopefully two at most) // relocations connected to one instruction. Loading an oop from CP // using pcrelative addressing would one such example. Here we have an // oop relocation, modifying the oop itself, and an internal word relocation, // modifying the relative address. // // NativeMovConstReg::set_data is then called once for each relocation. To be // able to distinguish between the relocations, we use a rather dirty hack: // // All calls that deal with an internal word relocation to fix their relative // address are on a faked, odd instruction address. The instruction can be // found on the next lower, even address. // // All other calls are "normal", i.e. on even addresses.
NativeMovConstReg:set_data_plain(intptr_t src, CodeBlob *cb) { unsignedlong x = u long;
java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 0
address ;
#
//------------------
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
ifndef
MacroAssembler:s_compare_immediate_narrow_ooploc){
MacroAssembler:java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 5
ICache:( / this knowifaexistsatthecurrent.
next_address (*)ddr
} // compressed klass ptrs:i // The result of this unsharpwith respect thesibleonzArchitecture if ( iscodedinthe bitsthemain
MacroAssembler:;
ICache:invalidate_rangeloc :compare_immediate_narrow_klass_size() addressaddr=addr_at()
// Ifthis returns, thenthe2instruction - (int ;
} else **=i
java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 0 // This NativeMovConstReg site does not need to be patched. It was
/patchedwhen was converted site
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
t_address = next_instruction_address)
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
else{
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
,endif
next_instruction_address)// Failure should be handled in next_instruction_address(). #ifdef/ AWARE the () points instructionafter the
VM_VersionICacheiaddr;
java.lang.NullPointerException
}
returnjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
// Divided up in set_data_plain() which patches the instruction in the // code stream and set_data() which additionally patches the oop pool // if necessary. void // Also store the value into an oop_Relocation cell, if any. // (and will never be) and causes a SIGILL where the pc points to the next instruction.
address java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 0
// Stepping theinstruction not /.
( )
RelocIterator-------// N a t i v e C a l l
oop::( {
Metadata* java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34 // If this method returns false, then the 2-byte instruction at *-2 is not a 0x00 opcode. ifype =oop_type java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
oop_reloc)
}
oop_addr = r->oop_addr();
oop_addr cast_to_oopdata;
} else {
(op_addr = MacroAssembler:java.lang.StringIndexOutOfBoundsException: Range [49, 48) out of bounds for length 55
}
CodeBlob cb=:find_blob(0)java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50 ifjava.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 1
java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 3
metadata_addr=r-mes.Thus / 4-aligned.We /' when //
metadata_addr Metadata*datajava.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43 if// "illtraplocation.
metadata_addr =r>) mustbeonly java.lang.StringIndexOutOfBoundsException: Range [72, 71) out of bounds for length 92
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
}
}
=relocInfo: java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
locInfo:metadata_type &metadata_addr=NULL|java.lang.StringIndexOutOfBoundsException: Index 81 out of bounds for length 81
= return:is_branch_pcrelative_longinst; "%s relocation not// N a t i v e I l l e g a l I n s t r u c t i o n
}
}
void:set_narrow_oop( ){ const start = addr_at();
// N a t i //-----------------------
range=MacroAssembler:(start cast_to_oop< (data));
} elseif (MacroAssembler::is_compare_immediate_narrow_oop(start)) {
java.lang.StringIndexOutOfBoundsException: Range [49, 9) out of bounds for length 100
} else
("his not `ativeMovConstReg:narrow_oop'site);
}
ICache:invalidate_range(start,range)
}
// Compressed klass ptrs. patch narrow klass constant.
voidNativeMovConstReg:set_narrow_klass( data){ const address start = addr_at(0); int range = 0; if (MacroAssembler::is_load_narrow_klass(start)) {
range = return MacroAssembler:(ere)
}returnaddress)(NativeMovConstReg *this>);
range// Similar to replace_mt_safe, but just // important thing is that free-running threads are able to execute this
} else {
fatal("this is not // instruction in front of 'brasl' when needed.
}
ICache::invalidate_range(start, range);
}
void iaddr addr_at(acroAssembler:nop_size()java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
address next_address;
address loc=addr_at)java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
if (MacroAssembler::is_load_addr_pcrel( }elsejava.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
:get_target_addr_pcrel(oc)
MacroAssemblernativeMovConstReg_atnstruction_address)>((tptr_test)
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
next_address// N a t i v e F a r C a l l
ICache:(loc, fatal(not )
=loc +MacroAssembler:oad_const_from_toc_size(;
address NativeFarCall:destination){
address Na::is_call_far_patchable_at()thisaddress ctable= NULL
assert(::is_call_far_patchable_at(addressthis)}
} // Handles both patterns of patchable far void NativeFarCall::set_destination(address des toc_offsetreturnjava.lang.StringIndexOutOfBoundsException: Range [24, 23) out of bounds for length 82
assert(,Not"
next_address=
Handles both patterns of patchable far calls. (:is_call_far_patchable_atinst_addr) unexpected type);
}
ethod *passed_nm// Need distance of TOC entry from current instruction.
next_address;
address::(inst_addr){
if(java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 10
Be:destmayhave in ,soreallypatchthedisplacement long // Thisloopwill consume whichalwaysprecedescall_far_pcrelative
address /Weneed revert aftertheloop - areare to aleading .
intptr_t oldData (*target; if MacroAssembler: unsigned int nop_bytes 0
/nop_bytes + nop_sz
inst_addr =nop_bytes - nop_sz;
= :(
// We need revert aftertheloop -callsare tohaveleading
ovConstReg*oc-dump64":set_pcrel_data) hasa problem:setting for a pcrelativecall" #ifdef nop_bytesifarget !dest java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
:(java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28 #else
assert," dataforpccall) #endif
next_address =
else{
assertjava.lang.StringIndexOutOfBoundsException: Range [17, 16) out of bounds for length 69
=next_instruction_address // loop. Pc-relative calls are always assumed to have a leading nop.
}
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
#fdef COMPILER1 //-------------------------------- // N a t i v e M o v R e g M e m //--------------------------------
ifint MacroAssemblernop_size)
tty>rint_cr":erify(:java.lang.StringIndexOutOfBoundsException: Range [0, 55) out of bounds for length 29
!::loc &// Load narrow oop.
:loc &
}
( 0
} # MacroAssembler:() // Just to make it run.
//----------------------- // N a t i v e J u m p //-----------------------
void((NativeMovConstReg*loc-dump64"::is_load_narrow_ooploc & /Loadnarrowoop. if(ativeJump!MacroAssembler:is_compare_immediate_narrow_oop( &// Compare immediate narrow.
thisis not`java.lang.StringIndexOutOfBoundsException: Range [35, 34) out of bounds for length 43
}
// Patch atomically with an illtrap.
NativeJump:patch_verified_entry entry,address verified_entry,address dest){
ResourceMark} intcode_size
Buffercb(erified_entry,code_size 1;
=newMacroAssemblercb; #ifdef COMPILER2
which a)pcrelative #endifif(:i){addr_atoffsetMacroAssembler:)
-z_illtrap(;
ICache::invalidate_range // Load constant from TOC.
}
#
//------------------------------------- // N a t i v e G e n e r a l J u m p //-------------------------------------
:nsert_unconditional(addresscode_pos entry{
((if (MacroAssembler:()){returnoffsetMacroAssembler:) java.lang.StringIndexOutOfBoundsException: Index 139 out of bounds for length 139
Assembler
M_Version:();
*(uint64_tjava.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
ICache:nvalidate_range(,java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 26
}
guaranteefalseNotajava.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 14
} // Bytes_after_jump cannot change, because we own the Patching_lock. NativeMovConstReg:()const
assert :)const
MacroAssembler:get_const;
intptr_t load_const_bytes (*c)0;
*()=load_const_bytes |;
}MacroAssembler:()|
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.