1 /* 2 * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. 3 * Copyright (c) 2016 SAP SE. 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_S390_VM_STUBROUTINES_ZARCH_64_64_HPP 27 #define CPU_S390_VM_STUBROUTINES_ZARCH_64_64_HPP 28 29 // This file holds the platform specific parts of the StubRoutines 30 // definition. See stubRoutines.hpp for a description on how to extend it. 31 32 static bool returns_to_call_stub(address return_pc) { return return_pc == _call_stub_return_address; } 33 34 enum { // Platform dependent constants. 35 // TODO: May be able to shrink this a lot 36 code_size1 = 20000, // Simply increase if too small (assembler will crash if too small). 37 code_size2 = 20000 // Simply increase if too small (assembler will crash if too small). 38 }; 39 40 // MethodHandles adapters 41 enum method_handles_platform_dependent_constants { 42 method_handles_adapters_code_size = 5000 43 }; 44 45 #define CRC32_COLUMN_SIZE 256 46 #define CRC32_BYFOUR 47 #ifdef CRC32_BYFOUR 48 #define CRC32_TABLES 8 49 #else 50 #define CRC32_TABLES 1 51 #endif 52 53 // Comapct string intrinsics: Translate table for string inflate intrinsic. Used by trot instruction. 54 #define TROT_ALIGNMENT 8 // Required by instruction, 55 // guaranteed by jlong table element type. 56 #define TROT_COLUMN_SIZE (256*sizeof(jchar)/sizeof(jlong)) 57 58 class zarch { 59 friend class StubGenerator; 60 61 public: 62 enum { nof_instance_allocators = 10 }; 63 64 // allocator lock values 65 enum { 66 unlocked = 0, 67 locked = 1 68 }; 69 70 private: 71 static address _handler_for_unsafe_access_entry; 72 73 static int _atomic_memory_operation_lock; 74 75 static address _partial_subtype_check; 76 static juint _crc_table[CRC32_TABLES][CRC32_COLUMN_SIZE]; 77 78 // Comapct string intrinsics: Translate table for string inflate intrinsic. Used by trot instruction. 79 static address _trot_table_addr; 80 static jlong _trot_table[TROT_COLUMN_SIZE]; 81 82 public: 83 // Global lock for everyone who needs to use atomic_compare_and_exchange 84 // or atomic_increment -- should probably use more locks for more 85 // scalability -- for instance one for each eden space or group of. 86 87 // Address of the lock for atomic_compare_and_exchange. 88 static int* atomic_memory_operation_lock_addr() { return &_atomic_memory_operation_lock; } 89 90 // Accessor and mutator for _atomic_memory_operation_lock. 91 static int atomic_memory_operation_lock() { return _atomic_memory_operation_lock; } 92 static void set_atomic_memory_operation_lock(int value) { _atomic_memory_operation_lock = value; } 93 94 static address handler_for_unsafe_access_entry() { return _handler_for_unsafe_access_entry; } 95 96 static address partial_subtype_check() { return _partial_subtype_check; } 97 98 static void generate_load_crc_table_addr(MacroAssembler* masm, Register table); 99 100 // Comapct string intrinsics: Translate table for string inflate intrinsic. Used by trot instruction. 101 static void generate_load_trot_table_addr(MacroAssembler* masm, Register table); 102 }; 103 104 #endif // CPU_S390_VM_STUBROUTINES_ZARCH_64_64_HPP