Mercurial > hg > truffle
annotate graal/com.oracle.graal.api.replacements/src/com/oracle/graal/api/replacements/MethodHandleAccessProvider.java @ 17351:90dc742e8cc7
Re-add insertIntoGraph argument to Node.copyWithInputs method.
author | Roland Schatz <roland.schatz@oracle.com> |
---|---|
date | Mon, 06 Oct 2014 16:33:58 +0200 |
parents | 09d721bcffe2 |
children | 9619ba4daf4c |
rev | line source |
---|---|
15481
09d721bcffe2
Introduce API for lookup of VM-internals of method handles
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
1 /* |
09d721bcffe2
Introduce API for lookup of VM-internals of method handles
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
2 * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved. |
09d721bcffe2
Introduce API for lookup of VM-internals of method handles
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
09d721bcffe2
Introduce API for lookup of VM-internals of method handles
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
4 * |
09d721bcffe2
Introduce API for lookup of VM-internals of method handles
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
09d721bcffe2
Introduce API for lookup of VM-internals of method handles
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
09d721bcffe2
Introduce API for lookup of VM-internals of method handles
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
09d721bcffe2
Introduce API for lookup of VM-internals of method handles
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
8 * |
09d721bcffe2
Introduce API for lookup of VM-internals of method handles
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
09d721bcffe2
Introduce API for lookup of VM-internals of method handles
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
09d721bcffe2
Introduce API for lookup of VM-internals of method handles
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
09d721bcffe2
Introduce API for lookup of VM-internals of method handles
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
09d721bcffe2
Introduce API for lookup of VM-internals of method handles
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
09d721bcffe2
Introduce API for lookup of VM-internals of method handles
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
14 * |
09d721bcffe2
Introduce API for lookup of VM-internals of method handles
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
09d721bcffe2
Introduce API for lookup of VM-internals of method handles
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
09d721bcffe2
Introduce API for lookup of VM-internals of method handles
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
09d721bcffe2
Introduce API for lookup of VM-internals of method handles
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
18 * |
09d721bcffe2
Introduce API for lookup of VM-internals of method handles
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
09d721bcffe2
Introduce API for lookup of VM-internals of method handles
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
09d721bcffe2
Introduce API for lookup of VM-internals of method handles
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
21 * questions. |
09d721bcffe2
Introduce API for lookup of VM-internals of method handles
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
22 */ |
09d721bcffe2
Introduce API for lookup of VM-internals of method handles
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
23 package com.oracle.graal.api.replacements; |
09d721bcffe2
Introduce API for lookup of VM-internals of method handles
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
24 |
09d721bcffe2
Introduce API for lookup of VM-internals of method handles
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
25 import java.lang.invoke.*; |
09d721bcffe2
Introduce API for lookup of VM-internals of method handles
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
26 |
09d721bcffe2
Introduce API for lookup of VM-internals of method handles
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
27 import com.oracle.graal.api.meta.*; |
09d721bcffe2
Introduce API for lookup of VM-internals of method handles
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
28 |
09d721bcffe2
Introduce API for lookup of VM-internals of method handles
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
29 /** |
09d721bcffe2
Introduce API for lookup of VM-internals of method handles
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
30 * Interface to access the internals of the {@link MethodHandle} implementation of the VM. An |
09d721bcffe2
Introduce API for lookup of VM-internals of method handles
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
31 * implementation of this interface is usually required to access non-public classes, methods, and |
09d721bcffe2
Introduce API for lookup of VM-internals of method handles
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
32 * fields of {@link MethodHandle}, i.e., data that is not standardized by the Java specification. |
09d721bcffe2
Introduce API for lookup of VM-internals of method handles
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
33 */ |
09d721bcffe2
Introduce API for lookup of VM-internals of method handles
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
34 public interface MethodHandleAccessProvider { |
09d721bcffe2
Introduce API for lookup of VM-internals of method handles
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
35 |
09d721bcffe2
Introduce API for lookup of VM-internals of method handles
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
36 /** |
09d721bcffe2
Introduce API for lookup of VM-internals of method handles
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
37 * Identification for methods defined on the class {@link MethodHandle} that are processed by |
09d721bcffe2
Introduce API for lookup of VM-internals of method handles
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
38 * the {@link MethodHandleAccessProvider}. |
09d721bcffe2
Introduce API for lookup of VM-internals of method handles
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
39 */ |
09d721bcffe2
Introduce API for lookup of VM-internals of method handles
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
40 public enum IntrinsicMethod { |
09d721bcffe2
Introduce API for lookup of VM-internals of method handles
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
41 /** The method {@code MethodHandle.invokeBasic}. */ |
09d721bcffe2
Introduce API for lookup of VM-internals of method handles
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
42 INVOKE_BASIC, |
09d721bcffe2
Introduce API for lookup of VM-internals of method handles
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
43 /** The method {@code MethodHandle.linkToStatic}. */ |
09d721bcffe2
Introduce API for lookup of VM-internals of method handles
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
44 LINK_TO_STATIC, |
09d721bcffe2
Introduce API for lookup of VM-internals of method handles
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
45 /** The method {@code MethodHandle.linkToSpecial}. */ |
09d721bcffe2
Introduce API for lookup of VM-internals of method handles
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
46 LINK_TO_SPECIAL, |
09d721bcffe2
Introduce API for lookup of VM-internals of method handles
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
47 /** The method {@code MethodHandle.linkToVirtual}. */ |
09d721bcffe2
Introduce API for lookup of VM-internals of method handles
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
48 LINK_TO_VIRTUAL, |
09d721bcffe2
Introduce API for lookup of VM-internals of method handles
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
49 /** The method {@code MethodHandle.linkToInterface}. */ |
09d721bcffe2
Introduce API for lookup of VM-internals of method handles
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
50 LINK_TO_INTERFACE |
09d721bcffe2
Introduce API for lookup of VM-internals of method handles
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
51 } |
09d721bcffe2
Introduce API for lookup of VM-internals of method handles
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
52 |
09d721bcffe2
Introduce API for lookup of VM-internals of method handles
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
53 /** |
09d721bcffe2
Introduce API for lookup of VM-internals of method handles
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
54 * Returns the method handle method intrinsic identifier for the provided method, or |
09d721bcffe2
Introduce API for lookup of VM-internals of method handles
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
55 * {@code null} if the method is not an intrinsic processed by this interface. |
09d721bcffe2
Introduce API for lookup of VM-internals of method handles
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
56 */ |
09d721bcffe2
Introduce API for lookup of VM-internals of method handles
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
57 IntrinsicMethod lookupMethodHandleIntrinsic(ResolvedJavaMethod method); |
09d721bcffe2
Introduce API for lookup of VM-internals of method handles
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
58 |
09d721bcffe2
Introduce API for lookup of VM-internals of method handles
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
59 /** |
09d721bcffe2
Introduce API for lookup of VM-internals of method handles
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
60 * Resolves the invocation target for an invocation of {@link IntrinsicMethod#INVOKE_BASIC |
09d721bcffe2
Introduce API for lookup of VM-internals of method handles
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
61 * MethodHandle.invokeBasic} with the given constant receiver {@link MethodHandle}. Returns |
09d721bcffe2
Introduce API for lookup of VM-internals of method handles
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
62 * {@code null} if the invocation target is not available at this time. |
09d721bcffe2
Introduce API for lookup of VM-internals of method handles
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
63 * <p> |
09d721bcffe2
Introduce API for lookup of VM-internals of method handles
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
64 * The first invocations of a method handle can use an interpreter to lookup the actual invoked |
09d721bcffe2
Introduce API for lookup of VM-internals of method handles
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
65 * method; frequently executed method handles can use Java bytecode generation to avoid the |
09d721bcffe2
Introduce API for lookup of VM-internals of method handles
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
66 * interpreter overhead. If the parameter forceBytecodeGeneration is set to true, the VM should |
09d721bcffe2
Introduce API for lookup of VM-internals of method handles
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
67 * try to generate bytecodes before this method returns. |
09d721bcffe2
Introduce API for lookup of VM-internals of method handles
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
68 */ |
09d721bcffe2
Introduce API for lookup of VM-internals of method handles
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
69 ResolvedJavaMethod resolveInvokeBasicTarget(Constant methodHandle, boolean forceBytecodeGeneration); |
09d721bcffe2
Introduce API for lookup of VM-internals of method handles
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
70 |
09d721bcffe2
Introduce API for lookup of VM-internals of method handles
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
71 /** |
09d721bcffe2
Introduce API for lookup of VM-internals of method handles
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
72 * Resolves the invocation target for an invocation of a {@code MethodHandle.linkTo*} method |
09d721bcffe2
Introduce API for lookup of VM-internals of method handles
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
73 * with the given constant member name. The member name is the last parameter of the |
09d721bcffe2
Introduce API for lookup of VM-internals of method handles
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
74 * {@code linkTo*} method. Returns {@code null} if the invocation target is not available at |
09d721bcffe2
Introduce API for lookup of VM-internals of method handles
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
75 * this time. |
09d721bcffe2
Introduce API for lookup of VM-internals of method handles
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
76 */ |
09d721bcffe2
Introduce API for lookup of VM-internals of method handles
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
77 ResolvedJavaMethod resolveLinkToTarget(Constant memberName); |
09d721bcffe2
Introduce API for lookup of VM-internals of method handles
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
78 } |