Mercurial > hg > truffle
annotate src/share/vm/graal/graalCompiler.cpp @ 3634:076542d505cd
Remove the need for a global stub array.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Mon, 14 Nov 2011 22:38:54 +0100 |
parents | 136ea96eb7f8 |
children | ff6a991c6e3c |
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. |
1410
b30a2cd5e3a2
Added methods to c1x_VMExits.cpp
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1407
diff
changeset
|
22 */ |
b30a2cd5e3a2
Added methods to c1x_VMExits.cpp
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1407
diff
changeset
|
23 |
2045
9c96c873c42b
Fix includes to match new hotspot mechanism.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1942
diff
changeset
|
24 #include "precompiled.hpp" |
2891
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2890
diff
changeset
|
25 #include "graal/graalCompiler.hpp" |
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2890
diff
changeset
|
26 #include "graal/graalJavaAccess.hpp" |
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2890
diff
changeset
|
27 #include "graal/graalVMExits.hpp" |
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2890
diff
changeset
|
28 #include "graal/graalVMEntries.hpp" |
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2890
diff
changeset
|
29 #include "graal/graalVmIds.hpp" |
2045
9c96c873c42b
Fix includes to match new hotspot mechanism.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1942
diff
changeset
|
30 #include "c1/c1_Runtime1.hpp" |
2663
d7c0775d7e72
added includes to build without precompiled headers
Christian.Wimmer@Oracle.com
parents:
2516
diff
changeset
|
31 #include "runtime/arguments.hpp" |
1406
35069ca331f2
Hooked C1XCompiler class into the system.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff
changeset
|
32 |
2891
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2890
diff
changeset
|
33 GraalCompiler* GraalCompiler::_instance = NULL; |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
34 |
2891
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2890
diff
changeset
|
35 GraalCompiler::GraalCompiler() { |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
36 _initialized = false; |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
37 assert(_instance == NULL, "only one instance allowed"); |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
38 _instance = this; |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
39 } |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
40 |
1406
35069ca331f2
Hooked C1XCompiler class into the system.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff
changeset
|
41 // Initialization |
2891
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2890
diff
changeset
|
42 void GraalCompiler::initialize() { |
1414
e1a275dbc8cd
Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1413
diff
changeset
|
43 if (_initialized) return; |
3064
8b0236cbed14
Make sure that the compiler is initialized at startup (and not on the first compiled method).
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
3055
diff
changeset
|
44 _initialized = true; |
1931
48bbaead8b6c
Adjustments after merge with OpenJDK repository.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1483
diff
changeset
|
45 CompilerThread* THREAD = CompilerThread::current(); |
2891
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2890
diff
changeset
|
46 TRACE_graal_1("GraalCompiler::initialize"); |
1412
9195b99c841b
Added first VM entry method.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1410
diff
changeset
|
47 |
1931
48bbaead8b6c
Adjustments after merge with OpenJDK repository.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1483
diff
changeset
|
48 initialize_buffer_blob(); |
48bbaead8b6c
Adjustments after merge with OpenJDK repository.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1483
diff
changeset
|
49 Runtime1::initialize(THREAD->get_buffer_blob()); |
48bbaead8b6c
Adjustments after merge with OpenJDK repository.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1483
diff
changeset
|
50 |
1432
b61a43cd1255
sourcecode formatting
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
51 JNIEnv *env = ((JavaThread *) Thread::current())->jni_environment(); |
3586
7604c69a6301
rename com.oracle.max.graal.runtime to com.oracle.max.graal.hotspot
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
3576
diff
changeset
|
52 jclass klass = env->FindClass("com/oracle/max/graal/hotspot/VMEntriesNative"); |
1483
ba37b9335e1e
New option "-graal" that sets up the correct boot class path and C1X options using only the two environment variables MAXINE and GRAAL.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1476
diff
changeset
|
53 if (klass == NULL) { |
2891
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2890
diff
changeset
|
54 tty->print_cr("graal VMEntries class not found"); |
2674
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
2663
diff
changeset
|
55 vm_abort(false); |
1483
ba37b9335e1e
New option "-graal" that sets up the correct boot class path and C1X options using only the two environment variables MAXINE and GRAAL.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1476
diff
changeset
|
56 } |
1432
b61a43cd1255
sourcecode formatting
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
57 env->RegisterNatives(klass, VMEntries_methods, VMEntries_methods_count()); |
b61a43cd1255
sourcecode formatting
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
58 |
1452
9b22e3e5df8e
Solved an issue with unresolved field patching.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1449
diff
changeset
|
59 { |
9b22e3e5df8e
Solved an issue with unresolved field patching.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1449
diff
changeset
|
60 VM_ENTRY_MARK; |
9b22e3e5df8e
Solved an issue with unresolved field patching.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1449
diff
changeset
|
61 check_pending_exception("Could not register natives"); |
9b22e3e5df8e
Solved an issue with unresolved field patching.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1449
diff
changeset
|
62 } |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
63 |
2891
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2890
diff
changeset
|
64 graal_compute_offsets(); |
1437
9e5e83ca2259
Enabled -C1X:OPTIONS when running HotSpot/C1X. Enabled checkstyle for the HotSpotVM Java project.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1434
diff
changeset
|
65 |
9e5e83ca2259
Enabled -C1X:OPTIONS when running HotSpot/C1X. Enabled checkstyle for the HotSpotVM Java project.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1434
diff
changeset
|
66 { |
9e5e83ca2259
Enabled -C1X:OPTIONS when running HotSpot/C1X. Enabled checkstyle for the HotSpotVM Java project.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1434
diff
changeset
|
67 VM_ENTRY_MARK; |
9e5e83ca2259
Enabled -C1X:OPTIONS when running HotSpot/C1X. Enabled checkstyle for the HotSpotVM Java project.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1434
diff
changeset
|
68 HandleMark hm; |
2925
b78b4ae0757c
Also call Compiler shutdown hook in case of System.exit call. Draft VMExits.Sandbox class.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2901
diff
changeset
|
69 VMExits::initializeCompiler(); |
2296
34354e2e40a3
cleanups and client/server fixes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2291
diff
changeset
|
70 VMExits::setDefaultOptions(); |
2891
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2890
diff
changeset
|
71 for (int i = 0; i < Arguments::num_graal_args(); ++i) { |
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2890
diff
changeset
|
72 const char* arg = Arguments::graal_args_array()[i]; |
1437
9e5e83ca2259
Enabled -C1X:OPTIONS when running HotSpot/C1X. Enabled checkstyle for the HotSpotVM Java project.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1434
diff
changeset
|
73 Handle option = java_lang_String::create_from_str(arg, THREAD); |
2215
999f8086cc4f
More changes to make it compile and work on win64.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
2182
diff
changeset
|
74 jboolean result = VMExits::setOption(option); |
2674
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
2663
diff
changeset
|
75 if (!result) { |
2891
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2890
diff
changeset
|
76 tty->print_cr("Invalid option for graal!"); |
2674
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
2663
diff
changeset
|
77 vm_abort(false); |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
2663
diff
changeset
|
78 } |
1437
9e5e83ca2259
Enabled -C1X:OPTIONS when running HotSpot/C1X. Enabled checkstyle for the HotSpotVM Java project.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1434
diff
changeset
|
79 } |
9e5e83ca2259
Enabled -C1X:OPTIONS when running HotSpot/C1X. Enabled checkstyle for the HotSpotVM Java project.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1434
diff
changeset
|
80 } |
1406
35069ca331f2
Hooked C1XCompiler class into the system.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff
changeset
|
81 } |
35069ca331f2
Hooked C1XCompiler class into the system.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff
changeset
|
82 |
2891
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2890
diff
changeset
|
83 void GraalCompiler::initialize_buffer_blob() { |
1931
48bbaead8b6c
Adjustments after merge with OpenJDK repository.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1483
diff
changeset
|
84 |
3555
22d11b3bc561
Various hacks to be able to install machine code from a Java thread.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
3090
diff
changeset
|
85 JavaThread* THREAD = JavaThread::current(); |
1931
48bbaead8b6c
Adjustments after merge with OpenJDK repository.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1483
diff
changeset
|
86 if (THREAD->get_buffer_blob() == NULL) { |
48bbaead8b6c
Adjustments after merge with OpenJDK repository.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1483
diff
changeset
|
87 // setup CodeBuffer. Preallocate a BufferBlob of size |
48bbaead8b6c
Adjustments after merge with OpenJDK repository.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1483
diff
changeset
|
88 // NMethodSizeLimit plus some extra space for constants. |
48bbaead8b6c
Adjustments after merge with OpenJDK repository.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1483
diff
changeset
|
89 int code_buffer_size = Compilation::desired_max_code_buffer_size() + |
48bbaead8b6c
Adjustments after merge with OpenJDK repository.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1483
diff
changeset
|
90 Compilation::desired_max_constant_size(); |
2891
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2890
diff
changeset
|
91 BufferBlob* blob = BufferBlob::create("graal temporary CodeBuffer", |
1931
48bbaead8b6c
Adjustments after merge with OpenJDK repository.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1483
diff
changeset
|
92 code_buffer_size); |
48bbaead8b6c
Adjustments after merge with OpenJDK repository.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1483
diff
changeset
|
93 guarantee(blob != NULL, "must create code buffer"); |
48bbaead8b6c
Adjustments after merge with OpenJDK repository.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1483
diff
changeset
|
94 THREAD->set_buffer_blob(blob); |
48bbaead8b6c
Adjustments after merge with OpenJDK repository.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1483
diff
changeset
|
95 } |
48bbaead8b6c
Adjustments after merge with OpenJDK repository.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1483
diff
changeset
|
96 } |
48bbaead8b6c
Adjustments after merge with OpenJDK repository.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1483
diff
changeset
|
97 |
1406
35069ca331f2
Hooked C1XCompiler class into the system.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff
changeset
|
98 // Compilation entry point for methods |
2891
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2890
diff
changeset
|
99 void GraalCompiler::compile_method(ciEnv* env, ciMethod* target, int entry_bci) { |
3064
8b0236cbed14
Make sure that the compiler is initialized at startup (and not on the first compiled method).
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
3055
diff
changeset
|
100 assert(_initialized, "must already be initialized"); |
1422
3483ec571caf
* using reflected objects instead of oops
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1421
diff
changeset
|
101 VM_ENTRY_MARK; |
3483ec571caf
* using reflected objects instead of oops
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1421
diff
changeset
|
102 ResourceMark rm; |
3483ec571caf
* using reflected objects instead of oops
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1421
diff
changeset
|
103 HandleMark hm; |
1406
35069ca331f2
Hooked C1XCompiler class into the system.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff
changeset
|
104 |
2891
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2890
diff
changeset
|
105 TRACE_graal_2("GraalCompiler::compile_method"); |
2499
ad9b14650e15
Fixed an issue with RiType.superType (wrong cast in the C++ part).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
2492
diff
changeset
|
106 |
1410
b30a2cd5e3a2
Added methods to c1x_VMExits.cpp
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1407
diff
changeset
|
107 CompilerThread::current()->set_compiling(true); |
1432
b61a43cd1255
sourcecode formatting
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
108 methodOop method = (methodOop) target->get_oop(); |
3555
22d11b3bc561
Various hacks to be able to install machine code from a Java thread.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
3090
diff
changeset
|
109 Handle hotspot_method = GraalCompiler::createHotSpotMethodResolved(method, CHECK); |
3011
f00918f35c7f
inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2925
diff
changeset
|
110 VMExits::compileMethod(hotspot_method, entry_bci); |
1422
3483ec571caf
* using reflected objects instead of oops
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1421
diff
changeset
|
111 CompilerThread::current()->set_compiling(false); |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
112 |
2891
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2890
diff
changeset
|
113 TRACE_graal_2("GraalCompiler::compile_method exit"); |
1406
35069ca331f2
Hooked C1XCompiler class into the system.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff
changeset
|
114 } |
35069ca331f2
Hooked C1XCompiler class into the system.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff
changeset
|
115 |
2901
d577d07cedec
Added time measurement for phases.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2891
diff
changeset
|
116 void GraalCompiler::exit() { |
3576
c94966c5fb41
Only shut down the compiler if it was initialized.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3566
diff
changeset
|
117 if (_initialized) { |
c94966c5fb41
Only shut down the compiler if it was initialized.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3566
diff
changeset
|
118 VMExits::shutdownCompiler(); |
c94966c5fb41
Only shut down the compiler if it was initialized.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3566
diff
changeset
|
119 } |
2901
d577d07cedec
Added time measurement for phases.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2891
diff
changeset
|
120 } |
d577d07cedec
Added time measurement for phases.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2891
diff
changeset
|
121 |
1406
35069ca331f2
Hooked C1XCompiler class into the system.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff
changeset
|
122 // Print compilation timers and statistics |
2891
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2890
diff
changeset
|
123 void GraalCompiler::print_timers() { |
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2890
diff
changeset
|
124 TRACE_graal_1("GraalCompiler::print_timers"); |
1410
b30a2cd5e3a2
Added methods to c1x_VMExits.cpp
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1407
diff
changeset
|
125 } |
b30a2cd5e3a2
Added methods to c1x_VMExits.cpp
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1407
diff
changeset
|
126 |
3565
b3f0f8a01ca2
remove some ci-dependencies
Lukas Stadler <lukas.stadler@jku.at>
parents:
3555
diff
changeset
|
127 oop GraalCompiler::get_RiType(KlassHandle klass, KlassHandle accessor, TRAPS) { |
3566
b0d192f86f34
more work on ci removal
Lukas Stadler <lukas.stadler@jku.at>
parents:
3565
diff
changeset
|
128 if (klass->oop_is_instance_slow()) { |
b0d192f86f34
more work on ci removal
Lukas Stadler <lukas.stadler@jku.at>
parents:
3565
diff
changeset
|
129 assert(instanceKlass::cast(klass())->is_initialized(), "unexpected unresolved klass"); |
b0d192f86f34
more work on ci removal
Lukas Stadler <lukas.stadler@jku.at>
parents:
3565
diff
changeset
|
130 } else if (klass->oop_is_javaArray_slow()){ |
b0d192f86f34
more work on ci removal
Lukas Stadler <lukas.stadler@jku.at>
parents:
3565
diff
changeset
|
131 } else { |
b0d192f86f34
more work on ci removal
Lukas Stadler <lukas.stadler@jku.at>
parents:
3565
diff
changeset
|
132 klass()->print(); |
b0d192f86f34
more work on ci removal
Lukas Stadler <lukas.stadler@jku.at>
parents:
3565
diff
changeset
|
133 assert(false, "unexpected klass"); |
b0d192f86f34
more work on ci removal
Lukas Stadler <lukas.stadler@jku.at>
parents:
3565
diff
changeset
|
134 } |
3565
b3f0f8a01ca2
remove some ci-dependencies
Lukas Stadler <lukas.stadler@jku.at>
parents:
3555
diff
changeset
|
135 Handle name = VmIds::toString<Handle>(klass->name(), THREAD); |
b3f0f8a01ca2
remove some ci-dependencies
Lukas Stadler <lukas.stadler@jku.at>
parents:
3555
diff
changeset
|
136 return createHotSpotTypeResolved(klass, name, CHECK_NULL); |
b3f0f8a01ca2
remove some ci-dependencies
Lukas Stadler <lukas.stadler@jku.at>
parents:
3555
diff
changeset
|
137 } |
b3f0f8a01ca2
remove some ci-dependencies
Lukas Stadler <lukas.stadler@jku.at>
parents:
3555
diff
changeset
|
138 |
b3f0f8a01ca2
remove some ci-dependencies
Lukas Stadler <lukas.stadler@jku.at>
parents:
3555
diff
changeset
|
139 oop GraalCompiler::get_RiType(ciType *type, KlassHandle accessor, TRAPS) { |
b3f0f8a01ca2
remove some ci-dependencies
Lukas Stadler <lukas.stadler@jku.at>
parents:
3555
diff
changeset
|
140 if (type->is_loaded()) { |
b3f0f8a01ca2
remove some ci-dependencies
Lukas Stadler <lukas.stadler@jku.at>
parents:
3555
diff
changeset
|
141 if (type->is_primitive_type()) { |
b3f0f8a01ca2
remove some ci-dependencies
Lukas Stadler <lukas.stadler@jku.at>
parents:
3555
diff
changeset
|
142 return VMExits::createRiTypePrimitive((int) type->basic_type(), THREAD); |
b3f0f8a01ca2
remove some ci-dependencies
Lukas Stadler <lukas.stadler@jku.at>
parents:
3555
diff
changeset
|
143 } |
b3f0f8a01ca2
remove some ci-dependencies
Lukas Stadler <lukas.stadler@jku.at>
parents:
3555
diff
changeset
|
144 KlassHandle klass = (klassOop) type->get_oop(); |
b3f0f8a01ca2
remove some ci-dependencies
Lukas Stadler <lukas.stadler@jku.at>
parents:
3555
diff
changeset
|
145 Handle name = VmIds::toString<Handle>(klass->name(), THREAD); |
b3f0f8a01ca2
remove some ci-dependencies
Lukas Stadler <lukas.stadler@jku.at>
parents:
3555
diff
changeset
|
146 return createHotSpotTypeResolved(klass, name, CHECK_NULL); |
b3f0f8a01ca2
remove some ci-dependencies
Lukas Stadler <lukas.stadler@jku.at>
parents:
3555
diff
changeset
|
147 } else { |
b3f0f8a01ca2
remove some ci-dependencies
Lukas Stadler <lukas.stadler@jku.at>
parents:
3555
diff
changeset
|
148 Symbol* name = ((ciKlass *) type)->name()->get_symbol(); |
b3f0f8a01ca2
remove some ci-dependencies
Lukas Stadler <lukas.stadler@jku.at>
parents:
3555
diff
changeset
|
149 return VMExits::createRiTypeUnresolved(VmIds::toString<Handle>(name, THREAD), THREAD); |
1422
3483ec571caf
* using reflected objects instead of oops
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1421
diff
changeset
|
150 } |
3483ec571caf
* using reflected objects instead of oops
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1421
diff
changeset
|
151 } |
3483ec571caf
* using reflected objects instead of oops
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1421
diff
changeset
|
152 |
2891
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2890
diff
changeset
|
153 oop GraalCompiler::get_RiField(ciField *field, ciInstanceKlass* accessor_klass, KlassHandle accessor, Bytecodes::Code byteCode, TRAPS) { |
3090
536528f48708
more escape analysis work: debug info
Lukas Stadler <lukas.stadler@jku.at>
parents:
3064
diff
changeset
|
154 int offset; |
536528f48708
more escape analysis work: debug info
Lukas Stadler <lukas.stadler@jku.at>
parents:
3064
diff
changeset
|
155 if (byteCode != Bytecodes::_illegal) { |
536528f48708
more escape analysis work: debug info
Lukas Stadler <lukas.stadler@jku.at>
parents:
3064
diff
changeset
|
156 bool will_link = field->will_link_from_vm(accessor_klass, byteCode); |
536528f48708
more escape analysis work: debug info
Lukas Stadler <lukas.stadler@jku.at>
parents:
3064
diff
changeset
|
157 offset = (field->holder()->is_loaded() && will_link) ? field->offset() : -1; |
536528f48708
more escape analysis work: debug info
Lukas Stadler <lukas.stadler@jku.at>
parents:
3064
diff
changeset
|
158 } else { |
536528f48708
more escape analysis work: debug info
Lukas Stadler <lukas.stadler@jku.at>
parents:
3064
diff
changeset
|
159 offset = field->offset(); |
536528f48708
more escape analysis work: debug info
Lukas Stadler <lukas.stadler@jku.at>
parents:
3064
diff
changeset
|
160 } |
2182
9569fdf936ff
Made merge compile.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2055
diff
changeset
|
161 Handle field_name = VmIds::toString<Handle>(field->name()->get_symbol(), CHECK_0); |
1449
8cfe3537a0d3
Pointer verification stub. Two loose oop fixes in C1X C++ part. Logging which methods have been compiled.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1443
diff
changeset
|
162 Handle field_holder = get_RiType(field->holder(), accessor, CHECK_0); |
8cfe3537a0d3
Pointer verification stub. Two loose oop fixes in C1X C++ part. Logging which methods have been compiled.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1443
diff
changeset
|
163 Handle field_type = get_RiType(field->type(), accessor, CHECK_0); |
2492
4e5515d09314
Fixed merge issues.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
2296
diff
changeset
|
164 int flags = field->flags().as_int(); |
4e5515d09314
Fixed merge issues.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
2296
diff
changeset
|
165 return VMExits::createRiField(field_holder, field_name, field_type, offset, flags, THREAD); |
1413
1ecc8f0aad00
Draft implementation of HotSpot CRI / first method compiling without exception.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1412
diff
changeset
|
166 } |
1ecc8f0aad00
Draft implementation of HotSpot CRI / first method compiling without exception.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1412
diff
changeset
|
167 |
2891
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2890
diff
changeset
|
168 oop GraalCompiler::createHotSpotTypeResolved(KlassHandle klass, Handle name, TRAPS) { |
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2890
diff
changeset
|
169 if (klass->graal_mirror() != NULL) { |
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2890
diff
changeset
|
170 return klass->graal_mirror(); |
1941
79d04223b8a5
Added caching for resolved types and resolved fields.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1931
diff
changeset
|
171 } |
79d04223b8a5
Added caching for resolved types and resolved fields.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1931
diff
changeset
|
172 |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
173 instanceKlass::cast(HotSpotTypeResolved::klass())->initialize(CHECK_NULL); |
2055
99ad52189524
Refactorings to get towards less CRI overhead.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2046
diff
changeset
|
174 Handle obj = instanceKlass::cast(HotSpotTypeResolved::klass())->allocate_instance(CHECK_NULL); |
99ad52189524
Refactorings to get towards less CRI overhead.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2046
diff
changeset
|
175 assert(obj() != NULL, "must succeed in allocating instance"); |
99ad52189524
Refactorings to get towards less CRI overhead.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2046
diff
changeset
|
176 |
2284
569d3fe7d65c
non-static VMEntries and VMExits, CompilationServer simplifications
Lukas Stadler <lukas.stadler@jku.at>
parents:
2215
diff
changeset
|
177 HotSpotTypeResolved::set_compiler(obj, VMExits::compilerInstance()()); |
2055
99ad52189524
Refactorings to get towards less CRI overhead.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2046
diff
changeset
|
178 |
99ad52189524
Refactorings to get towards less CRI overhead.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2046
diff
changeset
|
179 if (klass->oop_is_instance()) { |
99ad52189524
Refactorings to get towards less CRI overhead.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2046
diff
changeset
|
180 instanceKlass* ik = (instanceKlass*)klass()->klass_part(); |
99ad52189524
Refactorings to get towards less CRI overhead.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2046
diff
changeset
|
181 Handle full_name = java_lang_String::create_from_str(ik->signature_name(), CHECK_NULL); |
99ad52189524
Refactorings to get towards less CRI overhead.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2046
diff
changeset
|
182 HotSpotType::set_name(obj, full_name()); |
99ad52189524
Refactorings to get towards less CRI overhead.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2046
diff
changeset
|
183 } else { |
99ad52189524
Refactorings to get towards less CRI overhead.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2046
diff
changeset
|
184 HotSpotType::set_name(obj, name()); |
99ad52189524
Refactorings to get towards less CRI overhead.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2046
diff
changeset
|
185 } |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
186 |
1465
2c754f3a2722
Inlining of static final field values. Java mirror instead of VmID. Support for PrintMetrics option.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1461
diff
changeset
|
187 HotSpotTypeResolved::set_javaMirror(obj, klass->java_mirror()); |
2055
99ad52189524
Refactorings to get towards less CRI overhead.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2046
diff
changeset
|
188 HotSpotTypeResolved::set_simpleName(obj, name()); |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
189 HotSpotTypeResolved::set_accessFlags(obj, klass->access_flags().as_int()); |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
190 HotSpotTypeResolved::set_isInterface(obj, klass->is_interface()); |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
191 HotSpotTypeResolved::set_isInstanceClass(obj, klass->oop_is_instance()); |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
192 |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
193 if (klass->oop_is_javaArray()) { |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
194 HotSpotTypeResolved::set_isArrayClass(obj, true); |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
195 } else { |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
196 HotSpotTypeResolved::set_isArrayClass(obj, false); |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
197 HotSpotTypeResolved::set_instanceSize(obj, instanceKlass::cast(klass())->size_helper() * HeapWordSize); |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
198 HotSpotTypeResolved::set_hasFinalizer(obj, klass->has_finalizer()); |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
199 } |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
200 |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
201 // TODO replace these with correct values |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
202 HotSpotTypeResolved::set_hasSubclass(obj, false); |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
203 HotSpotTypeResolved::set_hasFinalizableSubclass(obj, false); |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
204 |
2891
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2890
diff
changeset
|
205 klass->set_graal_mirror(obj()); |
1941
79d04223b8a5
Added caching for resolved types and resolved fields.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1931
diff
changeset
|
206 |
2055
99ad52189524
Refactorings to get towards less CRI overhead.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2046
diff
changeset
|
207 return obj(); |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
208 } |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
209 |
3555
22d11b3bc561
Various hacks to be able to install machine code from a Java thread.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
3090
diff
changeset
|
210 oop GraalCompiler::createHotSpotMethodResolved(methodHandle method, TRAPS) { |
3011
f00918f35c7f
inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2925
diff
changeset
|
211 if (method->graal_mirror() != NULL) { |
f00918f35c7f
inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2925
diff
changeset
|
212 assert(method->graal_mirror()->is_a(HotSpotMethodResolved::klass()), "unexpected class..."); |
f00918f35c7f
inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2925
diff
changeset
|
213 return method->graal_mirror(); |
f00918f35c7f
inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2925
diff
changeset
|
214 } |
f00918f35c7f
inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2925
diff
changeset
|
215 |
3555
22d11b3bc561
Various hacks to be able to install machine code from a Java thread.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
3090
diff
changeset
|
216 Handle name = VmIds::toString<Handle>(method->name(), CHECK_NULL); |
22d11b3bc561
Various hacks to be able to install machine code from a Java thread.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
3090
diff
changeset
|
217 |
3011
f00918f35c7f
inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2925
diff
changeset
|
218 instanceKlass::cast(HotSpotMethodResolved::klass())->initialize(CHECK_NULL); |
f00918f35c7f
inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2925
diff
changeset
|
219 Handle obj = instanceKlass::cast(HotSpotMethodResolved::klass())->allocate_instance(CHECK_NULL); |
f00918f35c7f
inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2925
diff
changeset
|
220 assert(obj() != NULL, "must succeed in allocating instance"); |
3020
9fed07e4a375
Changed from method/reflect object back to methodOop, because using method/reflection can create deadlock with the user application (test with -Xcomp). Disabled method caching by default and created a flag -G:StoreResultGraph (otherwise eclipse will fail because of being out of memory).
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
3011
diff
changeset
|
221 |
3011
f00918f35c7f
inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2925
diff
changeset
|
222 HotSpotMethodResolved::set_compiler(obj, VMExits::compilerInstance()()); |
3020
9fed07e4a375
Changed from method/reflect object back to methodOop, because using method/reflection can create deadlock with the user application (test with -Xcomp). Disabled method caching by default and created a flag -G:StoreResultGraph (otherwise eclipse will fail because of being out of memory).
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
3011
diff
changeset
|
223 // (tw) Cannot use reflection here, because the compiler thread could dead lock with the running application. |
9fed07e4a375
Changed from method/reflect object back to methodOop, because using method/reflection can create deadlock with the user application (test with -Xcomp). Disabled method caching by default and created a flag -G:StoreResultGraph (otherwise eclipse will fail because of being out of memory).
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
3011
diff
changeset
|
224 // oop reflected = getReflectedMethod(method(), CHECK_NULL); |
9fed07e4a375
Changed from method/reflect object back to methodOop, because using method/reflection can create deadlock with the user application (test with -Xcomp). Disabled method caching by default and created a flag -G:StoreResultGraph (otherwise eclipse will fail because of being out of memory).
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
3011
diff
changeset
|
225 HotSpotMethodResolved::set_javaMirror(obj, method()); |
3011
f00918f35c7f
inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2925
diff
changeset
|
226 HotSpotMethodResolved::set_name(obj, name()); |
3020
9fed07e4a375
Changed from method/reflect object back to methodOop, because using method/reflection can create deadlock with the user application (test with -Xcomp). Disabled method caching by default and created a flag -G:StoreResultGraph (otherwise eclipse will fail because of being out of memory).
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
3011
diff
changeset
|
227 |
3011
f00918f35c7f
inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2925
diff
changeset
|
228 KlassHandle klass = method->method_holder(); |
f00918f35c7f
inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2925
diff
changeset
|
229 Handle holder_name = VmIds::toString<Handle>(klass->name(), CHECK_NULL); |
f00918f35c7f
inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2925
diff
changeset
|
230 oop holder = GraalCompiler::createHotSpotTypeResolved(klass, holder_name, CHECK_NULL); |
f00918f35c7f
inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2925
diff
changeset
|
231 HotSpotMethodResolved::set_holder(obj, holder); |
3020
9fed07e4a375
Changed from method/reflect object back to methodOop, because using method/reflection can create deadlock with the user application (test with -Xcomp). Disabled method caching by default and created a flag -G:StoreResultGraph (otherwise eclipse will fail because of being out of memory).
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
3011
diff
changeset
|
232 |
3011
f00918f35c7f
inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2925
diff
changeset
|
233 HotSpotMethodResolved::set_codeSize(obj, method->code_size()); |
f00918f35c7f
inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2925
diff
changeset
|
234 HotSpotMethodResolved::set_accessFlags(obj, method->access_flags().as_int()); |
f00918f35c7f
inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2925
diff
changeset
|
235 HotSpotMethodResolved::set_maxLocals(obj, method->max_locals()); |
f00918f35c7f
inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2925
diff
changeset
|
236 HotSpotMethodResolved::set_maxStackSize(obj, method->max_stack()); |
3020
9fed07e4a375
Changed from method/reflect object back to methodOop, because using method/reflection can create deadlock with the user application (test with -Xcomp). Disabled method caching by default and created a flag -G:StoreResultGraph (otherwise eclipse will fail because of being out of memory).
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
3011
diff
changeset
|
237 |
3011
f00918f35c7f
inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2925
diff
changeset
|
238 method->set_graal_mirror(obj()); |
f00918f35c7f
inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2925
diff
changeset
|
239 return obj(); |
f00918f35c7f
inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2925
diff
changeset
|
240 } |
f00918f35c7f
inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2925
diff
changeset
|
241 |
2891
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2890
diff
changeset
|
242 BasicType GraalCompiler::kindToBasicType(jchar ch) { |
1434
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1433
diff
changeset
|
243 switch(ch) { |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1433
diff
changeset
|
244 case 'z': return T_BOOLEAN; |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1433
diff
changeset
|
245 case 'b': return T_BYTE; |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1433
diff
changeset
|
246 case 's': return T_SHORT; |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1433
diff
changeset
|
247 case 'c': return T_CHAR; |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1433
diff
changeset
|
248 case 'i': return T_INT; |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1433
diff
changeset
|
249 case 'f': return T_FLOAT; |
3592
ff472e09af46
Fixed long signature char.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3591
diff
changeset
|
250 case 'j': return T_LONG; |
1434
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1433
diff
changeset
|
251 case 'd': return T_DOUBLE; |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1433
diff
changeset
|
252 case 'a': return T_OBJECT; |
1476
1f81c0d18c75
Build also release version of VM. Fix towards making SpecJVM2008 run.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1465
diff
changeset
|
253 case 'r': return T_ADDRESS; |
1434
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1433
diff
changeset
|
254 case '-': return T_ILLEGAL; |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1433
diff
changeset
|
255 default: |
1931
48bbaead8b6c
Adjustments after merge with OpenJDK repository.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1483
diff
changeset
|
256 fatal(err_msg("unexpected CiKind: %c", ch)); |
1434
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1433
diff
changeset
|
257 break; |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1433
diff
changeset
|
258 } |
2215
999f8086cc4f
More changes to make it compile and work on win64.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
2182
diff
changeset
|
259 return T_ILLEGAL; |
1434
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1433
diff
changeset
|
260 } |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1433
diff
changeset
|
261 |
3619
5e9645341ec3
support for new RiRuntime features: add code without making it the default for the method, executing Java tasks on the compile thread, communicate nmethod reference to Java code as HotSpotCompiledMethod
Lukas Stadler <lukas.stadler@jku.at>
parents:
3592
diff
changeset
|
262 void GraalCompiler::poll_java_queue() { |
5e9645341ec3
support for new RiRuntime features: add code without making it the default for the method, executing Java tasks on the compile thread, communicate nmethod reference to Java code as HotSpotCompiledMethod
Lukas Stadler <lukas.stadler@jku.at>
parents:
3592
diff
changeset
|
263 int system_dictionary_modification_counter; |
5e9645341ec3
support for new RiRuntime features: add code without making it the default for the method, executing Java tasks on the compile thread, communicate nmethod reference to Java code as HotSpotCompiledMethod
Lukas Stadler <lukas.stadler@jku.at>
parents:
3592
diff
changeset
|
264 { |
5e9645341ec3
support for new RiRuntime features: add code without making it the default for the method, executing Java tasks on the compile thread, communicate nmethod reference to Java code as HotSpotCompiledMethod
Lukas Stadler <lukas.stadler@jku.at>
parents:
3592
diff
changeset
|
265 MutexLocker locker(Compile_lock, Thread::current()); |
5e9645341ec3
support for new RiRuntime features: add code without making it the default for the method, executing Java tasks on the compile thread, communicate nmethod reference to Java code as HotSpotCompiledMethod
Lukas Stadler <lukas.stadler@jku.at>
parents:
3592
diff
changeset
|
266 system_dictionary_modification_counter = SystemDictionary::number_of_modifications(); |
5e9645341ec3
support for new RiRuntime features: add code without making it the default for the method, executing Java tasks on the compile thread, communicate nmethod reference to Java code as HotSpotCompiledMethod
Lukas Stadler <lukas.stadler@jku.at>
parents:
3592
diff
changeset
|
267 } |
5e9645341ec3
support for new RiRuntime features: add code without making it the default for the method, executing Java tasks on the compile thread, communicate nmethod reference to Java code as HotSpotCompiledMethod
Lukas Stadler <lukas.stadler@jku.at>
parents:
3592
diff
changeset
|
268 |
5e9645341ec3
support for new RiRuntime features: add code without making it the default for the method, executing Java tasks on the compile thread, communicate nmethod reference to Java code as HotSpotCompiledMethod
Lukas Stadler <lukas.stadler@jku.at>
parents:
3592
diff
changeset
|
269 { |
5e9645341ec3
support for new RiRuntime features: add code without making it the default for the method, executing Java tasks on the compile thread, communicate nmethod reference to Java code as HotSpotCompiledMethod
Lukas Stadler <lukas.stadler@jku.at>
parents:
3592
diff
changeset
|
270 ThreadToNativeFromVM ttn(JavaThread::current()); |
5e9645341ec3
support for new RiRuntime features: add code without making it the default for the method, executing Java tasks on the compile thread, communicate nmethod reference to Java code as HotSpotCompiledMethod
Lukas Stadler <lukas.stadler@jku.at>
parents:
3592
diff
changeset
|
271 ciEnv ci_env(NULL, system_dictionary_modification_counter); |
5e9645341ec3
support for new RiRuntime features: add code without making it the default for the method, executing Java tasks on the compile thread, communicate nmethod reference to Java code as HotSpotCompiledMethod
Lukas Stadler <lukas.stadler@jku.at>
parents:
3592
diff
changeset
|
272 { |
5e9645341ec3
support for new RiRuntime features: add code without making it the default for the method, executing Java tasks on the compile thread, communicate nmethod reference to Java code as HotSpotCompiledMethod
Lukas Stadler <lukas.stadler@jku.at>
parents:
3592
diff
changeset
|
273 VM_ENTRY_MARK; |
5e9645341ec3
support for new RiRuntime features: add code without making it the default for the method, executing Java tasks on the compile thread, communicate nmethod reference to Java code as HotSpotCompiledMethod
Lukas Stadler <lukas.stadler@jku.at>
parents:
3592
diff
changeset
|
274 ResourceMark rm; |
5e9645341ec3
support for new RiRuntime features: add code without making it the default for the method, executing Java tasks on the compile thread, communicate nmethod reference to Java code as HotSpotCompiledMethod
Lukas Stadler <lukas.stadler@jku.at>
parents:
3592
diff
changeset
|
275 HandleMark hm; |
5e9645341ec3
support for new RiRuntime features: add code without making it the default for the method, executing Java tasks on the compile thread, communicate nmethod reference to Java code as HotSpotCompiledMethod
Lukas Stadler <lukas.stadler@jku.at>
parents:
3592
diff
changeset
|
276 |
5e9645341ec3
support for new RiRuntime features: add code without making it the default for the method, executing Java tasks on the compile thread, communicate nmethod reference to Java code as HotSpotCompiledMethod
Lukas Stadler <lukas.stadler@jku.at>
parents:
3592
diff
changeset
|
277 VMExits::pollJavaQueue(); |
5e9645341ec3
support for new RiRuntime features: add code without making it the default for the method, executing Java tasks on the compile thread, communicate nmethod reference to Java code as HotSpotCompiledMethod
Lukas Stadler <lukas.stadler@jku.at>
parents:
3592
diff
changeset
|
278 } |
5e9645341ec3
support for new RiRuntime features: add code without making it the default for the method, executing Java tasks on the compile thread, communicate nmethod reference to Java code as HotSpotCompiledMethod
Lukas Stadler <lukas.stadler@jku.at>
parents:
3592
diff
changeset
|
279 } |
5e9645341ec3
support for new RiRuntime features: add code without making it the default for the method, executing Java tasks on the compile thread, communicate nmethod reference to Java code as HotSpotCompiledMethod
Lukas Stadler <lukas.stadler@jku.at>
parents:
3592
diff
changeset
|
280 } |