comparison jvmci/com.oracle.jvmci.code/src/com/oracle/jvmci/code/CodeCacheProvider.java @ 21798:395ac43a8578

moved JVMCI sources from graal/ to jvmci/ directory
author Doug Simon <doug.simon@oracle.com>
date Tue, 09 Jun 2015 00:22:49 +0200
parents graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/CodeCacheProvider.java@4c00096fc415
children
comparison
equal deleted inserted replaced
21797:42452d2dfbec 21798:395ac43a8578
1 /*
2 * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23 package com.oracle.jvmci.code;
24
25 import com.oracle.jvmci.code.CompilationResult.Call;
26 import com.oracle.jvmci.code.CompilationResult.DataPatch;
27 import com.oracle.jvmci.code.CompilationResult.Mark;
28 import com.oracle.jvmci.code.DataSection.Data;
29 import com.oracle.jvmci.meta.*;
30
31 /**
32 * Access to code cache related details and requirements.
33 */
34 public interface CodeCacheProvider {
35
36 /**
37 * Adds the given compilation result as an implementation of the given method without making it
38 * the default implementation.
39 *
40 * @param method a method to which the executable code is begin added
41 * @param compResult the compilation result to be added
42 * @param speculationLog the speculation log to be used
43 * @return a reference to the compiled and ready-to-run code or throws a
44 * {@link BailoutException} if the code installation failed
45 */
46 InstalledCode addMethod(ResolvedJavaMethod method, CompilationResult compResult, SpeculationLog speculationLog, InstalledCode predefinedInstalledCode);
47
48 /**
49 * Sets the given compilation result as the default implementation of the given method.
50 *
51 * @param method a method to which the executable code is begin added
52 * @param compResult the compilation result to be added
53 * @return a reference to the compiled and ready-to-run code or null if the code installation
54 * failed
55 */
56 InstalledCode setDefaultMethod(ResolvedJavaMethod method, CompilationResult compResult);
57
58 /**
59 * Gets a name for a {@link Mark} mark.
60 */
61 default String getMarkName(Mark mark) {
62 return String.valueOf(mark.id);
63 }
64
65 /**
66 * Gets a name for the {@linkplain Call#target target} of a {@link Call}.
67 */
68 default String getTargetName(Call call) {
69 return String.valueOf(call.target);
70 }
71
72 /**
73 * Gets the register configuration to use when compiling a given method.
74 */
75 RegisterConfig getRegisterConfig();
76
77 /**
78 * Minimum size of the stack area reserved for outgoing parameters. This area is reserved in all
79 * cases, even when the compiled method has no regular call instructions.
80 *
81 * @return the minimum size of the outgoing parameter area in bytes
82 */
83 int getMinimumOutgoingSize();
84
85 /**
86 * Determines if a {@link DataPatch} should be created for a given primitive constant that is
87 * part of a {@link CompilationResult}. A data patch is always created for an object constant.
88 */
89 boolean needsDataPatch(JavaConstant constant);
90
91 /**
92 * Create a {@link Data} item for a {@link Constant}, that can be used in a {@link DataPatch}.
93 */
94 Data createDataItem(Constant constant);
95
96 /**
97 * Gets a description of the target architecture.
98 */
99 TargetDescription getTarget();
100
101 /**
102 * Create a new speculation log for the target runtime.
103 */
104 SpeculationLog createSpeculationLog();
105 }