Path: blob/master/src/hotspot/cpu/ppc/c1_LIRGenerator_ppc.cpp
40930 views
/*1* Copyright (c) 2005, 2021, Oracle and/or its affiliates. All rights reserved.2* Copyright (c) 2012, 2019 SAP SE. All rights reserved.3* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.4*5* This code is free software; you can redistribute it and/or modify it6* under the terms of the GNU General Public License version 2 only, as7* published by the Free Software Foundation.8*9* This code is distributed in the hope that it will be useful, but WITHOUT10* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or11* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License12* version 2 for more details (a copy is included in the LICENSE file that13* accompanied this code).14*15* You should have received a copy of the GNU General Public License version16* 2 along with this work; if not, write to the Free Software Foundation,17* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.18*19* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA20* or visit www.oracle.com if you need additional information or have any21* questions.22*23*/2425#include "precompiled.hpp"26#include "asm/macroAssembler.inline.hpp"27#include "c1/c1_Compilation.hpp"28#include "c1/c1_FrameMap.hpp"29#include "c1/c1_Instruction.hpp"30#include "c1/c1_LIRAssembler.hpp"31#include "c1/c1_LIRGenerator.hpp"32#include "c1/c1_Runtime1.hpp"33#include "c1/c1_ValueStack.hpp"34#include "ci/ciArray.hpp"35#include "ci/ciObjArrayKlass.hpp"36#include "ci/ciTypeArrayKlass.hpp"37#include "runtime/sharedRuntime.hpp"38#include "runtime/stubRoutines.hpp"39#include "runtime/vm_version.hpp"40#include "utilities/powerOfTwo.hpp"41#include "vmreg_ppc.inline.hpp"4243#ifdef ASSERT44#define __ gen()->lir(__FILE__, __LINE__)->45#else46#define __ gen()->lir()->47#endif4849void LIRItem::load_byte_item() {50// Byte loads use same registers as other loads.51load_item();52}535455void LIRItem::load_nonconstant() {56LIR_Opr r = value()->operand();57if (_gen->can_inline_as_constant(value())) {58if (!r->is_constant()) {59r = LIR_OprFact::value_type(value()->type());60}61_result = r;62} else {63load_item();64}65}666768//--------------------------------------------------------------69// LIRGenerator70//--------------------------------------------------------------7172LIR_Opr LIRGenerator::exceptionOopOpr() { return FrameMap::R3_oop_opr; }73LIR_Opr LIRGenerator::exceptionPcOpr() { return FrameMap::R4_opr; }74LIR_Opr LIRGenerator::syncLockOpr() { return FrameMap::R5_opr; } // Need temp effect for MonitorEnterStub.75LIR_Opr LIRGenerator::syncTempOpr() { return FrameMap::R4_oop_opr; } // Need temp effect for MonitorEnterStub.76LIR_Opr LIRGenerator::getThreadTemp() { return LIR_OprFact::illegalOpr; } // not needed7778LIR_Opr LIRGenerator::result_register_for(ValueType* type, bool callee) {79LIR_Opr opr;80switch (type->tag()) {81case intTag: opr = FrameMap::R3_opr; break;82case objectTag: opr = FrameMap::R3_oop_opr; break;83case longTag: opr = FrameMap::R3_long_opr; break;84case floatTag: opr = FrameMap::F1_opr; break;85case doubleTag: opr = FrameMap::F1_double_opr; break;8687case addressTag:88default: ShouldNotReachHere(); return LIR_OprFact::illegalOpr;89}9091assert(opr->type_field() == as_OprType(as_BasicType(type)), "type mismatch");92return opr;93}9495LIR_Opr LIRGenerator::rlock_callee_saved(BasicType type) {96ShouldNotReachHere();97return LIR_OprFact::illegalOpr;98}99100101LIR_Opr LIRGenerator::rlock_byte(BasicType type) {102return new_register(T_INT);103}104105106//--------- loading items into registers --------------------------------107108// PPC cannot inline all constants.109bool LIRGenerator::can_store_as_constant(Value v, BasicType type) const {110if (v->type()->as_IntConstant() != NULL) {111return Assembler::is_simm16(v->type()->as_IntConstant()->value());112} else if (v->type()->as_LongConstant() != NULL) {113return Assembler::is_simm16(v->type()->as_LongConstant()->value());114} else if (v->type()->as_ObjectConstant() != NULL) {115return v->type()->as_ObjectConstant()->value()->is_null_object();116} else {117return false;118}119}120121122// Only simm16 constants can be inlined.123bool LIRGenerator::can_inline_as_constant(Value i) const {124return can_store_as_constant(i, as_BasicType(i->type()));125}126127128bool LIRGenerator::can_inline_as_constant(LIR_Const* c) const {129if (c->type() == T_INT) {130return Assembler::is_simm16(c->as_jint());131}132if (c->type() == T_LONG) {133return Assembler::is_simm16(c->as_jlong());134}135if (c->type() == T_OBJECT) {136return c->as_jobject() == NULL;137}138return false;139}140141142LIR_Opr LIRGenerator::safepoint_poll_register() {143return new_register(T_INT);144}145146147LIR_Address* LIRGenerator::generate_address(LIR_Opr base, LIR_Opr index,148int shift, int disp, BasicType type) {149assert(base->is_register(), "must be");150intx large_disp = disp;151152// Accumulate fixed displacements.153if (index->is_constant()) {154LIR_Const *constant = index->as_constant_ptr();155if (constant->type() == T_LONG) {156large_disp += constant->as_jlong() << shift;157} else {158large_disp += (intx)(constant->as_jint()) << shift;159}160index = LIR_OprFact::illegalOpr;161}162163if (index->is_register()) {164// Apply the shift and accumulate the displacement.165if (shift > 0) {166LIR_Opr tmp = new_pointer_register();167__ shift_left(index, shift, tmp);168index = tmp;169}170if (large_disp != 0) {171LIR_Opr tmp = new_pointer_register();172if (Assembler::is_simm16(large_disp)) {173__ add(index, LIR_OprFact::intptrConst(large_disp), tmp);174index = tmp;175} else {176__ move(LIR_OprFact::intptrConst(large_disp), tmp);177__ add(tmp, index, tmp);178index = tmp;179}180large_disp = 0;181}182} else if (!Assembler::is_simm16(large_disp)) {183// Index is illegal so replace it with the displacement loaded into a register.184index = new_pointer_register();185__ move(LIR_OprFact::intptrConst(large_disp), index);186large_disp = 0;187}188189// At this point we either have base + index or base + displacement.190if (large_disp == 0) {191return new LIR_Address(base, index, type);192} else {193assert(Assembler::is_simm16(large_disp), "must be");194return new LIR_Address(base, large_disp, type);195}196}197198199LIR_Address* LIRGenerator::emit_array_address(LIR_Opr array_opr, LIR_Opr index_opr,200BasicType type) {201int elem_size = type2aelembytes(type);202int shift = exact_log2(elem_size);203204LIR_Opr base_opr;205intx offset = arrayOopDesc::base_offset_in_bytes(type);206207if (index_opr->is_constant()) {208intx i = index_opr->as_constant_ptr()->as_jint();209intx array_offset = i * elem_size;210if (Assembler::is_simm16(array_offset + offset)) {211base_opr = array_opr;212offset = array_offset + offset;213} else {214base_opr = new_pointer_register();215if (Assembler::is_simm16(array_offset)) {216__ add(array_opr, LIR_OprFact::intptrConst(array_offset), base_opr);217} else {218__ move(LIR_OprFact::intptrConst(array_offset), base_opr);219__ add(base_opr, array_opr, base_opr);220}221}222} else {223#ifdef _LP64224if (index_opr->type() == T_INT) {225LIR_Opr tmp = new_register(T_LONG);226__ convert(Bytecodes::_i2l, index_opr, tmp);227index_opr = tmp;228}229#endif230231base_opr = new_pointer_register();232assert (index_opr->is_register(), "Must be register");233if (shift > 0) {234__ shift_left(index_opr, shift, base_opr);235__ add(base_opr, array_opr, base_opr);236} else {237__ add(index_opr, array_opr, base_opr);238}239}240return new LIR_Address(base_opr, offset, type);241}242243244LIR_Opr LIRGenerator::load_immediate(int x, BasicType type) {245LIR_Opr r = NULL;246if (type == T_LONG) {247r = LIR_OprFact::longConst(x);248} else if (type == T_INT) {249r = LIR_OprFact::intConst(x);250} else {251ShouldNotReachHere();252}253if (!Assembler::is_simm16(x)) {254LIR_Opr tmp = new_register(type);255__ move(r, tmp);256return tmp;257}258return r;259}260261262void LIRGenerator::increment_counter(address counter, BasicType type, int step) {263LIR_Opr pointer = new_pointer_register();264__ move(LIR_OprFact::intptrConst(counter), pointer);265LIR_Address* addr = new LIR_Address(pointer, type);266increment_counter(addr, step);267}268269270void LIRGenerator::increment_counter(LIR_Address* addr, int step) {271LIR_Opr temp = new_register(addr->type());272__ move(addr, temp);273__ add(temp, load_immediate(step, addr->type()), temp);274__ move(temp, addr);275}276277278void LIRGenerator::cmp_mem_int(LIR_Condition condition, LIR_Opr base, int disp, int c, CodeEmitInfo* info) {279LIR_Opr tmp = FrameMap::R0_opr;280__ load(new LIR_Address(base, disp, T_INT), tmp, info);281__ cmp(condition, tmp, c);282}283284285void LIRGenerator::cmp_reg_mem(LIR_Condition condition, LIR_Opr reg, LIR_Opr base,286int disp, BasicType type, CodeEmitInfo* info) {287LIR_Opr tmp = FrameMap::R0_opr;288__ load(new LIR_Address(base, disp, type), tmp, info);289__ cmp(condition, reg, tmp);290}291292293bool LIRGenerator::strength_reduce_multiply(LIR_Opr left, jint c, LIR_Opr result, LIR_Opr tmp) {294assert(left != result, "should be different registers");295if (is_power_of_2(c + 1)) {296__ shift_left(left, log2i_exact(c + 1), result);297__ sub(result, left, result);298return true;299} else if (is_power_of_2(c - 1)) {300__ shift_left(left, log2i_exact(c - 1), result);301__ add(result, left, result);302return true;303}304return false;305}306307308void LIRGenerator::store_stack_parameter(LIR_Opr item, ByteSize offset_from_sp) {309BasicType t = item->type();310LIR_Opr sp_opr = FrameMap::SP_opr;311if ((t == T_LONG || t == T_DOUBLE) &&312(in_bytes(offset_from_sp) % 8 != 0)) {313__ unaligned_move(item, new LIR_Address(sp_opr, in_bytes(offset_from_sp), t));314} else {315__ move(item, new LIR_Address(sp_opr, in_bytes(offset_from_sp), t));316}317}318319320//----------------------------------------------------------------------321// visitor functions322//----------------------------------------------------------------------323324void LIRGenerator::array_store_check(LIR_Opr value, LIR_Opr array, CodeEmitInfo* store_check_info, ciMethod* profiled_method, int profiled_bci) {325// Following registers are used by slow_subtype_check:326LIR_Opr tmp1 = FrameMap::R4_opr; // super_klass327LIR_Opr tmp2 = FrameMap::R5_opr; // sub_klass328LIR_Opr tmp3 = FrameMap::R6_opr; // temp329__ store_check(value, array, tmp1, tmp2, tmp3, store_check_info, profiled_method, profiled_bci);330}331332333void LIRGenerator::do_MonitorEnter(MonitorEnter* x) {334assert(x->is_pinned(),"");335LIRItem obj(x->obj(), this);336obj.load_item();337338set_no_result(x);339340// We use R4+R5 in order to get a temp effect. These regs are used in slow path (MonitorEnterStub).341LIR_Opr lock = FrameMap::R5_opr;342LIR_Opr scratch = FrameMap::R4_opr;343LIR_Opr hdr = FrameMap::R6_opr;344345CodeEmitInfo* info_for_exception = NULL;346if (x->needs_null_check()) {347info_for_exception = state_for(x);348}349350// This CodeEmitInfo must not have the xhandlers because here the351// object is already locked (xhandlers expects object to be unlocked).352CodeEmitInfo* info = state_for(x, x->state(), true);353monitor_enter(obj.result(), lock, hdr, scratch, x->monitor_no(), info_for_exception, info);354}355356357void LIRGenerator::do_MonitorExit(MonitorExit* x) {358assert(x->is_pinned(),"");359LIRItem obj(x->obj(), this);360obj.dont_load_item();361362set_no_result(x);363LIR_Opr lock = FrameMap::R5_opr;364LIR_Opr hdr = FrameMap::R4_opr; // Used for slow path (MonitorExitStub).365LIR_Opr obj_temp = FrameMap::R6_opr;366monitor_exit(obj_temp, lock, hdr, LIR_OprFact::illegalOpr, x->monitor_no());367}368369370// _ineg, _lneg, _fneg, _dneg371void LIRGenerator::do_NegateOp(NegateOp* x) {372LIRItem value(x->x(), this);373value.load_item();374LIR_Opr reg = rlock_result(x);375__ negate(value.result(), reg);376}377378379// for _fadd, _fmul, _fsub, _fdiv, _frem380// _dadd, _dmul, _dsub, _ddiv, _drem381void LIRGenerator::do_ArithmeticOp_FPU(ArithmeticOp* x) {382switch (x->op()) {383case Bytecodes::_fadd:384case Bytecodes::_fmul:385case Bytecodes::_fsub:386case Bytecodes::_fdiv:387case Bytecodes::_dadd:388case Bytecodes::_dmul:389case Bytecodes::_dsub:390case Bytecodes::_ddiv: {391LIRItem left(x->x(), this);392LIRItem right(x->y(), this);393left.load_item();394right.load_item();395rlock_result(x);396arithmetic_op_fpu(x->op(), x->operand(), left.result(), right.result());397}398break;399400case Bytecodes::_frem:401case Bytecodes::_drem: {402address entry = NULL;403switch (x->op()) {404case Bytecodes::_frem:405entry = CAST_FROM_FN_PTR(address, SharedRuntime::frem);406break;407case Bytecodes::_drem:408entry = CAST_FROM_FN_PTR(address, SharedRuntime::drem);409break;410default:411ShouldNotReachHere();412}413LIR_Opr result = call_runtime(x->x(), x->y(), entry, x->type(), NULL);414set_result(x, result);415}416break;417418default: ShouldNotReachHere();419}420}421422423// for _ladd, _lmul, _lsub, _ldiv, _lrem424void LIRGenerator::do_ArithmeticOp_Long(ArithmeticOp* x) {425bool is_div_rem = x->op() == Bytecodes::_ldiv || x->op() == Bytecodes::_lrem;426427LIRItem right(x->y(), this);428// Missing test if instr is commutative and if we should swap.429if (right.value()->type()->as_LongConstant() &&430(x->op() == Bytecodes::_lsub && right.value()->type()->as_LongConstant()->value() == ((-1)<<15)) ) {431// Sub is implemented by addi and can't support min_simm16 as constant..432right.load_item();433} else {434right.load_nonconstant();435}436assert(right.is_constant() || right.is_register(), "wrong state of right");437438if (is_div_rem) {439LIR_Opr divisor = right.result();440if (divisor->is_register()) {441CodeEmitInfo* null_check_info = state_for(x);442__ cmp(lir_cond_equal, divisor, LIR_OprFact::longConst(0));443__ branch(lir_cond_equal, new DivByZeroStub(null_check_info));444} else {445jlong const_divisor = divisor->as_constant_ptr()->as_jlong();446if (const_divisor == 0) {447CodeEmitInfo* null_check_info = state_for(x);448__ jump(new DivByZeroStub(null_check_info));449rlock_result(x);450__ move(LIR_OprFact::longConst(0), x->operand()); // dummy451return;452}453if (x->op() == Bytecodes::_lrem && !is_power_of_2(const_divisor) && const_divisor != -1) {454// Remainder computation would need additional tmp != R0.455right.load_item();456}457}458}459460LIRItem left(x->x(), this);461left.load_item();462rlock_result(x);463if (is_div_rem) {464CodeEmitInfo* info = NULL; // Null check already done above.465LIR_Opr tmp = FrameMap::R0_opr;466if (x->op() == Bytecodes::_lrem) {467__ irem(left.result(), right.result(), x->operand(), tmp, info);468} else if (x->op() == Bytecodes::_ldiv) {469__ idiv(left.result(), right.result(), x->operand(), tmp, info);470}471} else {472arithmetic_op_long(x->op(), x->operand(), left.result(), right.result(), NULL);473}474}475476477// for: _iadd, _imul, _isub, _idiv, _irem478void LIRGenerator::do_ArithmeticOp_Int(ArithmeticOp* x) {479bool is_div_rem = x->op() == Bytecodes::_idiv || x->op() == Bytecodes::_irem;480481LIRItem right(x->y(), this);482// Missing test if instr is commutative and if we should swap.483if (right.value()->type()->as_IntConstant() &&484(x->op() == Bytecodes::_isub && right.value()->type()->as_IntConstant()->value() == ((-1)<<15)) ) {485// Sub is implemented by addi and can't support min_simm16 as constant.486right.load_item();487} else {488right.load_nonconstant();489}490assert(right.is_constant() || right.is_register(), "wrong state of right");491492if (is_div_rem) {493LIR_Opr divisor = right.result();494if (divisor->is_register()) {495CodeEmitInfo* null_check_info = state_for(x);496__ cmp(lir_cond_equal, divisor, LIR_OprFact::intConst(0));497__ branch(lir_cond_equal, new DivByZeroStub(null_check_info));498} else {499jint const_divisor = divisor->as_constant_ptr()->as_jint();500if (const_divisor == 0) {501CodeEmitInfo* null_check_info = state_for(x);502__ jump(new DivByZeroStub(null_check_info));503rlock_result(x);504__ move(LIR_OprFact::intConst(0), x->operand()); // dummy505return;506}507if (x->op() == Bytecodes::_irem && !is_power_of_2(const_divisor) && const_divisor != -1) {508// Remainder computation would need additional tmp != R0.509right.load_item();510}511}512}513514LIRItem left(x->x(), this);515left.load_item();516rlock_result(x);517if (is_div_rem) {518CodeEmitInfo* info = NULL; // Null check already done above.519LIR_Opr tmp = FrameMap::R0_opr;520if (x->op() == Bytecodes::_irem) {521__ irem(left.result(), right.result(), x->operand(), tmp, info);522} else if (x->op() == Bytecodes::_idiv) {523__ idiv(left.result(), right.result(), x->operand(), tmp, info);524}525} else {526arithmetic_op_int(x->op(), x->operand(), left.result(), right.result(), FrameMap::R0_opr);527}528}529530531void LIRGenerator::do_ArithmeticOp(ArithmeticOp* x) {532ValueTag tag = x->type()->tag();533assert(x->x()->type()->tag() == tag && x->y()->type()->tag() == tag, "wrong parameters");534switch (tag) {535case floatTag:536case doubleTag: do_ArithmeticOp_FPU(x); return;537case longTag: do_ArithmeticOp_Long(x); return;538case intTag: do_ArithmeticOp_Int(x); return;539default: ShouldNotReachHere();540}541}542543544// _ishl, _lshl, _ishr, _lshr, _iushr, _lushr545void LIRGenerator::do_ShiftOp(ShiftOp* x) {546LIRItem value(x->x(), this);547LIRItem count(x->y(), this);548value.load_item();549LIR_Opr reg = rlock_result(x);550LIR_Opr mcount;551if (count.result()->is_register()) {552mcount = FrameMap::R0_opr;553} else {554mcount = LIR_OprFact::illegalOpr;555}556shift_op(x->op(), reg, value.result(), count.result(), mcount);557}558559560inline bool can_handle_logic_op_as_uimm(ValueType *type, Bytecodes::Code bc) {561jlong int_or_long_const;562if (type->as_IntConstant()) {563int_or_long_const = type->as_IntConstant()->value();564} else if (type->as_LongConstant()) {565int_or_long_const = type->as_LongConstant()->value();566} else if (type->as_ObjectConstant()) {567return type->as_ObjectConstant()->value()->is_null_object();568} else {569return false;570}571572if (Assembler::is_uimm(int_or_long_const, 16)) return true;573if ((int_or_long_const & 0xFFFF) == 0 &&574Assembler::is_uimm((jlong)((julong)int_or_long_const >> 16), 16)) return true;575576// see Assembler::andi577if (bc == Bytecodes::_iand &&578(is_power_of_2(int_or_long_const+1) ||579is_power_of_2(int_or_long_const) ||580is_power_of_2(-int_or_long_const))) return true;581if (bc == Bytecodes::_land &&582(is_power_of_2(int_or_long_const+1) ||583(Assembler::is_uimm(int_or_long_const, 32) && is_power_of_2(int_or_long_const)) ||584(int_or_long_const != min_jlong && is_power_of_2(-int_or_long_const)))) return true;585586// special case: xor -1587if ((bc == Bytecodes::_ixor || bc == Bytecodes::_lxor) &&588int_or_long_const == -1) return true;589return false;590}591592593// _iand, _land, _ior, _lor, _ixor, _lxor594void LIRGenerator::do_LogicOp(LogicOp* x) {595LIRItem left(x->x(), this);596LIRItem right(x->y(), this);597598left.load_item();599600Value rval = right.value();601LIR_Opr r = rval->operand();602ValueType *type = rval->type();603// Logic instructions use unsigned immediate values.604if (can_handle_logic_op_as_uimm(type, x->op())) {605if (!r->is_constant()) {606r = LIR_OprFact::value_type(type);607rval->set_operand(r);608}609right.set_result(r);610} else {611right.load_item();612}613614LIR_Opr reg = rlock_result(x);615616logic_op(x->op(), reg, left.result(), right.result());617}618619620// _lcmp, _fcmpl, _fcmpg, _dcmpl, _dcmpg621void LIRGenerator::do_CompareOp(CompareOp* x) {622LIRItem left(x->x(), this);623LIRItem right(x->y(), this);624left.load_item();625right.load_item();626LIR_Opr reg = rlock_result(x);627if (x->x()->type()->is_float_kind()) {628Bytecodes::Code code = x->op();629__ fcmp2int(left.result(), right.result(), reg, (code == Bytecodes::_fcmpl || code == Bytecodes::_dcmpl));630} else if (x->x()->type()->tag() == longTag) {631__ lcmp2int(left.result(), right.result(), reg);632} else {633Unimplemented();634}635}636637638LIR_Opr LIRGenerator::atomic_cmpxchg(BasicType type, LIR_Opr addr, LIRItem& cmp_value, LIRItem& new_value) {639LIR_Opr result = new_register(T_INT);640LIR_Opr t1 = LIR_OprFact::illegalOpr;641LIR_Opr t2 = LIR_OprFact::illegalOpr;642cmp_value.load_item();643new_value.load_item();644645// Volatile load may be followed by Unsafe CAS.646if (support_IRIW_for_not_multiple_copy_atomic_cpu) {647__ membar();648} else {649__ membar_release();650}651652if (is_reference_type(type)) {653if (UseCompressedOops) {654t1 = new_register(T_OBJECT);655t2 = new_register(T_OBJECT);656}657__ cas_obj(addr->as_address_ptr()->base(), cmp_value.result(), new_value.result(), t1, t2);658} else if (type == T_INT) {659__ cas_int(addr->as_address_ptr()->base(), cmp_value.result(), new_value.result(), t1, t2);660} else if (type == T_LONG) {661__ cas_long(addr->as_address_ptr()->base(), cmp_value.result(), new_value.result(), t1, t2);662} else {663Unimplemented();664}665__ cmove(lir_cond_equal, LIR_OprFact::intConst(1), LIR_OprFact::intConst(0),666result, type);667return result;668}669670671LIR_Opr LIRGenerator::atomic_xchg(BasicType type, LIR_Opr addr, LIRItem& value) {672LIR_Opr result = new_register(type);673LIR_Opr tmp = FrameMap::R0_opr;674675value.load_item();676677// Volatile load may be followed by Unsafe CAS.678if (support_IRIW_for_not_multiple_copy_atomic_cpu) {679__ membar();680} else {681__ membar_release();682}683684__ xchg(addr, value.result(), result, tmp);685686if (support_IRIW_for_not_multiple_copy_atomic_cpu) {687__ membar_acquire();688} else {689__ membar();690}691return result;692}693694695LIR_Opr LIRGenerator::atomic_add(BasicType type, LIR_Opr addr, LIRItem& value) {696LIR_Opr result = new_register(type);697LIR_Opr tmp = FrameMap::R0_opr;698699value.load_item();700701// Volatile load may be followed by Unsafe CAS.702if (support_IRIW_for_not_multiple_copy_atomic_cpu) {703__ membar(); // To be safe. Unsafe semantics are unclear.704} else {705__ membar_release();706}707708__ xadd(addr, value.result(), result, tmp);709710if (support_IRIW_for_not_multiple_copy_atomic_cpu) {711__ membar_acquire();712} else {713__ membar();714}715return result;716}717718719void LIRGenerator::do_MathIntrinsic(Intrinsic* x) {720switch (x->id()) {721case vmIntrinsics::_dabs: {722assert(x->number_of_arguments() == 1, "wrong type");723LIRItem value(x->argument_at(0), this);724value.load_item();725LIR_Opr dst = rlock_result(x);726__ abs(value.result(), dst, LIR_OprFact::illegalOpr);727break;728}729case vmIntrinsics::_dsqrt: {730if (VM_Version::has_fsqrt()) {731assert(x->number_of_arguments() == 1, "wrong type");732LIRItem value(x->argument_at(0), this);733value.load_item();734LIR_Opr dst = rlock_result(x);735__ sqrt(value.result(), dst, LIR_OprFact::illegalOpr);736break;737} // else fallthru738}739case vmIntrinsics::_dsin: // fall through740case vmIntrinsics::_dcos: // fall through741case vmIntrinsics::_dtan: // fall through742case vmIntrinsics::_dlog: // fall through743case vmIntrinsics::_dlog10: // fall through744case vmIntrinsics::_dexp: {745assert(x->number_of_arguments() == 1, "wrong type");746747address runtime_entry = NULL;748switch (x->id()) {749case vmIntrinsics::_dsqrt:750runtime_entry = CAST_FROM_FN_PTR(address, SharedRuntime::dsqrt);751break;752case vmIntrinsics::_dsin:753runtime_entry = CAST_FROM_FN_PTR(address, SharedRuntime::dsin);754break;755case vmIntrinsics::_dcos:756runtime_entry = CAST_FROM_FN_PTR(address, SharedRuntime::dcos);757break;758case vmIntrinsics::_dtan:759runtime_entry = CAST_FROM_FN_PTR(address, SharedRuntime::dtan);760break;761case vmIntrinsics::_dlog:762runtime_entry = CAST_FROM_FN_PTR(address, SharedRuntime::dlog);763break;764case vmIntrinsics::_dlog10:765runtime_entry = CAST_FROM_FN_PTR(address, SharedRuntime::dlog10);766break;767case vmIntrinsics::_dexp:768runtime_entry = CAST_FROM_FN_PTR(address, SharedRuntime::dexp);769break;770default:771ShouldNotReachHere();772}773774LIR_Opr result = call_runtime(x->argument_at(0), runtime_entry, x->type(), NULL);775set_result(x, result);776break;777}778case vmIntrinsics::_dpow: {779assert(x->number_of_arguments() == 2, "wrong type");780address runtime_entry = CAST_FROM_FN_PTR(address, SharedRuntime::dpow);781LIR_Opr result = call_runtime(x->argument_at(0), x->argument_at(1), runtime_entry, x->type(), NULL);782set_result(x, result);783break;784}785default:786break;787}788}789790791void LIRGenerator::do_ArrayCopy(Intrinsic* x) {792assert(x->number_of_arguments() == 5, "wrong type");793794// Make all state_for calls early since they can emit code.795CodeEmitInfo* info = state_for(x, x->state());796797LIRItem src (x->argument_at(0), this);798LIRItem src_pos (x->argument_at(1), this);799LIRItem dst (x->argument_at(2), this);800LIRItem dst_pos (x->argument_at(3), this);801LIRItem length (x->argument_at(4), this);802803// Load all values in callee_save_registers (C calling convention),804// as this makes the parameter passing to the fast case simpler.805src.load_item_force (FrameMap::R14_oop_opr);806src_pos.load_item_force (FrameMap::R15_opr);807dst.load_item_force (FrameMap::R17_oop_opr);808dst_pos.load_item_force (FrameMap::R18_opr);809length.load_item_force (FrameMap::R19_opr);810LIR_Opr tmp = FrameMap::R20_opr;811812int flags;813ciArrayKlass* expected_type;814arraycopy_helper(x, &flags, &expected_type);815816__ arraycopy(src.result(), src_pos.result(), dst.result(), dst_pos.result(),817length.result(), tmp,818expected_type, flags, info);819set_no_result(x);820}821822823// _i2l, _i2f, _i2d, _l2i, _l2f, _l2d, _f2i, _f2l, _f2d, _d2i, _d2l, _d2f824// _i2b, _i2c, _i2s825void LIRGenerator::do_Convert(Convert* x) {826if (!VM_Version::has_mtfprd()) {827switch (x->op()) {828829// int -> float: force spill830case Bytecodes::_l2f: {831if (!VM_Version::has_fcfids()) { // fcfids is >= Power7 only832// fcfid+frsp needs fixup code to avoid rounding incompatibility.833address entry = CAST_FROM_FN_PTR(address, SharedRuntime::l2f);834LIR_Opr result = call_runtime(x->value(), entry, x->type(), NULL);835set_result(x, result);836return;837} // else fallthru838}839case Bytecodes::_l2d: {840LIRItem value(x->value(), this);841LIR_Opr reg = rlock_result(x);842value.load_item();843LIR_Opr tmp = force_to_spill(value.result(), T_DOUBLE);844__ convert(x->op(), tmp, reg);845return;846}847case Bytecodes::_i2f:848case Bytecodes::_i2d: {849LIRItem value(x->value(), this);850LIR_Opr reg = rlock_result(x);851value.load_item();852// Convert i2l first.853LIR_Opr tmp1 = new_register(T_LONG);854__ convert(Bytecodes::_i2l, value.result(), tmp1);855LIR_Opr tmp2 = force_to_spill(tmp1, T_DOUBLE);856__ convert(x->op(), tmp2, reg);857return;858}859860// float -> int: result will be stored861case Bytecodes::_f2l:862case Bytecodes::_d2l: {863LIRItem value(x->value(), this);864LIR_Opr reg = rlock_result(x);865value.set_destroys_register(); // USE_KILL866value.load_item();867set_vreg_flag(reg, must_start_in_memory);868__ convert(x->op(), value.result(), reg);869return;870}871case Bytecodes::_f2i:872case Bytecodes::_d2i: {873LIRItem value(x->value(), this);874LIR_Opr reg = rlock_result(x);875value.set_destroys_register(); // USE_KILL876value.load_item();877// Convert l2i afterwards.878LIR_Opr tmp1 = new_register(T_LONG);879set_vreg_flag(tmp1, must_start_in_memory);880__ convert(x->op(), value.result(), tmp1);881__ convert(Bytecodes::_l2i, tmp1, reg);882return;883}884885// Within same category: just register conversions.886case Bytecodes::_i2b:887case Bytecodes::_i2c:888case Bytecodes::_i2s:889case Bytecodes::_i2l:890case Bytecodes::_l2i:891case Bytecodes::_f2d:892case Bytecodes::_d2f:893break;894895default: ShouldNotReachHere();896}897}898899// Register conversion.900LIRItem value(x->value(), this);901LIR_Opr reg = rlock_result(x);902value.load_item();903switch (x->op()) {904case Bytecodes::_f2l:905case Bytecodes::_d2l:906case Bytecodes::_f2i:907case Bytecodes::_d2i: value.set_destroys_register(); break; // USE_KILL908default: break;909}910__ convert(x->op(), value.result(), reg);911}912913914void LIRGenerator::do_NewInstance(NewInstance* x) {915// This instruction can be deoptimized in the slow path.916const LIR_Opr reg = result_register_for(x->type());917#ifndef PRODUCT918if (PrintNotLoaded && !x->klass()->is_loaded()) {919tty->print_cr(" ###class not loaded at new bci %d", x->printable_bci());920}921#endif922CodeEmitInfo* info = state_for(x, x->state());923LIR_Opr klass_reg = FrameMap::R4_metadata_opr; // Used by slow path (NewInstanceStub).924LIR_Opr tmp1 = FrameMap::R5_oop_opr;925LIR_Opr tmp2 = FrameMap::R6_oop_opr;926LIR_Opr tmp3 = FrameMap::R7_oop_opr;927LIR_Opr tmp4 = FrameMap::R8_oop_opr;928new_instance(reg, x->klass(), x->is_unresolved(), tmp1, tmp2, tmp3, tmp4, klass_reg, info);929930// Must prevent reordering of stores for object initialization931// with stores that publish the new object.932__ membar_storestore();933LIR_Opr result = rlock_result(x);934__ move(reg, result);935}936937938void LIRGenerator::do_NewTypeArray(NewTypeArray* x) {939// Evaluate state_for early since it may emit code.940CodeEmitInfo* info = state_for(x, x->state());941942LIRItem length(x->length(), this);943length.load_item();944945LIR_Opr reg = result_register_for(x->type());946LIR_Opr klass_reg = FrameMap::R4_metadata_opr; // Used by slow path (NewTypeArrayStub).947// We use R5 in order to get a temp effect. This reg is used in slow path (NewTypeArrayStub).948LIR_Opr tmp1 = FrameMap::R5_oop_opr;949LIR_Opr tmp2 = FrameMap::R6_oop_opr;950LIR_Opr tmp3 = FrameMap::R7_oop_opr;951LIR_Opr tmp4 = FrameMap::R8_oop_opr;952LIR_Opr len = length.result();953BasicType elem_type = x->elt_type();954955__ metadata2reg(ciTypeArrayKlass::make(elem_type)->constant_encoding(), klass_reg);956957CodeStub* slow_path = new NewTypeArrayStub(klass_reg, len, reg, info);958__ allocate_array(reg, len, tmp1, tmp2, tmp3, tmp4, elem_type, klass_reg, slow_path);959960// Must prevent reordering of stores for object initialization961// with stores that publish the new object.962__ membar_storestore();963LIR_Opr result = rlock_result(x);964__ move(reg, result);965}966967968void LIRGenerator::do_NewObjectArray(NewObjectArray* x) {969// Evaluate state_for early since it may emit code.970CodeEmitInfo* info = state_for(x, x->state());971// In case of patching (i.e., object class is not yet loaded),972// we need to reexecute the instruction and therefore provide973// the state before the parameters have been consumed.974CodeEmitInfo* patching_info = NULL;975if (!x->klass()->is_loaded() || PatchALot) {976patching_info = state_for(x, x->state_before());977}978979LIRItem length(x->length(), this);980length.load_item();981982const LIR_Opr reg = result_register_for(x->type());983LIR_Opr klass_reg = FrameMap::R4_metadata_opr; // Used by slow path (NewObjectArrayStub).984// We use R5 in order to get a temp effect. This reg is used in slow path (NewObjectArrayStub).985LIR_Opr tmp1 = FrameMap::R5_oop_opr;986LIR_Opr tmp2 = FrameMap::R6_oop_opr;987LIR_Opr tmp3 = FrameMap::R7_oop_opr;988LIR_Opr tmp4 = FrameMap::R8_oop_opr;989LIR_Opr len = length.result();990991CodeStub* slow_path = new NewObjectArrayStub(klass_reg, len, reg, info);992ciMetadata* obj = ciObjArrayKlass::make(x->klass());993if (obj == ciEnv::unloaded_ciobjarrayklass()) {994BAILOUT("encountered unloaded_ciobjarrayklass due to out of memory error");995}996klass2reg_with_patching(klass_reg, obj, patching_info);997__ allocate_array(reg, len, tmp1, tmp2, tmp3, tmp4, T_OBJECT, klass_reg, slow_path);998999// Must prevent reordering of stores for object initialization1000// with stores that publish the new object.1001__ membar_storestore();1002LIR_Opr result = rlock_result(x);1003__ move(reg, result);1004}100510061007void LIRGenerator::do_NewMultiArray(NewMultiArray* x) {1008Values* dims = x->dims();1009int i = dims->length();1010LIRItemList* items = new LIRItemList(i, i, NULL);1011while (i-- > 0) {1012LIRItem* size = new LIRItem(dims->at(i), this);1013items->at_put(i, size);1014}10151016// Evaluate state_for early since it may emit code.1017CodeEmitInfo* patching_info = NULL;1018if (!x->klass()->is_loaded() || PatchALot) {1019patching_info = state_for(x, x->state_before());10201021// Cannot re-use same xhandlers for multiple CodeEmitInfos, so1022// clone all handlers (NOTE: Usually this is handled transparently1023// by the CodeEmitInfo cloning logic in CodeStub constructors but1024// is done explicitly here because a stub isn't being used).1025x->set_exception_handlers(new XHandlers(x->exception_handlers()));1026}1027CodeEmitInfo* info = state_for(x, x->state());10281029i = dims->length();1030while (i-- > 0) {1031LIRItem* size = items->at(i);1032size->load_nonconstant();1033// FrameMap::_reserved_argument_area_size includes the dimensions1034// varargs, because it's initialized to hir()->max_stack() when the1035// FrameMap is created.1036store_stack_parameter(size->result(), in_ByteSize(i*sizeof(jint) + FrameMap::first_available_sp_in_frame));1037}10381039const LIR_Opr klass_reg = FrameMap::R4_metadata_opr; // Used by slow path.1040klass2reg_with_patching(klass_reg, x->klass(), patching_info);10411042LIR_Opr rank = FrameMap::R5_opr; // Used by slow path.1043__ move(LIR_OprFact::intConst(x->rank()), rank);10441045LIR_Opr varargs = FrameMap::as_pointer_opr(R6); // Used by slow path.1046__ leal(LIR_OprFact::address(new LIR_Address(FrameMap::SP_opr, FrameMap::first_available_sp_in_frame, T_INT)),1047varargs);10481049// Note: This instruction can be deoptimized in the slow path.1050LIR_OprList* args = new LIR_OprList(3);1051args->append(klass_reg);1052args->append(rank);1053args->append(varargs);1054const LIR_Opr reg = result_register_for(x->type());1055__ call_runtime(Runtime1::entry_for(Runtime1::new_multi_array_id),1056LIR_OprFact::illegalOpr,1057reg, args, info);10581059// Must prevent reordering of stores for object initialization1060// with stores that publish the new object.1061__ membar_storestore();1062LIR_Opr result = rlock_result(x);1063__ move(reg, result);1064}106510661067void LIRGenerator::do_BlockBegin(BlockBegin* x) {1068// nothing to do for now1069}107010711072void LIRGenerator::do_CheckCast(CheckCast* x) {1073LIRItem obj(x->obj(), this);1074CodeEmitInfo* patching_info = NULL;1075if (!x->klass()->is_loaded() || (PatchALot && !x->is_incompatible_class_change_check() && !x->is_invokespecial_receiver_check())) {1076// Must do this before locking the destination register as1077// an oop register, and before the obj is loaded (so x->obj()->item()1078// is valid for creating a debug info location).1079patching_info = state_for(x, x->state_before());1080}1081obj.load_item();1082LIR_Opr out_reg = rlock_result(x);1083CodeStub* stub;1084CodeEmitInfo* info_for_exception =1085(x->needs_exception_state() ? state_for(x) :1086state_for(x, x->state_before(), true /*ignore_xhandler*/));10871088if (x->is_incompatible_class_change_check()) {1089assert(patching_info == NULL, "can't patch this");1090stub = new SimpleExceptionStub(Runtime1::throw_incompatible_class_change_error_id,1091LIR_OprFact::illegalOpr, info_for_exception);1092} else if (x->is_invokespecial_receiver_check()) {1093assert(patching_info == NULL, "can't patch this");1094stub = new DeoptimizeStub(info_for_exception,1095Deoptimization::Reason_class_check,1096Deoptimization::Action_none);1097} else {1098stub = new SimpleExceptionStub(Runtime1::throw_class_cast_exception_id, obj.result(), info_for_exception);1099}1100// Following registers are used by slow_subtype_check:1101LIR_Opr tmp1 = FrameMap::R4_oop_opr; // super_klass1102LIR_Opr tmp2 = FrameMap::R5_oop_opr; // sub_klass1103LIR_Opr tmp3 = FrameMap::R6_oop_opr; // temp1104__ checkcast(out_reg, obj.result(), x->klass(), tmp1, tmp2, tmp3,1105x->direct_compare(), info_for_exception, patching_info, stub,1106x->profiled_method(), x->profiled_bci());1107}110811091110void LIRGenerator::do_InstanceOf(InstanceOf* x) {1111LIRItem obj(x->obj(), this);1112CodeEmitInfo* patching_info = NULL;1113if (!x->klass()->is_loaded() || PatchALot) {1114patching_info = state_for(x, x->state_before());1115}1116// Ensure the result register is not the input register because the1117// result is initialized before the patching safepoint.1118obj.load_item();1119LIR_Opr out_reg = rlock_result(x);1120// Following registers are used by slow_subtype_check:1121LIR_Opr tmp1 = FrameMap::R4_oop_opr; // super_klass1122LIR_Opr tmp2 = FrameMap::R5_oop_opr; // sub_klass1123LIR_Opr tmp3 = FrameMap::R6_oop_opr; // temp1124__ instanceof(out_reg, obj.result(), x->klass(), tmp1, tmp2, tmp3,1125x->direct_compare(), patching_info,1126x->profiled_method(), x->profiled_bci());1127}112811291130void LIRGenerator::do_If(If* x) {1131assert(x->number_of_sux() == 2, "inconsistency");1132ValueTag tag = x->x()->type()->tag();1133LIRItem xitem(x->x(), this);1134LIRItem yitem(x->y(), this);1135LIRItem* xin = &xitem;1136LIRItem* yin = &yitem;1137If::Condition cond = x->cond();11381139LIR_Opr left = LIR_OprFact::illegalOpr;1140LIR_Opr right = LIR_OprFact::illegalOpr;11411142xin->load_item();1143left = xin->result();11441145if (yin->result()->is_constant() && yin->result()->type() == T_INT &&1146Assembler::is_simm16(yin->result()->as_constant_ptr()->as_jint())) {1147// Inline int constants which are small enough to be immediate operands.1148right = LIR_OprFact::value_type(yin->value()->type());1149} else if (tag == longTag && yin->is_constant() && yin->get_jlong_constant() == 0 &&1150(cond == If::eql || cond == If::neq)) {1151// Inline long zero.1152right = LIR_OprFact::value_type(yin->value()->type());1153} else if (tag == objectTag && yin->is_constant() && (yin->get_jobject_constant()->is_null_object())) {1154right = LIR_OprFact::value_type(yin->value()->type());1155} else {1156yin->load_item();1157right = yin->result();1158}1159set_no_result(x);11601161// Add safepoint before generating condition code so it can be recomputed.1162if (x->is_safepoint()) {1163// Increment backedge counter if needed.1164increment_backedge_counter_conditionally(lir_cond(cond), left, right, state_for(x, x->state_before()),1165x->tsux()->bci(), x->fsux()->bci(), x->profiled_bci());1166__ safepoint(safepoint_poll_register(), state_for(x, x->state_before()));1167}11681169__ cmp(lir_cond(cond), left, right);1170// Generate branch profiling. Profiling code doesn't kill flags.1171profile_branch(x, cond);1172move_to_phi(x->state());1173if (x->x()->type()->is_float_kind()) {1174__ branch(lir_cond(cond), x->tsux(), x->usux());1175} else {1176__ branch(lir_cond(cond), x->tsux());1177}1178assert(x->default_sux() == x->fsux(), "wrong destination above");1179__ jump(x->default_sux());1180}118111821183LIR_Opr LIRGenerator::getThreadPointer() {1184return FrameMap::as_pointer_opr(R16_thread);1185}118611871188void LIRGenerator::trace_block_entry(BlockBegin* block) {1189LIR_Opr arg1 = FrameMap::R3_opr; // ARG11190__ move(LIR_OprFact::intConst(block->block_id()), arg1);1191LIR_OprList* args = new LIR_OprList(1);1192args->append(arg1);1193address func = CAST_FROM_FN_PTR(address, Runtime1::trace_block_entry);1194__ call_runtime_leaf(func, LIR_OprFact::illegalOpr, LIR_OprFact::illegalOpr, args);1195}119611971198void LIRGenerator::volatile_field_store(LIR_Opr value, LIR_Address* address,1199CodeEmitInfo* info) {1200#ifdef _LP641201__ store(value, address, info);1202#else1203Unimplemented();1204// __ volatile_store_mem_reg(value, address, info);1205#endif1206}12071208void LIRGenerator::volatile_field_load(LIR_Address* address, LIR_Opr result,1209CodeEmitInfo* info) {1210#ifdef _LP641211__ load(address, result, info);1212#else1213Unimplemented();1214// __ volatile_load_mem_reg(address, result, info);1215#endif1216}121712181219void LIRGenerator::do_update_CRC32(Intrinsic* x) {1220assert(UseCRC32Intrinsics, "or should not be here");1221LIR_Opr result = rlock_result(x);12221223switch (x->id()) {1224case vmIntrinsics::_updateCRC32: {1225LIRItem crc(x->argument_at(0), this);1226LIRItem val(x->argument_at(1), this);1227// Registers destroyed by update_crc32.1228crc.set_destroys_register();1229val.set_destroys_register();1230crc.load_item();1231val.load_item();1232__ update_crc32(crc.result(), val.result(), result);1233break;1234}1235case vmIntrinsics::_updateBytesCRC32:1236case vmIntrinsics::_updateByteBufferCRC32: {1237bool is_updateBytes = (x->id() == vmIntrinsics::_updateBytesCRC32);12381239LIRItem crc(x->argument_at(0), this);1240LIRItem buf(x->argument_at(1), this);1241LIRItem off(x->argument_at(2), this);1242LIRItem len(x->argument_at(3), this);1243buf.load_item();1244off.load_nonconstant();12451246LIR_Opr index = off.result();1247int offset = is_updateBytes ? arrayOopDesc::base_offset_in_bytes(T_BYTE) : 0;1248if (off.result()->is_constant()) {1249index = LIR_OprFact::illegalOpr;1250offset += off.result()->as_jint();1251}1252LIR_Opr base_op = buf.result();1253LIR_Address* a = NULL;12541255if (index->is_valid()) {1256LIR_Opr tmp = new_register(T_LONG);1257__ convert(Bytecodes::_i2l, index, tmp);1258index = tmp;1259__ add(index, LIR_OprFact::intptrConst(offset), index);1260a = new LIR_Address(base_op, index, T_BYTE);1261} else {1262a = new LIR_Address(base_op, offset, T_BYTE);1263}12641265BasicTypeList signature(3);1266signature.append(T_INT);1267signature.append(T_ADDRESS);1268signature.append(T_INT);1269CallingConvention* cc = frame_map()->c_calling_convention(&signature);1270const LIR_Opr result_reg = result_register_for(x->type());12711272LIR_Opr arg1 = cc->at(0),1273arg2 = cc->at(1),1274arg3 = cc->at(2);12751276crc.load_item_force(arg1); // We skip int->long conversion here, because CRC32 stub doesn't care about high bits.1277__ leal(LIR_OprFact::address(a), arg2);1278len.load_item_force(arg3); // We skip int->long conversion here, , because CRC32 stub expects int.12791280__ call_runtime_leaf(StubRoutines::updateBytesCRC32(), LIR_OprFact::illegalOpr, result_reg, cc->args());1281__ move(result_reg, result);1282break;1283}1284default: {1285ShouldNotReachHere();1286}1287}1288}12891290void LIRGenerator::do_update_CRC32C(Intrinsic* x) {1291assert(UseCRC32CIntrinsics, "or should not be here");1292LIR_Opr result = rlock_result(x);12931294switch (x->id()) {1295case vmIntrinsics::_updateBytesCRC32C:1296case vmIntrinsics::_updateDirectByteBufferCRC32C: {1297bool is_updateBytes = (x->id() == vmIntrinsics::_updateBytesCRC32C);12981299LIRItem crc(x->argument_at(0), this);1300LIRItem buf(x->argument_at(1), this);1301LIRItem off(x->argument_at(2), this);1302LIRItem end(x->argument_at(3), this);1303buf.load_item();1304off.load_nonconstant();1305end.load_nonconstant();13061307// len = end - off1308LIR_Opr len = end.result();1309LIR_Opr tmpA = new_register(T_INT);1310LIR_Opr tmpB = new_register(T_INT);1311__ move(end.result(), tmpA);1312__ move(off.result(), tmpB);1313__ sub(tmpA, tmpB, tmpA);1314len = tmpA;13151316LIR_Opr index = off.result();1317int offset = is_updateBytes ? arrayOopDesc::base_offset_in_bytes(T_BYTE) : 0;1318if (off.result()->is_constant()) {1319index = LIR_OprFact::illegalOpr;1320offset += off.result()->as_jint();1321}1322LIR_Opr base_op = buf.result();1323LIR_Address* a = NULL;13241325if (index->is_valid()) {1326LIR_Opr tmp = new_register(T_LONG);1327__ convert(Bytecodes::_i2l, index, tmp);1328index = tmp;1329__ add(index, LIR_OprFact::intptrConst(offset), index);1330a = new LIR_Address(base_op, index, T_BYTE);1331} else {1332a = new LIR_Address(base_op, offset, T_BYTE);1333}13341335BasicTypeList signature(3);1336signature.append(T_INT);1337signature.append(T_ADDRESS);1338signature.append(T_INT);1339CallingConvention* cc = frame_map()->c_calling_convention(&signature);1340const LIR_Opr result_reg = result_register_for(x->type());13411342LIR_Opr arg1 = cc->at(0),1343arg2 = cc->at(1),1344arg3 = cc->at(2);13451346crc.load_item_force(arg1); // We skip int->long conversion here, because CRC32C stub doesn't care about high bits.1347__ leal(LIR_OprFact::address(a), arg2);1348__ move(len, cc->at(2)); // We skip int->long conversion here, because CRC32C stub expects int.13491350__ call_runtime_leaf(StubRoutines::updateBytesCRC32C(), LIR_OprFact::illegalOpr, result_reg, cc->args());1351__ move(result_reg, result);1352break;1353}1354default: {1355ShouldNotReachHere();1356}1357}1358}13591360void LIRGenerator::do_FmaIntrinsic(Intrinsic* x) {1361assert(x->number_of_arguments() == 3, "wrong type");1362assert(UseFMA, "Needs FMA instructions support.");1363LIRItem value(x->argument_at(0), this);1364LIRItem value1(x->argument_at(1), this);1365LIRItem value2(x->argument_at(2), this);13661367value.load_item();1368value1.load_item();1369value2.load_item();13701371LIR_Opr calc_input = value.result();1372LIR_Opr calc_input1 = value1.result();1373LIR_Opr calc_input2 = value2.result();1374LIR_Opr calc_result = rlock_result(x);13751376switch (x->id()) {1377case vmIntrinsics::_fmaD: __ fmad(calc_input, calc_input1, calc_input2, calc_result); break;1378case vmIntrinsics::_fmaF: __ fmaf(calc_input, calc_input1, calc_input2, calc_result); break;1379default: ShouldNotReachHere();1380}1381}13821383void LIRGenerator::do_vectorizedMismatch(Intrinsic* x) {1384fatal("vectorizedMismatch intrinsic is not implemented on this platform");1385}138613871388