changeset 8660:d47b52b0ff68

fixed discrepancy between a method's name and its semantics
author Doug Simon <doug.simon@oracle.com>
date Fri, 05 Apr 2013 18:53:57 +0200
parents bc7bb895e359
children 31f1390766d9 b9a918201d47 1c11cbea6bf0
files graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/TypeCheckHints.java graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java
diffstat 2 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/TypeCheckHints.java	Fri Apr 05 17:51:55 2013 +0200
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/TypeCheckHints.java	Fri Apr 05 18:53:57 2013 +0200
@@ -63,7 +63,7 @@
      * @param maxHints the maximum length of {@link #types}
      */
     public TypeCheckHints(ResolvedJavaType type, JavaTypeProfile profile, Assumptions assumptions, double minHintHitProbability, int maxHints) {
-        if (type != null && canHaveSubtype(type)) {
+        if (type != null && !canHaveSubtype(type)) {
             types = new ResolvedJavaType[]{type};
             exact = true;
         } else {
@@ -113,9 +113,9 @@
      * Determines if a given type can have subtypes other than itself. This analysis is purely
      * static; no assumptions are made.
      * 
-     * @return true if {@code type} has no subtype(s)
+     * @return true if {@code type} can have subtypes
      */
     public static boolean canHaveSubtype(ResolvedJavaType type) {
-        return isFinal(getElementalType(type).getModifiers());
+        return !isFinal(getElementalType(type).getModifiers());
     }
 }
--- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java	Fri Apr 05 17:51:55 2013 +0200
+++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java	Fri Apr 05 18:53:57 2013 +0200
@@ -23,6 +23,7 @@
 package com.oracle.graal.java;
 
 import static com.oracle.graal.api.code.DeoptimizationAction.*;
+import static com.oracle.graal.api.code.TypeCheckHints.*;
 import static com.oracle.graal.api.meta.DeoptimizationReason.*;
 import static com.oracle.graal.bytecode.Bytecodes.*;
 import static java.lang.reflect.Modifier.*;
@@ -771,7 +772,7 @@
     }
 
     private JavaTypeProfile getProfileForTypeCheck(ResolvedJavaType type) {
-        if (!optimisticOpts.useTypeCheckHints() || TypeCheckHints.canHaveSubtype(type)) {
+        if (!optimisticOpts.useTypeCheckHints() || !canHaveSubtype(type)) {
             return null;
         } else {
             ResolvedJavaType uniqueSubtype = type.findUniqueConcreteSubtype();