hotspot/src/cpu/ppc/vm/macroAssembler_ppc.hpp
author mgerdin
Wed, 22 Mar 2017 15:25:21 +0100
changeset 44406 a46a6c4d1dd9
parent 44093 e22e0d071bf9
child 46369 3bf4544bec14
permissions -rw-r--r--
8176100: [REDO][REDO] G1 Needs pre barrier on dereference of weak JNI handles Reviewed-by: kbarrett, coleenp, tschatzl
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
     1
/*
44406
a46a6c4d1dd9 8176100: [REDO][REDO] G1 Needs pre barrier on dereference of weak JNI handles
mgerdin
parents: 44093
diff changeset
     2
 * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
a46a6c4d1dd9 8176100: [REDO][REDO] G1 Needs pre barrier on dereference of weak JNI handles
mgerdin
parents: 44093
diff changeset
     3
 * Copyright (c) 2012, 2017 SAP SE. All rights reserved.
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
     4
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
     5
 *
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
     6
 * This code is free software; you can redistribute it and/or modify it
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
     7
 * under the terms of the GNU General Public License version 2 only, as
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
     8
 * published by the Free Software Foundation.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
     9
 *
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    10
 * This code is distributed in the hope that it will be useful, but WITHOUT
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    11
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    12
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    13
 * version 2 for more details (a copy is included in the LICENSE file that
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    14
 * accompanied this code).
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    15
 *
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    16
 * You should have received a copy of the GNU General Public License version
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    17
 * 2 along with this work; if not, write to the Free Software Foundation,
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    18
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    19
 *
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    20
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    21
 * or visit www.oracle.com if you need additional information or have any
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    22
 * questions.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    23
 *
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    24
 */
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    25
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    26
#ifndef CPU_PPC_VM_MACROASSEMBLER_PPC_HPP
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    27
#define CPU_PPC_VM_MACROASSEMBLER_PPC_HPP
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    28
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    29
#include "asm/assembler.hpp"
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 28617
diff changeset
    30
#include "runtime/rtmLocking.hpp"
27684
e0391b2bf625 8064581: Move INCLUDE_ALL_GCS include section to the end of the include list
stefank
parents: 23492
diff changeset
    31
#include "utilities/macros.hpp"
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    32
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    33
// MacroAssembler extends Assembler by a few frequently used macros.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    34
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    35
class ciTypeArray;
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    36
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    37
class MacroAssembler: public Assembler {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    38
 public:
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    39
  MacroAssembler(CodeBuffer* code) : Assembler(code) {}
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    40
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    41
  //
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    42
  // Optimized instruction emitters
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    43
  //
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    44
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    45
  inline static int largeoffset_si16_si16_hi(int si31) { return (si31 + (1<<15)) >> 16; }
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    46
  inline static int largeoffset_si16_si16_lo(int si31) { return si31 - (((si31 + (1<<15)) >> 16) << 16); }
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    47
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    48
  // load d = *[a+si31]
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    49
  // Emits several instructions if the offset is not encodable in one instruction.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    50
  void ld_largeoffset_unchecked(Register d, int si31, Register a, int emit_filler_nop);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    51
  void ld_largeoffset          (Register d, int si31, Register a, int emit_filler_nop);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    52
  inline static bool is_ld_largeoffset(address a);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    53
  inline static int get_ld_largeoffset_offset(address a);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    54
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    55
  inline void round_to(Register r, int modulus);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    56
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    57
  // Load/store with type given by parameter.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    58
  void load_sized_value( Register dst, RegisterOrConstant offs, Register base, size_t size_in_bytes, bool is_signed);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    59
  void store_sized_value(Register dst, RegisterOrConstant offs, Register base, size_t size_in_bytes);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    60
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    61
  // Move register if destination register and target register are different
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    62
  inline void mr_if_needed(Register rd, Register rs);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 22843
diff changeset
    63
  inline void fmr_if_needed(FloatRegister rd, FloatRegister rs);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 22843
diff changeset
    64
  // This is dedicated for emitting scheduled mach nodes. For better
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 22843
diff changeset
    65
  // readability of the ad file I put it here.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 22843
diff changeset
    66
  // Endgroups are not needed if
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 22843
diff changeset
    67
  //  - the scheduler is off
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 22843
diff changeset
    68
  //  - the scheduler found that there is a natural group end, in that
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 22843
diff changeset
    69
  //    case it reduced the size of the instruction used in the test
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 22843
diff changeset
    70
  //    yielding 'needed'.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 22843
diff changeset
    71
  inline void endgroup_if_needed(bool needed);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 22843
diff changeset
    72
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 22843
diff changeset
    73
  // Memory barriers.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 22843
diff changeset
    74
  inline void membar(int bits);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 22843
diff changeset
    75
  inline void release();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 22843
diff changeset
    76
  inline void acquire();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 22843
diff changeset
    77
  inline void fence();
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    78
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    79
  // nop padding
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 22843
diff changeset
    80
  void align(int modulus, int max = 252, int rem = 0);
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    81
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    82
  //
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    83
  // Constants, loading constants, TOC support
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    84
  //
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    85
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    86
  // Address of the global TOC.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    87
  inline static address global_toc();
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    88
  // Offset of given address to the global TOC.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    89
  inline static int offset_to_global_toc(const address addr);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    90
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    91
  // Address of TOC of the current method.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    92
  inline address method_toc();
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    93
  // Offset of given address to TOC of the current method.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    94
  inline int offset_to_method_toc(const address addr);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    95
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    96
  // Global TOC.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    97
  void calculate_address_from_global_toc(Register dst, address addr,
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    98
                                         bool hi16 = true, bool lo16 = true,
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    99
                                         bool add_relocation = true, bool emit_dummy_addr = false);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   100
  inline void calculate_address_from_global_toc_hi16only(Register dst, address addr) {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   101
    calculate_address_from_global_toc(dst, addr, true, false);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   102
  };
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   103
  inline void calculate_address_from_global_toc_lo16only(Register dst, address addr) {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   104
    calculate_address_from_global_toc(dst, addr, false, true);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   105
  };
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   106
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   107
  inline static bool is_calculate_address_from_global_toc_at(address a, address bound);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   108
  static int patch_calculate_address_from_global_toc_at(address a, address addr, address bound);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   109
  static address get_address_of_calculate_address_from_global_toc_at(address a, address addr);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   110
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   111
#ifdef _LP64
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   112
  // Patch narrow oop constant.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   113
  inline static bool is_set_narrow_oop(address a, address bound);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   114
  static int patch_set_narrow_oop(address a, address bound, narrowOop data);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   115
  static narrowOop get_narrow_oop(address a, address bound);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   116
#endif
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   117
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   118
  inline static bool is_load_const_at(address a);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   119
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   120
  // Emits an oop const to the constant pool, loads the constant, and
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   121
  // sets a relocation info with address current_pc.
35085
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 31861
diff changeset
   122
  // Returns true if successful.
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 31861
diff changeset
   123
  bool load_const_from_method_toc(Register dst, AddressLiteral& a, Register toc, bool fixed_size = false);
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   124
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   125
  static bool is_load_const_from_method_toc_at(address a);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   126
  static int get_offset_of_load_const_from_method_toc_at(address a);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   127
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   128
  // Get the 64 bit constant from a `load_const' sequence.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   129
  static long get_const(address load_const);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   130
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   131
  // Patch the 64 bit constant of a `load_const' sequence. This is a
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   132
  // low level procedure. It neither flushes the instruction cache nor
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   133
  // is it atomic.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   134
  static void patch_const(address load_const, long x);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   135
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   136
  // Metadata in code that we have to keep track of.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   137
  AddressLiteral allocate_metadata_address(Metadata* obj); // allocate_index
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   138
  AddressLiteral constant_metadata_address(Metadata* obj); // find_index
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   139
  // Oops used directly in compiled code are stored in the constant pool,
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   140
  // and loaded from there.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   141
  // Allocate new entry for oop in constant pool. Generate relocation.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   142
  AddressLiteral allocate_oop_address(jobject obj);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   143
  // Find oop obj in constant pool. Return relocation with it's index.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   144
  AddressLiteral constant_oop_address(jobject obj);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   145
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   146
  // Find oop in constant pool and emit instructions to load it.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   147
  // Uses constant_oop_address.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   148
  inline void set_oop_constant(jobject obj, Register d);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   149
  // Same as load_address.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   150
  inline void set_oop         (AddressLiteral obj_addr, Register d);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   151
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   152
  // Read runtime constant:  Issue load if constant not yet established,
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   153
  // else use real constant.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   154
  virtual RegisterOrConstant delayed_value_impl(intptr_t* delayed_value_addr,
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   155
                                                Register tmp,
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   156
                                                int offset);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   157
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   158
  //
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   159
  // branch, jump
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   160
  //
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   161
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   162
  inline void pd_patch_instruction(address branch, address target);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   163
  NOT_PRODUCT(static void pd_print_patched_instruction(address branch);)
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   164
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   165
  // Conditional far branch for destinations encodable in 24+2 bits.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   166
  // Same interface as bc, e.g. no inverse boint-field.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   167
  enum {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   168
    bc_far_optimize_not         = 0,
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   169
    bc_far_optimize_on_relocate = 1
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   170
  };
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   171
  // optimize: flag for telling the conditional far branch to optimize
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   172
  //           itself when relocated.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   173
  void bc_far(int boint, int biint, Label& dest, int optimize);
35085
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 31861
diff changeset
   174
  void bc_far_optimized(int boint, int biint, Label& dest); // 1 or 2 instructions
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   175
  // Relocation of conditional far branches.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   176
  static bool    is_bc_far_at(address instruction_addr);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   177
  static address get_dest_of_bc_far_at(address instruction_addr);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   178
  static void    set_dest_of_bc_far_at(address instruction_addr, address dest);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   179
 private:
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   180
  static bool inline is_bc_far_variant1_at(address instruction_addr);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   181
  static bool inline is_bc_far_variant2_at(address instruction_addr);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   182
  static bool inline is_bc_far_variant3_at(address instruction_addr);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   183
 public:
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   184
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   185
  // Convenience bc_far versions.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   186
  inline void blt_far(ConditionRegister crx, Label& L, int optimize);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   187
  inline void bgt_far(ConditionRegister crx, Label& L, int optimize);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   188
  inline void beq_far(ConditionRegister crx, Label& L, int optimize);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   189
  inline void bso_far(ConditionRegister crx, Label& L, int optimize);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   190
  inline void bge_far(ConditionRegister crx, Label& L, int optimize);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   191
  inline void ble_far(ConditionRegister crx, Label& L, int optimize);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   192
  inline void bne_far(ConditionRegister crx, Label& L, int optimize);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   193
  inline void bns_far(ConditionRegister crx, Label& L, int optimize);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   194
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   195
  // Emit, identify and patch a NOT mt-safe patchable 64 bit absolute call/jump.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   196
 private:
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   197
  enum {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   198
    bxx64_patchable_instruction_count = (2/*load_codecache_const*/ + 3/*5load_const*/ + 1/*mtctr*/ + 1/*bctrl*/),
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   199
    bxx64_patchable_size              = bxx64_patchable_instruction_count * BytesPerInstWord,
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   200
    bxx64_patchable_ret_addr_offset   = bxx64_patchable_size
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   201
  };
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   202
  void bxx64_patchable(address target, relocInfo::relocType rt, bool link);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   203
  static bool is_bxx64_patchable_at(            address instruction_addr, bool link);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   204
  // Does the instruction use a pc-relative encoding of the destination?
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   205
  static bool is_bxx64_patchable_pcrelative_at( address instruction_addr, bool link);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   206
  static bool is_bxx64_patchable_variant1_at(   address instruction_addr, bool link);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   207
  // Load destination relative to global toc.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   208
  static bool is_bxx64_patchable_variant1b_at(  address instruction_addr, bool link);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   209
  static bool is_bxx64_patchable_variant2_at(   address instruction_addr, bool link);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   210
  static void set_dest_of_bxx64_patchable_at(   address instruction_addr, address target, bool link);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   211
  static address get_dest_of_bxx64_patchable_at(address instruction_addr, bool link);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   212
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   213
 public:
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   214
  // call
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   215
  enum {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   216
    bl64_patchable_instruction_count = bxx64_patchable_instruction_count,
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   217
    bl64_patchable_size              = bxx64_patchable_size,
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   218
    bl64_patchable_ret_addr_offset   = bxx64_patchable_ret_addr_offset
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   219
  };
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   220
  inline void bl64_patchable(address target, relocInfo::relocType rt) {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   221
    bxx64_patchable(target, rt, /*link=*/true);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   222
  }
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   223
  inline static bool is_bl64_patchable_at(address instruction_addr) {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   224
    return is_bxx64_patchable_at(instruction_addr, /*link=*/true);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   225
  }
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   226
  inline static bool is_bl64_patchable_pcrelative_at(address instruction_addr) {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   227
    return is_bxx64_patchable_pcrelative_at(instruction_addr, /*link=*/true);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   228
  }
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   229
  inline static void set_dest_of_bl64_patchable_at(address instruction_addr, address target) {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   230
    set_dest_of_bxx64_patchable_at(instruction_addr, target, /*link=*/true);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   231
  }
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   232
  inline static address get_dest_of_bl64_patchable_at(address instruction_addr) {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   233
    return get_dest_of_bxx64_patchable_at(instruction_addr, /*link=*/true);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   234
  }
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   235
  // jump
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   236
  enum {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   237
    b64_patchable_instruction_count = bxx64_patchable_instruction_count,
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   238
    b64_patchable_size              = bxx64_patchable_size,
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   239
  };
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   240
  inline void b64_patchable(address target, relocInfo::relocType rt) {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   241
    bxx64_patchable(target, rt, /*link=*/false);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   242
  }
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   243
  inline static bool is_b64_patchable_at(address instruction_addr) {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   244
    return is_bxx64_patchable_at(instruction_addr, /*link=*/false);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   245
  }
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   246
  inline static bool is_b64_patchable_pcrelative_at(address instruction_addr) {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   247
    return is_bxx64_patchable_pcrelative_at(instruction_addr, /*link=*/false);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   248
  }
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   249
  inline static void set_dest_of_b64_patchable_at(address instruction_addr, address target) {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   250
    set_dest_of_bxx64_patchable_at(instruction_addr, target, /*link=*/false);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   251
  }
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   252
  inline static address get_dest_of_b64_patchable_at(address instruction_addr) {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   253
    return get_dest_of_bxx64_patchable_at(instruction_addr, /*link=*/false);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   254
  }
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   255
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   256
  //
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   257
  // Support for frame handling
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   258
  //
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   259
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   260
  // some ABI-related functions
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   261
  void save_nonvolatile_gprs(   Register dst_base, int offset);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   262
  void restore_nonvolatile_gprs(Register src_base, int offset);
35085
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 31861
diff changeset
   263
  enum { num_volatile_regs = 11 + 14 }; // GPR + FPR
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   264
  void save_volatile_gprs(   Register dst_base, int offset);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   265
  void restore_volatile_gprs(Register src_base, int offset);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   266
  void save_LR_CR(   Register tmp);     // tmp contains LR on return.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   267
  void restore_LR_CR(Register tmp);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   268
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   269
  // Get current PC using bl-next-instruction trick.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   270
  address get_PC_trash_LR(Register result);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   271
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   272
  // Resize current frame either relatively wrt to current SP or absolute.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   273
  void resize_frame(Register offset, Register tmp);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   274
  void resize_frame(int      offset, Register tmp);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   275
  void resize_frame_absolute(Register addr, Register tmp1, Register tmp2);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   276
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   277
  // Push a frame of size bytes.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   278
  void push_frame(Register bytes, Register tmp);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   279
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   280
  // Push a frame of size `bytes'. No abi space provided.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   281
  void push_frame(unsigned int bytes, Register tmp);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   282
23211
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22861
diff changeset
   283
  // Push a frame of size `bytes' plus abi_reg_args on top.
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22861
diff changeset
   284
  void push_frame_reg_args(unsigned int bytes, Register tmp);
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   285
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   286
  // Setup up a new C frame with a spill area for non-volatile GPRs and additional
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   287
  // space for local variables
23211
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22861
diff changeset
   288
  void push_frame_reg_args_nonvolatiles(unsigned int bytes, Register tmp);
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   289
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   290
  // pop current C frame
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   291
  void pop_frame();
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   292
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   293
  //
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   294
  // Calls
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   295
  //
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   296
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   297
 private:
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   298
  address _last_calls_return_pc;
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   299
23211
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22861
diff changeset
   300
#if defined(ABI_ELFv2)
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22861
diff changeset
   301
  // Generic version of a call to C function.
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22861
diff changeset
   302
  // Updates and returns _last_calls_return_pc.
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22861
diff changeset
   303
  address branch_to(Register function_entry, bool and_link);
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22861
diff changeset
   304
#else
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   305
  // Generic version of a call to C function via a function descriptor
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   306
  // with variable support for C calling conventions (TOC, ENV, etc.).
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   307
  // updates and returns _last_calls_return_pc.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   308
  address branch_to(Register function_descriptor, bool and_link, bool save_toc_before_call,
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   309
                    bool restore_toc_after_call, bool load_toc_of_callee, bool load_env_of_callee);
23211
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22861
diff changeset
   310
#endif
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   311
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   312
 public:
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   313
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   314
  // Get the pc where the last call will return to. returns _last_calls_return_pc.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   315
  inline address last_calls_return_pc();
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   316
23211
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22861
diff changeset
   317
#if defined(ABI_ELFv2)
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22861
diff changeset
   318
  // Call a C function via a function descriptor and use full C
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22861
diff changeset
   319
  // calling conventions. Updates and returns _last_calls_return_pc.
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22861
diff changeset
   320
  address call_c(Register function_entry);
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22861
diff changeset
   321
  // For tail calls: only branch, don't link, so callee returns to caller of this function.
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22861
diff changeset
   322
  address call_c_and_return_to_caller(Register function_entry);
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22861
diff changeset
   323
  address call_c(address function_entry, relocInfo::relocType rt);
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22861
diff changeset
   324
#else
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   325
  // Call a C function via a function descriptor and use full C
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   326
  // calling conventions. Updates and returns _last_calls_return_pc.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   327
  address call_c(Register function_descriptor);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 22843
diff changeset
   328
  // For tail calls: only branch, don't link, so callee returns to caller of this function.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 22843
diff changeset
   329
  address call_c_and_return_to_caller(Register function_descriptor);
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   330
  address call_c(const FunctionDescriptor* function_descriptor, relocInfo::relocType rt);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   331
  address call_c_using_toc(const FunctionDescriptor* function_descriptor, relocInfo::relocType rt,
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   332
                           Register toc);
23211
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22861
diff changeset
   333
#endif
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   334
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   335
 protected:
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   336
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   337
  // It is imperative that all calls into the VM are handled via the
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   338
  // call_VM macros. They make sure that the stack linkage is setup
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   339
  // correctly. call_VM's correspond to ENTRY/ENTRY_X entry points
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   340
  // while call_VM_leaf's correspond to LEAF entry points.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   341
  //
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   342
  // This is the base routine called by the different versions of
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   343
  // call_VM. The interpreter may customize this version by overriding
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   344
  // it for its purposes (e.g., to save/restore additional registers
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   345
  // when doing a VM call).
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   346
  //
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   347
  // If no last_java_sp is specified (noreg) then SP will be used instead.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   348
  virtual void call_VM_base(
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   349
     // where an oop-result ends up if any; use noreg otherwise
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   350
    Register        oop_result,
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   351
    // to set up last_Java_frame in stubs; use noreg otherwise
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   352
    Register        last_java_sp,
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   353
    // the entry point
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   354
    address         entry_point,
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   355
    // flag which indicates if exception should be checked
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 22843
diff changeset
   356
    bool            check_exception = true
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   357
  );
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   358
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   359
  // Support for VM calls. This is the base routine called by the
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   360
  // different versions of call_VM_leaf. The interpreter may customize
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   361
  // this version by overriding it for its purposes (e.g., to
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   362
  // save/restore additional registers when doing a VM call).
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   363
  void call_VM_leaf_base(address entry_point);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   364
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   365
 public:
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   366
  // Call into the VM.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   367
  // Passes the thread pointer (in R3_ARG1) as a prepended argument.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   368
  // Makes sure oop return values are visible to the GC.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   369
  void call_VM(Register oop_result, address entry_point, bool check_exceptions = true);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   370
  void call_VM(Register oop_result, address entry_point, Register arg_1, bool check_exceptions = true);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   371
  void call_VM(Register oop_result, address entry_point, Register arg_1, Register arg_2, bool check_exceptions = true);
28187
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27684
diff changeset
   372
  void call_VM(Register oop_result, address entry_point, Register arg_1, Register arg_2, Register arg3, bool check_exceptions = true);
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   373
  void call_VM_leaf(address entry_point);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   374
  void call_VM_leaf(address entry_point, Register arg_1);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   375
  void call_VM_leaf(address entry_point, Register arg_1, Register arg_2);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   376
  void call_VM_leaf(address entry_point, Register arg_1, Register arg_2, Register arg_3);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   377
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   378
  // Call a stub function via a function descriptor, but don't save
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   379
  // TOC before call, don't setup TOC and ENV for call, and don't
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   380
  // restore TOC after call. Updates and returns _last_calls_return_pc.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   381
  inline address call_stub(Register function_entry);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   382
  inline void call_stub_and_return_to(Register function_entry, Register return_pc);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   383
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   384
  //
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   385
  // Java utilities
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   386
  //
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   387
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   388
  // Read from the polling page, its address is already in a register.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   389
  inline void load_from_polling_page(Register polling_page_address, int offset = 0);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   390
  // Check whether instruction is a read access to the polling page
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   391
  // which was emitted by load_from_polling_page(..).
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   392
  static bool is_load_from_polling_page(int instruction, void* ucontext/*may be NULL*/,
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   393
                                        address* polling_address_ptr = NULL);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   394
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   395
  // Check whether instruction is a write access to the memory
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   396
  // serialization page realized by one of the instructions stw, stwu,
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   397
  // stwx, or stwux.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   398
  static bool is_memory_serialization(int instruction, JavaThread* thread, void* ucontext);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   399
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   400
  // Support for NULL-checks
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   401
  //
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   402
  // Generates code that causes a NULL OS exception if the content of reg is NULL.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   403
  // If the accessed location is M[reg + offset] and the offset is known, provide the
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   404
  // offset. No explicit code generation is needed if the offset is within a certain
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   405
  // range (0 <= offset <= page_size).
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   406
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   407
  // Stack overflow checking
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   408
  void bang_stack_with_offset(int offset);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   409
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   410
  // If instruction is a stack bang of the form ld, stdu, or
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   411
  // stdux, return the banged address. Otherwise, return 0.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   412
  static address get_stack_bang_address(int instruction, void* ucontext);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   413
38931
3cf28d630349 8156923: [ppc] Implement "JEP 270: Reserved Stack Areas for Critical Sections".
goetz
parents: 38685
diff changeset
   414
  // Check for reserved stack access in method being exited. If the reserved
3cf28d630349 8156923: [ppc] Implement "JEP 270: Reserved Stack Areas for Critical Sections".
goetz
parents: 38685
diff changeset
   415
  // stack area was accessed, protect it again and throw StackOverflowError.
3cf28d630349 8156923: [ppc] Implement "JEP 270: Reserved Stack Areas for Critical Sections".
goetz
parents: 38685
diff changeset
   416
  void reserved_stack_check(Register return_pc);
3cf28d630349 8156923: [ppc] Implement "JEP 270: Reserved Stack Areas for Critical Sections".
goetz
parents: 38685
diff changeset
   417
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   418
  // Atomics
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   419
  // CmpxchgX sets condition register to cmpX(current, compare).
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   420
  // (flag == ne) => (dest_current_value != compare_value), (!swapped)
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   421
  // (flag == eq) => (dest_current_value == compare_value), ( swapped)
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   422
  static inline bool cmpxchgx_hint_acquire_lock()  { return true; }
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   423
  // The stxcx will probably not be succeeded by a releasing store.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   424
  static inline bool cmpxchgx_hint_release_lock()  { return false; }
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   425
  static inline bool cmpxchgx_hint_atomic_update() { return false; }
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   426
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   427
  // Cmpxchg semantics
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   428
  enum {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   429
    MemBarNone = 0,
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   430
    MemBarRel  = 1,
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   431
    MemBarAcq  = 2,
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   432
    MemBarFenceAfter = 4 // use powers of 2
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   433
  };
39444
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 38931
diff changeset
   434
 private:
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 38931
diff changeset
   435
  // Helper functions for word/sub-word atomics.
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 38931
diff changeset
   436
  void atomic_get_and_modify_generic(Register dest_current_value, Register exchange_value,
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 38931
diff changeset
   437
                                     Register addr_base, Register tmp1, Register tmp2, Register tmp3,
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 38931
diff changeset
   438
                                     bool cmpxchgx_hint, bool is_add, int size);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 38931
diff changeset
   439
  void cmpxchg_loop_body(ConditionRegister flag, Register dest_current_value,
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 38931
diff changeset
   440
                         Register compare_value, Register exchange_value,
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 38931
diff changeset
   441
                         Register addr_base, Register tmp1, Register tmp2,
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 38931
diff changeset
   442
                         Label &retry, Label &failed, bool cmpxchgx_hint, int size);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 38931
diff changeset
   443
  void cmpxchg_generic(ConditionRegister flag,
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 38931
diff changeset
   444
                       Register dest_current_value, Register compare_value, Register exchange_value, Register addr_base,
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 38931
diff changeset
   445
                       Register tmp1, Register tmp2,
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 38931
diff changeset
   446
                       int semantics, bool cmpxchgx_hint, Register int_flag_success, bool contention_hint, bool weak, int size);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 38931
diff changeset
   447
 public:
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 38931
diff changeset
   448
  // Temps and addr_base are killed if processor does not support Power 8 instructions.
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 38931
diff changeset
   449
  // Result will be sign extended.
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 38931
diff changeset
   450
  void getandsetb(Register dest_current_value, Register exchange_value, Register addr_base,
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 38931
diff changeset
   451
                  Register tmp1, Register tmp2, Register tmp3, bool cmpxchgx_hint) {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 38931
diff changeset
   452
    atomic_get_and_modify_generic(dest_current_value, exchange_value, addr_base, tmp1, tmp2, tmp3, cmpxchgx_hint, false, 1);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 38931
diff changeset
   453
  }
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 38931
diff changeset
   454
  // Temps and addr_base are killed if processor does not support Power 8 instructions.
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 38931
diff changeset
   455
  // Result will be sign extended.
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 38931
diff changeset
   456
  void getandseth(Register dest_current_value, Register exchange_value, Register addr_base,
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 38931
diff changeset
   457
                  Register tmp1, Register tmp2, Register tmp3, bool cmpxchgx_hint) {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 38931
diff changeset
   458
    atomic_get_and_modify_generic(dest_current_value, exchange_value, addr_base, tmp1, tmp2, tmp3, cmpxchgx_hint, false, 2);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 38931
diff changeset
   459
  }
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 38931
diff changeset
   460
  void getandsetw(Register dest_current_value, Register exchange_value, Register addr_base,
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 38931
diff changeset
   461
                  bool cmpxchgx_hint) {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 38931
diff changeset
   462
    atomic_get_and_modify_generic(dest_current_value, exchange_value, addr_base, noreg, noreg, noreg, cmpxchgx_hint, false, 4);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 38931
diff changeset
   463
  }
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 38931
diff changeset
   464
  void getandsetd(Register dest_current_value, Register exchange_value, Register addr_base,
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 38931
diff changeset
   465
                  bool cmpxchgx_hint);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 38931
diff changeset
   466
  // tmp2/3 and addr_base are killed if processor does not support Power 8 instructions (tmp1 is always needed).
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 38931
diff changeset
   467
  // Result will be sign extended.
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 38931
diff changeset
   468
  void getandaddb(Register dest_current_value, Register inc_value, Register addr_base,
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 38931
diff changeset
   469
                  Register tmp1, Register tmp2, Register tmp3, bool cmpxchgx_hint) {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 38931
diff changeset
   470
    atomic_get_and_modify_generic(dest_current_value, inc_value, addr_base, tmp1, tmp2, tmp3, cmpxchgx_hint, true, 1);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 38931
diff changeset
   471
  }
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 38931
diff changeset
   472
  // tmp2/3 and addr_base are killed if processor does not support Power 8 instructions (tmp1 is always needed).
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 38931
diff changeset
   473
  // Result will be sign extended.
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 38931
diff changeset
   474
  void getandaddh(Register dest_current_value, Register inc_value, Register addr_base,
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 38931
diff changeset
   475
                  Register tmp1, Register tmp2, Register tmp3, bool cmpxchgx_hint) {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 38931
diff changeset
   476
    atomic_get_and_modify_generic(dest_current_value, inc_value, addr_base, tmp1, tmp2, tmp3, cmpxchgx_hint, true, 2);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 38931
diff changeset
   477
  }
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 38931
diff changeset
   478
  void getandaddw(Register dest_current_value, Register inc_value, Register addr_base,
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 38931
diff changeset
   479
                  Register tmp1, bool cmpxchgx_hint) {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 38931
diff changeset
   480
    atomic_get_and_modify_generic(dest_current_value, inc_value, addr_base, tmp1, noreg, noreg, cmpxchgx_hint, true, 4);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 38931
diff changeset
   481
  }
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 38931
diff changeset
   482
  void getandaddd(Register dest_current_value, Register exchange_value, Register addr_base,
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 38931
diff changeset
   483
                  Register tmp, bool cmpxchgx_hint);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 38931
diff changeset
   484
  // Temps, addr_base and exchange_value are killed if processor does not support Power 8 instructions.
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 38931
diff changeset
   485
  // compare_value must be at least 32 bit sign extended. Result will be sign extended.
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 38931
diff changeset
   486
  void cmpxchgb(ConditionRegister flag,
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 38931
diff changeset
   487
                Register dest_current_value, Register compare_value, Register exchange_value, Register addr_base,
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 38931
diff changeset
   488
                Register tmp1, Register tmp2, int semantics, bool cmpxchgx_hint = false,
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 38931
diff changeset
   489
                Register int_flag_success = noreg, bool contention_hint = false, bool weak = false) {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 38931
diff changeset
   490
    cmpxchg_generic(flag, dest_current_value, compare_value, exchange_value, addr_base, tmp1, tmp2,
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 38931
diff changeset
   491
                    semantics, cmpxchgx_hint, int_flag_success, contention_hint, weak, 1);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 38931
diff changeset
   492
  }
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 38931
diff changeset
   493
  // Temps, addr_base and exchange_value are killed if processor does not support Power 8 instructions.
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 38931
diff changeset
   494
  // compare_value must be at least 32 bit sign extended. Result will be sign extended.
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 38931
diff changeset
   495
  void cmpxchgh(ConditionRegister flag,
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 38931
diff changeset
   496
                Register dest_current_value, Register compare_value, Register exchange_value, Register addr_base,
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 38931
diff changeset
   497
                Register tmp1, Register tmp2, int semantics, bool cmpxchgx_hint = false,
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 38931
diff changeset
   498
                Register int_flag_success = noreg, bool contention_hint = false, bool weak = false) {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 38931
diff changeset
   499
    cmpxchg_generic(flag, dest_current_value, compare_value, exchange_value, addr_base, tmp1, tmp2,
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 38931
diff changeset
   500
                    semantics, cmpxchgx_hint, int_flag_success, contention_hint, weak, 2);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 38931
diff changeset
   501
  }
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   502
  void cmpxchgw(ConditionRegister flag,
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   503
                Register dest_current_value, Register compare_value, Register exchange_value, Register addr_base,
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   504
                int semantics, bool cmpxchgx_hint = false,
39444
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 38931
diff changeset
   505
                Register int_flag_success = noreg, bool contention_hint = false, bool weak = false) {
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 38931
diff changeset
   506
    cmpxchg_generic(flag, dest_current_value, compare_value, exchange_value, addr_base, noreg, noreg,
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 38931
diff changeset
   507
                    semantics, cmpxchgx_hint, int_flag_success, contention_hint, weak, 4);
2eae9b74c1f3 8159976: PPC64: Add missing intrinsics for sub-word atomics
mdoerr
parents: 38931
diff changeset
   508
  }
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   509
  void cmpxchgd(ConditionRegister flag,
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 28617
diff changeset
   510
                Register dest_current_value, RegisterOrConstant compare_value, Register exchange_value,
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 28617
diff changeset
   511
                Register addr_base, int semantics, bool cmpxchgx_hint = false,
38685
e34308190947 8141635: Implement VarHandles/Unsafe intrinsics on POWER
mdoerr
parents: 38074
diff changeset
   512
                Register int_flag_success = noreg, Label* failed = NULL, bool contention_hint = false, bool weak = false);
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   513
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   514
  // interface method calling
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   515
  void lookup_interface_method(Register recv_klass,
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   516
                               Register intf_klass,
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   517
                               RegisterOrConstant itable_index,
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   518
                               Register method_result,
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   519
                               Register temp_reg, Register temp2_reg,
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   520
                               Label& no_such_interface);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   521
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   522
  // virtual method calling
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   523
  void lookup_virtual_method(Register recv_klass,
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   524
                             RegisterOrConstant vtable_index,
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   525
                             Register method_result);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   526
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   527
  // Test sub_klass against super_klass, with fast and slow paths.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   528
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   529
  // The fast path produces a tri-state answer: yes / no / maybe-slow.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   530
  // One of the three labels can be NULL, meaning take the fall-through.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   531
  // If super_check_offset is -1, the value is loaded up from super_klass.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   532
  // No registers are killed, except temp_reg and temp2_reg.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   533
  // If super_check_offset is not -1, temp2_reg is not used and can be noreg.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   534
  void check_klass_subtype_fast_path(Register sub_klass,
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   535
                                     Register super_klass,
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   536
                                     Register temp1_reg,
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   537
                                     Register temp2_reg,
35085
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 31861
diff changeset
   538
                                     Label* L_success,
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 31861
diff changeset
   539
                                     Label* L_failure,
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 31861
diff changeset
   540
                                     Label* L_slow_path = NULL, // default fall through
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 31861
diff changeset
   541
                                     RegisterOrConstant super_check_offset = RegisterOrConstant(-1));
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   542
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   543
  // The rest of the type check; must be wired to a corresponding fast path.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   544
  // It does not repeat the fast path logic, so don't use it standalone.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   545
  // The temp_reg can be noreg, if no temps are available.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   546
  // It can also be sub_klass or super_klass, meaning it's OK to kill that one.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   547
  // Updates the sub's secondary super cache as necessary.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   548
  void check_klass_subtype_slow_path(Register sub_klass,
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   549
                                     Register super_klass,
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   550
                                     Register temp1_reg,
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   551
                                     Register temp2_reg,
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   552
                                     Label* L_success = NULL,
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   553
                                     Register result_reg = noreg);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   554
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   555
  // Simplified, combined version, good for typical uses.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   556
  // Falls through on failure.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   557
  void check_klass_subtype(Register sub_klass,
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   558
                           Register super_klass,
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   559
                           Register temp1_reg,
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   560
                           Register temp2_reg,
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   561
                           Label& L_success);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   562
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   563
  // Method handle support (JSR 292).
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   564
  void check_method_handle_type(Register mtype_reg, Register mh_reg, Register temp_reg, Label& wrong_method_type);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   565
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   566
  RegisterOrConstant argument_offset(RegisterOrConstant arg_slot, Register temp_reg, int extra_slot_offset = 0);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   567
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   568
  // Biased locking support
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   569
  // Upon entry,obj_reg must contain the target object, and mark_reg
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   570
  // must contain the target object's header.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   571
  // Destroys mark_reg if an attempt is made to bias an anonymously
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   572
  // biased lock. In this case a failure will go either to the slow
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   573
  // case or fall through with the notEqual condition code set with
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   574
  // the expectation that the slow case in the runtime will be called.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   575
  // In the fall-through case where the CAS-based lock is done,
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   576
  // mark_reg is not destroyed.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   577
  void biased_locking_enter(ConditionRegister cr_reg, Register obj_reg, Register mark_reg, Register temp_reg,
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   578
                            Register temp2_reg, Label& done, Label* slow_case = NULL);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   579
  // Upon entry, the base register of mark_addr must contain the oop.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   580
  // Destroys temp_reg.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   581
  // If allow_delay_slot_filling is set to true, the next instruction
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   582
  // emitted after this one will go in an annulled delay slot if the
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   583
  // biased locking exit case failed.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   584
  void biased_locking_exit(ConditionRegister cr_reg, Register mark_addr, Register temp_reg, Label& done);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   585
35085
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 31861
diff changeset
   586
  // allocation (for C1)
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 31861
diff changeset
   587
  void eden_allocate(
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 31861
diff changeset
   588
    Register obj,                      // result: pointer to object after successful allocation
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 31861
diff changeset
   589
    Register var_size_in_bytes,        // object size in bytes if unknown at compile time; invalid otherwise
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 31861
diff changeset
   590
    int      con_size_in_bytes,        // object size in bytes if   known at compile time
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 31861
diff changeset
   591
    Register t1,                       // temp register
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 31861
diff changeset
   592
    Register t2,                       // temp register
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 31861
diff changeset
   593
    Label&   slow_case                 // continuation point if fast allocation fails
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 31861
diff changeset
   594
  );
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 31861
diff changeset
   595
  void tlab_allocate(
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 31861
diff changeset
   596
    Register obj,                      // result: pointer to object after successful allocation
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 31861
diff changeset
   597
    Register var_size_in_bytes,        // object size in bytes if unknown at compile time; invalid otherwise
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 31861
diff changeset
   598
    int      con_size_in_bytes,        // object size in bytes if   known at compile time
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 31861
diff changeset
   599
    Register t1,                       // temp register
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 31861
diff changeset
   600
    Label&   slow_case                 // continuation point if fast allocation fails
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 31861
diff changeset
   601
  );
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 31861
diff changeset
   602
  void tlab_refill(Label& retry_tlab, Label& try_eden, Label& slow_case);
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 31861
diff changeset
   603
  void incr_allocated_bytes(RegisterOrConstant size_in_bytes, Register t1, Register t2);
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 31861
diff changeset
   604
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 31861
diff changeset
   605
  enum { trampoline_stub_size = 6 * 4 };
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 31861
diff changeset
   606
  address emit_trampoline_stub(int destination_toc_offset, int insts_call_instruction_offset, Register Rtoc = noreg);
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 31861
diff changeset
   607
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 28617
diff changeset
   608
  void atomic_inc_ptr(Register addr, Register result, int simm16 = 1);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 28617
diff changeset
   609
  void atomic_ori_int(Register addr, Register result, int uimm16);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 28617
diff changeset
   610
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 28617
diff changeset
   611
#if INCLUDE_RTM_OPT
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 28617
diff changeset
   612
  void rtm_counters_update(Register abort_status, Register rtm_counters);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 28617
diff changeset
   613
  void branch_on_random_using_tb(Register tmp, int count, Label& brLabel);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 28617
diff changeset
   614
  void rtm_abort_ratio_calculation(Register rtm_counters_reg, RTMLockingCounters* rtm_counters,
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 28617
diff changeset
   615
                                   Metadata* method_data);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 28617
diff changeset
   616
  void rtm_profiling(Register abort_status_Reg, Register temp_Reg,
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 28617
diff changeset
   617
                     RTMLockingCounters* rtm_counters, Metadata* method_data, bool profile_rtm);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 28617
diff changeset
   618
  void rtm_retry_lock_on_abort(Register retry_count, Register abort_status,
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 28617
diff changeset
   619
                               Label& retryLabel, Label* checkRetry = NULL);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 28617
diff changeset
   620
  void rtm_retry_lock_on_busy(Register retry_count, Register owner_addr, Label& retryLabel);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 28617
diff changeset
   621
  void rtm_stack_locking(ConditionRegister flag, Register obj, Register mark_word, Register tmp,
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 28617
diff changeset
   622
                         Register retry_on_abort_count,
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 28617
diff changeset
   623
                         RTMLockingCounters* stack_rtm_counters,
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 28617
diff changeset
   624
                         Metadata* method_data, bool profile_rtm,
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 28617
diff changeset
   625
                         Label& DONE_LABEL, Label& IsInflated);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 28617
diff changeset
   626
  void rtm_inflated_locking(ConditionRegister flag, Register obj, Register mark_word, Register box,
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 28617
diff changeset
   627
                            Register retry_on_busy_count, Register retry_on_abort_count,
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 28617
diff changeset
   628
                            RTMLockingCounters* rtm_counters,
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 28617
diff changeset
   629
                            Metadata* method_data, bool profile_rtm,
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 28617
diff changeset
   630
                            Label& DONE_LABEL);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 28617
diff changeset
   631
#endif
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 28617
diff changeset
   632
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 28617
diff changeset
   633
  void compiler_fast_lock_object(ConditionRegister flag, Register oop, Register box,
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 28617
diff changeset
   634
                                 Register tmp1, Register tmp2, Register tmp3,
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 28617
diff changeset
   635
                                 bool try_bias = UseBiasedLocking,
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 28617
diff changeset
   636
                                 RTMLockingCounters* rtm_counters = NULL,
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 28617
diff changeset
   637
                                 RTMLockingCounters* stack_rtm_counters = NULL,
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 28617
diff changeset
   638
                                 Metadata* method_data = NULL,
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 28617
diff changeset
   639
                                 bool use_rtm = false, bool profile_rtm = false);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 28617
diff changeset
   640
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 28617
diff changeset
   641
  void compiler_fast_unlock_object(ConditionRegister flag, Register oop, Register box,
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 28617
diff changeset
   642
                                   Register tmp1, Register tmp2, Register tmp3,
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 28617
diff changeset
   643
                                   bool try_bias = UseBiasedLocking, bool use_rtm = false);
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   644
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   645
  // Support for serializing memory accesses between threads
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   646
  void serialize_memory(Register thread, Register tmp1, Register tmp2);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   647
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   648
  // GC barrier support.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   649
  void card_write_barrier_post(Register Rstore_addr, Register Rnew_val, Register Rtmp);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   650
  void card_table_write(jbyte* byte_map_base, Register Rtmp, Register Robj);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   651
44406
a46a6c4d1dd9 8176100: [REDO][REDO] G1 Needs pre barrier on dereference of weak JNI handles
mgerdin
parents: 44093
diff changeset
   652
  void resolve_jobject(Register value, Register tmp1, Register tmp2, bool needs_frame);
a46a6c4d1dd9 8176100: [REDO][REDO] G1 Needs pre barrier on dereference of weak JNI handles
mgerdin
parents: 44093
diff changeset
   653
23492
af5352f40e65 8037915: PPC64/AIX: Several smaller fixes
goetz
parents: 23221
diff changeset
   654
#if INCLUDE_ALL_GCS
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   655
  // General G1 pre-barrier generator.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   656
  void g1_write_barrier_pre(Register Robj, RegisterOrConstant offset, Register Rpre_val,
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   657
                            Register Rtmp1, Register Rtmp2, bool needs_frame = false);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   658
  // General G1 post-barrier generator
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   659
  void g1_write_barrier_post(Register Rstore_addr, Register Rnew_val, Register Rtmp1,
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   660
                             Register Rtmp2, Register Rtmp3, Label *filtered_ext = NULL);
23492
af5352f40e65 8037915: PPC64/AIX: Several smaller fixes
goetz
parents: 23221
diff changeset
   661
#endif
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   662
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   663
  // Support for managing the JavaThread pointer (i.e.; the reference to
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   664
  // thread-local information).
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   665
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   666
  // Support for last Java frame (but use call_VM instead where possible):
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   667
  // access R16_thread->last_Java_sp.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   668
  void set_last_Java_frame(Register last_java_sp, Register last_Java_pc);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   669
  void reset_last_Java_frame(void);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   670
  void set_top_ijava_frame_at_SP_as_last_Java_frame(Register sp, Register tmp1);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   671
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   672
  // Read vm result from thread: oop_result = R16_thread->result;
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   673
  void get_vm_result  (Register oop_result);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   674
  void get_vm_result_2(Register metadata_result);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   675
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   676
  static bool needs_explicit_null_check(intptr_t offset);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   677
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   678
  // Trap-instruction-based checks.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   679
  // Range checks can be distinguished from zero checks as they check 32 bit,
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   680
  // zero checks all 64 bits (tw, td).
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   681
  inline void trap_null_check(Register a, trap_to_bits cmp = traptoEqual);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   682
  static bool is_trap_null_check(int x) {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   683
    return is_tdi(x, traptoEqual,               -1/*any reg*/, 0) ||
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   684
           is_tdi(x, traptoGreaterThanUnsigned, -1/*any reg*/, 0);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   685
  }
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   686
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   687
  inline void trap_zombie_not_entrant();
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   688
  static bool is_trap_zombie_not_entrant(int x) { return is_tdi(x, traptoUnconditional, 0/*reg 0*/, 1); }
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   689
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   690
  inline void trap_should_not_reach_here();
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   691
  static bool is_trap_should_not_reach_here(int x) { return is_tdi(x, traptoUnconditional, 0/*reg 0*/, 2); }
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   692
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   693
  inline void trap_ic_miss_check(Register a, Register b);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   694
  static bool is_trap_ic_miss_check(int x) {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   695
    return is_td(x, traptoGreaterThanUnsigned | traptoLessThanUnsigned, -1/*any reg*/, -1/*any reg*/);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   696
  }
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   697
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   698
  // Implicit or explicit null check, jumps to static address exception_entry.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   699
  inline void null_check_throw(Register a, int offset, Register temp_reg, address exception_entry);
35085
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 31861
diff changeset
   700
  inline void null_check(Register a, int offset, Label *Lis_null); // implicit only if Lis_null not provided
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   701
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   702
  // Load heap oop and decompress. Loaded oop may not be null.
28617
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
   703
  // Specify tmp to save one cycle.
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
   704
  inline void load_heap_oop_not_null(Register d, RegisterOrConstant offs, Register s1 = noreg,
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
   705
                                     Register tmp = noreg);
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
   706
  // Store heap oop and decompress.  Decompressed oop may not be null.
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
   707
  // Specify tmp register if d should not be changed.
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 23211
diff changeset
   708
  inline void store_heap_oop_not_null(Register d, RegisterOrConstant offs, Register s1,
28617
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
   709
                                      Register tmp = noreg);
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   710
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   711
  // Null allowed.
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 28617
diff changeset
   712
  inline void load_heap_oop(Register d, RegisterOrConstant offs, Register s1 = noreg, Label *is_null = NULL);
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   713
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   714
  // Encode/decode heap oop. Oop may not be null, else en/decoding goes wrong.
28617
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
   715
  // src == d allowed.
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 23211
diff changeset
   716
  inline Register encode_heap_oop_not_null(Register d, Register src = noreg);
28617
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 28187
diff changeset
   717
  inline Register decode_heap_oop_not_null(Register d, Register src = noreg);
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   718
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   719
  // Null allowed.
35085
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 31861
diff changeset
   720
  inline Register encode_heap_oop(Register d, Register src); // Prefer null check in GC barrier!
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   721
  inline void decode_heap_oop(Register d);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   722
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   723
  // Load/Store klass oop from klass field. Compress.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   724
  void load_klass(Register dst, Register src);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   725
  void store_klass(Register dst_oop, Register klass, Register tmp = R0);
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 23211
diff changeset
   726
  void store_klass_gap(Register dst_oop, Register val = noreg); // Will store 0 if val not specified.
38074
8475fdc6dcc3 8154580: Save mirror in interpreter frame to enable cleanups of CLDClosure
coleenp
parents: 36303
diff changeset
   727
42068
18c8a4d5998e 8168083: PPC64: Cleanup template interpreter after 8154580 and 8154867
mdoerr
parents: 41334
diff changeset
   728
  void load_mirror_from_const_method(Register mirror, Register const_method);
38074
8475fdc6dcc3 8154580: Save mirror in interpreter frame to enable cleanups of CLDClosure
coleenp
parents: 36303
diff changeset
   729
22843
b245fac3b6a4 8027968: Adapt PPC to 8024927: Nashorn performance regression with CompressedOops
goetz
parents: 22824
diff changeset
   730
  static int instr_size_for_decode_klass_not_null();
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   731
  void decode_klass_not_null(Register dst, Register src = noreg);
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 28617
diff changeset
   732
  Register encode_klass_not_null(Register dst, Register src = noreg);
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   733
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   734
  // SIGTRAP-based range checks for arrays.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   735
  inline void trap_range_check_l(Register a, Register b);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   736
  inline void trap_range_check_l(Register a, int si16);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   737
  static bool is_trap_range_check_l(int x) {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   738
    return (is_tw (x, traptoLessThanUnsigned, -1/*any reg*/, -1/*any reg*/) ||
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   739
            is_twi(x, traptoLessThanUnsigned, -1/*any reg*/)                  );
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   740
  }
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   741
  inline void trap_range_check_le(Register a, int si16);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   742
  static bool is_trap_range_check_le(int x) {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   743
    return is_twi(x, traptoEqual | traptoLessThanUnsigned, -1/*any reg*/);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   744
  }
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   745
  inline void trap_range_check_g(Register a, int si16);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   746
  static bool is_trap_range_check_g(int x) {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   747
    return is_twi(x, traptoGreaterThanUnsigned, -1/*any reg*/);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   748
  }
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   749
  inline void trap_range_check_ge(Register a, Register b);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   750
  inline void trap_range_check_ge(Register a, int si16);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   751
  static bool is_trap_range_check_ge(int x) {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   752
    return (is_tw (x, traptoEqual | traptoGreaterThanUnsigned, -1/*any reg*/, -1/*any reg*/) ||
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   753
            is_twi(x, traptoEqual | traptoGreaterThanUnsigned, -1/*any reg*/)                  );
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   754
  }
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   755
  static bool is_trap_range_check(int x) {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   756
    return is_trap_range_check_l(x) || is_trap_range_check_le(x) ||
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   757
           is_trap_range_check_g(x) || is_trap_range_check_ge(x);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   758
  }
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   759
42661
2343dd675325 8170991: PPC64: Bad code for initialization of short arrays
mdoerr
parents: 42068
diff changeset
   760
  void clear_memory_unrolled(Register base_ptr, int cnt_dwords, Register tmp = R0, int offset = 0);
2343dd675325 8170991: PPC64: Bad code for initialization of short arrays
mdoerr
parents: 42068
diff changeset
   761
  void clear_memory_constlen(Register base_ptr, int cnt_dwords, Register tmp = R0);
2343dd675325 8170991: PPC64: Bad code for initialization of short arrays
mdoerr
parents: 42068
diff changeset
   762
  void clear_memory_doubleword(Register base_ptr, Register cnt_dwords, Register tmp = R0, long const_cnt = -1);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 22843
diff changeset
   763
36303
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35594
diff changeset
   764
#ifdef COMPILER2
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35594
diff changeset
   765
  // Intrinsics for CompactStrings
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35594
diff changeset
   766
  // Compress char[] to byte[] by compressing 16 bytes at once.
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35594
diff changeset
   767
  void string_compress_16(Register src, Register dst, Register cnt,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35594
diff changeset
   768
                          Register tmp1, Register tmp2, Register tmp3, Register tmp4, Register tmp5,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35594
diff changeset
   769
                          Label& Lfailure);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35594
diff changeset
   770
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35594
diff changeset
   771
  // Compress char[] to byte[]. cnt must be positive int.
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35594
diff changeset
   772
  void string_compress(Register src, Register dst, Register cnt, Register tmp, Label& Lfailure);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35594
diff changeset
   773
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35594
diff changeset
   774
  // Inflate byte[] to char[] by inflating 16 bytes at once.
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35594
diff changeset
   775
  void string_inflate_16(Register src, Register dst, Register cnt,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35594
diff changeset
   776
                         Register tmp1, Register tmp2, Register tmp3, Register tmp4, Register tmp5);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35594
diff changeset
   777
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35594
diff changeset
   778
  // Inflate byte[] to char[]. cnt must be positive int.
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35594
diff changeset
   779
  void string_inflate(Register src, Register dst, Register cnt, Register tmp);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35594
diff changeset
   780
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35594
diff changeset
   781
  void string_compare(Register str1, Register str2, Register cnt1, Register cnt2,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35594
diff changeset
   782
                      Register tmp1, Register result, int ae);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35594
diff changeset
   783
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35594
diff changeset
   784
  void array_equals(bool is_array_equ, Register ary1, Register ary2,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35594
diff changeset
   785
                    Register limit, Register tmp1, Register result, bool is_byte);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35594
diff changeset
   786
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35594
diff changeset
   787
  void string_indexof(Register result, Register haystack, Register haycnt,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35594
diff changeset
   788
                      Register needle, ciTypeArray* needle_values, Register needlecnt, int needlecntval,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35594
diff changeset
   789
                      Register tmp1, Register tmp2, Register tmp3, Register tmp4, int ae);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35594
diff changeset
   790
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35594
diff changeset
   791
  void string_indexof_char(Register result, Register haystack, Register haycnt,
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35594
diff changeset
   792
                           Register needle, jchar needleChar, Register tmp1, Register tmp2, bool is_byte);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35594
diff changeset
   793
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35594
diff changeset
   794
  void has_negatives(Register src, Register cnt, Register result, Register tmp1, Register tmp2);
6241574f5982 8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents: 35594
diff changeset
   795
#endif
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   796
31773
f874931cbae7 8130653: ppc: implement MultiplyToLen intrinsic
goetz
parents: 30303
diff changeset
   797
  // Emitters for BigInteger.multiplyToLen intrinsic.
f874931cbae7 8130653: ppc: implement MultiplyToLen intrinsic
goetz
parents: 30303
diff changeset
   798
  inline void multiply64(Register dest_hi, Register dest_lo,
f874931cbae7 8130653: ppc: implement MultiplyToLen intrinsic
goetz
parents: 30303
diff changeset
   799
                         Register x, Register y);
f874931cbae7 8130653: ppc: implement MultiplyToLen intrinsic
goetz
parents: 30303
diff changeset
   800
  void add2_with_carry(Register dest_hi, Register dest_lo,
f874931cbae7 8130653: ppc: implement MultiplyToLen intrinsic
goetz
parents: 30303
diff changeset
   801
                       Register src1, Register src2);
f874931cbae7 8130653: ppc: implement MultiplyToLen intrinsic
goetz
parents: 30303
diff changeset
   802
  void multiply_64_x_64_loop(Register x, Register xstart, Register x_xstart,
f874931cbae7 8130653: ppc: implement MultiplyToLen intrinsic
goetz
parents: 30303
diff changeset
   803
                             Register y, Register y_idx, Register z,
f874931cbae7 8130653: ppc: implement MultiplyToLen intrinsic
goetz
parents: 30303
diff changeset
   804
                             Register carry, Register product_high, Register product,
f874931cbae7 8130653: ppc: implement MultiplyToLen intrinsic
goetz
parents: 30303
diff changeset
   805
                             Register idx, Register kdx, Register tmp);
f874931cbae7 8130653: ppc: implement MultiplyToLen intrinsic
goetz
parents: 30303
diff changeset
   806
  void multiply_add_128_x_128(Register x_xstart, Register y, Register z,
f874931cbae7 8130653: ppc: implement MultiplyToLen intrinsic
goetz
parents: 30303
diff changeset
   807
                              Register yz_idx, Register idx, Register carry,
f874931cbae7 8130653: ppc: implement MultiplyToLen intrinsic
goetz
parents: 30303
diff changeset
   808
                              Register product_high, Register product, Register tmp,
f874931cbae7 8130653: ppc: implement MultiplyToLen intrinsic
goetz
parents: 30303
diff changeset
   809
                              int offset);
f874931cbae7 8130653: ppc: implement MultiplyToLen intrinsic
goetz
parents: 30303
diff changeset
   810
  void multiply_128_x_128_loop(Register x_xstart,
f874931cbae7 8130653: ppc: implement MultiplyToLen intrinsic
goetz
parents: 30303
diff changeset
   811
                               Register y, Register z,
f874931cbae7 8130653: ppc: implement MultiplyToLen intrinsic
goetz
parents: 30303
diff changeset
   812
                               Register yz_idx, Register idx, Register carry,
f874931cbae7 8130653: ppc: implement MultiplyToLen intrinsic
goetz
parents: 30303
diff changeset
   813
                               Register product_high, Register product,
f874931cbae7 8130653: ppc: implement MultiplyToLen intrinsic
goetz
parents: 30303
diff changeset
   814
                               Register carry2, Register tmp);
f874931cbae7 8130653: ppc: implement MultiplyToLen intrinsic
goetz
parents: 30303
diff changeset
   815
  void multiply_to_len(Register x, Register xlen,
f874931cbae7 8130653: ppc: implement MultiplyToLen intrinsic
goetz
parents: 30303
diff changeset
   816
                       Register y, Register ylen,
f874931cbae7 8130653: ppc: implement MultiplyToLen intrinsic
goetz
parents: 30303
diff changeset
   817
                       Register z, Register zlen,
f874931cbae7 8130653: ppc: implement MultiplyToLen intrinsic
goetz
parents: 30303
diff changeset
   818
                       Register tmp1, Register tmp2, Register tmp3, Register tmp4, Register tmp5,
f874931cbae7 8130653: ppc: implement MultiplyToLen intrinsic
goetz
parents: 30303
diff changeset
   819
                       Register tmp6, Register tmp7, Register tmp8, Register tmp9, Register tmp10,
f874931cbae7 8130653: ppc: implement MultiplyToLen intrinsic
goetz
parents: 30303
diff changeset
   820
                       Register tmp11, Register tmp12, Register tmp13);
f874931cbae7 8130653: ppc: implement MultiplyToLen intrinsic
goetz
parents: 30303
diff changeset
   821
31861
7efea6fae96b 8131048: ppc: implement CRC32 intrinsic
goetz
parents: 31773
diff changeset
   822
  // CRC32 Intrinsics.
7efea6fae96b 8131048: ppc: implement CRC32 intrinsic
goetz
parents: 31773
diff changeset
   823
  void load_reverse_32(Register dst, Register src);
7efea6fae96b 8131048: ppc: implement CRC32 intrinsic
goetz
parents: 31773
diff changeset
   824
  int  crc32_table_columns(Register table, Register tc0, Register tc1, Register tc2, Register tc3);
7efea6fae96b 8131048: ppc: implement CRC32 intrinsic
goetz
parents: 31773
diff changeset
   825
  void fold_byte_crc32(Register crc, Register val, Register table, Register tmp);
7efea6fae96b 8131048: ppc: implement CRC32 intrinsic
goetz
parents: 31773
diff changeset
   826
  void fold_8bit_crc32(Register crc, Register table, Register tmp);
7efea6fae96b 8131048: ppc: implement CRC32 intrinsic
goetz
parents: 31773
diff changeset
   827
  void update_byte_crc32(Register crc, Register val, Register table);
7efea6fae96b 8131048: ppc: implement CRC32 intrinsic
goetz
parents: 31773
diff changeset
   828
  void update_byteLoop_crc32(Register crc, Register buf, Register len, Register table,
7efea6fae96b 8131048: ppc: implement CRC32 intrinsic
goetz
parents: 31773
diff changeset
   829
                             Register data, bool loopAlignment, bool invertCRC);
7efea6fae96b 8131048: ppc: implement CRC32 intrinsic
goetz
parents: 31773
diff changeset
   830
  void update_1word_crc32(Register crc, Register buf, Register table, int bufDisp, int bufInc,
7efea6fae96b 8131048: ppc: implement CRC32 intrinsic
goetz
parents: 31773
diff changeset
   831
                          Register t0,  Register t1,  Register t2,  Register t3,
7efea6fae96b 8131048: ppc: implement CRC32 intrinsic
goetz
parents: 31773
diff changeset
   832
                          Register tc0, Register tc1, Register tc2, Register tc3);
7efea6fae96b 8131048: ppc: implement CRC32 intrinsic
goetz
parents: 31773
diff changeset
   833
  void kernel_crc32_2word(Register crc, Register buf, Register len, Register table,
7efea6fae96b 8131048: ppc: implement CRC32 intrinsic
goetz
parents: 31773
diff changeset
   834
                          Register t0,  Register t1,  Register t2,  Register t3,
7efea6fae96b 8131048: ppc: implement CRC32 intrinsic
goetz
parents: 31773
diff changeset
   835
                          Register tc0, Register tc1, Register tc2, Register tc3);
7efea6fae96b 8131048: ppc: implement CRC32 intrinsic
goetz
parents: 31773
diff changeset
   836
  void kernel_crc32_1word(Register crc, Register buf, Register len, Register table,
7efea6fae96b 8131048: ppc: implement CRC32 intrinsic
goetz
parents: 31773
diff changeset
   837
                          Register t0,  Register t1,  Register t2,  Register t3,
7efea6fae96b 8131048: ppc: implement CRC32 intrinsic
goetz
parents: 31773
diff changeset
   838
                          Register tc0, Register tc1, Register tc2, Register tc3);
7efea6fae96b 8131048: ppc: implement CRC32 intrinsic
goetz
parents: 31773
diff changeset
   839
  void kernel_crc32_1byte(Register crc, Register buf, Register len, Register table,
7efea6fae96b 8131048: ppc: implement CRC32 intrinsic
goetz
parents: 31773
diff changeset
   840
                          Register t0,  Register t1,  Register t2,  Register t3);
41334
8b28be7b8613 8164920: ppc: enhancement of CRC32 intrinsic
mdoerr
parents: 39444
diff changeset
   841
  void kernel_crc32_1word_vpmsumd(Register crc, Register buf, Register len, Register table,
8b28be7b8613 8164920: ppc: enhancement of CRC32 intrinsic
mdoerr
parents: 39444
diff changeset
   842
                          Register constants, Register barretConstants,
8b28be7b8613 8164920: ppc: enhancement of CRC32 intrinsic
mdoerr
parents: 39444
diff changeset
   843
                          Register t0,  Register t1, Register t2, Register t3, Register t4);
8b28be7b8613 8164920: ppc: enhancement of CRC32 intrinsic
mdoerr
parents: 39444
diff changeset
   844
  void kernel_crc32_1word_aligned(Register crc, Register buf, Register len,
8b28be7b8613 8164920: ppc: enhancement of CRC32 intrinsic
mdoerr
parents: 39444
diff changeset
   845
                          Register constants, Register barretConstants,
8b28be7b8613 8164920: ppc: enhancement of CRC32 intrinsic
mdoerr
parents: 39444
diff changeset
   846
                          Register t0, Register t1, Register t2);
8b28be7b8613 8164920: ppc: enhancement of CRC32 intrinsic
mdoerr
parents: 39444
diff changeset
   847
31861
7efea6fae96b 8131048: ppc: implement CRC32 intrinsic
goetz
parents: 31773
diff changeset
   848
  void kernel_crc32_singleByte(Register crc, Register buf, Register len, Register table, Register tmp);
7efea6fae96b 8131048: ppc: implement CRC32 intrinsic
goetz
parents: 31773
diff changeset
   849
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   850
  //
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   851
  // Debugging
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   852
  //
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   853
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   854
  // assert on cr0
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   855
  void asm_assert(bool check_equal, const char* msg, int id);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   856
  void asm_assert_eq(const char* msg, int id) { asm_assert(true, msg, id); }
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   857
  void asm_assert_ne(const char* msg, int id) { asm_assert(false, msg, id); }
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   858
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   859
 private:
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   860
  void asm_assert_mems_zero(bool check_equal, int size, int mem_offset, Register mem_base,
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   861
                            const char* msg, int id);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   862
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   863
 public:
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   864
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   865
  void asm_assert_mem8_is_zero(int mem_offset, Register mem_base, const char* msg, int id) {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   866
    asm_assert_mems_zero(true,  8, mem_offset, mem_base, msg, id);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   867
  }
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   868
  void asm_assert_mem8_isnot_zero(int mem_offset, Register mem_base, const char* msg, int id) {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   869
    asm_assert_mems_zero(false, 8, mem_offset, mem_base, msg, id);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   870
  }
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   871
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   872
  // Verify R16_thread contents.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   873
  void verify_thread();
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   874
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   875
  // Emit code to verify that reg contains a valid oop if +VerifyOops is set.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   876
  void verify_oop(Register reg, const char* s = "broken oop");
35085
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 31861
diff changeset
   877
  void verify_oop_addr(RegisterOrConstant offs, Register base, const char* s = "contains broken oop");
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   878
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   879
  // TODO: verify method and klass metadata (compare against vptr?)
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   880
  void _verify_method_ptr(Register reg, const char * msg, const char * file, int line) {}
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 22843
diff changeset
   881
  void _verify_klass_ptr(Register reg, const char * msg, const char * file, int line) {}
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   882
23211
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22861
diff changeset
   883
  // Convenience method returning function entry. For the ELFv1 case
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22861
diff changeset
   884
  // creates function descriptor at the current address and returs
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22861
diff changeset
   885
  // the pointer to it. For the ELFv2 case returns the current address.
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22861
diff changeset
   886
  inline address function_entry();
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22861
diff changeset
   887
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   888
#define verify_method_ptr(reg) _verify_method_ptr(reg, "broken method " #reg, __FILE__, __LINE__)
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   889
#define verify_klass_ptr(reg) _verify_klass_ptr(reg, "broken klass " #reg, __FILE__, __LINE__)
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   890
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   891
 private:
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   892
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   893
  enum {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   894
    stop_stop                = 0,
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   895
    stop_untested            = 1,
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   896
    stop_unimplemented       = 2,
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   897
    stop_shouldnotreachhere  = 3,
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   898
    stop_end                 = 4
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   899
  };
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   900
  void stop(int type, const char* msg, int id);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   901
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   902
 public:
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   903
  // Prints msg, dumps registers and stops execution.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   904
  void stop         (const char* msg = "", int id = 0) { stop(stop_stop,               msg, id); }
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   905
  void untested     (const char* msg = "", int id = 0) { stop(stop_untested,           msg, id); }
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   906
  void unimplemented(const char* msg = "", int id = 0) { stop(stop_unimplemented,      msg, id); }
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   907
  void should_not_reach_here()                         { stop(stop_shouldnotreachhere,  "", -1); }
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   908
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   909
  void zap_from_to(Register low, int before, Register high, int after, Register val, Register addr) PRODUCT_RETURN;
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   910
};
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   911
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 23211
diff changeset
   912
// class SkipIfEqualZero:
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 23211
diff changeset
   913
//
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 23211
diff changeset
   914
// Instantiating this class will result in assembly code being output that will
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 23211
diff changeset
   915
// jump around any code emitted between the creation of the instance and it's
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 23211
diff changeset
   916
// automatic destruction at the end of a scope block, depending on the value of
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 23211
diff changeset
   917
// the flag passed to the constructor, which will be checked at run-time.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 23211
diff changeset
   918
class SkipIfEqualZero : public StackObj {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 23211
diff changeset
   919
 private:
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 23211
diff changeset
   920
  MacroAssembler* _masm;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 23211
diff changeset
   921
  Label _label;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 23211
diff changeset
   922
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 23211
diff changeset
   923
 public:
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 23211
diff changeset
   924
   // 'Temp' is a temp register that this object can use (and trash).
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 23211
diff changeset
   925
   explicit SkipIfEqualZero(MacroAssembler*, Register temp, const bool* flag_addr);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 23211
diff changeset
   926
   ~SkipIfEqualZero();
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 23211
diff changeset
   927
};
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 23211
diff changeset
   928
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   929
#endif // CPU_PPC_VM_MACROASSEMBLER_PPC_HPP