changeset 22773:9273bb6ba33e

Simplify code installation interface: Use CompiledCode class instead of CompilationResult and DataSection.
author Roland Schatz <roland.schatz@oracle.com>
date Fri, 15 Jan 2016 16:50:19 +0100
parents f16c1266b0de
children 8a3fd0269d15
files jvmci/jdk.vm.ci.code/src/jdk/vm/ci/code/CodeCacheProvider.java jvmci/jdk.vm.ci.code/src/jdk/vm/ci/code/CompilationResult.java jvmci/jdk.vm.ci.code/src/jdk/vm/ci/code/CompiledCode.java jvmci/jdk.vm.ci.code/src/jdk/vm/ci/code/DataSection.java jvmci/jdk.vm.ci.code/src/jdk/vm/ci/code/InfopointReason.java jvmci/jdk.vm.ci.code/src/jdk/vm/ci/code/package-info.java jvmci/jdk.vm.ci.code/src/jdk/vm/ci/code/site/Call.java jvmci/jdk.vm.ci.code/src/jdk/vm/ci/code/site/ConstantReference.java jvmci/jdk.vm.ci.code/src/jdk/vm/ci/code/site/DataPatch.java jvmci/jdk.vm.ci.code/src/jdk/vm/ci/code/site/DataSectionReference.java jvmci/jdk.vm.ci.code/src/jdk/vm/ci/code/site/ExceptionHandler.java jvmci/jdk.vm.ci.code/src/jdk/vm/ci/code/site/Infopoint.java jvmci/jdk.vm.ci.code/src/jdk/vm/ci/code/site/InfopointReason.java jvmci/jdk.vm.ci.code/src/jdk/vm/ci/code/site/Mark.java jvmci/jdk.vm.ci.code/src/jdk/vm/ci/code/site/Reference.java jvmci/jdk.vm.ci.code/src/jdk/vm/ci/code/site/Site.java jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotCodeCacheProvider.java jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotCompiledCode.java jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotCompiledNmethod.java jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIRuntime.java jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVMEventListener.java src/share/vm/jvmci/jvmciCodeInstaller.cpp src/share/vm/jvmci/jvmciCodeInstaller.hpp src/share/vm/jvmci/jvmciJavaClasses.hpp src/share/vm/jvmci/systemDictionary_jvmci.hpp src/share/vm/jvmci/vmSymbols_jvmci.hpp
diffstat 26 files changed, 917 insertions(+), 1835 deletions(-) [+]
line wrap: on
line diff
--- a/jvmci/jdk.vm.ci.code/src/jdk/vm/ci/code/CodeCacheProvider.java	Fri Jan 15 15:51:01 2016 +0100
+++ b/jvmci/jdk.vm.ci.code/src/jdk/vm/ci/code/CodeCacheProvider.java	Fri Jan 15 16:50:19 2016 +0100
@@ -22,11 +22,8 @@
  */
 package jdk.vm.ci.code;
 
-import jdk.vm.ci.code.CompilationResult.Call;
-import jdk.vm.ci.code.CompilationResult.DataPatch;
-import jdk.vm.ci.code.CompilationResult.Mark;
-import jdk.vm.ci.code.DataSection.Data;
-import jdk.vm.ci.meta.Constant;
+import jdk.vm.ci.code.site.Call;
+import jdk.vm.ci.code.site.Mark;
 import jdk.vm.ci.meta.ResolvedJavaMethod;
 import jdk.vm.ci.meta.SpeculationLog;
 
@@ -40,7 +37,7 @@
      * default implementation of the method.
      *
      * @param method a method implemented by the installed code
-     * @param compResult the compilation result to be added
+     * @param compiledCode the compiled code to be added
      * @param log the speculation log to be used
      * @param installedCode a predefined {@link InstalledCode} object to use as a reference to the
      *            installed code. If {@code null}, a new {@link InstalledCode} object will be
@@ -48,8 +45,8 @@
      * @return a reference to the ready-to-run code
      * @throws BailoutException if the code installation failed
      */
-    default InstalledCode addCode(ResolvedJavaMethod method, CompilationResult compResult, SpeculationLog log, InstalledCode installedCode) {
-        return installCode(new CompilationRequest(method), compResult, installedCode, log, false);
+    default InstalledCode addCode(ResolvedJavaMethod method, CompiledCode compiledCode, SpeculationLog log, InstalledCode installedCode) {
+        return installCode(method, compiledCode, installedCode, log, false);
     }
 
     /**
@@ -58,21 +55,20 @@
      *
      * @param method a method implemented by the installed code and for which the installed code
      *            becomes the default implementation
-     * @param compResult the compilation result to be added
+     * @param compiledCode the compiled code to be added
      * @return a reference to the ready-to-run code
      * @throws BailoutException if the code installation failed
      */
-    default InstalledCode setDefaultCode(ResolvedJavaMethod method, CompilationResult compResult) {
-        return installCode(new CompilationRequest(method), compResult, null, null, true);
+    default InstalledCode setDefaultCode(ResolvedJavaMethod method, CompiledCode compiledCode) {
+        return installCode(method, compiledCode, null, null, true);
     }
 
     /**
      * Installs code based on a given compilation result.
      *
-     * @param compRequest details of the method compiled to produce {@code compResult} or
-     *            {@code null} if the input to {@code compResult} was not a
-     *            {@link ResolvedJavaMethod}
-     * @param compResult the compilation result to be added
+     * @param method the method compiled to produce {@code compiledCode} or {@code null} if the
+     *            input to {@code compResult} was not a {@link ResolvedJavaMethod}
+     * @param compiledCode the compiled code to be added
      * @param installedCode a pre-allocated {@link InstalledCode} object to use as a reference to
      *            the installed code. If {@code null}, a new {@link InstalledCode} object will be
      *            created.
@@ -84,7 +80,7 @@
      * @return a reference to the compiled and ready-to-run installed code
      * @throws BailoutException if the code installation failed
      */
-    InstalledCode installCode(CompilationRequest compRequest, CompilationResult compResult, InstalledCode installedCode, SpeculationLog log, boolean isDefault);
+    InstalledCode installCode(ResolvedJavaMethod method, CompiledCode compiledCode, InstalledCode installedCode, SpeculationLog log, boolean isDefault);
 
     /**
      * Invalidates {@code installedCode} such that {@link InvalidInstalledCodeException} will be
@@ -121,13 +117,6 @@
     int getMinimumOutgoingSize();
 
     /**
-     * Create a {@link Data} item for one or more {@link Constant Constants}, that can be used in a
-     * {@link DataPatch}. If more than one {@link Constant} is given, then they are tightly packed
-     * into a single {@link Data} item.
-     */
-    Data createDataItem(Constant... constants);
-
-    /**
      * Gets a description of the target architecture.
      */
     TargetDescription getTarget();
--- a/jvmci/jdk.vm.ci.code/src/jdk/vm/ci/code/CompilationResult.java	Fri Jan 15 15:51:01 2016 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,988 +0,0 @@
-/*
- * Copyright (c) 2009, 2014, 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 jdk.vm.ci.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.Map;
-import java.util.Objects;
-
-import jdk.vm.ci.meta.Assumptions.Assumption;
-import jdk.vm.ci.meta.InvokeTarget;
-import jdk.vm.ci.meta.JavaConstant;
-import jdk.vm.ci.meta.MetaUtil;
-import jdk.vm.ci.meta.ResolvedJavaMethod;
-import jdk.vm.ci.meta.VMConstant;
-
-/**
- * Represents the output from compiling a method, including the compiled machine code, associated
- * data and references, relocation information, deoptimization information, etc.
- */
-public class CompilationResult {
-
-    /**
-     * Represents a code position with associated additional information.
-     */
-    public abstract static class Site {
-
-        /**
-         * The position (or offset) of this site with respect to the start of the target method.
-         */
-        public final int pcOffset;
-
-        public Site(int pos) {
-            this.pcOffset = pos;
-        }
-
-        @Override
-        public final int hashCode() {
-            throw new UnsupportedOperationException("hashCode");
-        }
-
-        @Override
-        public String toString() {
-            return identityHashCodeString(this);
-        }
-
-        @Override
-        public abstract boolean equals(Object obj);
-    }
-
-    /**
-     * Represents an infopoint with associated debug info. Note that safepoints are also infopoints.
-     */
-    public static class Infopoint extends Site implements Comparable<Infopoint> {
-
-        public final DebugInfo debugInfo;
-
-        public final InfopointReason reason;
-
-        public Infopoint(int pcOffset, DebugInfo debugInfo, InfopointReason reason) {
-            super(pcOffset);
-            this.debugInfo = debugInfo;
-            this.reason = reason;
-        }
-
-        @Override
-        public String toString() {
-            StringBuilder sb = new StringBuilder();
-            sb.append(pcOffset);
-            sb.append("[<infopoint>]");
-            appendDebugInfo(sb, debugInfo);
-            return sb.toString();
-        }
-
-        @Override
-        public int compareTo(Infopoint o) {
-            if (pcOffset < o.pcOffset) {
-                return -1;
-            } else if (pcOffset > o.pcOffset) {
-                return 1;
-            }
-            return this.reason.compareTo(o.reason);
-        }
-
-        @Override
-        public boolean equals(Object obj) {
-            if (this == obj) {
-                return true;
-            }
-            if (obj != null && obj.getClass() == getClass()) {
-                Infopoint that = (Infopoint) obj;
-                if (this.pcOffset == that.pcOffset && Objects.equals(this.debugInfo, that.debugInfo) && Objects.equals(this.reason, that.reason)) {
-                    return true;
-                }
-            }
-            return false;
-        }
-    }
-
-    /**
-     * Represents a call in the code.
-     */
-    public static final class Call extends Infopoint {
-
-        /**
-         * The target of the call.
-         */
-        public final InvokeTarget target;
-
-        /**
-         * The size of the call instruction.
-         */
-        public final int size;
-
-        /**
-         * Specifies if this call is direct or indirect. A direct call has an immediate operand
-         * encoding the absolute or relative (to the call itself) address of the target. An indirect
-         * call has a register or memory operand specifying the target address of the call.
-         */
-        public final boolean direct;
-
-        public Call(InvokeTarget target, int pcOffset, int size, boolean direct, DebugInfo debugInfo) {
-            super(pcOffset, debugInfo, InfopointReason.CALL);
-            this.size = size;
-            this.target = target;
-            this.direct = direct;
-        }
-
-        @Override
-        public boolean equals(Object obj) {
-            if (this == obj) {
-                return true;
-            }
-            if (obj instanceof Call && super.equals(obj)) {
-                Call that = (Call) obj;
-                if (this.size == that.size && this.direct == that.direct && Objects.equals(this.target, that.target)) {
-                    return true;
-                }
-            }
-            return false;
-        }
-
-        @Override
-        public String toString() {
-            StringBuilder sb = new StringBuilder();
-            sb.append(pcOffset);
-            sb.append('[');
-            sb.append(target);
-            sb.append(']');
-
-            if (debugInfo != null) {
-                appendDebugInfo(sb, debugInfo);
-            }
-
-            return sb.toString();
-        }
-    }
-
-    /**
-     * Represents some external data that is referenced by the code.
-     */
-    public abstract static class Reference {
-
-        @Override
-        public abstract int hashCode();
-
-        @Override
-        public abstract boolean equals(Object obj);
-    }
-
-    public static final class ConstantReference extends Reference {
-
-        private final VMConstant constant;
-
-        public ConstantReference(VMConstant constant) {
-            this.constant = constant;
-        }
-
-        public VMConstant getConstant() {
-            return constant;
-        }
-
-        @Override
-        public String toString() {
-            return constant.toString();
-        }
-
-        @Override
-        public int hashCode() {
-            return constant.hashCode();
-        }
-
-        @Override
-        public boolean equals(Object obj) {
-            if (this == obj) {
-                return true;
-            }
-            if (obj instanceof ConstantReference) {
-                ConstantReference that = (ConstantReference) obj;
-                return Objects.equals(this.constant, that.constant);
-            }
-            return false;
-        }
-    }
-
-    public static final class DataSectionReference extends Reference {
-
-        private boolean initialized;
-        private int offset;
-
-        public DataSectionReference() {
-            // will be set after the data section layout is fixed
-            offset = 0xDEADDEAD;
-        }
-
-        public int getOffset() {
-            assert initialized;
-
-            return offset;
-        }
-
-        public void setOffset(int offset) {
-            assert !initialized;
-            initialized = true;
-
-            this.offset = offset;
-        }
-
-        @Override
-        public int hashCode() {
-            return offset;
-        }
-
-        @Override
-        public boolean equals(Object obj) {
-            if (this == obj) {
-                return true;
-            }
-            if (obj instanceof DataSectionReference) {
-                DataSectionReference that = (DataSectionReference) obj;
-                return this.offset == that.offset;
-            }
-            return false;
-        }
-
-        @Override
-        public String toString() {
-            if (initialized) {
-                return String.format("DataSection[0x%x]", offset);
-            } else {
-                return "DataSection[?]";
-            }
-        }
-    }
-
-    /**
-     * Represents a code site that references some data. The associated data can be either a
-     * {@link DataSectionReference reference} to the data section, or it may be an inlined
-     * {@link JavaConstant} that needs to be patched.
-     */
-    public static final class DataPatch extends Site {
-
-        public Reference reference;
-
-        public DataPatch(int pcOffset, Reference reference) {
-            super(pcOffset);
-            this.reference = reference;
-        }
-
-        @Override
-        public String toString() {
-            return String.format("%d[<data patch referring to %s>]", pcOffset, reference.toString());
-        }
-
-        @Override
-        public boolean equals(Object obj) {
-            if (this == obj) {
-                return true;
-            }
-            if (obj instanceof DataPatch) {
-                DataPatch that = (DataPatch) obj;
-                if (this.pcOffset == that.pcOffset && Objects.equals(this.reference, that.reference)) {
-                    return true;
-                }
-            }
-            return false;
-        }
-    }
-
-    /**
-     * 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 + "]";
-        }
-    }
-
-    /**
-     * Represents exception handler information for a specific code position. It includes the catch
-     * code position as well as the caught exception type.
-     */
-    public static final class ExceptionHandler extends Site {
-
-        public final int handlerPos;
-
-        ExceptionHandler(int pcOffset, int handlerPos) {
-            super(pcOffset);
-            this.handlerPos = handlerPos;
-        }
-
-        @Override
-        public String toString() {
-            return String.format("%d[<exception edge to %d>]", pcOffset, handlerPos);
-        }
-
-        @Override
-        public boolean equals(Object obj) {
-            if (this == obj) {
-                return true;
-            }
-            if (obj instanceof ExceptionHandler) {
-                ExceptionHandler that = (ExceptionHandler) obj;
-                if (this.pcOffset == that.pcOffset && this.handlerPos == that.handlerPos) {
-                    return true;
-                }
-            }
-            return false;
-        }
-    }
-
-    /**
-     * Represents a mark in the machine code that can be used by the runtime for its own purposes. A
-     * mark can reference other marks.
-     */
-    public static final class Mark extends Site {
-
-        public final Object id;
-
-        public Mark(int pcOffset, Object id) {
-            super(pcOffset);
-            this.id = id;
-        }
-
-        @Override
-        public String toString() {
-            if (id == null) {
-                return String.format("%d[<mar>]", pcOffset);
-            } else if (id instanceof Integer) {
-                return String.format("%d[<mark with id %s>]", pcOffset, Integer.toHexString((Integer) id));
-            } else {
-                return String.format("%d[<mark with id %s>]", pcOffset, id.toString());
-            }
-        }
-
-        @Override
-        public boolean equals(Object obj) {
-            if (this == obj) {
-                return true;
-            }
-            if (obj instanceof Mark) {
-                Mark that = (Mark) obj;
-                if (this.pcOffset == that.pcOffset && Objects.equals(this.id, that.id)) {
-                    return true;
-                }
-            }
-            return false;
-        }
-    }
-
-    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);
-    }
-
-    private static void appendDebugInfo(StringBuilder sb, DebugInfo info) {
-        if (info != null) {
-            ReferenceMap refMap = info.getReferenceMap();
-            if (refMap != null) {
-                sb.append(refMap.toString());
-                sb.append(']');
-            }
-            RegisterSaveLayout calleeSaveInfo = info.getCalleeSaveInfo();
-            if (calleeSaveInfo != null) {
-                sb.append(" callee-save-info[");
-                String sep = "";
-                for (Map.Entry<Register, Integer> e : calleeSaveInfo.registersToSlots(true).entrySet()) {
-                    sb.append(sep).append(e.getKey()).append("->").append(e.getValue());
-                    sep = ", ";
-                }
-                sb.append(']');
-            }
-            BytecodePosition codePos = info.getBytecodePosition();
-            if (codePos != null) {
-                MetaUtil.appendLocation(sb.append(" "), codePos.getMethod(), codePos.getBCI());
-                if (info.hasFrame()) {
-                    sb.append(" #locals=").append(info.frame().numLocals).append(" #expr=").append(info.frame().numStack);
-                    if (info.frame().numLocks > 0) {
-                        sb.append(" #locks=").append(info.frame().numLocks);
-                    }
-                }
-            }
-        }
-    }
-
-    /**
-     * @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/jvmci/jdk.vm.ci.code/src/jdk/vm/ci/code/CompiledCode.java	Fri Jan 15 16:50:19 2016 +0100
@@ -0,0 +1,103 @@
+/*
+ * 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 jdk.vm.ci.code;
+
+import jdk.vm.ci.code.site.Infopoint;
+import jdk.vm.ci.code.site.Site;
+import jdk.vm.ci.meta.Assumptions.Assumption;
+import jdk.vm.ci.meta.ResolvedJavaMethod;
+
+/**
+ * Abstract base class that represents the output from compiling a method.
+ */
+public abstract class CompiledCode {
+
+    /**
+     * The name of this compilation unit.
+     */
+    protected final String name;
+
+    /**
+     * The buffer containing the emitted machine code.
+     */
+    protected final byte[] targetCode;
+
+    /**
+     * The leading number of bytes in {@link #targetCode} containing the emitted machine code.
+     */
+    protected final int targetCodeSize;
+
+    /**
+     * A list of code annotations describing special sites in {@link #targetCode}.
+     */
+    protected final Site[] sites;
+
+    /**
+     * A list of {@link Assumption} this code relies on.
+     */
+    protected final 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.
+     */
+    protected final ResolvedJavaMethod[] methods;
+
+    public CompiledCode(String name, byte[] targetCode, int targetCodeSize, Site[] sites, Assumption[] assumptions, ResolvedJavaMethod[] methods) {
+        this.name = name;
+        this.targetCode = targetCode;
+        this.targetCodeSize = targetCodeSize;
+        this.sites = sites;
+        this.assumptions = assumptions;
+        this.methods = methods;
+
+        assert validateFrames();
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    @Override
+    public String toString() {
+        return name;
+    }
+
+    /**
+     * Ensure that all the frames passed into the VM are properly formatted with an empty or illegal
+     * slot following double word slots.
+     */
+    private boolean validateFrames() {
+        for (Site site : sites) {
+            if (site instanceof Infopoint) {
+                Infopoint info = (Infopoint) site;
+                if (info.debugInfo != null) {
+                    BytecodeFrame frame = info.debugInfo.frame();
+                    assert frame == null || frame.validateFormat();
+                }
+            }
+        }
+        return true;
+    }
+}
--- a/jvmci/jdk.vm.ci.code/src/jdk/vm/ci/code/DataSection.java	Fri Jan 15 15:51:01 2016 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,331 +0,0 @@
-/*
- * Copyright (c) 2014, 2014, 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 jdk.vm.ci.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 java.util.function.Consumer;
-
-import jdk.vm.ci.code.CompilationResult.DataPatch;
-import jdk.vm.ci.code.CompilationResult.DataSectionReference;
-import jdk.vm.ci.code.DataSection.Data;
-import jdk.vm.ci.meta.SerializableConstant;
-
-public final class DataSection implements Iterable<Data> {
-
-    @FunctionalInterface
-    public interface DataBuilder {
-
-        void emit(ByteBuffer buffer, Consumer<DataPatch> patch);
-
-        static DataBuilder raw(byte[] data) {
-            return (buffer, patch) -> buffer.put(data);
-        }
-
-        static DataBuilder serializable(SerializableConstant c) {
-            return (buffer, patch) -> c.serialize(buffer);
-        }
-
-        static DataBuilder zero(int size) {
-            switch (size) {
-                case 1:
-                    return (buffer, patch) -> buffer.put((byte) 0);
-                case 2:
-                    return (buffer, patch) -> buffer.putShort((short) 0);
-                case 4:
-                    return (buffer, patch) -> buffer.putInt(0);
-                case 8:
-                    return (buffer, patch) -> buffer.putLong(0L);
-                default:
-                    return (buffer, patch) -> {
-                        int rest = size;
-                        while (rest > 8) {
-                            buffer.putLong(0L);
-                            rest -= 8;
-                        }
-                        while (rest > 0) {
-                            buffer.put((byte) 0);
-                            rest--;
-                        }
-                    };
-            }
-        }
-    }
-
-    public static final class Data {
-
-        private int alignment;
-        private final int size;
-        private final DataBuilder builder;
-
-        private DataSectionReference ref;
-
-        public Data(int alignment, int size, DataBuilder builder) {
-            this.alignment = alignment;
-            this.size = size;
-            this.builder = builder;
-
-            // initialized in DataSection.insertData(Data)
-            ref = null;
-        }
-
-        public void updateAlignment(int newAlignment) {
-            if (newAlignment == alignment) {
-                return;
-            }
-            alignment = lcm(alignment, newAlignment);
-        }
-
-        public int getAlignment() {
-            return alignment;
-        }
-
-        public int getSize() {
-            return size;
-        }
-
-        public DataBuilder getBuilder() {
-            return builder;
-        }
-
-        @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;
-        }
-    }
-
-    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 Consumer} to receive {@link DataPatch data patches} for relocations in
-     *            the data section
-     */
-    public void buildDataSection(ByteBuffer buffer, Consumer<DataPatch> patch) {
-        checkClosed();
-        for (Data d : dataItems) {
-            buffer.position(d.ref.getOffset());
-            d.builder.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();
-    }
-
-    public 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/jvmci/jdk.vm.ci.code/src/jdk/vm/ci/code/InfopointReason.java	Fri Jan 15 15:51:01 2016 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2013, 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 jdk.vm.ci.code;
-
-/**
- * A reason for infopoint insertion.
- */
-public enum InfopointReason {
-    SAFEPOINT,
-    CALL,
-    IMPLICIT_EXCEPTION,
-    METHOD_START,
-    METHOD_END,
-    BYTECODE_POSITION;
-}
--- a/jvmci/jdk.vm.ci.code/src/jdk/vm/ci/code/package-info.java	Fri Jan 15 15:51:01 2016 +0100
+++ b/jvmci/jdk.vm.ci.code/src/jdk/vm/ci/code/package-info.java	Fri Jan 15 16:50:19 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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 that defines the interface between a Java application that wants to install code and the runtime.
  * The runtime provides in implementation of the {@link jdk.vm.ci.code.CodeCacheProvider} interface.
- * The method {@link jdk.vm.ci.code.CodeCacheProvider#addCode(jdk.vm.ci.meta.ResolvedJavaMethod, CompilationResult, jdk.vm.ci.meta.SpeculationLog, InstalledCode)}
+ * The method {@link jdk.vm.ci.code.CodeCacheProvider#addCode(jdk.vm.ci.meta.ResolvedJavaMethod, CompiledCode, jdk.vm.ci.meta.SpeculationLog, InstalledCode)}
  * can be used to install code.
  */
 package jdk.vm.ci.code;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jvmci/jdk.vm.ci.code/src/jdk/vm/ci/code/site/Call.java	Fri Jan 15 16:50:19 2016 +0100
@@ -0,0 +1,87 @@
+/*
+ * 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 jdk.vm.ci.code.site;
+
+import java.util.Objects;
+
+import jdk.vm.ci.code.DebugInfo;
+import jdk.vm.ci.meta.InvokeTarget;
+
+/**
+ * Represents a call in the code.
+ */
+public final class Call extends Infopoint {
+
+    /**
+     * The target of the call.
+     */
+    public final InvokeTarget target;
+
+    /**
+     * The size of the call instruction.
+     */
+    public final int size;
+
+    /**
+     * Specifies if this call is direct or indirect. A direct call has an immediate operand encoding
+     * the absolute or relative (to the call itself) address of the target. An indirect call has a
+     * register or memory operand specifying the target address of the call.
+     */
+    public final boolean direct;
+
+    public Call(InvokeTarget target, int pcOffset, int size, boolean direct, DebugInfo debugInfo) {
+        super(pcOffset, debugInfo, InfopointReason.CALL);
+        this.size = size;
+        this.target = target;
+        this.direct = direct;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj instanceof Call && super.equals(obj)) {
+            Call that = (Call) obj;
+            if (this.size == that.size && this.direct == that.direct && Objects.equals(this.target, that.target)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        sb.append(pcOffset);
+        sb.append('[');
+        sb.append(target);
+        sb.append(']');
+
+        if (debugInfo != null) {
+            appendDebugInfo(sb, debugInfo);
+        }
+
+        return sb.toString();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jvmci/jdk.vm.ci.code/src/jdk/vm/ci/code/site/ConstantReference.java	Fri Jan 15 16:50:19 2016 +0100
@@ -0,0 +1,62 @@
+/*
+ * 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 jdk.vm.ci.code.site;
+
+import java.util.Objects;
+
+import jdk.vm.ci.meta.VMConstant;
+
+public final class ConstantReference extends Reference {
+
+    private final VMConstant constant;
+
+    public ConstantReference(VMConstant constant) {
+        this.constant = constant;
+    }
+
+    public VMConstant getConstant() {
+        return constant;
+    }
+
+    @Override
+    public String toString() {
+        return constant.toString();
+    }
+
+    @Override
+    public int hashCode() {
+        return constant.hashCode();
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj instanceof ConstantReference) {
+            ConstantReference that = (ConstantReference) obj;
+            return Objects.equals(this.constant, that.constant);
+        }
+        return false;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jvmci/jdk.vm.ci.code/src/jdk/vm/ci/code/site/DataPatch.java	Fri Jan 15 16:50:19 2016 +0100
@@ -0,0 +1,61 @@
+/*
+ * 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 jdk.vm.ci.code.site;
+
+import java.util.Objects;
+
+import jdk.vm.ci.meta.JavaConstant;
+
+/**
+ * Represents a code site that references some data. The associated data can be either a
+ * {@link DataSectionReference reference} to the data section, or it may be an inlined
+ * {@link JavaConstant} that needs to be patched.
+ */
+public final class DataPatch extends Site {
+
+    public Reference reference;
+
+    public DataPatch(int pcOffset, Reference reference) {
+        super(pcOffset);
+        this.reference = reference;
+    }
+
+    @Override
+    public String toString() {
+        return String.format("%d[<data patch referring to %s>]", pcOffset, reference.toString());
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj instanceof DataPatch) {
+            DataPatch that = (DataPatch) obj;
+            if (this.pcOffset == that.pcOffset && Objects.equals(this.reference, that.reference)) {
+                return true;
+            }
+        }
+        return false;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jvmci/jdk.vm.ci.code/src/jdk/vm/ci/code/site/DataSectionReference.java	Fri Jan 15 16:50:19 2016 +0100
@@ -0,0 +1,73 @@
+/*
+ * 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 jdk.vm.ci.code.site;
+
+public final class DataSectionReference extends Reference {
+
+    private boolean initialized;
+    private int offset;
+
+    public DataSectionReference() {
+        // will be set after the data section layout is fixed
+        offset = 0xDEADDEAD;
+    }
+
+    public int getOffset() {
+        assert initialized;
+
+        return offset;
+    }
+
+    public void setOffset(int offset) {
+        assert !initialized;
+        initialized = true;
+
+        this.offset = offset;
+    }
+
+    @Override
+    public int hashCode() {
+        return offset;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj instanceof DataSectionReference) {
+            DataSectionReference that = (DataSectionReference) obj;
+            return this.offset == that.offset;
+        }
+        return false;
+    }
+
+    @Override
+    public String toString() {
+        if (initialized) {
+            return String.format("DataSection[0x%x]", offset);
+        } else {
+            return "DataSection[?]";
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jvmci/jdk.vm.ci.code/src/jdk/vm/ci/code/site/ExceptionHandler.java	Fri Jan 15 16:50:19 2016 +0100
@@ -0,0 +1,56 @@
+/*
+ * 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 jdk.vm.ci.code.site;
+
+/**
+ * Represents exception handler information for a specific code position. It includes the catch code
+ * position as well as the caught exception type.
+ */
+public final class ExceptionHandler extends Site {
+
+    public final int handlerPos;
+
+    public ExceptionHandler(int pcOffset, int handlerPos) {
+        super(pcOffset);
+        this.handlerPos = handlerPos;
+    }
+
+    @Override
+    public String toString() {
+        return String.format("%d[<exception edge to %d>]", pcOffset, handlerPos);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj instanceof ExceptionHandler) {
+            ExceptionHandler that = (ExceptionHandler) obj;
+            if (this.pcOffset == that.pcOffset && this.handlerPos == that.handlerPos) {
+                return true;
+            }
+        }
+        return false;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jvmci/jdk.vm.ci.code/src/jdk/vm/ci/code/site/Infopoint.java	Fri Jan 15 16:50:19 2016 +0100
@@ -0,0 +1,113 @@
+/*
+ * 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 jdk.vm.ci.code.site;
+
+import java.util.Map;
+import java.util.Objects;
+
+import jdk.vm.ci.code.BytecodePosition;
+import jdk.vm.ci.code.DebugInfo;
+import jdk.vm.ci.code.ReferenceMap;
+import jdk.vm.ci.code.Register;
+import jdk.vm.ci.code.RegisterSaveLayout;
+import jdk.vm.ci.meta.MetaUtil;
+
+/**
+ * Represents an infopoint with associated debug info. Note that safepoints are also infopoints.
+ */
+public class Infopoint extends Site implements Comparable<Infopoint> {
+
+    public final DebugInfo debugInfo;
+
+    public final InfopointReason reason;
+
+    public Infopoint(int pcOffset, DebugInfo debugInfo, InfopointReason reason) {
+        super(pcOffset);
+        this.debugInfo = debugInfo;
+        this.reason = reason;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        sb.append(pcOffset);
+        sb.append("[<infopoint>]");
+        appendDebugInfo(sb, debugInfo);
+        return sb.toString();
+    }
+
+    @Override
+    public int compareTo(Infopoint o) {
+        if (pcOffset < o.pcOffset) {
+            return -1;
+        } else if (pcOffset > o.pcOffset) {
+            return 1;
+        }
+        return this.reason.compareTo(o.reason);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj != null && obj.getClass() == getClass()) {
+            Infopoint that = (Infopoint) obj;
+            if (this.pcOffset == that.pcOffset && Objects.equals(this.debugInfo, that.debugInfo) && Objects.equals(this.reason, that.reason)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    protected static void appendDebugInfo(StringBuilder sb, DebugInfo info) {
+        if (info != null) {
+            ReferenceMap refMap = info.getReferenceMap();
+            if (refMap != null) {
+                sb.append(refMap.toString());
+                sb.append(']');
+            }
+            RegisterSaveLayout calleeSaveInfo = info.getCalleeSaveInfo();
+            if (calleeSaveInfo != null) {
+                sb.append(" callee-save-info[");
+                String sep = "";
+                for (Map.Entry<Register, Integer> e : calleeSaveInfo.registersToSlots(true).entrySet()) {
+                    sb.append(sep).append(e.getKey()).append("->").append(e.getValue());
+                    sep = ", ";
+                }
+                sb.append(']');
+            }
+            BytecodePosition codePos = info.getBytecodePosition();
+            if (codePos != null) {
+                MetaUtil.appendLocation(sb.append(" "), codePos.getMethod(), codePos.getBCI());
+                if (info.hasFrame()) {
+                    sb.append(" #locals=").append(info.frame().numLocals).append(" #expr=").append(info.frame().numStack);
+                    if (info.frame().numLocks > 0) {
+                        sb.append(" #locks=").append(info.frame().numLocks);
+                    }
+                }
+            }
+        }
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jvmci/jdk.vm.ci.code/src/jdk/vm/ci/code/site/InfopointReason.java	Fri Jan 15 16:50:19 2016 +0100
@@ -0,0 +1,35 @@
+/*
+ * 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
+ * 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 jdk.vm.ci.code.site;
+
+/**
+ * A reason for infopoint insertion.
+ */
+public enum InfopointReason {
+    SAFEPOINT,
+    CALL,
+    IMPLICIT_EXCEPTION,
+    METHOD_START,
+    METHOD_END,
+    BYTECODE_POSITION;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jvmci/jdk.vm.ci.code/src/jdk/vm/ci/code/site/Mark.java	Fri Jan 15 16:50:19 2016 +0100
@@ -0,0 +1,64 @@
+/*
+ * 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 jdk.vm.ci.code.site;
+
+import java.util.Objects;
+
+/**
+ * Represents a mark in the machine code that can be used by the runtime for its own purposes. A
+ * mark can reference other marks.
+ */
+public final class Mark extends Site {
+
+    public final Object id;
+
+    public Mark(int pcOffset, Object id) {
+        super(pcOffset);
+        this.id = id;
+    }
+
+    @Override
+    public String toString() {
+        if (id == null) {
+            return String.format("%d[<mar>]", pcOffset);
+        } else if (id instanceof Integer) {
+            return String.format("%d[<mark with id %s>]", pcOffset, Integer.toHexString((Integer) id));
+        } else {
+            return String.format("%d[<mark with id %s>]", pcOffset, id.toString());
+        }
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj instanceof Mark) {
+            Mark that = (Mark) obj;
+            if (this.pcOffset == that.pcOffset && Objects.equals(this.id, that.id)) {
+                return true;
+            }
+        }
+        return false;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jvmci/jdk.vm.ci.code/src/jdk/vm/ci/code/site/Reference.java	Fri Jan 15 16:50:19 2016 +0100
@@ -0,0 +1,35 @@
+/*
+ * 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 jdk.vm.ci.code.site;
+
+/**
+ * Represents some external data that is referenced by the code.
+ */
+public abstract class Reference {
+
+    @Override
+    public abstract int hashCode();
+
+    @Override
+    public abstract boolean equals(Object obj);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jvmci/jdk.vm.ci.code/src/jdk/vm/ci/code/site/Site.java	Fri Jan 15 16:50:19 2016 +0100
@@ -0,0 +1,53 @@
+/*
+ * 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 jdk.vm.ci.code.site;
+
+import static jdk.vm.ci.meta.MetaUtil.identityHashCodeString;
+
+/**
+ * Represents a code position with associated additional information.
+ */
+public abstract class Site {
+
+    /**
+     * The position (or offset) of this site with respect to the start of the target method.
+     */
+    public final int pcOffset;
+
+    public Site(int pos) {
+        this.pcOffset = pos;
+    }
+
+    @Override
+    public final int hashCode() {
+        throw new UnsupportedOperationException("hashCode");
+    }
+
+    @Override
+    public String toString() {
+        return identityHashCodeString(this);
+    }
+
+    @Override
+    public abstract boolean equals(Object obj);
+}
--- a/jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotCodeCacheProvider.java	Fri Jan 15 15:51:01 2016 +0100
+++ b/jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotCodeCacheProvider.java	Fri Jan 15 16:50:19 2016 +0100
@@ -22,30 +22,18 @@
  */
 package jdk.vm.ci.hotspot;
 
-import static jdk.vm.ci.hotspot.HotSpotCompressedNullConstant.COMPRESSED_NULL;
-
 import java.lang.reflect.Field;
 
 import jdk.vm.ci.code.BailoutException;
 import jdk.vm.ci.code.CodeCacheProvider;
-import jdk.vm.ci.code.CompilationRequest;
-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.Mark;
-import jdk.vm.ci.code.DataSection;
-import jdk.vm.ci.code.DataSection.Data;
-import jdk.vm.ci.code.DataSection.DataBuilder;
+import jdk.vm.ci.code.CompiledCode;
 import jdk.vm.ci.code.InstalledCode;
 import jdk.vm.ci.code.RegisterConfig;
 import jdk.vm.ci.code.TargetDescription;
-import jdk.vm.ci.common.JVMCIError;
-import jdk.vm.ci.meta.Constant;
-import jdk.vm.ci.meta.JavaConstant;
-import jdk.vm.ci.meta.SerializableConstant;
+import jdk.vm.ci.code.site.Call;
+import jdk.vm.ci.code.site.Mark;
+import jdk.vm.ci.meta.ResolvedJavaMethod;
 import jdk.vm.ci.meta.SpeculationLog;
-import jdk.vm.ci.meta.VMConstant;
 
 /**
  * HotSpot implementation of {@link CodeCacheProvider}.
@@ -113,41 +101,25 @@
         return runtime.getConfig().runtimeCallStackSize;
     }
 
-    private InstalledCode logOrDump(InstalledCode installedCode, CompilationResult compResult) {
-        ((HotSpotJVMCIRuntime) runtime).notifyInstall(this, installedCode, compResult);
+    private InstalledCode logOrDump(InstalledCode installedCode, CompiledCode compiledCode) {
+        ((HotSpotJVMCIRuntime) runtime).notifyInstall(this, installedCode, compiledCode);
         return installedCode;
     }
 
-    public InstalledCode installCode(CompilationRequest compRequest, CompilationResult compResult, InstalledCode installedCode, SpeculationLog log, boolean isDefault) {
-        HotSpotResolvedJavaMethod method = compRequest != null ? (HotSpotResolvedJavaMethod) compRequest.getMethod() : null;
+    public InstalledCode installCode(ResolvedJavaMethod method, CompiledCode compiledCode, InstalledCode installedCode, SpeculationLog log, boolean isDefault) {
         InstalledCode resultInstalledCode;
         if (installedCode == null) {
             if (method == null) {
                 // Must be a stub
-                resultInstalledCode = new HotSpotRuntimeStub(compResult.getName());
+                resultInstalledCode = new HotSpotRuntimeStub(compiledCode.getName());
             } else {
-                resultInstalledCode = new HotSpotNmethod(method, compResult.getName(), isDefault);
+                resultInstalledCode = new HotSpotNmethod((HotSpotResolvedJavaMethod) method, compiledCode.getName(), isDefault);
             }
         } else {
             resultInstalledCode = installedCode;
         }
-        HotSpotCompiledCode compiledCode;
-        if (method != null) {
-            final int id;
-            final long jvmciEnv;
-            if (compRequest instanceof HotSpotCompilationRequest) {
-                HotSpotCompilationRequest hsCompRequest = (HotSpotCompilationRequest) compRequest;
-                id = hsCompRequest.getId();
-                jvmciEnv = hsCompRequest.getJvmciEnv();
-            } else {
-                id = method.allocateCompileId(compRequest.getEntryBCI());
-                jvmciEnv = 0L;
-            }
-            compiledCode = new HotSpotCompiledNmethod(method, compResult, id, jvmciEnv);
-        } else {
-            compiledCode = new HotSpotCompiledCode(compResult);
-        }
-        int result = runtime.getCompilerToVM().installCode(target, compiledCode, resultInstalledCode, (HotSpotSpeculationLog) log);
+
+        int result = runtime.getCompilerToVM().installCode(target, (HotSpotCompiledCode) compiledCode, resultInstalledCode, (HotSpotSpeculationLog) log);
         if (result != config.codeInstallResultOk) {
             String resultDesc = config.getCodeInstallResultDescription(result);
             if (compiledCode instanceof HotSpotCompiledNmethod) {
@@ -163,83 +135,16 @@
                 }
                 throw new BailoutException(result != config.codeInstallResultDependenciesFailed, msg);
             } else {
-                throw new BailoutException("Error installing %s: %s", compResult.getName(), resultDesc);
+                throw new BailoutException("Error installing %s: %s", compiledCode.getName(), resultDesc);
             }
         }
-        return logOrDump(resultInstalledCode, compResult);
+        return logOrDump(resultInstalledCode, compiledCode);
     }
 
     public void invalidateInstalledCode(InstalledCode installedCode) {
         runtime.getCompilerToVM().invalidateInstalledCode(installedCode);
     }
 
-    private Data createSingleDataItem(Constant constant) {
-        int size;
-        DataBuilder builder;
-        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) {
-                builder = (buffer, patch) -> {
-                    patch.accept(new DataPatch(buffer.position(), new ConstantReference(vmConstant)));
-                    buffer.putInt(0xDEADDEAD);
-                };
-            } else {
-                assert size == 8;
-                builder = (buffer, patch) -> {
-                    patch.accept(new DataPatch(buffer.position(), new ConstantReference(vmConstant)));
-                    buffer.putLong(0xDEADDEADDEADDEADL);
-                };
-            }
-        } else if (JavaConstant.isNull(constant)) {
-            boolean compressed = COMPRESSED_NULL.equals(constant);
-            size = compressed ? 4 : target.wordSize;
-            builder = DataBuilder.zero(size);
-        } else if (constant instanceof SerializableConstant) {
-            SerializableConstant s = (SerializableConstant) constant;
-            size = s.getSerializedSize();
-            builder = DataBuilder.serializable(s);
-        } else {
-            throw new JVMCIError(String.valueOf(constant));
-        }
-
-        return new Data(size, size, builder);
-    }
-
-    public Data createDataItem(Constant... constants) {
-        assert constants.length > 0;
-        if (constants.length == 1) {
-            return createSingleDataItem(constants[0]);
-        } else {
-            DataBuilder[] builders = new DataBuilder[constants.length];
-            int size = 0;
-            int alignment = 1;
-            for (int i = 0; i < constants.length; i++) {
-                Data data = createSingleDataItem(constants[i]);
-
-                assert size % data.getAlignment() == 0 : "invalid alignment in packed constants";
-                alignment = DataSection.lcm(alignment, data.getAlignment());
-
-                builders[i] = data.getBuilder();
-                size += data.getSize();
-            }
-            DataBuilder ret = (buffer, patches) -> {
-                for (DataBuilder b : builders) {
-                    b.emit(buffer, patches);
-                }
-            };
-            return new Data(alignment, size, ret);
-        }
-    }
-
     @Override
     public TargetDescription getTarget() {
         return target;
--- a/jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotCompiledCode.java	Fri Jan 15 15:51:01 2016 +0100
+++ b/jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotCompiledCode.java	Fri Jan 15 16:50: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
@@ -22,61 +22,26 @@
  */
 package jdk.vm.ci.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.BytecodeFrame;
-import jdk.vm.ci.code.CompilationResult;
-import jdk.vm.ci.code.CompilationResult.CodeAnnotation;
-import jdk.vm.ci.code.CompilationResult.CodeComment;
-import jdk.vm.ci.code.CompilationResult.DataPatch;
-import jdk.vm.ci.code.CompilationResult.ExceptionHandler;
-import jdk.vm.ci.code.CompilationResult.Infopoint;
-import jdk.vm.ci.code.CompilationResult.JumpTable;
-import jdk.vm.ci.code.CompilationResult.Mark;
-import jdk.vm.ci.code.CompilationResult.Site;
-import jdk.vm.ci.code.DataSection;
-import jdk.vm.ci.code.InfopointReason;
-import jdk.vm.ci.common.JVMCIError;
+import jdk.vm.ci.code.CompiledCode;
+import jdk.vm.ci.code.site.DataPatch;
+import jdk.vm.ci.code.site.Site;
 import jdk.vm.ci.meta.Assumptions.Assumption;
 import jdk.vm.ci.meta.ResolvedJavaMethod;
 
 /**
- * A {@link CompilationResult} with additional HotSpot-specific information required for installing
- * the code in HotSpot's code cache.
+ * A {@link CompiledCode} with additional HotSpot-specific information required for installing the
+ * code in HotSpot's code cache.
  */
-public class HotSpotCompiledCode {
+public class HotSpotCompiledCode extends CompiledCode {
 
-    public final String name;
-    public final Site[] sites;
-    public final ExceptionHandler[] exceptionHandlers;
-    public final Comment[] comments;
-    public final Assumption[] assumptions;
-
-    public final byte[] targetCode;
-    public final int targetCodeSize;
+    protected final Comment[] comments;
 
-    public final byte[] dataSection;
-    public final int dataSectionAlignment;
-    public final DataPatch[] dataSectionPatches;
-
-    public final int totalFrameSize;
-    public final int customStackAreaOffset;
+    protected final byte[] dataSection;
+    protected final int dataSectionAlignment;
+    protected final DataPatch[] dataSectionPatches;
 
-    /**
-     * 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.
-     */
-    public final ResolvedJavaMethod[] methods;
+    protected final int totalFrameSize;
+    protected final int customStackAreaOffset;
 
     public static class Comment {
 
@@ -89,179 +54,14 @@
         }
     }
 
-    public HotSpotCompiledCode(CompilationResult compResult) {
-        name = compResult.getName();
-        sites = getSortedSites(compResult);
-        if (compResult.getExceptionHandlers().isEmpty()) {
-            exceptionHandlers = null;
-        } else {
-            exceptionHandlers = compResult.getExceptionHandlers().toArray(new ExceptionHandler[compResult.getExceptionHandlers().size()]);
-        }
-        List<CodeAnnotation> annotations = compResult.getAnnotations();
-        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);
-            }
-        }
-        assumptions = compResult.getAssumptions();
-        assert validateFrames();
-
-        targetCode = compResult.getTargetCode();
-        targetCodeSize = compResult.getTargetCodeSize();
-
-        DataSection data = compResult.getDataSection();
-        dataSection = new byte[data.getSectionSize()];
-
-        ByteBuffer buffer = ByteBuffer.wrap(dataSection).order(ByteOrder.nativeOrder());
-        Builder<DataPatch> patchBuilder = Stream.builder();
-        data.buildDataSection(buffer, patchBuilder);
-
-        dataSectionAlignment = data.getSectionAlignment();
-        dataSectionPatches = patchBuilder.build().toArray(len -> new DataPatch[len]);
-
-        totalFrameSize = compResult.getTotalFrameSize();
-        customStackAreaOffset = compResult.getCustomStackAreaOffset();
-
-        methods = compResult.getMethods();
-    }
-
-    /**
-     * Ensure that all the frames passed into HotSpot are properly formatted with an empty or
-     * illegal slot following double word slots.
-     */
-    private boolean validateFrames() {
-        for (Site site : sites) {
-            if (site instanceof Infopoint) {
-                Infopoint info = (Infopoint) site;
-                if (info.debugInfo != null) {
-                    BytecodeFrame frame = info.debugInfo.frame();
-                    assert frame == null || frame.validateFormat();
-                }
-            }
-        }
-        return true;
-    }
-
-    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.getInfopoints(), target.getDataPatches(), target.getMarks()};
-        int count = 0;
-        for (List<?> list : lists) {
-            count += list.size();
-        }
-        Site[] result = new Site[count];
-        int pos = 0;
-        for (List<?> list : lists) {
-            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;
-    }
-
-    @Override
-    public String toString() {
-        return name;
+    public HotSpotCompiledCode(String name, byte[] targetCode, int targetCodeSize, Site[] sites, Assumption[] assumptions, ResolvedJavaMethod[] methods, Comment[] comments, byte[] dataSection,
+                    int dataSectionAlignment, DataPatch[] dataSectionPatches, int totalFrameSize, int customStackAreaOffset) {
+        super(name, targetCode, targetCodeSize, sites, assumptions, methods);
+        this.comments = comments;
+        this.dataSection = dataSection;
+        this.dataSectionAlignment = dataSectionAlignment;
+        this.dataSectionPatches = dataSectionPatches;
+        this.totalFrameSize = totalFrameSize;
+        this.customStackAreaOffset = customStackAreaOffset;
     }
 }
--- a/jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotCompiledNmethod.java	Fri Jan 15 15:51:01 2016 +0100
+++ b/jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotCompiledNmethod.java	Fri Jan 15 16:50:19 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2014, 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
@@ -22,28 +22,31 @@
  */
 package jdk.vm.ci.hotspot;
 
-import jdk.vm.ci.code.CompilationResult;
+import jdk.vm.ci.code.site.DataPatch;
+import jdk.vm.ci.code.site.Site;
 import jdk.vm.ci.inittimer.SuppressFBWarnings;
+import jdk.vm.ci.meta.Assumptions.Assumption;
+import jdk.vm.ci.meta.ResolvedJavaMethod;
 
 /**
  * {@link HotSpotCompiledCode} destined for installation as an nmethod.
  */
 public final class HotSpotCompiledNmethod extends HotSpotCompiledCode {
 
-    public final HotSpotResolvedJavaMethod method;
-    public final int entryBCI;
+    protected final HotSpotResolvedJavaMethod method;
+    protected final int entryBCI;
 
     /**
      * Compilation identifier.
      */
-    public final int id;
+    protected final int id;
 
     /**
      * Address of a native {@code JVMCIEnv} object or 0L if no such object exists.
      */
-    public final long jvmciEnv;
+    protected final long jvmciEnv;
 
-    public final boolean hasUnsafeAccess;
+    protected final boolean hasUnsafeAccess;
 
     /**
      * May be set by VM if code installation fails. It will describe in more detail why installation
@@ -51,13 +54,15 @@
      */
     @SuppressFBWarnings(value = "UWF_UNWRITTEN_FIELD", justification = "set by the VM") private String installationFailureMessage;
 
-    public HotSpotCompiledNmethod(HotSpotResolvedJavaMethod method, CompilationResult compResult, int id, long jvmciEnv) {
-        super(compResult);
+    public HotSpotCompiledNmethod(String name, byte[] targetCode, int targetCodeSize, Site[] sites, Assumption[] assumptions, ResolvedJavaMethod[] methods, Comment[] comments, byte[] dataSection,
+                    int dataSectionAlignment, DataPatch[] dataSectionPatches, int totalFrameSize, int customStackAreaOffset, HotSpotResolvedJavaMethod method, int entryBCI, int id, long jvmciEnv,
+                    boolean hasUnsafeAccess) {
+        super(name, targetCode, targetCodeSize, sites, assumptions, methods, comments, dataSection, dataSectionAlignment, dataSectionPatches, totalFrameSize, customStackAreaOffset);
         this.method = method;
-        this.entryBCI = compResult.getEntryBCI();
+        this.entryBCI = entryBCI;
         this.id = id;
         this.jvmciEnv = jvmciEnv;
-        this.hasUnsafeAccess = compResult.hasUnsafeAccess();
+        this.hasUnsafeAccess = hasUnsafeAccess;
     }
 
     @Override
--- a/jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIRuntime.java	Fri Jan 15 15:51:01 2016 +0100
+++ b/jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIRuntime.java	Fri Jan 15 16:50: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
@@ -38,7 +38,7 @@
 
 import jdk.vm.ci.code.Architecture;
 import jdk.vm.ci.code.CompilationRequestResult;
-import jdk.vm.ci.code.CompilationResult;
+import jdk.vm.ci.code.CompiledCode;
 import jdk.vm.ci.code.InstalledCode;
 import jdk.vm.ci.common.JVMCIError;
 import jdk.vm.ci.inittimer.InitTimer;
@@ -263,11 +263,11 @@
      *
      * @param hotSpotCodeCacheProvider
      * @param installedCode
-     * @param compResult
+     * @param compiledCode
      */
-    void notifyInstall(HotSpotCodeCacheProvider hotSpotCodeCacheProvider, InstalledCode installedCode, CompilationResult compResult) {
+    void notifyInstall(HotSpotCodeCacheProvider hotSpotCodeCacheProvider, InstalledCode installedCode, CompiledCode compiledCode) {
         for (HotSpotVMEventListener vmEventListener : vmEventListeners) {
-            vmEventListener.notifyInstall(hotSpotCodeCacheProvider, installedCode, compResult);
+            vmEventListener.notifyInstall(hotSpotCodeCacheProvider, installedCode, compiledCode);
         }
     }
 
--- a/jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVMEventListener.java	Fri Jan 15 15:51:01 2016 +0100
+++ b/jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVMEventListener.java	Fri Jan 15 16:50: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
@@ -22,7 +22,7 @@
  */
 package jdk.vm.ci.hotspot;
 
-import jdk.vm.ci.code.CompilationResult;
+import jdk.vm.ci.code.CompiledCode;
 import jdk.vm.ci.code.InstalledCode;
 import jdk.vm.ci.meta.JVMCIMetaAccessContext;
 import jdk.vm.ci.meta.ResolvedJavaType;
@@ -40,9 +40,9 @@
      *
      * @param hotSpotCodeCacheProvider
      * @param installedCode
-     * @param compResult
+     * @param compiledCode
      */
-    default void notifyInstall(HotSpotCodeCacheProvider hotSpotCodeCacheProvider, InstalledCode installedCode, CompilationResult compResult) {
+    default void notifyInstall(HotSpotCodeCacheProvider hotSpotCodeCacheProvider, InstalledCode installedCode, CompiledCode compiledCode) {
     }
 
     /**
--- a/src/share/vm/jvmci/jvmciCodeInstaller.cpp	Fri Jan 15 15:51:01 2016 +0100
+++ b/src/share/vm/jvmci/jvmciCodeInstaller.cpp	Fri Jan 15 16:50: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
@@ -390,7 +390,7 @@
   CompilerThread* compilerThread = thread->is_Compiler_thread() ? thread->as_CompilerThread() : NULL;
   _oop_recorder = new OopRecorder(&_arena, true);
   _dependencies = new Dependencies(&_arena, _oop_recorder, compilerThread != NULL ? compilerThread->log() : NULL);
-  objArrayHandle assumptions = HotSpotCompiledCode::assumptions(compiled_code);
+  objArrayHandle assumptions = CompiledCode::assumptions(compiled_code);
   if (!assumptions.is_null()) {
     int length = assumptions->length();
     for (int i = 0; i < length; ++i) {
@@ -413,7 +413,7 @@
     }
   }
   if (JvmtiExport::can_hotswap_or_post_breakpoint()) {
-    objArrayHandle methods = HotSpotCompiledCode::methods(compiled_code);
+    objArrayHandle methods = CompiledCode::methods(compiled_code);
     if (!methods.is_null()) {
       int length = methods->length();
       for (int i = 0; i < length; ++i) {
@@ -440,12 +440,11 @@
   if (result != JVMCIEnv::ok) {
     return result;
   }
-  process_exception_handlers();
 
   int stack_slots = _total_frame_size / HeapWordSize; // conversion to words
 
   if (!compiled_code->is_a(HotSpotCompiledNmethod::klass())) {
-    oop stubName = HotSpotCompiledCode::name(compiled_code_obj);
+    oop stubName = CompiledCode::name(compiled_code_obj);
     char* name = strdup(java_lang_String::as_utf8_string(stubName));
     cb = RuntimeStub::new_runtime_stub(name,
                                        &buffer,
@@ -490,11 +489,10 @@
     // Only used in OopMap constructor for non-product builds
     _parameter_count = 0;
   }
-  _sites_handle = JNIHandles::make_local(HotSpotCompiledCode::sites(compiled_code));
-  _exception_handlers_handle = JNIHandles::make_local(HotSpotCompiledCode::exceptionHandlers(compiled_code));
+  _sites_handle = JNIHandles::make_local(CompiledCode::sites(compiled_code));
 
-  _code_handle = JNIHandles::make_local(HotSpotCompiledCode::targetCode(compiled_code));
-  _code_size = HotSpotCompiledCode::targetCodeSize(compiled_code);
+  _code_handle = JNIHandles::make_local(CompiledCode::targetCode(compiled_code));
+  _code_size = CompiledCode::targetCodeSize(compiled_code);
   _total_frame_size = HotSpotCompiledCode::totalFrameSize(compiled_code);
   _custom_stack_area_offset = HotSpotCompiledCode::customStackAreaOffset(compiled_code);
 
@@ -525,8 +523,8 @@
   objArrayOop sites = this->sites();
   for (int i = 0; i < sites->length(); i++) {
     oop site = sites->obj_at(i);
-    if (site->is_a(CompilationResult_Mark::klass())) {
-      oop id_obj = CompilationResult_Mark::id(site);
+    if (site->is_a(site_Mark::klass())) {
+      oop id_obj = site_Mark::id(site);
       if (id_obj != NULL) {
         if (!java_lang_boxing_object::is_instance(id_obj, T_INT)) {
           JVMCI_ERROR_0("expected Integer id, got %s", id_obj->klass()->signature_name());
@@ -583,12 +581,12 @@
 
   for (int i = 0; i < data_section_patches()->length(); i++) {
     Handle patch = data_section_patches()->obj_at(i);
-    Handle reference = CompilationResult_DataPatch::reference(patch);
-    if (!reference->is_a(CompilationResult_ConstantReference::klass())) {
+    Handle reference = site_DataPatch::reference(patch);
+    if (!reference->is_a(site_ConstantReference::klass())) {
       JVMCI_ERROR_OK("invalid patch in data section: %s", reference->klass()->signature_name());
     }
-    Handle constant = CompilationResult_ConstantReference::constant(reference);
-    address dest = _constants->start() + CompilationResult_Site::pcOffset(patch);
+    Handle constant = site_ConstantReference::constant(reference);
+    address dest = _constants->start() + site_Site::pcOffset(patch);
     if (constant->is_a(HotSpotMetaspaceConstantImpl::klass())) {
       if (HotSpotMetaspaceConstantImpl::compressed(constant)) {
 #ifdef _LP64
@@ -620,27 +618,30 @@
   jint last_pc_offset = -1;
   for (int i = 0; i < sites->length(); i++) {
     Handle site = sites->obj_at(i);
-    jint pc_offset = CompilationResult_Site::pcOffset(site);
+    jint pc_offset = site_Site::pcOffset(site);
 
-    if (site->is_a(CompilationResult_Call::klass())) {
+    if (site->is_a(site_Call::klass())) {
       TRACE_jvmci_4("call at %i", pc_offset);
       site_Call(buffer, pc_offset, site, CHECK_OK);
-    } else if (site->is_a(CompilationResult_Infopoint::klass())) {
+    } else if (site->is_a(site_Infopoint::klass())) {
       // three reasons for infopoints denote actual safepoints
-      oop reason = CompilationResult_Infopoint::reason(site);
-      if (InfopointReason::SAFEPOINT() == reason || InfopointReason::CALL() == reason || InfopointReason::IMPLICIT_EXCEPTION() == reason) {
+      oop reason = site_Infopoint::reason(site);
+      if (site_InfopointReason::SAFEPOINT() == reason || site_InfopointReason::CALL() == reason || site_InfopointReason::IMPLICIT_EXCEPTION() == reason) {
         TRACE_jvmci_4("safepoint at %i", pc_offset);
         site_Safepoint(buffer, pc_offset, site, CHECK_OK);
       } else {
         TRACE_jvmci_4("infopoint at %i", pc_offset);
         site_Infopoint(buffer, pc_offset, site, CHECK_OK);
       }
-    } else if (site->is_a(CompilationResult_DataPatch::klass())) {
+    } else if (site->is_a(site_DataPatch::klass())) {
       TRACE_jvmci_4("datapatch at %i", pc_offset);
       site_DataPatch(buffer, pc_offset, site, CHECK_OK);
-    } else if (site->is_a(CompilationResult_Mark::klass())) {
+    } else if (site->is_a(site_Mark::klass())) {
       TRACE_jvmci_4("mark at %i", pc_offset);
       site_Mark(buffer, pc_offset, site, CHECK_OK);
+    } else if (site->is_a(site_ExceptionHandler::klass())) {
+      TRACE_jvmci_4("exceptionhandler at %i", pc_offset);
+      site_ExceptionHandler(pc_offset, site);
     } else {
       JVMCI_ERROR_OK("unexpected site subclass: %s", site->klass()->signature_name());
     }
@@ -706,21 +707,14 @@
   _dependencies->assert_call_site_target_value(callSite(), methodHandle());
 }
 
-void CodeInstaller::process_exception_handlers() {
-  if (exception_handlers() != NULL) {
-    objArrayOop handlers = exception_handlers();
-    for (int i = 0; i < handlers->length(); i++) {
-      oop exc = handlers->obj_at(i);
-      jint pc_offset = CompilationResult_Site::pcOffset(exc);
-      jint handler_offset = CompilationResult_ExceptionHandler::handlerPos(exc);
+void CodeInstaller::site_ExceptionHandler(jint pc_offset, Handle exc) {
+  jint handler_offset = site_ExceptionHandler::handlerPos(exc);
 
-      // Subtable header
-      _exception_handler_table.add_entry(HandlerTableEntry(1, pc_offset, 0));
+  // Subtable header
+  _exception_handler_table.add_entry(HandlerTableEntry(1, pc_offset, 0));
 
-      // Subtable entry
-      _exception_handler_table.add_entry(HandlerTableEntry(-1, handler_offset, 0));
-    }
-  }
+  // Subtable entry
+  _exception_handler_table.add_entry(HandlerTableEntry(-1, handler_offset, 0));
 }
 
 // If deoptimization happens, the interpreter should reexecute these bytecodes.
@@ -889,7 +883,7 @@
 }
 
 void CodeInstaller::site_Safepoint(CodeBuffer& buffer, jint pc_offset, Handle site, TRAPS) {
-  Handle debug_info = CompilationResult_Infopoint::debugInfo(site);
+  Handle debug_info = site_Infopoint::debugInfo(site);
   if (debug_info.is_null()) {
     JVMCI_ERROR("debug info expected at safepoint at %i", pc_offset);
   }
@@ -903,7 +897,7 @@
 }
 
 void CodeInstaller::site_Infopoint(CodeBuffer& buffer, jint pc_offset, Handle site, TRAPS) {
-  Handle debug_info = CompilationResult_Infopoint::debugInfo(site);
+  Handle debug_info = site_Infopoint::debugInfo(site);
   if (debug_info.is_null()) {
     JVMCI_ERROR("debug info expected at infopoint at %i", pc_offset);
   }
@@ -918,7 +912,7 @@
 }
 
 void CodeInstaller::site_Call(CodeBuffer& buffer, jint pc_offset, Handle site, TRAPS) {
-  Handle target = CompilationResult_Call::target(site);
+  Handle target = site_Call::target(site);
   InstanceKlass* target_klass = InstanceKlass::cast(target->klass());
 
   Handle hotspot_method; // JavaMethod
@@ -930,7 +924,7 @@
     hotspot_method = target;
   }
 
-  Handle debug_info = CompilationResult_Call::debugInfo(site);
+  Handle debug_info = site_Call::debugInfo(site);
 
   assert(hotspot_method.not_null() ^ foreign_call.not_null(), "Call site needs exactly one type");
 
@@ -967,9 +961,9 @@
 }
 
 void CodeInstaller::site_DataPatch(CodeBuffer& buffer, jint pc_offset, Handle site, TRAPS) {
-  Handle reference = CompilationResult_DataPatch::reference(site);
-  if (reference->is_a(CompilationResult_ConstantReference::klass())) {
-    Handle constant = CompilationResult_ConstantReference::constant(reference);
+  Handle reference = site_DataPatch::reference(site);
+  if (reference->is_a(site_ConstantReference::klass())) {
+    Handle constant = site_ConstantReference::constant(reference);
     if (constant->is_a(HotSpotObjectConstantImpl::klass())) {
       pd_patch_OopConstant(pc_offset, constant, CHECK);
     } else if (constant->is_a(HotSpotMetaspaceConstantImpl::klass())) {
@@ -977,8 +971,8 @@
     } else {
       JVMCI_ERROR("unknown constant type in data patch: %s", constant->klass()->signature_name());
     }
-  } else if (reference->is_a(CompilationResult_DataSectionReference::klass())) {
-    int data_offset = CompilationResult_DataSectionReference::offset(reference);
+  } else if (reference->is_a(site_DataSectionReference::klass())) {
+    int data_offset = site_DataSectionReference::offset(reference);
     if (0 <= data_offset && data_offset < _constants_size) {
       pd_patch_DataSectionReference(pc_offset, data_offset);
     } else {
@@ -990,7 +984,7 @@
 }
 
 void CodeInstaller::site_Mark(CodeBuffer& buffer, jint pc_offset, Handle site, TRAPS) {
-  Handle id_obj = CompilationResult_Mark::id(site);
+  Handle id_obj = site_Mark::id(site);
 
   if (id_obj.not_null()) {
     if (!java_lang_boxing_object::is_instance(id_obj(), T_INT)) {
--- a/src/share/vm/jvmci/jvmciCodeInstaller.hpp	Fri Jan 15 15:51:01 2016 +0100
+++ b/src/share/vm/jvmci/jvmciCodeInstaller.hpp	Fri Jan 15 16:50: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
@@ -58,7 +58,6 @@
   jobject       _data_section_handle;
   jobject       _data_section_patches_handle;
   jobject       _sites_handle;
-  jobject       _exception_handlers_handle;
   CodeOffsets   _offsets;
 
   jobject       _code_handle;
@@ -104,7 +103,6 @@
   arrayOop code() { return (arrayOop) JNIHandles::resolve(_code_handle); }
   arrayOop data_section() { return (arrayOop) JNIHandles::resolve(_data_section_handle); }
   objArrayOop data_section_patches() { return (objArrayOop) JNIHandles::resolve(_data_section_patches_handle); }
-  objArrayOop exception_handlers() { return (objArrayOop) JNIHandles::resolve(_exception_handlers_handle); }
 #ifndef PRODUCT
   objArrayOop comments() { return (objArrayOop) JNIHandles::resolve(_comments_handle); }
 #endif
@@ -130,7 +128,7 @@
   narrowKlass record_narrow_metadata_reference(Handle constant, TRAPS);
 #endif
 
-  // extract the fields of the CompilationResult
+  // extract the fields of the HotSpotCompiledCode
   void initialize_fields(oop target, oop target_method, TRAPS);
   void initialize_dependencies(oop target_method, TRAPS);
   
@@ -150,6 +148,7 @@
   void site_Call(CodeBuffer& buffer, jint pc_offset, Handle site, TRAPS);
   void site_DataPatch(CodeBuffer& buffer, jint pc_offset, Handle site, TRAPS);
   void site_Mark(CodeBuffer& buffer, jint pc_offset, Handle site, TRAPS);
+  void site_ExceptionHandler(jint pc_offset, Handle site);
 
   OopMap* create_oop_map(Handle debug_info, TRAPS);
 
@@ -169,7 +168,6 @@
 
   GrowableArray<ScopeValue*>* record_virtual_objects(Handle debug_info, TRAPS);
 
-  void process_exception_handlers();
   int estimateStubSpace(int static_call_stubs);
 };
 
--- a/src/share/vm/jvmci/jvmciJavaClasses.hpp	Fri Jan 15 15:51:01 2016 +0100
+++ b/src/share/vm/jvmci/jvmciJavaClasses.hpp	Fri Jan 15 16:50: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
@@ -77,20 +77,21 @@
   start_class(HotSpotNmethod)                                                                                                                                  \
     boolean_field(HotSpotNmethod, isDefault)                                                                                                                   \
   end_class                                                                                                                                                    \
+  start_class(CompiledCode)                                                                                                                                    \
+    oop_field(CompiledCode, name, "Ljava/lang/String;")                                                                                                        \
+    typeArrayOop_field(CompiledCode, targetCode, "[B")                                                                                                         \
+    int_field(CompiledCode, targetCodeSize)                                                                                                                    \
+    objArrayOop_field(CompiledCode, sites, "[Ljdk/vm/ci/code/site/Site;")                                                                                      \
+    objArrayOop_field(CompiledCode, assumptions, "[Ljdk/vm/ci/meta/Assumptions$Assumption;")                                                                   \
+    objArrayOop_field(CompiledCode, methods, "[Ljdk/vm/ci/meta/ResolvedJavaMethod;")                                                                           \
+  end_class                                                                                                                                                    \
   start_class(HotSpotCompiledCode)                                                                                                                             \
-    oop_field(HotSpotCompiledCode, name, "Ljava/lang/String;")                                                                                                 \
-    objArrayOop_field(HotSpotCompiledCode, sites, "[Ljdk/vm/ci/code/CompilationResult$Site;")                                                                  \
-    objArrayOop_field(HotSpotCompiledCode, exceptionHandlers, "[Ljdk/vm/ci/code/CompilationResult$ExceptionHandler;")                                          \
     objArrayOop_field(HotSpotCompiledCode, comments, "[Ljdk/vm/ci/hotspot/HotSpotCompiledCode$Comment;")                                                       \
-    objArrayOop_field(HotSpotCompiledCode, assumptions, "[Ljdk/vm/ci/meta/Assumptions$Assumption;")                                                            \
-    typeArrayOop_field(HotSpotCompiledCode, targetCode, "[B")                                                                                                  \
-    int_field(HotSpotCompiledCode, targetCodeSize)                                                                                                             \
     typeArrayOop_field(HotSpotCompiledCode, dataSection, "[B")                                                                                                 \
     int_field(HotSpotCompiledCode, dataSectionAlignment)                                                                                                       \
-    objArrayOop_field(HotSpotCompiledCode, dataSectionPatches, "[Ljdk/vm/ci/code/CompilationResult$DataPatch;")                                                \
+    objArrayOop_field(HotSpotCompiledCode, dataSectionPatches, "[Ljdk/vm/ci/code/site/DataPatch;")                                                             \
     int_field(HotSpotCompiledCode, totalFrameSize)                                                                                                             \
     int_field(HotSpotCompiledCode, customStackAreaOffset)                                                                                                      \
-    objArrayOop_field(HotSpotCompiledCode, methods, "[Ljdk/vm/ci/meta/ResolvedJavaMethod;")                                                                    \
   end_class                                                                                                                                                    \
   start_class(HotSpotCompiledCode_Comment)                                                                                                                     \
     oop_field(HotSpotCompiledCode_Comment, text, "Ljava/lang/String;")                                                                                         \
@@ -130,36 +131,36 @@
     oop_field(Assumptions_CallSiteTargetValue, callSite, "Ljava/lang/invoke/CallSite;")                                                                        \
     oop_field(Assumptions_CallSiteTargetValue, methodHandle, "Ljava/lang/invoke/MethodHandle;")                                                                \
   end_class                                                                                                                                                    \
-  start_class(CompilationResult_Site)                                                                                                                          \
-    int_field(CompilationResult_Site, pcOffset)                                                                                                                \
+  start_class(site_Site)                                                                                                                                       \
+    int_field(site_Site, pcOffset)                                                                                                                             \
   end_class                                                                                                                                                    \
-  start_class(CompilationResult_Call)                                                                                                                          \
-    oop_field(CompilationResult_Call, target, "Ljdk/vm/ci/meta/InvokeTarget;")                                                                                 \
-    oop_field(CompilationResult_Call, debugInfo, "Ljdk/vm/ci/code/DebugInfo;")                                                                                 \
+  start_class(site_Call)                                                                                                                                       \
+    oop_field(site_Call, target, "Ljdk/vm/ci/meta/InvokeTarget;")                                                                                              \
+    oop_field(site_Call, debugInfo, "Ljdk/vm/ci/code/DebugInfo;")                                                                                              \
   end_class                                                                                                                                                    \
-  start_class(CompilationResult_DataPatch)                                                                                                                     \
-    oop_field(CompilationResult_DataPatch, reference, "Ljdk/vm/ci/code/CompilationResult$Reference;")                                                          \
+  start_class(site_DataPatch)                                                                                                                                  \
+    oop_field(site_DataPatch, reference, "Ljdk/vm/ci/code/site/Reference;")                                                                                    \
   end_class                                                                                                                                                    \
-  start_class(CompilationResult_ConstantReference)                                                                                                             \
-    oop_field(CompilationResult_ConstantReference, constant, "Ljdk/vm/ci/meta/VMConstant;")                                                                    \
+  start_class(site_ConstantReference)                                                                                                                          \
+    oop_field(site_ConstantReference, constant, "Ljdk/vm/ci/meta/VMConstant;")                                                                                 \
   end_class                                                                                                                                                    \
-  start_class(CompilationResult_DataSectionReference)                                                                                                          \
-    int_field(CompilationResult_DataSectionReference, offset)                                                                                                  \
+  start_class(site_DataSectionReference)                                                                                                                       \
+    int_field(site_DataSectionReference, offset)                                                                                                               \
   end_class                                                                                                                                                    \
-  start_class(InfopointReason)                                                                                                                                 \
-    static_oop_field(InfopointReason, SAFEPOINT, "Ljdk/vm/ci/code/InfopointReason;")                                                                           \
-    static_oop_field(InfopointReason, CALL, "Ljdk/vm/ci/code/InfopointReason;")                                                                                \
-    static_oop_field(InfopointReason, IMPLICIT_EXCEPTION, "Ljdk/vm/ci/code/InfopointReason;")                                                                  \
+  start_class(site_InfopointReason)                                                                                                                            \
+    static_oop_field(site_InfopointReason, SAFEPOINT, "Ljdk/vm/ci/code/site/InfopointReason;")                                                                 \
+    static_oop_field(site_InfopointReason, CALL, "Ljdk/vm/ci/code/site/InfopointReason;")                                                                      \
+    static_oop_field(site_InfopointReason, IMPLICIT_EXCEPTION, "Ljdk/vm/ci/code/site/InfopointReason;")                                                        \
   end_class                                                                                                                                                    \
-  start_class(CompilationResult_Infopoint)                                                                                                                     \
-    oop_field(CompilationResult_Infopoint, debugInfo, "Ljdk/vm/ci/code/DebugInfo;")                                                                            \
-    oop_field(CompilationResult_Infopoint, reason, "Ljdk/vm/ci/code/InfopointReason;")                                                                         \
+  start_class(site_Infopoint)                                                                                                                                  \
+    oop_field(site_Infopoint, debugInfo, "Ljdk/vm/ci/code/DebugInfo;")                                                                                         \
+    oop_field(site_Infopoint, reason, "Ljdk/vm/ci/code/site/InfopointReason;")                                                                                 \
   end_class                                                                                                                                                    \
-  start_class(CompilationResult_ExceptionHandler)                                                                                                              \
-    int_field(CompilationResult_ExceptionHandler, handlerPos)                                                                                                  \
+  start_class(site_ExceptionHandler)                                                                                                                           \
+    int_field(site_ExceptionHandler, handlerPos)                                                                                                               \
   end_class                                                                                                                                                    \
-  start_class(CompilationResult_Mark)                                                                                                                          \
-    oop_field(CompilationResult_Mark, id, "Ljava/lang/Object;")                                                                                                \
+  start_class(site_Mark)                                                                                                                                       \
+    oop_field(site_Mark, id, "Ljava/lang/Object;")                                                                                                             \
   end_class                                                                                                                                                    \
   start_class(CompilationRequestResult)                                                                                                                        \
     oop_field(CompilationRequestResult, failureMessage, "Ljava/lang/String;")                                                                                  \
--- a/src/share/vm/jvmci/systemDictionary_jvmci.hpp	Fri Jan 15 15:51:01 2016 +0100
+++ b/src/share/vm/jvmci/systemDictionary_jvmci.hpp	Fri Jan 15 16:50: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
@@ -54,19 +54,12 @@
   do_klass(Architecture_klass,                           jdk_vm_ci_code_Architecture,                           Jvmci) \
   do_klass(TargetDescription_klass,                      jdk_vm_ci_code_TargetDescription,                      Jvmci) \
   do_klass(BytecodePosition_klass,                       jdk_vm_ci_code_BytecodePosition,                       Jvmci) \
+  do_klass(CompiledCode_klass,                           jdk_vm_ci_code_CompiledCode,                           Jvmci) \
   do_klass(DebugInfo_klass,                              jdk_vm_ci_code_DebugInfo,                              Jvmci) \
   do_klass(RegisterSaveLayout_klass,                     jdk_vm_ci_code_RegisterSaveLayout,                     Jvmci) \
   do_klass(BytecodeFrame_klass,                          jdk_vm_ci_code_BytecodeFrame,                          Jvmci) \
-  do_klass(CompilationResult_Call_klass,                 jdk_vm_ci_code_CompilationResult_Call,                 Jvmci) \
-  do_klass(CompilationResult_ConstantReference_klass,    jdk_vm_ci_code_CompilationResult_ConstantReference,    Jvmci) \
-  do_klass(CompilationResult_DataPatch_klass,            jdk_vm_ci_code_CompilationResult_DataPatch,            Jvmci) \
-  do_klass(CompilationResult_DataSectionReference_klass, jdk_vm_ci_code_CompilationResult_DataSectionReference, Jvmci) \
-  do_klass(CompilationResult_ExceptionHandler_klass,     jdk_vm_ci_code_CompilationResult_ExceptionHandler,     Jvmci) \
-  do_klass(CompilationResult_Mark_klass,                 jdk_vm_ci_code_CompilationResult_Mark,                 Jvmci) \
-  do_klass(CompilationResult_Infopoint_klass,            jdk_vm_ci_code_CompilationResult_Infopoint,            Jvmci) \
-  do_klass(CompilationResult_Site_klass,                 jdk_vm_ci_code_CompilationResult_Site,                 Jvmci) \
+  do_klass(CompilationRequest_klass,                     jdk_vm_ci_code_CompilationRequest,                     Jvmci) \
   do_klass(CompilationRequestResult_klass,               jdk_vm_ci_code_CompilationRequestResult,               Jvmci) \
-  do_klass(InfopointReason_klass,                        jdk_vm_ci_code_InfopointReason,                        Jvmci) \
   do_klass(InstalledCode_klass,                          jdk_vm_ci_code_InstalledCode,                          Jvmci) \
   do_klass(code_Location_klass,                          jdk_vm_ci_code_Location,                               Jvmci) \
   do_klass(code_Register_klass,                          jdk_vm_ci_code_Register,                               Jvmci) \
@@ -74,7 +67,15 @@
   do_klass(StackSlot_klass,                              jdk_vm_ci_code_StackSlot,                              Jvmci) \
   do_klass(StackLockValue_klass,                         jdk_vm_ci_code_StackLockValue,                         Jvmci) \
   do_klass(VirtualObject_klass,                          jdk_vm_ci_code_VirtualObject,                          Jvmci) \
-  do_klass(CompilationRequest_klass,                     jdk_vm_ci_code_CompilationRequest,                     Jvmci) \
+  do_klass(site_Call_klass,                              jdk_vm_ci_code_site_Call,                              Jvmci) \
+  do_klass(site_ConstantReference_klass,                 jdk_vm_ci_code_site_ConstantReference,                 Jvmci) \
+  do_klass(site_DataPatch_klass,                         jdk_vm_ci_code_site_DataPatch,                         Jvmci) \
+  do_klass(site_DataSectionReference_klass,              jdk_vm_ci_code_site_DataSectionReference,              Jvmci) \
+  do_klass(site_ExceptionHandler_klass,                  jdk_vm_ci_code_site_ExceptionHandler,                  Jvmci) \
+  do_klass(site_Mark_klass,                              jdk_vm_ci_code_site_Mark,                              Jvmci) \
+  do_klass(site_Infopoint_klass,                         jdk_vm_ci_code_site_Infopoint,                         Jvmci) \
+  do_klass(site_Site_klass,                              jdk_vm_ci_code_site_Site,                              Jvmci) \
+  do_klass(site_InfopointReason_klass,                   jdk_vm_ci_code_site_InfopointReason,                   Jvmci) \
   do_klass(JavaConstant_klass,                           jdk_vm_ci_meta_JavaConstant,                           Jvmci) \
   do_klass(PrimitiveConstant_klass,                      jdk_vm_ci_meta_PrimitiveConstant,                      Jvmci) \
   do_klass(RawConstant_klass,                            jdk_vm_ci_meta_RawConstant,                            Jvmci) \
--- a/src/share/vm/jvmci/vmSymbols_jvmci.hpp	Fri Jan 15 15:51:01 2016 +0100
+++ b/src/share/vm/jvmci/vmSymbols_jvmci.hpp	Fri Jan 15 16:50: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
@@ -61,30 +61,31 @@
   template(jdk_vm_ci_meta_Assumptions_ConcreteMethod,             "jdk/vm/ci/meta/Assumptions$ConcreteMethod")                            \
   template(jdk_vm_ci_meta_Assumptions_CallSiteTargetValue,        "jdk/vm/ci/meta/Assumptions$CallSiteTargetValue")                       \
   template(jdk_vm_ci_code_Architecture,                           "jdk/vm/ci/code/Architecture")                                          \
-  template(jdk_vm_ci_code_TargetDescription,                      "jdk/vm/ci/code/TargetDescription")                                     \
-  template(jdk_vm_ci_code_CompilationResult_Call,                 "jdk/vm/ci/code/CompilationResult$Call")                                \
-  template(jdk_vm_ci_code_CompilationResult_ConstantReference,    "jdk/vm/ci/code/CompilationResult$ConstantReference")                   \
-  template(jdk_vm_ci_code_CompilationResult_DataPatch,            "jdk/vm/ci/code/CompilationResult$DataPatch")                           \
-  template(jdk_vm_ci_code_CompilationResult_DataSectionReference, "jdk/vm/ci/code/CompilationResult$DataSectionReference")                \
-  template(jdk_vm_ci_code_CompilationResult_ExceptionHandler,     "jdk/vm/ci/code/CompilationResult$ExceptionHandler")                    \
-  template(jdk_vm_ci_code_CompilationResult_Mark,                 "jdk/vm/ci/code/CompilationResult$Mark")                                \
-  template(jdk_vm_ci_code_CompilationResult_Infopoint,            "jdk/vm/ci/code/CompilationResult$Infopoint")                           \
-  template(jdk_vm_ci_code_CompilationResult_Site,                 "jdk/vm/ci/code/CompilationResult$Site")                                \
-  template(jdk_vm_ci_code_CompilationRequestResult,               "jdk/vm/ci/code/CompilationRequestResult")                              \
-  template(jdk_vm_ci_code_InfopointReason,                        "jdk/vm/ci/code/InfopointReason")                                       \
-  template(jdk_vm_ci_code_InstalledCode,                          "jdk/vm/ci/code/InstalledCode")                                         \
   template(jdk_vm_ci_code_BytecodeFrame,                          "jdk/vm/ci/code/BytecodeFrame")                                         \
   template(jdk_vm_ci_code_BytecodePosition,                       "jdk/vm/ci/code/BytecodePosition")                                      \
+  template(jdk_vm_ci_code_CompilationRequest,                     "jdk/vm/ci/code/CompilationRequest")                                    \
+  template(jdk_vm_ci_code_CompilationRequestResult,               "jdk/vm/ci/code/CompilationRequestResult")                              \
+  template(jdk_vm_ci_code_CompiledCode,                           "jdk/vm/ci/code/CompiledCode")                                          \
   template(jdk_vm_ci_code_DebugInfo,                              "jdk/vm/ci/code/DebugInfo")                                             \
+  template(jdk_vm_ci_code_InstalledCode,                          "jdk/vm/ci/code/InstalledCode")                                         \
   template(jdk_vm_ci_code_Location,                               "jdk/vm/ci/code/Location")                                              \
   template(jdk_vm_ci_code_Register,                               "jdk/vm/ci/code/Register")                                              \
   template(jdk_vm_ci_code_RegisterValue,                          "jdk/vm/ci/code/RegisterValue")                                         \
   template(jdk_vm_ci_code_StackSlot,                              "jdk/vm/ci/code/StackSlot")                                             \
   template(jdk_vm_ci_code_StackLockValue,                         "jdk/vm/ci/code/StackLockValue")                                        \
+  template(jdk_vm_ci_code_TargetDescription,                      "jdk/vm/ci/code/TargetDescription")                                     \
   template(jdk_vm_ci_code_VirtualObject,                          "jdk/vm/ci/code/VirtualObject")                                         \
   template(jdk_vm_ci_code_RegisterSaveLayout,                     "jdk/vm/ci/code/RegisterSaveLayout")                                    \
   template(jdk_vm_ci_code_InvalidInstalledCodeException,          "jdk/vm/ci/code/InvalidInstalledCodeException")                         \
-  template(jdk_vm_ci_code_CompilationRequest,                     "jdk/vm/ci/code/CompilationRequest")                                    \
+  template(jdk_vm_ci_code_site_Call,                              "jdk/vm/ci/code/site/Call")                                             \
+  template(jdk_vm_ci_code_site_ConstantReference,                 "jdk/vm/ci/code/site/ConstantReference")                                \
+  template(jdk_vm_ci_code_site_DataPatch,                         "jdk/vm/ci/code/site/DataPatch")                                        \
+  template(jdk_vm_ci_code_site_DataSectionReference,              "jdk/vm/ci/code/site/DataSectionReference")                             \
+  template(jdk_vm_ci_code_site_ExceptionHandler,                  "jdk/vm/ci/code/site/ExceptionHandler")                                 \
+  template(jdk_vm_ci_code_site_Mark,                              "jdk/vm/ci/code/site/Mark")                                             \
+  template(jdk_vm_ci_code_site_Infopoint,                         "jdk/vm/ci/code/site/Infopoint")                                        \
+  template(jdk_vm_ci_code_site_Site,                              "jdk/vm/ci/code/site/Site")                                             \
+  template(jdk_vm_ci_code_site_InfopointReason,                   "jdk/vm/ci/code/site/InfopointReason")                                  \
   template(jdk_vm_ci_common_JVMCIError,                           "jdk/vm/ci/common/JVMCIError")                                          \
   template(compileMethod_name,                                    "compileMethod")                                                        \
   template(compileMethod_signature,                               "(Ljdk/vm/ci/hotspot/HotSpotResolvedJavaMethod;IJI)Ljdk/vm/ci/code/CompilationRequestResult;") \