# HG changeset patch # User Roland Schatz # Date 1367319609 -7200 # Node ID aaf8798b096962560a2486c0069ada361593ed1b # Parent ed9b5a1bea52fef4406a3f10e484062b85f395b4 Load custom runtime implementations. diff -r ed9b5a1bea52 -r aaf8798b0969 graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotGraalRuntime.java --- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotGraalRuntime.java Tue Apr 30 12:58:12 2013 +0200 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotGraalRuntime.java Tue Apr 30 13:00:09 2013 +0200 @@ -40,7 +40,12 @@ */ public static HotSpotGraalRuntime makeInstance() { if (graalRuntime() == null) { - setInstance(new AMD64HotSpotGraalRuntime()); + HotSpotGraalRuntimeFactory factory = findFactory("AMD64"); + if (factory != null) { + setInstance(factory.createRuntime()); + } else { + setInstance(new AMD64HotSpotGraalRuntime()); + } } return graalRuntime(); } diff -r ed9b5a1bea52 -r aaf8798b0969 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java Tue Apr 30 12:58:12 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java Tue Apr 30 13:00:09 2013 +0200 @@ -84,6 +84,15 @@ runtime.compilerToVm = toVM; } + protected static HotSpotGraalRuntimeFactory findFactory(String architecture) { + for (HotSpotGraalRuntimeFactory factory : ServiceLoader.loadInstalled(HotSpotGraalRuntimeFactory.class)) { + if (factory.getArchitecture().equals(architecture) && factory.getName().equals(GraalOptions.GraalRuntime)) { + return factory; + } + } + return null; + } + private static Kind wordKind; /** diff -r ed9b5a1bea52 -r aaf8798b0969 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntimeFactory.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntimeFactory.java Tue Apr 30 13:00:09 2013 +0200 @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2011, 2012, 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; + +public interface HotSpotGraalRuntimeFactory { + + HotSpotGraalRuntime createRuntime(); + + String getArchitecture(); + + String getName(); +} diff -r ed9b5a1bea52 -r aaf8798b0969 graal/com.oracle.graal.phases/src/com/oracle/graal/phases/GraalOptions.java --- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/GraalOptions.java Tue Apr 30 12:58:12 2013 +0200 +++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/GraalOptions.java Tue Apr 30 13:00:09 2013 +0200 @@ -37,6 +37,7 @@ public static int Threads = 4; public static String CompilerConfiguration = "basic"; + public static String GraalRuntime = "basic"; // inlining settings public static boolean Inline = true;