author | coleenp |
Thu, 23 Jul 2015 15:17:58 -0400 | |
changeset 31981 | 9caa094a485f |
parent 31620 | 53be635ad49c |
permissions | -rw-r--r-- |
31620
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
1 |
/* |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
2 |
* Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
4 |
* |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
8 |
* |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
13 |
* accompanied this code). |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
14 |
* |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
18 |
* |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
21 |
* questions. |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
22 |
* |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
23 |
*/ |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
24 |
|
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
25 |
#ifndef SHARE_VM_CODE_CODE_CACHE_EXTENSIONS_EXT_HPP |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
26 |
#define SHARE_VM_CODE_CODE_CACHE_EXTENSIONS_EXT_HPP |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
27 |
|
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
28 |
#include "utilities/macros.hpp" |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
29 |
#include "memory/allocation.hpp" |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
30 |
#include "utilities/globalDefinitions.hpp" |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
31 |
#include "interpreter/bytecodes.hpp" |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
32 |
|
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
33 |
class AdapterHandlerEntry; |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
34 |
class CodeBlob; |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
35 |
class CodeBuffer; |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
36 |
class InterpreterMacroAssembler; |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
37 |
class Template; |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
38 |
|
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
39 |
// All the methods defined here are placeholders for possible extensions. |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
40 |
|
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
41 |
class CodeCacheExtensions: AllStatic { |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
42 |
friend class CodeCacheDumper; |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
43 |
|
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
44 |
public: |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
45 |
// init both code saving and loading |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
46 |
// Must be called very early, before any code is generated. |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
47 |
static void initialize() {} |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
48 |
|
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
49 |
// Check whether the generated interpreter will be saved. |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
50 |
static bool saving_generated_interpreter() { return false; } |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
51 |
|
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
52 |
// Check whether a pregenerated interpreter is used. |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
53 |
static bool use_pregenerated_interpreter() { return false; } |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
54 |
|
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
55 |
// Placeholder for additional VM initialization code |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
56 |
static void complete_step(CodeCacheExtensionsSteps::Step phase) {} |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
57 |
|
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
58 |
// Return false for newly generated code, on systems where it is not |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
59 |
// executable. |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
60 |
static bool is_executable(void *pc) { return true; } |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
61 |
|
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
62 |
// Return whether dynamically generated code can be executable |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
63 |
static bool support_dynamic_code() { return true; } |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
64 |
|
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
65 |
// Skip new code generation when known to be useless. |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
66 |
static bool skip_code_generation() { return false; } |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
67 |
|
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
68 |
// Skip stubs used only for compiled code support. |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
69 |
static bool skip_compiler_support() { return false; } |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
70 |
|
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
71 |
// Ignore UseFastSignatureHandlers when returning false |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
72 |
static bool support_fast_signature_handlers() { return true; } |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
73 |
|
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
74 |
///////////////////////// |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
75 |
// Handle generated code: |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
76 |
// - allow newly generated code to be shared |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
77 |
// - allow pregenerated code to be used in place of the newly generated one |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
78 |
// (modifying pc). |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
79 |
// - support remapping when doing both save and load |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
80 |
// 'remap' can be set to false if the addresses handled are not referenced |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
81 |
// from code generated later. |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
82 |
|
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
83 |
// Associate a name to a generated codelet and possibly modify the pc |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
84 |
// Note: use instead the specialized versions when they exist: |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
85 |
// - handle_generated_blob for CodeBlob |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
86 |
// - handle_generated_handler for SignatureHandlers |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
87 |
// See also the optimized calls below that handle several PCs at once. |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
88 |
static void handle_generated_pc(address &pc, const char *name) {} |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
89 |
|
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
90 |
// Adds a safe definition of the codelet, for codelets used right after |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
91 |
// generation (else we would need to immediately stop the JVM and convert |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
92 |
// the generated code to executable format before being able to go further). |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
93 |
static void handle_generated_pc(address &pc, const char *name, address default_entry) {} |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
94 |
|
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
95 |
// Special cases |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
96 |
|
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
97 |
// Special case for CodeBlobs, which may require blob specific actions. |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
98 |
static CodeBlob* handle_generated_blob(CodeBlob* blob, const char *name = NULL) { return blob; } |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
99 |
|
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
100 |
// Special case for Signature Handlers. |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
101 |
static void handle_generated_handler(address &handler_start, const char *name, address handler_end) {} |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
102 |
|
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
103 |
// Support for generating different variants of the interpreter |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
104 |
// that can be dynamically selected after reload. |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
105 |
// |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
106 |
// - init_interpreter_assembler allows to configure the assembler for |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
107 |
// the current variant |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
108 |
// |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
109 |
// - needs_other_interpreter_variant returns true as long as other |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
110 |
// variants are needed. |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
111 |
// |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
112 |
// - skip_template_interpreter_entries returns true if new entries |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
113 |
// need not be generated for this masm setup and this bytecode |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
114 |
// |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
115 |
// - completed_template_interpreter_entries is called after new |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
116 |
// entries have been generated and installed, for any non skipped |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
117 |
// bytecode. |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
118 |
static void init_interpreter_assembler(InterpreterMacroAssembler* masm, CodeBuffer* code) {} |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
119 |
static bool needs_other_interpreter_variant() { return false; } |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
120 |
static bool skip_template_interpreter_entries(Bytecodes::Code code) { return false; } |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
121 |
static void completed_template_interpreter_entries(InterpreterMacroAssembler* masm, Bytecodes::Code code) {} |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
122 |
|
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
123 |
// Code size optimization. May optimize the requested size. |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
124 |
static void size_blob(const char* name, int *updatable_size) {} |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
125 |
|
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
126 |
// ergonomics |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
127 |
static void set_ergonomics_flags() {} |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
128 |
}; |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
129 |
|
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
diff
changeset
|
130 |
#endif // SHARE_VM_CODE_CODE_CACHE_EXTENSIONS_EXT_HPP |