< prev index next >

src/hotspot/cpu/s390/c1_LIRGenerator_s390.cpp

BarrierSetC1

*** 138,148 **** LIR_Address* LIRGenerator::generate_address(LIR_Opr base, LIR_Opr index, int shift, int disp, BasicType type) { assert(base->is_register(), "must be"); if (index->is_constant()) { ! intptr_t large_disp = ((intx)(index->as_constant_ptr()->as_jint()) << shift) + disp; if (Displacement::is_validDisp(large_disp)) { return new LIR_Address(base, large_disp, type); } // Index is illegal so replace it with the displacement loaded into a register. index = new_pointer_register(); --- 138,154 ---- LIR_Address* LIRGenerator::generate_address(LIR_Opr base, LIR_Opr index, int shift, int disp, BasicType type) { assert(base->is_register(), "must be"); if (index->is_constant()) { ! intx large_disp = disp; ! LIR_Const *constant = index->as_constant_ptr(); ! if (constant->type() == T_LONG) { ! large_disp += constant->as_jlong() << shift; ! } else { ! large_disp += (intx)(constant->as_jint()) << shift; ! } if (Displacement::is_validDisp(large_disp)) { return new LIR_Address(base, large_disp, type); } // Index is illegal so replace it with the displacement loaded into a register. index = new_pointer_register(); ***************
*** 157,167 **** return new LIR_Address(base, index, disp, type); } } LIR_Address* LIRGenerator::emit_array_address(LIR_Opr array_opr, LIR_Opr index_opr, ! BasicType type, bool needs_card_mark) { int elem_size = type2aelembytes(type); int shift = exact_log2(elem_size); int offset_in_bytes = arrayOopDesc::base_offset_in_bytes(type); LIR_Address* addr; --- 163,173 ---- return new LIR_Address(base, index, disp, type); } } LIR_Address* LIRGenerator::emit_array_address(LIR_Opr array_opr, LIR_Opr index_opr, ! BasicType type) { int elem_size = type2aelembytes(type); int shift = exact_log2(elem_size); int offset_in_bytes = arrayOopDesc::base_offset_in_bytes(type); LIR_Address* addr; ***************
*** 179,198 **** } addr = new LIR_Address(array_opr, index_opr, offset_in_bytes, type); } ! if (needs_card_mark) { ! // This store will need a precise card mark, so go ahead and ! // compute the full adddres instead of computing once for the ! // store and again for the card mark. ! LIR_Opr tmp = new_pointer_register(); ! __ leal(LIR_OprFact::address(addr), tmp); ! return new LIR_Address(tmp, type); ! } else { ! return addr; ! } } LIR_Opr LIRGenerator::load_immediate(int x, BasicType type) { LIR_Opr r = LIR_OprFact::illegalOpr; if (type == T_LONG) { --- 185,195 ---- } addr = new LIR_Address(array_opr, index_opr, offset_in_bytes, type); } ! return addr; } LIR_Opr LIRGenerator::load_immediate(int x, BasicType type) { LIR_Opr r = LIR_OprFact::illegalOpr; if (type == T_LONG) { ***************
*** 250,339 **** //---------------------------------------------------------------------- // visitor functions //---------------------------------------------------------------------- ! void LIRGenerator::do_StoreIndexed(StoreIndexed* x) { ! assert(x->is_pinned(),""); ! bool needs_range_check = x->compute_needs_range_check(); ! bool use_length = x->length() != NULL; ! bool obj_store = x->elt_type() == T_ARRAY || x->elt_type() == T_OBJECT; ! bool needs_store_check = obj_store && (x->value()->as_Constant() == NULL || ! !get_jobject_constant(x->value())->is_null_object() || ! x->should_profile()); ! ! LIRItem array(x->array(), this); ! LIRItem index(x->index(), this); ! LIRItem value(x->value(), this); ! LIRItem length(this); ! ! array.load_item(); ! index.load_nonconstant(20); ! ! if (use_length && needs_range_check) { ! length.set_instruction(x->length()); ! length.load_item(); ! } ! if (needs_store_check || x->check_boolean()) { ! value.load_item(); ! } else { ! value.load_for_store(x->elt_type()); ! } ! ! set_no_result(x); ! ! // The CodeEmitInfo must be duplicated for each different ! // LIR-instruction because spilling can occur anywhere between two ! // instructions and so the debug information must be different. ! CodeEmitInfo* range_check_info = state_for (x); ! CodeEmitInfo* null_check_info = NULL; ! if (x->needs_null_check()) { ! null_check_info = new CodeEmitInfo(range_check_info); ! } ! ! // Emit array address setup early so it schedules better. ! LIR_Address* array_addr = emit_array_address(array.result(), index.result(), x->elt_type(), obj_store); ! if (value.result()->is_constant() && array_addr->index()->is_valid()) { ! // Constants cannot be stored with index register on ZARCH_64 (see LIR_Assembler::const2mem()). ! LIR_Opr tmp = new_pointer_register(); ! __ leal(LIR_OprFact::address(array_addr), tmp); ! array_addr = new LIR_Address(tmp, x->elt_type()); ! } ! ! if (GenerateRangeChecks && needs_range_check) { ! if (use_length) { ! __ cmp(lir_cond_belowEqual, length.result(), index.result()); ! __ branch(lir_cond_belowEqual, T_INT, new RangeCheckStub(range_check_info, index.result())); ! } else { ! array_range_check(array.result(), index.result(), null_check_info, range_check_info); ! // Range_check also does the null check. ! null_check_info = NULL; ! } ! } ! ! if (GenerateArrayStoreCheck && needs_store_check) { ! LIR_Opr tmp1 = new_register(objectType); ! LIR_Opr tmp2 = new_register(objectType); ! LIR_Opr tmp3 = LIR_OprFact::illegalOpr; ! ! CodeEmitInfo* store_check_info = new CodeEmitInfo(range_check_info); ! __ store_check(value.result(), array.result(), tmp1, tmp2, tmp3, store_check_info, x->profiled_method(), x->profiled_bci()); ! } ! ! if (obj_store) { ! // Needs GC write barriers. ! pre_barrier(LIR_OprFact::address(array_addr), LIR_OprFact::illegalOpr /* pre_val */, ! true /* do_load */, false /* patch */, NULL); ! } ! ! LIR_Opr result = maybe_mask_boolean(x, array.result(), value.result(), null_check_info); ! __ move(result, array_addr, null_check_info); ! ! if (obj_store) { ! // Precise card mark ! post_barrier(LIR_OprFact::address(array_addr), value.result()); ! } } void LIRGenerator::do_MonitorEnter(MonitorEnter* x) { assert(x->is_pinned(),""); LIRItem obj(x->obj(), this); --- 247,261 ---- //---------------------------------------------------------------------- // visitor functions //---------------------------------------------------------------------- ! void LIRGenerator::array_store_check(LIR_Opr value, LIR_Opr array, CodeEmitInfo* store_check_info, ciMethod* profiled_method, int profiled_bci) { ! LIR_Opr tmp1 = new_register(objectType); ! LIR_Opr tmp2 = new_register(objectType); ! LIR_Opr tmp3 = LIR_OprFact::illegalOpr; ! __ store_check(value, array, tmp1, tmp2, tmp3, store_check_info, profiled_method, profiled_bci); } void LIRGenerator::do_MonitorEnter(MonitorEnter* x) { assert(x->is_pinned(),""); LIRItem obj(x->obj(), this); ***************
*** 663,725 **** } else { ShouldNotReachHere(); } } ! void LIRGenerator::do_CompareAndSwap(Intrinsic* x, ValueType* type) { ! assert(x->number_of_arguments() == 4, "wrong type"); ! LIRItem obj (x->argument_at(0), this); // object ! LIRItem offset(x->argument_at(1), this); // offset of field ! LIRItem cmp (x->argument_at(2), this); // Value to compare with field. ! LIRItem val (x->argument_at(3), this); // Replace field with val if matches cmp. ! ! // Get address of field. ! obj.load_item(); ! offset.load_nonconstant(20); ! cmp.load_item(); ! val.load_item(); ! ! LIR_Opr addr = new_pointer_register(); ! LIR_Address* a; ! if (offset.result()->is_constant()) { ! assert(Immediate::is_simm20(offset.result()->as_jlong()), "should have been loaded into register"); ! a = new LIR_Address(obj.result(), ! offset.result()->as_jlong(), ! as_BasicType(type)); ! } else { ! a = new LIR_Address(obj.result(), ! offset.result(), ! 0, ! as_BasicType(type)); ! } ! __ leal(LIR_OprFact::address(a), addr); ! ! if (type == objectType) { // Write-barrier needed for Object fields. ! pre_barrier(addr, LIR_OprFact::illegalOpr /* pre_val */, ! true /* do_load */, false /* patch */, NULL); ! } ! ! LIR_Opr ill = LIR_OprFact::illegalOpr; // for convenience ! if (type == objectType) { ! __ cas_obj(addr, cmp.result(), val.result(), new_register(T_OBJECT), new_register(T_OBJECT)); ! } else if (type == intType) { ! __ cas_int(addr, cmp.result(), val.result(), ill, ill); ! } else if (type == longType) { ! __ cas_long(addr, cmp.result(), val.result(), ill, ill); } else { ShouldNotReachHere(); } // Generate conditional move of boolean result. ! LIR_Opr result = rlock_result(x); __ cmove(lir_cond_equal, LIR_OprFact::intConst(1), LIR_OprFact::intConst(0), ! result, as_BasicType(type)); ! if (type == objectType) { // Write-barrier needed for Object fields. ! // Precise card mark since could either be object or array ! post_barrier(addr, val.result()); ! } } void LIRGenerator::do_MathIntrinsic(Intrinsic* x) { switch (x->id()) { case vmIntrinsics::_dabs: case vmIntrinsics::_dsqrt: { --- 585,630 ---- } else { ShouldNotReachHere(); } } ! LIR_Opr LIRGenerator::atomic_cmpxchg(BasicType type, LIR_Opr addr, LIRItem& cmp_value, LIRItem& new_value) { ! LIR_Opr t1 = LIR_OprFact::illegalOpr; ! LIR_Opr t2 = LIR_OprFact::illegalOpr; ! cmp_value.load_item(); ! new_value.load_item(); ! if (type == T_OBJECT) { ! if (UseCompressedOops) { ! t1 = new_register(T_OBJECT); ! t2 = new_register(T_OBJECT); ! } ! __ cas_obj(addr->as_address_ptr()->base(), cmp_value.result(), new_value.result(), t1, t2); ! } else if (type == T_INT) { ! __ cas_int(addr->as_address_ptr()->base(), cmp_value.result(), new_value.result(), t1, t2); ! } else if (type == T_LONG) { ! __ cas_long(addr->as_address_ptr()->base(), cmp_value.result(), new_value.result(), t1, t2); } else { ShouldNotReachHere(); } // Generate conditional move of boolean result. ! LIR_Opr result = new_register(T_INT); __ cmove(lir_cond_equal, LIR_OprFact::intConst(1), LIR_OprFact::intConst(0), ! result, type); ! return result; } + LIR_Opr LIRGenerator::atomic_xchg(BasicType type, LIR_Opr addr, LIRItem& value) { + Unimplemented(); // Currently not supported on this platform. + return LIR_OprFact::illegalOpr; + } + + LIR_Opr LIRGenerator::atomic_add(BasicType type, LIR_Opr addr, LIRItem& value) { + LIR_Opr result = new_register(type); + value.load_item(); + __ xadd(addr, value.result(), result, LIR_OprFact::illegalOpr); + return result; + } void LIRGenerator::do_MathIntrinsic(Intrinsic* x) { switch (x->id()) { case vmIntrinsics::_dabs: case vmIntrinsics::_dsqrt: { ***************
*** 1102,1162 **** void LIRGenerator::volatile_field_load(LIR_Address* address, LIR_Opr result, CodeEmitInfo* info) { __ load(address, result, info); } - - void LIRGenerator::put_Object_unsafe(LIR_Opr src, LIR_Opr offset, LIR_Opr data, - BasicType type, bool is_volatile) { - LIR_Address* addr = new LIR_Address(src, offset, type); - bool is_obj = (type == T_ARRAY || type == T_OBJECT); - if (is_obj) { - // Do the pre-write barrier, if any. - pre_barrier(LIR_OprFact::address(addr), LIR_OprFact::illegalOpr /* pre_val */, - true /* do_load */, false /* patch */, NULL); - __ move(data, addr); - assert(src->is_register(), "must be register"); - // Seems to be a precise address. - post_barrier(LIR_OprFact::address(addr), data); - } else { - __ move(data, addr); - } - } - - - void LIRGenerator::get_Object_unsafe(LIR_Opr dst, LIR_Opr src, LIR_Opr offset, - BasicType type, bool is_volatile) { - LIR_Address* addr = new LIR_Address(src, offset, type); - __ load(addr, dst); - } - - void LIRGenerator::do_UnsafeGetAndSetObject(UnsafeGetAndSetObject* x) { - BasicType type = x->basic_type(); - assert (x->is_add() && type != T_ARRAY && type != T_OBJECT, "not supported"); - LIRItem src(x->object(), this); - LIRItem off(x->offset(), this); - LIRItem value(x->value(), this); - - src.load_item(); - value.load_item(); - off.load_nonconstant(20); - - LIR_Opr dst = rlock_result(x, type); - LIR_Opr data = value.result(); - LIR_Opr offset = off.result(); - - LIR_Address* addr; - if (offset->is_constant()) { - assert(Immediate::is_simm20(offset->as_jlong()), "should have been loaded into register"); - addr = new LIR_Address(src.result(), offset->as_jlong(), type); - } else { - addr = new LIR_Address(src.result(), offset, type); - } - - __ xadd(LIR_OprFact::address(addr), data, dst, LIR_OprFact::illegalOpr); - } - void LIRGenerator::do_update_CRC32(Intrinsic* x) { assert(UseCRC32Intrinsics, "or should not be here"); LIR_Opr result = rlock_result(x); switch (x->id()) { --- 1007,1016 ----
< prev index next >