src/hotspot/cpu/x86/interp_masm_x86.cpp
author psandoz
Fri, 08 Sep 2017 10:46:46 -0700
changeset 48826 c4d9d1b08e2e
parent 47881 0ce0ac68ace7
child 49027 8dc742d9bbab
permissions -rw-r--r--
8186209: Tool support for ConstantDynamic 8186046: Minimal ConstantDynamic support 8190972: Ensure that AOT/Graal filters out class files containing CONSTANT_Dynamic ahead of full AOT support Reviewed-by: acorn, coleenp, kvn Contributed-by: lois.foltan@oracle.com, john.r.rose@oracle.com, paul.sandoz@oracle.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
21095
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
     1
/*
46427
54713555867e 8171392: Move Klass pointers outside of ConstantPool entries so ConstantPool can be read-only
iklam
parents: 41082
diff changeset
     2
 * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
21095
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
     4
 *
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
     7
 * published by the Free Software Foundation.
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
     8
 *
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    13
 * accompanied this code).
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    14
 *
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    18
 *
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    21
 * questions.
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    22
 *
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    23
 */
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    24
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    25
#include "precompiled.hpp"
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    26
#include "interp_masm_x86.hpp"
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    27
#include "interpreter/interpreter.hpp"
29578
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
    28
#include "interpreter/interpreterRuntime.hpp"
38259
b495d1cfe673 8153535: Convert TraceRedefineClasses to Unified Logging
rehn
parents: 37480
diff changeset
    29
#include "logging/log.hpp"
29578
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
    30
#include "oops/arrayOop.hpp"
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
    31
#include "oops/markOop.hpp"
21095
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    32
#include "oops/methodData.hpp"
29578
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
    33
#include "oops/method.hpp"
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
    34
#include "prims/jvmtiExport.hpp"
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
    35
#include "prims/jvmtiThreadState.hpp"
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
    36
#include "runtime/basicLock.hpp"
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
    37
#include "runtime/biasedLocking.hpp"
47881
0ce0ac68ace7 8189941: Implementation JEP 312: Thread-local handshake
rehn
parents: 47216
diff changeset
    38
#include "runtime/safepointMechanism.hpp"
29578
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
    39
#include "runtime/sharedRuntime.hpp"
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
    40
#include "runtime/thread.inline.hpp"
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
    41
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
    42
// Implementation of InterpreterMacroAssembler
21095
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    43
33070
54f3f085b165 8136525: Generate interpreter entries only once and avoid unnecessary jump to jump
mdoerr
parents: 32391
diff changeset
    44
void InterpreterMacroAssembler::jump_to_entry(address entry) {
54f3f085b165 8136525: Generate interpreter entries only once and avoid unnecessary jump to jump
mdoerr
parents: 32391
diff changeset
    45
  assert(entry, "Entry must have been generated by now");
54f3f085b165 8136525: Generate interpreter entries only once and avoid unnecessary jump to jump
mdoerr
parents: 32391
diff changeset
    46
  jump(RuntimeAddress(entry));
54f3f085b165 8136525: Generate interpreter entries only once and avoid unnecessary jump to jump
mdoerr
parents: 32391
diff changeset
    47
}
54f3f085b165 8136525: Generate interpreter entries only once and avoid unnecessary jump to jump
mdoerr
parents: 32391
diff changeset
    48
21095
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    49
void InterpreterMacroAssembler::profile_obj_type(Register obj, const Address& mdo_addr) {
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    50
  Label update, next, none;
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    51
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    52
  verify_oop(obj);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    53
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    54
  testptr(obj, obj);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    55
  jccb(Assembler::notZero, update);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    56
  orptr(mdo_addr, TypeEntries::null_seen);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    57
  jmpb(next);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    58
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    59
  bind(update);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    60
  load_klass(obj, obj);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    61
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    62
  xorptr(obj, mdo_addr);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    63
  testptr(obj, TypeEntries::type_klass_mask);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    64
  jccb(Assembler::zero, next); // klass seen before, nothing to
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    65
                               // do. The unknown bit may have been
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    66
                               // set already but no need to check.
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    67
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    68
  testptr(obj, TypeEntries::type_unknown);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    69
  jccb(Assembler::notZero, next); // already unknown. Nothing to do anymore.
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    70
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    71
  cmpptr(mdo_addr, 0);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    72
  jccb(Assembler::equal, none);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    73
  cmpptr(mdo_addr, TypeEntries::null_seen);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    74
  jccb(Assembler::equal, none);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    75
  // There is a chance that the checks above (re-reading profiling
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    76
  // data from memory) fail if another thread has just set the
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    77
  // profiling to this obj's klass
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    78
  xorptr(obj, mdo_addr);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    79
  testptr(obj, TypeEntries::type_klass_mask);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    80
  jccb(Assembler::zero, next);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    81
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    82
  // different than before. Cannot keep accurate profile.
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    83
  orptr(mdo_addr, TypeEntries::type_unknown);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    84
  jmpb(next);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    85
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    86
  bind(none);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    87
  // first time here. Set profile type.
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    88
  movptr(mdo_addr, obj);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    89
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    90
  bind(next);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    91
}
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    92
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    93
void InterpreterMacroAssembler::profile_arguments_type(Register mdp, Register callee, Register tmp, bool is_virtual) {
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    94
  if (!ProfileInterpreter) {
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    95
    return;
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    96
  }
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    97
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    98
  if (MethodData::profile_arguments() || MethodData::profile_return()) {
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    99
    Label profile_continue;
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   100
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   101
    test_method_data_pointer(mdp, profile_continue);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   102
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   103
    int off_to_start = is_virtual ? in_bytes(VirtualCallData::virtual_call_data_size()) : in_bytes(CounterData::counter_data_size());
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   104
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   105
    cmpb(Address(mdp, in_bytes(DataLayout::tag_offset()) - off_to_start), is_virtual ? DataLayout::virtual_call_type_data_tag : DataLayout::call_type_data_tag);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   106
    jcc(Assembler::notEqual, profile_continue);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   107
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   108
    if (MethodData::profile_arguments()) {
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   109
      Label done;
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   110
      int off_to_args = in_bytes(TypeEntriesAtCall::args_data_offset());
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   111
      addptr(mdp, off_to_args);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   112
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   113
      for (int i = 0; i < TypeProfileArgsLimit; i++) {
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   114
        if (i > 0 || MethodData::profile_return()) {
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   115
          // If return value type is profiled we may have no argument to profile
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   116
          movptr(tmp, Address(mdp, in_bytes(TypeEntriesAtCall::cell_count_offset())-off_to_args));
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   117
          subl(tmp, i*TypeStackSlotEntries::per_arg_count());
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   118
          cmpl(tmp, TypeStackSlotEntries::per_arg_count());
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   119
          jcc(Assembler::less, done);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   120
        }
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   121
        movptr(tmp, Address(callee, Method::const_offset()));
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   122
        load_unsigned_short(tmp, Address(tmp, ConstMethod::size_of_parameters_offset()));
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   123
        // stack offset o (zero based) from the start of the argument
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   124
        // list, for n arguments translates into offset n - o - 1 from
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   125
        // the end of the argument list
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   126
        subptr(tmp, Address(mdp, in_bytes(TypeEntriesAtCall::stack_slot_offset(i))-off_to_args));
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   127
        subl(tmp, 1);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   128
        Address arg_addr = argument_address(tmp);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   129
        movptr(tmp, arg_addr);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   130
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   131
        Address mdo_arg_addr(mdp, in_bytes(TypeEntriesAtCall::argument_type_offset(i))-off_to_args);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   132
        profile_obj_type(tmp, mdo_arg_addr);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   133
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   134
        int to_add = in_bytes(TypeStackSlotEntries::per_arg_size());
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   135
        addptr(mdp, to_add);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   136
        off_to_args += to_add;
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   137
      }
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   138
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   139
      if (MethodData::profile_return()) {
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   140
        movptr(tmp, Address(mdp, in_bytes(TypeEntriesAtCall::cell_count_offset())-off_to_args));
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   141
        subl(tmp, TypeProfileArgsLimit*TypeStackSlotEntries::per_arg_count());
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   142
      }
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   143
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   144
      bind(done);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   145
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   146
      if (MethodData::profile_return()) {
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   147
        // We're right after the type profile for the last
22504
b1837533ba65 8026253: New type profiling points: sparc support
roland
parents: 21095
diff changeset
   148
        // argument. tmp is the number of cells left in the
21095
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   149
        // CallTypeData/VirtualCallTypeData to reach its end. Non null
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   150
        // if there's a return to profile.
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   151
        assert(ReturnTypeEntry::static_cell_count() < TypeStackSlotEntries::per_arg_count(), "can't move past ret type");
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   152
        shll(tmp, exact_log2(DataLayout::cell_size));
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   153
        addptr(mdp, tmp);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   154
      }
25714
87fa6860b5ae 8004128: NPG: remove stackwalking in Threads::gc_prologue and gc_epilogue code
coleenp
parents: 24088
diff changeset
   155
      movptr(Address(rbp, frame::interpreter_frame_mdp_offset * wordSize), mdp);
21095
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   156
    } else {
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   157
      assert(MethodData::profile_return(), "either profile call args or call ret");
24088
adf36ca51f17 8039975: SIGSEGV in MethodData::next_data(ProfileData*)
roland
parents: 22504
diff changeset
   158
      update_mdp_by_constant(mdp, in_bytes(TypeEntriesAtCall::return_only_size()));
21095
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   159
    }
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   160
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   161
    // mdp points right after the end of the
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   162
    // CallTypeData/VirtualCallTypeData, right after the cells for the
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   163
    // return value type if there's one
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   164
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   165
    bind(profile_continue);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   166
  }
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   167
}
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   168
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   169
void InterpreterMacroAssembler::profile_return_type(Register mdp, Register ret, Register tmp) {
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   170
  assert_different_registers(mdp, ret, tmp, _bcp_register);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   171
  if (ProfileInterpreter && MethodData::profile_return()) {
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   172
    Label profile_continue, done;
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   173
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   174
    test_method_data_pointer(mdp, profile_continue);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   175
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   176
    if (MethodData::profile_return_jsr292_only()) {
32820
ec181adbf3b1 8135085: Change Method::_intrinsic_id from u1 to u2
minqi
parents: 32391
diff changeset
   177
      assert(Method::intrinsic_id_size_in_bytes() == 2, "assuming Method::_intrinsic_id is u2");
ec181adbf3b1 8135085: Change Method::_intrinsic_id from u1 to u2
minqi
parents: 32391
diff changeset
   178
21095
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   179
      // If we don't profile all invoke bytecodes we must make sure
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   180
      // it's a bytecode we indeed profile. We can't go back to the
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   181
      // begining of the ProfileData we intend to update to check its
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   182
      // type because we're right after it and we don't known its
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   183
      // length
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   184
      Label do_profile;
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   185
      cmpb(Address(_bcp_register, 0), Bytecodes::_invokedynamic);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   186
      jcc(Assembler::equal, do_profile);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   187
      cmpb(Address(_bcp_register, 0), Bytecodes::_invokehandle);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   188
      jcc(Assembler::equal, do_profile);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   189
      get_method(tmp);
32820
ec181adbf3b1 8135085: Change Method::_intrinsic_id from u1 to u2
minqi
parents: 32391
diff changeset
   190
      cmpw(Address(tmp, Method::intrinsic_id_offset_in_bytes()), vmIntrinsics::_compiledLambdaForm);
21095
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   191
      jcc(Assembler::notEqual, profile_continue);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   192
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   193
      bind(do_profile);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   194
    }
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   195
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   196
    Address mdo_ret_addr(mdp, -in_bytes(ReturnTypeEntry::size()));
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   197
    mov(tmp, ret);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   198
    profile_obj_type(tmp, mdo_ret_addr);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   199
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   200
    bind(profile_continue);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   201
  }
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   202
}
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   203
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   204
void InterpreterMacroAssembler::profile_parameters_type(Register mdp, Register tmp1, Register tmp2) {
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   205
  if (ProfileInterpreter && MethodData::profile_parameters()) {
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   206
    Label profile_continue, done;
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   207
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   208
    test_method_data_pointer(mdp, profile_continue);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   209
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   210
    // Load the offset of the area within the MDO used for
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   211
    // parameters. If it's negative we're not profiling any parameters
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   212
    movl(tmp1, Address(mdp, in_bytes(MethodData::parameters_type_data_di_offset()) - in_bytes(MethodData::data_offset())));
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   213
    testl(tmp1, tmp1);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   214
    jcc(Assembler::negative, profile_continue);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   215
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   216
    // Compute a pointer to the area for parameters from the offset
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   217
    // and move the pointer to the slot for the last
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   218
    // parameters. Collect profiling from last parameter down.
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   219
    // mdo start + parameters offset + array length - 1
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   220
    addptr(mdp, tmp1);
22504
b1837533ba65 8026253: New type profiling points: sparc support
roland
parents: 21095
diff changeset
   221
    movptr(tmp1, Address(mdp, ArrayData::array_len_offset()));
21095
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   222
    decrement(tmp1, TypeStackSlotEntries::per_arg_count());
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   223
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   224
    Label loop;
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   225
    bind(loop);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   226
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   227
    int off_base = in_bytes(ParametersTypeData::stack_slot_offset(0));
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   228
    int type_base = in_bytes(ParametersTypeData::type_offset(0));
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   229
    Address::ScaleFactor per_arg_scale = Address::times(DataLayout::cell_size);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   230
    Address arg_off(mdp, tmp1, per_arg_scale, off_base);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   231
    Address arg_type(mdp, tmp1, per_arg_scale, type_base);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   232
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   233
    // load offset on the stack from the slot for this parameter
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   234
    movptr(tmp2, arg_off);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   235
    negptr(tmp2);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   236
    // read the parameter from the local area
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   237
    movptr(tmp2, Address(_locals_register, tmp2, Interpreter::stackElementScale()));
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   238
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   239
    // profile the parameter
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   240
    profile_obj_type(tmp2, arg_type);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   241
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   242
    // go to next parameter
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   243
    decrement(tmp1, TypeStackSlotEntries::per_arg_count());
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   244
    jcc(Assembler::positive, loop);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   245
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   246
    bind(profile_continue);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   247
  }
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   248
}
29578
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   249
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   250
void InterpreterMacroAssembler::call_VM_leaf_base(address entry_point,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   251
                                                  int number_of_arguments) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   252
  // interpreter specific
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   253
  //
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   254
  // Note: No need to save/restore bcp & locals registers
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   255
  //       since these are callee saved registers and no blocking/
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   256
  //       GC can happen in leaf calls.
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   257
  // Further Note: DO NOT save/restore bcp/locals. If a caller has
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   258
  // already saved them so that it can use rsi/rdi as temporaries
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   259
  // then a save/restore here will DESTROY the copy the caller
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   260
  // saved! There used to be a save_bcp() that only happened in
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   261
  // the ASSERT path (no restore_bcp). Which caused bizarre failures
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   262
  // when jvm built with ASSERTs.
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   263
#ifdef ASSERT
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   264
  {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   265
    Label L;
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   266
    cmpptr(Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize), (int32_t)NULL_WORD);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   267
    jcc(Assembler::equal, L);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   268
    stop("InterpreterMacroAssembler::call_VM_leaf_base:"
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   269
         " last_sp != NULL");
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   270
    bind(L);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   271
  }
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   272
#endif
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   273
  // super call
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   274
  MacroAssembler::call_VM_leaf_base(entry_point, number_of_arguments);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   275
  // interpreter specific
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   276
  // LP64: Used to ASSERT that r13/r14 were equal to frame's bcp/locals
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   277
  // but since they may not have been saved (and we don't want to
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   278
  // save them here (see note above) the assert is invalid.
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   279
}
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   280
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   281
void InterpreterMacroAssembler::call_VM_base(Register oop_result,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   282
                                             Register java_thread,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   283
                                             Register last_java_sp,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   284
                                             address  entry_point,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   285
                                             int      number_of_arguments,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   286
                                             bool     check_exceptions) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   287
  // interpreter specific
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   288
  //
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   289
  // Note: Could avoid restoring locals ptr (callee saved) - however doesn't
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   290
  //       really make a difference for these runtime calls, since they are
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   291
  //       slow anyway. Btw., bcp must be saved/restored since it may change
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   292
  //       due to GC.
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   293
  NOT_LP64(assert(java_thread == noreg , "not expecting a precomputed java thread");)
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   294
  save_bcp();
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   295
#ifdef ASSERT
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   296
  {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   297
    Label L;
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   298
    cmpptr(Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize), (int32_t)NULL_WORD);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   299
    jcc(Assembler::equal, L);
37152
29e68f1d35bb 8152065: TraceBytecodes breaks the interpreter expression stack
coleenp
parents: 35214
diff changeset
   300
    stop("InterpreterMacroAssembler::call_VM_base:"
29578
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   301
         " last_sp != NULL");
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   302
    bind(L);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   303
  }
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   304
#endif /* ASSERT */
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   305
  // super call
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   306
  MacroAssembler::call_VM_base(oop_result, noreg, last_java_sp,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   307
                               entry_point, number_of_arguments,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   308
                               check_exceptions);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   309
  // interpreter specific
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   310
  restore_bcp();
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   311
  restore_locals();
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   312
}
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   313
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   314
void InterpreterMacroAssembler::check_and_handle_popframe(Register java_thread) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   315
  if (JvmtiExport::can_pop_frame()) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   316
    Label L;
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   317
    // Initiate popframe handling only if it is not already being
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   318
    // processed.  If the flag has the popframe_processing bit set, it
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   319
    // means that this code is called *during* popframe handling - we
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   320
    // don't want to reenter.
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   321
    // This method is only called just after the call into the vm in
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   322
    // call_VM_base, so the arg registers are available.
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   323
    Register pop_cond = NOT_LP64(java_thread) // Not clear if any other register is available on 32 bit
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   324
                        LP64_ONLY(c_rarg0);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   325
    movl(pop_cond, Address(java_thread, JavaThread::popframe_condition_offset()));
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   326
    testl(pop_cond, JavaThread::popframe_pending_bit);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   327
    jcc(Assembler::zero, L);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   328
    testl(pop_cond, JavaThread::popframe_processing_bit);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   329
    jcc(Assembler::notZero, L);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   330
    // Call Interpreter::remove_activation_preserving_args_entry() to get the
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   331
    // address of the same-named entrypoint in the generated interpreter code.
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   332
    call_VM_leaf(CAST_FROM_FN_PTR(address, Interpreter::remove_activation_preserving_args_entry));
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   333
    jmp(rax);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   334
    bind(L);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   335
    NOT_LP64(get_thread(java_thread);)
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   336
  }
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   337
}
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   338
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   339
void InterpreterMacroAssembler::load_earlyret_value(TosState state) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   340
  Register thread = LP64_ONLY(r15_thread) NOT_LP64(rcx);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   341
  NOT_LP64(get_thread(thread);)
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   342
  movptr(rcx, Address(thread, JavaThread::jvmti_thread_state_offset()));
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   343
  const Address tos_addr(rcx, JvmtiThreadState::earlyret_tos_offset());
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   344
  const Address oop_addr(rcx, JvmtiThreadState::earlyret_oop_offset());
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   345
  const Address val_addr(rcx, JvmtiThreadState::earlyret_value_offset());
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   346
#ifdef _LP64
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   347
  switch (state) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   348
    case atos: movptr(rax, oop_addr);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   349
               movptr(oop_addr, (int32_t)NULL_WORD);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   350
               verify_oop(rax, state);              break;
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   351
    case ltos: movptr(rax, val_addr);                 break;
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   352
    case btos:                                   // fall through
37480
291ee208fb72 8132051: Better byte behavior
coleenp
parents: 37251
diff changeset
   353
    case ztos:                                   // fall through
29578
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   354
    case ctos:                                   // fall through
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   355
    case stos:                                   // fall through
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   356
    case itos: movl(rax, val_addr);                 break;
32391
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31046
diff changeset
   357
    case ftos: load_float(val_addr);                break;
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31046
diff changeset
   358
    case dtos: load_double(val_addr);               break;
29578
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   359
    case vtos: /* nothing to do */                  break;
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   360
    default  : ShouldNotReachHere();
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   361
  }
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   362
  // Clean up tos value in the thread object
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   363
  movl(tos_addr,  (int) ilgl);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   364
  movl(val_addr,  (int32_t) NULL_WORD);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   365
#else
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   366
  const Address val_addr1(rcx, JvmtiThreadState::earlyret_value_offset()
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   367
                             + in_ByteSize(wordSize));
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   368
  switch (state) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   369
    case atos: movptr(rax, oop_addr);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   370
               movptr(oop_addr, NULL_WORD);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   371
               verify_oop(rax, state);                break;
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   372
    case ltos:
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   373
               movl(rdx, val_addr1);               // fall through
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   374
    case btos:                                     // fall through
37480
291ee208fb72 8132051: Better byte behavior
coleenp
parents: 37251
diff changeset
   375
    case ztos:                                     // fall through
29578
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   376
    case ctos:                                     // fall through
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   377
    case stos:                                     // fall through
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   378
    case itos: movl(rax, val_addr);                   break;
32391
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31046
diff changeset
   379
    case ftos: load_float(val_addr);                  break;
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31046
diff changeset
   380
    case dtos: load_double(val_addr);                 break;
29578
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   381
    case vtos: /* nothing to do */                    break;
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   382
    default  : ShouldNotReachHere();
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   383
  }
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   384
#endif // _LP64
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   385
  // Clean up tos value in the thread object
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   386
  movl(tos_addr,  (int32_t) ilgl);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   387
  movptr(val_addr,  NULL_WORD);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   388
  NOT_LP64(movptr(val_addr1, NULL_WORD);)
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   389
}
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   390
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   391
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   392
void InterpreterMacroAssembler::check_and_handle_earlyret(Register java_thread) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   393
  if (JvmtiExport::can_force_early_return()) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   394
    Label L;
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   395
    Register tmp = LP64_ONLY(c_rarg0) NOT_LP64(java_thread);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   396
    Register rthread = LP64_ONLY(r15_thread) NOT_LP64(java_thread);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   397
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   398
    movptr(tmp, Address(rthread, JavaThread::jvmti_thread_state_offset()));
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   399
    testptr(tmp, tmp);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   400
    jcc(Assembler::zero, L); // if (thread->jvmti_thread_state() == NULL) exit;
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   401
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   402
    // Initiate earlyret handling only if it is not already being processed.
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   403
    // If the flag has the earlyret_processing bit set, it means that this code
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   404
    // is called *during* earlyret handling - we don't want to reenter.
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   405
    movl(tmp, Address(tmp, JvmtiThreadState::earlyret_state_offset()));
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   406
    cmpl(tmp, JvmtiThreadState::earlyret_pending);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   407
    jcc(Assembler::notEqual, L);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   408
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   409
    // Call Interpreter::remove_activation_early_entry() to get the address of the
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   410
    // same-named entrypoint in the generated interpreter code.
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   411
    NOT_LP64(get_thread(java_thread);)
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   412
    movptr(tmp, Address(rthread, JavaThread::jvmti_thread_state_offset()));
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   413
#ifdef _LP64
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   414
    movl(tmp, Address(tmp, JvmtiThreadState::earlyret_tos_offset()));
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   415
    call_VM_leaf(CAST_FROM_FN_PTR(address, Interpreter::remove_activation_early_entry), tmp);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   416
#else
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   417
    pushl(Address(tmp, JvmtiThreadState::earlyret_tos_offset()));
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   418
    call_VM_leaf(CAST_FROM_FN_PTR(address, Interpreter::remove_activation_early_entry), 1);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   419
#endif // _LP64
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   420
    jmp(rax);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   421
    bind(L);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   422
    NOT_LP64(get_thread(java_thread);)
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   423
  }
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   424
}
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   425
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   426
void InterpreterMacroAssembler::get_unsigned_2_byte_index_at_bcp(Register reg, int bcp_offset) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   427
  assert(bcp_offset >= 0, "bcp is still pointing to start of bytecode");
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   428
  load_unsigned_short(reg, Address(_bcp_register, bcp_offset));
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   429
  bswapl(reg);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   430
  shrl(reg, 16);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   431
}
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   432
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   433
void InterpreterMacroAssembler::get_cache_index_at_bcp(Register index,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   434
                                                       int bcp_offset,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   435
                                                       size_t index_size) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   436
  assert(bcp_offset > 0, "bcp is still pointing to start of bytecode");
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   437
  if (index_size == sizeof(u2)) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   438
    load_unsigned_short(index, Address(_bcp_register, bcp_offset));
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   439
  } else if (index_size == sizeof(u4)) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   440
    movl(index, Address(_bcp_register, bcp_offset));
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   441
    // Check if the secondary index definition is still ~x, otherwise
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   442
    // we have to change the following assembler code to calculate the
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   443
    // plain index.
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   444
    assert(ConstantPool::decode_invokedynamic_index(~123) == 123, "else change next line");
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   445
    notl(index);  // convert to plain index
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   446
  } else if (index_size == sizeof(u1)) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   447
    load_unsigned_byte(index, Address(_bcp_register, bcp_offset));
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   448
  } else {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   449
    ShouldNotReachHere();
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   450
  }
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   451
}
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   452
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   453
void InterpreterMacroAssembler::get_cache_and_index_at_bcp(Register cache,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   454
                                                           Register index,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   455
                                                           int bcp_offset,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   456
                                                           size_t index_size) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   457
  assert_different_registers(cache, index);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   458
  get_cache_index_at_bcp(index, bcp_offset, index_size);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   459
  movptr(cache, Address(rbp, frame::interpreter_frame_cache_offset * wordSize));
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   460
  assert(sizeof(ConstantPoolCacheEntry) == 4 * wordSize, "adjust code below");
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   461
  // convert from field index to ConstantPoolCacheEntry index
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   462
  assert(exact_log2(in_words(ConstantPoolCacheEntry::size())) == 2, "else change next line");
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   463
  shll(index, 2);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   464
}
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   465
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   466
void InterpreterMacroAssembler::get_cache_and_index_and_bytecode_at_bcp(Register cache,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   467
                                                                        Register index,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   468
                                                                        Register bytecode,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   469
                                                                        int byte_no,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   470
                                                                        int bcp_offset,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   471
                                                                        size_t index_size) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   472
  get_cache_and_index_at_bcp(cache, index, bcp_offset, index_size);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   473
  // We use a 32-bit load here since the layout of 64-bit words on
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   474
  // little-endian machines allow us that.
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   475
  movl(bytecode, Address(cache, index, Address::times_ptr, ConstantPoolCache::base_offset() + ConstantPoolCacheEntry::indices_offset()));
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   476
  const int shift_count = (1 + byte_no) * BitsPerByte;
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   477
  assert((byte_no == TemplateTable::f1_byte && shift_count == ConstantPoolCacheEntry::bytecode_1_shift) ||
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   478
         (byte_no == TemplateTable::f2_byte && shift_count == ConstantPoolCacheEntry::bytecode_2_shift),
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   479
         "correct shift count");
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   480
  shrl(bytecode, shift_count);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   481
  assert(ConstantPoolCacheEntry::bytecode_1_mask == ConstantPoolCacheEntry::bytecode_2_mask, "common mask");
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   482
  andl(bytecode, ConstantPoolCacheEntry::bytecode_1_mask);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   483
}
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   484
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   485
void InterpreterMacroAssembler::get_cache_entry_pointer_at_bcp(Register cache,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   486
                                                               Register tmp,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   487
                                                               int bcp_offset,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   488
                                                               size_t index_size) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   489
  assert(cache != tmp, "must use different register");
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   490
  get_cache_index_at_bcp(tmp, bcp_offset, index_size);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   491
  assert(sizeof(ConstantPoolCacheEntry) == 4 * wordSize, "adjust code below");
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   492
  // convert from field index to ConstantPoolCacheEntry index
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   493
  // and from word offset to byte offset
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   494
  assert(exact_log2(in_bytes(ConstantPoolCacheEntry::size_in_bytes())) == 2 + LogBytesPerWord, "else change next line");
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   495
  shll(tmp, 2 + LogBytesPerWord);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   496
  movptr(cache, Address(rbp, frame::interpreter_frame_cache_offset * wordSize));
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   497
  // skip past the header
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   498
  addptr(cache, in_bytes(ConstantPoolCache::base_offset()));
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   499
  addptr(cache, tmp);  // construct pointer to cache entry
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   500
}
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   501
31046
d01ad7a0ecb0 8081320: Backout JDK-8059340: ConstantPool::_resolved_references is missing in heap dump
vlivanov
parents: 31041
diff changeset
   502
// Load object from cpool->resolved_references(index)
d01ad7a0ecb0 8081320: Backout JDK-8059340: ConstantPool::_resolved_references is missing in heap dump
vlivanov
parents: 31041
diff changeset
   503
void InterpreterMacroAssembler::load_resolved_reference_at_index(
d01ad7a0ecb0 8081320: Backout JDK-8059340: ConstantPool::_resolved_references is missing in heap dump
vlivanov
parents: 31041
diff changeset
   504
                                           Register result, Register index) {
29578
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   505
  assert_different_registers(result, index);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   506
  // convert from field index to resolved_references() index and from
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   507
  // word index to byte offset. Since this is a java object, it can be compressed
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   508
  Register tmp = index;  // reuse
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   509
  shll(tmp, LogBytesPerHeapOop);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   510
31046
d01ad7a0ecb0 8081320: Backout JDK-8059340: ConstantPool::_resolved_references is missing in heap dump
vlivanov
parents: 31041
diff changeset
   511
  get_constant_pool(result);
29578
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   512
  // load pointer for resolved_references[] objArray
46427
54713555867e 8171392: Move Klass pointers outside of ConstantPool entries so ConstantPool can be read-only
iklam
parents: 41082
diff changeset
   513
  movptr(result, Address(result, ConstantPool::cache_offset_in_bytes()));
54713555867e 8171392: Move Klass pointers outside of ConstantPool entries so ConstantPool can be read-only
iklam
parents: 41082
diff changeset
   514
  movptr(result, Address(result, ConstantPoolCache::resolved_references_offset_in_bytes()));
46961
c9094b1e5f87 8186088: ConstantPoolCache::_resolved_references is not a JNIHandle
coleenp
parents: 46796
diff changeset
   515
  resolve_oop_handle(result);
29578
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   516
  // Add in the index
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   517
  addptr(result, tmp);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   518
  load_heap_oop(result, Address(result, arrayOopDesc::base_offset_in_bytes(T_OBJECT)));
48826
c4d9d1b08e2e 8186209: Tool support for ConstantDynamic
psandoz
parents: 47881
diff changeset
   519
  // The resulting oop is null if the reference is not yet resolved.
c4d9d1b08e2e 8186209: Tool support for ConstantDynamic
psandoz
parents: 47881
diff changeset
   520
  // It is Universe::the_null_sentinel() if the reference resolved to NULL via condy.
29578
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   521
}
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   522
46427
54713555867e 8171392: Move Klass pointers outside of ConstantPool entries so ConstantPool can be read-only
iklam
parents: 41082
diff changeset
   523
// load cpool->resolved_klass_at(index)
54713555867e 8171392: Move Klass pointers outside of ConstantPool entries so ConstantPool can be read-only
iklam
parents: 41082
diff changeset
   524
void InterpreterMacroAssembler::load_resolved_klass_at_index(Register cpool,
54713555867e 8171392: Move Klass pointers outside of ConstantPool entries so ConstantPool can be read-only
iklam
parents: 41082
diff changeset
   525
                                           Register index, Register klass) {
54713555867e 8171392: Move Klass pointers outside of ConstantPool entries so ConstantPool can be read-only
iklam
parents: 41082
diff changeset
   526
  movw(index, Address(cpool, index, Address::times_ptr, sizeof(ConstantPool)));
54713555867e 8171392: Move Klass pointers outside of ConstantPool entries so ConstantPool can be read-only
iklam
parents: 41082
diff changeset
   527
  Register resolved_klasses = cpool;
54713555867e 8171392: Move Klass pointers outside of ConstantPool entries so ConstantPool can be read-only
iklam
parents: 41082
diff changeset
   528
  movptr(resolved_klasses, Address(cpool, ConstantPool::resolved_klasses_offset_in_bytes()));
54713555867e 8171392: Move Klass pointers outside of ConstantPool entries so ConstantPool can be read-only
iklam
parents: 41082
diff changeset
   529
  movptr(klass, Address(resolved_klasses, index, Address::times_ptr, Array<Klass*>::base_offset_in_bytes()));
54713555867e 8171392: Move Klass pointers outside of ConstantPool entries so ConstantPool can be read-only
iklam
parents: 41082
diff changeset
   530
}
29578
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   531
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   532
// Generate a subtype check: branch to ok_is_subtype if sub_klass is a
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   533
// subtype of super_klass.
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   534
//
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   535
// Args:
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   536
//      rax: superklass
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   537
//      Rsub_klass: subklass
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   538
//
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   539
// Kills:
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   540
//      rcx, rdi
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   541
void InterpreterMacroAssembler::gen_subtype_check(Register Rsub_klass,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   542
                                                  Label& ok_is_subtype) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   543
  assert(Rsub_klass != rax, "rax holds superklass");
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   544
  LP64_ONLY(assert(Rsub_klass != r14, "r14 holds locals");)
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   545
  LP64_ONLY(assert(Rsub_klass != r13, "r13 holds bcp");)
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   546
  assert(Rsub_klass != rcx, "rcx holds 2ndary super array length");
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   547
  assert(Rsub_klass != rdi, "rdi holds 2ndary super array scan ptr");
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   548
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   549
  // Profile the not-null value's klass.
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   550
  profile_typecheck(rcx, Rsub_klass, rdi); // blows rcx, reloads rdi
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   551
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   552
  // Do the check.
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   553
  check_klass_subtype(Rsub_klass, rax, rcx, ok_is_subtype); // blows rcx
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   554
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   555
  // Profile the failure of the check.
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   556
  profile_typecheck_failed(rcx); // blows rcx
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   557
}
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   558
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   559
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   560
#ifndef _LP64
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   561
void InterpreterMacroAssembler::f2ieee() {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   562
  if (IEEEPrecision) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   563
    fstp_s(Address(rsp, 0));
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   564
    fld_s(Address(rsp, 0));
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   565
  }
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   566
}
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   567
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   568
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   569
void InterpreterMacroAssembler::d2ieee() {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   570
  if (IEEEPrecision) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   571
    fstp_d(Address(rsp, 0));
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   572
    fld_d(Address(rsp, 0));
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   573
  }
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   574
}
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   575
#endif // _LP64
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   576
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   577
// Java Expression Stack
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   578
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   579
void InterpreterMacroAssembler::pop_ptr(Register r) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   580
  pop(r);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   581
}
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   582
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   583
void InterpreterMacroAssembler::push_ptr(Register r) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   584
  push(r);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   585
}
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   586
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   587
void InterpreterMacroAssembler::push_i(Register r) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   588
  push(r);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   589
}
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   590
32391
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31046
diff changeset
   591
void InterpreterMacroAssembler::push_f(XMMRegister r) {
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31046
diff changeset
   592
  subptr(rsp, wordSize);
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31046
diff changeset
   593
  movflt(Address(rsp, 0), r);
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31046
diff changeset
   594
}
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31046
diff changeset
   595
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31046
diff changeset
   596
void InterpreterMacroAssembler::pop_f(XMMRegister r) {
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31046
diff changeset
   597
  movflt(r, Address(rsp, 0));
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31046
diff changeset
   598
  addptr(rsp, wordSize);
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31046
diff changeset
   599
}
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31046
diff changeset
   600
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31046
diff changeset
   601
void InterpreterMacroAssembler::push_d(XMMRegister r) {
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31046
diff changeset
   602
  subptr(rsp, 2 * wordSize);
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31046
diff changeset
   603
  movdbl(Address(rsp, 0), r);
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31046
diff changeset
   604
}
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31046
diff changeset
   605
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31046
diff changeset
   606
void InterpreterMacroAssembler::pop_d(XMMRegister r) {
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31046
diff changeset
   607
  movdbl(r, Address(rsp, 0));
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31046
diff changeset
   608
  addptr(rsp, 2 * Interpreter::stackElementSize);
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31046
diff changeset
   609
}
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31046
diff changeset
   610
29578
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   611
#ifdef _LP64
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   612
void InterpreterMacroAssembler::pop_i(Register r) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   613
  // XXX can't use pop currently, upper half non clean
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   614
  movl(r, Address(rsp, 0));
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   615
  addptr(rsp, wordSize);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   616
}
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   617
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   618
void InterpreterMacroAssembler::pop_l(Register r) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   619
  movq(r, Address(rsp, 0));
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   620
  addptr(rsp, 2 * Interpreter::stackElementSize);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   621
}
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   622
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   623
void InterpreterMacroAssembler::push_l(Register r) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   624
  subptr(rsp, 2 * wordSize);
41082
a0ed7f3b6205 8163014: Mysterious/wrong value for "long" frame local variable on 64-bit
mockner
parents: 40378
diff changeset
   625
  movptr(Address(rsp, Interpreter::expr_offset_in_bytes(0)), r         );
a0ed7f3b6205 8163014: Mysterious/wrong value for "long" frame local variable on 64-bit
mockner
parents: 40378
diff changeset
   626
  movptr(Address(rsp, Interpreter::expr_offset_in_bytes(1)), NULL_WORD );
29578
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   627
}
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   628
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   629
void InterpreterMacroAssembler::pop(TosState state) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   630
  switch (state) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   631
  case atos: pop_ptr();                 break;
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   632
  case btos:
37480
291ee208fb72 8132051: Better byte behavior
coleenp
parents: 37251
diff changeset
   633
  case ztos:
29578
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   634
  case ctos:
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   635
  case stos:
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   636
  case itos: pop_i();                   break;
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   637
  case ltos: pop_l();                   break;
32391
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31046
diff changeset
   638
  case ftos: pop_f(xmm0);               break;
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31046
diff changeset
   639
  case dtos: pop_d(xmm0);               break;
29578
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   640
  case vtos: /* nothing to do */        break;
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   641
  default:   ShouldNotReachHere();
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   642
  }
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   643
  verify_oop(rax, state);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   644
}
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   645
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   646
void InterpreterMacroAssembler::push(TosState state) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   647
  verify_oop(rax, state);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   648
  switch (state) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   649
  case atos: push_ptr();                break;
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   650
  case btos:
37480
291ee208fb72 8132051: Better byte behavior
coleenp
parents: 37251
diff changeset
   651
  case ztos:
29578
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   652
  case ctos:
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   653
  case stos:
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   654
  case itos: push_i();                  break;
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   655
  case ltos: push_l();                  break;
32391
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31046
diff changeset
   656
  case ftos: push_f(xmm0);              break;
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31046
diff changeset
   657
  case dtos: push_d(xmm0);              break;
29578
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   658
  case vtos: /* nothing to do */        break;
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   659
  default  : ShouldNotReachHere();
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   660
  }
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   661
}
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   662
#else
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   663
void InterpreterMacroAssembler::pop_i(Register r) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   664
  pop(r);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   665
}
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   666
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   667
void InterpreterMacroAssembler::pop_l(Register lo, Register hi) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   668
  pop(lo);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   669
  pop(hi);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   670
}
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   671
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   672
void InterpreterMacroAssembler::pop_f() {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   673
  fld_s(Address(rsp, 0));
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   674
  addptr(rsp, 1 * wordSize);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   675
}
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   676
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   677
void InterpreterMacroAssembler::pop_d() {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   678
  fld_d(Address(rsp, 0));
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   679
  addptr(rsp, 2 * wordSize);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   680
}
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   681
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   682
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   683
void InterpreterMacroAssembler::pop(TosState state) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   684
  switch (state) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   685
    case atos: pop_ptr(rax);                                 break;
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   686
    case btos:                                               // fall through
37480
291ee208fb72 8132051: Better byte behavior
coleenp
parents: 37251
diff changeset
   687
    case ztos:                                               // fall through
29578
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   688
    case ctos:                                               // fall through
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   689
    case stos:                                               // fall through
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   690
    case itos: pop_i(rax);                                   break;
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   691
    case ltos: pop_l(rax, rdx);                              break;
32391
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31046
diff changeset
   692
    case ftos:
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31046
diff changeset
   693
      if (UseSSE >= 1) {
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31046
diff changeset
   694
        pop_f(xmm0);
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31046
diff changeset
   695
      } else {
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31046
diff changeset
   696
        pop_f();
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31046
diff changeset
   697
      }
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31046
diff changeset
   698
      break;
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31046
diff changeset
   699
    case dtos:
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31046
diff changeset
   700
      if (UseSSE >= 2) {
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31046
diff changeset
   701
        pop_d(xmm0);
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31046
diff changeset
   702
      } else {
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31046
diff changeset
   703
        pop_d();
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31046
diff changeset
   704
      }
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31046
diff changeset
   705
      break;
29578
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   706
    case vtos: /* nothing to do */                           break;
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   707
    default  : ShouldNotReachHere();
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   708
  }
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   709
  verify_oop(rax, state);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   710
}
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   711
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   712
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   713
void InterpreterMacroAssembler::push_l(Register lo, Register hi) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   714
  push(hi);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   715
  push(lo);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   716
}
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   717
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   718
void InterpreterMacroAssembler::push_f() {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   719
  // Do not schedule for no AGI! Never write beyond rsp!
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   720
  subptr(rsp, 1 * wordSize);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   721
  fstp_s(Address(rsp, 0));
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   722
}
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   723
32391
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31046
diff changeset
   724
void InterpreterMacroAssembler::push_d() {
29578
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   725
  // Do not schedule for no AGI! Never write beyond rsp!
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   726
  subptr(rsp, 2 * wordSize);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   727
  fstp_d(Address(rsp, 0));
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   728
}
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   729
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   730
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   731
void InterpreterMacroAssembler::push(TosState state) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   732
  verify_oop(rax, state);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   733
  switch (state) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   734
    case atos: push_ptr(rax); break;
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   735
    case btos:                                               // fall through
37480
291ee208fb72 8132051: Better byte behavior
coleenp
parents: 37251
diff changeset
   736
    case ztos:                                               // fall through
29578
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   737
    case ctos:                                               // fall through
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   738
    case stos:                                               // fall through
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   739
    case itos: push_i(rax);                                    break;
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   740
    case ltos: push_l(rax, rdx);                               break;
32391
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31046
diff changeset
   741
    case ftos:
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31046
diff changeset
   742
      if (UseSSE >= 1) {
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31046
diff changeset
   743
        push_f(xmm0);
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31046
diff changeset
   744
      } else {
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31046
diff changeset
   745
        push_f();
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31046
diff changeset
   746
      }
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31046
diff changeset
   747
      break;
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31046
diff changeset
   748
    case dtos:
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31046
diff changeset
   749
      if (UseSSE >= 2) {
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31046
diff changeset
   750
        push_d(xmm0);
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31046
diff changeset
   751
      } else {
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31046
diff changeset
   752
        push_d();
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31046
diff changeset
   753
      }
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31046
diff changeset
   754
      break;
29578
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   755
    case vtos: /* nothing to do */                             break;
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   756
    default  : ShouldNotReachHere();
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   757
  }
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   758
}
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   759
#endif // _LP64
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   760
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   761
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   762
// Helpers for swap and dup
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   763
void InterpreterMacroAssembler::load_ptr(int n, Register val) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   764
  movptr(val, Address(rsp, Interpreter::expr_offset_in_bytes(n)));
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   765
}
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   766
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   767
void InterpreterMacroAssembler::store_ptr(int n, Register val) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   768
  movptr(Address(rsp, Interpreter::expr_offset_in_bytes(n)), val);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   769
}
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   770
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   771
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   772
void InterpreterMacroAssembler::prepare_to_jump_from_interpreted() {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   773
  // set sender sp
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   774
  lea(_bcp_register, Address(rsp, wordSize));
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   775
  // record last_sp
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   776
  movptr(Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize), _bcp_register);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   777
}
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   778
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   779
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   780
// Jump to from_interpreted entry of a call unless single stepping is possible
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   781
// in this thread in which case we must call the i2i entry
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   782
void InterpreterMacroAssembler::jump_from_interpreted(Register method, Register temp) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   783
  prepare_to_jump_from_interpreted();
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   784
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   785
  if (JvmtiExport::can_post_interpreter_events()) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   786
    Label run_compiled_code;
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   787
    // JVMTI events, such as single-stepping, are implemented partly by avoiding running
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   788
    // compiled code in threads for which the event is enabled.  Check here for
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   789
    // interp_only_mode if these events CAN be enabled.
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   790
    // interp_only is an int, on little endian it is sufficient to test the byte only
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   791
    // Is a cmpl faster?
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   792
    LP64_ONLY(temp = r15_thread;)
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   793
    NOT_LP64(get_thread(temp);)
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   794
    cmpb(Address(temp, JavaThread::interp_only_mode_offset()), 0);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   795
    jccb(Assembler::zero, run_compiled_code);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   796
    jmp(Address(method, Method::interpreter_entry_offset()));
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   797
    bind(run_compiled_code);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   798
  }
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   799
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   800
  jmp(Address(method, Method::from_interpreted_offset()));
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   801
}
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   802
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   803
// The following two routines provide a hook so that an implementation
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   804
// can schedule the dispatch in two parts.  x86 does not do this.
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   805
void InterpreterMacroAssembler::dispatch_prolog(TosState state, int step) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   806
  // Nothing x86 specific to be done here
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   807
}
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   808
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   809
void InterpreterMacroAssembler::dispatch_epilog(TosState state, int step) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   810
  dispatch_next(state, step);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   811
}
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   812
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   813
void InterpreterMacroAssembler::dispatch_base(TosState state,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   814
                                              address* table,
47881
0ce0ac68ace7 8189941: Implementation JEP 312: Thread-local handshake
rehn
parents: 47216
diff changeset
   815
                                              bool verifyoop,
0ce0ac68ace7 8189941: Implementation JEP 312: Thread-local handshake
rehn
parents: 47216
diff changeset
   816
                                              bool generate_poll) {
29578
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   817
  verify_FPU(1, state);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   818
  if (VerifyActivationFrameSize) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   819
    Label L;
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   820
    mov(rcx, rbp);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   821
    subptr(rcx, rsp);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   822
    int32_t min_frame_size =
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   823
      (frame::link_offset - frame::interpreter_frame_initial_sp_offset) *
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   824
      wordSize;
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   825
    cmpptr(rcx, (int32_t)min_frame_size);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   826
    jcc(Assembler::greaterEqual, L);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   827
    stop("broken stack frame");
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   828
    bind(L);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   829
  }
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   830
  if (verifyoop) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   831
    verify_oop(rax, state);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   832
  }
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   833
#ifdef _LP64
47881
0ce0ac68ace7 8189941: Implementation JEP 312: Thread-local handshake
rehn
parents: 47216
diff changeset
   834
0ce0ac68ace7 8189941: Implementation JEP 312: Thread-local handshake
rehn
parents: 47216
diff changeset
   835
  Label no_safepoint, dispatch;
0ce0ac68ace7 8189941: Implementation JEP 312: Thread-local handshake
rehn
parents: 47216
diff changeset
   836
  address* const safepoint_table = Interpreter::safept_table(state);
0ce0ac68ace7 8189941: Implementation JEP 312: Thread-local handshake
rehn
parents: 47216
diff changeset
   837
  if (SafepointMechanism::uses_thread_local_poll() && table != safepoint_table && generate_poll) {
0ce0ac68ace7 8189941: Implementation JEP 312: Thread-local handshake
rehn
parents: 47216
diff changeset
   838
    NOT_PRODUCT(block_comment("Thread-local Safepoint poll"));
0ce0ac68ace7 8189941: Implementation JEP 312: Thread-local handshake
rehn
parents: 47216
diff changeset
   839
0ce0ac68ace7 8189941: Implementation JEP 312: Thread-local handshake
rehn
parents: 47216
diff changeset
   840
    testb(Address(r15_thread, Thread::polling_page_offset()), SafepointMechanism::poll_bit());
0ce0ac68ace7 8189941: Implementation JEP 312: Thread-local handshake
rehn
parents: 47216
diff changeset
   841
0ce0ac68ace7 8189941: Implementation JEP 312: Thread-local handshake
rehn
parents: 47216
diff changeset
   842
    jccb(Assembler::zero, no_safepoint);
0ce0ac68ace7 8189941: Implementation JEP 312: Thread-local handshake
rehn
parents: 47216
diff changeset
   843
    lea(rscratch1, ExternalAddress((address)safepoint_table));
0ce0ac68ace7 8189941: Implementation JEP 312: Thread-local handshake
rehn
parents: 47216
diff changeset
   844
    jmpb(dispatch);
0ce0ac68ace7 8189941: Implementation JEP 312: Thread-local handshake
rehn
parents: 47216
diff changeset
   845
  }
0ce0ac68ace7 8189941: Implementation JEP 312: Thread-local handshake
rehn
parents: 47216
diff changeset
   846
0ce0ac68ace7 8189941: Implementation JEP 312: Thread-local handshake
rehn
parents: 47216
diff changeset
   847
  bind(no_safepoint);
29578
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   848
  lea(rscratch1, ExternalAddress((address)table));
47881
0ce0ac68ace7 8189941: Implementation JEP 312: Thread-local handshake
rehn
parents: 47216
diff changeset
   849
  bind(dispatch);
29578
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   850
  jmp(Address(rscratch1, rbx, Address::times_8));
47881
0ce0ac68ace7 8189941: Implementation JEP 312: Thread-local handshake
rehn
parents: 47216
diff changeset
   851
29578
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   852
#else
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   853
  Address index(noreg, rbx, Address::times_ptr);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   854
  ExternalAddress tbl((address)table);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   855
  ArrayAddress dispatch(tbl, index);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   856
  jump(dispatch);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   857
#endif // _LP64
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   858
}
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   859
47881
0ce0ac68ace7 8189941: Implementation JEP 312: Thread-local handshake
rehn
parents: 47216
diff changeset
   860
void InterpreterMacroAssembler::dispatch_only(TosState state, bool generate_poll) {
0ce0ac68ace7 8189941: Implementation JEP 312: Thread-local handshake
rehn
parents: 47216
diff changeset
   861
  dispatch_base(state, Interpreter::dispatch_table(state), true, generate_poll);
29578
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   862
}
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   863
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   864
void InterpreterMacroAssembler::dispatch_only_normal(TosState state) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   865
  dispatch_base(state, Interpreter::normal_table(state));
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   866
}
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   867
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   868
void InterpreterMacroAssembler::dispatch_only_noverify(TosState state) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   869
  dispatch_base(state, Interpreter::normal_table(state), false);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   870
}
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   871
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   872
47881
0ce0ac68ace7 8189941: Implementation JEP 312: Thread-local handshake
rehn
parents: 47216
diff changeset
   873
void InterpreterMacroAssembler::dispatch_next(TosState state, int step, bool generate_poll) {
29578
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   874
  // load next bytecode (load before advancing _bcp_register to prevent AGI)
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   875
  load_unsigned_byte(rbx, Address(_bcp_register, step));
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   876
  // advance _bcp_register
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   877
  increment(_bcp_register, step);
47881
0ce0ac68ace7 8189941: Implementation JEP 312: Thread-local handshake
rehn
parents: 47216
diff changeset
   878
  dispatch_base(state, Interpreter::dispatch_table(state), true, generate_poll);
29578
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   879
}
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   880
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   881
void InterpreterMacroAssembler::dispatch_via(TosState state, address* table) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   882
  // load current bytecode
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   883
  load_unsigned_byte(rbx, Address(_bcp_register, 0));
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   884
  dispatch_base(state, table);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   885
}
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   886
37480
291ee208fb72 8132051: Better byte behavior
coleenp
parents: 37251
diff changeset
   887
void InterpreterMacroAssembler::narrow(Register result) {
291ee208fb72 8132051: Better byte behavior
coleenp
parents: 37251
diff changeset
   888
291ee208fb72 8132051: Better byte behavior
coleenp
parents: 37251
diff changeset
   889
  // Get method->_constMethod->_result_type
291ee208fb72 8132051: Better byte behavior
coleenp
parents: 37251
diff changeset
   890
  movptr(rcx, Address(rbp, frame::interpreter_frame_method_offset * wordSize));
291ee208fb72 8132051: Better byte behavior
coleenp
parents: 37251
diff changeset
   891
  movptr(rcx, Address(rcx, Method::const_offset()));
291ee208fb72 8132051: Better byte behavior
coleenp
parents: 37251
diff changeset
   892
  load_unsigned_byte(rcx, Address(rcx, ConstMethod::result_type_offset()));
291ee208fb72 8132051: Better byte behavior
coleenp
parents: 37251
diff changeset
   893
291ee208fb72 8132051: Better byte behavior
coleenp
parents: 37251
diff changeset
   894
  Label done, notBool, notByte, notChar;
291ee208fb72 8132051: Better byte behavior
coleenp
parents: 37251
diff changeset
   895
291ee208fb72 8132051: Better byte behavior
coleenp
parents: 37251
diff changeset
   896
  // common case first
291ee208fb72 8132051: Better byte behavior
coleenp
parents: 37251
diff changeset
   897
  cmpl(rcx, T_INT);
291ee208fb72 8132051: Better byte behavior
coleenp
parents: 37251
diff changeset
   898
  jcc(Assembler::equal, done);
291ee208fb72 8132051: Better byte behavior
coleenp
parents: 37251
diff changeset
   899
291ee208fb72 8132051: Better byte behavior
coleenp
parents: 37251
diff changeset
   900
  // mask integer result to narrower return type.
291ee208fb72 8132051: Better byte behavior
coleenp
parents: 37251
diff changeset
   901
  cmpl(rcx, T_BOOLEAN);
291ee208fb72 8132051: Better byte behavior
coleenp
parents: 37251
diff changeset
   902
  jcc(Assembler::notEqual, notBool);
291ee208fb72 8132051: Better byte behavior
coleenp
parents: 37251
diff changeset
   903
  andl(result, 0x1);
291ee208fb72 8132051: Better byte behavior
coleenp
parents: 37251
diff changeset
   904
  jmp(done);
291ee208fb72 8132051: Better byte behavior
coleenp
parents: 37251
diff changeset
   905
291ee208fb72 8132051: Better byte behavior
coleenp
parents: 37251
diff changeset
   906
  bind(notBool);
291ee208fb72 8132051: Better byte behavior
coleenp
parents: 37251
diff changeset
   907
  cmpl(rcx, T_BYTE);
291ee208fb72 8132051: Better byte behavior
coleenp
parents: 37251
diff changeset
   908
  jcc(Assembler::notEqual, notByte);
291ee208fb72 8132051: Better byte behavior
coleenp
parents: 37251
diff changeset
   909
  LP64_ONLY(movsbl(result, result);)
291ee208fb72 8132051: Better byte behavior
coleenp
parents: 37251
diff changeset
   910
  NOT_LP64(shll(result, 24);)      // truncate upper 24 bits
291ee208fb72 8132051: Better byte behavior
coleenp
parents: 37251
diff changeset
   911
  NOT_LP64(sarl(result, 24);)      // and sign-extend byte
291ee208fb72 8132051: Better byte behavior
coleenp
parents: 37251
diff changeset
   912
  jmp(done);
291ee208fb72 8132051: Better byte behavior
coleenp
parents: 37251
diff changeset
   913
291ee208fb72 8132051: Better byte behavior
coleenp
parents: 37251
diff changeset
   914
  bind(notByte);
291ee208fb72 8132051: Better byte behavior
coleenp
parents: 37251
diff changeset
   915
  cmpl(rcx, T_CHAR);
291ee208fb72 8132051: Better byte behavior
coleenp
parents: 37251
diff changeset
   916
  jcc(Assembler::notEqual, notChar);
291ee208fb72 8132051: Better byte behavior
coleenp
parents: 37251
diff changeset
   917
  LP64_ONLY(movzwl(result, result);)
291ee208fb72 8132051: Better byte behavior
coleenp
parents: 37251
diff changeset
   918
  NOT_LP64(andl(result, 0xFFFF);)  // truncate upper 16 bits
291ee208fb72 8132051: Better byte behavior
coleenp
parents: 37251
diff changeset
   919
  jmp(done);
291ee208fb72 8132051: Better byte behavior
coleenp
parents: 37251
diff changeset
   920
291ee208fb72 8132051: Better byte behavior
coleenp
parents: 37251
diff changeset
   921
  bind(notChar);
291ee208fb72 8132051: Better byte behavior
coleenp
parents: 37251
diff changeset
   922
  // cmpl(rcx, T_SHORT);  // all that's left
291ee208fb72 8132051: Better byte behavior
coleenp
parents: 37251
diff changeset
   923
  // jcc(Assembler::notEqual, done);
291ee208fb72 8132051: Better byte behavior
coleenp
parents: 37251
diff changeset
   924
  LP64_ONLY(movswl(result, result);)
291ee208fb72 8132051: Better byte behavior
coleenp
parents: 37251
diff changeset
   925
  NOT_LP64(shll(result, 16);)      // truncate upper 16 bits
291ee208fb72 8132051: Better byte behavior
coleenp
parents: 37251
diff changeset
   926
  NOT_LP64(sarl(result, 16);)      // and sign-extend short
291ee208fb72 8132051: Better byte behavior
coleenp
parents: 37251
diff changeset
   927
291ee208fb72 8132051: Better byte behavior
coleenp
parents: 37251
diff changeset
   928
  // Nothing to do for T_INT
291ee208fb72 8132051: Better byte behavior
coleenp
parents: 37251
diff changeset
   929
  bind(done);
291ee208fb72 8132051: Better byte behavior
coleenp
parents: 37251
diff changeset
   930
}
291ee208fb72 8132051: Better byte behavior
coleenp
parents: 37251
diff changeset
   931
29578
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   932
// remove activation
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   933
//
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   934
// Unlock the receiver if this is a synchronized method.
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   935
// Unlock any Java monitors from syncronized blocks.
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   936
// Remove the activation from the stack.
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   937
//
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   938
// If there are locked Java monitors
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   939
//    If throw_monitor_exception
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   940
//       throws IllegalMonitorStateException
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   941
//    Else if install_monitor_exception
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   942
//       installs IllegalMonitorStateException
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   943
//    Else
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   944
//       no error processing
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   945
void InterpreterMacroAssembler::remove_activation(
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   946
        TosState state,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   947
        Register ret_addr,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   948
        bool throw_monitor_exception,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   949
        bool install_monitor_exception,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   950
        bool notify_jvmdi) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   951
  // Note: Registers rdx xmm0 may be in use for the
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   952
  // result check if synchronized method
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   953
  Label unlocked, unlock, no_unlock;
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   954
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   955
  const Register rthread = LP64_ONLY(r15_thread) NOT_LP64(rcx);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   956
  const Register robj    = LP64_ONLY(c_rarg1) NOT_LP64(rdx);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   957
  const Register rmon    = LP64_ONLY(c_rarg1) NOT_LP64(rcx);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   958
                              // monitor pointers need different register
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   959
                              // because rdx may have the result in it
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   960
  NOT_LP64(get_thread(rcx);)
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   961
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   962
  // get the value of _do_not_unlock_if_synchronized into rdx
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   963
  const Address do_not_unlock_if_synchronized(rthread,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   964
    in_bytes(JavaThread::do_not_unlock_if_synchronized_offset()));
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   965
  movbool(rbx, do_not_unlock_if_synchronized);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   966
  movbool(do_not_unlock_if_synchronized, false); // reset the flag
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   967
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   968
 // get method access flags
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   969
  movptr(rcx, Address(rbp, frame::interpreter_frame_method_offset * wordSize));
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   970
  movl(rcx, Address(rcx, Method::access_flags_offset()));
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   971
  testl(rcx, JVM_ACC_SYNCHRONIZED);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   972
  jcc(Assembler::zero, unlocked);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   973
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   974
  // Don't unlock anything if the _do_not_unlock_if_synchronized flag
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   975
  // is set.
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   976
  testbool(rbx);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   977
  jcc(Assembler::notZero, no_unlock);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   978
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   979
  // unlock monitor
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   980
  push(state); // save result
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   981
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   982
  // BasicObjectLock will be first in list, since this is a
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   983
  // synchronized method. However, need to check that the object has
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   984
  // not been unlocked by an explicit monitorexit bytecode.
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   985
  const Address monitor(rbp, frame::interpreter_frame_initial_sp_offset *
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   986
                        wordSize - (int) sizeof(BasicObjectLock));
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   987
  // We use c_rarg1/rdx so that if we go slow path it will be the correct
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   988
  // register for unlock_object to pass to VM directly
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   989
  lea(robj, monitor); // address of first monitor
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   990
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   991
  movptr(rax, Address(robj, BasicObjectLock::obj_offset_in_bytes()));
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   992
  testptr(rax, rax);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   993
  jcc(Assembler::notZero, unlock);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   994
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   995
  pop(state);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   996
  if (throw_monitor_exception) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   997
    // Entry already unlocked, need to throw exception
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   998
    NOT_LP64(empty_FPU_stack();)  // remove possible return value from FPU-stack, otherwise stack could overflow
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
   999
    call_VM(noreg, CAST_FROM_FN_PTR(address,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1000
                   InterpreterRuntime::throw_illegal_monitor_state_exception));
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1001
    should_not_reach_here();
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1002
  } else {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1003
    // Monitor already unlocked during a stack unroll. If requested,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1004
    // install an illegal_monitor_state_exception.  Continue with
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1005
    // stack unrolling.
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1006
    if (install_monitor_exception) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1007
      NOT_LP64(empty_FPU_stack();)
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1008
      call_VM(noreg, CAST_FROM_FN_PTR(address,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1009
                     InterpreterRuntime::new_illegal_monitor_state_exception));
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1010
    }
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1011
    jmp(unlocked);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1012
  }
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1013
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1014
  bind(unlock);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1015
  unlock_object(robj);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1016
  pop(state);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1017
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1018
  // Check that for block-structured locking (i.e., that all locked
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1019
  // objects has been unlocked)
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1020
  bind(unlocked);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1021
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1022
  // rax, rdx: Might contain return value
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1023
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1024
  // Check that all monitors are unlocked
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1025
  {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1026
    Label loop, exception, entry, restart;
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1027
    const int entry_size = frame::interpreter_frame_monitor_size() * wordSize;
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1028
    const Address monitor_block_top(
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1029
        rbp, frame::interpreter_frame_monitor_block_top_offset * wordSize);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1030
    const Address monitor_block_bot(
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1031
        rbp, frame::interpreter_frame_initial_sp_offset * wordSize);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1032
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1033
    bind(restart);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1034
    // We use c_rarg1 so that if we go slow path it will be the correct
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1035
    // register for unlock_object to pass to VM directly
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1036
    movptr(rmon, monitor_block_top); // points to current entry, starting
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1037
                                  // with top-most entry
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1038
    lea(rbx, monitor_block_bot);  // points to word before bottom of
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1039
                                  // monitor block
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1040
    jmp(entry);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1041
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1042
    // Entry already locked, need to throw exception
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1043
    bind(exception);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1044
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1045
    if (throw_monitor_exception) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1046
      // Throw exception
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1047
      NOT_LP64(empty_FPU_stack();)
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1048
      MacroAssembler::call_VM(noreg,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1049
                              CAST_FROM_FN_PTR(address, InterpreterRuntime::
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1050
                                   throw_illegal_monitor_state_exception));
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1051
      should_not_reach_here();
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1052
    } else {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1053
      // Stack unrolling. Unlock object and install illegal_monitor_exception.
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1054
      // Unlock does not block, so don't have to worry about the frame.
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1055
      // We don't have to preserve c_rarg1 since we are going to throw an exception.
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1056
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1057
      push(state);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1058
      mov(robj, rmon);   // nop if robj and rmon are the same
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1059
      unlock_object(robj);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1060
      pop(state);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1061
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1062
      if (install_monitor_exception) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1063
        NOT_LP64(empty_FPU_stack();)
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1064
        call_VM(noreg, CAST_FROM_FN_PTR(address,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1065
                                        InterpreterRuntime::
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1066
                                        new_illegal_monitor_state_exception));
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1067
      }
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1068
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1069
      jmp(restart);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1070
    }
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1071
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1072
    bind(loop);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1073
    // check if current entry is used
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1074
    cmpptr(Address(rmon, BasicObjectLock::obj_offset_in_bytes()), (int32_t) NULL);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1075
    jcc(Assembler::notEqual, exception);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1076
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1077
    addptr(rmon, entry_size); // otherwise advance to next entry
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1078
    bind(entry);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1079
    cmpptr(rmon, rbx); // check if bottom reached
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1080
    jcc(Assembler::notEqual, loop); // if not at bottom then check this entry
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1081
  }
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1082
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1083
  bind(no_unlock);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1084
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1085
  // jvmti support
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1086
  if (notify_jvmdi) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1087
    notify_method_exit(state, NotifyJVMTI);    // preserve TOSCA
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1088
  } else {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1089
    notify_method_exit(state, SkipNotifyJVMTI); // preserve TOSCA
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1090
  }
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1091
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1092
  // remove activation
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1093
  // get sender sp
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1094
  movptr(rbx,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1095
         Address(rbp, frame::interpreter_frame_sender_sp_offset * wordSize));
35071
a0910b1d3e0d 8046936: JEP 270: Reserved Stack Areas for Critical Sections
fparain
parents: 33160
diff changeset
  1096
  if (StackReservedPages > 0) {
a0910b1d3e0d 8046936: JEP 270: Reserved Stack Areas for Critical Sections
fparain
parents: 33160
diff changeset
  1097
    // testing if reserved zone needs to be re-enabled
a0910b1d3e0d 8046936: JEP 270: Reserved Stack Areas for Critical Sections
fparain
parents: 33160
diff changeset
  1098
    Register rthread = LP64_ONLY(r15_thread) NOT_LP64(rcx);
a0910b1d3e0d 8046936: JEP 270: Reserved Stack Areas for Critical Sections
fparain
parents: 33160
diff changeset
  1099
    Label no_reserved_zone_enabling;
a0910b1d3e0d 8046936: JEP 270: Reserved Stack Areas for Critical Sections
fparain
parents: 33160
diff changeset
  1100
a0910b1d3e0d 8046936: JEP 270: Reserved Stack Areas for Critical Sections
fparain
parents: 33160
diff changeset
  1101
    NOT_LP64(get_thread(rthread);)
a0910b1d3e0d 8046936: JEP 270: Reserved Stack Areas for Critical Sections
fparain
parents: 33160
diff changeset
  1102
40378
2e441ecd5ac7 8146697: VM crashes in test Test7005594
fparain
parents: 38259
diff changeset
  1103
    cmpl(Address(rthread, JavaThread::stack_guard_state_offset()), JavaThread::stack_guard_enabled);
2e441ecd5ac7 8146697: VM crashes in test Test7005594
fparain
parents: 38259
diff changeset
  1104
    jcc(Assembler::equal, no_reserved_zone_enabling);
2e441ecd5ac7 8146697: VM crashes in test Test7005594
fparain
parents: 38259
diff changeset
  1105
35071
a0910b1d3e0d 8046936: JEP 270: Reserved Stack Areas for Critical Sections
fparain
parents: 33160
diff changeset
  1106
    cmpptr(rbx, Address(rthread, JavaThread::reserved_stack_activation_offset()));
a0910b1d3e0d 8046936: JEP 270: Reserved Stack Areas for Critical Sections
fparain
parents: 33160
diff changeset
  1107
    jcc(Assembler::lessEqual, no_reserved_zone_enabling);
a0910b1d3e0d 8046936: JEP 270: Reserved Stack Areas for Critical Sections
fparain
parents: 33160
diff changeset
  1108
a0910b1d3e0d 8046936: JEP 270: Reserved Stack Areas for Critical Sections
fparain
parents: 33160
diff changeset
  1109
    call_VM_leaf(
a0910b1d3e0d 8046936: JEP 270: Reserved Stack Areas for Critical Sections
fparain
parents: 33160
diff changeset
  1110
      CAST_FROM_FN_PTR(address, SharedRuntime::enable_stack_reserved_zone), rthread);
a0910b1d3e0d 8046936: JEP 270: Reserved Stack Areas for Critical Sections
fparain
parents: 33160
diff changeset
  1111
    call_VM(noreg, CAST_FROM_FN_PTR(address,
a0910b1d3e0d 8046936: JEP 270: Reserved Stack Areas for Critical Sections
fparain
parents: 33160
diff changeset
  1112
                   InterpreterRuntime::throw_delayed_StackOverflowError));
a0910b1d3e0d 8046936: JEP 270: Reserved Stack Areas for Critical Sections
fparain
parents: 33160
diff changeset
  1113
    should_not_reach_here();
a0910b1d3e0d 8046936: JEP 270: Reserved Stack Areas for Critical Sections
fparain
parents: 33160
diff changeset
  1114
a0910b1d3e0d 8046936: JEP 270: Reserved Stack Areas for Critical Sections
fparain
parents: 33160
diff changeset
  1115
    bind(no_reserved_zone_enabling);
a0910b1d3e0d 8046936: JEP 270: Reserved Stack Areas for Critical Sections
fparain
parents: 33160
diff changeset
  1116
  }
29578
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1117
  leave();                           // remove frame anchor
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1118
  pop(ret_addr);                     // get return address
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1119
  mov(rsp, rbx);                     // set sp to sender sp
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1120
}
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1121
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1122
void InterpreterMacroAssembler::get_method_counters(Register method,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1123
                                                    Register mcs, Label& skip) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1124
  Label has_counters;
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1125
  movptr(mcs, Address(method, Method::method_counters_offset()));
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1126
  testptr(mcs, mcs);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1127
  jcc(Assembler::notZero, has_counters);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1128
  call_VM(noreg, CAST_FROM_FN_PTR(address,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1129
          InterpreterRuntime::build_method_counters), method);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1130
  movptr(mcs, Address(method,Method::method_counters_offset()));
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1131
  testptr(mcs, mcs);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1132
  jcc(Assembler::zero, skip); // No MethodCounters allocated, OutOfMemory
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1133
  bind(has_counters);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1134
}
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1135
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1136
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1137
// Lock object
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1138
//
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1139
// Args:
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1140
//      rdx, c_rarg1: BasicObjectLock to be used for locking
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1141
//
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1142
// Kills:
30749
39a2475280ee 6811960: x86 biasedlocking epoch expired rare bug
mockner
parents: 29578
diff changeset
  1143
//      rax, rbx
29578
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1144
void InterpreterMacroAssembler::lock_object(Register lock_reg) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1145
  assert(lock_reg == LP64_ONLY(c_rarg1) NOT_LP64(rdx),
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1146
         "The argument is only for looks. It must be c_rarg1");
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1147
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1148
  if (UseHeavyMonitors) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1149
    call_VM(noreg,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1150
            CAST_FROM_FN_PTR(address, InterpreterRuntime::monitorenter),
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1151
            lock_reg);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1152
  } else {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1153
    Label done;
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1154
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1155
    const Register swap_reg = rax; // Must use rax for cmpxchg instruction
30749
39a2475280ee 6811960: x86 biasedlocking epoch expired rare bug
mockner
parents: 29578
diff changeset
  1156
    const Register tmp_reg = rbx; // Will be passed to biased_locking_enter to avoid a
39a2475280ee 6811960: x86 biasedlocking epoch expired rare bug
mockner
parents: 29578
diff changeset
  1157
                                  // problematic case where tmp_reg = no_reg.
29578
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1158
    const Register obj_reg = LP64_ONLY(c_rarg3) NOT_LP64(rcx); // Will contain the oop
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1159
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1160
    const int obj_offset = BasicObjectLock::obj_offset_in_bytes();
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1161
    const int lock_offset = BasicObjectLock::lock_offset_in_bytes ();
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1162
    const int mark_offset = lock_offset +
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1163
                            BasicLock::displaced_header_offset_in_bytes();
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1164
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1165
    Label slow_case;
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1166
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1167
    // Load object pointer into obj_reg
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1168
    movptr(obj_reg, Address(lock_reg, obj_offset));
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1169
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1170
    if (UseBiasedLocking) {
30749
39a2475280ee 6811960: x86 biasedlocking epoch expired rare bug
mockner
parents: 29578
diff changeset
  1171
      biased_locking_enter(lock_reg, obj_reg, swap_reg, tmp_reg, false, done, &slow_case);
29578
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1172
    }
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1173
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1174
    // Load immediate 1 into swap_reg %rax
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1175
    movl(swap_reg, (int32_t)1);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1176
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1177
    // Load (object->mark() | 1) into swap_reg %rax
46449
7b2416f0f524 8167659: Access of mark word should use oopDesc::mark_offset_in_bytes() instead of '0'
rkennke
parents: 46427
diff changeset
  1178
    orptr(swap_reg, Address(obj_reg, oopDesc::mark_offset_in_bytes()));
29578
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1179
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1180
    // Save (object->mark() | 1) into BasicLock's displaced header
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1181
    movptr(Address(lock_reg, mark_offset), swap_reg);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1182
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1183
    assert(lock_offset == 0,
37251
9fc139ad74b5 8152358: code and comment cleanups found during the hunt for 8077392
dcubed
parents: 37152
diff changeset
  1184
           "displaced header must be first word in BasicObjectLock");
29578
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1185
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1186
    if (os::is_MP()) lock();
46449
7b2416f0f524 8167659: Access of mark word should use oopDesc::mark_offset_in_bytes() instead of '0'
rkennke
parents: 46427
diff changeset
  1187
    cmpxchgptr(lock_reg, Address(obj_reg, oopDesc::mark_offset_in_bytes()));
29578
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1188
    if (PrintBiasedLockingStatistics) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1189
      cond_inc32(Assembler::zero,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1190
                 ExternalAddress((address) BiasedLocking::fast_path_entry_count_addr()));
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1191
    }
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1192
    jcc(Assembler::zero, done);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1193
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1194
    const int zero_bits = LP64_ONLY(7) NOT_LP64(3);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1195
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1196
    // Test if the oopMark is an obvious stack pointer, i.e.,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1197
    //  1) (mark & zero_bits) == 0, and
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1198
    //  2) rsp <= mark < mark + os::pagesize()
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1199
    //
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1200
    // These 3 tests can be done by evaluating the following
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1201
    // expression: ((mark - rsp) & (zero_bits - os::vm_page_size())),
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1202
    // assuming both stack pointer and pagesize have their
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1203
    // least significant bits clear.
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1204
    // NOTE: the oopMark is in swap_reg %rax as the result of cmpxchg
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1205
    subptr(swap_reg, rsp);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1206
    andptr(swap_reg, zero_bits - os::vm_page_size());
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1207
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1208
    // Save the test result, for recursive case, the result is zero
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1209
    movptr(Address(lock_reg, mark_offset), swap_reg);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1210
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1211
    if (PrintBiasedLockingStatistics) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1212
      cond_inc32(Assembler::zero,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1213
                 ExternalAddress((address) BiasedLocking::fast_path_entry_count_addr()));
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1214
    }
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1215
    jcc(Assembler::zero, done);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1216
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1217
    bind(slow_case);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1218
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1219
    // Call the runtime routine for slow case
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1220
    call_VM(noreg,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1221
            CAST_FROM_FN_PTR(address, InterpreterRuntime::monitorenter),
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1222
            lock_reg);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1223
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1224
    bind(done);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1225
  }
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1226
}
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1227
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1228
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1229
// Unlocks an object. Used in monitorexit bytecode and
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1230
// remove_activation.  Throws an IllegalMonitorException if object is
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1231
// not locked by current thread.
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1232
//
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1233
// Args:
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1234
//      rdx, c_rarg1: BasicObjectLock for lock
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1235
//
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1236
// Kills:
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1237
//      rax
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1238
//      c_rarg0, c_rarg1, c_rarg2, c_rarg3, ... (param regs)
37251
9fc139ad74b5 8152358: code and comment cleanups found during the hunt for 8077392
dcubed
parents: 37152
diff changeset
  1239
//      rscratch1 (scratch reg)
29578
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1240
// rax, rbx, rcx, rdx
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1241
void InterpreterMacroAssembler::unlock_object(Register lock_reg) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1242
  assert(lock_reg == LP64_ONLY(c_rarg1) NOT_LP64(rdx),
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1243
         "The argument is only for looks. It must be c_rarg1");
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1244
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1245
  if (UseHeavyMonitors) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1246
    call_VM(noreg,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1247
            CAST_FROM_FN_PTR(address, InterpreterRuntime::monitorexit),
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1248
            lock_reg);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1249
  } else {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1250
    Label done;
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1251
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1252
    const Register swap_reg   = rax;  // Must use rax for cmpxchg instruction
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1253
    const Register header_reg = LP64_ONLY(c_rarg2) NOT_LP64(rbx);  // Will contain the old oopMark
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1254
    const Register obj_reg    = LP64_ONLY(c_rarg3) NOT_LP64(rcx);  // Will contain the oop
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1255
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1256
    save_bcp(); // Save in case of exception
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1257
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1258
    // Convert from BasicObjectLock structure to object and BasicLock
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1259
    // structure Store the BasicLock address into %rax
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1260
    lea(swap_reg, Address(lock_reg, BasicObjectLock::lock_offset_in_bytes()));
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1261
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1262
    // Load oop into obj_reg(%c_rarg3)
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1263
    movptr(obj_reg, Address(lock_reg, BasicObjectLock::obj_offset_in_bytes()));
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1264
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1265
    // Free entry
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1266
    movptr(Address(lock_reg, BasicObjectLock::obj_offset_in_bytes()), (int32_t)NULL_WORD);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1267
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1268
    if (UseBiasedLocking) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1269
      biased_locking_exit(obj_reg, header_reg, done);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1270
    }
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1271
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1272
    // Load the old header from BasicLock structure
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1273
    movptr(header_reg, Address(swap_reg,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1274
                               BasicLock::displaced_header_offset_in_bytes()));
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1275
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1276
    // Test for recursion
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1277
    testptr(header_reg, header_reg);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1278
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1279
    // zero for recursive case
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1280
    jcc(Assembler::zero, done);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1281
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1282
    // Atomic swap back the old header
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1283
    if (os::is_MP()) lock();
46449
7b2416f0f524 8167659: Access of mark word should use oopDesc::mark_offset_in_bytes() instead of '0'
rkennke
parents: 46427
diff changeset
  1284
    cmpxchgptr(header_reg, Address(obj_reg, oopDesc::mark_offset_in_bytes()));
29578
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1285
37251
9fc139ad74b5 8152358: code and comment cleanups found during the hunt for 8077392
dcubed
parents: 37152
diff changeset
  1286
    // zero for simple unlock of a stack-lock case
29578
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1287
    jcc(Assembler::zero, done);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1288
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1289
    // Call the runtime routine for slow case.
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1290
    movptr(Address(lock_reg, BasicObjectLock::obj_offset_in_bytes()),
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1291
         obj_reg); // restore obj
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1292
    call_VM(noreg,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1293
            CAST_FROM_FN_PTR(address, InterpreterRuntime::monitorexit),
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1294
            lock_reg);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1295
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1296
    bind(done);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1297
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1298
    restore_bcp();
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1299
  }
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1300
}
35214
d86005e0b4c2 8074457: Remove the non-Zero CPP Interpreter
coleenp
parents: 35071
diff changeset
  1301
29578
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1302
void InterpreterMacroAssembler::test_method_data_pointer(Register mdp,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1303
                                                         Label& zero_continue) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1304
  assert(ProfileInterpreter, "must be profiling interpreter");
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1305
  movptr(mdp, Address(rbp, frame::interpreter_frame_mdp_offset * wordSize));
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1306
  testptr(mdp, mdp);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1307
  jcc(Assembler::zero, zero_continue);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1308
}
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1309
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1310
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1311
// Set the method data pointer for the current bcp.
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1312
void InterpreterMacroAssembler::set_method_data_pointer_for_bcp() {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1313
  assert(ProfileInterpreter, "must be profiling interpreter");
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1314
  Label set_mdp;
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1315
  push(rax);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1316
  push(rbx);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1317
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1318
  get_method(rbx);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1319
  // Test MDO to avoid the call if it is NULL.
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1320
  movptr(rax, Address(rbx, in_bytes(Method::method_data_offset())));
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1321
  testptr(rax, rax);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1322
  jcc(Assembler::zero, set_mdp);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1323
  // rbx: method
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1324
  // _bcp_register: bcp
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1325
  call_VM_leaf(CAST_FROM_FN_PTR(address, InterpreterRuntime::bcp_to_di), rbx, _bcp_register);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1326
  // rax: mdi
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1327
  // mdo is guaranteed to be non-zero here, we checked for it before the call.
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1328
  movptr(rbx, Address(rbx, in_bytes(Method::method_data_offset())));
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1329
  addptr(rbx, in_bytes(MethodData::data_offset()));
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1330
  addptr(rax, rbx);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1331
  bind(set_mdp);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1332
  movptr(Address(rbp, frame::interpreter_frame_mdp_offset * wordSize), rax);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1333
  pop(rbx);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1334
  pop(rax);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1335
}
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1336
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1337
void InterpreterMacroAssembler::verify_method_data_pointer() {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1338
  assert(ProfileInterpreter, "must be profiling interpreter");
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1339
#ifdef ASSERT
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1340
  Label verify_continue;
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1341
  push(rax);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1342
  push(rbx);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1343
  Register arg3_reg = LP64_ONLY(c_rarg3) NOT_LP64(rcx);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1344
  Register arg2_reg = LP64_ONLY(c_rarg2) NOT_LP64(rdx);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1345
  push(arg3_reg);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1346
  push(arg2_reg);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1347
  test_method_data_pointer(arg3_reg, verify_continue); // If mdp is zero, continue
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1348
  get_method(rbx);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1349
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1350
  // If the mdp is valid, it will point to a DataLayout header which is
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1351
  // consistent with the bcp.  The converse is highly probable also.
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1352
  load_unsigned_short(arg2_reg,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1353
                      Address(arg3_reg, in_bytes(DataLayout::bci_offset())));
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1354
  addptr(arg2_reg, Address(rbx, Method::const_offset()));
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1355
  lea(arg2_reg, Address(arg2_reg, ConstMethod::codes_offset()));
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1356
  cmpptr(arg2_reg, _bcp_register);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1357
  jcc(Assembler::equal, verify_continue);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1358
  // rbx: method
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1359
  // _bcp_register: bcp
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1360
  // c_rarg3: mdp
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1361
  call_VM_leaf(CAST_FROM_FN_PTR(address, InterpreterRuntime::verify_mdp),
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1362
               rbx, _bcp_register, arg3_reg);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1363
  bind(verify_continue);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1364
  pop(arg2_reg);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1365
  pop(arg3_reg);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1366
  pop(rbx);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1367
  pop(rax);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1368
#endif // ASSERT
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1369
}
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1370
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1371
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1372
void InterpreterMacroAssembler::set_mdp_data_at(Register mdp_in,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1373
                                                int constant,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1374
                                                Register value) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1375
  assert(ProfileInterpreter, "must be profiling interpreter");
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1376
  Address data(mdp_in, constant);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1377
  movptr(data, value);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1378
}
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1379
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1380
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1381
void InterpreterMacroAssembler::increment_mdp_data_at(Register mdp_in,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1382
                                                      int constant,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1383
                                                      bool decrement) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1384
  // Counter address
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1385
  Address data(mdp_in, constant);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1386
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1387
  increment_mdp_data_at(data, decrement);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1388
}
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1389
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1390
void InterpreterMacroAssembler::increment_mdp_data_at(Address data,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1391
                                                      bool decrement) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1392
  assert(ProfileInterpreter, "must be profiling interpreter");
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1393
  // %%% this does 64bit counters at best it is wasting space
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1394
  // at worst it is a rare bug when counters overflow
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1395
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1396
  if (decrement) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1397
    // Decrement the register.  Set condition codes.
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1398
    addptr(data, (int32_t) -DataLayout::counter_increment);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1399
    // If the decrement causes the counter to overflow, stay negative
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1400
    Label L;
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1401
    jcc(Assembler::negative, L);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1402
    addptr(data, (int32_t) DataLayout::counter_increment);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1403
    bind(L);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1404
  } else {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1405
    assert(DataLayout::counter_increment == 1,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1406
           "flow-free idiom only works with 1");
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1407
    // Increment the register.  Set carry flag.
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1408
    addptr(data, DataLayout::counter_increment);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1409
    // If the increment causes the counter to overflow, pull back by 1.
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1410
    sbbptr(data, (int32_t)0);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1411
  }
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1412
}
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1413
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1414
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1415
void InterpreterMacroAssembler::increment_mdp_data_at(Register mdp_in,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1416
                                                      Register reg,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1417
                                                      int constant,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1418
                                                      bool decrement) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1419
  Address data(mdp_in, reg, Address::times_1, constant);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1420
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1421
  increment_mdp_data_at(data, decrement);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1422
}
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1423
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1424
void InterpreterMacroAssembler::set_mdp_flag_at(Register mdp_in,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1425
                                                int flag_byte_constant) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1426
  assert(ProfileInterpreter, "must be profiling interpreter");
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1427
  int header_offset = in_bytes(DataLayout::header_offset());
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1428
  int header_bits = DataLayout::flag_mask_to_header_mask(flag_byte_constant);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1429
  // Set the flag
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1430
  orl(Address(mdp_in, header_offset), header_bits);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1431
}
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1432
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1433
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1434
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1435
void InterpreterMacroAssembler::test_mdp_data_at(Register mdp_in,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1436
                                                 int offset,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1437
                                                 Register value,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1438
                                                 Register test_value_out,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1439
                                                 Label& not_equal_continue) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1440
  assert(ProfileInterpreter, "must be profiling interpreter");
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1441
  if (test_value_out == noreg) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1442
    cmpptr(value, Address(mdp_in, offset));
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1443
  } else {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1444
    // Put the test value into a register, so caller can use it:
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1445
    movptr(test_value_out, Address(mdp_in, offset));
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1446
    cmpptr(test_value_out, value);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1447
  }
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1448
  jcc(Assembler::notEqual, not_equal_continue);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1449
}
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1450
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1451
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1452
void InterpreterMacroAssembler::update_mdp_by_offset(Register mdp_in,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1453
                                                     int offset_of_disp) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1454
  assert(ProfileInterpreter, "must be profiling interpreter");
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1455
  Address disp_address(mdp_in, offset_of_disp);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1456
  addptr(mdp_in, disp_address);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1457
  movptr(Address(rbp, frame::interpreter_frame_mdp_offset * wordSize), mdp_in);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1458
}
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1459
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1460
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1461
void InterpreterMacroAssembler::update_mdp_by_offset(Register mdp_in,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1462
                                                     Register reg,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1463
                                                     int offset_of_disp) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1464
  assert(ProfileInterpreter, "must be profiling interpreter");
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1465
  Address disp_address(mdp_in, reg, Address::times_1, offset_of_disp);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1466
  addptr(mdp_in, disp_address);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1467
  movptr(Address(rbp, frame::interpreter_frame_mdp_offset * wordSize), mdp_in);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1468
}
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1469
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1470
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1471
void InterpreterMacroAssembler::update_mdp_by_constant(Register mdp_in,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1472
                                                       int constant) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1473
  assert(ProfileInterpreter, "must be profiling interpreter");
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1474
  addptr(mdp_in, constant);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1475
  movptr(Address(rbp, frame::interpreter_frame_mdp_offset * wordSize), mdp_in);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1476
}
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1477
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1478
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1479
void InterpreterMacroAssembler::update_mdp_for_ret(Register return_bci) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1480
  assert(ProfileInterpreter, "must be profiling interpreter");
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1481
  push(return_bci); // save/restore across call_VM
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1482
  call_VM(noreg,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1483
          CAST_FROM_FN_PTR(address, InterpreterRuntime::update_mdp_for_ret),
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1484
          return_bci);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1485
  pop(return_bci);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1486
}
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1487
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1488
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1489
void InterpreterMacroAssembler::profile_taken_branch(Register mdp,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1490
                                                     Register bumped_count) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1491
  if (ProfileInterpreter) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1492
    Label profile_continue;
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1493
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1494
    // If no method data exists, go to profile_continue.
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1495
    // Otherwise, assign to mdp
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1496
    test_method_data_pointer(mdp, profile_continue);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1497
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1498
    // We are taking a branch.  Increment the taken count.
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1499
    // We inline increment_mdp_data_at to return bumped_count in a register
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1500
    //increment_mdp_data_at(mdp, in_bytes(JumpData::taken_offset()));
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1501
    Address data(mdp, in_bytes(JumpData::taken_offset()));
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1502
    movptr(bumped_count, data);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1503
    assert(DataLayout::counter_increment == 1,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1504
            "flow-free idiom only works with 1");
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1505
    addptr(bumped_count, DataLayout::counter_increment);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1506
    sbbptr(bumped_count, 0);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1507
    movptr(data, bumped_count); // Store back out
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1508
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1509
    // The method data pointer needs to be updated to reflect the new target.
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1510
    update_mdp_by_offset(mdp, in_bytes(JumpData::displacement_offset()));
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1511
    bind(profile_continue);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1512
  }
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1513
}
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1514
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1515
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1516
void InterpreterMacroAssembler::profile_not_taken_branch(Register mdp) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1517
  if (ProfileInterpreter) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1518
    Label profile_continue;
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1519
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1520
    // If no method data exists, go to profile_continue.
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1521
    test_method_data_pointer(mdp, profile_continue);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1522
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1523
    // We are taking a branch.  Increment the not taken count.
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1524
    increment_mdp_data_at(mdp, in_bytes(BranchData::not_taken_offset()));
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1525
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1526
    // The method data pointer needs to be updated to correspond to
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1527
    // the next bytecode
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1528
    update_mdp_by_constant(mdp, in_bytes(BranchData::branch_data_size()));
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1529
    bind(profile_continue);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1530
  }
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1531
}
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1532
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1533
void InterpreterMacroAssembler::profile_call(Register mdp) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1534
  if (ProfileInterpreter) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1535
    Label profile_continue;
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1536
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1537
    // If no method data exists, go to profile_continue.
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1538
    test_method_data_pointer(mdp, profile_continue);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1539
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1540
    // We are making a call.  Increment the count.
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1541
    increment_mdp_data_at(mdp, in_bytes(CounterData::count_offset()));
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1542
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1543
    // The method data pointer needs to be updated to reflect the new target.
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1544
    update_mdp_by_constant(mdp, in_bytes(CounterData::counter_data_size()));
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1545
    bind(profile_continue);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1546
  }
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1547
}
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1548
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1549
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1550
void InterpreterMacroAssembler::profile_final_call(Register mdp) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1551
  if (ProfileInterpreter) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1552
    Label profile_continue;
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1553
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1554
    // If no method data exists, go to profile_continue.
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1555
    test_method_data_pointer(mdp, profile_continue);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1556
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1557
    // We are making a call.  Increment the count.
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1558
    increment_mdp_data_at(mdp, in_bytes(CounterData::count_offset()));
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1559
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1560
    // The method data pointer needs to be updated to reflect the new target.
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1561
    update_mdp_by_constant(mdp,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1562
                           in_bytes(VirtualCallData::
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1563
                                    virtual_call_data_size()));
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1564
    bind(profile_continue);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1565
  }
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1566
}
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1567
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1568
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1569
void InterpreterMacroAssembler::profile_virtual_call(Register receiver,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1570
                                                     Register mdp,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1571
                                                     Register reg2,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1572
                                                     bool receiver_can_be_null) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1573
  if (ProfileInterpreter) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1574
    Label profile_continue;
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1575
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1576
    // If no method data exists, go to profile_continue.
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1577
    test_method_data_pointer(mdp, profile_continue);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1578
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1579
    Label skip_receiver_profile;
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1580
    if (receiver_can_be_null) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1581
      Label not_null;
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1582
      testptr(receiver, receiver);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1583
      jccb(Assembler::notZero, not_null);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1584
      // We are making a call.  Increment the count for null receiver.
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1585
      increment_mdp_data_at(mdp, in_bytes(CounterData::count_offset()));
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1586
      jmp(skip_receiver_profile);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1587
      bind(not_null);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1588
    }
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1589
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1590
    // Record the receiver type.
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1591
    record_klass_in_profile(receiver, mdp, reg2, true);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1592
    bind(skip_receiver_profile);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1593
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1594
    // The method data pointer needs to be updated to reflect the new target.
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33083
diff changeset
  1595
#if INCLUDE_JVMCI
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33083
diff changeset
  1596
    if (MethodProfileWidth == 0) {
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33083
diff changeset
  1597
      update_mdp_by_constant(mdp, in_bytes(VirtualCallData::virtual_call_data_size()));
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33083
diff changeset
  1598
    }
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33083
diff changeset
  1599
#else // INCLUDE_JVMCI
29578
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1600
    update_mdp_by_constant(mdp,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1601
                           in_bytes(VirtualCallData::
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1602
                                    virtual_call_data_size()));
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33083
diff changeset
  1603
#endif // INCLUDE_JVMCI
29578
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1604
    bind(profile_continue);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1605
  }
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1606
}
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1607
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33083
diff changeset
  1608
#if INCLUDE_JVMCI
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33083
diff changeset
  1609
void InterpreterMacroAssembler::profile_called_method(Register method, Register mdp, Register reg2) {
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33083
diff changeset
  1610
  assert_different_registers(method, mdp, reg2);
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33083
diff changeset
  1611
  if (ProfileInterpreter && MethodProfileWidth > 0) {
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33083
diff changeset
  1612
    Label profile_continue;
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33083
diff changeset
  1613
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33083
diff changeset
  1614
    // If no method data exists, go to profile_continue.
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33083
diff changeset
  1615
    test_method_data_pointer(mdp, profile_continue);
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33083
diff changeset
  1616
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33083
diff changeset
  1617
    Label done;
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33083
diff changeset
  1618
    record_item_in_profile_helper(method, mdp, reg2, 0, done, MethodProfileWidth,
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33083
diff changeset
  1619
      &VirtualCallData::method_offset, &VirtualCallData::method_count_offset, in_bytes(VirtualCallData::nonprofiled_receiver_count_offset()));
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33083
diff changeset
  1620
    bind(done);
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33083
diff changeset
  1621
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33083
diff changeset
  1622
    update_mdp_by_constant(mdp, in_bytes(VirtualCallData::virtual_call_data_size()));
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33083
diff changeset
  1623
    bind(profile_continue);
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33083
diff changeset
  1624
  }
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33083
diff changeset
  1625
}
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33083
diff changeset
  1626
#endif // INCLUDE_JVMCI
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33083
diff changeset
  1627
29578
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1628
// This routine creates a state machine for updating the multi-row
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1629
// type profile at a virtual call site (or other type-sensitive bytecode).
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1630
// The machine visits each row (of receiver/count) until the receiver type
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1631
// is found, or until it runs out of rows.  At the same time, it remembers
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1632
// the location of the first empty row.  (An empty row records null for its
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1633
// receiver, and can be allocated for a newly-observed receiver type.)
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1634
// Because there are two degrees of freedom in the state, a simple linear
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1635
// search will not work; it must be a decision tree.  Hence this helper
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1636
// function is recursive, to generate the required tree structured code.
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1637
// It's the interpreter, so we are trading off code space for speed.
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1638
// See below for example code.
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1639
void InterpreterMacroAssembler::record_klass_in_profile_helper(
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1640
                                        Register receiver, Register mdp,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1641
                                        Register reg2, int start_row,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1642
                                        Label& done, bool is_virtual_call) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1643
  if (TypeProfileWidth == 0) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1644
    if (is_virtual_call) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1645
      increment_mdp_data_at(mdp, in_bytes(CounterData::count_offset()));
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1646
    }
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33083
diff changeset
  1647
#if INCLUDE_JVMCI
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33083
diff changeset
  1648
    else if (EnableJVMCI) {
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33083
diff changeset
  1649
      increment_mdp_data_at(mdp, in_bytes(ReceiverTypeData::nonprofiled_receiver_count_offset()));
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33083
diff changeset
  1650
    }
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33083
diff changeset
  1651
#endif // INCLUDE_JVMCI
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33083
diff changeset
  1652
  } else {
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33083
diff changeset
  1653
    int non_profiled_offset = -1;
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33083
diff changeset
  1654
    if (is_virtual_call) {
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33083
diff changeset
  1655
      non_profiled_offset = in_bytes(CounterData::count_offset());
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33083
diff changeset
  1656
    }
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33083
diff changeset
  1657
#if INCLUDE_JVMCI
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33083
diff changeset
  1658
    else if (EnableJVMCI) {
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33083
diff changeset
  1659
      non_profiled_offset = in_bytes(ReceiverTypeData::nonprofiled_receiver_count_offset());
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33083
diff changeset
  1660
    }
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33083
diff changeset
  1661
#endif // INCLUDE_JVMCI
29578
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1662
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33083
diff changeset
  1663
    record_item_in_profile_helper(receiver, mdp, reg2, 0, done, TypeProfileWidth,
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33083
diff changeset
  1664
        &VirtualCallData::receiver_offset, &VirtualCallData::receiver_count_offset, non_profiled_offset);
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33083
diff changeset
  1665
  }
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33083
diff changeset
  1666
}
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33083
diff changeset
  1667
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33083
diff changeset
  1668
void InterpreterMacroAssembler::record_item_in_profile_helper(Register item, Register mdp,
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33083
diff changeset
  1669
                                        Register reg2, int start_row, Label& done, int total_rows,
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33083
diff changeset
  1670
                                        OffsetFunction item_offset_fn, OffsetFunction item_count_offset_fn,
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33083
diff changeset
  1671
                                        int non_profiled_offset) {
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33083
diff changeset
  1672
  int last_row = total_rows - 1;
29578
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1673
  assert(start_row <= last_row, "must be work left to do");
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33083
diff changeset
  1674
  // Test this row for both the item and for null.
29578
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1675
  // Take any of three different outcomes:
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33083
diff changeset
  1676
  //   1. found item => increment count and goto done
29578
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1677
  //   2. found null => keep looking for case 1, maybe allocate this cell
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1678
  //   3. found something else => keep looking for cases 1 and 2
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1679
  // Case 3 is handled by a recursive call.
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1680
  for (int row = start_row; row <= last_row; row++) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1681
    Label next_test;
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1682
    bool test_for_null_also = (row == start_row);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1683
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33083
diff changeset
  1684
    // See if the item is item[n].
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33083
diff changeset
  1685
    int item_offset = in_bytes(item_offset_fn(row));
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33083
diff changeset
  1686
    test_mdp_data_at(mdp, item_offset, item,
29578
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1687
                     (test_for_null_also ? reg2 : noreg),
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1688
                     next_test);
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33083
diff changeset
  1689
    // (Reg2 now contains the item from the CallData.)
29578
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1690
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33083
diff changeset
  1691
    // The item is item[n].  Increment count[n].
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33083
diff changeset
  1692
    int count_offset = in_bytes(item_count_offset_fn(row));
29578
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1693
    increment_mdp_data_at(mdp, count_offset);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1694
    jmp(done);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1695
    bind(next_test);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1696
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1697
    if (test_for_null_also) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1698
      Label found_null;
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33083
diff changeset
  1699
      // Failed the equality check on item[n]...  Test for null.
29578
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1700
      testptr(reg2, reg2);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1701
      if (start_row == last_row) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1702
        // The only thing left to do is handle the null case.
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33083
diff changeset
  1703
        if (non_profiled_offset >= 0) {
29578
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1704
          jccb(Assembler::zero, found_null);
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33083
diff changeset
  1705
          // Item did not match any saved item and there is no empty row for it.
29578
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1706
          // Increment total counter to indicate polymorphic case.
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33083
diff changeset
  1707
          increment_mdp_data_at(mdp, non_profiled_offset);
29578
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1708
          jmp(done);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1709
          bind(found_null);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1710
        } else {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1711
          jcc(Assembler::notZero, done);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1712
        }
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1713
        break;
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1714
      }
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1715
      // Since null is rare, make it be the branch-taken case.
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1716
      jcc(Assembler::zero, found_null);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1717
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1718
      // Put all the "Case 3" tests here.
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33083
diff changeset
  1719
      record_item_in_profile_helper(item, mdp, reg2, start_row + 1, done, total_rows,
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33083
diff changeset
  1720
        item_offset_fn, item_count_offset_fn, non_profiled_offset);
29578
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1721
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33083
diff changeset
  1722
      // Found a null.  Keep searching for a matching item,
29578
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1723
      // but remember that this is an empty (unused) slot.
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1724
      bind(found_null);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1725
    }
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1726
  }
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1727
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33083
diff changeset
  1728
  // In the fall-through case, we found no matching item, but we
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33083
diff changeset
  1729
  // observed the item[start_row] is NULL.
29578
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1730
33160
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33083
diff changeset
  1731
  // Fill in the item field and increment the count.
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33083
diff changeset
  1732
  int item_offset = in_bytes(item_offset_fn(start_row));
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33083
diff changeset
  1733
  set_mdp_data_at(mdp, item_offset, item);
c59f1676d27e 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33083
diff changeset
  1734
  int count_offset = in_bytes(item_count_offset_fn(start_row));
29578
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1735
  movl(reg2, DataLayout::counter_increment);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1736
  set_mdp_data_at(mdp, count_offset, reg2);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1737
  if (start_row > 0) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1738
    jmp(done);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1739
  }
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1740
}
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1741
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1742
// Example state machine code for three profile rows:
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1743
//   // main copy of decision tree, rooted at row[1]
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1744
//   if (row[0].rec == rec) { row[0].incr(); goto done; }
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1745
//   if (row[0].rec != NULL) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1746
//     // inner copy of decision tree, rooted at row[1]
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1747
//     if (row[1].rec == rec) { row[1].incr(); goto done; }
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1748
//     if (row[1].rec != NULL) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1749
//       // degenerate decision tree, rooted at row[2]
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1750
//       if (row[2].rec == rec) { row[2].incr(); goto done; }
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1751
//       if (row[2].rec != NULL) { count.incr(); goto done; } // overflow
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1752
//       row[2].init(rec); goto done;
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1753
//     } else {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1754
//       // remember row[1] is empty
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1755
//       if (row[2].rec == rec) { row[2].incr(); goto done; }
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1756
//       row[1].init(rec); goto done;
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1757
//     }
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1758
//   } else {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1759
//     // remember row[0] is empty
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1760
//     if (row[1].rec == rec) { row[1].incr(); goto done; }
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1761
//     if (row[2].rec == rec) { row[2].incr(); goto done; }
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1762
//     row[0].init(rec); goto done;
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1763
//   }
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1764
//   done:
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1765
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1766
void InterpreterMacroAssembler::record_klass_in_profile(Register receiver,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1767
                                                        Register mdp, Register reg2,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1768
                                                        bool is_virtual_call) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1769
  assert(ProfileInterpreter, "must be profiling");
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1770
  Label done;
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1771
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1772
  record_klass_in_profile_helper(receiver, mdp, reg2, 0, done, is_virtual_call);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1773
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1774
  bind (done);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1775
}
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1776
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1777
void InterpreterMacroAssembler::profile_ret(Register return_bci,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1778
                                            Register mdp) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1779
  if (ProfileInterpreter) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1780
    Label profile_continue;
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1781
    uint row;
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1782
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1783
    // If no method data exists, go to profile_continue.
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1784
    test_method_data_pointer(mdp, profile_continue);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1785
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1786
    // Update the total ret count.
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1787
    increment_mdp_data_at(mdp, in_bytes(CounterData::count_offset()));
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1788
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1789
    for (row = 0; row < RetData::row_limit(); row++) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1790
      Label next_test;
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1791
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1792
      // See if return_bci is equal to bci[n]:
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1793
      test_mdp_data_at(mdp,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1794
                       in_bytes(RetData::bci_offset(row)),
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1795
                       return_bci, noreg,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1796
                       next_test);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1797
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1798
      // return_bci is equal to bci[n].  Increment the count.
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1799
      increment_mdp_data_at(mdp, in_bytes(RetData::bci_count_offset(row)));
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1800
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1801
      // The method data pointer needs to be updated to reflect the new target.
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1802
      update_mdp_by_offset(mdp,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1803
                           in_bytes(RetData::bci_displacement_offset(row)));
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1804
      jmp(profile_continue);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1805
      bind(next_test);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1806
    }
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1807
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1808
    update_mdp_for_ret(return_bci);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1809
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1810
    bind(profile_continue);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1811
  }
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1812
}
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1813
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1814
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1815
void InterpreterMacroAssembler::profile_null_seen(Register mdp) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1816
  if (ProfileInterpreter) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1817
    Label profile_continue;
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1818
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1819
    // If no method data exists, go to profile_continue.
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1820
    test_method_data_pointer(mdp, profile_continue);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1821
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1822
    set_mdp_flag_at(mdp, BitData::null_seen_byte_constant());
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1823
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1824
    // The method data pointer needs to be updated.
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1825
    int mdp_delta = in_bytes(BitData::bit_data_size());
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1826
    if (TypeProfileCasts) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1827
      mdp_delta = in_bytes(VirtualCallData::virtual_call_data_size());
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1828
    }
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1829
    update_mdp_by_constant(mdp, mdp_delta);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1830
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1831
    bind(profile_continue);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1832
  }
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1833
}
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1834
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1835
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1836
void InterpreterMacroAssembler::profile_typecheck_failed(Register mdp) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1837
  if (ProfileInterpreter && TypeProfileCasts) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1838
    Label profile_continue;
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1839
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1840
    // If no method data exists, go to profile_continue.
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1841
    test_method_data_pointer(mdp, profile_continue);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1842
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1843
    int count_offset = in_bytes(CounterData::count_offset());
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1844
    // Back up the address, since we have already bumped the mdp.
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1845
    count_offset -= in_bytes(VirtualCallData::virtual_call_data_size());
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1846
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1847
    // *Decrement* the counter.  We expect to see zero or small negatives.
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1848
    increment_mdp_data_at(mdp, count_offset, true);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1849
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1850
    bind (profile_continue);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1851
  }
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1852
}
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1853
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1854
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1855
void InterpreterMacroAssembler::profile_typecheck(Register mdp, Register klass, Register reg2) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1856
  if (ProfileInterpreter) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1857
    Label profile_continue;
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1858
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1859
    // If no method data exists, go to profile_continue.
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1860
    test_method_data_pointer(mdp, profile_continue);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1861
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1862
    // The method data pointer needs to be updated.
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1863
    int mdp_delta = in_bytes(BitData::bit_data_size());
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1864
    if (TypeProfileCasts) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1865
      mdp_delta = in_bytes(VirtualCallData::virtual_call_data_size());
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1866
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1867
      // Record the object type.
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1868
      record_klass_in_profile(klass, mdp, reg2, false);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1869
      NOT_LP64(assert(reg2 == rdi, "we know how to fix this blown reg");)
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1870
      NOT_LP64(restore_locals();)         // Restore EDI
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1871
    }
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1872
    update_mdp_by_constant(mdp, mdp_delta);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1873
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1874
    bind(profile_continue);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1875
  }
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1876
}
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1877
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1878
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1879
void InterpreterMacroAssembler::profile_switch_default(Register mdp) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1880
  if (ProfileInterpreter) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1881
    Label profile_continue;
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1882
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1883
    // If no method data exists, go to profile_continue.
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1884
    test_method_data_pointer(mdp, profile_continue);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1885
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1886
    // Update the default case count
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1887
    increment_mdp_data_at(mdp,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1888
                          in_bytes(MultiBranchData::default_count_offset()));
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1889
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1890
    // The method data pointer needs to be updated.
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1891
    update_mdp_by_offset(mdp,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1892
                         in_bytes(MultiBranchData::
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1893
                                  default_displacement_offset()));
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1894
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1895
    bind(profile_continue);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1896
  }
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1897
}
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1898
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1899
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1900
void InterpreterMacroAssembler::profile_switch_case(Register index,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1901
                                                    Register mdp,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1902
                                                    Register reg2) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1903
  if (ProfileInterpreter) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1904
    Label profile_continue;
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1905
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1906
    // If no method data exists, go to profile_continue.
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1907
    test_method_data_pointer(mdp, profile_continue);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1908
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1909
    // Build the base (index * per_case_size_in_bytes()) +
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1910
    // case_array_offset_in_bytes()
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1911
    movl(reg2, in_bytes(MultiBranchData::per_case_size()));
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1912
    imulptr(index, reg2); // XXX l ?
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1913
    addptr(index, in_bytes(MultiBranchData::case_array_offset())); // XXX l ?
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1914
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1915
    // Update the case count
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1916
    increment_mdp_data_at(mdp,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1917
                          index,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1918
                          in_bytes(MultiBranchData::relative_count_offset()));
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1919
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1920
    // The method data pointer needs to be updated.
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1921
    update_mdp_by_offset(mdp,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1922
                         index,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1923
                         in_bytes(MultiBranchData::
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1924
                                  relative_displacement_offset()));
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1925
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1926
    bind(profile_continue);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1927
  }
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1928
}
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1929
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1930
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1931
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1932
void InterpreterMacroAssembler::verify_oop(Register reg, TosState state) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1933
  if (state == atos) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1934
    MacroAssembler::verify_oop(reg);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1935
  }
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1936
}
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1937
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1938
void InterpreterMacroAssembler::verify_FPU(int stack_depth, TosState state) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1939
#ifndef _LP64
32391
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31046
diff changeset
  1940
  if ((state == ftos && UseSSE < 1) ||
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31046
diff changeset
  1941
      (state == dtos && UseSSE < 2)) {
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31046
diff changeset
  1942
    MacroAssembler::verify_FPU(stack_depth);
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31046
diff changeset
  1943
  }
29578
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1944
#endif
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1945
}
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1946
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1947
// Jump if ((*counter_addr += increment) & mask) satisfies the condition.
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1948
void InterpreterMacroAssembler::increment_mask_and_jump(Address counter_addr,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1949
                                                        int increment, Address mask,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1950
                                                        Register scratch, bool preloaded,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1951
                                                        Condition cond, Label* where) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1952
  if (!preloaded) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1953
    movl(scratch, counter_addr);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1954
  }
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1955
  incrementl(scratch, increment);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1956
  movl(counter_addr, scratch);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1957
  andl(scratch, mask);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1958
  jcc(cond, *where);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1959
}
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1960
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1961
void InterpreterMacroAssembler::notify_method_entry() {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1962
  // Whenever JVMTI is interp_only_mode, method entry/exit events are sent to
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1963
  // track stack depth.  If it is possible to enter interp_only_mode we add
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1964
  // the code to check if the event should be sent.
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1965
  Register rthread = LP64_ONLY(r15_thread) NOT_LP64(rcx);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1966
  Register rarg = LP64_ONLY(c_rarg1) NOT_LP64(rbx);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1967
  if (JvmtiExport::can_post_interpreter_events()) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1968
    Label L;
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1969
    NOT_LP64(get_thread(rthread);)
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1970
    movl(rdx, Address(rthread, JavaThread::interp_only_mode_offset()));
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1971
    testl(rdx, rdx);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1972
    jcc(Assembler::zero, L);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1973
    call_VM(noreg, CAST_FROM_FN_PTR(address,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1974
                                    InterpreterRuntime::post_method_entry));
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1975
    bind(L);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1976
  }
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1977
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1978
  {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1979
    SkipIfEqual skip(this, &DTraceMethodProbes, false);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1980
    NOT_LP64(get_thread(rthread);)
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1981
    get_method(rarg);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1982
    call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_method_entry),
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1983
                 rthread, rarg);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1984
  }
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1985
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1986
  // RedefineClasses() tracing support for obsolete method entry
38259
b495d1cfe673 8153535: Convert TraceRedefineClasses to Unified Logging
rehn
parents: 37480
diff changeset
  1987
  if (log_is_enabled(Trace, redefine, class, obsolete)) {
29578
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1988
    NOT_LP64(get_thread(rthread);)
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1989
    get_method(rarg);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1990
    call_VM_leaf(
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1991
      CAST_FROM_FN_PTR(address, SharedRuntime::rc_trace_method_entry),
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1992
      rthread, rarg);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1993
  }
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1994
}
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1995
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1996
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1997
void InterpreterMacroAssembler::notify_method_exit(
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1998
    TosState state, NotifyMethodExitMode mode) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  1999
  // Whenever JVMTI is interp_only_mode, method entry/exit events are sent to
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  2000
  // track stack depth.  If it is possible to enter interp_only_mode we add
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  2001
  // the code to check if the event should be sent.
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  2002
  Register rthread = LP64_ONLY(r15_thread) NOT_LP64(rcx);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  2003
  Register rarg = LP64_ONLY(c_rarg1) NOT_LP64(rbx);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  2004
  if (mode == NotifyJVMTI && JvmtiExport::can_post_interpreter_events()) {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  2005
    Label L;
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  2006
    // Note: frame::interpreter_frame_result has a dependency on how the
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  2007
    // method result is saved across the call to post_method_exit. If this
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  2008
    // is changed then the interpreter_frame_result implementation will
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  2009
    // need to be updated too.
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  2010
35214
d86005e0b4c2 8074457: Remove the non-Zero CPP Interpreter
coleenp
parents: 35071
diff changeset
  2011
    // template interpreter will leave the result on the top of the stack.
d86005e0b4c2 8074457: Remove the non-Zero CPP Interpreter
coleenp
parents: 35071
diff changeset
  2012
    push(state);
29578
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  2013
    NOT_LP64(get_thread(rthread);)
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  2014
    movl(rdx, Address(rthread, JavaThread::interp_only_mode_offset()));
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  2015
    testl(rdx, rdx);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  2016
    jcc(Assembler::zero, L);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  2017
    call_VM(noreg,
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  2018
            CAST_FROM_FN_PTR(address, InterpreterRuntime::post_method_exit));
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  2019
    bind(L);
35214
d86005e0b4c2 8074457: Remove the non-Zero CPP Interpreter
coleenp
parents: 35071
diff changeset
  2020
    pop(state);
29578
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  2021
  }
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  2022
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  2023
  {
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  2024
    SkipIfEqual skip(this, &DTraceMethodProbes, false);
35214
d86005e0b4c2 8074457: Remove the non-Zero CPP Interpreter
coleenp
parents: 35071
diff changeset
  2025
    push(state);
29578
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  2026
    NOT_LP64(get_thread(rthread);)
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  2027
    get_method(rarg);
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  2028
    call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_method_exit),
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  2029
                 rthread, rarg);
35214
d86005e0b4c2 8074457: Remove the non-Zero CPP Interpreter
coleenp
parents: 35071
diff changeset
  2030
    pop(state);
29578
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  2031
  }
0d3bd11f9e02 8074717: Merge interp_masm files for x86 _32 and _64
coleenp
parents: 25714
diff changeset
  2032
}