author | stefank |
Wed, 18 Feb 2015 10:28:27 +0100 | |
changeset 29201 | fee2bbb2ec1d |
parent 26432 | 9b974e2eae27 |
child 29213 | 340e3e8b810b |
permissions | -rw-r--r-- |
1 | 1 |
/* |
29201
fee2bbb2ec1d
8073389: Remove the include of resourceArea.hpp from classFileParser.hpp
stefank
parents:
26432
diff
changeset
|
2 |
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. |
1 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License version |
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
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 | 22 |
* |
23 |
*/ |
|
24 |
||
7397 | 25 |
#ifndef SHARE_VM_INTERPRETER_INTERPRETER_HPP |
26 |
#define SHARE_VM_INTERPRETER_INTERPRETER_HPP |
|
27 |
||
28 |
#include "code/stubs.hpp" |
|
29 |
#include "interpreter/cppInterpreter.hpp" |
|
30 |
#include "interpreter/templateInterpreter.hpp" |
|
29201
fee2bbb2ec1d
8073389: Remove the include of resourceArea.hpp from classFileParser.hpp
stefank
parents:
26432
diff
changeset
|
31 |
#include "memory/resourceArea.hpp" |
7397 | 32 |
#ifdef ZERO |
33 |
#ifdef TARGET_ARCH_zero |
|
34 |
# include "entry_zero.hpp" |
|
35 |
#endif |
|
36 |
#endif |
|
37 |
||
2131 | 38 |
// This file contains the platform-independent parts |
1 | 39 |
// of the interpreter and the interpreter generator. |
40 |
||
25715
d5a8dbdc5150
8049325: Introduce and clean up umbrella headers for the files in the cpu subdirectories.
goetz
parents:
22234
diff
changeset
|
41 |
class InterpreterMacroAssembler; |
d5a8dbdc5150
8049325: Introduce and clean up umbrella headers for the files in the cpu subdirectories.
goetz
parents:
22234
diff
changeset
|
42 |
|
1 | 43 |
//------------------------------------------------------------------------------------------------------------------------ |
44 |
// An InterpreterCodelet is a piece of interpreter code. All |
|
45 |
// interpreter code is generated into little codelets which |
|
46 |
// contain extra information for debugging and printing purposes. |
|
47 |
||
48 |
class InterpreterCodelet: public Stub { |
|
49 |
friend class VMStructs; |
|
50 |
private: |
|
51 |
int _size; // the size in bytes |
|
52 |
const char* _description; // a description of the codelet, for debugging & printing |
|
53 |
Bytecodes::Code _bytecode; // associated bytecode if any |
|
16368
713209c45a82
8008555: Debugging code in compiled method sometimes leaks memory
roland
parents:
13963
diff
changeset
|
54 |
DEBUG_ONLY(CodeStrings _strings;) // Comments for annotating assembler output. |
1 | 55 |
|
56 |
public: |
|
57 |
// Initialization/finalization |
|
13887
89b873bcc55b
7200163: add CodeComments functionality to assember stubs
kvn
parents:
8921
diff
changeset
|
58 |
void initialize(int size, |
26432 | 59 |
CodeStrings& strings) { _size = size; |
60 |
DEBUG_ONLY(::new(&_strings) CodeStrings();) |
|
61 |
DEBUG_ONLY(_strings.assign(strings);) } |
|
1 | 62 |
void finalize() { ShouldNotCallThis(); } |
63 |
||
64 |
// General info/converters |
|
65 |
int size() const { return _size; } |
|
66 |
static int code_size_to_size(int code_size) { return round_to(sizeof(InterpreterCodelet), CodeEntryAlignment) + code_size; } |
|
67 |
||
68 |
// Code info |
|
69 |
address code_begin() const { return (address)this + round_to(sizeof(InterpreterCodelet), CodeEntryAlignment); } |
|
70 |
address code_end() const { return (address)this + size(); } |
|
71 |
||
72 |
// Debugging |
|
73 |
void verify(); |
|
6176
4d9030fe341f
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
5547
diff
changeset
|
74 |
void print_on(outputStream* st) const; |
4d9030fe341f
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
5547
diff
changeset
|
75 |
void print() const { print_on(tty); } |
1 | 76 |
|
77 |
// Interpreter-specific initialization |
|
78 |
void initialize(const char* description, Bytecodes::Code bytecode); |
|
79 |
||
80 |
// Interpreter-specific attributes |
|
81 |
int code_size() const { return code_end() - code_begin(); } |
|
82 |
const char* description() const { return _description; } |
|
83 |
Bytecodes::Code bytecode() const { return _bytecode; } |
|
84 |
}; |
|
85 |
||
86 |
// Define a prototype interface |
|
87 |
DEF_STUB_INTERFACE(InterpreterCodelet); |
|
88 |
||
89 |
||
90 |
//------------------------------------------------------------------------------------------------------------------------ |
|
91 |
// A CodeletMark serves as an automatic creator/initializer for Codelets |
|
92 |
// (As a subclass of ResourceMark it automatically GC's the allocated |
|
93 |
// code buffer and assemblers). |
|
94 |
||
95 |
class CodeletMark: ResourceMark { |
|
96 |
private: |
|
97 |
InterpreterCodelet* _clet; |
|
98 |
InterpreterMacroAssembler** _masm; |
|
99 |
CodeBuffer _cb; |
|
100 |
||
101 |
int codelet_size() { |
|
102 |
// Request the whole code buffer (minus a little for alignment). |
|
103 |
// The commit call below trims it back for each codelet. |
|
104 |
int codelet_size = AbstractInterpreter::code()->available_space() - 2*K; |
|
105 |
||
106 |
// 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
|
107 |
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
|
108 |
"not enough space for interpreter generation"); |
1 | 109 |
|
110 |
return codelet_size; |
|
111 |
} |
|
112 |
||
113 |
public: |
|
25715
d5a8dbdc5150
8049325: Introduce and clean up umbrella headers for the files in the cpu subdirectories.
goetz
parents:
22234
diff
changeset
|
114 |
CodeletMark(InterpreterMacroAssembler*& masm, |
d5a8dbdc5150
8049325: Introduce and clean up umbrella headers for the files in the cpu subdirectories.
goetz
parents:
22234
diff
changeset
|
115 |
const char* description, |
d5a8dbdc5150
8049325: Introduce and clean up umbrella headers for the files in the cpu subdirectories.
goetz
parents:
22234
diff
changeset
|
116 |
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
|
117 |
~CodeletMark(); |
1 | 118 |
}; |
119 |
||
120 |
// Wrapper classes to produce Interpreter/InterpreterGenerator from either |
|
121 |
// the c++ interpreter or the template interpreter. |
|
122 |
||
123 |
class Interpreter: public CC_INTERP_ONLY(CppInterpreter) NOT_CC_INTERP(TemplateInterpreter) { |
|
124 |
||
25715
d5a8dbdc5150
8049325: Introduce and clean up umbrella headers for the files in the cpu subdirectories.
goetz
parents:
22234
diff
changeset
|
125 |
public: |
1 | 126 |
// Debugging/printing |
25715
d5a8dbdc5150
8049325: Introduce and clean up umbrella headers for the files in the cpu subdirectories.
goetz
parents:
22234
diff
changeset
|
127 |
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
|
128 |
|
7397 | 129 |
#ifdef TARGET_ARCH_x86 |
130 |
# include "interpreter_x86.hpp" |
|
131 |
#endif |
|
132 |
#ifdef TARGET_ARCH_sparc |
|
133 |
# include "interpreter_sparc.hpp" |
|
134 |
#endif |
|
135 |
#ifdef TARGET_ARCH_zero |
|
136 |
# include "interpreter_zero.hpp" |
|
137 |
#endif |
|
8107
78e5bd944384
7016023: Enable building ARM and PPC from src/closed repository
bobv
parents:
7397
diff
changeset
|
138 |
#ifdef TARGET_ARCH_arm |
78e5bd944384
7016023: Enable building ARM and PPC from src/closed repository
bobv
parents:
7397
diff
changeset
|
139 |
# include "interpreter_arm.hpp" |
78e5bd944384
7016023: Enable building ARM and PPC from src/closed repository
bobv
parents:
7397
diff
changeset
|
140 |
#endif |
78e5bd944384
7016023: Enable building ARM and PPC from src/closed repository
bobv
parents:
7397
diff
changeset
|
141 |
#ifdef TARGET_ARCH_ppc |
78e5bd944384
7016023: Enable building ARM and PPC from src/closed repository
bobv
parents:
7397
diff
changeset
|
142 |
# include "interpreter_ppc.hpp" |
78e5bd944384
7016023: Enable building ARM and PPC from src/closed repository
bobv
parents:
7397
diff
changeset
|
143 |
#endif |
7397 | 144 |
|
1 | 145 |
}; |
7397 | 146 |
|
147 |
#endif // SHARE_VM_INTERPRETER_INTERPRETER_HPP |