annotate graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/bridge/VMToCompilerImpl.java @ 4560:e43d36482d12

Merge
author Gilles Duboscq <duboscq@ssw.jku.at>
date Fri, 10 Feb 2012 17:09:39 +0100
parents 3706975946e4 7d0d849abf80
children b27666ff9bd6
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
4220
5c80ccb80036 Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4205
diff changeset
24 package com.oracle.max.graal.hotspot.bridge;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
25
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
26 import java.lang.reflect.*;
4406
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
27 import java.util.*;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
28 import java.util.concurrent.*;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
29
4199
aaac4894175c Renamed cri packages from sun to oracle.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4197
diff changeset
30 import com.oracle.max.cri.ci.*;
aaac4894175c Renamed cri packages from sun to oracle.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4197
diff changeset
31 import com.oracle.max.cri.ri.*;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
32 import com.oracle.max.criutils.*;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
33 import com.oracle.max.graal.compiler.*;
4197
b765172082ac Move HotSpotMethod* and HotSpotType* implementations into ri subpackage.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4171
diff changeset
34 import com.oracle.max.graal.compiler.phases.*;
4265
4643ccd37dac * removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents: 4220
diff changeset
35 import com.oracle.max.graal.compiler.phases.PhasePlan.PhasePosition;
4357
719ac1d92a52 More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4353
diff changeset
36 import com.oracle.max.graal.debug.*;
4406
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
37 import com.oracle.max.graal.debug.internal.*;
4220
5c80ccb80036 Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4205
diff changeset
38 import com.oracle.max.graal.hotspot.*;
5c80ccb80036 Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4205
diff changeset
39 import com.oracle.max.graal.hotspot.Compiler;
4197
b765172082ac Move HotSpotMethod* and HotSpotType* implementations into ri subpackage.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4171
diff changeset
40 import com.oracle.max.graal.hotspot.ri.*;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
41 import com.oracle.max.graal.hotspot.server.*;
4423
e8ce691d7923 Move Array copy, Unsafe and System snippets to hotspot specific project since they are hotspot specific.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4420
diff changeset
42 import com.oracle.max.graal.hotspot.snippets.*;
4205
2af849af1723 moved graphbuilder into the graal.java project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4203
diff changeset
43 import com.oracle.max.graal.java.*;
4197
b765172082ac Move HotSpotMethod* and HotSpotType* implementations into ri subpackage.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4171
diff changeset
44 import com.oracle.max.graal.snippets.*;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
45
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
46 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
47 * Exits from the HotSpot VM into Java code.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
48 */
4220
5c80ccb80036 Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4205
diff changeset
49 public class VMToCompilerImpl implements VMToCompiler, Remote {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
50
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
51 private final Compiler compiler;
4345
176d60b77d31 Moved PrintCompilation logic from graal.compiler to graal.hotspot. Made bootclasspath generated from the GRAAL environment option more generic (such that adding/removing a project requires no changes in the C++ part).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4220
diff changeset
52 private int compiledMethodCount;
4420
97e0fb1f4906 Make Array copy intrinsifier active again, fix format string in canonicalizer
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4410
diff changeset
53 private IntrinsifyArrayCopyPhase intrinsifyArrayCopy;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
54
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
55 public final HotSpotTypePrimitive typeBoolean;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
56 public final HotSpotTypePrimitive typeChar;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
57 public final HotSpotTypePrimitive typeFloat;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
58 public final HotSpotTypePrimitive typeDouble;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
59 public final HotSpotTypePrimitive typeByte;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
60 public final HotSpotTypePrimitive typeShort;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
61 public final HotSpotTypePrimitive typeInt;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
62 public final HotSpotTypePrimitive typeLong;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
63 public final HotSpotTypePrimitive typeVoid;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
64
4357
719ac1d92a52 More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4353
diff changeset
65 ThreadFactory compilerThreadFactory = new ThreadFactory() {
4406
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
66
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
67 @Override
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
68 public Thread newThread(Runnable r) {
4357
719ac1d92a52 More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4353
diff changeset
69 return new CompilerThread(r);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
70 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
71 };
4406
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
72
4357
719ac1d92a52 More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4353
diff changeset
73 private final class CompilerThread extends Thread {
4406
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
74
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
75 public CompilerThread(Runnable r) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
76 super(r);
4357
719ac1d92a52 More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4353
diff changeset
77 this.setName("GraalCompilerThread-" + this.getId());
719ac1d92a52 More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4353
diff changeset
78 this.setDaemon(true);
719ac1d92a52 More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4353
diff changeset
79 }
719ac1d92a52 More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4353
diff changeset
80
719ac1d92a52 More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4353
diff changeset
81 @Override
719ac1d92a52 More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4353
diff changeset
82 public void run() {
4363
7462c3600c3a Draft changes to the graph plotting.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4358
diff changeset
83 if (GraalOptions.Debug) {
7462c3600c3a Draft changes to the graph plotting.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4358
diff changeset
84 Debug.enable();
7462c3600c3a Draft changes to the graph plotting.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4358
diff changeset
85 HotSpotDebugConfig hotspotDebugConfig = new HotSpotDebugConfig(GraalOptions.Log, GraalOptions.Meter, GraalOptions.Time, GraalOptions.Dump, GraalOptions.MethodFilter);
7462c3600c3a Draft changes to the graph plotting.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4358
diff changeset
86 Debug.setConfig(hotspotDebugConfig);
7462c3600c3a Draft changes to the graph plotting.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4358
diff changeset
87 }
4357
719ac1d92a52 More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4353
diff changeset
88 super.run();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
89 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
90 }
4406
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
91
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
92 private ThreadPoolExecutor compileQueue;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
93
4220
5c80ccb80036 Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4205
diff changeset
94 public VMToCompilerImpl(Compiler compiler) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
95 this.compiler = compiler;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
96
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
97 typeBoolean = new HotSpotTypePrimitive(compiler, CiKind.Boolean);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
98 typeChar = new HotSpotTypePrimitive(compiler, CiKind.Char);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
99 typeFloat = new HotSpotTypePrimitive(compiler, CiKind.Float);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
100 typeDouble = new HotSpotTypePrimitive(compiler, CiKind.Double);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
101 typeByte = new HotSpotTypePrimitive(compiler, CiKind.Byte);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
102 typeShort = new HotSpotTypePrimitive(compiler, CiKind.Short);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
103 typeInt = new HotSpotTypePrimitive(compiler, CiKind.Int);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
104 typeLong = new HotSpotTypePrimitive(compiler, CiKind.Long);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
105 typeVoid = new HotSpotTypePrimitive(compiler, CiKind.Void);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
106 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
107
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
108 public void startCompiler() throws Throwable {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
109 // Make sure TTY is initialized here such that the correct System.out is used for TTY.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
110 TTY.initialize();
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
111 if (GraalOptions.Debug) {
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
112 Debug.enable();
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
113 HotSpotDebugConfig hotspotDebugConfig = new HotSpotDebugConfig(GraalOptions.Log, GraalOptions.Meter, GraalOptions.Time, GraalOptions.Dump, GraalOptions.MethodFilter);
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
114 Debug.setConfig(hotspotDebugConfig);
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
115 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
116
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
117 // Install intrinsics.
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
118 final HotSpotRuntime runtime = (HotSpotRuntime) compiler.getCompiler().runtime;
4197
b765172082ac Move HotSpotMethod* and HotSpotType* implementations into ri subpackage.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4171
diff changeset
119 if (GraalOptions.Intrinsify) {
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
120 Debug.scope("InstallSnippets", new DebugDumpScope("InstallSnippets"), new Runnable() {
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
121 @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
122 public void run() {
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
123 VMToCompilerImpl.this.intrinsifyArrayCopy = new IntrinsifyArrayCopyPhase(runtime);
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
124 GraalIntrinsics.installIntrinsics(runtime, runtime.getCompiler().getTarget(), PhasePlan.DEFAULT);
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
125 Snippets.install(runtime, runtime.getCompiler().getTarget(), new SystemSnippets(), PhasePlan.DEFAULT);
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
126 Snippets.install(runtime, runtime.getCompiler().getTarget(), new UnsafeSnippets(), PhasePlan.DEFAULT);
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
127 Snippets.install(runtime, runtime.getCompiler().getTarget(), new ArrayCopySnippets(), PhasePlan.DEFAULT);
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
128 }
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
129 });
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
130
4197
b765172082ac Move HotSpotMethod* and HotSpotType* implementations into ri subpackage.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4171
diff changeset
131 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
132
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
133 // Create compilation queue.
4357
719ac1d92a52 More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4353
diff changeset
134 compileQueue = new ThreadPoolExecutor(GraalOptions.Threads, GraalOptions.Threads, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>(), compilerThreadFactory);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
135
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
136 // Create queue status printing thread.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
137 if (GraalOptions.PrintQueue) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
138 Thread t = new Thread() {
4406
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
139
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
140 @Override
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
141 public void run() {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
142 while (true) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
143 TTY.println(compileQueue.toString());
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
144 try {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
145 Thread.sleep(1000);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
146 } catch (InterruptedException e) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
147 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
148 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
149 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
150 };
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
151 t.setDaemon(true);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
152 t.start();
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
153 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
154 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
155
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
156 /**
4406
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
157 * This method is the first method compiled during bootstrapping. Put any code in there that warms up compiler paths
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
158 * that are otherwise no exercised during bootstrapping and lead to later deoptimization when application code is
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
159 * 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
160 */
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
161 @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
162 @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
163 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
164 // 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
165 }
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
166
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
167 public void bootstrap() throws Throwable {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
168 TTY.print("Bootstrapping Graal");
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
169 TTY.flush();
4168
0bc4815d2069 Start bootstrapping in compiler threads
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4142
diff changeset
170 long startTime = System.currentTimeMillis();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
171
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
172 // Initialize compile queue with a selected set of methods.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
173 Class<Object> objectKlass = Object.class;
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
174 enqueue(getClass().getDeclaredMethod("compileWarmup"));
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
175 enqueue(objectKlass.getDeclaredMethod("equals", Object.class));
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
176 enqueue(objectKlass.getDeclaredMethod("toString"));
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
177
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
178 // Compile until the queue is empty.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
179 int z = 0;
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
180 while (compileQueue.getCompletedTaskCount() < Math.max(3, compileQueue.getTaskCount())) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
181 Thread.sleep(100);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
182 while (z < compileQueue.getCompletedTaskCount() / 100) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
183 ++z;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
184 TTY.print(".");
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
185 TTY.flush();
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
186 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
187 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
188
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
189 TTY.println(" in %d ms", System.currentTimeMillis() - startTime);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
190 System.gc();
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 private void enqueue(Method m) throws Throwable {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
194 RiMethod riMethod = compiler.getRuntime().getRiMethod(m);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
195 assert !Modifier.isAbstract(((HotSpotMethodResolved) riMethod).accessFlags()) && !Modifier.isNative(((HotSpotMethodResolved) riMethod).accessFlags()) : riMethod;
4168
0bc4815d2069 Start bootstrapping in compiler threads
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4142
diff changeset
196 compileMethod((HotSpotMethodResolved) riMethod, 0, false);
3733
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 public void shutdownCompiler() throws Throwable {
4406
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
200 // compiler.getCompiler().context.print();
4353
043bec543161 More work on debug framework. Removed concept of GraalContext.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4350
diff changeset
201 // TODO(tw): Print context results.
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
202 compileQueue.shutdown();
4406
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
203
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
204 if (Debug.isEnabled()) {
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
205 List<DebugValueMap> topLevelMaps = DebugValueMap.getTopLevelMaps();
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
206 List<DebugValue> debugValues = KeyRegistry.getDebugValues();
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
207 if (debugValues.size() > 0) {
4553
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4479
diff changeset
208 if (GraalOptions.SummarizeDebugValues) {
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4479
diff changeset
209 printSummary(topLevelMaps, debugValues);
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4479
diff changeset
210 } else {
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4479
diff changeset
211 for (DebugValueMap map : topLevelMaps) {
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4479
diff changeset
212 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
213 map.group();
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4479
diff changeset
214 map.normalize();
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4479
diff changeset
215 printMap(map, debugValues, 0);
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4479
diff changeset
216 }
4406
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
217 }
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
218 }
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
219 }
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
220 }
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
221
4553
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4479
diff changeset
222 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
223 DebugValueMap result = new DebugValueMap("Summary");
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4479
diff changeset
224 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
225 DebugValue debugValue = debugValues.get(i);
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4479
diff changeset
226 int index = debugValue.getIndex();
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4479
diff changeset
227 long total = collectTotal(topLevelMaps, index);
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4479
diff changeset
228 result.setCurrentValue(index, total);
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4479
diff changeset
229 }
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4479
diff changeset
230 printMap(result, debugValues, 0);
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4479
diff changeset
231 }
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4479
diff changeset
232
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4479
diff changeset
233 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
234 long total = 0;
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4479
diff changeset
235 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
236 DebugValueMap map = maps.get(i);
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4479
diff changeset
237 // the top level accumulates some counters -> do not process the children if we find a value
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4479
diff changeset
238 long value = map.getCurrentValue(index);
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4479
diff changeset
239 if (value == 0) {
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4479
diff changeset
240 total += collectTotal(map.getChildren(), index);
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4479
diff changeset
241 } else {
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4479
diff changeset
242 total += value;
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4479
diff changeset
243 }
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4479
diff changeset
244 }
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4479
diff changeset
245 return total;
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4479
diff changeset
246 }
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4479
diff changeset
247
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4479
diff changeset
248
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4479
diff changeset
249 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
250
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
251 printIndent(level);
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
252 TTY.println(map.getName());
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
253 for (DebugValue value : debugValues) {
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
254 long l = map.getCurrentValue(value.getIndex());
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
255 if (l != 0) {
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
256 printIndent(level + 1);
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
257 TTY.println(value.getName() + "=" + l);
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
258 }
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
259 }
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
260
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
261 for (DebugValueMap child : map.getChildren()) {
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
262 printMap(child, debugValues, level + 1);
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
263 }
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
264 }
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
265
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
266 private static void printIndent(int level) {
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
267 for (int i = 0; i < level; ++i) {
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
268 TTY.print(" ");
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
269 }
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
270 TTY.print("|-> ");
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
271 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
272
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
273 @Override
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
274 public void compileMethod(final HotSpotMethodResolved method, final int entryBCI, boolean blocking) throws Throwable {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
275 try {
4428
0bb7ab1add7e enable dumping graphs upon exception, new constructor for NodeInputList, initialize debug system for non-compiler threads
Lukas Stadler <lukas.stadler@jku.at>
parents: 4410
diff changeset
276 if (Thread.currentThread() instanceof CompilerThread) {
0bb7ab1add7e enable dumping graphs upon exception, new constructor for NodeInputList, initialize debug system for non-compiler threads
Lukas Stadler <lukas.stadler@jku.at>
parents: 4410
diff changeset
277 if (method.holder().name().contains("java/util/concurrent")) {
0bb7ab1add7e enable dumping graphs upon exception, new constructor for NodeInputList, initialize debug system for non-compiler threads
Lukas Stadler <lukas.stadler@jku.at>
parents: 4410
diff changeset
278 // This is required to avoid deadlocking a compiler thread. The issue is that a
0bb7ab1add7e enable dumping graphs upon exception, new constructor for NodeInputList, initialize debug system for non-compiler threads
Lukas Stadler <lukas.stadler@jku.at>
parents: 4410
diff changeset
279 // java.util.concurrent.BlockingQueue is used to implement the compilation worker
0bb7ab1add7e enable dumping graphs upon exception, new constructor for NodeInputList, initialize debug system for non-compiler threads
Lukas Stadler <lukas.stadler@jku.at>
parents: 4410
diff changeset
280 // queues. If a compiler thread triggers a compilation, then it may be blocked trying
0bb7ab1add7e enable dumping graphs upon exception, new constructor for NodeInputList, initialize debug system for non-compiler threads
Lukas Stadler <lukas.stadler@jku.at>
parents: 4410
diff changeset
281 // to add something to its own queue.
0bb7ab1add7e enable dumping graphs upon exception, new constructor for NodeInputList, initialize debug system for non-compiler threads
Lukas Stadler <lukas.stadler@jku.at>
parents: 4410
diff changeset
282 return;
0bb7ab1add7e enable dumping graphs upon exception, new constructor for NodeInputList, initialize debug system for non-compiler threads
Lukas Stadler <lukas.stadler@jku.at>
parents: 4410
diff changeset
283 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
284 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
285
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
286 Runnable runnable = new Runnable() {
4406
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
287
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
288 public void run() {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
289 try {
4477
27c5466afd55 Changes to debug framework.
Andreas Woess <andreas.woess@jku.at>
parents: 4431
diff changeset
290 final PhasePlan plan = getDefaultPhasePlan();
4265
4643ccd37dac * removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents: 4220
diff changeset
291 GraphBuilderPhase graphBuilderPhase = new GraphBuilderPhase(compiler.getRuntime());
4203
847e9dcb4980 Add graph builder to the phase plan.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4199
diff changeset
292 plan.addPhase(PhasePosition.AFTER_PARSING, graphBuilderPhase);
4345
176d60b77d31 Moved PrintCompilation logic from graal.compiler to graal.hotspot. Made bootclasspath generated from the GRAAL environment option more generic (such that adding/removing a project requires no changes in the C++ part).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4220
diff changeset
293 long startTime = 0;
176d60b77d31 Moved PrintCompilation logic from graal.compiler to graal.hotspot. Made bootclasspath generated from the GRAAL environment option more generic (such that adding/removing a project requires no changes in the C++ part).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4220
diff changeset
294 int index = compiledMethodCount++;
176d60b77d31 Moved PrintCompilation logic from graal.compiler to graal.hotspot. Made bootclasspath generated from the GRAAL environment option more generic (such that adding/removing a project requires no changes in the C++ part).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4220
diff changeset
295 final boolean printCompilation = GraalOptions.PrintCompilation && !TTY.isSuppressed();
176d60b77d31 Moved PrintCompilation logic from graal.compiler to graal.hotspot. Made bootclasspath generated from the GRAAL environment option more generic (such that adding/removing a project requires no changes in the C++ part).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4220
diff changeset
296 if (printCompilation) {
4406
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
297 TTY.println(String.format("Graal %4d %-70s %-45s %-50s ...", index, method.holder().name(), method.name(), method.signature().asString()));
4345
176d60b77d31 Moved PrintCompilation logic from graal.compiler to graal.hotspot. Made bootclasspath generated from the GRAAL environment option more generic (such that adding/removing a project requires no changes in the C++ part).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4220
diff changeset
298 startTime = System.nanoTime();
176d60b77d31 Moved PrintCompilation logic from graal.compiler to graal.hotspot. Made bootclasspath generated from the GRAAL environment option more generic (such that adding/removing a project requires no changes in the C++ part).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4220
diff changeset
299 }
176d60b77d31 Moved PrintCompilation logic from graal.compiler to graal.hotspot. Made bootclasspath generated from the GRAAL environment option more generic (such that adding/removing a project requires no changes in the C++ part).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4220
diff changeset
300
176d60b77d31 Moved PrintCompilation logic from graal.compiler to graal.hotspot. Made bootclasspath generated from the GRAAL environment option more generic (such that adding/removing a project requires no changes in the C++ part).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4220
diff changeset
301 CiTargetMethod result = null;
176d60b77d31 Moved PrintCompilation logic from graal.compiler to graal.hotspot. Made bootclasspath generated from the GRAAL environment option more generic (such that adding/removing a project requires no changes in the C++ part).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4220
diff changeset
302 TTY.Filter filter = new TTY.Filter(GraalOptions.PrintFilter, method);
176d60b77d31 Moved PrintCompilation logic from graal.compiler to graal.hotspot. Made bootclasspath generated from the GRAAL environment option more generic (such that adding/removing a project requires no changes in the C++ part).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4220
diff changeset
303 try {
4477
27c5466afd55 Changes to debug framework.
Andreas Woess <andreas.woess@jku.at>
parents: 4431
diff changeset
304 result = Debug.scope("Compiling", method, new Callable<CiTargetMethod>() {
27c5466afd55 Changes to debug framework.
Andreas Woess <andreas.woess@jku.at>
parents: 4431
diff changeset
305 @Override
27c5466afd55 Changes to debug framework.
Andreas Woess <andreas.woess@jku.at>
parents: 4431
diff changeset
306 public CiTargetMethod call() throws Exception {
27c5466afd55 Changes to debug framework.
Andreas Woess <andreas.woess@jku.at>
parents: 4431
diff changeset
307 return compiler.getCompiler().compileMethod(method, -1, plan);
27c5466afd55 Changes to debug framework.
Andreas Woess <andreas.woess@jku.at>
parents: 4431
diff changeset
308 }
27c5466afd55 Changes to debug framework.
Andreas Woess <andreas.woess@jku.at>
parents: 4431
diff changeset
309 });
4345
176d60b77d31 Moved PrintCompilation logic from graal.compiler to graal.hotspot. Made bootclasspath generated from the GRAAL environment option more generic (such that adding/removing a project requires no changes in the C++ part).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4220
diff changeset
310 } finally {
176d60b77d31 Moved PrintCompilation logic from graal.compiler to graal.hotspot. Made bootclasspath generated from the GRAAL environment option more generic (such that adding/removing a project requires no changes in the C++ part).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4220
diff changeset
311 filter.remove();
176d60b77d31 Moved PrintCompilation logic from graal.compiler to graal.hotspot. Made bootclasspath generated from the GRAAL environment option more generic (such that adding/removing a project requires no changes in the C++ part).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4220
diff changeset
312 if (printCompilation) {
176d60b77d31 Moved PrintCompilation logic from graal.compiler to graal.hotspot. Made bootclasspath generated from the GRAAL environment option more generic (such that adding/removing a project requires no changes in the C++ part).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4220
diff changeset
313 long time = (System.nanoTime() - startTime) / 100000;
4406
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
314 TTY.println(String.format("Graal %4d %-70s %-45s %-50s | %3d.%dms %4dnodes %5dB", index, "", "", "", time / 10, time % 10, 0, (result != null ? result.targetCodeSize()
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
315 : -1)));
4345
176d60b77d31 Moved PrintCompilation logic from graal.compiler to graal.hotspot. Made bootclasspath generated from the GRAAL environment option more generic (such that adding/removing a project requires no changes in the C++ part).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4220
diff changeset
316 }
176d60b77d31 Moved PrintCompilation logic from graal.compiler to graal.hotspot. Made bootclasspath generated from the GRAAL environment option more generic (such that adding/removing a project requires no changes in the C++ part).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4220
diff changeset
317 }
4366
97ada1b642b7 Merge fix.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4365
diff changeset
318 compiler.getRuntime().installMethod(method, result);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
319 } catch (CiBailout bailout) {
4468
87a12a816e99 added C1 inlining policy for comparison, bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4463
diff changeset
320 Debug.metric("Bailouts").increment();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
321 if (GraalOptions.ExitVMOnBailout) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
322 bailout.printStackTrace(TTY.cachedOut);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
323 System.exit(-1);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
324 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
325 } catch (Throwable t) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
326 if (GraalOptions.ExitVMOnException) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
327 t.printStackTrace(TTY.cachedOut);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
328 System.exit(-1);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
329 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
330 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
331 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
332 };
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
333
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
334 if (blocking) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
335 runnable.run();
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
336 } else {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
337 compileQueue.execute(runnable);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
338 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
339 } catch (RejectedExecutionException e) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
340 // The compile queue was already shut down.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
341 return;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
342 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
343 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
344
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
345 @Override
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
346 public RiMethod createRiMethodUnresolved(String name, String signature, RiType holder) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
347 return new HotSpotMethodUnresolved(compiler, name, signature, holder);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
348 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
349
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
350 @Override
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
351 public RiSignature createRiSignature(String signature) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
352 return new HotSpotSignature(compiler, signature);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
353 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
354
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
355 @Override
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
356 public RiField createRiField(RiType holder, String name, RiType type, int offset, int flags) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
357 if (offset != -1) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
358 HotSpotTypeResolved resolved = (HotSpotTypeResolved) holder;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
359 return resolved.createRiField(name, type, offset, flags);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
360 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
361 return new BaseUnresolvedField(holder, name, type);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
362 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
363
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
364 @Override
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
365 public RiType createRiType(HotSpotConstantPool pool, String name) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
366 throw new RuntimeException("not implemented");
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
367 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
368
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
369 @Override
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
370 public RiType createRiTypePrimitive(int basicType) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
371 switch (basicType) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
372 case 4:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
373 return typeBoolean;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
374 case 5:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
375 return typeChar;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
376 case 6:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
377 return typeFloat;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
378 case 7:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
379 return typeDouble;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
380 case 8:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
381 return typeByte;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
382 case 9:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
383 return typeShort;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
384 case 10:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
385 return typeInt;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
386 case 11:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
387 return typeLong;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
388 case 14:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
389 return typeVoid;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
390 default:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
391 throw new IllegalArgumentException("Unknown basic type: " + basicType);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
392 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
393 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
394
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
395 @Override
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
396 public RiType createRiTypeUnresolved(String name) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
397 return new HotSpotTypeUnresolved(compiler, name);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
398 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
399
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
400 @Override
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
401 public CiConstant createCiConstant(CiKind kind, long value) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
402 if (kind == CiKind.Long) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
403 return CiConstant.forLong(value);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
404 } else if (kind == CiKind.Int) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
405 return CiConstant.forInt((int) value);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
406 } else if (kind == CiKind.Short) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
407 return CiConstant.forShort((short) value);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
408 } else if (kind == CiKind.Char) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
409 return CiConstant.forChar((char) value);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
410 } else if (kind == CiKind.Byte) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
411 return CiConstant.forByte((byte) value);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
412 } else if (kind == CiKind.Boolean) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
413 return (value == 0) ? CiConstant.FALSE : CiConstant.TRUE;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
414 } else {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
415 throw new IllegalArgumentException();
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
416 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
417 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
418
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
419 @Override
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
420 public CiConstant createCiConstantFloat(float value) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
421 return CiConstant.forFloat(value);
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
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
424 @Override
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
425 public CiConstant createCiConstantDouble(double value) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
426 return CiConstant.forDouble(value);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
427 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
428
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
429 @Override
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
430 public CiConstant createCiConstantObject(Object object) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
431 return CiConstant.forObject(object);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
432 }
4420
97e0fb1f4906 Make Array copy intrinsifier active again, fix format string in canonicalizer
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4410
diff changeset
433
97e0fb1f4906 Make Array copy intrinsifier active again, fix format string in canonicalizer
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4410
diff changeset
434 private PhasePlan getDefaultPhasePlan() {
97e0fb1f4906 Make Array copy intrinsifier active again, fix format string in canonicalizer
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4410
diff changeset
435 PhasePlan phasePlan = new PhasePlan();
4463
6616513a42de bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4423
diff changeset
436 if (GraalOptions.Intrinsify) {
6616513a42de bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4423
diff changeset
437 phasePlan.addPhase(PhasePosition.HIGH_LEVEL, intrinsifyArrayCopy);
6616513a42de bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4423
diff changeset
438 }
4420
97e0fb1f4906 Make Array copy intrinsifier active again, fix format string in canonicalizer
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4410
diff changeset
439 return phasePlan;
97e0fb1f4906 Make Array copy intrinsifier active again, fix format string in canonicalizer
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4410
diff changeset
440 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
441 }