Mercurial > hg > graal-compiler
annotate graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/CodeCacheProvider.java @ 21629:36cf15e3219e
Move HotSpotResolvedJavaMethod.getSpeculationLog to ResolvedJavaMethod
author | Gilles Duboscq <gilles.m.duboscq@oracle.com> |
---|---|
date | Mon, 01 Jun 2015 15:14:39 +0200 |
parents | 48c1ebd24120 |
children | 4c00096fc415 |
rev | line source |
---|---|
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1 /* |
15358
c17d593ccafb
Add createSpeculationLog to CodeCacheProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
15018
diff
changeset
|
2 * Copyright (c) 2009, 2014, 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 */ |
21556
48c1ebd24120
renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
18188
diff
changeset
|
23 package com.oracle.jvmci.code; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
24 |
21629
36cf15e3219e
Move HotSpotResolvedJavaMethod.getSpeculationLog to ResolvedJavaMethod
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21556
diff
changeset
|
25 import com.oracle.jvmci.meta.*; |
21556
48c1ebd24120
renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
18188
diff
changeset
|
26 import com.oracle.jvmci.code.CompilationResult.DataPatch; |
48c1ebd24120
renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
18188
diff
changeset
|
27 import com.oracle.jvmci.code.DataSection.Data; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
28 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
29 /** |
12045
0fc653a9e019
made GraalCodeCacheProvider independent of CodeCacheProvider and renamed the former to LoweringProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
11959
diff
changeset
|
30 * Access to code cache related details and requirements. |
6539
2463eb24b644
Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6521
diff
changeset
|
31 */ |
11959
23ccaa863eda
made CodeCacheProvider independent of MetaAccessProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
11839
diff
changeset
|
32 public interface CodeCacheProvider { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
33 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
34 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7144
diff
changeset
|
35 * Adds the given compilation result as an implementation of the given method without making it |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7144
diff
changeset
|
36 * the default implementation. |
15358
c17d593ccafb
Add createSpeculationLog to CodeCacheProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
15018
diff
changeset
|
37 * |
6329
92bc58dc5b5e
More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5780
diff
changeset
|
38 * @param method a method to which the executable code is begin added |
92bc58dc5b5e
More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5780
diff
changeset
|
39 * @param compResult the compilation result to be added |
13669
034706a93f27
CodeCacheProvider.addMethod: add speculationLog argument
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
12530
diff
changeset
|
40 * @param speculationLog the speculation log to be used |
15217
ec7d8b646b9f
Truffle: Fixed display of installed code size.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
15162
diff
changeset
|
41 * @return a reference to the compiled and ready-to-run code or throws a |
ec7d8b646b9f
Truffle: Fixed display of installed code size.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
15162
diff
changeset
|
42 * {@link BailoutException} if the code installation failed |
6329
92bc58dc5b5e
More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5780
diff
changeset
|
43 */ |
15162
dbb1fe8348e6
Allow to supply predefined installed code object when adding a method to the code cache.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
15018
diff
changeset
|
44 InstalledCode addMethod(ResolvedJavaMethod method, CompilationResult compResult, SpeculationLog speculationLog, InstalledCode predefinedInstalledCode); |
6329
92bc58dc5b5e
More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5780
diff
changeset
|
45 |
92bc58dc5b5e
More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5780
diff
changeset
|
46 /** |
12530
ecd85445f77a
Rename CodeCacheProvider.addDefaultMethod to setDefaultMethod
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
12526
diff
changeset
|
47 * Sets the given compilation result as the default implementation of the given method. |
15358
c17d593ccafb
Add createSpeculationLog to CodeCacheProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
15018
diff
changeset
|
48 * |
12526
04671d59e93b
Allow CodeCacheProvider to install default methods
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
12363
diff
changeset
|
49 * @param method a method to which the executable code is begin added |
04671d59e93b
Allow CodeCacheProvider to install default methods
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
12363
diff
changeset
|
50 * @param compResult the compilation result to be added |
04671d59e93b
Allow CodeCacheProvider to install default methods
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
12363
diff
changeset
|
51 * @return a reference to the compiled and ready-to-run code or null if the code installation |
04671d59e93b
Allow CodeCacheProvider to install default methods
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
12363
diff
changeset
|
52 * failed |
04671d59e93b
Allow CodeCacheProvider to install default methods
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
12363
diff
changeset
|
53 */ |
12530
ecd85445f77a
Rename CodeCacheProvider.addDefaultMethod to setDefaultMethod
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
12526
diff
changeset
|
54 InstalledCode setDefaultMethod(ResolvedJavaMethod method, CompilationResult compResult); |
12526
04671d59e93b
Allow CodeCacheProvider to install default methods
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
12363
diff
changeset
|
55 |
04671d59e93b
Allow CodeCacheProvider to install default methods
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
12363
diff
changeset
|
56 /** |
8349
8d6ea1915d42
merged CodeInfo into InstalledCode (GRAAL-156)
Doug Simon <doug.simon@oracle.com>
parents:
7838
diff
changeset
|
57 * Returns a disassembly of some compiled code. |
15358
c17d593ccafb
Add createSpeculationLog to CodeCacheProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
15018
diff
changeset
|
58 * |
8349
8d6ea1915d42
merged CodeInfo into InstalledCode (GRAAL-156)
Doug Simon <doug.simon@oracle.com>
parents:
7838
diff
changeset
|
59 * @param compResult some compiled code |
8d6ea1915d42
merged CodeInfo into InstalledCode (GRAAL-156)
Doug Simon <doug.simon@oracle.com>
parents:
7838
diff
changeset
|
60 * @param installedCode the result of installing the code in {@code compResult} or null if the |
8d6ea1915d42
merged CodeInfo into InstalledCode (GRAAL-156)
Doug Simon <doug.simon@oracle.com>
parents:
7838
diff
changeset
|
61 * code has not yet been installed |
15358
c17d593ccafb
Add createSpeculationLog to CodeCacheProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
15018
diff
changeset
|
62 * |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7144
diff
changeset
|
63 * @return a disassembly. This will be of length 0 if the runtime does not support |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7144
diff
changeset
|
64 * disassembling. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
65 */ |
8349
8d6ea1915d42
merged CodeInfo into InstalledCode (GRAAL-156)
Doug Simon <doug.simon@oracle.com>
parents:
7838
diff
changeset
|
66 String disassemble(CompilationResult compResult, InstalledCode installedCode); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
67 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
68 /** |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
69 * Gets the register configuration to use when compiling a given method. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
70 */ |
12050
9584d08f56db
rename: lookupRegisterConfig -> getRegisterConfig
Doug Simon <doug.simon@oracle.com>
parents:
12045
diff
changeset
|
71 RegisterConfig getRegisterConfig(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
72 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
73 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7144
diff
changeset
|
74 * Minimum size of the stack area reserved for outgoing parameters. This area is reserved in all |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7144
diff
changeset
|
75 * cases, even when the compiled method has no regular call instructions. |
15358
c17d593ccafb
Add createSpeculationLog to CodeCacheProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
15018
diff
changeset
|
76 * |
4181
319860ae697a
Simplify FrameMap: make offsets of spill slots and outgoing parameters independent so that they can be allocated at the same time, eliminating the separate phases. This makes the separate StackBlock unnecesary. Change CiStackSlot to use byte offsets instead of spill slot index. This makes CiTarget.spillSlotSize unnecessary.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4139
diff
changeset
|
77 * @return the minimum size of the outgoing parameter area in bytes |
319860ae697a
Simplify FrameMap: make offsets of spill slots and outgoing parameters independent so that they can be allocated at the same time, eliminating the separate phases. This makes the separate StackBlock unnecesary. Change CiStackSlot to use byte offsets instead of spill slot index. This makes CiTarget.spillSlotSize unnecessary.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4139
diff
changeset
|
78 */ |
319860ae697a
Simplify FrameMap: make offsets of spill slots and outgoing parameters independent so that they can be allocated at the same time, eliminating the separate phases. This makes the separate StackBlock unnecesary. Change CiStackSlot to use byte offsets instead of spill slot index. This makes CiTarget.spillSlotSize unnecessary.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4139
diff
changeset
|
79 int getMinimumOutgoingSize(); |
319860ae697a
Simplify FrameMap: make offsets of spill slots and outgoing parameters independent so that they can be allocated at the same time, eliminating the separate phases. This makes the separate StackBlock unnecesary. Change CiStackSlot to use byte offsets instead of spill slot index. This makes CiTarget.spillSlotSize unnecessary.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4139
diff
changeset
|
80 |
319860ae697a
Simplify FrameMap: make offsets of spill slots and outgoing parameters independent so that they can be allocated at the same time, eliminating the separate phases. This makes the separate StackBlock unnecesary. Change CiStackSlot to use byte offsets instead of spill slot index. This makes CiTarget.spillSlotSize unnecessary.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4139
diff
changeset
|
81 /** |
15018
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14561
diff
changeset
|
82 * Determines if a {@link DataPatch} should be created for a given primitive constant that is |
db4254246f9a
Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents:
14561
diff
changeset
|
83 * part of a {@link CompilationResult}. A data patch is always created for an object constant. |
6996
eec373d34caf
added support for annotated Constants and used it to track Klass* values in Graal and register them in the metadata section of a nmethod during code installation
Doug Simon <doug.simon@oracle.com>
parents:
6651
diff
changeset
|
84 */ |
18187
9619ba4daf4c
Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents:
18176
diff
changeset
|
85 boolean needsDataPatch(JavaConstant constant); |
7715
ab7a97237115
expose TargetDescription through CodeCacheProvider API
Roland Schatz <roland.schatz@oracle.com>
parents:
7530
diff
changeset
|
86 |
ab7a97237115
expose TargetDescription through CodeCacheProvider API
Roland Schatz <roland.schatz@oracle.com>
parents:
7530
diff
changeset
|
87 /** |
18188
8652481a1110
Introduce new Constant interface for use in high-level graph.
Roland Schatz <roland.schatz@oracle.com>
parents:
18187
diff
changeset
|
88 * Create a {@link Data} item for a {@link Constant}, that can be used in a {@link DataPatch}. |
14561
e14198669e5c
Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents:
13669
diff
changeset
|
89 */ |
18188
8652481a1110
Introduce new Constant interface for use in high-level graph.
Roland Schatz <roland.schatz@oracle.com>
parents:
18187
diff
changeset
|
90 Data createDataItem(Constant constant); |
14561
e14198669e5c
Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents:
13669
diff
changeset
|
91 |
e14198669e5c
Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents:
13669
diff
changeset
|
92 /** |
7715
ab7a97237115
expose TargetDescription through CodeCacheProvider API
Roland Schatz <roland.schatz@oracle.com>
parents:
7530
diff
changeset
|
93 * Gets a description of the target architecture. |
ab7a97237115
expose TargetDescription through CodeCacheProvider API
Roland Schatz <roland.schatz@oracle.com>
parents:
7530
diff
changeset
|
94 */ |
ab7a97237115
expose TargetDescription through CodeCacheProvider API
Roland Schatz <roland.schatz@oracle.com>
parents:
7530
diff
changeset
|
95 TargetDescription getTarget(); |
15358
c17d593ccafb
Add createSpeculationLog to CodeCacheProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
15018
diff
changeset
|
96 |
c17d593ccafb
Add createSpeculationLog to CodeCacheProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
15018
diff
changeset
|
97 /** |
c17d593ccafb
Add createSpeculationLog to CodeCacheProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
15018
diff
changeset
|
98 * Create a new speculation log for the target runtime. |
c17d593ccafb
Add createSpeculationLog to CodeCacheProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
15018
diff
changeset
|
99 */ |
c17d593ccafb
Add createSpeculationLog to CodeCacheProvider.
Roland Schatz <roland.schatz@oracle.com>
parents:
15018
diff
changeset
|
100 SpeculationLog createSpeculationLog(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
101 } |