annotate graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java @ 7569:7cae58134ff7

collection of Graal compilation speed metrics is now triggered by -XX:+CITime instead of -Dgraal.benchmark.compilation=true
author Doug Simon <doug.simon@oracle.com>
date Wed, 30 Jan 2013 22:33:04 +0100
parents 0b68e6426b48
children 8bbbde9d0a52
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1 /*
4313
79af35bd9fd7 Bootstrap with a syncrhonized method to avoid later deoptimization when the first real synchronized method is compiled.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4265
diff changeset
2 * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
4 *
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
7 * published by the Free Software Foundation.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
8 *
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
13 * accompanied this code).
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
14 *
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
18 *
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
21 * questions.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
22 */
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
23
5060
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
24 package com.oracle.graal.hotspot.bridge;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
25
7384
d0fbdf2f7a0e added com.sun.crypto.provider.CipherBlockChaining intrinsifications
Doug Simon <doug.simon@oracle.com>
parents: 7373
diff changeset
26 import static com.oracle.graal.graph.UnsafeAccess.*;
7558
223f645acb9b added compilation rate measurements on top of existing metric/timer facility - enabled with -Dgraal.benchmark.compilation=true
Doug Simon <doug.simon@oracle.com>
parents: 7552
diff changeset
27 import static com.oracle.graal.hotspot.CompilationTask.*;
223f645acb9b added compilation rate measurements on top of existing metric/timer facility - enabled with -Dgraal.benchmark.compilation=true
Doug Simon <doug.simon@oracle.com>
parents: 7552
diff changeset
28 import static com.oracle.graal.java.GraphBuilderPhase.*;
223f645acb9b added compilation rate measurements on top of existing metric/timer facility - enabled with -Dgraal.benchmark.compilation=true
Doug Simon <doug.simon@oracle.com>
parents: 7552
diff changeset
29 import static com.oracle.graal.phases.common.InliningUtil.*;
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6682
diff changeset
30
5328
e4e02131c58b log file (i.e. -G:LogFile=log.txt option) now used for TTY output as well
Doug Simon <doug.simon@oracle.com>
parents: 5323
diff changeset
31 import java.io.*;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
32 import java.lang.reflect.*;
4406
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
33 import java.util.*;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
34 import java.util.concurrent.*;
5176
af59b4dfc9e4 compilation queue changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 5164
diff changeset
35 import java.util.concurrent.atomic.*;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
36
7064
8d16b9b2c51e first part of refactoring the InliningPhase
Christian Haeubl <haeubl@ssw.jku.at>
parents: 6682
diff changeset
37 import com.oracle.graal.api.code.*;
5507
dc71b06d09f8 Moving classes from cri.ri to api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5503
diff changeset
38 import com.oracle.graal.api.meta.*;
5060
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
39 import com.oracle.graal.compiler.*;
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
40 import com.oracle.graal.debug.*;
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
41 import com.oracle.graal.debug.internal.*;
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
42 import com.oracle.graal.hotspot.*;
5548
8872bc0eebdf Renaming hotspot.ri => hotspot.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5547
diff changeset
43 import com.oracle.graal.hotspot.meta.*;
6677
3dddb311395f hotspot infrastructure for OnStackReplacement
Lukas Stadler <lukas.stadler@jku.at>
parents: 6539
diff changeset
44 import com.oracle.graal.hotspot.phases.*;
5060
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
45 import com.oracle.graal.java.*;
6677
3dddb311395f hotspot infrastructure for OnStackReplacement
Lukas Stadler <lukas.stadler@jku.at>
parents: 6539
diff changeset
46 import com.oracle.graal.nodes.*;
6525
2c913b643422 rename packages in graal.phases to match project name
Doug Simon <doug.simon@oracle.com>
parents: 6500
diff changeset
47 import com.oracle.graal.phases.*;
6677
3dddb311395f hotspot infrastructure for OnStackReplacement
Lukas Stadler <lukas.stadler@jku.at>
parents: 6539
diff changeset
48 import com.oracle.graal.phases.PhasePlan.PhasePosition;
7318
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7247
diff changeset
49 import com.oracle.graal.printer.*;
5060
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
50 import com.oracle.graal.snippets.*;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
51
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
52 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
53 * Exits from the HotSpot VM into Java code.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
54 */
5529
d487ae06265d Move graal.hotspot.server into its own project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5526
diff changeset
55 public class VMToCompilerImpl implements VMToCompiler {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
56
5763
a3d71693e0ce removed bytecode disassembly from CodeCacheRuntime into separate BytecodeDisassembler class
Doug Simon <doug.simon@oracle.com>
parents: 5719
diff changeset
57 private final HotSpotGraalRuntime graalRuntime;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
58
7084
9ba90252ce08 HotSpotResolvedJavaType is now the HotSpot implementation of ResolvedJavaType,
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7081
diff changeset
59 public final HotSpotResolvedPrimitiveType typeBoolean;
9ba90252ce08 HotSpotResolvedJavaType is now the HotSpot implementation of ResolvedJavaType,
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7081
diff changeset
60 public final HotSpotResolvedPrimitiveType typeChar;
9ba90252ce08 HotSpotResolvedJavaType is now the HotSpot implementation of ResolvedJavaType,
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7081
diff changeset
61 public final HotSpotResolvedPrimitiveType typeFloat;
9ba90252ce08 HotSpotResolvedJavaType is now the HotSpot implementation of ResolvedJavaType,
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7081
diff changeset
62 public final HotSpotResolvedPrimitiveType typeDouble;
9ba90252ce08 HotSpotResolvedJavaType is now the HotSpot implementation of ResolvedJavaType,
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7081
diff changeset
63 public final HotSpotResolvedPrimitiveType typeByte;
9ba90252ce08 HotSpotResolvedJavaType is now the HotSpot implementation of ResolvedJavaType,
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7081
diff changeset
64 public final HotSpotResolvedPrimitiveType typeShort;
9ba90252ce08 HotSpotResolvedJavaType is now the HotSpot implementation of ResolvedJavaType,
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7081
diff changeset
65 public final HotSpotResolvedPrimitiveType typeInt;
9ba90252ce08 HotSpotResolvedJavaType is now the HotSpot implementation of ResolvedJavaType,
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7081
diff changeset
66 public final HotSpotResolvedPrimitiveType typeLong;
9ba90252ce08 HotSpotResolvedJavaType is now the HotSpot implementation of ResolvedJavaType,
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7081
diff changeset
67 public final HotSpotResolvedPrimitiveType typeVoid;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
68
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
69 private ThreadPoolExecutor compileQueue;
5176
af59b4dfc9e4 compilation queue changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 5164
diff changeset
70 private ThreadPoolExecutor slowCompileQueue;
af59b4dfc9e4 compilation queue changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 5164
diff changeset
71 private AtomicInteger compileTaskIds = new AtomicInteger();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
72
6721
98d691bc23da make osr compilations asynchronous
Lukas Stadler <lukas.stadler@jku.at>
parents: 6682
diff changeset
73 private volatile boolean bootstrapRunning;
98d691bc23da make osr compilations asynchronous
Lukas Stadler <lukas.stadler@jku.at>
parents: 6682
diff changeset
74
5328
e4e02131c58b log file (i.e. -G:LogFile=log.txt option) now used for TTY output as well
Doug Simon <doug.simon@oracle.com>
parents: 5323
diff changeset
75 private PrintStream log = System.out;
e4e02131c58b log file (i.e. -G:LogFile=log.txt option) now used for TTY output as well
Doug Simon <doug.simon@oracle.com>
parents: 5323
diff changeset
76
7569
7cae58134ff7 collection of Graal compilation speed metrics is now triggered by -XX:+CITime instead of -Dgraal.benchmark.compilation=true
Doug Simon <doug.simon@oracle.com>
parents: 7560
diff changeset
77 private boolean quietMeterAndTime;
7cae58134ff7 collection of Graal compilation speed metrics is now triggered by -XX:+CITime instead of -Dgraal.benchmark.compilation=true
Doug Simon <doug.simon@oracle.com>
parents: 7560
diff changeset
78
5534
e0f7a49129f2 Renamed HotSpotCompilerImpl => HotSpotGraalRuntime.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5530
diff changeset
79 public VMToCompilerImpl(HotSpotGraalRuntime compiler) {
5763
a3d71693e0ce removed bytecode disassembly from CodeCacheRuntime into separate BytecodeDisassembler class
Doug Simon <doug.simon@oracle.com>
parents: 5719
diff changeset
80 this.graalRuntime = compiler;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
81
7084
9ba90252ce08 HotSpotResolvedJavaType is now the HotSpot implementation of ResolvedJavaType,
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7081
diff changeset
82 typeBoolean = new HotSpotResolvedPrimitiveType(Kind.Boolean);
9ba90252ce08 HotSpotResolvedJavaType is now the HotSpot implementation of ResolvedJavaType,
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7081
diff changeset
83 typeChar = new HotSpotResolvedPrimitiveType(Kind.Char);
9ba90252ce08 HotSpotResolvedJavaType is now the HotSpot implementation of ResolvedJavaType,
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7081
diff changeset
84 typeFloat = new HotSpotResolvedPrimitiveType(Kind.Float);
9ba90252ce08 HotSpotResolvedJavaType is now the HotSpot implementation of ResolvedJavaType,
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7081
diff changeset
85 typeDouble = new HotSpotResolvedPrimitiveType(Kind.Double);
9ba90252ce08 HotSpotResolvedJavaType is now the HotSpot implementation of ResolvedJavaType,
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7081
diff changeset
86 typeByte = new HotSpotResolvedPrimitiveType(Kind.Byte);
9ba90252ce08 HotSpotResolvedJavaType is now the HotSpot implementation of ResolvedJavaType,
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7081
diff changeset
87 typeShort = new HotSpotResolvedPrimitiveType(Kind.Short);
9ba90252ce08 HotSpotResolvedJavaType is now the HotSpot implementation of ResolvedJavaType,
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7081
diff changeset
88 typeInt = new HotSpotResolvedPrimitiveType(Kind.Int);
9ba90252ce08 HotSpotResolvedJavaType is now the HotSpot implementation of ResolvedJavaType,
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7081
diff changeset
89 typeLong = new HotSpotResolvedPrimitiveType(Kind.Long);
9ba90252ce08 HotSpotResolvedJavaType is now the HotSpot implementation of ResolvedJavaType,
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7081
diff changeset
90 typeVoid = new HotSpotResolvedPrimitiveType(Kind.Void);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
91 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
92
7084
9ba90252ce08 HotSpotResolvedJavaType is now the HotSpot implementation of ResolvedJavaType,
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7081
diff changeset
93 private static void initMirror(HotSpotResolvedPrimitiveType type, long offset) {
7053
014727292ae0 removed more usages of ResolvedJavaType.toJava()
Doug Simon <doug.simon@oracle.com>
parents: 7034
diff changeset
94 Class<?> mirror = type.mirror();
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6682
diff changeset
95 unsafe.putObject(mirror, offset, type);
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6682
diff changeset
96 assert unsafe.getObject(mirror, offset) == type;
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6682
diff changeset
97 }
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6682
diff changeset
98
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
99 public void startCompiler() throws Throwable {
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6682
diff changeset
100
7569
7cae58134ff7 collection of Graal compilation speed metrics is now triggered by -XX:+CITime instead of -Dgraal.benchmark.compilation=true
Doug Simon <doug.simon@oracle.com>
parents: 7560
diff changeset
101 HotSpotVMConfig config = graalRuntime.getConfig();
7cae58134ff7 collection of Graal compilation speed metrics is now triggered by -XX:+CITime instead of -Dgraal.benchmark.compilation=true
Doug Simon <doug.simon@oracle.com>
parents: 7560
diff changeset
102 long offset = config.graalMirrorInClassOffset;
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6682
diff changeset
103 initMirror(typeBoolean, offset);
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6682
diff changeset
104 initMirror(typeChar, offset);
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6682
diff changeset
105 initMirror(typeFloat, offset);
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6682
diff changeset
106 initMirror(typeDouble, offset);
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6682
diff changeset
107 initMirror(typeByte, offset);
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6682
diff changeset
108 initMirror(typeShort, offset);
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6682
diff changeset
109 initMirror(typeInt, offset);
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6682
diff changeset
110 initMirror(typeLong, offset);
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6682
diff changeset
111 initMirror(typeVoid, offset);
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6682
diff changeset
112
5328
e4e02131c58b log file (i.e. -G:LogFile=log.txt option) now used for TTY output as well
Doug Simon <doug.simon@oracle.com>
parents: 5323
diff changeset
113 if (GraalOptions.LogFile != null) {
e4e02131c58b log file (i.e. -G:LogFile=log.txt option) now used for TTY output as well
Doug Simon <doug.simon@oracle.com>
parents: 5323
diff changeset
114 try {
e4e02131c58b log file (i.e. -G:LogFile=log.txt option) now used for TTY output as well
Doug Simon <doug.simon@oracle.com>
parents: 5323
diff changeset
115 final boolean enableAutoflush = true;
e4e02131c58b log file (i.e. -G:LogFile=log.txt option) now used for TTY output as well
Doug Simon <doug.simon@oracle.com>
parents: 5323
diff changeset
116 log = new PrintStream(new FileOutputStream(GraalOptions.LogFile), enableAutoflush);
e4e02131c58b log file (i.e. -G:LogFile=log.txt option) now used for TTY output as well
Doug Simon <doug.simon@oracle.com>
parents: 5323
diff changeset
117 } catch (FileNotFoundException e) {
e4e02131c58b log file (i.e. -G:LogFile=log.txt option) now used for TTY output as well
Doug Simon <doug.simon@oracle.com>
parents: 5323
diff changeset
118 throw new RuntimeException("couldn't open log file: " + GraalOptions.LogFile, e);
e4e02131c58b log file (i.e. -G:LogFile=log.txt option) now used for TTY output as well
Doug Simon <doug.simon@oracle.com>
parents: 5323
diff changeset
119 }
e4e02131c58b log file (i.e. -G:LogFile=log.txt option) now used for TTY output as well
Doug Simon <doug.simon@oracle.com>
parents: 5323
diff changeset
120 }
e4e02131c58b log file (i.e. -G:LogFile=log.txt option) now used for TTY output as well
Doug Simon <doug.simon@oracle.com>
parents: 5323
diff changeset
121
e4e02131c58b log file (i.e. -G:LogFile=log.txt option) now used for TTY output as well
Doug Simon <doug.simon@oracle.com>
parents: 5323
diff changeset
122 TTY.initialize(log);
5164
56909bcec047 added check for use of MethodFilter option without use of Log, Dump, Meter or Time options
Doug Simon <doug.simon@oracle.com>
parents: 5138
diff changeset
123
56909bcec047 added check for use of MethodFilter option without use of Log, Dump, Meter or Time options
Doug Simon <doug.simon@oracle.com>
parents: 5138
diff changeset
124 if (GraalOptions.Log == null && GraalOptions.Meter == null && GraalOptions.Time == null && GraalOptions.Dump == null) {
56909bcec047 added check for use of MethodFilter option without use of Log, Dump, Meter or Time options
Doug Simon <doug.simon@oracle.com>
parents: 5138
diff changeset
125 if (GraalOptions.MethodFilter != null) {
56909bcec047 added check for use of MethodFilter option without use of Log, Dump, Meter or Time options
Doug Simon <doug.simon@oracle.com>
parents: 5138
diff changeset
126 TTY.println("WARNING: Ignoring MethodFilter option since Log, Meter, Time and Dump options are all null");
56909bcec047 added check for use of MethodFilter option without use of Log, Dump, Meter or Time options
Doug Simon <doug.simon@oracle.com>
parents: 5138
diff changeset
127 }
56909bcec047 added check for use of MethodFilter option without use of Log, Dump, Meter or Time options
Doug Simon <doug.simon@oracle.com>
parents: 5138
diff changeset
128 }
56909bcec047 added check for use of MethodFilter option without use of Log, Dump, Meter or Time options
Doug Simon <doug.simon@oracle.com>
parents: 5138
diff changeset
129
7569
7cae58134ff7 collection of Graal compilation speed metrics is now triggered by -XX:+CITime instead of -Dgraal.benchmark.compilation=true
Doug Simon <doug.simon@oracle.com>
parents: 7560
diff changeset
130 if (config.ciTime) {
7cae58134ff7 collection of Graal compilation speed metrics is now triggered by -XX:+CITime instead of -Dgraal.benchmark.compilation=true
Doug Simon <doug.simon@oracle.com>
parents: 7560
diff changeset
131 quietMeterAndTime = (GraalOptions.Meter == null && GraalOptions.Time == null);
7558
223f645acb9b added compilation rate measurements on top of existing metric/timer facility - enabled with -Dgraal.benchmark.compilation=true
Doug Simon <doug.simon@oracle.com>
parents: 7552
diff changeset
132 GraalOptions.Debug = true;
223f645acb9b added compilation rate measurements on top of existing metric/timer facility - enabled with -Dgraal.benchmark.compilation=true
Doug Simon <doug.simon@oracle.com>
parents: 7552
diff changeset
133 GraalOptions.Meter = "";
223f645acb9b added compilation rate measurements on top of existing metric/timer facility - enabled with -Dgraal.benchmark.compilation=true
Doug Simon <doug.simon@oracle.com>
parents: 7552
diff changeset
134 GraalOptions.Time = "";
223f645acb9b added compilation rate measurements on top of existing metric/timer facility - enabled with -Dgraal.benchmark.compilation=true
Doug Simon <doug.simon@oracle.com>
parents: 7552
diff changeset
135 }
223f645acb9b added compilation rate measurements on top of existing metric/timer facility - enabled with -Dgraal.benchmark.compilation=true
Doug Simon <doug.simon@oracle.com>
parents: 7552
diff changeset
136
7346
5ce0743ba6d8 Small fix that prevented debug mode to work with DebugSnippets set to false.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7318
diff changeset
137 if (GraalOptions.Debug) {
5ce0743ba6d8 Small fix that prevented debug mode to work with DebugSnippets set to false.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7318
diff changeset
138 Debug.enable();
5ce0743ba6d8 Small fix that prevented debug mode to work with DebugSnippets set to false.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7318
diff changeset
139 if (GraalOptions.DebugSnippets) {
5ce0743ba6d8 Small fix that prevented debug mode to work with DebugSnippets set to false.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7318
diff changeset
140 DebugEnvironment.initialize(log);
5ce0743ba6d8 Small fix that prevented debug mode to work with DebugSnippets set to false.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7318
diff changeset
141 }
4558
3706975946e4 Make graph dumping a bit more robust when there is no method, enable debug in the startCompiler method, add context and scope for snippets installation
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4479
diff changeset
142 }
7346
5ce0743ba6d8 Small fix that prevented debug mode to work with DebugSnippets set to false.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7318
diff changeset
143
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
144 // Install intrinsics.
5763
a3d71693e0ce removed bytecode disassembly from CodeCacheRuntime into separate BytecodeDisassembler class
Doug Simon <doug.simon@oracle.com>
parents: 5719
diff changeset
145 GraalCompiler compiler = graalRuntime.getCompiler();
a3d71693e0ce removed bytecode disassembly from CodeCacheRuntime into separate BytecodeDisassembler class
Doug Simon <doug.simon@oracle.com>
parents: 5719
diff changeset
146 final HotSpotRuntime runtime = (HotSpotRuntime) compiler.runtime;
4197
b765172082ac Move HotSpotMethod* and HotSpotType* implementations into ri subpackage.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4171
diff changeset
147 if (GraalOptions.Intrinsify) {
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7510
diff changeset
148 Debug.scope("InstallSnippets", new Object[]{new DebugDumpScope("InstallSnippets"), compiler}, new Runnable() {
5134
4eb9895d9afe Refactoring of the debug framework. Move compiler thread implementation to its own file.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5061
diff changeset
149
4558
3706975946e4 Make graph dumping a bit more robust when there is no method, enable debug in the startCompiler method, add context and scope for snippets installation
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4479
diff changeset
150 @Override
3706975946e4 Make graph dumping a bit more robust when there is no method, enable debug in the startCompiler method, add context and scope for snippets installation
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4479
diff changeset
151 public void run() {
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7510
diff changeset
152 // Snippets cannot have speculative optimizations since they have to be valid
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7510
diff changeset
153 // for the entire run of the VM.
7127
4632b14e56dd Snippets cannot have speculative optimizations since they have to be valid for the entire run of the VM
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7110
diff changeset
154 Assumptions assumptions = new Assumptions(false);
7373
6b2c55fc9ba8 reworked mechanism for omitting intrinsics if the underlying hardware support is not available and used it to make intrinsification of Integer.bitCount() dependent on whether the POPCNT instruction is available
Doug Simon <doug.simon@oracle.com>
parents: 7346
diff changeset
155 SnippetInstaller installer = new HotSpotSnippetInstaller(runtime, assumptions, runtime.getGraalRuntime().getTarget());
5585
a7ed598130c2 modified snippet installation to avoid using compiler storage for every method (not just the snippets) processed during installation
Doug Simon <doug.simon@oracle.com>
parents: 5554
diff changeset
156 GraalIntrinsics.installIntrinsics(installer);
7064
8d16b9b2c51e first part of refactoring the InliningPhase
Christian Haeubl <haeubl@ssw.jku.at>
parents: 6682
diff changeset
157 runtime.installSnippets(installer, assumptions);
4558
3706975946e4 Make graph dumping a bit more robust when there is no method, enable debug in the startCompiler method, add context and scope for snippets installation
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4479
diff changeset
158 }
3706975946e4 Make graph dumping a bit more robust when there is no method, enable debug in the startCompiler method, add context and scope for snippets installation
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4479
diff changeset
159 });
3706975946e4 Make graph dumping a bit more robust when there is no method, enable debug in the startCompiler method, add context and scope for snippets installation
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4479
diff changeset
160
4197
b765172082ac Move HotSpotMethod* and HotSpotType* implementations into ri subpackage.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4171
diff changeset
161 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
162
7558
223f645acb9b added compilation rate measurements on top of existing metric/timer facility - enabled with -Dgraal.benchmark.compilation=true
Doug Simon <doug.simon@oracle.com>
parents: 7552
diff changeset
163 if (GraalOptions.DebugSnippets) {
223f645acb9b added compilation rate measurements on top of existing metric/timer facility - enabled with -Dgraal.benchmark.compilation=true
Doug Simon <doug.simon@oracle.com>
parents: 7552
diff changeset
164 phaseTransition("snippets");
223f645acb9b added compilation rate measurements on top of existing metric/timer facility - enabled with -Dgraal.benchmark.compilation=true
Doug Simon <doug.simon@oracle.com>
parents: 7552
diff changeset
165 }
223f645acb9b added compilation rate measurements on top of existing metric/timer facility - enabled with -Dgraal.benchmark.compilation=true
Doug Simon <doug.simon@oracle.com>
parents: 7552
diff changeset
166
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
167 // Create compilation queue.
5183
e1e681a5558e fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents: 5177
diff changeset
168 BlockingQueue<Runnable> queue = GraalOptions.PriorityCompileQueue ? new PriorityBlockingQueue<Runnable>() : new LinkedBlockingQueue<Runnable>();
5176
af59b4dfc9e4 compilation queue changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 5164
diff changeset
169 compileQueue = new ThreadPoolExecutor(GraalOptions.Threads, GraalOptions.Threads, 0L, TimeUnit.MILLISECONDS, queue, CompilerThread.FACTORY);
af59b4dfc9e4 compilation queue changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 5164
diff changeset
170
af59b4dfc9e4 compilation queue changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 5164
diff changeset
171 if (GraalOptions.SlowCompileThreads) {
5183
e1e681a5558e fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents: 5177
diff changeset
172 BlockingQueue<Runnable> slowQueue = GraalOptions.PriorityCompileQueue ? new PriorityBlockingQueue<Runnable>() : new LinkedBlockingQueue<Runnable>();
5176
af59b4dfc9e4 compilation queue changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 5164
diff changeset
173 slowCompileQueue = new ThreadPoolExecutor(GraalOptions.Threads, GraalOptions.Threads, 0L, TimeUnit.MILLISECONDS, slowQueue, CompilerThread.LOW_PRIORITY_FACTORY);
af59b4dfc9e4 compilation queue changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 5164
diff changeset
174 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
175
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
176 // Create queue status printing thread.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
177 if (GraalOptions.PrintQueue) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
178 Thread t = new Thread() {
4406
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
179
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
180 @Override
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
181 public void run() {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
182 while (true) {
5176
af59b4dfc9e4 compilation queue changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 5164
diff changeset
183 if (slowCompileQueue == null) {
af59b4dfc9e4 compilation queue changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 5164
diff changeset
184 TTY.println(compileQueue.toString());
af59b4dfc9e4 compilation queue changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 5164
diff changeset
185 } else {
af59b4dfc9e4 compilation queue changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 5164
diff changeset
186 TTY.println("fast: " + compileQueue.toString() + " slow: " + slowCompileQueue);
af59b4dfc9e4 compilation queue changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 5164
diff changeset
187 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
188 try {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
189 Thread.sleep(1000);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
190 } catch (InterruptedException e) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
191 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
192 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
193 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
194 };
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
195 t.setDaemon(true);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
196 t.start();
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
197 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
198 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
199
4313
79af35bd9fd7 Bootstrap with a syncrhonized method to avoid later deoptimization when the first real synchronized method is compiled.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4265
diff changeset
200 /**
7558
223f645acb9b added compilation rate measurements on top of existing metric/timer facility - enabled with -Dgraal.benchmark.compilation=true
Doug Simon <doug.simon@oracle.com>
parents: 7552
diff changeset
201 * Take action related to entering a new execution phase.
223f645acb9b added compilation rate measurements on top of existing metric/timer facility - enabled with -Dgraal.benchmark.compilation=true
Doug Simon <doug.simon@oracle.com>
parents: 7552
diff changeset
202 *
223f645acb9b added compilation rate measurements on top of existing metric/timer facility - enabled with -Dgraal.benchmark.compilation=true
Doug Simon <doug.simon@oracle.com>
parents: 7552
diff changeset
203 * @param phase the execution phase being entered
223f645acb9b added compilation rate measurements on top of existing metric/timer facility - enabled with -Dgraal.benchmark.compilation=true
Doug Simon <doug.simon@oracle.com>
parents: 7552
diff changeset
204 */
223f645acb9b added compilation rate measurements on top of existing metric/timer facility - enabled with -Dgraal.benchmark.compilation=true
Doug Simon <doug.simon@oracle.com>
parents: 7552
diff changeset
205 protected void phaseTransition(String phase) {
223f645acb9b added compilation rate measurements on top of existing metric/timer facility - enabled with -Dgraal.benchmark.compilation=true
Doug Simon <doug.simon@oracle.com>
parents: 7552
diff changeset
206 CompilationStatistics.clear(phase);
7569
7cae58134ff7 collection of Graal compilation speed metrics is now triggered by -XX:+CITime instead of -Dgraal.benchmark.compilation=true
Doug Simon <doug.simon@oracle.com>
parents: 7560
diff changeset
207 if (graalRuntime.getConfig().ciTime) {
7558
223f645acb9b added compilation rate measurements on top of existing metric/timer facility - enabled with -Dgraal.benchmark.compilation=true
Doug Simon <doug.simon@oracle.com>
parents: 7552
diff changeset
208 parsedBytecodesPerSecond = MetricRateInPhase.snapshot(phase, parsedBytecodesPerSecond, BytecodesParsed, CompilationTime, TimeUnit.SECONDS);
223f645acb9b added compilation rate measurements on top of existing metric/timer facility - enabled with -Dgraal.benchmark.compilation=true
Doug Simon <doug.simon@oracle.com>
parents: 7552
diff changeset
209 inlinedBytecodesPerSecond = MetricRateInPhase.snapshot(phase, inlinedBytecodesPerSecond, InlinedBytecodes, CompilationTime, TimeUnit.SECONDS);
223f645acb9b added compilation rate measurements on top of existing metric/timer facility - enabled with -Dgraal.benchmark.compilation=true
Doug Simon <doug.simon@oracle.com>
parents: 7552
diff changeset
210 }
223f645acb9b added compilation rate measurements on top of existing metric/timer facility - enabled with -Dgraal.benchmark.compilation=true
Doug Simon <doug.simon@oracle.com>
parents: 7552
diff changeset
211 }
223f645acb9b added compilation rate measurements on top of existing metric/timer facility - enabled with -Dgraal.benchmark.compilation=true
Doug Simon <doug.simon@oracle.com>
parents: 7552
diff changeset
212
223f645acb9b added compilation rate measurements on top of existing metric/timer facility - enabled with -Dgraal.benchmark.compilation=true
Doug Simon <doug.simon@oracle.com>
parents: 7552
diff changeset
213 /**
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7510
diff changeset
214 * This method is the first method compiled during bootstrapping. Put any code in there that
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7510
diff changeset
215 * warms up compiler paths that are otherwise not exercised during bootstrapping and lead to
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7510
diff changeset
216 * later deoptimization when application code is compiled.
4313
79af35bd9fd7 Bootstrap with a syncrhonized method to avoid later deoptimization when the first real synchronized method is compiled.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4265
diff changeset
217 */
79af35bd9fd7 Bootstrap with a syncrhonized method to avoid later deoptimization when the first real synchronized method is compiled.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4265
diff changeset
218 @SuppressWarnings("unused")
79af35bd9fd7 Bootstrap with a syncrhonized method to avoid later deoptimization when the first real synchronized method is compiled.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4265
diff changeset
219 @Deprecated
79af35bd9fd7 Bootstrap with a syncrhonized method to avoid later deoptimization when the first real synchronized method is compiled.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4265
diff changeset
220 private synchronized void compileWarmup() {
79af35bd9fd7 Bootstrap with a syncrhonized method to avoid later deoptimization when the first real synchronized method is compiled.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4265
diff changeset
221 // Method is synchronized to exercise the synchronization code in the compiler.
79af35bd9fd7 Bootstrap with a syncrhonized method to avoid later deoptimization when the first real synchronized method is compiled.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4265
diff changeset
222 }
79af35bd9fd7 Bootstrap with a syncrhonized method to avoid later deoptimization when the first real synchronized method is compiled.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4265
diff changeset
223
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
224 public void bootstrap() throws Throwable {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
225 TTY.print("Bootstrapping Graal");
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
226 TTY.flush();
4168
0bc4815d2069 Start bootstrapping in compiler threads
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4142
diff changeset
227 long startTime = System.currentTimeMillis();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
228
6721
98d691bc23da make osr compilations asynchronous
Lukas Stadler <lukas.stadler@jku.at>
parents: 6682
diff changeset
229 bootstrapRunning = true;
5183
e1e681a5558e fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents: 5177
diff changeset
230 boolean firstRun = true;
e1e681a5558e fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents: 5177
diff changeset
231 do {
e1e681a5558e fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents: 5177
diff changeset
232 // Initialize compile queue with a selected set of methods.
e1e681a5558e fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents: 5177
diff changeset
233 Class<Object> objectKlass = Object.class;
e1e681a5558e fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents: 5177
diff changeset
234 if (firstRun) {
e1e681a5558e fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents: 5177
diff changeset
235 enqueue(getClass().getDeclaredMethod("compileWarmup"));
e1e681a5558e fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents: 5177
diff changeset
236 enqueue(objectKlass.getDeclaredMethod("equals", Object.class));
e1e681a5558e fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents: 5177
diff changeset
237 enqueue(objectKlass.getDeclaredMethod("toString"));
e1e681a5558e fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents: 5177
diff changeset
238 firstRun = false;
e1e681a5558e fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents: 5177
diff changeset
239 } else {
e1e681a5558e fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents: 5177
diff changeset
240 for (int i = 0; i < 100; i++) {
e1e681a5558e fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents: 5177
diff changeset
241 enqueue(getClass().getDeclaredMethod("bootstrap"));
e1e681a5558e fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents: 5177
diff changeset
242 }
e1e681a5558e fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents: 5177
diff changeset
243 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
244
5183
e1e681a5558e fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents: 5177
diff changeset
245 // Compile until the queue is empty.
e1e681a5558e fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents: 5177
diff changeset
246 int z = 0;
5263
d87155082c4d guard all compilation queue accesses, to avoid deadlocks
Lukas Stadler <lukas.stadler@jku.at>
parents: 5183
diff changeset
247 while (true) {
d87155082c4d guard all compilation queue accesses, to avoid deadlocks
Lukas Stadler <lukas.stadler@jku.at>
parents: 5183
diff changeset
248 try {
d87155082c4d guard all compilation queue accesses, to avoid deadlocks
Lukas Stadler <lukas.stadler@jku.at>
parents: 5183
diff changeset
249 assert !CompilationTask.withinEnqueue.get();
d87155082c4d guard all compilation queue accesses, to avoid deadlocks
Lukas Stadler <lukas.stadler@jku.at>
parents: 5183
diff changeset
250 CompilationTask.withinEnqueue.set(Boolean.TRUE);
d87155082c4d guard all compilation queue accesses, to avoid deadlocks
Lukas Stadler <lukas.stadler@jku.at>
parents: 5183
diff changeset
251 if (slowCompileQueue == null) {
d87155082c4d guard all compilation queue accesses, to avoid deadlocks
Lukas Stadler <lukas.stadler@jku.at>
parents: 5183
diff changeset
252 if (compileQueue.getCompletedTaskCount() >= Math.max(3, compileQueue.getTaskCount())) {
d87155082c4d guard all compilation queue accesses, to avoid deadlocks
Lukas Stadler <lukas.stadler@jku.at>
parents: 5183
diff changeset
253 break;
d87155082c4d guard all compilation queue accesses, to avoid deadlocks
Lukas Stadler <lukas.stadler@jku.at>
parents: 5183
diff changeset
254 }
d87155082c4d guard all compilation queue accesses, to avoid deadlocks
Lukas Stadler <lukas.stadler@jku.at>
parents: 5183
diff changeset
255 } else {
d87155082c4d guard all compilation queue accesses, to avoid deadlocks
Lukas Stadler <lukas.stadler@jku.at>
parents: 5183
diff changeset
256 if (compileQueue.getCompletedTaskCount() + slowCompileQueue.getCompletedTaskCount() >= Math.max(3, compileQueue.getTaskCount() + slowCompileQueue.getTaskCount())) {
d87155082c4d guard all compilation queue accesses, to avoid deadlocks
Lukas Stadler <lukas.stadler@jku.at>
parents: 5183
diff changeset
257 break;
d87155082c4d guard all compilation queue accesses, to avoid deadlocks
Lukas Stadler <lukas.stadler@jku.at>
parents: 5183
diff changeset
258 }
5183
e1e681a5558e fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents: 5177
diff changeset
259 }
5263
d87155082c4d guard all compilation queue accesses, to avoid deadlocks
Lukas Stadler <lukas.stadler@jku.at>
parents: 5183
diff changeset
260 } finally {
d87155082c4d guard all compilation queue accesses, to avoid deadlocks
Lukas Stadler <lukas.stadler@jku.at>
parents: 5183
diff changeset
261 CompilationTask.withinEnqueue.set(Boolean.FALSE);
5183
e1e681a5558e fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents: 5177
diff changeset
262 }
5263
d87155082c4d guard all compilation queue accesses, to avoid deadlocks
Lukas Stadler <lukas.stadler@jku.at>
parents: 5183
diff changeset
263
d87155082c4d guard all compilation queue accesses, to avoid deadlocks
Lukas Stadler <lukas.stadler@jku.at>
parents: 5183
diff changeset
264 Thread.sleep(100);
d87155082c4d guard all compilation queue accesses, to avoid deadlocks
Lukas Stadler <lukas.stadler@jku.at>
parents: 5183
diff changeset
265 while (z < compileQueue.getCompletedTaskCount() / 100) {
d87155082c4d guard all compilation queue accesses, to avoid deadlocks
Lukas Stadler <lukas.stadler@jku.at>
parents: 5183
diff changeset
266 ++z;
d87155082c4d guard all compilation queue accesses, to avoid deadlocks
Lukas Stadler <lukas.stadler@jku.at>
parents: 5183
diff changeset
267 TTY.print(".");
d87155082c4d guard all compilation queue accesses, to avoid deadlocks
Lukas Stadler <lukas.stadler@jku.at>
parents: 5183
diff changeset
268 TTY.flush();
5183
e1e681a5558e fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents: 5177
diff changeset
269 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
270 }
5183
e1e681a5558e fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents: 5177
diff changeset
271 } while ((System.currentTimeMillis() - startTime) <= GraalOptions.TimedBootstrap);
7558
223f645acb9b added compilation rate measurements on top of existing metric/timer facility - enabled with -Dgraal.benchmark.compilation=true
Doug Simon <doug.simon@oracle.com>
parents: 7552
diff changeset
272
223f645acb9b added compilation rate measurements on top of existing metric/timer facility - enabled with -Dgraal.benchmark.compilation=true
Doug Simon <doug.simon@oracle.com>
parents: 7552
diff changeset
273 phaseTransition("bootstrap");
223f645acb9b added compilation rate measurements on top of existing metric/timer facility - enabled with -Dgraal.benchmark.compilation=true
Doug Simon <doug.simon@oracle.com>
parents: 7552
diff changeset
274
6721
98d691bc23da make osr compilations asynchronous
Lukas Stadler <lukas.stadler@jku.at>
parents: 6682
diff changeset
275 bootstrapRunning = false;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
276
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
277 TTY.println(" in %d ms", System.currentTimeMillis() - startTime);
5763
a3d71693e0ce removed bytecode disassembly from CodeCacheRuntime into separate BytecodeDisassembler class
Doug Simon <doug.simon@oracle.com>
parents: 5719
diff changeset
278 if (graalRuntime.getCache() != null) {
a3d71693e0ce removed bytecode disassembly from CodeCacheRuntime into separate BytecodeDisassembler class
Doug Simon <doug.simon@oracle.com>
parents: 5719
diff changeset
279 graalRuntime.getCache().clear();
5177
a26b6248d398 added graph caching (-G:+CacheGraphs)
Lukas Stadler <lukas.stadler@jku.at>
parents: 5176
diff changeset
280 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
281 System.gc();
7558
223f645acb9b added compilation rate measurements on top of existing metric/timer facility - enabled with -Dgraal.benchmark.compilation=true
Doug Simon <doug.simon@oracle.com>
parents: 7552
diff changeset
282 phaseTransition("bootstrap2");
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
283 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
284
7558
223f645acb9b added compilation rate measurements on top of existing metric/timer facility - enabled with -Dgraal.benchmark.compilation=true
Doug Simon <doug.simon@oracle.com>
parents: 7552
diff changeset
285 private MetricRateInPhase parsedBytecodesPerSecond;
223f645acb9b added compilation rate measurements on top of existing metric/timer facility - enabled with -Dgraal.benchmark.compilation=true
Doug Simon <doug.simon@oracle.com>
parents: 7552
diff changeset
286 private MetricRateInPhase inlinedBytecodesPerSecond;
223f645acb9b added compilation rate measurements on top of existing metric/timer facility - enabled with -Dgraal.benchmark.compilation=true
Doug Simon <doug.simon@oracle.com>
parents: 7552
diff changeset
287
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
288 private void enqueue(Method m) throws Throwable {
6539
2463eb24b644 Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6526
diff changeset
289 JavaMethod javaMethod = graalRuntime.getRuntime().lookupJavaMethod(m);
2463eb24b644 Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6526
diff changeset
290 assert !Modifier.isAbstract(((HotSpotResolvedJavaMethod) javaMethod).getModifiers()) && !Modifier.isNative(((HotSpotResolvedJavaMethod) javaMethod).getModifiers()) : javaMethod;
6677
3dddb311395f hotspot infrastructure for OnStackReplacement
Lukas Stadler <lukas.stadler@jku.at>
parents: 6539
diff changeset
291 compileMethod((HotSpotResolvedJavaMethod) javaMethod, StructuredGraph.INVOCATION_ENTRY_BCI, false, 10);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
292 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
293
5367
7cf71c7961c6 if -G:Dump option is used, the compiler queues are given 5 seconds to finish any pending tasks (including graph dumping) before the VM exits
Doug Simon <doug.simon@oracle.com>
parents: 5361
diff changeset
294 private static void shutdownCompileQueue(ThreadPoolExecutor queue) throws InterruptedException {
7cf71c7961c6 if -G:Dump option is used, the compiler queues are given 5 seconds to finish any pending tasks (including graph dumping) before the VM exits
Doug Simon <doug.simon@oracle.com>
parents: 5361
diff changeset
295 if (queue != null) {
7cf71c7961c6 if -G:Dump option is used, the compiler queues are given 5 seconds to finish any pending tasks (including graph dumping) before the VM exits
Doug Simon <doug.simon@oracle.com>
parents: 5361
diff changeset
296 queue.shutdown();
7cf71c7961c6 if -G:Dump option is used, the compiler queues are given 5 seconds to finish any pending tasks (including graph dumping) before the VM exits
Doug Simon <doug.simon@oracle.com>
parents: 5361
diff changeset
297 if (Debug.isEnabled() && GraalOptions.Dump != null) {
5661
28dea025b221 reduced shutdown pause when -G:Dump is used from 5 seconds to 2
Doug Simon <doug.simon@oracle.com>
parents: 5585
diff changeset
298 // Wait 2 seconds to flush out all graph dumps that may be of interest
28dea025b221 reduced shutdown pause when -G:Dump is used from 5 seconds to 2
Doug Simon <doug.simon@oracle.com>
parents: 5585
diff changeset
299 queue.awaitTermination(2, TimeUnit.SECONDS);
5367
7cf71c7961c6 if -G:Dump option is used, the compiler queues are given 5 seconds to finish any pending tasks (including graph dumping) before the VM exits
Doug Simon <doug.simon@oracle.com>
parents: 5361
diff changeset
300 }
7cf71c7961c6 if -G:Dump option is used, the compiler queues are given 5 seconds to finish any pending tasks (including graph dumping) before the VM exits
Doug Simon <doug.simon@oracle.com>
parents: 5361
diff changeset
301 }
7cf71c7961c6 if -G:Dump option is used, the compiler queues are given 5 seconds to finish any pending tasks (including graph dumping) before the VM exits
Doug Simon <doug.simon@oracle.com>
parents: 5361
diff changeset
302 }
7cf71c7961c6 if -G:Dump option is used, the compiler queues are given 5 seconds to finish any pending tasks (including graph dumping) before the VM exits
Doug Simon <doug.simon@oracle.com>
parents: 5361
diff changeset
303
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
304 public void shutdownCompiler() throws Throwable {
5263
d87155082c4d guard all compilation queue accesses, to avoid deadlocks
Lukas Stadler <lukas.stadler@jku.at>
parents: 5183
diff changeset
305 try {
d87155082c4d guard all compilation queue accesses, to avoid deadlocks
Lukas Stadler <lukas.stadler@jku.at>
parents: 5183
diff changeset
306 assert !CompilationTask.withinEnqueue.get();
d87155082c4d guard all compilation queue accesses, to avoid deadlocks
Lukas Stadler <lukas.stadler@jku.at>
parents: 5183
diff changeset
307 CompilationTask.withinEnqueue.set(Boolean.TRUE);
5367
7cf71c7961c6 if -G:Dump option is used, the compiler queues are given 5 seconds to finish any pending tasks (including graph dumping) before the VM exits
Doug Simon <doug.simon@oracle.com>
parents: 5361
diff changeset
308 shutdownCompileQueue(compileQueue);
7cf71c7961c6 if -G:Dump option is used, the compiler queues are given 5 seconds to finish any pending tasks (including graph dumping) before the VM exits
Doug Simon <doug.simon@oracle.com>
parents: 5361
diff changeset
309 shutdownCompileQueue(slowCompileQueue);
5263
d87155082c4d guard all compilation queue accesses, to avoid deadlocks
Lukas Stadler <lukas.stadler@jku.at>
parents: 5183
diff changeset
310 } finally {
d87155082c4d guard all compilation queue accesses, to avoid deadlocks
Lukas Stadler <lukas.stadler@jku.at>
parents: 5183
diff changeset
311 CompilationTask.withinEnqueue.set(Boolean.FALSE);
5176
af59b4dfc9e4 compilation queue changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 5164
diff changeset
312 }
4406
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
313
7569
7cae58134ff7 collection of Graal compilation speed metrics is now triggered by -XX:+CITime instead of -Dgraal.benchmark.compilation=true
Doug Simon <doug.simon@oracle.com>
parents: 7560
diff changeset
314 if (Debug.isEnabled() && !quietMeterAndTime) {
4406
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
315 List<DebugValueMap> topLevelMaps = DebugValueMap.getTopLevelMaps();
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
316 List<DebugValue> debugValues = KeyRegistry.getDebugValues();
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
317 if (debugValues.size() > 0) {
5386
19e5dc8d0891 alphabetically sort debug values for Metric and Time
Lukas Stadler <lukas.stadler@jku.at>
parents: 5367
diff changeset
318 ArrayList<DebugValue> sortedValues = new ArrayList<>(debugValues);
7551
68a59067974a made DebugValue implement Comparable and removed comparator that sorted the "Runs" metric before all others
Doug Simon <doug.simon@oracle.com>
parents: 7384
diff changeset
319 Collections.sort(sortedValues);
5386
19e5dc8d0891 alphabetically sort debug values for Metric and Time
Lukas Stadler <lukas.stadler@jku.at>
parents: 5367
diff changeset
320
4553
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4479
diff changeset
321 if (GraalOptions.SummarizeDebugValues) {
5386
19e5dc8d0891 alphabetically sort debug values for Metric and Time
Lukas Stadler <lukas.stadler@jku.at>
parents: 5367
diff changeset
322 printSummary(topLevelMaps, sortedValues);
5134
4eb9895d9afe Refactoring of the debug framework. Move compiler thread implementation to its own file.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5061
diff changeset
323 } else if (GraalOptions.PerThreadDebugValues) {
4553
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4479
diff changeset
324 for (DebugValueMap map : topLevelMaps) {
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4479
diff changeset
325 TTY.println("Showing the results for thread: " + map.getName());
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4479
diff changeset
326 map.group();
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4479
diff changeset
327 map.normalize();
5386
19e5dc8d0891 alphabetically sort debug values for Metric and Time
Lukas Stadler <lukas.stadler@jku.at>
parents: 5367
diff changeset
328 printMap(map, sortedValues, 0);
4553
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4479
diff changeset
329 }
5134
4eb9895d9afe Refactoring of the debug framework. Move compiler thread implementation to its own file.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5061
diff changeset
330 } else {
4eb9895d9afe Refactoring of the debug framework. Move compiler thread implementation to its own file.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5061
diff changeset
331 DebugValueMap globalMap = new DebugValueMap("Global");
4eb9895d9afe Refactoring of the debug framework. Move compiler thread implementation to its own file.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5061
diff changeset
332 for (DebugValueMap map : topLevelMaps) {
4eb9895d9afe Refactoring of the debug framework. Move compiler thread implementation to its own file.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5061
diff changeset
333 if (GraalOptions.SummarizePerPhase) {
4eb9895d9afe Refactoring of the debug framework. Move compiler thread implementation to its own file.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5061
diff changeset
334 flattenChildren(map, globalMap);
4eb9895d9afe Refactoring of the debug framework. Move compiler thread implementation to its own file.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5061
diff changeset
335 } else {
7558
223f645acb9b added compilation rate measurements on top of existing metric/timer facility - enabled with -Dgraal.benchmark.compilation=true
Doug Simon <doug.simon@oracle.com>
parents: 7552
diff changeset
336 globalMap.addChild(map);
5134
4eb9895d9afe Refactoring of the debug framework. Move compiler thread implementation to its own file.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5061
diff changeset
337 }
4eb9895d9afe Refactoring of the debug framework. Move compiler thread implementation to its own file.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5061
diff changeset
338 }
4eb9895d9afe Refactoring of the debug framework. Move compiler thread implementation to its own file.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5061
diff changeset
339 if (!GraalOptions.SummarizePerPhase) {
4eb9895d9afe Refactoring of the debug framework. Move compiler thread implementation to its own file.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5061
diff changeset
340 globalMap.group();
4eb9895d9afe Refactoring of the debug framework. Move compiler thread implementation to its own file.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5061
diff changeset
341 }
4eb9895d9afe Refactoring of the debug framework. Move compiler thread implementation to its own file.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5061
diff changeset
342 globalMap.normalize();
5386
19e5dc8d0891 alphabetically sort debug values for Metric and Time
Lukas Stadler <lukas.stadler@jku.at>
parents: 5367
diff changeset
343 printMap(globalMap, sortedValues, 0);
4406
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
344 }
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
345 }
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
346 }
7558
223f645acb9b added compilation rate measurements on top of existing metric/timer facility - enabled with -Dgraal.benchmark.compilation=true
Doug Simon <doug.simon@oracle.com>
parents: 7552
diff changeset
347 phaseTransition("final");
223f645acb9b added compilation rate measurements on top of existing metric/timer facility - enabled with -Dgraal.benchmark.compilation=true
Doug Simon <doug.simon@oracle.com>
parents: 7552
diff changeset
348
7569
7cae58134ff7 collection of Graal compilation speed metrics is now triggered by -XX:+CITime instead of -Dgraal.benchmark.compilation=true
Doug Simon <doug.simon@oracle.com>
parents: 7560
diff changeset
349 if (graalRuntime.getConfig().ciTime) {
7560
0b68e6426b48 fixed bug in implementation of -Dgraal.benchmark.compilation=true
Doug Simon <doug.simon@oracle.com>
parents: 7558
diff changeset
350 parsedBytecodesPerSecond.printAll("ParsedBytecodesPerSecond");
0b68e6426b48 fixed bug in implementation of -Dgraal.benchmark.compilation=true
Doug Simon <doug.simon@oracle.com>
parents: 7558
diff changeset
351 inlinedBytecodesPerSecond.printAll("InlinedBytecodesPerSecond");
0b68e6426b48 fixed bug in implementation of -Dgraal.benchmark.compilation=true
Doug Simon <doug.simon@oracle.com>
parents: 7558
diff changeset
352 }
7558
223f645acb9b added compilation rate measurements on top of existing metric/timer facility - enabled with -Dgraal.benchmark.compilation=true
Doug Simon <doug.simon@oracle.com>
parents: 7552
diff changeset
353
5769
8635406a0c33 factored counter functionality out of CheckcastSnippets in SnippetCounter for use by other snippets
Doug Simon <doug.simon@oracle.com>
parents: 5763
diff changeset
354 SnippetCounter.printGroups(TTY.out().out());
4563
b27666ff9bd6 added compilation time statistics to product mode
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4560
diff changeset
355 }
b27666ff9bd6 added compilation time statistics to product mode
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4560
diff changeset
356
5134
4eb9895d9afe Refactoring of the debug framework. Move compiler thread implementation to its own file.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5061
diff changeset
357 private void flattenChildren(DebugValueMap map, DebugValueMap globalMap) {
4eb9895d9afe Refactoring of the debug framework. Move compiler thread implementation to its own file.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5061
diff changeset
358 globalMap.addChild(map);
4eb9895d9afe Refactoring of the debug framework. Move compiler thread implementation to its own file.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5061
diff changeset
359 for (DebugValueMap child : map.getChildren()) {
4eb9895d9afe Refactoring of the debug framework. Move compiler thread implementation to its own file.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5061
diff changeset
360 flattenChildren(child, globalMap);
4eb9895d9afe Refactoring of the debug framework. Move compiler thread implementation to its own file.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5061
diff changeset
361 }
4eb9895d9afe Refactoring of the debug framework. Move compiler thread implementation to its own file.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5061
diff changeset
362 map.clearChildren();
4406
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
363 }
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
364
4553
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4479
diff changeset
365 private static void printSummary(List<DebugValueMap> topLevelMaps, List<DebugValue> debugValues) {
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4479
diff changeset
366 DebugValueMap result = new DebugValueMap("Summary");
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4479
diff changeset
367 for (int i = debugValues.size() - 1; i >= 0; i--) {
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4479
diff changeset
368 DebugValue debugValue = debugValues.get(i);
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4479
diff changeset
369 int index = debugValue.getIndex();
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4479
diff changeset
370 long total = collectTotal(topLevelMaps, index);
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4479
diff changeset
371 result.setCurrentValue(index, total);
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4479
diff changeset
372 }
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4479
diff changeset
373 printMap(result, debugValues, 0);
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4479
diff changeset
374 }
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4479
diff changeset
375
7558
223f645acb9b added compilation rate measurements on top of existing metric/timer facility - enabled with -Dgraal.benchmark.compilation=true
Doug Simon <doug.simon@oracle.com>
parents: 7552
diff changeset
376 static long collectTotal(DebugValue value) {
223f645acb9b added compilation rate measurements on top of existing metric/timer facility - enabled with -Dgraal.benchmark.compilation=true
Doug Simon <doug.simon@oracle.com>
parents: 7552
diff changeset
377 List<DebugValueMap> maps = DebugValueMap.getTopLevelMaps();
223f645acb9b added compilation rate measurements on top of existing metric/timer facility - enabled with -Dgraal.benchmark.compilation=true
Doug Simon <doug.simon@oracle.com>
parents: 7552
diff changeset
378 long total = 0;
223f645acb9b added compilation rate measurements on top of existing metric/timer facility - enabled with -Dgraal.benchmark.compilation=true
Doug Simon <doug.simon@oracle.com>
parents: 7552
diff changeset
379 for (int i = 0; i < maps.size(); i++) {
223f645acb9b added compilation rate measurements on top of existing metric/timer facility - enabled with -Dgraal.benchmark.compilation=true
Doug Simon <doug.simon@oracle.com>
parents: 7552
diff changeset
380 DebugValueMap map = maps.get(i);
223f645acb9b added compilation rate measurements on top of existing metric/timer facility - enabled with -Dgraal.benchmark.compilation=true
Doug Simon <doug.simon@oracle.com>
parents: 7552
diff changeset
381 int index = value.getIndex();
223f645acb9b added compilation rate measurements on top of existing metric/timer facility - enabled with -Dgraal.benchmark.compilation=true
Doug Simon <doug.simon@oracle.com>
parents: 7552
diff changeset
382 total += map.getCurrentValue(index);
223f645acb9b added compilation rate measurements on top of existing metric/timer facility - enabled with -Dgraal.benchmark.compilation=true
Doug Simon <doug.simon@oracle.com>
parents: 7552
diff changeset
383 total += collectTotal(map.getChildren(), index);
223f645acb9b added compilation rate measurements on top of existing metric/timer facility - enabled with -Dgraal.benchmark.compilation=true
Doug Simon <doug.simon@oracle.com>
parents: 7552
diff changeset
384 }
223f645acb9b added compilation rate measurements on top of existing metric/timer facility - enabled with -Dgraal.benchmark.compilation=true
Doug Simon <doug.simon@oracle.com>
parents: 7552
diff changeset
385 return total;
223f645acb9b added compilation rate measurements on top of existing metric/timer facility - enabled with -Dgraal.benchmark.compilation=true
Doug Simon <doug.simon@oracle.com>
parents: 7552
diff changeset
386 }
223f645acb9b added compilation rate measurements on top of existing metric/timer facility - enabled with -Dgraal.benchmark.compilation=true
Doug Simon <doug.simon@oracle.com>
parents: 7552
diff changeset
387
4553
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4479
diff changeset
388 private static long collectTotal(List<DebugValueMap> maps, int index) {
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4479
diff changeset
389 long total = 0;
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4479
diff changeset
390 for (int i = 0; i < maps.size(); i++) {
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4479
diff changeset
391 DebugValueMap map = maps.get(i);
7247
1706be855f0e Use ThreadMXBean to get CPU time instead of Wallclock time for Timers if possible
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7221
diff changeset
392 total += map.getCurrentValue(index);
1706be855f0e Use ThreadMXBean to get CPU time instead of Wallclock time for Timers if possible
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7221
diff changeset
393 total += collectTotal(map.getChildren(), index);
4553
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4479
diff changeset
394 }
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4479
diff changeset
395 return total;
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4479
diff changeset
396 }
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4479
diff changeset
397
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4479
diff changeset
398 private static void printMap(DebugValueMap map, List<DebugValue> debugValues, int level) {
4406
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
399
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
400 printIndent(level);
5134
4eb9895d9afe Refactoring of the debug framework. Move compiler thread implementation to its own file.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5061
diff changeset
401 TTY.println("%s", map.getName());
5386
19e5dc8d0891 alphabetically sort debug values for Metric and Time
Lukas Stadler <lukas.stadler@jku.at>
parents: 5367
diff changeset
402
4406
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
403 for (DebugValue value : debugValues) {
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
404 long l = map.getCurrentValue(value.getIndex());
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
405 if (l != 0) {
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
406 printIndent(level + 1);
5134
4eb9895d9afe Refactoring of the debug framework. Move compiler thread implementation to its own file.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5061
diff changeset
407 TTY.println(value.getName() + "=" + value.toString(l));
4406
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
408 }
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
409 }
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
410
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
411 for (DebugValueMap child : map.getChildren()) {
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
412 printMap(child, debugValues, level + 1);
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
413 }
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
414 }
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
415
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
416 private static void printIndent(int level) {
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
417 for (int i = 0; i < level; ++i) {
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
418 TTY.print(" ");
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
419 }
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
420 TTY.print("|-> ");
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
421 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
422
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
423 @Override
7084
9ba90252ce08 HotSpotResolvedJavaType is now the HotSpot implementation of ResolvedJavaType,
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7081
diff changeset
424 public boolean compileMethod(long metaspaceMethod, final HotSpotResolvedObjectType holder, final int entryBCI, boolean blocking, int priority) throws Throwable {
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6682
diff changeset
425 HotSpotResolvedJavaMethod method = holder.createMethod(metaspaceMethod);
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6682
diff changeset
426 return compileMethod(method, entryBCI, blocking, priority);
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6682
diff changeset
427 }
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6682
diff changeset
428
7108
fa99bf3837ec fixed some issues that precluded compilation of Graal compiler methods
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7085
diff changeset
429 /**
fa99bf3837ec fixed some issues that precluded compilation of Graal compiler methods
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7085
diff changeset
430 * Compiles a method to machine code.
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7510
diff changeset
431 *
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7510
diff changeset
432 * @return true if the method is in the queue (either added to the queue or already in the
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7510
diff changeset
433 * queue)
7108
fa99bf3837ec fixed some issues that precluded compilation of Graal compiler methods
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7085
diff changeset
434 */
5554
70f715dfbb41 Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5548
diff changeset
435 public boolean compileMethod(final HotSpotResolvedJavaMethod method, final int entryBCI, boolean blocking, int priority) throws Throwable {
7108
fa99bf3837ec fixed some issues that precluded compilation of Graal compiler methods
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7085
diff changeset
436 CompilationTask current = method.currentTask();
6721
98d691bc23da make osr compilations asynchronous
Lukas Stadler <lukas.stadler@jku.at>
parents: 6682
diff changeset
437 boolean osrCompilation = entryBCI != StructuredGraph.INVOCATION_ENTRY_BCI;
98d691bc23da make osr compilations asynchronous
Lukas Stadler <lukas.stadler@jku.at>
parents: 6682
diff changeset
438 if (osrCompilation && bootstrapRunning) {
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7510
diff changeset
439 // no OSR compilations during bootstrap - the compiler is just too slow at this point,
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7510
diff changeset
440 // and we know that there are no endless loops
7108
fa99bf3837ec fixed some issues that precluded compilation of Graal compiler methods
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7085
diff changeset
441 return current != null;
6721
98d691bc23da make osr compilations asynchronous
Lukas Stadler <lukas.stadler@jku.at>
parents: 6682
diff changeset
442 }
98d691bc23da make osr compilations asynchronous
Lukas Stadler <lukas.stadler@jku.at>
parents: 6682
diff changeset
443
5183
e1e681a5558e fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents: 5177
diff changeset
444 if (CompilationTask.withinEnqueue.get()) {
e1e681a5558e fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents: 5177
diff changeset
445 // This is required to avoid deadlocking a compiler thread. The issue is that a
e1e681a5558e fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents: 5177
diff changeset
446 // java.util.concurrent.BlockingQueue is used to implement the compilation worker
e1e681a5558e fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents: 5177
diff changeset
447 // queues. If a compiler thread triggers a compilation, then it may be blocked trying
e1e681a5558e fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents: 5177
diff changeset
448 // to add something to its own queue.
7108
fa99bf3837ec fixed some issues that precluded compilation of Graal compiler methods
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7085
diff changeset
449 return current != null;
5176
af59b4dfc9e4 compilation queue changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 5164
diff changeset
450 }
5183
e1e681a5558e fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents: 5177
diff changeset
451 CompilationTask.withinEnqueue.set(Boolean.TRUE);
5176
af59b4dfc9e4 compilation queue changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 5164
diff changeset
452
5183
e1e681a5558e fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents: 5177
diff changeset
453 try {
e1e681a5558e fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents: 5177
diff changeset
454 if (!blocking && current != null) {
6721
98d691bc23da make osr compilations asynchronous
Lukas Stadler <lukas.stadler@jku.at>
parents: 6682
diff changeset
455 if (current.isInProgress()) {
98d691bc23da make osr compilations asynchronous
Lukas Stadler <lukas.stadler@jku.at>
parents: 6682
diff changeset
456 if (current.getEntryBCI() == entryBCI) {
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7510
diff changeset
457 // a compilation with the correct bci is already in progress, so just return
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7510
diff changeset
458 // true
6721
98d691bc23da make osr compilations asynchronous
Lukas Stadler <lukas.stadler@jku.at>
parents: 6682
diff changeset
459 return true;
98d691bc23da make osr compilations asynchronous
Lukas Stadler <lukas.stadler@jku.at>
parents: 6682
diff changeset
460 }
5176
af59b4dfc9e4 compilation queue changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 5164
diff changeset
461 } else {
6721
98d691bc23da make osr compilations asynchronous
Lukas Stadler <lukas.stadler@jku.at>
parents: 6682
diff changeset
462 if (GraalOptions.PriorityCompileQueue) {
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7510
diff changeset
463 // normally compilation tasks will only be re-queued when they get a
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7510
diff changeset
464 // priority boost, so cancel the old task and add a new one
6721
98d691bc23da make osr compilations asynchronous
Lukas Stadler <lukas.stadler@jku.at>
parents: 6682
diff changeset
465 current.cancel();
98d691bc23da make osr compilations asynchronous
Lukas Stadler <lukas.stadler@jku.at>
parents: 6682
diff changeset
466 } else {
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7510
diff changeset
467 // without a prioritizing compile queue it makes no sense to re-queue the
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7510
diff changeset
468 // compilation task
6721
98d691bc23da make osr compilations asynchronous
Lukas Stadler <lukas.stadler@jku.at>
parents: 6682
diff changeset
469 return true;
98d691bc23da make osr compilations asynchronous
Lukas Stadler <lukas.stadler@jku.at>
parents: 6682
diff changeset
470 }
5176
af59b4dfc9e4 compilation queue changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 5164
diff changeset
471 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
472 }
5183
e1e681a5558e fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents: 5177
diff changeset
473
e1e681a5558e fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents: 5177
diff changeset
474 final OptimisticOptimizations optimisticOpts = new OptimisticOptimizations(method);
e1e681a5558e fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents: 5177
diff changeset
475 int id = compileTaskIds.incrementAndGet();
6962
Doug Simon <doug.simon@oracle.com>
parents: 6958 6721
diff changeset
476 // OSR compilations need to be finished quickly, so they get max priority
6721
98d691bc23da make osr compilations asynchronous
Lukas Stadler <lukas.stadler@jku.at>
parents: 6682
diff changeset
477 int queuePriority = osrCompilation ? -1 : priority;
98d691bc23da make osr compilations asynchronous
Lukas Stadler <lukas.stadler@jku.at>
parents: 6682
diff changeset
478 CompilationTask task = CompilationTask.create(graalRuntime, createPhasePlan(optimisticOpts, osrCompilation), optimisticOpts, method, entryBCI, id, queuePriority);
5183
e1e681a5558e fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents: 5177
diff changeset
479 if (blocking) {
e1e681a5558e fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents: 5177
diff changeset
480 task.runCompilation();
7108
fa99bf3837ec fixed some issues that precluded compilation of Graal compiler methods
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7085
diff changeset
481 return false;
5183
e1e681a5558e fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents: 5177
diff changeset
482 } else {
e1e681a5558e fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents: 5177
diff changeset
483 try {
e1e681a5558e fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents: 5177
diff changeset
484 method.setCurrentTask(task);
e1e681a5558e fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents: 5177
diff changeset
485 if (GraalOptions.SlowCompileThreads && priority > GraalOptions.SlowQueueCutoff) {
e1e681a5558e fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents: 5177
diff changeset
486 slowCompileQueue.execute(task);
e1e681a5558e fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents: 5177
diff changeset
487 } else {
e1e681a5558e fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents: 5177
diff changeset
488 compileQueue.execute(task);
e1e681a5558e fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents: 5177
diff changeset
489 }
7110
9bd688f91d3f minor fix
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7108
diff changeset
490 return true;
5183
e1e681a5558e fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents: 5177
diff changeset
491 } catch (RejectedExecutionException e) {
e1e681a5558e fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents: 5177
diff changeset
492 // The compile queue was already shut down.
e1e681a5558e fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents: 5177
diff changeset
493 return false;
e1e681a5558e fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents: 5177
diff changeset
494 }
e1e681a5558e fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents: 5177
diff changeset
495 }
e1e681a5558e fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents: 5177
diff changeset
496 } finally {
e1e681a5558e fix PriorityQueue, enable PriorityQueue and CacheGraphs
Lukas Stadler <lukas.stadler@jku.at>
parents: 5177
diff changeset
497 CompilationTask.withinEnqueue.set(Boolean.FALSE);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
498 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
499 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
500
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
501 @Override
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6682
diff changeset
502 public JavaMethod createUnresolvedJavaMethod(String name, String signature, JavaType holder) {
5530
9da759562a42 Remove compiler member field from HotSpot's implementation of the Ri* interfaces.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5529
diff changeset
503 return new HotSpotMethodUnresolved(name, signature, holder);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
504 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
505
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
506 @Override
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6682
diff changeset
507 public JavaField createJavaField(JavaType holder, String name, JavaType type, int offset, int flags, boolean internal) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
508 if (offset != -1) {
7084
9ba90252ce08 HotSpotResolvedJavaType is now the HotSpot implementation of ResolvedJavaType,
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7081
diff changeset
509 HotSpotResolvedObjectType resolved = (HotSpotResolvedObjectType) holder;
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6682
diff changeset
510 return resolved.createField(name, type, offset, flags, internal);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
511 }
6539
2463eb24b644 Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6526
diff changeset
512 return new HotSpotUnresolvedField(holder, name, type);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
513 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
514
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
515 @Override
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6682
diff changeset
516 public ResolvedJavaMethod createResolvedJavaMethod(JavaType holder, long metaspaceMethod) {
7084
9ba90252ce08 HotSpotResolvedJavaType is now the HotSpot implementation of ResolvedJavaType,
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7081
diff changeset
517 HotSpotResolvedObjectType type = (HotSpotResolvedObjectType) holder;
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6682
diff changeset
518 return type.createMethod(metaspaceMethod);
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6682
diff changeset
519 }
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6682
diff changeset
520
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6682
diff changeset
521 @Override
5554
70f715dfbb41 Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5548
diff changeset
522 public ResolvedJavaType createPrimitiveJavaType(int basicType) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
523 switch (basicType) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
524 case 4:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
525 return typeBoolean;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
526 case 5:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
527 return typeChar;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
528 case 6:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
529 return typeFloat;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
530 case 7:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
531 return typeDouble;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
532 case 8:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
533 return typeByte;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
534 case 9:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
535 return typeShort;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
536 case 10:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
537 return typeInt;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
538 case 11:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
539 return typeLong;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
540 case 14:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
541 return typeVoid;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
542 default:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
543 throw new IllegalArgumentException("Unknown basic type: " + basicType);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
544 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
545 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
546
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
547 @Override
7084
9ba90252ce08 HotSpotResolvedJavaType is now the HotSpot implementation of ResolvedJavaType,
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7081
diff changeset
548 public HotSpotUnresolvedJavaType createUnresolvedJavaType(String name) {
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6682
diff changeset
549 int dims = 0;
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6682
diff changeset
550 int startIndex = 0;
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6682
diff changeset
551 while (name.charAt(startIndex) == '[') {
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6682
diff changeset
552 startIndex++;
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6682
diff changeset
553 dims++;
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6682
diff changeset
554 }
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6682
diff changeset
555
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6682
diff changeset
556 // Decode name if necessary.
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6682
diff changeset
557 if (name.charAt(name.length() - 1) == ';') {
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6682
diff changeset
558 assert name.charAt(startIndex) == 'L';
7084
9ba90252ce08 HotSpotResolvedJavaType is now the HotSpot implementation of ResolvedJavaType,
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7081
diff changeset
559 return new HotSpotUnresolvedJavaType(name, name.substring(startIndex + 1, name.length() - 1), dims);
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6682
diff changeset
560 } else {
7084
9ba90252ce08 HotSpotResolvedJavaType is now the HotSpot implementation of ResolvedJavaType,
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7081
diff changeset
561 return new HotSpotUnresolvedJavaType(HotSpotUnresolvedJavaType.getFullName(name, dims), name, dims);
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6682
diff changeset
562 }
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6682
diff changeset
563 }
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6682
diff changeset
564
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6682
diff changeset
565 @Override
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7510
diff changeset
566 public HotSpotResolvedObjectType createResolvedJavaType(long metaspaceKlass, String name, String simpleName, Class javaMirror, boolean hasFinalizableSubclass, int sizeOrSpecies) {
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7510
diff changeset
567 HotSpotResolvedObjectType type = new HotSpotResolvedObjectType(metaspaceKlass, name, simpleName, javaMirror, hasFinalizableSubclass, sizeOrSpecies);
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6682
diff changeset
568
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6682
diff changeset
569 long offset = HotSpotGraalRuntime.getInstance().getConfig().graalMirrorInClassOffset;
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6682
diff changeset
570 if (!unsafe.compareAndSwapObject(javaMirror, offset, null, type)) {
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6682
diff changeset
571 // lost the race - return the existing value instead
7084
9ba90252ce08 HotSpotResolvedJavaType is now the HotSpot implementation of ResolvedJavaType,
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7081
diff changeset
572 type = (HotSpotResolvedObjectType) unsafe.getObject(javaMirror, offset);
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6682
diff changeset
573 }
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6682
diff changeset
574 return type;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
575 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
576
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
577 @Override
5554
70f715dfbb41 Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5548
diff changeset
578 public Constant createConstant(Kind kind, long value) {
5540
a891c53a295b Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5538
diff changeset
579 if (kind == Kind.Long) {
5538
e18ba36bfebc Renamed RiConstant => Constant.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5534
diff changeset
580 return Constant.forLong(value);
5540
a891c53a295b Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5538
diff changeset
581 } else if (kind == Kind.Int) {
5538
e18ba36bfebc Renamed RiConstant => Constant.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5534
diff changeset
582 return Constant.forInt((int) value);
5540
a891c53a295b Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5538
diff changeset
583 } else if (kind == Kind.Short) {
5538
e18ba36bfebc Renamed RiConstant => Constant.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5534
diff changeset
584 return Constant.forShort((short) value);
5540
a891c53a295b Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5538
diff changeset
585 } else if (kind == Kind.Char) {
5538
e18ba36bfebc Renamed RiConstant => Constant.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5534
diff changeset
586 return Constant.forChar((char) value);
5540
a891c53a295b Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5538
diff changeset
587 } else if (kind == Kind.Byte) {
5538
e18ba36bfebc Renamed RiConstant => Constant.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5534
diff changeset
588 return Constant.forByte((byte) value);
5540
a891c53a295b Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5538
diff changeset
589 } else if (kind == Kind.Boolean) {
5538
e18ba36bfebc Renamed RiConstant => Constant.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5534
diff changeset
590 return (value == 0) ? Constant.FALSE : Constant.TRUE;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
591 } else {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
592 throw new IllegalArgumentException();
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
593 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
594 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
595
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
596 @Override
5554
70f715dfbb41 Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5548
diff changeset
597 public Constant createConstantFloat(float value) {
5538
e18ba36bfebc Renamed RiConstant => Constant.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5534
diff changeset
598 return Constant.forFloat(value);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
599 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
600
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
601 @Override
5554
70f715dfbb41 Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5548
diff changeset
602 public Constant createConstantDouble(double value) {
5538
e18ba36bfebc Renamed RiConstant => Constant.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5534
diff changeset
603 return Constant.forDouble(value);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
604 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
605
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
606 @Override
5554
70f715dfbb41 Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5548
diff changeset
607 public Constant createConstantObject(Object object) {
5538
e18ba36bfebc Renamed RiConstant => Constant.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5534
diff changeset
608 return Constant.forObject(object);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
609 }
4420
97e0fb1f4906 Make Array copy intrinsifier active again, fix format string in canonicalizer
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4410
diff changeset
610
6677
3dddb311395f hotspot infrastructure for OnStackReplacement
Lukas Stadler <lukas.stadler@jku.at>
parents: 6539
diff changeset
611 public PhasePlan createPhasePlan(OptimisticOptimizations optimisticOpts, boolean onStackReplacement) {
4420
97e0fb1f4906 Make Array copy intrinsifier active again, fix format string in canonicalizer
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4410
diff changeset
612 PhasePlan phasePlan = new PhasePlan();
6677
3dddb311395f hotspot infrastructure for OnStackReplacement
Lukas Stadler <lukas.stadler@jku.at>
parents: 6539
diff changeset
613 phasePlan.addPhase(PhasePosition.AFTER_PARSING, new GraphBuilderPhase(graalRuntime.getRuntime(), GraphBuilderConfiguration.getDefault(), optimisticOpts));
3dddb311395f hotspot infrastructure for OnStackReplacement
Lukas Stadler <lukas.stadler@jku.at>
parents: 6539
diff changeset
614 if (onStackReplacement) {
3dddb311395f hotspot infrastructure for OnStackReplacement
Lukas Stadler <lukas.stadler@jku.at>
parents: 6539
diff changeset
615 phasePlan.addPhase(PhasePosition.AFTER_PARSING, new OnStackReplacementPhase());
3dddb311395f hotspot infrastructure for OnStackReplacement
Lukas Stadler <lukas.stadler@jku.at>
parents: 6539
diff changeset
616 }
4420
97e0fb1f4906 Make Array copy intrinsifier active again, fix format string in canonicalizer
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4410
diff changeset
617 return phasePlan;
97e0fb1f4906 Make Array copy intrinsifier active again, fix format string in canonicalizer
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4410
diff changeset
618 }
5328
e4e02131c58b log file (i.e. -G:LogFile=log.txt option) now used for TTY output as well
Doug Simon <doug.simon@oracle.com>
parents: 5323
diff changeset
619
e4e02131c58b log file (i.e. -G:LogFile=log.txt option) now used for TTY output as well
Doug Simon <doug.simon@oracle.com>
parents: 5323
diff changeset
620 @Override
e4e02131c58b log file (i.e. -G:LogFile=log.txt option) now used for TTY output as well
Doug Simon <doug.simon@oracle.com>
parents: 5323
diff changeset
621 public PrintStream log() {
e4e02131c58b log file (i.e. -G:LogFile=log.txt option) now used for TTY output as well
Doug Simon <doug.simon@oracle.com>
parents: 5323
diff changeset
622 return log;
e4e02131c58b log file (i.e. -G:LogFile=log.txt option) now used for TTY output as well
Doug Simon <doug.simon@oracle.com>
parents: 5323
diff changeset
623 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
624 }