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, 2022, 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 riscv {
 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 _compare_long_string_LL;
 62   static address _compare_long_string_LU;
 63   static address _compare_long_string_UL;
 64   static address _compare_long_string_UU;
 65   static address _string_indexof_linear_ll;
 66   static address _string_indexof_linear_uu;
 67   static address _string_indexof_linear_ul;
 68   static address _large_byte_array_inflate;
 69 
 70   static address _method_entry_barrier;
 71 
 72   static bool _completed;
 73 
 74  public:
 75 
 76   static address get_previous_sp_entry() {
 77     return _get_previous_sp_entry;
 78   }
 79 
 80   static address f2i_fixup() {
 81     return _f2i_fixup;
 82   }
 83 
 84   static address f2l_fixup() {
 85     return _f2l_fixup;
 86   }
 87 
 88   static address d2i_fixup() {
 89     return _d2i_fixup;
 90   }
 91 
 92   static address d2l_fixup() {
 93     return _d2l_fixup;
 94   }
 95 
 96   static address float_sign_mask() {
 97     return _float_sign_mask;
 98   }
 99 
100   static address float_sign_flip() {
101     return _float_sign_flip;
102   }
103 
104   static address double_sign_mask() {
105     return _double_sign_mask;
106   }
107 
108   static address double_sign_flip() {
109     return _double_sign_flip;
110   }
111 
112   static address zero_blocks() {
113     return _zero_blocks;
114   }
115 
116   static address compare_long_string_LL() {
117     return _compare_long_string_LL;
118   }
119 
120   static address compare_long_string_LU() {
121     return _compare_long_string_LU;
122   }
123 
124   static address compare_long_string_UL() {
125     return _compare_long_string_UL;
126   }
127 
128   static address compare_long_string_UU() {
129     return _compare_long_string_UU;
130   }
131 
132   static address string_indexof_linear_ul() {
133     return _string_indexof_linear_ul;
134   }
135 
136   static address string_indexof_linear_ll() {
137     return _string_indexof_linear_ll;
138   }
139 
140   static address string_indexof_linear_uu() {
141     return _string_indexof_linear_uu;
142   }
143 
144   static address large_byte_array_inflate() {
145     return _large_byte_array_inflate;
146   }
147 
148   static address method_entry_barrier() {
149     return _method_entry_barrier;
150   }
151 
152   static bool complete() {
153     return _completed;
154   }
155 
156   static void set_completed() {
157     _completed = true;
158   }
159 };
160 
161 #endif // CPU_RISCV_STUBROUTINES_RISCV_HPP