annotate src/share/vm/graal/graalVMToCompiler.hpp @ 15870:fe608a56e3f7

made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
author Doug Simon <doug.simon@oracle.com>
date Fri, 23 May 2014 19:36:34 +0200
parents 063ec2920d21
children af0e42dad358
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2516
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
1 /*
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
2 * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
4 *
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
7 * published by the Free Software Foundation.
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
8 *
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
13 * accompanied this code).
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
14 *
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
15 * You should have received a copy of the GNU General Public License version
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
18 *
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
21 * questions.
1414
e1a275dbc8cd Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1413
diff changeset
22 */
e1a275dbc8cd Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1413
diff changeset
23
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5554
diff changeset
24 #ifndef SHARE_VM_GRAAL_GRAAL_VM_TO_COMPILER_HPP
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5554
diff changeset
25 #define SHARE_VM_GRAAL_GRAAL_VM_TO_COMPILER_HPP
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5554
diff changeset
26
2663
d7c0775d7e72 added includes to build without precompiled headers
Christian.Wimmer@Oracle.com
parents: 2516
diff changeset
27 #include "memory/allocation.hpp"
d7c0775d7e72 added includes to build without precompiled headers
Christian.Wimmer@Oracle.com
parents: 2516
diff changeset
28 #include "oops/oop.hpp"
d7c0775d7e72 added includes to build without precompiled headers
Christian.Wimmer@Oracle.com
parents: 2516
diff changeset
29 #include "runtime/handles.hpp"
d7c0775d7e72 added includes to build without precompiled headers
Christian.Wimmer@Oracle.com
parents: 2516
diff changeset
30 #include "runtime/thread.hpp"
d7c0775d7e72 added includes to build without precompiled headers
Christian.Wimmer@Oracle.com
parents: 2516
diff changeset
31 #include "classfile/javaClasses.hpp"
d7c0775d7e72 added includes to build without precompiled headers
Christian.Wimmer@Oracle.com
parents: 2516
diff changeset
32 #include "runtime/jniHandles.hpp"
d7c0775d7e72 added includes to build without precompiled headers
Christian.Wimmer@Oracle.com
parents: 2516
diff changeset
33 #include "runtime/javaCalls.hpp"
d7c0775d7e72 added includes to build without precompiled headers
Christian.Wimmer@Oracle.com
parents: 2516
diff changeset
34
4220
5c80ccb80036 Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4139
diff changeset
35 class VMToCompiler : public AllStatic {
1414
e1a275dbc8cd Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1413
diff changeset
36
e1a275dbc8cd Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1413
diff changeset
37 private:
15582
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
38 static jobject _HotSpotGraalRuntime_instance;
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
39 static jobject _VMToCompiler_instance;
1414
e1a275dbc8cd Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1413
diff changeset
40
15582
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
41 static Klass* _VMToCompiler_klass;
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
42
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
43 static KlassHandle VMToCompiler_klass();
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
44 static Handle VMToCompiler_instance();
1421
6223633ce7dd changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1414
diff changeset
45
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
46 public:
15582
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
47 // Gets the singleton HotSpotGraalRuntime instance, initializing it if necessary
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
48 static Handle get_HotSpotGraalRuntime();
1421
6223633ce7dd changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1414
diff changeset
49
15582
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
50 // Creates a new HotSpotTruffleRuntime object
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
51 static Handle create_HotSpotTruffleRuntime();
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
52
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
53 static jobject get_HotSpotGraalRuntime_jobject() {
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
54 get_HotSpotGraalRuntime();
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
55 return _HotSpotGraalRuntime_instance;
5526
87e4aed94b26 Remove HotSpotCompiler interface, let HotSpotCompilerImpl implement GraalRuntime (in preparation of renaming).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5278
diff changeset
56 }
87e4aed94b26 Remove HotSpotCompiler interface, let HotSpotCompilerImpl implement GraalRuntime (in preparation of renaming).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5278
diff changeset
57
15870
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents: 15582
diff changeset
58 // public static void HotSpotOptions.setOption(String name, OptionValue<?> option, char spec, String stringValue, long primitiveValue);
fe608a56e3f7 made HotSpotOptions processing faster by removing use of service loader in VM startup and only doing work for options specified on the command line
Doug Simon <doug.simon@oracle.com>
parents: 15582
diff changeset
59 static void setOption(KlassHandle hotSpotOptionsClass, Handle name, Handle option, jchar spec, Handle stringValue, jlong primitiveValue);
15582
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
60
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
61 #ifdef COMPILERGRAAL
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
62 // public abstract void startCompiler(boolean bootstrapEnabled);
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
63 static void startCompiler(jboolean bootstrap_enabled);
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
64
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
65 // public abstract void bootstrap();
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
66 static void bootstrap();
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
67
15463
a20be10ad437 made Graal work with the HotSpot compiler queue and compiler threads, enabled by -XX:-UseGraalCompilationQueue
Doug Simon <doug.simon@oracle.com>
parents: 15106
diff changeset
68 // public abstract boolean compileMethod(long metaspaceMethod, int entryBCI, long ctask, boolean blocking);
a20be10ad437 made Graal work with the HotSpot compiler queue and compiler threads, enabled by -XX:-UseGraalCompilationQueue
Doug Simon <doug.simon@oracle.com>
parents: 15106
diff changeset
69 static void compileMethod(Method* method, int entry_bci, jlong ctask, jboolean blocking);
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
70
2901
d577d07cedec Added time measurement for phases.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2890
diff changeset
71 // public abstract void shutdownCompiler();
d577d07cedec Added time measurement for phases.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2890
diff changeset
72 static void shutdownCompiler();
15582
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
73 #endif
3650
0e8a2a629afb Pass-by compilation broker.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3632
diff changeset
74
15582
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
75 // public abstract void shutdownRuntime();
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
76 static void shutdownRuntime();
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
77
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
78 #ifndef PRODUCT
12652
0dd597c6c9c7 fixed performance regression in hosted CompileTheWorld
Doug Simon <doug.simon@oracle.com>
parents: 11585
diff changeset
79 // public abstract void compileTheWorld();
0dd597c6c9c7 fixed performance regression in hosted CompileTheWorld
Doug Simon <doug.simon@oracle.com>
parents: 11585
diff changeset
80 static void compileTheWorld();
15582
063ec2920d21 made Graal runtime initialization in hosted mode lazy
Doug Simon <doug.simon@oracle.com>
parents: 15463
diff changeset
81 #endif
1421
6223633ce7dd changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1414
diff changeset
82 };
6223633ce7dd changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1414
diff changeset
83
2284
569d3fe7d65c non-static VMEntries and VMExits, CompilationServer simplifications
Lukas Stadler <lukas.stadler@jku.at>
parents: 1941
diff changeset
84 inline void check_pending_exception(const char* message, bool dump_core = false) {
1441
f8ab19e5acae Fix oop relocation for static stub calls.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1437
diff changeset
85 Thread* THREAD = Thread::current();
f8ab19e5acae Fix oop relocation for static stub calls.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1437
diff changeset
86 if (THREAD->has_pending_exception()) {
1442
50ff0b5b971b Improved exception reporting after exception in compileMethod.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1441
diff changeset
87 Handle exception = PENDING_EXCEPTION;
50ff0b5b971b Improved exception reporting after exception in compileMethod.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1441
diff changeset
88 CLEAR_PENDING_EXCEPTION;
3601
3822c5969a8b better error messages for missing MAXINE env var and exceptions thrown by the compiler
Lukas Stadler <lukas.stadler@jku.at>
parents: 3011
diff changeset
89
3822c5969a8b better error messages for missing MAXINE env var and exceptions thrown by the compiler
Lukas Stadler <lukas.stadler@jku.at>
parents: 3011
diff changeset
90 assert(exception->is_a(SystemDictionary::Throwable_klass()), "Throwable instance expected");
3822c5969a8b better error messages for missing MAXINE env var and exceptions thrown by the compiler
Lukas Stadler <lukas.stadler@jku.at>
parents: 3011
diff changeset
91 JavaValue result(T_VOID);
3822c5969a8b better error messages for missing MAXINE env var and exceptions thrown by the compiler
Lukas Stadler <lukas.stadler@jku.at>
parents: 3011
diff changeset
92 JavaCalls::call_virtual(&result,
3822c5969a8b better error messages for missing MAXINE env var and exceptions thrown by the compiler
Lukas Stadler <lukas.stadler@jku.at>
parents: 3011
diff changeset
93 exception,
3822c5969a8b better error messages for missing MAXINE env var and exceptions thrown by the compiler
Lukas Stadler <lukas.stadler@jku.at>
parents: 3011
diff changeset
94 KlassHandle(THREAD,
3822c5969a8b better error messages for missing MAXINE env var and exceptions thrown by the compiler
Lukas Stadler <lukas.stadler@jku.at>
parents: 3011
diff changeset
95 SystemDictionary::Throwable_klass()),
3822c5969a8b better error messages for missing MAXINE env var and exceptions thrown by the compiler
Lukas Stadler <lukas.stadler@jku.at>
parents: 3011
diff changeset
96 vmSymbols::printStackTrace_name(),
3822c5969a8b better error messages for missing MAXINE env var and exceptions thrown by the compiler
Lukas Stadler <lukas.stadler@jku.at>
parents: 3011
diff changeset
97 vmSymbols::void_method_signature(),
3822c5969a8b better error messages for missing MAXINE env var and exceptions thrown by the compiler
Lukas Stadler <lukas.stadler@jku.at>
parents: 3011
diff changeset
98 THREAD);
3822c5969a8b better error messages for missing MAXINE env var and exceptions thrown by the compiler
Lukas Stadler <lukas.stadler@jku.at>
parents: 3011
diff changeset
99
2284
569d3fe7d65c non-static VMEntries and VMExits, CompilationServer simplifications
Lukas Stadler <lukas.stadler@jku.at>
parents: 1941
diff changeset
100 vm_abort(dump_core);
1421
6223633ce7dd changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1414
diff changeset
101 }
6223633ce7dd changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1414
diff changeset
102 }
2285
762de4b26788 turn Compiler and HotSpotTypeResolved into interfaces
Lukas Stadler <lukas.stadler@jku.at>
parents: 2284
diff changeset
103
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5554
diff changeset
104 #endif // SHARE_VM_GRAAL_GRAAL_VM_TO_COMPILER_HPP