8257423: [PPC64] Support -XX:-UseInlineCaches

Reviewed-by: stuefe, rrich
This commit is contained in:
Martin Doerr 2020-12-04 11:24:15 +00:00
parent feabddee56
commit 1d2d9815d0
2 changed files with 24 additions and 16 deletions
src/hotspot/cpu/ppc

@ -3153,10 +3153,25 @@ void MacroAssembler::store_klass_gap(Register dst_oop, Register val) {
}
int MacroAssembler::instr_size_for_decode_klass_not_null() {
if (!UseCompressedClassPointers) return 0;
int num_instrs = 1; // shift or move
if (CompressedKlassPointers::base() != 0) num_instrs = 7; // shift + load const + add
return num_instrs * BytesPerInstWord;
static int computed_size = -1;
// Not yet computed?
if (computed_size == -1) {
if (!UseCompressedClassPointers) {
computed_size = 0;
} else {
// Determine by scratch emit.
ResourceMark rm;
int code_size = 8 * BytesPerInstWord;
CodeBuffer cb("decode_klass_not_null scratch buffer", code_size, 0);
MacroAssembler* a = new MacroAssembler(&cb);
a->decode_klass_not_null(R11_scratch1);
computed_size = a->offset();
}
}
return computed_size;
}
void MacroAssembler::decode_klass_not_null(Register dst, Register src) {

@ -1100,8 +1100,7 @@ int MachCallStaticJavaNode::ret_addr_offset() {
int MachCallDynamicJavaNode::ret_addr_offset() {
// Offset is 4 with postalloc expanded calls (bl is one instruction). We use
// postalloc expanded calls if we use inline caches and do not update method data.
if (UseInlineCaches)
return 4;
if (UseInlineCaches) return 4;
int vtable_index = this->_vtable_index;
if (vtable_index < 0) {
@ -1109,8 +1108,7 @@ int MachCallDynamicJavaNode::ret_addr_offset() {
assert(vtable_index == Method::invalid_vtable_index, "correct sentinel value");
return 12;
} else {
assert(!UseInlineCaches, "expect vtable calls only if not using ICs");
return 24;
return 24 + MacroAssembler::instr_size_for_decode_klass_not_null();
}
}
@ -3635,7 +3633,7 @@ encode %{
int start_offset = __ offset();
Register Rtoc = (ra_) ? $constanttablebase : R2_TOC;
#if 0
int vtable_index = this->_vtable_index;
if (_vtable_index < 0) {
// Must be invalid_vtable_index, not nonvirtual_vtable_index.
@ -3656,7 +3654,7 @@ encode %{
__ relocate(virtual_call_Relocation::spec(virtual_call_meta_addr));
emit_call_with_trampoline_stub(_masm, (address)$meth$$method, relocInfo::none);
assert(((MachCallDynamicJavaNode*)this)->ret_addr_offset() == __ offset() - start_offset,
"Fix constant in ret_addr_offset()");
"Fix constant in ret_addr_offset(), expected %d", __ offset() - start_offset);
} else {
assert(!UseInlineCaches, "expect vtable calls only if not using ICs");
// Go thru the vtable. Get receiver klass. Receiver already
@ -3676,14 +3674,9 @@ encode %{
// Call target. Either compiled code or C2I adapter.
__ mtctr(R11_scratch1);
__ bctrl();
if (((MachCallDynamicJavaNode*)this)->ret_addr_offset() != __ offset() - start_offset) {
tty->print(" %d, %d\n", ((MachCallDynamicJavaNode*)this)->ret_addr_offset(),__ offset() - start_offset);
}
assert(((MachCallDynamicJavaNode*)this)->ret_addr_offset() == __ offset() - start_offset,
"Fix constant in ret_addr_offset()");
"Fix constant in ret_addr_offset(), expected %d", __ offset() - start_offset);
}
#endif
Unimplemented(); // ret_addr_offset not yet fixed. Depends on compressed oops (load klass!).
%}
// a runtime call