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  * Copyright (c) 2020, 2021, Huawei Technologies Co., Ltd. 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_RISCV_STUBROUTINES_RISCV_HPP
 28 #define CPU_RISCV_STUBROUTINES_RISCV_HPP
 29 
 30 // This file holds the platform specific parts of the StubRoutines
 31 // definition. See stubRoutines.hpp for a description on how to
 32 // extend it.
 33 
 34 static bool    returns_to_call_stub(address return_pc)   {
 35   return return_pc == _call_stub_return_address;
 36 }
 37 
 38 enum platform_dependent_constants {
 39   code_size1 = 19000,          // simply increase if too small (assembler will crash if too small)
 40   code_size2 = 28000           // simply increase if too small (assembler will crash if too small)
 41 };
 42 
 43 class riscv64 {
 44  friend class StubGenerator;
 45 
 46  private:
 47   static address _get_previous_sp_entry;
 48 
 49   static address _f2i_fixup;
 50   static address _f2l_fixup;
 51   static address _d2i_fixup;
 52   static address _d2l_fixup;
 53 
 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 _has_negatives;
 62   static address _has_negatives_long;
 63   static address _compare_long_string_LL;
 64   static address _compare_long_string_LU;
 65   static address _compare_long_string_UL;
 66   static address _compare_long_string_UU;
 67   static address _string_indexof_linear_ll;
 68   static address _string_indexof_linear_uu;
 69   static address _string_indexof_linear_ul;
 70   static address _large_byte_array_inflate;
 71 
 72   static address _method_entry_barrier;
 73 
 74   static bool _completed;
 75 
 76  public:
 77 
 78   static address get_previous_sp_entry()
 79   {
 80     return _get_previous_sp_entry;
 81   }
 82 
 83   static address f2i_fixup()
 84   {
 85     return _f2i_fixup;
 86   }
 87 
 88   static address f2l_fixup()
 89   {
 90     return _f2l_fixup;
 91   }
 92 
 93   static address d2i_fixup()
 94   {
 95     return _d2i_fixup;
 96   }
 97 
 98   static address d2l_fixup()
 99   {
100     return _d2l_fixup;
101   }
102 
103   static address float_sign_mask()
104   {
105     return _float_sign_mask;
106   }
107 
108   static address float_sign_flip()
109   {
110     return _float_sign_flip;
111   }
112 
113   static address double_sign_mask()
114   {
115     return _double_sign_mask;
116   }
117 
118   static address double_sign_flip()
119   {
120     return _double_sign_flip;
121   }
122 
123   static address zero_blocks() {
124     return _zero_blocks;
125   }
126 
127   static address has_negatives() {
128     return _has_negatives;
129   }
130 
131   static address has_negatives_long() {
132     return _has_negatives_long;
133   }
134 
135   static address compare_long_string_LL() {
136     return _compare_long_string_LL;
137   }
138 
139   static address compare_long_string_LU() {
140     return _compare_long_string_LU;
141   }
142 
143   static address compare_long_string_UL() {
144     return _compare_long_string_UL;
145   }
146 
147   static address compare_long_string_UU() {
148     return _compare_long_string_UU;
149   }
150 
151   static address string_indexof_linear_ul() {
152     return _string_indexof_linear_ul;
153   }
154 
155   static address string_indexof_linear_ll() {
156     return _string_indexof_linear_ll;
157   }
158 
159   static address string_indexof_linear_uu() {
160     return _string_indexof_linear_uu;
161   }
162 
163   static address large_byte_array_inflate() {
164     return _large_byte_array_inflate;
165   }
166 
167   static address method_entry_barrier() {
168     return _method_entry_barrier;
169   }
170 
171   static bool complete() {
172     return _completed;
173   }
174 
175   static void set_completed() {
176     _completed = true;
177   }
178 };
179 
180 #endif // CPU_RISCV_STUBROUTINES_RISCV_HPP