1 /* 2 * Copyright (c) 2003, 2025, 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 // emit enum used to size per-blob code buffers 38 39 #define DEFINE_BLOB_SIZE(blob_name, size) \ 40 _ ## blob_name ## _code_size = size, 41 42 enum platform_dependent_constants { 43 STUBGEN_ARCH_BLOBS_DO(DEFINE_BLOB_SIZE) 44 }; 45 46 #undef DEFINE_BLOB_SIZE 47 48 class aarch64 { 49 friend class StubGenerator; 50 friend class StubRoutines; 51 #if INCLUDE_JVMCI 52 friend class JVMCIVMStructs; 53 #endif 54 55 // declare fields for arch-specific entries 56 57 #define DECLARE_ARCH_ENTRY(arch, blob_name, stub_name, field_name, getter_name) \ 58 static address STUB_FIELD_NAME(field_name) ; 59 60 #define DECLARE_ARCH_ENTRY_INIT(arch, blob_name, stub_name, field_name, getter_name, init_function) \ 61 DECLARE_ARCH_ENTRY(arch, blob_name, stub_name, field_name, getter_name) 62 63 private: 64 STUBGEN_ARCH_ENTRIES_DO(DECLARE_ARCH_ENTRY, DECLARE_ARCH_ENTRY_INIT) 65 66 #undef DECLARE_ARCH_ENTRY_INIT 67 #undef DECLARE_ARCH_ENTRY 68 69 static bool _completed; 70 71 public: 72 73 // declare getters for arch-specific entries 74 75 #define DEFINE_ARCH_ENTRY_GETTER(arch, blob_name, stub_name, field_name, getter_name) \ 76 static address getter_name() { return STUB_FIELD_NAME(field_name) ; } 77 78 #define DEFINE_ARCH_ENTRY_GETTER_INIT(arch, blob_name, stub_name, field_name, getter_name, init_function) \ 79 DEFINE_ARCH_ENTRY_GETTER(arch, blob_name, stub_name, field_name, getter_name) 80 81 STUBGEN_ARCH_ENTRIES_DO(DEFINE_ARCH_ENTRY_GETTER, DEFINE_ARCH_ENTRY_GETTER_INIT) 82 83 #undef DEFINE_ARCH_ENTRY_GETTER_INIT 84 #undef DEFINE_ARCH_ENTRY_GETTER 85 86 static address large_arrays_hashcode(BasicType eltype) { 87 switch (eltype) { 88 case T_BOOLEAN: 89 return large_arrays_hashcode_boolean(); 90 case T_BYTE: 91 return large_arrays_hashcode_byte(); 92 case T_CHAR: 93 return large_arrays_hashcode_char(); 94 case T_SHORT: 95 return large_arrays_hashcode_short(); 96 case T_INT: 97 return large_arrays_hashcode_int(); 98 default: 99 ShouldNotReachHere(); 100 } 101 102 return nullptr; 103 } 104 105 static bool complete() { 106 return _completed; 107 } 108 109 static void set_completed() { 110 _completed = true; 111 } 112 113 private: 114 static uint16_t _kyberConsts[]; 115 static uint32_t _dilithiumConsts[]; 116 static juint _crc_table[]; 117 static jubyte _adler_table[]; 118 // begin trigonometric tables block. See comments in .cpp file 119 static juint _npio2_hw[]; 120 static jdouble _two_over_pi[]; 121 static jdouble _pio2[]; 122 static jdouble _dsin_coef[]; 123 static jdouble _dcos_coef[]; 124 // end trigonometric tables block 125 }; 126 127 #endif // CPU_AARCH64_STUBROUTINES_AARCH64_HPP