src/hotspot/cpu/s390/macroAssembler_s390.hpp
author mdoerr
Tue, 28 Nov 2017 01:08:26 +0300
changeset 48585 d9fcb7ba8133
parent 48332 651a95f30dfb
child 49748 6a880e576856
permissions -rw-r--r--
8191907: PPC64 and s390 parts of JDK-8174962: Better interface invocations Reviewed-by: goetz
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
42065
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
     1
/*
46315
a796c32af782 8175368: [s390] Provide intrinsic implementation for CRC32C
lucy
parents: 43420
diff changeset
     2
 * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
a796c32af782 8175368: [s390] Provide intrinsic implementation for CRC32C
lucy
parents: 43420
diff changeset
     3
 * Copyright (c) 2016, 2017, 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_MACROASSEMBLER_S390_HPP
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    27
#define CPU_S390_VM_MACROASSEMBLER_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 "asm/assembler.hpp"
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    30
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    31
#define MODERN_IFUN(name)  ((void (MacroAssembler::*)(Register, int64_t, Register, Register))&MacroAssembler::name)
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    32
#define CLASSIC_IFUN(name) ((void (MacroAssembler::*)(Register, int64_t, Register, Register))&MacroAssembler::name)
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    33
#define MODERN_FFUN(name)  ((void (MacroAssembler::*)(FloatRegister, int64_t, Register, Register))&MacroAssembler::name)
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    34
#define CLASSIC_FFUN(name) ((void (MacroAssembler::*)(FloatRegister, int64_t, Register, Register))&MacroAssembler::name)
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    35
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    36
class MacroAssembler: public Assembler {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    37
 public:
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    38
  MacroAssembler(CodeBuffer* code) : Assembler(code) {}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    39
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    40
  //
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    41
  // Optimized instruction emitters
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    42
  //
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    43
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    44
  // Move register if destination register and target register are different.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    45
  void lr_if_needed(Register rd, Register rs);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    46
  void lgr_if_needed(Register rd, Register rs);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    47
  void llgfr_if_needed(Register rd, Register rs);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    48
  void ldr_if_needed(FloatRegister rd, FloatRegister rs);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    49
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    50
  void move_reg_if_needed(Register dest, BasicType dest_type, Register src, BasicType src_type);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    51
  void move_freg_if_needed(FloatRegister dest, BasicType dest_type, FloatRegister src, BasicType src_type);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    52
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    53
  void freg2mem_opt(FloatRegister reg,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    54
                    int64_t       disp,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    55
                    Register      index,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    56
                    Register      base,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    57
                    void (MacroAssembler::*modern) (FloatRegister, int64_t, Register, Register),
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    58
                    void (MacroAssembler::*classic)(FloatRegister, int64_t, Register, Register),
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    59
                    Register      scratch = Z_R0);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    60
  void freg2mem_opt(FloatRegister reg,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    61
                    const Address &a, bool is_double = true);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    62
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    63
  void mem2freg_opt(FloatRegister reg,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    64
                    int64_t       disp,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    65
                    Register      index,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    66
                    Register      base,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    67
                    void (MacroAssembler::*modern) (FloatRegister, int64_t, Register, Register),
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    68
                    void (MacroAssembler::*classic)(FloatRegister, int64_t, Register, Register),
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    69
                    Register      scratch = Z_R0);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    70
  void mem2freg_opt(FloatRegister reg,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    71
                    const Address &a, bool is_double = true);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    72
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    73
  void reg2mem_opt(Register reg,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    74
                   int64_t  disp,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    75
                   Register index,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    76
                   Register base,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    77
                   void (MacroAssembler::*modern) (Register, int64_t, Register, Register),
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    78
                   void (MacroAssembler::*classic)(Register, int64_t, Register, Register),
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    79
                   Register scratch = Z_R0);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    80
  // returns offset of the store instruction
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    81
  int reg2mem_opt(Register reg, const Address &a, bool is_double = true);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    82
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    83
  void mem2reg_opt(Register reg,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    84
                   int64_t  disp,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    85
                   Register index,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    86
                   Register base,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    87
                   void (MacroAssembler::*modern) (Register, int64_t, Register, Register),
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    88
                   void (MacroAssembler::*classic)(Register, int64_t, Register, Register));
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    89
  void mem2reg_opt(Register reg, const Address &a, bool is_double = true);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    90
  void mem2reg_signed_opt(Register reg, const Address &a);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    91
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    92
  // AND immediate and set condition code, works for 64 bit immediates/operation as well.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    93
   void and_imm(Register r, long mask, Register tmp = Z_R0, bool wide = false);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    94
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    95
  // 1's complement, 32bit or 64bit. Optimized to exploit distinct operands facility.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    96
  // Note: The condition code is neither preserved nor correctly set by this code!!!
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    97
  // Note: (wide == false) does not protect the high order half of the target register
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    98
  // from alternation. It only serves as optimization hint for 32-bit results.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
    99
  void not_(Register r1, Register r2 = noreg, bool wide = false);  // r1 = ~r2
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   100
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   101
  // Expanded support of all "rotate_then_<logicalOP>" instructions.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   102
  //
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   103
  // Generalize and centralize rotate_then_<logicalOP> emitter.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   104
  // Functional description. For details, see Principles of Operation, Chapter 7, "Rotate Then Insert..."
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   105
  //  - Bits  in a register are numbered left (most significant) to right (least significant), i.e. [0..63].
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   106
  //  - Bytes in a register are numbered left (most significant) to right (least significant), i.e. [0..7].
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   107
  //  - Register src is rotated to the left by (nRotate&0x3f) positions.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   108
  //  - Negative values for nRotate result in a rotation to the right by abs(nRotate) positions.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   109
  //  - The bits in positions [lBitPos..rBitPos] of the _ROTATED_ src operand take part in the
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   110
  //    logical operation performed on the contents (in those positions) of the dst operand.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   111
  //  - The logical operation that is performed on the dst operand is one of
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   112
  //     o insert the selected bits (replacing the original contents of those bit positions)
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   113
  //     o and the selected bits with the corresponding bits of the dst operand
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   114
  //     o or  the selected bits with the corresponding bits of the dst operand
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   115
  //     o xor the selected bits with the corresponding bits of the dst operand
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   116
  //  - For clear_dst == true, the destination register is cleared before the bits are inserted.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   117
  //    For clear_dst == false, only the bit positions that get data inserted from src
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   118
  //    are changed. All other bit positions remain unchanged.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   119
  //  - For test_only == true,  the result of the logicalOP is only used to set the condition code, dst remains unchanged.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   120
  //    For test_only == false, the result of the logicalOP replaces the selected bits of dst.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   121
  //  - src32bit and dst32bit indicate the respective register is used as 32bit value only.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   122
  //    Knowledge can simplify code generation.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   123
  //
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   124
  // Here is an important performance note, valid for all <logicalOP>s except "insert":
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   125
  //   Due to the too complex nature of the operation, it cannot be done in a single cycle.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   126
  //   Timing constraints require the instructions to be cracked into two micro-ops, taking
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   127
  //   one or two cycles each to execute. In some cases, an additional pipeline bubble might get added.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   128
  //   Macroscopically, that makes up for a three- or four-cycle instruction where you would
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   129
  //   expect just a single cycle.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   130
  //   It is thus not beneficial from a performance point of view to exploit those instructions.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   131
  //   Other reasons (code compactness, register pressure, ...) might outweigh this penalty.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   132
  //
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   133
  unsigned long create_mask(int lBitPos, int rBitPos);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   134
  void rotate_then_mask(Register dst, Register src, int lBitPos, int rBitPos,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   135
                        int nRotate, bool src32bit, bool dst32bit, bool oneBits);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   136
  void rotate_then_insert(Register dst, Register src, int lBitPos, int rBitPos, int nRotate,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   137
                          bool clear_dst);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   138
  void rotate_then_and(Register dst, Register src, int lBitPos, int rBitPos, int nRotate,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   139
                       bool test_only);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   140
  void rotate_then_or(Register dst, Register src, int lBitPos, int rBitPos, int nRotate,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   141
                      bool test_onlyt);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   142
  void rotate_then_xor(Register dst, Register src, int lBitPos, int rBitPos, int nRotate,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   143
                       bool test_only);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   144
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   145
  void add64(Register r1, RegisterOrConstant inc);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   146
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   147
  // Helper function to multiply the 64bit contents of a register by a 16bit constant.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   148
  // The optimization tries to avoid the mghi instruction, since it uses the FPU for
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   149
  // calculation and is thus rather slow.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   150
  //
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   151
  // There is no handling for special cases, e.g. cval==0 or cval==1.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   152
  //
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   153
  // Returns len of generated code block.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   154
  unsigned int mul_reg64_const16(Register rval, Register work, int cval);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   155
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   156
  // Generic operation r1 := r2 + imm.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   157
  void add2reg(Register r1, int64_t imm, Register r2 = noreg);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   158
  // Generic operation r := b + x + d.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   159
  void add2reg_with_index(Register r, int64_t d, Register x, Register b = noreg);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   160
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   161
  // Add2mem* methods for direct memory increment.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   162
  void add2mem_32(const Address &a, int64_t imm, Register tmp);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   163
  void add2mem_64(const Address &a, int64_t imm, Register tmp);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   164
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   165
  // *((int8_t*)(dst)) |= imm8
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   166
  inline void or2mem_8(Address& dst, int64_t imm8);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   167
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   168
  // Load values by size and signedness.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   169
  void load_sized_value(Register dst, Address src, size_t size_in_bytes, bool is_signed);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   170
  void store_sized_value(Register src, Address dst, size_t size_in_bytes);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   171
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   172
  // Load values with large offsets to base address.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   173
 private:
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   174
  int  split_largeoffset(int64_t si20_offset, Register tmp, bool fixed_codelen, bool accumulate);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   175
 public:
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   176
  void load_long_largeoffset(Register t, int64_t si20, Register a, Register tmp);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   177
  void load_float_largeoffset(FloatRegister t, int64_t si20, Register a, Register tmp);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   178
  void load_double_largeoffset(FloatRegister t, int64_t si20, Register a, Register tmp);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   179
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   180
 private:
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   181
  long toc_distance();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   182
 public:
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   183
  void load_toc(Register Rtoc);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   184
  void load_long_pcrelative(Register Rdst, address dataLocation);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   185
  static int load_long_pcrelative_size() { return 6; }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   186
  void load_addr_pcrelative(Register Rdst, address dataLocation);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   187
  static int load_addr_pcrel_size() { return 6; } // Just a LARL.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   188
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   189
  // Load a value from memory and test (set CC).
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   190
  void load_and_test_byte    (Register dst, const Address &a);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   191
  void load_and_test_short   (Register dst, const Address &a);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   192
  void load_and_test_int     (Register dst, const Address &a);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   193
  void load_and_test_int2long(Register dst, const Address &a);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   194
  void load_and_test_long    (Register dst, const Address &a);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   195
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   196
  // Test a bit in memory. Result is reflected in CC.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   197
  void testbit(const Address &a, unsigned int bit);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   198
  // Test a bit in a register. Result is reflected in CC.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   199
  void testbit(Register r, unsigned int bitPos);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   200
48094
bca569f79fa1 8189793: [s390]: Improve String compress/inflate by exploiting vector instructions
lucy
parents: 47216
diff changeset
   201
  void prefetch_read(Address a);
bca569f79fa1 8189793: [s390]: Improve String compress/inflate by exploiting vector instructions
lucy
parents: 47216
diff changeset
   202
  void prefetch_update(Address a);
bca569f79fa1 8189793: [s390]: Improve String compress/inflate by exploiting vector instructions
lucy
parents: 47216
diff changeset
   203
42065
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   204
  // Clear a register, i.e. load const zero into reg. Return len (in bytes) of
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   205
  // generated instruction(s).
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   206
  //   whole_reg: Clear 64 bits if true, 32 bits otherwise.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   207
  //   set_cc: Use instruction that sets the condition code, if true.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   208
  int clear_reg(Register r, bool whole_reg = true, bool set_cc = true);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   209
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   210
#ifdef ASSERT
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   211
  int preset_reg(Register r, unsigned long pattern, int pattern_len);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   212
#endif
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   213
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   214
  // Clear (store zeros) a small piece of memory.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   215
  // CAUTION: Do not use this for atomic memory clearing. Use store_const() instead.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   216
  //   addr: Address descriptor of memory to clear.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   217
  //         Index register will not be used!
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   218
  //   size: Number of bytes to clear.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   219
  void clear_mem(const Address& addr, unsigned size);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   220
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   221
  // Move immediate values to memory. Currently supports 32 and 64 bit stores,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   222
  // but may be extended to 16 bit store operation, if needed.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   223
  // For details, see implementation in *.cpp file.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   224
         int store_const(const Address &dest, long imm,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   225
                         unsigned int lm, unsigned int lc,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   226
                         Register scratch = Z_R0);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   227
  inline int store_const(const Address &dest, long imm,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   228
                         Register scratch = Z_R0, bool is_long = true);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   229
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   230
  // Move/initialize arbitrarily large memory area. No check for destructive overlap.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   231
  // Being interruptible, these instructions need a retry-loop.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   232
  void move_long_ext(Register dst, Register src, unsigned int pad);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   233
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   234
  void compare_long_ext(Register left, Register right, unsigned int pad);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   235
  void compare_long_uni(Register left, Register right, unsigned int pad);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   236
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   237
  void search_string(Register end, Register start);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   238
  void search_string_uni(Register end, Register start);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   239
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   240
  // Translate instructions
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   241
  // Being interruptible, these instructions need a retry-loop.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   242
  void translate_oo(Register dst, Register src, uint mask);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   243
  void translate_ot(Register dst, Register src, uint mask);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   244
  void translate_to(Register dst, Register src, uint mask);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   245
  void translate_tt(Register dst, Register src, uint mask);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   246
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   247
  // Crypto instructions.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   248
  // Being interruptible, these instructions need a retry-loop.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   249
  void cksm(Register crcBuff, Register srcBuff);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   250
  void km( Register dstBuff, Register srcBuff);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   251
  void kmc(Register dstBuff, Register srcBuff);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   252
  void kimd(Register srcBuff);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   253
  void klmd(Register srcBuff);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   254
  void kmac(Register srcBuff);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   255
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   256
  // nop padding
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   257
  void align(int modulus);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   258
  void align_address(int modulus);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   259
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   260
  //
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   261
  // Constants, loading constants, TOC support
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   262
  //
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   263
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   264
  // Load generic address: d <- base(a) + index(a) + disp(a).
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   265
  inline void load_address(Register d, const Address &a);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   266
  // Load absolute address (and try to optimize).
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   267
  void load_absolute_address(Register d, address addr);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   268
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   269
  // Address of Z_ARG1 and argument_offset.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   270
  // If temp_reg == arg_slot, arg_slot will be overwritten.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   271
  Address argument_address(RegisterOrConstant arg_slot,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   272
                           Register temp_reg = noreg,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   273
                           int64_t extra_slot_offset = 0);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   274
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   275
  // Load a narrow ptr constant (oop or klass ptr).
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   276
  void load_narrow_oop( Register t, narrowOop a);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   277
  void load_narrow_klass(Register t, Klass* k);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   278
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   279
  static bool is_load_const_32to64(address pos);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   280
  static bool is_load_narrow_oop(address pos)   { return is_load_const_32to64(pos); }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   281
  static bool is_load_narrow_klass(address pos) { return is_load_const_32to64(pos); }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   282
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   283
  static int  load_const_32to64_size()          { return 6; }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   284
  static bool load_narrow_oop_size()            { return load_const_32to64_size(); }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   285
  static bool load_narrow_klass_size()          { return load_const_32to64_size(); }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   286
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   287
  static int  patch_load_const_32to64(address pos, int64_t a);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   288
  static int  patch_load_narrow_oop(address pos, oop o);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   289
  static int  patch_load_narrow_klass(address pos, Klass* k);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   290
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   291
  // cOops. CLFI exploit.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   292
  void compare_immediate_narrow_oop(Register oop1, narrowOop oop2);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   293
  void compare_immediate_narrow_klass(Register op1, Klass* op2);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   294
  static bool is_compare_immediate32(address pos);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   295
  static bool is_compare_immediate_narrow_oop(address pos);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   296
  static bool is_compare_immediate_narrow_klass(address pos);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   297
  static int  compare_immediate_narrow_size()       { return 6; }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   298
  static int  compare_immediate_narrow_oop_size()   { return compare_immediate_narrow_size(); }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   299
  static int  compare_immediate_narrow_klass_size() { return compare_immediate_narrow_size(); }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   300
  static int  patch_compare_immediate_32(address pos, int64_t a);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   301
  static int  patch_compare_immediate_narrow_oop(address pos, oop o);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   302
  static int  patch_compare_immediate_narrow_klass(address pos, Klass* k);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   303
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   304
  // Load a 32bit constant into a 64bit register.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   305
  void load_const_32to64(Register t, int64_t x, bool sign_extend=true);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   306
  // Load a 64 bit constant.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   307
         void load_const(Register t, long a);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   308
  inline void load_const(Register t, void* a);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   309
  inline void load_const(Register t, Label& L);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   310
  inline void load_const(Register t, const AddressLiteral& a);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   311
  // Get the 64 bit constant from a `load_const' sequence.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   312
  static long get_const(address load_const);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   313
  // Patch the 64 bit constant of a `load_const' sequence. This is a low level
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   314
  // procedure. It neither flushes the instruction cache nor is it atomic.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   315
  static void patch_const(address load_const, long x);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   316
  static int load_const_size() { return 12; }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   317
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   318
  // Turn a char into boolean. NOTE: destroys r.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   319
  void c2bool(Register r, Register t = Z_R0);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   320
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   321
  // Optimized version of load_const for constants that do not need to be
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   322
  // loaded by a sequence of instructions of fixed length and that do not
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   323
  // need to be patched.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   324
  int load_const_optimized_rtn_len(Register t, long x, bool emit);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   325
  inline void load_const_optimized(Register t, long x);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   326
  inline void load_const_optimized(Register t, void* a);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   327
  inline void load_const_optimized(Register t, Label& L);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   328
  inline void load_const_optimized(Register t, const AddressLiteral& a);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   329
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   330
 public:
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   331
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   332
  //----------------------------------------------------------
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   333
  //            oops in code             -------------
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   334
  //  including compressed oops support  -------------
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   335
  //----------------------------------------------------------
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   336
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   337
  // Metadata in code that we have to keep track of.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   338
  AddressLiteral allocate_metadata_address(Metadata* obj); // allocate_index
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   339
  AddressLiteral constant_metadata_address(Metadata* obj); // find_index
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   340
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   341
  // allocate_index
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   342
  AddressLiteral allocate_oop_address(jobject obj);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   343
  // find_index
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   344
  AddressLiteral constant_oop_address(jobject obj);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   345
  // Uses allocate_oop_address.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   346
  inline void set_oop         (jobject obj, Register d);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   347
  // Uses constant_oop_address.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   348
  inline void set_oop_constant(jobject obj, Register d);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   349
  // Uses constant_metadata_address.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   350
  inline bool set_metadata_constant(Metadata* md, Register d);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   351
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   352
  virtual RegisterOrConstant delayed_value_impl(intptr_t* delayed_value_addr,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   353
                                                Register tmp,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   354
                                                int offset);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   355
  //
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   356
  // branch, jump
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   357
  //
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   358
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   359
  // Use one generic function for all branch patches.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   360
  static unsigned long patched_branch(address dest_pos, unsigned long inst, address inst_pos);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   361
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   362
  void pd_patch_instruction(address branch, address target);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   363
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   364
  // Extract relative address from "relative" instructions.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   365
  static long get_pcrel_offset(unsigned long inst);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   366
  static long get_pcrel_offset(address pc);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   367
  static address get_target_addr_pcrel(address pc);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   368
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   369
  static inline bool is_call_pcrelative_short(unsigned long inst);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   370
  static inline bool is_call_pcrelative_long(unsigned long inst);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   371
  static inline bool is_branch_pcrelative_short(unsigned long inst);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   372
  static inline bool is_branch_pcrelative_long(unsigned long inst);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   373
  static inline bool is_compareandbranch_pcrelative_short(unsigned long inst);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   374
  static inline bool is_branchoncount_pcrelative_short(unsigned long inst);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   375
  static inline bool is_branchonindex32_pcrelative_short(unsigned long inst);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   376
  static inline bool is_branchonindex64_pcrelative_short(unsigned long inst);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   377
  static inline bool is_branchonindex_pcrelative_short(unsigned long inst);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   378
  static inline bool is_branch_pcrelative16(unsigned long inst);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   379
  static inline bool is_branch_pcrelative32(unsigned long inst);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   380
  static inline bool is_branch_pcrelative(unsigned long inst);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   381
  static inline bool is_load_pcrelative_long(unsigned long inst);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   382
  static inline bool is_misc_pcrelative_long(unsigned long inst);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   383
  static inline bool is_pcrelative_short(unsigned long inst);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   384
  static inline bool is_pcrelative_long(unsigned long inst);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   385
  // PCrelative TOC access. Variants with address argument.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   386
  static inline bool is_load_pcrelative_long(address iLoc);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   387
  static inline bool is_pcrelative_short(address iLoc);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   388
  static inline bool is_pcrelative_long(address iLoc);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   389
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   390
  static inline bool is_pcrelative_instruction(address iloc);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   391
  static inline bool is_load_addr_pcrel(address a);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   392
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   393
  static void patch_target_addr_pcrel(address pc, address con);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   394
  static void patch_addr_pcrel(address pc, address con) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   395
    patch_target_addr_pcrel(pc, con); // Just delegate. This is only for nativeInst_s390.cpp.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   396
  }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   397
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   398
  //---------------------------------------------------------
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   399
  //  Some macros for more comfortable assembler programming.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   400
  //---------------------------------------------------------
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   401
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   402
  // NOTE: pass NearLabel T to signal that the branch target T will be bound to a near address.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   403
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   404
  void compare32_and_branch(Register r1, RegisterOrConstant x2, branch_condition cond, Label& target);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   405
  void compareU32_and_branch(Register r1, RegisterOrConstant x2, branch_condition cond, Label& target);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   406
  void compare64_and_branch(Register r1, RegisterOrConstant x2, branch_condition cond, Label& target);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   407
  void compareU64_and_branch(Register r1, RegisterOrConstant x2, branch_condition cond, Label& target);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   408
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   409
  void branch_optimized(Assembler::branch_condition cond, address branch_target);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   410
  void branch_optimized(Assembler::branch_condition cond, Label&  branch_target);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   411
  void compare_and_branch_optimized(Register r1,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   412
                                    Register r2,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   413
                                    Assembler::branch_condition cond,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   414
                                    address  branch_addr,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   415
                                    bool     len64,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   416
                                    bool     has_sign);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   417
  void compare_and_branch_optimized(Register r1,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   418
                                    jlong    x2,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   419
                                    Assembler::branch_condition cond,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   420
                                    Label&   branch_target,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   421
                                    bool     len64,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   422
                                    bool     has_sign);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   423
  void compare_and_branch_optimized(Register r1,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   424
                                    Register r2,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   425
                                    Assembler::branch_condition cond,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   426
                                    Label&   branch_target,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   427
                                    bool     len64,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   428
                                    bool     has_sign);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   429
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   430
  //
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   431
  // Support for frame handling
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   432
  //
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   433
  // Specify the register that should be stored as the return pc in the
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   434
  // current frame (default is R14).
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   435
  inline void save_return_pc(Register pc = Z_R14);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   436
  inline void restore_return_pc();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   437
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   438
  // Get current PC.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   439
  address get_PC(Register result);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   440
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   441
  // Get current PC + offset. Offset given in bytes, must be even!
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   442
  address get_PC(Register result, int64_t offset);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   443
48332
651a95f30dfb 8193257: PPC64, s390 implementation for Thread-local handshakes
mdoerr
parents: 48094
diff changeset
   444
  // Get size of instruction at pc (which must point to valid code).
651a95f30dfb 8193257: PPC64, s390 implementation for Thread-local handshakes
mdoerr
parents: 48094
diff changeset
   445
  void instr_size(Register size, Register pc);
651a95f30dfb 8193257: PPC64, s390 implementation for Thread-local handshakes
mdoerr
parents: 48094
diff changeset
   446
46726
7801367e3cc9 8180659: [s390] micro-optimization in resize_frame_absolute()
lucy
parents: 46369
diff changeset
   447
  // Accessing, and in particular modifying, a stack location is only safe if
7801367e3cc9 8180659: [s390] micro-optimization in resize_frame_absolute()
lucy
parents: 46369
diff changeset
   448
  // the stack pointer (Z_SP) is set such that the accessed stack location is
7801367e3cc9 8180659: [s390] micro-optimization in resize_frame_absolute()
lucy
parents: 46369
diff changeset
   449
  // in the reserved range.
7801367e3cc9 8180659: [s390] micro-optimization in resize_frame_absolute()
lucy
parents: 46369
diff changeset
   450
  //
7801367e3cc9 8180659: [s390] micro-optimization in resize_frame_absolute()
lucy
parents: 46369
diff changeset
   451
  // From a performance point of view, it is desirable not to change the SP
7801367e3cc9 8180659: [s390] micro-optimization in resize_frame_absolute()
lucy
parents: 46369
diff changeset
   452
  // first and then immediately use it to access the freshly reserved space.
7801367e3cc9 8180659: [s390] micro-optimization in resize_frame_absolute()
lucy
parents: 46369
diff changeset
   453
  // That opens a small gap, though. If, just after storing some value (the
7801367e3cc9 8180659: [s390] micro-optimization in resize_frame_absolute()
lucy
parents: 46369
diff changeset
   454
  // frame pointer) into the to-be-reserved space, an interrupt is caught,
7801367e3cc9 8180659: [s390] micro-optimization in resize_frame_absolute()
lucy
parents: 46369
diff changeset
   455
  // the handler might use the space beyond Z_SP for it's own purpose.
7801367e3cc9 8180659: [s390] micro-optimization in resize_frame_absolute()
lucy
parents: 46369
diff changeset
   456
  // If that happens, the stored value might get altered.
7801367e3cc9 8180659: [s390] micro-optimization in resize_frame_absolute()
lucy
parents: 46369
diff changeset
   457
42065
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   458
  // Resize current frame either relatively wrt to current SP or absolute.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   459
  void resize_frame_sub(Register offset, Register fp, bool load_fp=true);
46726
7801367e3cc9 8180659: [s390] micro-optimization in resize_frame_absolute()
lucy
parents: 46369
diff changeset
   460
  void resize_frame_abs_with_offset(Register newSP, Register fp, int offset, bool load_fp);
7801367e3cc9 8180659: [s390] micro-optimization in resize_frame_absolute()
lucy
parents: 46369
diff changeset
   461
  void resize_frame_absolute(Register addr, Register fp, bool load_fp);
42065
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   462
  void resize_frame(RegisterOrConstant offset, Register fp, bool load_fp=true);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   463
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   464
  // Push a frame of size bytes, if copy_sp is false, old_sp must already
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   465
  // contain a copy of Z_SP.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   466
  void push_frame(Register bytes, Register old_sp, bool copy_sp = true, bool bytes_with_inverted_sign = false);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   467
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   468
  // Push a frame of size `bytes'. no abi space provided.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   469
  // Don't rely on register locking, instead pass a scratch register
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   470
  // (Z_R0 by default).
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   471
  // CAUTION! passing registers >= Z_R2 may produce bad results on
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   472
  // old CPUs!
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   473
  unsigned int push_frame(unsigned int bytes, Register scratch = Z_R0);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   474
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   475
  // Push a frame of size `bytes' with abi160 on top.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   476
  unsigned int push_frame_abi160(unsigned int bytes);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   477
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   478
  // Pop current C frame.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   479
  void pop_frame();
46726
7801367e3cc9 8180659: [s390] micro-optimization in resize_frame_absolute()
lucy
parents: 46369
diff changeset
   480
  // Pop current C frame and restore return PC register (Z_R14).
7801367e3cc9 8180659: [s390] micro-optimization in resize_frame_absolute()
lucy
parents: 46369
diff changeset
   481
  void pop_frame_restore_retPC(int frame_size_in_bytes);
42065
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   482
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   483
  //
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   484
  // Calls
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   485
  //
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   486
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   487
 private:
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   488
  address _last_calls_return_pc;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   489
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   490
 public:
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   491
  // Support for VM calls. This is the base routine called by the
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   492
  // different versions of call_VM_leaf. The interpreter may customize
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   493
  // this version by overriding it for its purposes (e.g., to
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   494
  // save/restore additional registers when doing a VM call).
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   495
  void call_VM_leaf_base(address entry_point);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   496
  void call_VM_leaf_base(address entry_point, bool allow_relocation);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   497
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   498
  // It is imperative that all calls into the VM are handled via the
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   499
  // call_VM macros. They make sure that the stack linkage is setup
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   500
  // correctly. Call_VM's correspond to ENTRY/ENTRY_X entry points
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   501
  // while call_VM_leaf's correspond to LEAF entry points.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   502
  //
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   503
  // This is the base routine called by the different versions of
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   504
  // call_VM. The interpreter may customize this version by overriding
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   505
  // it for its purposes (e.g., to save/restore additional registers
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   506
  // when doing a VM call).
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   507
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   508
  // If no last_java_sp is specified (noreg) then SP will be used instead.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   509
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   510
  virtual void call_VM_base(
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   511
    Register        oop_result,        // Where an oop-result ends up if any; use noreg otherwise.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   512
    Register        last_java_sp,      // To set up last_Java_frame in stubs; use noreg otherwise.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   513
    address         entry_point,       // The entry point.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   514
    bool            check_exception);  // Flag which indicates if exception should be checked.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   515
  virtual void call_VM_base(
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   516
    Register        oop_result,       // Where an oop-result ends up if any; use noreg otherwise.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   517
    Register        last_java_sp,     // To set up last_Java_frame in stubs; use noreg otherwise.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   518
    address         entry_point,      // The entry point.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   519
    bool            allow_relocation, // Flag to request generation of relocatable code.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   520
    bool            check_exception); // Flag which indicates if exception should be checked.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   521
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   522
  // Call into the VM.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   523
  // Passes the thread pointer (in Z_ARG1) as a prepended argument.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   524
  // Makes sure oop return values are visible to the GC.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   525
  void call_VM(Register oop_result, address entry_point, bool check_exceptions = true);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   526
  void call_VM(Register oop_result, address entry_point, Register arg_1, bool check_exceptions = true);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   527
  void call_VM(Register oop_result, address entry_point, Register arg_1, Register arg_2, bool check_exceptions = true);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   528
  void call_VM(Register oop_result, address entry_point, Register arg_1, Register arg_2,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   529
               Register arg_3, bool check_exceptions = true);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   530
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   531
  void call_VM_static(Register oop_result, address entry_point, bool check_exceptions = true);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   532
  void call_VM_static(Register oop_result, address entry_point, Register arg_1, Register arg_2,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   533
                      Register arg_3, bool check_exceptions = true);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   534
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   535
  // Overloaded with last_java_sp.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   536
  void call_VM(Register oop_result, Register last_java_sp, address entry_point, bool check_exceptions = true);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   537
  void call_VM(Register oop_result, Register last_java_sp, address entry_point,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   538
               Register arg_1, bool check_exceptions = true);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   539
  void call_VM(Register oop_result, Register last_java_sp, address entry_point,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   540
               Register arg_1, Register arg_2, bool check_exceptions = true);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   541
  void call_VM(Register oop_result, Register last_java_sp, address entry_point,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   542
               Register arg_1, Register arg_2, Register arg_3, bool check_exceptions = true);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   543
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   544
  void call_VM_leaf(address entry_point);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   545
  void call_VM_leaf(address entry_point, Register arg_1);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   546
  void call_VM_leaf(address entry_point, Register arg_1, Register arg_2);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   547
  void call_VM_leaf(address entry_point, Register arg_1, Register arg_2, Register arg_3);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   548
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   549
  // Really static VM leaf call (never patched).
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   550
  void call_VM_leaf_static(address entry_point);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   551
  void call_VM_leaf_static(address entry_point, Register arg_1);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   552
  void call_VM_leaf_static(address entry_point, Register arg_1, Register arg_2);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   553
  void call_VM_leaf_static(address entry_point, Register arg_1, Register arg_2, Register arg_3);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   554
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   555
  // Call a C function via its function entry. Updates and returns _last_calls_return_pc.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   556
  inline address call(Register function_entry);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   557
  inline address call_c(Register function_entry);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   558
         address call_c(address function_entry);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   559
  // Variant for really static (non-relocatable) calls which are never patched.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   560
         address call_c_static(address function_entry);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   561
  // TOC or pc-relative call + emits a runtime_call relocation.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   562
         address call_c_opt(address function_entry);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   563
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   564
  inline address call_stub(Register function_entry);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   565
  inline address call_stub(address  function_entry);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   566
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   567
  // Get the pc where the last call will return to. Returns _last_calls_return_pc.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   568
  inline address last_calls_return_pc();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   569
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   570
 private:
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   571
  static bool is_call_far_patchable_variant0_at(address instruction_addr); // Dynamic TOC: load target addr from CP and call.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   572
  static bool is_call_far_patchable_variant2_at(address instruction_addr); // PC-relative call, prefixed with NOPs.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   573
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   574
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   575
 public:
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   576
  bool           call_far_patchable(address target, int64_t toc_offset);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   577
  static bool    is_call_far_patchable_at(address inst_start);             // All supported forms of patchable calls.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   578
  static bool    is_call_far_patchable_pcrelative_at(address inst_start);  // Pc-relative call with leading nops.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   579
  static bool    is_call_far_pcrelative(address instruction_addr);         // Pure far pc-relative call, with one leading size adjustment nop.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   580
  static void    set_dest_of_call_far_patchable_at(address inst_start, address target, int64_t toc_offset);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   581
  static address get_dest_of_call_far_patchable_at(address inst_start, address toc_start);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   582
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   583
  void align_call_far_patchable(address pc);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   584
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   585
  // PCrelative TOC access.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   586
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   587
  // This value is independent of code position - constant for the lifetime of the VM.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   588
  static int call_far_patchable_size() {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   589
    return load_const_from_toc_size() + call_byregister_size();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   590
  }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   591
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   592
  static int call_far_patchable_ret_addr_offset() { return call_far_patchable_size(); }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   593
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   594
  static bool call_far_patchable_requires_alignment_nop(address pc) {
42556
c03d98321ad1 8169317: [s390] Various minor bug fixes and adaptions.
goetz
parents: 42065
diff changeset
   595
    if (!os::is_MP()) return false;
42065
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   596
    int size = call_far_patchable_size();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   597
    return ((intptr_t)(pc + size) & 0x03L) != 0;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   598
  }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   599
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   600
  // END OF PCrelative TOC access.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   601
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   602
  static int jump_byregister_size()          { return 2; }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   603
  static int jump_pcrelative_size()          { return 4; }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   604
  static int jump_far_pcrelative_size()      { return 6; }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   605
  static int call_byregister_size()          { return 2; }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   606
  static int call_pcrelative_size()          { return 4; }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   607
  static int call_far_pcrelative_size()      { return 2 + 6; } // Prepend each BRASL with a nop.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   608
  static int call_far_pcrelative_size_raw()  { return 6; }     // Prepend each BRASL with a nop.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   609
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   610
  //
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   611
  // Java utilities
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   612
  //
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   613
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   614
  // These routines should emit JVMTI PopFrame and ForceEarlyReturn handling code.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   615
  // The implementation is only non-empty for the InterpreterMacroAssembler,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   616
  // as only the interpreter handles PopFrame and ForceEarlyReturn requests.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   617
  virtual void check_and_handle_popframe(Register java_thread);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   618
  virtual void check_and_handle_earlyret(Register java_thread);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   619
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   620
  // Polling page support.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   621
  enum poll_mask {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   622
    mask_stackbang = 0xde, // 222 (dec)
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   623
    mask_safepoint = 0x6f, // 111 (dec)
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   624
    mask_profiling = 0xba  // 186 (dec)
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   625
  };
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   626
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   627
  // Read from the polling page.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   628
  void load_from_polling_page(Register polling_page_address, int64_t offset = 0);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   629
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   630
  // Check if given instruction is a read from the polling page
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   631
  // as emitted by load_from_polling_page.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   632
  static bool is_load_from_polling_page(address instr_loc);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   633
  // Extract poll address from instruction and ucontext.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   634
  static address get_poll_address(address instr_loc, void* ucontext);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   635
  // Extract poll register from instruction.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   636
  static uint get_poll_register(address instr_loc);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   637
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   638
  // Check if instruction is a write access to the memory serialization page
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   639
  // realized by one of the instructions stw, stwu, stwx, or stwux.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   640
  static bool is_memory_serialization(int instruction, JavaThread* thread, void* ucontext);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   641
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   642
  // Support for serializing memory accesses between threads.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   643
  void serialize_memory(Register thread, Register tmp1, Register tmp2);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   644
48332
651a95f30dfb 8193257: PPC64, s390 implementation for Thread-local handshakes
mdoerr
parents: 48094
diff changeset
   645
  // Check if safepoint requested and if so branch
651a95f30dfb 8193257: PPC64, s390 implementation for Thread-local handshakes
mdoerr
parents: 48094
diff changeset
   646
  void safepoint_poll(Label& slow_path, Register temp_reg);
651a95f30dfb 8193257: PPC64, s390 implementation for Thread-local handshakes
mdoerr
parents: 48094
diff changeset
   647
42065
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   648
  // Stack overflow checking
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   649
  void bang_stack_with_offset(int offset);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   650
43420
a056d6465ef9 8172049: [s390] Implement "JEP 270: Reserved Stack Areas for Critical Sections".
goetz
parents: 42556
diff changeset
   651
  // Check for reserved stack access in method being exited. If the reserved
a056d6465ef9 8172049: [s390] Implement "JEP 270: Reserved Stack Areas for Critical Sections".
goetz
parents: 42556
diff changeset
   652
  // stack area was accessed, protect it again and throw StackOverflowError.
a056d6465ef9 8172049: [s390] Implement "JEP 270: Reserved Stack Areas for Critical Sections".
goetz
parents: 42556
diff changeset
   653
  // Uses Z_R1.
a056d6465ef9 8172049: [s390] Implement "JEP 270: Reserved Stack Areas for Critical Sections".
goetz
parents: 42556
diff changeset
   654
  void reserved_stack_check(Register return_pc);
a056d6465ef9 8172049: [s390] Implement "JEP 270: Reserved Stack Areas for Critical Sections".
goetz
parents: 42556
diff changeset
   655
42065
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   656
  // Atomics
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   657
  // -- none?
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   658
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   659
  void tlab_allocate(Register obj,                // Result: pointer to object after successful allocation
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   660
                     Register var_size_in_bytes,  // Object size in bytes if unknown at compile time; invalid otherwise.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   661
                     int      con_size_in_bytes,  // Object size in bytes if   known at compile time.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   662
                     Register t1,                 // temp register
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   663
                     Label&   slow_case);         // Continuation point if fast allocation fails.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   664
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   665
  // Emitter for interface method lookup.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   666
  //   input: recv_klass, intf_klass, itable_index
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   667
  //   output: method_result
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   668
  //   kills: itable_index, temp1_reg, Z_R0, Z_R1
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   669
  void lookup_interface_method(Register           recv_klass,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   670
                               Register           intf_klass,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   671
                               RegisterOrConstant itable_index,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   672
                               Register           method_result,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   673
                               Register           temp1_reg,
48585
d9fcb7ba8133 8191907: PPC64 and s390 parts of JDK-8174962: Better interface invocations
mdoerr
parents: 48332
diff changeset
   674
                               Label&             no_such_interface,
d9fcb7ba8133 8191907: PPC64 and s390 parts of JDK-8174962: Better interface invocations
mdoerr
parents: 48332
diff changeset
   675
                               bool               return_method = true);
42065
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   676
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   677
  // virtual method calling
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   678
  void lookup_virtual_method(Register             recv_klass,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   679
                             RegisterOrConstant   vtable_index,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   680
                             Register             method_result);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   681
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   682
  // Factor out code to call ic_miss_handler.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   683
  unsigned int call_ic_miss_handler(Label& ICM, int trapMarker, int requiredSize, Register scratch);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   684
  void nmethod_UEP(Label& ic_miss);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   685
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   686
  // Emitters for "partial subtype" checks.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   687
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   688
  // Test sub_klass against super_klass, with fast and slow paths.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   689
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   690
  // The fast path produces a tri-state answer: yes / no / maybe-slow.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   691
  // One of the three labels can be NULL, meaning take the fall-through.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   692
  // If super_check_offset is -1, the value is loaded up from super_klass.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   693
  // No registers are killed, except temp_reg and temp2_reg.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   694
  // If super_check_offset is not -1, temp1_reg is not used and can be noreg.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   695
  void check_klass_subtype_fast_path(Register sub_klass,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   696
                                     Register super_klass,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   697
                                     Register temp1_reg,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   698
                                     Label*   L_success,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   699
                                     Label*   L_failure,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   700
                                     Label*   L_slow_path,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   701
                                     RegisterOrConstant super_check_offset = RegisterOrConstant(-1));
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   702
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   703
  // The rest of the type check; must be wired to a corresponding fast path.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   704
  // It does not repeat the fast path logic, so don't use it standalone.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   705
  // The temp_reg can be noreg, if no temps are available.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   706
  // It can also be sub_klass or super_klass, meaning it's OK to kill that one.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   707
  // Updates the sub's secondary super cache as necessary.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   708
  void check_klass_subtype_slow_path(Register Rsubklass,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   709
                                     Register Rsuperklas,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   710
                                     Register Rarray_ptr, // tmp
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   711
                                     Register Rlength,    // tmp
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   712
                                     Label* L_success,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   713
                                     Label* L_failure);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   714
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   715
  // Simplified, combined version, good for typical uses.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   716
  // Falls through on failure.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   717
  void check_klass_subtype(Register sub_klass,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   718
                           Register super_klass,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   719
                           Register temp1_reg,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   720
                           Register temp2_reg,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   721
                           Label&   L_success);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   722
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   723
  // Increment a counter at counter_address when the eq condition code is set.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   724
  // Kills registers tmp1_reg and tmp2_reg and preserves the condition code.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   725
  void increment_counter_eq(address counter_address, Register tmp1_reg, Register tmp2_reg);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   726
  // Biased locking support
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   727
  // Upon entry,obj_reg must contain the target object, and mark_reg
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   728
  // must contain the target object's header.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   729
  // Destroys mark_reg if an attempt is made to bias an anonymously
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   730
  // biased lock. In this case a failure will go either to the slow
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   731
  // case or fall through with the notEqual condition code set with
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   732
  // the expectation that the slow case in the runtime will be called.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   733
  // In the fall-through case where the CAS-based lock is done,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   734
  // mark_reg is not destroyed.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   735
  void biased_locking_enter(Register obj_reg, Register mark_reg, Register temp_reg,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   736
                            Register temp2_reg, Label& done, Label* slow_case = NULL);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   737
  // Upon entry, the base register of mark_addr must contain the oop.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   738
  // Destroys temp_reg.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   739
  // If allow_delay_slot_filling is set to true, the next instruction
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   740
  // emitted after this one will go in an annulled delay slot if the
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   741
  // biased locking exit case failed.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   742
  void biased_locking_exit(Register mark_addr, Register temp_reg, Label& done);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   743
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   744
  void compiler_fast_lock_object(Register oop, Register box, Register temp1, Register temp2, bool try_bias = UseBiasedLocking);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   745
  void compiler_fast_unlock_object(Register oop, Register box, Register temp1, Register temp2, bool try_bias = UseBiasedLocking);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   746
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   747
  // Write to card table for modification at store_addr - register is destroyed afterwards.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   748
  void card_write_barrier_post(Register store_addr, Register tmp);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   749
44406
a46a6c4d1dd9 8176100: [REDO][REDO] G1 Needs pre barrier on dereference of weak JNI handles
mgerdin
parents: 44093
diff changeset
   750
  void resolve_jobject(Register value, Register tmp1, Register tmp2);
a46a6c4d1dd9 8176100: [REDO][REDO] G1 Needs pre barrier on dereference of weak JNI handles
mgerdin
parents: 44093
diff changeset
   751
42065
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   752
#if INCLUDE_ALL_GCS
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   753
  // General G1 pre-barrier generator.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   754
  // Purpose: record the previous value if it is not null.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   755
  // All non-tmps are preserved.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   756
  void g1_write_barrier_pre(Register           Robj,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   757
                            RegisterOrConstant offset,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   758
                            Register           Rpre_val,        // Ideally, this is a non-volatile register.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   759
                            Register           Rval,            // Will be preserved.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   760
                            Register           Rtmp1,           // If Rpre_val is volatile, either Rtmp1
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   761
                            Register           Rtmp2,           // or Rtmp2 has to be non-volatile.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   762
                            bool               pre_val_needed); // Save Rpre_val across runtime call, caller uses it.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   763
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   764
  // General G1 post-barrier generator.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   765
  // Purpose: Store cross-region card.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   766
  void g1_write_barrier_post(Register Rstore_addr,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   767
                             Register Rnew_val,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   768
                             Register Rtmp1,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   769
                             Register Rtmp2,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   770
                             Register Rtmp3);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   771
#endif // INCLUDE_ALL_GCS
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   772
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   773
  // Support for last Java frame (but use call_VM instead where possible).
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   774
 private:
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   775
  void set_last_Java_frame(Register last_Java_sp, Register last_Java_pc, bool allow_relocation);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   776
  void reset_last_Java_frame(bool allow_relocation);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   777
  void set_top_ijava_frame_at_SP_as_last_Java_frame(Register sp, Register tmp1, bool allow_relocation);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   778
 public:
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   779
  inline void set_last_Java_frame(Register last_java_sp, Register last_Java_pc);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   780
  inline void set_last_Java_frame_static(Register last_java_sp, Register last_Java_pc);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   781
  inline void reset_last_Java_frame(void);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   782
  inline void reset_last_Java_frame_static(void);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   783
  inline void set_top_ijava_frame_at_SP_as_last_Java_frame(Register sp, Register tmp1);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   784
  inline void set_top_ijava_frame_at_SP_as_last_Java_frame_static(Register sp, Register tmp1);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   785
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   786
  void set_thread_state(JavaThreadState new_state);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   787
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   788
  // Read vm result from thread.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   789
  void get_vm_result  (Register oop_result);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   790
  void get_vm_result_2(Register result);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   791
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   792
  // Vm result is currently getting hijacked to for oop preservation.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   793
  void set_vm_result(Register oop_result);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   794
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   795
  // Support for NULL-checks
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   796
  //
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   797
  // Generates code that causes a NULL OS exception if the content of reg is NULL.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   798
  // If the accessed location is M[reg + offset] and the offset is known, provide the
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   799
  // offset. No explicit code generation is needed if the offset is within a certain
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   800
  // range (0 <= offset <= page_size).
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   801
  //
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   802
  // %%%%%% Currently not done for z/Architecture
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   803
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   804
  void null_check(Register reg, Register tmp = Z_R0, int64_t offset = -1);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   805
  static bool needs_explicit_null_check(intptr_t offset);  // Implemented in shared file ?!
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   806
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   807
  // Klass oop manipulations if compressed.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   808
  void encode_klass_not_null(Register dst, Register src = noreg);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   809
  void decode_klass_not_null(Register dst, Register src);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   810
  void decode_klass_not_null(Register dst);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   811
  void load_klass(Register klass, Address mem);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   812
  void load_klass(Register klass, Register src_oop);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   813
  void load_prototype_header(Register Rheader, Register Rsrc_oop);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   814
  void store_klass(Register klass, Register dst_oop, Register ck = noreg); // Klass will get compressed if ck not provided.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   815
  void store_klass_gap(Register s, Register dst_oop);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   816
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   817
  // This function calculates the size of the code generated by
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   818
  //   decode_klass_not_null(register dst)
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   819
  // when (Universe::heap() != NULL). Hence, if the instructions
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   820
  // it generates change, then this method needs to be updated.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   821
  static int instr_size_for_decode_klass_not_null();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   822
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   823
  void encode_heap_oop(Register oop);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   824
  void encode_heap_oop_not_null(Register oop);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   825
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   826
  static int get_oop_base_pow2_offset(uint64_t oop_base);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   827
  int  get_oop_base(Register Rbase, uint64_t oop_base);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   828
  int  get_oop_base_complement(Register Rbase, uint64_t oop_base);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   829
  void compare_heap_oop(Register Rop1, Address mem, bool maybeNULL);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   830
  void compare_klass_ptr(Register Rop1, int64_t disp, Register Rbase, bool maybeNULL);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   831
  void load_heap_oop(Register dest, const Address &a);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   832
  void load_heap_oop(Register d, int64_t si16, Register s1);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   833
  void load_heap_oop_not_null(Register d, int64_t si16, Register s1);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   834
  void store_heap_oop(Register Roop, RegisterOrConstant offset, Register base);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   835
  void store_heap_oop_not_null(Register Roop, RegisterOrConstant offset, Register base);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   836
  void store_heap_oop_null(Register zero, RegisterOrConstant offset, Register base);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   837
  void oop_encoder(Register Rdst, Register Rsrc, bool maybeNULL,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   838
                   Register Rbase = Z_R1, int pow2_offset = -1, bool only32bitValid = false);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   839
  void oop_decoder(Register Rdst, Register Rsrc, bool maybeNULL,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   840
                   Register Rbase = Z_R1, int pow2_offset = -1);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   841
46961
c9094b1e5f87 8186088: ConstantPoolCache::_resolved_references is not a JNIHandle
coleenp
parents: 46726
diff changeset
   842
  void resolve_oop_handle(Register result);
42065
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   843
  void load_mirror(Register mirror, Register method);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   844
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   845
  //--------------------------
48094
bca569f79fa1 8189793: [s390]: Improve String compress/inflate by exploiting vector instructions
lucy
parents: 47216
diff changeset
   846
  //---  Operations on arrays.
42065
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   847
  //--------------------------
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   848
  unsigned int Clear_Array(Register cnt_arg, Register base_pointer_arg, Register src_addr, Register src_len);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   849
  unsigned int Clear_Array_Const(long cnt, Register base);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   850
  unsigned int Clear_Array_Const_Big(long cnt, Register base_pointer_arg, Register src_addr, Register src_len);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   851
  unsigned int CopyRawMemory_AlignedDisjoint(Register src_reg, Register dst_reg,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   852
                                             Register cnt_reg,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   853
                                             Register tmp1_reg, Register tmp2_reg);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   854
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   855
  //-------------------------------------------
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   856
  // Special String Intrinsics Implementation.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   857
  //-------------------------------------------
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   858
  // Intrinsics for CompactStrings
48094
bca569f79fa1 8189793: [s390]: Improve String compress/inflate by exploiting vector instructions
lucy
parents: 47216
diff changeset
   859
  //   Restores: src, dst
bca569f79fa1 8189793: [s390]: Improve String compress/inflate by exploiting vector instructions
lucy
parents: 47216
diff changeset
   860
  //   Uses:     cnt
bca569f79fa1 8189793: [s390]: Improve String compress/inflate by exploiting vector instructions
lucy
parents: 47216
diff changeset
   861
  //   Kills:    tmp, Z_R0, Z_R1.
bca569f79fa1 8189793: [s390]: Improve String compress/inflate by exploiting vector instructions
lucy
parents: 47216
diff changeset
   862
  //   Early clobber: result.
bca569f79fa1 8189793: [s390]: Improve String compress/inflate by exploiting vector instructions
lucy
parents: 47216
diff changeset
   863
  //   Boolean precise controls accuracy of result value.
bca569f79fa1 8189793: [s390]: Improve String compress/inflate by exploiting vector instructions
lucy
parents: 47216
diff changeset
   864
  unsigned int string_compress(Register result, Register src, Register dst, Register cnt,
bca569f79fa1 8189793: [s390]: Improve String compress/inflate by exploiting vector instructions
lucy
parents: 47216
diff changeset
   865
                               Register tmp,    bool precise);
bca569f79fa1 8189793: [s390]: Improve String compress/inflate by exploiting vector instructions
lucy
parents: 47216
diff changeset
   866
bca569f79fa1 8189793: [s390]: Improve String compress/inflate by exploiting vector instructions
lucy
parents: 47216
diff changeset
   867
  // Inflate byte[] to char[].
bca569f79fa1 8189793: [s390]: Improve String compress/inflate by exploiting vector instructions
lucy
parents: 47216
diff changeset
   868
  unsigned int string_inflate_trot(Register src, Register dst, Register cnt, Register tmp);
bca569f79fa1 8189793: [s390]: Improve String compress/inflate by exploiting vector instructions
lucy
parents: 47216
diff changeset
   869
bca569f79fa1 8189793: [s390]: Improve String compress/inflate by exploiting vector instructions
lucy
parents: 47216
diff changeset
   870
  // Inflate byte[] to char[].
bca569f79fa1 8189793: [s390]: Improve String compress/inflate by exploiting vector instructions
lucy
parents: 47216
diff changeset
   871
  //   Restores: src, dst
bca569f79fa1 8189793: [s390]: Improve String compress/inflate by exploiting vector instructions
lucy
parents: 47216
diff changeset
   872
  //   Uses:     cnt
bca569f79fa1 8189793: [s390]: Improve String compress/inflate by exploiting vector instructions
lucy
parents: 47216
diff changeset
   873
  //   Kills:    tmp, Z_R0, Z_R1.
bca569f79fa1 8189793: [s390]: Improve String compress/inflate by exploiting vector instructions
lucy
parents: 47216
diff changeset
   874
  unsigned int string_inflate(Register src, Register dst, Register cnt, Register tmp);
bca569f79fa1 8189793: [s390]: Improve String compress/inflate by exploiting vector instructions
lucy
parents: 47216
diff changeset
   875
bca569f79fa1 8189793: [s390]: Improve String compress/inflate by exploiting vector instructions
lucy
parents: 47216
diff changeset
   876
  // Inflate byte[] to char[], length known at compile time.
bca569f79fa1 8189793: [s390]: Improve String compress/inflate by exploiting vector instructions
lucy
parents: 47216
diff changeset
   877
  //   Restores: src, dst
bca569f79fa1 8189793: [s390]: Improve String compress/inflate by exploiting vector instructions
lucy
parents: 47216
diff changeset
   878
  //   Kills:    tmp, Z_R0, Z_R1.
bca569f79fa1 8189793: [s390]: Improve String compress/inflate by exploiting vector instructions
lucy
parents: 47216
diff changeset
   879
  // Note:
bca569f79fa1 8189793: [s390]: Improve String compress/inflate by exploiting vector instructions
lucy
parents: 47216
diff changeset
   880
  //   len is signed int. Counts # characters, not bytes.
bca569f79fa1 8189793: [s390]: Improve String compress/inflate by exploiting vector instructions
lucy
parents: 47216
diff changeset
   881
  unsigned int string_inflate_const(Register src, Register dst, Register tmp, int len);
42065
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   882
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   883
  // Kills src.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   884
  unsigned int has_negatives(Register result, Register src, Register cnt,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   885
                             Register odd_reg, Register even_reg, Register tmp);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   886
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   887
  unsigned int string_compare(Register str1, Register str2, Register cnt1, Register cnt2,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   888
                              Register odd_reg, Register even_reg, Register result, int ae);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   889
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   890
  unsigned int array_equals(bool is_array_equ, Register ary1, Register ary2, Register limit,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   891
                            Register odd_reg, Register even_reg, Register result, bool is_byte);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   892
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   893
  unsigned int string_indexof(Register result, Register haystack, Register haycnt,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   894
                              Register needle, Register needlecnt, int needlecntval,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   895
                              Register odd_reg, Register even_reg, int ae);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   896
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   897
  unsigned int string_indexof_char(Register result, Register haystack, Register haycnt,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   898
                                   Register needle, jchar needleChar, Register odd_reg, Register even_reg, bool is_byte);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   899
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   900
  // Emit an oop const to the constant pool and set a relocation info
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   901
  // with address current_pc. Return the TOC offset of the constant.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   902
  int store_const_in_toc(AddressLiteral& val);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   903
  int store_oop_in_toc(AddressLiteral& oop);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   904
  // Emit an oop const to the constant pool via store_oop_in_toc, or
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   905
  // emit a scalar const to the constant pool via store_const_in_toc,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   906
  // and load the constant into register dst.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   907
  bool load_const_from_toc(Register dst, AddressLiteral& a, Register Rtoc = noreg);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   908
  // Get CPU version dependent size of load_const sequence.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   909
  // The returned value is valid only for code sequences
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   910
  // generated by load_const, not load_const_optimized.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   911
  static int load_const_from_toc_size() {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   912
    return load_long_pcrelative_size();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   913
  }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   914
  bool load_oop_from_toc(Register dst, AddressLiteral& a, Register Rtoc = noreg);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   915
  static intptr_t get_const_from_toc(address pc);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   916
  static void     set_const_in_toc(address pc, unsigned long new_data, CodeBlob *cb);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   917
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   918
  // Dynamic TOC.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   919
  static bool is_load_const(address a);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   920
  static bool is_load_const_from_toc_pcrelative(address a);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   921
  static bool is_load_const_from_toc(address a) { return is_load_const_from_toc_pcrelative(a); }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   922
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   923
  // PCrelative TOC access.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   924
  static bool is_call_byregister(address a) { return is_z_basr(*(short*)a); }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   925
  static bool is_load_const_from_toc_call(address a);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   926
  static bool is_load_const_call(address a);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   927
  static int load_const_call_size() { return load_const_size() + call_byregister_size(); }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   928
  static int load_const_from_toc_call_size() { return load_const_from_toc_size() + call_byregister_size(); }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   929
  // Offset is +/- 2**32 -> use long.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   930
  static long get_load_const_from_toc_offset(address a);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   931
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   932
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   933
  void generate_type_profiling(const Register Rdata,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   934
                               const Register Rreceiver_klass,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   935
                               const Register Rwanted_receiver_klass,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   936
                               const Register Rmatching_row,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   937
                               bool is_virtual_call);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   938
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   939
  // Bit operations for single register operands.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   940
  inline void lshift(Register r, int places, bool doubl = true);   // <<
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   941
  inline void rshift(Register r, int places, bool doubl = true);   // >>
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   942
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   943
  //
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   944
  // Debugging
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   945
  //
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   946
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   947
  // Assert on CC (condition code in CPU state).
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   948
  void asm_assert(bool check_equal, const char* msg, int id) PRODUCT_RETURN;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   949
  void asm_assert_low(const char *msg, int id) PRODUCT_RETURN;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   950
  void asm_assert_high(const char *msg, int id) PRODUCT_RETURN;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   951
  void asm_assert_eq(const char* msg, int id) { asm_assert(true, msg, id); }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   952
  void asm_assert_ne(const char* msg, int id) { asm_assert(false, msg, id); }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   953
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   954
  void asm_assert_static(bool check_equal, const char* msg, int id) PRODUCT_RETURN;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   955
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   956
 private:
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   957
  // Emit assertions.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   958
  void asm_assert_mems_zero(bool check_equal, bool allow_relocation, int size, int64_t mem_offset,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   959
                            Register mem_base, const char* msg, int id) PRODUCT_RETURN;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   960
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   961
 public:
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   962
  inline void asm_assert_mem4_is_zero(int64_t mem_offset, Register mem_base, const char* msg, int id) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   963
    asm_assert_mems_zero(true,  true, 4, mem_offset, mem_base, msg, id);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   964
  }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   965
  inline void asm_assert_mem8_is_zero(int64_t mem_offset, Register mem_base, const char* msg, int id) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   966
    asm_assert_mems_zero(true,  true, 8, mem_offset, mem_base, msg, id);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   967
  }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   968
  inline void asm_assert_mem4_isnot_zero(int64_t mem_offset, Register mem_base, const char* msg, int id) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   969
    asm_assert_mems_zero(false, true, 4, mem_offset, mem_base, msg, id);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   970
  }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   971
  inline void asm_assert_mem8_isnot_zero(int64_t mem_offset, Register mem_base, const char* msg, int id) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   972
    asm_assert_mems_zero(false, true, 8, mem_offset, mem_base, msg, id);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   973
  }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   974
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   975
  inline void asm_assert_mem4_is_zero_static(int64_t mem_offset, Register mem_base, const char* msg, int id) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   976
    asm_assert_mems_zero(true,  false, 4, mem_offset, mem_base, msg, id);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   977
  }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   978
  inline void asm_assert_mem8_is_zero_static(int64_t mem_offset, Register mem_base, const char* msg, int id) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   979
    asm_assert_mems_zero(true,  false, 8, mem_offset, mem_base, msg, id);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   980
  }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   981
  inline void asm_assert_mem4_isnot_zero_static(int64_t mem_offset, Register mem_base, const char* msg, int id) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   982
    asm_assert_mems_zero(false, false, 4, mem_offset, mem_base, msg, id);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   983
  }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   984
  inline void asm_assert_mem8_isnot_zero_static(int64_t mem_offset, Register mem_base, const char* msg, int id) {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   985
    asm_assert_mems_zero(false, false, 8, mem_offset, mem_base, msg, id);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   986
  }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   987
  void asm_assert_frame_size(Register expected_size, Register tmp, const char* msg, int id) PRODUCT_RETURN;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   988
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   989
  // Verify Z_thread contents.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   990
  void verify_thread();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   991
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   992
  // Only if +VerifyOops.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   993
  void verify_oop(Register reg, const char* s = "broken oop");
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   994
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   995
  // TODO: verify_method and klass metadata (compare against vptr?).
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   996
  void _verify_method_ptr(Register reg, const char * msg, const char * file, int line) {}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   997
  void _verify_klass_ptr(Register reg, const char * msg, const char * file, int line) {}
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   998
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
   999
#define verify_method_ptr(reg) _verify_method_ptr(reg, "broken method " #reg, __FILE__, __LINE__)
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1000
#define verify_klass_ptr(reg) _verify_klass_ptr(reg, "broken klass " #reg, __FILE__, __LINE__)
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1001
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1002
 private:
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1003
  // Generate printout in stop().
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1004
  static const char* stop_types[];
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1005
  enum {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1006
    stop_stop               = 0,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1007
    stop_untested           = 1,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1008
    stop_unimplemented      = 2,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1009
    stop_shouldnotreachhere = 3,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1010
    stop_end                = 4
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1011
  };
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1012
  // Prints msg and stops execution.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1013
  void    stop(int type, const char* msg, int id = 0);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1014
  address stop_chain(address reentry, int type, const char* msg, int id, bool allow_relocation); // Non-relocateable code only!!
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1015
  void    stop_static(int type, const char* msg, int id);                                        // Non-relocateable code only!!
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1016
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1017
 public:
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1018
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1019
  // Prints msg and stops.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1020
  address stop_chain(      address reentry, const char* msg = "", int id = 0) { return stop_chain(reentry, stop_stop, msg, id, true); }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1021
  address stop_chain_static(address reentry, const char* msg = "", int id = 0) { return stop_chain(reentry, stop_stop, msg, id, false); }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1022
  void stop_static  (const char* msg = "", int id = 0) { stop_static(stop_stop,   msg, id); }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1023
  void stop         (const char* msg = "", int id = 0) { stop(stop_stop,          msg, id); }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1024
  void untested     (const char* msg = "", int id = 0) { stop(stop_untested,      msg, id); }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1025
  void unimplemented(const char* msg = "", int id = 0) { stop(stop_unimplemented, msg, id); }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1026
  void should_not_reach_here(const char* msg = "", int id = -1) { stop(stop_shouldnotreachhere, msg, id); }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1027
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1028
  // Factor out part of stop into subroutine to save space.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1029
  void stop_subroutine();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1030
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1031
  // Prints msg, but don't stop.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1032
  void warn(const char* msg);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1033
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1034
  //-----------------------------
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1035
  //---  basic block tracing code
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1036
  //-----------------------------
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1037
  void trace_basic_block(uint i);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1038
  void init_basic_block_trace();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1039
  // Number of bytes a basic block gets larger due to the tracing code macro (worst case).
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1040
  // Currently, worst case is 48 bytes. 64 puts us securely on the safe side.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1041
  static int basic_blck_trace_blk_size_incr() { return 64; }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1042
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1043
  // Write pattern 0x0101010101010101 in region [low-before, high+after].
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1044
  // Low and high may be the same registers. Before and after are
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1045
  // the numbers of 8-byte words.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1046
  void zap_from_to(Register low, Register high, Register tmp1 = Z_R0, Register tmp2 = Z_R1,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1047
                   int before = 0, int after = 0) PRODUCT_RETURN;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1048
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1049
  // Emitters for CRC32 calculation.
46315
a796c32af782 8175368: [s390] Provide intrinsic implementation for CRC32C
lucy
parents: 43420
diff changeset
  1050
  // A note on invertCRC:
a796c32af782 8175368: [s390] Provide intrinsic implementation for CRC32C
lucy
parents: 43420
diff changeset
  1051
  //   Unfortunately, internal representation of crc differs between CRC32 and CRC32C.
a796c32af782 8175368: [s390] Provide intrinsic implementation for CRC32C
lucy
parents: 43420
diff changeset
  1052
  //   CRC32 holds it's current crc value in the externally visible representation.
a796c32af782 8175368: [s390] Provide intrinsic implementation for CRC32C
lucy
parents: 43420
diff changeset
  1053
  //   CRC32C holds it's current crc value in internal format, ready for updating.
a796c32af782 8175368: [s390] Provide intrinsic implementation for CRC32C
lucy
parents: 43420
diff changeset
  1054
  //   Thus, the crc value must be bit-flipped before updating it in the CRC32 case.
a796c32af782 8175368: [s390] Provide intrinsic implementation for CRC32C
lucy
parents: 43420
diff changeset
  1055
  //   In the CRC32C case, it must be bit-flipped when it is given to the outside world (getValue()).
a796c32af782 8175368: [s390] Provide intrinsic implementation for CRC32C
lucy
parents: 43420
diff changeset
  1056
  //   The bool invertCRC parameter indicates whether bit-flipping is required before updates.
42065
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1057
 private:
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1058
  void fold_byte_crc32(Register crc, Register table, Register val, Register tmp);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1059
  void fold_8bit_crc32(Register crc, Register table, Register tmp);
46315
a796c32af782 8175368: [s390] Provide intrinsic implementation for CRC32C
lucy
parents: 43420
diff changeset
  1060
  void update_byte_crc32( Register crc, Register val, Register table);
42065
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1061
  void update_byteLoop_crc32(Register crc, Register buf, Register len, Register table,
46315
a796c32af782 8175368: [s390] Provide intrinsic implementation for CRC32C
lucy
parents: 43420
diff changeset
  1062
                             Register data);
42065
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1063
  void update_1word_crc32(Register crc, Register buf, Register table, int bufDisp, int bufInc,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1064
                          Register t0,  Register t1,  Register t2,  Register t3);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1065
 public:
46315
a796c32af782 8175368: [s390] Provide intrinsic implementation for CRC32C
lucy
parents: 43420
diff changeset
  1066
  void kernel_crc32_singleByteReg(Register crc, Register val, Register table,
a796c32af782 8175368: [s390] Provide intrinsic implementation for CRC32C
lucy
parents: 43420
diff changeset
  1067
                                  bool invertCRC);
a796c32af782 8175368: [s390] Provide intrinsic implementation for CRC32C
lucy
parents: 43420
diff changeset
  1068
  void kernel_crc32_singleByte(Register crc, Register buf, Register len, Register table, Register tmp,
a796c32af782 8175368: [s390] Provide intrinsic implementation for CRC32C
lucy
parents: 43420
diff changeset
  1069
                               bool invertCRC);
42065
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1070
  void kernel_crc32_1byte(Register crc, Register buf, Register len, Register table,
46315
a796c32af782 8175368: [s390] Provide intrinsic implementation for CRC32C
lucy
parents: 43420
diff changeset
  1071
                          Register t0,  Register t1,  Register t2,  Register t3,
a796c32af782 8175368: [s390] Provide intrinsic implementation for CRC32C
lucy
parents: 43420
diff changeset
  1072
                          bool invertCRC);
42065
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1073
  void kernel_crc32_1word(Register crc, Register buf, Register len, Register table,
46315
a796c32af782 8175368: [s390] Provide intrinsic implementation for CRC32C
lucy
parents: 43420
diff changeset
  1074
                          Register t0,  Register t1,  Register t2,  Register t3,
a796c32af782 8175368: [s390] Provide intrinsic implementation for CRC32C
lucy
parents: 43420
diff changeset
  1075
                          bool invertCRC);
42065
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1076
  void kernel_crc32_2word(Register crc, Register buf, Register len, Register table,
46315
a796c32af782 8175368: [s390] Provide intrinsic implementation for CRC32C
lucy
parents: 43420
diff changeset
  1077
                          Register t0,  Register t1,  Register t2,  Register t3,
a796c32af782 8175368: [s390] Provide intrinsic implementation for CRC32C
lucy
parents: 43420
diff changeset
  1078
                          bool invertCRC);
42065
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1079
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1080
  // Emitters for BigInteger.multiplyToLen intrinsic
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1081
  // note: length of result array (zlen) is passed on the stack
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1082
 private:
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1083
  void add2_with_carry(Register dest_hi, Register dest_lo,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1084
                       Register src1, Register src2);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1085
  void multiply_64_x_64_loop(Register x, Register xstart,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1086
                             Register x_xstart,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1087
                             Register y, Register y_idx, Register z,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1088
                             Register carry, Register product,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1089
                             Register idx, Register kdx);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1090
  void multiply_add_128_x_128(Register x_xstart, Register y, Register z,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1091
                              Register yz_idx, Register idx,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1092
                              Register carry, Register product, int offset);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1093
  void multiply_128_x_128_loop(Register x_xstart,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1094
                               Register y, Register z,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1095
                               Register yz_idx, Register idx,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1096
                               Register jdx,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1097
                               Register carry, Register product,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1098
                               Register carry2);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1099
 public:
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1100
  void multiply_to_len(Register x, Register xlen,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1101
                       Register y, Register ylen,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1102
                       Register z,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1103
                       Register tmp1, Register tmp2,
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1104
                       Register tmp3, Register tmp4, Register tmp5);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1105
};
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1106
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1107
/**
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1108
 * class SkipIfEqual:
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1109
 *
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1110
 * Instantiating this class will result in assembly code being output that will
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1111
 * jump around any code emitted between the creation of the instance and it's
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1112
 * automatic destruction at the end of a scope block, depending on the value of
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1113
 * the flag passed to the constructor, which will be checked at run-time.
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1114
 */
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1115
class SkipIfEqual {
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1116
 private:
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1117
  MacroAssembler* _masm;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1118
  Label _label;
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1119
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1120
 public:
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1121
  SkipIfEqual(MacroAssembler*, const bool* flag_addr, bool value, Register _rscratch);
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1122
  ~SkipIfEqual();
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1123
};
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1124
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1125
#ifdef ASSERT
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1126
// Return false (e.g. important for our impl. of virtual calls).
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1127
inline bool AbstractAssembler::pd_check_instruction_mark() { return false; }
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1128
#endif
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1129
6032b31e3719 8167673: [s390] The s390 port.
goetz
parents:
diff changeset
  1130
#endif // CPU_S390_VM_MACROASSEMBLER_S390_HPP