src/cpu/x86/vm/c1_LIRGenerator_x86.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File 7088419 Sdiff src/cpu/x86/vm

src/cpu/x86/vm/c1_LIRGenerator_x86.cpp

Print this page


   1 /*
   2  * Copyright (c) 2005, 2012, Oracle and/or its affiliates. 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 it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 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 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


 915   // args without worry of overwriting during the xfer
 916 
 917   src.load_item_force     (FrameMap::as_oop_opr(j_rarg0));
 918   src_pos.load_item_force (FrameMap::as_opr(j_rarg1));
 919   dst.load_item_force     (FrameMap::as_oop_opr(j_rarg2));
 920   dst_pos.load_item_force (FrameMap::as_opr(j_rarg3));
 921   length.load_item_force  (FrameMap::as_opr(j_rarg4));
 922 
 923   LIR_Opr tmp =           FrameMap::as_opr(j_rarg5);
 924 #endif // LP64
 925 
 926   set_no_result(x);
 927 
 928   int flags;
 929   ciArrayKlass* expected_type;
 930   arraycopy_helper(x, &flags, &expected_type);
 931 
 932   __ arraycopy(src.result(), src_pos.result(), dst.result(), dst_pos.result(), length.result(), tmp, expected_type, flags, info); // does add_safepoint
 933 }
 934 











































































 935 
 936 // _i2l, _i2f, _i2d, _l2i, _l2f, _l2d, _f2i, _f2l, _f2d, _d2i, _d2l, _d2f
 937 // _i2b, _i2c, _i2s
 938 LIR_Opr fixed_register_for(BasicType type) {
 939   switch (type) {
 940     case T_FLOAT:  return FrameMap::fpu0_float_opr;
 941     case T_DOUBLE: return FrameMap::fpu0_double_opr;
 942     case T_INT:    return FrameMap::rax_opr;
 943     case T_LONG:   return FrameMap::long0_opr;
 944     default:       ShouldNotReachHere(); return LIR_OprFact::illegalOpr;
 945   }
 946 }
 947 
 948 void LIRGenerator::do_Convert(Convert* x) {
 949   // flags that vary for the different operations and different SSE-settings
 950   bool fixed_input, fixed_result, round_result, needs_stub;
 951 
 952   switch (x->op()) {
 953     case Bytecodes::_i2l: // fall through
 954     case Bytecodes::_l2i: // fall through


   1 /*
   2  * Copyright (c) 2005, 2013, Oracle and/or its affiliates. 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 it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 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 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


 915   // args without worry of overwriting during the xfer
 916 
 917   src.load_item_force     (FrameMap::as_oop_opr(j_rarg0));
 918   src_pos.load_item_force (FrameMap::as_opr(j_rarg1));
 919   dst.load_item_force     (FrameMap::as_oop_opr(j_rarg2));
 920   dst_pos.load_item_force (FrameMap::as_opr(j_rarg3));
 921   length.load_item_force  (FrameMap::as_opr(j_rarg4));
 922 
 923   LIR_Opr tmp =           FrameMap::as_opr(j_rarg5);
 924 #endif // LP64
 925 
 926   set_no_result(x);
 927 
 928   int flags;
 929   ciArrayKlass* expected_type;
 930   arraycopy_helper(x, &flags, &expected_type);
 931 
 932   __ arraycopy(src.result(), src_pos.result(), dst.result(), dst_pos.result(), length.result(), tmp, expected_type, flags, info); // does add_safepoint
 933 }
 934 
 935 void LIRGenerator::do_update_CRC32(Intrinsic* x) {
 936   assert(UseCRC32Intrinsics, "need AVX and LCMUL instructions support");
 937   // Make all state_for calls early since they can emit code
 938   LIR_Opr result = rlock_result(x);
 939   int flags = 0;
 940   switch (x->id()) {
 941     case vmIntrinsics::_updateCRC32: {
 942       LIRItem crc(x->argument_at(0), this);
 943       LIRItem val(x->argument_at(1), this);
 944       crc.load_item();
 945       val.load_item();
 946       __ update_crc32(crc.result(), val.result(), result);
 947       break;
 948     }
 949     case vmIntrinsics::_updateBytesCRC32:
 950     case vmIntrinsics::_updateByteBufferCRC32: {
 951       bool is_updateBytes = (x->id() == vmIntrinsics::_updateBytesCRC32);
 952 
 953       LIRItem crc(x->argument_at(0), this);
 954       LIRItem buf(x->argument_at(1), this);
 955       LIRItem off(x->argument_at(2), this);
 956       LIRItem len(x->argument_at(3), this);
 957       buf.load_item();
 958       off.load_nonconstant();
 959 
 960       LIR_Opr index = off.result();
 961       int offset = is_updateBytes ? arrayOopDesc::base_offset_in_bytes(T_BYTE) : 0;
 962       if(off.result()->is_constant()) {
 963         index = LIR_OprFact::illegalOpr;
 964        offset += off.result()->as_jint();
 965       }
 966       LIR_Opr base_op = buf.result();
 967 
 968 #ifndef _LP64
 969       if (!is_updateBytes) { // long b raw address
 970          base_op = new_register(T_INT);
 971          __ convert(Bytecodes::_l2i, buf.result(), base_op);
 972       }
 973 #else
 974       if (index->is_valid()) {
 975         LIR_Opr tmp = new_register(T_LONG);
 976         __ convert(Bytecodes::_i2l, index, tmp);
 977         index = tmp;
 978       }
 979 #endif
 980 
 981       LIR_Address* a = new LIR_Address(base_op,
 982                                        index,
 983                                        LIR_Address::times_1,
 984                                        offset,
 985                                        T_BYTE);
 986       BasicTypeList signature(3);
 987       signature.append(T_INT);
 988       signature.append(T_ADDRESS);
 989       signature.append(T_INT);
 990       CallingConvention* cc = frame_map()->c_calling_convention(&signature);
 991       const LIR_Opr result_reg = result_register_for(x->type());
 992 
 993       LIR_Opr addr = new_pointer_register();
 994       __ leal(LIR_OprFact::address(a), addr);
 995 
 996       crc.load_item_force(cc->at(0));
 997       __ move(addr, cc->at(1));
 998       len.load_item_force(cc->at(2));
 999 
1000       __ call_runtime_leaf(StubRoutines::updateBytesCRC32(), getThreadTemp(), result_reg, cc->args());
1001       __ move(result_reg, result);
1002 
1003       break;
1004     }
1005     default: {
1006       ShouldNotReachHere();
1007     }
1008   }
1009 }
1010 
1011 // _i2l, _i2f, _i2d, _l2i, _l2f, _l2d, _f2i, _f2l, _f2d, _d2i, _d2l, _d2f
1012 // _i2b, _i2c, _i2s
1013 LIR_Opr fixed_register_for(BasicType type) {
1014   switch (type) {
1015     case T_FLOAT:  return FrameMap::fpu0_float_opr;
1016     case T_DOUBLE: return FrameMap::fpu0_double_opr;
1017     case T_INT:    return FrameMap::rax_opr;
1018     case T_LONG:   return FrameMap::long0_opr;
1019     default:       ShouldNotReachHere(); return LIR_OprFact::illegalOpr;
1020   }
1021 }
1022 
1023 void LIRGenerator::do_Convert(Convert* x) {
1024   // flags that vary for the different operations and different SSE-settings
1025   bool fixed_input, fixed_result, round_result, needs_stub;
1026 
1027   switch (x->op()) {
1028     case Bytecodes::_i2l: // fall through
1029     case Bytecodes::_l2i: // fall through


src/cpu/x86/vm/c1_LIRGenerator_x86.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File