Mercurial > hg > truffle
annotate src/share/vm/graal/graalCompiler.cpp @ 15250:4c68a0eb69ca
mx: refactored JMH benchmark building and dependency creation out of 'jmh' into 'buildjmh' and 'makejmhdeps' respectively
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Sat, 19 Apr 2014 00:41:04 +0200 |
parents | 6876a4599b7e |
children | a20be10ad437 |
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" |
3637
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3634
diff
changeset
|
31 #include "graal/graalEnv.hpp" |
7125
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
7115
diff
changeset
|
32 #include "graal/graalRuntime.hpp" |
2663
d7c0775d7e72
added includes to build without precompiled headers
Christian.Wimmer@Oracle.com
parents:
2516
diff
changeset
|
33 #include "runtime/arguments.hpp" |
5150
fdd9dd4508fa
some GC fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
5130
diff
changeset
|
34 #include "runtime/compilationPolicy.hpp" |
14881
1415a62ac8b2
allow to force bootstrap in tiered
Bernhard Urban <bernhard.urban@jku.at>
parents:
14875
diff
changeset
|
35 #include "runtime/globals_extension.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; |
9934
0f7ca53be929
CR-806: Changes to build Graal for SPARC
Morris Meyer <morris.meyer@oracle.com>
parents:
9913
diff
changeset
|
54 AMD64_ONLY(guarantee(heap_end < allocation_end, "heap end too close to end of address space (might lead to erroneous TLAB allocations)")); |
7115
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 |
13156
2e76d94f8383
propagate code-cache-full message up to Java to throw exception instead of crashing VM
twisti
parents:
13106
diff
changeset
|
57 BufferBlob* buffer_blob = initialize_buffer_blob(); |
2e76d94f8383
propagate code-cache-full message up to Java to throw exception instead of crashing VM
twisti
parents:
13106
diff
changeset
|
58 if (buffer_blob == NULL) { |
2e76d94f8383
propagate code-cache-full message up to Java to throw exception instead of crashing VM
twisti
parents:
13106
diff
changeset
|
59 // If we are called from JNI_CreateJavaVM we cannot use set_state yet because it takes a lock. |
2e76d94f8383
propagate code-cache-full message up to Java to throw exception instead of crashing VM
twisti
parents:
13106
diff
changeset
|
60 // set_state(failed); |
2e76d94f8383
propagate code-cache-full message up to Java to throw exception instead of crashing VM
twisti
parents:
13106
diff
changeset
|
61 } else { |
2e76d94f8383
propagate code-cache-full message up to Java to throw exception instead of crashing VM
twisti
parents:
13106
diff
changeset
|
62 // set_state(initialized); |
2e76d94f8383
propagate code-cache-full message up to Java to throw exception instead of crashing VM
twisti
parents:
13106
diff
changeset
|
63 } |
1931
48bbaead8b6c
Adjustments after merge with OpenJDK repository.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1483
diff
changeset
|
64 |
1432
b61a43cd1255
sourcecode formatting
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
65 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
|
66 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
|
67 if (klass == NULL) { |
4221
bcbb918f5ac6
Renaming of VMExits and VMEntries part 2.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4139
diff
changeset
|
68 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
|
69 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
|
70 } |
4221
bcbb918f5ac6
Renaming of VMExits and VMEntries part 2.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4139
diff
changeset
|
71 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
|
72 |
3650
0e8a2a629afb
Pass-by compilation broker.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3649
diff
changeset
|
73 ResourceMark rm; |
0e8a2a629afb
Pass-by compilation broker.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3649
diff
changeset
|
74 HandleMark hm; |
1452
9b22e3e5df8e
Solved an issue with unresolved field patching.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1449
diff
changeset
|
75 { |
7126
ce248dc0a656
removed all Graal modifications to ci and c1
Doug Simon <doug.simon@oracle.com>
parents:
7125
diff
changeset
|
76 GRAAL_VM_ENTRY_MARK; |
1452
9b22e3e5df8e
Solved an issue with unresolved field patching.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1449
diff
changeset
|
77 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
|
78 } |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
79 |
2891
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2890
diff
changeset
|
80 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
|
81 |
13096
b65b34c524cb
Ensure _non_oop_bits is initialized before starting compile
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13089
diff
changeset
|
82 // Ensure _non_oop_bits is initialized |
b65b34c524cb
Ensure _non_oop_bits is initialized before starting compile
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13089
diff
changeset
|
83 Universe::non_oop_word(); |
b65b34c524cb
Ensure _non_oop_bits is initialized before starting compile
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13089
diff
changeset
|
84 |
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 { |
7126
ce248dc0a656
removed all Graal modifications to ci and c1
Doug Simon <doug.simon@oracle.com>
parents:
7125
diff
changeset
|
86 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
|
87 HandleMark hm; |
9913
35f93560b1f0
ensure that <clinit> for HotSpotOptions is called irrespective of whether and -G: options are specified
Doug Simon <doug.simon@oracle.com>
parents:
9728
diff
changeset
|
88 VMToCompiler::initOptions(); |
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 } |
13106
bdc836ef885e
made CITimeEach work for Graal even if CITime is not enabled
Doug Simon <doug.simon@oracle.com>
parents:
13104
diff
changeset
|
98 VMToCompiler::finalizeOptions(CITime || CITimeEach); |
11561
e1309fc4d17f
ensure Debug.enable() is called before any DebugTimer or DebugMetric objects are requested
Doug Simon <doug.simon@oracle.com>
parents:
10770
diff
changeset
|
99 |
3694
221133c5ed6c
Don't call startCompiler if the VM is run with -Xint
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3653
diff
changeset
|
100 if (UseCompiler) { |
14768
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14172
diff
changeset
|
101 _external_deopt_i2c_entry = create_external_deopt_i2c(); |
14881
1415a62ac8b2
allow to force bootstrap in tiered
Bernhard Urban <bernhard.urban@jku.at>
parents:
14875
diff
changeset
|
102 #ifdef COMPILERGRAAL |
1415a62ac8b2
allow to force bootstrap in tiered
Bernhard Urban <bernhard.urban@jku.at>
parents:
14875
diff
changeset
|
103 bool bootstrap = FLAG_IS_DEFAULT(BootstrapGraal) ? !TieredCompilation : BootstrapGraal; |
1415a62ac8b2
allow to force bootstrap in tiered
Bernhard Urban <bernhard.urban@jku.at>
parents:
14875
diff
changeset
|
104 #else |
1415a62ac8b2
allow to force bootstrap in tiered
Bernhard Urban <bernhard.urban@jku.at>
parents:
14875
diff
changeset
|
105 bool bootstrap = false; |
1415a62ac8b2
allow to force bootstrap in tiered
Bernhard Urban <bernhard.urban@jku.at>
parents:
14875
diff
changeset
|
106 #endif |
15106
6876a4599b7e
create NodeClass for each Node subclass during class initialization of the latter
Doug Simon <doug.simon@oracle.com>
parents:
15059
diff
changeset
|
107 VMToCompiler::startCompiler(bootstrap); |
3694
221133c5ed6c
Don't call startCompiler if the VM is run with -Xint
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3653
diff
changeset
|
108 _initialized = true; |
12652
0dd597c6c9c7
fixed performance regression in hosted CompileTheWorld
Doug Simon <doug.simon@oracle.com>
parents:
12647
diff
changeset
|
109 CompilationPolicy::completed_vm_startup(); |
12647
b038b643a3a4
restricted BootstrapGraal option to GRAALVM builds only
Doug Simon <doug.simon@oracle.com>
parents:
11585
diff
changeset
|
110 if (bootstrap) { |
13156
2e76d94f8383
propagate code-cache-full message up to Java to throw exception instead of crashing VM
twisti
parents:
13106
diff
changeset
|
111 // Avoid -Xcomp and -Xbatch problems by turning on interpreter and background compilation for bootstrapping. |
2e76d94f8383
propagate code-cache-full message up to Java to throw exception instead of crashing VM
twisti
parents:
13106
diff
changeset
|
112 FlagSetting a(UseInterpreter, true); |
2e76d94f8383
propagate code-cache-full message up to Java to throw exception instead of crashing VM
twisti
parents:
13106
diff
changeset
|
113 FlagSetting b(BackgroundCompilation, true); |
13353
0e5c4f9fa9a5
enabled non-hosted CompileTheWorld execution with complete bootstrapping and the ability to override compilation options separately for CTW compilations
Doug Simon <doug.simon@oracle.com>
parents:
13263
diff
changeset
|
114 #ifndef PRODUCT |
13363
5c891b2983c5
improved comment explaining why CompileTheWorld is set to false during bootstrapping
Doug Simon <doug.simon@oracle.com>
parents:
13353
diff
changeset
|
115 // Turn off CompileTheWorld during bootstrap so that a counter overflow event |
5c891b2983c5
improved comment explaining why CompileTheWorld is set to false during bootstrapping
Doug Simon <doug.simon@oracle.com>
parents:
13353
diff
changeset
|
116 // triggers further compilation (see NonTieredCompPolicy::event()) hence |
5c891b2983c5
improved comment explaining why CompileTheWorld is set to false during bootstrapping
Doug Simon <doug.simon@oracle.com>
parents:
13353
diff
changeset
|
117 // allowing a complete bootstrap |
13353
0e5c4f9fa9a5
enabled non-hosted CompileTheWorld execution with complete bootstrapping and the ability to override compilation options separately for CTW compilations
Doug Simon <doug.simon@oracle.com>
parents:
13263
diff
changeset
|
118 FlagSetting c(CompileTheWorld, false); |
0e5c4f9fa9a5
enabled non-hosted CompileTheWorld execution with complete bootstrapping and the ability to override compilation options separately for CTW compilations
Doug Simon <doug.simon@oracle.com>
parents:
13263
diff
changeset
|
119 #endif |
4221
bcbb918f5ac6
Renaming of VMExits and VMEntries part 2.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4139
diff
changeset
|
120 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
|
121 } |
12652
0dd597c6c9c7
fixed performance regression in hosted CompileTheWorld
Doug Simon <doug.simon@oracle.com>
parents:
12647
diff
changeset
|
122 |
0dd597c6c9c7
fixed performance regression in hosted CompileTheWorld
Doug Simon <doug.simon@oracle.com>
parents:
12647
diff
changeset
|
123 #ifndef PRODUCT |
0dd597c6c9c7
fixed performance regression in hosted CompileTheWorld
Doug Simon <doug.simon@oracle.com>
parents:
12647
diff
changeset
|
124 if (CompileTheWorld) { |
0dd597c6c9c7
fixed performance regression in hosted CompileTheWorld
Doug Simon <doug.simon@oracle.com>
parents:
12647
diff
changeset
|
125 // We turn off CompileTheWorld so that Graal can |
0dd597c6c9c7
fixed performance regression in hosted CompileTheWorld
Doug Simon <doug.simon@oracle.com>
parents:
12647
diff
changeset
|
126 // be compiled by C1/C2 when Graal does a CTW. |
0dd597c6c9c7
fixed performance regression in hosted CompileTheWorld
Doug Simon <doug.simon@oracle.com>
parents:
12647
diff
changeset
|
127 CompileTheWorld = false; |
0dd597c6c9c7
fixed performance regression in hosted CompileTheWorld
Doug Simon <doug.simon@oracle.com>
parents:
12647
diff
changeset
|
128 VMToCompiler::compileTheWorld(); |
0dd597c6c9c7
fixed performance regression in hosted CompileTheWorld
Doug Simon <doug.simon@oracle.com>
parents:
12647
diff
changeset
|
129 } |
0dd597c6c9c7
fixed performance regression in hosted CompileTheWorld
Doug Simon <doug.simon@oracle.com>
parents:
12647
diff
changeset
|
130 #endif |
3651
a31028282e3e
Support blocking compilation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3650
diff
changeset
|
131 } |
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
|
132 } |
1406
35069ca331f2
Hooked C1XCompiler class into the system.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff
changeset
|
133 } |
35069ca331f2
Hooked C1XCompiler class into the system.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff
changeset
|
134 |
14768
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14172
diff
changeset
|
135 address GraalCompiler::create_external_deopt_i2c() { |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14172
diff
changeset
|
136 ResourceMark rm; |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14172
diff
changeset
|
137 BufferBlob* buffer = BufferBlob::create("externalDeopt", 1*K); |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14172
diff
changeset
|
138 CodeBuffer cb(buffer); |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14172
diff
changeset
|
139 short buffer_locs[20]; |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14172
diff
changeset
|
140 cb.insts()->initialize_shared_locs((relocInfo*)buffer_locs, sizeof(buffer_locs)/sizeof(relocInfo)); |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14172
diff
changeset
|
141 MacroAssembler masm(&cb); |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14172
diff
changeset
|
142 |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14172
diff
changeset
|
143 int total_args_passed = 5; |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14172
diff
changeset
|
144 |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14172
diff
changeset
|
145 BasicType* sig_bt = NEW_RESOURCE_ARRAY(BasicType, total_args_passed); |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14172
diff
changeset
|
146 VMRegPair* regs = NEW_RESOURCE_ARRAY(VMRegPair, total_args_passed); |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14172
diff
changeset
|
147 int i = 0; |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14172
diff
changeset
|
148 sig_bt[i++] = T_INT; |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14172
diff
changeset
|
149 sig_bt[i++] = T_LONG; |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14172
diff
changeset
|
150 sig_bt[i++] = T_VOID; // long stakes 2 slots |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14172
diff
changeset
|
151 sig_bt[i++] = T_INT; |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14172
diff
changeset
|
152 sig_bt[i++] = T_OBJECT; |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14172
diff
changeset
|
153 |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14172
diff
changeset
|
154 int comp_args_on_stack = SharedRuntime::java_calling_convention(sig_bt, regs, total_args_passed, false); |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14172
diff
changeset
|
155 |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14172
diff
changeset
|
156 SharedRuntime::gen_i2c_adapter(&masm, total_args_passed, comp_args_on_stack, sig_bt, regs); |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14172
diff
changeset
|
157 masm.flush(); |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14172
diff
changeset
|
158 |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14172
diff
changeset
|
159 return AdapterBlob::create(&cb)->content_begin(); |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14172
diff
changeset
|
160 } |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14172
diff
changeset
|
161 |
3e9a960f0da1
HSAIL: preliminary deopt support
Doug Simon <doug.simon@oracle.com>
parents:
14172
diff
changeset
|
162 |
13156
2e76d94f8383
propagate code-cache-full message up to Java to throw exception instead of crashing VM
twisti
parents:
13106
diff
changeset
|
163 BufferBlob* GraalCompiler::initialize_buffer_blob() { |
3555
22d11b3bc561
Various hacks to be able to install machine code from a Java thread.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
3090
diff
changeset
|
164 JavaThread* THREAD = JavaThread::current(); |
13156
2e76d94f8383
propagate code-cache-full message up to Java to throw exception instead of crashing VM
twisti
parents:
13106
diff
changeset
|
165 BufferBlob* buffer_blob = THREAD->get_buffer_blob(); |
2e76d94f8383
propagate code-cache-full message up to Java to throw exception instead of crashing VM
twisti
parents:
13106
diff
changeset
|
166 if (buffer_blob == NULL) { |
2e76d94f8383
propagate code-cache-full message up to Java to throw exception instead of crashing VM
twisti
parents:
13106
diff
changeset
|
167 buffer_blob = BufferBlob::create("Graal thread-local CodeBuffer", GraalNMethodSizeLimit); |
2e76d94f8383
propagate code-cache-full message up to Java to throw exception instead of crashing VM
twisti
parents:
13106
diff
changeset
|
168 if (buffer_blob != NULL) { |
2e76d94f8383
propagate code-cache-full message up to Java to throw exception instead of crashing VM
twisti
parents:
13106
diff
changeset
|
169 THREAD->set_buffer_blob(buffer_blob); |
2e76d94f8383
propagate code-cache-full message up to Java to throw exception instead of crashing VM
twisti
parents:
13106
diff
changeset
|
170 } |
1931
48bbaead8b6c
Adjustments after merge with OpenJDK repository.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1483
diff
changeset
|
171 } |
13156
2e76d94f8383
propagate code-cache-full message up to Java to throw exception instead of crashing VM
twisti
parents:
13106
diff
changeset
|
172 return buffer_blob; |
1931
48bbaead8b6c
Adjustments after merge with OpenJDK repository.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1483
diff
changeset
|
173 } |
48bbaead8b6c
Adjustments after merge with OpenJDK repository.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1483
diff
changeset
|
174 |
3651
a31028282e3e
Support blocking compilation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3650
diff
changeset
|
175 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
|
176 GRAAL_EXCEPTION_CONTEXT |
3651
a31028282e3e
Support blocking compilation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3650
diff
changeset
|
177 if (!_initialized) { |
10056
a323a9e20f9d
Fixed a few race conditions in the compilation queue.
Christian Haeubl <haeubl@ssw.jku.at>
parents:
9934
diff
changeset
|
178 CompilationPolicy::policy()->delay_compilation(method()); |
3651
a31028282e3e
Support blocking compilation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3650
diff
changeset
|
179 return; |
a31028282e3e
Support blocking compilation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3650
diff
changeset
|
180 } |
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
|
181 |
3650
0e8a2a629afb
Pass-by compilation broker.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3649
diff
changeset
|
182 assert(_initialized, "must already be initialized"); |
0e8a2a629afb
Pass-by compilation broker.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3649
diff
changeset
|
183 ResourceMark rm; |
13089
77fbf02f701c
re-enabled protection against recursive Graal compilation requests with Graal specific _graal_compiling field in JavaThread
Doug Simon <doug.simon@oracle.com>
parents:
13086
diff
changeset
|
184 thread->set_is_graal_compiling(true); |
13262
f13f6dc290c8
don't pass HotSpotResolvedObjectType to VMToCompiler.compileMethod but instead create it in Java code
twisti
parents:
13156
diff
changeset
|
185 VMToCompiler::compileMethod(method(), entry_bci, blocking); |
13089
77fbf02f701c
re-enabled protection against recursive Graal compilation requests with Graal specific _graal_compiling field in JavaThread
Doug Simon <doug.simon@oracle.com>
parents:
13086
diff
changeset
|
186 thread->set_is_graal_compiling(false); |
3650
0e8a2a629afb
Pass-by compilation broker.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3649
diff
changeset
|
187 } |
0e8a2a629afb
Pass-by compilation broker.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3649
diff
changeset
|
188 |
1406
35069ca331f2
Hooked C1XCompiler class into the system.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff
changeset
|
189 // Compilation entry point for methods |
2891
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2890
diff
changeset
|
190 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
|
191 ShouldNotReachHere(); |
1406
35069ca331f2
Hooked C1XCompiler class into the system.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff
changeset
|
192 } |
35069ca331f2
Hooked C1XCompiler class into the system.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff
changeset
|
193 |
2901
d577d07cedec
Added time measurement for phases.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2891
diff
changeset
|
194 void GraalCompiler::exit() { |
3576
c94966c5fb41
Only shut down the compiler if it was initialized.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3566
diff
changeset
|
195 if (_initialized) { |
4221
bcbb918f5ac6
Renaming of VMExits and VMEntries part 2.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4139
diff
changeset
|
196 VMToCompiler::shutdownCompiler(); |
3576
c94966c5fb41
Only shut down the compiler if it was initialized.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3566
diff
changeset
|
197 } |
2901
d577d07cedec
Added time measurement for phases.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2891
diff
changeset
|
198 } |
d577d07cedec
Added time measurement for phases.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2891
diff
changeset
|
199 |
1406
35069ca331f2
Hooked C1XCompiler class into the system.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff
changeset
|
200 // Print compilation timers and statistics |
2891
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2890
diff
changeset
|
201 void GraalCompiler::print_timers() { |
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2890
diff
changeset
|
202 TRACE_graal_1("GraalCompiler::print_timers"); |
1410
b30a2cd5e3a2
Added methods to c1x_VMExits.cpp
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1407
diff
changeset
|
203 } |
b30a2cd5e3a2
Added methods to c1x_VMExits.cpp
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1407
diff
changeset
|
204 |
2891
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2890
diff
changeset
|
205 BasicType GraalCompiler::kindToBasicType(jchar ch) { |
1434
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1433
diff
changeset
|
206 switch(ch) { |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1433
diff
changeset
|
207 case 'z': return T_BOOLEAN; |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1433
diff
changeset
|
208 case 'b': return T_BYTE; |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1433
diff
changeset
|
209 case 's': return T_SHORT; |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1433
diff
changeset
|
210 case 'c': return T_CHAR; |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1433
diff
changeset
|
211 case 'i': return T_INT; |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1433
diff
changeset
|
212 case 'f': return T_FLOAT; |
3592
ff472e09af46
Fixed long signature char.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3591
diff
changeset
|
213 case 'j': return T_LONG; |
1434
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1433
diff
changeset
|
214 case 'd': return T_DOUBLE; |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1433
diff
changeset
|
215 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
|
216 case 'r': return T_ADDRESS; |
1434
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1433
diff
changeset
|
217 case '-': return T_ILLEGAL; |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1433
diff
changeset
|
218 default: |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5545
diff
changeset
|
219 fatal(err_msg("unexpected Kind: %c", ch)); |
1434
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1433
diff
changeset
|
220 break; |
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1433
diff
changeset
|
221 } |
2215
999f8086cc4f
More changes to make it compile and work on win64.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
2182
diff
changeset
|
222 return T_ILLEGAL; |
1434
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1433
diff
changeset
|
223 } |