changeset 19395:a306749d3e86

Lookup Tag based on index in enum value array.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Sun, 15 Feb 2015 23:13:11 +0100
parents e6d78307bdc9
children 7e2c87dae93e
files graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMethodDataAccessor.java
diffstat 1 files changed, 3 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMethodDataAccessor.java	Sun Feb 15 22:38:29 2015 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMethodDataAccessor.java	Sun Feb 15 23:13:11 2015 +0100
@@ -26,7 +26,6 @@
 
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.api.meta.ProfilingInfo.TriState;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.hotspot.*;
 
 /**
@@ -70,12 +69,9 @@
         }
 
         public static Tag getEnum(int value) {
-            for (Tag e : values()) {
-                if (e.value == value) {
-                    return e;
-                }
-            }
-            throw GraalInternalError.shouldNotReachHere("unknown enum value " + value);
+            Tag result = values()[value];
+            assert value == result.value;
+            return result;
         }
     }