Mercurial > hg > truffle
changeset 9662:eade47d311a3
Merge.
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Mon, 13 May 2013 14:17:35 +0200 |
parents | c6f3c1e48f54 (diff) 309181f26fc7 (current diff) |
children | 822adbb2ee7b 86fa3d9f9fdd |
files | graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java |
diffstat | 22 files changed, 449 insertions(+), 229 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.asm.test/src/com/oracle/graal/asm/test/AssemblerTest.java Mon May 13 13:15:42 2013 +0200 +++ b/graal/com.oracle.graal.asm.test/src/com/oracle/graal/asm/test/AssemblerTest.java Mon May 13 14:17:35 2013 +0200 @@ -59,7 +59,7 @@ DisassemblerProvider dis = Graal.getRuntime().getCapability(DisassemblerProvider.class); if (dis != null) { String disasm = dis.disassemble(code); - Assert.assertTrue(String.valueOf(code.getMethod()), disasm == null || disasm.length() > 0); + Assert.assertTrue(code.toString(), disasm == null || disasm.length() > 0); } return code; }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotCompilationResult.java Mon May 13 13:15:42 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotCompilationResult.java Mon May 13 14:17:35 2013 +0200 @@ -27,12 +27,15 @@ import java.util.*; import com.oracle.graal.api.code.*; -import com.oracle.graal.api.code.CompilationResult.*; +import com.oracle.graal.api.code.CompilationResult.Call; +import com.oracle.graal.api.code.CompilationResult.DataPatch; +import com.oracle.graal.api.code.CompilationResult.ExceptionHandler; +import com.oracle.graal.api.code.CompilationResult.Infopoint; +import com.oracle.graal.api.code.CompilationResult.Mark; +import com.oracle.graal.api.code.CompilationResult.Site; import com.oracle.graal.api.meta.*; -import com.oracle.graal.api.code.CompilationResult.ExceptionHandler; import com.oracle.graal.hotspot.meta.*; import com.oracle.graal.hotspot.stubs.*; -import com.oracle.graal.replacements.*; /** * Augments a {@link CompilationResult} with HotSpot-specific information. @@ -41,12 +44,15 @@ private static final long serialVersionUID = 7807321392203253218L; public final CompilationResult comp; - public final HotSpotResolvedJavaMethod method; // used only for methods - public final int entryBCI; // used only for methods /** - * Name of the RuntimeStub to be installed for this compilation result. If null, then the - * compilation result will be installed as an nmethod. + * Non-null for installation of an nmethod. + */ + public final HotSpotResolvedJavaMethod method; + public final int entryBCI; + + /** + * Non-null for installation of a RuntimeStub. */ public final String stubName; @@ -55,23 +61,49 @@ public HotSpotCompilationResult(HotSpotResolvedJavaMethod method, int entryBCI, CompilationResult comp) { this.method = method; + this.stubName = null; this.comp = comp; this.entryBCI = entryBCI; - if (graalRuntime().getRuntime().lookupJavaType(Stub.class).isAssignableFrom(method.getDeclaringClass()) && method.getAnnotation(Snippet.class) != null) { - this.stubName = MetaUtil.format("%h.%n", method); - } else { - this.stubName = null; - } - sites = getSortedSites(comp); - if (comp.getExceptionHandlers() == null) { + if (comp.getExceptionHandlers().isEmpty()) { exceptionHandlers = null; } else { exceptionHandlers = comp.getExceptionHandlers().toArray(new ExceptionHandler[comp.getExceptionHandlers().size()]); } } + public HotSpotCompilationResult(Stub stub, CompilationResult comp) { + assert checkStubInvariants(comp); + this.method = null; + this.stubName = stub.toString(); + this.comp = comp; + this.entryBCI = 0; + + sites = getSortedSites(comp); + assert comp.getExceptionHandlers().isEmpty(); + exceptionHandlers = null; + } + + /** + * Checks the conditions a compilation must satisfy to be installed as a RuntimeStub. + */ + private boolean checkStubInvariants(CompilationResult compResult) { + for (DataPatch data : compResult.getDataReferences()) { + Constant constant = data.constant; + assert constant.getKind() != Kind.Object : this + " cannot have embedded object constant: " + constant; + assert constant.getPrimitiveAnnotation() == null : this + " cannot have embedded metadata: " + constant; + } + for (Infopoint infopoint : compResult.getInfopoints()) { + assert infopoint instanceof Call : this + " cannot have non-call infopoint: " + infopoint; + Call call = (Call) infopoint; + assert call.target instanceof HotSpotRuntimeCallTarget : this + " cannot have non runtime call: " + call.target; + HotSpotRuntimeCallTarget callTarget = (HotSpotRuntimeCallTarget) call.target; + assert callTarget.getAddress() == graalRuntime().getConfig().uncommonTrapStub || callTarget.isCRuntimeCall() : this + "must only call C runtime or deoptimization stub, not " + call.target; + } + return true; + } + static class SiteComparator implements Comparator<Site> { public int compare(Site s1, Site s2) {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVM.java Mon May 13 13:15:42 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVM.java Mon May 13 14:17:35 2013 +0200 @@ -191,7 +191,7 @@ HotSpotResolvedJavaField getJavaField(Field reflectionField); - long getMaxCallTargetOffset(long stub); + long getMaxCallTargetOffset(long address); String disassembleCodeBlob(long codeBlob);
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVMImpl.java Mon May 13 13:15:42 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVMImpl.java Mon May 13 14:17:35 2013 +0200 @@ -127,7 +127,7 @@ public native int getCompiledCodeSize(long metaspaceMethod); @Override - public native long getMaxCallTargetOffset(long stub); + public native long getMaxCallTargetOffset(long address); @Override public native String disassembleCodeBlob(long codeBlob);
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotInstalledCode.java Mon May 13 13:15:42 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotInstalledCode.java Mon May 13 14:17:35 2013 +0200 @@ -30,6 +30,7 @@ import com.oracle.graal.api.meta.*; import com.oracle.graal.graph.*; import com.oracle.graal.hotspot.*; +import com.oracle.graal.hotspot.stubs.*; /** * Implementation of {@link InstalledCode} for HotSpot. If the code is installed as an nmethod (as @@ -46,18 +47,26 @@ private static final long serialVersionUID = 156632908220561612L; private final HotSpotResolvedJavaMethod method; + private final Stub stub; private final boolean isDefault; private final Graph graph; long codeBlob; long start; - boolean isNmethod; public HotSpotInstalledCode(HotSpotResolvedJavaMethod method, Graph graph, boolean isDefault) { this.method = method; + this.stub = null; this.graph = graph; this.isDefault = isDefault; } + public HotSpotInstalledCode(Stub stub) { + this.method = null; + this.stub = stub; + this.graph = null; + this.isDefault = false; + } + public boolean isDefault() { return isDefault; } @@ -77,24 +86,27 @@ @Override public boolean isValid() { - return !isNmethod || graalRuntime().getCompilerToVM().isInstalledCodeValid(codeBlob); + return stub != null || graalRuntime().getCompilerToVM().isInstalledCodeValid(codeBlob); } @Override public void invalidate() { - if (isNmethod) { + if (stub == null) { graalRuntime().getCompilerToVM().invalidateInstalledCode(codeBlob); } } @Override public String toString() { - return String.format("InstalledCode[method=%s, codeBlob=0x%x, isDefault=%b, isNmethod=%b]", method, codeBlob, isDefault, isNmethod); + if (stub != null) { + return String.format("InstalledCode[stub=%s, codeBlob=0x%x]", stub, codeBlob); + } + return String.format("InstalledCode[method=%s, codeBlob=0x%x, isDefault=%b]", method, codeBlob, isDefault); } @Override public Object execute(Object arg1, Object arg2, Object arg3) throws InvalidInstalledCodeException { - assert isNmethod; + assert stub == null; assert method.getSignature().getParameterCount(!Modifier.isStatic(method.getModifiers())) == 3; assert method.getSignature().getParameterKind(0) == Kind.Object; assert method.getSignature().getParameterKind(1) == Kind.Object; @@ -118,7 +130,7 @@ @Override public Object executeVarargs(Object... args) throws InvalidInstalledCodeException { - assert isNmethod; + assert stub == null; assert checkArgs(args); return graalRuntime().getCompilerToVM().executeCompiledMethodVarargs(args, codeBlob); }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java Mon May 13 13:15:42 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java Mon May 13 14:17:35 2013 +0200 @@ -30,7 +30,6 @@ import static com.oracle.graal.graph.UnsafeAccess.*; import static com.oracle.graal.hotspot.HotSpotBackend.*; import static com.oracle.graal.hotspot.HotSpotGraalRuntime.*; -import static com.oracle.graal.hotspot.nodes.IdentityHashCodeStubCall.*; import static com.oracle.graal.hotspot.nodes.MonitorEnterStubCall.*; import static com.oracle.graal.hotspot.nodes.MonitorExitStubCall.*; import static com.oracle.graal.hotspot.nodes.NewArrayStubCall.*; @@ -41,11 +40,11 @@ import static com.oracle.graal.hotspot.nodes.VerifyOopStubCall.*; import static com.oracle.graal.hotspot.nodes.WriteBarrierPostStubCall.*; import static com.oracle.graal.hotspot.nodes.WriteBarrierPreStubCall.*; +import static com.oracle.graal.hotspot.replacements.HotSpotReplacementsUtil.IDENTITY_HASHCODE; import static com.oracle.graal.hotspot.replacements.SystemSubstitutions.*; import static com.oracle.graal.hotspot.stubs.CreateNullPointerExceptionStub.*; import static com.oracle.graal.hotspot.stubs.CreateOutOfBoundsExceptionStub.*; import static com.oracle.graal.hotspot.stubs.ExceptionHandlerStub.*; -import static com.oracle.graal.hotspot.stubs.IdentityHashCodeStub.*; import static com.oracle.graal.hotspot.stubs.LogObjectStub.*; import static com.oracle.graal.hotspot.stubs.LogPrimitiveStub.*; import static com.oracle.graal.hotspot.stubs.LogPrintfStub.*; @@ -387,15 +386,6 @@ /* temps */ null, /* ret */ ret(Kind.Void)); - addStubCall(IDENTITY_HASHCODE, - /* ret */ ret(Kind.Int), - /* arg0: obj */ javaCallingConvention(Kind.Object)); - - addCRuntimeCall(IDENTITY_HASH_CODE_C, config.identityHashCodeAddress, - /* ret */ ret(Kind.Int), - /* arg0: thread */ nativeCallingConvention(word, - /* arg1: object */ Kind.Object)); - addStubCall(MONITORENTER, /* ret */ ret(Kind.Void), /* arg0: object */ javaCallingConvention(Kind.Object, @@ -582,7 +572,6 @@ link(new NewMultiArrayStub(this, replacements, graalRuntime.getTarget(), runtimeCalls.get(NEW_MULTI_ARRAY))); link(new RegisterFinalizerStub(this, replacements, graalRuntime.getTarget(), runtimeCalls.get(REGISTER_FINALIZER))); link(new ThreadIsInterruptedStub(this, replacements, graalRuntime.getTarget(), runtimeCalls.get(THREAD_IS_INTERRUPTED))); - link(new IdentityHashCodeStub(this, replacements, graalRuntime.getTarget(), runtimeCalls.get(IDENTITY_HASHCODE))); link(new ExceptionHandlerStub(this, replacements, graalRuntime.getTarget(), runtimeCalls.get(EXCEPTION_HANDLER))); link(new UnwindExceptionToCallerStub(this, replacements, graalRuntime.getTarget(), runtimeCalls.get(UNWIND_EXCEPTION_TO_CALLER))); link(new VerifyOopStub(this, replacements, graalRuntime.getTarget(), runtimeCalls.get(VERIFY_OOP))); @@ -597,12 +586,23 @@ link(new VMErrorStub(this, replacements, graalRuntime.getTarget(), runtimeCalls.get(VM_ERROR))); link(new WriteBarrierPreStub(this, replacements, graalRuntime.getTarget(), runtimeCalls.get(WRITE_BARRIER_PRE))); link(new WriteBarrierPostStub(this, replacements, graalRuntime.getTarget(), runtimeCalls.get(WRITE_BARRIER_POST))); + + CompilerToVM c2vm = graalRuntime.getCompilerToVM(); + link(new RuntimeCallStub(config.identityHashCodeAddress, IDENTITY_HASHCODE, true, this, replacements, globalStubRegConfig, c2vm)); } private static void link(Stub stub) { stub.getLinkage().setStub(stub); } + private void link(RuntimeCallStub stub) { + HotSpotRuntimeCallTarget linkage = stub.getLinkage(); + HotSpotRuntimeCallTarget targetLinkage = stub.getTargetLinkage(); + linkage.setStub(stub); + runtimeCalls.put(linkage.getDescriptor(), linkage); + runtimeCalls.put(targetLinkage.getDescriptor(), targetLinkage); + } + public HotSpotGraalRuntime getGraalRuntime() { return graalRuntime; }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotSignature.java Mon May 13 13:15:42 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotSignature.java Mon May 13 14:17:35 2013 +0200 @@ -37,10 +37,10 @@ public class HotSpotSignature extends CompilerObject implements Signature { private static final long serialVersionUID = -2890917956072366116L; - private final List<String> arguments = new ArrayList<>(); + private final List<String> parameters = new ArrayList<>(); private final String returnType; private final String originalString; - private JavaType[] argumentTypes; + private JavaType[] parameterTypes; private JavaType returnTypeCache; public HotSpotSignature(String signature) { @@ -51,7 +51,7 @@ int cur = 1; while (cur < signature.length() && signature.charAt(cur) != ')') { int nextCur = parseSignature(signature, cur); - arguments.add(signature.substring(cur, nextCur)); + parameters.add(signature.substring(cur, nextCur)); cur = nextCur; } @@ -64,6 +64,20 @@ } } + public HotSpotSignature(JavaType returnType, JavaType... parameterTypes) { + this.parameterTypes = parameterTypes.clone(); + this.returnTypeCache = returnType; + this.returnType = returnType.getName(); + StringBuilder sb = new StringBuilder("("); + for (JavaType type : parameterTypes) { + parameters.add(type.getName()); + sb.append(type.getName()); + } + sb.append(")").append(returnType.getName()); + this.originalString = sb.toString(); + assert new HotSpotSignature(originalString).equals(this); + } + private static int parseSignature(String signature, int start) { int cur = start; char first; @@ -96,12 +110,12 @@ @Override public int getParameterCount(boolean withReceiver) { - return arguments.size() + (withReceiver ? 1 : 0); + return parameters.size() + (withReceiver ? 1 : 0); } @Override public Kind getParameterKind(int index) { - return Kind.fromTypeString(arguments.get(index)); + return Kind.fromTypeString(parameters.get(index)); } @Override @@ -115,13 +129,13 @@ @Override public JavaType getParameterType(int index, ResolvedJavaType accessingClass) { - if (argumentTypes == null) { - argumentTypes = new JavaType[arguments.size()]; + if (parameterTypes == null) { + parameterTypes = new JavaType[parameters.size()]; } - JavaType type = argumentTypes[index]; + JavaType type = parameterTypes[index]; if (type == null || !(type instanceof ResolvedJavaType)) { - type = graalRuntime().lookupType(arguments.get(index), (HotSpotResolvedObjectType) accessingClass, false); - argumentTypes[index] = type; + type = graalRuntime().lookupType(parameters.get(index), (HotSpotResolvedObjectType) accessingClass, false); + parameterTypes[index] = type; } return type; } @@ -149,4 +163,21 @@ return "HotSpotSignature<" + originalString + ">"; } + @Override + public boolean equals(Object obj) { + if (obj instanceof HotSpotSignature) { + HotSpotSignature other = (HotSpotSignature) obj; + if (other.originalString.equals(originalString)) { + assert other.parameters.equals(parameters); + assert other.returnType.equals(returnType); + return true; + } + } + return false; + } + + @Override + public int hashCode() { + return originalString.hashCode(); + } }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/IdentityHashCodeStubCall.java Mon May 13 13:15:42 2013 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,59 +0,0 @@ -/* - * Copyright (c) 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.nodes; - -import com.oracle.graal.api.code.*; -import com.oracle.graal.api.code.RuntimeCallTarget.Descriptor; -import com.oracle.graal.api.meta.*; -import com.oracle.graal.compiler.gen.*; -import com.oracle.graal.compiler.target.*; -import com.oracle.graal.hotspot.stubs.*; -import com.oracle.graal.lir.*; -import com.oracle.graal.nodes.*; -import com.oracle.graal.nodes.type.*; - -/** - * Node implementing a call to {@link IdentityHashCodeStub}. - */ -public class IdentityHashCodeStubCall extends DeoptimizingStubCall implements LIRGenLowerable { - - @Input private final ValueNode object; - public static final Descriptor IDENTITY_HASHCODE = new Descriptor("identity_hashcode", false, int.class, Object.class); - - public IdentityHashCodeStubCall(ValueNode object) { - super(StampFactory.forKind(Kind.Int)); - this.object = object; - } - - @Override - public void generate(LIRGenerator gen) { - RuntimeCallTarget stub = gen.getRuntime().lookupRuntimeCall(IdentityHashCodeStubCall.IDENTITY_HASHCODE); - Variable result = gen.emitCall(stub, stub.getCallingConvention(), this, gen.operand(object)); - gen.setResult(this, result); - } - - @NodeIntrinsic - public static int call(Object object) { - return System.identityHashCode(object); - } -}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/HotSpotReplacementsUtil.java Mon May 13 13:15:42 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/HotSpotReplacementsUtil.java Mon May 13 14:17:35 2013 +0200 @@ -27,6 +27,7 @@ import sun.misc.*; import com.oracle.graal.api.code.*; +import com.oracle.graal.api.code.RuntimeCallTarget.Descriptor; import com.oracle.graal.api.meta.*; import com.oracle.graal.graph.Node.ConstantNodeParameter; import com.oracle.graal.graph.Node.NodeIntrinsic; @@ -668,7 +669,15 @@ } } - return IdentityHashCodeStubCall.call(x); + return identityHashCode(IDENTITY_HASHCODE, x); + } + + public static final Descriptor IDENTITY_HASHCODE = new Descriptor("identity_hashcode", false, int.class, Object.class); + + @SuppressWarnings("unused") + @NodeIntrinsic(RuntimeCallNode.class) + public static int identityHashCode(@ConstantNodeParameter Descriptor descriptor, Object object) { + return System.identityHashCode(object); } @Fold
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/IdentityHashCodeStub.java Mon May 13 13:15:42 2013 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,58 +0,0 @@ -/* - * Copyright (c) 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.stubs; - -import static com.oracle.graal.hotspot.replacements.HotSpotReplacementsUtil.*; - -import com.oracle.graal.api.code.RuntimeCallTarget.Descriptor; -import com.oracle.graal.api.code.*; -import com.oracle.graal.graph.Node.ConstantNodeParameter; -import com.oracle.graal.graph.Node.NodeIntrinsic; -import com.oracle.graal.hotspot.*; -import com.oracle.graal.hotspot.meta.*; -import com.oracle.graal.hotspot.nodes.*; -import com.oracle.graal.nodes.spi.*; -import com.oracle.graal.replacements.*; -import com.oracle.graal.word.*; - -/** - * Stub called from {@link IdentityHashCodeStubCall}. - */ -public class IdentityHashCodeStub extends CRuntimeStub { - - public IdentityHashCodeStub(final HotSpotRuntime runtime, Replacements replacements, TargetDescription target, HotSpotRuntimeCallTarget linkage) { - super(runtime, replacements, target, linkage); - } - - @Snippet - private static int identityHashCode(Object object) { - int result = identityHashCodeC(IDENTITY_HASH_CODE_C, thread(), object); - StubUtil.handlePendingException(false); - return result; - } - - public static final Descriptor IDENTITY_HASH_CODE_C = StubUtil.descriptorFor(IdentityHashCodeStub.class, "identityHashCodeC", false); - - @NodeIntrinsic(CRuntimeCall.class) - public static native int identityHashCodeC(@ConstantNodeParameter Descriptor identityHashCodeC, Word thread, Object object); -}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/RuntimeCallStub.java Mon May 13 14:17:35 2013 +0200 @@ -0,0 +1,244 @@ +/* + * Copyright (c) 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.stubs; + +import static com.oracle.graal.api.meta.MetaUtil.*; +import static com.oracle.graal.hotspot.HotSpotGraalRuntime.*; + +import java.util.*; + +import com.oracle.graal.api.code.*; +import com.oracle.graal.api.code.CallingConvention.Type; +import com.oracle.graal.api.code.RuntimeCallTarget.Descriptor; +import com.oracle.graal.api.meta.*; +import com.oracle.graal.debug.*; +import com.oracle.graal.graph.*; +import com.oracle.graal.hotspot.*; +import com.oracle.graal.hotspot.bridge.*; +import com.oracle.graal.hotspot.meta.*; +import com.oracle.graal.hotspot.nodes.*; +import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.java.*; +import com.oracle.graal.nodes.java.MethodCallTargetNode.InvokeKind; +import com.oracle.graal.nodes.spi.*; +import com.oracle.graal.nodes.type.*; +import com.oracle.graal.phases.common.*; +import com.oracle.graal.replacements.*; +import com.oracle.graal.replacements.nodes.*; +import com.oracle.graal.word.*; +import com.oracle.graal.word.phases.*; + +/** + * Base class for a stub that calls into a HotSpot C/C++ runtime function using the native + * {@link CallingConvention}. + */ +public class RuntimeCallStub extends Stub { + + /** + * The target of the call. + */ + private final HotSpotRuntimeCallTarget target; + + /** + * Specifies if the JavaThread value for the current thread is to be prepended to the arguments + * for the call to {@link #target}. + */ + protected final boolean prependThread; + + /** + * Creates a stub for a call to code at a given address. + * + * @param address the address of the code to call + * @param sig the signature of the call to this stub + * @param prependThread true if the JavaThread value for the current thread is to be prepended + * to the arguments for the call to {@code address} + * @param regConfig used to get the calling convention for the call to this stub from Graal + * compiled Java code as well as the calling convention for the call to + * {@code address} + * @param vm the Java to HotSpot C/C++ runtime interface + */ + public RuntimeCallStub(long address, Descriptor sig, boolean prependThread, HotSpotRuntime runtime, Replacements replacements, RegisterConfig regConfig, CompilerToVM vm) { + super(runtime, replacements, new HotSpotRuntimeCallTarget(sig, 0L, false, createCallingConvention(runtime, regConfig, sig), vm)); + this.prependThread = prependThread; + Class[] targetParameterTypes = createTargetParameters(sig); + Descriptor targetSig = new Descriptor(sig.getName() + ":C", sig.hasSideEffect(), sig.getResultType(), targetParameterTypes); + CallingConvention targetCc = createCallingConvention(runtime, regConfig, targetSig); + target = new HotSpotRuntimeCallTarget(targetSig, address, true, targetCc, vm); + } + + /** + * Gets the linkage information for the runtime call. + */ + public HotSpotRuntimeCallTarget getTargetLinkage() { + return target; + } + + private static CallingConvention createCallingConvention(HotSpotRuntime runtime, RegisterConfig regConfig, Descriptor d) { + Class<?>[] argumentTypes = d.getArgumentTypes(); + JavaType[] parameterTypes = new JavaType[argumentTypes.length]; + for (int i = 0; i < parameterTypes.length; ++i) { + parameterTypes[i] = runtime.lookupJavaType(argumentTypes[i]); + } + TargetDescription target = graalRuntime().getTarget(); + JavaType returnType = runtime.lookupJavaType(d.getResultType()); + return regConfig.getCallingConvention(Type.NativeCall, returnType, parameterTypes, target, false); + } + + private Class[] createTargetParameters(Descriptor sig) { + Class[] parameters = sig.getArgumentTypes(); + if (prependThread) { + Class[] newParameters = new Class[parameters.length + 1]; + System.arraycopy(parameters, 0, newParameters, 1, parameters.length); + newParameters[0] = Word.class; + return newParameters; + } + return parameters; + } + + @Override + protected ResolvedJavaMethod getInstalledCodeOwner() { + return null; + } + + @Override + protected Object debugScopeContext() { + return new JavaMethod() { + + public Signature getSignature() { + Descriptor d = linkage.descriptor; + Class<?>[] arguments = d.getArgumentTypes(); + JavaType[] parameters = new JavaType[arguments.length]; + for (int i = 0; i < arguments.length; i++) { + parameters[i] = runtime.lookupJavaType(arguments[i]); + } + return new HotSpotSignature(runtime.lookupJavaType(d.getResultType()), parameters); + } + + public String getName() { + return linkage.descriptor.getName(); + } + + public JavaType getDeclaringClass() { + return runtime.lookupJavaType(RuntimeCallStub.class); + } + + @Override + public String toString() { + return format("HotSpotStub<%n(%p)>", this); + } + }; + } + + @Override + protected StructuredGraph getGraph() { + Class<?>[] args = linkage.getDescriptor().getArgumentTypes(); + LocalNode[] locals = new LocalNode[args.length]; + + StructuredGraph graph = new StructuredGraph(toString(), null); + StubStartNode start = graph.add(new StubStartNode(this)); + graph.replaceFixed(graph.start(), start); + + ResolvedJavaType accessingClass = runtime.lookupJavaType(getClass()); + for (int i = 0; i < args.length; i++) { + JavaType type = runtime.lookupJavaType(args[i]).resolve(accessingClass); + Kind kind = type.getKind().getStackKind(); + Stamp stamp; + if (kind == Kind.Object) { + stamp = StampFactory.declared((ResolvedJavaType) type); + } else { + stamp = StampFactory.forKind(kind); + } + LocalNode local = graph.unique(new LocalNode(i, stamp)); + locals[i] = local; + } + + // Create target call + CRuntimeCall call = createTargetCall(locals, graph, start); + + // Create call to handlePendingException + ResolvedJavaMethod hpeMethod = resolveMethod(StubUtil.class, "handlePendingException", boolean.class); + JavaType returnType = hpeMethod.getSignature().getReturnType(null); + ValueNode[] hpeArgs = {ConstantNode.forBoolean(linkage.getCallingConvention().getReturn().getKind() == Kind.Object, graph)}; + MethodCallTargetNode hpeTarget = graph.add(new MethodCallTargetNode(InvokeKind.Static, hpeMethod, hpeArgs, returnType)); + InvokeNode hpeInvoke = graph.add(new InvokeNode(hpeTarget, FrameState.UNKNOWN_BCI)); + List<ValueNode> emptyStack = Collections.emptyList(); + hpeInvoke.setStateAfter(graph.add(new FrameState(null, FrameState.INVALID_FRAMESTATE_BCI, new ValueNode[0], emptyStack, new ValueNode[0], false, false))); + graph.addAfterFixed(call, hpeInvoke); + + // Create return node + ReturnNode ret = graph.add(new ReturnNode(linkage.descriptor.getResultType() == void.class ? null : call)); + graph.addAfterFixed(hpeInvoke, ret); + + if (Debug.isDumpEnabled()) { + Debug.dump(graph, "Initial stub graph"); + } + + // Inline call to handlePendingException + inline(hpeInvoke); + + if (Debug.isDumpEnabled()) { + Debug.dump(graph, "Stub graph before compilation"); + } + + return graph; + } + + private CRuntimeCall createTargetCall(LocalNode[] locals, StructuredGraph graph, StubStartNode start) { + CRuntimeCall call; + ValueNode[] targetArguments; + if (prependThread) { + ReadRegisterNode thread = graph.add(new ReadRegisterNode(runtime.threadRegister(), true, false)); + graph.addAfterFixed(start, thread); + targetArguments = new ValueNode[1 + locals.length]; + targetArguments[0] = thread; + System.arraycopy(locals, 0, targetArguments, 1, locals.length); + call = graph.add(new CRuntimeCall(target.descriptor, targetArguments)); + graph.addAfterFixed(thread, call); + } else { + targetArguments = new ValueNode[locals.length]; + System.arraycopy(locals, 0, targetArguments, 0, locals.length); + call = graph.add(new CRuntimeCall(target.descriptor, targetArguments)); + graph.addAfterFixed(start, call); + } + return call; + } + + private void inline(InvokeNode invoke) { + StructuredGraph graph = invoke.graph(); + ResolvedJavaMethod method = ((MethodCallTargetNode) invoke.callTarget()).targetMethod(); + ReplacementsImpl repl = new ReplacementsImpl(runtime, new Assumptions(false), runtime.getTarget()); + StructuredGraph hpeGraph = repl.makeGraph(method, null, null); + InliningUtil.inline(invoke, hpeGraph, false); + new NodeIntrinsificationPhase(runtime).apply(graph); + new WordTypeRewriterPhase(runtime, wordKind()).apply(graph); + new DeadCodeEliminationPhase().apply(graph); + } + + private ResolvedJavaMethod resolveMethod(Class<?> declaringClass, String name, Class... parameterTypes) { + try { + return runtime.lookupJavaMethod(declaringClass.getDeclaredMethod(name, parameterTypes)); + } catch (Exception e) { + throw new GraalInternalError(e); + } + } +}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/SnippetStub.java Mon May 13 13:15:42 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/SnippetStub.java Mon May 13 14:17:35 2013 +0200 @@ -82,13 +82,17 @@ protected abstract Arguments makeArguments(SnippetInfo stub); @Override + protected Object debugScopeContext() { + return getInstalledCodeOwner(); + } + + @Override public ResolvedJavaMethod getInstalledCodeOwner() { return snippet.info.getMethod(); } @Override public String toString() { - ResolvedJavaMethod method = getInstalledCodeOwner(); - return "Stub<" + (method != null ? format("%h.%n", method) : linkage) + ">"; + return "Stub<" + format("%h.%n", getInstalledCodeOwner()) + ">"; } }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/Stub.java Mon May 13 13:15:42 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/Stub.java Mon May 13 14:17:35 2013 +0200 @@ -28,15 +28,14 @@ import java.util.concurrent.*; import com.oracle.graal.api.code.*; -import com.oracle.graal.api.code.CompilationResult.Call; -import com.oracle.graal.api.code.CompilationResult.DataPatch; -import com.oracle.graal.api.code.CompilationResult.Infopoint; import com.oracle.graal.api.meta.*; import com.oracle.graal.compiler.*; import com.oracle.graal.compiler.target.*; import com.oracle.graal.debug.*; import com.oracle.graal.debug.internal.*; +import com.oracle.graal.graph.*; import com.oracle.graal.hotspot.*; +import com.oracle.graal.hotspot.bridge.CompilerToVM.CodeInstallResult; import com.oracle.graal.hotspot.meta.*; import com.oracle.graal.hotspot.nodes.*; import com.oracle.graal.java.*; @@ -55,7 +54,7 @@ public abstract class Stub { /** - * The linkage information for the stub. + * The linkage information for a call to this stub from compiled code. */ protected final HotSpotRuntimeCallTarget linkage; @@ -107,33 +106,22 @@ this.replacements = replacements; } + /** + * Gets the linkage for a call to this stub from compiled code. + */ public HotSpotRuntimeCallTarget getLinkage() { return linkage; } /** - * Checks the conditions a compilation must satisfy to be installed as a RuntimeStub. + * Gets the graph that from which the code for this stub will be compiled. */ - private boolean checkStubInvariants(CompilationResult compResult) { - for (DataPatch data : compResult.getDataReferences()) { - Constant constant = data.constant; - assert constant.getKind() != Kind.Object : this + " cannot have embedded object constant: " + constant; - assert constant.getPrimitiveAnnotation() == null : this + " cannot have embedded metadata: " + constant; - } - for (Infopoint infopoint : compResult.getInfopoints()) { - assert infopoint instanceof Call : this + " cannot have non-call infopoint: " + infopoint; - Call call = (Call) infopoint; - assert call.target instanceof HotSpotRuntimeCallTarget : this + " cannot have non runtime call: " + call.target; - HotSpotRuntimeCallTarget callTarget = (HotSpotRuntimeCallTarget) call.target; - assert callTarget.getAddress() == graalRuntime().getConfig().uncommonTrapStub || callTarget.isCRuntimeCall() : this + "must only call C runtime or deoptimization stub, not " + call.target; - } - return true; - } - protected abstract StructuredGraph getGraph(); @Override - public abstract String toString(); + public String toString() { + return "Stub<" + linkage.getDescriptor() + ">"; + } /** * Gets the method the stub's code will be {@linkplain InstalledCode#getMethod() associated} @@ -141,9 +129,10 @@ */ protected abstract ResolvedJavaMethod getInstalledCodeOwner(); - protected Object debugScopeContext() { - return getInstalledCodeOwner(); - } + /** + * Gets a context object for the debug scope created when producing the code for this stub. + */ + protected abstract Object debugScopeContext(); /** * Gets the code for this stub, compiling it first if necessary. @@ -156,10 +145,11 @@ public void run() { final StructuredGraph graph = getGraph(); - StubStartNode newStart = graph.add(new StubStartNode(Stub.this)); - newStart.setStateAfter(graph.start().stateAfter()); - graph.replaceFixed(graph.start(), newStart); - graph.setStart(newStart); + if (!(graph.start() instanceof StubStartNode)) { + StubStartNode newStart = graph.add(new StubStartNode(Stub.this)); + newStart.setStateAfter(graph.start().stateAfter()); + graph.replaceFixed(graph.start(), newStart); + } PhasePlan phasePlan = new PhasePlan(); GraphBuilderPhase graphBuilderPhase = new GraphBuilderPhase(runtime, GraphBuilderConfiguration.getDefault(), OptimisticOptimizations.ALL); @@ -168,23 +158,27 @@ final CompilationResult compResult = GraalCompiler.compileGraph(graph, cc, getInstalledCodeOwner(), runtime, replacements, backend, runtime.getTarget(), null, phasePlan, OptimisticOptimizations.ALL, new SpeculationLog()); - assert checkStubInvariants(compResult); - assert destroyedRegisters != null; code = Debug.scope("CodeInstall", new Callable<InstalledCode>() { @Override public InstalledCode call() { - InstalledCode installedCode = runtime.addMethod(getInstalledCodeOwner(), compResult); - assert installedCode != null : "error installing stub " + this; + Stub stub = Stub.this; + HotSpotInstalledCode installedCode = new HotSpotInstalledCode(stub); + HotSpotCompilationResult hsCompResult = new HotSpotCompilationResult(stub, compResult); + CodeInstallResult result = graalRuntime().getCompilerToVM().installCode(hsCompResult, installedCode, null); + if (result != CodeInstallResult.OK) { + throw new GraalInternalError("Error installing stub %s: %s", Stub.this, result); + } if (Debug.isDumpEnabled()) { Debug.dump(new Object[]{compResult, installedCode}, "After code installation"); } - // TTY.println(getMethod().toString()); - // TTY.println(runtime().disassemble(installedCode)); + // TTY.println(stub.toString()); + // TTY.println(runtime.disassemble(installedCode)); return installedCode; } }); + } }); assert code != null : "error installing stub " + this;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/StructuredGraph.java Mon May 13 13:15:42 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/StructuredGraph.java Mon May 13 14:17:35 2013 +0200 @@ -251,6 +251,9 @@ node.setNext(null); replacement.setNext(next); node.replaceAndDelete(replacement); + if (node == start) { + setStart((StartNode) replacement); + } } public void replaceFixedWithFloating(FixedWithNextNode node, FloatingNode replacement) {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/MemoryCheckpoint.java Mon May 13 13:15:42 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/MemoryCheckpoint.java Mon May 13 14:17:35 2013 +0200 @@ -26,9 +26,9 @@ import com.oracle.graal.nodes.extended.LocationNode.LocationIdentity; /** - * This interface marks is used for subclasses of {@link FixedNode} that kill a set of memory - * locations represented by location identities (i.e. change a value at one or more locations that - * belong to these location identities). + * This interface marks subclasses of {@link FixedNode} that kill a set of memory locations + * represented by location identities (i.e. change a value at one or more locations that belong to + * these location identities). */ public interface MemoryCheckpoint {
--- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CFGPrinterObserver.java Mon May 13 13:15:42 2013 +0200 +++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CFGPrinterObserver.java Mon May 13 14:17:35 2013 +0200 @@ -45,7 +45,7 @@ private CFGPrinter cfgPrinter; private File cfgFile; - private ResolvedJavaMethod curMethod; + private JavaMethod curMethod; private List<String> curDecorators = Collections.emptyList(); @Override @@ -64,17 +64,18 @@ * and decorator pair. */ private boolean checkMethodScope() { - ResolvedJavaMethod method = null; + JavaMethod method = null; ArrayList<String> decorators = new ArrayList<>(); for (Object o : Debug.context()) { - if (o instanceof ResolvedJavaMethod) { - method = (ResolvedJavaMethod) o; + if (o instanceof JavaMethod) { + method = (JavaMethod) o; decorators.clear(); } else if (o instanceof StructuredGraph) { StructuredGraph graph = (StructuredGraph) o; - assert graph != null && graph.method() != null : "cannot find method context for CFG dump"; - method = graph.method(); - decorators.clear(); + if (graph.method() != null) { + method = graph.method(); + decorators.clear(); + } } else if (o instanceof DebugDumpScope) { DebugDumpScope debugDumpScope = (DebugDumpScope) o; if (debugDumpScope.decorator) {
--- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/GraphPrinterDumpHandler.java Mon May 13 13:15:42 2013 +0200 +++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/GraphPrinterDumpHandler.java Mon May 13 14:17:35 2013 +0200 @@ -181,10 +181,18 @@ private static List<String> getInlineContext() { List<String> result = new ArrayList<>(); + Object last = null; for (Object o : Debug.context()) { JavaMethod method = GraalDebugConfig.asJavaMethod(o); if (method != null) { - result.add(MetaUtil.format("%H::%n(%p)", method)); + if (last != method) { + result.add(MetaUtil.format("%H::%n(%p)", method)); + } else { + // This prevents multiple adjacent method context objects for the same method + // from resulting in multiple IGV tree levels. This works on the + // assumption that real inlining debug scopes will have a graph + // context object between the inliner and inlinee context objects. + } } else if (o instanceof DebugDumpScope) { DebugDumpScope debugDumpScope = (DebugDumpScope) o; if (debugDumpScope.decorator && !result.isEmpty()) { @@ -193,6 +201,7 @@ result.add(debugDumpScope.name); } } + last = o; } if (result.isEmpty()) { result.add("Top Scope");
--- a/src/share/vm/graal/graalCodeInstaller.cpp Mon May 13 13:15:42 2013 +0200 +++ b/src/share/vm/graal/graalCodeInstaller.cpp Mon May 13 14:17:35 2013 +0200 @@ -351,7 +351,7 @@ } // constructor used to create a method -CodeInstaller::CodeInstaller(Handle& comp_result, methodHandle method, GraalEnv::CodeInstallResult& result, CodeBlob*& cb, Handle installed_code, Handle triggered_deoptimizations) { +CodeInstaller::CodeInstaller(Handle& comp_result, GraalEnv::CodeInstallResult& result, CodeBlob*& cb, Handle installed_code, Handle triggered_deoptimizations) { GraalCompiler::initialize_buffer_blob(); CodeBuffer buffer(JavaThread::current()->get_buffer_blob()); jobject comp_result_obj = JNIHandles::make_local(comp_result()); @@ -360,7 +360,7 @@ { No_Safepoint_Verifier no_safepoint; - initialize_fields(JNIHandles::resolve(comp_result_obj), method); + initialize_fields(JNIHandles::resolve(comp_result_obj)); initialize_buffer(buffer); process_exception_handlers(); } @@ -379,17 +379,23 @@ result = GraalEnv::ok; } else { nmethod* nm = NULL; + methodHandle method = getMethodFromHotSpotMethod(HotSpotCompilationResult::method(comp_result)); result = GraalEnv::register_method(method, nm, entry_bci, &_offsets, _custom_stack_area_offset, &buffer, stack_slots, _debug_recorder->_oopmaps, &_exception_handler_table, GraalCompiler::instance(), _debug_recorder, _dependencies, NULL, -1, false, leaf_graph_ids, installed_code, triggered_deoptimizations); cb = nm; } } -void CodeInstaller::initialize_fields(oop comp_result, methodHandle method) { +void CodeInstaller::initialize_fields(oop comp_result) { _comp_result = HotSpotCompilationResult::comp(comp_result); - if (!method.is_null()) { + oop hotspotJavaMethod = HotSpotCompilationResult::method(comp_result); + if (hotspotJavaMethod != NULL) { + methodHandle method = getMethodFromHotSpotMethod(hotspotJavaMethod); _parameter_count = method->size_of_parameters(); TRACE_graal_1("installing code for %s", method->name_and_sig_as_C_string()); + } else { + // TODO (ds) not sure if this is correct - only used in OopMap constructor for non-product builds + _parameter_count = 0; } _stubName = HotSpotCompilationResult::stubName(comp_result); _sites = (arrayOop) HotSpotCompilationResult::sites(comp_result);
--- a/src/share/vm/graal/graalCodeInstaller.hpp Mon May 13 13:15:42 2013 +0200 +++ b/src/share/vm/graal/graalCodeInstaller.hpp Mon May 13 14:17:35 2013 +0200 @@ -76,13 +76,13 @@ public: - CodeInstaller(Handle& comp_result, methodHandle method, GraalEnv::CodeInstallResult& result, CodeBlob*& cb, Handle installed_code, Handle triggered_deoptimizations); + CodeInstaller(Handle& comp_result, GraalEnv::CodeInstallResult& result, CodeBlob*& cb, Handle installed_code, Handle triggered_deoptimizations); static address runtime_call_target_address(oop runtime_call); private: // extract the fields of the CompilationResult - void initialize_fields(oop target_method, methodHandle method); + void initialize_fields(oop target_method); void initialize_assumptions(oop target_method); // perform data and call relocation on the CodeBuffer
--- a/src/share/vm/graal/graalCompilerToVM.cpp Mon May 13 13:15:42 2013 +0200 +++ b/src/share/vm/graal/graalCompilerToVM.cpp Mon May 13 14:17:35 2013 +0200 @@ -606,8 +606,8 @@ return JNIHandles::make_local(field_array()); C2V_END -C2V_VMENTRY(jlong, getMaxCallTargetOffset, (JNIEnv *env, jobject, jlong stub)) - address target_addr = (address) stub; +C2V_VMENTRY(jlong, getMaxCallTargetOffset, (JNIEnv *env, jobject, jlong addr)) + address target_addr = (address) addr; if (target_addr != 0x0) { int64_t off_low = (int64_t)target_addr - ((int64_t)CodeCache::low_bound() + sizeof(int)); int64_t off_high = (int64_t)target_addr - ((int64_t)CodeCache::high_bound() + sizeof(int)); @@ -872,12 +872,11 @@ HandleMark hm; Handle compResultHandle = JNIHandles::resolve(compResult); CodeBlob* cb = NULL; - methodHandle method = getMethodFromHotSpotMethod(HotSpotCompilationResult::method(compResult)); Handle installed_code_handle = JNIHandles::resolve(installed_code); Handle triggered_deoptimizations_handle = JNIHandles::resolve(triggered_deoptimizations); GraalEnv::CodeInstallResult result; - CodeInstaller installer(compResultHandle, method, result, cb, installed_code_handle, triggered_deoptimizations_handle); + CodeInstaller installer(compResultHandle, result, cb, installed_code_handle, triggered_deoptimizations_handle); if (PrintCodeCacheOnCompilation) { stringStream s; @@ -898,7 +897,6 @@ HotSpotInstalledCode::set_codeBlob(installed_code_handle, (jlong) cb); HotSpotInstalledCode::set_method(installed_code_handle, HotSpotCompilationResult::method(compResult)); HotSpotInstalledCode::set_start(installed_code_handle, (jlong) cb->code_begin()); - HotSpotInstalledCode::set_isNmethod(installed_code_handle, cb->is_nmethod()); nmethod* nm = cb->as_nmethod_or_null(); assert(nm == NULL || !installed_code_handle->is_scavengable() || nm->on_scavenge_root_list(), "nm should be scavengable if installed_code is scavengable"); }
--- a/src/share/vm/graal/graalJavaAccess.cpp Mon May 13 13:15:42 2013 +0200 +++ b/src/share/vm/graal/graalJavaAccess.cpp Mon May 13 14:17:35 2013 +0200 @@ -31,13 +31,8 @@ void compute_offset(int &dest_offset, Klass* klass, const char* name, const char* signature, bool static_field) { Symbol* name_symbol = SymbolTable::probe(name, (int)strlen(name)); Symbol* signature_symbol = SymbolTable::probe(signature, (int)strlen(signature)); -#ifndef PRODUCT if (name_symbol == NULL || signature_symbol == NULL) { - tty->print_cr("symbol with name %s was not found in symbol table (klass=%s)", name, klass->name()->as_C_string()); - } -#endif - if (name_symbol == NULL || signature_symbol == NULL) { - guarantee(false, err_msg("symbol not found - class layout of %s changed?", klass->name()->as_C_string())); + guarantee(false, err_msg("symbol with name %s and signature %s was not found in symbol table (klass=%s)", name, signature, klass->name()->as_C_string())); } InstanceKlass* ik = InstanceKlass::cast(klass);
--- a/src/share/vm/graal/graalJavaAccess.hpp Mon May 13 13:15:42 2013 +0200 +++ b/src/share/vm/graal/graalJavaAccess.hpp Mon May 13 14:17:35 2013 +0200 @@ -81,7 +81,6 @@ oop_field(HotSpotInstalledCode, method, "Lcom/oracle/graal/hotspot/meta/HotSpotResolvedJavaMethod;") \ long_field(HotSpotInstalledCode, start) \ boolean_field(HotSpotInstalledCode, isDefault) \ - boolean_field(HotSpotInstalledCode, isNmethod) \ end_class \ start_class(HotSpotCompilationResult) \ oop_field(HotSpotCompilationResult, comp, "Lcom/oracle/graal/api/code/CompilationResult;") \