author | stefank |
Thu, 13 Apr 2017 09:57:51 +0200 | |
changeset 46620 | 750c6edff33b |
parent 35214 | d86005e0b4c2 |
child 46625 | edefffab74e2 |
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 |
|
2131 | 33 |
// This file contains the platform-independent parts |
1 | 34 |
// of the interpreter and the interpreter generator. |
35 |
||
25715
d5a8dbdc5150
8049325: Introduce and clean up umbrella headers for the files in the cpu subdirectories.
goetz
parents:
22234
diff
changeset
|
36 |
class InterpreterMacroAssembler; |
d5a8dbdc5150
8049325: Introduce and clean up umbrella headers for the files in the cpu subdirectories.
goetz
parents:
22234
diff
changeset
|
37 |
|
1 | 38 |
//------------------------------------------------------------------------------------------------------------------------ |
39 |
// An InterpreterCodelet is a piece of interpreter code. All |
|
40 |
// interpreter code is generated into little codelets which |
|
41 |
// contain extra information for debugging and printing purposes. |
|
42 |
||
43 |
class InterpreterCodelet: public Stub { |
|
44 |
friend class VMStructs; |
|
31620
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
30601
diff
changeset
|
45 |
friend class CodeCacheDumper; // possible extension [do not remove] |
1 | 46 |
private: |
47 |
int _size; // the size in bytes |
|
48 |
const char* _description; // a description of the codelet, for debugging & printing |
|
49 |
Bytecodes::Code _bytecode; // associated bytecode if any |
|
16368
713209c45a82
8008555: Debugging code in compiled method sometimes leaks memory
roland
parents:
13963
diff
changeset
|
50 |
DEBUG_ONLY(CodeStrings _strings;) // Comments for annotating assembler output. |
1 | 51 |
|
52 |
public: |
|
53 |
// Initialization/finalization |
|
13887
89b873bcc55b
7200163: add CodeComments functionality to assember stubs
kvn
parents:
8921
diff
changeset
|
54 |
void initialize(int size, |
26432 | 55 |
CodeStrings& strings) { _size = size; |
56 |
DEBUG_ONLY(::new(&_strings) CodeStrings();) |
|
57 |
DEBUG_ONLY(_strings.assign(strings);) } |
|
1 | 58 |
void finalize() { ShouldNotCallThis(); } |
59 |
||
60 |
// General info/converters |
|
61 |
int size() const { return _size; } |
|
46620
750c6edff33b
8178500: Replace usages of round_to and round_down with align_up and align_down
stefank
parents:
35214
diff
changeset
|
62 |
static int code_size_to_size(int code_size) { return align_up((int)sizeof(InterpreterCodelet), CodeEntryAlignment) + code_size; } |
1 | 63 |
|
64 |
// Code info |
|
46620
750c6edff33b
8178500: Replace usages of round_to and round_down with align_up and align_down
stefank
parents:
35214
diff
changeset
|
65 |
address code_begin() const { return (address)this + align_up(sizeof(InterpreterCodelet), CodeEntryAlignment); } |
1 | 66 |
address code_end() const { return (address)this + size(); } |
67 |
||
68 |
// Debugging |
|
69 |
void verify(); |
|
6176
4d9030fe341f
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
5547
diff
changeset
|
70 |
void print_on(outputStream* st) const; |
4d9030fe341f
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
5547
diff
changeset
|
71 |
void print() const { print_on(tty); } |
1 | 72 |
|
73 |
// Interpreter-specific initialization |
|
74 |
void initialize(const char* description, Bytecodes::Code bytecode); |
|
75 |
||
76 |
// Interpreter-specific attributes |
|
77 |
int code_size() const { return code_end() - code_begin(); } |
|
78 |
const char* description() const { return _description; } |
|
79 |
Bytecodes::Code bytecode() const { return _bytecode; } |
|
80 |
}; |
|
81 |
||
82 |
// Define a prototype interface |
|
83 |
DEF_STUB_INTERFACE(InterpreterCodelet); |
|
84 |
||
85 |
||
86 |
//------------------------------------------------------------------------------------------------------------------------ |
|
87 |
// A CodeletMark serves as an automatic creator/initializer for Codelets |
|
88 |
// (As a subclass of ResourceMark it automatically GC's the allocated |
|
89 |
// code buffer and assemblers). |
|
90 |
||
91 |
class CodeletMark: ResourceMark { |
|
92 |
private: |
|
93 |
InterpreterCodelet* _clet; |
|
94 |
InterpreterMacroAssembler** _masm; |
|
95 |
CodeBuffer _cb; |
|
96 |
||
97 |
int codelet_size() { |
|
98 |
// Request the whole code buffer (minus a little for alignment). |
|
99 |
// The commit call below trims it back for each codelet. |
|
100 |
int codelet_size = AbstractInterpreter::code()->available_space() - 2*K; |
|
101 |
||
102 |
// 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
|
103 |
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
|
104 |
"not enough space for interpreter generation"); |
1 | 105 |
|
106 |
return codelet_size; |
|
107 |
} |
|
108 |
||
109 |
public: |
|
25715
d5a8dbdc5150
8049325: Introduce and clean up umbrella headers for the files in the cpu subdirectories.
goetz
parents:
22234
diff
changeset
|
110 |
CodeletMark(InterpreterMacroAssembler*& masm, |
d5a8dbdc5150
8049325: Introduce and clean up umbrella headers for the files in the cpu subdirectories.
goetz
parents:
22234
diff
changeset
|
111 |
const char* description, |
d5a8dbdc5150
8049325: Introduce and clean up umbrella headers for the files in the cpu subdirectories.
goetz
parents:
22234
diff
changeset
|
112 |
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
|
113 |
~CodeletMark(); |
1 | 114 |
}; |
115 |
||
35214 | 116 |
// Wrapper typedef to use the name Interpreter to mean either |
1 | 117 |
// the c++ interpreter or the template interpreter. |
118 |
||
35214 | 119 |
typedef CC_INTERP_ONLY(CppInterpreter) NOT_CC_INTERP(TemplateInterpreter) Interpreter; |
7397 | 120 |
|
121 |
#endif // SHARE_VM_INTERPRETER_INTERPRETER_HPP |