annotate graal/com.oracle.max.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java @ 5060:4ed4295ce15f

Update import statements.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Thu, 08 Mar 2012 19:11:12 +0100
parents ed559a528128
children
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
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.*;
5060
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
33 import com.oracle.graal.compiler.*;
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
34 import com.oracle.graal.compiler.phases.*;
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
35 import com.oracle.graal.compiler.phases.PhasePlan.PhasePosition;
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
36 import com.oracle.graal.debug.*;
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
37 import com.oracle.graal.debug.internal.*;
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
38 import com.oracle.graal.hotspot.*;
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
39 import com.oracle.graal.hotspot.Compiler;
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
40 import com.oracle.graal.hotspot.ri.*;
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
41 import com.oracle.graal.hotspot.server.*;
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
42 import com.oracle.graal.hotspot.snippets.*;
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
43 import com.oracle.graal.java.*;
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
44 import com.oracle.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;
4563
b27666ff9bd6 added compilation time statistics to product mode
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4560
diff changeset
53 private long totalCompilationTime;
4420
97e0fb1f4906 Make Array copy intrinsifier active again, fix format string in canonicalizer
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4410
diff changeset
54 private IntrinsifyArrayCopyPhase intrinsifyArrayCopy;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
55
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
56 public final HotSpotTypePrimitive typeBoolean;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
57 public final HotSpotTypePrimitive typeChar;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
58 public final HotSpotTypePrimitive typeFloat;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
59 public final HotSpotTypePrimitive typeDouble;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
60 public final HotSpotTypePrimitive typeByte;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
61 public final HotSpotTypePrimitive typeShort;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
62 public final HotSpotTypePrimitive typeInt;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
63 public final HotSpotTypePrimitive typeLong;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
64 public final HotSpotTypePrimitive typeVoid;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
65
4357
719ac1d92a52 More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4353
diff changeset
66 ThreadFactory compilerThreadFactory = new ThreadFactory() {
4406
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
67
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
68 @Override
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
69 public Thread newThread(Runnable r) {
4357
719ac1d92a52 More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4353
diff changeset
70 return new CompilerThread(r);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
71 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
72 };
4406
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
73
4357
719ac1d92a52 More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4353
diff changeset
74 private final class CompilerThread extends Thread {
4406
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
75
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
76 public CompilerThread(Runnable r) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
77 super(r);
4357
719ac1d92a52 More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4353
diff changeset
78 this.setName("GraalCompilerThread-" + this.getId());
719ac1d92a52 More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4353
diff changeset
79 this.setDaemon(true);
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
719ac1d92a52 More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4353
diff changeset
82 @Override
719ac1d92a52 More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4353
diff changeset
83 public void run() {
4363
7462c3600c3a Draft changes to the graph plotting.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4358
diff changeset
84 if (GraalOptions.Debug) {
7462c3600c3a Draft changes to the graph plotting.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4358
diff changeset
85 Debug.enable();
7462c3600c3a Draft changes to the graph plotting.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4358
diff changeset
86 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
87 Debug.setConfig(hotspotDebugConfig);
7462c3600c3a Draft changes to the graph plotting.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4358
diff changeset
88 }
4357
719ac1d92a52 More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4353
diff changeset
89 super.run();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
90 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
91 }
4406
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
92
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
93 private ThreadPoolExecutor compileQueue;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
94
4220
5c80ccb80036 Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4205
diff changeset
95 public VMToCompilerImpl(Compiler compiler) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
96 this.compiler = compiler;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
97
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
98 typeBoolean = new HotSpotTypePrimitive(compiler, CiKind.Boolean);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
99 typeChar = new HotSpotTypePrimitive(compiler, CiKind.Char);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
100 typeFloat = new HotSpotTypePrimitive(compiler, CiKind.Float);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
101 typeDouble = new HotSpotTypePrimitive(compiler, CiKind.Double);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
102 typeByte = new HotSpotTypePrimitive(compiler, CiKind.Byte);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
103 typeShort = new HotSpotTypePrimitive(compiler, CiKind.Short);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
104 typeInt = new HotSpotTypePrimitive(compiler, CiKind.Int);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
105 typeLong = new HotSpotTypePrimitive(compiler, CiKind.Long);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
106 typeVoid = new HotSpotTypePrimitive(compiler, CiKind.Void);
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
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
109 public void startCompiler() throws Throwable {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
110 // 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
111 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
112 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
113 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
114 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
115 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
116 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
117
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
118 // 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
119 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
120 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
121 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
122 @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
123 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
124 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
125 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
126 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
127 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
128 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
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 });
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
131
4197
b765172082ac Move HotSpotMethod* and HotSpotType* implementations into ri subpackage.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4171
diff changeset
132 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
133
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
134 // Create compilation queue.
4357
719ac1d92a52 More work on debug framework.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4353
diff changeset
135 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
136
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
137 // Create queue status printing thread.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
138 if (GraalOptions.PrintQueue) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
139 Thread t = new Thread() {
4406
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
140
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
141 @Override
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
142 public void run() {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
143 while (true) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
144 TTY.println(compileQueue.toString());
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
145 try {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
146 Thread.sleep(1000);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
147 } catch (InterruptedException e) {
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 };
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
152 t.setDaemon(true);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
153 t.start();
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 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
156
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
157 /**
4406
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
158 * 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
159 * 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
160 * 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
161 */
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 @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
163 @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
164 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
165 // 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
166 }
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
167
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
168 public void bootstrap() throws Throwable {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
169 TTY.print("Bootstrapping Graal");
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
170 TTY.flush();
4168
0bc4815d2069 Start bootstrapping in compiler threads
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4142
diff changeset
171 long startTime = System.currentTimeMillis();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
172
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
173 // 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
174 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
175 enqueue(getClass().getDeclaredMethod("compileWarmup"));
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
176 enqueue(objectKlass.getDeclaredMethod("equals", Object.class));
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
177 enqueue(objectKlass.getDeclaredMethod("toString"));
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
178
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
179 // Compile until the queue is empty.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
180 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
181 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
182 Thread.sleep(100);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
183 while (z < compileQueue.getCompletedTaskCount() / 100) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
184 ++z;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
185 TTY.print(".");
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
186 TTY.flush();
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
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
190 TTY.println(" in %d ms", System.currentTimeMillis() - startTime);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
191 System.gc();
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 private void enqueue(Method m) throws Throwable {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
195 RiMethod riMethod = compiler.getRuntime().getRiMethod(m);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
196 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
197 compileMethod((HotSpotMethodResolved) riMethod, 0, false);
3733
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
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
200 public void shutdownCompiler() throws Throwable {
5056
2f2c6347fce4 comments cleanup/retagging
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5021
diff changeset
201 // compiler.getCompiler().context.print();
2f2c6347fce4 comments cleanup/retagging
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5021
diff changeset
202 // TODO (thomaswue): Print context results.
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
203 compileQueue.shutdown();
4406
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
204
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
205 if (Debug.isEnabled()) {
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
206 List<DebugValueMap> topLevelMaps = DebugValueMap.getTopLevelMaps();
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
207 List<DebugValue> debugValues = KeyRegistry.getDebugValues();
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
208 if (debugValues.size() > 0) {
4553
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4479
diff changeset
209 if (GraalOptions.SummarizeDebugValues) {
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4479
diff changeset
210 printSummary(topLevelMaps, debugValues);
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4479
diff changeset
211 } else {
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4479
diff changeset
212 for (DebugValueMap map : topLevelMaps) {
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4479
diff changeset
213 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
214 map.group();
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4479
diff changeset
215 map.normalize();
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4479
diff changeset
216 printMap(map, debugValues, 0);
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4479
diff changeset
217 }
4406
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 }
4563
b27666ff9bd6 added compilation time statistics to product mode
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4560
diff changeset
221
b27666ff9bd6 added compilation time statistics to product mode
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4560
diff changeset
222 if (GraalOptions.PrintCompilationStatistics) {
b27666ff9bd6 added compilation time statistics to product mode
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4560
diff changeset
223 printCompilationStatistics();
b27666ff9bd6 added compilation time statistics to product mode
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4560
diff changeset
224 }
b27666ff9bd6 added compilation time statistics to product mode
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4560
diff changeset
225 }
b27666ff9bd6 added compilation time statistics to product mode
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4560
diff changeset
226
b27666ff9bd6 added compilation time statistics to product mode
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4560
diff changeset
227 private void printCompilationStatistics() {
b27666ff9bd6 added compilation time statistics to product mode
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4560
diff changeset
228 TTY.println("Accumulated compilation statistics");
b27666ff9bd6 added compilation time statistics to product mode
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4560
diff changeset
229 TTY.println(" Compiled methods : %d", compiledMethodCount);
b27666ff9bd6 added compilation time statistics to product mode
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4560
diff changeset
230 TTY.println(" Total compilation time : %6.3f s", totalCompilationTime / Math.pow(10, 9));
4406
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
231 }
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
232
4553
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4479
diff changeset
233 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
234 DebugValueMap result = new DebugValueMap("Summary");
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4479
diff changeset
235 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
236 DebugValue debugValue = debugValues.get(i);
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4479
diff changeset
237 int index = debugValue.getIndex();
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4479
diff changeset
238 long total = collectTotal(topLevelMaps, index);
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4479
diff changeset
239 result.setCurrentValue(index, total);
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4479
diff changeset
240 }
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4479
diff changeset
241 printMap(result, debugValues, 0);
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4479
diff changeset
242 }
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 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
245 long total = 0;
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4479
diff changeset
246 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
247 DebugValueMap map = maps.get(i);
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4479
diff changeset
248 // 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
249 long value = map.getCurrentValue(index);
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4479
diff changeset
250 if (value == 0) {
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4479
diff changeset
251 total += collectTotal(map.getChildren(), index);
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4479
diff changeset
252 } else {
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4479
diff changeset
253 total += value;
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4479
diff changeset
254 }
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4479
diff changeset
255 }
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4479
diff changeset
256 return total;
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4479
diff changeset
257 }
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4479
diff changeset
258
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4479
diff changeset
259
7d0d849abf80 added option to summarize debug values
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4479
diff changeset
260 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
261
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
262 printIndent(level);
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
263 TTY.println(map.getName());
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
264 for (DebugValue value : debugValues) {
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
265 long l = map.getCurrentValue(value.getIndex());
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
266 if (l != 0) {
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
267 printIndent(level + 1);
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
268 TTY.println(value.getName() + "=" + l);
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 }
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
271
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
272 for (DebugValueMap child : map.getChildren()) {
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
273 printMap(child, debugValues, level + 1);
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
274 }
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
275 }
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
276
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
277 private static void printIndent(int level) {
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
278 for (int i = 0; i < level; ++i) {
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
279 TTY.print(" ");
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
280 }
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
281 TTY.print("|-> ");
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
282 }
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 @Override
5018
bf63d72879aa fixed an issue that prevented java.util.concurrent methods from being compiled
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4563
diff changeset
285 public boolean compileMethod(final HotSpotMethodResolved method, final int entryBCI, boolean blocking) throws Throwable {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
286 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
287 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
288 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
289 // 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
290 // 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
291 // 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
292 // to add something to its own queue.
5021
a7c079d5dc87 try to reduce MaximumGreedyInlineSize significantly
Christian Haeubl <christian.haeubl@oracle.com>
parents: 5019
diff changeset
293 return false;
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
294 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
295 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
296
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
297 Runnable runnable = new Runnable() {
4406
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
298
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
299 public void run() {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
300 try {
4477
27c5466afd55 Changes to debug framework.
Andreas Woess <andreas.woess@jku.at>
parents: 4431
diff changeset
301 final PhasePlan plan = getDefaultPhasePlan();
4265
4643ccd37dac * removed CiStatistics
Lukas Stadler <lukas.stadler@jku.at>
parents: 4220
diff changeset
302 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
303 plan.addPhase(PhasePosition.AFTER_PARSING, graphBuilderPhase);
4563
b27666ff9bd6 added compilation time statistics to product mode
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4560
diff changeset
304 long startTime = System.nanoTime();
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
305 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
306 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
307 if (printCompilation) {
4406
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
308 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
309 }
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
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 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
312 TTY.Filter filter = new TTY.Filter(GraalOptions.PrintFilter, method);
4563
b27666ff9bd6 added compilation time statistics to product mode
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4560
diff changeset
313 long nanoTime;
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
314 try {
5054
b4f548d49f96 Remove duplicate method entry in debug scope.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5021
diff changeset
315 result = Debug.scope("Compiling", new Callable<CiTargetMethod>() {
4477
27c5466afd55 Changes to debug framework.
Andreas Woess <andreas.woess@jku.at>
parents: 4431
diff changeset
316 @Override
27c5466afd55 Changes to debug framework.
Andreas Woess <andreas.woess@jku.at>
parents: 4431
diff changeset
317 public CiTargetMethod call() throws Exception {
27c5466afd55 Changes to debug framework.
Andreas Woess <andreas.woess@jku.at>
parents: 4431
diff changeset
318 return compiler.getCompiler().compileMethod(method, -1, plan);
27c5466afd55 Changes to debug framework.
Andreas Woess <andreas.woess@jku.at>
parents: 4431
diff changeset
319 }
27c5466afd55 Changes to debug framework.
Andreas Woess <andreas.woess@jku.at>
parents: 4431
diff changeset
320 });
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
321 } 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
322 filter.remove();
4563
b27666ff9bd6 added compilation time statistics to product mode
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4560
diff changeset
323 nanoTime = System.nanoTime() - startTime;
b27666ff9bd6 added compilation time statistics to product mode
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4560
diff changeset
324 totalCompilationTime += nanoTime;
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
325 if (printCompilation) {
4563
b27666ff9bd6 added compilation time statistics to product mode
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4560
diff changeset
326 TTY.println(String.format("Graal %4d %-70s %-45s %-50s | %3d.%dms %4dnodes %5dB", index, "", "", "", nanoTime / 1000000, nanoTime % 1000000, 0, (result != null ? result.targetCodeSize()
4406
961895157a38 Tentative implementation of Meter and Time.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4366
diff changeset
327 : -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
328 }
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
329 }
4366
97ada1b642b7 Merge fix.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4365
diff changeset
330 compiler.getRuntime().installMethod(method, result);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
331 } catch (CiBailout bailout) {
4468
87a12a816e99 added C1 inlining policy for comparison, bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4463
diff changeset
332 Debug.metric("Bailouts").increment();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
333 if (GraalOptions.ExitVMOnBailout) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
334 bailout.printStackTrace(TTY.cachedOut);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
335 System.exit(-1);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
336 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
337 } catch (Throwable t) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
338 if (GraalOptions.ExitVMOnException) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
339 t.printStackTrace(TTY.cachedOut);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
340 System.exit(-1);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
341 }
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
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
346 if (blocking) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
347 runnable.run();
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
348 } else {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
349 compileQueue.execute(runnable);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
350 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
351 } catch (RejectedExecutionException e) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
352 // The compile queue was already shut down.
5018
bf63d72879aa fixed an issue that prevented java.util.concurrent methods from being compiled
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4563
diff changeset
353 return false;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
354 }
5018
bf63d72879aa fixed an issue that prevented java.util.concurrent methods from being compiled
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4563
diff changeset
355 return true;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
356 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
357
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
358 @Override
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
359 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
360 return new HotSpotMethodUnresolved(compiler, name, signature, holder);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
361 }
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 @Override
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
364 public RiSignature createRiSignature(String signature) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
365 return new HotSpotSignature(compiler, signature);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
366 }
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 @Override
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
369 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
370 if (offset != -1) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
371 HotSpotTypeResolved resolved = (HotSpotTypeResolved) holder;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
372 return resolved.createRiField(name, type, offset, flags);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
373 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
374 return new BaseUnresolvedField(holder, name, type);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
375 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
376
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
377 @Override
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
378 public RiType createRiType(HotSpotConstantPool pool, String name) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
379 throw new RuntimeException("not implemented");
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
380 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
381
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
382 @Override
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
383 public RiType createRiTypePrimitive(int basicType) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
384 switch (basicType) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
385 case 4:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
386 return typeBoolean;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
387 case 5:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
388 return typeChar;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
389 case 6:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
390 return typeFloat;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
391 case 7:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
392 return typeDouble;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
393 case 8:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
394 return typeByte;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
395 case 9:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
396 return typeShort;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
397 case 10:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
398 return typeInt;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
399 case 11:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
400 return typeLong;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
401 case 14:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
402 return typeVoid;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
403 default:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
404 throw new IllegalArgumentException("Unknown basic type: " + basicType);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
405 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
406 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
407
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
408 @Override
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
409 public RiType createRiTypeUnresolved(String name) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
410 return new HotSpotTypeUnresolved(compiler, name);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
411 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
412
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
413 @Override
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
414 public CiConstant createCiConstant(CiKind kind, long value) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
415 if (kind == CiKind.Long) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
416 return CiConstant.forLong(value);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
417 } else if (kind == CiKind.Int) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
418 return CiConstant.forInt((int) value);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
419 } else if (kind == CiKind.Short) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
420 return CiConstant.forShort((short) value);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
421 } else if (kind == CiKind.Char) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
422 return CiConstant.forChar((char) value);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
423 } else if (kind == CiKind.Byte) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
424 return CiConstant.forByte((byte) value);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
425 } else if (kind == CiKind.Boolean) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
426 return (value == 0) ? CiConstant.FALSE : CiConstant.TRUE;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
427 } else {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
428 throw new IllegalArgumentException();
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
429 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
430 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
431
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
432 @Override
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
433 public CiConstant createCiConstantFloat(float value) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
434 return CiConstant.forFloat(value);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
435 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
436
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
437 @Override
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
438 public CiConstant createCiConstantDouble(double value) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
439 return CiConstant.forDouble(value);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
440 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
441
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
442 @Override
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
443 public CiConstant createCiConstantObject(Object object) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
444 return CiConstant.forObject(object);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
445 }
4420
97e0fb1f4906 Make Array copy intrinsifier active again, fix format string in canonicalizer
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4410
diff changeset
446
97e0fb1f4906 Make Array copy intrinsifier active again, fix format string in canonicalizer
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4410
diff changeset
447 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
448 PhasePlan phasePlan = new PhasePlan();
4463
6616513a42de bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4423
diff changeset
449 if (GraalOptions.Intrinsify) {
6616513a42de bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4423
diff changeset
450 phasePlan.addPhase(PhasePosition.HIGH_LEVEL, intrinsifyArrayCopy);
6616513a42de bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4423
diff changeset
451 }
4420
97e0fb1f4906 Make Array copy intrinsifier active again, fix format string in canonicalizer
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4410
diff changeset
452 return phasePlan;
97e0fb1f4906 Make Array copy intrinsifier active again, fix format string in canonicalizer
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 4410
diff changeset
453 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
454 }