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
24
25 package org.graalvm.compiler.nodes.spi;
26
27 import java.util.List;
28
29 import org.graalvm.compiler.core.common.spi.ArrayOffsetProvider;
30 import org.graalvm.compiler.debug.DebugContext;
31 import org.graalvm.compiler.debug.GraalError;
32 import org.graalvm.compiler.graph.Node;
33 import org.graalvm.compiler.nodes.ValueNode;
34 import org.graalvm.compiler.nodes.java.MonitorIdNode;
35 import org.graalvm.compiler.nodes.virtual.VirtualObjectNode;
36 import org.graalvm.compiler.options.OptionValues;
37
38 import jdk.vm.ci.meta.ConstantReflectionProvider;
39 import jdk.vm.ci.meta.JavaConstant;
40 import jdk.vm.ci.meta.JavaKind;
41 import jdk.vm.ci.meta.MetaAccessProvider;
42
43 /**
44 * This tool can be used to query the current state (normal/virtualized/re-materialized) of values
45 * and to describe the actions that would be taken for this state.
46 *
47 * See also {@link Virtualizable}.
48 */
49 public interface VirtualizerTool {
50
51 /**
52 * @return the {@link MetaAccessProvider} associated with the current compilation.
53 */
54 MetaAccessProvider getMetaAccessProvider();
55
56 /**
57 * @return the {@link ConstantReflectionProvider} associated with the current compilation, which
58 * can be used to access {@link JavaConstant}s.
59 */
60 ConstantReflectionProvider getConstantReflectionProvider();
61
62 ArrayOffsetProvider getArrayOffsetProvider();
63
64 /**
65 * This method should be used to query the maximum size of virtualized objects before attempting
66 * virtualization.
67 *
68 * @return the maximum number of entries for virtualized objects.
69 */
70 int getMaximumEntryCount();
71
72 // methods working on virtualized/materialized objects
73
74 /**
75 * Introduces a new virtual object to the current state.
76 *
77 * @param virtualObject the new virtual object.
78 * @param entryState the initial state of the virtual object's fields.
79 * @param locks the initial locking depths.
80 * @param ensureVirtualized true if this object needs to stay virtual
81 */
82 void createVirtualObject(VirtualObjectNode virtualObject, ValueNode[] entryState, List<MonitorIdNode> locks, boolean ensureVirtualized);
|
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
24
25 package org.graalvm.compiler.nodes.spi;
26
27 import java.util.List;
28
29 import org.graalvm.compiler.debug.DebugContext;
30 import org.graalvm.compiler.debug.GraalError;
31 import org.graalvm.compiler.graph.Node;
32 import org.graalvm.compiler.nodes.ValueNode;
33 import org.graalvm.compiler.nodes.java.MonitorIdNode;
34 import org.graalvm.compiler.nodes.virtual.VirtualObjectNode;
35 import org.graalvm.compiler.options.OptionValues;
36
37 import jdk.vm.ci.meta.ConstantReflectionProvider;
38 import jdk.vm.ci.meta.JavaConstant;
39 import jdk.vm.ci.meta.JavaKind;
40 import jdk.vm.ci.meta.MetaAccessProvider;
41
42 /**
43 * This tool can be used to query the current state (normal/virtualized/re-materialized) of values
44 * and to describe the actions that would be taken for this state.
45 *
46 * See also {@link Virtualizable}.
47 */
48 public interface VirtualizerTool {
49
50 /**
51 * @return the {@link MetaAccessProvider} associated with the current compilation.
52 */
53 MetaAccessProvider getMetaAccess();
54
55 /**
56 * @return the {@link ConstantReflectionProvider} associated with the current compilation, which
57 * can be used to access {@link JavaConstant}s.
58 */
59 ConstantReflectionProvider getConstantReflection();
60
61 /**
62 * This method should be used to query the maximum size of virtualized objects before attempting
63 * virtualization.
64 *
65 * @return the maximum number of entries for virtualized objects.
66 */
67 int getMaximumEntryCount();
68
69 // methods working on virtualized/materialized objects
70
71 /**
72 * Introduces a new virtual object to the current state.
73 *
74 * @param virtualObject the new virtual object.
75 * @param entryState the initial state of the virtual object's fields.
76 * @param locks the initial locking depths.
77 * @param ensureVirtualized true if this object needs to stay virtual
78 */
79 void createVirtualObject(VirtualObjectNode virtualObject, ValueNode[] entryState, List<MonitorIdNode> locks, boolean ensureVirtualized);
|