hotspot/src/cpu/x86/vm/templateInterpreter_x86.cpp
author coleenp
Sat, 05 Dec 2015 10:40:22 -0500
changeset 34651 07b1cc0f6040
parent 25950 b5c40ed1d349
child 35214 d86005e0b4c2
permissions -rw-r--r--
8144534: Refactor templateInterpreter and templateInterpreterGenerator functions Summary: merged templateInterpreter_x86_32/64 into templateInterpreterGenerator_x86.cpp (some 32/64 functions remain for the hand coded crc functions). Reviewed-by: goetz, jrose, twisti
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
24018
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
     1
/*
34651
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents: 25950
diff changeset
     2
 * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
24018
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
     4
 *
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
     7
 * published by the Free Software Foundation.
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
     8
 *
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    13
 * accompanied this code).
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    14
 *
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    18
 *
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    21
 * questions.
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    22
 *
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    23
 */
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    24
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    25
#include "precompiled.hpp"
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    26
#include "ci/ciMethod.hpp"
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    27
#include "interpreter/interpreter.hpp"
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    28
#include "runtime/frame.inline.hpp"
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    29
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    30
#ifndef CC_INTERP
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    31
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    32
// asm based interpreter deoptimization helpers
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    33
int AbstractInterpreter::size_activation(int max_stack,
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    34
                                         int temps,
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    35
                                         int extra_args,
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    36
                                         int monitors,
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    37
                                         int callee_params,
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    38
                                         int callee_locals,
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    39
                                         bool is_top_frame) {
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    40
  // Note: This calculation must exactly parallel the frame setup
25950
b5c40ed1d349 8003426: Remove UseFastAccessors and UseFastEmptyMethods except for zero
coleenp
parents: 24322
diff changeset
    41
  // in InterpreterGenerator::generate_fixed_frame.
24018
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    42
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    43
  // fixed size of an interpreter frame:
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    44
  int overhead = frame::sender_sp_offset -
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    45
                 frame::interpreter_frame_initial_sp_offset;
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    46
  // Our locals were accounted for by the caller (or last_frame_adjust
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    47
  // on the transistion) Since the callee parameters already account
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    48
  // for the callee's params we only need to account for the extra
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    49
  // locals.
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    50
  int size = overhead +
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    51
         (callee_locals - callee_params)*Interpreter::stackElementWords +
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    52
         monitors * frame::interpreter_frame_monitor_size() +
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    53
         temps* Interpreter::stackElementWords + extra_args;
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    54
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    55
  return size;
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    56
}
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    57
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    58
void AbstractInterpreter::layout_activation(Method* method,
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    59
                                            int tempcount,
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    60
                                            int popframe_extra_args,
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    61
                                            int moncount,
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    62
                                            int caller_actual_parameters,
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    63
                                            int callee_param_count,
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    64
                                            int callee_locals,
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    65
                                            frame* caller,
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    66
                                            frame* interpreter_frame,
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    67
                                            bool is_top_frame,
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    68
                                            bool is_bottom_frame) {
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    69
  // The frame interpreter_frame is guaranteed to be the right size,
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    70
  // as determined by a previous call to the size_activation() method.
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    71
  // It is also guaranteed to be walkable even though it is in a
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    72
  // skeletal state
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    73
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    74
  int max_locals = method->max_locals() * Interpreter::stackElementWords;
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    75
  int extra_locals = (method->max_locals() - method->size_of_parameters()) *
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    76
    Interpreter::stackElementWords;
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    77
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    78
#ifdef ASSERT
24322
c2978d1578e3 8036956: remove EnableInvokeDynamic flag
anoll
parents: 24018
diff changeset
    79
  assert(caller->sp() == interpreter_frame->sender_sp(), "Frame not properly walkable");
24018
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    80
#endif
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    81
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    82
  interpreter_frame->interpreter_frame_set_method(method);
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    83
  // NOTE the difference in using sender_sp and
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    84
  // interpreter_frame_sender_sp interpreter_frame_sender_sp is
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    85
  // the original sp of the caller (the unextended_sp) and
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    86
  // sender_sp is fp+8/16 (32bit/64bit) XXX
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    87
  intptr_t* locals = interpreter_frame->sender_sp() + max_locals - 1;
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    88
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    89
#ifdef ASSERT
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    90
  if (caller->is_interpreted_frame()) {
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    91
    assert(locals < caller->fp() + frame::interpreter_frame_initial_sp_offset, "bad placement");
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    92
  }
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    93
#endif
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    94
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    95
  interpreter_frame->interpreter_frame_set_locals(locals);
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    96
  BasicObjectLock* montop = interpreter_frame->interpreter_frame_monitor_begin();
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    97
  BasicObjectLock* monbot = montop - moncount;
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    98
  interpreter_frame->interpreter_frame_set_monitor_end(monbot);
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
    99
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
   100
  // Set last_sp
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
   101
  intptr_t*  esp = (intptr_t*) monbot -
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
   102
    tempcount*Interpreter::stackElementWords -
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
   103
    popframe_extra_args;
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
   104
  interpreter_frame->interpreter_frame_set_last_sp(esp);
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
   105
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
   106
  // All frames but the initial (oldest) interpreter frame we fill in have
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
   107
  // a value for sender_sp that allows walking the stack but isn't
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
   108
  // truly correct. Correct the value here.
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
   109
  if (extra_locals != 0 &&
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
   110
      interpreter_frame->sender_sp() ==
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
   111
      interpreter_frame->interpreter_frame_sender_sp()) {
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
   112
    interpreter_frame->set_interpreter_frame_sender_sp(caller->sp() +
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
   113
                                                       extra_locals);
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
   114
  }
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
   115
  *interpreter_frame->interpreter_frame_cache_addr() =
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
   116
    method->constants()->cache();
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
   117
}
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
   118
34651
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents: 25950
diff changeset
   119
#ifndef _LP64
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents: 25950
diff changeset
   120
int AbstractInterpreter::BasicType_as_index(BasicType type) {
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents: 25950
diff changeset
   121
  int i = 0;
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents: 25950
diff changeset
   122
  switch (type) {
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents: 25950
diff changeset
   123
    case T_BOOLEAN: i = 0; break;
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents: 25950
diff changeset
   124
    case T_CHAR   : i = 1; break;
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents: 25950
diff changeset
   125
    case T_BYTE   : i = 2; break;
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents: 25950
diff changeset
   126
    case T_SHORT  : i = 3; break;
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents: 25950
diff changeset
   127
    case T_INT    : // fall through
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents: 25950
diff changeset
   128
    case T_LONG   : // fall through
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents: 25950
diff changeset
   129
    case T_VOID   : i = 4; break;
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents: 25950
diff changeset
   130
    case T_FLOAT  : i = 5; break;  // have to treat float and double separately for SSE
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents: 25950
diff changeset
   131
    case T_DOUBLE : i = 6; break;
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents: 25950
diff changeset
   132
    case T_OBJECT : // fall through
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents: 25950
diff changeset
   133
    case T_ARRAY  : i = 7; break;
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents: 25950
diff changeset
   134
    default       : ShouldNotReachHere();
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents: 25950
diff changeset
   135
  }
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents: 25950
diff changeset
   136
  assert(0 <= i && i < AbstractInterpreter::number_of_result_handlers, "index out of bounds");
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents: 25950
diff changeset
   137
  return i;
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents: 25950
diff changeset
   138
}
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents: 25950
diff changeset
   139
#else
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents: 25950
diff changeset
   140
int AbstractInterpreter::BasicType_as_index(BasicType type) {
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents: 25950
diff changeset
   141
  int i = 0;
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents: 25950
diff changeset
   142
  switch (type) {
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents: 25950
diff changeset
   143
    case T_BOOLEAN: i = 0; break;
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents: 25950
diff changeset
   144
    case T_CHAR   : i = 1; break;
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents: 25950
diff changeset
   145
    case T_BYTE   : i = 2; break;
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents: 25950
diff changeset
   146
    case T_SHORT  : i = 3; break;
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents: 25950
diff changeset
   147
    case T_INT    : i = 4; break;
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents: 25950
diff changeset
   148
    case T_LONG   : i = 5; break;
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents: 25950
diff changeset
   149
    case T_VOID   : i = 6; break;
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents: 25950
diff changeset
   150
    case T_FLOAT  : i = 7; break;
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents: 25950
diff changeset
   151
    case T_DOUBLE : i = 8; break;
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents: 25950
diff changeset
   152
    case T_OBJECT : i = 9; break;
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents: 25950
diff changeset
   153
    case T_ARRAY  : i = 9; break;
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents: 25950
diff changeset
   154
    default       : ShouldNotReachHere();
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents: 25950
diff changeset
   155
  }
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents: 25950
diff changeset
   156
  assert(0 <= i && i < AbstractInterpreter::number_of_result_handlers,
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents: 25950
diff changeset
   157
         "index out of bounds");
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents: 25950
diff changeset
   158
  return i;
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents: 25950
diff changeset
   159
}
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents: 25950
diff changeset
   160
#endif // _LP64
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents: 25950
diff changeset
   161
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents: 25950
diff changeset
   162
// These should never be compiled since the interpreter will prefer
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents: 25950
diff changeset
   163
// the compiled version to the intrinsic version.
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents: 25950
diff changeset
   164
bool AbstractInterpreter::can_be_compiled(methodHandle m) {
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents: 25950
diff changeset
   165
  switch (method_kind(m)) {
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents: 25950
diff changeset
   166
    case Interpreter::java_lang_math_sin     : // fall thru
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents: 25950
diff changeset
   167
    case Interpreter::java_lang_math_cos     : // fall thru
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents: 25950
diff changeset
   168
    case Interpreter::java_lang_math_tan     : // fall thru
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents: 25950
diff changeset
   169
    case Interpreter::java_lang_math_abs     : // fall thru
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents: 25950
diff changeset
   170
    case Interpreter::java_lang_math_log     : // fall thru
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents: 25950
diff changeset
   171
    case Interpreter::java_lang_math_log10   : // fall thru
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents: 25950
diff changeset
   172
    case Interpreter::java_lang_math_sqrt    : // fall thru
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents: 25950
diff changeset
   173
    case Interpreter::java_lang_math_pow     : // fall thru
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents: 25950
diff changeset
   174
    case Interpreter::java_lang_math_exp     :
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents: 25950
diff changeset
   175
      return false;
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents: 25950
diff changeset
   176
    default:
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents: 25950
diff changeset
   177
      return true;
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents: 25950
diff changeset
   178
  }
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents: 25950
diff changeset
   179
}
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents: 25950
diff changeset
   180
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents: 25950
diff changeset
   181
// How much stack a method activation needs in words.
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents: 25950
diff changeset
   182
int AbstractInterpreter::size_top_interpreter_activation(Method* method) {
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents: 25950
diff changeset
   183
  const int entry_size = frame::interpreter_frame_monitor_size();
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents: 25950
diff changeset
   184
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents: 25950
diff changeset
   185
  // total overhead size: entry_size + (saved rbp thru expr stack
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents: 25950
diff changeset
   186
  // bottom).  be sure to change this if you add/subtract anything
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents: 25950
diff changeset
   187
  // to/from the overhead area
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents: 25950
diff changeset
   188
  const int overhead_size =
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents: 25950
diff changeset
   189
    -(frame::interpreter_frame_initial_sp_offset) + entry_size;
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents: 25950
diff changeset
   190
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents: 25950
diff changeset
   191
#ifndef _LP64
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents: 25950
diff changeset
   192
  const int stub_code = 4;  // see generate_call_stub
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents: 25950
diff changeset
   193
#else
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents: 25950
diff changeset
   194
  const int stub_code = frame::entry_frame_after_call_words;
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents: 25950
diff changeset
   195
#endif
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents: 25950
diff changeset
   196
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents: 25950
diff changeset
   197
  const int method_stack = (method->max_locals() + method->max_stack()) *
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents: 25950
diff changeset
   198
                           Interpreter::stackElementWords;
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents: 25950
diff changeset
   199
  return (overhead_size + method_stack + stub_code);
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents: 25950
diff changeset
   200
}
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents: 25950
diff changeset
   201
24018
77b156916bab 8032410: compiler/uncommontrap/TestStackBangRbp.java times out on Solaris-Sparc V9
roland
parents:
diff changeset
   202
#endif // CC_INTERP