# HG changeset patch # User Thomas Wuerthinger # Date 1339184917 -7200 # Node ID 9da759562a42d43ea07072d39f690d6c1a4f173b # Parent d487ae06265d1eb81515ef644085bb76b8df3bcb Remove compiler member field from HotSpot's implementation of the Ri* interfaces. diff -r d487ae06265d -r 9da759562a42 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilerObject.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilerObject.java Fri Jun 08 20:17:14 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilerObject.java Fri Jun 08 21:48:37 2012 +0200 @@ -32,10 +32,4 @@ */ public abstract class CompilerObject implements Serializable, FormatWithToString { private static final long serialVersionUID = -4551670987101214877L; - protected final HotSpotCompilerImpl compiler; - - protected CompilerObject(HotSpotCompilerImpl compiler) { - this.compiler = compiler; - } - } diff -r d487ae06265d -r 9da759562a42 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotTargetMethod.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotTargetMethod.java Fri Jun 08 20:17:14 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotTargetMethod.java Fri Jun 08 21:48:37 2012 +0200 @@ -42,8 +42,7 @@ public final Site[] sites; public final ExceptionHandler[] exceptionHandlers; - public HotSpotTargetMethod(HotSpotCompilerImpl compiler, HotSpotMethodResolved method, CiTargetMethod targetMethod) { - super(compiler); + public HotSpotTargetMethod(HotSpotMethodResolved method, CiTargetMethod targetMethod) { this.method = method; this.targetMethod = targetMethod; this.name = null; @@ -56,17 +55,6 @@ } } - private HotSpotTargetMethod(HotSpotCompilerImpl compiler, CiTargetMethod targetMethod, String name) { - super(compiler); - this.method = null; - this.targetMethod = targetMethod; - this.name = name; - - sites = getSortedSites(targetMethod); - assert targetMethod.exceptionHandlers == null || targetMethod.exceptionHandlers.size() == 0; - exceptionHandlers = null; - } - private static Site[] getSortedSites(CiTargetMethod target) { List[] lists = new List[] {target.safepoints, target.dataReferences, target.marks}; int count = 0; diff -r d487ae06265d -r 9da759562a42 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConfig.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConfig.java Fri Jun 08 20:17:14 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConfig.java Fri Jun 08 21:48:37 2012 +0200 @@ -32,7 +32,6 @@ private static final long serialVersionUID = -4744897993263044184L; private HotSpotVMConfig() { - super(null); } // os information, register layout, code generation, ... diff -r d487ae06265d -r 9da759562a42 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 20:17:14 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java Fri Jun 08 21:48:37 2012 +0200 @@ -71,15 +71,15 @@ public VMToCompilerImpl(HotSpotCompilerImpl compiler) { this.compiler = compiler; - typeBoolean = new HotSpotTypePrimitive(compiler, RiKind.Boolean); - typeChar = new HotSpotTypePrimitive(compiler, RiKind.Char); - typeFloat = new HotSpotTypePrimitive(compiler, RiKind.Float); - typeDouble = new HotSpotTypePrimitive(compiler, RiKind.Double); - typeByte = new HotSpotTypePrimitive(compiler, RiKind.Byte); - typeShort = new HotSpotTypePrimitive(compiler, RiKind.Short); - typeInt = new HotSpotTypePrimitive(compiler, RiKind.Int); - typeLong = new HotSpotTypePrimitive(compiler, RiKind.Long); - typeVoid = new HotSpotTypePrimitive(compiler, RiKind.Void); + typeBoolean = new HotSpotTypePrimitive(RiKind.Boolean); + typeChar = new HotSpotTypePrimitive(RiKind.Char); + typeFloat = new HotSpotTypePrimitive(RiKind.Float); + typeDouble = new HotSpotTypePrimitive(RiKind.Double); + typeByte = new HotSpotTypePrimitive(RiKind.Byte); + typeShort = new HotSpotTypePrimitive(RiKind.Short); + typeInt = new HotSpotTypePrimitive(RiKind.Int); + typeLong = new HotSpotTypePrimitive(RiKind.Long); + typeVoid = new HotSpotTypePrimitive(RiKind.Void); } public void startCompiler() throws Throwable { @@ -398,12 +398,12 @@ @Override public RiMethod createRiMethodUnresolved(String name, String signature, RiType holder) { - return new HotSpotMethodUnresolved(compiler, name, signature, holder); + return new HotSpotMethodUnresolved(name, signature, holder); } @Override public RiSignature createRiSignature(String signature) { - return new HotSpotSignature(compiler, signature); + return new HotSpotSignature(signature); } @Override @@ -448,7 +448,7 @@ @Override public RiType createRiTypeUnresolved(String name) { - return new HotSpotTypeUnresolved(compiler, name); + return new HotSpotTypeUnresolved(name); } @Override diff -r d487ae06265d -r 9da759562a42 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotCodeInfo.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotCodeInfo.java Fri Jun 08 20:17:14 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotCodeInfo.java Fri Jun 08 21:48:37 2012 +0200 @@ -38,8 +38,7 @@ public final CiTargetMethod targetMethod; private HotSpotMethodResolved method; - public HotSpotCodeInfo(HotSpotCompilerImpl compiler, CiTargetMethod targetMethod, HotSpotMethodResolved method) { - super(compiler); + public HotSpotCodeInfo(CiTargetMethod targetMethod, HotSpotMethodResolved method) { assert targetMethod != null; this.method = method; this.targetMethod = targetMethod; diff -r d487ae06265d -r 9da759562a42 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 20:17:14 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotCompiledMethod.java Fri Jun 08 21:48:37 2012 +0200 @@ -41,8 +41,7 @@ private final RiResolvedMethod method; private long nmethod; - public HotSpotCompiledMethod(HotSpotCompilerImpl compiler, RiResolvedMethod method) { - super(compiler); + public HotSpotCompiledMethod(RiResolvedMethod method) { this.method = method; } @@ -67,7 +66,7 @@ assert method.signature().argumentKindAt(0, false) == RiKind.Object; assert method.signature().argumentKindAt(1, false) == RiKind.Object; assert !Modifier.isStatic(method.accessFlags()) || method.signature().argumentKindAt(2, false) == RiKind.Object; - return compiler.getCompilerToVM().executeCompiledMethod(this, arg1, arg2, arg3); + return HotSpotCompilerImpl.getInstance().getCompilerToVM().executeCompiledMethod(this, arg1, arg2, arg3); } private boolean checkArgs(Object... args) { @@ -87,6 +86,6 @@ @Override public Object executeVarargs(Object... args) { assert checkArgs(args); - return compiler.getCompilerToVM().executeCompiledMethodVarargs(this, args); + return HotSpotCompilerImpl.getInstance().getCompilerToVM().executeCompiledMethodVarargs(this, args); } } diff -r d487ae06265d -r 9da759562a42 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 20:17:14 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotConstantPool.java Fri Jun 08 21:48:37 2012 +0200 @@ -34,14 +34,13 @@ private final HotSpotTypeResolvedImpl type; - public HotSpotConstantPool(HotSpotCompilerImpl compiler, HotSpotTypeResolvedImpl type) { - super(compiler); + public HotSpotConstantPool(HotSpotTypeResolvedImpl type) { this.type = type; } @Override public Object lookupConstant(int cpi) { - Object constant = compiler.getCompilerToVM().RiConstantPool_lookupConstant(type, cpi); + Object constant = HotSpotCompilerImpl.getInstance().getCompilerToVM().RiConstantPool_lookupConstant(type, cpi); return constant; } @@ -52,21 +51,21 @@ @Override public RiMethod lookupMethod(int cpi, int byteCode) { - return compiler.getCompilerToVM().RiConstantPool_lookupMethod(type, cpi, (byte) byteCode); + return HotSpotCompilerImpl.getInstance().getCompilerToVM().RiConstantPool_lookupMethod(type, cpi, (byte) byteCode); } @Override public RiType lookupType(int cpi, int opcode) { - return compiler.getCompilerToVM().RiConstantPool_lookupType(type, cpi); + return HotSpotCompilerImpl.getInstance().getCompilerToVM().RiConstantPool_lookupType(type, cpi); } @Override public RiField lookupField(int cpi, int opcode) { - return compiler.getCompilerToVM().RiConstantPool_lookupField(type, cpi, (byte) opcode); + return HotSpotCompilerImpl.getInstance().getCompilerToVM().RiConstantPool_lookupField(type, cpi, (byte) opcode); } @Override public void loadReferencedType(int cpi, int bytecode) { - compiler.getCompilerToVM().RiConstantPool_loadReferencedType(type, cpi, (byte) bytecode); + HotSpotCompilerImpl.getInstance().getCompilerToVM().RiConstantPool_loadReferencedType(type, cpi, (byte) bytecode); } } diff -r d487ae06265d -r 9da759562a42 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotExceptionHandler.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotExceptionHandler.java Fri Jun 08 20:17:14 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotExceptionHandler.java Fri Jun 08 21:48:37 2012 +0200 @@ -35,7 +35,6 @@ private RiType catchClass; private HotSpotExceptionHandler() { - super(null); } @Override diff -r d487ae06265d -r 9da759562a42 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotField.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotField.java Fri Jun 08 20:17:14 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotField.java Fri Jun 08 21:48:37 2012 +0200 @@ -45,8 +45,7 @@ private final int accessFlags; private RiConstant constant; // Constant part only valid for static fields. - public HotSpotField(HotSpotCompilerImpl compiler, RiResolvedType holder, String name, RiType type, int offset, int accessFlags) { - super(compiler); + public HotSpotField(RiResolvedType holder, String name, RiType type, int offset, int accessFlags) { this.holder = holder; this.name = name; this.type = type; diff -r d487ae06265d -r 9da759562a42 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotKlassOop.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotKlassOop.java Fri Jun 08 20:17:14 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotKlassOop.java Fri Jun 08 21:48:37 2012 +0200 @@ -39,8 +39,7 @@ */ public final Class javaMirror; - public HotSpotKlassOop(HotSpotCompilerImpl compiler, Class javaMirror) { - super(compiler); + public HotSpotKlassOop(Class javaMirror) { this.javaMirror = javaMirror; } diff -r d487ae06265d -r 9da759562a42 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotMethod.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotMethod.java Fri Jun 08 20:17:14 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotMethod.java Fri Jun 08 21:48:37 2012 +0200 @@ -30,10 +30,6 @@ private static final long serialVersionUID = 7167491397941960839L; protected String name; - protected HotSpotMethod(HotSpotCompilerImpl compiler) { - super(compiler); - } - @Override public final String name() { return name; diff -r d487ae06265d -r 9da759562a42 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 20:17:14 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotMethodData.java Fri Jun 08 21:48:37 2012 +0200 @@ -56,8 +56,7 @@ private int normalDataSize; private int extraDataSize; - private HotSpotMethodData(HotSpotCompilerImpl compiler) { - super(compiler); + private HotSpotMethodData() { throw new IllegalStateException("this constructor is never actually called, because the objects are allocated from within the VM"); } @@ -78,7 +77,7 @@ } public int getDeoptimizationCount(RiDeoptReason reason) { - int reasonIndex = compiler.getRuntime().convertDeoptReason(reason); + int reasonIndex = HotSpotCompilerImpl.getInstance().getRuntime().convertDeoptReason(reason); return unsafe.getByte(hotspotMirror, (long) config.methodDataOopTrapHistoryOffset + reasonIndex) & 0xFF; } diff -r d487ae06265d -r 9da759562a42 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 20:17:14 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotMethodResolvedImpl.java Fri Jun 08 21:48:37 2012 +0200 @@ -65,7 +65,6 @@ private CompilationTask currentTask; private HotSpotMethodResolvedImpl() { - super(null); throw new IllegalStateException("this constructor is never actually called, because the objects are allocated from within the VM"); } @@ -87,7 +86,7 @@ @Override public byte[] code() { if (code == null) { - code = compiler.getCompilerToVM().RiMethod_code(this); + code = HotSpotCompilerImpl.getInstance().getCompilerToVM().RiMethod_code(this); assert code.length == codeSize : "expected: " + codeSize + ", actual: " + code.length; } return code; @@ -100,13 +99,13 @@ @Override public RiExceptionHandler[] exceptionHandlers() { - return compiler.getCompilerToVM().RiMethod_exceptionHandlers(this); + return HotSpotCompilerImpl.getInstance().getCompilerToVM().RiMethod_exceptionHandlers(this); } @Override public boolean hasBalancedMonitors() { if (hasBalancedMonitors == null) { - hasBalancedMonitors = compiler.getCompilerToVM().RiMethod_hasBalancedMonitors(this); + hasBalancedMonitors = HotSpotCompilerImpl.getInstance().getCompilerToVM().RiMethod_hasBalancedMonitors(this); } return hasBalancedMonitors; } @@ -159,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 = compiler.getCompilerToVM().RiMethod_toStackTraceElement(this, 0); + StackTraceElement ste = HotSpotCompilerImpl.getInstance().getCompilerToVM().RiMethod_toStackTraceElement(this, 0); return new StackTraceElement(ste.getClassName(), ste.getMethodName(), ste.getFileName(), -1); } - return compiler.getCompilerToVM().RiMethod_toStackTraceElement(this, bci); + return HotSpotCompilerImpl.getInstance().getCompilerToVM().RiMethod_toStackTraceElement(this, bci); } @Override public RiResolvedMethod uniqueConcreteMethod() { - return (RiResolvedMethod) compiler.getCompilerToVM().RiMethod_uniqueConcreteMethod(this); + return (RiResolvedMethod) HotSpotCompilerImpl.getInstance().getCompilerToVM().RiMethod_uniqueConcreteMethod(this); } @Override public RiSignature signature() { if (signature == null) { - signature = new HotSpotSignature(compiler, compiler.getCompilerToVM().RiMethod_signature(this)); + signature = new HotSpotSignature(HotSpotCompilerImpl.getInstance().getCompilerToVM().RiMethod_signature(this)); } return signature; } @@ -184,11 +183,11 @@ } public boolean hasCompiledCode() { - return compiler.getCompilerToVM().RiMethod_hasCompiledCode(this); + return HotSpotCompilerImpl.getInstance().getCompilerToVM().RiMethod_hasCompiledCode(this); } public int compiledCodeSize() { - int result = compiler.getCompilerToVM().RiMethod_getCompiledCodeSize(this); + int result = HotSpotCompilerImpl.getInstance().getCompilerToVM().RiMethod_getCompiledCodeSize(this); if (result > 0) { assert result > MethodEntryCounters.getCodeSize(); result = result - MethodEntryCounters.getCodeSize(); @@ -208,7 +207,7 @@ @Override public int invocationCount() { - return compiler.getCompilerToVM().RiMethod_invocationCount(this); + return HotSpotCompilerImpl.getInstance().getCompilerToVM().RiMethod_invocationCount(this); } @Override @@ -244,7 +243,7 @@ File file = new File(GraalOptions.PICache, JniMangle.mangleMethod(holder, name, signature(), false)); if (file.exists()) { try { - SnapshotProfilingInfo snapshot = SnapshotProfilingInfo.load(file, compiler.getRuntime()); + SnapshotProfilingInfo snapshot = SnapshotProfilingInfo.load(file, HotSpotCompilerImpl.getInstance().getRuntime()); if (snapshot.codeSize() != codeSize) { // The class file was probably changed - ignore the saved profile return null; @@ -282,14 +281,14 @@ } if (GraalOptions.UseProfilingInformation && methodData == null) { - methodData = compiler.getCompilerToVM().RiMethod_methodData(this); + methodData = HotSpotCompilerImpl.getInstance().getCompilerToVM().RiMethod_methodData(this); } if (methodData == null || (!methodData.hasNormalData() && !methodData.hasExtraData())) { // Be optimistic and return false for exceptionSeen. A methodDataOop is allocated in case of a deoptimization. info = BaseProfilingInfo.get(RiExceptionSeen.FALSE); } else { - info = new HotSpotProfilingInfo(compiler, methodData, codeSize); + info = new HotSpotProfilingInfo(methodData, codeSize); saveProfilingInfo(info); } return info; @@ -370,7 +369,7 @@ @Override public int vtableEntryOffset() { - return compiler.getCompilerToVM().RiMethod_vtableEntryOffset(this); + return HotSpotCompilerImpl.getInstance().getCompilerToVM().RiMethod_vtableEntryOffset(this); } @Override diff -r d487ae06265d -r 9da759562a42 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotMethodUnresolved.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotMethodUnresolved.java Fri Jun 08 20:17:14 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotMethodUnresolved.java Fri Jun 08 21:48:37 2012 +0200 @@ -23,7 +23,6 @@ package com.oracle.graal.hotspot.ri; import com.oracle.graal.api.meta.*; -import com.oracle.graal.hotspot.*; /** * Implementation of RiMethod for unresolved HotSpot methods. @@ -33,11 +32,10 @@ private final RiSignature signature; protected RiType holder; - public HotSpotMethodUnresolved(HotSpotCompilerImpl compiler, String name, String signature, RiType holder) { - super(compiler); + public HotSpotMethodUnresolved(String name, String signature, RiType holder) { this.name = name; this.holder = holder; - this.signature = new HotSpotSignature(compiler, signature); + this.signature = new HotSpotSignature(signature); } @Override diff -r d487ae06265d -r 9da759562a42 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotProfilingInfo.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotProfilingInfo.java Fri Jun 08 20:17:14 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotProfilingInfo.java Fri Jun 08 21:48:37 2012 +0200 @@ -40,8 +40,7 @@ private HotSpotMethodData methodData; private final int codeSize; - public HotSpotProfilingInfo(HotSpotCompilerImpl compiler, HotSpotMethodData methodData, int codeSize) { - super(compiler); + public HotSpotProfilingInfo(HotSpotMethodData methodData, int codeSize) { this.methodData = methodData; this.codeSize = codeSize; hintPosition = 0; diff -r d487ae06265d -r 9da759562a42 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 20:17:14 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotRuntime.java Fri Jun 08 21:48:37 2012 +0200 @@ -465,10 +465,10 @@ return (RiResolvedMethod) compiler.getCompilerToVM().getRiMethod(reflectionMethod); } - private HotSpotCodeInfo makeInfo(RiResolvedMethod method, CiTargetMethod code, RiCodeInfo[] info) { + private static HotSpotCodeInfo makeInfo(RiResolvedMethod method, CiTargetMethod code, RiCodeInfo[] info) { HotSpotCodeInfo hsInfo = null; if (info != null && info.length > 0) { - hsInfo = new HotSpotCodeInfo(compiler, code, (HotSpotMethodResolved) method); + hsInfo = new HotSpotCodeInfo(code, (HotSpotMethodResolved) method); info[0] = hsInfo; } return hsInfo; @@ -476,13 +476,13 @@ public void installMethod(RiResolvedMethod method, CiTargetMethod code, RiCodeInfo[] info) { HotSpotCodeInfo hsInfo = makeInfo(method, code, info); - compiler.getCompilerToVM().installMethod(new HotSpotTargetMethod(compiler, (HotSpotMethodResolved) method, code), true, hsInfo); + compiler.getCompilerToVM().installMethod(new HotSpotTargetMethod((HotSpotMethodResolved) method, code), true, hsInfo); } @Override public RiCompiledMethod addMethod(RiResolvedMethod method, CiTargetMethod code, RiCodeInfo[] info) { HotSpotCodeInfo hsInfo = makeInfo(method, code, info); - return compiler.getCompilerToVM().installMethod(new HotSpotTargetMethod(compiler, (HotSpotMethodResolved) method, code), false, hsInfo); + return compiler.getCompilerToVM().installMethod(new HotSpotTargetMethod((HotSpotMethodResolved) method, code), false, hsInfo); } @Override diff -r d487ae06265d -r 9da759562a42 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 20:17:14 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotSignature.java Fri Jun 08 21:48:37 2012 +0200 @@ -40,8 +40,7 @@ private RiType[] argumentTypes; private RiType returnTypeCache; - public HotSpotSignature(HotSpotCompilerImpl compiler, String signature) { - super(compiler); + public HotSpotSignature(String signature) { assert signature.length() > 0; this.originalString = signature; @@ -118,7 +117,7 @@ } RiType type = argumentTypes[index]; if (type == null || !(type instanceof RiResolvedType)) { - type = compiler.lookupType(arguments.get(index), (HotSpotTypeResolved) accessingClass, true); + type = HotSpotCompilerImpl.getInstance().lookupType(arguments.get(index), (HotSpotTypeResolved) accessingClass, true); argumentTypes[index] = type; } return type; @@ -137,7 +136,7 @@ @Override public RiType returnType(RiType accessingClass) { if (returnTypeCache == null) { - returnTypeCache = compiler.lookupType(returnType, (HotSpotTypeResolved) accessingClass, false); + returnTypeCache = HotSpotCompilerImpl.getInstance().lookupType(returnType, (HotSpotTypeResolved) accessingClass, false); } return returnTypeCache; } diff -r d487ae06265d -r 9da759562a42 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotType.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotType.java Fri Jun 08 20:17:14 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotType.java Fri Jun 08 21:48:37 2012 +0200 @@ -32,10 +32,6 @@ private static final long serialVersionUID = -4252886265301910771L; protected String name; - protected HotSpotType(HotSpotCompilerImpl compiler) { - super(compiler); - } - @Override public final String name() { return name; diff -r d487ae06265d -r 9da759562a42 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 20:17:14 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotTypePrimitive.java Fri Jun 08 21:48:37 2012 +0200 @@ -38,11 +38,10 @@ private RiKind kind; private final HotSpotKlassOop klassOop; - public HotSpotTypePrimitive(HotSpotCompilerImpl compiler, RiKind kind) { - super(compiler); + public HotSpotTypePrimitive(RiKind kind) { this.kind = kind; this.name = String.valueOf(Character.toUpperCase(kind.typeChar)); - this.klassOop = new HotSpotKlassOop(compiler, kind.toJavaClass()); + this.klassOop = new HotSpotKlassOop(kind.toJavaClass()); } @Override @@ -53,7 +52,7 @@ @Override public RiResolvedType arrayOf() { - return (RiResolvedType) compiler.getCompilerToVM().getPrimitiveArrayType(kind); + return (RiResolvedType) HotSpotCompilerImpl.getInstance().getCompilerToVM().getPrimitiveArrayType(kind); } @Override diff -r d487ae06265d -r 9da759562a42 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 20:17:14 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotTypeResolvedImpl.java Fri Jun 08 21:48:37 2012 +0200 @@ -56,7 +56,6 @@ private RiResolvedType arrayOfType; private HotSpotTypeResolvedImpl() { - super(null); } @Override @@ -67,7 +66,7 @@ @Override public RiResolvedType arrayOf() { if (arrayOfType == null) { - arrayOfType = (RiResolvedType) compiler.getCompilerToVM().RiType_arrayOf(this); + arrayOfType = (RiResolvedType) HotSpotCompilerImpl.getInstance().getCompilerToVM().RiType_arrayOf(this); } return arrayOfType; } @@ -75,7 +74,7 @@ @Override public RiResolvedType componentType() { assert isArrayClass(); - return (RiResolvedType) compiler.getCompilerToVM().RiType_componentType(this); + return (RiResolvedType) HotSpotCompilerImpl.getInstance().getCompilerToVM().RiType_componentType(this); } @Override @@ -83,14 +82,14 @@ if (isArrayClass()) { return Modifier.isFinal(componentType().accessFlags()) ? this : null; } else { - return (RiResolvedType) compiler.getCompilerToVM().RiType_uniqueConcreteSubtype(this); + return (RiResolvedType) HotSpotCompilerImpl.getInstance().getCompilerToVM().RiType_uniqueConcreteSubtype(this); } } @Override public RiResolvedType superType() { if (!superTypeSet) { - superType = (RiResolvedType) compiler.getCompilerToVM().RiType_superType(this); + superType = (RiResolvedType) HotSpotCompilerImpl.getInstance().getCompilerToVM().RiType_superType(this); superTypeSet = true; } return superType; @@ -101,7 +100,7 @@ if (otherType instanceof HotSpotTypePrimitive) { return null; } else { - return (RiResolvedType) compiler.getCompilerToVM().RiType_leastCommonAncestor(this, (HotSpotTypeResolved) otherType); + return (RiResolvedType) HotSpotCompilerImpl.getInstance().getCompilerToVM().RiType_leastCommonAncestor(this, (HotSpotTypeResolved) otherType); } } @@ -155,7 +154,7 @@ @Override public boolean isInitialized() { if (!isInitialized) { - isInitialized = compiler.getCompilerToVM().RiType_isInitialized(this); + isInitialized = HotSpotCompilerImpl.getInstance().getCompilerToVM().RiType_isInitialized(this); } return isInitialized; } @@ -178,7 +177,7 @@ @Override public boolean isSubtypeOf(RiResolvedType other) { if (other instanceof HotSpotTypeResolved) { - return compiler.getCompilerToVM().RiType_isSubtypeOf(this, other); + return HotSpotCompilerImpl.getInstance().getCompilerToVM().RiType_isSubtypeOf(this, other); } // No resolved type is a subtype of an unresolved type. return false; @@ -192,7 +191,7 @@ @Override public RiResolvedMethod resolveMethodImpl(RiResolvedMethod method) { assert method instanceof HotSpotMethod; - return (RiResolvedMethod) compiler.getCompilerToVM().RiType_resolveMethodImpl(this, method.name(), method.signature().asString()); + return (RiResolvedMethod) HotSpotCompilerImpl.getInstance().getCompilerToVM().RiType_resolveMethodImpl(this, method.name(), method.signature().asString()); } @Override @@ -203,7 +202,7 @@ @Override public RiConstantPool constantPool() { if (constantPool == null) { - constantPool = new HotSpotConstantPool(compiler, this); + constantPool = new HotSpotConstantPool(this); } return constantPool; } @@ -227,7 +226,7 @@ } if (result == null) { - result = new HotSpotField(compiler, this, fieldName, type, offset, flags); + result = new HotSpotField(this, fieldName, type, offset, flags); fieldCache.put(id, result); } else { assert result.name().equals(fieldName); @@ -245,7 +244,7 @@ @Override public RiResolvedField[] declaredFields() { if (fields == null) { - fields = compiler.getCompilerToVM().RiType_fields(this); + fields = HotSpotCompilerImpl.getInstance().getCompilerToVM().RiType_fields(this); } return fields; } @@ -271,7 +270,7 @@ @Override public synchronized HotSpotKlassOop klassOop() { if (klassOopCache == null) { - klassOopCache = new HotSpotKlassOop(compiler, javaMirror); + klassOopCache = new HotSpotKlassOop(javaMirror); } return klassOopCache; } diff -r d487ae06265d -r 9da759562a42 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 20:17:14 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotTypeUnresolved.java Fri Jun 08 21:48:37 2012 +0200 @@ -38,8 +38,7 @@ /** * Creates a new unresolved type for a specified type descriptor. */ - public HotSpotTypeUnresolved(HotSpotCompilerImpl compiler, String name) { - super(compiler); + public HotSpotTypeUnresolved(String name) { assert name.length() > 0 : "name cannot be empty"; int dims = 0; @@ -62,8 +61,7 @@ this.dimensions = dims; } - public HotSpotTypeUnresolved(HotSpotCompilerImpl compiler, String name, int dimensions) { - super(compiler); + public HotSpotTypeUnresolved(String name, int dimensions) { assert dimensions >= 0; this.simpleName = name; this.dimensions = dimensions; @@ -82,12 +80,12 @@ @Override public RiType componentType() { assert dimensions > 0 : "no array class" + name(); - return new HotSpotTypeUnresolved(compiler, simpleName, dimensions - 1); + return new HotSpotTypeUnresolved(simpleName, dimensions - 1); } @Override public RiType arrayOf() { - return new HotSpotTypeUnresolved(compiler, simpleName, dimensions + 1); + return new HotSpotTypeUnresolved(simpleName, dimensions + 1); } @Override @@ -117,7 +115,7 @@ @Override public RiResolvedType resolve(RiResolvedType accessingClass) { - return (RiResolvedType) compiler.lookupType(name, (HotSpotTypeResolved) accessingClass, true); + return (RiResolvedType) HotSpotCompilerImpl.getInstance().lookupType(name, (HotSpotTypeResolved) accessingClass, true); } @Override diff -r d487ae06265d -r 9da759562a42 src/share/vm/graal/graalCompiler.cpp --- a/src/share/vm/graal/graalCompiler.cpp Fri Jun 08 20:17:14 2012 +0200 +++ b/src/share/vm/graal/graalCompiler.cpp Fri Jun 08 21:48:37 2012 +0200 @@ -260,8 +260,6 @@ Handle obj = instanceKlass::cast(HotSpotTypeResolved::klass())->allocate_instance(CHECK_NULL); assert(obj() != NULL, "must succeed in allocating instance"); - HotSpotTypeResolved::set_compiler(obj, VMToCompiler::compilerInstance()()); - if (klass->oop_is_instance()) { ResourceMark rm; instanceKlass* ik = (instanceKlass*)klass()->klass_part(); @@ -305,8 +303,7 @@ instanceKlass::cast(HotSpotMethodResolved::klass())->initialize(CHECK_NULL); Handle obj = instanceKlass::cast(HotSpotMethodResolved::klass())->allocate_instance(CHECK_NULL); assert(obj() != NULL, "must succeed in allocating instance"); - - HotSpotMethodResolved::set_compiler(obj, VMToCompiler::compilerInstance()()); + // (thomaswue) Cannot use reflection here, because the compiler thread could dead lock with the running application. // oop reflected = getReflectedMethod(method(), CHECK_NULL); HotSpotMethodResolved::set_javaMirror(obj, method()); @@ -337,7 +334,6 @@ Handle obj = instanceKlass::cast(HotSpotMethodData::klass())->allocate_instance(CHECK_NULL); assert(obj.not_null(), "must succeed in allocating instance"); - HotSpotMethodData::set_compiler(obj, VMToCompiler::compilerInstance()()); HotSpotMethodData::set_hotspotMirror(obj, method_data()); HotSpotMethodData::set_normalDataSize(obj, method_data()->data_size()); HotSpotMethodData::set_extraDataSize(obj, method_data()->extra_data_size()); diff -r d487ae06265d -r 9da759562a42 src/share/vm/graal/graalCompilerToVM.cpp --- a/src/share/vm/graal/graalCompilerToVM.cpp Fri Jun 08 20:17:14 2012 +0200 +++ b/src/share/vm/graal/graalCompilerToVM.cpp Fri Jun 08 21:48:37 2012 +0200 @@ -902,7 +902,6 @@ instanceKlass::cast(HotSpotCompiledMethod::klass())->initialize(CHECK_NULL); Handle obj = instanceKlass::cast(HotSpotCompiledMethod::klass())->allocate_permanent_instance(CHECK_NULL); assert(obj() != NULL, "must succeed in allocating instance"); - HotSpotCompiledMethod::set_compiler(obj, VMToCompiler::compilerInstance()()); HotSpotCompiledMethod::set_nmethod(obj, (jlong) nm); HotSpotCompiledMethod::set_method(obj, HotSpotTargetMethod::method(targetMethod)); nm->set_graal_compiled_method(obj()); diff -r d487ae06265d -r 9da759562a42 src/share/vm/graal/graalJavaAccess.hpp --- a/src/share/vm/graal/graalJavaAccess.hpp Fri Jun 08 20:17:14 2012 +0200 +++ b/src/share/vm/graal/graalJavaAccess.hpp Fri Jun 08 21:48:37 2012 +0200 @@ -46,7 +46,6 @@ #define COMPILER_CLASSES_DO(start_class, end_class, char_field, int_field, boolean_field, long_field, float_field, oop_field, static_oop_field) \ start_class(HotSpotTypeResolved) \ - oop_field(HotSpotTypeResolved, compiler, "Lcom/oracle/graal/hotspot/HotSpotCompilerImpl;") \ oop_field(HotSpotTypeResolved, javaMirror, "Ljava/lang/Class;") \ oop_field(HotSpotTypeResolved, simpleName, "Ljava/lang/String;") \ int_field(HotSpotTypeResolved, accessFlags) \ @@ -63,7 +62,6 @@ oop_field(HotSpotKlassOop, javaMirror, "Ljava/lang/Class;") \ end_class \ start_class(HotSpotMethodResolved) \ - oop_field(HotSpotMethodResolved, compiler, "Lcom/oracle/graal/hotspot/HotSpotCompilerImpl;") \ oop_field(HotSpotMethodResolved, name, "Ljava/lang/String;") \ oop_field(HotSpotMethodResolved, holder, "Lcom/oracle/graal/api/meta/RiResolvedType;") \ oop_field(HotSpotMethodResolved, javaMirror, "Ljava/lang/Object;") \ @@ -74,7 +72,6 @@ boolean_field(HotSpotMethodResolved, canBeInlined) \ end_class \ start_class(HotSpotMethodData) \ - oop_field(HotSpotMethodData, compiler, "Lcom/oracle/graal/hotspot/HotSpotCompilerImpl;") \ oop_field(HotSpotMethodData, hotspotMirror, "Ljava/lang/Object;") \ int_field(HotSpotMethodData, normalDataSize) \ int_field(HotSpotMethodData, extraDataSize) \ @@ -88,7 +85,6 @@ int_field(HotSpotField, accessFlags) \ end_class \ start_class(HotSpotCompiledMethod) \ - oop_field(HotSpotCompiledMethod, compiler, "Lcom/oracle/graal/hotspot/HotSpotCompilerImpl;") \ long_field(HotSpotCompiledMethod, nmethod) \ oop_field(HotSpotCompiledMethod, method, "Lcom/oracle/graal/api/meta/RiResolvedMethod;")\ end_class \