src/hotspot/cpu/s390/relocInfo_s390.hpp
author naoto
Tue, 09 Jul 2019 08:05:38 -0700
changeset 55627 9c1885fb2a42
parent 53244 9807daeb47c4
child 57583 aad50831e169
permissions -rw-r--r--
8227127: Era designator not displayed correctly using the COMPAT provider Reviewed-by: rriggs
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
42065
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
     1
/*
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 48486
diff changeset
     2
 * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
48486
bda5211e7876 8193927: Optimize scanning code for oops.
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
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 48486
diff changeset
    26
#ifndef CPU_S390_RELOCINFO_S390_HPP
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 48486
diff changeset
    27
#define CPU_S390_RELOCINFO_S390_HPP
42065
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    28
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    29
//----------------------------
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    30
//  relocInfo layout
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    31
//----------------------------
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    32
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    33
// This description should be contained in code/relocInfo.hpp
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    34
// but was put here to minimize shared code diffs.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    35
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    36
// Relocation information for a nmethod is stored in compressed
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    37
// form in an array of element type short int (16 bits).
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    38
// Each array element constitutes one relocInfo record.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    39
// The layout of one such record is described here.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    40
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    41
// +------------+---+---+------------------------------+
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    42
// |    type    |  fmt  |      offset/offset_unit      |
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    43
// +------------+---+---+------------------------------+
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    44
//
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    45
// |<-- value_width (16) ----------------------------->|
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    46
// |<type_width>|<-- nontype_width (12) -------------->|
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    47
//      (4)
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    48
// |            |<--+-->|<-- offset_width (10) ------->|
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    49
//              /       \
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    50
//             /   (2)   \
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    51
//            /<--format->\
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    52
//            |    width  |
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    53
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    54
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    55
// only for type == data_prefix_tag:
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    56
// +------------+---+---+------------------------------+
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    57
// |    type    |   |              data                |
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    58
// +------------+---+---+------------------------------+
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    59
// |     15     |<->|<-- datalen_width (11) ---------->|
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    60
//                |
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    61
//                +--datalen_tag (1)
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    62
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    63
// relocType
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    64
//   The type field holds a value of relocType (which is
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    65
//   an enum of all possible relocation types). Currently,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    66
//   there are 16 distinct relocation types, requiring
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    67
//   type_width to be (at least) 4.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    68
// relocFormat
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    69
//   The format field holds a value of relocFormat (which is
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    70
//   an enum of all possible relocation formats). Currently,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    71
//   there are 4 distinct relocation formats, requiring
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    72
//   format_width to be (at least) 2.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    73
// offset
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    74
//   Each relocInfo is related to one specific address in the CodeBlob.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    75
//   The address always points to the first byte of the target instruction.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    76
//   It does NOT refer directly to the relocation subfield or embedded constant.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    77
//   offset contains the distance of this relocInfo from the previous one.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    78
//   offset is scaled by offset_unit (the platform-specific instruction
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    79
//   alignment requirement) to maximize the encodable distance.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    80
//   To obtain the absolute address in the CodeBlob the relocInfo is
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    81
//   related to, you have to iterate over all relocInfos from the
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    82
//   beginning, and then use RelocIterator::addr() to get the address.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    83
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    84
// relocType == data_prefix_tag
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    85
//   These are relocInfo records containing inline data that belongs to
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    86
//   the next non-data relocInfo record. Usage of that inline data is
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    87
//   specific and private to that relocInfo record.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    88
//   For details refer to code/relocInfo.hpp
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    89
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    90
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    91
  // machine-dependent parts of class relocInfo
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    92
 private:
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    93
  enum {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    94
    // Instructions are HW (2-byte) aligned on z/Architecture.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    95
    offset_unit        =  2,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    96
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    97
    // Encodes Assembler::disp32_operand vs. Assembler::imm64_operand.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    98
    // (Assembler::call32_operand is used on call instructions only.)
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    99
    format_width       =  2
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   100
  };
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   101
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   102
 public:
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   103
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   104
  enum relocFormat {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   105
    no_format           = 0,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   106
    uncompressed_format = 0,  // Relocation is for a regular oop.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   107
    compressed_format   = 1,  // Relocation is for a narrow (compressed) oop or klass.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   108
                              // Similar to relocInfo::narrow_oop_in_const.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   109
    pcrel_addr_format   = 2,  // Relocation is for the target LOCATION of a pc-relative instruction.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   110
    pcrel_data_format   = 3   // Relocation is for the target data of a pc-relative instruction.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   111
  };
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   112
48486
bda5211e7876 8193927: Optimize scanning code for oops.
goetz
parents: 47216
diff changeset
   113
  // This platform has no oops in the code that are not also
bda5211e7876 8193927: Optimize scanning code for oops.
goetz
parents: 47216
diff changeset
   114
  // listed in the oop section.
bda5211e7876 8193927: Optimize scanning code for oops.
goetz
parents: 47216
diff changeset
   115
  static bool mustIterateImmediateOopsInCode() { return false; }
bda5211e7876 8193927: Optimize scanning code for oops.
goetz
parents: 47216
diff changeset
   116
42065
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   117
  // Store the new target address into an oop_Relocation cell, if any.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   118
  // Return indication if update happened.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   119
  static bool update_oop_pool(address begin, address end, address newTarget, CodeBlob* cb);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   120
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 48486
diff changeset
   121
#endif // CPU_S390_RELOCINFO_S390_HPP