< prev index next >

src/hotspot/cpu/aarch64/c1_LIRGenerator_aarch64.cpp

Print this page


   1 /*
   2  * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
   3  * Copyright (c) 2014, Red Hat Inc. All rights reserved.
   4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   5  *
   6  * This code is free software; you can redistribute it and/or modify it
   7  * under the terms of the GNU General Public License version 2 only, as
   8  * published by the Free Software Foundation.
   9  *
  10  * This code is distributed in the hope that it will be useful, but WITHOUT
  11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  13  * version 2 for more details (a copy is included in the LICENSE file that
  14  * accompanied this code).
  15  *
  16  * You should have received a copy of the GNU General Public License version
  17  * 2 along with this work; if not, write to the Free Software Foundation,
  18  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  19  *
  20  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  21  * or visit www.oracle.com if you need additional information or have any
  22  * questions.
  23  *


 693     left.set_destroys_register();
 694   }
 695   left.load_item();
 696   right.load_item();
 697   LIR_Opr reg = rlock_result(x);
 698 
 699   if (x->x()->type()->is_float_kind()) {
 700     Bytecodes::Code code = x->op();
 701     __ fcmp2int(left.result(), right.result(), reg, (code == Bytecodes::_fcmpl || code == Bytecodes::_dcmpl));
 702   } else if (x->x()->type()->tag() == longTag) {
 703     __ lcmp2int(left.result(), right.result(), reg);
 704   } else {
 705     Unimplemented();
 706   }
 707 }
 708 
 709 LIR_Opr LIRGenerator::atomic_cmpxchg(BasicType type, LIR_Opr addr, LIRItem& cmp_value, LIRItem& new_value) {
 710   LIR_Opr ill = LIR_OprFact::illegalOpr;  // for convenience
 711   new_value.load_item();
 712   cmp_value.load_item();
 713   LIR_Opr result = new_register(T_INT);
 714   if (type == T_OBJECT || type == T_ARRAY) {
 715     __ cas_obj(addr, cmp_value.result(), new_value.result(), new_register(T_INT), new_register(T_INT), result);
 716   } else if (type == T_INT) {
 717     __ cas_int(addr->as_address_ptr()->base(), cmp_value.result(), new_value.result(), ill, ill);
 718   } else if (type == T_LONG) {
 719     __ cas_long(addr->as_address_ptr()->base(), cmp_value.result(), new_value.result(), ill, ill);
 720   } else {
 721     ShouldNotReachHere();
 722     Unimplemented();
 723   }
 724   __ logical_xor(FrameMap::r8_opr, LIR_OprFact::intConst(1), result);


 725   return result;
 726 }
 727 
 728 LIR_Opr LIRGenerator::atomic_xchg(BasicType type, LIR_Opr addr, LIRItem& value) {
 729   bool is_oop = type == T_OBJECT || type == T_ARRAY;
 730   LIR_Opr result = new_register(type);
 731   value.load_item();
 732   assert(type == T_INT || is_oop LP64_ONLY( || type == T_LONG ), "unexpected type");
 733   LIR_Opr tmp = new_register(T_INT);
 734   __ xchg(addr, value.result(), result, tmp);
 735   return result;
 736 }
 737 
 738 LIR_Opr LIRGenerator::atomic_add(BasicType type, LIR_Opr addr, LIRItem& value) {
 739   LIR_Opr result = new_register(type);
 740   value.load_item();
 741   assert(type == T_INT LP64_ONLY( || type == T_LONG ), "unexpected type");
 742   LIR_Opr tmp = new_register(T_INT);
 743   __ xadd(addr, value.result(), result, tmp);
 744   return result;


 922 
 923       LIRItem crc(x->argument_at(0), this);
 924       LIRItem buf(x->argument_at(1), this);
 925       LIRItem off(x->argument_at(2), this);
 926       LIRItem len(x->argument_at(3), this);
 927       buf.load_item();
 928       off.load_nonconstant();
 929 
 930       LIR_Opr index = off.result();
 931       int offset = is_updateBytes ? arrayOopDesc::base_offset_in_bytes(T_BYTE) : 0;
 932       if(off.result()->is_constant()) {
 933         index = LIR_OprFact::illegalOpr;
 934        offset += off.result()->as_jint();
 935       }
 936       LIR_Opr base_op = buf.result();
 937 
 938       if (index->is_valid()) {
 939         LIR_Opr tmp = new_register(T_LONG);
 940         __ convert(Bytecodes::_i2l, index, tmp);
 941         index = tmp;




 942       }
 943 
 944       if (offset) {
 945         LIR_Opr tmp = new_pointer_register();
 946         __ add(base_op, LIR_OprFact::intConst(offset), tmp);
 947         base_op = tmp;
 948         offset = 0;
 949       }
 950 
 951       LIR_Address* a = new LIR_Address(base_op,
 952                                        index,
 953                                        offset,
 954                                        T_BYTE);
 955       BasicTypeList signature(3);
 956       signature.append(T_INT);
 957       signature.append(T_ADDRESS);
 958       signature.append(T_INT);
 959       CallingConvention* cc = frame_map()->c_calling_convention(&signature);
 960       const LIR_Opr result_reg = result_register_for(x->type());
 961 


   1 /*
   2  * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
   3  * Copyright (c) 2014, 2018, Red Hat, Inc. All rights reserved.
   4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   5  *
   6  * This code is free software; you can redistribute it and/or modify it
   7  * under the terms of the GNU General Public License version 2 only, as
   8  * published by the Free Software Foundation.
   9  *
  10  * This code is distributed in the hope that it will be useful, but WITHOUT
  11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  13  * version 2 for more details (a copy is included in the LICENSE file that
  14  * accompanied this code).
  15  *
  16  * You should have received a copy of the GNU General Public License version
  17  * 2 along with this work; if not, write to the Free Software Foundation,
  18  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  19  *
  20  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  21  * or visit www.oracle.com if you need additional information or have any
  22  * questions.
  23  *


 693     left.set_destroys_register();
 694   }
 695   left.load_item();
 696   right.load_item();
 697   LIR_Opr reg = rlock_result(x);
 698 
 699   if (x->x()->type()->is_float_kind()) {
 700     Bytecodes::Code code = x->op();
 701     __ fcmp2int(left.result(), right.result(), reg, (code == Bytecodes::_fcmpl || code == Bytecodes::_dcmpl));
 702   } else if (x->x()->type()->tag() == longTag) {
 703     __ lcmp2int(left.result(), right.result(), reg);
 704   } else {
 705     Unimplemented();
 706   }
 707 }
 708 
 709 LIR_Opr LIRGenerator::atomic_cmpxchg(BasicType type, LIR_Opr addr, LIRItem& cmp_value, LIRItem& new_value) {
 710   LIR_Opr ill = LIR_OprFact::illegalOpr;  // for convenience
 711   new_value.load_item();
 712   cmp_value.load_item();

 713   if (type == T_OBJECT || type == T_ARRAY) {
 714     __ cas_obj(addr, cmp_value.result(), new_value.result(), new_register(T_INT), new_register(T_INT));
 715   } else if (type == T_INT) {
 716     __ cas_int(addr->as_address_ptr()->base(), cmp_value.result(), new_value.result(), ill, ill);
 717   } else if (type == T_LONG) {
 718     __ cas_long(addr->as_address_ptr()->base(), cmp_value.result(), new_value.result(), ill, ill);
 719   } else {
 720     ShouldNotReachHere();
 721     Unimplemented();
 722   }
 723   LIR_Opr result = new_register(T_INT);
 724   __ cmove(lir_cond_equal, LIR_OprFact::intConst(1), LIR_OprFact::intConst(0),
 725            result, type);
 726   return result;
 727 }
 728 
 729 LIR_Opr LIRGenerator::atomic_xchg(BasicType type, LIR_Opr addr, LIRItem& value) {
 730   bool is_oop = type == T_OBJECT || type == T_ARRAY;
 731   LIR_Opr result = new_register(type);
 732   value.load_item();
 733   assert(type == T_INT || is_oop LP64_ONLY( || type == T_LONG ), "unexpected type");
 734   LIR_Opr tmp = new_register(T_INT);
 735   __ xchg(addr, value.result(), result, tmp);
 736   return result;
 737 }
 738 
 739 LIR_Opr LIRGenerator::atomic_add(BasicType type, LIR_Opr addr, LIRItem& value) {
 740   LIR_Opr result = new_register(type);
 741   value.load_item();
 742   assert(type == T_INT LP64_ONLY( || type == T_LONG ), "unexpected type");
 743   LIR_Opr tmp = new_register(T_INT);
 744   __ xadd(addr, value.result(), result, tmp);
 745   return result;


 923 
 924       LIRItem crc(x->argument_at(0), this);
 925       LIRItem buf(x->argument_at(1), this);
 926       LIRItem off(x->argument_at(2), this);
 927       LIRItem len(x->argument_at(3), this);
 928       buf.load_item();
 929       off.load_nonconstant();
 930 
 931       LIR_Opr index = off.result();
 932       int offset = is_updateBytes ? arrayOopDesc::base_offset_in_bytes(T_BYTE) : 0;
 933       if(off.result()->is_constant()) {
 934         index = LIR_OprFact::illegalOpr;
 935        offset += off.result()->as_jint();
 936       }
 937       LIR_Opr base_op = buf.result();
 938 
 939       if (index->is_valid()) {
 940         LIR_Opr tmp = new_register(T_LONG);
 941         __ convert(Bytecodes::_i2l, index, tmp);
 942         index = tmp;
 943       }
 944 
 945       if (is_updateBytes) {
 946         base_op = access_resolve_for_read(IN_HEAP, base_op, NULL);
 947       }
 948 
 949       if (offset) {
 950         LIR_Opr tmp = new_pointer_register();
 951         __ add(base_op, LIR_OprFact::intConst(offset), tmp);
 952         base_op = tmp;
 953         offset = 0;
 954       }
 955 
 956       LIR_Address* a = new LIR_Address(base_op,
 957                                        index,
 958                                        offset,
 959                                        T_BYTE);
 960       BasicTypeList signature(3);
 961       signature.append(T_INT);
 962       signature.append(T_ADDRESS);
 963       signature.append(T_INT);
 964       CallingConvention* cc = frame_map()->c_calling_convention(&signature);
 965       const LIR_Opr result_reg = result_register_for(x->type());
 966 


< prev index next >