# HG changeset patch # User goetz # Date 1383821231 -3600 # Node ID b245fac3b6a4dd19e1e165589f37384c3ca083af # Parent 38688bfbd633c80be6f2798fa614e49e97e89cfe 8027968: Adapt PPC to 8024927: Nashorn performance regression with CompressedOops Reviewed-by: coleenp, kvn diff -r 38688bfbd633 -r b245fac3b6a4 hotspot/src/cpu/ppc/vm/macroAssembler_ppc.cpp --- a/hotspot/src/cpu/ppc/vm/macroAssembler_ppc.cpp Thu Nov 07 11:51:53 2013 +0100 +++ b/hotspot/src/cpu/ppc/vm/macroAssembler_ppc.cpp Thu Nov 07 11:47:11 2013 +0100 @@ -2382,10 +2382,12 @@ void MacroAssembler::encode_klass_not_null(Register dst, Register src) { if (src == noreg) src = dst; - assert(Universe::narrow_klass_base() != NULL, "Base should be initialized"); - load_const(R0, Universe::narrow_klass_base()); - sub(dst, src, R0); - if (Universe::narrow_klass_shift() != 0) { + if (Universe::narrow_klass_base() != 0) { + load_const(R0, Universe::narrow_klass_base()); + sub(dst, src, R0); + } + if (Universe::narrow_klass_shift() != 0 || + Universe::narrow_klass_base() == 0 && src != dst) { // Move required. srdi(dst, src, Universe::narrow_klass_shift()); } } @@ -2399,16 +2401,25 @@ } } +int MacroAssembler::instr_size_for_decode_klass_not_null() { + if (!UseCompressedClassPointers) return 0; + int num_instrs = 1; // shift or move + if (Universe::narrow_klass_base() != 0) num_instrs = 7; // shift + load const + add + return num_instrs * BytesPerInstWord; +} + void MacroAssembler::decode_klass_not_null(Register dst, Register src) { if (src == noreg) src = dst; Register shifted_src = src; - assert(Universe::narrow_klass_base() != NULL, "Base should be initialized"); - if (Universe::narrow_klass_shift() != 0) { + if (Universe::narrow_klass_shift() != 0 || + Universe::narrow_klass_base() == 0 && src != dst) { // Move required. shifted_src = dst; sldi(shifted_src, src, Universe::narrow_klass_shift()); } - load_const(R0, Universe::narrow_klass_base()); - add(dst, shifted_src, R0); + if (Universe::narrow_klass_base() != 0) { + load_const(R0, Universe::narrow_klass_base()); + add(dst, shifted_src, R0); + } } void MacroAssembler::load_klass(Register dst, Register src) { diff -r 38688bfbd633 -r b245fac3b6a4 hotspot/src/cpu/ppc/vm/macroAssembler_ppc.hpp --- a/hotspot/src/cpu/ppc/vm/macroAssembler_ppc.hpp Thu Nov 07 11:51:53 2013 +0100 +++ b/hotspot/src/cpu/ppc/vm/macroAssembler_ppc.hpp Thu Nov 07 11:47:11 2013 +0100 @@ -551,6 +551,7 @@ void load_klass(Register dst, Register src); void load_klass_with_trap_null_check(Register dst, Register src); void store_klass(Register dst_oop, Register klass, Register tmp = R0); + static int instr_size_for_decode_klass_not_null(); void decode_klass_not_null(Register dst, Register src = noreg); void encode_klass_not_null(Register dst, Register src = noreg); diff -r 38688bfbd633 -r b245fac3b6a4 hotspot/src/cpu/ppc/vm/vtableStubs_ppc_64.cpp --- a/hotspot/src/cpu/ppc/vm/vtableStubs_ppc_64.cpp Thu Nov 07 11:51:53 2013 +0100 +++ b/hotspot/src/cpu/ppc/vm/vtableStubs_ppc_64.cpp Thu Nov 07 11:47:11 2013 +0100 @@ -255,10 +255,11 @@ if (TraceJumps || DebugVtables || CountCompiledCalls || VerifyOops) { return 1000; } else { + int decode_klass_size = MacroAssembler::instr_size_for_decode_klass_not_null(); if (is_vtable_stub) { - return 20 + 16 + 8; // Plain + (cOops & Traps) + safety + return 20 + decode_klass_size + 8 + 8; // Plain + cOops + Traps + safety } else { - return 16 + 96; + return 96 + decode_klass_size + 12 + 8; // Plain + cOops + Traps + safety } } }