1 /*
   2  * Copyright (c) 2000, 2010, 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  *
  24  */
  25 // This file is a derivative work resulting from (and including) modifications
  26 // made by Azul Systems, Inc.  The dates of such changes are 2013-2016.
  27 // Copyright 2013-2016 Azul Systems, Inc.  All Rights Reserved.
  28 //
  29 // Please contact Azul Systems, 385 Moffett Park Drive, Suite 115, Sunnyvale,
  30 // CA 94089 USA or visit www.azul.com if you need additional information or
  31 // have any questions.
  32 
  33 #ifndef CPU_X86_VM_C1_LIRASSEMBLER_AARCH32_HPP
  34 #define CPU_X86_VM_C1_LIRASSEMBLER_AARCH32_HPP
  35 
  36 #include "assembler_aarch32.hpp"
  37 
  38 
  39  private:
  40 
  41   int array_element_size(BasicType type) const;
  42 
  43   // helper functions which checks for overflow and sets bailout if it
  44   // occurs.  Always returns a valid embeddable pointer but in the
  45   // bailout case the pointer won't be to unique storage.
  46   address float_constant(float f);
  47   address double_constant(double d);
  48 
  49   address int_constant(jlong n);
  50 
  51   Address as_Address(LIR_Address* addr, Register tmp, Address::InsnDataType type);
  52   Address as_Address_hi(LIR_Address* addr, Address::InsnDataType type);
  53   Address as_Address_lo(LIR_Address* addr, Address::InsnDataType type);
  54 
  55   Address as_Address(LIR_Address* addr, Address::InsnDataType type) {
  56     return as_Address(addr, rscratch1, type);
  57   }
  58 
  59 
  60   // Record the type of the receiver in ReceiverTypeData
  61   void type_profile_helper(Register mdo,
  62                            ciMethodData *md, ciProfileData *data,
  63                            Register recv, Label* update_done);
  64   void add_debug_info_for_branch(address adr, CodeEmitInfo* info);
  65 
  66   void casw(Register addr, Register newval, Register cmpval, Register result);
  67   void casl(Register addr, Register newval_lo, Register newval_hi,
  68             Register cmpval_lo,  Register cmpval_hi,
  69             Register tmp_lo, Register tmp_hi, Register result);
  70 
  71   FloatRegister as_float_reg(LIR_Opr doubleReg);
  72 
  73   static const int max_tableswitches = 20;
  74   struct tableswitch switches[max_tableswitches];
  75   int tableswitch_count;
  76 
  77   void init() { tableswitch_count = 0; }
  78 
  79   void deoptimize_trap(CodeEmitInfo *info);
  80 
  81   // remap input register (*s1 or *s2) to a temp one if it is at the same time
  82   // used a result register (d) of a preceeding operation (so otherwise its
  83   // contents gets effectively corrupt)
  84   void check_register_collision(Register d, Register *s1, Register *s2 = NULL, Register tmp = rscratch1);
  85 
  86 public:
  87 
  88   void store_parameter(Register r, int offset_from_sp_in_words);
  89   void store_parameter(jint c,     int offset_from_sp_in_words);
  90   void store_parameter(jobject c,  int offset_from_sp_in_words);
  91 
  92 enum { call_stub_size = 12 * NativeInstruction::arm_insn_sz,
  93        exception_handler_size = DEBUG_ONLY(1*K) NOT_DEBUG(175),
  94        deopt_handler_size = 7 * NativeInstruction::arm_insn_sz };
  95 
  96 #endif // CPU_X86_VM_C1_LIRASSEMBLER_AARCH32_HPP