src/hotspot/cpu/ppc/interp_masm_ppc_64.cpp
author coleenp
Wed, 21 Mar 2018 19:45:24 -0400
changeset 49480 d7df2dd501ce
parent 48965 be873d8c0114
child 49748 6a880e576856
permissions -rw-r--r--
8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files Summary: Remove frame.inline.hpp,etc from header files and adjust transitive includes. Reviewed-by: stefank, stuefe
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
/*
48626
9f6f48d4f9a1 8194814: [ppc, s390] A row of minor fixes and cleanups
goetz
parents: 48332
diff changeset
     2
 * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
9f6f48d4f9a1 8194814: [ppc, s390] A row of minor fixes and cleanups
goetz
parents: 48332
diff changeset
     3
 * Copyright (c) 2012, 2018 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
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    27
#include "precompiled.hpp"
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    28
#include "asm/macroAssembler.inline.hpp"
40010
e32d5e545789 8161258: Simplify including platform files.
goetz
parents: 39390
diff changeset
    29
#include "interp_masm_ppc.hpp"
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    30
#include "interpreter/interpreterRuntime.hpp"
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
    31
#include "prims/jvmtiThreadState.hpp"
49480
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents: 48965
diff changeset
    32
#include "runtime/frame.inline.hpp"
48332
651a95f30dfb 8193257: PPC64, s390 implementation for Thread-local handshakes
mdoerr
parents: 47634
diff changeset
    33
#include "runtime/safepointMechanism.hpp"
29080
a16b0d9a08f5 8072910: Move the g1EvacFailure.hpp implementation to g1EvacFailure.cpp
stefank
parents: 28492
diff changeset
    34
#include "runtime/sharedRuntime.hpp"
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    35
48626
9f6f48d4f9a1 8194814: [ppc, s390] A row of minor fixes and cleanups
goetz
parents: 48332
diff changeset
    36
// Implementation of InterpreterMacroAssembler.
9f6f48d4f9a1 8194814: [ppc, s390] A row of minor fixes and cleanups
goetz
parents: 48332
diff changeset
    37
9f6f48d4f9a1 8194814: [ppc, s390] A row of minor fixes and cleanups
goetz
parents: 48332
diff changeset
    38
// This file specializes the assembler with interpreter-specific macros.
9f6f48d4f9a1 8194814: [ppc, s390] A row of minor fixes and cleanups
goetz
parents: 48332
diff changeset
    39
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    40
#ifdef PRODUCT
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    41
#define BLOCK_COMMENT(str) // nothing
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    42
#else
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    43
#define BLOCK_COMMENT(str) block_comment(str)
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    44
#endif
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    45
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 22824
diff changeset
    46
void InterpreterMacroAssembler::null_check_throw(Register a, int offset, Register temp_reg) {
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 22824
diff changeset
    47
  address exception_entry = Interpreter::throw_NullPointerException_entry();
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 22824
diff changeset
    48
  MacroAssembler::null_check_throw(a, offset, temp_reg, exception_entry);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 22824
diff changeset
    49
}
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 22824
diff changeset
    50
33070
54f3f085b165 8136525: Generate interpreter entries only once and avoid unnecessary jump to jump
mdoerr
parents: 32074
diff changeset
    51
void InterpreterMacroAssembler::jump_to_entry(address entry, Register Rscratch) {
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
    52
  assert(entry, "Entry must have been generated by now");
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
    53
  if (is_within_range_of_b(entry, pc())) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
    54
    b(entry);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
    55
  } else {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
    56
    load_const_optimized(Rscratch, entry, R0);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
    57
    mtctr(Rscratch);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
    58
    bctr();
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
    59
  }
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
    60
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
    61
48332
651a95f30dfb 8193257: PPC64, s390 implementation for Thread-local handshakes
mdoerr
parents: 47634
diff changeset
    62
void InterpreterMacroAssembler::dispatch_next(TosState state, int bcp_incr, bool generate_poll) {
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
    63
  Register bytecode = R12_scratch2;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
    64
  if (bcp_incr != 0) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
    65
    lbzu(bytecode, bcp_incr, R14_bcp);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
    66
  } else {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
    67
    lbz(bytecode, 0, R14_bcp);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
    68
  }
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
    69
48332
651a95f30dfb 8193257: PPC64, s390 implementation for Thread-local handshakes
mdoerr
parents: 47634
diff changeset
    70
  dispatch_Lbyte_code(state, bytecode, Interpreter::dispatch_table(state), generate_poll);
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
    71
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
    72
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
    73
void InterpreterMacroAssembler::dispatch_via(TosState state, address* table) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
    74
  // Load current bytecode.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
    75
  Register bytecode = R12_scratch2;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
    76
  lbz(bytecode, 0, R14_bcp);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
    77
  dispatch_Lbyte_code(state, bytecode, table);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
    78
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
    79
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
    80
// Dispatch code executed in the prolog of a bytecode which does not do it's
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
    81
// own dispatch. The dispatch address is computed and placed in R24_dispatch_addr.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
    82
void InterpreterMacroAssembler::dispatch_prolog(TosState state, int bcp_incr) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
    83
  Register bytecode = R12_scratch2;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
    84
  lbz(bytecode, bcp_incr, R14_bcp);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
    85
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
    86
  load_dispatch_table(R24_dispatch_addr, Interpreter::dispatch_table(state));
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
    87
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
    88
  sldi(bytecode, bytecode, LogBytesPerWord);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
    89
  ldx(R24_dispatch_addr, R24_dispatch_addr, bytecode);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
    90
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
    91
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
    92
// Dispatch code executed in the epilog of a bytecode which does not do it's
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
    93
// own dispatch. The dispatch address in R24_dispatch_addr is used for the
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
    94
// dispatch.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
    95
void InterpreterMacroAssembler::dispatch_epilog(TosState state, int bcp_incr) {
35085
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 33083
diff changeset
    96
  if (bcp_incr) { addi(R14_bcp, R14_bcp, bcp_incr); }
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
    97
  mtctr(R24_dispatch_addr);
35085
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 33083
diff changeset
    98
  bcctr(bcondAlways, 0, bhintbhBCCTRisNotPredictable);
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
    99
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   100
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   101
void InterpreterMacroAssembler::check_and_handle_popframe(Register scratch_reg) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   102
  assert(scratch_reg != R0, "can't use R0 as scratch_reg here");
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   103
  if (JvmtiExport::can_pop_frame()) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   104
    Label L;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   105
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   106
    // Check the "pending popframe condition" flag in the current thread.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   107
    lwz(scratch_reg, in_bytes(JavaThread::popframe_condition_offset()), R16_thread);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   108
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   109
    // Initiate popframe handling only if it is not already being
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   110
    // processed. If the flag has the popframe_processing bit set, it
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   111
    // means that this code is called *during* popframe handling - we
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   112
    // don't want to reenter.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   113
    andi_(R0, scratch_reg, JavaThread::popframe_pending_bit);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   114
    beq(CCR0, L);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   115
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   116
    andi_(R0, scratch_reg, JavaThread::popframe_processing_bit);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   117
    bne(CCR0, L);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   118
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   119
    // Call the Interpreter::remove_activation_preserving_args_entry()
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   120
    // func to get the address of the same-named entrypoint in the
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   121
    // generated interpreter code.
25916
c5c22fab48fd 8050942: PPC64: implement template interpreter for ppc64le
kvn
parents: 24322
diff changeset
   122
#if defined(ABI_ELFv2)
c5c22fab48fd 8050942: PPC64: implement template interpreter for ppc64le
kvn
parents: 24322
diff changeset
   123
    call_c(CAST_FROM_FN_PTR(address,
c5c22fab48fd 8050942: PPC64: implement template interpreter for ppc64le
kvn
parents: 24322
diff changeset
   124
                            Interpreter::remove_activation_preserving_args_entry),
c5c22fab48fd 8050942: PPC64: implement template interpreter for ppc64le
kvn
parents: 24322
diff changeset
   125
           relocInfo::none);
c5c22fab48fd 8050942: PPC64: implement template interpreter for ppc64le
kvn
parents: 24322
diff changeset
   126
#else
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   127
    call_c(CAST_FROM_FN_PTR(FunctionDescriptor*,
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   128
                            Interpreter::remove_activation_preserving_args_entry),
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   129
           relocInfo::none);
25916
c5c22fab48fd 8050942: PPC64: implement template interpreter for ppc64le
kvn
parents: 24322
diff changeset
   130
#endif
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   131
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   132
    // Jump to Interpreter::_remove_activation_preserving_args_entry.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   133
    mtctr(R3_RET);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   134
    bctr();
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   135
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   136
    align(32, 12);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   137
    bind(L);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   138
  }
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   139
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   140
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   141
void InterpreterMacroAssembler::check_and_handle_earlyret(Register scratch_reg) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   142
  const Register Rthr_state_addr = scratch_reg;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   143
  if (JvmtiExport::can_force_early_return()) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   144
    Label Lno_early_ret;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   145
    ld(Rthr_state_addr, in_bytes(JavaThread::jvmti_thread_state_offset()), R16_thread);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   146
    cmpdi(CCR0, Rthr_state_addr, 0);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   147
    beq(CCR0, Lno_early_ret);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   148
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   149
    lwz(R0, in_bytes(JvmtiThreadState::earlyret_state_offset()), Rthr_state_addr);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   150
    cmpwi(CCR0, R0, JvmtiThreadState::earlyret_pending);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   151
    bne(CCR0, Lno_early_ret);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   152
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   153
    // Jump to Interpreter::_earlyret_entry.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   154
    lwz(R3_ARG1, in_bytes(JvmtiThreadState::earlyret_tos_offset()), Rthr_state_addr);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   155
    call_VM_leaf(CAST_FROM_FN_PTR(address, Interpreter::remove_activation_early_entry));
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   156
    mtlr(R3_RET);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   157
    blr();
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   158
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   159
    align(32, 12);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   160
    bind(Lno_early_ret);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   161
  }
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   162
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   163
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   164
void InterpreterMacroAssembler::load_earlyret_value(TosState state, Register Rscratch1) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   165
  const Register RjvmtiState = Rscratch1;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   166
  const Register Rscratch2   = R0;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   167
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   168
  ld(RjvmtiState, in_bytes(JavaThread::jvmti_thread_state_offset()), R16_thread);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   169
  li(Rscratch2, 0);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   170
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   171
  switch (state) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   172
    case atos: ld(R17_tos, in_bytes(JvmtiThreadState::earlyret_oop_offset()), RjvmtiState);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   173
               std(Rscratch2, in_bytes(JvmtiThreadState::earlyret_oop_offset()), RjvmtiState);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   174
               break;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   175
    case ltos: ld(R17_tos, in_bytes(JvmtiThreadState::earlyret_value_offset()), RjvmtiState);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   176
               break;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   177
    case btos: // fall through
37488
ab63cdc0e14e 8154867: PPC64: Better byte behavior
mdoerr
parents: 35232
diff changeset
   178
    case ztos: // fall through
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   179
    case ctos: // fall through
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   180
    case stos: // fall through
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   181
    case itos: lwz(R17_tos, in_bytes(JvmtiThreadState::earlyret_value_offset()), RjvmtiState);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   182
               break;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   183
    case ftos: lfs(F15_ftos, in_bytes(JvmtiThreadState::earlyret_value_offset()), RjvmtiState);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   184
               break;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   185
    case dtos: lfd(F15_ftos, in_bytes(JvmtiThreadState::earlyret_value_offset()), RjvmtiState);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   186
               break;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   187
    case vtos: break;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   188
    default  : ShouldNotReachHere();
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   189
  }
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   190
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   191
  // Clean up tos value in the jvmti thread state.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   192
  std(Rscratch2, in_bytes(JvmtiThreadState::earlyret_value_offset()), RjvmtiState);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   193
  // Set tos state field to illegal value.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   194
  li(Rscratch2, ilgl);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   195
  stw(Rscratch2, in_bytes(JvmtiThreadState::earlyret_tos_offset()), RjvmtiState);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   196
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   197
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   198
// Common code to dispatch and dispatch_only.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   199
// Dispatch value in Lbyte_code and increment Lbcp.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   200
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   201
void InterpreterMacroAssembler::load_dispatch_table(Register dst, address* table) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   202
  address table_base = (address)Interpreter::dispatch_table((TosState)0);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   203
  intptr_t table_offs = (intptr_t)table - (intptr_t)table_base;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   204
  if (is_simm16(table_offs)) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   205
    addi(dst, R25_templateTableBase, (int)table_offs);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   206
  } else {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   207
    load_const_optimized(dst, table, R0);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   208
  }
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   209
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   210
35166
23125410af16 8145117: PPC64: Remove cpp interpreter implementation
goetz
parents: 33083
diff changeset
   211
void InterpreterMacroAssembler::dispatch_Lbyte_code(TosState state, Register bytecode,
48332
651a95f30dfb 8193257: PPC64, s390 implementation for Thread-local handshakes
mdoerr
parents: 47634
diff changeset
   212
                                                    address* table, bool generate_poll) {
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   213
  assert_different_registers(bytecode, R11_scratch1);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   214
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   215
  // Calc dispatch table address.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   216
  load_dispatch_table(R11_scratch1, table);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   217
48332
651a95f30dfb 8193257: PPC64, s390 implementation for Thread-local handshakes
mdoerr
parents: 47634
diff changeset
   218
  if (SafepointMechanism::uses_thread_local_poll() && generate_poll) {
651a95f30dfb 8193257: PPC64, s390 implementation for Thread-local handshakes
mdoerr
parents: 47634
diff changeset
   219
    address *sfpt_tbl = Interpreter::safept_table(state);
651a95f30dfb 8193257: PPC64, s390 implementation for Thread-local handshakes
mdoerr
parents: 47634
diff changeset
   220
    if (table != sfpt_tbl) {
651a95f30dfb 8193257: PPC64, s390 implementation for Thread-local handshakes
mdoerr
parents: 47634
diff changeset
   221
      Label dispatch;
651a95f30dfb 8193257: PPC64, s390 implementation for Thread-local handshakes
mdoerr
parents: 47634
diff changeset
   222
      ld(R0, in_bytes(Thread::polling_page_offset()), R16_thread);
651a95f30dfb 8193257: PPC64, s390 implementation for Thread-local handshakes
mdoerr
parents: 47634
diff changeset
   223
      // Armed page has poll_bit set, if poll bit is cleared just continue.
651a95f30dfb 8193257: PPC64, s390 implementation for Thread-local handshakes
mdoerr
parents: 47634
diff changeset
   224
      andi_(R0, R0, SafepointMechanism::poll_bit());
651a95f30dfb 8193257: PPC64, s390 implementation for Thread-local handshakes
mdoerr
parents: 47634
diff changeset
   225
      beq(CCR0, dispatch);
651a95f30dfb 8193257: PPC64, s390 implementation for Thread-local handshakes
mdoerr
parents: 47634
diff changeset
   226
      load_dispatch_table(R11_scratch1, sfpt_tbl);
651a95f30dfb 8193257: PPC64, s390 implementation for Thread-local handshakes
mdoerr
parents: 47634
diff changeset
   227
      align(32, 16);
651a95f30dfb 8193257: PPC64, s390 implementation for Thread-local handshakes
mdoerr
parents: 47634
diff changeset
   228
      bind(dispatch);
651a95f30dfb 8193257: PPC64, s390 implementation for Thread-local handshakes
mdoerr
parents: 47634
diff changeset
   229
    }
651a95f30dfb 8193257: PPC64, s390 implementation for Thread-local handshakes
mdoerr
parents: 47634
diff changeset
   230
  }
651a95f30dfb 8193257: PPC64, s390 implementation for Thread-local handshakes
mdoerr
parents: 47634
diff changeset
   231
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   232
  sldi(R12_scratch2, bytecode, LogBytesPerWord);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   233
  ldx(R11_scratch1, R11_scratch1, R12_scratch2);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   234
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   235
  // Jump off!
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   236
  mtctr(R11_scratch1);
35085
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 33083
diff changeset
   237
  bcctr(bcondAlways, 0, bhintbhBCCTRisNotPredictable);
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   238
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   239
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   240
void InterpreterMacroAssembler::load_receiver(Register Rparam_count, Register Rrecv_dst) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   241
  sldi(Rrecv_dst, Rparam_count, Interpreter::logStackElementSize);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   242
  ldx(Rrecv_dst, Rrecv_dst, R15_esp);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   243
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   244
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   245
// helpers for expression stack
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   246
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   247
void InterpreterMacroAssembler::pop_i(Register r) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   248
  lwzu(r, Interpreter::stackElementSize, R15_esp);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   249
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   250
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   251
void InterpreterMacroAssembler::pop_ptr(Register r) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   252
  ldu(r, Interpreter::stackElementSize, R15_esp);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   253
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   254
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   255
void InterpreterMacroAssembler::pop_l(Register r) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   256
  ld(r, Interpreter::stackElementSize, R15_esp);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   257
  addi(R15_esp, R15_esp, 2 * Interpreter::stackElementSize);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   258
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   259
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   260
void InterpreterMacroAssembler::pop_f(FloatRegister f) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   261
  lfsu(f, Interpreter::stackElementSize, R15_esp);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   262
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   263
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   264
void InterpreterMacroAssembler::pop_d(FloatRegister f) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   265
  lfd(f, Interpreter::stackElementSize, R15_esp);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   266
  addi(R15_esp, R15_esp, 2 * Interpreter::stackElementSize);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   267
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   268
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   269
void InterpreterMacroAssembler::push_i(Register r) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   270
  stw(r, 0, R15_esp);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   271
  addi(R15_esp, R15_esp, - Interpreter::stackElementSize );
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   272
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   273
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   274
void InterpreterMacroAssembler::push_ptr(Register r) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   275
  std(r, 0, R15_esp);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   276
  addi(R15_esp, R15_esp, - Interpreter::stackElementSize );
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   277
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   278
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   279
void InterpreterMacroAssembler::push_l(Register r) {
41342
18c64f6a5cc3 8166765: [ppc] Port "8163014: Mysterious/wrong value for long frame local variable on 64-bit"
goetz
parents: 40010
diff changeset
   280
  // Clear unused slot.
18c64f6a5cc3 8166765: [ppc] Port "8163014: Mysterious/wrong value for long frame local variable on 64-bit"
goetz
parents: 40010
diff changeset
   281
  load_const_optimized(R0, 0L);
18c64f6a5cc3 8166765: [ppc] Port "8163014: Mysterious/wrong value for long frame local variable on 64-bit"
goetz
parents: 40010
diff changeset
   282
  std(R0, 0, R15_esp);
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   283
  std(r, - Interpreter::stackElementSize, R15_esp);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   284
  addi(R15_esp, R15_esp, - 2 * Interpreter::stackElementSize );
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   285
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   286
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   287
void InterpreterMacroAssembler::push_f(FloatRegister f) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   288
  stfs(f, 0, R15_esp);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   289
  addi(R15_esp, R15_esp, - Interpreter::stackElementSize );
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   290
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   291
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   292
void InterpreterMacroAssembler::push_d(FloatRegister f)   {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   293
  stfd(f, - Interpreter::stackElementSize, R15_esp);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   294
  addi(R15_esp, R15_esp, - 2 * Interpreter::stackElementSize );
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   295
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   296
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   297
void InterpreterMacroAssembler::push_2ptrs(Register first, Register second) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   298
  std(first, 0, R15_esp);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   299
  std(second, -Interpreter::stackElementSize, R15_esp);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   300
  addi(R15_esp, R15_esp, - 2 * Interpreter::stackElementSize );
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   301
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   302
46615
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46427
diff changeset
   303
void InterpreterMacroAssembler::move_l_to_d(Register l, FloatRegister d) {
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46427
diff changeset
   304
  if (VM_Version::has_mtfprd()) {
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46427
diff changeset
   305
    mtfprd(d, l);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46427
diff changeset
   306
  } else {
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46427
diff changeset
   307
    std(l, 0, R15_esp);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46427
diff changeset
   308
    lfd(d, 0, R15_esp);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46427
diff changeset
   309
  }
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   310
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   311
46615
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46427
diff changeset
   312
void InterpreterMacroAssembler::move_d_to_l(FloatRegister d, Register l) {
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46427
diff changeset
   313
  if (VM_Version::has_mtfprd()) {
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46427
diff changeset
   314
    mffprd(l, d);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46427
diff changeset
   315
  } else {
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46427
diff changeset
   316
    stfd(d, 0, R15_esp);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46427
diff changeset
   317
    ld(l, 0, R15_esp);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46427
diff changeset
   318
  }
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   319
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   320
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   321
void InterpreterMacroAssembler::push(TosState state) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   322
  switch (state) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   323
    case atos: push_ptr();                break;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   324
    case btos:
37488
ab63cdc0e14e 8154867: PPC64: Better byte behavior
mdoerr
parents: 35232
diff changeset
   325
    case ztos:
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   326
    case ctos:
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   327
    case stos:
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   328
    case itos: push_i();                  break;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   329
    case ltos: push_l();                  break;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   330
    case ftos: push_f();                  break;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   331
    case dtos: push_d();                  break;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   332
    case vtos: /* nothing to do */        break;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   333
    default  : ShouldNotReachHere();
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   334
  }
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   335
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   336
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   337
void InterpreterMacroAssembler::pop(TosState state) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   338
  switch (state) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   339
    case atos: pop_ptr();            break;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   340
    case btos:
37488
ab63cdc0e14e 8154867: PPC64: Better byte behavior
mdoerr
parents: 35232
diff changeset
   341
    case ztos:
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   342
    case ctos:
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   343
    case stos:
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   344
    case itos: pop_i();              break;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   345
    case ltos: pop_l();              break;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   346
    case ftos: pop_f();              break;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   347
    case dtos: pop_d();              break;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   348
    case vtos: /* nothing to do */   break;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   349
    default  : ShouldNotReachHere();
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   350
  }
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   351
  verify_oop(R17_tos, state);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   352
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   353
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   354
void InterpreterMacroAssembler::empty_expression_stack() {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   355
  addi(R15_esp, R26_monitor, - Interpreter::stackElementSize);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   356
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   357
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   358
void InterpreterMacroAssembler::get_2_byte_integer_at_bcp(int         bcp_offset,
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   359
                                                          Register    Rdst,
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   360
                                                          signedOrNot is_signed) {
25916
c5c22fab48fd 8050942: PPC64: implement template interpreter for ppc64le
kvn
parents: 24322
diff changeset
   361
#if defined(VM_LITTLE_ENDIAN)
c5c22fab48fd 8050942: PPC64: implement template interpreter for ppc64le
kvn
parents: 24322
diff changeset
   362
  if (bcp_offset) {
c5c22fab48fd 8050942: PPC64: implement template interpreter for ppc64le
kvn
parents: 24322
diff changeset
   363
    load_const_optimized(Rdst, bcp_offset);
c5c22fab48fd 8050942: PPC64: implement template interpreter for ppc64le
kvn
parents: 24322
diff changeset
   364
    lhbrx(Rdst, R14_bcp, Rdst);
c5c22fab48fd 8050942: PPC64: implement template interpreter for ppc64le
kvn
parents: 24322
diff changeset
   365
  } else {
c5c22fab48fd 8050942: PPC64: implement template interpreter for ppc64le
kvn
parents: 24322
diff changeset
   366
    lhbrx(Rdst, R14_bcp);
c5c22fab48fd 8050942: PPC64: implement template interpreter for ppc64le
kvn
parents: 24322
diff changeset
   367
  }
c5c22fab48fd 8050942: PPC64: implement template interpreter for ppc64le
kvn
parents: 24322
diff changeset
   368
  if (is_signed == Signed) {
c5c22fab48fd 8050942: PPC64: implement template interpreter for ppc64le
kvn
parents: 24322
diff changeset
   369
    extsh(Rdst, Rdst);
c5c22fab48fd 8050942: PPC64: implement template interpreter for ppc64le
kvn
parents: 24322
diff changeset
   370
  }
c5c22fab48fd 8050942: PPC64: implement template interpreter for ppc64le
kvn
parents: 24322
diff changeset
   371
#else
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   372
  // Read Java big endian format.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   373
  if (is_signed == Signed) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   374
    lha(Rdst, bcp_offset, R14_bcp);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   375
  } else {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   376
    lhz(Rdst, bcp_offset, R14_bcp);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   377
  }
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   378
#endif
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   379
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   380
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   381
void InterpreterMacroAssembler::get_4_byte_integer_at_bcp(int         bcp_offset,
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   382
                                                          Register    Rdst,
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   383
                                                          signedOrNot is_signed) {
25916
c5c22fab48fd 8050942: PPC64: implement template interpreter for ppc64le
kvn
parents: 24322
diff changeset
   384
#if defined(VM_LITTLE_ENDIAN)
c5c22fab48fd 8050942: PPC64: implement template interpreter for ppc64le
kvn
parents: 24322
diff changeset
   385
  if (bcp_offset) {
c5c22fab48fd 8050942: PPC64: implement template interpreter for ppc64le
kvn
parents: 24322
diff changeset
   386
    load_const_optimized(Rdst, bcp_offset);
c5c22fab48fd 8050942: PPC64: implement template interpreter for ppc64le
kvn
parents: 24322
diff changeset
   387
    lwbrx(Rdst, R14_bcp, Rdst);
c5c22fab48fd 8050942: PPC64: implement template interpreter for ppc64le
kvn
parents: 24322
diff changeset
   388
  } else {
c5c22fab48fd 8050942: PPC64: implement template interpreter for ppc64le
kvn
parents: 24322
diff changeset
   389
    lwbrx(Rdst, R14_bcp);
c5c22fab48fd 8050942: PPC64: implement template interpreter for ppc64le
kvn
parents: 24322
diff changeset
   390
  }
c5c22fab48fd 8050942: PPC64: implement template interpreter for ppc64le
kvn
parents: 24322
diff changeset
   391
  if (is_signed == Signed) {
c5c22fab48fd 8050942: PPC64: implement template interpreter for ppc64le
kvn
parents: 24322
diff changeset
   392
    extsw(Rdst, Rdst);
c5c22fab48fd 8050942: PPC64: implement template interpreter for ppc64le
kvn
parents: 24322
diff changeset
   393
  }
c5c22fab48fd 8050942: PPC64: implement template interpreter for ppc64le
kvn
parents: 24322
diff changeset
   394
#else
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   395
  // Read Java big endian format.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   396
  if (bcp_offset & 3) { // Offset unaligned?
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   397
    load_const_optimized(Rdst, bcp_offset);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   398
    if (is_signed == Signed) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   399
      lwax(Rdst, R14_bcp, Rdst);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   400
    } else {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   401
      lwzx(Rdst, R14_bcp, Rdst);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   402
    }
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   403
  } else {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   404
    if (is_signed == Signed) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   405
      lwa(Rdst, bcp_offset, R14_bcp);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   406
    } else {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   407
      lwz(Rdst, bcp_offset, R14_bcp);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   408
    }
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   409
  }
25916
c5c22fab48fd 8050942: PPC64: implement template interpreter for ppc64le
kvn
parents: 24322
diff changeset
   410
#endif
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   411
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   412
25916
c5c22fab48fd 8050942: PPC64: implement template interpreter for ppc64le
kvn
parents: 24322
diff changeset
   413
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   414
// Load the constant pool cache index from the bytecode stream.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   415
//
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   416
// Kills / writes:
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   417
//   - Rdst, Rscratch
35166
23125410af16 8145117: PPC64: Remove cpp interpreter implementation
goetz
parents: 33083
diff changeset
   418
void InterpreterMacroAssembler::get_cache_index_at_bcp(Register Rdst, int bcp_offset,
23125410af16 8145117: PPC64: Remove cpp interpreter implementation
goetz
parents: 33083
diff changeset
   419
                                                       size_t index_size) {
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   420
  assert(bcp_offset > 0, "bcp is still pointing to start of bytecode");
25916
c5c22fab48fd 8050942: PPC64: implement template interpreter for ppc64le
kvn
parents: 24322
diff changeset
   421
  // Cache index is always in the native format, courtesy of Rewriter.
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   422
  if (index_size == sizeof(u2)) {
25916
c5c22fab48fd 8050942: PPC64: implement template interpreter for ppc64le
kvn
parents: 24322
diff changeset
   423
    lhz(Rdst, bcp_offset, R14_bcp);
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   424
  } else if (index_size == sizeof(u4)) {
25916
c5c22fab48fd 8050942: PPC64: implement template interpreter for ppc64le
kvn
parents: 24322
diff changeset
   425
    if (bcp_offset & 3) {
c5c22fab48fd 8050942: PPC64: implement template interpreter for ppc64le
kvn
parents: 24322
diff changeset
   426
      load_const_optimized(Rdst, bcp_offset);
c5c22fab48fd 8050942: PPC64: implement template interpreter for ppc64le
kvn
parents: 24322
diff changeset
   427
      lwax(Rdst, R14_bcp, Rdst);
c5c22fab48fd 8050942: PPC64: implement template interpreter for ppc64le
kvn
parents: 24322
diff changeset
   428
    } else {
c5c22fab48fd 8050942: PPC64: implement template interpreter for ppc64le
kvn
parents: 24322
diff changeset
   429
      lwa(Rdst, bcp_offset, R14_bcp);
c5c22fab48fd 8050942: PPC64: implement template interpreter for ppc64le
kvn
parents: 24322
diff changeset
   430
    }
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   431
    assert(ConstantPool::decode_invokedynamic_index(~123) == 123, "else change next line");
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   432
    nand(Rdst, Rdst, Rdst); // convert to plain index
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   433
  } else if (index_size == sizeof(u1)) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   434
    lbz(Rdst, bcp_offset, R14_bcp);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   435
  } else {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   436
    ShouldNotReachHere();
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   437
  }
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   438
  // Rdst now contains cp cache index.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   439
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   440
35166
23125410af16 8145117: PPC64: Remove cpp interpreter implementation
goetz
parents: 33083
diff changeset
   441
void InterpreterMacroAssembler::get_cache_and_index_at_bcp(Register cache, int bcp_offset,
23125410af16 8145117: PPC64: Remove cpp interpreter implementation
goetz
parents: 33083
diff changeset
   442
                                                           size_t index_size) {
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   443
  get_cache_index_at_bcp(cache, bcp_offset, index_size);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   444
  sldi(cache, cache, exact_log2(in_words(ConstantPoolCacheEntry::size()) * BytesPerWord));
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   445
  add(cache, R27_constPoolCache, cache);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   446
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   447
25916
c5c22fab48fd 8050942: PPC64: implement template interpreter for ppc64le
kvn
parents: 24322
diff changeset
   448
// Load 4-byte signed or unsigned integer in Java format (that is, big-endian format)
c5c22fab48fd 8050942: PPC64: implement template interpreter for ppc64le
kvn
parents: 24322
diff changeset
   449
// from (Rsrc)+offset.
c5c22fab48fd 8050942: PPC64: implement template interpreter for ppc64le
kvn
parents: 24322
diff changeset
   450
void InterpreterMacroAssembler::get_u4(Register Rdst, Register Rsrc, int offset,
c5c22fab48fd 8050942: PPC64: implement template interpreter for ppc64le
kvn
parents: 24322
diff changeset
   451
                                       signedOrNot is_signed) {
c5c22fab48fd 8050942: PPC64: implement template interpreter for ppc64le
kvn
parents: 24322
diff changeset
   452
#if defined(VM_LITTLE_ENDIAN)
c5c22fab48fd 8050942: PPC64: implement template interpreter for ppc64le
kvn
parents: 24322
diff changeset
   453
  if (offset) {
c5c22fab48fd 8050942: PPC64: implement template interpreter for ppc64le
kvn
parents: 24322
diff changeset
   454
    load_const_optimized(Rdst, offset);
c5c22fab48fd 8050942: PPC64: implement template interpreter for ppc64le
kvn
parents: 24322
diff changeset
   455
    lwbrx(Rdst, Rdst, Rsrc);
c5c22fab48fd 8050942: PPC64: implement template interpreter for ppc64le
kvn
parents: 24322
diff changeset
   456
  } else {
c5c22fab48fd 8050942: PPC64: implement template interpreter for ppc64le
kvn
parents: 24322
diff changeset
   457
    lwbrx(Rdst, Rsrc);
c5c22fab48fd 8050942: PPC64: implement template interpreter for ppc64le
kvn
parents: 24322
diff changeset
   458
  }
c5c22fab48fd 8050942: PPC64: implement template interpreter for ppc64le
kvn
parents: 24322
diff changeset
   459
  if (is_signed == Signed) {
c5c22fab48fd 8050942: PPC64: implement template interpreter for ppc64le
kvn
parents: 24322
diff changeset
   460
    extsw(Rdst, Rdst);
c5c22fab48fd 8050942: PPC64: implement template interpreter for ppc64le
kvn
parents: 24322
diff changeset
   461
  }
c5c22fab48fd 8050942: PPC64: implement template interpreter for ppc64le
kvn
parents: 24322
diff changeset
   462
#else
c5c22fab48fd 8050942: PPC64: implement template interpreter for ppc64le
kvn
parents: 24322
diff changeset
   463
  if (is_signed == Signed) {
c5c22fab48fd 8050942: PPC64: implement template interpreter for ppc64le
kvn
parents: 24322
diff changeset
   464
    lwa(Rdst, offset, Rsrc);
c5c22fab48fd 8050942: PPC64: implement template interpreter for ppc64le
kvn
parents: 24322
diff changeset
   465
  } else {
c5c22fab48fd 8050942: PPC64: implement template interpreter for ppc64le
kvn
parents: 24322
diff changeset
   466
    lwz(Rdst, offset, Rsrc);
c5c22fab48fd 8050942: PPC64: implement template interpreter for ppc64le
kvn
parents: 24322
diff changeset
   467
  }
c5c22fab48fd 8050942: PPC64: implement template interpreter for ppc64le
kvn
parents: 24322
diff changeset
   468
#endif
c5c22fab48fd 8050942: PPC64: implement template interpreter for ppc64le
kvn
parents: 24322
diff changeset
   469
}
c5c22fab48fd 8050942: PPC64: implement template interpreter for ppc64le
kvn
parents: 24322
diff changeset
   470
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   471
// Load object from cpool->resolved_references(index).
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29080
diff changeset
   472
void InterpreterMacroAssembler::load_resolved_reference_at_index(Register result, Register index, Label *is_null) {
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   473
  assert_different_registers(result, index);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   474
  get_constant_pool(result);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   475
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   476
  // Convert from field index to resolved_references() index and from
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   477
  // word index to byte offset. Since this is a java object, it can be compressed.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   478
  Register tmp = index;  // reuse
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   479
  sldi(tmp, index, LogBytesPerHeapOop);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   480
  // Load pointer for resolved_references[] objArray.
46427
54713555867e 8171392: Move Klass pointers outside of ConstantPool entries so ConstantPool can be read-only
iklam
parents: 41342
diff changeset
   481
  ld(result, ConstantPool::cache_offset_in_bytes(), result);
54713555867e 8171392: Move Klass pointers outside of ConstantPool entries so ConstantPool can be read-only
iklam
parents: 41342
diff changeset
   482
  ld(result, ConstantPoolCache::resolved_references_offset_in_bytes(), result);
46961
c9094b1e5f87 8186088: ConstantPoolCache::_resolved_references is not a JNIHandle
coleenp
parents: 46615
diff changeset
   483
  resolve_oop_handle(result);
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   484
#ifdef ASSERT
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   485
  Label index_ok;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   486
  lwa(R0, arrayOopDesc::length_offset_in_bytes(), result);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   487
  sldi(R0, R0, LogBytesPerHeapOop);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   488
  cmpd(CCR0, tmp, R0);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   489
  blt(CCR0, index_ok);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   490
  stop("resolved reference index out of bounds", 0x09256);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   491
  bind(index_ok);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   492
#endif
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   493
  // Add in the index.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   494
  add(result, tmp, result);
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29080
diff changeset
   495
  load_heap_oop(result, arrayOopDesc::base_offset_in_bytes(T_OBJECT), result, is_null);
48965
be873d8c0114 8196786: [PPC64+s390] ConstantDynamic support
mdoerr
parents: 48626
diff changeset
   496
  // The resulting oop is null if the reference is not yet resolved.
be873d8c0114 8196786: [PPC64+s390] ConstantDynamic support
mdoerr
parents: 48626
diff changeset
   497
  // It is Universe::the_null_sentinel() if the reference resolved to NULL via condy.
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   498
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   499
46427
54713555867e 8171392: Move Klass pointers outside of ConstantPool entries so ConstantPool can be read-only
iklam
parents: 41342
diff changeset
   500
// load cpool->resolved_klass_at(index)
54713555867e 8171392: Move Klass pointers outside of ConstantPool entries so ConstantPool can be read-only
iklam
parents: 41342
diff changeset
   501
void InterpreterMacroAssembler::load_resolved_klass_at_offset(Register Rcpool, Register Roffset, Register Rklass) {
54713555867e 8171392: Move Klass pointers outside of ConstantPool entries so ConstantPool can be read-only
iklam
parents: 41342
diff changeset
   502
  // int value = *(Rcpool->int_at_addr(which));
54713555867e 8171392: Move Klass pointers outside of ConstantPool entries so ConstantPool can be read-only
iklam
parents: 41342
diff changeset
   503
  // int resolved_klass_index = extract_low_short_from_int(value);
54713555867e 8171392: Move Klass pointers outside of ConstantPool entries so ConstantPool can be read-only
iklam
parents: 41342
diff changeset
   504
  add(Roffset, Rcpool, Roffset);
54713555867e 8171392: Move Klass pointers outside of ConstantPool entries so ConstantPool can be read-only
iklam
parents: 41342
diff changeset
   505
#if defined(VM_LITTLE_ENDIAN)
54713555867e 8171392: Move Klass pointers outside of ConstantPool entries so ConstantPool can be read-only
iklam
parents: 41342
diff changeset
   506
  lhz(Roffset, sizeof(ConstantPool), Roffset);     // Roffset = resolved_klass_index
54713555867e 8171392: Move Klass pointers outside of ConstantPool entries so ConstantPool can be read-only
iklam
parents: 41342
diff changeset
   507
#else
54713555867e 8171392: Move Klass pointers outside of ConstantPool entries so ConstantPool can be read-only
iklam
parents: 41342
diff changeset
   508
  lhz(Roffset, sizeof(ConstantPool) + 2, Roffset); // Roffset = resolved_klass_index
54713555867e 8171392: Move Klass pointers outside of ConstantPool entries so ConstantPool can be read-only
iklam
parents: 41342
diff changeset
   509
#endif
54713555867e 8171392: Move Klass pointers outside of ConstantPool entries so ConstantPool can be read-only
iklam
parents: 41342
diff changeset
   510
54713555867e 8171392: Move Klass pointers outside of ConstantPool entries so ConstantPool can be read-only
iklam
parents: 41342
diff changeset
   511
  ld(Rklass, ConstantPool::resolved_klasses_offset_in_bytes(), Rcpool); // Rklass = Rcpool->_resolved_klasses
54713555867e 8171392: Move Klass pointers outside of ConstantPool entries so ConstantPool can be read-only
iklam
parents: 41342
diff changeset
   512
54713555867e 8171392: Move Klass pointers outside of ConstantPool entries so ConstantPool can be read-only
iklam
parents: 41342
diff changeset
   513
  sldi(Roffset, Roffset, LogBytesPerWord);
54713555867e 8171392: Move Klass pointers outside of ConstantPool entries so ConstantPool can be read-only
iklam
parents: 41342
diff changeset
   514
  addi(Roffset, Roffset, Array<Klass*>::base_offset_in_bytes());
54713555867e 8171392: Move Klass pointers outside of ConstantPool entries so ConstantPool can be read-only
iklam
parents: 41342
diff changeset
   515
  isync(); // Order load of instance Klass wrt. tags.
54713555867e 8171392: Move Klass pointers outside of ConstantPool entries so ConstantPool can be read-only
iklam
parents: 41342
diff changeset
   516
  ldx(Rklass, Rklass, Roffset);
54713555867e 8171392: Move Klass pointers outside of ConstantPool entries so ConstantPool can be read-only
iklam
parents: 41342
diff changeset
   517
}
54713555867e 8171392: Move Klass pointers outside of ConstantPool entries so ConstantPool can be read-only
iklam
parents: 41342
diff changeset
   518
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   519
// Generate a subtype check: branch to ok_is_subtype if sub_klass is
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   520
// a subtype of super_klass. Blows registers Rsub_klass, tmp1, tmp2.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   521
void InterpreterMacroAssembler::gen_subtype_check(Register Rsub_klass, Register Rsuper_klass, Register Rtmp1,
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   522
                                                  Register Rtmp2, Register Rtmp3, Label &ok_is_subtype) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   523
  // Profile the not-null value's klass.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   524
  profile_typecheck(Rsub_klass, Rtmp1, Rtmp2);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   525
  check_klass_subtype(Rsub_klass, Rsuper_klass, Rtmp1, Rtmp2, ok_is_subtype);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   526
  profile_typecheck_failed(Rtmp1, Rtmp2);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   527
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   528
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   529
// Separate these two to allow for delay slot in middle.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   530
// These are used to do a test and full jump to exception-throwing code.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   531
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   532
// Check that index is in range for array, then shift index by index_shift,
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   533
// and put arrayOop + shifted_index into res.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   534
// Note: res is still shy of address by array offset into object.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   535
35166
23125410af16 8145117: PPC64: Remove cpp interpreter implementation
goetz
parents: 33083
diff changeset
   536
void InterpreterMacroAssembler::index_check_without_pop(Register Rarray, Register Rindex,
23125410af16 8145117: PPC64: Remove cpp interpreter implementation
goetz
parents: 33083
diff changeset
   537
                                                        int index_shift, Register Rtmp, Register Rres) {
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   538
  // Check that index is in range for array, then shift index by index_shift,
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   539
  // and put arrayOop + shifted_index into res.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   540
  // Note: res is still shy of address by array offset into object.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   541
  // Kills:
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   542
  //   - Rindex
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   543
  // Writes:
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   544
  //   - Rres: Address that corresponds to the array index if check was successful.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   545
  verify_oop(Rarray);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   546
  const Register Rlength   = R0;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   547
  const Register RsxtIndex = Rtmp;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   548
  Label LisNull, LnotOOR;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   549
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   550
  // Array nullcheck
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   551
  if (!ImplicitNullChecks) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   552
    cmpdi(CCR0, Rarray, 0);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   553
    beq(CCR0, LisNull);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   554
  } else {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   555
    null_check_throw(Rarray, arrayOopDesc::length_offset_in_bytes(), /*temp*/RsxtIndex);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   556
  }
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   557
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   558
  // Rindex might contain garbage in upper bits (remember that we don't sign extend
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   559
  // during integer arithmetic operations). So kill them and put value into same register
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   560
  // where ArrayIndexOutOfBounds would expect the index in.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   561
  rldicl(RsxtIndex, Rindex, 0, 32); // zero extend 32 bit -> 64 bit
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   562
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   563
  // Index check
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   564
  lwz(Rlength, arrayOopDesc::length_offset_in_bytes(), Rarray);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   565
  cmplw(CCR0, Rindex, Rlength);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   566
  sldi(RsxtIndex, RsxtIndex, index_shift);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   567
  blt(CCR0, LnotOOR);
28187
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
   568
  // Index should be in R17_tos, array should be in R4_ARG2.
35085
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 33083
diff changeset
   569
  mr_if_needed(R17_tos, Rindex);
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 33083
diff changeset
   570
  mr_if_needed(R4_ARG2, Rarray);
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   571
  load_dispatch_table(Rtmp, (address*)Interpreter::_throw_ArrayIndexOutOfBoundsException_entry);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   572
  mtctr(Rtmp);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   573
  bctr();
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   574
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   575
  if (!ImplicitNullChecks) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   576
    bind(LisNull);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   577
    load_dispatch_table(Rtmp, (address*)Interpreter::_throw_NullPointerException_entry);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   578
    mtctr(Rtmp);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   579
    bctr();
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   580
  }
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   581
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   582
  align(32, 16);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   583
  bind(LnotOOR);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   584
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   585
  // Calc address
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   586
  add(Rres, RsxtIndex, Rarray);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   587
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   588
35166
23125410af16 8145117: PPC64: Remove cpp interpreter implementation
goetz
parents: 33083
diff changeset
   589
void InterpreterMacroAssembler::index_check(Register array, Register index,
23125410af16 8145117: PPC64: Remove cpp interpreter implementation
goetz
parents: 33083
diff changeset
   590
                                            int index_shift, Register tmp, Register res) {
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   591
  // pop array
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   592
  pop_ptr(array);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   593
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   594
  // check array
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   595
  index_check_without_pop(array, index, index_shift, tmp, res);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   596
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   597
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   598
void InterpreterMacroAssembler::get_const(Register Rdst) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   599
  ld(Rdst, in_bytes(Method::const_offset()), R19_method);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   600
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   601
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   602
void InterpreterMacroAssembler::get_constant_pool(Register Rdst) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   603
  get_const(Rdst);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   604
  ld(Rdst, in_bytes(ConstMethod::constants_offset()), Rdst);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   605
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   606
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   607
void InterpreterMacroAssembler::get_constant_pool_cache(Register Rdst) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   608
  get_constant_pool(Rdst);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   609
  ld(Rdst, ConstantPool::cache_offset_in_bytes(), Rdst);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   610
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   611
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   612
void InterpreterMacroAssembler::get_cpool_and_tags(Register Rcpool, Register Rtags) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   613
  get_constant_pool(Rcpool);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   614
  ld(Rtags, ConstantPool::tags_offset_in_bytes(), Rcpool);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   615
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   616
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   617
// Unlock if synchronized method.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   618
//
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   619
// Unlock the receiver if this is a synchronized method.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   620
// Unlock any Java monitors from synchronized blocks.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   621
//
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   622
// If there are locked Java monitors
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   623
//   If throw_monitor_exception
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   624
//     throws IllegalMonitorStateException
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   625
//   Else if install_monitor_exception
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   626
//     installs IllegalMonitorStateException
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   627
//   Else
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   628
//     no error processing
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   629
void InterpreterMacroAssembler::unlock_if_synchronized_method(TosState state,
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   630
                                                              bool throw_monitor_exception,
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   631
                                                              bool install_monitor_exception) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   632
  Label Lunlocked, Lno_unlock;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   633
  {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   634
    Register Rdo_not_unlock_flag = R11_scratch1;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   635
    Register Raccess_flags       = R12_scratch2;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   636
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   637
    // Check if synchronized method or unlocking prevented by
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   638
    // JavaThread::do_not_unlock_if_synchronized flag.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   639
    lbz(Rdo_not_unlock_flag, in_bytes(JavaThread::do_not_unlock_if_synchronized_offset()), R16_thread);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   640
    lwz(Raccess_flags, in_bytes(Method::access_flags_offset()), R19_method);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   641
    li(R0, 0);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   642
    stb(R0, in_bytes(JavaThread::do_not_unlock_if_synchronized_offset()), R16_thread); // reset flag
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   643
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   644
    push(state);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   645
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   646
    // Skip if we don't have to unlock.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   647
    rldicl_(R0, Raccess_flags, 64-JVM_ACC_SYNCHRONIZED_BIT, 63); // Extract bit and compare to 0.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   648
    beq(CCR0, Lunlocked);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   649
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   650
    cmpwi(CCR0, Rdo_not_unlock_flag, 0);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   651
    bne(CCR0, Lno_unlock);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   652
  }
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   653
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   654
  // Unlock
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   655
  {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   656
    Register Rmonitor_base = R11_scratch1;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   657
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   658
    Label Lunlock;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   659
    // If it's still locked, everything is ok, unlock it.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   660
    ld(Rmonitor_base, 0, R1_SP);
35166
23125410af16 8145117: PPC64: Remove cpp interpreter implementation
goetz
parents: 33083
diff changeset
   661
    addi(Rmonitor_base, Rmonitor_base,
23125410af16 8145117: PPC64: Remove cpp interpreter implementation
goetz
parents: 33083
diff changeset
   662
         -(frame::ijava_state_size + frame::interpreter_frame_monitor_size_in_bytes())); // Monitor base
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   663
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   664
    ld(R0, BasicObjectLock::obj_offset_in_bytes(), Rmonitor_base);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   665
    cmpdi(CCR0, R0, 0);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   666
    bne(CCR0, Lunlock);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   667
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   668
    // If it's already unlocked, throw exception.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   669
    if (throw_monitor_exception) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   670
      call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::throw_illegal_monitor_state_exception));
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   671
      should_not_reach_here();
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   672
    } else {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   673
      if (install_monitor_exception) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   674
        call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::new_illegal_monitor_state_exception));
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   675
        b(Lunlocked);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   676
      }
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   677
    }
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   678
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   679
    bind(Lunlock);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   680
    unlock_object(Rmonitor_base);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   681
  }
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   682
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   683
  // Check that all other monitors are unlocked. Throw IllegelMonitorState exception if not.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   684
  bind(Lunlocked);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   685
  {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   686
    Label Lexception, Lrestart;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   687
    Register Rcurrent_obj_addr = R11_scratch1;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   688
    const int delta = frame::interpreter_frame_monitor_size_in_bytes();
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   689
    assert((delta & LongAlignmentMask) == 0, "sizeof BasicObjectLock must be even number of doublewords");
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   690
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   691
    bind(Lrestart);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   692
    // Set up search loop: Calc num of iterations.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   693
    {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   694
      Register Riterations = R12_scratch2;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   695
      Register Rmonitor_base = Rcurrent_obj_addr;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   696
      ld(Rmonitor_base, 0, R1_SP);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   697
      addi(Rmonitor_base, Rmonitor_base, - frame::ijava_state_size);  // Monitor base
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   698
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   699
      subf_(Riterations, R26_monitor, Rmonitor_base);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   700
      ble(CCR0, Lno_unlock);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   701
35166
23125410af16 8145117: PPC64: Remove cpp interpreter implementation
goetz
parents: 33083
diff changeset
   702
      addi(Rcurrent_obj_addr, Rmonitor_base,
23125410af16 8145117: PPC64: Remove cpp interpreter implementation
goetz
parents: 33083
diff changeset
   703
           BasicObjectLock::obj_offset_in_bytes() - frame::interpreter_frame_monitor_size_in_bytes());
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   704
      // Check if any monitor is on stack, bail out if not
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   705
      srdi(Riterations, Riterations, exact_log2(delta));
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   706
      mtctr(Riterations);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   707
    }
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   708
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   709
    // The search loop: Look for locked monitors.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   710
    {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   711
      const Register Rcurrent_obj = R0;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   712
      Label Lloop;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   713
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   714
      ld(Rcurrent_obj, 0, Rcurrent_obj_addr);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   715
      addi(Rcurrent_obj_addr, Rcurrent_obj_addr, -delta);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   716
      bind(Lloop);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   717
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   718
      // Check if current entry is used.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   719
      cmpdi(CCR0, Rcurrent_obj, 0);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   720
      bne(CCR0, Lexception);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   721
      // Preload next iteration's compare value.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   722
      ld(Rcurrent_obj, 0, Rcurrent_obj_addr);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   723
      addi(Rcurrent_obj_addr, Rcurrent_obj_addr, -delta);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   724
      bdnz(Lloop);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   725
    }
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   726
    // Fell through: Everything's unlocked => finish.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   727
    b(Lno_unlock);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   728
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   729
    // An object is still locked => need to throw exception.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   730
    bind(Lexception);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   731
    if (throw_monitor_exception) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   732
      call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::throw_illegal_monitor_state_exception));
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   733
      should_not_reach_here();
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   734
    } else {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   735
      // Stack unrolling. Unlock object and if requested, install illegal_monitor_exception.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   736
      // Unlock does not block, so don't have to worry about the frame.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   737
      Register Rmonitor_addr = R11_scratch1;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   738
      addi(Rmonitor_addr, Rcurrent_obj_addr, -BasicObjectLock::obj_offset_in_bytes() + delta);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   739
      unlock_object(Rmonitor_addr);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   740
      if (install_monitor_exception) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   741
        call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::new_illegal_monitor_state_exception));
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   742
      }
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   743
      b(Lrestart);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   744
    }
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   745
  }
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   746
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   747
  align(32, 12);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   748
  bind(Lno_unlock);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   749
  pop(state);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   750
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   751
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   752
// Support function for remove_activation & Co.
35166
23125410af16 8145117: PPC64: Remove cpp interpreter implementation
goetz
parents: 33083
diff changeset
   753
void InterpreterMacroAssembler::merge_frames(Register Rsender_sp, Register return_pc,
23125410af16 8145117: PPC64: Remove cpp interpreter implementation
goetz
parents: 33083
diff changeset
   754
                                             Register Rscratch1, Register Rscratch2) {
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   755
  // Pop interpreter frame.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   756
  ld(Rscratch1, 0, R1_SP); // *SP
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   757
  ld(Rsender_sp, _ijava_state_neg(sender_sp), Rscratch1); // top_frame_sp
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   758
  ld(Rscratch2, 0, Rscratch1); // **SP
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   759
#ifdef ASSERT
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   760
  {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   761
    Label Lok;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   762
    ld(R0, _ijava_state_neg(ijava_reserved), Rscratch1);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   763
    cmpdi(CCR0, R0, 0x5afe);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   764
    beq(CCR0, Lok);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   765
    stop("frame corrupted (remove activation)", 0x5afe);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   766
    bind(Lok);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   767
  }
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   768
#endif
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   769
  if (return_pc!=noreg) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   770
    ld(return_pc, _abi(lr), Rscratch1); // LR
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   771
  }
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   772
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   773
  // Merge top frames.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   774
  subf(Rscratch1, R1_SP, Rsender_sp); // top_frame_sp - SP
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   775
  stdux(Rscratch2, R1_SP, Rscratch1); // atomically set *(SP = top_frame_sp) = **SP
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   776
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   777
37488
ab63cdc0e14e 8154867: PPC64: Better byte behavior
mdoerr
parents: 35232
diff changeset
   778
void InterpreterMacroAssembler::narrow(Register result) {
ab63cdc0e14e 8154867: PPC64: Better byte behavior
mdoerr
parents: 35232
diff changeset
   779
  Register ret_type = R11_scratch1;
ab63cdc0e14e 8154867: PPC64: Better byte behavior
mdoerr
parents: 35232
diff changeset
   780
  ld(R11_scratch1, in_bytes(Method::const_offset()), R19_method);
ab63cdc0e14e 8154867: PPC64: Better byte behavior
mdoerr
parents: 35232
diff changeset
   781
  lbz(ret_type, in_bytes(ConstMethod::result_type_offset()), R11_scratch1);
ab63cdc0e14e 8154867: PPC64: Better byte behavior
mdoerr
parents: 35232
diff changeset
   782
ab63cdc0e14e 8154867: PPC64: Better byte behavior
mdoerr
parents: 35232
diff changeset
   783
  Label notBool, notByte, notChar, done;
ab63cdc0e14e 8154867: PPC64: Better byte behavior
mdoerr
parents: 35232
diff changeset
   784
ab63cdc0e14e 8154867: PPC64: Better byte behavior
mdoerr
parents: 35232
diff changeset
   785
  // common case first
ab63cdc0e14e 8154867: PPC64: Better byte behavior
mdoerr
parents: 35232
diff changeset
   786
  cmpwi(CCR0, ret_type, T_INT);
ab63cdc0e14e 8154867: PPC64: Better byte behavior
mdoerr
parents: 35232
diff changeset
   787
  beq(CCR0, done);
ab63cdc0e14e 8154867: PPC64: Better byte behavior
mdoerr
parents: 35232
diff changeset
   788
ab63cdc0e14e 8154867: PPC64: Better byte behavior
mdoerr
parents: 35232
diff changeset
   789
  cmpwi(CCR0, ret_type, T_BOOLEAN);
ab63cdc0e14e 8154867: PPC64: Better byte behavior
mdoerr
parents: 35232
diff changeset
   790
  bne(CCR0, notBool);
ab63cdc0e14e 8154867: PPC64: Better byte behavior
mdoerr
parents: 35232
diff changeset
   791
  andi(result, result, 0x1);
ab63cdc0e14e 8154867: PPC64: Better byte behavior
mdoerr
parents: 35232
diff changeset
   792
  b(done);
ab63cdc0e14e 8154867: PPC64: Better byte behavior
mdoerr
parents: 35232
diff changeset
   793
ab63cdc0e14e 8154867: PPC64: Better byte behavior
mdoerr
parents: 35232
diff changeset
   794
  bind(notBool);
ab63cdc0e14e 8154867: PPC64: Better byte behavior
mdoerr
parents: 35232
diff changeset
   795
  cmpwi(CCR0, ret_type, T_BYTE);
ab63cdc0e14e 8154867: PPC64: Better byte behavior
mdoerr
parents: 35232
diff changeset
   796
  bne(CCR0, notByte);
ab63cdc0e14e 8154867: PPC64: Better byte behavior
mdoerr
parents: 35232
diff changeset
   797
  extsb(result, result);
ab63cdc0e14e 8154867: PPC64: Better byte behavior
mdoerr
parents: 35232
diff changeset
   798
  b(done);
ab63cdc0e14e 8154867: PPC64: Better byte behavior
mdoerr
parents: 35232
diff changeset
   799
ab63cdc0e14e 8154867: PPC64: Better byte behavior
mdoerr
parents: 35232
diff changeset
   800
  bind(notByte);
ab63cdc0e14e 8154867: PPC64: Better byte behavior
mdoerr
parents: 35232
diff changeset
   801
  cmpwi(CCR0, ret_type, T_CHAR);
ab63cdc0e14e 8154867: PPC64: Better byte behavior
mdoerr
parents: 35232
diff changeset
   802
  bne(CCR0, notChar);
ab63cdc0e14e 8154867: PPC64: Better byte behavior
mdoerr
parents: 35232
diff changeset
   803
  andi(result, result, 0xffff);
ab63cdc0e14e 8154867: PPC64: Better byte behavior
mdoerr
parents: 35232
diff changeset
   804
  b(done);
ab63cdc0e14e 8154867: PPC64: Better byte behavior
mdoerr
parents: 35232
diff changeset
   805
ab63cdc0e14e 8154867: PPC64: Better byte behavior
mdoerr
parents: 35232
diff changeset
   806
  bind(notChar);
ab63cdc0e14e 8154867: PPC64: Better byte behavior
mdoerr
parents: 35232
diff changeset
   807
  // cmpwi(CCR0, ret_type, T_SHORT);  // all that's left
ab63cdc0e14e 8154867: PPC64: Better byte behavior
mdoerr
parents: 35232
diff changeset
   808
  // bne(CCR0, done);
ab63cdc0e14e 8154867: PPC64: Better byte behavior
mdoerr
parents: 35232
diff changeset
   809
  extsh(result, result);
ab63cdc0e14e 8154867: PPC64: Better byte behavior
mdoerr
parents: 35232
diff changeset
   810
ab63cdc0e14e 8154867: PPC64: Better byte behavior
mdoerr
parents: 35232
diff changeset
   811
  // Nothing to do for T_INT
ab63cdc0e14e 8154867: PPC64: Better byte behavior
mdoerr
parents: 35232
diff changeset
   812
  bind(done);
ab63cdc0e14e 8154867: PPC64: Better byte behavior
mdoerr
parents: 35232
diff changeset
   813
}
ab63cdc0e14e 8154867: PPC64: Better byte behavior
mdoerr
parents: 35232
diff changeset
   814
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   815
// Remove activation.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   816
//
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   817
// Unlock the receiver if this is a synchronized method.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   818
// Unlock any Java monitors from synchronized blocks.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   819
// Remove the activation from the stack.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   820
//
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   821
// If there are locked Java monitors
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   822
//    If throw_monitor_exception
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   823
//       throws IllegalMonitorStateException
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   824
//    Else if install_monitor_exception
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   825
//       installs IllegalMonitorStateException
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   826
//    Else
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   827
//       no error processing
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   828
void InterpreterMacroAssembler::remove_activation(TosState state,
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   829
                                                  bool throw_monitor_exception,
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   830
                                                  bool install_monitor_exception) {
38931
3cf28d630349 8156923: [ppc] Implement "JEP 270: Reserved Stack Areas for Critical Sections".
goetz
parents: 37488
diff changeset
   831
  BLOCK_COMMENT("remove_activation {");
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   832
  unlock_if_synchronized_method(state, throw_monitor_exception, install_monitor_exception);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   833
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   834
  // Save result (push state before jvmti call and pop it afterwards) and notify jvmti.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   835
  notify_method_exit(false, state, NotifyJVMTI, true);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   836
38931
3cf28d630349 8156923: [ppc] Implement "JEP 270: Reserved Stack Areas for Critical Sections".
goetz
parents: 37488
diff changeset
   837
  BLOCK_COMMENT("reserved_stack_check:");
3cf28d630349 8156923: [ppc] Implement "JEP 270: Reserved Stack Areas for Critical Sections".
goetz
parents: 37488
diff changeset
   838
  if (StackReservedPages > 0) {
3cf28d630349 8156923: [ppc] Implement "JEP 270: Reserved Stack Areas for Critical Sections".
goetz
parents: 37488
diff changeset
   839
    // Test if reserved zone needs to be enabled.
3cf28d630349 8156923: [ppc] Implement "JEP 270: Reserved Stack Areas for Critical Sections".
goetz
parents: 37488
diff changeset
   840
    Label no_reserved_zone_enabling;
3cf28d630349 8156923: [ppc] Implement "JEP 270: Reserved Stack Areas for Critical Sections".
goetz
parents: 37488
diff changeset
   841
3cf28d630349 8156923: [ppc] Implement "JEP 270: Reserved Stack Areas for Critical Sections".
goetz
parents: 37488
diff changeset
   842
    // Compare frame pointers. There is no good stack pointer, as with stack
3cf28d630349 8156923: [ppc] Implement "JEP 270: Reserved Stack Areas for Critical Sections".
goetz
parents: 37488
diff changeset
   843
    // frame compression we can get different SPs when we do calls. A subsequent
3cf28d630349 8156923: [ppc] Implement "JEP 270: Reserved Stack Areas for Critical Sections".
goetz
parents: 37488
diff changeset
   844
    // call could have a smaller SP, so that this compare succeeds for an
3cf28d630349 8156923: [ppc] Implement "JEP 270: Reserved Stack Areas for Critical Sections".
goetz
parents: 37488
diff changeset
   845
    // inner call of the method annotated with ReservedStack.
3cf28d630349 8156923: [ppc] Implement "JEP 270: Reserved Stack Areas for Critical Sections".
goetz
parents: 37488
diff changeset
   846
    ld_ptr(R0, JavaThread::reserved_stack_activation_offset(), R16_thread);
3cf28d630349 8156923: [ppc] Implement "JEP 270: Reserved Stack Areas for Critical Sections".
goetz
parents: 37488
diff changeset
   847
    ld_ptr(R11_scratch1, _abi(callers_sp), R1_SP); // Load frame pointer.
3cf28d630349 8156923: [ppc] Implement "JEP 270: Reserved Stack Areas for Critical Sections".
goetz
parents: 37488
diff changeset
   848
    cmpld(CCR0, R11_scratch1, R0);
3cf28d630349 8156923: [ppc] Implement "JEP 270: Reserved Stack Areas for Critical Sections".
goetz
parents: 37488
diff changeset
   849
    blt_predict_taken(CCR0, no_reserved_zone_enabling);
3cf28d630349 8156923: [ppc] Implement "JEP 270: Reserved Stack Areas for Critical Sections".
goetz
parents: 37488
diff changeset
   850
3cf28d630349 8156923: [ppc] Implement "JEP 270: Reserved Stack Areas for Critical Sections".
goetz
parents: 37488
diff changeset
   851
    // Enable reserved zone again, throw stack overflow exception.
3cf28d630349 8156923: [ppc] Implement "JEP 270: Reserved Stack Areas for Critical Sections".
goetz
parents: 37488
diff changeset
   852
    call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::enable_stack_reserved_zone), R16_thread);
3cf28d630349 8156923: [ppc] Implement "JEP 270: Reserved Stack Areas for Critical Sections".
goetz
parents: 37488
diff changeset
   853
    call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::throw_delayed_StackOverflowError));
3cf28d630349 8156923: [ppc] Implement "JEP 270: Reserved Stack Areas for Critical Sections".
goetz
parents: 37488
diff changeset
   854
3cf28d630349 8156923: [ppc] Implement "JEP 270: Reserved Stack Areas for Critical Sections".
goetz
parents: 37488
diff changeset
   855
    should_not_reach_here();
3cf28d630349 8156923: [ppc] Implement "JEP 270: Reserved Stack Areas for Critical Sections".
goetz
parents: 37488
diff changeset
   856
3cf28d630349 8156923: [ppc] Implement "JEP 270: Reserved Stack Areas for Critical Sections".
goetz
parents: 37488
diff changeset
   857
    bind(no_reserved_zone_enabling);
3cf28d630349 8156923: [ppc] Implement "JEP 270: Reserved Stack Areas for Critical Sections".
goetz
parents: 37488
diff changeset
   858
  }
3cf28d630349 8156923: [ppc] Implement "JEP 270: Reserved Stack Areas for Critical Sections".
goetz
parents: 37488
diff changeset
   859
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   860
  verify_oop(R17_tos, state);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   861
  verify_thread();
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   862
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   863
  merge_frames(/*top_frame_sp*/ R21_sender_SP, /*return_pc*/ R0, R11_scratch1, R12_scratch2);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   864
  mtlr(R0);
38931
3cf28d630349 8156923: [ppc] Implement "JEP 270: Reserved Stack Areas for Critical Sections".
goetz
parents: 37488
diff changeset
   865
  BLOCK_COMMENT("} remove_activation");
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   866
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   867
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   868
// Lock object
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   869
//
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   870
// Registers alive
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   871
//   monitor - Address of the BasicObjectLock to be used for locking,
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   872
//             which must be initialized with the object to lock.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   873
//   object  - Address of the object to be locked.
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
void InterpreterMacroAssembler::lock_object(Register monitor, Register object) {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   876
  if (UseHeavyMonitors) {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   877
    call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::monitorenter),
35166
23125410af16 8145117: PPC64: Remove cpp interpreter implementation
goetz
parents: 33083
diff changeset
   878
            monitor, /*check_for_exceptions=*/true);
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   879
  } else {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   880
    // template code:
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   881
    //
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   882
    // markOop displaced_header = obj->mark().set_unlocked();
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   883
    // monitor->lock()->set_displaced_header(displaced_header);
47634
6a0c42c40cd1 8188220: Remove Atomic::*_ptr() uses and overloads from hotspot
coleenp
parents: 47216
diff changeset
   884
    // if (Atomic::cmpxchg(/*ex=*/monitor, /*addr*/obj->mark_addr(), /*cmp*/displaced_header) == displaced_header) {
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   885
    //   // We stored the monitor address into the object's mark word.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   886
    // } else if (THREAD->is_lock_owned((address)displaced_header))
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   887
    //   // Simple recursive case.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   888
    //   monitor->lock()->set_displaced_header(NULL);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   889
    // } else {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   890
    //   // Slow path.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   891
    //   InterpreterRuntime::monitorenter(THREAD, monitor);
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
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   894
    const Register displaced_header = R7_ARG5;
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   895
    const Register object_mark_addr = R8_ARG6;
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   896
    const Register current_header   = R9_ARG7;
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   897
    const Register tmp              = R10_ARG8;
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   898
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   899
    Label done;
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 22824
diff changeset
   900
    Label cas_failed, slow_case;
22824
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
    assert_different_registers(displaced_header, object_mark_addr, current_header, tmp);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   903
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   904
    // markOop displaced_header = obj->mark().set_unlocked();
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   905
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   906
    // Load markOop from object into displaced_header.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   907
    ld(displaced_header, oopDesc::mark_offset_in_bytes(), object);
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
    if (UseBiasedLocking) {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   910
      biased_locking_enter(CCR0, object, displaced_header, tmp, current_header, done, &slow_case);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   911
    }
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   912
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   913
    // Set displaced_header to be (markOop of object | UNLOCK_VALUE).
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   914
    ori(displaced_header, displaced_header, markOopDesc::unlocked_value);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   915
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   916
    // monitor->lock()->set_displaced_header(displaced_header);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   917
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   918
    // Initialize the box (Must happen before we update the object mark!).
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   919
    std(displaced_header, BasicObjectLock::lock_offset_in_bytes() +
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 22824
diff changeset
   920
        BasicLock::displaced_header_offset_in_bytes(), monitor);
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   921
47634
6a0c42c40cd1 8188220: Remove Atomic::*_ptr() uses and overloads from hotspot
coleenp
parents: 47216
diff changeset
   922
    // if (Atomic::cmpxchg(/*ex=*/monitor, /*addr*/obj->mark_addr(), /*cmp*/displaced_header) == displaced_header) {
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   923
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   924
    // Store stack address of the BasicObjectLock (this is monitor) into object.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   925
    addi(object_mark_addr, object, oopDesc::mark_offset_in_bytes());
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   926
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   927
    // Must fence, otherwise, preceding store(s) may float below cmpxchg.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   928
    // CmpxchgX sets CCR0 to cmpX(current, displaced).
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   929
    cmpxchgd(/*flag=*/CCR0,
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   930
             /*current_value=*/current_header,
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   931
             /*compare_value=*/displaced_header, /*exchange_value=*/monitor,
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   932
             /*where=*/object_mark_addr,
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   933
             MacroAssembler::MemBarRel | MacroAssembler::MemBarAcq,
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 22824
diff changeset
   934
             MacroAssembler::cmpxchgx_hint_acquire_lock(),
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 22824
diff changeset
   935
             noreg,
35085
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 33083
diff changeset
   936
             &cas_failed,
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 33083
diff changeset
   937
             /*check without membar and ldarx first*/true);
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   938
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   939
    // If the compare-and-exchange succeeded, then we found an unlocked
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   940
    // object and we have now locked it.
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 22824
diff changeset
   941
    b(done);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 22824
diff changeset
   942
    bind(cas_failed);
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   943
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   944
    // } else if (THREAD->is_lock_owned((address)displaced_header))
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   945
    //   // Simple recursive case.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   946
    //   monitor->lock()->set_displaced_header(NULL);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   947
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   948
    // We did not see an unlocked object so try the fast recursive case.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   949
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   950
    // Check if owner is self by comparing the value in the markOop of object
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   951
    // (current_header) with the stack pointer.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   952
    sub(current_header, current_header, R1_SP);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   953
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   954
    assert(os::vm_page_size() > 0xfff, "page size too small - change the constant");
35085
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 33083
diff changeset
   955
    load_const_optimized(tmp, ~(os::vm_page_size()-1) | markOopDesc::lock_mask_in_place);
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   956
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   957
    and_(R0/*==0?*/, current_header, tmp);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   958
    // If condition is true we are done and hence we can store 0 in the displaced
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   959
    // header indicating it is a recursive lock.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   960
    bne(CCR0, slow_case);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   961
    std(R0/*==0!*/, BasicObjectLock::lock_offset_in_bytes() +
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 22824
diff changeset
   962
        BasicLock::displaced_header_offset_in_bytes(), monitor);
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   963
    b(done);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   964
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   965
    // } else {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   966
    //   // Slow path.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   967
    //   InterpreterRuntime::monitorenter(THREAD, monitor);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   968
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   969
    // None of the above fast optimizations worked so we have to get into the
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   970
    // slow case of monitor enter.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   971
    bind(slow_case);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   972
    call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::monitorenter),
35166
23125410af16 8145117: PPC64: Remove cpp interpreter implementation
goetz
parents: 33083
diff changeset
   973
            monitor, /*check_for_exceptions=*/true);
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   974
    // }
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   975
    align(32, 12);
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   976
    bind(done);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   977
  }
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   978
}
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   979
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   980
// Unlocks an object. Used in monitorexit bytecode and remove_activation.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   981
//
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   982
// Registers alive
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   983
//   monitor - Address of the BasicObjectLock to be used for locking,
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   984
//             which must be initialized with the object to lock.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   985
//
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   986
// Throw IllegalMonitorException if object is not locked by current thread.
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 22824
diff changeset
   987
void InterpreterMacroAssembler::unlock_object(Register monitor, bool check_for_exceptions) {
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   988
  if (UseHeavyMonitors) {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   989
    call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::monitorexit),
35166
23125410af16 8145117: PPC64: Remove cpp interpreter implementation
goetz
parents: 33083
diff changeset
   990
            monitor, check_for_exceptions);
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   991
  } else {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   992
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   993
    // template code:
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   994
    //
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   995
    // if ((displaced_header = monitor->displaced_header()) == NULL) {
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   996
    //   // Recursive unlock. Mark the monitor unlocked by setting the object field to NULL.
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   997
    //   monitor->set_obj(NULL);
47634
6a0c42c40cd1 8188220: Remove Atomic::*_ptr() uses and overloads from hotspot
coleenp
parents: 47216
diff changeset
   998
    // } else if (Atomic::cmpxchg(displaced_header, obj->mark_addr(), monitor) == monitor) {
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   999
    //   // We swapped the unlocked mark in displaced_header into the object's mark word.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  1000
    //   monitor->set_obj(NULL);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  1001
    // } else {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  1002
    //   // Slow path.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  1003
    //   InterpreterRuntime::monitorexit(THREAD, monitor);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  1004
    // }
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  1005
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  1006
    const Register object           = R7_ARG5;
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  1007
    const Register displaced_header = R8_ARG6;
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  1008
    const Register object_mark_addr = R9_ARG7;
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  1009
    const Register current_header   = R10_ARG8;
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  1010
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 22824
diff changeset
  1011
    Label free_slot;
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  1012
    Label slow_case;
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  1013
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  1014
    assert_different_registers(object, displaced_header, object_mark_addr, current_header);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  1015
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  1016
    if (UseBiasedLocking) {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  1017
      // The object address from the monitor is in object.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  1018
      ld(object, BasicObjectLock::obj_offset_in_bytes(), monitor);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  1019
      assert(oopDesc::mark_offset_in_bytes() == 0, "offset of _mark is not 0");
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 22824
diff changeset
  1020
      biased_locking_exit(CCR0, object, displaced_header, free_slot);
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  1021
    }
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  1022
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  1023
    // Test first if we are in the fast recursive case.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  1024
    ld(displaced_header, BasicObjectLock::lock_offset_in_bytes() +
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  1025
           BasicLock::displaced_header_offset_in_bytes(), monitor);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  1026
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  1027
    // If the displaced header is zero, we have a recursive unlock.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  1028
    cmpdi(CCR0, displaced_header, 0);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 22824
diff changeset
  1029
    beq(CCR0, free_slot); // recursive unlock
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  1030
47634
6a0c42c40cd1 8188220: Remove Atomic::*_ptr() uses and overloads from hotspot
coleenp
parents: 47216
diff changeset
  1031
    // } else if (Atomic::cmpxchg(displaced_header, obj->mark_addr(), monitor) == monitor) {
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  1032
    //   // We swapped the unlocked mark in displaced_header into the object's mark word.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  1033
    //   monitor->set_obj(NULL);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  1034
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  1035
    // If we still have a lightweight lock, unlock the object and be done.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  1036
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  1037
    // The object address from the monitor is in object.
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1038
    if (!UseBiasedLocking) { ld(object, BasicObjectLock::obj_offset_in_bytes(), monitor); }
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  1039
    addi(object_mark_addr, object, oopDesc::mark_offset_in_bytes());
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  1040
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  1041
    // We have the displaced header in displaced_header. If the lock is still
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  1042
    // lightweight, it will contain the monitor address and we'll store the
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  1043
    // displaced header back into the object's mark word.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  1044
    // CmpxchgX sets CCR0 to cmpX(current, monitor).
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  1045
    cmpxchgd(/*flag=*/CCR0,
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  1046
             /*current_value=*/current_header,
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  1047
             /*compare_value=*/monitor, /*exchange_value=*/displaced_header,
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  1048
             /*where=*/object_mark_addr,
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 22824
diff changeset
  1049
             MacroAssembler::MemBarRel,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 22824
diff changeset
  1050
             MacroAssembler::cmpxchgx_hint_release_lock(),
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 22824
diff changeset
  1051
             noreg,
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 22824
diff changeset
  1052
             &slow_case);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 22824
diff changeset
  1053
    b(free_slot);
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  1054
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  1055
    // } else {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  1056
    //   // Slow path.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  1057
    //   InterpreterRuntime::monitorexit(THREAD, monitor);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  1058
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  1059
    // The lock has been converted into a heavy lock and hence
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  1060
    // we need to get into the slow case.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  1061
    bind(slow_case);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  1062
    call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::monitorexit),
35166
23125410af16 8145117: PPC64: Remove cpp interpreter implementation
goetz
parents: 33083
diff changeset
  1063
            monitor, check_for_exceptions);
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  1064
    // }
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  1065
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 22824
diff changeset
  1066
    Label done;
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 22824
diff changeset
  1067
    b(done); // Monitor register may be overwritten! Runtime has already freed the slot.
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 22824
diff changeset
  1068
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 22824
diff changeset
  1069
    // Exchange worked, do monitor->set_obj(NULL);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 22824
diff changeset
  1070
    align(32, 12);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 22824
diff changeset
  1071
    bind(free_slot);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 22824
diff changeset
  1072
    li(R0, 0);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 22824
diff changeset
  1073
    std(R0, BasicObjectLock::obj_offset_in_bytes(), monitor);
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  1074
    bind(done);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  1075
  }
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  1076
}
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  1077
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1078
// Load compiled (i2c) or interpreter entry when calling from interpreted and
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1079
// do the call. Centralized so that all interpreter calls will do the same actions.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1080
// If jvmti single stepping is on for a thread we must not call compiled code.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1081
//
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1082
// Input:
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1083
//   - Rtarget_method: method to call
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1084
//   - Rret_addr:      return address
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1085
//   - 2 scratch regs
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1086
//
35166
23125410af16 8145117: PPC64: Remove cpp interpreter implementation
goetz
parents: 33083
diff changeset
  1087
void InterpreterMacroAssembler::call_from_interpreter(Register Rtarget_method, Register Rret_addr,
23125410af16 8145117: PPC64: Remove cpp interpreter implementation
goetz
parents: 33083
diff changeset
  1088
                                                      Register Rscratch1, Register Rscratch2) {
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1089
  assert_different_registers(Rscratch1, Rscratch2, Rtarget_method, Rret_addr);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1090
  // Assume we want to go compiled if available.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1091
  const Register Rtarget_addr = Rscratch1;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1092
  const Register Rinterp_only = Rscratch2;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1093
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1094
  ld(Rtarget_addr, in_bytes(Method::from_interpreted_offset()), Rtarget_method);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1095
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1096
  if (JvmtiExport::can_post_interpreter_events()) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1097
    lwz(Rinterp_only, in_bytes(JavaThread::interp_only_mode_offset()), R16_thread);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1098
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1099
    // JVMTI events, such as single-stepping, are implemented partly by avoiding running
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1100
    // compiled code in threads for which the event is enabled. Check here for
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1101
    // interp_only_mode if these events CAN be enabled.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1102
    Label done;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1103
    verify_thread();
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1104
    cmpwi(CCR0, Rinterp_only, 0);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1105
    beq(CCR0, done);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1106
    ld(Rtarget_addr, in_bytes(Method::interpreter_entry_offset()), Rtarget_method);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1107
    align(32, 12);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1108
    bind(done);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1109
  }
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1110
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1111
#ifdef ASSERT
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1112
  {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1113
    Label Lok;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1114
    cmpdi(CCR0, Rtarget_addr, 0);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1115
    bne(CCR0, Lok);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1116
    stop("null entry point");
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1117
    bind(Lok);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1118
  }
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1119
#endif // ASSERT
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1120
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1121
  mr(R21_sender_SP, R1_SP);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1122
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1123
  // Calc a precise SP for the call. The SP value we calculated in
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1124
  // generate_fixed_frame() is based on the max_stack() value, so we would waste stack space
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1125
  // if esp is not max. Also, the i2c adapter extends the stack space without restoring
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1126
  // our pre-calced value, so repeating calls via i2c would result in stack overflow.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1127
  // Since esp already points to an empty slot, we just have to sub 1 additional slot
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1128
  // to meet the abi scratch requirements.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1129
  // The max_stack pointer will get restored by means of the GR_Lmax_stack local in
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1130
  // the return entry of the interpreter.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1131
  addi(Rscratch2, R15_esp, Interpreter::stackElementSize - frame::abi_reg_args_size);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1132
  clrrdi(Rscratch2, Rscratch2, exact_log2(frame::alignment_in_bytes)); // round towards smaller address
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1133
  resize_frame_absolute(Rscratch2, Rscratch2, R0);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1134
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1135
  mr_if_needed(R19_method, Rtarget_method);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1136
  mtctr(Rtarget_addr);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1137
  mtlr(Rret_addr);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1138
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1139
  save_interpreter_state(Rscratch2);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1140
#ifdef ASSERT
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1141
  ld(Rscratch1, _ijava_state_neg(top_frame_sp), Rscratch2); // Rscratch2 contains fp
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1142
  cmpd(CCR0, R21_sender_SP, Rscratch1);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1143
  asm_assert_eq("top_frame_sp incorrect", 0x951);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1144
#endif
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1145
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1146
  bctr();
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1147
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1148
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1149
// Set the method data pointer for the current bcp.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1150
void InterpreterMacroAssembler::set_method_data_pointer_for_bcp() {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1151
  assert(ProfileInterpreter, "must be profiling interpreter");
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1152
  Label get_continue;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1153
  ld(R28_mdx, in_bytes(Method::method_data_offset()), R19_method);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1154
  test_method_data_pointer(get_continue);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1155
  call_VM_leaf(CAST_FROM_FN_PTR(address, InterpreterRuntime::bcp_to_di), R19_method, R14_bcp);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1156
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1157
  addi(R28_mdx, R28_mdx, in_bytes(MethodData::data_offset()));
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1158
  add(R28_mdx, R28_mdx, R3_RET);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1159
  bind(get_continue);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1160
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1161
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1162
// Test ImethodDataPtr. If it is null, continue at the specified label.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1163
void InterpreterMacroAssembler::test_method_data_pointer(Label& zero_continue) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1164
  assert(ProfileInterpreter, "must be profiling interpreter");
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1165
  cmpdi(CCR0, R28_mdx, 0);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1166
  beq(CCR0, zero_continue);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1167
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1168
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1169
void InterpreterMacroAssembler::verify_method_data_pointer() {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1170
  assert(ProfileInterpreter, "must be profiling interpreter");
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1171
#ifdef ASSERT
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1172
  Label verify_continue;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1173
  test_method_data_pointer(verify_continue);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1174
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1175
  // If the mdp is valid, it will point to a DataLayout header which is
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1176
  // consistent with the bcp. The converse is highly probable also.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1177
  lhz(R11_scratch1, in_bytes(DataLayout::bci_offset()), R28_mdx);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1178
  ld(R12_scratch2, in_bytes(Method::const_offset()), R19_method);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1179
  addi(R11_scratch1, R11_scratch1, in_bytes(ConstMethod::codes_offset()));
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1180
  add(R11_scratch1, R12_scratch2, R12_scratch2);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1181
  cmpd(CCR0, R11_scratch1, R14_bcp);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1182
  beq(CCR0, verify_continue);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1183
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1184
  call_VM_leaf(CAST_FROM_FN_PTR(address, InterpreterRuntime::verify_mdp ), R19_method, R14_bcp, R28_mdx);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1185
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1186
  bind(verify_continue);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1187
#endif
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1188
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1189
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1190
void InterpreterMacroAssembler::test_invocation_counter_for_mdp(Register invocation_count,
35085
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 33083
diff changeset
  1191
                                                                Register method_counters,
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1192
                                                                Register Rscratch,
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1193
                                                                Label &profile_continue) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1194
  assert(ProfileInterpreter, "must be profiling interpreter");
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1195
  // Control will flow to "profile_continue" if the counter is less than the
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1196
  // limit or if we call profile_method().
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1197
  Label done;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1198
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1199
  // If no method data exists, and the counter is high enough, make one.
35085
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 33083
diff changeset
  1200
  lwz(Rscratch, in_bytes(MethodCounters::interpreter_profile_limit_offset()), method_counters);
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1201
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1202
  cmpdi(CCR0, R28_mdx, 0);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1203
  // Test to see if we should create a method data oop.
35085
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 33083
diff changeset
  1204
  cmpd(CCR1, Rscratch, invocation_count);
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1205
  bne(CCR0, done);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1206
  bge(CCR1, profile_continue);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1207
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1208
  // Build it now.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1209
  call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::profile_method));
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1210
  set_method_data_pointer_for_bcp();
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1211
  b(profile_continue);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1212
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1213
  align(32, 12);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1214
  bind(done);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1215
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1216
35085
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 33083
diff changeset
  1217
void InterpreterMacroAssembler::test_backedge_count_for_osr(Register backedge_count, Register method_counters,
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 33083
diff changeset
  1218
                                                            Register target_bcp, Register disp, Register Rtmp) {
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 33083
diff changeset
  1219
  assert_different_registers(backedge_count, target_bcp, disp, Rtmp, R4_ARG2);
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1220
  assert(UseOnStackReplacement,"Must UseOnStackReplacement to test_backedge_count_for_osr");
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1222
  Label did_not_overflow;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1223
  Label overflow_with_error;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1224
35085
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 33083
diff changeset
  1225
  lwz(Rtmp, in_bytes(MethodCounters::interpreter_backward_branch_limit_offset()), method_counters);
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1226
  cmpw(CCR0, backedge_count, Rtmp);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1227
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1228
  blt(CCR0, did_not_overflow);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1229
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1230
  // When ProfileInterpreter is on, the backedge_count comes from the
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1231
  // methodDataOop, which value does not get reset on the call to
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1232
  // frequency_counter_overflow(). To avoid excessive calls to the overflow
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1233
  // routine while the method is being compiled, add a second test to make sure
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1234
  // the overflow function is called only once every overflow_frequency.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1235
  if (ProfileInterpreter) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1236
    const int overflow_frequency = 1024;
35085
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 33083
diff changeset
  1237
    andi_(Rtmp, backedge_count, overflow_frequency-1);
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1238
    bne(CCR0, did_not_overflow);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1239
  }
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1240
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1241
  // Overflow in loop, pass branch bytecode.
35085
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 33083
diff changeset
  1242
  subf(R4_ARG2, disp, target_bcp); // Compute branch bytecode (previous bcp).
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 33083
diff changeset
  1243
  call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::frequency_counter_overflow), R4_ARG2, true);
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1244
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1245
  // Was an OSR adapter generated?
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1246
  cmpdi(CCR0, R3_RET, 0);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1247
  beq(CCR0, overflow_with_error);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1248
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1249
  // Has the nmethod been invalidated already?
26705
fca1785e7084 8048721: -XX:+PrintCompilation prints negative bci for non entrant OSR methods
thartmann
parents: 25916
diff changeset
  1250
  lbz(Rtmp, nmethod::state_offset(), R3_RET);
fca1785e7084 8048721: -XX:+PrintCompilation prints negative bci for non entrant OSR methods
thartmann
parents: 25916
diff changeset
  1251
  cmpwi(CCR0, Rtmp, nmethod::in_use);
fca1785e7084 8048721: -XX:+PrintCompilation prints negative bci for non entrant OSR methods
thartmann
parents: 25916
diff changeset
  1252
  bne(CCR0, overflow_with_error);
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1253
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1254
  // Migrate the interpreter frame off of the stack.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1255
  // We can use all registers because we will not return to interpreter from this point.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1256
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1257
  // Save nmethod.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1258
  const Register osr_nmethod = R31;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1259
  mr(osr_nmethod, R3_RET);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1260
  set_top_ijava_frame_at_SP_as_last_Java_frame(R1_SP, R11_scratch1);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1261
  call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::OSR_migration_begin), R16_thread);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1262
  reset_last_Java_frame();
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1263
  // OSR buffer is in ARG1
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1264
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1265
  // Remove the interpreter frame.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1266
  merge_frames(/*top_frame_sp*/ R21_sender_SP, /*return_pc*/ R0, R11_scratch1, R12_scratch2);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1267
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1268
  // Jump to the osr code.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1269
  ld(R11_scratch1, nmethod::osr_entry_point_offset(), osr_nmethod);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1270
  mtlr(R0);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1271
  mtctr(R11_scratch1);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1272
  bctr();
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1273
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1274
  align(32, 12);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1275
  bind(overflow_with_error);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1276
  bind(did_not_overflow);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1277
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1278
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1279
// Store a value at some constant offset from the method data pointer.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1280
void InterpreterMacroAssembler::set_mdp_data_at(int constant, Register value) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1281
  assert(ProfileInterpreter, "must be profiling interpreter");
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1282
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1283
  std(value, constant, R28_mdx);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1284
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1285
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1286
// Increment the value at some constant offset from the method data pointer.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1287
void InterpreterMacroAssembler::increment_mdp_data_at(int constant,
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1288
                                                      Register counter_addr,
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1289
                                                      Register Rbumped_count,
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1290
                                                      bool decrement) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1291
  // Locate the counter at a fixed offset from the mdp:
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1292
  addi(counter_addr, R28_mdx, constant);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1293
  increment_mdp_data_at(counter_addr, Rbumped_count, decrement);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1294
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1295
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1296
// Increment the value at some non-fixed (reg + constant) offset from
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1297
// the method data pointer.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1298
void InterpreterMacroAssembler::increment_mdp_data_at(Register reg,
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1299
                                                      int constant,
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1300
                                                      Register scratch,
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1301
                                                      Register Rbumped_count,
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1302
                                                      bool decrement) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1303
  // Add the constant to reg to get the offset.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1304
  add(scratch, R28_mdx, reg);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1305
  // Then calculate the counter address.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1306
  addi(scratch, scratch, constant);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1307
  increment_mdp_data_at(scratch, Rbumped_count, decrement);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1308
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1309
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1310
void InterpreterMacroAssembler::increment_mdp_data_at(Register counter_addr,
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1311
                                                      Register Rbumped_count,
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1312
                                                      bool decrement) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1313
  assert(ProfileInterpreter, "must be profiling interpreter");
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1314
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1315
  // Load the counter.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1316
  ld(Rbumped_count, 0, counter_addr);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1317
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1318
  if (decrement) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1319
    // Decrement the register. Set condition codes.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1320
    addi(Rbumped_count, Rbumped_count, - DataLayout::counter_increment);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1321
    // Store the decremented counter, if it is still negative.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1322
    std(Rbumped_count, 0, counter_addr);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1323
    // Note: add/sub overflow check are not ported, since 64 bit
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1324
    // calculation should never overflow.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1325
  } else {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1326
    // Increment the register. Set carry flag.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1327
    addi(Rbumped_count, Rbumped_count, DataLayout::counter_increment);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1328
    // Store the incremented counter.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1329
    std(Rbumped_count, 0, counter_addr);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1330
  }
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1331
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1332
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1333
// Set a flag value at the current method data pointer position.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1334
void InterpreterMacroAssembler::set_mdp_flag_at(int flag_constant,
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1335
                                                Register scratch) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1336
  assert(ProfileInterpreter, "must be profiling interpreter");
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1337
  // Load the data header.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1338
  lbz(scratch, in_bytes(DataLayout::flags_offset()), R28_mdx);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1339
  // Set the flag.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1340
  ori(scratch, scratch, flag_constant);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1341
  // Store the modified header.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1342
  stb(scratch, in_bytes(DataLayout::flags_offset()), R28_mdx);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1343
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1344
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1345
// Test the location at some offset from the method data pointer.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1346
// If it is not equal to value, branch to the not_equal_continue Label.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1347
void InterpreterMacroAssembler::test_mdp_data_at(int offset,
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1348
                                                 Register value,
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1349
                                                 Label& not_equal_continue,
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1350
                                                 Register test_out) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1351
  assert(ProfileInterpreter, "must be profiling interpreter");
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1352
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1353
  ld(test_out, offset, R28_mdx);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1354
  cmpd(CCR0,  value, test_out);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1355
  bne(CCR0, not_equal_continue);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1356
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1357
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1358
// Update the method data pointer by the displacement located at some fixed
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1359
// offset from the method data pointer.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1360
void InterpreterMacroAssembler::update_mdp_by_offset(int offset_of_disp,
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1361
                                                     Register scratch) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1362
  assert(ProfileInterpreter, "must be profiling interpreter");
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1363
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1364
  ld(scratch, offset_of_disp, R28_mdx);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1365
  add(R28_mdx, scratch, R28_mdx);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1366
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1367
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1368
// Update the method data pointer by the displacement located at the
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1369
// offset (reg + offset_of_disp).
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1370
void InterpreterMacroAssembler::update_mdp_by_offset(Register reg,
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1371
                                                     int offset_of_disp,
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1372
                                                     Register scratch) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1373
  assert(ProfileInterpreter, "must be profiling interpreter");
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1374
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1375
  add(scratch, reg, R28_mdx);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1376
  ld(scratch, offset_of_disp, scratch);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1377
  add(R28_mdx, scratch, R28_mdx);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1378
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1379
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1380
// Update the method data pointer by a simple constant displacement.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1381
void InterpreterMacroAssembler::update_mdp_by_constant(int constant) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1382
  assert(ProfileInterpreter, "must be profiling interpreter");
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1383
  addi(R28_mdx, R28_mdx, constant);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1384
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1385
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1386
// Update the method data pointer for a _ret bytecode whose target
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1387
// was not among our cached targets.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1388
void InterpreterMacroAssembler::update_mdp_for_ret(TosState state,
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1389
                                                   Register return_bci) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1390
  assert(ProfileInterpreter, "must be profiling interpreter");
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1391
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1392
  push(state);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1393
  assert(return_bci->is_nonvolatile(), "need to protect return_bci");
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1394
  call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::update_mdp_for_ret), return_bci);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1395
  pop(state);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1396
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1397
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1398
// Increments the backedge counter.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1399
// Returns backedge counter + invocation counter in Rdst.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1400
void InterpreterMacroAssembler::increment_backedge_counter(const Register Rcounters, const Register Rdst,
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1401
                                                           const Register Rtmp1, Register Rscratch) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1402
  assert(UseCompiler, "incrementing must be useful");
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1403
  assert_different_registers(Rdst, Rtmp1);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1404
  const Register invocation_counter = Rtmp1;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1405
  const Register counter = Rdst;
35085
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 33083
diff changeset
  1406
  // TODO: PPC port: assert(4 == InvocationCounter::sz_counter(), "unexpected field size.");
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1407
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1408
  // Load backedge counter.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1409
  lwz(counter, in_bytes(MethodCounters::backedge_counter_offset()) +
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1410
               in_bytes(InvocationCounter::counter_offset()), Rcounters);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1411
  // Load invocation counter.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1412
  lwz(invocation_counter, in_bytes(MethodCounters::invocation_counter_offset()) +
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1413
                          in_bytes(InvocationCounter::counter_offset()), Rcounters);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1414
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1415
  // Add the delta to the backedge counter.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1416
  addi(counter, counter, InvocationCounter::count_increment);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1417
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1418
  // Mask the invocation counter.
35085
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 33083
diff changeset
  1419
  andi(invocation_counter, invocation_counter, InvocationCounter::count_mask_value);
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1420
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1421
  // Store new counter value.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1422
  stw(counter, in_bytes(MethodCounters::backedge_counter_offset()) +
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1423
               in_bytes(InvocationCounter::counter_offset()), Rcounters);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1424
  // Return invocation counter + backedge counter.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1425
  add(counter, counter, invocation_counter);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1426
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1427
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1428
// Count a taken branch in the bytecodes.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1429
void InterpreterMacroAssembler::profile_taken_branch(Register scratch, Register bumped_count) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1430
  if (ProfileInterpreter) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1431
    Label profile_continue;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1432
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1433
    // If no method data exists, go to profile_continue.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1434
    test_method_data_pointer(profile_continue);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1435
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1436
    // We are taking a branch. Increment the taken count.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1437
    increment_mdp_data_at(in_bytes(JumpData::taken_offset()), scratch, bumped_count);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1438
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1439
    // The method data pointer needs to be updated to reflect the new target.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1440
    update_mdp_by_offset(in_bytes(JumpData::displacement_offset()), scratch);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1441
    bind (profile_continue);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1442
  }
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1443
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1444
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1445
// Count a not-taken branch in the bytecodes.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1446
void InterpreterMacroAssembler::profile_not_taken_branch(Register scratch1, Register scratch2) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1447
  if (ProfileInterpreter) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1448
    Label profile_continue;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1449
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1450
    // If no method data exists, go to profile_continue.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1451
    test_method_data_pointer(profile_continue);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1452
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1453
    // We are taking a branch. Increment the not taken count.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1454
    increment_mdp_data_at(in_bytes(BranchData::not_taken_offset()), scratch1, scratch2);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1455
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1456
    // The method data pointer needs to be updated to correspond to the
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1457
    // next bytecode.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1458
    update_mdp_by_constant(in_bytes(BranchData::branch_data_size()));
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1459
    bind (profile_continue);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1460
  }
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1461
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1462
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1463
// Count a non-virtual call in the bytecodes.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1464
void InterpreterMacroAssembler::profile_call(Register scratch1, Register scratch2) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1465
  if (ProfileInterpreter) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1466
    Label profile_continue;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1467
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1468
    // If no method data exists, go to profile_continue.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1469
    test_method_data_pointer(profile_continue);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1470
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1471
    // We are making a call. Increment the count.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1472
    increment_mdp_data_at(in_bytes(CounterData::count_offset()), scratch1, scratch2);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1473
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1474
    // The method data pointer needs to be updated to reflect the new target.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1475
    update_mdp_by_constant(in_bytes(CounterData::counter_data_size()));
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1476
    bind (profile_continue);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1477
  }
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1478
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1479
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1480
// Count a final call in the bytecodes.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1481
void InterpreterMacroAssembler::profile_final_call(Register scratch1, Register scratch2) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1482
  if (ProfileInterpreter) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1483
    Label profile_continue;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1484
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1485
    // If no method data exists, go to profile_continue.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1486
    test_method_data_pointer(profile_continue);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1487
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1488
    // We are making a call. Increment the count.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1489
    increment_mdp_data_at(in_bytes(CounterData::count_offset()), scratch1, scratch2);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1490
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1491
    // The method data pointer needs to be updated to reflect the new target.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1492
    update_mdp_by_constant(in_bytes(VirtualCallData::virtual_call_data_size()));
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1493
    bind (profile_continue);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1494
  }
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1495
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1496
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1497
// Count a virtual call in the bytecodes.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1498
void InterpreterMacroAssembler::profile_virtual_call(Register Rreceiver,
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1499
                                                     Register Rscratch1,
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1500
                                                     Register Rscratch2,
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1501
                                                     bool receiver_can_be_null) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1502
  if (!ProfileInterpreter) { return; }
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1503
  Label profile_continue;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1504
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1505
  // If no method data exists, go to profile_continue.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1506
  test_method_data_pointer(profile_continue);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1507
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1508
  Label skip_receiver_profile;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1509
  if (receiver_can_be_null) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1510
    Label not_null;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1511
    cmpdi(CCR0, Rreceiver, 0);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1512
    bne(CCR0, not_null);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1513
    // We are making a call. Increment the count for null receiver.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1514
    increment_mdp_data_at(in_bytes(CounterData::count_offset()), Rscratch1, Rscratch2);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1515
    b(skip_receiver_profile);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1516
    bind(not_null);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1517
  }
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1518
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1519
  // Record the receiver type.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1520
  record_klass_in_profile(Rreceiver, Rscratch1, Rscratch2, true);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1521
  bind(skip_receiver_profile);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1522
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1523
  // The method data pointer needs to be updated to reflect the new target.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1524
  update_mdp_by_constant(in_bytes(VirtualCallData::virtual_call_data_size()));
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1525
  bind (profile_continue);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1526
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1527
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1528
void InterpreterMacroAssembler::profile_typecheck(Register Rklass, Register Rscratch1, Register Rscratch2) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1529
  if (ProfileInterpreter) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1530
    Label profile_continue;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1531
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1532
    // If no method data exists, go to profile_continue.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1533
    test_method_data_pointer(profile_continue);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1534
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1535
    int mdp_delta = in_bytes(BitData::bit_data_size());
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1536
    if (TypeProfileCasts) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1537
      mdp_delta = in_bytes(VirtualCallData::virtual_call_data_size());
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1538
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1539
      // Record the object type.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1540
      record_klass_in_profile(Rklass, Rscratch1, Rscratch2, false);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1541
    }
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1542
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1543
    // The method data pointer needs to be updated.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1544
    update_mdp_by_constant(mdp_delta);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1545
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1546
    bind (profile_continue);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1547
  }
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1548
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1549
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1550
void InterpreterMacroAssembler::profile_typecheck_failed(Register Rscratch1, Register Rscratch2) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1551
  if (ProfileInterpreter && TypeProfileCasts) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1552
    Label profile_continue;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1553
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1554
    // If no method data exists, go to profile_continue.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1555
    test_method_data_pointer(profile_continue);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1556
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1557
    int count_offset = in_bytes(CounterData::count_offset());
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1558
    // Back up the address, since we have already bumped the mdp.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1559
    count_offset -= in_bytes(VirtualCallData::virtual_call_data_size());
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1560
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1561
    // *Decrement* the counter. We expect to see zero or small negatives.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1562
    increment_mdp_data_at(count_offset, Rscratch1, Rscratch2, true);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1563
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1564
    bind (profile_continue);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1565
  }
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1566
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1567
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1568
// Count a ret in the bytecodes.
35166
23125410af16 8145117: PPC64: Remove cpp interpreter implementation
goetz
parents: 33083
diff changeset
  1569
void InterpreterMacroAssembler::profile_ret(TosState state, Register return_bci,
23125410af16 8145117: PPC64: Remove cpp interpreter implementation
goetz
parents: 33083
diff changeset
  1570
                                            Register scratch1, Register scratch2) {
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1571
  if (ProfileInterpreter) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1572
    Label profile_continue;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1573
    uint row;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1574
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1575
    // If no method data exists, go to profile_continue.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1576
    test_method_data_pointer(profile_continue);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1577
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1578
    // Update the total ret count.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1579
    increment_mdp_data_at(in_bytes(CounterData::count_offset()), scratch1, scratch2 );
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1580
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1581
    for (row = 0; row < RetData::row_limit(); row++) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1582
      Label next_test;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1583
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1584
      // See if return_bci is equal to bci[n]:
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1585
      test_mdp_data_at(in_bytes(RetData::bci_offset(row)), return_bci, next_test, scratch1);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1586
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1587
      // return_bci is equal to bci[n]. Increment the count.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1588
      increment_mdp_data_at(in_bytes(RetData::bci_count_offset(row)), scratch1, scratch2);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1589
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1590
      // The method data pointer needs to be updated to reflect the new target.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1591
      update_mdp_by_offset(in_bytes(RetData::bci_displacement_offset(row)), scratch1);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1592
      b(profile_continue);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1593
      bind(next_test);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1594
    }
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1595
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1596
    update_mdp_for_ret(state, return_bci);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1597
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1598
    bind (profile_continue);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1599
  }
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1600
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1601
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1602
// Count the default case of a switch construct.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1603
void InterpreterMacroAssembler::profile_switch_default(Register scratch1,  Register scratch2) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1604
  if (ProfileInterpreter) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1605
    Label profile_continue;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1606
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1607
    // If no method data exists, go to profile_continue.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1608
    test_method_data_pointer(profile_continue);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1609
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1610
    // Update the default case count
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1611
    increment_mdp_data_at(in_bytes(MultiBranchData::default_count_offset()),
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1612
                          scratch1, scratch2);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1613
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1614
    // The method data pointer needs to be updated.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1615
    update_mdp_by_offset(in_bytes(MultiBranchData::default_displacement_offset()),
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1616
                         scratch1);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1617
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1618
    bind (profile_continue);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1619
  }
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1620
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1621
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1622
// Count the index'th case of a switch construct.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1623
void InterpreterMacroAssembler::profile_switch_case(Register index,
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1624
                                                    Register scratch1,
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1625
                                                    Register scratch2,
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1626
                                                    Register scratch3) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1627
  if (ProfileInterpreter) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1628
    assert_different_registers(index, scratch1, scratch2, scratch3);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1629
    Label profile_continue;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1630
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1631
    // If no method data exists, go to profile_continue.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1632
    test_method_data_pointer(profile_continue);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1633
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1634
    // Build the base (index * per_case_size_in_bytes()) + case_array_offset_in_bytes().
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1635
    li(scratch3, in_bytes(MultiBranchData::case_array_offset()));
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1636
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1637
    assert (in_bytes(MultiBranchData::per_case_size()) == 16, "so that shladd works");
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1638
    sldi(scratch1, index, exact_log2(in_bytes(MultiBranchData::per_case_size())));
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1639
    add(scratch1, scratch1, scratch3);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1640
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1641
    // Update the case count.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1642
    increment_mdp_data_at(scratch1, in_bytes(MultiBranchData::relative_count_offset()), scratch2, scratch3);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1643
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1644
    // The method data pointer needs to be updated.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1645
    update_mdp_by_offset(scratch1, in_bytes(MultiBranchData::relative_displacement_offset()), scratch2);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1646
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1647
    bind (profile_continue);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1648
  }
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1649
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1650
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1651
void InterpreterMacroAssembler::profile_null_seen(Register Rscratch1, Register Rscratch2) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1652
  if (ProfileInterpreter) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1653
    assert_different_registers(Rscratch1, Rscratch2);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1654
    Label profile_continue;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1655
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1656
    // If no method data exists, go to profile_continue.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1657
    test_method_data_pointer(profile_continue);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1658
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1659
    set_mdp_flag_at(BitData::null_seen_byte_constant(), Rscratch1);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1660
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1661
    // The method data pointer needs to be updated.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1662
    int mdp_delta = in_bytes(BitData::bit_data_size());
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1663
    if (TypeProfileCasts) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1664
      mdp_delta = in_bytes(VirtualCallData::virtual_call_data_size());
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1665
    }
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1666
    update_mdp_by_constant(mdp_delta);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1667
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1668
    bind (profile_continue);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1669
  }
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1670
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1671
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1672
void InterpreterMacroAssembler::record_klass_in_profile(Register Rreceiver,
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1673
                                                        Register Rscratch1, Register Rscratch2,
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1674
                                                        bool is_virtual_call) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1675
  assert(ProfileInterpreter, "must be profiling");
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1676
  assert_different_registers(Rreceiver, Rscratch1, Rscratch2);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1677
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1678
  Label done;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1679
  record_klass_in_profile_helper(Rreceiver, Rscratch1, Rscratch2, 0, done, is_virtual_call);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1680
  bind (done);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1681
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1682
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1683
void InterpreterMacroAssembler::record_klass_in_profile_helper(
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1684
                                        Register receiver, Register scratch1, Register scratch2,
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1685
                                        int start_row, Label& done, bool is_virtual_call) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1686
  if (TypeProfileWidth == 0) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1687
    if (is_virtual_call) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1688
      increment_mdp_data_at(in_bytes(CounterData::count_offset()), scratch1, scratch2);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1689
    }
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1690
    return;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1691
  }
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1692
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1693
  int last_row = VirtualCallData::row_limit() - 1;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1694
  assert(start_row <= last_row, "must be work left to do");
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1695
  // Test this row for both the receiver and for null.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1696
  // Take any of three different outcomes:
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1697
  //   1. found receiver => increment count and goto done
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1698
  //   2. found null => keep looking for case 1, maybe allocate this cell
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1699
  //   3. found something else => keep looking for cases 1 and 2
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1700
  // Case 3 is handled by a recursive call.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1701
  for (int row = start_row; row <= last_row; row++) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1702
    Label next_test;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1703
    bool test_for_null_also = (row == start_row);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1704
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1705
    // See if the receiver is receiver[n].
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1706
    int recvr_offset = in_bytes(VirtualCallData::receiver_offset(row));
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1707
    test_mdp_data_at(recvr_offset, receiver, next_test, scratch1);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1708
    // delayed()->tst(scratch);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1709
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1710
    // The receiver is receiver[n]. Increment count[n].
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1711
    int count_offset = in_bytes(VirtualCallData::receiver_count_offset(row));
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1712
    increment_mdp_data_at(count_offset, scratch1, scratch2);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1713
    b(done);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1714
    bind(next_test);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1715
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1716
    if (test_for_null_also) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1717
      Label found_null;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1718
      // Failed the equality check on receiver[n]... Test for null.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1719
      if (start_row == last_row) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1720
        // The only thing left to do is handle the null case.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1721
        if (is_virtual_call) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1722
          // Scratch1 contains test_out from test_mdp_data_at.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1723
          cmpdi(CCR0, scratch1, 0);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1724
          beq(CCR0, found_null);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1725
          // Receiver did not match any saved receiver and there is no empty row for it.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1726
          // Increment total counter to indicate polymorphic case.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1727
          increment_mdp_data_at(in_bytes(CounterData::count_offset()), scratch1, scratch2);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1728
          b(done);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1729
          bind(found_null);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1730
        } else {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1731
          cmpdi(CCR0, scratch1, 0);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1732
          bne(CCR0, done);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1733
        }
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1734
        break;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1735
      }
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1736
      // Since null is rare, make it be the branch-taken case.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1737
      cmpdi(CCR0, scratch1, 0);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1738
      beq(CCR0, found_null);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1739
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1740
      // Put all the "Case 3" tests here.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1741
      record_klass_in_profile_helper(receiver, scratch1, scratch2, start_row + 1, done, is_virtual_call);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1742
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1743
      // Found a null. Keep searching for a matching receiver,
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1744
      // but remember that this is an empty (unused) slot.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1745
      bind(found_null);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1746
    }
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1747
  }
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1748
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1749
  // In the fall-through case, we found no matching receiver, but we
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1750
  // observed the receiver[start_row] is NULL.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1751
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1752
  // Fill in the receiver field and increment the count.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1753
  int recvr_offset = in_bytes(VirtualCallData::receiver_offset(start_row));
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1754
  set_mdp_data_at(recvr_offset, receiver);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1755
  int count_offset = in_bytes(VirtualCallData::receiver_count_offset(start_row));
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1756
  li(scratch1, DataLayout::counter_increment);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1757
  set_mdp_data_at(count_offset, scratch1);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1758
  if (start_row > 0) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1759
    b(done);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1760
  }
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1761
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1762
28187
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1763
// Argument and return type profilig.
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1764
// kills: tmp, tmp2, R0, CR0, CR1
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1765
void InterpreterMacroAssembler::profile_obj_type(Register obj, Register mdo_addr_base,
35166
23125410af16 8145117: PPC64: Remove cpp interpreter implementation
goetz
parents: 33083
diff changeset
  1766
                                                 RegisterOrConstant mdo_addr_offs,
23125410af16 8145117: PPC64: Remove cpp interpreter implementation
goetz
parents: 33083
diff changeset
  1767
                                                 Register tmp, Register tmp2) {
28187
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1768
  Label do_nothing, do_update;
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1769
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1770
  // tmp2 = obj is allowed
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1771
  assert_different_registers(obj, mdo_addr_base, tmp, R0);
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1772
  assert_different_registers(tmp2, mdo_addr_base, tmp, R0);
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1773
  const Register klass = tmp2;
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1774
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1775
  verify_oop(obj);
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1776
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1777
  ld(tmp, mdo_addr_offs, mdo_addr_base);
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1778
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1779
  // Set null_seen if obj is 0.
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1780
  cmpdi(CCR0, obj, 0);
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1781
  ori(R0, tmp, TypeEntries::null_seen);
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1782
  beq(CCR0, do_update);
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1783
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1784
  load_klass(klass, obj);
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1785
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1786
  clrrdi(R0, tmp, exact_log2(-TypeEntries::type_klass_mask));
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1787
  // Basically same as andi(R0, tmp, TypeEntries::type_klass_mask);
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1788
  cmpd(CCR1, R0, klass);
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1789
  // Klass seen before, nothing to do (regardless of unknown bit).
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1790
  //beq(CCR1, do_nothing);
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1791
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1792
  andi_(R0, klass, TypeEntries::type_unknown);
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1793
  // Already unknown. Nothing to do anymore.
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1794
  //bne(CCR0, do_nothing);
28492
57fecf138f7b 8068724: ppc64: update assembler: SPR access, CR logic, HTM
mdoerr
parents: 28187
diff changeset
  1795
  crorc(CCR0, Assembler::equal, CCR1, Assembler::equal); // cr0 eq = cr1 eq or cr0 ne
28187
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1796
  beq(CCR0, do_nothing);
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1797
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1798
  clrrdi_(R0, tmp, exact_log2(-TypeEntries::type_mask));
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1799
  orr(R0, klass, tmp); // Combine klass and null_seen bit (only used if (tmp & type_mask)==0).
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1800
  beq(CCR0, do_update); // First time here. Set profile type.
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1801
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1802
  // Different than before. Cannot keep accurate profile.
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1803
  ori(R0, tmp, TypeEntries::type_unknown);
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1804
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1805
  bind(do_update);
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1806
  // update profile
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1807
  std(R0, mdo_addr_offs, mdo_addr_base);
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1808
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1809
  align(32, 12);
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1810
  bind(do_nothing);
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1811
}
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1812
35166
23125410af16 8145117: PPC64: Remove cpp interpreter implementation
goetz
parents: 33083
diff changeset
  1813
void InterpreterMacroAssembler::profile_arguments_type(Register callee,
23125410af16 8145117: PPC64: Remove cpp interpreter implementation
goetz
parents: 33083
diff changeset
  1814
                                                       Register tmp1, Register tmp2,
23125410af16 8145117: PPC64: Remove cpp interpreter implementation
goetz
parents: 33083
diff changeset
  1815
                                                       bool is_virtual) {
28187
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1816
  if (!ProfileInterpreter) {
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1817
    return;
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1818
  }
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1819
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1820
  assert_different_registers(callee, tmp1, tmp2, R28_mdx);
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1821
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1822
  if (MethodData::profile_arguments() || MethodData::profile_return()) {
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1823
    Label profile_continue;
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1824
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1825
    test_method_data_pointer(profile_continue);
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1826
35166
23125410af16 8145117: PPC64: Remove cpp interpreter implementation
goetz
parents: 33083
diff changeset
  1827
    int off_to_start = is_virtual ?
23125410af16 8145117: PPC64: Remove cpp interpreter implementation
goetz
parents: 33083
diff changeset
  1828
      in_bytes(VirtualCallData::virtual_call_data_size()) : in_bytes(CounterData::counter_data_size());
28187
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1829
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1830
    lbz(tmp1, in_bytes(DataLayout::tag_offset()) - off_to_start, R28_mdx);
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1831
    cmpwi(CCR0, tmp1, is_virtual ? DataLayout::virtual_call_type_data_tag : DataLayout::call_type_data_tag);
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1832
    bne(CCR0, profile_continue);
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1833
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1834
    if (MethodData::profile_arguments()) {
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1835
      Label done;
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1836
      int off_to_args = in_bytes(TypeEntriesAtCall::args_data_offset());
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1837
      add(R28_mdx, off_to_args, R28_mdx);
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1838
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1839
      for (int i = 0; i < TypeProfileArgsLimit; i++) {
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1840
        if (i > 0 || MethodData::profile_return()) {
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1841
          // If return value type is profiled we may have no argument to profile.
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1842
          ld(tmp1, in_bytes(TypeEntriesAtCall::cell_count_offset())-off_to_args, R28_mdx);
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1843
          cmpdi(CCR0, tmp1, (i+1)*TypeStackSlotEntries::per_arg_count());
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1844
          addi(tmp1, tmp1, -i*TypeStackSlotEntries::per_arg_count());
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1845
          blt(CCR0, done);
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1846
        }
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1847
        ld(tmp1, in_bytes(Method::const_offset()), callee);
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1848
        lhz(tmp1, in_bytes(ConstMethod::size_of_parameters_offset()), tmp1);
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1849
        // Stack offset o (zero based) from the start of the argument
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1850
        // list, for n arguments translates into offset n - o - 1 from
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1851
        // the end of the argument list. But there's an extra slot at
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1852
        // the top of the stack. So the offset is n - o from Lesp.
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1853
        ld(tmp2, in_bytes(TypeEntriesAtCall::stack_slot_offset(i))-off_to_args, R28_mdx);
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1854
        subf(tmp1, tmp2, tmp1);
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1855
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1856
        sldi(tmp1, tmp1, Interpreter::logStackElementSize);
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1857
        ldx(tmp1, tmp1, R15_esp);
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1858
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1859
        profile_obj_type(tmp1, R28_mdx, in_bytes(TypeEntriesAtCall::argument_type_offset(i))-off_to_args, tmp2, tmp1);
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1860
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1861
        int to_add = in_bytes(TypeStackSlotEntries::per_arg_size());
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1862
        addi(R28_mdx, R28_mdx, to_add);
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1863
        off_to_args += to_add;
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1864
      }
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1865
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1866
      if (MethodData::profile_return()) {
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1867
        ld(tmp1, in_bytes(TypeEntriesAtCall::cell_count_offset())-off_to_args, R28_mdx);
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1868
        addi(tmp1, tmp1, -TypeProfileArgsLimit*TypeStackSlotEntries::per_arg_count());
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1869
      }
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1870
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1871
      bind(done);
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1872
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1873
      if (MethodData::profile_return()) {
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1874
        // We're right after the type profile for the last
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1875
        // argument. tmp1 is the number of cells left in the
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1876
        // CallTypeData/VirtualCallTypeData to reach its end. Non null
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1877
        // if there's a return to profile.
35166
23125410af16 8145117: PPC64: Remove cpp interpreter implementation
goetz
parents: 33083
diff changeset
  1878
        assert(ReturnTypeEntry::static_cell_count() < TypeStackSlotEntries::per_arg_count(),
23125410af16 8145117: PPC64: Remove cpp interpreter implementation
goetz
parents: 33083
diff changeset
  1879
               "can't move past ret type");
28187
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1880
        sldi(tmp1, tmp1, exact_log2(DataLayout::cell_size));
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1881
        add(R28_mdx, tmp1, R28_mdx);
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1882
      }
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1883
    } else {
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1884
      assert(MethodData::profile_return(), "either profile call args or call ret");
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1885
      update_mdp_by_constant(in_bytes(TypeEntriesAtCall::return_only_size()));
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1886
    }
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1887
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1888
    // Mdp points right after the end of the
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1889
    // CallTypeData/VirtualCallTypeData, right after the cells for the
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1890
    // return value type if there's one.
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1891
    align(32, 12);
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1892
    bind(profile_continue);
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1893
  }
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1894
}
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1895
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1896
void InterpreterMacroAssembler::profile_return_type(Register ret, Register tmp1, Register tmp2) {
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1897
  assert_different_registers(ret, tmp1, tmp2);
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1898
  if (ProfileInterpreter && MethodData::profile_return()) {
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1899
    Label profile_continue;
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1900
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1901
    test_method_data_pointer(profile_continue);
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1902
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1903
    if (MethodData::profile_return_jsr292_only()) {
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1904
      // If we don't profile all invoke bytecodes we must make sure
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1905
      // it's a bytecode we indeed profile. We can't go back to the
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1906
      // begining of the ProfileData we intend to update to check its
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1907
      // type because we're right after it and we don't known its
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1908
      // length.
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1909
      lbz(tmp1, 0, R14_bcp);
35085
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 33083
diff changeset
  1910
      lbz(tmp2, Method::intrinsic_id_offset_in_bytes(), R19_method);
28187
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1911
      cmpwi(CCR0, tmp1, Bytecodes::_invokedynamic);
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1912
      cmpwi(CCR1, tmp1, Bytecodes::_invokehandle);
28492
57fecf138f7b 8068724: ppc64: update assembler: SPR access, CR logic, HTM
mdoerr
parents: 28187
diff changeset
  1913
      cror(CCR0, Assembler::equal, CCR1, Assembler::equal);
28187
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1914
      cmpwi(CCR1, tmp2, vmIntrinsics::_compiledLambdaForm);
28492
57fecf138f7b 8068724: ppc64: update assembler: SPR access, CR logic, HTM
mdoerr
parents: 28187
diff changeset
  1915
      cror(CCR0, Assembler::equal, CCR1, Assembler::equal);
28187
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1916
      bne(CCR0, profile_continue);
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1917
    }
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1918
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1919
    profile_obj_type(ret, R28_mdx, -in_bytes(ReturnTypeEntry::size()), tmp1, tmp2);
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1920
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1921
    align(32, 12);
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1922
    bind(profile_continue);
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1923
  }
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1924
}
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1925
35166
23125410af16 8145117: PPC64: Remove cpp interpreter implementation
goetz
parents: 33083
diff changeset
  1926
void InterpreterMacroAssembler::profile_parameters_type(Register tmp1, Register tmp2,
23125410af16 8145117: PPC64: Remove cpp interpreter implementation
goetz
parents: 33083
diff changeset
  1927
                                                        Register tmp3, Register tmp4) {
28187
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1928
  if (ProfileInterpreter && MethodData::profile_parameters()) {
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1929
    Label profile_continue, done;
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1930
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1931
    test_method_data_pointer(profile_continue);
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1932
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1933
    // Load the offset of the area within the MDO used for
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1934
    // parameters. If it's negative we're not profiling any parameters.
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1935
    lwz(tmp1, in_bytes(MethodData::parameters_type_data_di_offset()) - in_bytes(MethodData::data_offset()), R28_mdx);
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1936
    cmpwi(CCR0, tmp1, 0);
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1937
    blt(CCR0, profile_continue);
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1938
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1939
    // Compute a pointer to the area for parameters from the offset
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1940
    // and move the pointer to the slot for the last
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1941
    // parameters. Collect profiling from last parameter down.
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1942
    // mdo start + parameters offset + array length - 1
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1943
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1944
    // Pointer to the parameter area in the MDO.
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1945
    const Register mdp = tmp1;
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1946
    add(mdp, tmp1, R28_mdx);
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1947
30303
c703c89fddbf 8077838: Recent developments for ppc.
goetz
parents: 29080
diff changeset
  1948
    // Offset of the current profile entry to update.
28187
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1949
    const Register entry_offset = tmp2;
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1950
    // entry_offset = array len in number of cells
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1951
    ld(entry_offset, in_bytes(ArrayData::array_len_offset()), mdp);
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1952
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1953
    int off_base = in_bytes(ParametersTypeData::stack_slot_offset(0));
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1954
    assert(off_base % DataLayout::cell_size == 0, "should be a number of cells");
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1955
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1956
    // entry_offset (number of cells)  = array len - size of 1 entry + offset of the stack slot field
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1957
    addi(entry_offset, entry_offset, -TypeStackSlotEntries::per_arg_count() + (off_base / DataLayout::cell_size));
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1958
    // entry_offset in bytes
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1959
    sldi(entry_offset, entry_offset, exact_log2(DataLayout::cell_size));
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1960
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1961
    Label loop;
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1962
    align(32, 12);
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1963
    bind(loop);
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1964
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1965
    // Load offset on the stack from the slot for this parameter.
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1966
    ld(tmp3, entry_offset, mdp);
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1967
    sldi(tmp3, tmp3, Interpreter::logStackElementSize);
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1968
    neg(tmp3, tmp3);
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1969
    // Read the parameter from the local area.
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1970
    ldx(tmp3, tmp3, R18_locals);
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1971
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1972
    // Make entry_offset now point to the type field for this parameter.
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1973
    int type_base = in_bytes(ParametersTypeData::type_offset(0));
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1974
    assert(type_base > off_base, "unexpected");
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1975
    addi(entry_offset, entry_offset, type_base - off_base);
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1976
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1977
    // Profile the parameter.
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1978
    profile_obj_type(tmp3, mdp, entry_offset, tmp4, tmp3);
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1979
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1980
    // Go to next parameter.
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1981
    int delta = TypeStackSlotEntries::per_arg_count() * DataLayout::cell_size + (type_base - off_base);
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1982
    cmpdi(CCR0, entry_offset, off_base + delta);
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1983
    addi(entry_offset, entry_offset, -delta);
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1984
    bge(CCR0, loop);
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1985
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1986
    align(32, 12);
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1987
    bind(profile_continue);
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1988
  }
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1989
}
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  1990
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1991
// Add a InterpMonitorElem to stack (see frame_sparc.hpp).
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1992
void InterpreterMacroAssembler::add_monitor_to_stack(bool stack_is_empty, Register Rtemp1, Register Rtemp2) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1993
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1994
  // Very-local scratch registers.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1995
  const Register esp  = Rtemp1;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1996
  const Register slot = Rtemp2;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1997
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1998
  // Extracted monitor_size.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  1999
  int monitor_size = frame::interpreter_frame_monitor_size_in_bytes();
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2000
  assert(Assembler::is_aligned((unsigned int)monitor_size,
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2001
                               (unsigned int)frame::alignment_in_bytes),
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2002
         "size of a monitor must respect alignment of SP");
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2003
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2004
  resize_frame(-monitor_size, /*temp*/esp); // Allocate space for new monitor
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2005
  std(R1_SP, _ijava_state_neg(top_frame_sp), esp); // esp contains fp
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2006
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2007
  // Shuffle expression stack down. Recall that stack_base points
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2008
  // just above the new expression stack bottom. Old_tos and new_tos
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2009
  // are used to scan thru the old and new expression stacks.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2010
  if (!stack_is_empty) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2011
    Label copy_slot, copy_slot_finished;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2012
    const Register n_slots = slot;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2013
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2014
    addi(esp, R15_esp, Interpreter::stackElementSize); // Point to first element (pre-pushed stack).
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2015
    subf(n_slots, esp, R26_monitor);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2016
    srdi_(n_slots, n_slots, LogBytesPerWord);          // Compute number of slots to copy.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2017
    assert(LogBytesPerWord == 3, "conflicts assembler instructions");
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2018
    beq(CCR0, copy_slot_finished);                     // Nothing to copy.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2019
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2020
    mtctr(n_slots);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2021
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2022
    // loop
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2023
    bind(copy_slot);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2024
    ld(slot, 0, esp);              // Move expression stack down.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2025
    std(slot, -monitor_size, esp); // distance = monitor_size
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2026
    addi(esp, esp, BytesPerWord);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2027
    bdnz(copy_slot);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2028
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2029
    bind(copy_slot_finished);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2030
  }
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2031
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2032
  addi(R15_esp, R15_esp, -monitor_size);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2033
  addi(R26_monitor, R26_monitor, -monitor_size);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2034
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2035
  // Restart interpreter
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2036
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2037
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2038
// ============================================================================
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2039
// Java locals access
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2040
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2041
// Load a local variable at index in Rindex into register Rdst_value.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2042
// Also puts address of local into Rdst_address as a service.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2043
// Kills:
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2044
//   - Rdst_value
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2045
//   - Rdst_address
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2046
void InterpreterMacroAssembler::load_local_int(Register Rdst_value, Register Rdst_address, Register Rindex) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2047
  sldi(Rdst_address, Rindex, Interpreter::logStackElementSize);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2048
  subf(Rdst_address, Rdst_address, R18_locals);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2049
  lwz(Rdst_value, 0, Rdst_address);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2050
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2051
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2052
// Load a local variable at index in Rindex into register Rdst_value.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2053
// Also puts address of local into Rdst_address as a service.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2054
// Kills:
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2055
//   - Rdst_value
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2056
//   - Rdst_address
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2057
void InterpreterMacroAssembler::load_local_long(Register Rdst_value, Register Rdst_address, Register Rindex) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2058
  sldi(Rdst_address, Rindex, Interpreter::logStackElementSize);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2059
  subf(Rdst_address, Rdst_address, R18_locals);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2060
  ld(Rdst_value, -8, Rdst_address);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2061
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2062
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2063
// Load a local variable at index in Rindex into register Rdst_value.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2064
// Also puts address of local into Rdst_address as a service.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2065
// Input:
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2066
//   - Rindex:      slot nr of local variable
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2067
// Kills:
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2068
//   - Rdst_value
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2069
//   - Rdst_address
35166
23125410af16 8145117: PPC64: Remove cpp interpreter implementation
goetz
parents: 33083
diff changeset
  2070
void InterpreterMacroAssembler::load_local_ptr(Register Rdst_value,
23125410af16 8145117: PPC64: Remove cpp interpreter implementation
goetz
parents: 33083
diff changeset
  2071
                                               Register Rdst_address,
23125410af16 8145117: PPC64: Remove cpp interpreter implementation
goetz
parents: 33083
diff changeset
  2072
                                               Register Rindex) {
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2073
  sldi(Rdst_address, Rindex, Interpreter::logStackElementSize);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2074
  subf(Rdst_address, Rdst_address, R18_locals);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2075
  ld(Rdst_value, 0, Rdst_address);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2076
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2077
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2078
// Load a local variable at index in Rindex into register Rdst_value.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2079
// Also puts address of local into Rdst_address as a service.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2080
// Kills:
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2081
//   - Rdst_value
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2082
//   - Rdst_address
35166
23125410af16 8145117: PPC64: Remove cpp interpreter implementation
goetz
parents: 33083
diff changeset
  2083
void InterpreterMacroAssembler::load_local_float(FloatRegister Rdst_value,
23125410af16 8145117: PPC64: Remove cpp interpreter implementation
goetz
parents: 33083
diff changeset
  2084
                                                 Register Rdst_address,
23125410af16 8145117: PPC64: Remove cpp interpreter implementation
goetz
parents: 33083
diff changeset
  2085
                                                 Register Rindex) {
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2086
  sldi(Rdst_address, Rindex, Interpreter::logStackElementSize);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2087
  subf(Rdst_address, Rdst_address, R18_locals);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2088
  lfs(Rdst_value, 0, Rdst_address);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2089
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2090
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2091
// Load a local variable at index in Rindex into register Rdst_value.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2092
// Also puts address of local into Rdst_address as a service.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2093
// Kills:
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2094
//   - Rdst_value
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2095
//   - Rdst_address
35166
23125410af16 8145117: PPC64: Remove cpp interpreter implementation
goetz
parents: 33083
diff changeset
  2096
void InterpreterMacroAssembler::load_local_double(FloatRegister Rdst_value,
23125410af16 8145117: PPC64: Remove cpp interpreter implementation
goetz
parents: 33083
diff changeset
  2097
                                                  Register Rdst_address,
23125410af16 8145117: PPC64: Remove cpp interpreter implementation
goetz
parents: 33083
diff changeset
  2098
                                                  Register Rindex) {
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2099
  sldi(Rdst_address, Rindex, Interpreter::logStackElementSize);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2100
  subf(Rdst_address, Rdst_address, R18_locals);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2101
  lfd(Rdst_value, -8, Rdst_address);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2102
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2103
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2104
// Store an int value at local variable slot Rindex.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2105
// Kills:
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2106
//   - Rindex
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2107
void InterpreterMacroAssembler::store_local_int(Register Rvalue, Register Rindex) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2108
  sldi(Rindex, Rindex, Interpreter::logStackElementSize);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2109
  subf(Rindex, Rindex, R18_locals);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2110
  stw(Rvalue, 0, Rindex);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2111
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2112
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2113
// Store a long value at local variable slot Rindex.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2114
// Kills:
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2115
//   - Rindex
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2116
void InterpreterMacroAssembler::store_local_long(Register Rvalue, Register Rindex) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2117
  sldi(Rindex, Rindex, Interpreter::logStackElementSize);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2118
  subf(Rindex, Rindex, R18_locals);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2119
  std(Rvalue, -8, Rindex);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2120
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2121
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2122
// Store an oop value at local variable slot Rindex.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2123
// Kills:
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2124
//   - Rindex
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2125
void InterpreterMacroAssembler::store_local_ptr(Register Rvalue, Register Rindex) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2126
  sldi(Rindex, Rindex, Interpreter::logStackElementSize);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2127
  subf(Rindex, Rindex, R18_locals);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2128
  std(Rvalue, 0, Rindex);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2129
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2130
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2131
// Store an int value at local variable slot Rindex.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2132
// Kills:
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2133
//   - Rindex
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2134
void InterpreterMacroAssembler::store_local_float(FloatRegister Rvalue, Register Rindex) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2135
  sldi(Rindex, Rindex, Interpreter::logStackElementSize);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2136
  subf(Rindex, Rindex, R18_locals);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2137
  stfs(Rvalue, 0, Rindex);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2138
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2139
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2140
// Store an int value at local variable slot Rindex.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2141
// Kills:
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2142
//   - Rindex
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2143
void InterpreterMacroAssembler::store_local_double(FloatRegister Rvalue, Register Rindex) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2144
  sldi(Rindex, Rindex, Interpreter::logStackElementSize);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2145
  subf(Rindex, Rindex, R18_locals);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2146
  stfd(Rvalue, -8, Rindex);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2147
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2148
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2149
// Read pending exception from thread and jump to interpreter.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2150
// Throw exception entry if one if pending. Fall through otherwise.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2151
void InterpreterMacroAssembler::check_and_forward_exception(Register Rscratch1, Register Rscratch2) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2152
  assert_different_registers(Rscratch1, Rscratch2, R3);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2153
  Register Rexception = Rscratch1;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2154
  Register Rtmp       = Rscratch2;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2155
  Label Ldone;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2156
  // Get pending exception oop.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2157
  ld(Rexception, thread_(pending_exception));
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2158
  cmpdi(CCR0, Rexception, 0);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2159
  beq(CCR0, Ldone);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2160
  li(Rtmp, 0);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2161
  mr_if_needed(R3, Rexception);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2162
  std(Rtmp, thread_(pending_exception)); // Clear exception in thread
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2163
  if (Interpreter::rethrow_exception_entry() != NULL) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2164
    // Already got entry address.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2165
    load_dispatch_table(Rtmp, (address*)Interpreter::rethrow_exception_entry());
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2166
  } else {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2167
    // Dynamically load entry address.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2168
    int simm16_rest = load_const_optimized(Rtmp, &Interpreter::_rethrow_exception_entry, R0, true);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2169
    ld(Rtmp, simm16_rest, Rtmp);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2170
  }
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2171
  mtctr(Rtmp);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2172
  save_interpreter_state(Rtmp);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2173
  bctr();
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2174
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2175
  align(32, 12);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2176
  bind(Ldone);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2177
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2178
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2179
void InterpreterMacroAssembler::call_VM(Register oop_result, address entry_point, bool check_exceptions) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2180
  save_interpreter_state(R11_scratch1);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2181
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2182
  MacroAssembler::call_VM(oop_result, entry_point, false);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2183
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2184
  restore_interpreter_state(R11_scratch1, /*bcp_and_mdx_only*/ true);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2185
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2186
  check_and_handle_popframe(R11_scratch1);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2187
  check_and_handle_earlyret(R11_scratch1);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2188
  // Now check exceptions manually.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2189
  if (check_exceptions) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2190
    check_and_forward_exception(R11_scratch1, R12_scratch2);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2191
  }
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2192
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2193
35166
23125410af16 8145117: PPC64: Remove cpp interpreter implementation
goetz
parents: 33083
diff changeset
  2194
void InterpreterMacroAssembler::call_VM(Register oop_result, address entry_point,
23125410af16 8145117: PPC64: Remove cpp interpreter implementation
goetz
parents: 33083
diff changeset
  2195
                                        Register arg_1, bool check_exceptions) {
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2196
  // ARG1 is reserved for the thread.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2197
  mr_if_needed(R4_ARG2, arg_1);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2198
  call_VM(oop_result, entry_point, check_exceptions);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2199
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2200
35166
23125410af16 8145117: PPC64: Remove cpp interpreter implementation
goetz
parents: 33083
diff changeset
  2201
void InterpreterMacroAssembler::call_VM(Register oop_result, address entry_point,
23125410af16 8145117: PPC64: Remove cpp interpreter implementation
goetz
parents: 33083
diff changeset
  2202
                                        Register arg_1, Register arg_2,
23125410af16 8145117: PPC64: Remove cpp interpreter implementation
goetz
parents: 33083
diff changeset
  2203
                                        bool check_exceptions) {
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2204
  // ARG1 is reserved for the thread.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2205
  mr_if_needed(R4_ARG2, arg_1);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2206
  assert(arg_2 != R4_ARG2, "smashed argument");
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2207
  mr_if_needed(R5_ARG3, arg_2);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2208
  call_VM(oop_result, entry_point, check_exceptions);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2209
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2210
35166
23125410af16 8145117: PPC64: Remove cpp interpreter implementation
goetz
parents: 33083
diff changeset
  2211
void InterpreterMacroAssembler::call_VM(Register oop_result, address entry_point,
23125410af16 8145117: PPC64: Remove cpp interpreter implementation
goetz
parents: 33083
diff changeset
  2212
                                        Register arg_1, Register arg_2, Register arg_3,
23125410af16 8145117: PPC64: Remove cpp interpreter implementation
goetz
parents: 33083
diff changeset
  2213
                                        bool check_exceptions) {
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2214
  // ARG1 is reserved for the thread.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2215
  mr_if_needed(R4_ARG2, arg_1);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2216
  assert(arg_2 != R4_ARG2, "smashed argument");
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2217
  mr_if_needed(R5_ARG3, arg_2);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2218
  assert(arg_3 != R4_ARG2 && arg_3 != R5_ARG3, "smashed argument");
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2219
  mr_if_needed(R6_ARG4, arg_3);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2220
  call_VM(oop_result, entry_point, check_exceptions);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2221
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2222
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2223
void InterpreterMacroAssembler::save_interpreter_state(Register scratch) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2224
  ld(scratch, 0, R1_SP);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2225
  std(R15_esp, _ijava_state_neg(esp), scratch);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2226
  std(R14_bcp, _ijava_state_neg(bcp), scratch);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2227
  std(R26_monitor, _ijava_state_neg(monitors), scratch);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2228
  if (ProfileInterpreter) { std(R28_mdx, _ijava_state_neg(mdx), scratch); }
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2229
  // Other entries should be unchanged.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2230
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2231
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2232
void InterpreterMacroAssembler::restore_interpreter_state(Register scratch, bool bcp_and_mdx_only) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2233
  ld(scratch, 0, R1_SP);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2234
  ld(R14_bcp, _ijava_state_neg(bcp), scratch); // Changed by VM code (exception).
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2235
  if (ProfileInterpreter) { ld(R28_mdx, _ijava_state_neg(mdx), scratch); } // Changed by VM code.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2236
  if (!bcp_and_mdx_only) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2237
    // Following ones are Metadata.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2238
    ld(R19_method, _ijava_state_neg(method), scratch);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2239
    ld(R27_constPoolCache, _ijava_state_neg(cpoolCache), scratch);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2240
    // Following ones are stack addresses and don't require reload.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2241
    ld(R15_esp, _ijava_state_neg(esp), scratch);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2242
    ld(R18_locals, _ijava_state_neg(locals), scratch);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2243
    ld(R26_monitor, _ijava_state_neg(monitors), scratch);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2244
  }
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2245
#ifdef ASSERT
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2246
  {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2247
    Label Lok;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2248
    subf(R0, R1_SP, scratch);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2249
    cmpdi(CCR0, R0, frame::abi_reg_args_size + frame::ijava_state_size);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2250
    bge(CCR0, Lok);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2251
    stop("frame too small (restore istate)", 0x5432);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2252
    bind(Lok);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2253
  }
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2254
  {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2255
    Label Lok;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2256
    ld(R0, _ijava_state_neg(ijava_reserved), scratch);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2257
    cmpdi(CCR0, R0, 0x5afe);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2258
    beq(CCR0, Lok);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2259
    stop("frame corrupted (restore istate)", 0x5afe);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2260
    bind(Lok);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2261
  }
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2262
#endif
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2263
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2264
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2265
void InterpreterMacroAssembler::get_method_counters(Register method,
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2266
                                                    Register Rcounters,
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2267
                                                    Label& skip) {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2268
  BLOCK_COMMENT("Load and ev. allocate counter object {");
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2269
  Label has_counters;
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2270
  ld(Rcounters, in_bytes(Method::method_counters_offset()), method);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2271
  cmpdi(CCR0, Rcounters, 0);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2272
  bne(CCR0, has_counters);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2273
  call_VM(noreg, CAST_FROM_FN_PTR(address,
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2274
                                  InterpreterRuntime::build_method_counters), method, false);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2275
  ld(Rcounters, in_bytes(Method::method_counters_offset()), method);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2276
  cmpdi(CCR0, Rcounters, 0);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2277
  beq(CCR0, skip); // No MethodCounters, OutOfMemory.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2278
  BLOCK_COMMENT("} Load and ev. allocate counter object");
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2279
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2280
  bind(has_counters);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2281
}
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2282
35166
23125410af16 8145117: PPC64: Remove cpp interpreter implementation
goetz
parents: 33083
diff changeset
  2283
void InterpreterMacroAssembler::increment_invocation_counter(Register Rcounters,
23125410af16 8145117: PPC64: Remove cpp interpreter implementation
goetz
parents: 33083
diff changeset
  2284
                                                             Register iv_be_count,
23125410af16 8145117: PPC64: Remove cpp interpreter implementation
goetz
parents: 33083
diff changeset
  2285
                                                             Register Rtmp_r0) {
32074
54b9558a71a2 8132242: LogTouchedMethods (8025692) asserts if TieredCompilation is off.
minqi
parents: 30303
diff changeset
  2286
  assert(UseCompiler || LogTouchedMethods, "incrementing must be useful");
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2287
  Register invocation_count = iv_be_count;
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2288
  Register backedge_count   = Rtmp_r0;
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2289
  int delta = InvocationCounter::count_increment;
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2290
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2291
  // Load each counter in a register.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2292
  //  ld(inv_counter, Rtmp);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2293
  //  ld(be_counter, Rtmp2);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2294
  int inv_counter_offset = in_bytes(MethodCounters::invocation_counter_offset() +
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2295
                                    InvocationCounter::counter_offset());
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2296
  int be_counter_offset  = in_bytes(MethodCounters::backedge_counter_offset() +
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2297
                                    InvocationCounter::counter_offset());
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2298
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2299
  BLOCK_COMMENT("Increment profiling counters {");
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2300
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2301
  // Load the backedge counter.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2302
  lwz(backedge_count, be_counter_offset, Rcounters); // is unsigned int
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2303
  // Mask the backedge counter.
35085
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 33083
diff changeset
  2304
  andi(backedge_count, backedge_count, InvocationCounter::count_mask_value);
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2305
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2306
  // Load the invocation counter.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2307
  lwz(invocation_count, inv_counter_offset, Rcounters); // is unsigned int
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2308
  // Add the delta to the invocation counter and store the result.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2309
  addi(invocation_count, invocation_count, delta);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2310
  // Store value.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2311
  stw(invocation_count, inv_counter_offset, Rcounters);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2312
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2313
  // Add invocation counter + backedge counter.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2314
  add(iv_be_count, backedge_count, invocation_count);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2315
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2316
  // Note that this macro must leave the backedge_count + invocation_count in
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2317
  // register iv_be_count!
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2318
  BLOCK_COMMENT("} Increment profiling counters");
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2319
}
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2320
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2321
void InterpreterMacroAssembler::verify_oop(Register reg, TosState state) {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2322
  if (state == atos) { MacroAssembler::verify_oop(reg); }
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2323
}
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2324
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2325
// Local helper function for the verify_oop_or_return_address macro.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2326
static bool verify_return_address(Method* m, int bci) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2327
#ifndef PRODUCT
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2328
  address pc = (address)(m->constMethod()) + in_bytes(ConstMethod::codes_offset()) + bci;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2329
  // Assume it is a valid return address if it is inside m and is preceded by a jsr.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2330
  if (!m->contains(pc))                                            return false;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2331
  address jsr_pc;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2332
  jsr_pc = pc - Bytecodes::length_for(Bytecodes::_jsr);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2333
  if (*jsr_pc == Bytecodes::_jsr   && jsr_pc >= m->code_base())    return true;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2334
  jsr_pc = pc - Bytecodes::length_for(Bytecodes::_jsr_w);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2335
  if (*jsr_pc == Bytecodes::_jsr_w && jsr_pc >= m->code_base())    return true;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2336
#endif // PRODUCT
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2337
  return false;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2338
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2339
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2340
void InterpreterMacroAssembler::verify_FPU(int stack_depth, TosState state) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2341
  if (VerifyFPU) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2342
    unimplemented("verfiyFPU");
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2343
  }
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2344
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2345
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2346
void InterpreterMacroAssembler::verify_oop_or_return_address(Register reg, Register Rtmp) {
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2347
  if (!VerifyOops) return;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2348
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2349
  // The VM documentation for the astore[_wide] bytecode allows
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2350
  // the TOS to be not only an oop but also a return address.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2351
  Label test;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2352
  Label skip;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2353
  // See if it is an address (in the current method):
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2354
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2355
  const int log2_bytecode_size_limit = 16;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2356
  srdi_(Rtmp, reg, log2_bytecode_size_limit);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2357
  bne(CCR0, test);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2358
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2359
  address fd = CAST_FROM_FN_PTR(address, verify_return_address);
35085
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 33083
diff changeset
  2360
  const int nbytes_save = MacroAssembler::num_volatile_regs * 8;
28187
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  2361
  save_volatile_gprs(R1_SP, -nbytes_save); // except R0
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  2362
  save_LR_CR(Rtmp); // Save in old frame.
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2363
  push_frame_reg_args(nbytes_save, Rtmp);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2364
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2365
  load_const_optimized(Rtmp, fd, R0);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2366
  mr_if_needed(R4_ARG2, reg);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2367
  mr(R3_ARG1, R19_method);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2368
  call_c(Rtmp); // call C
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2369
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2370
  pop_frame();
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2371
  restore_LR_CR(Rtmp);
28187
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 27012
diff changeset
  2372
  restore_volatile_gprs(R1_SP, -nbytes_save); // except R0
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2373
  b(skip);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2374
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2375
  // Perform a more elaborate out-of-line call.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2376
  // Not an address; verify it:
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2377
  bind(test);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2378
  verify_oop(reg);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2379
  bind(skip);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2380
}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2381
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2382
// Inline assembly for:
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2383
//
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2384
// if (thread is in interp_only_mode) {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2385
//   InterpreterRuntime::post_method_entry();
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2386
// }
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2387
// if (*jvmpi::event_flags_array_at_addr(JVMPI_EVENT_METHOD_ENTRY ) ||
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2388
//     *jvmpi::event_flags_array_at_addr(JVMPI_EVENT_METHOD_ENTRY2)   ) {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2389
//   SharedRuntime::jvmpi_method_entry(method, receiver);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2390
// }
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2391
void InterpreterMacroAssembler::notify_method_entry() {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2392
  // JVMTI
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2393
  // Whenever JVMTI puts a thread in interp_only_mode, method
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2394
  // entry/exit events are sent for that thread to track stack
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2395
  // depth. If it is possible to enter interp_only_mode we add
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2396
  // the code to check if the event should be sent.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2397
  if (JvmtiExport::can_post_interpreter_events()) {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2398
    Label jvmti_post_done;
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2399
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2400
    lwz(R0, in_bytes(JavaThread::interp_only_mode_offset()), R16_thread);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2401
    cmpwi(CCR0, R0, 0);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2402
    beq(CCR0, jvmti_post_done);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2403
    call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::post_method_entry),
35166
23125410af16 8145117: PPC64: Remove cpp interpreter implementation
goetz
parents: 33083
diff changeset
  2404
            /*check_exceptions=*/true);
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2405
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2406
    bind(jvmti_post_done);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2407
  }
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2408
}
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2409
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2410
// Inline assembly for:
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2411
//
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2412
// if (thread is in interp_only_mode) {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2413
//   // save result
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2414
//   InterpreterRuntime::post_method_exit();
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2415
//   // restore result
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2416
// }
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2417
// if (*jvmpi::event_flags_array_at_addr(JVMPI_EVENT_METHOD_EXIT)) {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2418
//   // save result
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2419
//   SharedRuntime::jvmpi_method_exit();
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2420
//   // restore result
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2421
// }
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2422
//
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2423
// Native methods have their result stored in d_tmp and l_tmp.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2424
// Java methods have their result stored in the expression stack.
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2425
void InterpreterMacroAssembler::notify_method_exit(bool is_native_method, TosState state,
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2426
                                                   NotifyMethodExitMode mode, bool check_exceptions) {
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2427
  // JVMTI
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2428
  // Whenever JVMTI puts a thread in interp_only_mode, method
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2429
  // entry/exit events are sent for that thread to track stack
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2430
  // depth. If it is possible to enter interp_only_mode we add
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2431
  // the code to check if the event should be sent.
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2432
  if (mode == NotifyJVMTI && JvmtiExport::can_post_interpreter_events()) {
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2433
    Label jvmti_post_done;
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2434
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2435
    lwz(R0, in_bytes(JavaThread::interp_only_mode_offset()), R16_thread);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2436
    cmpwi(CCR0, R0, 0);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2437
    beq(CCR0, jvmti_post_done);
35166
23125410af16 8145117: PPC64: Remove cpp interpreter implementation
goetz
parents: 33083
diff changeset
  2438
    if (!is_native_method) { push(state); } // Expose tos to GC.
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2439
    call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::post_method_exit),
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2440
            /*check_exceptions=*/check_exceptions);
35166
23125410af16 8145117: PPC64: Remove cpp interpreter implementation
goetz
parents: 33083
diff changeset
  2441
    if (!is_native_method) { pop(state); }
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2442
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 22824
diff changeset
  2443
    align(32, 12);
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2444
    bind(jvmti_post_done);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2445
  }
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2446
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
  2447
  // Dtrace support not implemented.
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2448
}
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
  2449