c1_LIRGenerator_sparc.cpp revision 304
325N/A * Copyright 2005-2008 Sun Microsystems, Inc. All Rights Reserved. 325N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 325N/A * This code is free software; you can redistribute it and/or modify it 325N/A * under the terms of the GNU General Public License version 2 only, as 325N/A * published by the Free Software Foundation. 325N/A * This code is distributed in the hope that it will be useful, but WITHOUT 325N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 325N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 325N/A * version 2 for more details (a copy is included in the LICENSE file that 325N/A * accompanied this code). 325N/A * You should have received a copy of the GNU General Public License version 325N/A * 2 along with this work; if not, write to the Free Software Foundation, 325N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 325N/A * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 325N/A * CA 95054 USA or visit www.sun.com if you need additional information or 325N/A#
include "incls/_precompiled.incl" 325N/A // byte loads use same registers as other loads //-------------------------------------------------------------- //-------------------------------------------------------------- //--------- loading items into registers -------------------------------- // SPARC cannot inline all constants // only simm13 constants can be inlined // accumulate fixed displacements // apply the shift and accumulate the displacement // index is illegal so replace it with the displacement loaded into a register // at this point we either have base + index or base + displacement //---------------------------------------------------------------------- //---------------------------------------------------------------------- // 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 // emit array address setup early so it schedules better // range_check also does the null check // this CodeEmitInfo must not have the xhandlers because here the // object is already locked (xhandlers expects object to be unlocked) // _ineg, _lneg, _fneg, _dneg // for _fadd, _fmul, _fsub, _fdiv, _frem // _dadd, _dmul, _dsub, _ddiv, _drem // for _ladd, _lmul, _lsub, _ldiv, _lrem break;
// check if dividend is 0 is done elsewhere break;
// check if dividend is 0 is done elsewhere // order of arguments to runtime call is reversed. // Returns if item is an int constant that can be represented by a simm13 // for: _iadd, _imul, _isub, _idiv, _irem // missing test if instr is commutative and if we should swap // _ishl, _lshl, _ishr, _lshr, _iushr, _lushr // Long shift destroys count register // the old backend doesn't support this assert(c >= 0 && c <
32,
"should be small");
// _iand, _land, _ior, _lor, _ixor, _lxor // _lcmp, _fcmpl, _fcmpg, _dcmpl, _dcmpg // generate compare-and-swap and produce zero condition if swap occurs // generate conditional move of boolean result // Use temps to avoid kills // generate conditional move of boolean result // Note: spill caller save before setting the item // load all values in callee_save_registers, as this makes the // parameter passing to the fast case simpler // _i2l, _i2f, _i2d, _l2i, _l2f, _l2d, _f2i, _f2l, _f2d, _d2i, _d2l, _d2f // To convert an int to double, we need to load the 32-bit int // from memory into a single precision floating point register // (even numbered). Then the sparc fitod instruction takes care // of the conversion. This is a bit ugly, but is the best way to // get the int value in a single precision floating point register // This instruction can be deoptimized in the slow path : use // O0 as result register. // in case of patching (i.e., object class is not yet loaded), we need to reexecute the instruction // and therefore provide the state before the parameters have been consumed BAILOUT(
"encountered unloaded_ciobjarrayklass due to out of memory error");
// need to get the info before, as the items may become invalid through item_free // cannot re-use same xhandlers for multiple CodeEmitInfos, so // if a patching_info was generated above then debug information for the state before // the call is going to be emitted. The LIRGenerator calls above may have left some values // in registers and that's been recorded in the CodeEmitInfo. In that case the items // for those values can't simply be freed if they are registers because the values // might be destroyed by store_stack_parameter. So in the case of patching, delay the // freeing of the items that already were in registers // This instruction can be deoptimized in the slow path : use // O0 as result register. // must do this before locking the destination register as an oop register, // and before the obj is loaded (so x->obj()->item() is valid for creating a debug info location) // ensure the result register is not the input register because the result is initialized before the patching safepoint // for longs, only conditions "eql", "neq", "lss", "geq" are valid; // mirror for other conditions // inline int constants which are small enough to be immediate operands // add safepoint before generating condition code so it can be recomputed // increment backedge counter if needed // This address is precise