# HG changeset patch # User Roland Schatz # Date 1428060433 -7200 # Node ID 90b5605032bc508855b248cd40ba12de629fcf2b # Parent 81a34c9d6e17d2dd43ceece81b02cb93665c4060 Run input type verification only when assertions are enabled. diff -r 81a34c9d6e17 -r 90b5605032bc graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/DefaultGenericInvocationPlugin.java --- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/DefaultGenericInvocationPlugin.java Thu Apr 02 18:55:27 2015 +0200 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/DefaultGenericInvocationPlugin.java Fri Apr 03 13:27:13 2015 +0200 @@ -98,19 +98,19 @@ return false; } - private InputType getInputType(ObjectStamp stamp) { - ResolvedJavaType type = stamp.type(); + private InputType getInputType(ResolvedJavaType type) { if (type != null && structuralInputType.isAssignableFrom(type)) { - while (type != null) { + ResolvedJavaType current = type; + while (current != null) { MarkerType markerType = type.getAnnotation(MarkerType.class); if (markerType != null) { return markerType.value(); } - type = type.getSuperclass(); + current = current.getSuperclass(); } - throw GraalInternalError.shouldNotReachHere(String.format("%s extends StructuralInput, but is not annotated with @MarkerType", stamp.type())); + throw GraalInternalError.shouldNotReachHere(String.format("%s extends StructuralInput, but is not annotated with @MarkerType", type)); } else { return InputType.Value; } @@ -133,16 +133,17 @@ res = b.add(res); - InputType inputType = InputType.Value; + boolean nonValueType = false; if (returnKind == Kind.Object && stamp instanceof ObjectStamp) { - inputType = getInputType((ObjectStamp) stamp); + ResolvedJavaType type = ((ObjectStamp) stamp).type(); + if (type != null && structuralInputType.isAssignableFrom(type)) { + assert res.isAllowedUsageType(getInputType(type)); + nonValueType = true; + } } - if (inputType != InputType.Value) { - assert res.isAllowedUsageType(inputType); - b.push(Kind.Object, res); - } else if (returnKind != Kind.Void) { - assert res.getKind().getStackKind() != Kind.Void; + if (returnKind != Kind.Void) { + assert nonValueType || res.getKind().getStackKind() != Kind.Void; b.push(returnKind.getStackKind(), res); } else { assert res.getKind().getStackKind() == Kind.Void;