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 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "code/codeCacheExtensions.hpp"
27 #include "interpreter/interpreter.hpp"
28 #include "interpreter/interpreterRuntime.hpp"
29 #include "interpreter/interp_masm.hpp"
30 #include "interpreter/templateInterpreter.hpp"
31 #include "interpreter/templateInterpreterGenerator.hpp"
32 #include "interpreter/templateTable.hpp"
33 #include "memory/resourceArea.hpp"
34 #include "runtime/timerTrace.hpp"
35
36 #ifndef CC_INTERP
37
38 # define __ _masm->
39
40 void TemplateInterpreter::initialize() {
41 if (_code != NULL) return;
42 // assertions
43 assert((int)Bytecodes::number_of_codes <= (int)DispatchTable::length,
44 "dispatch table too small");
45
46 AbstractInterpreter::initialize();
47
48 TemplateTable::initialize();
49
50 // generate interpreter
51 { ResourceMark rm;
52 TraceTime timer("Interpreter generation", TRACETIME_LOG(Info, startuptime));
53 int code_size = InterpreterCodeSize;
54 NOT_PRODUCT(code_size *= 4;) // debug uses extra interpreter code space
55 #if INCLUDE_JVMTI
56 if (CodeCacheExtensions::saving_generated_interpreter()) {
57 // May requires several versions of the codelets.
58 // Final size will automatically be optimized.
59 code_size *= 2;
60 }
61 #endif
62 _code = new StubQueue(new InterpreterCodeletInterface, code_size, NULL,
63 "Interpreter");
64 TemplateInterpreterGenerator g(_code);
65 }
66 if (PrintInterpreter) {
67 if (CodeCacheExtensions::saving_generated_interpreter() &&
68 CodeCacheExtensions::use_pregenerated_interpreter()) {
69 ResourceMark rm;
70 tty->print("Printing the newly generated interpreter first");
71 print();
72 tty->print("Printing the pregenerated interpreter next");
73 }
74 }
75
76 // Install the pregenerated interpreter code before printing it
77 CodeCacheExtensions::complete_step(CodeCacheExtensionsSteps::TemplateInterpreter);
78
79 if (PrintInterpreter) {
80 ResourceMark rm;
81 print();
82 }
83
84 // initialize dispatch table
85 _active_table = _normal_table;
86 }
87
88 //------------------------------------------------------------------------------------------------------------------------
89 // Implementation of EntryPoint
90
91 EntryPoint::EntryPoint() {
92 assert(number_of_states == 10, "check the code below");
93 _entry[btos] = NULL;
94 _entry[ztos] = NULL;
95 _entry[ctos] = NULL;
96 _entry[stos] = NULL;
97 _entry[atos] = NULL;
|
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 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "interpreter/interpreter.hpp"
27 #include "interpreter/interpreterRuntime.hpp"
28 #include "interpreter/interp_masm.hpp"
29 #include "interpreter/templateInterpreter.hpp"
30 #include "interpreter/templateInterpreterGenerator.hpp"
31 #include "interpreter/templateTable.hpp"
32 #include "memory/resourceArea.hpp"
33 #include "runtime/timerTrace.hpp"
34
35 #ifndef CC_INTERP
36
37 # define __ _masm->
38
39 void TemplateInterpreter::initialize() {
40 if (_code != NULL) return;
41 // assertions
42 assert((int)Bytecodes::number_of_codes <= (int)DispatchTable::length,
43 "dispatch table too small");
44
45 AbstractInterpreter::initialize();
46
47 TemplateTable::initialize();
48
49 // generate interpreter
50 { ResourceMark rm;
51 TraceTime timer("Interpreter generation", TRACETIME_LOG(Info, startuptime));
52 int code_size = InterpreterCodeSize;
53 NOT_PRODUCT(code_size *= 4;) // debug uses extra interpreter code space
54 _code = new StubQueue(new InterpreterCodeletInterface, code_size, NULL,
55 "Interpreter");
56 TemplateInterpreterGenerator g(_code);
57 }
58
59 if (PrintInterpreter) {
60 ResourceMark rm;
61 print();
62 }
63
64 // initialize dispatch table
65 _active_table = _normal_table;
66 }
67
68 //------------------------------------------------------------------------------------------------------------------------
69 // Implementation of EntryPoint
70
71 EntryPoint::EntryPoint() {
72 assert(number_of_states == 10, "check the code below");
73 _entry[btos] = NULL;
74 _entry[ztos] = NULL;
75 _entry[ctos] = NULL;
76 _entry[stos] = NULL;
77 _entry[atos] = NULL;
|