Mercurial > hg > truffle
changeset 15154:d708c2fc5cba
Allow DirectMethodHandles references in immutable code
author | Gilles Duboscq <duboscq@ssw.jku.at> |
---|---|
date | Wed, 16 Apr 2014 16:49:10 +0200 |
parents | d224a3a0e6a9 |
children | 8fc3ca046532 5be5e917e421 |
files | graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/AheadOfTimeVerificationPhase.java |
diffstat | 1 files changed, 9 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/AheadOfTimeVerificationPhase.java Tue Apr 15 18:24:22 2014 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/AheadOfTimeVerificationPhase.java Wed Apr 16 16:49:10 2014 +0200 @@ -27,6 +27,7 @@ import com.oracle.graal.api.meta.*; import com.oracle.graal.hotspot.meta.*; import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.type.*; import com.oracle.graal.phases.*; import com.oracle.graal.phases.tiers.*; @@ -45,7 +46,7 @@ protected boolean verify(StructuredGraph graph, PhaseContext context) { for (ConstantNode node : getConstantNodes(graph)) { if (node.recordsUsages() || !node.gatherUsages(graph).isEmpty()) { - if (isObject(node) && !isNullReference(node) && !isInternedString(node)) { + if (isObject(node) && !isNullReference(node) && !isInternedString(node) && !isDirectMethodHandle(node)) { throw new VerificationError("illegal object constant: " + node); } } @@ -61,6 +62,13 @@ return isObject(node) && node.asConstant().isNull(); } + private static boolean isDirectMethodHandle(ConstantNode node) { + if (!isObject(node)) { + return false; + } + return "Ljava/lang/invoke/DirectMethodHandle;".equals(ObjectStamp.typeOrNull(node).getName()); + } + @SuppressFBWarnings(value = "ES_COMPARING_STRINGS_WITH_EQ", justification = "reference equality is what we want") private static boolean isInternedString(ConstantNode node) { if (!isObject(node)) {