src/hotspot/cpu/s390/bytes_s390.hpp
author goetz
Tue, 09 Jan 2018 08:38:22 +0100
changeset 48626 9f6f48d4f9a1
parent 47216 71c04702a3d5
child 53244 9807daeb47c4
permissions -rw-r--r--
8194814: [ppc, s390] A row of minor fixes and cleanups Summary: Fix the data types of pd flags. Reviewed-by: mdoerr
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
42065
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
     1
/*
48626
9f6f48d4f9a1 8194814: [ppc, s390] A row of minor fixes and cleanups
goetz
parents: 47216
diff changeset
     2
 * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
9f6f48d4f9a1 8194814: [ppc, s390] A row of minor fixes and cleanups
goetz
parents: 47216
diff changeset
     3
 * Copyright (c) 2016, 2018 SAP SE. All rights reserved.
42065
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
     4
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
     5
 *
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
     6
 * This code is free software; you can redistribute it and/or modify it
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
     7
 * under the terms of the GNU General Public License version 2 only, as
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
     8
 * published by the Free Software Foundation.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
     9
 *
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    10
 * This code is distributed in the hope that it will be useful, but WITHOUT
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    11
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    12
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    13
 * version 2 for more details (a copy is included in the LICENSE file that
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    14
 * accompanied this code).
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    15
 *
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    16
 * You should have received a copy of the GNU General Public License version
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    17
 * 2 along with this work; if not, write to the Free Software Foundation,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    18
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    19
 *
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    20
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    21
 * or visit www.oracle.com if you need additional information or have any
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    22
 * questions.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    23
 *
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    24
 */
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    25
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    26
#ifndef CPU_S390_VM_BYTES_S390_HPP
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    27
#define CPU_S390_VM_BYTES_S390_HPP
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    28
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    29
#include "memory/allocation.hpp"
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    30
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    31
class Bytes: AllStatic {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    32
 public:
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    33
  // Efficient reading and writing of unaligned unsigned data in
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    34
  // platform-specific byte ordering.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    35
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    36
  // Use regular load and store for unaligned access.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    37
  //
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    38
  // On z/Architecture, unaligned loads and stores are supported when using the
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    39
  // "traditional" load (LH, L/LY, LG) and store (STH, ST/STY, STG) instructions.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    40
  // The penalty for unaligned access is just very few (two or three) ticks,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    41
  // plus another few (two or three) ticks if the access crosses a cache line boundary.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    42
  //
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    43
  // In short, it makes no sense on z/Architecture to piecemeal get or put unaligned data.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    44
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    45
  static inline u2   get_native_u2(address p) { return *(u2*)p; }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    46
  static inline u4   get_native_u4(address p) { return *(u4*)p; }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    47
  static inline u8   get_native_u8(address p) { return *(u8*)p; }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    48
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    49
  static inline void put_native_u2(address p, u2 x) { *(u2*)p = x; }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    50
  static inline void put_native_u4(address p, u4 x) { *(u4*)p = x; }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    51
  static inline void put_native_u8(address p, u8 x) { *(u8*)p = x; }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    52
48626
9f6f48d4f9a1 8194814: [ppc, s390] A row of minor fixes and cleanups
goetz
parents: 47216
diff changeset
    53
  // The following header contains the implementations of swap_u2, swap_u4, and swap_u8.
9f6f48d4f9a1 8194814: [ppc, s390] A row of minor fixes and cleanups
goetz
parents: 47216
diff changeset
    54
#include OS_CPU_HEADER_INLINE(bytes)
42065
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    55
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    56
  // Efficient reading and writing of unaligned unsigned data in Java byte ordering (i.e. big-endian ordering)
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    57
  static inline u2   get_Java_u2(address p) { return get_native_u2(p); }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    58
  static inline u4   get_Java_u4(address p) { return get_native_u4(p); }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    59
  static inline u8   get_Java_u8(address p) { return get_native_u8(p); }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    60
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    61
  static inline void put_Java_u2(address p, u2 x) { put_native_u2(p, x); }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    62
  static inline void put_Java_u4(address p, u4 x) { put_native_u4(p, x); }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    63
  static inline void put_Java_u8(address p, u8 x) { put_native_u8(p, x); }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    64
};
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    65
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    66
#endif // CPU_S390_VM_BYTES_S390_HPP