1 /*
  2  * Copyright (c) 2003, 2020, 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 
 26 #ifndef CPU_AARCH64_STUBROUTINES_AARCH64_HPP
 27 #define CPU_AARCH64_STUBROUTINES_AARCH64_HPP
 28 
 29 // This file holds the platform specific parts of the StubRoutines
 30 // definition. See stubRoutines.hpp for a description on how to
 31 // extend it.
 32 
 33 static bool    returns_to_call_stub(address return_pc)   {
 34   return return_pc == _call_stub_return_address;
 35 }
 36 
 37 enum platform_dependent_constants {
 38   code_size1 = 19000,          // simply increase if too small (assembler will crash if too small)
 39   code_size2 = 45000           // simply increase if too small (assembler will crash if too small)
 40 };
 41 
 42 class aarch64 {
 43  friend class StubGenerator;
 44 
 45  private:
 46   static address _get_previous_sp_entry;
 47 
 48   static address _f2i_fixup;
 49   static address _f2l_fixup;
 50   static address _d2i_fixup;
 51   static address _d2l_fixup;
 52 
 53   static address _vector_iota_indices;
 54   static address _float_sign_mask;
 55   static address _float_sign_flip;
 56   static address _double_sign_mask;
 57   static address _double_sign_flip;
 58 
 59   static address _zero_blocks;
 60 
 61   static address _large_array_equals;
 62   static address _compare_long_string_LL;
 63   static address _compare_long_string_LU;
 64   static address _compare_long_string_UL;
 65   static address _compare_long_string_UU;
 66   static address _string_indexof_linear_ll;
 67   static address _string_indexof_linear_uu;
 68   static address _string_indexof_linear_ul;
 69   static address _large_byte_array_inflate;
 70 
 71   static address _method_entry_barrier;
 72 
 73   static address _check_lock_stack;
 74 
 75   static address _spin_wait;
 76 
 77   static bool _completed;
 78 
 79  public:
 80 
 81   static address _count_positives;
 82   static address _count_positives_long;
 83 
 84   static address get_previous_sp_entry()
 85   {
 86     return _get_previous_sp_entry;
 87   }
 88 
 89   static address f2i_fixup()
 90   {
 91     return _f2i_fixup;
 92   }
 93 
 94   static address f2l_fixup()
 95   {
 96     return _f2l_fixup;
 97   }
 98 
 99   static address d2i_fixup()
100   {
101     return _d2i_fixup;
102   }
103 
104   static address d2l_fixup()
105   {
106     return _d2l_fixup;
107   }
108 
109   static address vector_iota_indices() {
110     return _vector_iota_indices;
111   }
112 
113   static address float_sign_mask()
114   {
115     return _float_sign_mask;
116   }
117 
118   static address float_sign_flip()
119   {
120     return _float_sign_flip;
121   }
122 
123   static address double_sign_mask()
124   {
125     return _double_sign_mask;
126   }
127 
128   static address double_sign_flip()
129   {
130     return _double_sign_flip;
131   }
132 
133   static address zero_blocks() {
134     return _zero_blocks;
135   }
136 
137   static address count_positives() {
138     return _count_positives;
139   }
140 
141   static address count_positives_long() {
142       return _count_positives_long;
143   }
144 
145   static address large_array_equals() {
146       return _large_array_equals;
147   }
148 
149   static address compare_long_string_LL() {
150       return _compare_long_string_LL;
151   }
152 
153   static address compare_long_string_LU() {
154       return _compare_long_string_LU;
155   }
156 
157   static address compare_long_string_UL() {
158       return _compare_long_string_UL;
159   }
160 
161   static address compare_long_string_UU() {
162       return _compare_long_string_UU;
163   }
164 
165   static address string_indexof_linear_ul() {
166       return _string_indexof_linear_ul;
167   }
168 
169   static address string_indexof_linear_ll() {
170       return _string_indexof_linear_ll;
171   }
172 
173   static address string_indexof_linear_uu() {
174       return _string_indexof_linear_uu;
175   }
176 
177   static address large_byte_array_inflate() {
178       return _large_byte_array_inflate;
179   }
180 
181   static address method_entry_barrier() {
182     return _method_entry_barrier;
183   }
184 
185   static address check_lock_stack() {
186     return _check_lock_stack;
187   }
188 
189   static address spin_wait() {
190     return _spin_wait;
191   }
192 
193   static bool complete() {
194     return _completed;
195   }
196 
197   static void set_completed() {
198     _completed = true;
199   }
200 
201 private:
202   static juint    _crc_table[];
203   static jubyte   _adler_table[];
204   // begin trigonometric tables block. See comments in .cpp file
205   static juint    _npio2_hw[];
206   static jdouble   _two_over_pi[];
207   static jdouble   _pio2[];
208   static jdouble   _dsin_coef[];
209   static jdouble  _dcos_coef[];
210   // end trigonometric tables block
211 };
212 
213 #endif // CPU_AARCH64_STUBROUTINES_AARCH64_HPP