Path: blob/master/src/hotspot/cpu/s390/bytes_s390.hpp
40930 views
/*1* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.2* Copyright (c) 2016, 2018 SAP SE. All rights reserved.3* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.4*5* This code is free software; you can redistribute it and/or modify it6* under the terms of the GNU General Public License version 2 only, as7* published by the Free Software Foundation.8*9* This code is distributed in the hope that it will be useful, but WITHOUT10* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or11* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License12* version 2 for more details (a copy is included in the LICENSE file that13* accompanied this code).14*15* You should have received a copy of the GNU General Public License version16* 2 along with this work; if not, write to the Free Software Foundation,17* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.18*19* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA20* or visit www.oracle.com if you need additional information or have any21* questions.22*23*/2425#ifndef CPU_S390_BYTES_S390_HPP26#define CPU_S390_BYTES_S390_HPP2728#include "memory/allocation.hpp"2930class Bytes: AllStatic {31public:32// Efficient reading and writing of unaligned unsigned data in33// platform-specific byte ordering.3435// Use regular load and store for unaligned access.36//37// On z/Architecture, unaligned loads and stores are supported when using the38// "traditional" load (LH, L/LY, LG) and store (STH, ST/STY, STG) instructions.39// The penalty for unaligned access is just very few (two or three) ticks,40// plus another few (two or three) ticks if the access crosses a cache line boundary.41//42// In short, it makes no sense on z/Architecture to piecemeal get or put unaligned data.4344static inline u2 get_native_u2(address p) { return *(u2*)p; }45static inline u4 get_native_u4(address p) { return *(u4*)p; }46static inline u8 get_native_u8(address p) { return *(u8*)p; }4748static inline void put_native_u2(address p, u2 x) { *(u2*)p = x; }49static inline void put_native_u4(address p, u4 x) { *(u4*)p = x; }50static inline void put_native_u8(address p, u8 x) { *(u8*)p = x; }5152// The following header contains the implementations of swap_u2, swap_u4, and swap_u8.53#include OS_CPU_HEADER(bytes)5455// Efficient reading and writing of unaligned unsigned data in Java byte ordering (i.e. big-endian ordering)56static inline u2 get_Java_u2(address p) { return get_native_u2(p); }57static inline u4 get_Java_u4(address p) { return get_native_u4(p); }58static inline u8 get_Java_u8(address p) { return get_native_u8(p); }5960static inline void put_Java_u2(address p, u2 x) { put_native_u2(p, x); }61static inline void put_Java_u4(address p, u4 x) { put_native_u4(p, x); }62static inline void put_Java_u8(address p, u8 x) { put_native_u8(p, x); }63};6465#endif // CPU_S390_BYTES_S390_HPP666768