# HG changeset patch # User Thomas Wuerthinger # Date 1339189802 -7200 # Node ID e0f7a49129f2f37e3ffde4d531cfc62d3e7a94f2 # Parent c5c13f3ed5c4d016d4188a851a2e74abf80aae97 Renamed HotSpotCompilerImpl => HotSpotGraalRuntime. diff -r c5c13f3ed5c4 -r e0f7a49129f2 graal/com.oracle.graal.hotspot.server/src/com/oracle/graal/hotspot/server/CompilationServer.java --- a/graal/com.oracle.graal.hotspot.server/src/com/oracle/graal/hotspot/server/CompilationServer.java Fri Jun 08 22:50:39 2012 +0200 +++ b/graal/com.oracle.graal.hotspot.server/src/com/oracle/graal/hotspot/server/CompilationServer.java Fri Jun 08 23:10:02 2012 +0200 @@ -43,9 +43,9 @@ public interface ConnectionObserver { - void connectionStarted(HotSpotCompilerImpl compiler); + void connectionStarted(HotSpotGraalRuntime compiler); - void connectionFinished(HotSpotCompilerImpl compiler); + void connectionFinished(HotSpotGraalRuntime compiler); } private final boolean multiple; @@ -91,7 +91,7 @@ CompilerToVM toVM = (CompilerToVM) streams.getInvocation().waitForResult(false); // return the initialized compiler to the client - HotSpotCompilerImpl compiler = initializeServer(toVM); + HotSpotGraalRuntime compiler = initializeServer(toVM); compiler.getCompiler(); streams.getInvocation().sendResult(compiler); @@ -120,7 +120,7 @@ } @SuppressWarnings("unused") - private static HotSpotCompilerImpl initializeServer(CompilerToVM toVM) { + private static HotSpotGraalRuntime initializeServer(CompilerToVM toVM) { // TODO(thomaswue): Fix creation of compiler instances on server side. return null; } diff -r c5c13f3ed5c4 -r e0f7a49129f2 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java Fri Jun 08 22:50:39 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java Fri Jun 08 23:10:02 2012 +0200 @@ -47,18 +47,18 @@ private volatile boolean cancelled; - private final HotSpotCompilerImpl compiler; + private final HotSpotGraalRuntime compiler; private final PhasePlan plan; private final HotSpotMethodResolved method; private final OptimisticOptimizations optimisticOpts; private final int id; private final int priority; - public static CompilationTask create(HotSpotCompilerImpl compiler, PhasePlan plan, OptimisticOptimizations optimisticOpts, HotSpotMethodResolved method, int id, int priority) { + public static CompilationTask create(HotSpotGraalRuntime compiler, PhasePlan plan, OptimisticOptimizations optimisticOpts, HotSpotMethodResolved method, int id, int priority) { return new CompilationTask(compiler, plan, optimisticOpts, method, id, priority); } - private CompilationTask(HotSpotCompilerImpl compiler, PhasePlan plan, OptimisticOptimizations optimisticOpts, HotSpotMethodResolved method, int id, int priority) { + private CompilationTask(HotSpotGraalRuntime compiler, PhasePlan plan, OptimisticOptimizations optimisticOpts, HotSpotMethodResolved method, int id, int priority) { this.compiler = compiler; this.plan = plan; this.method = method; diff -r c5c13f3ed5c4 -r e0f7a49129f2 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilerThread.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilerThread.java Fri Jun 08 22:50:39 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilerThread.java Fri Jun 08 23:10:02 2012 +0200 @@ -58,7 +58,7 @@ public void run() { if (GraalOptions.Debug) { Debug.enable(); - PrintStream log = HotSpotCompilerImpl.getInstance().getVMToCompiler().log(); + PrintStream log = HotSpotGraalRuntime.getInstance().getVMToCompiler().log(); HotSpotDebugConfig hotspotDebugConfig = new HotSpotDebugConfig(GraalOptions.Log, GraalOptions.Meter, GraalOptions.Time, GraalOptions.Dump, GraalOptions.MethodFilter, log); Debug.setConfig(hotspotDebugConfig); } diff -r c5c13f3ed5c4 -r e0f7a49129f2 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotCompilerImpl.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotCompilerImpl.java Fri Jun 08 22:50:39 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,212 +0,0 @@ -/* - * 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; - -import java.lang.reflect.*; -import com.oracle.graal.api.*; -import com.oracle.graal.api.code.*; -import com.oracle.graal.api.meta.*; -import com.oracle.graal.compiler.*; -import com.oracle.graal.compiler.target.*; -import com.oracle.graal.cri.*; -import com.oracle.graal.hotspot.bridge.*; -import com.oracle.graal.hotspot.logging.*; -import com.oracle.graal.hotspot.ri.*; -import com.oracle.max.asm.target.amd64.*; -import com.oracle.max.cri.xir.*; - -/** - * Singleton class holding the instance of the GraalCompiler. - */ -public final class HotSpotCompilerImpl implements GraalRuntime { - - private static final HotSpotCompilerImpl instance = new HotSpotCompilerImpl(); - - public static HotSpotCompilerImpl getInstance() { - return instance; - } - - private final CompilerToVM compilerToVm; - private final VMToCompiler vmToCompiler; - - private HotSpotRuntime runtime; - private GraalCompiler compiler; - private CiTarget target; - private volatile HotSpotGraphCache cache; - - private final HotSpotVMConfig config; - - public HotSpotVMConfig getConfig() { - return config; - } - - private HotSpotCompilerImpl() { - - CompilerToVM toVM = new CompilerToVMImpl(); - - // initialize VmToCompiler - VMToCompiler toCompiler = new VMToCompilerImpl(this); - - // logging, etc. - if (CountingProxy.ENABLED) { - toCompiler = CountingProxy.getProxy(VMToCompiler.class, toCompiler); - toVM = CountingProxy.getProxy(CompilerToVM.class, toVM); - } - if (Logger.ENABLED) { - toCompiler = LoggingProxy.getProxy(VMToCompiler.class, toCompiler); - toVM = LoggingProxy.getProxy(CompilerToVM.class, toVM); - } - - // set the final fields - compilerToVm = toVM; - vmToCompiler = toCompiler; - config = compilerToVm.getConfiguration(); - config.check(); - - if (Boolean.valueOf(System.getProperty("graal.printconfig"))) { - printConfig(config); - } - } - - private static void printConfig(HotSpotVMConfig config) { - Field[] fields = config.getClass().getDeclaredFields(); - for (Field f : fields) { - f.setAccessible(true); - try { - Logger.info(String.format("%9s %-40s = %s", f.getType().getSimpleName(), f.getName(), Logger.pretty(f.get(config)))); - } catch (Exception e) { - } - } - } - - public CiTarget getTarget() { - if (target == null) { - final int wordSize = 8; - final int stackFrameAlignment = 16; - target = new CiTarget(new AMD64(), true, stackFrameAlignment, config.vmPageSize, wordSize, true, true, true); - } - - return target; - } - - public GraalCompiler getCompiler() { - if (compiler == null) { - // these options are important - graal will not generate correct code without them - GraalOptions.StackShadowPages = config.stackShadowPages; - - RiXirGenerator generator = new HotSpotXirGenerator(config, getTarget(), getRuntime().getGlobalStubRegisterConfig(), this); - if (Logger.ENABLED) { - generator = LoggingProxy.getProxy(RiXirGenerator.class, generator); - } - - Backend backend = Backend.create(runtime, target); - generator.initialize(backend.newXirAssembler()); - - compiler = new GraalCompiler(getRuntime(), getTarget(), backend, generator); - if (GraalOptions.CacheGraphs) { - cache = new HotSpotGraphCache(); - } - } - return compiler; - } - - public HotSpotGraphCache getCache() { - return cache; - } - - public CompilerToVM getCompilerToVM() { - return compilerToVm; - } - - public VMToCompiler getVMToCompiler() { - return vmToCompiler; - } - - public RiType lookupType(String returnType, HotSpotTypeResolved accessingClass, boolean eagerResolve) { - if (returnType.length() == 1 && vmToCompiler instanceof VMToCompilerImpl) { - VMToCompilerImpl exitsNative = (VMToCompilerImpl) vmToCompiler; - RiKind kind = RiKind.fromPrimitiveOrVoidTypeChar(returnType.charAt(0)); - switch(kind) { - case Boolean: - return exitsNative.typeBoolean; - case Byte: - return exitsNative.typeByte; - case Char: - return exitsNative.typeChar; - case Double: - return exitsNative.typeDouble; - case Float: - return exitsNative.typeFloat; - case Illegal: - break; - case Int: - return exitsNative.typeInt; - case Jsr: - break; - case Long: - return exitsNative.typeLong; - case Object: - break; - case Short: - return exitsNative.typeShort; - case Void: - return exitsNative.typeVoid; - } - } - return compilerToVm.RiSignature_lookupType(returnType, accessingClass, eagerResolve); - } - - public HotSpotRuntime getRuntime() { - if (runtime == null) { - runtime = new HotSpotRuntime(config, this); - } - return runtime; - } - - public void evictDeoptedGraphs() { - if (cache != null) { - long[] deoptedGraphs = getCompilerToVM().getDeoptedLeafGraphIds(); - if (deoptedGraphs != null) { - if (deoptedGraphs.length == 0) { - cache.clear(); - } else { - cache.removeGraphs(deoptedGraphs); - } - } - } - } - - @Override - public String getName() { - return "HotSpotGraalRuntime"; - } - - @SuppressWarnings("unchecked") - @Override - public T getCapability(Class clazz) { - if (clazz == ExtendedRiRuntime.class) { - return (T) getRuntime(); - } - return null; - } -} diff -r c5c13f3ed5c4 -r e0f7a49129f2 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java Fri Jun 08 23:10:02 2012 +0200 @@ -0,0 +1,212 @@ +/* + * 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; + +import java.lang.reflect.*; +import com.oracle.graal.api.*; +import com.oracle.graal.api.code.*; +import com.oracle.graal.api.meta.*; +import com.oracle.graal.compiler.*; +import com.oracle.graal.compiler.target.*; +import com.oracle.graal.cri.*; +import com.oracle.graal.hotspot.bridge.*; +import com.oracle.graal.hotspot.logging.*; +import com.oracle.graal.hotspot.ri.*; +import com.oracle.max.asm.target.amd64.*; +import com.oracle.max.cri.xir.*; + +/** + * Singleton class holding the instance of the GraalCompiler. + */ +public final class HotSpotGraalRuntime implements GraalRuntime { + + private static final HotSpotGraalRuntime instance = new HotSpotGraalRuntime(); + + public static HotSpotGraalRuntime getInstance() { + return instance; + } + + private final CompilerToVM compilerToVm; + private final VMToCompiler vmToCompiler; + + private HotSpotRuntime runtime; + private GraalCompiler compiler; + private CiTarget target; + private volatile HotSpotGraphCache cache; + + private final HotSpotVMConfig config; + + public HotSpotVMConfig getConfig() { + return config; + } + + private HotSpotGraalRuntime() { + + CompilerToVM toVM = new CompilerToVMImpl(); + + // initialize VmToCompiler + VMToCompiler toCompiler = new VMToCompilerImpl(this); + + // logging, etc. + if (CountingProxy.ENABLED) { + toCompiler = CountingProxy.getProxy(VMToCompiler.class, toCompiler); + toVM = CountingProxy.getProxy(CompilerToVM.class, toVM); + } + if (Logger.ENABLED) { + toCompiler = LoggingProxy.getProxy(VMToCompiler.class, toCompiler); + toVM = LoggingProxy.getProxy(CompilerToVM.class, toVM); + } + + // set the final fields + compilerToVm = toVM; + vmToCompiler = toCompiler; + config = compilerToVm.getConfiguration(); + config.check(); + + if (Boolean.valueOf(System.getProperty("graal.printconfig"))) { + printConfig(config); + } + } + + private static void printConfig(HotSpotVMConfig config) { + Field[] fields = config.getClass().getDeclaredFields(); + for (Field f : fields) { + f.setAccessible(true); + try { + Logger.info(String.format("%9s %-40s = %s", f.getType().getSimpleName(), f.getName(), Logger.pretty(f.get(config)))); + } catch (Exception e) { + } + } + } + + public CiTarget getTarget() { + if (target == null) { + final int wordSize = 8; + final int stackFrameAlignment = 16; + target = new CiTarget(new AMD64(), true, stackFrameAlignment, config.vmPageSize, wordSize, true, true, true); + } + + return target; + } + + public GraalCompiler getCompiler() { + if (compiler == null) { + // these options are important - graal will not generate correct code without them + GraalOptions.StackShadowPages = config.stackShadowPages; + + RiXirGenerator generator = new HotSpotXirGenerator(config, getTarget(), getRuntime().getGlobalStubRegisterConfig(), this); + if (Logger.ENABLED) { + generator = LoggingProxy.getProxy(RiXirGenerator.class, generator); + } + + Backend backend = Backend.create(runtime, target); + generator.initialize(backend.newXirAssembler()); + + compiler = new GraalCompiler(getRuntime(), getTarget(), backend, generator); + if (GraalOptions.CacheGraphs) { + cache = new HotSpotGraphCache(); + } + } + return compiler; + } + + public HotSpotGraphCache getCache() { + return cache; + } + + public CompilerToVM getCompilerToVM() { + return compilerToVm; + } + + public VMToCompiler getVMToCompiler() { + return vmToCompiler; + } + + public RiType lookupType(String returnType, HotSpotTypeResolved accessingClass, boolean eagerResolve) { + if (returnType.length() == 1 && vmToCompiler instanceof VMToCompilerImpl) { + VMToCompilerImpl exitsNative = (VMToCompilerImpl) vmToCompiler; + RiKind kind = RiKind.fromPrimitiveOrVoidTypeChar(returnType.charAt(0)); + switch(kind) { + case Boolean: + return exitsNative.typeBoolean; + case Byte: + return exitsNative.typeByte; + case Char: + return exitsNative.typeChar; + case Double: + return exitsNative.typeDouble; + case Float: + return exitsNative.typeFloat; + case Illegal: + break; + case Int: + return exitsNative.typeInt; + case Jsr: + break; + case Long: + return exitsNative.typeLong; + case Object: + break; + case Short: + return exitsNative.typeShort; + case Void: + return exitsNative.typeVoid; + } + } + return compilerToVm.RiSignature_lookupType(returnType, accessingClass, eagerResolve); + } + + public HotSpotRuntime getRuntime() { + if (runtime == null) { + runtime = new HotSpotRuntime(config, this); + } + return runtime; + } + + public void evictDeoptedGraphs() { + if (cache != null) { + long[] deoptedGraphs = getCompilerToVM().getDeoptedLeafGraphIds(); + if (deoptedGraphs != null) { + if (deoptedGraphs.length == 0) { + cache.clear(); + } else { + cache.removeGraphs(deoptedGraphs); + } + } + } + } + + @Override + public String getName() { + return "HotSpotGraalRuntime"; + } + + @SuppressWarnings("unchecked") + @Override + public T getCapability(Class clazz) { + if (clazz == ExtendedRiRuntime.class) { + return (T) getRuntime(); + } + return null; + } +} diff -r c5c13f3ed5c4 -r e0f7a49129f2 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java Fri Jun 08 22:50:39 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java Fri Jun 08 23:10:02 2012 +0200 @@ -49,7 +49,7 @@ */ public class VMToCompilerImpl implements VMToCompiler { - private final HotSpotCompilerImpl compiler; + private final HotSpotGraalRuntime compiler; private IntrinsifyArrayCopyPhase intrinsifyArrayCopy; public final HotSpotTypePrimitive typeBoolean; @@ -68,7 +68,7 @@ private PrintStream log = System.out; - public VMToCompilerImpl(HotSpotCompilerImpl compiler) { + public VMToCompilerImpl(HotSpotGraalRuntime compiler) { this.compiler = compiler; typeBoolean = new HotSpotTypePrimitive(RiKind.Boolean); diff -r c5c13f3ed5c4 -r e0f7a49129f2 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/counters/MethodEntryCounters.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/counters/MethodEntryCounters.java Fri Jun 08 22:50:39 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/counters/MethodEntryCounters.java Fri Jun 08 23:10:02 2012 +0200 @@ -142,7 +142,7 @@ } - public static void printCounters(HotSpotCompilerImpl compiler) { + public static void printCounters(HotSpotGraalRuntime compiler) { if (!GraalOptions.MethodEntryCounters) { return; } diff -r c5c13f3ed5c4 -r e0f7a49129f2 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/TailcallNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/TailcallNode.java Fri Jun 08 22:50:39 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/TailcallNode.java Fri Jun 08 23:10:02 2012 +0200 @@ -57,7 +57,7 @@ @Override public void generate(LIRGeneratorTool generator) { LIRGenerator gen = (LIRGenerator) generator; - HotSpotVMConfig config = HotSpotCompilerImpl.getInstance().getConfig(); + HotSpotVMConfig config = HotSpotGraalRuntime.getInstance().getConfig(); RiResolvedMethod method = frameState.method(); boolean isStatic = Modifier.isStatic(method.accessFlags()); diff -r c5c13f3ed5c4 -r e0f7a49129f2 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/WriteBarrier.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/WriteBarrier.java Fri Jun 08 22:50:39 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/WriteBarrier.java Fri Jun 08 23:10:02 2012 +0200 @@ -36,7 +36,7 @@ } protected void generateBarrier(RiValue adr, LIRGeneratorTool gen) { - HotSpotVMConfig config = HotSpotCompilerImpl.getInstance().getConfig(); + HotSpotVMConfig config = HotSpotGraalRuntime.getInstance().getConfig(); RiValue base = gen.emitUShr(adr, RiConstant.forInt(config.cardtableShift)); long startAddress = config.cardtableStartAddress; diff -r c5c13f3ed5c4 -r e0f7a49129f2 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotCompiledMethod.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotCompiledMethod.java Fri Jun 08 22:50:39 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotCompiledMethod.java Fri Jun 08 23:10:02 2012 +0200 @@ -66,7 +66,7 @@ assert method.signature().argumentKindAt(0) == RiKind.Object; assert method.signature().argumentKindAt(1) == RiKind.Object; assert !Modifier.isStatic(method.accessFlags()) || method.signature().argumentKindAt(2) == RiKind.Object; - return HotSpotCompilerImpl.getInstance().getCompilerToVM().executeCompiledMethod(this, arg1, arg2, arg3); + return HotSpotGraalRuntime.getInstance().getCompilerToVM().executeCompiledMethod(this, arg1, arg2, arg3); } private boolean checkArgs(Object... args) { @@ -86,6 +86,6 @@ @Override public Object executeVarargs(Object... args) { assert checkArgs(args); - return HotSpotCompilerImpl.getInstance().getCompilerToVM().executeCompiledMethodVarargs(this, args); + return HotSpotGraalRuntime.getInstance().getCompilerToVM().executeCompiledMethodVarargs(this, args); } } diff -r c5c13f3ed5c4 -r e0f7a49129f2 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotConstantPool.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotConstantPool.java Fri Jun 08 22:50:39 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotConstantPool.java Fri Jun 08 23:10:02 2012 +0200 @@ -40,7 +40,7 @@ @Override public Object lookupConstant(int cpi) { - Object constant = HotSpotCompilerImpl.getInstance().getCompilerToVM().RiConstantPool_lookupConstant(type, cpi); + Object constant = HotSpotGraalRuntime.getInstance().getCompilerToVM().RiConstantPool_lookupConstant(type, cpi); return constant; } @@ -51,21 +51,21 @@ @Override public RiMethod lookupMethod(int cpi, int byteCode) { - return HotSpotCompilerImpl.getInstance().getCompilerToVM().RiConstantPool_lookupMethod(type, cpi, (byte) byteCode); + return HotSpotGraalRuntime.getInstance().getCompilerToVM().RiConstantPool_lookupMethod(type, cpi, (byte) byteCode); } @Override public RiType lookupType(int cpi, int opcode) { - return HotSpotCompilerImpl.getInstance().getCompilerToVM().RiConstantPool_lookupType(type, cpi); + return HotSpotGraalRuntime.getInstance().getCompilerToVM().RiConstantPool_lookupType(type, cpi); } @Override public RiField lookupField(int cpi, int opcode) { - return HotSpotCompilerImpl.getInstance().getCompilerToVM().RiConstantPool_lookupField(type, cpi, (byte) opcode); + return HotSpotGraalRuntime.getInstance().getCompilerToVM().RiConstantPool_lookupField(type, cpi, (byte) opcode); } @Override public void loadReferencedType(int cpi, int bytecode) { - HotSpotCompilerImpl.getInstance().getCompilerToVM().RiConstantPool_loadReferencedType(type, cpi, (byte) bytecode); + HotSpotGraalRuntime.getInstance().getCompilerToVM().RiConstantPool_loadReferencedType(type, cpi, (byte) bytecode); } } diff -r c5c13f3ed5c4 -r e0f7a49129f2 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotMethodData.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotMethodData.java Fri Jun 08 22:50:39 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotMethodData.java Fri Jun 08 23:10:02 2012 +0200 @@ -37,7 +37,7 @@ private static final long serialVersionUID = -8873133496591225071L; static { - config = HotSpotCompilerImpl.getInstance().getConfig(); + config = HotSpotGraalRuntime.getInstance().getConfig(); } // TODO (chaeubl) use same logic as in NodeClass? @@ -77,7 +77,7 @@ } public int getDeoptimizationCount(RiDeoptReason reason) { - int reasonIndex = HotSpotCompilerImpl.getInstance().getRuntime().convertDeoptReason(reason); + int reasonIndex = HotSpotGraalRuntime.getInstance().getRuntime().convertDeoptReason(reason); return unsafe.getByte(hotspotMirror, (long) config.methodDataOopTrapHistoryOffset + reasonIndex) & 0xFF; } @@ -342,7 +342,7 @@ Object graalMirror = unsafe.getObject(receiverKlassOop, (long) config.graalMirrorKlassOffset); if (graalMirror == null) { Class javaClass = (Class) unsafe.getObject(receiverKlassOop, (long) config.classMirrorOffset); - graalMirror = HotSpotCompilerImpl.getInstance().getCompilerToVM().getType(javaClass); + graalMirror = HotSpotGraalRuntime.getInstance().getCompilerToVM().getType(javaClass); assert graalMirror != null : "must not return null"; } diff -r c5c13f3ed5c4 -r e0f7a49129f2 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotMethodResolvedImpl.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotMethodResolvedImpl.java Fri Jun 08 22:50:39 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotMethodResolvedImpl.java Fri Jun 08 23:10:02 2012 +0200 @@ -86,7 +86,7 @@ @Override public byte[] code() { if (code == null) { - code = HotSpotCompilerImpl.getInstance().getCompilerToVM().RiMethod_code(this); + code = HotSpotGraalRuntime.getInstance().getCompilerToVM().RiMethod_code(this); assert code.length == codeSize : "expected: " + codeSize + ", actual: " + code.length; } return code; @@ -99,13 +99,13 @@ @Override public RiExceptionHandler[] exceptionHandlers() { - return HotSpotCompilerImpl.getInstance().getCompilerToVM().RiMethod_exceptionHandlers(this); + return HotSpotGraalRuntime.getInstance().getCompilerToVM().RiMethod_exceptionHandlers(this); } @Override public boolean hasBalancedMonitors() { if (hasBalancedMonitors == null) { - hasBalancedMonitors = HotSpotCompilerImpl.getInstance().getCompilerToVM().RiMethod_hasBalancedMonitors(this); + hasBalancedMonitors = HotSpotGraalRuntime.getInstance().getCompilerToVM().RiMethod_hasBalancedMonitors(this); } return hasBalancedMonitors; } @@ -158,21 +158,21 @@ public StackTraceElement toStackTraceElement(int bci) { if (bci < 0 || bci >= codeSize) { // HotSpot code can only construct stack trace elements for valid bcis - StackTraceElement ste = HotSpotCompilerImpl.getInstance().getCompilerToVM().RiMethod_toStackTraceElement(this, 0); + StackTraceElement ste = HotSpotGraalRuntime.getInstance().getCompilerToVM().RiMethod_toStackTraceElement(this, 0); return new StackTraceElement(ste.getClassName(), ste.getMethodName(), ste.getFileName(), -1); } - return HotSpotCompilerImpl.getInstance().getCompilerToVM().RiMethod_toStackTraceElement(this, bci); + return HotSpotGraalRuntime.getInstance().getCompilerToVM().RiMethod_toStackTraceElement(this, bci); } @Override public RiResolvedMethod uniqueConcreteMethod() { - return (RiResolvedMethod) HotSpotCompilerImpl.getInstance().getCompilerToVM().RiMethod_uniqueConcreteMethod(this); + return (RiResolvedMethod) HotSpotGraalRuntime.getInstance().getCompilerToVM().RiMethod_uniqueConcreteMethod(this); } @Override public RiSignature signature() { if (signature == null) { - signature = new HotSpotSignature(HotSpotCompilerImpl.getInstance().getCompilerToVM().RiMethod_signature(this)); + signature = new HotSpotSignature(HotSpotGraalRuntime.getInstance().getCompilerToVM().RiMethod_signature(this)); } return signature; } @@ -183,11 +183,11 @@ } public boolean hasCompiledCode() { - return HotSpotCompilerImpl.getInstance().getCompilerToVM().RiMethod_hasCompiledCode(this); + return HotSpotGraalRuntime.getInstance().getCompilerToVM().RiMethod_hasCompiledCode(this); } public int compiledCodeSize() { - int result = HotSpotCompilerImpl.getInstance().getCompilerToVM().RiMethod_getCompiledCodeSize(this); + int result = HotSpotGraalRuntime.getInstance().getCompilerToVM().RiMethod_getCompiledCodeSize(this); if (result > 0) { assert result > MethodEntryCounters.getCodeSize(); result = result - MethodEntryCounters.getCodeSize(); @@ -207,7 +207,7 @@ @Override public int invocationCount() { - return HotSpotCompilerImpl.getInstance().getCompilerToVM().RiMethod_invocationCount(this); + return HotSpotGraalRuntime.getInstance().getCompilerToVM().RiMethod_invocationCount(this); } @Override @@ -243,7 +243,7 @@ File file = new File(GraalOptions.PICache, JniMangle.mangleMethod(holder, name, signature(), false)); if (file.exists()) { try { - SnapshotProfilingInfo snapshot = SnapshotProfilingInfo.load(file, HotSpotCompilerImpl.getInstance().getRuntime()); + SnapshotProfilingInfo snapshot = SnapshotProfilingInfo.load(file, HotSpotGraalRuntime.getInstance().getRuntime()); if (snapshot.codeSize() != codeSize) { // The class file was probably changed - ignore the saved profile return null; @@ -281,7 +281,7 @@ } if (GraalOptions.UseProfilingInformation && methodData == null) { - methodData = HotSpotCompilerImpl.getInstance().getCompilerToVM().RiMethod_methodData(this); + methodData = HotSpotGraalRuntime.getInstance().getCompilerToVM().RiMethod_methodData(this); } if (methodData == null || (!methodData.hasNormalData() && !methodData.hasExtraData())) { @@ -369,7 +369,7 @@ @Override public int vtableEntryOffset() { - return HotSpotCompilerImpl.getInstance().getCompilerToVM().RiMethod_vtableEntryOffset(this); + return HotSpotGraalRuntime.getInstance().getCompilerToVM().RiMethod_vtableEntryOffset(this); } @Override diff -r c5c13f3ed5c4 -r e0f7a49129f2 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotRuntime.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotRuntime.java Fri Jun 08 22:50:39 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotRuntime.java Fri Jun 08 23:10:02 2012 +0200 @@ -55,10 +55,10 @@ public final HotSpotVMConfig config; final HotSpotRegisterConfig regConfig; private final HotSpotRegisterConfig globalStubRegConfig; - private final HotSpotCompilerImpl compiler; + private final HotSpotGraalRuntime compiler; private CheckCastSnippets.Templates checkcasts; - public HotSpotRuntime(HotSpotVMConfig config, HotSpotCompilerImpl compiler) { + public HotSpotRuntime(HotSpotVMConfig config, HotSpotGraalRuntime compiler) { this.config = config; this.compiler = compiler; regConfig = new HotSpotRegisterConfig(config, false); @@ -76,7 +76,7 @@ } - public HotSpotCompilerImpl getCompiler() { + public HotSpotGraalRuntime getCompiler() { return compiler; } diff -r c5c13f3ed5c4 -r e0f7a49129f2 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotSignature.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotSignature.java Fri Jun 08 22:50:39 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotSignature.java Fri Jun 08 23:10:02 2012 +0200 @@ -117,7 +117,7 @@ } RiType type = argumentTypes[index]; if (type == null || !(type instanceof RiResolvedType)) { - type = HotSpotCompilerImpl.getInstance().lookupType(arguments.get(index), (HotSpotTypeResolved) accessingClass, true); + type = HotSpotGraalRuntime.getInstance().lookupType(arguments.get(index), (HotSpotTypeResolved) accessingClass, true); argumentTypes[index] = type; } return type; @@ -136,7 +136,7 @@ @Override public RiType returnType(RiType accessingClass) { if (returnTypeCache == null) { - returnTypeCache = HotSpotCompilerImpl.getInstance().lookupType(returnType, (HotSpotTypeResolved) accessingClass, false); + returnTypeCache = HotSpotGraalRuntime.getInstance().lookupType(returnType, (HotSpotTypeResolved) accessingClass, false); } return returnTypeCache; } diff -r c5c13f3ed5c4 -r e0f7a49129f2 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotTypePrimitive.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotTypePrimitive.java Fri Jun 08 22:50:39 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotTypePrimitive.java Fri Jun 08 23:10:02 2012 +0200 @@ -52,7 +52,7 @@ @Override public RiResolvedType arrayOf() { - return (RiResolvedType) HotSpotCompilerImpl.getInstance().getCompilerToVM().getPrimitiveArrayType(kind); + return (RiResolvedType) HotSpotGraalRuntime.getInstance().getCompilerToVM().getPrimitiveArrayType(kind); } @Override diff -r c5c13f3ed5c4 -r e0f7a49129f2 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotTypeResolvedImpl.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotTypeResolvedImpl.java Fri Jun 08 22:50:39 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotTypeResolvedImpl.java Fri Jun 08 23:10:02 2012 +0200 @@ -66,7 +66,7 @@ @Override public RiResolvedType arrayOf() { if (arrayOfType == null) { - arrayOfType = (RiResolvedType) HotSpotCompilerImpl.getInstance().getCompilerToVM().RiType_arrayOf(this); + arrayOfType = (RiResolvedType) HotSpotGraalRuntime.getInstance().getCompilerToVM().RiType_arrayOf(this); } return arrayOfType; } @@ -74,7 +74,7 @@ @Override public RiResolvedType componentType() { assert isArrayClass(); - return (RiResolvedType) HotSpotCompilerImpl.getInstance().getCompilerToVM().RiType_componentType(this); + return (RiResolvedType) HotSpotGraalRuntime.getInstance().getCompilerToVM().RiType_componentType(this); } @Override @@ -82,14 +82,14 @@ if (isArrayClass()) { return Modifier.isFinal(componentType().accessFlags()) ? this : null; } else { - return (RiResolvedType) HotSpotCompilerImpl.getInstance().getCompilerToVM().RiType_uniqueConcreteSubtype(this); + return (RiResolvedType) HotSpotGraalRuntime.getInstance().getCompilerToVM().RiType_uniqueConcreteSubtype(this); } } @Override public RiResolvedType superType() { if (!superTypeSet) { - superType = (RiResolvedType) HotSpotCompilerImpl.getInstance().getCompilerToVM().RiType_superType(this); + superType = (RiResolvedType) HotSpotGraalRuntime.getInstance().getCompilerToVM().RiType_superType(this); superTypeSet = true; } return superType; @@ -100,7 +100,7 @@ if (otherType instanceof HotSpotTypePrimitive) { return null; } else { - return (RiResolvedType) HotSpotCompilerImpl.getInstance().getCompilerToVM().RiType_leastCommonAncestor(this, (HotSpotTypeResolved) otherType); + return (RiResolvedType) HotSpotGraalRuntime.getInstance().getCompilerToVM().RiType_leastCommonAncestor(this, (HotSpotTypeResolved) otherType); } } @@ -154,7 +154,7 @@ @Override public boolean isInitialized() { if (!isInitialized) { - isInitialized = HotSpotCompilerImpl.getInstance().getCompilerToVM().RiType_isInitialized(this); + isInitialized = HotSpotGraalRuntime.getInstance().getCompilerToVM().RiType_isInitialized(this); } return isInitialized; } @@ -177,7 +177,7 @@ @Override public boolean isSubtypeOf(RiResolvedType other) { if (other instanceof HotSpotTypeResolved) { - return HotSpotCompilerImpl.getInstance().getCompilerToVM().RiType_isSubtypeOf(this, other); + return HotSpotGraalRuntime.getInstance().getCompilerToVM().RiType_isSubtypeOf(this, other); } // No resolved type is a subtype of an unresolved type. return false; @@ -191,7 +191,7 @@ @Override public RiResolvedMethod resolveMethodImpl(RiResolvedMethod method) { assert method instanceof HotSpotMethod; - return (RiResolvedMethod) HotSpotCompilerImpl.getInstance().getCompilerToVM().RiType_resolveMethodImpl(this, method.name(), method.signature().asString()); + return (RiResolvedMethod) HotSpotGraalRuntime.getInstance().getCompilerToVM().RiType_resolveMethodImpl(this, method.name(), method.signature().asString()); } @Override @@ -244,7 +244,7 @@ @Override public RiResolvedField[] declaredFields() { if (fields == null) { - fields = HotSpotCompilerImpl.getInstance().getCompilerToVM().RiType_fields(this); + fields = HotSpotGraalRuntime.getInstance().getCompilerToVM().RiType_fields(this); } return fields; } @@ -275,7 +275,7 @@ return klassOopCache; } - private static final int SECONDARY_SUPER_CACHE_OFFSET = HotSpotCompilerImpl.getInstance().getConfig().secondarySuperCacheOffset; + private static final int SECONDARY_SUPER_CACHE_OFFSET = HotSpotGraalRuntime.getInstance().getConfig().secondarySuperCacheOffset; public boolean isPrimaryType() { return SECONDARY_SUPER_CACHE_OFFSET != superCheckOffset; diff -r c5c13f3ed5c4 -r e0f7a49129f2 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotTypeUnresolved.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotTypeUnresolved.java Fri Jun 08 22:50:39 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotTypeUnresolved.java Fri Jun 08 23:10:02 2012 +0200 @@ -115,7 +115,7 @@ @Override public RiResolvedType resolve(RiResolvedType accessingClass) { - return (RiResolvedType) HotSpotCompilerImpl.getInstance().lookupType(name, (HotSpotTypeResolved) accessingClass, true); + return (RiResolvedType) HotSpotGraalRuntime.getInstance().lookupType(name, (HotSpotTypeResolved) accessingClass, true); } @Override diff -r c5c13f3ed5c4 -r e0f7a49129f2 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotXirGenerator.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotXirGenerator.java Fri Jun 08 22:50:39 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotXirGenerator.java Fri Jun 08 23:10:02 2012 +0200 @@ -75,12 +75,12 @@ private final HotSpotVMConfig config; private final CiTarget target; private final CiRegisterConfig registerConfig; - private final HotSpotCompilerImpl compiler; + private final HotSpotGraalRuntime compiler; private CiXirAssembler globalAsm; - public HotSpotXirGenerator(HotSpotVMConfig config, CiTarget target, CiRegisterConfig registerConfig, HotSpotCompilerImpl compiler) { + public HotSpotXirGenerator(HotSpotVMConfig config, CiTarget target, CiRegisterConfig registerConfig, HotSpotGraalRuntime compiler) { this.config = config; this.target = target; this.registerConfig = registerConfig; diff -r c5c13f3ed5c4 -r e0f7a49129f2 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/ArrayCopySnippets.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/ArrayCopySnippets.java Fri Jun 08 22:50:39 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/ArrayCopySnippets.java Fri Jun 08 23:10:02 2012 +0200 @@ -373,11 +373,11 @@ @Fold private static int cardTableShift() { - return HotSpotCompilerImpl.getInstance().getConfig().cardtableShift; + return HotSpotGraalRuntime.getInstance().getConfig().cardtableShift; } @Fold private static long cardTableStart() { - return HotSpotCompilerImpl.getInstance().getConfig().cardtableStartAddress; + return HotSpotGraalRuntime.getInstance().getConfig().cardtableStartAddress; } } diff -r c5c13f3ed5c4 -r e0f7a49129f2 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/CheckCastSnippets.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/CheckCastSnippets.java Fri Jun 08 22:50:39 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/CheckCastSnippets.java Fri Jun 08 23:10:02 2012 +0200 @@ -276,22 +276,22 @@ @Fold private static int superCheckOffsetOffset() { - return HotSpotCompilerImpl.getInstance().getConfig().superCheckOffsetOffset; + return HotSpotGraalRuntime.getInstance().getConfig().superCheckOffsetOffset; } @Fold private static int secondarySuperCacheOffset() { - return HotSpotCompilerImpl.getInstance().getConfig().secondarySuperCacheOffset; + return HotSpotGraalRuntime.getInstance().getConfig().secondarySuperCacheOffset; } @Fold private static int secondarySupersOffset() { - return HotSpotCompilerImpl.getInstance().getConfig().secondarySupersOffset; + return HotSpotGraalRuntime.getInstance().getConfig().secondarySupersOffset; } @Fold private static int hubOffset() { - return HotSpotCompilerImpl.getInstance().getConfig().hubOffset; + return HotSpotGraalRuntime.getInstance().getConfig().hubOffset; } public static void printCounter(PrintStream out, Counter c, long total) { diff -r c5c13f3ed5c4 -r e0f7a49129f2 src/share/vm/classfile/vmSymbols.hpp --- a/src/share/vm/classfile/vmSymbols.hpp Fri Jun 08 22:50:39 2012 +0200 +++ b/src/share/vm/classfile/vmSymbols.hpp Fri Jun 08 23:10:02 2012 +0200 @@ -282,7 +282,7 @@ template(com_oracle_graal_hotspot_HotSpotKlassOop, "com/oracle/graal/hotspot/ri/HotSpotKlassOop") \ template(com_oracle_graal_hotspot_HotSpotExceptionHandler, "com/oracle/graal/hotspot/ri/HotSpotExceptionHandler") \ template(com_oracle_graal_hotspot_HotSpotProxy, "com/oracle/graal/hotspot/HotSpotProxy") \ - template(com_oracle_graal_hotspot_CompilerImpl, "com/oracle/graal/hotspot/HotSpotCompilerImpl") \ + template(com_oracle_graal_hotspot_CompilerImpl, "com/oracle/graal/hotspot/HotSpotGraalRuntime") \ template(com_oracle_max_cri_ri_RiMethod, "com/oracle/graal/api/meta/RiMethod") \ template(com_oracle_max_cri_ri_RiResolvedField, "com/oracle/graal/api/meta/RiResolvedField") \ template(com_oracle_max_cri_ri_RiType, "com/oracle/graal/api/meta/RiType") \ @@ -348,7 +348,7 @@ template(getVMToCompiler_signature, "()Lcom/oracle/graal/hotspot/bridge/VMToCompiler;") \ template(getInstance_name, "getInstance") \ template(initialize_name, "initialize") \ - template(getInstance_signature, "()Lcom/oracle/graal/hotspot/HotSpotCompilerImpl;") \ + template(getInstance_signature, "()Lcom/oracle/graal/hotspot/HotSpotGraalRuntime;") \ template(forObject_name, "forObject") \ template(callbackInternal_name, "callbackInternal") \ template(callback_signature, "(Ljava/lang/Object;)Ljava/lang/Object;") \ diff -r c5c13f3ed5c4 -r e0f7a49129f2 src/share/vm/graal/graalVMToCompiler.cpp --- a/src/share/vm/graal/graalVMToCompiler.cpp Fri Jun 08 22:50:39 2012 +0200 +++ b/src/share/vm/graal/graalVMToCompiler.cpp Fri Jun 08 23:10:02 2012 +0200 @@ -41,7 +41,7 @@ Handle VMToCompiler::compilerInstance() { if (JNIHandles::resolve(_compilerPermObject) == NULL) { KlassHandle compilerImplKlass = SystemDictionary::resolve_or_null(vmSymbols::com_oracle_graal_hotspot_CompilerImpl(), SystemDictionary::java_system_loader(), NULL, Thread::current()); - check_not_null(compilerImplKlass(), "Couldn't find class com.sun.hotspot.graal.HotSpotCompilerImpl"); + check_not_null(compilerImplKlass(), "Couldn't find class com.sun.hotspot.graal.HotSpotGraalRuntime"); JavaValue result(T_OBJECT); JavaCalls::call_static(&result, compilerImplKlass, vmSymbols::getInstance_name(), vmSymbols::getInstance_signature(), Thread::current());