1 /*
   2  * Copyright (c) 2013, Red Hat Inc.
   3  * Copyright (c) 2000, 2010, Oracle and/or its affiliates.
   4  * All rights reserved.
   5  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   6  *
   7  * This code is free software; you can redistribute it and/or modify it
   8  * under the terms of the GNU General Public License version 2 only, as
   9  * published by the Free Software Foundation.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  *
  25  */
  26 
  27 #ifndef CPU_X86_VM_C1_LIRASSEMBLER_X86_HPP
  28 #define CPU_X86_VM_C1_LIRASSEMBLER_X86_HPP
  29 
  30 // ArrayCopyStub needs access to bailout
  31 friend class ArrayCopyStub;
  32 
  33  private:
  34 
  35   int array_element_size(BasicType type) const;
  36 
  37   void arith_fpu_implementation(LIR_Code code, int left_index, int right_index, int dest_index, bool pop_fpu_stack);
  38 
  39   // helper functions which checks for overflow and sets bailout if it
  40   // occurs.  Always returns a valid embeddable pointer but in the
  41   // bailout case the pointer won't be to unique storage.
  42   address float_constant(float f);
  43   address double_constant(double d);
  44 
  45   address int_constant(jlong n);
  46 
  47   bool is_literal_address(LIR_Address* addr);
  48 
  49   // When we need to use something other than rscratch1 use this
  50   // method.
  51   Address as_Address(LIR_Address* addr, Register tmp);
  52 
  53   // Record the type of the receiver in ReceiverTypeData
  54   void type_profile_helper(Register mdo,
  55                            ciMethodData *md, ciProfileData *data,
  56                            Register recv, Label* update_done);
  57   void add_debug_info_for_branch(address adr, CodeEmitInfo* info);
  58 
  59   void casw(Register addr, Register newval, Register cmpval);
  60   void casl(Register addr, Register newval, Register cmpval);
  61 
  62   void poll_for_safepoint(relocInfo::relocType rtype, CodeEmitInfo* info = NULL);
  63 
  64   static const int max_tableswitches = 20;
  65   struct tableswitch switches[max_tableswitches];
  66   int tableswitch_count;
  67 
  68   void init() { tableswitch_count = 0; }
  69 
  70   void deoptimize_trap(CodeEmitInfo *info);
  71 
  72 public:
  73 
  74   void store_parameter(Register r, int offset_from_esp_in_words);
  75   void store_parameter(jint c,     int offset_from_esp_in_words);
  76   void store_parameter(jobject c,  int offset_from_esp_in_words);
  77 
  78 enum { call_stub_size = 12 * NativeInstruction::instruction_size,
  79        exception_handler_size = DEBUG_ONLY(1*K) NOT_DEBUG(175),
  80        deopt_handler_size = 7 * NativeInstruction::instruction_size };
  81 
  82 
  83 #endif // CPU_X86_VM_C1_LIRASSEMBLER_X86_HPP