src/hotspot/cpu/ppc/interp_masm_ppc.hpp
author naoto
Tue, 09 Jul 2019 08:05:38 -0700
changeset 55627 9c1885fb2a42
parent 55322 bc5baf205475
permissions -rw-r--r--
8227127: Era designator not displayed correctly using the COMPAT provider Reviewed-by: rriggs
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
     1
/*
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 50162
diff changeset
     2
 * Copyright (c) 2002, 2019, Oracle and/or its affiliates. All rights reserved.
46427
54713555867e 8171392: Move Klass pointers outside of ConstantPool entries so ConstantPool can be read-only
iklam
parents: 46294
diff changeset
     3
 * Copyright (c) 2012, 2017 SAP SE. All rights reserved.
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
     4
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
     5
 *
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
     6
 * This code is free software; you can redistribute it and/or modify it
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
     7
 * under the terms of the GNU General Public License version 2 only, as
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
     8
 * published by the Free Software Foundation.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
     9
 *
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    10
 * This code is distributed in the hope that it will be useful, but WITHOUT
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    11
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    12
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    13
 * version 2 for more details (a copy is included in the LICENSE file that
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    14
 * accompanied this code).
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    15
 *
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    16
 * You should have received a copy of the GNU General Public License version
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    17
 * 2 along with this work; if not, write to the Free Software Foundation,
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    18
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    19
 *
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    20
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    21
 * or visit www.oracle.com if you need additional information or have any
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    22
 * questions.
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    23
 *
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    24
 */
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    25
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 50162
diff changeset
    26
#ifndef CPU_PPC_INTERP_MASM_PPC_HPP
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 50162
diff changeset
    27
#define CPU_PPC_INTERP_MASM_PPC_HPP
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    28
24349
d8f40e5b392d 8042309: Some bugfixes for the ppc64 port.
goetz
parents: 23221
diff changeset
    29
#include "asm/macroAssembler.hpp"
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    30
#include "interpreter/invocationCounter.hpp"
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    31
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
    32
// This file specializes the assembler with interpreter-specific macros.
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    33
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    34
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    35
class InterpreterMacroAssembler: public MacroAssembler {
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    36
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    37
 public:
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    38
  InterpreterMacroAssembler(CodeBuffer* code) : MacroAssembler(code) {}
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    39
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 22824
diff changeset
    40
  void null_check_throw(Register a, int offset, Register temp_reg);
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 22824
diff changeset
    41
33070
54f3f085b165 8136525: Generate interpreter entries only once and avoid unnecessary jump to jump
mdoerr
parents: 30310
diff changeset
    42
  void jump_to_entry(address entry, Register Rscratch);
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
    43
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
    44
  // Handy address generation macros.
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    45
#define thread_(field_name) in_bytes(JavaThread::field_name ## _offset()), R16_thread
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    46
#define method_(field_name) in_bytes(Method::field_name ## _offset()), R19_method
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
    47
46294
345a46524a19 8172020: Internal Error (cpu/arm/vm/frame_arm.cpp:571): assert(obj == __null || Universe::heap()->is_in(obj)) failed: sanity check #
cjplummer
parents: 40010
diff changeset
    48
  virtual void check_and_handle_popframe(Register scratch_reg);
345a46524a19 8172020: Internal Error (cpu/arm/vm/frame_arm.cpp:571): assert(obj == __null || Universe::heap()->is_in(obj)) failed: sanity check #
cjplummer
parents: 40010
diff changeset
    49
  virtual void check_and_handle_earlyret(Register scratch_reg);
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
    50
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
    51
  // Base routine for all dispatches.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
    52
  void dispatch_base(TosState state, address* table);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
    53
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
    54
  void load_earlyret_value(TosState state, Register Rscratch1);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
    55
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
    56
  static const Address l_tmp;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
    57
  static const Address d_tmp;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
    58
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
    59
  // dispatch routines
48332
651a95f30dfb 8193257: PPC64, s390 implementation for Thread-local handshakes
mdoerr
parents: 47216
diff changeset
    60
  void dispatch_next(TosState state, int step = 0, bool generate_poll = false);
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
    61
  void dispatch_via (TosState state, address* table);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
    62
  void load_dispatch_table(Register dst, address* table);
48332
651a95f30dfb 8193257: PPC64, s390 implementation for Thread-local handshakes
mdoerr
parents: 47216
diff changeset
    63
  void dispatch_Lbyte_code(TosState state, Register bytecode, address* table, bool generate_poll = false);
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
    64
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
    65
  // Called by shared interpreter generator.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
    66
  void dispatch_prolog(TosState state, int step = 0);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
    67
  void dispatch_epilog(TosState state, int step = 0);
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
  // Super call_VM calls - correspond to MacroAssembler::call_VM(_leaf) calls.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
    70
  void super_call_VM_leaf(Register thread_cache, address entry_point, Register arg_1);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
    71
  void super_call_VM(Register thread_cache, Register oop_result, Register last_java_sp,
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
    72
                     address entry_point, Register arg_1, Register arg_2, bool check_exception = true);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
    73
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
    74
  // 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
    75
  // a subtype of super_klass.  Blows registers tmp1, tmp2 and tmp3.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
    76
  void gen_subtype_check(Register sub_klass, Register super_klass,
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
    77
                         Register tmp1, Register tmp2, Register tmp3, Label &ok_is_subtype);
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
  // Load object from cpool->resolved_references(index).
50162
f9fe56417050 8202713: Create a MacroAssembler::access_load/store_at wrapper for S390 and PPC
mdoerr
parents: 48332
diff changeset
    80
  void load_resolved_reference_at_index(Register result, Register index, Label *L_handle_null = NULL);
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
    81
46427
54713555867e 8171392: Move Klass pointers outside of ConstantPool entries so ConstantPool can be read-only
iklam
parents: 46294
diff changeset
    82
  // load cpool->resolved_klass_at(index)
54713555867e 8171392: Move Klass pointers outside of ConstantPool entries so ConstantPool can be read-only
iklam
parents: 46294
diff changeset
    83
  void 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: 46294
diff changeset
    84
55322
bc5baf205475 8224826: Implement fast class initialization checks on PPC64
mdoerr
parents: 53244
diff changeset
    85
  void load_resolved_method_at_index(int byte_no, Register cache, Register method);
bc5baf205475 8224826: Implement fast class initialization checks on PPC64
mdoerr
parents: 53244
diff changeset
    86
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
    87
  void load_receiver(Register Rparam_count, Register Rrecv_dst);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
    88
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
    89
  // helpers for expression stack
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
    90
  void pop_i(     Register r = R17_tos);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
    91
  void pop_ptr(   Register r = R17_tos);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
    92
  void pop_l(     Register r = R17_tos);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
    93
  void pop_f(FloatRegister f = F15_ftos);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
    94
  void pop_d(FloatRegister f = F15_ftos );
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
    95
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
    96
  void push_i(     Register r = R17_tos);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
    97
  void push_ptr(   Register r = R17_tos);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
    98
  void push_l(     Register r = R17_tos);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
    99
  void push_f(FloatRegister f = F15_ftos );
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   100
  void push_d(FloatRegister f = F15_ftos);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   101
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   102
  void push_2ptrs(Register first, Register second);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   103
46615
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46427
diff changeset
   104
  void move_l_to_d(Register l = R17_tos, FloatRegister d = F15_ftos);
3fd9b25850f4 8181809: PPC64: Leverage mtfprd/mffprd on POWER8
mdoerr
parents: 46427
diff changeset
   105
  void move_d_to_l(FloatRegister d = F15_ftos, Register l = R17_tos);
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   106
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   107
  void pop (TosState state);           // transition vtos -> state
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   108
  void push(TosState state);           // transition state -> vtos
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   109
  void empty_expression_stack();       // Resets both Lesp and SP.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   110
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   111
 public:
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   112
  // Load values from bytecode stream:
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   113
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   114
  enum signedOrNot { Signed, Unsigned };
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   115
  enum setCCOrNot  { set_CC, dont_set_CC };
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   116
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   117
  void get_2_byte_integer_at_bcp(int         bcp_offset,
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   118
                                 Register    Rdst,
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   119
                                 signedOrNot is_signed);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   120
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   121
  void get_4_byte_integer_at_bcp(int         bcp_offset,
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   122
                                 Register    Rdst,
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   123
                                 signedOrNot is_signed = Unsigned);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   124
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   125
  void get_cache_index_at_bcp(Register Rdst, int bcp_offset, size_t index_size);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   126
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   127
  void get_cache_and_index_at_bcp(Register cache, int bcp_offset, size_t index_size = sizeof(u2));
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   128
25916
c5c22fab48fd 8050942: PPC64: implement template interpreter for ppc64le
kvn
parents: 24349
diff changeset
   129
  void get_u4(Register Rdst, Register Rsrc, int offset, signedOrNot is_signed);
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   130
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   131
  // common code
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   132
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   133
  void field_offset_at(int n, Register tmp, Register dest, Register base);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   134
  int  field_offset_at(Register object, address bcp, int offset);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   135
  void fast_iaaccess(int n, address bcp);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   136
  void fast_iaputfield(address bcp, bool do_store_check);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   137
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   138
  void index_check(Register array, Register index, int index_shift, Register tmp, Register res);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   139
  void index_check_without_pop(Register array, Register index, int index_shift, Register tmp, Register res);
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 get_const(Register Rdst);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   142
  void get_constant_pool(Register Rdst);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   143
  void get_constant_pool_cache(Register Rdst);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   144
  void get_cpool_and_tags(Register Rcpool, Register Rtags);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   145
  void is_a(Label& L);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   146
37488
ab63cdc0e14e 8154867: PPC64: Better byte behavior
mdoerr
parents: 35594
diff changeset
   147
  void narrow(Register result);
ab63cdc0e14e 8154867: PPC64: Better byte behavior
mdoerr
parents: 35594
diff changeset
   148
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   149
  // Java Call Helpers
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   150
  void call_from_interpreter(Register Rtarget_method, Register Rret_addr, Register Rscratch1, Register Rscratch2);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   151
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
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   154
  void unlock_if_synchronized_method(TosState state, bool throw_monitor_exception = true,
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   155
                                     bool install_monitor_exception = true);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   156
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   157
  // Removes the current activation (incl. unlocking of monitors).
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   158
  // Additionally this code is used for earlyReturn in which case we
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   159
  // want to skip throwing an exception and installing an exception.
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   160
  void remove_activation(TosState state,
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   161
                         bool throw_monitor_exception = true,
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   162
                         bool install_monitor_exception = true);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   163
  void merge_frames(Register Rtop_frame_sp, Register return_pc, Register Rscratch1, Register Rscratch2); // merge top frames
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   164
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   165
  void add_monitor_to_stack(bool stack_is_empty, Register Rtemp1, Register Rtemp2);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   166
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   167
  // Local variable access helpers
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   168
  void load_local_int(Register Rdst_value, Register Rdst_address, Register Rindex);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   169
  void load_local_long(Register Rdst_value, Register Rdst_address, Register Rindex);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   170
  void load_local_ptr(Register Rdst_value, Register Rdst_address, Register Rindex);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   171
  void load_local_float(FloatRegister Rdst_value, Register Rdst_address, Register Rindex);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   172
  void load_local_double(FloatRegister Rdst_value, Register Rdst_address, Register Rindex);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   173
  void store_local_int(Register Rvalue, Register Rindex);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   174
  void store_local_long(Register Rvalue, Register Rindex);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   175
  void store_local_ptr(Register Rvalue, Register Rindex);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   176
  void store_local_float(FloatRegister Rvalue, Register Rindex);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   177
  void store_local_double(FloatRegister Rvalue, Register Rindex);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   178
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   179
  // Call VM for std frames
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   180
  // Special call VM versions that check for exceptions and forward exception
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   181
  // via short cut (not via expensive forward exception stub).
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   182
  void check_and_forward_exception(Register Rscratch1, Register Rscratch2);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   183
  void call_VM(Register oop_result, address entry_point, bool check_exceptions = true);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   184
  void call_VM(Register oop_result, address entry_point, Register arg_1, bool check_exceptions = true);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   185
  void call_VM(Register oop_result, address entry_point, Register arg_1, Register arg_2, bool check_exceptions = true);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   186
  void call_VM(Register oop_result, address entry_point, Register arg_1, Register arg_2, Register arg_3, bool check_exceptions = true);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   187
  // Should not be used:
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   188
  void call_VM(Register oop_result, Register last_java_sp, address entry_point, bool check_exceptions = true) {ShouldNotReachHere();}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   189
  void call_VM(Register oop_result, Register last_java_sp, address entry_point, Register arg_1, bool check_exceptions = true) {ShouldNotReachHere();}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   190
  void call_VM(Register oop_result, Register last_java_sp, address entry_point, Register arg_1, Register arg_2, bool check_exceptions = true) {ShouldNotReachHere();}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   191
  void call_VM(Register oop_result, Register last_java_sp, address entry_point, Register arg_1, Register arg_2, Register arg_3, bool check_exceptions = true) {ShouldNotReachHere();}
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   192
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   193
  Address first_local_in_stack();
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   194
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   195
  enum LoadOrStore { load, store };
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   196
  void static_iload_or_store(int which_local, LoadOrStore direction, Register Rtmp);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   197
  void static_aload_or_store(int which_local, LoadOrStore direction, Register Rtmp);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   198
  void static_dload_or_store(int which_local, LoadOrStore direction);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   199
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   200
  void save_interpreter_state(Register scratch);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   201
  void restore_interpreter_state(Register scratch, bool bcp_and_mdx_only = false);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   202
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   203
  void increment_backedge_counter(const Register Rcounters, Register Rtmp, Register Rtmp2, Register Rscratch);
35085
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 33070
diff changeset
   204
  void test_backedge_count_for_osr(Register backedge_count, Register method_counters, Register target_bcp, Register disp, Register Rtmp);
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   205
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   206
  void record_static_call_in_profile(Register Rentry, Register Rtmp);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   207
  void record_receiver_call_in_profile(Register Rklass, Register Rentry, Register Rtmp);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   208
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   209
  void get_method_counters(Register method, Register Rcounters, Label& skip);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   210
  void increment_invocation_counter(Register iv_be_count, Register Rtmp1, Register Rtmp2_r0);
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   211
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   212
  // Object locking
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   213
  void lock_object  (Register lock_reg, Register obj_reg);
22861
f5c393d456fc 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 22824
diff changeset
   214
  void unlock_object(Register lock_reg, bool check_for_exceptions = true);
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   215
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   216
  // Interpreter profiling operations
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   217
  void set_method_data_pointer_for_bcp();
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   218
  void test_method_data_pointer(Label& zero_continue);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   219
  void verify_method_data_pointer();
35085
839c8ba29724 8144019: PPC64 C1: Introduce Client Compiler
mdoerr
parents: 33070
diff changeset
   220
  void test_invocation_counter_for_mdp(Register invocation_count, Register method_counters, Register Rscratch, Label &profile_continue);
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   222
  void set_mdp_data_at(int constant, Register value);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   223
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   224
  void increment_mdp_data_at(int constant, Register counter_addr, Register Rbumped_count, bool decrement = false);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   225
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   226
  void increment_mdp_data_at(Register counter_addr, Register Rbumped_count, bool decrement = false);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   227
  void increment_mdp_data_at(Register reg, int constant, Register scratch, Register Rbumped_count, bool decrement = false);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   228
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   229
  void set_mdp_flag_at(int flag_constant, Register scratch);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   230
  void test_mdp_data_at(int offset, Register value, Label& not_equal_continue, Register test_out);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   231
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   232
  void update_mdp_by_offset(int offset_of_disp, Register scratch);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   233
  void update_mdp_by_offset(Register reg, int offset_of_disp,
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   234
                            Register scratch);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   235
  void update_mdp_by_constant(int constant);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   236
  void update_mdp_for_ret(TosState state, Register return_bci);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   237
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   238
  void profile_taken_branch(Register scratch, Register bumped_count);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   239
  void profile_not_taken_branch(Register scratch1, Register scratch2);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   240
  void profile_call(Register scratch1, Register scratch2);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   241
  void profile_final_call(Register scratch1, Register scratch2);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   242
  void profile_virtual_call(Register Rreceiver, Register Rscratch1, Register Rscratch2,  bool receiver_can_be_null);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   243
  void profile_typecheck(Register Rklass, Register Rscratch1, Register Rscratch2);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   244
  void profile_typecheck_failed(Register Rscratch1, Register Rscratch2);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   245
  void profile_ret(TosState state, Register return_bci, Register scratch1, Register scratch2);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   246
  void profile_switch_default(Register scratch1, Register scratch2);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   247
  void profile_switch_case(Register index, Register scratch1,Register scratch2, Register scratch3);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   248
  void profile_null_seen(Register Rscratch1, Register Rscratch2);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   249
  void record_klass_in_profile(Register receiver, Register scratch1, Register scratch2, bool is_virtual_call);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   250
  void record_klass_in_profile_helper(Register receiver, Register scratch1, Register scratch2, int start_row, Label& done, bool is_virtual_call);
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   251
28187
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 25916
diff changeset
   252
  // Argument and return type profiling.
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 25916
diff changeset
   253
  void profile_obj_type(Register obj, Register mdo_addr_base, RegisterOrConstant mdo_addr_offs, Register tmp, Register tmp2);
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 25916
diff changeset
   254
  void profile_arguments_type(Register callee, Register tmp1, Register tmp2, bool is_virtual);
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 25916
diff changeset
   255
  void profile_return_type(Register ret, Register tmp1, Register tmp2);
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 25916
diff changeset
   256
  void profile_parameters_type(Register tmp1, Register tmp2, Register tmp3, Register tmp4);
fc19df82d6ee 8066964: ppc64: argument and return type profiling, fix problem with popframe
goetz
parents: 25916
diff changeset
   257
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   258
  // Debugging
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   259
  void verify_oop(Register reg, TosState state = atos);    // only if +VerifyOops && state == atos
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   260
  void verify_oop_or_return_address(Register reg, Register rtmp); // for astore
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   261
  void verify_FPU(int stack_depth, TosState state = ftos);
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   262
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   263
  typedef enum { NotifyJVMTI, SkipNotifyJVMTI } NotifyMethodExitMode;
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   264
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   265
  // Support for jvmdi/jvmpi.
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   266
  void notify_method_entry();
23221
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   267
  void notify_method_exit(bool is_native_method, TosState state,
b70675ece1ce 8036976: PPC64: implement the template interpreter
goetz
parents: 22861
diff changeset
   268
                          NotifyMethodExitMode mode, bool check_exceptions);
22824
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   269
};
28258dd5cb2e 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
   270
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 50162
diff changeset
   271
#endif // CPU_PPC_INTERP_MASM_PPC_HPP