8169317: [s390] Various minor bug fixes and adaptions

Reviewed-by: mdoerr
This commit is contained in:
Goetz Lindenmaier 2016-11-07 12:37:28 +01:00
parent c5b56dab55
commit 003b7aba48
11 changed files with 60 additions and 44 deletions

View File

@ -1075,8 +1075,7 @@ void LIR_Assembler::reg2mem(LIR_Opr from, LIR_Opr dest_opr, BasicType type,
{
if (UseCompressedOops && !wide) {
Register compressed_src = Z_R14;
__ z_lgr(compressed_src, from->as_register());
__ encode_heap_oop(compressed_src);
__ oop_encoder(compressed_src, from->as_register(), true, (disp_reg != Z_R1) ? Z_R1 : Z_R0, -1, true);
offset = code_offset();
if (short_disp) {
__ z_st(compressed_src, disp_value, disp_reg, dest);

View File

@ -156,7 +156,7 @@ void frame::patch_pc(Thread* thread, address pc) {
}
own_abi()->return_pc = (uint64_t)pc;
_cb = CodeCache::find_blob(pc);
address original_pc = nmethod::get_deopt_original_pc(this);
address original_pc = CompiledMethod::get_deopt_original_pc(this);
if (original_pc != NULL) {
assert(original_pc == _pc, "expected original to be stored before patching");
_deopt_state = is_deoptimized;

View File

@ -39,7 +39,7 @@ inline void frame::find_codeblob_and_set_pc_and_deopt_state(address pc) {
_fp = (intptr_t *) own_abi()->callers_sp;
address original_pc = nmethod::get_deopt_original_pc(this);
address original_pc = CompiledMethod::get_deopt_original_pc(this);
if (original_pc != NULL) {
_pc = original_pc;
_deopt_state = is_deoptimized;

View File

@ -92,9 +92,6 @@ define_pd_global(intx, InitArrayShortSize, 1*BytesPerLong);
product(bool, ReoptimizeCallSequences, true, \
"Reoptimize code-sequences of calls at runtime.") \
\
product(bool, UseCountLeadingZerosInstruction, true, \
"Use count leading zeros instruction.") \
\
product(bool, UseByteReverseInstruction, true, \
"Use byte reverse instruction.") \
\

View File

@ -574,6 +574,7 @@ class MacroAssembler: public Assembler {
static int call_far_patchable_ret_addr_offset() { return call_far_patchable_size(); }
static bool call_far_patchable_requires_alignment_nop(address pc) {
if (!os::is_MP()) return false;
int size = call_far_patchable_size();
return ((intptr_t)(pc + size) & 0x03L) != 0;
}

View File

@ -256,11 +256,7 @@ void NativeFarCall::verify() {
address NativeFarCall::destination() {
assert(MacroAssembler::is_call_far_patchable_at((address)this), "unexpected call type");
address ctable = NULL;
if (MacroAssembler::call_far_patchable_requires_alignment_nop((address)this)) {
return MacroAssembler::get_dest_of_call_far_patchable_at(((address)this)+MacroAssembler::nop_size(), ctable);
} else {
return MacroAssembler::get_dest_of_call_far_patchable_at((address)this, ctable);
}
return MacroAssembler::get_dest_of_call_far_patchable_at((address)this, ctable);
}
@ -610,20 +606,20 @@ void NativeMovRegMem::verify() {
unsigned long inst1;
Assembler::get_instruction(l2, &inst1);
if (!Assembler::is_z_lb(inst1) &&
!Assembler::is_z_llgh(inst1) &&
!Assembler::is_z_lh(inst1) &&
!Assembler::is_z_l(inst1) &&
!Assembler::is_z_llgf(inst1) &&
!Assembler::is_z_lg(inst1) &&
!Assembler::is_z_le(inst1) &&
!Assembler::is_z_ld(inst1) &&
!Assembler::is_z_stc(inst1) &&
!Assembler::is_z_sth(inst1) &&
!Assembler::is_z_st(inst1) &&
!(Assembler::is_z_lgr(inst1) && UseCompressedOops) &&
!Assembler::is_z_stg(inst1) &&
!Assembler::is_z_ste(inst1) &&
if (!Assembler::is_z_lb(inst1) &&
!Assembler::is_z_llgh(inst1) &&
!Assembler::is_z_lh(inst1) &&
!Assembler::is_z_l(inst1) &&
!Assembler::is_z_llgf(inst1) &&
!Assembler::is_z_lg(inst1) &&
!Assembler::is_z_le(inst1) &&
!Assembler::is_z_ld(inst1) &&
!Assembler::is_z_stc(inst1) &&
!Assembler::is_z_sth(inst1) &&
!Assembler::is_z_st(inst1) &&
!UseCompressedOops &&
!Assembler::is_z_stg(inst1) &&
!Assembler::is_z_ste(inst1) &&
!Assembler::is_z_std(inst1)) {
tty->cr();
tty->print_cr("NativeMovRegMem::verify(): verifying addr " PTR_FORMAT

View File

@ -102,11 +102,8 @@ address Relocation::pd_call_destination(address orig_addr) {
if (orig_addr == NULL) {
call = nativeFarCall_at(inst_addr);
} else {
if (MacroAssembler::is_call_far_patchable_pcrelative_at(inst_addr)) {
call = nativeFarCall_at(orig_addr);
} else {
call = nativeFarCall_at(orig_addr); // must access location (in CP) where destination is stored in unmoved code, because load from CP is pc-relative
}
// must access location (in CP) where destination is stored in unmoved code, because load from CP is pc-relative
call = nativeFarCall_at(orig_addr);
}
return call->destination();
}

View File

@ -1489,8 +1489,8 @@ const bool Matcher::match_rule_supported(int opcode) {
case Op_CountLeadingZerosL:
case Op_CountTrailingZerosI:
case Op_CountTrailingZerosL:
// Implementation requires FLOGR instruction.
return UseCountLeadingZerosInstruction;
// Implementation requires FLOGR instruction, which is available since z9.
return true;
case Op_ReverseBytesI:
case Op_ReverseBytesL:
@ -9897,7 +9897,6 @@ instruct string_compareUL(iRegP str1, iRegP str2, rarg2RegI cnt1, rarg5RegI cnt2
// String IndexOfChar
instruct indexOfChar_U(iRegP haystack, iRegI haycnt, iRegI ch, iRegI result, roddRegL oddReg, revenRegL evenReg, flagsReg cr) %{
predicate(CompactStrings);
match(Set result (StrIndexOfChar (Binary haystack haycnt) ch));
effect(TEMP_DEF result, TEMP evenReg, TEMP oddReg, KILL cr); // R0, R1 are killed, too.
ins_cost(200);
@ -10590,7 +10589,6 @@ instruct bytes_reverse_long(iRegL dst, iRegL src) %{
instruct countLeadingZerosI(revenRegI dst, iRegI src, roddRegI tmp, flagsReg cr) %{
match(Set dst (CountLeadingZerosI src));
effect(KILL tmp, KILL cr);
predicate(UseCountLeadingZerosInstruction); // See Matcher::match_rule_supported
ins_cost(3 * DEFAULT_COST);
size(14);
format %{ "SLLG $dst,$src,32\t# no need to always count 32 zeroes first\n\t"
@ -10629,7 +10627,6 @@ instruct countLeadingZerosI(revenRegI dst, iRegI src, roddRegI tmp, flagsReg cr)
instruct countLeadingZerosL(revenRegI dst, iRegL src, roddRegI tmp, flagsReg cr) %{
match(Set dst (CountLeadingZerosL src));
effect(KILL tmp, KILL cr);
predicate(UseCountLeadingZerosInstruction); // See Matcher::match_rule_supported
ins_cost(DEFAULT_COST);
size(4);
format %{ "FLOGR $dst,$src \t# count leading zeros (long)\n\t" %}
@ -10655,7 +10652,6 @@ instruct countLeadingZerosL(revenRegI dst, iRegL src, roddRegI tmp, flagsReg cr)
instruct countTrailingZerosI(revenRegI dst, iRegI src, roddRegI tmp, flagsReg cr) %{
match(Set dst (CountTrailingZerosI src));
effect(TEMP_DEF dst, TEMP tmp, KILL cr);
predicate(UseCountLeadingZerosInstruction); // See Matcher::match_rule_supported
ins_cost(8 * DEFAULT_COST);
// TODO: s390 port size(FIXED_SIZE); // Emitted code depends on PreferLAoverADD being on/off.
format %{ "LLGFR $dst,$src \t# clear upper 32 bits (we are dealing with int)\n\t"
@ -10709,7 +10705,6 @@ instruct countTrailingZerosI(revenRegI dst, iRegI src, roddRegI tmp, flagsReg cr
instruct countTrailingZerosL(revenRegI dst, iRegL src, roddRegL tmp, flagsReg cr) %{
match(Set dst (CountTrailingZerosL src));
effect(TEMP_DEF dst, KILL tmp, KILL cr);
predicate(UseCountLeadingZerosInstruction); // See Matcher::match_rule_supported
ins_cost(8 * DEFAULT_COST);
// TODO: s390 port size(FIXED_SIZE); // Emitted code depends on PreferLAoverADD being on/off.
format %{ "LCGR $dst,$src \t# preserve src\n\t"

View File

@ -3831,17 +3831,17 @@ void TemplateTable::newarray() {
// Call runtime.
__ z_llgc(Z_ARG2, at_bcp(1)); // type
// size in Z_tos
__ z_lgfr(Z_ARG3, Z_tos); // size
call_VM(Z_RET,
CAST_FROM_FN_PTR(address, InterpreterRuntime::newarray),
Z_ARG2, Z_tos);
Z_ARG2, Z_ARG3);
}
void TemplateTable::anewarray() {
transition(itos, atos);
__ get_2_byte_integer_at_bcp(Z_ARG3, 1, InterpreterMacroAssembler::Unsigned);
__ get_constant_pool(Z_ARG2);
__ z_llgfr(Z_ARG4, Z_tos);
__ z_lgfr(Z_ARG4, Z_tos);
call_VM(Z_tos, CAST_FROM_FN_PTR(address, InterpreterRuntime::anewarray),
Z_ARG2, Z_ARG3, Z_ARG4);
}

View File

@ -271,6 +271,31 @@ void VM_Version::set_features_string() {
tty->print_cr(" oldest detected generation is %s", _features_string);
_features_string = "z/Architecture (ambiguous detection)";
}
if (has_Crypto_AES()) {
char buf[256];
assert(strlen(_features_string) + 4 + 3*4 + 1 < sizeof(buf), "increase buffer size");
jio_snprintf(buf, sizeof(buf), "%s aes%s%s%s", // String 'aes' must be surrounded by spaces so that jtreg tests recognize it.
_features_string,
has_Crypto_AES128() ? " 128" : "",
has_Crypto_AES192() ? " 192" : "",
has_Crypto_AES256() ? " 256" : "");
_features_string = os::strdup(buf);
}
if (has_Crypto_SHA()) {
char buf[256];
assert(strlen(_features_string) + 4 + 2 + 2*4 + 6 + 1 < sizeof(buf), "increase buffer size");
// String 'sha1' etc must be surrounded by spaces so that jtreg tests recognize it.
jio_snprintf(buf, sizeof(buf), "%s %s%s%s%s",
_features_string,
has_Crypto_SHA1() ? " sha1" : "",
has_Crypto_SHA256() ? " sha256" : "",
has_Crypto_SHA512() ? " sha512" : "",
has_Crypto_GHASH() ? " ghash" : "");
if (has_Crypto_AES()) { os::free((void *)_features_string); }
_features_string = os::strdup(buf);
}
}
// featureBuffer - bit array indicating availability of various features
@ -369,7 +394,7 @@ void VM_Version::print_features_internal(const char* text, bool print_anyway) {
if (has_Crypto()) {
tty->cr();
tty->print_cr("detailled availability of %s capabilities:", "CryptoFacility");
tty->print_cr("detailed availability of %s capabilities:", "CryptoFacility");
if (test_feature_bit(&_cipher_features[0], -1, 2*Cipher::_featureBits)) {
tty->cr();
tty->print_cr(" available: %s", "Message Cipher Functions");
@ -479,7 +504,6 @@ void VM_Version::reset_features(bool reset) {
}
}
void VM_Version::set_features_z900(bool reset) {
reset_features(reset);

View File

@ -171,6 +171,8 @@ frame os::get_sender_for_C_frame(frame* fr) {
}
frame os::current_frame() {
// Expected to return the stack pointer of this method.
// But if inlined, returns the stack pointer of our caller!
intptr_t* csp = (intptr_t*) *((intptr_t*) os::current_stack_pointer());
assert (csp != NULL, "sp should not be NULL");
// Pass a dummy pc. This way we don't have to load it from the
@ -184,8 +186,13 @@ frame os::current_frame() {
assert(senderFrame.pc() != NULL, "Sender pc should not be NULL");
// Return sender of sender of current topframe which hopefully
// both have pc != NULL.
#ifdef _NMT_NOINLINE_ // Is set in slowdebug builds.
// Current_stack_pointer is not inlined, we must pop one more frame.
frame tmp = os::get_sender_for_C_frame(&topframe);
return os::get_sender_for_C_frame(&tmp);
#else
return os::get_sender_for_C_frame(&topframe);
#endif
}
}
@ -374,7 +381,7 @@ JVM_handle_linux_signal(int sig,
// BugId 4454115: A read from a MappedByteBuffer can fault here if the
// underlying file has been truncated. Do not crash the VM in such a case.
CodeBlob* cb = CodeCache::find_blob_unsafe(pc);
nmethod* nm = (cb != NULL && cb->is_nmethod()) ? (nmethod*)cb : NULL;
CompiledMethod* nm = (cb != NULL) ? cb->as_compiled_method_or_null() : NULL;
if (nm != NULL && nm->has_unsafe_access()) {
// We don't really need a stub here! Just set the pending exeption and
// continue at the next instruction after the faulting read. Returning