annotate src/share/vm/graal/graalCompiler.cpp @ 9430:147162b27799

GRAAL-234 - PTX code loading
author Morris Meyer <morris.meyer@oracle.com>
date Tue, 30 Apr 2013 08:17:55 -0400
parents bc26f978b0ce
children aa8f3fc0a9a9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2516
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
1 /*
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
2 * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
4 *
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
7 * published by the Free Software Foundation.
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
8 *
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
13 * accompanied this code).
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
14 *
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
15 * You should have received a copy of the GNU General Public License version
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
18 *
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
21 * questions.
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"
6559
d5f7e737827f fixed compilation issues on Solaris. When using SunStudio compiler, Solaris build with DONT_USE_PRECOMPILED_HEADER
Laurent Daynes <Laurent.Daynes@oracle.com>
parents: 6442
diff changeset
25 #include "memory/oopFactory.hpp"
d5f7e737827f fixed compilation issues on Solaris. When using SunStudio compiler, Solaris build with DONT_USE_PRECOMPILED_HEADER
Laurent Daynes <Laurent.Daynes@oracle.com>
parents: 6442
diff changeset
26 #include "runtime/javaCalls.hpp"
2891
75a99b4f1c98 Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2890
diff changeset
27 #include "graal/graalCompiler.hpp"
75a99b4f1c98 Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2890
diff changeset
28 #include "graal/graalJavaAccess.hpp"
4221
bcbb918f5ac6 Renaming of VMExits and VMEntries part 2.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4139
diff changeset
29 #include "graal/graalVMToCompiler.hpp"
bcbb918f5ac6 Renaming of VMExits and VMEntries part 2.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4139
diff changeset
30 #include "graal/graalCompilerToVM.hpp"
9430
147162b27799 GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents: 9126
diff changeset
31 #include "graal/graalCompilerToGPU.hpp"
3637
ff6a991c6e3c Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3634
diff changeset
32 #include "graal/graalEnv.hpp"
7125
1baf7f1e3f23 decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents: 7115
diff changeset
33 #include "graal/graalRuntime.hpp"
2663
d7c0775d7e72 added includes to build without precompiled headers
Christian.Wimmer@Oracle.com
parents: 2516
diff changeset
34 #include "runtime/arguments.hpp"
5150
fdd9dd4508fa some GC fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 5130
diff changeset
35 #include "runtime/compilationPolicy.hpp"
1406
35069ca331f2 Hooked C1XCompiler class into the system.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff changeset
36
2891
75a99b4f1c98 Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2890
diff changeset
37 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
38
7154
5d0bb7d52783 changes to support Graal co-existing with the other HotSpot compiler(s) and being used for explicit compilation requests and code installation via the Graal API
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
39 GraalCompiler::GraalCompiler() : AbstractCompiler(graal) {
1429
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
40 _initialized = false;
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
41 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
42 _instance = this;
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
43 }
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
44
1406
35069ca331f2 Hooked C1XCompiler class into the system.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff changeset
45 // Initialization
2891
75a99b4f1c98 Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2890
diff changeset
46 void GraalCompiler::initialize() {
3650
0e8a2a629afb Pass-by compilation broker.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3649
diff changeset
47
0e8a2a629afb Pass-by compilation broker.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3649
diff changeset
48 ThreadToNativeFromVM trans(JavaThread::current());
0e8a2a629afb Pass-by compilation broker.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3649
diff changeset
49 JavaThread* THREAD = JavaThread::current();
2891
75a99b4f1c98 Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2890
diff changeset
50 TRACE_graal_1("GraalCompiler::initialize");
1412
9195b99c841b Added first VM entry method.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1410
diff changeset
51
7216
5a95c784febf fixed windows make files and VS2012-specific compilation issues
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7126
diff changeset
52 uintptr_t heap_end = (uintptr_t) Universe::heap()->reserved_region().end();
5a95c784febf fixed windows make files and VS2012-specific compilation issues
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7126
diff changeset
53 uintptr_t allocation_end = heap_end + ((uintptr_t)16) * 1024 * 1024 * 1024;
7115
1c76a458616e simplified TLAB allocation (don't use + and -)
Lukas Stadler <lukas.stadler@jku.at>
parents: 7094
diff changeset
54 guarantee(heap_end < allocation_end, "heap end too close to end of address space (might lead to erroneous TLAB allocations)");
1c76a458616e simplified TLAB allocation (don't use + and -)
Lukas Stadler <lukas.stadler@jku.at>
parents: 7094
diff changeset
55 NOT_LP64(error("check TLAB allocation code for address space conflicts"));
1c76a458616e simplified TLAB allocation (don't use + and -)
Lukas Stadler <lukas.stadler@jku.at>
parents: 7094
diff changeset
56
5129
51111665eda6 Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents: 5062
diff changeset
57 _deopted_leaf_graph_count = 0;
51111665eda6 Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents: 5062
diff changeset
58
1931
48bbaead8b6c Adjustments after merge with OpenJDK repository.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1483
diff changeset
59 initialize_buffer_blob();
7125
1baf7f1e3f23 decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents: 7115
diff changeset
60 GraalRuntime::initialize(THREAD->get_buffer_blob());
1931
48bbaead8b6c Adjustments after merge with OpenJDK repository.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1483
diff changeset
61
1432
b61a43cd1255 sourcecode formatting
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1429
diff changeset
62 JNIEnv *env = ((JavaThread *) Thread::current())->jni_environment();
5062
5e9f38419819 Adjust C++ part according to the renaming.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5056
diff changeset
63 jclass klass = env->FindClass("com/oracle/graal/hotspot/bridge/CompilerToVMImpl");
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
64 if (klass == NULL) {
4221
bcbb918f5ac6 Renaming of VMExits and VMEntries part 2.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4139
diff changeset
65 tty->print_cr("graal CompilerToVMImpl class not found");
2674
6ab73784566a * BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents: 2663
diff changeset
66 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
67 }
4221
bcbb918f5ac6 Renaming of VMExits and VMEntries part 2.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4139
diff changeset
68 env->RegisterNatives(klass, CompilerToVM_methods, CompilerToVM_methods_count());
9430
147162b27799 GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents: 9126
diff changeset
69
147162b27799 GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents: 9126
diff changeset
70 klass = env->FindClass("com/oracle/graal/hotspot/bridge/CompilerToGPUImpl");
147162b27799 GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents: 9126
diff changeset
71 if (klass == NULL) {
147162b27799 GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents: 9126
diff changeset
72 tty->print_cr("graal CompilerToGPUImpl class not found");
147162b27799 GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents: 9126
diff changeset
73 vm_abort(false);
147162b27799 GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents: 9126
diff changeset
74 }
147162b27799 GRAAL-234 - PTX code loading
Morris Meyer <morris.meyer@oracle.com>
parents: 9126
diff changeset
75 env->RegisterNatives(klass, CompilerToGPU_methods, CompilerToGPU_methods_count());
1432
b61a43cd1255 sourcecode formatting
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1429
diff changeset
76
3650
0e8a2a629afb Pass-by compilation broker.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3649
diff changeset
77 ResourceMark rm;
0e8a2a629afb Pass-by compilation broker.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3649
diff changeset
78 HandleMark hm;
1452
9b22e3e5df8e Solved an issue with unresolved field patching.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1449
diff changeset
79 {
7126
ce248dc0a656 removed all Graal modifications to ci and c1
Doug Simon <doug.simon@oracle.com>
parents: 7125
diff changeset
80 GRAAL_VM_ENTRY_MARK;
1452
9b22e3e5df8e Solved an issue with unresolved field patching.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1449
diff changeset
81 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
82 }
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
83
2891
75a99b4f1c98 Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2890
diff changeset
84 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
85
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
86 {
7126
ce248dc0a656 removed all Graal modifications to ci and c1
Doug Simon <doug.simon@oracle.com>
parents: 7125
diff changeset
87 GRAAL_VM_ENTRY_MARK;
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
88 HandleMark hm;
2891
75a99b4f1c98 Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2890
diff changeset
89 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
90 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
91 Handle option = java_lang_String::create_from_str(arg, THREAD);
4221
bcbb918f5ac6 Renaming of VMExits and VMEntries part 2.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4139
diff changeset
92 jboolean result = VMToCompiler::setOption(option);
2674
6ab73784566a * BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents: 2663
diff changeset
93 if (!result) {
5156
482265e41a1a added -G:+PrintFlags flag for printing the Graal flags; tightened format checking of Graal options to be consistent with HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 5150
diff changeset
94 tty->print_cr("Invalid option for graal: -G:%s", arg);
2674
6ab73784566a * BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents: 2663
diff changeset
95 vm_abort(false);
6ab73784566a * BlockBegin.predecessors changed to List<BlockEnd>
Lukas Stadler <lukas.stadler@jku.at>
parents: 2663
diff changeset
96 }
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
97 }
3694
221133c5ed6c Don't call startCompiler if the VM is run with -Xint
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3653
diff changeset
98 if (UseCompiler) {
4221
bcbb918f5ac6 Renaming of VMExits and VMEntries part 2.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4139
diff changeset
99 VMToCompiler::startCompiler();
3694
221133c5ed6c Don't call startCompiler if the VM is run with -Xint
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3653
diff changeset
100 _initialized = true;
221133c5ed6c Don't call startCompiler if the VM is run with -Xint
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3653
diff changeset
101 if (BootstrapGraal) {
9108
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents: 8151
diff changeset
102 // We turn off CompileTheWorld and complete the VM startup so that
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents: 8151
diff changeset
103 // Graal can be compiled by C1/C2 when we do a CTW.
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents: 8151
diff changeset
104 NOT_PRODUCT(CompileTheWorld = false);
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents: 8151
diff changeset
105 CompilationPolicy::completed_vm_startup();
4221
bcbb918f5ac6 Renaming of VMExits and VMEntries part 2.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4139
diff changeset
106 VMToCompiler::bootstrap();
3694
221133c5ed6c Don't call startCompiler if the VM is run with -Xint
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3653
diff changeset
107 }
3651
a31028282e3e Support blocking compilation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3650
diff changeset
108 }
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
109 }
1406
35069ca331f2 Hooked C1XCompiler class into the system.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff changeset
110 }
35069ca331f2 Hooked C1XCompiler class into the system.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff changeset
111
5129
51111665eda6 Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents: 5062
diff changeset
112 void GraalCompiler::deopt_leaf_graph(jlong leaf_graph_id) {
51111665eda6 Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents: 5062
diff changeset
113 assert(leaf_graph_id != -1, "unexpected leaf graph id");
51111665eda6 Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents: 5062
diff changeset
114
51111665eda6 Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents: 5062
diff changeset
115 if (_deopted_leaf_graph_count < LEAF_GRAPH_ARRAY_SIZE) {
51111665eda6 Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents: 5062
diff changeset
116 MutexLockerEx y(GraalDeoptLeafGraphIds_lock, Mutex::_no_safepoint_check_flag);
51111665eda6 Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents: 5062
diff changeset
117 if (_deopted_leaf_graph_count < LEAF_GRAPH_ARRAY_SIZE) {
51111665eda6 Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents: 5062
diff changeset
118 _deopted_leaf_graphs[_deopted_leaf_graph_count++] = leaf_graph_id;
51111665eda6 Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents: 5062
diff changeset
119 }
51111665eda6 Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents: 5062
diff changeset
120 }
51111665eda6 Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents: 5062
diff changeset
121 }
51111665eda6 Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents: 5062
diff changeset
122
51111665eda6 Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents: 5062
diff changeset
123 oop GraalCompiler::dump_deopted_leaf_graphs(TRAPS) {
51111665eda6 Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents: 5062
diff changeset
124 if (_deopted_leaf_graph_count == 0) {
51111665eda6 Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents: 5062
diff changeset
125 return NULL;
51111665eda6 Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents: 5062
diff changeset
126 }
51111665eda6 Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents: 5062
diff changeset
127 jlong* elements;
51111665eda6 Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents: 5062
diff changeset
128 int length;
51111665eda6 Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents: 5062
diff changeset
129 {
51111665eda6 Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents: 5062
diff changeset
130 MutexLockerEx y(GraalDeoptLeafGraphIds_lock, Mutex::_no_safepoint_check_flag);
51111665eda6 Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents: 5062
diff changeset
131 if (_deopted_leaf_graph_count == 0) {
51111665eda6 Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents: 5062
diff changeset
132 return NULL;
51111665eda6 Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents: 5062
diff changeset
133 }
51111665eda6 Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents: 5062
diff changeset
134 if (_deopted_leaf_graph_count == LEAF_GRAPH_ARRAY_SIZE) {
51111665eda6 Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents: 5062
diff changeset
135 length = 0;
51111665eda6 Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents: 5062
diff changeset
136 } else {
51111665eda6 Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents: 5062
diff changeset
137 length = _deopted_leaf_graph_count;
51111665eda6 Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents: 5062
diff changeset
138 }
51111665eda6 Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents: 5062
diff changeset
139 elements = new jlong[length];
51111665eda6 Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents: 5062
diff changeset
140 for (int i = 0; i < length; i++) {
51111665eda6 Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents: 5062
diff changeset
141 elements[i] = _deopted_leaf_graphs[i];
51111665eda6 Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents: 5062
diff changeset
142 }
51111665eda6 Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents: 5062
diff changeset
143 _deopted_leaf_graph_count = 0;
51111665eda6 Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents: 5062
diff changeset
144 }
51111665eda6 Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents: 5062
diff changeset
145 typeArrayOop array = oopFactory::new_longArray(length, CHECK_NULL);
51111665eda6 Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents: 5062
diff changeset
146 for (int i = 0; i < length; i++) {
51111665eda6 Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents: 5062
diff changeset
147 array->long_at_put(i, elements[i]);
51111665eda6 Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents: 5062
diff changeset
148 }
51111665eda6 Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents: 5062
diff changeset
149 delete elements;
51111665eda6 Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents: 5062
diff changeset
150 return array;
51111665eda6 Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents: 5062
diff changeset
151 }
51111665eda6 Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents: 5062
diff changeset
152
2891
75a99b4f1c98 Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2890
diff changeset
153 void GraalCompiler::initialize_buffer_blob() {
1931
48bbaead8b6c Adjustments after merge with OpenJDK repository.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1483
diff changeset
154
3555
22d11b3bc561 Various hacks to be able to install machine code from a Java thread.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 3090
diff changeset
155 JavaThread* THREAD = JavaThread::current();
1931
48bbaead8b6c Adjustments after merge with OpenJDK repository.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1483
diff changeset
156 if (THREAD->get_buffer_blob() == NULL) {
7125
1baf7f1e3f23 decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents: 7115
diff changeset
157 BufferBlob* blob = BufferBlob::create("Graal thread-local CodeBuffer", GraalNMethodSizeLimit);
1931
48bbaead8b6c Adjustments after merge with OpenJDK repository.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1483
diff changeset
158 guarantee(blob != NULL, "must create code buffer");
48bbaead8b6c Adjustments after merge with OpenJDK repository.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1483
diff changeset
159 THREAD->set_buffer_blob(blob);
48bbaead8b6c Adjustments after merge with OpenJDK repository.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1483
diff changeset
160 }
48bbaead8b6c Adjustments after merge with OpenJDK repository.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1483
diff changeset
161 }
48bbaead8b6c Adjustments after merge with OpenJDK repository.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1483
diff changeset
162
3651
a31028282e3e Support blocking compilation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3650
diff changeset
163 void GraalCompiler::compile_method(methodHandle method, int entry_bci, jboolean blocking) {
7126
ce248dc0a656 removed all Graal modifications to ci and c1
Doug Simon <doug.simon@oracle.com>
parents: 7125
diff changeset
164 GRAAL_EXCEPTION_CONTEXT
3651
a31028282e3e Support blocking compilation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3650
diff changeset
165 if (!_initialized) {
a31028282e3e Support blocking compilation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3650
diff changeset
166 method->clear_queued_for_compilation();
a31028282e3e Support blocking compilation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3650
diff changeset
167 method->invocation_counter()->reset();
a31028282e3e Support blocking compilation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3650
diff changeset
168 method->backedge_counter()->reset();
a31028282e3e Support blocking compilation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3650
diff changeset
169 return;
a31028282e3e Support blocking compilation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3650
diff changeset
170 }
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6699
diff changeset
171
3650
0e8a2a629afb Pass-by compilation broker.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3649
diff changeset
172 assert(_initialized, "must already be initialized");
0e8a2a629afb Pass-by compilation broker.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3649
diff changeset
173 ResourceMark rm;
8151
b8f261ba79c6 Minimize diff to plain HotSpot version.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7813
diff changeset
174 JavaThread::current()->set_is_compiling(true);
7084
9ba90252ce08 HotSpotResolvedJavaType is now the HotSpot implementation of ResolvedJavaType,
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 6950
diff changeset
175 Handle holder = GraalCompiler::createHotSpotResolvedObjectType(method, CHECK);
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6699
diff changeset
176 jboolean success = VMToCompiler::compileMethod(method(), holder, entry_bci, blocking, method->graal_priority());
8151
b8f261ba79c6 Minimize diff to plain HotSpot version.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7813
diff changeset
177 JavaThread::current()->set_is_compiling(false);
5018
bf63d72879aa fixed an issue that prevented java.util.concurrent methods from being compiled
Christian Haeubl <christian.haeubl@oracle.com>
parents: 5003
diff changeset
178 if (success != JNI_TRUE) {
bf63d72879aa fixed an issue that prevented java.util.concurrent methods from being compiled
Christian Haeubl <christian.haeubl@oracle.com>
parents: 5003
diff changeset
179 method->clear_queued_for_compilation();
5150
fdd9dd4508fa some GC fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 5130
diff changeset
180 CompilationPolicy::policy()->delay_compilation(method());
5018
bf63d72879aa fixed an issue that prevented java.util.concurrent methods from being compiled
Christian Haeubl <christian.haeubl@oracle.com>
parents: 5003
diff changeset
181 }
3650
0e8a2a629afb Pass-by compilation broker.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3649
diff changeset
182 }
0e8a2a629afb Pass-by compilation broker.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3649
diff changeset
183
1406
35069ca331f2 Hooked C1XCompiler class into the system.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff changeset
184 // Compilation entry point for methods
2891
75a99b4f1c98 Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2890
diff changeset
185 void GraalCompiler::compile_method(ciEnv* env, ciMethod* target, int entry_bci) {
3651
a31028282e3e Support blocking compilation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3650
diff changeset
186 ShouldNotReachHere();
1406
35069ca331f2 Hooked C1XCompiler class into the system.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff changeset
187 }
35069ca331f2 Hooked C1XCompiler class into the system.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff changeset
188
2901
d577d07cedec Added time measurement for phases.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2891
diff changeset
189 void GraalCompiler::exit() {
3576
c94966c5fb41 Only shut down the compiler if it was initialized.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3566
diff changeset
190 if (_initialized) {
4221
bcbb918f5ac6 Renaming of VMExits and VMEntries part 2.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4139
diff changeset
191 VMToCompiler::shutdownCompiler();
3576
c94966c5fb41 Only shut down the compiler if it was initialized.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3566
diff changeset
192 }
2901
d577d07cedec Added time measurement for phases.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2891
diff changeset
193 }
d577d07cedec Added time measurement for phases.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2891
diff changeset
194
1406
35069ca331f2 Hooked C1XCompiler class into the system.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff changeset
195 // Print compilation timers and statistics
2891
75a99b4f1c98 Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2890
diff changeset
196 void GraalCompiler::print_timers() {
75a99b4f1c98 Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2890
diff changeset
197 TRACE_graal_1("GraalCompiler::print_timers");
1410
b30a2cd5e3a2 Added methods to c1x_VMExits.cpp
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1407
diff changeset
198 }
b30a2cd5e3a2 Added methods to c1x_VMExits.cpp
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1407
diff changeset
199
5554
70f715dfbb41 Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5545
diff changeset
200 Handle GraalCompiler::get_JavaType(Symbol* klass_name, TRAPS) {
7811
94ea9a864fc6 Remove usages of VmIds.toString.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7739
diff changeset
201 return VMToCompiler::createUnresolvedJavaType(java_lang_String::create_from_symbol(klass_name, THREAD), THREAD);
3637
ff6a991c6e3c Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3634
diff changeset
202 }
ff6a991c6e3c Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3634
diff changeset
203
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6699
diff changeset
204 Handle GraalCompiler::get_JavaTypeFromSignature(Symbol* signature, KlassHandle loading_klass, TRAPS) {
3637
ff6a991c6e3c Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3634
diff changeset
205
ff6a991c6e3c Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3634
diff changeset
206 BasicType field_type = FieldType::basic_type(signature);
ff6a991c6e3c Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3634
diff changeset
207 // 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
208 // field.
ff6a991c6e3c Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3634
diff changeset
209 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
210 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
211 if (handle.is_null()) {
5554
70f715dfbb41 Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5545
diff changeset
212 return get_JavaType(signature, CHECK_NULL);
3637
ff6a991c6e3c Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3634
diff changeset
213 } else {
5554
70f715dfbb41 Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5545
diff changeset
214 return get_JavaType(handle, CHECK_NULL);
3637
ff6a991c6e3c Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3634
diff changeset
215 }
3566
b0d192f86f34 more work on ci removal
Lukas Stadler <lukas.stadler@jku.at>
parents: 3565
diff changeset
216 } else {
5554
70f715dfbb41 Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5545
diff changeset
217 return VMToCompiler::createPrimitiveJavaType(field_type, CHECK_NULL);
3566
b0d192f86f34 more work on ci removal
Lukas Stadler <lukas.stadler@jku.at>
parents: 3565
diff changeset
218 }
3637
ff6a991c6e3c Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3634
diff changeset
219 }
ff6a991c6e3c Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3634
diff changeset
220
5554
70f715dfbb41 Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5545
diff changeset
221 Handle GraalCompiler::get_JavaType(constantPoolHandle cp, int index, KlassHandle loading_klass, TRAPS) {
3637
ff6a991c6e3c Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3634
diff changeset
222 bool is_accessible = false;
ff6a991c6e3c Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3634
diff changeset
223
ff6a991c6e3c Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3634
diff changeset
224 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
225 oop catch_class = NULL;
ff6a991c6e3c Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3634
diff changeset
226 if (klass.is_null()) {
ff6a991c6e3c Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3634
diff changeset
227 Symbol* klass_name = NULL;
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6699
diff changeset
228 {
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6699
diff changeset
229 // We have to lock the cpool to keep the oop from being resolved
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6699
diff changeset
230 // while we are accessing it. But we must release the lock before
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6699
diff changeset
231 // calling up into Java.
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6699
diff changeset
232 MonitorLockerEx ml(cp->lock());
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6699
diff changeset
233 constantTag tag = cp->tag_at(index);
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6699
diff changeset
234 if (tag.is_klass()) {
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6699
diff changeset
235 // The klass has been inserted into the constant pool
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6699
diff changeset
236 // very recently.
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6699
diff changeset
237 return GraalCompiler::get_JavaType(cp->resolved_klass_at(index), CHECK_NULL);
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6699
diff changeset
238 } else if (tag.is_symbol()) {
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6699
diff changeset
239 klass_name = cp->symbol_at(index);
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6699
diff changeset
240 } else {
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6699
diff changeset
241 assert(cp->tag_at(index).is_unresolved_klass(), "wrong tag");
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6699
diff changeset
242 klass_name = cp->unresolved_klass_at(index);
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6699
diff changeset
243 }
3637
ff6a991c6e3c Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3634
diff changeset
244 }
5554
70f715dfbb41 Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5545
diff changeset
245 return GraalCompiler::get_JavaType(klass_name, CHECK_NULL);
3637
ff6a991c6e3c Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3634
diff changeset
246 } else {
5554
70f715dfbb41 Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5545
diff changeset
247 return GraalCompiler::get_JavaType(klass, CHECK_NULL);
3637
ff6a991c6e3c Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3634
diff changeset
248 }
ff6a991c6e3c Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3634
diff changeset
249 }
ff6a991c6e3c Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3634
diff changeset
250
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6948
diff changeset
251 Handle GraalCompiler::get_JavaTypeFromClass(Handle java_class, TRAPS) {
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6948
diff changeset
252 oop graal_mirror = java_lang_Class::graal_mirror(java_class());
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6948
diff changeset
253 if (graal_mirror != NULL) {
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6948
diff changeset
254 return graal_mirror;
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6948
diff changeset
255 }
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6948
diff changeset
256
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6948
diff changeset
257 if (java_lang_Class::is_primitive(java_class())) {
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6948
diff changeset
258 BasicType basicType = java_lang_Class::primitive_type(java_class());
6442
45f682f7fea8 Add MetaAccessProvider.getResolvedJavaField to convert from reflection field to metadata field
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6367
diff changeset
259 return VMToCompiler::createPrimitiveJavaType((int) basicType, THREAD);
45f682f7fea8 Add MetaAccessProvider.getResolvedJavaField to convert from reflection field to metadata field
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6367
diff changeset
260 } else {
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6948
diff changeset
261 KlassHandle klass = java_lang_Class::as_Klass(java_class());
6442
45f682f7fea8 Add MetaAccessProvider.getResolvedJavaField to convert from reflection field to metadata field
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6367
diff changeset
262 Handle name = java_lang_String::create_from_symbol(klass->name(), CHECK_NULL);
7084
9ba90252ce08 HotSpotResolvedJavaType is now the HotSpot implementation of ResolvedJavaType,
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 6950
diff changeset
263 return GraalCompiler::createHotSpotResolvedObjectType(klass, name, CHECK_NULL);
6442
45f682f7fea8 Add MetaAccessProvider.getResolvedJavaField to convert from reflection field to metadata field
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6367
diff changeset
264 }
45f682f7fea8 Add MetaAccessProvider.getResolvedJavaField to convert from reflection field to metadata field
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6367
diff changeset
265 }
45f682f7fea8 Add MetaAccessProvider.getResolvedJavaField to convert from reflection field to metadata field
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6367
diff changeset
266
5554
70f715dfbb41 Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5545
diff changeset
267 Handle GraalCompiler::get_JavaType(KlassHandle klass, TRAPS) {
7811
94ea9a864fc6 Remove usages of VmIds.toString.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7739
diff changeset
268 Handle name = java_lang_String::create_from_symbol(klass->name(), THREAD);
7084
9ba90252ce08 HotSpotResolvedJavaType is now the HotSpot implementation of ResolvedJavaType,
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 6950
diff changeset
269 return createHotSpotResolvedObjectType(klass, name, CHECK_NULL);
3565
b3f0f8a01ca2 remove some ci-dependencies
Lukas Stadler <lukas.stadler@jku.at>
parents: 3555
diff changeset
270 }
b3f0f8a01ca2 remove some ci-dependencies
Lukas Stadler <lukas.stadler@jku.at>
parents: 3555
diff changeset
271
6442
45f682f7fea8 Add MetaAccessProvider.getResolvedJavaField to convert from reflection field to metadata field
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6367
diff changeset
272 Handle GraalCompiler::get_JavaField(int offset, int flags, Symbol* field_name, Handle field_holder, Handle field_type, TRAPS) {
7811
94ea9a864fc6 Remove usages of VmIds.toString.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7739
diff changeset
273 Handle name = java_lang_String::create_from_symbol(field_name, CHECK_NULL);
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6699
diff changeset
274 return VMToCompiler::createJavaField(field_holder, name, field_type, offset, flags, false, CHECK_NULL);
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6699
diff changeset
275 }
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6699
diff changeset
276
7084
9ba90252ce08 HotSpotResolvedJavaType is now the HotSpot implementation of ResolvedJavaType,
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 6950
diff changeset
277 Handle GraalCompiler::createHotSpotResolvedObjectType(methodHandle method, TRAPS) {
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6699
diff changeset
278 KlassHandle klass = method->method_holder();
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6699
diff changeset
279 oop java_class = klass->java_mirror();
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6699
diff changeset
280 oop graal_mirror = java_lang_Class::graal_mirror(java_class);
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6699
diff changeset
281 if (graal_mirror != NULL) {
7084
9ba90252ce08 HotSpotResolvedJavaType is now the HotSpot implementation of ResolvedJavaType,
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 6950
diff changeset
282 assert(graal_mirror->is_a(HotSpotResolvedObjectType::klass()), "unexpected class...");
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6699
diff changeset
283 return graal_mirror;
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6699
diff changeset
284 }
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6699
diff changeset
285 Handle name = java_lang_String::create_from_symbol(klass->name(), CHECK_NULL);
7084
9ba90252ce08 HotSpotResolvedJavaType is now the HotSpot implementation of ResolvedJavaType,
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 6950
diff changeset
286 return GraalCompiler::createHotSpotResolvedObjectType(klass, name, CHECK_NULL);
1413
1ecc8f0aad00 Draft implementation of HotSpot CRI / first method compiling without exception.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1412
diff changeset
287 }
1ecc8f0aad00 Draft implementation of HotSpot CRI / first method compiling without exception.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1412
diff changeset
288
7084
9ba90252ce08 HotSpotResolvedJavaType is now the HotSpot implementation of ResolvedJavaType,
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 6950
diff changeset
289 Handle GraalCompiler::createHotSpotResolvedObjectType(KlassHandle klass, Handle name, TRAPS) {
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6699
diff changeset
290 oop java_class = klass->java_mirror();
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6699
diff changeset
291 oop graal_mirror = java_lang_Class::graal_mirror(java_class);
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6699
diff changeset
292 if (graal_mirror != NULL) {
7084
9ba90252ce08 HotSpotResolvedJavaType is now the HotSpot implementation of ResolvedJavaType,
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 6950
diff changeset
293 assert(graal_mirror->is_a(HotSpotResolvedObjectType::klass()), "unexpected class...");
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6699
diff changeset
294 return graal_mirror;
1941
79d04223b8a5 Added caching for resolved types and resolved fields.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1931
diff changeset
295 }
79d04223b8a5 Added caching for resolved types and resolved fields.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1931
diff changeset
296
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6699
diff changeset
297 Handle simpleName = name;
2055
99ad52189524 Refactorings to get towards less CRI overhead.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2046
diff changeset
298 if (klass->oop_is_instance()) {
3650
0e8a2a629afb Pass-by compilation broker.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3649
diff changeset
299 ResourceMark rm;
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6699
diff changeset
300 InstanceKlass* ik = (InstanceKlass*) klass();
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6699
diff changeset
301 name = java_lang_String::create_from_str(ik->signature_name(), CHECK_NULL);
1429
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
302 }
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
303
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6699
diff changeset
304 int sizeOrSpecies;
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6699
diff changeset
305 if (klass->is_interface()) {
7084
9ba90252ce08 HotSpotResolvedJavaType is now the HotSpot implementation of ResolvedJavaType,
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 6950
diff changeset
306 sizeOrSpecies = (int) 0x80000000; // see HotSpotResolvedObjectType.INTERFACE_SPECIES_VALUE
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6699
diff changeset
307 } else if (klass->oop_is_array()) {
7084
9ba90252ce08 HotSpotResolvedJavaType is now the HotSpot implementation of ResolvedJavaType,
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 6950
diff changeset
308 sizeOrSpecies = (int) 0x7fffffff; // see HotSpotResolvedObjectType.ARRAY_SPECIES_VALUE
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6699
diff changeset
309 } else {
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6699
diff changeset
310 sizeOrSpecies = InstanceKlass::cast(klass())->size_helper() * HeapWordSize;
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6699
diff changeset
311 if (!InstanceKlass::cast(klass())->can_be_fastpath_allocated()) {
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6699
diff changeset
312 sizeOrSpecies = -sizeOrSpecies;
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6699
diff changeset
313 }
4439
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4221
diff changeset
314 }
f7251c729b31 profiling info first try
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4221
diff changeset
315
9126
bc26f978b0ce HotSpotResolvedObjectType: implement hasFinalizeSubclass() correctly
Bernhard Urban <bernhard.urban@jku.at>
parents: 9108
diff changeset
316 return VMToCompiler::createResolvedJavaType(klass(), name, simpleName, java_class, sizeOrSpecies, CHECK_NULL);
3011
f00918f35c7f inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2925
diff changeset
317 }
f00918f35c7f inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2925
diff changeset
318
2891
75a99b4f1c98 Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2890
diff changeset
319 BasicType GraalCompiler::kindToBasicType(jchar ch) {
1434
72cfb36c6bb2 * enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1433
diff changeset
320 switch(ch) {
72cfb36c6bb2 * enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1433
diff changeset
321 case 'z': return T_BOOLEAN;
72cfb36c6bb2 * enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1433
diff changeset
322 case 'b': return T_BYTE;
72cfb36c6bb2 * enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1433
diff changeset
323 case 's': return T_SHORT;
72cfb36c6bb2 * enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1433
diff changeset
324 case 'c': return T_CHAR;
72cfb36c6bb2 * enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1433
diff changeset
325 case 'i': return T_INT;
72cfb36c6bb2 * enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1433
diff changeset
326 case 'f': return T_FLOAT;
3592
ff472e09af46 Fixed long signature char.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3591
diff changeset
327 case 'j': return T_LONG;
1434
72cfb36c6bb2 * enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1433
diff changeset
328 case 'd': return T_DOUBLE;
72cfb36c6bb2 * enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1433
diff changeset
329 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
330 case 'r': return T_ADDRESS;
1434
72cfb36c6bb2 * enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1433
diff changeset
331 case '-': return T_ILLEGAL;
72cfb36c6bb2 * enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1433
diff changeset
332 default:
5554
70f715dfbb41 Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5545
diff changeset
333 fatal(err_msg("unexpected Kind: %c", ch));
1434
72cfb36c6bb2 * enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1433
diff changeset
334 break;
72cfb36c6bb2 * enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1433
diff changeset
335 }
2215
999f8086cc4f More changes to make it compile and work on win64.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 2182
diff changeset
336 return T_ILLEGAL;
1434
72cfb36c6bb2 * enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1433
diff changeset
337 }