hotspot/src/cpu/s390/vm/bytes_s390.hpp
author redestad
Mon, 03 Jul 2017 09:01:34 +0200
changeset 46608 b0da00b77053
parent 46504 38048d4d20e7
permissions -rw-r--r--
8183232: Avoid resolving method_kind in AbstractInterpreter::can_be_compiled Reviewed-by: coleenp, mdoerr, neliasso
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
42065
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
     1
/*
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
     2
 * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
     3
 * Copyright (c) 2016 SAP SE. All rights reserved.
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
  // Only swap on little endian machines => suffix `_le'.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    46
  static inline u2   swap_u2_le(u2 x) { return x; }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    47
  static inline u4   swap_u4_le(u4 x) { return x; }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    48
  static inline u8   swap_u8_le(u8 x) { return x; }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    49
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    50
  static inline u2   get_native_u2(address p) { return *(u2*)p; }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    51
  static inline u4   get_native_u4(address p) { return *(u4*)p; }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    52
  static inline u8   get_native_u8(address p) { return *(u8*)p; }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    53
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    54
  static inline void put_native_u2(address p, u2 x) { *(u2*)p = x; }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    55
  static inline void put_native_u4(address p, u4 x) { *(u4*)p = x; }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    56
  static inline void put_native_u8(address p, u8 x) { *(u8*)p = x; }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    57
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    58
#include "bytes_linux_s390.inline.hpp"
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    59
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    60
  // 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
    61
  static inline u2   get_Java_u2(address p) { return get_native_u2(p); }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    62
  static inline u4   get_Java_u4(address p) { return get_native_u4(p); }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    63
  static inline u8   get_Java_u8(address p) { return get_native_u8(p); }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    64
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    65
  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
    66
  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
    67
  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
    68
};
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    69
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    70
#endif // CPU_S390_VM_BYTES_S390_HPP