Mercurial > hg > graal-compiler
changeset 20160:90b5605032bc
Run input type verification only when assertions are enabled.
author | Roland Schatz <roland.schatz@oracle.com> |
---|---|
date | Fri, 03 Apr 2015 13:27:13 +0200 |
parents | 81a34c9d6e17 |
children | 6adad2a0a24d |
files | graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/DefaultGenericInvocationPlugin.java |
diffstat | 1 files changed, 13 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- 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;