< prev index next >

src/hotspot/cpu/ppc/macroAssembler_ppc.cpp

Print this page




1994   std(super_klass, target_offset, sub_klass); // save result to cache
1995   if (result_reg != noreg) { li(result_reg, 0); } // load zero result (indicates a hit)
1996   if (L_success != NULL) { b(*L_success); }
1997   else if (result_reg == noreg) { blr(); } // return with CR0.eq if neither label nor result reg provided
1998 
1999   bind(fallthru);
2000 }
2001 
2002 // Try fast path, then go to slow one if not successful
2003 void MacroAssembler::check_klass_subtype(Register sub_klass,
2004                          Register super_klass,
2005                          Register temp1_reg,
2006                          Register temp2_reg,
2007                          Label& L_success) {
2008   Label L_failure;
2009   check_klass_subtype_fast_path(sub_klass, super_klass, temp1_reg, temp2_reg, &L_success, &L_failure);
2010   check_klass_subtype_slow_path(sub_klass, super_klass, temp1_reg, temp2_reg, &L_success);
2011   bind(L_failure); // Fallthru if not successful.
2012 }
2013 
2014 void MacroAssembler::clinit_barrier(Register klass, Register thread, Label* L_fast_path, Label* L_slow_path) {
2015   assert(L_fast_path != NULL || L_slow_path != NULL, "at least one is required");
2016 
2017   Label L_fallthrough;
2018   if (L_fast_path == NULL) {
2019     L_fast_path = &L_fallthrough;
2020   } else if (L_slow_path == NULL) {
2021     L_slow_path = &L_fallthrough;
2022   }
2023 
2024   // Fast path check: class is fully initialized
2025   lbz(R0, in_bytes(InstanceKlass::init_state_offset()), klass);
2026   cmpwi(CCR0, R0, InstanceKlass::fully_initialized);
2027   beq(CCR0, *L_fast_path);
2028 
2029   // Fast path check: current thread is initializer thread
2030   ld(R0, in_bytes(InstanceKlass::init_thread_offset()), klass);
2031   cmpd(CCR0, thread, R0);
2032   if (L_slow_path == &L_fallthrough) {
2033     beq(CCR0, *L_fast_path);
2034   } else if (L_fast_path == &L_fallthrough) {
2035     bne(CCR0, *L_slow_path);
2036   } else {
2037     Unimplemented();
2038   }
2039 
2040   bind(L_fallthrough);
2041 }
2042 
2043 void MacroAssembler::check_method_handle_type(Register mtype_reg, Register mh_reg,
2044                                               Register temp_reg,
2045                                               Label& wrong_method_type) {
2046   assert_different_registers(mtype_reg, mh_reg, temp_reg);
2047   // Compare method type against that of the receiver.
2048   load_heap_oop(temp_reg, delayed_value(java_lang_invoke_MethodHandle::type_offset_in_bytes, temp_reg), mh_reg,
2049                 noreg, noreg, false, IS_NOT_NULL);
2050   cmpd(CCR0, temp_reg, mtype_reg);
2051   bne(CCR0, wrong_method_type);
2052 }
2053 
2054 RegisterOrConstant MacroAssembler::argument_offset(RegisterOrConstant arg_slot,
2055                                                    Register temp_reg,
2056                                                    int extra_slot_offset) {
2057   // cf. TemplateTable::prepare_invoke(), if (load_receiver).
2058   int stackElementSize = Interpreter::stackElementSize;
2059   int offset = extra_slot_offset * stackElementSize;
2060   if (arg_slot.is_constant()) {
2061     offset += arg_slot.as_constant() * stackElementSize;
2062     return offset;


3204   if (UseCompressedClassPointers) {
3205     lwz(dst, oopDesc::klass_offset_in_bytes(), src);
3206     // Attention: no null check here!
3207     decode_klass_not_null(dst, dst);
3208   } else {
3209     ld(dst, oopDesc::klass_offset_in_bytes(), src);
3210   }
3211 }
3212 
3213 // ((OopHandle)result).resolve();
3214 void MacroAssembler::resolve_oop_handle(Register result) {
3215   // OopHandle::resolve is an indirection.
3216   ld(result, 0, result);
3217 }
3218 
3219 void MacroAssembler::load_mirror_from_const_method(Register mirror, Register const_method) {
3220   ld(mirror, in_bytes(ConstMethod::constants_offset()), const_method);
3221   ld(mirror, ConstantPool::pool_holder_offset_in_bytes(), mirror);
3222   ld(mirror, in_bytes(Klass::java_mirror_offset()), mirror);
3223   resolve_oop_handle(mirror);
3224 }
3225 
3226 void MacroAssembler::load_method_holder(Register holder, Register method) {
3227   ld(holder, in_bytes(Method::const_offset()), method);
3228   ld(holder, in_bytes(ConstMethod::constants_offset()), holder);
3229   ld(holder, ConstantPool::pool_holder_offset_in_bytes(), holder);
3230 }
3231 
3232 // Clear Array
3233 // For very short arrays. tmp == R0 is allowed.
3234 void MacroAssembler::clear_memory_unrolled(Register base_ptr, int cnt_dwords, Register tmp, int offset) {
3235   if (cnt_dwords > 0) { li(tmp, 0); }
3236   for (int i = 0; i < cnt_dwords; ++i) { std(tmp, offset + i * 8, base_ptr); }
3237 }
3238 
3239 // Version for constant short array length. Kills base_ptr. tmp == R0 is allowed.
3240 void MacroAssembler::clear_memory_constlen(Register base_ptr, int cnt_dwords, Register tmp) {
3241   if (cnt_dwords < 8) {
3242     clear_memory_unrolled(base_ptr, cnt_dwords, tmp);
3243     return;
3244   }
3245 
3246   Label loop;
3247   const long loopcnt   = cnt_dwords >> 1,
3248              remainder = cnt_dwords & 1;
3249 




1994   std(super_klass, target_offset, sub_klass); // save result to cache
1995   if (result_reg != noreg) { li(result_reg, 0); } // load zero result (indicates a hit)
1996   if (L_success != NULL) { b(*L_success); }
1997   else if (result_reg == noreg) { blr(); } // return with CR0.eq if neither label nor result reg provided
1998 
1999   bind(fallthru);
2000 }
2001 
2002 // Try fast path, then go to slow one if not successful
2003 void MacroAssembler::check_klass_subtype(Register sub_klass,
2004                          Register super_klass,
2005                          Register temp1_reg,
2006                          Register temp2_reg,
2007                          Label& L_success) {
2008   Label L_failure;
2009   check_klass_subtype_fast_path(sub_klass, super_klass, temp1_reg, temp2_reg, &L_success, &L_failure);
2010   check_klass_subtype_slow_path(sub_klass, super_klass, temp1_reg, temp2_reg, &L_success);
2011   bind(L_failure); // Fallthru if not successful.
2012 }
2013 





























2014 void MacroAssembler::check_method_handle_type(Register mtype_reg, Register mh_reg,
2015                                               Register temp_reg,
2016                                               Label& wrong_method_type) {
2017   assert_different_registers(mtype_reg, mh_reg, temp_reg);
2018   // Compare method type against that of the receiver.
2019   load_heap_oop(temp_reg, delayed_value(java_lang_invoke_MethodHandle::type_offset_in_bytes, temp_reg), mh_reg,
2020                 noreg, noreg, false, IS_NOT_NULL);
2021   cmpd(CCR0, temp_reg, mtype_reg);
2022   bne(CCR0, wrong_method_type);
2023 }
2024 
2025 RegisterOrConstant MacroAssembler::argument_offset(RegisterOrConstant arg_slot,
2026                                                    Register temp_reg,
2027                                                    int extra_slot_offset) {
2028   // cf. TemplateTable::prepare_invoke(), if (load_receiver).
2029   int stackElementSize = Interpreter::stackElementSize;
2030   int offset = extra_slot_offset * stackElementSize;
2031   if (arg_slot.is_constant()) {
2032     offset += arg_slot.as_constant() * stackElementSize;
2033     return offset;


3175   if (UseCompressedClassPointers) {
3176     lwz(dst, oopDesc::klass_offset_in_bytes(), src);
3177     // Attention: no null check here!
3178     decode_klass_not_null(dst, dst);
3179   } else {
3180     ld(dst, oopDesc::klass_offset_in_bytes(), src);
3181   }
3182 }
3183 
3184 // ((OopHandle)result).resolve();
3185 void MacroAssembler::resolve_oop_handle(Register result) {
3186   // OopHandle::resolve is an indirection.
3187   ld(result, 0, result);
3188 }
3189 
3190 void MacroAssembler::load_mirror_from_const_method(Register mirror, Register const_method) {
3191   ld(mirror, in_bytes(ConstMethod::constants_offset()), const_method);
3192   ld(mirror, ConstantPool::pool_holder_offset_in_bytes(), mirror);
3193   ld(mirror, in_bytes(Klass::java_mirror_offset()), mirror);
3194   resolve_oop_handle(mirror);






3195 }
3196 
3197 // Clear Array
3198 // For very short arrays. tmp == R0 is allowed.
3199 void MacroAssembler::clear_memory_unrolled(Register base_ptr, int cnt_dwords, Register tmp, int offset) {
3200   if (cnt_dwords > 0) { li(tmp, 0); }
3201   for (int i = 0; i < cnt_dwords; ++i) { std(tmp, offset + i * 8, base_ptr); }
3202 }
3203 
3204 // Version for constant short array length. Kills base_ptr. tmp == R0 is allowed.
3205 void MacroAssembler::clear_memory_constlen(Register base_ptr, int cnt_dwords, Register tmp) {
3206   if (cnt_dwords < 8) {
3207     clear_memory_unrolled(base_ptr, cnt_dwords, tmp);
3208     return;
3209   }
3210 
3211   Label loop;
3212   const long loopcnt   = cnt_dwords >> 1,
3213              remainder = cnt_dwords & 1;
3214 


< prev index next >