hotspot/src/share/vm/interpreter/cppInterpreter.cpp
author coleenp
Tue, 12 Aug 2014 10:48:55 -0400
changeset 25950 b5c40ed1d349
parent 14294 130e947dfbe6
child 35214 d86005e0b4c2
permissions -rw-r--r--
8003426: Remove UseFastAccessors and UseFastEmptyMethods except for zero Summary: These options have been long disabled in Xmixed mode because they prevent these small methods from being inlined and are subject to bit rot, and we don't need more macro assembler code to maintain and change if the constant pool cache format changes. Reviewed-by: simonis, kvn
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
25950
b5c40ed1d349 8003426: Remove UseFastAccessors and UseFastEmptyMethods except for zero
coleenp
parents: 14294
diff changeset
     2
 * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 2534
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 2534
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 2534
diff changeset
    21
 * questions.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    25
#include "precompiled.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    26
#include "interpreter/bytecodeInterpreter.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    27
#include "interpreter/interpreter.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    28
#include "interpreter/interpreterGenerator.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    29
#include "interpreter/interpreterRuntime.hpp"
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    30
489c9b5090e2 Initial load
duke
parents:
diff changeset
    31
#ifdef CC_INTERP
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
# define __ _masm->
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
void CppInterpreter::initialize() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
  if (_code != NULL) return;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
  AbstractInterpreter::initialize();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
  // generate interpreter
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
  { ResourceMark rm;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
    TraceTime timer("Interpreter generation", TraceStartupTime);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
    int code_size = InterpreterCodeSize;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
    NOT_PRODUCT(code_size *= 4;)  // debug uses extra interpreter code space
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
    _code = new StubQueue(new InterpreterCodeletInterface, code_size, NULL,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
                          "Interpreter");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
    InterpreterGenerator g(_code);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
    if (PrintInterpreter) print();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
  // Allow c++ interpreter to do one initialization now that switches are set, etc.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
  BytecodeInterpreter start_msg(BytecodeInterpreter::initialize);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
  if (JvmtiExport::can_post_interpreter_events())
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
    BytecodeInterpreter::runWithChecks(&start_msg);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
  else
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
    BytecodeInterpreter::run(&start_msg);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
address    CppInterpreter::_tosca_to_stack         [AbstractInterpreter::number_of_result_handlers];
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
address    CppInterpreter::_stack_to_stack         [AbstractInterpreter::number_of_result_handlers];
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
address    CppInterpreter::_stack_to_native_abi    [AbstractInterpreter::number_of_result_handlers];
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
CppInterpreterGenerator::CppInterpreterGenerator(StubQueue* _code): AbstractInterpreterGenerator(_code) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
static const BasicType types[Interpreter::number_of_result_handlers] = {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
  T_BOOLEAN,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
  T_CHAR   ,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
  T_BYTE   ,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
  T_SHORT  ,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
  T_INT    ,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
  T_LONG   ,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
  T_VOID   ,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
  T_FLOAT  ,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
  T_DOUBLE ,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
  T_OBJECT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
void CppInterpreterGenerator::generate_all() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
  AbstractInterpreterGenerator::generate_all();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
  { CodeletMark cm(_masm, "result handlers for native calls");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
    // The various result converter stublets.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
    int is_generated[Interpreter::number_of_result_handlers];
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
    memset(is_generated, 0, sizeof(is_generated));
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
    int _tosca_to_stack_is_generated[Interpreter::number_of_result_handlers];
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
    int _stack_to_stack_is_generated[Interpreter::number_of_result_handlers];
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
    int _stack_to_native_abi_is_generated[Interpreter::number_of_result_handlers];
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
    memset(_tosca_to_stack_is_generated, 0, sizeof(_tosca_to_stack_is_generated));
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
    memset(_stack_to_stack_is_generated, 0, sizeof(_stack_to_stack_is_generated));
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
    memset(_stack_to_native_abi_is_generated, 0, sizeof(_stack_to_native_abi_is_generated));
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
    for (int i = 0; i < Interpreter::number_of_result_handlers; i++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
      BasicType type = types[i];
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
      if (!is_generated[Interpreter::BasicType_as_index(type)]++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
        Interpreter::_native_abi_to_tosca[Interpreter::BasicType_as_index(type)] = generate_result_handler_for(type);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
      if (!_tosca_to_stack_is_generated[Interpreter::BasicType_as_index(type)]++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
        Interpreter::_tosca_to_stack[Interpreter::BasicType_as_index(type)] = generate_tosca_to_stack_converter(type);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
      if (!_stack_to_stack_is_generated[Interpreter::BasicType_as_index(type)]++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
        Interpreter::_stack_to_stack[Interpreter::BasicType_as_index(type)] = generate_stack_to_stack_converter(type);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
      if (!_stack_to_native_abi_is_generated[Interpreter::BasicType_as_index(type)]++) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
        Interpreter::_stack_to_native_abi[Interpreter::BasicType_as_index(type)] = generate_stack_to_native_abi_converter(type);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
25950
b5c40ed1d349 8003426: Remove UseFastAccessors and UseFastEmptyMethods except for zero
coleenp
parents: 14294
diff changeset
   111
#define method_entry(kind) Interpreter::_entry_table[Interpreter::kind] = ((InterpreterGenerator*)this)->generate_method_entry(Interpreter::kind)
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
  { CodeletMark cm(_masm, "(kind = frame_manager)");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
    // all non-native method kinds
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
    method_entry(zerolocals);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
    method_entry(zerolocals_synchronized);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
    method_entry(empty);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
    method_entry(accessor);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
    method_entry(abstract);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
    method_entry(java_lang_math_sin   );
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
    method_entry(java_lang_math_cos   );
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
    method_entry(java_lang_math_tan   );
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
    method_entry(java_lang_math_abs   );
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
    method_entry(java_lang_math_sqrt  );
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
    method_entry(java_lang_math_log   );
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
    method_entry(java_lang_math_log10 );
14294
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9176
diff changeset
   127
    method_entry(java_lang_math_pow );
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9176
diff changeset
   128
    method_entry(java_lang_math_exp );
9176
42d9d1010f38 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 7397
diff changeset
   129
    method_entry(java_lang_ref_reference_get);
14294
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9176
diff changeset
   130
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9176
diff changeset
   131
    initialize_method_handle_entries();
130e947dfbe6 8000780: make Zero build and run with JDK8
twisti
parents: 9176
diff changeset
   132
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
    Interpreter::_native_entry_begin = Interpreter::code()->code_end();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
    method_entry(native);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
    method_entry(native_synchronized);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
    Interpreter::_native_entry_end = Interpreter::code()->code_end();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
#undef method_entry
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
#endif // CC_INTERP