Skip to content

Commit 1d2d981

Browse files
committed
8257423: [PPC64] Support -XX:-UseInlineCaches
Reviewed-by: stuefe, rrich
1 parent feabdde commit 1d2d981

File tree

2 files changed

+24
-16
lines changed

2 files changed

+24
-16
lines changed

src/hotspot/cpu/ppc/macroAssembler_ppc.cpp

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3153,10 +3153,25 @@ void MacroAssembler::store_klass_gap(Register dst_oop, Register val) {
31533153
}
31543154

31553155
int MacroAssembler::instr_size_for_decode_klass_not_null() {
3156-
if (!UseCompressedClassPointers) return 0;
3157-
int num_instrs = 1; // shift or move
3158-
if (CompressedKlassPointers::base() != 0) num_instrs = 7; // shift + load const + add
3159-
return num_instrs * BytesPerInstWord;
3156+
static int computed_size = -1;
3157+
3158+
// Not yet computed?
3159+
if (computed_size == -1) {
3160+
3161+
if (!UseCompressedClassPointers) {
3162+
computed_size = 0;
3163+
} else {
3164+
// Determine by scratch emit.
3165+
ResourceMark rm;
3166+
int code_size = 8 * BytesPerInstWord;
3167+
CodeBuffer cb("decode_klass_not_null scratch buffer", code_size, 0);
3168+
MacroAssembler* a = new MacroAssembler(&cb);
3169+
a->decode_klass_not_null(R11_scratch1);
3170+
computed_size = a->offset();
3171+
}
3172+
}
3173+
3174+
return computed_size;
31603175
}
31613176

31623177
void MacroAssembler::decode_klass_not_null(Register dst, Register src) {

src/hotspot/cpu/ppc/ppc.ad

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1100,17 +1100,15 @@ int MachCallStaticJavaNode::ret_addr_offset() {
11001100
int MachCallDynamicJavaNode::ret_addr_offset() {
11011101
// Offset is 4 with postalloc expanded calls (bl is one instruction). We use
11021102
// postalloc expanded calls if we use inline caches and do not update method data.
1103-
if (UseInlineCaches)
1104-
return 4;
1103+
if (UseInlineCaches) return 4;
11051104

11061105
int vtable_index = this->_vtable_index;
11071106
if (vtable_index < 0) {
11081107
// Must be invalid_vtable_index, not nonvirtual_vtable_index.
11091108
assert(vtable_index == Method::invalid_vtable_index, "correct sentinel value");
11101109
return 12;
11111110
} else {
1112-
assert(!UseInlineCaches, "expect vtable calls only if not using ICs");
1113-
return 24;
1111+
return 24 + MacroAssembler::instr_size_for_decode_klass_not_null();
11141112
}
11151113
}
11161114

@@ -3635,7 +3633,7 @@ encode %{
36353633
int start_offset = __ offset();
36363634

36373635
Register Rtoc = (ra_) ? $constanttablebase : R2_TOC;
3638-
#if 0
3636+
36393637
int vtable_index = this->_vtable_index;
36403638
if (_vtable_index < 0) {
36413639
// Must be invalid_vtable_index, not nonvirtual_vtable_index.
@@ -3656,7 +3654,7 @@ encode %{
36563654
__ relocate(virtual_call_Relocation::spec(virtual_call_meta_addr));
36573655
emit_call_with_trampoline_stub(_masm, (address)$meth$$method, relocInfo::none);
36583656
assert(((MachCallDynamicJavaNode*)this)->ret_addr_offset() == __ offset() - start_offset,
3659-
"Fix constant in ret_addr_offset()");
3657+
"Fix constant in ret_addr_offset(), expected %d", __ offset() - start_offset);
36603658
} else {
36613659
assert(!UseInlineCaches, "expect vtable calls only if not using ICs");
36623660
// Go thru the vtable. Get receiver klass. Receiver already
@@ -3676,14 +3674,9 @@ encode %{
36763674
// Call target. Either compiled code or C2I adapter.
36773675
__ mtctr(R11_scratch1);
36783676
__ bctrl();
3679-
if (((MachCallDynamicJavaNode*)this)->ret_addr_offset() != __ offset() - start_offset) {
3680-
tty->print(" %d, %d\n", ((MachCallDynamicJavaNode*)this)->ret_addr_offset(),__ offset() - start_offset);
3681-
}
36823677
assert(((MachCallDynamicJavaNode*)this)->ret_addr_offset() == __ offset() - start_offset,
3683-
"Fix constant in ret_addr_offset()");
3678+
"Fix constant in ret_addr_offset(), expected %d", __ offset() - start_offset);
36843679
}
3685-
#endif
3686-
Unimplemented(); // ret_addr_offset not yet fixed. Depends on compressed oops (load klass!).
36873680
%}
36883681

36893682
// a runtime call

0 commit comments

Comments
 (0)