hotspot/src/cpu/zero/vm/abstractInterpreter_zero.cpp
author coleenp
Tue, 12 Jan 2016 13:14:41 -0500
changeset 35479 62c12ca7a45e
child 46608 b0da00b77053
permissions -rw-r--r--
8146410: Interpreter functions are declared and defined in the wrong files Summary: Moved functions to the correct files. Reviewed-by: goetz, aph, twisti, mockner
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
35479
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
     1
/*
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
     2
 * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
     3
 * Copyright 2007, 2008, 2009, 2010, 2011 Red Hat, Inc.
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
     4
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
     5
 *
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
     6
 * This code is free software; you can redistribute it and/or modify it
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
     7
 * under the terms of the GNU General Public License version 2 only, as
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
     8
 * published by the Free Software Foundation.
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
     9
 *
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    10
 * This code is distributed in the hope that it will be useful, but WITHOUT
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    11
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    12
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    13
 * version 2 for more details (a copy is included in the LICENSE file that
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    14
 * accompanied this code).
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    15
 *
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    16
 * You should have received a copy of the GNU General Public License version
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    17
 * 2 along with this work; if not, write to the Free Software Foundation,
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    18
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    19
 *
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    20
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    21
 * or visit www.oracle.com if you need additional information or have any
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    22
 * questions.
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    23
 *
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    24
 */
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    25
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    26
#include "precompiled.hpp"
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    27
#include "interpreter/bytecodeInterpreter.hpp"
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    28
#include "interpreter/cppInterpreter.hpp"
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    29
#include "runtime/frame.inline.hpp"
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    30
#include "utilities/globalDefinitions.hpp"
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    31
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    32
bool AbstractInterpreter::can_be_compiled(methodHandle m) {
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    33
  return true;
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    34
}
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    35
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    36
int AbstractInterpreter::BasicType_as_index(BasicType type) {
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    37
  int i = 0;
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    38
  switch (type) {
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    39
    case T_BOOLEAN: i = 0; break;
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    40
    case T_CHAR   : i = 1; break;
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    41
    case T_BYTE   : i = 2; break;
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    42
    case T_SHORT  : i = 3; break;
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    43
    case T_INT    : i = 4; break;
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    44
    case T_LONG   : i = 5; break;
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    45
    case T_VOID   : i = 6; break;
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    46
    case T_FLOAT  : i = 7; break;
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    47
    case T_DOUBLE : i = 8; break;
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    48
    case T_OBJECT : i = 9; break;
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    49
    case T_ARRAY  : i = 9; break;
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    50
    default       : ShouldNotReachHere();
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    51
  }
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    52
  assert(0 <= i && i < AbstractInterpreter::number_of_result_handlers,
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    53
         "index out of bounds");
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    54
  return i;
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    55
}
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    56
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    57
// Deoptimization helpers
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    58
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    59
int AbstractInterpreter::size_activation(int       max_stack,
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    60
                                         int       tempcount,
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    61
                                         int       extra_args,
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    62
                                         int       moncount,
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    63
                                         int       callee_param_count,
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    64
                                         int       callee_locals,
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    65
                                         bool      is_top_frame) {
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    66
  int header_words        = InterpreterFrame::header_words;
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    67
  int monitor_words       = moncount * frame::interpreter_frame_monitor_size();
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    68
  int stack_words         = is_top_frame ? max_stack : tempcount;
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    69
  int callee_extra_locals = callee_locals - callee_param_count;
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    70
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    71
  return header_words + monitor_words + stack_words + callee_extra_locals;
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    72
}
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    73
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    74
void AbstractInterpreter::layout_activation(Method* method,
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    75
                                            int       tempcount,
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    76
                                            int       popframe_extra_args,
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    77
                                            int       moncount,
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    78
                                            int       caller_actual_parameters,
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    79
                                            int       callee_param_count,
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    80
                                            int       callee_locals,
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    81
                                            frame*    caller,
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    82
                                            frame*    interpreter_frame,
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    83
                                            bool      is_top_frame,
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    84
                                            bool      is_bottom_frame) {
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    85
  assert(popframe_extra_args == 0, "what to do?");
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    86
  assert(!is_top_frame || (!callee_locals && !callee_param_count),
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    87
         "top frame should have no caller");
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    88
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    89
  // This code must exactly match what InterpreterFrame::build
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    90
  // does (the full InterpreterFrame::build, that is, not the
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    91
  // one that creates empty frames for the deoptimizer).
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    92
  //
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    93
  // interpreter_frame will be filled in.  It's size is determined by
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    94
  // a previous call to the size_activation() method,
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    95
  //
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    96
  // Note that tempcount is the current size of the expression
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    97
  // stack.  For top most frames we will allocate a full sized
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    98
  // expression stack and not the trimmed version that non-top
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    99
  // frames have.
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
   100
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
   101
  int monitor_words       = moncount * frame::interpreter_frame_monitor_size();
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
   102
  intptr_t *locals        = interpreter_frame->fp() + method->max_locals();
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
   103
  interpreterState istate = interpreter_frame->get_interpreterState();
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
   104
  intptr_t *monitor_base  = (intptr_t*) istate;
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
   105
  intptr_t *stack_base    = monitor_base - monitor_words;
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
   106
  intptr_t *stack         = stack_base - tempcount - 1;
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
   107
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
   108
  BytecodeInterpreter::layout_interpreterState(istate,
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
   109
                                               caller,
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
   110
                                               NULL,
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
   111
                                               method,
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
   112
                                               locals,
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
   113
                                               stack,
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
   114
                                               stack_base,
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
   115
                                               monitor_base,
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
   116
                                               NULL,
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
   117
                                               is_top_frame);
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
   118
}
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
   119
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
   120
// Helper for (runtime) stack overflow checks
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
   121
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
   122
int AbstractInterpreter::size_top_interpreter_activation(Method* method) {
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
   123
  return 0;
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
   124
}