changeset 17447:f861021b49b8

Restructure CodeCacheProvider hierarchy.
author Roland Schatz <roland.schatz@oracle.com>
date Wed, 15 Oct 2014 11:04:45 +0200
parents 9a804ec7f707
children a38357f170c0
files graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotBackendFactory.java graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotCodeCacheProvider.java graal/com.oracle.graal.hotspot.hsail/src/com/oracle/graal/hotspot/hsail/HSAILHotSpotCodeCacheProvider.java graal/com.oracle.graal.hotspot.ptx/src/com/oracle/graal/hotspot/ptx/PTXHotSpotCodeCacheProvider.java graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotBackendFactory.java graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotCodeCacheProvider.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotCodeCacheProvider.java
diffstat 7 files changed, 18 insertions(+), 99 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotBackendFactory.java	Wed Oct 15 01:10:27 2014 +0200
+++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotBackendFactory.java	Wed Oct 15 11:04:45 2014 +0200
@@ -102,6 +102,7 @@
 
         HotSpotProviders providers;
         HotSpotRegistersProvider registers;
+        RegisterConfig regConfig;
         HotSpotCodeCacheProvider codeCache;
         HotSpotConstantReflectionProvider constantReflection;
         HotSpotHostForeignCallsProvider foreignCalls;
@@ -120,8 +121,11 @@
             try (InitTimer rt = timer("create MetaAccess provider")) {
                 metaAccess = createMetaAccess(runtime);
             }
+            try (InitTimer rt = timer("create RegisterConfig")) {
+                regConfig = createRegisterConfig(runtime, target);
+            }
             try (InitTimer rt = timer("create CodeCache provider")) {
-                codeCache = createCodeCache(runtime, target);
+                codeCache = createCodeCache(runtime, target, regConfig);
             }
             try (InitTimer rt = timer("create ConstantReflection provider")) {
                 constantReflection = createConstantReflection(runtime);
@@ -186,8 +190,12 @@
         return new HotSpotConstantReflectionProvider(runtime);
     }
 
-    protected AMD64HotSpotCodeCacheProvider createCodeCache(HotSpotGraalRuntime runtime, TargetDescription target) {
-        return new AMD64HotSpotCodeCacheProvider(runtime, target);
+    protected RegisterConfig createRegisterConfig(HotSpotGraalRuntime runtime, TargetDescription target) {
+        return new AMD64HotSpotRegisterConfig(target.arch, runtime.getConfig());
+    }
+
+    protected HotSpotCodeCacheProvider createCodeCache(HotSpotGraalRuntime runtime, TargetDescription target, RegisterConfig regConfig) {
+        return new HotSpotCodeCacheProvider(runtime, target, regConfig);
     }
 
     protected HotSpotMetaAccessProvider createMetaAccess(HotSpotGraalRuntime runtime) {
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotCodeCacheProvider.java	Wed Oct 15 01:10:27 2014 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.hotspot.amd64;
-
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.hotspot.*;
-import com.oracle.graal.hotspot.meta.*;
-
-public class AMD64HotSpotCodeCacheProvider extends HotSpotCodeCacheProvider {
-
-    public AMD64HotSpotCodeCacheProvider(HotSpotGraalRuntime runtime, TargetDescription target) {
-        super(runtime, target);
-    }
-
-    @Override
-    protected RegisterConfig createRegisterConfig() {
-        return new AMD64HotSpotRegisterConfig(getTarget().arch, runtime.getConfig());
-    }
-}
--- a/graal/com.oracle.graal.hotspot.hsail/src/com/oracle/graal/hotspot/hsail/HSAILHotSpotCodeCacheProvider.java	Wed Oct 15 01:10:27 2014 +0200
+++ b/graal/com.oracle.graal.hotspot.hsail/src/com/oracle/graal/hotspot/hsail/HSAILHotSpotCodeCacheProvider.java	Wed Oct 15 11:04:45 2014 +0200
@@ -31,7 +31,7 @@
 public class HSAILHotSpotCodeCacheProvider extends HotSpotCodeCacheProvider {
 
     public HSAILHotSpotCodeCacheProvider(HotSpotGraalRuntime runtime, TargetDescription target) {
-        super(runtime, target);
+        super(runtime, target, new HSAILHotSpotRegisterConfig());
 
     }
 
@@ -40,9 +40,4 @@
         byte[] code = installedCode == null ? Arrays.copyOf(compResult.getTargetCode(), compResult.getTargetCodeSize()) : installedCode.getCode();
         return new String(code);
     }
-
-    @Override
-    protected RegisterConfig createRegisterConfig() {
-        return new HSAILHotSpotRegisterConfig();
-    }
 }
--- a/graal/com.oracle.graal.hotspot.ptx/src/com/oracle/graal/hotspot/ptx/PTXHotSpotCodeCacheProvider.java	Wed Oct 15 01:10:27 2014 +0200
+++ b/graal/com.oracle.graal.hotspot.ptx/src/com/oracle/graal/hotspot/ptx/PTXHotSpotCodeCacheProvider.java	Wed Oct 15 11:04:45 2014 +0200
@@ -31,7 +31,7 @@
 public class PTXHotSpotCodeCacheProvider extends HotSpotCodeCacheProvider {
 
     public PTXHotSpotCodeCacheProvider(HotSpotGraalRuntime runtime, TargetDescription target) {
-        super(runtime, target);
+        super(runtime, target, new PTXHotSpotRegisterConfig());
     }
 
     @Override
@@ -39,9 +39,4 @@
         byte[] code = installedCode == null ? Arrays.copyOf(compResult.getTargetCode(), compResult.getTargetCodeSize()) : installedCode.getCode();
         return new String(code);
     }
-
-    @Override
-    protected RegisterConfig createRegisterConfig() {
-        return new PTXHotSpotRegisterConfig();
-    }
 }
--- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotBackendFactory.java	Wed Oct 15 01:10:27 2014 +0200
+++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotBackendFactory.java	Wed Oct 15 11:04:45 2014 +0200
@@ -54,7 +54,8 @@
 
         HotSpotRegistersProvider registers = createRegisters();
         HotSpotMetaAccessProvider metaAccess = new HotSpotMetaAccessProvider(runtime);
-        HotSpotCodeCacheProvider codeCache = new SPARCHotSpotCodeCacheProvider(runtime, target);
+        RegisterConfig regConfig = new SPARCHotSpotRegisterConfig(target, runtime.getConfig());
+        HotSpotCodeCacheProvider codeCache = new HotSpotCodeCacheProvider(runtime, target, regConfig);
         HotSpotConstantReflectionProvider constantReflection = new HotSpotConstantReflectionProvider(runtime);
         Value[] nativeABICallerSaveRegisters = createNativeABICallerSaveRegisters(runtime.getConfig(), codeCache.getRegisterConfig());
         HotSpotForeignCallsProvider foreignCalls = new SPARCHotSpotForeignCallsProvider(runtime, metaAccess, codeCache, nativeABICallerSaveRegisters);
--- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotCodeCacheProvider.java	Wed Oct 15 01:10:27 2014 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.hotspot.sparc;
-
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.hotspot.*;
-import com.oracle.graal.hotspot.meta.*;
-
-public class SPARCHotSpotCodeCacheProvider extends HotSpotCodeCacheProvider {
-
-    public SPARCHotSpotCodeCacheProvider(HotSpotGraalRuntime runtime, TargetDescription target) {
-        super(runtime, target);
-    }
-
-    @Override
-    protected RegisterConfig createRegisterConfig() {
-        return new SPARCHotSpotRegisterConfig(getTarget(), runtime.getConfig());
-    }
-}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotCodeCacheProvider.java	Wed Oct 15 01:10:27 2014 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotCodeCacheProvider.java	Wed Oct 15 11:04:45 2014 +0200
@@ -48,20 +48,18 @@
 /**
  * HotSpot implementation of {@link CodeCacheProvider}.
  */
-public abstract class HotSpotCodeCacheProvider implements CodeCacheProvider {
+public class HotSpotCodeCacheProvider implements CodeCacheProvider {
 
     protected final HotSpotGraalRuntime runtime;
     protected final TargetDescription target;
     protected final RegisterConfig regConfig;
 
-    public HotSpotCodeCacheProvider(HotSpotGraalRuntime runtime, TargetDescription target) {
+    public HotSpotCodeCacheProvider(HotSpotGraalRuntime runtime, TargetDescription target, RegisterConfig regConfig) {
         this.runtime = runtime;
         this.target = target;
-        regConfig = createRegisterConfig();
+        this.regConfig = regConfig;
     }
 
-    protected abstract RegisterConfig createRegisterConfig();
-
     /**
      * Constants used to mark special positions in code being installed into the code cache by Graal
      * C++ code.