Mercurial > hg > graal-compiler
changeset 23316:52f4acf6f365
Update import: Move CompilationResult and DataSection from JVMCI to Graal.
line wrap: on
line diff
--- a/graal/com.oracle.graal.asm.amd64.test/src/com/oracle/graal/asm/amd64/test/BitOpsTest.java Fri Jan 15 16:30:38 2016 +0100 +++ b/graal/com.oracle.graal.asm.amd64.test/src/com/oracle/graal/asm/amd64/test/BitOpsTest.java Mon Jan 18 10:29:19 2016 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2016, 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 @@ -36,7 +36,6 @@ import jdk.vm.ci.amd64.AMD64; import jdk.vm.ci.amd64.AMD64.CPUFeature; import jdk.vm.ci.code.CallingConvention; -import jdk.vm.ci.code.CompilationResult; import jdk.vm.ci.code.Register; import jdk.vm.ci.code.RegisterConfig; import jdk.vm.ci.code.TargetDescription; @@ -48,6 +47,7 @@ import com.oracle.graal.asm.amd64.AMD64Address; import com.oracle.graal.asm.amd64.AMD64Assembler; import com.oracle.graal.asm.test.AssemblerTest; +import com.oracle.graal.code.CompilationResult; public class BitOpsTest extends AssemblerTest { private static boolean lzcntSupported;
--- a/graal/com.oracle.graal.asm.amd64.test/src/com/oracle/graal/asm/amd64/test/IncrementDecrementMacroTest.java Fri Jan 15 16:30:38 2016 +0100 +++ b/graal/com.oracle.graal.asm.amd64.test/src/com/oracle/graal/asm/amd64/test/IncrementDecrementMacroTest.java Mon Jan 18 10:29:19 2016 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, 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 @@ -29,7 +29,6 @@ import jdk.vm.ci.amd64.AMD64; import jdk.vm.ci.code.CallingConvention; -import jdk.vm.ci.code.CompilationResult; import jdk.vm.ci.code.Register; import jdk.vm.ci.code.RegisterConfig; import jdk.vm.ci.code.TargetDescription; @@ -41,6 +40,7 @@ import com.oracle.graal.asm.amd64.AMD64Address; import com.oracle.graal.asm.amd64.AMD64MacroAssembler; import com.oracle.graal.asm.test.AssemblerTest; +import com.oracle.graal.code.CompilationResult; public class IncrementDecrementMacroTest extends AssemblerTest {
--- a/graal/com.oracle.graal.asm.amd64.test/src/com/oracle/graal/asm/amd64/test/SimpleAssemblerTest.java Fri Jan 15 16:30:38 2016 +0100 +++ b/graal/com.oracle.graal.asm.amd64.test/src/com/oracle/graal/asm/amd64/test/SimpleAssemblerTest.java Mon Jan 18 10:29:19 2016 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2016, 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 @@ -29,13 +29,10 @@ import jdk.vm.ci.amd64.AMD64; import jdk.vm.ci.code.CallingConvention; -import jdk.vm.ci.code.CompilationResult; -import jdk.vm.ci.code.CompilationResult.DataSectionReference; -import jdk.vm.ci.code.DataSection.Data; -import jdk.vm.ci.code.DataSection.DataBuilder; import jdk.vm.ci.code.Register; import jdk.vm.ci.code.RegisterConfig; import jdk.vm.ci.code.TargetDescription; +import jdk.vm.ci.code.site.DataSectionReference; import jdk.vm.ci.meta.JavaConstant; import jdk.vm.ci.meta.JavaKind; @@ -45,6 +42,10 @@ import com.oracle.graal.asm.amd64.AMD64Assembler; import com.oracle.graal.asm.amd64.AMD64MacroAssembler; import com.oracle.graal.asm.test.AssemblerTest; +import com.oracle.graal.code.CompilationResult; +import com.oracle.graal.code.DataSection.Data; +import com.oracle.graal.code.DataSection.RawData; +import com.oracle.graal.code.DataSection.SerializableData; public class SimpleAssemblerTest extends AssemblerTest { @@ -77,7 +78,7 @@ public byte[] generateCode(CompilationResult compResult, TargetDescription target, RegisterConfig registerConfig, CallingConvention cc) { AMD64MacroAssembler asm = new AMD64MacroAssembler(target, registerConfig); Register ret = registerConfig.getReturnRegister(JavaKind.Double); - Data data = new Data(8, 8, DataBuilder.serializable(JavaConstant.forDouble(84.72))); + Data data = new SerializableData(JavaConstant.forDouble(84.72), 8); DataSectionReference ref = compResult.getDataSection().insertData(data); compResult.recordDataPatch(asm.position(), ref); asm.movdbl(ret, asm.getPlaceholder()); @@ -99,7 +100,7 @@ byte[] rawBytes = new byte[8]; ByteBuffer.wrap(rawBytes).order(ByteOrder.nativeOrder()).putDouble(84.72); - Data data = new Data(8, 8, DataBuilder.raw(rawBytes)); + Data data = new RawData(rawBytes, 8); DataSectionReference ref = compResult.getDataSection().insertData(data); compResult.recordDataPatch(asm.position(), ref); asm.movdbl(ret, asm.getPlaceholder());
--- a/graal/com.oracle.graal.asm.test/src/com/oracle/graal/asm/test/AssemblerTest.java Fri Jan 15 16:30:38 2016 +0100 +++ b/graal/com.oracle.graal.asm.test/src/com/oracle/graal/asm/test/AssemblerTest.java Mon Jan 18 10:29:19 2016 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2016, 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 @@ -27,7 +27,7 @@ import jdk.vm.ci.code.CallingConvention; import jdk.vm.ci.code.CodeCacheProvider; import jdk.vm.ci.code.CodeUtil; -import jdk.vm.ci.code.CompilationResult; +import jdk.vm.ci.code.CompiledCode; import jdk.vm.ci.code.InstalledCode; import jdk.vm.ci.code.InvalidInstalledCodeException; import jdk.vm.ci.code.RegisterConfig; @@ -40,15 +40,20 @@ import org.junit.Assert; +import com.oracle.graal.api.test.Graal; +import com.oracle.graal.code.CompilationResult; import com.oracle.graal.code.DisassemblerProvider; +import com.oracle.graal.compiler.target.Backend; import com.oracle.graal.debug.Debug; import com.oracle.graal.debug.Debug.Scope; +import com.oracle.graal.runtime.RuntimeProvider; import com.oracle.graal.test.GraalTest; public abstract class AssemblerTest extends GraalTest { private final MetaAccessProvider metaAccess; protected final CodeCacheProvider codeCache; + private final Backend backend; public interface CodeGenTest { byte[] generateCode(CompilationResult compResult, TargetDescription target, RegisterConfig registerConfig, CallingConvention cc); @@ -58,6 +63,7 @@ JVMCIBackend providers = JVMCI.getRuntime().getHostJVMCIBackend(); this.metaAccess = providers.getMetaAccess(); this.codeCache = providers.getCodeCache(); + this.backend = Graal.getRequiredCapability(RuntimeProvider.class).getHostBackend(); } public MetaAccessProvider getMetaAccess() { @@ -77,7 +83,8 @@ compResult.setTotalFrameSize(0); compResult.close(); - InstalledCode code = codeCache.addCode(method, compResult, null, null); + CompiledCode compiledCode = backend.createCompiledCode(method, compResult); + InstalledCode code = codeCache.addCode(method, compiledCode, null, null); for (DisassemblerProvider dis : Services.load(DisassemblerProvider.class)) { String disasm1 = dis.disassembleCompiledCode(codeCache, compResult);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.code/src/com/oracle/graal/code/CompilationResult.java Mon Jan 18 10:29:19 2016 +0100 @@ -0,0 +1,626 @@ +/* + * Copyright (c) 2009, 2016, 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.code; + +import static java.util.Collections.emptyList; +import static java.util.Collections.unmodifiableList; +import static jdk.vm.ci.meta.MetaUtil.identityHashCodeString; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.Objects; + +import jdk.vm.ci.code.DebugInfo; +import jdk.vm.ci.code.site.Call; +import jdk.vm.ci.code.site.ConstantReference; +import jdk.vm.ci.code.site.DataPatch; +import jdk.vm.ci.code.site.DataSectionReference; +import jdk.vm.ci.code.site.ExceptionHandler; +import jdk.vm.ci.code.site.Infopoint; +import jdk.vm.ci.code.site.InfopointReason; +import jdk.vm.ci.code.site.Mark; +import jdk.vm.ci.code.site.Reference; +import jdk.vm.ci.code.site.Site; +import jdk.vm.ci.meta.Assumptions.Assumption; +import jdk.vm.ci.meta.InvokeTarget; +import jdk.vm.ci.meta.ResolvedJavaMethod; + +/** + * Represents the output from compiling a method, including the compiled machine code, associated + * data and references, relocation information, deoptimization information, etc. + */ +public class CompilationResult { + + /** + * Provides extra information about instructions or data at specific positions in + * {@link CompilationResult#getTargetCode()}. This is optional information that can be used to + * enhance a disassembly of the code. + */ + public abstract static class CodeAnnotation { + + public final int position; + + public CodeAnnotation(int position) { + this.position = position; + } + + @Override + public final int hashCode() { + throw new UnsupportedOperationException("hashCode"); + } + + @Override + public String toString() { + return identityHashCodeString(this); + } + + @Override + public abstract boolean equals(Object obj); + } + + /** + * A string comment about one or more instructions at a specific position in the code. + */ + public static final class CodeComment extends CodeAnnotation { + + public final String value; + + public CodeComment(int position, String comment) { + super(position); + this.value = comment; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj instanceof CodeComment) { + CodeComment that = (CodeComment) obj; + if (this.position == that.position && this.value.equals(that.value)) { + return true; + } + } + return false; + } + + @Override + public String toString() { + return getClass().getSimpleName() + "@" + position + ": " + value; + } + } + + /** + * Describes a table of signed offsets embedded in the code. The offsets are relative to the + * starting address of the table. This type of table maybe generated when translating a + * multi-way branch based on a key value from a dense value set (e.g. the {@code tableswitch} + * JVM instruction). + * + * The table is indexed by the contiguous range of integers from {@link #low} to {@link #high} + * inclusive. + */ + public static final class JumpTable extends CodeAnnotation { + + /** + * The low value in the key range (inclusive). + */ + public final int low; + + /** + * The high value in the key range (inclusive). + */ + public final int high; + + /** + * The size (in bytes) of each table entry. + */ + public final int entrySize; + + public JumpTable(int position, int low, int high, int entrySize) { + super(position); + this.low = low; + this.high = high; + this.entrySize = entrySize; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj instanceof JumpTable) { + JumpTable that = (JumpTable) obj; + if (this.position == that.position && this.entrySize == that.entrySize && this.low == that.low && this.high == that.high) { + return true; + } + } + return false; + } + + @Override + public String toString() { + return getClass().getSimpleName() + "@" + position + ": [" + low + " .. " + high + "]"; + } + } + + private boolean closed; + + private int entryBCI = -1; + + private final DataSection dataSection = new DataSection(); + + private final List<Infopoint> infopoints = new ArrayList<>(); + private final List<DataPatch> dataPatches = new ArrayList<>(); + private final List<ExceptionHandler> exceptionHandlers = new ArrayList<>(); + private final List<Mark> marks = new ArrayList<>(); + + private int totalFrameSize = -1; + private int customStackAreaOffset = -1; + + private final String name; + + /** + * The buffer containing the emitted machine code. + */ + private byte[] targetCode; + + /** + * The leading number of bytes in {@link #targetCode} containing the emitted machine code. + */ + private int targetCodeSize; + + private ArrayList<CodeAnnotation> annotations; + + private Assumption[] assumptions; + + /** + * The list of the methods whose bytecodes were used as input to the compilation. If + * {@code null}, then the compilation did not record method dependencies. Otherwise, the first + * element of this array is the root method of the compilation. + */ + private ResolvedJavaMethod[] methods; + + private int bytecodeSize; + + private boolean hasUnsafeAccess; + + public CompilationResult() { + this(null); + } + + public CompilationResult(String name) { + this.name = name; + } + + @Override + public int hashCode() { + // CompilationResult instances should not be used as hash map keys + throw new UnsupportedOperationException("hashCode"); + } + + @Override + public String toString() { + if (methods != null) { + return getClass().getName() + "[" + methods[0].format("%H.%n(%p)%r") + "]"; + } + return identityHashCodeString(this); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj != null && obj.getClass() == getClass()) { + CompilationResult that = (CompilationResult) obj; + // @formatter:off + if (this.entryBCI == that.entryBCI && + this.customStackAreaOffset == that.customStackAreaOffset && + this.totalFrameSize == that.totalFrameSize && + this.targetCodeSize == that.targetCodeSize && + Objects.equals(this.name, that.name) && + Objects.equals(this.annotations, that.annotations) && + Objects.equals(this.dataSection, that.dataSection) && + Objects.equals(this.exceptionHandlers, that.exceptionHandlers) && + Objects.equals(this.dataPatches, that.dataPatches) && + Objects.equals(this.infopoints, that.infopoints) && + Objects.equals(this.marks, that.marks) && + Arrays.equals(this.assumptions, that.assumptions) && + Arrays.equals(targetCode, that.targetCode)) { + return true; + } + // @formatter:on + } + return false; + } + + /** + * @return the entryBCI + */ + public int getEntryBCI() { + return entryBCI; + } + + /** + * @param entryBCI the entryBCI to set + */ + public void setEntryBCI(int entryBCI) { + checkOpen(); + this.entryBCI = entryBCI; + } + + /** + * Sets the assumptions made during compilation. + */ + public void setAssumptions(Assumption[] assumptions) { + checkOpen(); + this.assumptions = assumptions; + } + + /** + * Gets the assumptions made during compilation. + * + * The caller must not modify the contents of the returned array. + */ + public Assumption[] getAssumptions() { + return assumptions; + } + + /** + * Sets the methods whose bytecodes were used as input to the compilation. + * + * @param rootMethod the root method of the compilation + * @param inlinedMethods the methods inlined during compilation + */ + public void setMethods(ResolvedJavaMethod rootMethod, Collection<ResolvedJavaMethod> inlinedMethods) { + checkOpen(); + assert rootMethod != null; + assert inlinedMethods != null; + if (inlinedMethods.contains(rootMethod)) { + methods = inlinedMethods.toArray(new ResolvedJavaMethod[inlinedMethods.size()]); + for (int i = 0; i < methods.length; i++) { + if (methods[i].equals(rootMethod)) { + if (i != 0) { + ResolvedJavaMethod tmp = methods[0]; + methods[0] = methods[i]; + methods[i] = tmp; + } + break; + } + } + } else { + methods = new ResolvedJavaMethod[1 + inlinedMethods.size()]; + methods[0] = rootMethod; + int i = 1; + for (ResolvedJavaMethod m : inlinedMethods) { + methods[i++] = m; + } + } + } + + /** + * Gets the methods whose bytecodes were used as input to the compilation. + * + * The caller must not modify the contents of the returned array. + * + * @return {@code null} if the compilation did not record method dependencies otherwise the + * methods whose bytecodes were used as input to the compilation with the first element + * being the root method of the compilation + */ + public ResolvedJavaMethod[] getMethods() { + return methods; + } + + public void setBytecodeSize(int bytecodeSize) { + checkOpen(); + this.bytecodeSize = bytecodeSize; + } + + public int getBytecodeSize() { + return bytecodeSize; + } + + public DataSection getDataSection() { + return dataSection; + } + + /** + * The total frame size of the method in bytes. This includes the return address pushed onto the + * stack, if any. + * + * @return the frame size + */ + public int getTotalFrameSize() { + assert totalFrameSize != -1 : "frame size not yet initialized!"; + return totalFrameSize; + } + + /** + * Sets the total frame size in bytes. This includes the return address pushed onto the stack, + * if any. + * + * @param size the size of the frame in bytes + */ + public void setTotalFrameSize(int size) { + checkOpen(); + totalFrameSize = size; + } + + /** + * Sets the machine that has been generated by the compiler. + * + * @param code the machine code generated + * @param size the size of the machine code + */ + public void setTargetCode(byte[] code, int size) { + checkOpen(); + targetCode = code; + targetCodeSize = size; + } + + /** + * Records a data patch in the code section. The data patch can refer to something in the + * {@link DataSectionReference data section} or directly to an {@link ConstantReference inlined + * constant}. + * + * @param codePos The position in the code that needs to be patched. + * @param ref The reference that should be inserted in the code. + */ + public void recordDataPatch(int codePos, Reference ref) { + checkOpen(); + assert codePos >= 0 && ref != null; + dataPatches.add(new DataPatch(codePos, ref)); + } + + /** + * Records a call in the code array. + * + * @param codePos the position of the call in the code array + * @param size the size of the call instruction + * @param target the being called + * @param debugInfo the debug info for the call + * @param direct specifies if this is a {@linkplain Call#direct direct} call + */ + public void recordCall(int codePos, int size, InvokeTarget target, DebugInfo debugInfo, boolean direct) { + checkOpen(); + final Call call = new Call(target, codePos, size, direct, debugInfo); + addInfopoint(call); + } + + /** + * Records an exception handler for this method. + * + * @param codePos the position in the code that is covered by the handler + * @param handlerPos the position of the handler + */ + public void recordExceptionHandler(int codePos, int handlerPos) { + checkOpen(); + assert validateExceptionHandlerAdd(codePos, handlerPos) : String.format("Duplicate exception handler for pc 0x%x handlerPos 0x%x", codePos, handlerPos); + exceptionHandlers.add(new ExceptionHandler(codePos, handlerPos)); + } + + /** + * Validate if the exception handler for codePos already exists and handlerPos is different. + * + * @param codePos + * @param handlerPos + * @return true if the validation is successful + */ + private boolean validateExceptionHandlerAdd(int codePos, int handlerPos) { + ExceptionHandler exHandler = getExceptionHandlerForCodePos(codePos); + return exHandler == null || exHandler.handlerPos == handlerPos; + } + + /** + * Returns the first ExceptionHandler which matches codePos. + * + * @param codePos position to search for + * @return first matching ExceptionHandler + */ + private ExceptionHandler getExceptionHandlerForCodePos(int codePos) { + for (ExceptionHandler h : exceptionHandlers) { + if (h.pcOffset == codePos) { + return h; + } + } + return null; + } + + /** + * Records an infopoint in the code array. + * + * @param codePos the position of the infopoint in the code array + * @param debugInfo the debug info for the infopoint + */ + public void recordInfopoint(int codePos, DebugInfo debugInfo, InfopointReason reason) { + addInfopoint(new Infopoint(codePos, debugInfo, reason)); + } + + /** + * Records a custom infopoint in the code section. + * + * Compiler implementations can use this method to record non-standard infopoints, which are not + * handled by dedicated methods like {@link #recordCall}. + * + * @param infopoint the infopoint to record, usually a derived class from {@link Infopoint} + */ + public void addInfopoint(Infopoint infopoint) { + checkOpen(); + infopoints.add(infopoint); + } + + /** + * Records an instruction mark within this method. + * + * @param codePos the position in the code that is covered by the handler + * @param markId the identifier for this mark + */ + public Mark recordMark(int codePos, Object markId) { + checkOpen(); + Mark mark = new Mark(codePos, markId); + marks.add(mark); + return mark; + } + + /** + * Offset in bytes for the custom stack area (relative to sp). + * + * @return the offset in bytes + */ + public int getCustomStackAreaOffset() { + return customStackAreaOffset; + } + + /** + * @see #getCustomStackAreaOffset() + * @param offset + */ + public void setCustomStackAreaOffset(int offset) { + checkOpen(); + customStackAreaOffset = offset; + } + + /** + * @return the machine code generated for this method + */ + public byte[] getTargetCode() { + return targetCode; + } + + /** + * @return the size of the machine code generated for this method + */ + public int getTargetCodeSize() { + return targetCodeSize; + } + + /** + * @return the code annotations or {@code null} if there are none + */ + public List<CodeAnnotation> getAnnotations() { + if (annotations == null) { + return Collections.emptyList(); + } + return annotations; + } + + public void addAnnotation(CodeAnnotation annotation) { + checkOpen(); + assert annotation != null; + if (annotations == null) { + annotations = new ArrayList<>(); + } + annotations.add(annotation); + } + + /** + * @return the list of infopoints, sorted by {@link Site#pcOffset} + */ + public List<Infopoint> getInfopoints() { + if (infopoints.isEmpty()) { + return emptyList(); + } + return unmodifiableList(infopoints); + } + + /** + * @return the list of data references + */ + public List<DataPatch> getDataPatches() { + if (dataPatches.isEmpty()) { + return emptyList(); + } + return unmodifiableList(dataPatches); + } + + /** + * @return the list of exception handlers + */ + public List<ExceptionHandler> getExceptionHandlers() { + if (exceptionHandlers.isEmpty()) { + return emptyList(); + } + return unmodifiableList(exceptionHandlers); + } + + /** + * @return the list of marks + */ + public List<Mark> getMarks() { + if (marks.isEmpty()) { + return emptyList(); + } + return unmodifiableList(marks); + } + + public String getName() { + return name; + } + + public void setHasUnsafeAccess(boolean hasUnsafeAccess) { + checkOpen(); + this.hasUnsafeAccess = hasUnsafeAccess; + } + + public boolean hasUnsafeAccess() { + return hasUnsafeAccess; + } + + /** + * Clears the information in this object pertaining to generating code. That is, the + * {@linkplain #getMarks() marks}, {@linkplain #getInfopoints() infopoints}, + * {@linkplain #getExceptionHandlers() exception handlers}, {@linkplain #getDataPatches() data + * patches} and {@linkplain #getAnnotations() annotations} recorded in this object are cleared. + */ + public void resetForEmittingCode() { + checkOpen(); + infopoints.clear(); + dataPatches.clear(); + exceptionHandlers.clear(); + marks.clear(); + dataSection.clear(); + if (annotations != null) { + annotations.clear(); + } + } + + private void checkOpen() { + if (closed) { + throw new IllegalStateException(); + } + } + + /** + * Closes this compilation result to future updates. + */ + public void close() { + if (closed) { + throw new IllegalStateException("Cannot re-close compilation result " + this); + } + dataSection.close(); + closed = true; + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.code/src/com/oracle/graal/code/DataSection.java Mon Jan 18 10:29:19 2016 +0100 @@ -0,0 +1,414 @@ +/* + * Copyright (c) 2014, 2016, 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.code; + +import static jdk.vm.ci.meta.MetaUtil.identityHashCodeString; + +import java.nio.ByteBuffer; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.Objects; + +import jdk.vm.ci.code.site.DataSectionReference; +import jdk.vm.ci.meta.SerializableConstant; +import jdk.vm.ci.meta.VMConstant; + +import com.oracle.graal.code.DataSection.Data; + +public final class DataSection implements Iterable<Data> { + + public interface Patches { + + void registerPatch(VMConstant c); + } + + public abstract static class Data { + + private int alignment; + private final int size; + + private DataSectionReference ref; + + protected Data(int alignment, int size) { + this.alignment = alignment; + this.size = size; + + // initialized in DataSection.insertData(Data) + ref = null; + } + + protected abstract void emit(ByteBuffer buffer, Patches patches); + + public void updateAlignment(int newAlignment) { + if (newAlignment == alignment) { + return; + } + alignment = lcm(alignment, newAlignment); + } + + public int getAlignment() { + return alignment; + } + + public int getSize() { + return size; + } + + @Override + public int hashCode() { + // Data instances should not be used as hash map keys + throw new UnsupportedOperationException("hashCode"); + } + + @Override + public String toString() { + return identityHashCodeString(this); + } + + @Override + public boolean equals(Object obj) { + assert ref != null; + if (obj == this) { + return true; + } + if (obj instanceof Data) { + Data that = (Data) obj; + if (this.alignment == that.alignment && this.size == that.size && this.ref.equals(that.ref)) { + return true; + } + } + return false; + } + } + + public static final class RawData extends Data { + + private final byte[] data; + + public RawData(byte[] data, int alignment) { + super(alignment, data.length); + this.data = data; + } + + @Override + protected void emit(ByteBuffer buffer, Patches patches) { + buffer.put(data); + } + } + + public static final class SerializableData extends Data { + + private final SerializableConstant constant; + + public SerializableData(SerializableConstant constant) { + this(constant, constant.getSerializedSize()); + } + + public SerializableData(SerializableConstant constant, int alignment) { + super(alignment, constant.getSerializedSize()); + this.constant = constant; + } + + @Override + protected void emit(ByteBuffer buffer, Patches patches) { + constant.serialize(buffer); + } + } + + public static class ZeroData extends Data { + + protected ZeroData(int alignment, int size) { + super(alignment, size); + } + + public static ZeroData create(int alignment, int size) { + switch (size) { + case 1: + return new ZeroData(alignment, size) { + @Override + protected void emit(ByteBuffer buffer, Patches patches) { + buffer.put((byte) 0); + } + }; + + case 2: + return new ZeroData(alignment, size) { + @Override + protected void emit(ByteBuffer buffer, Patches patches) { + buffer.putShort((short) 0); + } + }; + + case 4: + return new ZeroData(alignment, size) { + @Override + protected void emit(ByteBuffer buffer, Patches patches) { + buffer.putInt(0); + } + }; + + case 8: + return new ZeroData(alignment, size) { + @Override + protected void emit(ByteBuffer buffer, Patches patches) { + buffer.putLong(0); + } + }; + + default: + return new ZeroData(alignment, size); + } + } + + @Override + protected void emit(ByteBuffer buffer, Patches patches) { + int rest = getSize(); + while (rest > 8) { + buffer.putLong(0L); + rest -= 8; + } + while (rest > 0) { + buffer.put((byte) 0); + rest--; + } + } + } + + public static final class PackedData extends Data { + + private final Data[] nested; + + private PackedData(int alignment, int size, Data[] nested) { + super(alignment, size); + this.nested = nested; + } + + public static PackedData create(Data[] nested) { + int size = 0; + int alignment = 1; + for (int i = 0; i < nested.length; i++) { + assert size % nested[i].getAlignment() == 0 : "invalid alignment in packed constants"; + alignment = DataSection.lcm(alignment, nested[i].getAlignment()); + size += nested[i].getSize(); + } + return new PackedData(alignment, size, nested); + } + + @Override + protected void emit(ByteBuffer buffer, Patches patches) { + for (Data data : nested) { + data.emit(buffer, patches); + } + } + } + + private final ArrayList<Data> dataItems = new ArrayList<>(); + + private boolean closed; + private int sectionAlignment; + private int sectionSize; + + @Override + public int hashCode() { + // DataSection instances should not be used as hash map keys + throw new UnsupportedOperationException("hashCode"); + } + + @Override + public String toString() { + return identityHashCodeString(this); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj instanceof DataSection) { + DataSection that = (DataSection) obj; + if (this.closed == that.closed && this.sectionAlignment == that.sectionAlignment && this.sectionSize == that.sectionSize && Objects.equals(this.dataItems, that.dataItems)) { + return true; + } + } + return false; + } + + /** + * Inserts a {@link Data} item into the data section. If the item is already in the data + * section, the same {@link DataSectionReference} is returned. + * + * @param data the {@link Data} item to be inserted + * @return a unique {@link DataSectionReference} identifying the {@link Data} item + */ + public DataSectionReference insertData(Data data) { + checkOpen(); + synchronized (data) { + if (data.ref == null) { + data.ref = new DataSectionReference(); + dataItems.add(data); + } + return data.ref; + } + } + + /** + * Transfers all {@link Data} from the provided other {@link DataSection} to this + * {@link DataSection}, and empties the other section. + */ + public void addAll(DataSection other) { + checkOpen(); + other.checkOpen(); + + for (Data data : other.dataItems) { + assert data.ref != null; + dataItems.add(data); + } + other.dataItems.clear(); + } + + /** + * Determines if this object has been {@link #close() closed}. + */ + public boolean closed() { + return closed; + } + + /** + * Computes the layout of the data section and closes this object to further updates. + * + * This must be called exactly once. + */ + public void close() { + checkOpen(); + closed = true; + + // simple heuristic: put items with larger alignment requirement first + dataItems.sort((a, b) -> a.alignment - b.alignment); + + int position = 0; + int alignment = 1; + for (Data d : dataItems) { + alignment = lcm(alignment, d.alignment); + position = align(position, d.alignment); + + d.ref.setOffset(position); + position += d.size; + } + + sectionAlignment = alignment; + sectionSize = position; + } + + /** + * Gets the size of the data section. + * + * This must only be called once this object has been {@linkplain #closed() closed}. + */ + public int getSectionSize() { + checkClosed(); + return sectionSize; + } + + /** + * Gets the minimum alignment requirement of the data section. + * + * This must only be called once this object has been {@linkplain #closed() closed}. + */ + public int getSectionAlignment() { + checkClosed(); + return sectionAlignment; + } + + /** + * Builds the data section into a given buffer. + * + * This must only be called once this object has been {@linkplain #closed() closed}. + * + * @param buffer the {@link ByteBuffer} where the data section should be built. The buffer must + * hold at least {@link #getSectionSize()} bytes. + * @param patch a {@link Patches} instance to receive {@link VMConstant constants} for + * relocations in the data section + */ + public void buildDataSection(ByteBuffer buffer, Patches patch) { + checkClosed(); + for (Data d : dataItems) { + buffer.position(d.ref.getOffset()); + d.emit(buffer, patch); + } + } + + public Data findData(DataSectionReference ref) { + for (Data d : dataItems) { + if (d.ref == ref) { + return d; + } + } + return null; + } + + public Iterator<Data> iterator() { + return dataItems.iterator(); + } + + private static int lcm(int x, int y) { + if (x == 0) { + return y; + } else if (y == 0) { + return x; + } + + int a = Math.max(x, y); + int b = Math.min(x, y); + while (b > 0) { + int tmp = a % b; + a = b; + b = tmp; + } + + int gcd = a; + return x * y / gcd; + } + + private static int align(int position, int alignment) { + return ((position + alignment - 1) / alignment) * alignment; + } + + private void checkClosed() { + if (!closed) { + throw new IllegalStateException(); + } + } + + private void checkOpen() { + if (closed) { + throw new IllegalStateException(); + } + } + + public void clear() { + checkOpen(); + this.dataItems.clear(); + this.sectionAlignment = 0; + this.sectionSize = 0; + } +}
--- a/graal/com.oracle.graal.code/src/com/oracle/graal/code/DisassemblerProvider.java Fri Jan 15 16:30:38 2016 +0100 +++ b/graal/com.oracle.graal.code/src/com/oracle/graal/code/DisassemblerProvider.java Mon Jan 18 10:29:19 2016 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2016, 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 @@ -23,7 +23,6 @@ package com.oracle.graal.code; import jdk.vm.ci.code.CodeCacheProvider; -import jdk.vm.ci.code.CompilationResult; import jdk.vm.ci.code.InstalledCode; /**
--- a/graal/com.oracle.graal.code/src/com/oracle/graal/code/HexCodeFile.java Fri Jan 15 16:30:38 2016 +0100 +++ b/graal/com.oracle.graal.code/src/com/oracle/graal/code/HexCodeFile.java Mon Jan 18 10:29:19 2016 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2016, 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 @@ -32,10 +32,11 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; +import com.oracle.graal.code.CompilationResult.CodeAnnotation; +import com.oracle.graal.code.CompilationResult.CodeComment; +import com.oracle.graal.code.CompilationResult.JumpTable; + import jdk.vm.ci.code.CodeUtil; -import jdk.vm.ci.code.CompilationResult.CodeAnnotation; -import jdk.vm.ci.code.CompilationResult.CodeComment; -import jdk.vm.ci.code.CompilationResult.JumpTable; /** * A HexCodeFile is a textual format for representing a chunk of machine code along with extra
--- a/graal/com.oracle.graal.code/src/com/oracle/graal/code/HexCodeFileDisassemblerProvider.java Fri Jan 15 16:30:38 2016 +0100 +++ b/graal/com.oracle.graal.code/src/com/oracle/graal/code/HexCodeFileDisassemblerProvider.java Mon Jan 18 10:29:19 2016 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2016, 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 @@ -30,15 +30,15 @@ import jdk.vm.ci.code.CodeUtil; import jdk.vm.ci.code.CodeUtil.DefaultRefMapFormatter; import jdk.vm.ci.code.CodeUtil.RefMapFormatter; -import jdk.vm.ci.code.CompilationResult; -import jdk.vm.ci.code.CompilationResult.Call; -import jdk.vm.ci.code.CompilationResult.DataPatch; -import jdk.vm.ci.code.CompilationResult.Infopoint; -import jdk.vm.ci.code.CompilationResult.Mark; import jdk.vm.ci.code.InstalledCode; import jdk.vm.ci.code.Register; import jdk.vm.ci.code.RegisterConfig; import jdk.vm.ci.code.TargetDescription; +import jdk.vm.ci.code.site.Call; +import jdk.vm.ci.code.site.DataPatch; +import jdk.vm.ci.code.site.ExceptionHandler; +import jdk.vm.ci.code.site.Infopoint; +import jdk.vm.ci.code.site.Mark; import com.oracle.graal.serviceprovider.ServiceProvider; @@ -108,7 +108,7 @@ if (!compResult.getExceptionHandlers().isEmpty()) { String nl = HexCodeFile.NEW_LINE; StringBuilder buf = new StringBuilder("------ Exception Handlers ------").append(nl); - for (CompilationResult.ExceptionHandler e : compResult.getExceptionHandlers()) { + for (ExceptionHandler e : compResult.getExceptionHandlers()) { buf.append(" ").append(e.pcOffset).append(" -> ").append(e.handlerPos).append(nl); hcf.addComment(e.pcOffset, "[exception -> " + e.handlerPos + "]"); hcf.addComment(e.handlerPos, "[exception handler for " + e.pcOffset + "]"); @@ -127,6 +127,7 @@ */ static class HexCodeFileDisTool { static final MethodHandle processMethod; + static { MethodHandle toolMethod = null; try {
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerAssumptionsTest.java Fri Jan 15 16:30:38 2016 +0100 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerAssumptionsTest.java Mon Jan 18 10:29:19 2016 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, 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 @@ -23,12 +23,13 @@ package com.oracle.graal.compiler.test; import jdk.vm.ci.code.Architecture; -import jdk.vm.ci.code.CompilationResult; +import jdk.vm.ci.code.CompiledCode; import jdk.vm.ci.code.InstalledCode; import jdk.vm.ci.meta.Assumptions.Assumption; import jdk.vm.ci.meta.ResolvedJavaMethod; import jdk.vm.ci.meta.ResolvedJavaType; +import com.oracle.graal.code.CompilationResult; import com.oracle.graal.nodes.StructuredGraph; import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions; @@ -65,7 +66,8 @@ checkGraph(expectedAssumption, graph); CompilationResult compilationResult = compile(javaMethod, graph); - final InstalledCode installedCode = getProviders().getCodeCache().setDefaultCode(javaMethod, compilationResult); + CompiledCode compiledCode = getBackend().createCompiledCode(javaMethod, compilationResult); + final InstalledCode installedCode = getProviders().getCodeCache().setDefaultCode(javaMethod, compiledCode); assertTrue(installedCode.isValid()); if (classToLoad != null) { String fullName = getClass().getName() + "$" + classToLoad;
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java Fri Jan 15 16:30:38 2016 +0100 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java Mon Jan 18 10:29:19 2016 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2016, 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 @@ -44,7 +44,7 @@ import jdk.vm.ci.code.CallingConvention; import jdk.vm.ci.code.CallingConvention.Type; import jdk.vm.ci.code.CodeCacheProvider; -import jdk.vm.ci.code.CompilationResult; +import jdk.vm.ci.code.CompiledCode; import jdk.vm.ci.code.InstalledCode; import jdk.vm.ci.code.TargetDescription; import jdk.vm.ci.common.JVMCIError; @@ -68,6 +68,7 @@ import com.oracle.graal.api.directives.GraalDirectives; import com.oracle.graal.api.replacements.SnippetReflectionProvider; import com.oracle.graal.api.test.Graal; +import com.oracle.graal.code.CompilationResult; import com.oracle.graal.compiler.GraalCompiler; import com.oracle.graal.compiler.GraalCompiler.Request; import com.oracle.graal.compiler.target.Backend; @@ -785,7 +786,8 @@ } protected InstalledCode addMethod(final ResolvedJavaMethod method, final CompilationResult compResult) { - return getCodeCache().addCode(method, compResult, null, null); + CompiledCode compiledCode = backend.createCompiledCode(method, compResult); + return getCodeCache().addCode(method, compiledCode, null, null); } private final Map<ResolvedJavaMethod, Method> methodMap = new HashMap<>();
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/InfopointReasonTest.java Fri Jan 15 16:30:38 2016 +0100 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/InfopointReasonTest.java Mon Jan 18 10:29:19 2016 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2016, 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 @@ -28,14 +28,14 @@ import static org.junit.Assert.assertNotNull; import jdk.vm.ci.code.CallingConvention; import jdk.vm.ci.code.CallingConvention.Type; -import jdk.vm.ci.code.CompilationResult; -import jdk.vm.ci.code.CompilationResult.Call; -import jdk.vm.ci.code.CompilationResult.Infopoint; -import jdk.vm.ci.code.InfopointReason; +import jdk.vm.ci.code.site.Call; +import jdk.vm.ci.code.site.Infopoint; +import jdk.vm.ci.code.site.InfopointReason; import jdk.vm.ci.meta.ResolvedJavaMethod; import org.junit.Test; +import com.oracle.graal.code.CompilationResult; import com.oracle.graal.lir.asm.CompilationResultBuilderFactory; import com.oracle.graal.nodes.FullInfopointNode; import com.oracle.graal.nodes.StructuredGraph;
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/InterfaceMethodHandleTest.java Fri Jan 15 16:30:38 2016 +0100 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/InterfaceMethodHandleTest.java Mon Jan 18 10:29:19 2016 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, 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 @@ -30,12 +30,14 @@ import jdk.internal.org.objectweb.asm.Label; import jdk.internal.org.objectweb.asm.MethodVisitor; import jdk.internal.org.objectweb.asm.Opcodes; -import jdk.vm.ci.code.CompilationResult; +import jdk.vm.ci.code.CompiledCode; import jdk.vm.ci.code.InstalledCode; import jdk.vm.ci.meta.ResolvedJavaMethod; import org.junit.Test; +import com.oracle.graal.code.CompilationResult; + public final class InterfaceMethodHandleTest extends GraalCompilerTest implements Opcodes { private static final MethodHandle INTERFACE_HANDLE_M; private static final MethodHandle INTERFACE_HANDLE_M2; @@ -102,7 +104,8 @@ protected InstalledCode addMethod(ResolvedJavaMethod method, CompilationResult compResult) { if (method.getDeclaringClass().equals(getMetaAccess().lookupJavaType(M2Thrower.class))) { // Make sure M2Thrower.m2 is invoked from normal code - return getCodeCache().setDefaultCode(method, compResult); + CompiledCode compiledCode = getBackend().createCompiledCode(method, compResult); + return getCodeCache().setDefaultCode(method, compiledCode); } return super.addMethod(method, compResult); }
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/deopt/MonitorDeoptTest.java Fri Jan 15 16:30:38 2016 +0100 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/deopt/MonitorDeoptTest.java Mon Jan 18 10:29:19 2016 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2016, 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 @@ -24,13 +24,14 @@ */ package com.oracle.graal.compiler.test.deopt; -import jdk.vm.ci.code.CompilationResult; +import jdk.vm.ci.code.CompiledCode; import jdk.vm.ci.code.InstalledCode; import jdk.vm.ci.meta.ResolvedJavaMethod; import org.junit.Assert; import org.junit.Test; +import com.oracle.graal.code.CompilationResult; import com.oracle.graal.compiler.test.GraalCompilerTest; import com.oracle.graal.nodes.AbstractEndNode; import com.oracle.graal.nodes.FixedNode; @@ -144,7 +145,8 @@ removeLoopSafepoint(graph); CompilationResult compilationResult = compile(javaMethod, graph); - final InstalledCode installedCode = getProviders().getCodeCache().setDefaultCode(javaMethod, compilationResult); + CompiledCode compiledCode = getBackend().createCompiledCode(javaMethod, compilationResult); + final InstalledCode installedCode = getProviders().getCodeCache().setDefaultCode(javaMethod, compiledCode); final Monitor monitor = new Monitor();
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/inlining/InliningTest.java Fri Jan 15 16:30:38 2016 +0100 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/inlining/InliningTest.java Mon Jan 18 10:29:19 2016 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2016, 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 @@ -22,7 +22,7 @@ */ package com.oracle.graal.compiler.test.inlining; -import jdk.vm.ci.code.InfopointReason; +import jdk.vm.ci.code.site.InfopointReason; import jdk.vm.ci.meta.ResolvedJavaMethod; import org.junit.Ignore;
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/tutorial/InvokeGraal.java Fri Jan 15 16:30:38 2016 +0100 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/tutorial/InvokeGraal.java Mon Jan 18 10:29:19 2016 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, 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 @@ -29,13 +29,14 @@ import jdk.vm.ci.code.CallingConvention.Type; import jdk.vm.ci.code.CodeCacheProvider; import jdk.vm.ci.code.CodeUtil; -import jdk.vm.ci.code.CompilationResult; +import jdk.vm.ci.code.CompiledCode; import jdk.vm.ci.code.InstalledCode; import jdk.vm.ci.meta.MetaAccessProvider; import jdk.vm.ci.meta.ProfilingInfo; import jdk.vm.ci.meta.ResolvedJavaMethod; import com.oracle.graal.api.test.Graal; +import com.oracle.graal.code.CompilationResult; import com.oracle.graal.compiler.GraalCompiler; import com.oracle.graal.compiler.target.Backend; import com.oracle.graal.debug.Debug; @@ -138,7 +139,8 @@ * Install the compilation result into the VM, i.e., copy the byte[] array that contains * the machine code into an actual executable memory location. */ - InstalledCode installedCode = codeCache.addCode(method, compilationResult, null, null); + CompiledCode compiledCode = backend.createCompiledCode(method, compilationResult); + InstalledCode installedCode = codeCache.addCode(method, compiledCode, null, null); return installedCode; } catch (Throwable ex) {
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java Fri Jan 15 16:30:38 2016 +0100 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java Mon Jan 18 10:29:19 2016 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2016, 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 @@ -31,11 +31,10 @@ import java.util.List; import jdk.vm.ci.code.CallingConvention; -import jdk.vm.ci.code.CompilationResult; -import jdk.vm.ci.code.CompilationResult.ConstantReference; -import jdk.vm.ci.code.CompilationResult.DataPatch; import jdk.vm.ci.code.RegisterConfig; import jdk.vm.ci.code.TargetDescription; +import jdk.vm.ci.code.site.ConstantReference; +import jdk.vm.ci.code.site.DataPatch; import jdk.vm.ci.meta.Assumptions; import jdk.vm.ci.meta.JavaConstant; import jdk.vm.ci.meta.JavaKind; @@ -43,6 +42,7 @@ import jdk.vm.ci.meta.ResolvedJavaMethod; import jdk.vm.ci.meta.VMConstant; +import com.oracle.graal.code.CompilationResult; import com.oracle.graal.compiler.LIRGenerationPhase.LIRGenerationContext; import com.oracle.graal.compiler.common.alloc.ComputeBlockOrder; import com.oracle.graal.compiler.common.alloc.RegisterAllocationConfig;
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/NodeLIRBuilder.java Fri Jan 15 16:30:38 2016 +0100 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/NodeLIRBuilder.java Mon Jan 18 10:29:19 2016 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2016, 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 @@ -38,9 +38,9 @@ import jdk.vm.ci.code.BytecodePosition; import jdk.vm.ci.code.CallingConvention; -import jdk.vm.ci.code.InfopointReason; import jdk.vm.ci.code.StackSlot; import jdk.vm.ci.code.ValueUtil; +import jdk.vm.ci.code.site.InfopointReason; import jdk.vm.ci.common.JVMCIError; import jdk.vm.ci.meta.AllocatableValue; import jdk.vm.ci.meta.Constant;
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/target/Backend.java Fri Jan 15 16:30:38 2016 +0100 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/target/Backend.java Mon Jan 18 10:29:19 2016 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2016, 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 @@ -24,7 +24,7 @@ import jdk.vm.ci.code.CallingConvention; import jdk.vm.ci.code.CodeCacheProvider; -import jdk.vm.ci.code.CompilationResult; +import jdk.vm.ci.code.CompiledCode; import jdk.vm.ci.code.RegisterConfig; import jdk.vm.ci.code.TargetDescription; import jdk.vm.ci.common.JVMCIError; @@ -33,6 +33,7 @@ import jdk.vm.ci.meta.ResolvedJavaMethod; import com.oracle.graal.asm.Assembler; +import com.oracle.graal.code.CompilationResult; import com.oracle.graal.compiler.common.alloc.RegisterAllocationConfig; import com.oracle.graal.compiler.common.spi.ForeignCallDescriptor; import com.oracle.graal.compiler.common.spi.ForeignCallsProvider; @@ -132,6 +133,12 @@ CompilationResultBuilderFactory factory); /** + * Turns a Graal {@link CompilationResult} into a {@link CompiledCode} object that can be passed + * to the VM for code installation. + */ + public abstract CompiledCode createCompiledCode(ResolvedJavaMethod method, CompilationResult compilationResult); + + /** * Emits the code for a given graph. * * @param installedCodeOwner the method the compiled code will be associated with once
--- a/graal/com.oracle.graal.hotspot.aarch64/src/com/oracle/graal/hotspot/aarch64/AArch64HotSpotBackend.java Fri Jan 15 16:30:38 2016 +0100 +++ b/graal/com.oracle.graal.hotspot.aarch64/src/com/oracle/graal/hotspot/aarch64/AArch64HotSpotBackend.java Mon Jan 18 10:29:19 2016 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2016, 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 @@ -36,15 +36,27 @@ import java.lang.reflect.Field; import java.util.Set; +import jdk.vm.ci.code.CallingConvention; +import jdk.vm.ci.code.Register; +import jdk.vm.ci.code.RegisterConfig; +import jdk.vm.ci.code.StackSlot; +import jdk.vm.ci.hotspot.HotSpotVMConfig; +import jdk.vm.ci.hotspot.aarch64.AArch64HotSpotRegisterConfig; +import jdk.vm.ci.meta.JavaType; +import jdk.vm.ci.meta.ResolvedJavaMethod; +import sun.misc.Unsafe; + import com.oracle.graal.asm.Assembler; import com.oracle.graal.asm.Label; import com.oracle.graal.asm.aarch64.AArch64Address; import com.oracle.graal.asm.aarch64.AArch64Assembler; import com.oracle.graal.asm.aarch64.AArch64MacroAssembler; import com.oracle.graal.asm.aarch64.AArch64MacroAssembler.ScratchRegister; +import com.oracle.graal.code.CompilationResult; import com.oracle.graal.compiler.aarch64.AArch64NodeMatchRules; import com.oracle.graal.compiler.common.alloc.RegisterAllocationConfig; import com.oracle.graal.compiler.common.spi.ForeignCallLinkage; +import com.oracle.graal.hotspot.HotSpotDataBuilder; import com.oracle.graal.hotspot.HotSpotGraalRuntimeProvider; import com.oracle.graal.hotspot.HotSpotHostBackend; import com.oracle.graal.hotspot.meta.HotSpotForeignCallsProvider; @@ -56,6 +68,7 @@ import com.oracle.graal.lir.aarch64.AArch64FrameMapBuilder; import com.oracle.graal.lir.asm.CompilationResultBuilder; import com.oracle.graal.lir.asm.CompilationResultBuilderFactory; +import com.oracle.graal.lir.asm.DataBuilder; import com.oracle.graal.lir.asm.FrameContext; import com.oracle.graal.lir.framemap.FrameMap; import com.oracle.graal.lir.framemap.FrameMapBuilder; @@ -64,17 +77,6 @@ import com.oracle.graal.nodes.StructuredGraph; import com.oracle.graal.nodes.spi.NodeLIRBuilderTool; -import jdk.vm.ci.code.CallingConvention; -import jdk.vm.ci.code.CompilationResult; -import jdk.vm.ci.code.Register; -import jdk.vm.ci.code.RegisterConfig; -import jdk.vm.ci.code.StackSlot; -import jdk.vm.ci.hotspot.HotSpotVMConfig; -import jdk.vm.ci.hotspot.aarch64.AArch64HotSpotRegisterConfig; -import jdk.vm.ci.meta.JavaType; -import jdk.vm.ci.meta.ResolvedJavaMethod; -import sun.misc.Unsafe; - /** * HotSpot AArch64 specific backend. */ @@ -240,7 +242,8 @@ Assembler masm = createAssembler(frameMap); HotSpotFrameContext frameContext = new HotSpotFrameContext(stub != null); - CompilationResultBuilder crb = factory.createBuilder(getCodeCache(), getForeignCalls(), frameMap, masm, frameContext, compilationResult); + DataBuilder dataBuilder = new HotSpotDataBuilder(getCodeCache().getTarget()); + CompilationResultBuilder crb = factory.createBuilder(getCodeCache(), getForeignCalls(), frameMap, masm, dataBuilder, frameContext, compilationResult); crb.setTotalFrameSize(frameMap.frameSize()); StackSlot deoptimizationRescueSlot = gen.getDeoptimizationRescueSlot(); if (deoptimizationRescueSlot != null && stub == null) {
--- a/graal/com.oracle.graal.hotspot.aarch64/src/com/oracle/graal/hotspot/aarch64/AArch64HotSpotSafepointOp.java Fri Jan 15 16:30:38 2016 +0100 +++ b/graal/com.oracle.graal.hotspot.aarch64/src/com/oracle/graal/hotspot/aarch64/AArch64HotSpotSafepointOp.java Mon Jan 18 10:29:19 2016 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2016, 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 @@ -34,8 +34,8 @@ import com.oracle.graal.lir.aarch64.AArch64LIRInstruction; import com.oracle.graal.lir.asm.CompilationResultBuilder; -import jdk.vm.ci.code.InfopointReason; import jdk.vm.ci.code.Register; +import jdk.vm.ci.code.site.InfopointReason; import jdk.vm.ci.hotspot.HotSpotVMConfig; import jdk.vm.ci.meta.AllocatableValue;
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotBackend.java Fri Jan 15 16:30:38 2016 +0100 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotBackend.java Mon Jan 18 10:29:19 2016 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2016, 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 @@ -36,7 +36,6 @@ import jdk.vm.ci.amd64.AMD64; import jdk.vm.ci.code.CallingConvention; -import jdk.vm.ci.code.CompilationResult; import jdk.vm.ci.code.Register; import jdk.vm.ci.code.RegisterConfig; import jdk.vm.ci.code.StackSlot; @@ -50,11 +49,13 @@ import com.oracle.graal.asm.amd64.AMD64Address; import com.oracle.graal.asm.amd64.AMD64Assembler.ConditionFlag; import com.oracle.graal.asm.amd64.AMD64MacroAssembler; +import com.oracle.graal.code.CompilationResult; import com.oracle.graal.compiler.amd64.AMD64NodeMatchRules; import com.oracle.graal.compiler.common.alloc.RegisterAllocationConfig; import com.oracle.graal.compiler.gen.BytecodeLIRBuilder; import com.oracle.graal.compiler.gen.BytecodeParserTool; import com.oracle.graal.compiler.target.Backend; +import com.oracle.graal.hotspot.HotSpotDataBuilder; import com.oracle.graal.hotspot.HotSpotGraalRuntimeProvider; import com.oracle.graal.hotspot.HotSpotHostBackend; import com.oracle.graal.hotspot.meta.HotSpotForeignCallsProvider; @@ -66,6 +67,7 @@ import com.oracle.graal.lir.amd64.AMD64FrameMapBuilder; import com.oracle.graal.lir.asm.CompilationResultBuilder; import com.oracle.graal.lir.asm.CompilationResultBuilderFactory; +import com.oracle.graal.lir.asm.DataBuilder; import com.oracle.graal.lir.asm.FrameContext; import com.oracle.graal.lir.framemap.FrameMap; import com.oracle.graal.lir.framemap.FrameMapBuilder; @@ -234,7 +236,8 @@ Stub stub = gen.getStub(); Assembler masm = createAssembler(frameMap); HotSpotFrameContext frameContext = new HotSpotFrameContext(stub != null, omitFrame); - CompilationResultBuilder crb = factory.createBuilder(getCodeCache(), getForeignCalls(), frameMap, masm, frameContext, compilationResult); + DataBuilder dataBuilder = new HotSpotDataBuilder(getCodeCache().getTarget()); + CompilationResultBuilder crb = factory.createBuilder(getCodeCache(), getForeignCalls(), frameMap, masm, dataBuilder, frameContext, compilationResult); crb.setTotalFrameSize(frameMap.totalFrameSize()); StackSlot deoptimizationRescueSlot = gen.getDeoptimizationRescueSlot(); if (deoptimizationRescueSlot != null && stub == null) {
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotSafepointOp.java Fri Jan 15 16:30:38 2016 +0100 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotSafepointOp.java Mon Jan 18 10:29:19 2016 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2016, 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 @@ -26,9 +26,9 @@ import static com.oracle.graal.compiler.common.GraalOptions.ImmutableCode; import static jdk.vm.ci.amd64.AMD64.rax; import static jdk.vm.ci.amd64.AMD64.rip; -import jdk.vm.ci.code.InfopointReason; import jdk.vm.ci.code.Register; import jdk.vm.ci.code.RegisterValue; +import jdk.vm.ci.code.site.InfopointReason; import jdk.vm.ci.hotspot.HotSpotVMConfig; import jdk.vm.ci.meta.AllocatableValue; import jdk.vm.ci.meta.JavaConstant;
--- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotBackend.java Fri Jan 15 16:30:38 2016 +0100 +++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotBackend.java Mon Jan 18 10:29:19 2016 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2016, 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 @@ -44,9 +44,6 @@ import java.util.concurrent.ConcurrentHashMap; import jdk.vm.ci.code.CallingConvention; -import jdk.vm.ci.code.CompilationResult; -import jdk.vm.ci.code.DataSection; -import jdk.vm.ci.code.DataSection.Data; import jdk.vm.ci.code.Register; import jdk.vm.ci.code.RegisterConfig; import jdk.vm.ci.code.StackSlot; @@ -61,11 +58,15 @@ import com.oracle.graal.asm.sparc.SPARCAssembler; import com.oracle.graal.asm.sparc.SPARCMacroAssembler; import com.oracle.graal.asm.sparc.SPARCMacroAssembler.ScratchRegister; +import com.oracle.graal.code.CompilationResult; +import com.oracle.graal.code.DataSection; +import com.oracle.graal.code.DataSection.Data; import com.oracle.graal.compiler.common.alloc.RegisterAllocationConfig; import com.oracle.graal.compiler.common.cfg.AbstractBlockBase; import com.oracle.graal.compiler.sparc.SPARCNodeMatchRules; import com.oracle.graal.debug.Debug; import com.oracle.graal.debug.DebugMetric; +import com.oracle.graal.hotspot.HotSpotDataBuilder; import com.oracle.graal.hotspot.HotSpotGraalRuntimeProvider; import com.oracle.graal.hotspot.HotSpotHostBackend; import com.oracle.graal.hotspot.meta.HotSpotForeignCallsProvider; @@ -78,6 +79,7 @@ import com.oracle.graal.lir.StandardOp.SaveRegistersOp; import com.oracle.graal.lir.asm.CompilationResultBuilder; import com.oracle.graal.lir.asm.CompilationResultBuilderFactory; +import com.oracle.graal.lir.asm.DataBuilder; import com.oracle.graal.lir.asm.FrameContext; import com.oracle.graal.lir.framemap.FrameMap; import com.oracle.graal.lir.framemap.FrameMapBuilder; @@ -246,7 +248,8 @@ Assembler masm = createAssembler(frameMap); // On SPARC we always use stack frames. HotSpotFrameContext frameContext = new HotSpotFrameContext(stub != null); - CompilationResultBuilder crb = factory.createBuilder(getProviders().getCodeCache(), getProviders().getForeignCalls(), frameMap, masm, frameContext, compilationResult); + DataBuilder dataBuilder = new HotSpotDataBuilder(getCodeCache().getTarget()); + CompilationResultBuilder crb = factory.createBuilder(getProviders().getCodeCache(), getProviders().getForeignCalls(), frameMap, masm, dataBuilder, frameContext, compilationResult); crb.setTotalFrameSize(frameMap.totalFrameSize()); StackSlot deoptimizationRescueSlot = gen.getDeoptimizationRescueSlot(); if (deoptimizationRescueSlot != null && stub == null) {
--- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotSafepointOp.java Fri Jan 15 16:30:38 2016 +0100 +++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotSafepointOp.java Mon Jan 18 10:29:19 2016 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2016, 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 @@ -24,9 +24,9 @@ import static jdk.vm.ci.code.ValueUtil.asRegister; import static jdk.vm.ci.sparc.SPARC.g0; -import jdk.vm.ci.code.InfopointReason; import jdk.vm.ci.code.Register; import jdk.vm.ci.code.ValueUtil; +import jdk.vm.ci.code.site.InfopointReason; import jdk.vm.ci.hotspot.HotSpotVMConfig; import jdk.vm.ci.meta.AllocatableValue;
--- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/AheadOfTimeCompilationTest.java Fri Jan 15 16:30:38 2016 +0100 +++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/AheadOfTimeCompilationTest.java Mon Jan 18 10:29:19 2016 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2016, 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 @@ -28,7 +28,6 @@ import static jdk.vm.ci.code.CodeUtil.getCallingConvention; import jdk.vm.ci.code.CallingConvention; import jdk.vm.ci.code.CallingConvention.Type; -import jdk.vm.ci.code.CompilationResult; import jdk.vm.ci.hotspot.HotSpotResolvedObjectType; import jdk.vm.ci.meta.JavaConstant; import jdk.vm.ci.meta.JavaKind; @@ -39,6 +38,7 @@ import org.junit.Test; import com.oracle.graal.api.test.Graal; +import com.oracle.graal.code.CompilationResult; import com.oracle.graal.compiler.common.type.Stamp; import com.oracle.graal.compiler.test.GraalCompilerTest; import com.oracle.graal.graph.iterators.NodeIterable;
--- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/HotSpotCryptoSubstitutionTest.java Fri Jan 15 16:30:38 2016 +0100 +++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/HotSpotCryptoSubstitutionTest.java Mon Jan 18 10:29:19 2016 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2016, 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 @@ -38,21 +38,22 @@ import javax.crypto.KeyGenerator; import javax.crypto.SecretKey; -import jdk.vm.ci.code.CompilationResult; +import jdk.vm.ci.code.CompiledCode; import jdk.vm.ci.code.InstalledCode; import jdk.vm.ci.meta.ResolvedJavaMethod; import org.junit.Assert; import org.junit.Test; +import com.oracle.graal.code.CompilationResult; import com.oracle.graal.hotspot.meta.HotSpotGraphBuilderPlugins; import com.oracle.graal.hotspot.meta.HotSpotProviders; import com.oracle.graal.java.GraphBuilderPhase; import com.oracle.graal.nodes.StructuredGraph; import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions; import com.oracle.graal.nodes.graphbuilderconf.GraphBuilderConfiguration; +import com.oracle.graal.nodes.graphbuilderconf.GraphBuilderConfiguration.Plugins; import com.oracle.graal.nodes.graphbuilderconf.IntrinsicContext; -import com.oracle.graal.nodes.graphbuilderconf.GraphBuilderConfiguration.Plugins; import com.oracle.graal.phases.OptimisticOptimizations; /** @@ -62,7 +63,8 @@ @Override protected InstalledCode addMethod(ResolvedJavaMethod method, CompilationResult compResult) { - return getCodeCache().setDefaultCode(method, compResult); + CompiledCode compiledCode = getBackend().createCompiledCode(method, compResult); + return getCodeCache().setDefaultCode(method, compiledCode); } SecretKey aesKey;
--- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/HotSpotMonitorValueTest.java Fri Jan 15 16:30:38 2016 +0100 +++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/HotSpotMonitorValueTest.java Mon Jan 18 10:29:19 2016 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2016, 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 @@ -31,16 +31,16 @@ import java.util.List; import jdk.vm.ci.code.BytecodeFrame; -import jdk.vm.ci.code.CompilationResult; -import jdk.vm.ci.code.CompilationResult.Call; -import jdk.vm.ci.code.CompilationResult.Infopoint; import jdk.vm.ci.code.InstalledCode; import jdk.vm.ci.code.StackLockValue; +import jdk.vm.ci.code.site.Call; +import jdk.vm.ci.code.site.Infopoint; import jdk.vm.ci.common.JVMCIError; import jdk.vm.ci.meta.ResolvedJavaMethod; import org.junit.Test; +import com.oracle.graal.code.CompilationResult; import com.oracle.graal.compiler.test.GraalCompilerTest; public class HotSpotMonitorValueTest extends GraalCompilerTest {
--- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/JVMCIInfopointErrorTest.java Fri Jan 15 16:30:38 2016 +0100 +++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/JVMCIInfopointErrorTest.java Mon Jan 18 10:29:19 2016 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, 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 @@ -28,10 +28,10 @@ import java.util.function.Consumer; import jdk.vm.ci.code.BytecodeFrame; -import jdk.vm.ci.code.CompilationResult; -import jdk.vm.ci.code.InfopointReason; import jdk.vm.ci.code.VirtualObject; +import jdk.vm.ci.code.site.InfopointReason; import jdk.vm.ci.common.JVMCIError; +import jdk.vm.ci.hotspot.HotSpotCompiledCode; import jdk.vm.ci.meta.AllocatableValue; import jdk.vm.ci.meta.JavaConstant; import jdk.vm.ci.meta.JavaKind; @@ -44,11 +44,13 @@ import org.junit.Test; +import com.oracle.graal.code.CompilationResult; import com.oracle.graal.compiler.common.type.StampFactory; import com.oracle.graal.compiler.test.GraalCompilerTest; import com.oracle.graal.debug.Debug; import com.oracle.graal.debug.DebugConfigScope; import com.oracle.graal.graph.NodeClass; +import com.oracle.graal.hotspot.HotSpotCompiledCodeBuilder; import com.oracle.graal.lir.FullInfopointOp; import com.oracle.graal.lir.LIRFrameState; import com.oracle.graal.lir.LIRInstruction; @@ -134,7 +136,8 @@ graph.addAfterFixed(graph.start(), test); CompilationResult compResult = compile(method, graph); - getCodeCache().addCode(method, compResult, null, null); + HotSpotCompiledCode compiledCode = HotSpotCompiledCodeBuilder.createCompiledCode(method, null, compResult); + getCodeCache().addCode(method, compiledCode, null, null); } @Test(expected = JVMCIError.class)
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java Fri Jan 15 16:30:38 2016 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java Mon Jan 18 10:29:19 2016 +0100 @@ -35,9 +35,9 @@ import jdk.vm.ci.code.BailoutException; import jdk.vm.ci.code.CodeCacheProvider; import jdk.vm.ci.code.CompilationRequestResult; -import jdk.vm.ci.code.CompilationResult; import jdk.vm.ci.code.InstalledCode; import jdk.vm.ci.hotspot.HotSpotCompilationRequest; +import jdk.vm.ci.hotspot.HotSpotCompiledCode; import jdk.vm.ci.hotspot.HotSpotInstalledCode; import jdk.vm.ci.hotspot.HotSpotJVMCIRuntimeProvider; import jdk.vm.ci.hotspot.HotSpotNmethod; @@ -51,6 +51,7 @@ import jdk.vm.ci.services.Services; import sun.misc.Unsafe; +import com.oracle.graal.code.CompilationResult; import com.oracle.graal.debug.Debug; import com.oracle.graal.debug.Debug.Scope; import com.oracle.graal.debug.DebugCloseable; @@ -313,7 +314,8 @@ final CodeCacheProvider codeCache = jvmciRuntime.getHostJVMCIBackend().getCodeCache(); InstalledCode installedCode = null; try (Scope s = Debug.scope("CodeInstall", new DebugDumpScope(String.valueOf(getId()), true), codeCache, getMethod())) { - installedCode = codeCache.installCode(request, compResult, null, request.getMethod().getSpeculationLog(), installAsDefault); + HotSpotCompiledCode compiledCode = HotSpotCompiledCodeBuilder.createCompiledCode(request.getMethod(), request, compResult); + installedCode = codeCache.installCode(request.getMethod(), compiledCode, null, request.getMethod().getSpeculationLog(), installAsDefault); } catch (Throwable e) { throw Debug.handle(e); }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotBackend.java Fri Jan 15 16:30:38 2016 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotBackend.java Mon Jan 18 10:29:19 2016 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2016, 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 @@ -29,6 +29,7 @@ import java.util.Map; import java.util.Set; +import jdk.vm.ci.code.CompiledCode; import jdk.vm.ci.code.DebugInfo; import jdk.vm.ci.code.Register; import jdk.vm.ci.code.RegisterSaveLayout; @@ -36,8 +37,10 @@ import jdk.vm.ci.code.ValueUtil; import jdk.vm.ci.hotspot.HotSpotJVMCIRuntime; import jdk.vm.ci.hotspot.HotSpotVMConfig; +import jdk.vm.ci.meta.ResolvedJavaMethod; import jdk.vm.ci.meta.Value; +import com.oracle.graal.code.CompilationResult; import com.oracle.graal.compiler.common.cfg.AbstractBlockBase; import com.oracle.graal.compiler.common.spi.ForeignCallDescriptor; import com.oracle.graal.compiler.common.spi.ForeignCallLinkage; @@ -278,4 +281,9 @@ public ReferenceMapBuilder newReferenceMapBuilder(int totalFrameSize) { return new HotSpotReferenceMapBuilder(totalFrameSize); } + + @Override + public CompiledCode createCompiledCode(ResolvedJavaMethod method, CompilationResult compResult) { + return HotSpotCompiledCodeBuilder.createCompiledCode(method, null, compResult); + } }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotCompiledCodeBuilder.java Mon Jan 18 10:29:19 2016 +0100 @@ -0,0 +1,237 @@ +/* + * Copyright (c) 2012, 2016, 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.nio.ByteBuffer; +import java.nio.ByteOrder; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Comparator; +import java.util.EnumMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Stream; +import java.util.stream.Stream.Builder; + +import jdk.vm.ci.code.site.ConstantReference; +import jdk.vm.ci.code.site.DataPatch; +import jdk.vm.ci.code.site.Infopoint; +import jdk.vm.ci.code.site.InfopointReason; +import jdk.vm.ci.code.site.Mark; +import jdk.vm.ci.code.site.Site; +import jdk.vm.ci.common.JVMCIError; +import jdk.vm.ci.hotspot.HotSpotCompilationRequest; +import jdk.vm.ci.hotspot.HotSpotCompiledCode; +import jdk.vm.ci.hotspot.HotSpotCompiledCode.Comment; +import jdk.vm.ci.hotspot.HotSpotCompiledNmethod; +import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod; +import jdk.vm.ci.meta.Assumptions.Assumption; +import jdk.vm.ci.meta.ResolvedJavaMethod; + +import com.oracle.graal.code.CompilationResult; +import com.oracle.graal.code.CompilationResult.CodeAnnotation; +import com.oracle.graal.code.CompilationResult.CodeComment; +import com.oracle.graal.code.CompilationResult.JumpTable; +import com.oracle.graal.code.DataSection; + +public class HotSpotCompiledCodeBuilder { + + public static HotSpotCompiledCode createCompiledCode(ResolvedJavaMethod method, HotSpotCompilationRequest compRequest, CompilationResult compResult) { + String name = compResult.getName(); + + byte[] targetCode = compResult.getTargetCode(); + int targetCodeSize = compResult.getTargetCodeSize(); + + Site[] sites = getSortedSites(compResult); + + Assumption[] assumptions = compResult.getAssumptions(); + + ResolvedJavaMethod[] methods = compResult.getMethods(); + + List<CodeAnnotation> annotations = compResult.getAnnotations(); + Comment[] comments = new Comment[annotations.size()]; + if (!annotations.isEmpty()) { + for (int i = 0; i < comments.length; i++) { + CodeAnnotation annotation = annotations.get(i); + String text; + if (annotation instanceof CodeComment) { + CodeComment codeComment = (CodeComment) annotation; + text = codeComment.value; + } else if (annotation instanceof JumpTable) { + JumpTable jumpTable = (JumpTable) annotation; + text = "JumpTable [" + jumpTable.low + " .. " + jumpTable.high + "]"; + } else { + text = annotation.toString(); + } + comments[i] = new Comment(annotation.position, text); + } + } + + DataSection data = compResult.getDataSection(); + byte[] dataSection = new byte[data.getSectionSize()]; + + ByteBuffer buffer = ByteBuffer.wrap(dataSection).order(ByteOrder.nativeOrder()); + Builder<DataPatch> patchBuilder = Stream.builder(); + data.buildDataSection(buffer, vmConstant -> { + patchBuilder.accept(new DataPatch(buffer.position(), new ConstantReference(vmConstant))); + }); + + int dataSectionAlignment = data.getSectionAlignment(); + DataPatch[] dataSectionPatches = patchBuilder.build().toArray(len -> new DataPatch[len]); + + int totalFrameSize = compResult.getTotalFrameSize(); + int customStackAreaOffset = compResult.getCustomStackAreaOffset(); + + if (method instanceof HotSpotResolvedJavaMethod) { + HotSpotResolvedJavaMethod hsMethod = (HotSpotResolvedJavaMethod) method; + int entryBCI = compResult.getEntryBCI(); + boolean hasUnsafeAccess = compResult.hasUnsafeAccess(); + + int id; + long jvmciEnv; + if (compRequest != null) { + id = compRequest.getId(); + jvmciEnv = compRequest.getJvmciEnv(); + } else { + id = hsMethod.allocateCompileId(entryBCI); + jvmciEnv = 0L; + } + return new HotSpotCompiledNmethod(name, targetCode, targetCodeSize, sites, assumptions, methods, comments, dataSection, dataSectionAlignment, dataSectionPatches, totalFrameSize, + customStackAreaOffset, hsMethod, entryBCI, id, jvmciEnv, hasUnsafeAccess); + } else { + return new HotSpotCompiledCode(name, targetCode, targetCodeSize, sites, assumptions, methods, comments, dataSection, dataSectionAlignment, dataSectionPatches, totalFrameSize, + customStackAreaOffset); + } + } + + static class SiteComparator implements Comparator<Site> { + + /** + * Defines an order for sorting {@link Infopoint}s based on their + * {@linkplain Infopoint#reason reasons}. This is used to choose which infopoint to preserve + * when multiple infopoints collide on the same PC offset. A negative order value implies a + * non-optional infopoint (i.e., must be preserved). + */ + static final Map<InfopointReason, Integer> HOTSPOT_INFOPOINT_SORT_ORDER = new EnumMap<>(InfopointReason.class); + + static { + HOTSPOT_INFOPOINT_SORT_ORDER.put(InfopointReason.SAFEPOINT, -4); + HOTSPOT_INFOPOINT_SORT_ORDER.put(InfopointReason.CALL, -3); + HOTSPOT_INFOPOINT_SORT_ORDER.put(InfopointReason.IMPLICIT_EXCEPTION, -2); + HOTSPOT_INFOPOINT_SORT_ORDER.put(InfopointReason.METHOD_START, 2); + HOTSPOT_INFOPOINT_SORT_ORDER.put(InfopointReason.METHOD_END, 3); + HOTSPOT_INFOPOINT_SORT_ORDER.put(InfopointReason.BYTECODE_POSITION, 4); + } + + static int ord(Infopoint info) { + return HOTSPOT_INFOPOINT_SORT_ORDER.get(info.reason); + } + + static int checkCollision(Infopoint i1, Infopoint i2) { + int o1 = ord(i1); + int o2 = ord(i2); + if (o1 < 0 && o2 < 0) { + throw new JVMCIError("Non optional infopoints cannot collide: %s and %s", i1, i2); + } + return o1 - o2; + } + + /** + * Records whether any two {@link Infopoint}s had the same {@link Infopoint#pcOffset}. + */ + boolean sawCollidingInfopoints; + + public int compare(Site s1, Site s2) { + if (s1.pcOffset == s2.pcOffset) { + // Marks must come first since patching a call site + // may need to know the mark denoting the call type + // (see uses of CodeInstaller::_next_call_type). + boolean s1IsMark = s1 instanceof Mark; + boolean s2IsMark = s2 instanceof Mark; + if (s1IsMark != s2IsMark) { + return s1IsMark ? -1 : 1; + } + + // Infopoints must group together so put them after + // other Site types. + boolean s1IsInfopoint = s1 instanceof Infopoint; + boolean s2IsInfopoint = s2 instanceof Infopoint; + if (s1IsInfopoint != s2IsInfopoint) { + return s1IsInfopoint ? 1 : -1; + } + + if (s1IsInfopoint) { + sawCollidingInfopoints = true; + return checkCollision((Infopoint) s1, (Infopoint) s2); + } + } + return s1.pcOffset - s2.pcOffset; + } + } + + /** + * HotSpot expects sites to be presented in ascending order of PC (see + * {@code DebugInformationRecorder::add_new_pc_offset}). In addition, it expects + * {@link Infopoint} PCs to be unique. + */ + private static Site[] getSortedSites(CompilationResult target) { + List<?>[] lists = new List<?>[]{target.getExceptionHandlers(), target.getInfopoints(), target.getDataPatches(), target.getMarks()}; + int count = 0; + for (List<?> list : lists) { + if (list != null) { + count += list.size(); + } + } + Site[] result = new Site[count]; + int pos = 0; + for (List<?> list : lists) { + if (list != null) { + for (Object elem : list) { + result[pos++] = (Site) elem; + } + } + } + SiteComparator c = new SiteComparator(); + Arrays.sort(result, c); + if (c.sawCollidingInfopoints) { + Infopoint lastInfopoint = null; + List<Site> copy = new ArrayList<>(count); + for (int i = 0; i < count; i++) { + if (result[i] instanceof Infopoint) { + Infopoint info = (Infopoint) result[i]; + if (lastInfopoint == null || lastInfopoint.pcOffset != info.pcOffset) { + lastInfopoint = info; + copy.add(info); + } else { + // Omit this colliding infopoint + assert lastInfopoint.reason.compareTo(info.reason) <= 0; + } + } else { + copy.add(result[i]); + } + } + result = copy.toArray(new Site[copy.size()]); + } + return result; + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotDataBuilder.java Mon Jan 18 10:29:19 2016 +0100 @@ -0,0 +1,95 @@ +/* + * Copyright (c) 2015, 2016, 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 static jdk.vm.ci.hotspot.HotSpotCompressedNullConstant.COMPRESSED_NULL; + +import java.nio.ByteBuffer; + +import jdk.vm.ci.code.TargetDescription; +import jdk.vm.ci.common.JVMCIError; +import jdk.vm.ci.hotspot.HotSpotConstant; +import jdk.vm.ci.meta.Constant; +import jdk.vm.ci.meta.JavaConstant; +import jdk.vm.ci.meta.SerializableConstant; +import jdk.vm.ci.meta.VMConstant; + +import com.oracle.graal.code.DataSection.Data; +import com.oracle.graal.code.DataSection.Patches; +import com.oracle.graal.code.DataSection.SerializableData; +import com.oracle.graal.code.DataSection.ZeroData; +import com.oracle.graal.lir.asm.DataBuilder; + +public class HotSpotDataBuilder extends DataBuilder { + + private final TargetDescription target; + + public HotSpotDataBuilder(TargetDescription target) { + this.target = target; + } + + @Override + public Data createDataItem(Constant constant) { + int size; + if (constant instanceof VMConstant) { + VMConstant vmConstant = (VMConstant) constant; + boolean compressed; + if (constant instanceof HotSpotConstant) { + HotSpotConstant c = (HotSpotConstant) vmConstant; + compressed = c.isCompressed(); + } else { + throw new JVMCIError(String.valueOf(constant)); + } + + size = compressed ? 4 : target.wordSize; + if (size == 4) { + return new Data(size, size) { + + @Override + protected void emit(ByteBuffer buffer, Patches patches) { + patches.registerPatch(vmConstant); + buffer.putInt(0xDEADDEAD); + } + }; + } else { + return new Data(size, size) { + + @Override + protected void emit(ByteBuffer buffer, Patches patches) { + patches.registerPatch(vmConstant); + buffer.putLong(0xDEADDEADDEADDEADL); + } + }; + } + } else if (JavaConstant.isNull(constant)) { + boolean compressed = COMPRESSED_NULL.equals(constant); + size = compressed ? 4 : target.wordSize; + return ZeroData.create(size, size); + } else if (constant instanceof SerializableConstant) { + SerializableConstant s = (SerializableConstant) constant; + return new SerializableData(s); + } else { + throw new JVMCIError(String.valueOf(constant)); + } + } +}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalCompiler.java Fri Jan 15 16:30:38 2016 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalCompiler.java Mon Jan 18 10:29:19 2016 +0100 @@ -31,7 +31,6 @@ import jdk.vm.ci.code.CallingConvention.Type; import jdk.vm.ci.code.CompilationRequest; import jdk.vm.ci.code.CompilationRequestResult; -import jdk.vm.ci.code.CompilationResult; import jdk.vm.ci.hotspot.HotSpotCodeCacheProvider; import jdk.vm.ci.hotspot.HotSpotCompilationRequest; import jdk.vm.ci.hotspot.HotSpotJVMCIRuntimeProvider; @@ -44,6 +43,7 @@ import jdk.vm.ci.runtime.JVMCICompiler; import com.oracle.graal.api.runtime.GraalJVMCICompiler; +import com.oracle.graal.code.CompilationResult; import com.oracle.graal.compiler.GraalCompiler; import com.oracle.graal.debug.Debug; import com.oracle.graal.debug.DebugConfigScope;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalVMEventListener.java Fri Jan 15 16:30:38 2016 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalVMEventListener.java Mon Jan 18 10:29:19 2016 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, 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 @@ -24,7 +24,7 @@ import java.util.ArrayList; -import jdk.vm.ci.code.CompilationResult; +import jdk.vm.ci.code.CompiledCode; import jdk.vm.ci.code.InstalledCode; import jdk.vm.ci.hotspot.HotSpotCodeCacheProvider; import jdk.vm.ci.hotspot.HotSpotVMEventListener; @@ -49,9 +49,9 @@ } @Override - public void notifyInstall(HotSpotCodeCacheProvider codeCache, InstalledCode installedCode, CompilationResult compResult) { + public void notifyInstall(HotSpotCodeCacheProvider codeCache, InstalledCode installedCode, CompiledCode compiledCode) { if (Debug.isDumpEnabled()) { - Debug.dump(new Object[]{compResult, installedCode}, "After code installation"); + Debug.dump(new Object[]{compiledCode, installedCode}, "After code installation"); } if (Debug.isLogEnabled()) { Debug.log("%s", codeCache.disassemble(installedCode));
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotDisassemblerProvider.java Fri Jan 15 16:30:38 2016 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotDisassemblerProvider.java Mon Jan 18 10:29:19 2016 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2016, 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 @@ -23,10 +23,10 @@ package com.oracle.graal.hotspot.meta; import jdk.vm.ci.code.CodeCacheProvider; -import jdk.vm.ci.code.CompilationResult; import jdk.vm.ci.code.InstalledCode; import jdk.vm.ci.hotspot.HotSpotCodeCacheProvider; +import com.oracle.graal.code.CompilationResult; import com.oracle.graal.code.DisassemblerProvider; import com.oracle.graal.serviceprovider.ServiceProvider;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/Stub.java Fri Jan 15 16:30:38 2016 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/Stub.java Mon Jan 18 10:29:19 2016 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2016, 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 @@ -31,23 +31,25 @@ import jdk.vm.ci.code.CallingConvention; import jdk.vm.ci.code.CodeCacheProvider; -import jdk.vm.ci.code.CompilationResult; -import jdk.vm.ci.code.CompilationResult.Call; -import jdk.vm.ci.code.CompilationResult.ConstantReference; -import jdk.vm.ci.code.CompilationResult.DataPatch; -import jdk.vm.ci.code.CompilationResult.Infopoint; import jdk.vm.ci.code.InstalledCode; import jdk.vm.ci.code.Register; import jdk.vm.ci.code.RegisterConfig; +import jdk.vm.ci.code.site.Call; +import jdk.vm.ci.code.site.ConstantReference; +import jdk.vm.ci.code.site.DataPatch; +import jdk.vm.ci.code.site.Infopoint; +import jdk.vm.ci.hotspot.HotSpotCompiledCode; import jdk.vm.ci.hotspot.HotSpotMetaspaceConstant; import jdk.vm.ci.meta.DefaultProfilingInfo; import jdk.vm.ci.meta.ResolvedJavaMethod; import jdk.vm.ci.meta.TriState; +import com.oracle.graal.code.CompilationResult; import com.oracle.graal.compiler.target.Backend; import com.oracle.graal.debug.Debug; import com.oracle.graal.debug.Debug.Scope; import com.oracle.graal.debug.internal.DebugScope; +import com.oracle.graal.hotspot.HotSpotCompiledCodeBuilder; import com.oracle.graal.hotspot.HotSpotForeignCallLinkage; import com.oracle.graal.hotspot.meta.HotSpotProviders; import com.oracle.graal.hotspot.nodes.StubStartNode; @@ -192,7 +194,8 @@ assert destroyedRegisters != null; try (Scope s = Debug.scope("CodeInstall")) { - code = codeCache.installCode(null, compResult, null, null, false); + HotSpotCompiledCode compiledCode = HotSpotCompiledCodeBuilder.createCompiledCode(null, null, compResult); + code = codeCache.installCode(null, compiledCode, null, null, false); } catch (Throwable e) { throw Debug.handle(e); }
--- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/BytecodeParser.java Fri Jan 15 16:30:38 2016 +0100 +++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/BytecodeParser.java Mon Jan 18 10:29:19 2016 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2016, 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 @@ -260,7 +260,7 @@ import jdk.vm.ci.code.BytecodeFrame; import jdk.vm.ci.code.BytecodePosition; import jdk.vm.ci.code.CodeUtil; -import jdk.vm.ci.code.InfopointReason; +import jdk.vm.ci.code.site.InfopointReason; import jdk.vm.ci.common.JVMCIError; import jdk.vm.ci.meta.ConstantPool; import jdk.vm.ci.meta.ConstantReflectionProvider; @@ -379,11 +379,11 @@ import com.oracle.graal.nodes.graphbuilderconf.GraphBuilderConfiguration; import com.oracle.graal.nodes.graphbuilderconf.GraphBuilderContext; import com.oracle.graal.nodes.graphbuilderconf.InlineInvokePlugin; +import com.oracle.graal.nodes.graphbuilderconf.InlineInvokePlugin.InlineInfo; import com.oracle.graal.nodes.graphbuilderconf.IntrinsicContext; import com.oracle.graal.nodes.graphbuilderconf.InvocationPlugin; +import com.oracle.graal.nodes.graphbuilderconf.InvocationPlugins.InvocationPluginReceiver; import com.oracle.graal.nodes.graphbuilderconf.NodePlugin; -import com.oracle.graal.nodes.graphbuilderconf.InlineInvokePlugin.InlineInfo; -import com.oracle.graal.nodes.graphbuilderconf.InvocationPlugins.InvocationPluginReceiver; import com.oracle.graal.nodes.java.ArrayLengthNode; import com.oracle.graal.nodes.java.CheckCastNode; import com.oracle.graal.nodes.java.ExceptionObjectNode;
--- a/graal/com.oracle.graal.lir.aarch64/src/com/oracle/graal/lir/aarch64/AArch64ControlFlow.java Fri Jan 15 16:30:38 2016 +0100 +++ b/graal/com.oracle.graal.lir.aarch64/src/com/oracle/graal/lir/aarch64/AArch64ControlFlow.java Mon Jan 18 10:29:19 2016 +0100 @@ -28,7 +28,6 @@ import java.util.function.Function; import jdk.vm.ci.aarch64.AArch64Kind; -import jdk.vm.ci.code.CompilationResult.JumpTable; import jdk.vm.ci.code.Register; import jdk.vm.ci.common.JVMCIError; import jdk.vm.ci.meta.Constant; @@ -42,6 +41,7 @@ import com.oracle.graal.asm.aarch64.AArch64Assembler; import com.oracle.graal.asm.aarch64.AArch64MacroAssembler; import com.oracle.graal.asm.aarch64.AArch64MacroAssembler.PatchLabelKind; +import com.oracle.graal.code.CompilationResult.JumpTable; import com.oracle.graal.compiler.common.calc.Condition; import com.oracle.graal.lir.ConstantValue; import com.oracle.graal.lir.LIRInstructionClass;
--- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Binary.java Fri Jan 15 16:30:38 2016 +0100 +++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Binary.java Mon Jan 18 10:29:19 2016 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, 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 @@ -31,7 +31,7 @@ import static jdk.vm.ci.code.ValueUtil.isRegister; import static jdk.vm.ci.code.ValueUtil.isStackSlot; import static jdk.vm.ci.code.ValueUtil.sameRegister; -import jdk.vm.ci.code.CompilationResult.DataSectionReference; +import jdk.vm.ci.code.site.DataSectionReference; import jdk.vm.ci.meta.AllocatableValue; import jdk.vm.ci.meta.JavaConstant; import jdk.vm.ci.meta.Value;
--- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64BinaryConsumer.java Fri Jan 15 16:30:38 2016 +0100 +++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64BinaryConsumer.java Mon Jan 18 10:29:19 2016 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, 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 @@ -29,7 +29,7 @@ import static jdk.vm.ci.code.ValueUtil.asRegister; import static jdk.vm.ci.code.ValueUtil.isRegister; import static jdk.vm.ci.code.ValueUtil.isStackSlot; -import jdk.vm.ci.code.CompilationResult.DataSectionReference; +import jdk.vm.ci.code.site.DataSectionReference; import jdk.vm.ci.meta.AllocatableValue; import jdk.vm.ci.meta.Constant; import jdk.vm.ci.meta.VMConstant;
--- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64ControlFlow.java Fri Jan 15 16:30:38 2016 +0100 +++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64ControlFlow.java Mon Jan 18 10:29:19 2016 +0100 @@ -31,7 +31,6 @@ import static jdk.vm.ci.code.ValueUtil.isRegister; import jdk.vm.ci.amd64.AMD64; import jdk.vm.ci.amd64.AMD64Kind; -import jdk.vm.ci.code.CompilationResult.JumpTable; import jdk.vm.ci.code.Register; import jdk.vm.ci.common.JVMCIError; import jdk.vm.ci.meta.AllocatableValue; @@ -44,6 +43,7 @@ import com.oracle.graal.asm.amd64.AMD64Address; import com.oracle.graal.asm.amd64.AMD64Address.Scale; import com.oracle.graal.asm.amd64.AMD64Assembler.ConditionFlag; +import com.oracle.graal.code.CompilationResult.JumpTable; import com.oracle.graal.asm.amd64.AMD64MacroAssembler; import com.oracle.graal.compiler.common.calc.Condition; import com.oracle.graal.lir.LIRInstructionClass;
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/FullInfopointOp.java Fri Jan 15 16:30:38 2016 +0100 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/FullInfopointOp.java Mon Jan 18 10:29:19 2016 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2016, 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 @@ -22,9 +22,9 @@ */ package com.oracle.graal.lir; -import jdk.vm.ci.code.InfopointReason; +import com.oracle.graal.lir.asm.CompilationResultBuilder; -import com.oracle.graal.lir.asm.CompilationResultBuilder; +import jdk.vm.ci.code.site.InfopointReason; /** * Emits an infopoint (only mark the position).
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/SimpleInfopointOp.java Fri Jan 15 16:30:38 2016 +0100 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/SimpleInfopointOp.java Mon Jan 18 10:29:19 2016 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -24,7 +24,7 @@ import jdk.vm.ci.code.BytecodePosition; import jdk.vm.ci.code.DebugInfo; -import jdk.vm.ci.code.InfopointReason; +import jdk.vm.ci.code.site.InfopointReason; import com.oracle.graal.lir.asm.CompilationResultBuilder;
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/asm/CompilationResultBuilder.java Fri Jan 15 16:30:38 2016 +0100 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/asm/CompilationResultBuilder.java Mon Jan 18 10:29:19 2016 +0100 @@ -34,15 +34,13 @@ import java.util.function.Consumer; import jdk.vm.ci.code.CodeCacheProvider; -import jdk.vm.ci.code.CompilationResult; -import jdk.vm.ci.code.CompilationResult.ConstantReference; -import jdk.vm.ci.code.CompilationResult.DataSectionReference; -import jdk.vm.ci.code.DataSection.Data; -import jdk.vm.ci.code.DataSection.DataBuilder; import jdk.vm.ci.code.DebugInfo; -import jdk.vm.ci.code.InfopointReason; import jdk.vm.ci.code.StackSlot; import jdk.vm.ci.code.TargetDescription; +import jdk.vm.ci.code.site.ConstantReference; +import jdk.vm.ci.code.site.DataSectionReference; +import jdk.vm.ci.code.site.InfopointReason; +import jdk.vm.ci.code.site.Mark; import jdk.vm.ci.common.JVMCIError; import jdk.vm.ci.meta.Constant; import jdk.vm.ci.meta.InvokeTarget; @@ -54,6 +52,9 @@ import com.oracle.graal.asm.AbstractAddress; import com.oracle.graal.asm.Assembler; import com.oracle.graal.asm.NumUtil; +import com.oracle.graal.code.CompilationResult; +import com.oracle.graal.code.DataSection.Data; +import com.oracle.graal.code.DataSection.RawData; import com.oracle.graal.compiler.common.cfg.AbstractBlockBase; import com.oracle.graal.compiler.common.spi.ForeignCallsProvider; import com.oracle.graal.debug.Debug; @@ -90,6 +91,7 @@ } public final Assembler asm; + public final DataBuilder dataBuilder; public final CompilationResult compilationResult; public final TargetDescription target; public final CodeCacheProvider codeCache; @@ -118,12 +120,14 @@ private Consumer<LIRInstruction> beforeOp; private Consumer<LIRInstruction> afterOp; - public CompilationResultBuilder(CodeCacheProvider codeCache, ForeignCallsProvider foreignCalls, FrameMap frameMap, Assembler asm, FrameContext frameContext, CompilationResult compilationResult) { + public CompilationResultBuilder(CodeCacheProvider codeCache, ForeignCallsProvider foreignCalls, FrameMap frameMap, Assembler asm, DataBuilder dataBuilder, FrameContext frameContext, + CompilationResult compilationResult) { this.target = codeCache.getTarget(); this.codeCache = codeCache; this.foreignCalls = foreignCalls; this.frameMap = frameMap; this.asm = asm; + this.dataBuilder = dataBuilder; this.compilationResult = compilationResult; this.frameContext = frameContext; assert frameContext != null; @@ -136,7 +140,7 @@ compilationResult.setTotalFrameSize(frameSize); } - public CompilationResult.Mark recordMark(Object id) { + public Mark recordMark(Object id) { return compilationResult.recordMark(asm.position(), id); } @@ -227,7 +231,7 @@ Debug.log("Constant reference in code: pos = %d, data = %s", asm.position(), constant); Data data = dataCache.get(constant); if (data == null) { - data = codeCache.createDataItem(constant); + data = dataBuilder.createDataItem(constant); dataCache.put(constant, data); } data.updateAlignment(alignment); @@ -239,7 +243,7 @@ if (Debug.isLogEnabled()) { Debug.log("Data reference in code: pos = %d, data = %s", asm.position(), Arrays.toString(data)); } - return recordDataSectionReference(new Data(alignment, data.length, DataBuilder.raw(data))); + return recordDataSectionReference(new RawData(data, alignment)); } /**
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/asm/CompilationResultBuilderFactory.java Fri Jan 15 16:30:38 2016 +0100 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/asm/CompilationResultBuilderFactory.java Mon Jan 18 10:29:19 2016 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2016, 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 @@ -23,9 +23,9 @@ package com.oracle.graal.lir.asm; import jdk.vm.ci.code.CodeCacheProvider; -import jdk.vm.ci.code.CompilationResult; import com.oracle.graal.asm.Assembler; +import com.oracle.graal.code.CompilationResult; import com.oracle.graal.compiler.common.spi.ForeignCallsProvider; import com.oracle.graal.lir.framemap.FrameMap; @@ -37,7 +37,7 @@ /** * Creates a new {@link CompilationResultBuilder}. */ - CompilationResultBuilder createBuilder(CodeCacheProvider codeCache, ForeignCallsProvider foreignCalls, FrameMap frameMap, Assembler asm, FrameContext frameContext, + CompilationResultBuilder createBuilder(CodeCacheProvider codeCache, ForeignCallsProvider foreignCalls, FrameMap frameMap, Assembler asm, DataBuilder dataBuilder, FrameContext frameContext, CompilationResult compilationResult); /** @@ -45,9 +45,9 @@ */ CompilationResultBuilderFactory Default = new CompilationResultBuilderFactory() { - public CompilationResultBuilder createBuilder(CodeCacheProvider codeCache, ForeignCallsProvider foreignCalls, FrameMap frameMap, Assembler asm, FrameContext frameContext, - CompilationResult compilationResult) { - return new CompilationResultBuilder(codeCache, foreignCalls, frameMap, asm, frameContext, compilationResult); + public CompilationResultBuilder createBuilder(CodeCacheProvider codeCache, ForeignCallsProvider foreignCalls, FrameMap frameMap, Assembler asm, DataBuilder dataBuilder, + FrameContext frameContext, CompilationResult compilationResult) { + return new CompilationResultBuilder(codeCache, foreignCalls, frameMap, asm, dataBuilder, frameContext, compilationResult); } }; }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/asm/DataBuilder.java Mon Jan 18 10:29:19 2016 +0100 @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2015, 2016, 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.lir.asm; + +import jdk.vm.ci.meta.Constant; + +import com.oracle.graal.code.DataSection.Data; + +public abstract class DataBuilder { + + public abstract Data createDataItem(Constant c); +}
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/gen/LIRGenerator.java Fri Jan 15 16:30:38 2016 +0100 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/gen/LIRGenerator.java Mon Jan 18 10:29:19 2016 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2016, 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 @@ -37,10 +37,10 @@ import jdk.vm.ci.code.BytecodePosition; import jdk.vm.ci.code.CallingConvention; import jdk.vm.ci.code.CodeCacheProvider; -import jdk.vm.ci.code.InfopointReason; import jdk.vm.ci.code.Register; import jdk.vm.ci.code.RegisterAttributes; import jdk.vm.ci.code.TargetDescription; +import jdk.vm.ci.code.site.InfopointReason; import jdk.vm.ci.common.JVMCIError; import jdk.vm.ci.meta.AllocatableValue; import jdk.vm.ci.meta.Constant;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FullInfopointNode.java Fri Jan 15 16:30:38 2016 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FullInfopointNode.java Mon Jan 18 10:29:19 2016 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2016, 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 @@ -22,7 +22,7 @@ */ package com.oracle.graal.nodes; -import jdk.vm.ci.code.InfopointReason; +import jdk.vm.ci.code.site.InfopointReason; import com.oracle.graal.graph.NodeClass; import com.oracle.graal.graph.spi.Simplifiable;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/InfopointNode.java Fri Jan 15 16:30:38 2016 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/InfopointNode.java Mon Jan 18 10:29:19 2016 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -22,7 +22,7 @@ */ package com.oracle.graal.nodes; -import jdk.vm.ci.code.InfopointReason; +import jdk.vm.ci.code.site.InfopointReason; import com.oracle.graal.compiler.common.type.StampFactory; import com.oracle.graal.graph.NodeClass;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/SimpleInfopointNode.java Fri Jan 15 16:30:38 2016 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/SimpleInfopointNode.java Mon Jan 18 10:29:19 2016 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -23,7 +23,7 @@ package com.oracle.graal.nodes; import jdk.vm.ci.code.BytecodePosition; -import jdk.vm.ci.code.InfopointReason; +import jdk.vm.ci.code.site.InfopointReason; import com.oracle.graal.graph.IterableNodeType; import com.oracle.graal.graph.NodeClass;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/NodeLIRBuilderTool.java Fri Jan 15 16:30:38 2016 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/NodeLIRBuilderTool.java Mon Jan 18 10:29:19 2016 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2016, 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 @@ -27,7 +27,7 @@ import jdk.vm.ci.code.BytecodePosition; import jdk.vm.ci.code.CallingConvention; -import jdk.vm.ci.code.InfopointReason; +import jdk.vm.ci.code.site.InfopointReason; import jdk.vm.ci.meta.Value; import com.oracle.graal.compiler.common.cfg.BlockMap;
--- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CFGPrinterObserver.java Fri Jan 15 16:30:38 2016 +0100 +++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CFGPrinterObserver.java Mon Jan 18 10:29:19 2016 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2016, 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 @@ -35,13 +35,13 @@ import java.util.concurrent.atomic.AtomicInteger; import jdk.vm.ci.code.CodeCacheProvider; -import jdk.vm.ci.code.CompilationResult; import jdk.vm.ci.code.InstalledCode; import jdk.vm.ci.common.JVMCIError; import jdk.vm.ci.meta.JavaMethod; import jdk.vm.ci.meta.ResolvedJavaMethod; import jdk.vm.ci.services.Services; +import com.oracle.graal.code.CompilationResult; import com.oracle.graal.code.DisassemblerProvider; import com.oracle.graal.compiler.common.GraalOptions; import com.oracle.graal.compiler.common.cfg.AbstractBlockBase;
--- a/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/InstanceOfTest.java Fri Jan 15 16:30:38 2016 +0100 +++ b/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/InstanceOfTest.java Mon Jan 18 10:29:19 2016 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2016, 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 @@ -28,9 +28,9 @@ import java.util.Map; import java.util.TreeMap; -import jdk.vm.ci.code.CompilationResult.Call; -import jdk.vm.ci.code.CompilationResult.Mark; -import jdk.vm.ci.code.CompilationResult.Site; +import jdk.vm.ci.code.site.Call; +import jdk.vm.ci.code.site.Mark; +import jdk.vm.ci.code.site.Site; import jdk.vm.ci.meta.JavaTypeProfile; import org.junit.Test;
--- a/graal/com.oracle.graal.truffle.hotspot.amd64/src/com/oracle/graal/truffle/hotspot/amd64/AMD64OptimizedCallTargetInstrumentationFactory.java Fri Jan 15 16:30:38 2016 +0100 +++ b/graal/com.oracle.graal.truffle.hotspot.amd64/src/com/oracle/graal/truffle/hotspot/amd64/AMD64OptimizedCallTargetInstrumentationFactory.java Mon Jan 18 10:29:19 2016 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2016, 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 @@ -25,7 +25,6 @@ import jdk.vm.ci.amd64.AMD64; import jdk.vm.ci.code.CallingConvention.Type; import jdk.vm.ci.code.CodeCacheProvider; -import jdk.vm.ci.code.CompilationResult; import jdk.vm.ci.code.InstalledCode; import jdk.vm.ci.code.Register; import jdk.vm.ci.meta.JavaKind; @@ -35,8 +34,10 @@ import com.oracle.graal.asm.amd64.AMD64Address; import com.oracle.graal.asm.amd64.AMD64Assembler.ConditionFlag; import com.oracle.graal.asm.amd64.AMD64MacroAssembler; +import com.oracle.graal.code.CompilationResult; import com.oracle.graal.compiler.common.spi.ForeignCallsProvider; import com.oracle.graal.lir.asm.CompilationResultBuilder; +import com.oracle.graal.lir.asm.DataBuilder; import com.oracle.graal.lir.asm.FrameContext; import com.oracle.graal.lir.framemap.FrameMap; import com.oracle.graal.serviceprovider.ServiceProvider; @@ -46,9 +47,9 @@ @ServiceProvider(OptimizedCallTargetInstrumentationFactory.class) public class AMD64OptimizedCallTargetInstrumentationFactory extends OptimizedCallTargetInstrumentationFactory { - public CompilationResultBuilder createBuilder(CodeCacheProvider codeCache, ForeignCallsProvider foreignCalls, FrameMap frameMap, Assembler asm, FrameContext frameContext, + public CompilationResultBuilder createBuilder(CodeCacheProvider codeCache, ForeignCallsProvider foreignCalls, FrameMap frameMap, Assembler asm, DataBuilder dataBuilder, FrameContext frameContext, CompilationResult compilationResult) { - return new OptimizedCallTargetInstrumentation(codeCache, foreignCalls, frameMap, asm, frameContext, compilationResult, config, registers) { + return new OptimizedCallTargetInstrumentation(codeCache, foreignCalls, frameMap, asm, dataBuilder, frameContext, compilationResult, config, registers) { @Override protected void injectTailCallCode() { @SuppressWarnings("hiding")
--- a/graal/com.oracle.graal.truffle.hotspot.sparc/src/com/oracle/graal/truffle/hotspot/sparc/SPARCOptimizedCallTargetInstumentationFactory.java Fri Jan 15 16:30:38 2016 +0100 +++ b/graal/com.oracle.graal.truffle.hotspot.sparc/src/com/oracle/graal/truffle/hotspot/sparc/SPARCOptimizedCallTargetInstumentationFactory.java Mon Jan 18 10:29:19 2016 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2016, 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 @@ -28,7 +28,6 @@ import static jdk.vm.ci.code.CallingConvention.Type.JavaCall; import static jdk.vm.ci.meta.JavaKind.Object; import jdk.vm.ci.code.CodeCacheProvider; -import jdk.vm.ci.code.CompilationResult; import jdk.vm.ci.code.InstalledCode; import jdk.vm.ci.code.Register; @@ -37,8 +36,10 @@ import com.oracle.graal.asm.sparc.SPARCAddress; import com.oracle.graal.asm.sparc.SPARCMacroAssembler; import com.oracle.graal.asm.sparc.SPARCMacroAssembler.ScratchRegister; +import com.oracle.graal.code.CompilationResult; import com.oracle.graal.compiler.common.spi.ForeignCallsProvider; import com.oracle.graal.lir.asm.CompilationResultBuilder; +import com.oracle.graal.lir.asm.DataBuilder; import com.oracle.graal.lir.asm.FrameContext; import com.oracle.graal.lir.framemap.FrameMap; import com.oracle.graal.serviceprovider.ServiceProvider; @@ -48,9 +49,9 @@ @ServiceProvider(OptimizedCallTargetInstrumentationFactory.class) public class SPARCOptimizedCallTargetInstumentationFactory extends OptimizedCallTargetInstrumentationFactory { - public CompilationResultBuilder createBuilder(CodeCacheProvider codeCache, ForeignCallsProvider foreignCalls, FrameMap frameMap, Assembler asm, FrameContext frameContext, + public CompilationResultBuilder createBuilder(CodeCacheProvider codeCache, ForeignCallsProvider foreignCalls, FrameMap frameMap, Assembler asm, DataBuilder dataBuilder, FrameContext frameContext, CompilationResult compilationResult) { - return new OptimizedCallTargetInstrumentation(codeCache, foreignCalls, frameMap, asm, frameContext, compilationResult, config, registers) { + return new OptimizedCallTargetInstrumentation(codeCache, foreignCalls, frameMap, asm, dataBuilder, frameContext, compilationResult, config, registers) { @Override protected void injectTailCallCode() { @SuppressWarnings("hiding")
--- a/graal/com.oracle.graal.truffle.hotspot/src/com/oracle/graal/truffle/hotspot/HotSpotTruffleRuntime.java Fri Jan 15 16:30:38 2016 +0100 +++ b/graal/com.oracle.graal.truffle.hotspot/src/com/oracle/graal/truffle/hotspot/HotSpotTruffleRuntime.java Mon Jan 18 10:29:19 2016 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2016, 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 @@ -42,7 +42,7 @@ import jdk.vm.ci.code.CallingConvention; import jdk.vm.ci.code.CallingConvention.Type; import jdk.vm.ci.code.CodeCacheProvider; -import jdk.vm.ci.code.CompilationResult; +import jdk.vm.ci.code.CompiledCode; import jdk.vm.ci.code.stack.StackIntrospection; import jdk.vm.ci.common.JVMCIError; import jdk.vm.ci.hotspot.HotSpotCodeCacheProvider; @@ -57,6 +57,7 @@ import jdk.vm.ci.services.Services; import com.oracle.graal.api.runtime.GraalRuntime; +import com.oracle.graal.code.CompilationResult; import com.oracle.graal.compiler.target.Backend; import com.oracle.graal.debug.Debug; import com.oracle.graal.debug.Debug.Scope; @@ -64,6 +65,7 @@ import com.oracle.graal.debug.GraalDebugConfig; import com.oracle.graal.debug.TTY; import com.oracle.graal.hotspot.HotSpotBackend; +import com.oracle.graal.hotspot.HotSpotCompiledCodeBuilder; import com.oracle.graal.hotspot.meta.HotSpotProviders; import com.oracle.graal.java.GraphBuilderPhase; import com.oracle.graal.lir.asm.CompilationResultBuilderFactory; @@ -217,7 +219,8 @@ CompilationResult compResult = compileMethod(method); CodeCacheProvider codeCache = providers.getCodeCache(); try (Scope s = Debug.scope("CodeInstall", codeCache, method)) { - codeCache.setDefaultCode(method, compResult); + CompiledCode compiledCode = HotSpotCompiledCodeBuilder.createCompiledCode(method, null, compResult); + codeCache.setDefaultCode(method, compiledCode); } catch (Throwable e) { throw Debug.handle(e); }
--- a/graal/com.oracle.graal.truffle.hotspot/src/com/oracle/graal/truffle/hotspot/OptimizedCallTargetInstrumentation.java Fri Jan 15 16:30:38 2016 +0100 +++ b/graal/com.oracle.graal.truffle.hotspot/src/com/oracle/graal/truffle/hotspot/OptimizedCallTargetInstrumentation.java Mon Jan 18 10:29:19 2016 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2016, 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 @@ -27,16 +27,17 @@ import java.lang.reflect.Field; import jdk.vm.ci.code.CodeCacheProvider; -import jdk.vm.ci.code.CompilationResult; -import jdk.vm.ci.code.CompilationResult.Mark; +import jdk.vm.ci.code.site.Mark; import jdk.vm.ci.common.JVMCIError; import jdk.vm.ci.hotspot.HotSpotCodeCacheProvider; import jdk.vm.ci.hotspot.HotSpotVMConfig; import com.oracle.graal.asm.Assembler; +import com.oracle.graal.code.CompilationResult; import com.oracle.graal.compiler.common.spi.ForeignCallsProvider; import com.oracle.graal.hotspot.meta.HotSpotRegistersProvider; import com.oracle.graal.lir.asm.CompilationResultBuilder; +import com.oracle.graal.lir.asm.DataBuilder; import com.oracle.graal.lir.asm.FrameContext; import com.oracle.graal.lir.framemap.FrameMap; import com.oracle.graal.truffle.OptimizedCallTarget; @@ -48,9 +49,9 @@ protected final HotSpotVMConfig config; protected final HotSpotRegistersProvider registers; - public OptimizedCallTargetInstrumentation(CodeCacheProvider codeCache, ForeignCallsProvider foreignCalls, FrameMap frameMap, Assembler asm, FrameContext frameContext, + public OptimizedCallTargetInstrumentation(CodeCacheProvider codeCache, ForeignCallsProvider foreignCalls, FrameMap frameMap, Assembler asm, DataBuilder dataBuilder, FrameContext frameContext, CompilationResult compilationResult, HotSpotVMConfig config, HotSpotRegistersProvider registers) { - super(codeCache, foreignCalls, frameMap, asm, frameContext, compilationResult); + super(codeCache, foreignCalls, frameMap, asm, dataBuilder, frameContext, compilationResult); this.config = config; this.registers = registers; }
--- a/graal/com.oracle.graal.truffle.hotspot/src/com/oracle/graal/truffle/hotspot/nfi/HotSpotNativeFunctionInterface.java Fri Jan 15 16:30:38 2016 +0100 +++ b/graal/com.oracle.graal.truffle.hotspot/src/com/oracle/graal/truffle/hotspot/nfi/HotSpotNativeFunctionInterface.java Mon Jan 18 10:29:19 2016 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -31,17 +31,19 @@ import jdk.vm.ci.code.CallingConvention; import jdk.vm.ci.code.CallingConvention.Type; -import jdk.vm.ci.code.CompilationResult; import jdk.vm.ci.code.InstalledCode; +import jdk.vm.ci.hotspot.HotSpotCompiledCode; import jdk.vm.ci.hotspot.HotSpotVMConfig; import jdk.vm.ci.meta.DefaultProfilingInfo; import jdk.vm.ci.meta.TriState; import sun.misc.Unsafe; +import com.oracle.graal.code.CompilationResult; import com.oracle.graal.compiler.GraalCompiler; import com.oracle.graal.compiler.target.Backend; import com.oracle.graal.debug.Debug; import com.oracle.graal.debug.Debug.Scope; +import com.oracle.graal.hotspot.HotSpotCompiledCodeBuilder; import com.oracle.graal.hotspot.meta.HotSpotProviders; import com.oracle.graal.lir.asm.CompilationResultBuilderFactory; import com.oracle.graal.lir.phases.LIRSuites; @@ -182,7 +184,8 @@ lirSuites, new CompilationResult(), CompilationResultBuilderFactory.Default); InstalledCode installedCode; try (Scope s = Debug.scope("CodeInstall", providers.getCodeCache(), g.method())) { - installedCode = providers.getCodeCache().addCode(g.method(), compResult, null, null); + HotSpotCompiledCode compiledCode = HotSpotCompiledCodeBuilder.createCompiledCode(g.method(), null, compResult); + installedCode = providers.getCodeCache().addCode(g.method(), compiledCode, null, null); } catch (Throwable e) { throw Debug.handle(e); }
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/GraalTruffleCompilationListener.java Fri Jan 15 16:30:38 2016 +0100 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/GraalTruffleCompilationListener.java Mon Jan 18 10:29:19 2016 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -22,8 +22,7 @@ */ package com.oracle.graal.truffle; -import jdk.vm.ci.code.CompilationResult; - +import com.oracle.graal.code.CompilationResult; import com.oracle.graal.nodes.StructuredGraph; import com.oracle.truffle.api.nodes.Node;
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/GraalTruffleRuntime.java Fri Jan 15 16:30:38 2016 +0100 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/GraalTruffleRuntime.java Mon Jan 18 10:29:19 2016 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2016, 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 @@ -42,7 +42,6 @@ import java.util.stream.Collectors; import jdk.vm.ci.code.BailoutException; -import jdk.vm.ci.code.CompilationResult; import jdk.vm.ci.code.stack.InspectedFrame; import jdk.vm.ci.code.stack.InspectedFrameVisitor; import jdk.vm.ci.code.stack.StackIntrospection; @@ -52,6 +51,7 @@ import jdk.vm.ci.services.Services; import com.oracle.graal.api.runtime.GraalRuntime; +import com.oracle.graal.code.CompilationResult; import com.oracle.graal.compiler.CompilerThreadFactory; import com.oracle.graal.debug.Debug; import com.oracle.graal.debug.Debug.Scope;
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCompilationResultBuilderFactory.java Fri Jan 15 16:30:38 2016 +0100 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCompilationResultBuilderFactory.java Mon Jan 18 10:29:19 2016 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, 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 @@ -27,13 +27,14 @@ import java.util.Set; import jdk.vm.ci.code.CodeCacheProvider; -import jdk.vm.ci.code.CompilationResult; import jdk.vm.ci.meta.Assumptions.Assumption; import com.oracle.graal.asm.Assembler; +import com.oracle.graal.code.CompilationResult; import com.oracle.graal.compiler.common.spi.ForeignCallsProvider; import com.oracle.graal.lir.asm.CompilationResultBuilder; import com.oracle.graal.lir.asm.CompilationResultBuilderFactory; +import com.oracle.graal.lir.asm.DataBuilder; import com.oracle.graal.lir.asm.FrameContext; import com.oracle.graal.lir.framemap.FrameMap; import com.oracle.graal.nodes.StructuredGraph; @@ -60,9 +61,9 @@ this.validAssumptions = validAssumptions; } - public CompilationResultBuilder createBuilder(CodeCacheProvider codeCache, ForeignCallsProvider foreignCalls, FrameMap frameMap, Assembler asm, FrameContext frameContext, + public CompilationResultBuilder createBuilder(CodeCacheProvider codeCache, ForeignCallsProvider foreignCalls, FrameMap frameMap, Assembler asm, DataBuilder dataBuilder, FrameContext frameContext, CompilationResult compilationResult) { - return new CompilationResultBuilder(codeCache, foreignCalls, frameMap, asm, frameContext, compilationResult) { + return new CompilationResultBuilder(codeCache, foreignCalls, frameMap, asm, dataBuilder, frameContext, compilationResult) { @Override protected void closeCompilationResult() { CompilationResult result = this.compilationResult;
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCompiler.java Fri Jan 15 16:30:38 2016 +0100 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCompiler.java Mon Jan 18 10:29:19 2016 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2016, 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 @@ -31,7 +31,7 @@ import jdk.vm.ci.code.CallingConvention; import jdk.vm.ci.code.CallingConvention.Type; import jdk.vm.ci.code.CodeCacheProvider; -import jdk.vm.ci.code.CompilationResult; +import jdk.vm.ci.code.CompiledCode; import jdk.vm.ci.code.InstalledCode; import jdk.vm.ci.meta.ConstantReflectionProvider; import jdk.vm.ci.meta.MetaAccessProvider; @@ -39,6 +39,7 @@ import jdk.vm.ci.meta.SpeculationLog; import com.oracle.graal.api.replacements.SnippetReflectionProvider; +import com.oracle.graal.code.CompilationResult; import com.oracle.graal.compiler.target.Backend; import com.oracle.graal.debug.Debug; import com.oracle.graal.debug.Debug.Scope; @@ -193,7 +194,8 @@ InstalledCode installedCode; try (Scope s = Debug.scope("CodeInstall", providers.getCodeCache()); DebugCloseable a = CodeInstallationTime.start(); DebugCloseable c = CodeInstallationMemUse.start()) { - installedCode = providers.getCodeCache().addCode(graph.method(), result, graph.getSpeculationLog(), predefinedInstalledCode); + CompiledCode compiledCode = backend.createCompiledCode(graph.method(), result); + installedCode = providers.getCodeCache().addCode(graph.method(), compiledCode, graph.getSpeculationLog(), predefinedInstalledCode); } catch (Throwable e) { throw Debug.handle(e); }
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/debug/AbstractDebugCompilationListener.java Fri Jan 15 16:30:38 2016 +0100 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/debug/AbstractDebugCompilationListener.java Mon Jan 18 10:29:19 2016 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -24,8 +24,7 @@ import java.util.Map; -import jdk.vm.ci.code.CompilationResult; - +import com.oracle.graal.code.CompilationResult; import com.oracle.graal.nodes.StructuredGraph; import com.oracle.graal.truffle.GraalTruffleCompilationListener; import com.oracle.graal.truffle.GraalTruffleRuntime;
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/debug/CompilationStatisticsListener.java Fri Jan 15 16:30:38 2016 +0100 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/debug/CompilationStatisticsListener.java Mon Jan 18 10:29:19 2016 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -36,8 +36,7 @@ import java.util.stream.Stream; import java.util.stream.StreamSupport; -import jdk.vm.ci.code.CompilationResult; - +import com.oracle.graal.code.CompilationResult; import com.oracle.graal.nodes.StructuredGraph; import com.oracle.graal.truffle.GraalTruffleRuntime; import com.oracle.graal.truffle.OptimizedCallTarget;
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/debug/TraceCompilationASTListener.java Fri Jan 15 16:30:38 2016 +0100 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/debug/TraceCompilationASTListener.java Mon Jan 18 10:29:19 2016 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -26,8 +26,7 @@ import java.util.List; -import jdk.vm.ci.code.CompilationResult; - +import com.oracle.graal.code.CompilationResult; import com.oracle.graal.nodes.StructuredGraph; import com.oracle.graal.truffle.GraalTruffleRuntime; import com.oracle.graal.truffle.OptimizedCallTarget;
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/debug/TraceCompilationCallTreeListener.java Fri Jan 15 16:30:38 2016 +0100 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/debug/TraceCompilationCallTreeListener.java Mon Jan 18 10:29:19 2016 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -28,8 +28,7 @@ import java.util.List; import java.util.Map; -import jdk.vm.ci.code.CompilationResult; - +import com.oracle.graal.code.CompilationResult; import com.oracle.graal.nodes.StructuredGraph; import com.oracle.graal.truffle.GraalTruffleRuntime; import com.oracle.graal.truffle.OptimizedCallTarget;
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/debug/TraceCompilationListener.java Fri Jan 15 16:30:38 2016 +0100 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/debug/TraceCompilationListener.java Mon Jan 18 10:29:19 2016 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -28,8 +28,7 @@ import java.util.LinkedHashMap; import java.util.Map; -import jdk.vm.ci.code.CompilationResult; - +import com.oracle.graal.code.CompilationResult; import com.oracle.graal.nodes.StructuredGraph; import com.oracle.graal.truffle.GraalTruffleRuntime; import com.oracle.graal.truffle.OptimizedCallTarget;
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/debug/TraceCompilationPolymorphismListener.java Fri Jan 15 16:30:38 2016 +0100 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/debug/TraceCompilationPolymorphismListener.java Mon Jan 18 10:29:19 2016 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -27,8 +27,7 @@ import java.util.LinkedHashMap; import java.util.Map; -import jdk.vm.ci.code.CompilationResult; - +import com.oracle.graal.code.CompilationResult; import com.oracle.graal.nodes.StructuredGraph; import com.oracle.graal.truffle.GraalTruffleRuntime; import com.oracle.graal.truffle.OptimizedCallTarget;
--- a/mx.graal/suite.py Fri Jan 15 16:30:38 2016 +0100 +++ b/mx.graal/suite.py Mon Jan 18 10:29:19 2016 +0100 @@ -39,7 +39,7 @@ { "name" : "jvmci", "optional" : "true", - "version" : "1fbfcc0334d34d574646289ce1c93b05699ee555", + "version" : "8a3fd0269d15ae84d31c34df144297df5ba3c773", "urls" : [ {"url" : "http://lafo.ssw.uni-linz.ac.at/hg/graal-jvmci-8", "kind" : "hg"}, {"url" : "https://curio.ssw.jku.at/nexus/content/repositories/snapshots", "kind" : "binary"}, @@ -280,7 +280,6 @@ "com.oracle.graal.api.runtime", "com.oracle.graal.replacements", "com.oracle.graal.runtime", - "com.oracle.graal.code", ]), "checkstyle" : "com.oracle.graal.graph", "annotationProcessors" : [ @@ -484,7 +483,9 @@ "subDir" : "graal", "sourceDirs" : ["src"], "dependencies" : [ + "com.oracle.graal.api.test", "com.oracle.graal.code", + "com.oracle.graal.runtime", "com.oracle.graal.test", "com.oracle.graal.debug", ], @@ -521,8 +522,9 @@ "subDir" : "graal", "sourceDirs" : ["src"], "dependencies" : [ + "com.oracle.graal.asm", + "com.oracle.graal.code", "com.oracle.graal.compiler.common", - "com.oracle.graal.asm", ], "annotationProcessors" : ["GRAAL_OPTIONS_PROCESSOR"], "checkstyle" : "com.oracle.graal.graph", @@ -702,10 +704,9 @@ "dependencies" : [ "com.oracle.graal.graph", "com.oracle.graal.api.replacements", + "com.oracle.graal.bytecode", "com.oracle.graal.lir", - "com.oracle.graal.bytecode", ], - "generatedDependencies" : ["com.oracle.graal.serviceprovider"], "checkstyle" : "com.oracle.graal.graph", "javaCompliance" : "1.8", "annotationProcessors" : [ @@ -974,9 +975,8 @@ "subDir" : "graal", "sourceDirs" : ["src"], "dependencies" : [ - "com.oracle.graal.code", + "com.oracle.graal.compiler", "com.oracle.graal.java", - "com.oracle.graal.compiler", ], "annotationProcessors" : [ "GRAAL_OPTIONS_PROCESSOR",