changeset 5161:05fb99cbb605

Merge
author Gilles Duboscq <duboscq@ssw.jku.at>
date Wed, 28 Mar 2012 09:37:18 +0200
parents 6e385457d6fc 24c77ad284dc
children 3ac351ed7270
files
diffstat 6 files changed, 90 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalOptions.java	Mon Mar 26 15:47:49 2012 +0200
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalOptions.java	Wed Mar 28 09:37:18 2012 +0200
@@ -196,6 +196,11 @@
      */
     public static boolean AllocSSA                           = false;
 
+    /**
+     * Prints all the available GraalOptions.
+     */
+    public static boolean PrintFlags                           = false;
+
     static {
         // turn detailed assertions on when the general assertions are on (misusing the assert keyword for this)
         assert (DetailedAsserts = true) == true;
--- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/Debug.java	Mon Mar 26 15:47:49 2012 +0200
+++ b/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/Debug.java	Wed Mar 28 09:37:18 2012 +0200
@@ -55,18 +55,22 @@
         return ENABLED && DebugScope.getInstance().isLogEnabled();
     }
 
+    @SuppressWarnings("unused")
     public static Runnable decorateDebugRoot(Runnable runnable, String name, DebugConfig config) {
         return runnable;
     }
 
+    @SuppressWarnings("unused")
     public static <T> Callable<T> decorateDebugRoot(Callable<T> callable, String name, DebugConfig config) {
         return callable;
     }
 
+    @SuppressWarnings("unused")
     public static Runnable decorateScope(Runnable runnable, String name, Object... context) {
         return runnable;
     }
 
+    @SuppressWarnings("unused")
     public static <T> Callable<T> decorateScope(Callable<T> callable, String name, Object... context) {
         return callable;
     }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotOptions.java	Mon Mar 26 15:47:49 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotOptions.java	Wed Mar 28 09:37:18 2012 +0200
@@ -24,6 +24,7 @@
 package com.oracle.graal.hotspot;
 
 import java.lang.reflect.*;
+import java.util.*;
 
 import com.oracle.graal.compiler.*;
 import com.oracle.graal.hotspot.logging.*;
@@ -35,6 +36,7 @@
         GraalOptions.ResolveClassBeforeStaticInvoke = false;
     }
 
+    // Called from VM code
     public static boolean setOption(String option) {
         if (option.length() == 0) {
             return false;
@@ -62,28 +64,35 @@
         Field f;
         try {
             f = GraalOptions.class.getDeclaredField(fieldName);
+            Class< ? > fType = f.getType();
 
             if (value == null) {
-                if (f.getType() == Float.TYPE) {
+                if (fType == Boolean.TYPE) {
+                    Logger.info("Value for boolean option '" + fieldName + "' must use '-G:+" + fieldName + "' or '-G:-" + fieldName + "' format");
+                    return false;
+                }
+
+                if (valueString == null) {
+                    Logger.info("Value for option '" + fieldName + "' must use '-G:" + fieldName + "=<value>' format");
+                    return false;
+                }
+
+                if (fType == Float.TYPE) {
                     value = Float.parseFloat(valueString);
-                } else if (f.getType() == Double.TYPE) {
+                } else if (fType == Double.TYPE) {
                     value = Double.parseDouble(valueString);
-                } else if (f.getType() == Integer.TYPE) {
+                } else if (fType == Integer.TYPE) {
                     value = Integer.parseInt(valueString);
-                } else if (f.getType() == Boolean.TYPE) {
-                    if (valueString == null || valueString.length() == 0) {
-                        value = true;
-                    } else {
-                        value = Boolean.parseBoolean(valueString);
-                    }
-                } else if (f.getType() == String.class) {
-                    if (valueString == null) {
-                        value = "";
-                    } else {
-                        value = valueString;
-                    }
+                } else if (fType == String.class) {
+                    value = valueString;
+                }
+            } else {
+                if (fType != Boolean.TYPE) {
+                    Logger.info("Value for option '" + fieldName + "' must use '-G:" + fieldName + "=<value>' format");
+                    return false;
                 }
             }
+
             if (value != null) {
                 f.setAccessible(true);
                 f.set(null, value);
@@ -106,6 +115,31 @@
             return false;
         }
 
+        if (option.equals("+PrintFlags")) {
+            printFlags();
+        }
+
         return true;
     }
+
+    private static void printFlags() {
+        Logger.info("[Graal flags]");
+        Field[] flags = GraalOptions.class.getDeclaredFields();
+        Arrays.sort(flags, new Comparator<Field>() {
+            public int compare(Field o1, Field o2) {
+                return o1.getName().compareTo(o2.getName());
+            }
+        });
+        for (Field f : flags) {
+            if (Modifier.isPublic(f.getModifiers()) && Modifier.isStatic(f.getModifiers())) {
+                f.setAccessible(true);
+                try {
+                    Object value = f.get(null);
+                    Logger.info(String.format("%9s %-40s = %s", f.getType().getSimpleName(), f.getName(), value));
+                } catch (Exception e) {
+                }
+            }
+        }
+        System.exit(0);
+    }
 }
--- a/mx/eclipse-settings/org.eclipse.jdt.core.prefs	Mon Mar 26 15:47:49 2012 +0200
+++ b/mx/eclipse-settings/org.eclipse.jdt.core.prefs	Wed Mar 28 09:37:18 2012 +0200
@@ -1,4 +1,3 @@
-#Sun Dec 18 01:19:17 CET 2011
 eclipse.preferences.version=1
 org.eclipse.jdt.core.builder.cleanOutputFolder=clean
 org.eclipse.jdt.core.builder.duplicateResourceTask=warning
@@ -18,6 +17,11 @@
 org.eclipse.jdt.core.codeComplete.staticFieldSuffixes=
 org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes=
 org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes=
+org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
+org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
+org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
+org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
+org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
@@ -72,13 +76,17 @@
 org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
 org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
 org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
+org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
 org.eclipse.jdt.core.compiler.problem.nullReference=warning
+org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
+org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
 org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
 org.eclipse.jdt.core.compiler.problem.parameterAssignment=warning
 org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
 org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
 org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
 org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
+org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
 org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
 org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning
 org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
--- a/mxtool/mx.py	Mon Mar 26 15:47:49 2012 +0200
+++ b/mxtool/mx.py	Wed Mar 28 09:37:18 2012 +0200
@@ -124,7 +124,7 @@
 Property values can use environment variables with Bash syntax (e.g. ${HOME}).
 """
 
-import sys, os, errno, time, subprocess, shlex, types, urllib2, contextlib, StringIO, zipfile, signal
+import sys, os, errno, time, subprocess, shlex, types, urllib2, contextlib, StringIO, zipfile, signal, xml.sax.saxutils
 import shutil, fnmatch, re, xml.dom.minidom
 from collections import Callable
 from threading import Thread
@@ -1379,6 +1379,9 @@
     def println(out, obj):
         out.write(str(obj) + '\n')
 
+    source_locator_memento = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>\n<sourceLookupDirector><sourceContainers duplicates="false">'
+    entities = { '"':  "&quot;", "'":  "&apos;", '\n': '&#10;' }
+
     for p in projects():
         if p.native:
             continue
@@ -1492,7 +1495,6 @@
         update_file(join(p.dir, '.project'), out.getvalue())
         out.close()
 
-        out = StringIO.StringIO()
         settingsDir = join(p.dir, ".settings")
         if not exists(settingsDir):
             os.mkdir(settingsDir)
@@ -1506,6 +1508,24 @@
                         content = f.read()
                     content = content.replace('${javaCompliance}', str(p.javaCompliance))
                     update_file(join(settingsDir, name), content)
+                    
+        memento = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>\n<javaProject name="' + p.name + '"/>\n'
+        source_locator_memento += '\n<container memento="' + xml.sax.saxutils.escape(memento, entities) + '" typeId="org.eclipse.jdt.launching.sourceContainer.javaProject"/>'
+        
+    source_locator_memento += '</sourceContainers>\n</sourceLookupDirector>'
+    launch = r"""<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.jdt.launching.remoteJavaApplication">
+<stringAttribute key="org.eclipse.debug.core.source_locator_id" value="org.eclipse.jdt.launching.sourceLocator.JavaSourceLookupDirector"/>
+<stringAttribute key="org.eclipse.debug.core.source_locator_memento" value="{0}"/>
+<booleanAttribute key="org.eclipse.jdt.launching.ALLOW_TERMINATE" value="true"/>
+<mapAttribute key="org.eclipse.jdt.launching.CONNECT_MAP">
+<mapEntry key="hostname" value="localhost"/>
+<mapEntry key="port" value="8000"/>
+</mapAttribute>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value=""/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_CONNECTOR_ID" value="org.eclipse.jdt.launching.socketAttachConnector"/>
+</launchConfiguration>""".format(xml.sax.saxutils.escape(source_locator_memento, entities))
+    update_file(join(suite.dir, 'mx', 'attach-8000.launch'), launch)
 
 def netbeansinit(args, suite=None):
     """(re)generate NetBeans project configurations"""
--- a/src/share/vm/graal/graalCompiler.cpp	Mon Mar 26 15:47:49 2012 +0200
+++ b/src/share/vm/graal/graalCompiler.cpp	Wed Mar 28 09:37:18 2012 +0200
@@ -80,7 +80,7 @@
       Handle option = java_lang_String::create_from_str(arg, THREAD);
       jboolean result = VMToCompiler::setOption(option);
       if (!result) {
-        tty->print_cr("Invalid option for graal!");
+        tty->print_cr("Invalid option for graal: -G:%s", arg);
         vm_abort(false);
       }
     }