src/hotspot/cpu/zero/abstractInterpreter_zero.cpp
author ihse
Mon, 26 Nov 2018 14:18:22 +0100
branchihse-manpages-branch
changeset 57043 23d7457ca4c6
parent 47216 71c04702a3d5
permissions -rw-r--r--
Clean up login in when running which kind of man page creation.
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
/*
46608
b0da00b77053 8183232: Avoid resolving method_kind in AbstractInterpreter::can_be_compiled
redestad
parents: 35479
diff changeset
     2
 * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
35479
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
int AbstractInterpreter::BasicType_as_index(BasicType type) {
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    33
  int i = 0;
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    34
  switch (type) {
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    35
    case T_BOOLEAN: i = 0; break;
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    36
    case T_CHAR   : i = 1; break;
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    37
    case T_BYTE   : i = 2; break;
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    38
    case T_SHORT  : i = 3; break;
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    39
    case T_INT    : i = 4; break;
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    40
    case T_LONG   : i = 5; break;
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    41
    case T_VOID   : i = 6; break;
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    42
    case T_FLOAT  : i = 7; break;
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    43
    case T_DOUBLE : i = 8; break;
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    44
    case T_OBJECT : i = 9; break;
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    45
    case T_ARRAY  : i = 9; break;
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    46
    default       : ShouldNotReachHere();
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    47
  }
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    48
  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
    49
         "index out of bounds");
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    50
  return i;
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
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    53
// Deoptimization helpers
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    54
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    55
int AbstractInterpreter::size_activation(int       max_stack,
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    56
                                         int       tempcount,
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    57
                                         int       extra_args,
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    58
                                         int       moncount,
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    59
                                         int       callee_param_count,
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    60
                                         int       callee_locals,
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    61
                                         bool      is_top_frame) {
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    62
  int header_words        = InterpreterFrame::header_words;
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    63
  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
    64
  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
    65
  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
    66
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    67
  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
    68
}
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    69
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    70
void AbstractInterpreter::layout_activation(Method* method,
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    71
                                            int       tempcount,
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    72
                                            int       popframe_extra_args,
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    73
                                            int       moncount,
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    74
                                            int       caller_actual_parameters,
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    75
                                            int       callee_param_count,
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    76
                                            int       callee_locals,
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    77
                                            frame*    caller,
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    78
                                            frame*    interpreter_frame,
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    79
                                            bool      is_top_frame,
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    80
                                            bool      is_bottom_frame) {
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    81
  assert(popframe_extra_args == 0, "what to do?");
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    82
  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
    83
         "top frame should have no caller");
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    84
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    85
  // This code must exactly match what InterpreterFrame::build
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    86
  // 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
    87
  // one that creates empty frames for the deoptimizer).
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
  // 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
    90
  // a previous call to the size_activation() method,
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    91
  //
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    92
  // 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
    93
  // 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
    94
  // 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
    95
  // frames have.
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    96
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
    97
  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
    98
  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
    99
  interpreterState istate = interpreter_frame->get_interpreterState();
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
   100
  intptr_t *monitor_base  = (intptr_t*) istate;
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
   101
  intptr_t *stack_base    = monitor_base - monitor_words;
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
   102
  intptr_t *stack         = stack_base - tempcount - 1;
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
   103
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
   104
  BytecodeInterpreter::layout_interpreterState(istate,
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
   105
                                               caller,
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
   106
                                               NULL,
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
   107
                                               method,
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
   108
                                               locals,
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
   109
                                               stack,
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
   110
                                               stack_base,
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
   111
                                               monitor_base,
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
   112
                                               NULL,
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
   113
                                               is_top_frame);
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
   114
}
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
   115
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
   116
// Helper for (runtime) stack overflow checks
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
   117
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
   118
int AbstractInterpreter::size_top_interpreter_activation(Method* method) {
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
   119
  return 0;
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
diff changeset
   120
}