changeset 13776:8305aec3a1ae

an empty architecture specification implies all architectures
author Doug Simon <doug.simon@oracle.com>
date Tue, 28 Jan 2014 12:19:30 +0100
parents 43c7df32d5ab
children b6cecbcfa503
files graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConfig.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConstant.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMField.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMFlag.java
diffstat 4 files changed, 27 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConfig.java	Tue Jan 28 12:18:38 2014 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConfig.java	Tue Jan 28 12:19:30 2014 +0100
@@ -39,12 +39,19 @@
 
     private static final long serialVersionUID = -4744897993263044184L;
 
-    private static boolean containsString(String[] array, String item) {
-        if (array == null) {
-            return false;
+    /**
+     * Determines if the current architecture is included in a given architecture set specification.
+     * 
+     * @param currentArch
+     * @param archsSpecification specifies a set of architectures. A zero length value implies all
+     *            architectures.
+     */
+    private static boolean isRequired(String currentArch, String[] archsSpecification) {
+        if (archsSpecification.length == 0) {
+            return true;
         }
-        for (String arch : array) {
-            if (arch.equals(item)) {
+        for (String arch : archsSpecification) {
+            if (arch.equals(currentArch)) {
                 return true;
             }
         }
@@ -90,7 +97,7 @@
                 String type = annotation.type();
                 VMFields.Field entry = vmFields.get(name);
                 if (entry == null) {
-                    if (annotation.optional() || !containsString(annotation.archs(), currentArch)) {
+                    if (annotation.optional() || !isRequired(currentArch, annotation.archs())) {
                         continue;
                     }
                     throw new IllegalArgumentException("field not found: " + name);
@@ -135,11 +142,10 @@
                 String name = annotation.name();
                 AbstractConstant entry = vmConstants.get(name);
                 if (entry == null) {
-                    if (!containsString(annotation.archs(), currentArch)) {
+                    if (!isRequired(currentArch, annotation.archs())) {
                         continue;
-                    } else {
-                        throw new IllegalArgumentException("constant not found: " + name);
                     }
+                    throw new IllegalArgumentException("constant not found: " + name);
                 }
                 setField(f, entry.getValue());
             } else if (f.isAnnotationPresent(HotSpotVMFlag.class)) {
@@ -147,11 +153,11 @@
                 String name = annotation.name();
                 Flags.Flag entry = flags.get(name);
                 if (entry == null) {
-                    if (annotation.optional() || !containsString(annotation.archs(), currentArch)) {
+                    if (!isRequired(currentArch, annotation.archs())) {
                         continue;
-                    } else {
-                        throw new IllegalArgumentException("flag not found: " + name);
                     }
+                    throw new IllegalArgumentException("flag not found: " + name);
+
                 }
                 setField(f, entry.getValue());
             }
@@ -712,6 +718,7 @@
     @HotSpotVMFlag(name = "PrintInlining") @Stable public boolean printInlining;
     @HotSpotVMFlag(name = "GraalUseFastLocking") @Stable public boolean useFastLocking;
     @HotSpotVMFlag(name = "ForceUnreachable") @Stable public boolean forceUnreachable;
+    @HotSpotVMFlag(name = "GPUOffload") @Stable public boolean gpuOffload;
 
     @HotSpotVMFlag(name = "UseTLAB") @Stable public boolean useTLAB;
     @HotSpotVMFlag(name = "UseBiasedLocking") @Stable public boolean useBiasedLocking;
@@ -832,8 +839,6 @@
     @HotSpotVMField(name = "JavaThread::_vm_result", type = "oop", get = HotSpotVMField.Type.OFFSET) @Stable public int threadObjectResultOffset;
     @HotSpotVMField(name = "JavaThread::_graal_counters[0]", type = "jlong", get = HotSpotVMField.Type.OFFSET, optional = true) @Stable public int graalCountersThreadOffset;
 
-    @HotSpotVMConstant(name = "GRAAL_COUNTERS_SIZE") @Stable public int graalCountersSize;
-
     /**
      * This field is used to pass exception objects into and out of the runtime system during
      * exception handling for compiled code.
@@ -1267,6 +1272,8 @@
     @Stable public long arithmeticTanAddress;
     @Stable public long loadAndClearExceptionAddress;
 
+    @Stable public int graalCountersSize;
+
     @HotSpotVMConstant(name = "Deoptimization::Reason_none") @Stable public int deoptReasonNone;
     @HotSpotVMConstant(name = "Deoptimization::Reason_null_check") @Stable public int deoptReasonNullCheck;
     @HotSpotVMConstant(name = "Deoptimization::Reason_range_check") @Stable public int deoptReasonRangeCheck;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConstant.java	Tue Jan 28 12:18:38 2014 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConstant.java	Tue Jan 28 12:19:30 2014 +0100
@@ -32,7 +32,8 @@
 
     /**
      * List of architectures where this constant is required. Names are derived from
-     * {@link HotSpotVMConfig#getHostArchitectureName()}.
+     * {@link HotSpotVMConfig#getHostArchitectureName()}. An empty list implies that the constant is
+     * required on all architectures.
      */
     String[] archs() default {};
 
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMField.java	Tue Jan 28 12:18:38 2014 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMField.java	Tue Jan 28 12:19:30 2014 +0100
@@ -40,7 +40,8 @@
 
     /**
      * List of architectures where this constant is required. Names are derived from
-     * {@link HotSpotVMConfig#getHostArchitectureName()}.
+     * {@link HotSpotVMConfig#getHostArchitectureName()}. An empty list implies that the constant is
+     * required on all architectures.
      */
     String[] archs() default {};
 
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMFlag.java	Tue Jan 28 12:18:38 2014 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMFlag.java	Tue Jan 28 12:19:30 2014 +0100
@@ -32,7 +32,8 @@
 
     /**
      * List of architectures where this constant is required. Names are derived from
-     * {@link HotSpotVMConfig#getHostArchitectureName()}.
+     * {@link HotSpotVMConfig#getHostArchitectureName()}. An empty list implies that the constant is
+     * required on all architectures.
      */
     String[] archs() default {};