Mercurial > hg > truffle
annotate src/share/vm/graal/graalCompiler.cpp @ 3649:5a8c44b5fb80
Remove ci usage on field lookup.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Wed, 16 Nov 2011 16:46:32 +0100 |
parents | ff6a991c6e3c |
children | 0e8a2a629afb |
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" |
3637
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3634
diff
changeset
|
30 #include "graal/graalEnv.hpp" |
2045
9c96c873c42b
Fix includes to match new hotspot mechanism.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1942
diff
changeset
|
31 #include "c1/c1_Runtime1.hpp" |
2663
d7c0775d7e72
added includes to build without precompiled headers
Christian.Wimmer@Oracle.com
parents:
2516
diff
changeset
|
32 #include "runtime/arguments.hpp" |
1406
35069ca331f2
Hooked C1XCompiler class into the system.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff
changeset
|
33 |
2891
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2890
diff
changeset
|
34 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
|
35 |
2891
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2890
diff
changeset
|
36 GraalCompiler::GraalCompiler() { |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
37 _initialized = false; |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
38 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
|
39 _instance = this; |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
40 } |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
41 |
1406
35069ca331f2
Hooked C1XCompiler class into the system.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff
changeset
|
42 // Initialization |
2891
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2890
diff
changeset
|
43 void GraalCompiler::initialize() { |
1414
e1a275dbc8cd
Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1413
diff
changeset
|
44 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
|
45 _initialized = true; |
1931
48bbaead8b6c
Adjustments after merge with OpenJDK repository.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1483
diff
changeset
|
46 CompilerThread* THREAD = CompilerThread::current(); |
2891
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2890
diff
changeset
|
47 TRACE_graal_1("GraalCompiler::initialize"); |
1412
9195b99c841b
Added first VM entry method.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1410
diff
changeset
|
48 |
1931
48bbaead8b6c
Adjustments after merge with OpenJDK repository.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1483
diff
changeset
|
49 initialize_buffer_blob(); |
48bbaead8b6c
Adjustments after merge with OpenJDK repository.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1483
diff
changeset
|
50 Runtime1::initialize(THREAD->get_buffer_blob()); |
48bbaead8b6c
Adjustments after merge with OpenJDK repository.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1483
diff
changeset
|
51 |
1432
b61a43cd1255
sourcecode formatting
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
52 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
|
53 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
|
54 if (klass == NULL) { |
2891
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2890
diff
changeset
|
55 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
|
56 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
|
57 } |
1432
b61a43cd1255
sourcecode formatting
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
58 env->RegisterNatives(klass, VMEntries_methods, VMEntries_methods_count()); |
b61a43cd1255
sourcecode formatting
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
59 |
1452
9b22e3e5df8e
Solved an issue with unresolved field patching.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1449
diff
changeset
|
60 { |
9b22e3e5df8e
Solved an issue with unresolved field patching.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1449
diff
changeset
|
61 VM_ENTRY_MARK; |
9b22e3e5df8e
Solved an issue with unresolved field patching.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1449
diff
changeset
|
62 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
|
63 } |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
64 |
2891
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2890
diff
changeset
|
65 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
|
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 { |
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 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
|
69 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
|
70 VMExits::initializeCompiler(); |
2296
34354e2e40a3
cleanups and client/server fixes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2291
diff
changeset
|
71 VMExits::setDefaultOptions(); |
2891
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2890
diff
changeset
|
72 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
|
73 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
|
74 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
|
75 jboolean result = VMExits::setOption(option); |
2674
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
2663
diff
changeset
|
76 if (!result) { |
2891
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2890
diff
changeset
|
77 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
|
78 vm_abort(false); |
6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents:
2663
diff
changeset
|
79 } |
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
|
80 } |
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
|
81 } |
1406
35069ca331f2
Hooked C1XCompiler class into the system.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff
changeset
|
82 } |
35069ca331f2
Hooked C1XCompiler class into the system.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff
changeset
|
83 |
2891
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2890
diff
changeset
|
84 void GraalCompiler::initialize_buffer_blob() { |
1931
48bbaead8b6c
Adjustments after merge with OpenJDK repository.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1483
diff
changeset
|
85 |
3555
22d11b3bc561
Various hacks to be able to install machine code from a Java thread.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
3090
diff
changeset
|
86 JavaThread* THREAD = JavaThread::current(); |
1931
48bbaead8b6c
Adjustments after merge with OpenJDK repository.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1483
diff
changeset
|
87 if (THREAD->get_buffer_blob() == NULL) { |
48bbaead8b6c
Adjustments after merge with OpenJDK repository.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1483
diff
changeset
|
88 // setup CodeBuffer. Preallocate a BufferBlob of size |
48bbaead8b6c
Adjustments after merge with OpenJDK repository.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1483
diff
changeset
|
89 // NMethodSizeLimit plus some extra space for constants. |
48bbaead8b6c
Adjustments after merge with OpenJDK repository.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1483
diff
changeset
|
90 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
|
91 Compilation::desired_max_constant_size(); |
2891
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2890
diff
changeset
|
92 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
|
93 code_buffer_size); |
48bbaead8b6c
Adjustments after merge with OpenJDK repository.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1483
diff
changeset
|
94 guarantee(blob != NULL, "must create code buffer"); |
48bbaead8b6c
Adjustments after merge with OpenJDK repository.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1483
diff
changeset
|
95 THREAD->set_buffer_blob(blob); |
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 } |
48bbaead8b6c
Adjustments after merge with OpenJDK repository.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1483
diff
changeset
|
98 |
1406
35069ca331f2
Hooked C1XCompiler class into the system.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff
changeset
|
99 // Compilation entry point for methods |
2891
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2890
diff
changeset
|
100 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
|
101 assert(_initialized, "must already be initialized"); |
1422
3483ec571caf
* using reflected objects instead of oops
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1421
diff
changeset
|
102 VM_ENTRY_MARK; |
3483ec571caf
* using reflected objects instead of oops
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1421
diff
changeset
|
103 ResourceMark rm; |
3483ec571caf
* using reflected objects instead of oops
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1421
diff
changeset
|
104 HandleMark hm; |
1406
35069ca331f2
Hooked C1XCompiler class into the system.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff
changeset
|
105 |
2891
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2890
diff
changeset
|
106 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
|
107 |
1410
b30a2cd5e3a2
Added methods to c1x_VMExits.cpp
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1407
diff
changeset
|
108 CompilerThread::current()->set_compiling(true); |
1432
b61a43cd1255
sourcecode formatting
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
109 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
|
110 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
|
111 VMExits::compileMethod(hotspot_method, entry_bci); |
1422
3483ec571caf
* using reflected objects instead of oops
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1421
diff
changeset
|
112 CompilerThread::current()->set_compiling(false); |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
113 |
2891
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2890
diff
changeset
|
114 TRACE_graal_2("GraalCompiler::compile_method exit"); |
1406
35069ca331f2
Hooked C1XCompiler class into the system.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff
changeset
|
115 } |
35069ca331f2
Hooked C1XCompiler class into the system.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff
changeset
|
116 |
2901
d577d07cedec
Added time measurement for phases.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2891
diff
changeset
|
117 void GraalCompiler::exit() { |
3576
c94966c5fb41
Only shut down the compiler if it was initialized.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3566
diff
changeset
|
118 if (_initialized) { |
c94966c5fb41
Only shut down the compiler if it was initialized.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3566
diff
changeset
|
119 VMExits::shutdownCompiler(); |
c94966c5fb41
Only shut down the compiler if it was initialized.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3566
diff
changeset
|
120 } |
2901
d577d07cedec
Added time measurement for phases.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2891
diff
changeset
|
121 } |
d577d07cedec
Added time measurement for phases.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2891
diff
changeset
|
122 |
1406
35069ca331f2
Hooked C1XCompiler class into the system.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff
changeset
|
123 // Print compilation timers and statistics |
2891
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2890
diff
changeset
|
124 void GraalCompiler::print_timers() { |
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2890
diff
changeset
|
125 TRACE_graal_1("GraalCompiler::print_timers"); |
1410
b30a2cd5e3a2
Added methods to c1x_VMExits.cpp
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1407
diff
changeset
|
126 } |
b30a2cd5e3a2
Added methods to c1x_VMExits.cpp
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1407
diff
changeset
|
127 |
3637
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3634
diff
changeset
|
128 oop GraalCompiler::get_RiType(Symbol* klass_name, TRAPS) { |
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3634
diff
changeset
|
129 return VMExits::createRiTypeUnresolved(VmIds::toString<Handle>(klass_name, THREAD), THREAD); |
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3634
diff
changeset
|
130 } |
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3634
diff
changeset
|
131 |
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3634
diff
changeset
|
132 oop GraalCompiler::get_RiTypeFromSignature(constantPoolHandle cp, int index, KlassHandle loading_klass, TRAPS) { |
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3634
diff
changeset
|
133 |
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3634
diff
changeset
|
134 Symbol* signature = cp->symbol_at(index); |
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3634
diff
changeset
|
135 BasicType field_type = FieldType::basic_type(signature); |
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3634
diff
changeset
|
136 // If the field is a pointer type, get the klass of the |
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3634
diff
changeset
|
137 // field. |
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3634
diff
changeset
|
138 if (field_type == T_OBJECT || field_type == T_ARRAY) { |
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3634
diff
changeset
|
139 KlassHandle handle = GraalEnv::get_klass_by_name(loading_klass, signature, false); |
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3634
diff
changeset
|
140 if (handle.is_null()) { |
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3634
diff
changeset
|
141 return get_RiType(signature, CHECK_NULL); |
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3634
diff
changeset
|
142 } else { |
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3634
diff
changeset
|
143 return get_RiType(handle, CHECK_NULL); |
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3634
diff
changeset
|
144 } |
3566
b0d192f86f34
more work on ci removal
Lukas Stadler <lukas.stadler@jku.at>
parents:
3565
diff
changeset
|
145 } else { |
3637
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3634
diff
changeset
|
146 return VMExits::createRiTypePrimitive(field_type, CHECK_NULL); |
3566
b0d192f86f34
more work on ci removal
Lukas Stadler <lukas.stadler@jku.at>
parents:
3565
diff
changeset
|
147 } |
3637
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3634
diff
changeset
|
148 } |
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3634
diff
changeset
|
149 |
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3634
diff
changeset
|
150 oop GraalCompiler::get_RiType(constantPoolHandle cp, int index, KlassHandle loading_klass, TRAPS) { |
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3634
diff
changeset
|
151 bool is_accessible = false; |
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3634
diff
changeset
|
152 |
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3634
diff
changeset
|
153 KlassHandle klass = GraalEnv::get_klass_by_index(cp, index, is_accessible, loading_klass); |
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3634
diff
changeset
|
154 oop catch_class = NULL; |
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3634
diff
changeset
|
155 if (klass.is_null()) { |
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3634
diff
changeset
|
156 // We have to lock the cpool to keep the oop from being resolved |
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3634
diff
changeset
|
157 // while we are accessing it. |
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3634
diff
changeset
|
158 ObjectLocker ol(cp, THREAD); |
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3634
diff
changeset
|
159 |
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3634
diff
changeset
|
160 Symbol* klass_name = NULL; |
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3634
diff
changeset
|
161 constantTag tag = cp->tag_at(index); |
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3634
diff
changeset
|
162 if (tag.is_klass()) { |
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3634
diff
changeset
|
163 // The klass has been inserted into the constant pool |
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3634
diff
changeset
|
164 // very recently. |
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3634
diff
changeset
|
165 return GraalCompiler::get_RiType(cp->resolved_klass_at(index), CHECK_NULL); |
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3634
diff
changeset
|
166 } else if (tag.is_symbol()) { |
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3634
diff
changeset
|
167 klass_name = cp->symbol_at(index); |
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3634
diff
changeset
|
168 } else { |
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3634
diff
changeset
|
169 assert(cp->tag_at(index).is_unresolved_klass(), "wrong tag"); |
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3634
diff
changeset
|
170 klass_name = cp->unresolved_klass_at(index); |
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3634
diff
changeset
|
171 } |
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3634
diff
changeset
|
172 return GraalCompiler::get_RiType(klass_name, CHECK_NULL); |
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3634
diff
changeset
|
173 } else { |
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3634
diff
changeset
|
174 return GraalCompiler::get_RiType(klass, CHECK_NULL); |
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3634
diff
changeset
|
175 } |
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3634
diff
changeset
|
176 } |
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3634
diff
changeset
|
177 |
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3634
diff
changeset
|
178 oop GraalCompiler::get_RiType(KlassHandle klass, TRAPS) { |
3565
b3f0f8a01ca2
remove some ci-dependencies
Lukas Stadler <lukas.stadler@jku.at>
parents:
3555
diff
changeset
|
179 Handle name = VmIds::toString<Handle>(klass->name(), THREAD); |
b3f0f8a01ca2
remove some ci-dependencies
Lukas Stadler <lukas.stadler@jku.at>
parents:
3555
diff
changeset
|
180 return createHotSpotTypeResolved(klass, name, CHECK_NULL); |
b3f0f8a01ca2
remove some ci-dependencies
Lukas Stadler <lukas.stadler@jku.at>
parents:
3555
diff
changeset
|
181 } |
b3f0f8a01ca2
remove some ci-dependencies
Lukas Stadler <lukas.stadler@jku.at>
parents:
3555
diff
changeset
|
182 |
3649
5a8c44b5fb80
Remove ci usage on field lookup.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3637
diff
changeset
|
183 oop GraalCompiler::get_RiField(int offset, int flags, Symbol* field_name, Handle field_holder, Handle field_type, Bytecodes::Code byteCode, TRAPS) { |
5a8c44b5fb80
Remove ci usage on field lookup.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3637
diff
changeset
|
184 Handle name = VmIds::toString<Handle>(field_name, CHECK_NULL); |
5a8c44b5fb80
Remove ci usage on field lookup.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3637
diff
changeset
|
185 return VMExits::createRiField(field_holder, name, field_type, offset, flags, CHECK_NULL); |
1413
1ecc8f0aad00
Draft implementation of HotSpot CRI / first method compiling without exception.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1412
diff
changeset
|
186 } |
1ecc8f0aad00
Draft implementation of HotSpot CRI / first method compiling without exception.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1412
diff
changeset
|
187 |
2891
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2890
diff
changeset
|
188 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
|
189 if (klass->graal_mirror() != NULL) { |
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2890
diff
changeset
|
190 return klass->graal_mirror(); |
1941
79d04223b8a5
Added caching for resolved types and resolved fields.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1931
diff
changeset
|
191 } |
79d04223b8a5
Added caching for resolved types and resolved fields.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1931
diff
changeset
|
192 |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
193 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
|
194 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
|
195 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
|
196 |
2284
569d3fe7d65c
non-static VMEntries and VMExits, CompilationServer simplifications
Lukas Stadler <lukas.stadler@jku.at>
parents:
2215
diff
changeset
|
197 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
|
198 |
99ad52189524
Refactorings to get towards less CRI overhead.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2046
diff
changeset
|
199 if (klass->oop_is_instance()) { |
99ad52189524
Refactorings to get towards less CRI overhead.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2046
diff
changeset
|
200 instanceKlass* ik = (instanceKlass*)klass()->klass_part(); |
99ad52189524
Refactorings to get towards less CRI overhead.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2046
diff
changeset
|
201 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
|
202 HotSpotType::set_name(obj, full_name()); |
99ad52189524
Refactorings to get towards less CRI overhead.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2046
diff
changeset
|
203 } else { |
99ad52189524
Refactorings to get towards less CRI overhead.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2046
diff
changeset
|
204 HotSpotType::set_name(obj, name()); |
99ad52189524
Refactorings to get towards less CRI overhead.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2046
diff
changeset
|
205 } |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
206 |
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
|
207 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
|
208 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
|
209 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
|
210 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
|
211 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
|
212 |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
213 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
|
214 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
|
215 } else { |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
216 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
|
217 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
|
218 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
|
219 } |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
220 |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
221 // 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
|
222 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
|
223 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
|
224 |
2891
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2890
diff
changeset
|
225 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
|
226 |
2055
99ad52189524
Refactorings to get towards less CRI overhead.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2046
diff
changeset
|
227 return obj(); |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
228 } |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
229 |
3555
22d11b3bc561
Various hacks to be able to install machine code from a Java thread.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
3090
diff
changeset
|
230 oop GraalCompiler::createHotSpotMethodResolved(methodHandle method, TRAPS) { |
3011
f00918f35c7f
inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2925
diff
changeset
|
231 if (method->graal_mirror() != NULL) { |
f00918f35c7f
inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2925
diff
changeset
|
232 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
|
233 return method->graal_mirror(); |
f00918f35c7f
inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2925
diff
changeset
|
234 } |
f00918f35c7f
inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2925
diff
changeset
|
235 |
3555
22d11b3bc561
Various hacks to be able to install machine code from a Java thread.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
3090
diff
changeset
|
236 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
|
237 |
3011
f00918f35c7f
inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2925
diff
changeset
|
238 instanceKlass::cast(HotSpotMethodResolved::klass())->initialize(CHECK_NULL); |
f00918f35c7f
inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2925
diff
changeset
|
239 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
|
240 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
|
241 |
3011
f00918f35c7f
inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2925
diff
changeset
|
242 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
|
243 // (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
|
244 // 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
|
245 HotSpotMethodResolved::set_javaMirror(obj, method()); |
3011
f00918f35c7f
inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2925
diff
changeset
|
246 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
|
247 |
3011
f00918f35c7f
inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2925
diff
changeset
|
248 KlassHandle klass = method->method_holder(); |
f00918f35c7f
inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2925
diff
changeset
|
249 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
|
250 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
|
251 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
|
252 |
3011
f00918f35c7f
inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2925
diff
changeset
|
253 HotSpotMethodResolved::set_codeSize(obj, method->code_size()); |
f00918f35c7f
inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2925
diff
changeset
|
254 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
|
255 HotSpotMethodResolved::set_maxLocals(obj, method->max_locals()); |
f00918f35c7f
inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2925
diff
changeset
|
256 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
|
257 |
3011
f00918f35c7f
inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2925
diff
changeset
|
258 method->set_graal_mirror(obj()); |
f00918f35c7f
inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2925
diff
changeset
|
259 return obj(); |
f00918f35c7f
inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2925
diff
changeset
|
260 } |
f00918f35c7f
inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2925
diff
changeset
|
261 |
2891
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2890
diff
changeset
|
262 BasicType GraalCompiler::kindToBasicType(jchar ch) { |
1434
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1433
diff
changeset
|
263 switch(ch) { |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1433
diff
changeset
|
264 case 'z': return T_BOOLEAN; |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1433
diff
changeset
|
265 case 'b': return T_BYTE; |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1433
diff
changeset
|
266 case 's': return T_SHORT; |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1433
diff
changeset
|
267 case 'c': return T_CHAR; |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1433
diff
changeset
|
268 case 'i': return T_INT; |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1433
diff
changeset
|
269 case 'f': return T_FLOAT; |
3592
ff472e09af46
Fixed long signature char.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3591
diff
changeset
|
270 case 'j': return T_LONG; |
1434
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1433
diff
changeset
|
271 case 'd': return T_DOUBLE; |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1433
diff
changeset
|
272 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
|
273 case 'r': return T_ADDRESS; |
1434
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1433
diff
changeset
|
274 case '-': return T_ILLEGAL; |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1433
diff
changeset
|
275 default: |
1931
48bbaead8b6c
Adjustments after merge with OpenJDK repository.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1483
diff
changeset
|
276 fatal(err_msg("unexpected CiKind: %c", ch)); |
1434
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1433
diff
changeset
|
277 break; |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1433
diff
changeset
|
278 } |
2215
999f8086cc4f
More changes to make it compile and work on win64.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
2182
diff
changeset
|
279 return T_ILLEGAL; |
1434
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1433
diff
changeset
|
280 } |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1433
diff
changeset
|
281 |
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
|
282 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
|
283 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
|
284 { |
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
|
285 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
|
286 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
|
287 } |
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
|
288 |
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
|
289 { |
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
|
290 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
|
291 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
|
292 { |
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
|
293 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
|
294 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
|
295 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
|
296 |
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
|
297 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
|
298 } |
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
|
299 } |
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
|
300 } |