hotspot/src/cpu/x86/vm/interp_masm_x86.cpp
author roland
Tue, 22 Oct 2013 09:51:47 +0200
changeset 21095 1a04f7b3946e
child 22504 b1837533ba65
permissions -rw-r--r--
8026251: New type profiling points: parameters to methods Summary: x86 interpreter and c1 type profiling for parameters on method entries Reviewed-by: kvn, twisti
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
/*
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
     2
 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
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"
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    28
#include "oops/methodData.hpp"
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    29
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    30
#ifndef CC_INTERP
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    31
void InterpreterMacroAssembler::profile_obj_type(Register obj, const Address& mdo_addr) {
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    32
  Label update, next, none;
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    33
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    34
  verify_oop(obj);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    35
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    36
  testptr(obj, obj);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    37
  jccb(Assembler::notZero, update);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    38
  orptr(mdo_addr, TypeEntries::null_seen);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    39
  jmpb(next);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    40
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    41
  bind(update);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    42
  load_klass(obj, obj);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    43
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    44
  xorptr(obj, mdo_addr);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    45
  testptr(obj, TypeEntries::type_klass_mask);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    46
  jccb(Assembler::zero, next); // klass seen before, nothing to
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    47
                               // do. The unknown bit may have been
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    48
                               // set already but no need to check.
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    49
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    50
  testptr(obj, TypeEntries::type_unknown);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    51
  jccb(Assembler::notZero, next); // already unknown. Nothing to do anymore.
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    52
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    53
  cmpptr(mdo_addr, 0);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    54
  jccb(Assembler::equal, none);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    55
  cmpptr(mdo_addr, TypeEntries::null_seen);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    56
  jccb(Assembler::equal, none);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    57
  // There is a chance that the checks above (re-reading profiling
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    58
  // data from memory) fail if another thread has just set the
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    59
  // profiling to this obj's klass
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    60
  xorptr(obj, mdo_addr);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    61
  testptr(obj, TypeEntries::type_klass_mask);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    62
  jccb(Assembler::zero, next);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    63
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    64
  // different than before. Cannot keep accurate profile.
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    65
  orptr(mdo_addr, TypeEntries::type_unknown);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    66
  jmpb(next);
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
  bind(none);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    69
  // first time here. Set profile type.
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    70
  movptr(mdo_addr, obj);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    71
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    72
  bind(next);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    73
}
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    74
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    75
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
    76
  if (!ProfileInterpreter) {
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    77
    return;
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    78
  }
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    79
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    80
  if (MethodData::profile_arguments() || MethodData::profile_return()) {
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    81
    Label profile_continue;
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    82
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    83
    test_method_data_pointer(mdp, profile_continue);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    84
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    85
    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
    86
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    87
    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
    88
    jcc(Assembler::notEqual, profile_continue);
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
    if (MethodData::profile_arguments()) {
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    91
      Label done;
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    92
      int off_to_args = in_bytes(TypeEntriesAtCall::args_data_offset());
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    93
      addptr(mdp, off_to_args);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    94
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    95
      for (int i = 0; i < TypeProfileArgsLimit; i++) {
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    96
        if (i > 0 || MethodData::profile_return()) {
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
    97
          // 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
    98
          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
    99
          subl(tmp, i*TypeStackSlotEntries::per_arg_count());
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   100
          cmpl(tmp, TypeStackSlotEntries::per_arg_count());
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   101
          jcc(Assembler::less, done);
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
        movptr(tmp, Address(callee, Method::const_offset()));
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   104
        load_unsigned_short(tmp, Address(tmp, ConstMethod::size_of_parameters_offset()));
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   105
        // stack offset o (zero based) from the start of the argument
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   106
        // list, for n arguments translates into offset n - o - 1 from
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   107
        // the end of the argument list
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   108
        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
   109
        subl(tmp, 1);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   110
        Address arg_addr = argument_address(tmp);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   111
        movptr(tmp, arg_addr);
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
        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
   114
        profile_obj_type(tmp, mdo_arg_addr);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   115
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   116
        int to_add = in_bytes(TypeStackSlotEntries::per_arg_size());
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   117
        addptr(mdp, to_add);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   118
        off_to_args += to_add;
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   119
      }
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
      if (MethodData::profile_return()) {
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   122
        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
   123
        subl(tmp, TypeProfileArgsLimit*TypeStackSlotEntries::per_arg_count());
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   124
      }
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   125
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   126
      bind(done);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   127
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   128
      if (MethodData::profile_return()) {
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   129
        // We're right after the type profile for the last
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   130
        // argument. tmp is the number of cell left in the
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   131
        // CallTypeData/VirtualCallTypeData to reach its end. Non null
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   132
        // if there's a return to profile.
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   133
        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
   134
        shll(tmp, exact_log2(DataLayout::cell_size));
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   135
        addptr(mdp, tmp);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   136
      }
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   137
      movptr(Address(rbp, frame::interpreter_frame_mdx_offset * wordSize), mdp);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   138
    } else {
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   139
      assert(MethodData::profile_return(), "either profile call args or call ret");
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   140
      update_mdp_by_constant(mdp, in_bytes(ReturnTypeEntry::size()));
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   141
    }
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
    // mdp points right after the end of the
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   144
    // CallTypeData/VirtualCallTypeData, right after the cells for the
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   145
    // return value type if there's one
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   146
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   147
    bind(profile_continue);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   148
  }
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   149
}
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   150
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   151
void InterpreterMacroAssembler::profile_return_type(Register mdp, Register ret, Register tmp) {
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   152
  assert_different_registers(mdp, ret, tmp, _bcp_register);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   153
  if (ProfileInterpreter && MethodData::profile_return()) {
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   154
    Label profile_continue, done;
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   155
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   156
    test_method_data_pointer(mdp, profile_continue);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   157
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   158
    if (MethodData::profile_return_jsr292_only()) {
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   159
      // 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
   160
      // 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
   161
      // begining of the ProfileData we intend to update to check its
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   162
      // 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
   163
      // length
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   164
      Label do_profile;
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   165
      cmpb(Address(_bcp_register, 0), Bytecodes::_invokedynamic);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   166
      jcc(Assembler::equal, do_profile);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   167
      cmpb(Address(_bcp_register, 0), Bytecodes::_invokehandle);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   168
      jcc(Assembler::equal, do_profile);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   169
      get_method(tmp);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   170
      cmpb(Address(tmp, Method::intrinsic_id_offset_in_bytes()), vmIntrinsics::_compiledLambdaForm);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   171
      jcc(Assembler::notEqual, profile_continue);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   172
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   173
      bind(do_profile);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   174
    }
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
    Address mdo_ret_addr(mdp, -in_bytes(ReturnTypeEntry::size()));
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   177
    mov(tmp, ret);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   178
    profile_obj_type(tmp, mdo_ret_addr);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   179
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   180
    bind(profile_continue);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   181
  }
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   182
}
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   183
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   184
void InterpreterMacroAssembler::profile_parameters_type(Register mdp, Register tmp1, Register tmp2) {
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   185
  if (ProfileInterpreter && MethodData::profile_parameters()) {
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   186
    Label profile_continue, done;
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   187
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   188
    test_method_data_pointer(mdp, profile_continue);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   189
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   190
    // Load the offset of the area within the MDO used for
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   191
    // parameters. If it's negative we're not profiling any parameters
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   192
    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
   193
    testl(tmp1, tmp1);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   194
    jcc(Assembler::negative, profile_continue);
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
    // Compute a pointer to the area for parameters from the offset
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   197
    // and move the pointer to the slot for the last
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   198
    // parameters. Collect profiling from last parameter down.
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   199
    // mdo start + parameters offset + array length - 1
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   200
    addptr(mdp, tmp1);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   201
    movptr(tmp1, Address(mdp, in_bytes(ArrayData::array_len_offset())));
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   202
    decrement(tmp1, TypeStackSlotEntries::per_arg_count());
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
    Label loop;
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   205
    bind(loop);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   206
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   207
    int off_base = in_bytes(ParametersTypeData::stack_slot_offset(0));
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   208
    int type_base = in_bytes(ParametersTypeData::type_offset(0));
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   209
    Address::ScaleFactor per_arg_scale = Address::times(DataLayout::cell_size);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   210
    Address arg_off(mdp, tmp1, per_arg_scale, off_base);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   211
    Address arg_type(mdp, tmp1, per_arg_scale, type_base);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   212
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   213
    // load offset on the stack from the slot for this parameter
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   214
    movptr(tmp2, arg_off);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   215
    negptr(tmp2);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   216
    // read the parameter from the local area
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   217
    movptr(tmp2, Address(_locals_register, tmp2, Interpreter::stackElementScale()));
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   218
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   219
    // profile the parameter
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   220
    profile_obj_type(tmp2, arg_type);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   221
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   222
    // go to next parameter
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   223
    decrement(tmp1, TypeStackSlotEntries::per_arg_count());
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   224
    jcc(Assembler::positive, loop);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   225
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   226
    bind(profile_continue);
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   227
  }
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   228
}
1a04f7b3946e 8026251: New type profiling points: parameters to methods
roland
parents:
diff changeset
   229
#endif