gcclass hints (YOU NEED TO UPDATE upstream/build/gcclass)
[nestedvm.git] / src / org / ibex / nestedvm / util / Platform.java
index ed59627..f7eea1e 100644 (file)
@@ -6,6 +6,13 @@ import java.util.*;
 
 import java.text.DateFormatSymbols;
 
+/*
+ GCCLASS_HINT: org.ibex.nestedvm.util.Platform.<clinit> org.ibex.nestedvm.util.Platform$Jdk11.<init>
+ GCCLASS_HINT: org.ibex.nestedvm.util.Platform.<clinit> org.ibex.nestedvm.util.Platform$Jdk12.<init>
+ GCCLASS_HINT: org.ibex.nestedvm.util.Platform.<clinit> org.ibex.nestedvm.util.Platform$Jdk13.<init>
+ GCCLASS_HINT: org.ibex.nestedvm.util.Platform.<clinit> org.ibex.nestedvm.util.Platform$Jdk14.<init>
+*/
+
 public abstract class Platform {
     Platform() { }
     private static final Platform p;
@@ -13,7 +20,10 @@ public abstract class Platform {
     static {
         float version;
         try {
-            version = Float.valueOf(System.getProperty("java.specification.version")).floatValue();
+            if(getProperty("java.vm.name").equals("SableVM"))
+                version = 1.2f;
+            else
+                version = Float.valueOf(getProperty("java.specification.version")).floatValue();
         } catch(Exception e) {
             System.err.println("WARNING: " + e + " while trying to find jvm version -  assuming 1.1");
             version = 1.1f;
@@ -33,6 +43,15 @@ public abstract class Platform {
         }
     }
     
+    public static String getProperty(String key) {
+        try {
+            return System.getProperty(key);
+        } catch(SecurityException e) {
+            return null;
+        }
+    }
+    
+    
     abstract boolean _atomicCreateFile(File f) throws IOException;
     public static boolean atomicCreateFile(File f) throws IOException { return p._atomicCreateFile(f); }
     
@@ -52,8 +71,6 @@ public abstract class Platform {
     abstract RandomAccessFile _truncatedRandomAccessFile(File f, String mode) throws IOException;
     public static RandomAccessFile truncatedRandomAccessFile(File f, String mode) throws IOException { return p._truncatedRandomAccessFile(f,mode); }
     
-    // FEATURE: Make sure GCClass can get rid of uncalled superclass methdos
-    
     static class Jdk11 extends Platform {
         boolean _atomicCreateFile(File f) throws IOException {
             // This is not atomic, but its the best we can do on jdk 1.1