changeset 6404:4ee4f44b55c6

Create Backend instance directly instead of specifying the class name as a system property
author Christian Wimmer <christian.wimmer@oracle.com>
date Fri, 14 Sep 2012 14:03:43 -0700
parents 0c7e719c8bf8
children 6b56cf2bf7da
files graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/target/Backend.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java
diffstat 3 files changed, 1 insertions(+), 28 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/target/Backend.java	Fri Sep 14 13:58:17 2012 -0700
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/target/Backend.java	Fri Sep 14 14:03:43 2012 -0700
@@ -22,8 +22,6 @@
  */
 package com.oracle.graal.compiler.target;
 
-import java.lang.reflect.*;
-
 import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.*;
@@ -38,12 +36,6 @@
  */
 public abstract class Backend {
 
-    /**
-     * The name of the system property whose value (if non-null) specifies the fully qualified
-     * name of the class to be instantiated by {@link #create(CodeCacheProvider, TargetDescription)}.
-     */
-    public static final String BACKEND_CLASS_PROPERTY = "graal.compiler.backend.class";
-
     public final CodeCacheProvider runtime;
     public final TargetDescription target;
 
@@ -52,22 +44,6 @@
         this.target = target;
     }
 
-    /**
-     * Creates the architecture and runtime specific back-end object.
-     * The class of the object instantiated must be in the {@link #BACKEND_CLASS_PROPERTY} system property.
-     */
-    public static Backend create(CodeCacheProvider runtime, TargetDescription target) {
-        String className = System.getProperty(BACKEND_CLASS_PROPERTY);
-        assert className != null : "System property must be defined: " + BACKEND_CLASS_PROPERTY;
-        try {
-            Class<?> c = Class.forName(className);
-            Constructor<?> cons = c.getDeclaredConstructor(CodeCacheProvider.class, TargetDescription.class);
-            return (Backend) cons.newInstance(runtime, target);
-        } catch (Exception e) {
-            throw new Error("Could not instantiate " + className, e);
-        }
-    }
-
     public FrameMap newFrameMap(RegisterConfig registerConfig) {
         return new FrameMap(runtime, target, registerConfig);
     }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java	Fri Sep 14 13:58:17 2012 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java	Fri Sep 14 14:03:43 2012 -0700
@@ -123,7 +123,7 @@
                 generator = LoggingProxy.getProxy(XirGenerator.class, generator);
             }
 
-            Backend backend = Backend.create(runtime, target);
+            Backend backend = new HotSpotAMD64Backend(runtime, target);
             generator.initialize(backend.newXirAssembler());
 
             compiler = new GraalCompiler(getRuntime(), getTarget(), backend, generator);
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java	Fri Sep 14 13:58:17 2012 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java	Fri Sep 14 14:03:43 2012 -0700
@@ -36,7 +36,6 @@
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.api.meta.JavaType.Representation;
 import com.oracle.graal.compiler.*;
-import com.oracle.graal.compiler.target.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.hotspot.*;
 import com.oracle.graal.hotspot.nodes.*;
@@ -70,8 +69,6 @@
         this.graalRuntime = graalRuntime;
         regConfig = new HotSpotRegisterConfig(config, false);
         globalStubRegConfig = new HotSpotRegisterConfig(config, true);
-
-        System.setProperty(Backend.BACKEND_CLASS_PROPERTY, HotSpotAMD64Backend.class.getName());
     }
 
     public void installSnippets(SnippetInstaller installer) {