annotate graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompiler.java @ 12779:f6c511451e4a

made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
author Doug Simon <doug.simon@oracle.com>
date Tue, 19 Nov 2013 01:31:19 +0100
parents 0dd597c6c9c7
children 36bbe5bbe8fd
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 /*
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
2 * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
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
5328
e4e02131c58b log file (i.e. -G:LogFile=log.txt option) now used for TTY output as well
Doug Simon <doug.simon@oracle.com>
parents: 5323
diff changeset
26 import java.io.*;
12779
f6c511451e4a made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents: 12652
diff changeset
27 import java.util.concurrent.*;
5328
e4e02131c58b log file (i.e. -G:LogFile=log.txt option) now used for TTY output as well
Doug Simon <doug.simon@oracle.com>
parents: 5323
diff changeset
28
5507
dc71b06d09f8 Moving classes from cri.ri to api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5504
diff changeset
29 import com.oracle.graal.api.meta.*;
7786
8bbbde9d0a52 extended ResolvedJavaMethod API by getLocalVariableTable
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 7530
diff changeset
30 import com.oracle.graal.hotspot.debug.*;
5548
8872bc0eebdf Renaming hotspot.ri => hotspot.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5541
diff changeset
31 import com.oracle.graal.hotspot.meta.*;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
32
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
33 /**
4410
646a6bfecf73 Small doc fixes.
Doug Simon <doug.simon@oracle.com>
parents: 4220
diff changeset
34 * Calls from HotSpot into Java.
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
35 */
4220
5c80ccb80036 Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4199
diff changeset
36 public interface VMToCompiler {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
37
9108
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents: 7786
diff changeset
38 /**
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents: 7786
diff changeset
39 * Compiles a method to machine code. This method is called from the VM
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents: 7786
diff changeset
40 * (VMToCompiler::compileMethod).
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents: 7786
diff changeset
41 */
10672
e7d07c9bb779 Removed priority compilation queue.
Christian Haeubl <haeubl@ssw.jku.at>
parents: 10056
diff changeset
42 void compileMethod(long metaspaceMethod, HotSpotResolvedObjectType holder, int entryBCI, boolean blocking) throws Throwable;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
43
9108
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents: 7786
diff changeset
44 /**
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents: 7786
diff changeset
45 * Compiles a method to machine code.
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents: 7786
diff changeset
46 */
10672
e7d07c9bb779 Removed priority compilation queue.
Christian Haeubl <haeubl@ssw.jku.at>
parents: 10056
diff changeset
47 void compileMethod(HotSpotResolvedJavaMethod method, int entryBCI, boolean blocking) throws Throwable;
9108
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents: 7786
diff changeset
48
12779
f6c511451e4a made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents: 12652
diff changeset
49 /**
f6c511451e4a made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents: 12652
diff changeset
50 * Notifies this object of statistics for a completed compilation.
f6c511451e4a made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents: 12652
diff changeset
51 *
f6c511451e4a made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents: 12652
diff changeset
52 * @param id the identifier of the compilation
f6c511451e4a made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents: 12652
diff changeset
53 * @param method the method compiled
f6c511451e4a made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents: 12652
diff changeset
54 * @param osr specifies if the compilation was for on-stack-replacement
f6c511451e4a made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents: 12652
diff changeset
55 * @param processedBytecodes the number of bytecodes processed during the compilation, including
f6c511451e4a made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents: 12652
diff changeset
56 * the bytecodes of all inlined methods
f6c511451e4a made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents: 12652
diff changeset
57 * @param time the amount time spent compiling {@code method}
f6c511451e4a made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents: 12652
diff changeset
58 * @param timeUnit the units of {@code time}
f6c511451e4a made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents: 12652
diff changeset
59 * @param installedCode the nmethod installed as a result of the compilation
f6c511451e4a made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents: 12652
diff changeset
60 */
f6c511451e4a made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents: 12652
diff changeset
61 void notifyCompilationDone(int id, HotSpotResolvedJavaMethod method, boolean osr, int processedBytecodes, long time, TimeUnit timeUnit, HotSpotInstalledCode installedCode);
f6c511451e4a made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents: 12652
diff changeset
62
4192
432c40a691ce CRI clean up.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4139
diff changeset
63 void shutdownCompiler() throws Throwable;
432c40a691ce CRI clean up.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4139
diff changeset
64
12779
f6c511451e4a made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents: 12652
diff changeset
65 void startCompiler(boolean bootstrapEnabled, long statsAddress) throws Throwable;
4192
432c40a691ce CRI clean up.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4139
diff changeset
66
432c40a691ce CRI clean up.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4139
diff changeset
67 void bootstrap() throws Throwable;
432c40a691ce CRI clean up.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4139
diff changeset
68
12652
0dd597c6c9c7 fixed performance regression in hosted CompileTheWorld
Doug Simon <doug.simon@oracle.com>
parents: 10672
diff changeset
69 void compileTheWorld() throws Throwable;
0dd597c6c9c7 fixed performance regression in hosted CompileTheWorld
Doug Simon <doug.simon@oracle.com>
parents: 10672
diff changeset
70
5328
e4e02131c58b log file (i.e. -G:LogFile=log.txt option) now used for TTY output as well
Doug Simon <doug.simon@oracle.com>
parents: 5323
diff changeset
71 PrintStream log();
e4e02131c58b log file (i.e. -G:LogFile=log.txt option) now used for TTY output as well
Doug Simon <doug.simon@oracle.com>
parents: 5323
diff changeset
72
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6677
diff changeset
73 JavaMethod createUnresolvedJavaMethod(String name, String signature, JavaType holder);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
74
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6677
diff changeset
75 JavaField createJavaField(JavaType holder, String name, JavaType type, int offset, int flags, boolean internal);
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6677
diff changeset
76
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6677
diff changeset
77 ResolvedJavaMethod createResolvedJavaMethod(JavaType holder, long metaspaceMethod);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
78
5554
70f715dfbb41 Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5548
diff changeset
79 JavaType createPrimitiveJavaType(int basicType);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
80
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6677
diff changeset
81 JavaType createUnresolvedJavaType(String name);
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6677
diff changeset
82
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6677
diff changeset
83 /**
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6677
diff changeset
84 * Creates a resolved Java type.
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7084
diff changeset
85 *
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6677
diff changeset
86 * @param metaspaceKlass the metaspace Klass object for the type
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6677
diff changeset
87 * @param name the {@linkplain JavaType#getName() name} of the type
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6677
diff changeset
88 * @param simpleName a simple, unqualified name for the type
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6677
diff changeset
89 * @param javaMirror the {@link Class} mirror
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7084
diff changeset
90 * @param sizeOrSpecies the size of an instance of the type, or
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7084
diff changeset
91 * {@link HotSpotResolvedObjectType#INTERFACE_SPECIES_VALUE} or
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7084
diff changeset
92 * {@link HotSpotResolvedObjectType#ARRAY_SPECIES_VALUE}
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7084
diff changeset
93 * @return the resolved type associated with {@code javaMirror} which may not be the type
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7084
diff changeset
94 * instantiated by this call in the case of another thread racing to create the same
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7084
diff changeset
95 * type
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6677
diff changeset
96 */
9126
bc26f978b0ce HotSpotResolvedObjectType: implement hasFinalizeSubclass() correctly
Bernhard Urban <bernhard.urban@jku.at>
parents: 9108
diff changeset
97 ResolvedJavaType createResolvedJavaType(long metaspaceKlass, String name, String simpleName, Class javaMirror, int sizeOrSpecies);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
98
5554
70f715dfbb41 Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5548
diff changeset
99 Constant createConstant(Kind kind, long value);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
100
5554
70f715dfbb41 Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5548
diff changeset
101 Constant createConstantFloat(float value);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
102
5554
70f715dfbb41 Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5548
diff changeset
103 Constant createConstantDouble(double value);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
104
5554
70f715dfbb41 Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5548
diff changeset
105 Constant createConstantObject(Object object);
7786
8bbbde9d0a52 extended ResolvedJavaMethod API by getLocalVariableTable
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 7530
diff changeset
106
8bbbde9d0a52 extended ResolvedJavaMethod API by getLocalVariableTable
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 7530
diff changeset
107 LocalImpl createLocalImpl(String name, String type, HotSpotResolvedObjectType holder, int bciStart, int bciEnd, int slot);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
108 }