# HG changeset patch # User Josef Eisl # Date 1407518499 -7200 # Node ID 1227fb471b6d4a22665adca95b16ea0077f0f83e # Parent 55c59139cc57c6095eed6faeeb80d67e3058075a Add ExcludeFromIdentityComparisonVerification annotation. diff -r 55c59139cc57 -r 1227fb471b6d graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ExcludeFromIdentityComparisonVerification.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ExcludeFromIdentityComparisonVerification.java Fri Aug 08 19:21:39 2014 +0200 @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.graal.api.meta; + +import java.lang.annotation.*; + +/** + * This annotation can be use to mark methods which are allowed to use identity checks (==/!=) on + * restricted types. + * + * @see CheckGraalInvariants + */ +@SuppressWarnings("javadoc") +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.METHOD) +public @interface ExcludeFromIdentityComparisonVerification { + +} diff -r 55c59139cc57 -r 1227fb471b6d graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Value.java --- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Value.java Fri Aug 08 18:12:04 2014 +0200 +++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Value.java Fri Aug 08 19:21:39 2014 +0200 @@ -103,6 +103,7 @@ * Warning: Use with caution! Usually equivalence {@link #equals(Object)} is sufficient and * should be used. */ + @ExcludeFromIdentityComparisonVerification public final boolean identityEquals(Value other) { return this == other; } diff -r 55c59139cc57 -r 1227fb471b6d graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/CheckGraalInvariants.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/CheckGraalInvariants.java Fri Aug 08 18:12:04 2014 +0200 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/CheckGraalInvariants.java Fri Aug 08 19:21:39 2014 +0200 @@ -118,6 +118,7 @@ // ignore } else { String methodName = className + "." + m.getName(); + boolean verifyEquals = !m.isAnnotationPresent(ExcludeFromIdentityComparisonVerification.class); if (matches(filters, methodName)) { executor.execute(() -> { StructuredGraph graph = new StructuredGraph(metaAccess.lookupJavaMethod(m)); @@ -125,7 +126,7 @@ graphBuilderSuite.apply(graph, context); // update phi stamps graph.getNodes().filter(PhiNode.class).forEach(PhiNode::inferStamp); - checkGraph(context, graph); + checkGraph(context, graph, verifyEquals); } catch (VerificationError e) { errors.add(e.getMessage()); } catch (LinkageError e) { @@ -170,13 +171,16 @@ /** * Checks the invariants for a single graph. */ - private static void checkGraph(HighTierContext context, StructuredGraph graph) { - new VerifyUsageWithEquals(Value.class).apply(graph, context); - new VerifyUsageWithEquals(Register.class).apply(graph, context); - new VerifyUsageWithEquals(JavaType.class).apply(graph, context); - new VerifyUsageWithEquals(JavaMethod.class).apply(graph, context); - new VerifyUsageWithEquals(JavaField.class).apply(graph, context); - new VerifyUsageWithEquals(LIRKind.class).apply(graph, context); + private static void checkGraph(HighTierContext context, StructuredGraph graph, boolean verifyEquals) { + if (verifyEquals) { + System.out.println("test"); + new VerifyUsageWithEquals(Value.class).apply(graph, context); + new VerifyUsageWithEquals(Register.class).apply(graph, context); + new VerifyUsageWithEquals(JavaType.class).apply(graph, context); + new VerifyUsageWithEquals(JavaMethod.class).apply(graph, context); + new VerifyUsageWithEquals(JavaField.class).apply(graph, context); + new VerifyUsageWithEquals(LIRKind.class).apply(graph, context); + } new VerifyDebugUsage().apply(graph, context); }