src/hotspot/cpu/ppc/macroAssembler_ppc.inline.hpp
author mdoerr
Wed, 10 Jan 2018 11:09:55 +0100
changeset 48506 478e77658965
parent 47216 71c04702a3d5
child 50162 f9fe56417050
permissions -rw-r--r--
8194258: PPC64 safepoint mechanism: Fix initialization on AIX and support SIGTRAP Summary: Use mmap on AIX to allocate protected page. Use trap instructions for polling if UseSIGTRAP is enabled. Reviewed-by: rehn, goetz
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
/*
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 28617
diff changeset
     2
 * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
35594
cc13089c6327 8147937: Adapt SAP copyrights to new company name.
goetz
parents: 35085
diff changeset
     3
 * Copyright (c) 2012, 2015 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_INLINE_HPP
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    27
#define CPU_PPC_VM_MACROASSEMBLER_PPC_INLINE_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.inline.hpp"
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    30
#include "asm/macroAssembler.hpp"
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    31
#include "asm/codeBuffer.hpp"
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    32
#include "code/codeCache.hpp"
48506
478e77658965 8194258: PPC64 safepoint mechanism: Fix initialization on AIX and support SIGTRAP
mdoerr
parents: 47216
diff changeset
    33
#include "runtime/safepointMechanism.hpp"
22824
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
inline bool MacroAssembler::is_ld_largeoffset(address a) {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    36
  const int inst1 = *(int *)a;
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    37
  const int inst2 = *(int *)(a+4);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    38
  return (is_ld(inst1)) ||
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    39
         (is_addis(inst1) && is_ld(inst2) && inv_ra_field(inst2) == inv_rt_field(inst1));
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
inline int MacroAssembler::get_ld_largeoffset_offset(address a) {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    43
  assert(MacroAssembler::is_ld_largeoffset(a), "must be ld with large offset");
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
  const int inst1 = *(int *)a;
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    46
  if (is_ld(inst1)) {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    47
    return inv_d1_field(inst1);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    48
  } else {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    49
    const int inst2 = *(int *)(a+4);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    50
    return (inv_d1_field(inst1) << 16) + inv_d1_field(inst2);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    51
  }
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    52
}
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    53
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    54
inline void MacroAssembler::round_to(Register r, int modulus) {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    55
  assert(is_power_of_2_long((jlong)modulus), "must be power of 2");
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    56
  addi(r, r, modulus-1);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    57
  clrrdi(r, r, log2_long((jlong)modulus));
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    58
}
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    59
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    60
// 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
    61
inline void MacroAssembler::mr_if_needed(Register rd, Register rs) {
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 22852
diff changeset
    62
  if (rs != rd) mr(rd, rs);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 22852
diff changeset
    63
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 22852
diff changeset
    64
inline void MacroAssembler::fmr_if_needed(FloatRegister rd, FloatRegister rs) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 22852
diff changeset
    65
  if (rs != rd) fmr(rd, rs);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 22852
diff changeset
    66
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 22852
diff changeset
    67
inline void MacroAssembler::endgroup_if_needed(bool needed) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 22852
diff changeset
    68
  if (needed) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 22852
diff changeset
    69
    endgroup();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 22852
diff changeset
    70
  }
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    71
}
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    72
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 22852
diff changeset
    73
inline void MacroAssembler::membar(int bits) {
35085
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 31773
diff changeset
    74
  // Comment: Usage of elemental_membar(bits) is not recommended for Power 8.
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 31773
diff changeset
    75
  // If elemental_membar(bits) is used, disable optimization of acquire-release
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 31773
diff changeset
    76
  // (Matcher::post_membar_release where we use PPC64_ONLY(xop == Op_MemBarRelease ||))!
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 31773
diff changeset
    77
  if (bits & StoreLoad) { sync(); }
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 31773
diff changeset
    78
  else if (bits) { lwsync(); }
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 22852
diff changeset
    79
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 22852
diff changeset
    80
inline void MacroAssembler::release() { membar(LoadStore | StoreStore); }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 22852
diff changeset
    81
inline void MacroAssembler::acquire() { membar(LoadLoad | LoadStore); }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 22852
diff changeset
    82
inline void MacroAssembler::fence()   { membar(LoadLoad | LoadStore | StoreLoad | StoreStore); }
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 22852
diff changeset
    83
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    84
// Address of the global TOC.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    85
inline address MacroAssembler::global_toc() {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    86
  return CodeCache::low_bound();
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    87
}
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    88
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    89
// Offset of given address to the global TOC.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    90
inline int MacroAssembler::offset_to_global_toc(const address addr) {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    91
  intptr_t offset = (intptr_t)addr - (intptr_t)MacroAssembler::global_toc();
35085
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 31773
diff changeset
    92
  assert(Assembler::is_uimm((long)offset, 31), "must be in range");
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    93
  return (int)offset;
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    94
}
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
// Address of current method's TOC.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    97
inline address MacroAssembler::method_toc() {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    98
  return code()->consts()->start();
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    99
}
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   100
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   101
// Offset of given address to current method's TOC.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   102
inline int MacroAssembler::offset_to_method_toc(address addr) {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   103
  intptr_t offset = (intptr_t)addr - (intptr_t)method_toc();
35085
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 31773
diff changeset
   104
  assert(Assembler::is_uimm((long)offset, 31), "must be in range");
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   105
  return (int)offset;
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
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   108
inline bool MacroAssembler::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
   109
  const address inst2_addr = a;
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   110
  const int inst2 = *(int *) a;
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   111
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   112
  // The relocation points to the second instruction, the addi.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   113
  if (!is_addi(inst2)) return false;
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   114
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   115
  // The addi reads and writes the same register dst.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   116
  const int dst = inv_rt_field(inst2);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   117
  if (inv_ra_field(inst2) != dst) return false;
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   118
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   119
  // Now, find the preceding addis which writes to dst.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   120
  int inst1 = 0;
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   121
  address inst1_addr = inst2_addr - BytesPerInstWord;
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   122
  while (inst1_addr >= bound) {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   123
    inst1 = *(int *) inst1_addr;
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   124
    if (is_addis(inst1) && inv_rt_field(inst1) == dst) {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   125
      // stop, found the addis which writes dst
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   126
      break;
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
    inst1_addr -= BytesPerInstWord;
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   129
  }
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
  if (!(inst1 == 0 || inv_ra_field(inst1) == 29 /* R29 */)) return false;
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   132
  return is_addis(inst1);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   133
}
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   134
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   135
#ifdef _LP64
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   136
// Detect narrow oop constants.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   137
inline bool MacroAssembler::is_set_narrow_oop(address a, address bound) {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   138
  const address inst2_addr = a;
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   139
  const int inst2 = *(int *)a;
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 22852
diff changeset
   140
  // The relocation points to the second instruction, the ori.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 22852
diff changeset
   141
  if (!is_ori(inst2)) return false;
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   142
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 22852
diff changeset
   143
  // The ori reads and writes the same register dst.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 22852
diff changeset
   144
  const int dst = inv_rta_field(inst2);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 22852
diff changeset
   145
  if (inv_rs_field(inst2) != dst) return false;
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   146
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   147
  // Now, find the preceding addis which writes to dst.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   148
  int inst1 = 0;
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   149
  address inst1_addr = inst2_addr - BytesPerInstWord;
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   150
  while (inst1_addr >= bound) {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   151
    inst1 = *(int *) inst1_addr;
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   152
    if (is_lis(inst1) && inv_rs_field(inst1) == dst) return true;
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   153
    inst1_addr -= BytesPerInstWord;
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   154
  }
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   155
  return false;
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   156
}
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   157
#endif
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
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   160
inline bool MacroAssembler::is_load_const_at(address a) {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   161
  const int* p_inst = (int *) a;
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   162
  bool b = is_lis(*p_inst++);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   163
  if (is_ori(*p_inst)) {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   164
    p_inst++;
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   165
    b = b && is_rldicr(*p_inst++); // TODO: could be made more precise: `sldi'!
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   166
    b = b && is_oris(*p_inst++);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   167
    b = b && is_ori(*p_inst);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   168
  } else if (is_lis(*p_inst)) {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   169
    p_inst++;
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   170
    b = b && is_ori(*p_inst++);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   171
    b = b && is_ori(*p_inst);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   172
    // TODO: could enhance reliability by adding is_insrdi
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   173
  } else return false;
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   174
  return b;
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   175
}
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   176
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   177
inline void MacroAssembler::set_oop_constant(jobject obj, Register d) {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   178
  set_oop(constant_oop_address(obj), d);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   179
}
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   180
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   181
inline void MacroAssembler::set_oop(AddressLiteral obj_addr, Register d) {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   182
  assert(obj_addr.rspec().type() == relocInfo::oop_type, "must be an oop reloc");
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   183
  load_const(d, obj_addr);
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
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   186
inline void MacroAssembler::pd_patch_instruction(address branch, address target) {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   187
  jint& stub_inst = *(jint*) branch;
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   188
  stub_inst = patched_branch(target - branch, stub_inst, 0);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   189
}
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   190
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   191
// Relocation of conditional far branches.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   192
inline bool MacroAssembler::is_bc_far_variant1_at(address instruction_addr) {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   193
  // Variant 1, the 1st instruction contains the destination address:
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
  //    bcxx  DEST
35085
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 31773
diff changeset
   196
  //    nop
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   197
  //
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   198
  const int instruction_1 = *(int*)(instruction_addr);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   199
  const int instruction_2 = *(int*)(instruction_addr + 4);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   200
  return is_bcxx(instruction_1) &&
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   201
         (inv_bd_field(instruction_1, (intptr_t)instruction_addr) != (intptr_t)(instruction_addr + 2*4)) &&
35085
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 31773
diff changeset
   202
         is_nop(instruction_2);
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   203
}
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   204
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   205
// Relocation of conditional far branches.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   206
inline bool MacroAssembler::is_bc_far_variant2_at(address instruction_addr) {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   207
  // Variant 2, the 2nd instruction contains the destination address:
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   208
  //
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   209
  //    b!cxx SKIP
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   210
  //    bxx   DEST
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   211
  //  SKIP:
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
  const int instruction_1 = *(int*)(instruction_addr);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   214
  const int instruction_2 = *(int*)(instruction_addr + 4);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   215
  return is_bcxx(instruction_1) &&
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   216
         (inv_bd_field(instruction_1, (intptr_t)instruction_addr) == (intptr_t)(instruction_addr + 2*4)) &&
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   217
         is_bxx(instruction_2);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   218
}
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
// Relocation for conditional branches
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   221
inline bool MacroAssembler::is_bc_far_variant3_at(address instruction_addr) {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   222
  // Variant 3, far cond branch to the next instruction, already patched to nops:
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   223
  //
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   224
  //    nop
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   225
  //    endgroup
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   226
  //  SKIP/DEST:
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   227
  //
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   228
  const int instruction_1 = *(int*)(instruction_addr);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   229
  const int instruction_2 = *(int*)(instruction_addr + 4);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   230
  return is_nop(instruction_1) &&
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   231
         is_endgroup(instruction_2);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   232
}
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   233
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
// Convenience bc_far versions
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   236
inline void MacroAssembler::blt_far(ConditionRegister crx, Label& L, int optimize) { MacroAssembler::bc_far(bcondCRbiIs1, bi0(crx, less), L, optimize); }
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   237
inline void MacroAssembler::bgt_far(ConditionRegister crx, Label& L, int optimize) { MacroAssembler::bc_far(bcondCRbiIs1, bi0(crx, greater), L, optimize); }
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   238
inline void MacroAssembler::beq_far(ConditionRegister crx, Label& L, int optimize) { MacroAssembler::bc_far(bcondCRbiIs1, bi0(crx, equal), L, optimize); }
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   239
inline void MacroAssembler::bso_far(ConditionRegister crx, Label& L, int optimize) { MacroAssembler::bc_far(bcondCRbiIs1, bi0(crx, summary_overflow), L, optimize); }
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   240
inline void MacroAssembler::bge_far(ConditionRegister crx, Label& L, int optimize) { MacroAssembler::bc_far(bcondCRbiIs0, bi0(crx, less), L, optimize); }
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   241
inline void MacroAssembler::ble_far(ConditionRegister crx, Label& L, int optimize) { MacroAssembler::bc_far(bcondCRbiIs0, bi0(crx, greater), L, optimize); }
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   242
inline void MacroAssembler::bne_far(ConditionRegister crx, Label& L, int optimize) { MacroAssembler::bc_far(bcondCRbiIs0, bi0(crx, equal), L, optimize); }
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   243
inline void MacroAssembler::bns_far(ConditionRegister crx, Label& L, int optimize) { MacroAssembler::bc_far(bcondCRbiIs0, bi0(crx, summary_overflow), L, optimize); }
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   244
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   245
inline address MacroAssembler::call_stub(Register function_entry) {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   246
  mtctr(function_entry);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   247
  bctrl();
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   248
  return pc();
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   249
}
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   250
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   251
inline void MacroAssembler::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
   252
  assert_different_registers(function_entry, return_pc);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   253
  mtlr(return_pc);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   254
  mtctr(function_entry);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   255
  bctr();
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
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   258
// Get the pc where the last emitted call will return to.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   259
inline address MacroAssembler::last_calls_return_pc() {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   260
  return _last_calls_return_pc;
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   261
}
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   262
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   263
// 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
   264
inline void MacroAssembler::load_from_polling_page(Register polling_page_address, int offset) {
48506
478e77658965 8194258: PPC64 safepoint mechanism: Fix initialization on AIX and support SIGTRAP
mdoerr
parents: 47216
diff changeset
   265
  if (SafepointMechanism::uses_thread_local_poll() && USE_POLL_BIT_ONLY) {
478e77658965 8194258: PPC64 safepoint mechanism: Fix initialization on AIX and support SIGTRAP
mdoerr
parents: 47216
diff changeset
   266
    int encoding = SafepointMechanism::poll_bit();
478e77658965 8194258: PPC64 safepoint mechanism: Fix initialization on AIX and support SIGTRAP
mdoerr
parents: 47216
diff changeset
   267
    tdi(traptoGreaterThanUnsigned | traptoEqual, polling_page_address, encoding);
478e77658965 8194258: PPC64 safepoint mechanism: Fix initialization on AIX and support SIGTRAP
mdoerr
parents: 47216
diff changeset
   268
  } else {
478e77658965 8194258: PPC64 safepoint mechanism: Fix initialization on AIX and support SIGTRAP
mdoerr
parents: 47216
diff changeset
   269
    ld(R0, offset, polling_page_address);
478e77658965 8194258: PPC64 safepoint mechanism: Fix initialization on AIX and support SIGTRAP
mdoerr
parents: 47216
diff changeset
   270
  }
22824
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
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   273
// Trap-instruction-based checks.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   274
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   275
inline void MacroAssembler::trap_null_check(Register a, trap_to_bits cmp) {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   276
  assert(TrapBasedNullChecks, "sanity");
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   277
  tdi(cmp, a/*reg a*/, 0);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   278
}
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   279
inline void MacroAssembler::trap_zombie_not_entrant() {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   280
  tdi(traptoUnconditional, 0/*reg 0*/, 1);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   281
}
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   282
inline void MacroAssembler::trap_should_not_reach_here() {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   283
  tdi_unchecked(traptoUnconditional, 0/*reg 0*/, 2);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   284
}
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
inline void MacroAssembler::trap_ic_miss_check(Register a, Register b) {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   287
  td(traptoGreaterThanUnsigned | traptoLessThanUnsigned, a, b);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   288
}
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
// Do an explicit null check if access to a+offset will not raise a SIGSEGV.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   291
// Either issue a trap instruction that raises SIGTRAP, or do a compare that
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   292
// branches to exception_entry.
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 22852
diff changeset
   293
// No support for compressed oops (base page of heap). Does not distinguish
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   294
// loads and stores.
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 22852
diff changeset
   295
inline void MacroAssembler::null_check_throw(Register a, int offset, Register temp_reg,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 22852
diff changeset
   296
                                             address exception_entry) {
22852
1063026e8cee 8028471: PPC64 (part 215): opto: Extend ImplicitNullCheck optimization.
goetz
parents: 22824
diff changeset
   297
  if (!ImplicitNullChecks || needs_explicit_null_check(offset) || !os::zero_page_read_protected()) {
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   298
    if (TrapBasedNullChecks) {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   299
      assert(UseSIGTRAP, "sanity");
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   300
      trap_null_check(a);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   301
    } else {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   302
      Label ok;
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   303
      cmpdi(CCR0, a, 0);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   304
      bne(CCR0, ok);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   305
      load_const_optimized(temp_reg, exception_entry);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   306
      mtctr(temp_reg);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   307
      bctr();
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   308
      bind(ok);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   309
    }
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   310
  }
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
35085
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 31773
diff changeset
   313
inline void MacroAssembler::null_check(Register a, int offset, Label *Lis_null) {
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 31773
diff changeset
   314
  if (!ImplicitNullChecks || needs_explicit_null_check(offset) || !os::zero_page_read_protected()) {
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   315
    if (TrapBasedNullChecks) {
35085
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 31773
diff changeset
   316
      assert(UseSIGTRAP, "sanity");
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 31773
diff changeset
   317
      trap_null_check(a);
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 31773
diff changeset
   318
    } else if (Lis_null){
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 31773
diff changeset
   319
      Label ok;
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 31773
diff changeset
   320
      cmpdi(CCR0, a, 0);
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 31773
diff changeset
   321
      beq(CCR0, *Lis_null);
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   322
    }
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   323
  }
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   324
}
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   325
28617
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 23221
diff changeset
   326
inline void MacroAssembler::load_heap_oop_not_null(Register d, RegisterOrConstant offs, Register s1, Register tmp) {
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   327
  if (UseCompressedOops) {
28617
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 23221
diff changeset
   328
    // In disjoint mode decoding can save a cycle if src != dst.
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 23221
diff changeset
   329
    Register narrowOop = (tmp != noreg && Universe::narrow_oop_base_disjoint()) ? tmp : d;
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 23221
diff changeset
   330
    lwz(narrowOop, offs, s1);
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   331
    // Attention: no null check here!
28617
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 23221
diff changeset
   332
    Register res = decode_heap_oop_not_null(d, narrowOop);
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 23221
diff changeset
   333
    assert(res == d, "caller will not consume loaded value");
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   334
  } else {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   335
    ld(d, offs, s1);
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
}
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   338
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 23211
diff changeset
   339
inline void MacroAssembler::store_heap_oop_not_null(Register d, RegisterOrConstant offs, Register s1, Register tmp) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 23211
diff changeset
   340
  if (UseCompressedOops) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 23211
diff changeset
   341
    Register compressedOop = encode_heap_oop_not_null((tmp != noreg) ? tmp : d, d);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 23211
diff changeset
   342
    stw(compressedOop, offs, s1);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 23211
diff changeset
   343
  } else {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 23211
diff changeset
   344
    std(d, offs, s1);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 23211
diff changeset
   345
  }
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 23211
diff changeset
   346
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 23211
diff changeset
   347
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 28617
diff changeset
   348
inline void MacroAssembler::load_heap_oop(Register d, RegisterOrConstant offs, Register s1, Label *is_null) {
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   349
  if (UseCompressedOops) {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   350
    lwz(d, offs, s1);
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 28617
diff changeset
   351
    if (is_null != NULL) {
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 28617
diff changeset
   352
      cmpwi(CCR0, d, 0);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 28617
diff changeset
   353
      beq(CCR0, *is_null);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 28617
diff changeset
   354
      decode_heap_oop_not_null(d);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 28617
diff changeset
   355
    } else {
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 28617
diff changeset
   356
      decode_heap_oop(d);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 28617
diff changeset
   357
    }
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   358
  } else {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   359
    ld(d, offs, s1);
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 28617
diff changeset
   360
    if (is_null != NULL) {
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 28617
diff changeset
   361
      cmpdi(CCR0, d, 0);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 28617
diff changeset
   362
      beq(CCR0, *is_null);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 28617
diff changeset
   363
    }
22824
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
}
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   366
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 23211
diff changeset
   367
inline Register MacroAssembler::encode_heap_oop_not_null(Register d, Register src) {
28617
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 23221
diff changeset
   368
  Register current = (src != noreg) ? src : d; // Oop to be compressed is in d if no src provided.
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 23221
diff changeset
   369
  if (Universe::narrow_oop_base_overlaps()) {
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 28617
diff changeset
   370
    sub_const_optimized(d, current, Universe::narrow_oop_base(), R0);
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 23211
diff changeset
   371
    current = d;
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   372
  }
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   373
  if (Universe::narrow_oop_shift() != 0) {
28617
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 23221
diff changeset
   374
    rldicl(d, current, 64-Universe::narrow_oop_shift(), 32);  // Clears the upper bits.
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 23211
diff changeset
   375
    current = d;
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   376
  }
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 23211
diff changeset
   377
  return current; // Encoded oop is in this register.
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   378
}
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   379
35085
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 31773
diff changeset
   380
inline Register MacroAssembler::encode_heap_oop(Register d, Register src) {
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 31773
diff changeset
   381
  if (Universe::narrow_oop_base() != NULL) {
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 31773
diff changeset
   382
    if (VM_Version::has_isel()) {
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 31773
diff changeset
   383
      cmpdi(CCR0, src, 0);
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 31773
diff changeset
   384
      Register co = encode_heap_oop_not_null(d, src);
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 31773
diff changeset
   385
      assert(co == d, "sanity");
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 31773
diff changeset
   386
      isel_0(d, CCR0, Assembler::equal);
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 31773
diff changeset
   387
    } else {
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 31773
diff changeset
   388
      Label isNull;
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 31773
diff changeset
   389
      or_(d, src, src); // move and compare 0
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 31773
diff changeset
   390
      beq(CCR0, isNull);
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 31773
diff changeset
   391
      encode_heap_oop_not_null(d, src);
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 31773
diff changeset
   392
      bind(isNull);
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 31773
diff changeset
   393
    }
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 31773
diff changeset
   394
    return d;
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 31773
diff changeset
   395
  } else {
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 31773
diff changeset
   396
    return encode_heap_oop_not_null(d, src);
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 31773
diff changeset
   397
  }
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 31773
diff changeset
   398
}
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 31773
diff changeset
   399
28617
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 23221
diff changeset
   400
inline Register MacroAssembler::decode_heap_oop_not_null(Register d, Register src) {
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 23221
diff changeset
   401
  if (Universe::narrow_oop_base_disjoint() && src != noreg && src != d &&
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 23221
diff changeset
   402
      Universe::narrow_oop_shift() != 0) {
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 28617
diff changeset
   403
    load_const_optimized(d, Universe::narrow_oop_base(), R0);
28617
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 23221
diff changeset
   404
    rldimi(d, src, Universe::narrow_oop_shift(), 32-Universe::narrow_oop_shift());
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 23221
diff changeset
   405
    return d;
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 23221
diff changeset
   406
  }
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 23221
diff changeset
   407
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 23221
diff changeset
   408
  Register current = (src != noreg) ? src : d; // Compressed oop is in d if no src provided.
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   409
  if (Universe::narrow_oop_shift() != 0) {
28617
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 23221
diff changeset
   410
    sldi(d, current, Universe::narrow_oop_shift());
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 23221
diff changeset
   411
    current = d;
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   412
  }
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   413
  if (Universe::narrow_oop_base() != NULL) {
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 28617
diff changeset
   414
    add_const_optimized(d, current, Universe::narrow_oop_base(), R0);
28617
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 23221
diff changeset
   415
    current = d;
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   416
  }
28617
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 23221
diff changeset
   417
  return current; // Decoded oop is in this register.
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   418
}
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   419
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   420
inline void MacroAssembler::decode_heap_oop(Register d) {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   421
  Label isNull;
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 28617
diff changeset
   422
  bool use_isel = false;
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   423
  if (Universe::narrow_oop_base() != NULL) {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   424
    cmpwi(CCR0, d, 0);
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 28617
diff changeset
   425
    if (VM_Version::has_isel()) {
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 28617
diff changeset
   426
      use_isel = true;
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 28617
diff changeset
   427
    } else {
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 28617
diff changeset
   428
      beq(CCR0, isNull);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 28617
diff changeset
   429
    }
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   430
  }
28617
12ae756253c2 8068503: ppc64: Encode/Decode nodes for disjoint cOops mode
goetz
parents: 23221
diff changeset
   431
  decode_heap_oop_not_null(d);
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 28617
diff changeset
   432
  if (use_isel) {
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 28617
diff changeset
   433
    isel_0(d, CCR0, Assembler::equal);
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 28617
diff changeset
   434
  }
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   435
  bind(isNull);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   436
}
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   437
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   438
// SIGTRAP-based range checks for arrays.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   439
inline void MacroAssembler::trap_range_check_l(Register a, Register b) {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   440
  tw (traptoLessThanUnsigned,                  a/*reg a*/, b/*reg b*/);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   441
}
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   442
inline void MacroAssembler::trap_range_check_l(Register a, int si16) {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   443
  twi(traptoLessThanUnsigned,                  a/*reg a*/, si16);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   444
}
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   445
inline void MacroAssembler::trap_range_check_le(Register a, int si16) {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   446
  twi(traptoEqual | traptoLessThanUnsigned,    a/*reg a*/, si16);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   447
}
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   448
inline void MacroAssembler::trap_range_check_g(Register a, int si16) {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   449
  twi(traptoGreaterThanUnsigned,               a/*reg a*/, si16);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   450
}
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   451
inline void MacroAssembler::trap_range_check_ge(Register a, Register b) {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   452
  tw (traptoEqual | traptoGreaterThanUnsigned, a/*reg a*/, b/*reg b*/);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   453
}
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   454
inline void MacroAssembler::trap_range_check_ge(Register a, int si16) {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   455
  twi(traptoEqual | traptoGreaterThanUnsigned, a/*reg a*/, si16);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   456
}
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   457
31773
f874931cbae7 8130653: ppc: implement MultiplyToLen intrinsic
goetz
parents: 30303
diff changeset
   458
// unsigned integer multiplication 64*64 -> 128 bits
f874931cbae7 8130653: ppc: implement MultiplyToLen intrinsic
goetz
parents: 30303
diff changeset
   459
inline void MacroAssembler::multiply64(Register dest_hi, Register dest_lo,
f874931cbae7 8130653: ppc: implement MultiplyToLen intrinsic
goetz
parents: 30303
diff changeset
   460
                                       Register x, Register y) {
f874931cbae7 8130653: ppc: implement MultiplyToLen intrinsic
goetz
parents: 30303
diff changeset
   461
  mulld(dest_lo, x, y);
f874931cbae7 8130653: ppc: implement MultiplyToLen intrinsic
goetz
parents: 30303
diff changeset
   462
  mulhdu(dest_hi, x, y);
f874931cbae7 8130653: ppc: implement MultiplyToLen intrinsic
goetz
parents: 30303
diff changeset
   463
}
f874931cbae7 8130653: ppc: implement MultiplyToLen intrinsic
goetz
parents: 30303
diff changeset
   464
23211
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22861
diff changeset
   465
#if defined(ABI_ELFv2)
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22861
diff changeset
   466
inline address MacroAssembler::function_entry() { return pc(); }
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22861
diff changeset
   467
#else
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22861
diff changeset
   468
inline address MacroAssembler::function_entry() { return emit_fd(); }
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22861
diff changeset
   469
#endif
954e3a81da29 8035647: PPC64: Support for elf v2 abi.
goetz
parents: 22861
diff changeset
   470
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   471
#endif // CPU_PPC_VM_MACROASSEMBLER_PPC_INLINE_HPP