hotspot/src/share/vm/interpreter/interpreter.hpp
author goetz
Fri, 04 Jul 2014 11:46:01 +0200
changeset 25715 d5a8dbdc5150
parent 22234 da823d78ad65
child 26432 9b974e2eae27
permissions -rw-r--r--
8049325: Introduce and clean up umbrella headers for the files in the cpu subdirectories. Summary: Introduce and clean up umbrella headers for the files in the cpu subdirectories. Reviewed-by: lfoltan, coleenp, dholmes
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
25715
d5a8dbdc5150 8049325: Introduce and clean up umbrella headers for the files in the cpu subdirectories.
goetz
parents: 22234
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: 2131
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 2131
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: 2131
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: 6418
diff changeset
    25
#ifndef SHARE_VM_INTERPRETER_INTERPRETER_HPP
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6418
diff changeset
    26
#define SHARE_VM_INTERPRETER_INTERPRETER_HPP
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6418
diff changeset
    27
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6418
diff changeset
    28
#include "code/stubs.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6418
diff changeset
    29
#include "interpreter/cppInterpreter.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6418
diff changeset
    30
#include "interpreter/templateInterpreter.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6418
diff changeset
    31
#ifdef ZERO
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6418
diff changeset
    32
#ifdef TARGET_ARCH_zero
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6418
diff changeset
    33
# include "entry_zero.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6418
diff changeset
    34
#endif
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6418
diff changeset
    35
#endif
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6418
diff changeset
    36
2131
98f9cef66a34 6810672: Comment typos
twisti
parents: 1
diff changeset
    37
// This file contains the platform-independent parts
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
// of the interpreter and the interpreter generator.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
25715
d5a8dbdc5150 8049325: Introduce and clean up umbrella headers for the files in the cpu subdirectories.
goetz
parents: 22234
diff changeset
    40
class InterpreterMacroAssembler;
d5a8dbdc5150 8049325: Introduce and clean up umbrella headers for the files in the cpu subdirectories.
goetz
parents: 22234
diff changeset
    41
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
//------------------------------------------------------------------------------------------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
// An InterpreterCodelet is a piece of interpreter code. All
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
// interpreter code is generated into little codelets which
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
// contain extra information for debugging and printing purposes.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
class InterpreterCodelet: public Stub {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
  friend class VMStructs;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
  int         _size;                             // the size in bytes
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
  const char* _description;                      // a description of the codelet, for debugging & printing
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
  Bytecodes::Code _bytecode;                     // associated bytecode if any
16368
713209c45a82 8008555: Debugging code in compiled method sometimes leaks memory
roland
parents: 13963
diff changeset
    53
  DEBUG_ONLY(CodeStrings _strings;)              // Comments for annotating assembler output.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
  // Initialization/finalization
13887
89b873bcc55b 7200163: add CodeComments functionality to assember stubs
kvn
parents: 8921
diff changeset
    57
  void    initialize(int size,
16368
713209c45a82 8008555: Debugging code in compiled method sometimes leaks memory
roland
parents: 13963
diff changeset
    58
                     CodeStrings& strings)       { _size = size; DEBUG_ONLY(_strings.assign(strings);) }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
  void    finalize()                             { ShouldNotCallThis(); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
  // General info/converters
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
  int     size() const                           { return _size; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
  static  int code_size_to_size(int code_size)   { return round_to(sizeof(InterpreterCodelet), CodeEntryAlignment) + code_size; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
  // Code info
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
  address code_begin() const                     { return (address)this + round_to(sizeof(InterpreterCodelet), CodeEntryAlignment); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
  address code_end() const                       { return (address)this + size(); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
  // Debugging
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
  void    verify();
6176
4d9030fe341f 6953477: Increase portability and flexibility of building Hotspot
bobv
parents: 5547
diff changeset
    71
  void    print_on(outputStream* st) const;
4d9030fe341f 6953477: Increase portability and flexibility of building Hotspot
bobv
parents: 5547
diff changeset
    72
  void    print() const { print_on(tty); }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
  // Interpreter-specific initialization
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
  void    initialize(const char* description, Bytecodes::Code bytecode);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
  // Interpreter-specific attributes
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
  int         code_size() const                  { return code_end() - code_begin(); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
  const char* description() const                { return _description; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
  Bytecodes::Code bytecode() const               { return _bytecode; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
// Define a prototype interface
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
DEF_STUB_INTERFACE(InterpreterCodelet);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
//------------------------------------------------------------------------------------------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
// A CodeletMark serves as an automatic creator/initializer for Codelets
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
// (As a subclass of ResourceMark it automatically GC's the allocated
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
// code buffer and assemblers).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
class CodeletMark: ResourceMark {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
  InterpreterCodelet*         _clet;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
  InterpreterMacroAssembler** _masm;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
  CodeBuffer                  _cb;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
  int codelet_size() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
    // Request the whole code buffer (minus a little for alignment).
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
    // The commit call below trims it back for each codelet.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
    int codelet_size = AbstractInterpreter::code()->available_space() - 2*K;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
    // Guarantee there's a little bit of code space left.
25715
d5a8dbdc5150 8049325: Introduce and clean up umbrella headers for the files in the cpu subdirectories.
goetz
parents: 22234
diff changeset
   104
    guarantee(codelet_size > 0 && (size_t)codelet_size > 2*K,
d5a8dbdc5150 8049325: Introduce and clean up umbrella headers for the files in the cpu subdirectories.
goetz
parents: 22234
diff changeset
   105
              "not enough space for interpreter generation");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
    return codelet_size;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
 public:
25715
d5a8dbdc5150 8049325: Introduce and clean up umbrella headers for the files in the cpu subdirectories.
goetz
parents: 22234
diff changeset
   111
  CodeletMark(InterpreterMacroAssembler*& masm,
d5a8dbdc5150 8049325: Introduce and clean up umbrella headers for the files in the cpu subdirectories.
goetz
parents: 22234
diff changeset
   112
              const char* description,
d5a8dbdc5150 8049325: Introduce and clean up umbrella headers for the files in the cpu subdirectories.
goetz
parents: 22234
diff changeset
   113
              Bytecodes::Code bytecode = Bytecodes::_illegal);
d5a8dbdc5150 8049325: Introduce and clean up umbrella headers for the files in the cpu subdirectories.
goetz
parents: 22234
diff changeset
   114
  ~CodeletMark();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
// Wrapper classes to produce Interpreter/InterpreterGenerator from either
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
// the c++ interpreter or the template interpreter.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
class Interpreter: public CC_INTERP_ONLY(CppInterpreter) NOT_CC_INTERP(TemplateInterpreter) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
25715
d5a8dbdc5150 8049325: Introduce and clean up umbrella headers for the files in the cpu subdirectories.
goetz
parents: 22234
diff changeset
   122
 public:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
  // Debugging/printing
25715
d5a8dbdc5150 8049325: Introduce and clean up umbrella headers for the files in the cpu subdirectories.
goetz
parents: 22234
diff changeset
   124
  static InterpreterCodelet* codelet_containing(address pc) { return (InterpreterCodelet*)_code->stub_containing(pc); }
d5a8dbdc5150 8049325: Introduce and clean up umbrella headers for the files in the cpu subdirectories.
goetz
parents: 22234
diff changeset
   125
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6418
diff changeset
   126
#ifdef TARGET_ARCH_x86
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6418
diff changeset
   127
# include "interpreter_x86.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6418
diff changeset
   128
#endif
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6418
diff changeset
   129
#ifdef TARGET_ARCH_sparc
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6418
diff changeset
   130
# include "interpreter_sparc.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6418
diff changeset
   131
#endif
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6418
diff changeset
   132
#ifdef TARGET_ARCH_zero
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6418
diff changeset
   133
# include "interpreter_zero.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6418
diff changeset
   134
#endif
8107
78e5bd944384 7016023: Enable building ARM and PPC from src/closed repository
bobv
parents: 7397
diff changeset
   135
#ifdef TARGET_ARCH_arm
78e5bd944384 7016023: Enable building ARM and PPC from src/closed repository
bobv
parents: 7397
diff changeset
   136
# include "interpreter_arm.hpp"
78e5bd944384 7016023: Enable building ARM and PPC from src/closed repository
bobv
parents: 7397
diff changeset
   137
#endif
78e5bd944384 7016023: Enable building ARM and PPC from src/closed repository
bobv
parents: 7397
diff changeset
   138
#ifdef TARGET_ARCH_ppc
78e5bd944384 7016023: Enable building ARM and PPC from src/closed repository
bobv
parents: 7397
diff changeset
   139
# include "interpreter_ppc.hpp"
78e5bd944384 7016023: Enable building ARM and PPC from src/closed repository
bobv
parents: 7397
diff changeset
   140
#endif
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6418
diff changeset
   141
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
};
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6418
diff changeset
   143
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6418
diff changeset
   144
#endif // SHARE_VM_INTERPRETER_INTERPRETER_HPP