hotspot/src/share/vm/interpreter/bytecodeInterpreterProfiling.hpp
author goetz
Sun, 15 Sep 2013 15:28:58 +0200
changeset 22836 e7e511228518
child 25374 d7fb2af5d53c
permissions -rw-r--r--
8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling Summary: Implement profiling for c2 jit compilation. Also enable new cppInterpreter features. Reviewed-by: kvn
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
22836
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
     1
/*
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
     2
 * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
     3
 * Copyright 2012, 2013 SAP AG. All rights reserved.
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
     4
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
     5
 *
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
     6
 * This code is free software; you can redistribute it and/or modify it
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
     7
 * under the terms of the GNU General Public License version 2 only, as
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
     8
 * published by the Free Software Foundation.
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
     9
 *
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    10
 * This code is distributed in the hope that it will be useful, but WITHOUT
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    11
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    12
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    13
 * version 2 for more details (a copy is included in the LICENSE file that
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    14
 * accompanied this code).
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    15
 *
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    16
 * You should have received a copy of the GNU General Public License version
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    17
 * 2 along with this work; if not, write to the Free Software Foundation,
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    18
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    19
 *
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    20
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    21
 * or visit www.oracle.com if you need additional information or have any
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    22
 * questions.
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    23
 *
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    24
 */
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    25
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    26
// This file defines a set of macros which are used by the c++-interpreter
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    27
// for updating a method's methodData object.
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    28
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    29
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    30
#ifndef SHARE_VM_INTERPRETER_BYTECODEINTERPRETERPROFILING_HPP
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    31
#define SHARE_VM_INTERPRETER_BYTECODEINTERPRETERPROFILING_HPP
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    32
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    33
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    34
// Global settings /////////////////////////////////////////////////////////////
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    35
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    36
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    37
// Enables profiling support.
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    38
#if defined(COMPILER2)
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    39
#define CC_INTERP_PROFILE
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    40
#endif
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    41
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    42
// Enables assertions for profiling code (also works in product-builds).
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    43
// #define CC_INTERP_PROFILE_WITH_ASSERTIONS
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    44
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    45
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    46
#ifdef CC_INTERP
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    47
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    48
// Empty dummy implementations if profiling code is switched off. //////////////
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    49
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    50
#ifndef CC_INTERP_PROFILE
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    51
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    52
#define SET_MDX(mdx)
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    53
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    54
#define BI_PROFILE_GET_OR_CREATE_METHOD_DATA(exception_handler)                \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    55
  if (ProfileInterpreter) {                                                    \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    56
    ShouldNotReachHere();                                                      \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    57
  }
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    58
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    59
#define BI_PROFILE_ALIGN_TO_CURRENT_BCI()
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    60
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    61
#define BI_PROFILE_UPDATE_JUMP()
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    62
#define BI_PROFILE_UPDATE_BRANCH(is_taken)
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    63
#define BI_PROFILE_UPDATE_RET(bci)
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    64
#define BI_PROFILE_SUBTYPECHECK_FAILED(receiver)
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    65
#define BI_PROFILE_UPDATE_CHECKCAST(null_seen, receiver)
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    66
#define BI_PROFILE_UPDATE_INSTANCEOF(null_seen, receiver)
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    67
#define BI_PROFILE_UPDATE_CALL()
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    68
#define BI_PROFILE_UPDATE_FINALCALL()
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    69
#define BI_PROFILE_UPDATE_VIRTUALCALL(receiver)
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    70
#define BI_PROFILE_UPDATE_SWITCH(switch_index)
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    71
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    72
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    73
#else
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    74
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    75
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    76
// Non-dummy implementations ///////////////////////////////////////////////////
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    77
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    78
// Accessors for the current method data pointer 'mdx'.
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    79
#define MDX()        (istate->mdx())
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    80
#define SET_MDX(mdx)                                                           \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    81
  if (TraceProfileInterpreter) {                                               \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    82
    /* Let it look like TraceBytecodes' format. */                             \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    83
    tty->print_cr("[%d]           %4d  "                                       \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    84
                  "mdx " PTR_FORMAT "(%d)"                                     \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    85
                  "  "                                                         \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    86
                  " \t-> " PTR_FORMAT "(%d)",                                  \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    87
                (int) THREAD->osthread()->thread_id(),                         \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    88
                BCI(),                                                         \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    89
                MDX(),                                                         \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    90
                (MDX() == NULL                                                 \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    91
                 ? 0                                                           \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    92
                 : istate->method()->method_data()->dp_to_di((address)MDX())), \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    93
                mdx,                                                           \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    94
                istate->method()->method_data()->dp_to_di((address)mdx)        \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    95
                );                                                             \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    96
  };                                                                           \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    97
  istate->set_mdx(mdx);
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    98
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
    99
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   100
// Dumps the profiling method data for the current method.
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   101
#ifdef PRODUCT
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   102
#define BI_PROFILE_PRINT_METHOD_DATA()
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   103
#else  // PRODUCT
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   104
#define BI_PROFILE_PRINT_METHOD_DATA()                                         \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   105
  {                                                                            \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   106
    ttyLocker ttyl;                                                            \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   107
    MethodData *md = istate->method()->method_data();                          \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   108
    tty->cr();                                                                 \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   109
    tty->print("method data at mdx " PTR_FORMAT "(0) for",                     \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   110
               md->data_layout_at(md->bci_to_di(0)));                          \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   111
    istate->method()->print_short_name(tty);                                   \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   112
    tty->cr();                                                                 \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   113
    if (md != NULL) {                                                          \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   114
      md->print_data_on(tty);                                                  \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   115
      address mdx = (address) MDX();                                           \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   116
      if (mdx != NULL) {                                                       \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   117
        tty->print_cr("current mdx " PTR_FORMAT "(%d)",                        \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   118
                      mdx,                                                     \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   119
                      istate->method()->method_data()->dp_to_di(mdx));         \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   120
      }                                                                        \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   121
    } else {                                                                   \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   122
      tty->print_cr("no method data");                                         \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   123
    }                                                                          \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   124
  }
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   125
#endif // PRODUCT
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   126
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   127
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   128
// Gets or creates the profiling method data and initializes mdx.
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   129
#define BI_PROFILE_GET_OR_CREATE_METHOD_DATA(exception_handler)                \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   130
  if (ProfileInterpreter && MDX() == NULL) {                                   \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   131
    /* Mdx is not yet initialized for this activation. */                      \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   132
    MethodData *md = istate->method()->method_data();                          \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   133
    if (md == NULL) {                                                          \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   134
      MethodCounters* mcs;                                                     \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   135
      GET_METHOD_COUNTERS(mcs);                                                \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   136
      /* The profiling method data doesn't exist for this method, */           \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   137
      /* create it if the counters have overflowed. */                         \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   138
      if (mcs->invocation_counter()                                            \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   139
                         ->reached_ProfileLimit(mcs->backedge_counter())) {    \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   140
        /* Must use CALL_VM, because an async exception may be pending. */     \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   141
        CALL_VM((InterpreterRuntime::profile_method(THREAD)),                  \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   142
                exception_handler);                                            \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   143
        md = istate->method()->method_data();                                  \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   144
        if (md != NULL) {                                                      \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   145
          if (TraceProfileInterpreter) {                                       \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   146
            BI_PROFILE_PRINT_METHOD_DATA();                                    \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   147
          }                                                                    \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   148
          Method *m = istate->method();                                        \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   149
          int bci = m->bci_from(pc);                                           \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   150
          jint di = md->bci_to_di(bci);                                        \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   151
          SET_MDX(md->data_layout_at(di));                                     \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   152
        }                                                                      \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   153
      }                                                                        \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   154
    } else {                                                                   \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   155
      /* The profiling method data exists, align the method data pointer */    \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   156
      /* mdx to the current bytecode index. */                                 \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   157
      if (TraceProfileInterpreter) {                                           \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   158
        BI_PROFILE_PRINT_METHOD_DATA();                                        \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   159
      }                                                                        \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   160
      SET_MDX(md->data_layout_at(md->bci_to_di(BCI())));                       \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   161
    }                                                                          \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   162
  }
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   163
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   164
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   165
// Asserts that the current method data pointer mdx corresponds
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   166
// to the current bytecode.
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   167
#if defined(CC_INTERP_PROFILE_WITH_ASSERTIONS)
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   168
#define BI_PROFILE_CHECK_MDX()                                                 \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   169
  {                                                                            \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   170
    MethodData *md = istate->method()->method_data();                          \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   171
    address mdx  = (address) MDX();                                            \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   172
    address mdx2 = (address) md->data_layout_at(md->bci_to_di(BCI()));         \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   173
    guarantee(md   != NULL, "1");                                              \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   174
    guarantee(mdx  != NULL, "2");                                              \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   175
    guarantee(mdx2 != NULL, "3");                                              \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   176
    if (mdx != mdx2) {                                                         \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   177
      BI_PROFILE_PRINT_METHOD_DATA();                                          \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   178
      fatal3("invalid mdx at bci %d:"                                          \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   179
             " was " PTR_FORMAT                                                \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   180
             " but expected " PTR_FORMAT,                                      \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   181
             BCI(),                                                            \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   182
             mdx,                                                              \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   183
             mdx2);                                                            \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   184
    }                                                                          \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   185
  }
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   186
#else
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   187
#define BI_PROFILE_CHECK_MDX()
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   188
#endif
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   189
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   190
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   191
// Aligns the method data pointer mdx to the current bytecode index.
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   192
#define BI_PROFILE_ALIGN_TO_CURRENT_BCI()                                      \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   193
  if (ProfileInterpreter && MDX() != NULL) {                                   \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   194
    MethodData *md = istate->method()->method_data();                          \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   195
    SET_MDX(md->data_layout_at(md->bci_to_di(BCI())));                         \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   196
  }
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   197
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   198
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   199
// Updates profiling data for a jump.
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   200
#define BI_PROFILE_UPDATE_JUMP()                                               \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   201
  if (ProfileInterpreter && MDX() != NULL) {                                   \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   202
    BI_PROFILE_CHECK_MDX();                                                    \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   203
    JumpData::increment_taken_count_no_overflow(MDX());                        \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   204
    /* Remember last branch taken count. */                                    \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   205
    mdo_last_branch_taken_count = JumpData::taken_count(MDX());                \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   206
    SET_MDX(JumpData::advance_taken(MDX()));                                   \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   207
  }
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   208
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   209
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   210
// Updates profiling data for a taken/not taken branch.
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   211
#define BI_PROFILE_UPDATE_BRANCH(is_taken)                                     \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   212
  if (ProfileInterpreter && MDX() != NULL) {                                   \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   213
    BI_PROFILE_CHECK_MDX();                                                    \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   214
    if (is_taken) {                                                            \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   215
      BranchData::increment_taken_count_no_overflow(MDX());                    \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   216
      /* Remember last branch taken count. */                                  \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   217
      mdo_last_branch_taken_count = BranchData::taken_count(MDX());            \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   218
      SET_MDX(BranchData::advance_taken(MDX()));                               \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   219
    } else {                                                                   \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   220
      BranchData::increment_not_taken_count_no_overflow(MDX());                \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   221
      SET_MDX(BranchData::advance_not_taken(MDX()));                           \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   222
    }                                                                          \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   223
  }
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   224
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   225
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   226
// Updates profiling data for a ret with given bci.
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   227
#define BI_PROFILE_UPDATE_RET(bci)                                             \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   228
  if (ProfileInterpreter && MDX() != NULL) {                                   \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   229
    BI_PROFILE_CHECK_MDX();                                                    \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   230
    MethodData *md = istate->method()->method_data();                          \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   231
/* FIXME: there is more to do here than increment and advance(mdx)! */         \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   232
    CounterData::increment_count_no_overflow(MDX());                           \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   233
    SET_MDX(RetData::advance(md, bci));                                        \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   234
  }
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   235
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   236
// Decrement counter at checkcast if the subtype check fails (as template
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   237
// interpreter does!).
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   238
#define BI_PROFILE_SUBTYPECHECK_FAILED(receiver)                               \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   239
  if (ProfileInterpreter && MDX() != NULL) {                                   \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   240
    BI_PROFILE_CHECK_MDX();                                                    \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   241
    ReceiverTypeData::increment_receiver_count_no_overflow(MDX(), receiver);   \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   242
    ReceiverTypeData::decrement_count(MDX());                                  \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   243
  }
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   244
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   245
// Updates profiling data for a checkcast (was a null seen? which receiver?).
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   246
#define BI_PROFILE_UPDATE_CHECKCAST(null_seen, receiver)                       \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   247
  if (ProfileInterpreter && MDX() != NULL) {                                   \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   248
    BI_PROFILE_CHECK_MDX();                                                    \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   249
    if (null_seen) {                                                           \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   250
      ReceiverTypeData::set_null_seen(MDX());                                  \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   251
    } else {                                                                   \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   252
      /* Template interpreter doesn't increment count. */                      \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   253
      /* ReceiverTypeData::increment_count_no_overflow(MDX()); */              \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   254
      ReceiverTypeData::increment_receiver_count_no_overflow(MDX(), receiver); \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   255
    }                                                                          \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   256
    SET_MDX(ReceiverTypeData::advance(MDX()));                                 \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   257
  }
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   258
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   259
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   260
// Updates profiling data for an instanceof (was a null seen? which receiver?).
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   261
#define BI_PROFILE_UPDATE_INSTANCEOF(null_seen, receiver)                      \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   262
  BI_PROFILE_UPDATE_CHECKCAST(null_seen, receiver)
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   263
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   264
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   265
// Updates profiling data for a call.
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   266
#define BI_PROFILE_UPDATE_CALL()                                               \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   267
  if (ProfileInterpreter && MDX() != NULL) {                                   \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   268
    BI_PROFILE_CHECK_MDX();                                                    \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   269
    CounterData::increment_count_no_overflow(MDX());                           \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   270
    SET_MDX(CounterData::advance(MDX()));                                      \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   271
  }
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   272
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   273
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   274
// Updates profiling data for a final call.
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   275
#define BI_PROFILE_UPDATE_FINALCALL()                                          \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   276
  if (ProfileInterpreter && MDX() != NULL) {                                   \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   277
    BI_PROFILE_CHECK_MDX();                                                    \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   278
    VirtualCallData::increment_count_no_overflow(MDX());                       \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   279
    SET_MDX(VirtualCallData::advance(MDX()));                                  \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   280
  }
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   281
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   282
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   283
// Updates profiling data for a virtual call with given receiver Klass.
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   284
#define BI_PROFILE_UPDATE_VIRTUALCALL(receiver)                                \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   285
  if (ProfileInterpreter && MDX() != NULL) {                                   \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   286
    BI_PROFILE_CHECK_MDX();                                                    \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   287
    VirtualCallData::increment_receiver_count_no_overflow(MDX(), receiver);    \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   288
    SET_MDX(VirtualCallData::advance(MDX()));                                  \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   289
  }
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   290
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   291
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   292
// Updates profiling data for a switch (tabelswitch or lookupswitch) with
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   293
// given taken index (-1 means default case was taken).
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   294
#define BI_PROFILE_UPDATE_SWITCH(switch_index)                                 \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   295
  if (ProfileInterpreter && MDX() != NULL) {                                   \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   296
    BI_PROFILE_CHECK_MDX();                                                    \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   297
    MultiBranchData::increment_count_no_overflow(MDX(), switch_index);         \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   298
    SET_MDX(MultiBranchData::advance(MDX(), switch_index));                    \
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   299
  }
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   300
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   301
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   302
// The end /////////////////////////////////////////////////////////////////////
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   303
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   304
#endif // CC_INTERP_PROFILE
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   305
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   306
#endif // CC_INTERP
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   307
e7e511228518 8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
goetz
parents:
diff changeset
   308
#endif // SHARE_VM_INTERPRETER_BYTECODECINTERPRETERPROFILING_HPP