changeset 5510:426c605c9d3c

Move cri.ci to api.code.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Thu, 07 Jun 2012 18:55:34 +0200
parents 6ed763809de7
children fe3288796132
files graal/com.oracle.graal.alloc/src/com/oracle/graal/alloc/simple/DataFlowAnalysis.java graal/com.oracle.graal.alloc/src/com/oracle/graal/alloc/simple/LinearScanAllocator.java graal/com.oracle.graal.alloc/src/com/oracle/graal/alloc/simple/SpillAllAllocator.java graal/com.oracle.graal.alloc/src/com/oracle/graal/alloc/util/IntervalPrinter.java graal/com.oracle.graal.alloc/src/com/oracle/graal/alloc/util/MoveResolver.java graal/com.oracle.graal.alloc/src/com/oracle/graal/alloc/util/RegisterVerifier.java graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CiAddress.java graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CiArchitecture.java graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CiAssumptions.java graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CiBailout.java graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CiCalleeSaveLayout.java graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CiCallingConvention.java graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CiCodePos.java graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CiCompilationStatistics.java graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CiDebugInfo.java graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CiDeoptAction.java graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CiExceptionHandler.java graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CiFrame.java graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CiGenericCallback.java graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CiMonitorValue.java graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CiRegister.java graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CiRegisterAttributes.java graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CiRegisterConfig.java graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CiRegisterConfigImpl.java graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CiRegisterValue.java graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CiRuntimeCall.java graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CiStackSlot.java graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CiTarget.java graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CiTargetMethod.java graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CiUtil.java graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CiValueUtil.java graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CiVirtualObject.java graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/RiRuntime.java graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/package-info.java graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/OptimisticOptimizations.java graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/Interval.java graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScan.java graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScanWalker.java graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/MoveResolver.java graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/RegisterVerifier.java graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/DebugInfoBuilder.java graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/LIRGenerator.java graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/CanonicalizerPhase.java graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/EscapeAnalysisPhase.java graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/InliningPhase.java graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/LoweringPhase.java graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/SnippetIntrinsificationPhase.java graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/target/Backend.java graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/target/amd64/AMD64DeoptimizationStub.java graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/target/amd64/AMD64LIRGenerator.java graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/target/amd64/AMD64XirAssembler.java graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/target/amd64/AMD64XirOp.java graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/types/PropagateTypeCachePhase.java graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/types/TypeFeedbackCache.java graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/util/InliningUtil.java graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/util/Util.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/Compiler.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilerImpl.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotDebugConfig.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotTargetMethod.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVM.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVMImpl.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/counters/MethodEntryCounters.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/CurrentThread.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/TailcallNode.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/WriteBarrier.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotCodeInfo.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotCompiledMethod.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotField.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotMethodResolvedImpl.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotProfilingInfo.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotRegisterConfig.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotRuntime.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotXirGenerator.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/ArrayCopySnippets.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/CheckCastSnippets.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/DirectStoreNode.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/IntrinsifyArrayCopyPhase.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/SystemSnippets.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/target/amd64/AMD64SafepointOp.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/target/amd64/AMD64TailcallOp.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/target/amd64/HotSpotAMD64Backend.java graal/com.oracle.graal.java/src/com/oracle/graal/java/BciBlockMapping.java graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java graal/com.oracle.graal.java/src/com/oracle/graal/java/JsrNotSupportedBailout.java graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Arithmetic.java graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Call.java graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Compare.java graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64ControlFlow.java graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Move.java graal/com.oracle.graal.lir/src/com/oracle/graal/lir/FrameMap.java graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRDebugInfo.java graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRInstruction.java graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRVerifier.java graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRXirInstruction.java graal/com.oracle.graal.lir/src/com/oracle/graal/lir/ValueUtil.java graal/com.oracle.graal.lir/src/com/oracle/graal/lir/Variable.java graal/com.oracle.graal.lir/src/com/oracle/graal/lir/asm/TargetMethodAssembler.java graal/com.oracle.graal.nodes/src/com/oracle/graal/cri/CiLoweringTool.java graal/com.oracle.graal.nodes/src/com/oracle/graal/cri/ExtendedRiRuntime.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ConstantNode.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/DeoptimizeNode.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FixedGuardNode.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FrameState.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardNode.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/InvokeNode.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/InvokeWithExceptionNode.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/UnwindNode.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/CompareNode.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/Condition.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerMulNode.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/BoxingMethodPool.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/FloatingReadNode.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ReadHubNode.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ReadNode.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/RuntimeCallNode.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AccessFieldNode.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AccessMonitorNode.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/ArrayLengthNode.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/ExceptionObjectNode.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoadFieldNode.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoadIndexedNode.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/RegisterFinalizerNode.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/CanonicalizerTool.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/LIRGeneratorTool.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/types/TypeFeedbackTool.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/StampFactory.java graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CFGPrinter.java graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CFGPrinterObserver.java graal/com.oracle.graal.printer/src/com/oracle/graal/printer/IdealGraphPrinterDumpHandler.java graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/GraalIntrinsics.java graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/MathSnippetsX86.java graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/NodeClassSnippets.java graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/SnippetTemplate.java graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/Snippets.java graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/target/amd64/AMD64MathIntrinsicOp.java graal/com.oracle.graal.tests/src/com/oracle/graal/compiler/tests/GraphTest.java graal/com.oracle.max.asm/src/com/oracle/max/asm/AbstractAssembler.java graal/com.oracle.max.asm/src/com/oracle/max/asm/target/amd64/AMD64.java graal/com.oracle.max.asm/src/com/oracle/max/asm/target/amd64/AMD64Assembler.java graal/com.oracle.max.asm/src/com/oracle/max/asm/target/amd64/AMD64MacroAssembler.java graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiAddress.java graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiArchitecture.java graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiAssumptions.java graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiBailout.java graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiCalleeSaveLayout.java graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiCallingConvention.java graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiCodePos.java graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiCompilationStatistics.java graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiDebugInfo.java graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiDeoptAction.java graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiExceptionHandler.java graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiFrame.java graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiGenericCallback.java graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiMonitorValue.java graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiRegister.java graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiRegisterAttributes.java graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiRegisterConfig.java graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiRegisterConfigImpl.java graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiRegisterValue.java graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiRuntimeCall.java graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiStackSlot.java graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiTarget.java graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiTargetMethod.java graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiUtil.java graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiValueUtil.java graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiVirtualObject.java graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/package-info.java graal/com.oracle.max.cri/src/com/oracle/max/cri/ri/RiRuntime.java graal/com.oracle.max.cri/src/com/oracle/max/cri/xir/CiXirAssembler.java graal/com.oracle.max.cri/src/com/oracle/max/cri/xir/XirSite.java graal/com.oracle.max.cri/src/com/oracle/max/cri/xir/XirSnippet.java graal/com.oracle.max.criutils/src/com/oracle/max/criutils/BaseProfilingInfo.java graal/com.oracle.max.criutils/src/com/oracle/max/criutils/BaseUnresolvedField.java graal/com.oracle.max.criutils/src/com/oracle/max/criutils/BaseUnresolvedMethod.java graal/com.oracle.max.criutils/src/com/oracle/max/criutils/CompilationPrinter.java graal/com.oracle.max.criutils/src/com/oracle/max/criutils/HexCodeFile.java graal/com.oracle.max.criutils/src/com/oracle/max/criutils/SnapshotProfilingInfo.java graal/com.oracle.max.criutils/src/com/oracle/max/criutils/TypeCheckHints.java mx/projects
diffstat 183 files changed, 4902 insertions(+), 4944 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.alloc/src/com/oracle/graal/alloc/simple/DataFlowAnalysis.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.alloc/src/com/oracle/graal/alloc/simple/DataFlowAnalysis.java	Thu Jun 07 18:55:34 2012 +0200
@@ -22,12 +22,12 @@
  */
 package com.oracle.graal.alloc.simple;
 
-import static com.oracle.max.cri.ci.CiValueUtil.*;
+import static com.oracle.graal.api.code.CiValueUtil.*;
 import static com.oracle.graal.lir.ValueUtil.*;
 
 import java.util.*;
 
-import com.oracle.max.cri.ci.*;
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.debug.*;
 import com.oracle.graal.lir.*;
--- a/graal/com.oracle.graal.alloc/src/com/oracle/graal/alloc/simple/LinearScanAllocator.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.alloc/src/com/oracle/graal/alloc/simple/LinearScanAllocator.java	Thu Jun 07 18:55:34 2012 +0200
@@ -22,14 +22,12 @@
  */
 package com.oracle.graal.alloc.simple;
 
-import static com.oracle.max.cri.ci.CiValueUtil.*;
 import static com.oracle.graal.alloc.util.LocationUtil.*;
-
 import java.util.*;
 
-import com.oracle.max.cri.ci.*;
-import com.oracle.max.cri.ci.CiRegister.RegisterFlag;
 import com.oracle.graal.alloc.util.*;
+import com.oracle.graal.api.code.*;
+import com.oracle.graal.api.code.CiRegister.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.debug.*;
 import com.oracle.graal.graph.*;
--- a/graal/com.oracle.graal.alloc/src/com/oracle/graal/alloc/simple/SpillAllAllocator.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.alloc/src/com/oracle/graal/alloc/simple/SpillAllAllocator.java	Thu Jun 07 18:55:34 2012 +0200
@@ -22,14 +22,12 @@
  */
 package com.oracle.graal.alloc.simple;
 
-import static com.oracle.max.cri.ci.CiValueUtil.*;
 import static com.oracle.graal.alloc.util.LocationUtil.*;
-
 import java.util.*;
 
-import com.oracle.max.cri.ci.*;
-import com.oracle.max.cri.ci.CiRegister.RegisterFlag;
 import com.oracle.graal.alloc.util.*;
+import com.oracle.graal.api.code.*;
+import com.oracle.graal.api.code.CiRegister.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.debug.*;
 import com.oracle.graal.graph.*;
--- a/graal/com.oracle.graal.alloc/src/com/oracle/graal/alloc/util/IntervalPrinter.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.alloc/src/com/oracle/graal/alloc/util/IntervalPrinter.java	Thu Jun 07 18:55:34 2012 +0200
@@ -22,13 +22,11 @@
  */
 package com.oracle.graal.alloc.util;
 
-import static com.oracle.max.cri.ci.CiValueUtil.*;
 import static com.oracle.graal.alloc.util.LocationUtil.*;
-
 import java.util.*;
 
-import com.oracle.max.cri.ci.*;
 import com.oracle.graal.alloc.simple.*;
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.debug.*;
 import com.oracle.graal.lir.*;
--- a/graal/com.oracle.graal.alloc/src/com/oracle/graal/alloc/util/MoveResolver.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.alloc/src/com/oracle/graal/alloc/util/MoveResolver.java	Thu Jun 07 18:55:34 2012 +0200
@@ -22,12 +22,10 @@
  */
 package com.oracle.graal.alloc.util;
 
-import static com.oracle.max.cri.ci.CiValueUtil.*;
 import static com.oracle.graal.alloc.util.LocationUtil.*;
-
 import java.util.*;
 
-import com.oracle.max.cri.ci.*;
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.debug.*;
 import com.oracle.graal.graph.*;
--- a/graal/com.oracle.graal.alloc/src/com/oracle/graal/alloc/util/RegisterVerifier.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.alloc/src/com/oracle/graal/alloc/util/RegisterVerifier.java	Thu Jun 07 18:55:34 2012 +0200
@@ -22,12 +22,10 @@
  */
 package com.oracle.graal.alloc.util;
 
-import static com.oracle.max.cri.ci.CiValueUtil.*;
 import static com.oracle.graal.alloc.util.LocationUtil.*;
-
 import java.util.*;
 
-import com.oracle.max.cri.ci.*;
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.debug.*;
 import com.oracle.graal.graph.*;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CiAddress.java	Thu Jun 07 18:55:34 2012 +0200
@@ -0,0 +1,177 @@
+/*
+ * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.graal.api.code;
+
+import static com.oracle.graal.api.code.CiValueUtil.*;
+
+import com.oracle.graal.api.meta.*;
+
+/**
+ * Represents an address in target machine memory, specified via some combination of a base register, an index register,
+ * a displacement and a scale. Note that the base and index registers may be a variable that will get a register assigned
+ * later by the register allocator.
+ */
+public final class CiAddress extends RiValue {
+    private static final long serialVersionUID = -1003772042519945089L;
+
+    /**
+     * A sentinel value used as a place holder in an instruction stream for an address that will be patched.
+     */
+    public static final CiAddress Placeholder = new CiAddress(RiKind.Illegal, RiValue.IllegalValue);
+
+    /**
+     * Base register that defines the start of the address computation.
+     * If not present, is denoted by {@link RiValue#IllegalValue}.
+     */
+    public RiValue base;
+
+    /**
+     * Index register, the value of which (possibly scaled by {@link #scale}) is added to {@link #base}.
+     * If not present, is denoted by {@link RiValue#IllegalValue}.
+     */
+    public RiValue index;
+
+    /**
+     * Scaling factor for indexing, dependent on target operand size.
+     */
+    public final Scale scale;
+
+    /**
+     * Optional additive displacement.
+     */
+    public final int displacement;
+
+    /**
+     * Creates a {@code CiAddress} with given base register, no scaling and no displacement.
+     * @param kind the kind of the value being addressed
+     * @param base the base register
+     */
+    public CiAddress(RiKind kind, RiValue base) {
+        this(kind, base, IllegalValue, Scale.Times1, 0);
+    }
+
+    /**
+     * Creates a {@code CiAddress} with given base register, no scaling and a given displacement.
+     * @param kind the kind of the value being addressed
+     * @param base the base register
+     * @param displacement the displacement
+     */
+    public CiAddress(RiKind kind, RiValue base, int displacement) {
+        this(kind, base, IllegalValue, Scale.Times1, displacement);
+    }
+
+    /**
+     * Creates a {@code CiAddress} with given base and index registers, scaling and displacement.
+     * This is the most general constructor..
+     * @param kind the kind of the value being addressed
+     * @param base the base register
+     * @param index the index register
+     * @param scale the scaling factor
+     * @param displacement the displacement
+     */
+    public CiAddress(RiKind kind, RiValue base, RiValue index, Scale scale, int displacement) {
+        super(kind);
+        this.base = base;
+        this.index = index;
+        this.scale = scale;
+        this.displacement = displacement;
+
+        assert !isConstant(base) && !isStackSlot(base);
+        assert !isConstant(index) && !isStackSlot(index);
+    }
+
+    /**
+     * A scaling factor used in complex addressing modes such as those supported by x86 platforms.
+     */
+    public enum Scale {
+        Times1(1, 0),
+        Times2(2, 1),
+        Times4(4, 2),
+        Times8(8, 3);
+
+        private Scale(int value, int log2) {
+            this.value = value;
+            this.log2 = log2;
+        }
+
+        /**
+         * The value (or multiplier) of this scale.
+         */
+        public final int value;
+
+        /**
+         * The {@linkplain #value value} of this scale log 2.
+         */
+        public final int log2;
+
+        public static Scale fromInt(int scale) {
+            switch (scale) {
+                case 1:  return Times1;
+                case 2:  return Times2;
+                case 4:  return Times4;
+                case 8:  return Times8;
+                default: throw new IllegalArgumentException(String.valueOf(scale));
+            }
+        }
+    }
+
+    @Override
+    public String toString() {
+        if (this == Placeholder) {
+            return "[<placeholder>]";
+        }
+
+        StringBuilder s = new StringBuilder();
+        s.append(kind.javaName).append("[");
+        String sep = "";
+        if (isLegal(base)) {
+            s.append(base);
+            sep = " + ";
+        }
+        if (isLegal(index)) {
+            s.append(sep).append(index).append(" * ").append(scale.value);
+            sep = " + ";
+        }
+        if (displacement < 0) {
+            s.append(" - ").append(-displacement);
+        } else if (displacement > 0) {
+            s.append(sep).append(displacement);
+        }
+        s.append("]");
+        return s.toString();
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (obj instanceof CiAddress) {
+            CiAddress addr = (CiAddress) obj;
+            return kind == addr.kind && displacement == addr.displacement && base.equals(addr.base) && scale == addr.scale && index.equals(addr.index);
+        }
+        return false;
+    }
+
+    @Override
+    public int hashCode() {
+        return base.hashCode() ^ index.hashCode() ^ (displacement << 4) ^ (scale.value << 8) ^ (kind.ordinal() << 12);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CiArchitecture.java	Thu Jun 07 18:55:34 2012 +0200
@@ -0,0 +1,211 @@
+/*
+ * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.graal.api.code;
+
+import java.util.*;
+
+import com.oracle.graal.api.code.CiRegister.*;
+
+
+/**
+ * Represents a CPU architecture, including information such as its endianness, CPU
+ * registers, word width, etc.
+ */
+public abstract class CiArchitecture {
+
+    /**
+     * The endianness of the architecture.
+     */
+    public static enum ByteOrder {
+        LittleEndian,
+        BigEndian
+    }
+
+    /**
+     * The number of bits required in a bit map covering all the registers that may store references.
+     * The bit position of a register in the map is the register's {@linkplain CiRegister#number number}.
+     */
+    public final int registerReferenceMapBitCount;
+
+    /**
+     * Represents the natural size of words (typically registers and pointers) of this architecture, in bytes.
+     */
+    public final int wordSize;
+
+    /**
+     * The name of this architecture (e.g. "AMD64", "SPARCv9").
+     */
+    public final String name;
+
+    /**
+     * Array of all available registers on this architecture. The index of each register in this
+     * array is equal to its {@linkplain CiRegister#number number}.
+     */
+    public final CiRegister[] registers;
+
+    /**
+     * Map of all registers keyed by their {@linkplain CiRegister#name names}.
+     */
+    public final HashMap<String, CiRegister> registersByName;
+
+    /**
+     * The byte ordering can be either little or big endian.
+     */
+    public final ByteOrder byteOrder;
+
+    /**
+     * Mask of the barrier constants defined in {@link MemoryBarriers} denoting the barriers that
+     * are not required to be explicitly inserted under this architecture.
+     */
+    public final int implicitMemoryBarriers;
+
+    /**
+     * Determines the barriers in a given barrier mask that are explicitly required on this architecture.
+     *
+     * @param barriers a mask of the barrier constants defined in {@link MemoryBarriers}
+     * @return the value of {@code barriers} minus the barriers unnecessary on this architecture
+     */
+    public final int requiredBarriers(int barriers) {
+        return barriers & ~implicitMemoryBarriers;
+    }
+
+    /**
+     * Offset in bytes from the beginning of a call instruction to the displacement.
+     */
+    public final int machineCodeCallDisplacementOffset;
+
+    /**
+     * The size of the return address pushed to the stack by a call instruction.
+     * A value of 0 denotes that call linkage uses registers instead (e.g. SPARC).
+     */
+    public final int returnAddressSize;
+
+    private final EnumMap<RegisterFlag, CiRegister[]> registersByTypeAndEncoding;
+
+    /**
+     * Gets the register for a given {@linkplain CiRegister#encoding encoding} and type.
+     *
+     * @param encoding a register value as used in a machine instruction
+     * @param type the type of the register
+     */
+    public CiRegister registerFor(int encoding, RegisterFlag type) {
+        CiRegister[] regs = registersByTypeAndEncoding.get(type);
+        assert encoding >= 0 && encoding < regs.length;
+        CiRegister reg = regs[encoding];
+        assert reg != null;
+        return reg;
+    }
+
+    protected CiArchitecture(String name,
+                    int wordSize,
+                    ByteOrder byteOrder,
+                    CiRegister[] registers,
+                    int implicitMemoryBarriers,
+                    int nativeCallDisplacementOffset,
+                    int registerReferenceMapBitCount,
+                    int returnAddressSize) {
+        this.name = name;
+        this.registers = registers;
+        this.wordSize = wordSize;
+        this.byteOrder = byteOrder;
+        this.implicitMemoryBarriers = implicitMemoryBarriers;
+        this.machineCodeCallDisplacementOffset = nativeCallDisplacementOffset;
+        this.registerReferenceMapBitCount = registerReferenceMapBitCount;
+        this.returnAddressSize = returnAddressSize;
+
+        registersByName = new HashMap<>(registers.length);
+        for (CiRegister register : registers) {
+            registersByName.put(register.name, register);
+            assert registers[register.number] == register;
+        }
+
+        registersByTypeAndEncoding = new EnumMap<>(RegisterFlag.class);
+        EnumMap<RegisterFlag, CiRegister[]> categorizedRegs = CiRegister.categorize(registers);
+        for (RegisterFlag type : RegisterFlag.values()) {
+            CiRegister[] regs = categorizedRegs.get(type);
+            int max = CiRegister.maxRegisterEncoding(regs);
+            CiRegister[] regsByEnc = new CiRegister[max + 1];
+            for (CiRegister reg : regs) {
+                regsByEnc[reg.encoding] = reg;
+            }
+            registersByTypeAndEncoding.put(type, regsByEnc);
+        }
+    }
+
+    /**
+     * Converts this architecture to a string.
+     * @return the string representation of this architecture
+     */
+    @Override
+    public final String toString() {
+        return name.toLowerCase();
+    }
+
+    /**
+     * Checks whether this is a 32-bit architecture.
+     * @return {@code true} if this architecture is 32-bit
+     */
+    public final boolean is32bit() {
+        return wordSize == 4;
+    }
+
+    /**
+     * Checks whether this is a 64-bit architecture.
+     * @return {@code true} if this architecture is 64-bit
+     */
+    public final boolean is64bit() {
+        return wordSize == 8;
+    }
+
+    // The following methods are architecture specific and not dependent on state
+    // stored in this class. They have convenient default implementations.
+
+    /**
+     * Checks whether this architecture's normal arithmetic instructions use a two-operand form
+     * (e.g. x86 which overwrites one operand register with the result when adding).
+     * @return {@code true} if this architecture uses two-operand mode
+     */
+    public boolean twoOperandMode() {
+        return false;
+    }
+
+    // TODO: Why enumerate the concrete subclasses here rather
+    // than use instanceof comparisons in code that cares?
+
+    /**
+     * Checks whether the architecture is x86.
+     * @return {@code true} if the architecture is x86
+     */
+    public boolean isX86() {
+        return false;
+    }
+
+    /**
+     * Checks whether the architecture is SPARC.
+     * @return {@code true} if the architecture is SPARC
+     */
+    public boolean isSPARC() {
+        return false;
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CiAssumptions.java	Thu Jun 07 18:55:34 2012 +0200
@@ -0,0 +1,262 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.graal.api.code;
+
+import java.io.*;
+import java.util.*;
+
+import com.oracle.graal.api.meta.*;
+
+/**
+ * Class for recording optimistic assumptions made during compilation.
+ * Recorded assumption can be visited for subsequent processing using
+ * an implementation of the {@link CiAssumptionProcessor} interface.
+ */
+public final class CiAssumptions implements Serializable, Iterable<CiAssumptions.Assumption> {
+
+    private static final long serialVersionUID = 5152062717588239131L;
+
+    public abstract static class Assumption implements Serializable {
+
+        private static final long serialVersionUID = -1936652569665112915L;
+    }
+
+    /**
+     * An assumption about a unique subtype of a given type.
+     */
+    public static final class ConcreteSubtype extends Assumption {
+
+        private static final long serialVersionUID = -1457173265437676252L;
+
+        /**
+         * Type the assumption is made about.
+         */
+        public final RiResolvedType context;
+
+        /**
+         * Assumed unique concrete sub-type of the context type.
+         */
+        public final RiResolvedType subtype;
+
+        public ConcreteSubtype(RiResolvedType context, RiResolvedType subtype) {
+            this.context = context;
+            this.subtype = subtype;
+        }
+
+        @Override
+        public int hashCode() {
+            final int prime = 31;
+            int result = 1;
+            result = prime * result + context.hashCode();
+            result = prime * result + subtype.hashCode();
+            return result;
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            if (obj instanceof ConcreteSubtype) {
+                ConcreteSubtype other = (ConcreteSubtype) obj;
+                return other.context == context && other.subtype == subtype;
+            }
+            return false;
+        }
+    }
+
+    /**
+     * An assumption about a unique implementation of a virtual method.
+     */
+    public static final class ConcreteMethod extends Assumption {
+
+        private static final long serialVersionUID = -7636746737947390059L;
+
+        /**
+         * A virtual (or interface) method whose unique implementation for the receiver type
+         * in {@link #context} is {@link #impl}.
+         */
+        public final RiResolvedMethod method;
+
+        /**
+         * A receiver type.
+         */
+        public final RiResolvedType context;
+
+        /**
+         * The unique implementation of {@link #method} for {@link #context}.
+         */
+        public final RiResolvedMethod impl;
+
+        public ConcreteMethod(RiResolvedMethod method, RiResolvedType context, RiResolvedMethod impl) {
+            this.method = method;
+            this.context = context;
+            this.impl = impl;
+        }
+
+        @Override
+        public int hashCode() {
+            final int prime = 31;
+            int result = 1;
+            result = prime * result + method.hashCode();
+            result = prime * result + context.hashCode();
+            result = prime * result + impl.hashCode();
+            return result;
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            if (obj instanceof ConcreteMethod) {
+                ConcreteMethod other = (ConcreteMethod) obj;
+                return other.method == method && other.context == context && other.impl == impl;
+            }
+            return false;
+        }
+    }
+
+    /**
+     * An assumption that specified that a method was used during the compilation.
+     */
+    public static final class MethodContents extends Assumption {
+
+        private static final long serialVersionUID = -4821594103928571659L;
+
+        public final RiResolvedMethod method;
+
+        public MethodContents(RiResolvedMethod method) {
+            this.method = method;
+        }
+
+        @Override
+        public int hashCode() {
+            final int prime = 31;
+            int result = 1;
+            result = prime * result + method.hashCode();
+            return result;
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            if (obj instanceof ConcreteMethod) {
+                ConcreteMethod other = (ConcreteMethod) obj;
+                return other.method == method;
+            }
+            return false;
+        }
+    }
+
+    /**
+     * Array with the assumptions. This field is directly accessed from C++ code in the Graal/HotSpot implementation.
+     */
+    private Assumption[] list;
+
+    private int count;
+
+    /**
+     * Returns whether any assumptions have been registered.
+     * @return {@code true} if at least one assumption has been registered, {@code false} otherwise.
+     */
+    public boolean isEmpty() {
+        return count == 0;
+    }
+
+    @Override
+    public Iterator<Assumption> iterator() {
+        return new Iterator<CiAssumptions.Assumption>() {
+            int index;
+            public void remove() {
+                throw new UnsupportedOperationException();
+            }
+            public Assumption next() {
+                if (index >= count) {
+                    throw new NoSuchElementException();
+                }
+                return list[index++];
+            }
+            public boolean hasNext() {
+                return index < count;
+            }
+        };
+    }
+
+    /**
+     * Records an assumption that the specified type has no finalizable subclasses.
+     *
+     * @param receiverType the type that is assumed to have no finalizable subclasses
+     * @return {@code true} if the assumption was recorded and can be assumed; {@code false} otherwise
+     */
+    @SuppressWarnings("static-method")
+    public boolean recordNoFinalizableSubclassAssumption(RiResolvedType receiverType) {
+        // TODO (thomaswue): Record that assumption correctly.
+        return false;
+    }
+
+    /**
+     * Records that {@code subtype} is the only concrete subtype in the class hierarchy below {@code context}.
+     * @param context the root of the subtree of the class hierarchy that this assumptions is about
+     * @param subtype the one concrete subtype
+     */
+    public void recordConcreteSubtype(RiResolvedType context, RiResolvedType subtype) {
+        record(new ConcreteSubtype(context, subtype));
+    }
+
+    /**
+     * Records that {@code impl} is the only possible concrete target for a virtual call to
+     * {@code method} with a receiver of type {@code context}.
+     *
+     * @param method a method that is the target of a virtual call
+     * @param context the receiver type of a call to {@code method}
+     * @param impl the concrete method that is the only possible target for the virtual call
+     */
+    public void recordConcreteMethod(RiResolvedMethod method, RiResolvedType context, RiResolvedMethod impl) {
+        record(new ConcreteMethod(method, context, impl));
+    }
+
+    /**
+     * Records that {@code method} was used during the compilation.
+     *
+     * @param method a method whose contents were used
+     */
+    public void recordMethodContents(RiResolvedMethod method) {
+        record(new MethodContents(method));
+    }
+
+    private void record(Assumption assumption) {
+        if (list == null) {
+            list = new Assumption[4];
+        } else {
+            for (int i = 0; i < count; ++i) {
+                if (assumption.equals(list[i])) {
+                    return;
+                }
+            }
+        }
+        if (list.length == count) {
+            Assumption[] newList = new Assumption[list.length * 2];
+            for (int i = 0; i < list.length; ++i) {
+                newList[i] = list[i];
+            }
+            list = newList;
+        }
+        list[count] = assumption;
+        count++;
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CiBailout.java	Thu Jun 07 18:55:34 2012 +0200
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.graal.api.code;
+
+import java.util.*;
+
+/**
+ * {@code CiBailout} is thrown when the compiler refuses to compile a method because of problems with the method.
+ * e.g. bytecode wouldn't verify, too big, JSR/ret too complicated, etc. This exception is <i>not</i>
+ * meant to indicate problems with the compiler itself.
+ */
+public class CiBailout extends RuntimeException {
+
+    public static final long serialVersionUID = 8974598793458772L;
+
+    /**
+     * Create a new {@code CiBailout}.
+     * @param reason a message indicating the reason
+     */
+    public CiBailout(String reason) {
+        super(reason);
+    }
+
+    /**
+     * Create a new {@code CiBailout}.
+     * @param reason a message indicating the reason with a String.format - syntax
+     * @param args parameters to the formatter
+     */
+    public CiBailout(String format, Object... args) {
+        this(String.format(Locale.ENGLISH, format, args));
+    }
+
+    /**
+     * Create a new {@code CiBailout} t due to an internal exception being thrown.
+     * @param reason a message indicating the reason
+     * @param cause the throwable that was the cause of the bailout
+     */
+    public CiBailout(String reason, Throwable cause) {
+        super(reason);
+        initCause(cause);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CiCalleeSaveLayout.java	Thu Jun 07 18:55:34 2012 +0200
@@ -0,0 +1,178 @@
+/*
+ * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.graal.api.code;
+
+import java.util.*;
+
+
+/**
+ * The callee save area (CSA) is a contiguous space in a stack frame
+ * used to save (and restore) the values of the caller's registers.
+ * This class describes the layout of a CSA in terms of its
+ * {@linkplain #size size}, {@linkplain #slotSize slot size} and
+ * the {@linkplain #registers callee save registers} covered by the CSA.
+ */
+public class CiCalleeSaveLayout {
+
+    /**
+     * The size (in bytes) of the CSA.
+     */
+    public final int size;
+
+    /**
+     * The size (in bytes) of an {@linkplain #registerAtIndex(int) indexable} slot in the CSA.
+     */
+    public final int slotSize;
+
+    /**
+     * Map from {@linkplain CiRegister#number register numbers} to slot indexes in the CSA.
+     */
+    private final int[] regNumToIndex;
+
+    private final CiRegister[] indexToReg;
+
+    /**
+     * The list of registers {@linkplain #contains(CiRegister) contained} by this CSA.
+     */
+    public final CiRegister[] registers;
+
+    /**
+     * The offset from the frame pointer to the CSA. If this is not known, then this field
+     * will have the value {@link Integer#MAX_VALUE}.
+     */
+    public final int frameOffsetToCSA;
+
+    /**
+     * Creates a CSA layout.
+     *
+     * @param size size (in bytes) of the CSA. If this is {@code -1}, then the CSA size will be computed from {@code registers}.
+     * @param slotSize the size (in bytes) of an {@linkplain #registerAtIndex(int) indexable} slot in the CSA
+     * @param registers the registers that can be saved in the CSA
+     */
+    public CiCalleeSaveLayout(int frameOffsetToCSA, int size, int slotSize, CiRegister... registers) {
+        this.frameOffsetToCSA = frameOffsetToCSA;
+        assert slotSize == 0 || CiUtil.isPowerOf2(slotSize);
+        this.slotSize = slotSize;
+        int maxRegNum = -1;
+        int maxOffset = 0;
+        this.registers = registers;
+        int offset = 0;
+        for (CiRegister reg : registers) {
+            assert offset % slotSize == 0;
+            assert reg.number >= 0;
+            if (reg.number > maxRegNum) {
+                maxRegNum = reg.number;
+            }
+            if (offset > maxOffset) {
+                maxOffset = offset;
+            }
+            offset += reg.spillSlotSize;
+        }
+        if (size == -1) {
+            this.size = offset;
+        } else {
+            assert offset <= size;
+            this.size = size;
+        }
+
+        this.regNumToIndex = new int[maxRegNum + 1];
+        this.indexToReg = offset == 0 ? new CiRegister[0] : new CiRegister[offset / slotSize];
+        Arrays.fill(regNumToIndex, -1);
+        offset = 0;
+        for (CiRegister reg : registers) {
+            int index = offset / slotSize;
+            regNumToIndex[reg.number] = index;
+            indexToReg[index] = reg;
+            offset += reg.spillSlotSize;
+        }
+    }
+
+    /**
+     * Gets the offset of a given register in the CSA.
+     *
+     * @return the offset (in bytes) of {@code reg} in the CSA
+     * @throws IllegalArgumentException if {@code reg} does not have a slot in the CSA
+     */
+    public int offsetOf(int reg) {
+        return indexOf(reg) * slotSize;
+    }
+
+    /**
+     * Gets the index of a given register in the CSA.
+     *
+     * @return the index of {@code reg} in the CSA
+     * @throws IllegalArgumentException if {@code reg} does not have a slot in the CSA
+     */
+    public int indexOf(int reg) {
+        if (!contains(reg)) {
+            throw new IllegalArgumentException(String.valueOf(reg));
+        }
+        return regNumToIndex[reg];
+    }
+
+    /**
+     * Gets the offset of a given register in the CSA.
+     *
+     * @return the offset (in bytes) of {@code reg} in the CSA
+     * @throws IllegalArgumentException if {@code reg} does not have a slot in the CSA
+     */
+    public int offsetOf(CiRegister reg) {
+        return offsetOf(reg.number);
+    }
+
+    /**
+     * Determines if the CSA includes a slot for a given register.
+     *
+     * @param reg the register to test
+     * @return true if the CSA contains a slot for {@code reg}
+     */
+    public boolean contains(int reg) {
+        return reg >= 0 && reg < regNumToIndex.length && regNumToIndex[reg] != -1;
+    }
+
+    /**
+     * Gets the register whose slot in the CSA is at a given index.
+     *
+     * @param index an index of a slot in the CSA
+     * @return the register whose slot in the CSA is at  {@code index} or {@code null} if {@code index} does not denote a
+     *         slot in the CSA aligned with a register
+     */
+    public CiRegister registerAt(int index) {
+        if (index < 0 || index >= indexToReg.length) {
+            return null;
+        }
+        return indexToReg[index];
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder("[");
+        for (CiRegister reg : registers) {
+            if (sb.length() != 1) {
+                sb.append(", ");
+            }
+            sb.append(reg).append("{+").append(offsetOf(reg)).append('}');
+        }
+        return sb.append("] size=").append(size).toString();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CiCallingConvention.java	Thu Jun 07 18:55:34 2012 +0200
@@ -0,0 +1,107 @@
+/*
+ * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.graal.api.code;
+
+import static com.oracle.graal.api.code.CiValueUtil.*;
+
+import com.oracle.graal.api.meta.*;
+
+
+/**
+ * A calling convention describes the locations in which the arguments for a call are placed.
+ */
+public class CiCallingConvention {
+
+    /**
+     * Constants denoting the type of a call for which a calling convention is
+     * {@linkplain CiRegisterConfig#getCallingConvention(Type, CiKind[], CiTarget, boolean) requested}.
+     */
+    public enum Type {
+        /**
+         * A request for the outgoing argument locations at a call site to Java code.
+         */
+        JavaCall(true),
+
+        /**
+         * A request for the incoming argument locations.
+         */
+        JavaCallee(false),
+
+        /**
+         * A request for the outgoing argument locations at a call site to the runtime (which may be Java or native code).
+         */
+        RuntimeCall(true),
+
+        /**
+         * A request for the outgoing argument locations at a call site to
+         * external native code that complies with the platform ABI.
+         */
+        NativeCall(true);
+
+        /**
+         * Determines if this is a request for the outgoing argument locations at a call site.
+         */
+        public final boolean out;
+
+        public static final Type[] VALUES = values();
+
+        private Type(boolean out) {
+            this.out = out;
+        }
+    }
+
+    /**
+     * The amount of stack space (in bytes) required for the stack-based arguments of the call.
+     */
+    public final int stackSize;
+
+    /**
+     * The locations in which the arguments are placed. This array ordered by argument index.
+     */
+    public final RiValue[] locations;
+
+    public CiCallingConvention(RiValue[] locations, int stackSize) {
+        this.locations = locations;
+        this.stackSize = stackSize;
+        assert verify();
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder result = new StringBuilder();
+        result.append("CallingConvention[");
+        for (RiValue op : locations) {
+            result.append(op.toString()).append(" ");
+        }
+        result.append("]");
+        return result.toString();
+    }
+
+    private boolean verify() {
+        for (int i = 0; i < locations.length; i++) {
+            RiValue location = locations[i];
+            assert isStackSlot(location) || isRegister(location);
+        }
+        return true;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CiCodePos.java	Thu Jun 07 18:55:34 2012 +0200
@@ -0,0 +1,103 @@
+/*
+ * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.graal.api.code;
+
+import java.io.*;
+
+import com.oracle.graal.api.meta.*;
+
+/**
+ * Represents a code position, that is, a chain of inlined methods with bytecode
+ * locations, that is communicated from the compiler to the runtime system. A code position
+ * can be used by the runtime system to reconstruct a source-level stack trace
+ * for exceptions and to create {@linkplain CiFrame frames} for deoptimization.
+ */
+public abstract class CiCodePos implements Serializable {
+
+    private static final long serialVersionUID = 8633885274526033515L;
+
+    /**
+     * The position where this position has been called, {@code null} if none.
+     */
+    public final CiCodePos caller;
+
+    /**
+     * The runtime interface method for this position.
+     */
+    public final RiResolvedMethod method;
+
+    /**
+     * The location within the method, as a bytecode index. The constant
+     * {@code -1} may be used to indicate the location is unknown, for example
+     * within code synthesized by the compiler.
+     */
+    public final int bci;
+
+    /**
+     * Constructs a new object representing a given parent/caller, a given method, and a given BCI.
+     *
+     * @param caller the parent position
+     * @param method the method
+     * @param bci a BCI within the method
+     */
+    public CiCodePos(CiCodePos caller, RiResolvedMethod method, int bci) {
+        assert method != null;
+        this.caller = caller;
+        this.method = method;
+        this.bci = bci;
+    }
+
+    /**
+     * Converts this code position to a string representation.
+     * @return a string representation of this code position
+     */
+    @Override
+    public String toString() {
+        return CiUtil.append(new StringBuilder(100), this).toString();
+    }
+
+    /**
+     * Deep equality test.
+     */
+    @Override
+    public boolean equals(Object obj) {
+        if (obj == this) {
+            return true;
+        }
+        if (obj instanceof CiCodePos) {
+            CiCodePos other = (CiCodePos) obj;
+            if (other.method.equals(method) && other.bci == bci) {
+                if (caller == null) {
+                    return other.caller == null;
+                }
+                return caller.equals(other.caller);
+            }
+        }
+        return false;
+    }
+
+    @Override
+    public int hashCode() {
+        return bci;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CiCompilationStatistics.java	Thu Jun 07 18:55:34 2012 +0200
@@ -0,0 +1,211 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.graal.api.code;
+
+import java.io.*;
+import java.lang.annotation.*;
+import java.lang.reflect.*;
+import java.util.*;
+import java.util.concurrent.*;
+
+import com.oracle.graal.api.meta.*;
+
+@SuppressWarnings("unused")
+public final class CiCompilationStatistics {
+
+    private static final long RESOLUTION = 100000000;
+    private static final boolean TIMELINE_ENABLED = System.getProperty("stats.timeline.file") != null;
+    private static final boolean COMPILATIONSTATS_ENABLED = System.getProperty("stats.compilations.file") != null;
+    private static final boolean ENABLED = TIMELINE_ENABLED || COMPILATIONSTATS_ENABLED;
+
+    private static final CiCompilationStatistics DUMMY = new CiCompilationStatistics(null);
+
+    private static ConcurrentLinkedDeque<CiCompilationStatistics> list = new ConcurrentLinkedDeque<>();
+
+    private static final ThreadLocal<Deque<CiCompilationStatistics>> current = new ThreadLocal<Deque<CiCompilationStatistics>>() {
+
+        @Override
+        protected Deque<CiCompilationStatistics> initialValue() {
+            return new ArrayDeque<>();
+        }
+    };
+
+    @Retention(RetentionPolicy.RUNTIME)
+    @Target(ElementType.FIELD)
+    private static @interface AbsoluteTimeValue {
+    }
+
+    @Retention(RetentionPolicy.RUNTIME)
+    @Target(ElementType.FIELD)
+    private static @interface TimeValue {
+    }
+
+    private static long zeroTime = System.nanoTime();
+
+    private final String holder;
+    private final String name;
+    private final String signature;
+    @AbsoluteTimeValue
+    private final long startTime;
+    @TimeValue
+    private long duration;
+    private int startInvCount;
+    private int endInvCount;
+    private int bytecodeCount;
+    private int codeSize;
+    private int deoptCount;
+
+    private CiCompilationStatistics(RiResolvedMethod method) {
+        if (method != null) {
+            holder = CiUtil.format("%H", method);
+            name = method.name();
+            signature = CiUtil.format("%p", method);
+            startTime = System.nanoTime();
+            startInvCount = method.invocationCount();
+            bytecodeCount = method.codeSize();
+        } else {
+            holder = "";
+            name = "";
+            signature = "";
+            startTime = 0;
+        }
+    }
+
+    public void finish(RiResolvedMethod method) {
+        if (ENABLED) {
+            duration = System.nanoTime() - startTime;
+            endInvCount = method.invocationCount();
+            codeSize = method.compiledCodeSize();
+            if (current.get().getLast() != this) {
+                throw new RuntimeException("mismatch in finish()");
+            }
+            current.get().removeLast();
+        }
+    }
+
+    public static CiCompilationStatistics current() {
+        return current.get().isEmpty() ? null : current.get().getLast();
+    }
+
+    public static CiCompilationStatistics create(RiResolvedMethod method) {
+        if (ENABLED) {
+            CiCompilationStatistics stats = new CiCompilationStatistics(method);
+            list.add(stats);
+            current.get().addLast(stats);
+            return stats;
+        } else {
+            return DUMMY;
+        }
+    }
+
+    @SuppressWarnings("deprecation")
+    public static void clear(String dumpName) {
+        if (!ENABLED) {
+            return;
+        }
+        try {
+            ConcurrentLinkedDeque<CiCompilationStatistics> snapshot = list;
+            long snapshotZeroTime = zeroTime;
+
+            list = new ConcurrentLinkedDeque<>();
+            zeroTime = System.nanoTime();
+
+            Date now = new Date();
+            String dateString = (now.getYear() + 1900) + "_" + (now.getMonth() + 1) + "_" + now.getDate() + " " + now.getHours() + "_" + now.getMinutes() + "_" + now.getSeconds();
+            try (PrintStream out = new PrintStream("compilations " + dateString + " " + dumpName + ".csv")) {
+                // output the list of all compilations
+
+                Field[] declaredFields = CiCompilationStatistics.class.getDeclaredFields();
+                ArrayList<Field> fields = new ArrayList<>();
+                for (Field field : declaredFields) {
+                    if (!Modifier.isStatic(field.getModifiers())) {
+                        fields.add(field);
+                    }
+                }
+                for (Field field : fields) {
+                    out.print(field.getName() + ";");
+                }
+                out.println();
+                for (CiCompilationStatistics stats : snapshot) {
+                    for (Field field : fields) {
+                        if (field.isAnnotationPresent(AbsoluteTimeValue.class)) {
+                            double value = (field.getLong(stats) - snapshotZeroTime) / 1000000d;
+                            out.print(String.format(Locale.ENGLISH, "%.3f", value) + ";");
+                        } else if (field.isAnnotationPresent(TimeValue.class)) {
+                            double value = field.getLong(stats) / 1000000d;
+                            out.print(String.format(Locale.ENGLISH, "%.3f", value) + ";");
+                        } else {
+                            out.print(field.get(stats) + ";");
+                        }
+                    }
+                    out.println();
+                }
+            }
+
+            String timelineFile = System.getProperty("stats.timeline.file");
+            if (timelineFile == null || timelineFile.isEmpty()) {
+                timelineFile = "timeline " + dateString;
+            }
+            try (FileOutputStream fos = new FileOutputStream(timelineFile + " " + dumpName + ".csv", true); PrintStream out = new PrintStream(fos)) {
+
+                long[] timeSpent = new long[10000];
+                int maxTick = 0;
+                for (CiCompilationStatistics stats : snapshot) {
+                    long start = stats.startTime - snapshotZeroTime;
+                    long duration = stats.duration;
+                    if (start < 0) {
+                        duration -= -start;
+                        start = 0;
+                    }
+
+                    int tick = (int) (start / RESOLUTION);
+                    long timeLeft = RESOLUTION - (start % RESOLUTION);
+
+                    while (tick < timeSpent.length && duration > 0) {
+                        if (tick > maxTick) {
+                            maxTick = tick;
+                        }
+                        timeSpent[tick] += Math.min(timeLeft, duration);
+                        duration -= timeLeft;
+                        tick++;
+                        timeLeft = RESOLUTION;
+                    }
+                }
+                String timelineName = System.getProperty("stats.timeline.name");
+                if (timelineName != null && !timelineName.isEmpty()) {
+                    out.print(timelineName + ";");
+                }
+                for (int i = 0; i <= maxTick; i++) {
+                    out.print((timeSpent[i] * 100 / RESOLUTION) + ";");
+                }
+                out.println();
+            }
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    public void setDeoptCount(int count) {
+        this.deoptCount = count;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CiDebugInfo.java	Thu Jun 07 18:55:34 2012 +0200
@@ -0,0 +1,107 @@
+/*
+ * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.graal.api.code;
+
+import java.io.*;
+
+import com.oracle.graal.api.meta.*;
+
+/**
+ * Represents the debugging information for a particular place in the code,
+ * which includes the code position, a reference map, and deoptimization information.
+ */
+public class CiDebugInfo implements Serializable {
+
+    private static final long serialVersionUID = -6047206624915812516L;
+
+    /**
+     * The code position (including all inlined methods) of this debug info.
+     * If this is a {@link CiFrame} instance, then it is also the deoptimization information for each inlined frame.
+     */
+    public final CiCodePos codePos;
+
+    /**
+     * The reference map for the registers at this point. The reference map is <i>packed</i> in that
+     * for bit {@code k} in byte {@code n}, it refers to the register whose
+     * {@linkplain CiRegister#number number} is {@code (k + n * 8)}.
+     */
+    public final RiBitMap registerRefMap;
+
+    /**
+     * The reference map for the stack frame at this point. A set bit at {@code k} in the map
+     * represents stack slot number {@code k}.
+     */
+    public final RiBitMap frameRefMap;
+
+    /**
+     * Creates a new {@code CiDebugInfo} from the given values.
+     *
+     * @param codePos the {@linkplain CiCodePos code position} or {@linkplain CiFrame frame} info
+     * @param registerRefMap the register map
+     * @param frameRefMap the reference map for {@code frame}, which may be {@code null}
+     */
+    public CiDebugInfo(CiCodePos codePos, RiBitMap registerRefMap, RiBitMap frameRefMap) {
+        this.codePos = codePos;
+        this.registerRefMap = registerRefMap;
+        this.frameRefMap = frameRefMap;
+    }
+
+    /**
+     * @return {@code true} if this debug information has a frame
+     */
+    public boolean hasFrame() {
+        return codePos instanceof CiFrame;
+    }
+
+    /**
+     * @return {@code true} if this debug info has a reference map for the registers
+     */
+    public boolean hasRegisterRefMap() {
+        return registerRefMap != null && registerRefMap.size() > 0;
+    }
+
+    /**
+     * @return {@code true} if this debug info has a reference map for the stack
+     */
+    public boolean hasStackRefMap() {
+        return frameRefMap != null && frameRefMap.size() > 0;
+    }
+
+
+    /**
+     * Gets the deoptimization information for each inlined frame (if available).
+     *
+     * @return {@code null} if no frame de-opt info is {@linkplain #hasDebugFrame available}
+     */
+    public CiFrame frame() {
+        if (hasFrame()) {
+            return (CiFrame) codePos;
+        }
+        return null;
+    }
+
+    @Override
+    public String toString() {
+        return CiUtil.append(new StringBuilder(100), this, null).toString();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CiDeoptAction.java	Thu Jun 07 18:55:34 2012 +0200
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.graal.api.code;
+
+
+public enum CiDeoptAction {
+    None,                           // just interpret, do not invalidate nmethod
+    RecompileIfTooManyDeopts,       // recompile the nmethod; need not invalidate
+    InvalidateReprofile,            // invalidate the nmethod, reset IC, maybe recompile
+    InvalidateRecompile,            // invalidate the nmethod, recompile (probably)
+    InvalidateStopCompiling;        // invalidate the nmethod and do not compile
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CiExceptionHandler.java	Thu Jun 07 18:55:34 2012 +0200
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.graal.api.code;
+
+import com.oracle.graal.api.meta.*;
+
+/**
+ * An implementation of the {@link RiExceptionHandler} interface.
+ */
+public class CiExceptionHandler implements RiExceptionHandler {
+
+    public static final CiExceptionHandler[] NONE = {};
+
+    public final int startBCI;
+    public final int endBCI;
+    public final int handlerBCI;
+    public final int catchTypeCPI;
+    public final RiType catchType;
+
+    /**
+     * Creates a new exception handler with the specified ranges.
+     * @param startBCI the start index of the protected range
+     * @param endBCI the end index of the protected range
+     * @param catchBCI the index of the handler
+     * @param catchTypeCPI the index of the throwable class in the constant pool
+     * @param catchType the type caught by this exception handler
+     */
+    public CiExceptionHandler(int startBCI, int endBCI, int catchBCI, int catchTypeCPI, RiType catchType) {
+        this.startBCI = startBCI;
+        this.endBCI = endBCI;
+        this.handlerBCI = catchBCI;
+        this.catchTypeCPI = catchTypeCPI;
+        this.catchType = catchType;
+    }
+
+    public int startBCI() {
+        return startBCI;
+    }
+
+    public int endBCI() {
+        return endBCI;
+    }
+
+    public int handlerBCI() {
+        return handlerBCI;
+    }
+
+    public int catchTypeCPI() {
+        return catchTypeCPI;
+    }
+
+    public boolean isCatchAll() {
+        return catchTypeCPI == 0;
+    }
+
+    public RiType catchType() {
+        return catchType;
+    }
+
+    @Override
+    public String toString() {
+        return new StringBuilder(20).
+            append('[').
+            append(startBCI).
+            append(" - ").
+            append(endBCI).
+            append(") -> ").
+            append(handlerBCI).
+            append(" type=").
+            append(catchType == null ? "*any*" : catchType.name()).
+            toString();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CiFrame.java	Thu Jun 07 18:55:34 2012 +0200
@@ -0,0 +1,143 @@
+/*
+ * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.graal.api.code;
+
+import java.io.*;
+
+import com.oracle.graal.api.meta.*;
+
+/**
+ * Represents the Java bytecode frame state(s) at a given position
+ * including {@link RiValue locations} where to find the local variables,
+ * operand stack values and locked objects of the bytecode frame(s).
+ */
+public class CiFrame extends CiCodePos implements Serializable {
+    private static final long serialVersionUID = -345025397165977565L;
+
+    /**
+     * An array of values representing how to reconstruct the state of the Java frame.
+     * This is array is partitioned as follows:
+     * <p>
+     * <table border="1" cellpadding="5" frame="void", rules="all">
+     * <tr><th>Start index (inclusive)</th><th>End index (exclusive)</th><th>Description</th></tr>
+     * <tr><td>0</td>                   <td>numLocals</td>           <td>Local variables</td></tr>
+     * <tr><td>numLocals</td>           <td>numLocals + numStack</td><td>Operand stack</td></tr>
+     * <tr><td>numLocals + numStack</td><td>values.length</td>       <td>Locked objects</td></tr>
+     * </table>
+     * <p>
+     * Note that the number of locals and the number of stack slots may be smaller than the
+     * maximum number of locals and stack slots as specified in the compiled method.
+     */
+    public final RiValue[] values;
+
+    /**
+     * The number of locals in the values array.
+     */
+    public final int numLocals;
+
+    /**
+     * The number of stack slots in the values array.
+     */
+    public final int numStack;
+
+    /**
+     * The number of locks in the values array.
+     */
+    public final int numLocks;
+
+    /**
+     * In case this frame state belongs to a deoptimization, the leafGraphId will contain the StructuredGraph.graphId() of the graph that originally introduced this deoptimization point.
+     * This id is later on used by the runtime system to evict graphs from the graph cache when deoptimizations originating from them have been hit.
+     */
+    public final long leafGraphId;
+
+    public final boolean rethrowException;
+
+    public final boolean duringCall;
+
+    /**
+     * Creates a new frame object.
+     *
+     * @param caller the caller frame (which may be {@code null})
+     * @param method the method
+     * @param bci a BCI within the method
+     * @param rethrowException specifies if the VM should re-throw the pending exception when deopt'ing using this frame
+     * @param values the frame state {@link #values}
+     * @param numLocals the number of local variables
+     * @param numStack the depth of the stack
+     * @param numLocks the number of locked objects
+     */
+    public CiFrame(CiFrame caller, RiResolvedMethod method, int bci, boolean rethrowException, boolean duringCall, RiValue[] values, int numLocals, int numStack, int numLocks, long leafGraphId) {
+        super(caller, method, bci);
+        assert values != null;
+        this.rethrowException = rethrowException;
+        this.duringCall = duringCall;
+        this.values = values;
+        this.numLocals = numLocals;
+        this.numStack = numStack;
+        this.numLocks = numLocks;
+        this.leafGraphId = leafGraphId;
+        assert !rethrowException || numStack == 1 : "must have exception on top of the stack";
+    }
+
+    /**
+     * Gets the value representing the specified local variable.
+     * @param i the local variable index
+     * @return the value that can be used to reconstruct the local's current value
+     */
+    public RiValue getLocalValue(int i) {
+        return values[i];
+    }
+
+    /**
+     * Gets the value representing the specified stack slot.
+     * @param i the stack index
+     * @return the value that can be used to reconstruct the stack slot's current value
+     */
+    public RiValue getStackValue(int i) {
+        return values[i + numLocals];
+    }
+
+    /**
+     * Gets the value representing the specified lock.
+     * @param i the lock index
+     * @return the value that can be used to reconstruct the lock's current value
+     */
+    public RiValue getLockValue(int i) {
+        return values[i + numLocals + numStack];
+    }
+
+    /**
+     * Gets the caller of this frame.
+     *
+     * @return {@code null} if this frame has no caller
+     */
+    public CiFrame caller() {
+        return (CiFrame) caller;
+    }
+
+    @Override
+    public String toString() {
+        return CiUtil.append(new StringBuilder(100), this).toString();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CiGenericCallback.java	Thu Jun 07 18:55:34 2012 +0200
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.graal.api.code;
+
+/**
+ * This interface is used for {@link CiRuntimeCall#GenericCallback} runtime calls.
+ */
+public abstract class CiGenericCallback {
+
+    @SuppressWarnings("unused")
+    private Object callbackInternal(Object arg) {
+        try {
+            return callback(arg);
+        } catch (Throwable t) {
+            t.printStackTrace();
+            return null;
+        }
+    }
+
+    public abstract Object callback(Object arg);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CiMonitorValue.java	Thu Jun 07 18:55:34 2012 +0200
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.graal.api.code;
+
+import com.oracle.graal.api.meta.*;
+
+public final class CiMonitorValue extends RiValue {
+    private static final long serialVersionUID = 8241681800464483691L;
+
+    public RiValue owner;
+    public final RiValue lockData;
+    public final boolean eliminated;
+
+    public CiMonitorValue(RiValue owner, RiValue lockData, boolean eliminated) {
+        super(RiKind.Illegal);
+        this.owner = owner;
+        this.lockData = lockData;
+        this.eliminated = eliminated;
+    }
+
+    @Override
+    public String toString() {
+        return "monitor[" + owner + (lockData != null ? ", " + lockData : "") + (eliminated ? ", eliminated" : "") + "]";
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CiRegister.java	Thu Jun 07 18:55:34 2012 +0200
@@ -0,0 +1,256 @@
+/*
+ * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.graal.api.code;
+
+import java.io.*;
+import java.util.*;
+
+import com.oracle.graal.api.meta.*;
+
+/**
+ * Represents a target machine register.
+ */
+public final class CiRegister implements Comparable<CiRegister>, Serializable {
+
+    private static final long serialVersionUID = -7213269157816016300L;
+
+    /**
+     * Invalid register.
+     */
+    public static final CiRegister None = new CiRegister(-1, -1, 0, "noreg");
+
+    /**
+     * Frame pointer of the current method. All spill slots and outgoing stack-based arguments
+     * are addressed relative to this register.
+     */
+    public static final CiRegister Frame = new CiRegister(-2, -2, 0, "framereg", RegisterFlag.CPU);
+
+    public static final CiRegister CallerFrame = new CiRegister(-3, -3, 0, "callerframereg", RegisterFlag.CPU);
+
+    /**
+     * The identifier for this register that is unique across all the registers in a {@link CiArchitecture}.
+     * A valid register has {@code number > 0}.
+     */
+    public final int number;
+
+    /**
+     * The mnemonic of this register.
+     */
+    public final String name;
+
+    /**
+     * The actual encoding in a target machine instruction for this register, which may or
+     * may not be the same as {@link #number}.
+     */
+    public final int encoding;
+
+    /**
+     * The size of the stack slot used to spill the value of this register.
+     */
+    public final int spillSlotSize;
+
+    /**
+     * The set of {@link RegisterFlag} values associated with this register.
+     */
+    private final int flags;
+
+    /**
+     * An array of {@link CiRegisterValue} objects, for this register, with one entry
+     * per {@link RiKind}, indexed by {@link RiKind#ordinal}.
+     */
+    private final CiRegisterValue[] values;
+
+    /**
+     * Attributes that characterize a register in a useful way.
+     *
+     */
+    public enum RegisterFlag {
+        /**
+         * Denotes an integral (i.e. non floating point) register.
+         */
+        CPU,
+
+        /**
+         * Denotes a register whose lowest order byte can be addressed separately.
+         */
+        Byte,
+
+        /**
+         * Denotes a floating point register.
+         */
+        FPU;
+
+        public final int mask = 1 << (ordinal() + 1);
+    }
+
+    /**
+     * Creates a {@code CiRegister} instance.
+     *
+     * @param number unique identifier for the register
+     * @param encoding the target machine encoding for the register
+     * @param spillSlotSize the size of the stack slot used to spill the value of the register
+     * @param name the mnemonic name for the register
+     * @param flags the set of {@link RegisterFlag} values for the register
+     */
+    public CiRegister(int number, int encoding, int spillSlotSize, String name, RegisterFlag... flags) {
+        this.number = number;
+        this.name = name;
+        this.spillSlotSize = spillSlotSize;
+        this.flags = createMask(flags);
+        this.encoding = encoding;
+
+        values = new CiRegisterValue[RiKind.VALUES.length];
+        for (RiKind kind : RiKind.VALUES) {
+            values[kind.ordinal()] = new CiRegisterValue(kind, this);
+        }
+    }
+
+    private static int createMask(RegisterFlag... flags) {
+        int result = 0;
+        for (RegisterFlag f : flags) {
+            result |= f.mask;
+        }
+        return result;
+    }
+
+    public boolean isSet(RegisterFlag f) {
+        return (flags & f.mask) != 0;
+    }
+
+    /**
+     * Gets this register as a {@linkplain CiRegisterValue value} with a specified kind.
+     * @param kind the specified kind
+     * @return the {@link CiRegisterValue}
+     */
+    public CiRegisterValue asValue(RiKind kind) {
+        return values[kind.ordinal()];
+    }
+
+    /**
+     * Gets this register as a {@linkplain CiRegisterValue value} with no particular kind.
+     * @return a {@link CiRegisterValue} with {@link RiKind#Illegal} kind.
+     */
+    public CiRegisterValue asValue() {
+        return asValue(RiKind.Illegal);
+    }
+
+    /**
+     * Determines if this is a valid register.
+     * @return {@code true} iff this register is valid
+     */
+    public boolean isValid() {
+        return number >= 0;
+    }
+
+    /**
+     * Determines if this a floating point register.
+     */
+    public boolean isFpu() {
+        return isSet(RegisterFlag.FPU);
+    }
+
+    /**
+     * Determines if this a general purpose register.
+     */
+    public boolean isCpu() {
+        return isSet(RegisterFlag.CPU);
+    }
+
+    /**
+     * Determines if this register has the {@link RegisterFlag#Byte} attribute set.
+     * @return {@code true} iff this register has the {@link RegisterFlag#Byte} attribute set.
+     */
+    public boolean isByte() {
+        return isSet(RegisterFlag.Byte);
+    }
+
+    /**
+     * Categorizes a set of registers by {@link RegisterFlag}.
+     *
+     * @param registers a list of registers to be categorized
+     * @return a map from each {@link RegisterFlag} constant to the list of registers for which the flag is
+     *         {@linkplain #isSet(RegisterFlag) set}
+     */
+    public static EnumMap<RegisterFlag, CiRegister[]> categorize(CiRegister[] registers) {
+        EnumMap<RegisterFlag, CiRegister[]> result = new EnumMap<>(RegisterFlag.class);
+        for (RegisterFlag flag : RegisterFlag.values()) {
+            ArrayList<CiRegister> list = new ArrayList<>();
+            for (CiRegister r : registers) {
+                if (r.isSet(flag)) {
+                    list.add(r);
+                }
+            }
+            result.put(flag, list.toArray(new CiRegister[list.size()]));
+        }
+        return result;
+    }
+
+    /**
+     * Gets the maximum register {@linkplain #number number} in a given set of registers.
+     *
+     * @param registers the set of registers to process
+     * @return the maximum register number for any register in {@code registers}
+     */
+    public static int maxRegisterNumber(CiRegister[] registers) {
+        int max = Integer.MIN_VALUE;
+        for (CiRegister r : registers) {
+            if (r.number > max) {
+                max = r.number;
+            }
+        }
+        return max;
+    }
+
+    /**
+     * Gets the maximum register {@linkplain #encoding encoding} in a given set of registers.
+     *
+     * @param registers the set of registers to process
+     * @return the maximum register encoding for any register in {@code registers}
+     */
+    public static int maxRegisterEncoding(CiRegister[] registers) {
+        int max = Integer.MIN_VALUE;
+        for (CiRegister r : registers) {
+            if (r.encoding > max) {
+                max = r.encoding;
+            }
+        }
+        return max;
+    }
+
+    @Override
+    public String toString() {
+        return name;
+    }
+
+    @Override
+    public int compareTo(CiRegister o) {
+        if (number < o.number) {
+            return -1;
+        }
+        if (number > o.number) {
+            return 1;
+        }
+        return 0;
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CiRegisterAttributes.java	Thu Jun 07 18:55:34 2012 +0200
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.graal.api.code;
+
+import java.util.*;
+
+/**
+ * A collection of register attributes. The specific attribute values for a register may be
+ * local to a compilation context. For example, a {@link CiRegisterConfig} in use during
+ * a compilation will determine which registers are callee saved.
+ */
+public class CiRegisterAttributes {
+
+    /**
+     * Denotes a register whose value preservation (if required) across a call is the responsibility of the caller.
+     */
+    public final boolean isCallerSave;
+
+    /**
+     * Denotes a register whose value preservation (if required) across a call is the responsibility of the callee.
+     */
+    public final boolean isCalleeSave;
+
+    /**
+     * Denotes a register that is available for use by a register allocator.
+     */
+    public final boolean isAllocatable;
+
+    /**
+     * Denotes a register guaranteed to be non-zero if read in compiled Java code.
+     * For example, a register dedicated to holding the current thread.
+     */
+    public boolean isNonZero;
+
+    public CiRegisterAttributes(boolean isCallerSave, boolean isCalleeSave, boolean isAllocatable) {
+        this.isCallerSave = isCallerSave;
+        this.isCalleeSave = isCalleeSave;
+        this.isAllocatable = isAllocatable;
+    }
+
+    public static final CiRegisterAttributes NONE = new CiRegisterAttributes(false, false, false);
+
+    /**
+     * Creates a map from register {@linkplain CiRegister#number numbers} to register
+     * {@linkplain CiRegisterAttributes attributes} for a given register configuration and set of
+     * registers.
+     *
+     * @param registerConfig a register configuration
+     * @param registers a set of registers
+     * @return an array whose length is the max register number in {@code registers} plus 1. An element at index i holds
+     *         the attributes of the register whose number is i.
+     */
+    public static CiRegisterAttributes[] createMap(CiRegisterConfig registerConfig, CiRegister[] registers) {
+        CiRegisterAttributes[] map = new CiRegisterAttributes[registers.length];
+        for (CiRegister reg : registers) {
+            if (reg != null) {
+                CiCalleeSaveLayout csl = registerConfig.getCalleeSaveLayout();
+                CiRegisterAttributes attr = new CiRegisterAttributes(
+                                Arrays.asList(registerConfig.getCallerSaveRegisters()).contains(reg),
+                                csl == null ? false : Arrays.asList(csl.registers).contains(reg),
+                                Arrays.asList(registerConfig.getAllocatableRegisters()).contains(reg));
+                if (map.length <= reg.number) {
+                    map = Arrays.copyOf(map, reg.number + 1);
+                }
+                map[reg.number] = attr;
+            }
+        }
+        for (int i = 0; i < map.length; i++) {
+            if (map[i] == null) {
+                map[i] = NONE;
+            }
+        }
+        return map;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CiRegisterConfig.java	Thu Jun 07 18:55:34 2012 +0200
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.graal.api.code;
+
+import java.util.*;
+
+import com.oracle.graal.api.code.CiCallingConvention.*;
+import com.oracle.graal.api.code.CiRegister.*;
+import com.oracle.graal.api.meta.*;
+
+/**
+ * A register configuration binds roles and {@linkplain CiRegisterAttributes attributes}
+ * to physical registers.
+ */
+public interface CiRegisterConfig {
+
+    /**
+     * Gets the register to be used for returning a value of a given kind.
+     */
+    CiRegister getReturnRegister(RiKind kind);
+
+    /**
+     * Gets the register to which {@link CiRegister#Frame} and {@link CiRegister#CallerFrame} are bound.
+     */
+    CiRegister getFrameRegister();
+
+    CiRegister getScratchRegister();
+
+    /**
+     * Gets the calling convention describing how arguments are passed.
+     *
+     * @param type the type of calling convention being requested
+     * @param parameters the types of the arguments of the call
+     * @param target the target platform
+     * @param stackOnly ignore registers
+     */
+    CiCallingConvention getCallingConvention(Type type, RiKind[] parameters, CiTarget target, boolean stackOnly);
+
+    /**
+     * Gets the ordered set of registers that are can be used to pass parameters
+     * according to a given calling convention.
+     *
+     * @param type the type of calling convention
+     * @param flag specifies whether registers for {@linkplain RegisterFlag#CPU integral} or
+     *             {@linkplain} RegisterFlag#FPU floating point} parameters are being requested
+     * @return the ordered set of registers that may be used to pass parameters in a call conforming to {@code type}
+     */
+    CiRegister[] getCallingConventionRegisters(Type type, RegisterFlag flag);
+
+    /**
+     * Gets the set of registers that can be used by the register allocator.
+     */
+    CiRegister[] getAllocatableRegisters();
+
+    /**
+     * Gets the set of registers that can be used by the register allocator,
+     * {@linkplain CiRegister#categorize(CiRegister[]) categorized} by register {@linkplain RegisterFlag flags}.
+     *
+     * @return a map from each {@link RegisterFlag} constant to the list of {@linkplain #getAllocatableRegisters()
+     *         allocatable} registers for which the flag is {@linkplain #isSet(RegisterFlag) set}
+     *
+     */
+    EnumMap<RegisterFlag, CiRegister[]> getCategorizedAllocatableRegisters();
+
+    /**
+     * Gets the registers whose values must be preserved by a method across any call it makes.
+     */
+    CiRegister[] getCallerSaveRegisters();
+
+    /**
+     * Gets the layout of the callee save area of this register configuration.
+     *
+     * @return {@code null} if there is no callee save area
+     */
+    CiCalleeSaveLayout getCalleeSaveLayout();
+
+    /**
+     * Gets a map from register {@linkplain CiRegister#number numbers} to register
+     * {@linkplain CiRegisterAttributes attributes} for this register configuration.
+     *
+     * @return an array where an element at index i holds the attributes of the register whose number is i
+     * @see CiRegister#categorize(CiRegister[])
+     */
+    CiRegisterAttributes[] getAttributesMap();
+
+    /**
+     * Gets the register corresponding to a runtime-defined role.
+     *
+     * @param id the identifier of a runtime-defined register role
+     * @return the register playing the role specified by {@code id}
+     */
+    CiRegister getRegisterForRole(int id);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CiRegisterConfigImpl.java	Thu Jun 07 18:55:34 2012 +0200
@@ -0,0 +1,298 @@
+/*
+ * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.graal.api.code;
+
+import java.util.*;
+
+import com.oracle.graal.api.code.CiCallingConvention.*;
+import com.oracle.graal.api.code.CiRegister.*;
+import com.oracle.graal.api.meta.*;
+
+/**
+ * A default implementation of {@link CiRegisterConfig}.
+ */
+public class CiRegisterConfigImpl implements CiRegisterConfig {
+
+    /**
+     * The object describing the callee save area of this register configuration.
+     */
+    public CiCalleeSaveLayout csl;
+
+    /**
+     * The minimum register role identifier.
+     */
+    public final int minRole;
+
+    /**
+     * The map from register role IDs to registers.
+     */
+    public final CiRegister[] registersRoleMap;
+
+    /**
+     * The set of registers that can be used by the register allocator.
+     */
+    public final CiRegister[] allocatable;
+
+    /**
+     * The set of registers that can be used by the register allocator,
+     * {@linkplain CiRegister#categorize(CiRegister[]) categorized} by register
+     * {@linkplain RegisterFlag flags}.
+     */
+    public final EnumMap<RegisterFlag, CiRegister[]> categorized;
+
+    /**
+     * The ordered set of registers used to pass integral arguments.
+     */
+    public final CiRegister[] cpuParameters;
+
+    /**
+     * The ordered set of registers used to pass floating point arguments.
+     */
+    public final CiRegister[] fpuParameters;
+
+    /**
+     * The caller saved registers.
+     */
+    public final CiRegister[] callerSave;
+
+    /**
+     * The register to which {@link CiRegister#Frame} and {@link CiRegister#CallerFrame} are bound.
+     */
+    public final CiRegister frame;
+
+    /**
+     * Register for returning an integral value.
+     */
+    public final CiRegister integralReturn;
+
+    /**
+     * Register for returning a floating point value.
+     */
+    public final CiRegister floatingPointReturn;
+
+    /**
+     * The map from register {@linkplain CiRegister#number numbers} to register
+     * {@linkplain CiRegisterAttributes attributes} for this register configuration.
+     */
+    public final CiRegisterAttributes[] attributesMap;
+
+    /**
+     * The scratch register.
+     */
+    public final CiRegister scratch;
+
+    /**
+     * The frame offset of the first stack argument for each calling convention {@link CiCallingConvention.Type}.
+     */
+    public final int[] stackArg0Offsets = new int[CiCallingConvention.Type.VALUES.length];
+
+    public CiRegisterConfigImpl(
+                    CiRegister frame,
+                    CiRegister integralReturn,
+                    CiRegister floatingPointReturn,
+                    CiRegister scratch,
+                    CiRegister[] allocatable,
+                    CiRegister[] callerSave,
+                    CiRegister[] parameters,
+                    CiCalleeSaveLayout csl,
+                    CiRegister[] allRegisters,
+                    Map<Integer, CiRegister> roles) {
+        this.frame = frame;
+        this.csl = csl;
+        this.allocatable = allocatable;
+        this.callerSave = callerSave;
+        assert !Arrays.asList(allocatable).contains(scratch);
+        this.scratch = scratch;
+        EnumMap<RegisterFlag, CiRegister[]> categorizedParameters = CiRegister.categorize(parameters);
+        this.cpuParameters = categorizedParameters.get(RegisterFlag.CPU);
+        this.fpuParameters = categorizedParameters.get(RegisterFlag.FPU);
+        categorized = CiRegister.categorize(allocatable);
+        attributesMap = CiRegisterAttributes.createMap(this, allRegisters);
+        this.floatingPointReturn = floatingPointReturn;
+        this.integralReturn = integralReturn;
+        int minRoleId = Integer.MAX_VALUE;
+        int maxRoleId = Integer.MIN_VALUE;
+        for (Map.Entry<Integer, CiRegister> e : roles.entrySet()) {
+            int id = e.getKey();
+            assert id >= 0;
+            if (minRoleId > id) {
+                minRoleId = id;
+            }
+            if (maxRoleId < id) {
+                maxRoleId = id;
+            }
+        }
+        registersRoleMap = new CiRegister[(maxRoleId - minRoleId) + 1];
+        for (Map.Entry<Integer, CiRegister> e : roles.entrySet()) {
+            int id = e.getKey();
+            registersRoleMap[id] = e.getValue();
+        }
+        minRole = minRoleId;
+    }
+
+    public CiRegisterConfigImpl(CiRegisterConfigImpl src, CiCalleeSaveLayout csl) {
+        this.frame = src.frame;
+        this.csl = csl;
+        this.allocatable = src.allocatable;
+        this.callerSave = src.callerSave;
+        this.scratch = src.scratch;
+        this.cpuParameters = src.cpuParameters;
+        this.fpuParameters = src.fpuParameters;
+        this.categorized = src.categorized;
+        this.attributesMap = src.attributesMap;
+        this.floatingPointReturn = src.floatingPointReturn;
+        this.integralReturn = src.integralReturn;
+        this.registersRoleMap = src.registersRoleMap;
+        this.minRole = src.minRole;
+        System.arraycopy(src.stackArg0Offsets, 0, stackArg0Offsets, 0, stackArg0Offsets.length);
+    }
+
+    public CiRegister getReturnRegister(RiKind kind) {
+        if (kind.isDouble() || kind.isFloat()) {
+            return floatingPointReturn;
+        }
+        return integralReturn;
+    }
+
+    public CiRegister getFrameRegister() {
+        return frame;
+    }
+
+    public CiRegister getScratchRegister() {
+        return scratch;
+    }
+
+    /**
+     * {@inheritDoc}
+     *
+     * This implementation assigns all available registers to parameters before assigning
+     * any stack slots to parameters.
+     */
+    public CiCallingConvention getCallingConvention(Type type, RiKind[] parameters, CiTarget target, boolean stackOnly) {
+        RiValue[] locations = new RiValue[parameters.length];
+
+        int currentGeneral = 0;
+        int currentXMM = 0;
+        int currentStackOffset = stackArg0Offsets[type.ordinal()];
+
+        for (int i = 0; i < parameters.length; i++) {
+            final RiKind kind = parameters[i];
+
+            switch (kind) {
+                case Byte:
+                case Boolean:
+                case Short:
+                case Char:
+                case Int:
+                case Long:
+                case Object:
+                    if (!stackOnly && currentGeneral < cpuParameters.length) {
+                        CiRegister register = cpuParameters[currentGeneral++];
+                        locations[i] = register.asValue(kind);
+                    }
+                    break;
+
+                case Float:
+                case Double:
+                    if (!stackOnly && currentXMM < fpuParameters.length) {
+                        CiRegister register = fpuParameters[currentXMM++];
+                        locations[i] = register.asValue(kind);
+                    }
+                    break;
+
+                default:
+                    throw new InternalError("Unexpected parameter kind: " + kind);
+            }
+
+            if (locations[i] == null) {
+                locations[i] = CiStackSlot.get(kind.stackKind(), currentStackOffset, !type.out);
+                currentStackOffset += Math.max(target.sizeInBytes(kind), target.wordSize);
+            }
+        }
+
+        return new CiCallingConvention(locations, currentStackOffset);
+    }
+
+    public CiRegister[] getCallingConventionRegisters(Type type, RegisterFlag flag) {
+        if (flag == RegisterFlag.CPU) {
+            return cpuParameters;
+        }
+        assert flag == RegisterFlag.FPU;
+        return fpuParameters;
+    }
+
+    public CiRegister[] getAllocatableRegisters() {
+        return allocatable;
+    }
+
+    public EnumMap<RegisterFlag, CiRegister[]> getCategorizedAllocatableRegisters() {
+        return categorized;
+    }
+
+    public CiRegister[] getCallerSaveRegisters() {
+        return callerSave;
+    }
+
+    public CiCalleeSaveLayout getCalleeSaveLayout() {
+        return csl;
+    }
+
+    public CiRegisterAttributes[] getAttributesMap() {
+        return attributesMap;
+    }
+
+    public CiRegister getRegisterForRole(int id) {
+        return registersRoleMap[id - minRole];
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder roleMap = new StringBuilder();
+        for (int i = 0; i < registersRoleMap.length; ++i) {
+            CiRegister reg = registersRoleMap[i];
+            if (reg != null) {
+                if (roleMap.length() != 0) {
+                    roleMap.append(", ");
+                }
+                roleMap.append(i + minRole).append(" -> ").append(reg);
+            }
+        }
+        StringBuilder stackArg0OffsetsMap = new StringBuilder();
+        for (Type t : Type.VALUES) {
+            if (stackArg0OffsetsMap.length() != 0) {
+                stackArg0OffsetsMap.append(", ");
+            }
+            stackArg0OffsetsMap.append(t).append(" -> ").append(stackArg0Offsets[t.ordinal()]);
+        }
+        String res = String.format(
+             "Allocatable: " + Arrays.toString(getAllocatableRegisters()) + "%n" +
+             "CallerSave:  " + Arrays.toString(getCallerSaveRegisters()) + "%n" +
+             "CalleeSave:  " + getCalleeSaveLayout() + "%n" +
+             "CPU Params:  " + Arrays.toString(cpuParameters) + "%n" +
+             "FPU Params:  " + Arrays.toString(fpuParameters) + "%n" +
+             "VMRoles:     " + roleMap + "%n" +
+             "stackArg0:   " + stackArg0OffsetsMap + "%n" +
+             "Scratch:     " + getScratchRegister() + "%n");
+        return res;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CiRegisterValue.java	Thu Jun 07 18:55:34 2012 +0200
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.graal.api.code;
+
+import com.oracle.graal.api.meta.*;
+
+/**
+ * Denotes a register that stores a value of a fixed kind. There is exactly one (canonical) instance of {@code
+ * CiRegisterValue} for each ({@link CiRegister}, {@link RiKind}) pair. Use {@link CiRegister#asValue(RiKind)} to
+ * retrieve the canonical {@link CiRegisterValue} instance for a given (register,kind) pair.
+ */
+public final class CiRegisterValue extends RiValue {
+    private static final long serialVersionUID = 7999341472196897163L;
+
+    /**
+     * The register.
+     */
+    public final CiRegister reg;
+
+    /**
+     * Should only be called from {@link CiRegister#CiRegister} to ensure canonicalization.
+     */
+    protected CiRegisterValue(RiKind kind, CiRegister register) {
+        super(kind);
+        this.reg = register;
+    }
+
+    @Override
+    public int hashCode() {
+        return (reg.number << 4) ^ kind.ordinal();
+    }
+
+    @Override
+    public String toString() {
+        return reg.name + kindSuffix();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CiRuntimeCall.java	Thu Jun 07 18:55:34 2012 +0200
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.graal.api.code;
+
+import static com.oracle.graal.api.meta.RiKind.*;
+
+import com.oracle.graal.api.meta.*;
+
+/**
+ * Enumerates the calls that must be provided by the runtime system. The compiler
+ * may generate code that calls the runtime services for unresolved and slow cases of some
+ * bytecodes.
+ */
+public enum CiRuntimeCall {
+    UnwindException(Void, Object),
+    Deoptimize(Void),
+    RegisterFinalizer(Void, Object),
+    SetDeoptInfo(Void, Object),
+    CreateNullPointerException(Object),
+    CreateOutOfBoundsException(Object, Int),
+    JavaTimeMillis(Long),
+    JavaTimeNanos(Long),
+    Debug(Void),
+    ArithmeticFrem(Float, Float, Float),
+    ArithmeticDrem(Double, Double, Double),
+    ArithmeticCos(Double, Double),
+    ArithmeticTan(Double, Double),
+    ArithmeticSin(Double, Double),
+    GenericCallback(Object, Object, Object);
+
+    public final RiKind resultKind;
+    public final RiKind[] arguments;
+
+    private CiRuntimeCall(RiKind resultKind, RiKind... args) {
+        this.resultKind = resultKind;
+        this.arguments = args;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CiStackSlot.java	Thu Jun 07 18:55:34 2012 +0200
@@ -0,0 +1,175 @@
+/*
+ * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.graal.api.code;
+
+import static com.oracle.graal.api.meta.RiKind.*;
+
+import com.oracle.graal.api.meta.*;
+
+/**
+ * Represents a compiler spill slot or an outgoing stack-based argument in a method's frame
+ * or an incoming stack-based argument in a method's {@linkplain #inCallerFrame() caller's frame}.
+ */
+public final class CiStackSlot extends RiValue {
+    private static final long serialVersionUID = -7725071921307318433L;
+
+    private final int offset;
+    private final boolean addFrameSize;
+
+    /**
+     * Gets a {@link CiStackSlot} instance representing a stack slot at a given index
+     * holding a value of a given kind.
+     *
+     * @param kind The kind of the value stored in the stack slot.
+     * @param offset The offset of the stack slot (in bytes)
+     * @param inCallerFrame Specifies if the offset is relative to the stack pointer,
+     *        or the beginning of the frame (stack pointer + total frame size).
+     */
+    public static CiStackSlot get(RiKind kind, int offset, boolean addFrameSize) {
+        assert kind.stackKind() == kind;
+        assert addFrameSize || offset >= 0;
+
+        if (offset % CACHE_GRANULARITY == 0) {
+            CiStackSlot[][] cache;
+            int index = offset / CACHE_GRANULARITY;
+            if (!addFrameSize) {
+                cache = OUT_CACHE;
+            } else if (offset >= 0) {
+                cache = IN_CACHE;
+            } else {
+                cache = SPILL_CACHE;
+                index = -index;
+            }
+            CiStackSlot[] slots = cache[kind.ordinal()];
+            if (index < slots.length) {
+                CiStackSlot slot = slots[index];
+                assert slot.kind == kind && slot.offset == offset && slot.addFrameSize == addFrameSize;
+                return slot;
+            }
+        }
+        return new CiStackSlot(kind, offset, addFrameSize);
+    }
+
+    /**
+     * Private constructor to enforce use of {@link #get()} so that a cache can be used.
+     */
+    private CiStackSlot(RiKind kind, int offset, boolean addFrameSize) {
+        super(kind);
+        this.offset = offset;
+        this.addFrameSize = addFrameSize;
+    }
+
+    /**
+     * Gets the offset of this stack slot, relative to the stack pointer.
+     * @return The offset of this slot (in bytes).
+     */
+    public int offset(int totalFrameSize) {
+        assert totalFrameSize > 0 || !addFrameSize;
+        int result = offset + (addFrameSize ? totalFrameSize : 0);
+        assert result >= 0;
+        return result;
+    }
+
+    public boolean inCallerFrame() {
+        return addFrameSize && offset >= 0;
+    }
+
+    public int rawOffset() {
+        return offset;
+    }
+
+    public boolean rawAddFrameSize() {
+        return addFrameSize;
+    }
+
+    @Override
+    public int hashCode() {
+        return kind.ordinal() ^ (offset << 4) ^ (addFrameSize ? 15 : 0);
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (o == this) {
+            return true;
+        }
+        if (o instanceof CiStackSlot) {
+            CiStackSlot l = (CiStackSlot) o;
+            return l.kind == kind && l.offset == offset && l.addFrameSize == addFrameSize;
+        }
+        return false;
+    }
+
+    @Override
+    public String toString() {
+        if (!addFrameSize) {
+            return "out:" + offset + kindSuffix();
+        } else if (offset >= 0) {
+            return "in:" + offset + kindSuffix();
+        } else {
+            return "stack:" + (-offset) + kindSuffix();
+        }
+    }
+
+    /**
+     * Gets this stack slot used to pass an argument from the perspective of a caller.
+     */
+    public CiStackSlot asOutArg() {
+        assert offset >= 0;
+        if (addFrameSize) {
+            return get(kind, offset, false);
+        }
+        return this;
+    }
+
+    /**
+     * Gets this stack slot used to pass an argument from the perspective of a callee.
+     */
+    public CiStackSlot asInArg() {
+        assert offset >= 0;
+        if (!addFrameSize) {
+            return get(kind, offset, true);
+        }
+        return this;
+    }
+
+
+    private static final int CACHE_GRANULARITY = 8;
+    private static final int SPILL_CACHE_PER_KIND_SIZE = 100;
+    private static final int PARAM_CACHE_PER_KIND_SIZE = 10;
+
+    private static final CiStackSlot[][] SPILL_CACHE = makeCache(SPILL_CACHE_PER_KIND_SIZE, -1, true);
+    private static final CiStackSlot[][] IN_CACHE = makeCache(PARAM_CACHE_PER_KIND_SIZE, 1, true);
+    private static final CiStackSlot[][] OUT_CACHE = makeCache(PARAM_CACHE_PER_KIND_SIZE, 1, false);
+
+    private static CiStackSlot[][] makeCache(int cachePerKindSize, int sign, boolean addFrameSize) {
+        CiStackSlot[][] cache = new CiStackSlot[RiKind.VALUES.length][];
+        for (RiKind kind : new RiKind[] {Illegal, Int, Long, Float, Double, Object, Jsr}) {
+            CiStackSlot[] slots = new CiStackSlot[cachePerKindSize];
+            for (int i = 0; i < cachePerKindSize; i++) {
+                slots[i] = new CiStackSlot(kind, sign * i * CACHE_GRANULARITY, addFrameSize);
+            }
+            cache[kind.ordinal()] = slots;
+        }
+        return cache;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CiTarget.java	Thu Jun 07 18:55:34 2012 +0200
@@ -0,0 +1,159 @@
+/*
+ * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.graal.api.code;
+
+import com.oracle.graal.api.meta.*;
+
+
+/**
+ * Represents the target machine for a compiler, including the CPU architecture, the size of pointers and references,
+ * alignment of stacks, caches, etc.
+ */
+public class CiTarget {
+    public final CiArchitecture arch;
+
+    /**
+     * The OS page size.
+     */
+    public final int pageSize;
+
+    /**
+     * Specifies if this is a multi-processor system.
+     */
+    public final boolean isMP;
+
+    /**
+     * Specifies if this target supports encoding objects inline in the machine code.
+     */
+    public final boolean inlineObjects;
+
+    /**
+     * The machine word size on this target.
+     */
+    public final int wordSize;
+
+    /**
+     * The CiKind to be used for representing raw pointers and CPU registers.
+     */
+    public final RiKind wordKind;
+
+    /**
+     * The stack alignment requirement of the platform. For example,
+     * from Appendix D of <a href="http://www.intel.com/Assets/PDF/manual/248966.pdf">Intel 64 and IA-32 Architectures Optimization Reference Manual</a>:
+     * <pre>
+     *     "It is important to ensure that the stack frame is aligned to a
+     *      16-byte boundary upon function entry to keep local __m128 data,
+     *      parameters, and XMM register spill locations aligned throughout
+     *      a function invocation."
+     * </pre>
+     */
+    public final int stackAlignment;
+
+    /**
+     * @see http://docs.sun.com/app/docs/doc/806-0477/6j9r2e2b9?a=view
+     */
+    public final int stackBias;
+
+    /**
+     * The cache alignment.
+     */
+    public final int cacheAlignment;
+
+    /**
+     * Specifies how {@code long} and {@code double} constants are to be stored
+     * in {@linkplain CiFrame frames}. This is useful for VMs such as HotSpot
+     * where convention the interpreter uses is that the second local
+     * holds the first raw word of the native long or double representation.
+     * This is actually reasonable, since locals and stack arrays
+     * grow downwards in all implementations.
+     * If, on some machine, the interpreter's Java locals or stack
+     * were to grow upwards, the embedded doubles would be word-swapped.)
+     */
+    public final boolean debugInfoDoubleWordsInSecondSlot;
+
+    /**
+     * Temporary flag to distinguish between the semantics necessary for HotSpot and Maxine.
+     */
+    // TODO This should go away when XIR goes away, and the logic be part of the VM-specific lowering.
+    public final boolean invokeSnippetAfterArguments;
+
+    public CiTarget(CiArchitecture arch,
+             boolean isMP,
+             int stackAlignment,
+             int pageSize,
+             int cacheAlignment,
+             boolean inlineObjects,
+             boolean debugInfoDoubleWordsInSecondSlot,
+             boolean invokeSnippetAfterArguments) {
+        this.arch = arch;
+        this.pageSize = pageSize;
+        this.isMP = isMP;
+        this.wordSize = arch.wordSize;
+        if (wordSize == 8) {
+            this.wordKind = RiKind.Long;
+        } else {
+            this.wordKind = RiKind.Int;
+        }
+        this.stackAlignment = stackAlignment;
+        this.stackBias = 0; // TODO: configure with param once SPARC port exists
+        this.cacheAlignment = cacheAlignment;
+        this.inlineObjects = inlineObjects;
+        this.debugInfoDoubleWordsInSecondSlot = debugInfoDoubleWordsInSecondSlot;
+        this.invokeSnippetAfterArguments = invokeSnippetAfterArguments;
+    }
+
+    /**
+     * Gets the size in bytes of the specified kind for this target.
+     *
+     * @param kind the kind for which to get the size
+     * @return the size in bytes of {@code kind}
+     */
+    public int sizeInBytes(RiKind kind) {
+        // Checkstyle: stop
+        switch (kind) {
+            case Boolean: return 1;
+            case Byte: return 1;
+            case Char: return 2;
+            case Short: return 2;
+            case Int: return 4;
+            case Long: return 8;
+            case Float: return 4;
+            case Double: return 8;
+            case Object: return wordSize;
+            case Jsr: return 4;
+            default: return 0;
+        }
+        // Checkstyle: resume
+    }
+
+    /**
+     * Aligns the given frame size (without return instruction pointer) to the stack
+     * alignment size and return the aligned size (without return instruction pointer).
+     * @param frameSize the initial frame size to be aligned
+     * @return the aligned frame size
+     */
+    public int alignFrameSize(int frameSize) {
+        int x = frameSize + arch.returnAddressSize + (stackAlignment - 1);
+        return (x / stackAlignment) * stackAlignment - arch.returnAddressSize;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CiTargetMethod.java	Thu Jun 07 18:55:34 2012 +0200
@@ -0,0 +1,555 @@
+/*
+ * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.graal.api.code;
+
+import java.io.*;
+import java.util.*;
+
+import com.oracle.graal.api.meta.*;
+
+/**
+ * Represents the output from compiling a method, including the compiled machine code, associated data and references,
+ * relocation information, deoptimization information, etc. It is the essential component of a {@link CiResult}, which also includes
+ * {@linkplain CiStatistics compilation statistics} and {@linkplain CiBailout failure information}.
+ */
+public class CiTargetMethod implements Serializable {
+
+    private static final long serialVersionUID = -1319947729753702434L;
+
+    /**
+     * Represents a code position with associated additional information.
+     */
+    public abstract static class Site implements Serializable {
+        private static final long serialVersionUID = -8214214947651979102L;
+        /**
+         * 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;
+        }
+    }
+
+    /**
+     * Represents a safepoint with associated debug info.
+     */
+    public static class Safepoint extends Site implements Comparable<Safepoint> {
+        private static final long serialVersionUID = 2479806696381720162L;
+        public final CiDebugInfo debugInfo;
+
+        Safepoint(int pcOffset, CiDebugInfo debugInfo) {
+            super(pcOffset);
+            this.debugInfo = debugInfo;
+        }
+
+        @Override
+        public String toString() {
+            StringBuilder sb = new StringBuilder();
+            sb.append(pcOffset);
+            sb.append("[<safepoint>]");
+            appendDebugInfo(sb, debugInfo);
+            return sb.toString();
+        }
+
+        @Override
+        public int compareTo(Safepoint o) {
+            if (pcOffset < o.pcOffset) {
+                return -1;
+            } else if (pcOffset > o.pcOffset) {
+                return 1;
+            }
+            return 0;
+        }
+    }
+
+    /**
+     * Represents a call in the code.
+     */
+    public static final class Call extends Safepoint {
+        private static final long serialVersionUID = 1440741241631046954L;
+
+        /**
+         * The target of the call.
+         */
+        public final Object 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;
+
+        Call(Object target, int pcOffset, int size, boolean direct, CiDebugInfo debugInfo) {
+            super(pcOffset, debugInfo);
+            this.size = size;
+            this.target = target;
+            this.direct = direct;
+        }
+
+        @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 a reference to data from the code. The associated data can be any constant.
+     */
+    public static final class DataPatch extends Site {
+        private static final long serialVersionUID = 5771730331604867476L;
+        public final RiConstant constant;
+        public final int alignment;
+
+        DataPatch(int pcOffset, RiConstant data, int alignment) {
+            super(pcOffset);
+            this.constant = data;
+            this.alignment = alignment;
+        }
+
+        @Override
+        public String toString() {
+            return String.format("%d[<data patch referring to data %s>]", pcOffset, constant);
+        }
+    }
+
+    /**
+     * Provides extra information about instructions or data at specific positions in {@link CiTargetMethod#targetCode()}.
+     * This is optional information that can be used to enhance a disassembly of the code.
+     */
+    public abstract static class CodeAnnotation implements Serializable {
+        private static final long serialVersionUID = -7903959680749520748L;
+        public final int position;
+
+        public CodeAnnotation(int position) {
+            this.position = position;
+        }
+    }
+
+    /**
+     * A string comment about one or more instructions at a specific position in the code.
+     */
+    public static final class CodeComment extends CodeAnnotation {
+        /**
+         *
+         */
+        private static final long serialVersionUID = 6802287188701961401L;
+        public final String value;
+        public CodeComment(int position, String comment) {
+            super(position);
+            this.value = comment;
+        }
+
+        @Override
+        public String toString() {
+            return getClass().getSimpleName() + "@" + position + ": " + value;
+        }
+    }
+
+    /**
+     * Labels some inline data in the code.
+     */
+    public static final class InlineData extends CodeAnnotation {
+        private static final long serialVersionUID = 305997507263827108L;
+        public final int size;
+        public InlineData(int position, int size) {
+            super(position);
+            this.size = size;
+        }
+
+        @Override
+        public String toString() {
+            return getClass().getSimpleName() + "@" + position + ": size=" + size;
+        }
+    }
+
+    /**
+     * 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 {
+        private static final long serialVersionUID = 2222194398353801831L;
+
+        /**
+         * 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 String toString() {
+            return getClass().getSimpleName() + "@" + position + ": [" + low + " .. " + high + "]";
+        }
+    }
+
+    /**
+     * Describes a table of key and offset pairs. The offset in each table entry is relative to the address of
+     * the table. This type of table maybe generated when translating a multi-way branch
+     * based on a key value from a sparse value set (e.g. the {@code lookupswitch} JVM instruction).
+     */
+    public static final class LookupTable extends CodeAnnotation {
+        private static final long serialVersionUID = 8367952567559116160L;
+
+        /**
+         * The number of entries in the table.
+         */
+        public final int npairs;
+
+        /**
+         * The size (in bytes) of entry's key.
+         */
+        public final int keySize;
+
+        /**
+         * The size (in bytes) of entry's offset value.
+         */
+        public final int offsetSize;
+
+        public LookupTable(int position, int npairs, int keySize, int offsetSize) {
+            super(position);
+            this.npairs = npairs;
+            this.keySize = keySize;
+            this.offsetSize = offsetSize;
+        }
+
+        @Override
+        public String toString() {
+            return getClass().getSimpleName() + "@" + position + ": [npairs=" + npairs + ", keySize=" + keySize + ", offsetSize=" + offsetSize + "]";
+        }
+    }
+
+    /**
+     * 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 {
+        private static final long serialVersionUID = 4897339464722665281L;
+        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);
+        }
+    }
+
+    public static final class Mark extends Site {
+        private static final long serialVersionUID = 3612943150662354844L;
+        public final Object id;
+        public final Mark[] references;
+
+        Mark(int pcOffset, Object id, Mark[] references) {
+            super(pcOffset);
+            this.id = id;
+            this.references = references;
+        }
+
+        @Override
+        public String toString() {
+            if (id == null) {
+                return String.format("%d[<mark with %d references>]", pcOffset, references.length);
+            } else if (id instanceof Integer) {
+                return String.format("%d[<mark with %d references and id %s>]", pcOffset, references.length, Integer.toHexString((Integer) id));
+            } else {
+                return String.format("%d[<mark with %d references and id %s>]", pcOffset, references.length, id.toString());
+            }
+        }
+    }
+
+    /**
+     * List of safepoints, sorted by {@link Site#pcOffset}.
+     */
+    public final List<Safepoint> safepoints = new ArrayList<>();
+
+    /**
+     * List of data references.
+     */
+    public final List<DataPatch> dataReferences = new ArrayList<>();
+
+    /**
+     * List of exception handlers.
+     */
+    public final List<ExceptionHandler> exceptionHandlers = new ArrayList<>();
+
+    /**
+     * List of marks.
+     */
+    public final List<Mark> marks = new ArrayList<>();
+
+    private int frameSize = -1;
+    private int customStackAreaOffset = -1;
+    private int registerRestoreEpilogueOffset = -1;
+    /**
+     * 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 CiAssumptions assumptions;
+
+    /**
+     * Constructs a new target method.
+     */
+    public CiTargetMethod() {
+    }
+
+    public void setAssumptions(CiAssumptions assumptions) {
+        this.assumptions = assumptions;
+    }
+
+    public CiAssumptions assumptions() {
+        return assumptions;
+    }
+
+    /**
+     * Sets the frame size in bytes. Does not include the return address pushed onto the
+     * stack, if any.
+     *
+     * @param size the size of the frame in bytes
+     */
+    public void setFrameSize(int size) {
+        frameSize = 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) {
+        targetCode = code;
+        targetCodeSize = size;
+    }
+
+    /**
+     * Records a reference to the data section in the code section (e.g. to load an integer or floating point constant).
+     *
+     * @param codePos the position in the code where the data reference occurs
+     * @param data the data that is referenced
+     * @param alignment the alignment requirement of the data or 0 if there is no alignment requirement
+     */
+    public void recordDataReference(int codePos, RiConstant data, int alignment) {
+        assert codePos >= 0 && data != null;
+        dataReferences.add(new DataPatch(codePos, data, alignment));
+    }
+
+    /**
+     * 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 {@link RiRuntime#asCallTarget(Object) target} 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, Object target, CiDebugInfo debugInfo, boolean direct) {
+        final Call call = new Call(target, codePos, size, direct, debugInfo);
+        addSafepoint(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
+     * @param throwableType the type of exceptions handled by the handler
+     */
+    public void recordExceptionHandler(int codePos, int handlerPos) {
+        exceptionHandlers.add(new ExceptionHandler(codePos, handlerPos));
+    }
+
+    /**
+     * Records a safepoint in the code array.
+     *
+     * @param codePos the position of the safepoint in the code array
+     * @param debugInfo the debug info for the safepoint
+     */
+    public void recordSafepoint(int codePos, CiDebugInfo debugInfo) {
+        addSafepoint(new Safepoint(codePos, debugInfo));
+    }
+
+    private void addSafepoint(Safepoint safepoint) {
+        // The safepoints list must always be sorted
+        if (!safepoints.isEmpty() && safepoints.get(safepoints.size() - 1).pcOffset >= safepoint.pcOffset) {
+            // This re-sorting should be very rare
+            Collections.sort(safepoints);
+        }
+        safepoints.add(safepoint);
+    }
+
+    /**
+     * Records an instruction mark within this method.
+     *
+     * @param codePos the position in the code that is covered by the handler
+     * @param id the identifier for this mark
+     * @param references an array of other marks that this mark references
+     */
+    public Mark recordMark(int codePos, Object id, Mark[] references) {
+        Mark mark = new Mark(codePos, id, references);
+        marks.add(mark);
+        return mark;
+    }
+
+    /**
+     * Allows a method to specify the offset of the epilogue that restores the callee saved registers. Must be called
+     * iff the method is a callee saved method and stores callee registers on the stack.
+     *
+     * @param registerRestoreEpilogueOffset the offset in the machine code where the epilogue begins
+     */
+    public void setRegisterRestoreEpilogueOffset(int registerRestoreEpilogueOffset) {
+        assert this.registerRestoreEpilogueOffset == -1;
+        this.registerRestoreEpilogueOffset = registerRestoreEpilogueOffset;
+    }
+
+    /**
+     * The frame size of the method in bytes.
+     *
+     * @return the frame size
+     */
+    public int frameSize() {
+        assert frameSize != -1 : "frame size not yet initialized!";
+        return frameSize;
+    }
+
+    /**
+     * @return the code offset of the start of the epilogue that restores all callee saved registers, or -1 if this is
+     *         not a callee saved method
+     */
+    public int registerRestoreEpilogueOffset() {
+        return registerRestoreEpilogueOffset;
+    }
+
+    /**
+     * Offset in bytes for the custom stack area (relative to sp).
+     * @return the offset in bytes
+     */
+    public int customStackAreaOffset() {
+        return customStackAreaOffset;
+    }
+
+    /**
+     * @see #customStackAreaOffset()
+     * @param offset
+     */
+    public void setCustomStackAreaOffset(int offset) {
+        customStackAreaOffset = offset;
+    }
+
+    /**
+     * @return the machine code generated for this method
+     */
+    public byte[] targetCode() {
+        return targetCode;
+    }
+
+    /**
+     * @return the size of the machine code generated for this method
+     */
+    public int targetCodeSize() {
+        return targetCodeSize;
+    }
+
+    /**
+     * @return the code annotations or {@code null} if there are none
+     */
+    public List<CodeAnnotation> annotations() {
+        return annotations;
+    }
+
+    public void addAnnotation(CodeAnnotation annotation) {
+        assert annotation != null;
+        if (annotations == null) {
+            annotations = new ArrayList<>();
+        }
+        annotations.add(annotation);
+    }
+
+    private static void appendDebugInfo(StringBuilder sb, CiDebugInfo info) {
+        if (info != null) {
+            appendRefMap(sb, "stackMap", info.frameRefMap);
+            appendRefMap(sb, "registerMap", info.registerRefMap);
+            CiCodePos codePos = info.codePos;
+            if (codePos != null) {
+                CiUtil.appendLocation(sb.append(" "), codePos.method, codePos.bci);
+                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);
+                    }
+                }
+            }
+        }
+    }
+
+    private static void appendRefMap(StringBuilder sb, String name, RiBitMap map) {
+        if (map != null) {
+            sb.append(' ').append(name).append('[').append(map.toBinaryString()).append(']');
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CiUtil.java	Thu Jun 07 18:55:34 2012 +0200
@@ -0,0 +1,705 @@
+/*
+ * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.graal.api.code;
+
+import static java.lang.reflect.Modifier.*;
+
+import java.lang.annotation.*;
+import java.util.*;
+
+import com.oracle.graal.api.meta.*;
+import com.oracle.graal.api.meta.RiTypeProfile.*;
+
+/**
+ * Miscellaneous collection of utility methods used in the {@code CRI} project.
+ */
+public class CiUtil {
+
+    public static final String NEW_LINE = String.format("%n");
+
+    /**
+     * Gets the annotation of a particular type for a formal parameter of a given method.
+     *
+     * @param annotationClass the Class object corresponding to the annotation type
+     * @param parameterIndex the index of a formal parameter of {@code method}
+     * @param method the method for which a parameter annotation is being requested
+     * @return the annotation of type {@code annotationClass} for the formal parameter present, else null
+     * @throws IndexOutOfBoundsException if {@code parameterIndex} does not denote a formal parameter
+     */
+    public static <T extends Annotation> T getParameterAnnotation(Class<T> annotationClass, int parameterIndex, RiResolvedMethod method) {
+        if (parameterIndex >= 0) {
+            Annotation[][] parameterAnnotations = method.getParameterAnnotations();
+            for (Annotation a : parameterAnnotations[parameterIndex]) {
+                if (a.annotationType() == annotationClass) {
+                    return annotationClass.cast(a);
+                }
+            }
+        }
+        return null;
+    }
+
+    public static final int K = 1024;
+    public static final int M = 1024 * 1024;
+
+    public static boolean isOdd(int n) {
+        return (n & 1) == 1;
+    }
+
+    public static boolean isEven(int n) {
+        return (n & 1) == 0;
+    }
+
+    /**
+     * Checks whether the specified integer is a power of two.
+     *
+     * @param val the value to check
+     * @return {@code true} if the value is a power of two; {@code false} otherwise
+     */
+    public static boolean isPowerOf2(int val) {
+        return val != 0 && (val & val - 1) == 0;
+    }
+
+    /**
+     * Checks whether the specified long is a power of two.
+     *
+     * @param val the value to check
+     * @return {@code true} if the value is a power of two; {@code false} otherwise
+     */
+    public static boolean isPowerOf2(long val) {
+        return val != 0 && (val & val - 1) == 0;
+    }
+
+    /**
+     * Computes the log (base 2) of the specified integer, rounding down. (E.g {@code log2(8) = 3}, {@code log2(21) = 4}
+     * )
+     *
+     * @param val the value
+     * @return the log base 2 of the value
+     */
+    public static int log2(int val) {
+        assert val > 0 && isPowerOf2(val);
+        return 31 - Integer.numberOfLeadingZeros(val);
+    }
+
+    /**
+     * Computes the log (base 2) of the specified long, rounding down. (E.g {@code log2(8) = 3}, {@code log2(21) = 4})
+     *
+     * @param val the value
+     * @return the log base 2 of the value
+     */
+    public static int log2(long val) {
+        assert val > 0 && isPowerOf2(val);
+        return 63 - Long.numberOfLeadingZeros(val);
+    }
+
+    public static int align(int size, int align) {
+        assert isPowerOf2(align);
+        return (size + align - 1) & ~(align - 1);
+    }
+
+    /**
+     * Gets a word with the nth bit set.
+     *
+     * @param n the nth bit to set
+     * @return an integer value with the nth bit set
+     */
+    public static int nthBit(int n) {
+        return n >= Integer.SIZE ? 0 : 1 << n;
+    }
+
+    /**
+     * Gets a word with the right-most n bits set.
+     *
+     * @param n the number of right most bits to set
+     * @return an integer value with the right-most n bits set
+     */
+    public static int rightNBits(int n) {
+        return nthBit(n) - 1;
+    }
+
+    /**
+     * Gets a string for a given method formatted according to a given format specification. A format specification is
+     * composed of characters that are to be copied verbatim to the result and specifiers that denote an attribute of
+     * the method that is to be copied to the result. A specifier is a single character preceded by a '%' character. The
+     * accepted specifiers and the method attributes they denote are described below:
+     *
+     * <pre>
+     *     Specifier | Description                                          | Example(s)
+     *     ----------+------------------------------------------------------------------------------------------
+     *     'R'       | Qualified return type                                | "int" "java.lang.String"
+     *     'r'       | Unqualified return type                              | "int" "String"
+     *     'H'       | Qualified holder                                     | "java.util.Map.Entry"
+     *     'h'       | Unqualified holder                                   | "Entry"
+     *     'n'       | Method name                                          | "add"
+     *     'P'       | Qualified parameter types, separated by ', '         | "int, java.lang.String"
+     *     'p'       | Unqualified parameter types, separated by ', '       | "int, String"
+     *     'f'       | Indicator if method is unresolved, static or virtual | "unresolved" "static" "virtual"
+     *     '%'       | A '%' character                                      | "%"
+     * </pre>
+     *
+     * @param format a format specification
+     * @param method the method to be formatted
+     * @param kinds if {@code true} then the types in {@code method}'s signature are printed in the
+     *            {@linkplain RiKind#jniName JNI} form of their {@linkplain RiKind kind}
+     * @return the result of formatting this method according to {@code format}
+     * @throws IllegalFormatException if an illegal specifier is encountered in {@code format}
+     */
+    public static String format(String format, RiMethod method) throws IllegalFormatException {
+        final StringBuilder sb = new StringBuilder();
+        int index = 0;
+        RiSignature sig = null;
+        while (index < format.length()) {
+            final char ch = format.charAt(index++);
+            if (ch == '%') {
+                if (index >= format.length()) {
+                    throw new UnknownFormatConversionException("An unquoted '%' character cannot terminate a method format specification");
+                }
+                final char specifier = format.charAt(index++);
+                boolean qualified = false;
+                switch (specifier) {
+                    case 'R':
+                        qualified = true;
+                        // fall through
+                    case 'r': {
+                        if (sig == null) {
+                            sig = method.signature();
+                        }
+                        sb.append(RiUtil.toJavaName(sig.returnType(null), qualified));
+                        break;
+                    }
+                    case 'H':
+                        qualified = true;
+                        // fall through
+                    case 'h': {
+                        sb.append(RiUtil.toJavaName(method.holder(), qualified));
+                        break;
+                    }
+                    case 'n': {
+                        sb.append(method.name());
+                        break;
+                    }
+                    case 'P':
+                        qualified = true;
+                        // fall through
+                    case 'p': {
+                        if (sig == null) {
+                            sig = method.signature();
+                        }
+                        for (int i = 0; i < sig.argumentCount(false); i++) {
+                            if (i != 0) {
+                                sb.append(", ");
+                            }
+                            sb.append(RiUtil.toJavaName(sig.argumentTypeAt(i, null), qualified));
+                        }
+                        break;
+                    }
+                    case 'f': {
+                        sb.append(!(method instanceof RiResolvedMethod) ? "unresolved" : isStatic(((RiResolvedMethod) method).accessFlags()) ? "static" : "virtual");
+                        break;
+                    }
+                    case '%': {
+                        sb.append('%');
+                        break;
+                    }
+                    default: {
+                        throw new UnknownFormatConversionException(String.valueOf(specifier));
+                    }
+                }
+            } else {
+                sb.append(ch);
+            }
+        }
+        return sb.toString();
+    }
+
+    /**
+     * Gets a string for a given field formatted according to a given format specification. A format specification is
+     * composed of characters that are to be copied verbatim to the result and specifiers that denote an attribute of
+     * the field that is to be copied to the result. A specifier is a single character preceded by a '%' character. The
+     * accepted specifiers and the field attributes they denote are described below:
+     *
+     * <pre>
+     *     Specifier | Description                                          | Example(s)
+     *     ----------+------------------------------------------------------------------------------------------
+     *     'T'       | Qualified type                                       | "int" "java.lang.String"
+     *     't'       | Unqualified type                                     | "int" "String"
+     *     'H'       | Qualified holder                                     | "java.util.Map.Entry"
+     *     'h'       | Unqualified holder                                   | "Entry"
+     *     'n'       | Field name                                           | "age"
+     *     'f'       | Indicator if field is unresolved, static or instance | "unresolved" "static" "instance"
+     *     '%'       | A '%' character                                      | "%"
+     * </pre>
+     *
+     * @param format a format specification
+     * @param field the field to be formatted
+     * @param kinds if {@code true} then {@code field}'s type is printed in the {@linkplain RiKind#jniName JNI} form of
+     *            its {@linkplain RiKind kind}
+     * @return the result of formatting this field according to {@code format}
+     * @throws IllegalFormatException if an illegal specifier is encountered in {@code format}
+     */
+    public static String format(String format, RiField field) throws IllegalFormatException {
+        final StringBuilder sb = new StringBuilder();
+        int index = 0;
+        RiType type = field.type();
+        while (index < format.length()) {
+            final char ch = format.charAt(index++);
+            if (ch == '%') {
+                if (index >= format.length()) {
+                    throw new UnknownFormatConversionException("An unquoted '%' character cannot terminate a field format specification");
+                }
+                final char specifier = format.charAt(index++);
+                boolean qualified = false;
+                switch (specifier) {
+                    case 'T':
+                        qualified = true;
+                        // fall through
+                    case 't': {
+                        sb.append(RiUtil.toJavaName(type, qualified));
+                        break;
+                    }
+                    case 'H':
+                        qualified = true;
+                        // fall through
+                    case 'h': {
+                        sb.append(RiUtil.toJavaName(field.holder(), qualified));
+                        break;
+                    }
+                    case 'n': {
+                        sb.append(field.name());
+                        break;
+                    }
+                    case 'f': {
+                        sb.append(!(field instanceof RiResolvedField) ? "unresolved" : isStatic(((RiResolvedField) field).accessFlags()) ? "static" : "instance");
+                        break;
+                    }
+                    case '%': {
+                        sb.append('%');
+                        break;
+                    }
+                    default: {
+                        throw new UnknownFormatConversionException(String.valueOf(specifier));
+                    }
+                }
+            } else {
+                sb.append(ch);
+            }
+        }
+        return sb.toString();
+    }
+
+    /**
+     * Converts a Java source-language class name into the internal form.
+     *
+     * @param className the class name
+     * @return the internal name form of the class name
+     */
+    public static String toInternalName(String className) {
+        return "L" + className.replace('.', '/') + ";";
+    }
+
+    /**
+     * Creates a set that uses reference-equality instead of {@link Object#equals(Object)} when comparing values.
+     *
+     * @param <T> the type of elements in the set
+     * @return a set based on reference-equality
+     */
+    public static <T> Set<T> newIdentityHashSet() {
+        return Collections.newSetFromMap(new IdentityHashMap<T, Boolean>());
+    }
+
+    /**
+     * Prepends the String {@code indentation} to every line in String {@code lines}, including a possibly non-empty
+     * line following the final newline.
+     */
+    public static String indent(String lines, String indentation) {
+        if (lines.length() == 0) {
+            return lines;
+        }
+        final String newLine = "\n";
+        if (lines.endsWith(newLine)) {
+            return indentation + (lines.substring(0, lines.length() - 1)).replace(newLine, newLine + indentation) + newLine;
+        }
+        return indentation + lines.replace(newLine, newLine + indentation);
+    }
+
+    /**
+     * Formats the values in a frame as a tabulated string.
+     *
+     * @param frame
+     * @return the values in {@code frame} as a tabulated string
+     */
+    public static String tabulateValues(CiFrame frame) {
+        int cols = Math.max(frame.numLocals, Math.max(frame.numStack, frame.numLocks));
+        assert cols > 0;
+        ArrayList<Object> cells = new ArrayList<>();
+        cells.add("");
+        for (int i = 0; i < cols; i++) {
+            cells.add(i);
+        }
+        cols++;
+        if (frame.numLocals != 0) {
+            cells.add("locals:");
+            cells.addAll(Arrays.asList(frame.values).subList(0, frame.numLocals));
+            cells.addAll(Collections.nCopies(cols - frame.numLocals - 1, ""));
+        }
+        if (frame.numStack != 0) {
+            cells.add("stack:");
+            cells.addAll(Arrays.asList(frame.values).subList(frame.numLocals, frame.numLocals + frame.numStack));
+            cells.addAll(Collections.nCopies(cols - frame.numStack - 1, ""));
+        }
+        if (frame.numLocks != 0) {
+            cells.add("locks:");
+            cells.addAll(Arrays.asList(frame.values).subList(frame.numLocals + frame.numStack, frame.values.length));
+            cells.addAll(Collections.nCopies(cols - frame.numLocks - 1, ""));
+        }
+        Object[] cellArray = cells.toArray();
+        for (int i = 0; i < cellArray.length; i++) {
+            if ((i % cols) != 0) {
+                cellArray[i] = "|" + cellArray[i];
+            }
+        }
+        return CiUtil.tabulate(cellArray, cols, 1, 1);
+    }
+
+    /**
+     * Formats a given table as a string. The value of each cell is produced by {@link String#valueOf(Object)}.
+     *
+     * @param cells the cells of the table in row-major order
+     * @param cols the number of columns per row
+     * @param lpad the number of space padding inserted before each formatted cell value
+     * @param rpad the number of space padding inserted after each formatted cell value
+     * @return a string with one line per row and each column left-aligned
+     */
+    public static String tabulate(Object[] cells, int cols, int lpad, int rpad) {
+        int rows = (cells.length + (cols - 1)) / cols;
+        int[] colWidths = new int[cols];
+        for (int col = 0; col < cols; col++) {
+            for (int row = 0; row < rows; row++) {
+                int index = col + (row * cols);
+                if (index < cells.length) {
+                    Object cell = cells[index];
+                    colWidths[col] = Math.max(colWidths[col], String.valueOf(cell).length());
+                }
+            }
+        }
+        StringBuilder sb = new StringBuilder();
+        String nl = NEW_LINE;
+        for (int row = 0; row < rows; row++) {
+            for (int col = 0; col < cols; col++) {
+                int index = col + (row * cols);
+                if (index < cells.length) {
+                    for (int i = 0; i < lpad; i++) {
+                        sb.append(' ');
+                    }
+                    Object cell = cells[index];
+                    String s = String.valueOf(cell);
+                    int w = s.length();
+                    sb.append(s);
+                    while (w < colWidths[col]) {
+                        sb.append(' ');
+                        w++;
+                    }
+                    for (int i = 0; i < rpad; i++) {
+                        sb.append(' ');
+                    }
+                }
+            }
+            sb.append(nl);
+        }
+        return sb.toString();
+    }
+
+    /**
+     * Convenient shortcut for calling {@link #appendLocation(StringBuilder, RiMethod, int)} without having to supply a
+     * a {@link StringBuilder} instance and convert the result to a string.
+     */
+    public static String toLocation(RiResolvedMethod method, int bci) {
+        return appendLocation(new StringBuilder(), method, bci).toString();
+    }
+
+    /**
+     * Appends a string representation of a location specified by a given method and bci to a given
+     * {@link StringBuilder}. If a stack trace element with a non-null file name and non-negative line number is
+     * {@linkplain RiMethod#toStackTraceElement(int) available} for the given method, then the string returned is the
+     * {@link StackTraceElement#toString()} value of the stack trace element, suffixed by the bci location. For example:
+     *
+     * <pre>
+     *     java.lang.String.valueOf(String.java:2930) [bci: 12]
+     * </pre>
+     *
+     * Otherwise, the string returned is the value of {@code CiUtil.format("%H.%n(%p)"}, suffixed by the bci location.
+     * For example:
+     *
+     * <pre>
+     *     java.lang.String.valueOf(int) [bci: 12]
+     * </pre>
+     *
+     * @param sb
+     * @param method
+     * @param bci
+     * @return
+     */
+    public static StringBuilder appendLocation(StringBuilder sb, RiResolvedMethod method, int bci) {
+        if (method != null) {
+            StackTraceElement ste = method.toStackTraceElement(bci);
+            if (ste.getFileName() != null && ste.getLineNumber() > 0) {
+                sb.append(ste);
+            } else {
+                sb.append(CiUtil.format("%H.%n(%p)", method));
+            }
+        } else {
+            sb.append("Null method");
+        }
+        return sb.append(" [bci: ").append(bci).append(']');
+    }
+
+    /**
+     * Appends a formatted code position to a {@link StringBuilder}.
+     *
+     * @param sb the {@link StringBuilder} to append to
+     * @param pos the code position to format and append to {@code sb}
+     * @return the value of {@code sb}
+     */
+    public static StringBuilder append(StringBuilder sb, CiCodePos pos) {
+        appendLocation(sb.append("at "), pos.method, pos.bci);
+        if (pos.caller != null) {
+            sb.append(NEW_LINE);
+            append(sb, pos.caller);
+        }
+        return sb;
+    }
+
+    /**
+     * Appends a formatted frame to a {@link StringBuilder}.
+     *
+     * @param sb the {@link StringBuilder} to append to
+     * @param frame the frame to format and append to {@code sb}
+     * @return the value of {@code sb}
+     */
+    public static StringBuilder append(StringBuilder sb, CiFrame frame) {
+        appendLocation(sb.append("at "), frame.method, frame.bci);
+        if (frame.values != null && frame.values.length > 0) {
+            sb.append(NEW_LINE);
+            String table = tabulateValues(frame);
+            String[] rows = table.split(NEW_LINE);
+            for (int i = 0; i < rows.length; i++) {
+                String row = rows[i];
+                if (!row.trim().isEmpty()) {
+                    sb.append("  ").append(row);
+                    if (i != rows.length - 1) {
+                        sb.append(NEW_LINE);
+                    }
+                }
+            }
+        }
+        if (frame.caller() != null) {
+            sb.append(NEW_LINE);
+            append(sb, frame.caller());
+        } else if (frame.caller != null) {
+            sb.append(NEW_LINE);
+            append(sb, frame.caller);
+        }
+        return sb;
+    }
+
+    /**
+     * Formats a location present in a register or frame reference map.
+     */
+    public static class RefMapFormatter {
+
+        /**
+         * The size of a stack slot.
+         */
+        public final int slotSize;
+
+        /**
+         * The register used as the frame pointer.
+         */
+        public final CiRegister fp;
+
+        public final CiArchitecture arch;
+
+        /**
+         * The offset (in bytes) from the slot pointed to by {@link #fp} to the slot corresponding to bit 0 in the frame
+         * reference map.
+         */
+        public final int refMapToFPOffset;
+
+        public RefMapFormatter(CiArchitecture arch, int slotSize, CiRegister fp, int refMapToFPOffset) {
+            this.arch = arch;
+            this.slotSize = slotSize;
+            this.fp = fp;
+            this.refMapToFPOffset = refMapToFPOffset;
+        }
+
+        public String formatStackSlot(int frameRefMapIndex) {
+            int refMapOffset = frameRefMapIndex * slotSize;
+            int fpOffset = refMapOffset + refMapToFPOffset;
+            if (fpOffset >= 0) {
+                return fp + "+" + fpOffset;
+            }
+            return fp.name + fpOffset;
+        }
+
+        public String formatRegister(int regRefMapIndex) {
+            return arch.registers[regRefMapIndex].toString();
+        }
+    }
+
+    /**
+     * Appends a formatted debug info to a {@link StringBuilder}.
+     *
+     * @param sb the {@link StringBuilder} to append to
+     * @param info the debug info to format and append to {@code sb}
+     * @return the value of {@code sb}
+     */
+    public static StringBuilder append(StringBuilder sb, CiDebugInfo info, RefMapFormatter formatter) {
+        String nl = NEW_LINE;
+        if (info.hasRegisterRefMap()) {
+            sb.append("  reg-ref-map:");
+            RiBitMap bm = info.registerRefMap;
+            if (formatter != null) {
+                for (int reg = bm.nextSetBit(0); reg >= 0; reg = bm.nextSetBit(reg + 1)) {
+                    sb.append(" " + formatter.formatRegister(reg));
+                }
+            }
+            sb.append(' ').append(bm).append(nl);
+        }
+        if (info.hasStackRefMap()) {
+            sb.append("frame-ref-map:");
+            RiBitMap bm = info.frameRefMap;
+            if (formatter != null) {
+                for (int i = bm.nextSetBit(0); i >= 0; i = bm.nextSetBit(i + 1)) {
+                    sb.append(" " + formatter.formatStackSlot(i));
+                }
+            }
+            sb.append(' ').append(bm).append(nl);
+        }
+        CiFrame frame = info.frame();
+        if (frame != null) {
+            append(sb, frame);
+        } else if (info.codePos != null) {
+            append(sb, info.codePos);
+        }
+        return sb;
+    }
+
+    public static RiKind[] signatureToKinds(RiResolvedMethod method) {
+        RiKind receiver = isStatic(method.accessFlags()) ? null : method.holder().kind(true);
+        return signatureToKinds(method.signature(), receiver);
+    }
+
+    public static RiKind[] signatureToKinds(RiSignature signature, RiKind receiverKind) {
+        int args = signature.argumentCount(false);
+        RiKind[] result;
+        int i = 0;
+        if (receiverKind != null) {
+            result = new RiKind[args + 1];
+            result[0] = receiverKind;
+            i = 1;
+        } else {
+            result = new RiKind[args];
+        }
+        for (int j = 0; j < args; j++) {
+            result[i + j] = signature.argumentKindAt(j, true);
+        }
+        return result;
+    }
+
+    public static Class< ? >[] signatureToTypes(RiSignature signature, RiResolvedType accessingClass) {
+        int count = signature.argumentCount(false);
+        Class< ? >[] result = new Class< ? >[count];
+        for (int i = 0; i < result.length; ++i) {
+            result[i] = signature.argumentTypeAt(i, accessingClass).resolve(accessingClass).toJava();
+        }
+        return result;
+    }
+
+    /**
+     * Formats some profiling information associated as a string.
+     *
+     * @param info the profiling info to format
+     * @param method an optional method that augments the profile string returned
+     * @param sep the separator to use for each separate profile record
+     */
+    public static String profileToString(RiProfilingInfo info, RiResolvedMethod method, String sep) {
+        StringBuilder buf = new StringBuilder(100);
+        if (method != null) {
+            buf.append(String.format("canBeStaticallyBound: %b%s", method.canBeStaticallyBound(), sep)).
+            append(String.format("invocationCount: %d%s", method.invocationCount(), sep));
+        }
+        for (int i = 0; i < info.codeSize(); i++) {
+            if (info.getExecutionCount(i) != -1) {
+                buf.append(String.format("executionCount@%d: %d%s", i, info.getExecutionCount(i), sep));
+            }
+
+            if (info.getBranchTakenProbability(i) != -1) {
+                buf.append(String.format("branchProbability@%d: %.3f%s", i, info.getBranchTakenProbability(i), sep));
+            }
+
+            double[] switchProbabilities = info.getSwitchProbabilities(i);
+            if (switchProbabilities != null) {
+                buf.append(String.format("switchProbabilities@%d:", i));
+                for (int j = 0; j < switchProbabilities.length; j++) {
+                    buf.append(String.format(" %.3f", switchProbabilities[j]));
+                }
+                buf.append(sep);
+            }
+
+            if (info.getExceptionSeen(i) != RiExceptionSeen.FALSE) {
+                buf.append(String.format("exceptionSeen@%d: %s%s", i, info.getExceptionSeen(i).name(), sep));
+            }
+
+            RiTypeProfile typeProfile = info.getTypeProfile(i);
+            if (typeProfile != null) {
+                ProfiledType[] ptypes = typeProfile.getTypes();
+                if (ptypes != null) {
+                    buf.append(String.format("types@%d:", i));
+                    for (int j = 0; j < ptypes.length; j++) {
+                        ProfiledType ptype = ptypes[j];
+                        buf.append(String.format(" %.3f (%s)%s", ptype.probability, ptype.type, sep));
+                    }
+                    buf.append(String.format(" %.3f <not recorded>%s", typeProfile.getNotRecordedProbability(), sep));
+                }
+            }
+        }
+
+        boolean firstDeoptReason = true;
+        for (RiDeoptReason reason: RiDeoptReason.values()) {
+            int count = info.getDeoptimizationCount(reason);
+            if (count > 0) {
+                if (firstDeoptReason) {
+                    buf.append("deoptimization history").append(sep);
+                    firstDeoptReason = false;
+                }
+                buf.append(String.format(" %s: %d%s", reason.name(), count, sep));
+            }
+        }
+        if (buf.length() == 0) {
+            return "";
+        }
+        String s = buf.toString();
+        assert s.endsWith(sep);
+        return s.substring(0, s.length() - sep.length());
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CiValueUtil.java	Thu Jun 07 18:55:34 2012 +0200
@@ -0,0 +1,130 @@
+/*
+ * Copyright (c) 2012, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.graal.api.code;
+
+import com.oracle.graal.api.meta.*;
+
+public class CiValueUtil {
+    public static boolean isIllegal(RiValue value) {
+        assert value != null;
+        return value == RiValue.IllegalValue;
+    }
+
+    public static boolean isLegal(RiValue value) {
+        return !isIllegal(value);
+    }
+
+    public static boolean isVirtualObject(RiValue value) {
+        assert value != null;
+        return value instanceof CiVirtualObject;
+    }
+
+    public static CiVirtualObject asVirtualObject(RiValue value) {
+        assert value != null;
+        return (CiVirtualObject) value;
+    }
+
+    public static boolean isConstant(RiValue value) {
+        assert value != null;
+        return value instanceof RiConstant;
+    }
+
+    public static RiConstant asConstant(RiValue value) {
+        assert value != null;
+        return (RiConstant) value;
+    }
+
+
+    public static boolean isStackSlot(RiValue value) {
+        assert value != null;
+        return value instanceof CiStackSlot;
+    }
+
+    public static CiStackSlot asStackSlot(RiValue value) {
+        assert value != null;
+        return (CiStackSlot) value;
+    }
+
+    public static boolean isAddress(RiValue value) {
+        assert value != null;
+        return value instanceof CiAddress;
+    }
+
+    public static CiAddress asAddress(RiValue value) {
+        assert value != null;
+        return (CiAddress) value;
+    }
+
+
+    public static boolean isRegister(RiValue value) {
+        assert value != null;
+        return value instanceof CiRegisterValue;
+    }
+
+    public static CiRegister asRegister(RiValue value) {
+        assert value != null;
+        return ((CiRegisterValue) value).reg;
+    }
+
+    public static CiRegister asIntReg(RiValue value) {
+        assert value.kind == RiKind.Int || value.kind == RiKind.Jsr;
+        return asRegister(value);
+    }
+
+    public static CiRegister asLongReg(RiValue value) {
+        assert value.kind == RiKind.Long : value.kind;
+        return asRegister(value);
+    }
+
+    public static CiRegister asObjectReg(RiValue value) {
+        assert value.kind == RiKind.Object;
+        return asRegister(value);
+    }
+
+    public static CiRegister asFloatReg(RiValue value) {
+        assert value.kind == RiKind.Float;
+        return asRegister(value);
+    }
+
+    public static CiRegister asDoubleReg(RiValue value) {
+        assert value.kind == RiKind.Double;
+        return asRegister(value);
+    }
+
+
+    public static boolean sameRegister(RiValue v1, RiValue v2) {
+        return isRegister(v1) && isRegister(v2) && asRegister(v1) == asRegister(v2);
+    }
+
+    public static boolean sameRegister(RiValue v1, RiValue v2, RiValue v3) {
+        return sameRegister(v1, v2) && sameRegister(v1, v3);
+    }
+
+    public static boolean differentRegisters(RiValue v1, RiValue v2) {
+        return !isRegister(v1) || !isRegister(v2) || asRegister(v1) != asRegister(v2);
+    }
+
+    public static boolean differentRegisters(RiValue v1, RiValue v2, RiValue v3) {
+        return differentRegisters(v1, v2) && differentRegisters(v1, v3) && differentRegisters(v2, v3);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CiVirtualObject.java	Thu Jun 07 18:55:34 2012 +0200
@@ -0,0 +1,164 @@
+/*
+ * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.graal.api.code;
+
+import com.oracle.graal.api.meta.*;
+
+/**
+ * An instance of this class represents an object whose allocation was removed by escape analysis. The information stored in the {@link CiVirtualObject} is used during
+ * deoptimization to recreate the object.
+ */
+public final class CiVirtualObject extends RiValue {
+    private static final long serialVersionUID = -2907197776426346021L;
+
+    private final RiType type;
+    private RiValue[] values;
+    private final int id;
+
+    /**
+     * Creates a new CiVirtualObject for the given type, with the given fields. If the type is an instance class then the values array needs to have one entry for each field, ordered in
+     * like the fields returned by {@link RiResolvedType#declaredFields()}. If the type is an array then the length of the values array determines the reallocated array length.
+     * @param type the type of the object whose allocation was removed during compilation. This can be either an instance of an array type.
+     * @param values an array containing all the values to be stored into the object when it is recreated.
+     * @param id a unique id that identifies the object within the debug information for one position in the compiled code.
+     * @return a new CiVirtualObject instance.
+     */
+    public static CiVirtualObject get(RiType type, RiValue[] values, int id) {
+        return new CiVirtualObject(type, values, id);
+    }
+
+    private CiVirtualObject(RiType type, RiValue[] values, int id) {
+        super(RiKind.Object);
+        this.type = type;
+        this.values = values;
+        this.id = id;
+    }
+
+    @Override
+    public String toString() {
+        return "vobject:" + id;
+    }
+
+    /**
+     * @return the type of the object whose allocation was removed during compilation. This can be either an instance of an array type.
+     */
+    public RiType type() {
+        return type;
+    }
+
+    /**
+     * @return an array containing all the values to be stored into the object when it is recreated.
+     */
+    public RiValue[] values() {
+        return values;
+    }
+
+    /**
+     * @return the unique id that identifies the object within the debug information for one position in the compiled code.
+     */
+    public int id() {
+        return id;
+    }
+
+    /**
+     * Overwrites the current set of values with a new one.
+     * @param values an array containing all the values to be stored into the object when it is recreated.
+     */
+    public void setValues(RiValue[] values) {
+        this.values = values;
+    }
+
+    @Override
+    public int hashCode() {
+        return kind.ordinal() + type.hashCode();
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (o == this) {
+            return true;
+        }
+        if (o instanceof CiVirtualObject) {
+            CiVirtualObject l = (CiVirtualObject) o;
+            if (l.type != type || l.values.length != values.length) {
+                return false;
+            }
+            for (int i = 0; i < values.length; i++) {
+                if (values[i] != l.values[i]) {
+                    return false;
+                }
+            }
+            return true;
+        }
+        return false;
+    }
+
+    /**
+     * This is a helper class used to create virtual objects for a number of different JDK classes.
+     */
+    public static class CiVirtualObjectFactory {
+        private int nextId = 0;
+        private final RiRuntime runtime;
+
+        public CiVirtualObjectFactory(RiRuntime runtime) {
+            this.runtime = runtime;
+        }
+
+        public CiVirtualObject constantProxy(RiKind kind, RiValue objectValue, RiValue primitiveValue) {
+            RiConstant cKind = RiConstant.forObject(kind);
+            // TODO: here the ordering is hard coded... we should query RiType.fields() and act accordingly
+            return new CiVirtualObject(runtime.getType(RiConstant.class), new RiValue[] {cKind, primitiveValue, RiValue.IllegalValue, objectValue}, nextId++);
+        }
+
+        public RiValue proxy(RiValue ciValue) {
+            switch (ciValue.kind) {
+                case Boolean:
+                    return new CiVirtualObject(runtime.getType(Boolean.class), new RiValue[] {ciValue}, nextId++);
+                case Byte:
+                    return new CiVirtualObject(runtime.getType(Byte.class), new RiValue[] {ciValue}, nextId++);
+                case Char:
+                    return new CiVirtualObject(runtime.getType(Character.class), new RiValue[] {ciValue}, nextId++);
+                case Double:
+                    return new CiVirtualObject(runtime.getType(Double.class), new RiValue[] {ciValue, RiValue.IllegalValue}, nextId++);
+                case Float:
+                    return new CiVirtualObject(runtime.getType(Float.class), new RiValue[] {ciValue}, nextId++);
+                case Int:
+                    return new CiVirtualObject(runtime.getType(Integer.class), new RiValue[] {ciValue}, nextId++);
+                case Long:
+                    return new CiVirtualObject(runtime.getType(Long.class), new RiValue[] {ciValue, RiValue.IllegalValue}, nextId++);
+                case Object:
+                    return ciValue;
+                case Short:
+                    return new CiVirtualObject(runtime.getType(Short.class), new RiValue[] {ciValue}, nextId++);
+                default:
+                    assert false : ciValue.kind;
+                    return null;
+            }
+        }
+
+        public CiVirtualObject arrayProxy(RiType arrayType, RiValue[] values) {
+            return new CiVirtualObject(arrayType, values, nextId++);
+        }
+
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/RiRuntime.java	Thu Jun 07 18:55:34 2012 +0200
@@ -0,0 +1,148 @@
+/*
+ * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.graal.api.code;
+
+import java.lang.reflect.*;
+
+import com.oracle.graal.api.meta.*;
+
+/**
+ * Encapsulates the main functionality of the runtime for the compiler, including access
+ * to constant pools, OSR frames, inlining requirements, and runtime calls such as checkcast.
+s */
+public interface RiRuntime {
+
+    /**
+     * Get the size in bytes for locking information on the stack.
+     */
+    int sizeOfLockData();
+
+    /**
+     * Returns a disassembly of the given installed code.
+     *
+     * @param code the code that should be disassembled
+     * @return a disassembly. This will be of length 0 if the runtime does not support disassembling.
+     */
+    String disassemble(RiCodeInfo code, CiTargetMethod tm);
+
+    /**
+     * Returns the disassembly of the given method in a {@code javap}-like format.
+     *
+     * @param method the method that should be disassembled
+     * @return the disassembly. This will be of length 0 if the runtime does not support disassembling.
+     */
+    String disassemble(RiResolvedMethod method);
+
+    /**
+     * Returns the RiType object representing the base type for the given kind.
+     */
+    RiResolvedType asRiType(RiKind kind);
+
+    /**
+     * Returns the type of the given constant object.
+     *
+     * @return {@code null} if {@code constant.isNull() || !constant.kind.isObject()}
+     */
+    RiResolvedType getTypeOf(RiConstant constant);
+
+
+    RiResolvedType getType(Class<?> clazz);
+
+    /**
+     * Used by the canonicalizer to compare objects, since a given runtime might not want to expose the real objects to the compiler.
+     *
+     * @return true if the two parameters represent the same runtime object, false otherwise
+     */
+    boolean areConstantObjectsEqual(RiConstant x, RiConstant y);
+
+    /**
+     * Gets the register configuration to use when compiling a given method.
+     *
+     * @param method the top level method of a compilation
+     */
+    CiRegisterConfig getRegisterConfig(RiMethod method);
+
+    CiRegisterConfig getGlobalStubRegisterConfig();
+
+    /**
+     * Custom area on the stack of each compiled method that the VM can use for its own purposes.
+     * @return the size of the custom area in bytes
+     */
+    int getCustomStackAreaSize();
+
+    /**
+     * Minimum size of the stack area reserved for outgoing parameters. This area is reserved in all cases, even when
+     * the compiled method has no regular call instructions.
+     * @return the minimum size of the outgoing parameter area in bytes
+     */
+    int getMinimumOutgoingSize();
+
+    /**
+     * Gets the length of the array that is wrapped in a CiConstant object.
+     */
+    int getArrayLength(RiConstant array);
+
+    /**
+     * Performs any runtime-specific conversion on the object used to describe the target of a call.
+     */
+    Object asCallTarget(Object target);
+
+    /**
+     * Returns the maximum absolute offset of a runtime call target from any position in the code cache or -1
+     * when not known or not applicable. Intended for determining the required size of address/offset fields.
+     */
+    long getMaxCallTargetOffset(CiRuntimeCall rtcall);
+
+    /**
+     * Provides the {@link RiMethod} for a {@link Method} obtained via reflection.
+     */
+    RiResolvedMethod getRiMethod(Method reflectionMethod);
+
+    /**
+     * Adds the given machine code as an implementation of the given method without making it the default implementation.
+     * @param method a method to which the executable code is begin added
+     * @param code the code to be added
+     * @param info the object into which details of the installed code will be written.
+     *        Ignored if null, otherwise the info is written to index 0 of this array.
+     * @return a reference to the compiled and ready-to-run code
+     */
+    RiCompiledMethod addMethod(RiResolvedMethod method, CiTargetMethod code, RiCodeInfo[] info);
+
+    /**
+     * Encodes a deoptimization action and a deoptimization reason in an integer value.
+     * @return the encoded value as an integer
+     */
+    int encodeDeoptActionAndReason(CiDeoptAction action, RiDeoptReason reason);
+
+    /**
+     * Converts a RiDeoptReason into an integer value.
+     * @return An integer value representing the given RiDeoptReason.
+     */
+    int convertDeoptReason(RiDeoptReason reason);
+
+    /**
+     * Converts a RiDeoptAction into an integer value.
+     * @return An integer value representing the given RiDeoptAction.
+     */
+    int convertDeoptAction(CiDeoptAction action);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/package-info.java	Thu Jun 07 18:55:34 2012 +0200
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/**
+ * The compiler-provided part of the bi-directional interface between the compiler and the runtime system of a virtual machine for the instruction set defined in
+ * {@link com.oracle.graal.compiler.graphbuilder.Bytecodes}.
+ *
+ * The target hardware architecture is represented by {@link com.oracle.graal.api.code.CiArchitecture} and the specific target machine
+ * environment for a compiler instance is represented by {@link com.oracle.graal.api.code.CiTarget}.
+ * <p>
+ * A {@code CiResult} encapsulates
+ * {@linkplain com.oracle.max.cri.ci.CiStatistics compilation statistics}, possible {@linkplain com.oracle.graal.api.code.CiBailout error state}
+ * and the {@linkplain com.oracle.graal.api.code.CiTargetMethod compiled code and metadata}.
+ * {@link com.oracle.graal.api.code.CiCodePos} and {@link com.oracle.graal.api.code.CiDebugInfo} provide detailed information to the
+ * runtime to support debugging and deoptimization of the compiled code.
+ * <p>
+ * The compiler manipulates {@link com.oracle.graal.api.meta.RiValue} instances that have a {@link com.oracle.graal.api.meta.RiKind}, and are
+ * immutable. A concrete {@link com.oracle.graal.api.meta.RiValue value} is one of the following subclasses:
+ * <ul>
+ * <li>{@link com.oracle.graal.api.meta.RiConstant}: a constant value.
+ * <li>{@link com.oracle.graal.api.code.CiRegisterValue}: a value stored in a {@linkplain com.oracle.graal.api.code.CiRegister target machine register}.
+ * <li>{@link com.oracle.graal.api.code.CiStackSlot}: a spill slot or an outgoing stack-based argument in a method's frame.
+ * <li>{@link com.oracle.graal.api.code.CiAddress}: an address in target machine memory.
+ * <li>{@link com.oracle.graal.compiler.lir.CiVariable}: a value (cf. virtual register) that is yet to be bound to a target machine location (physical register or memory address).
+ *</ul>
+ */
+package com.oracle.graal.api.code;
+
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java	Thu Jun 07 18:55:34 2012 +0200
@@ -27,6 +27,7 @@
 import java.util.concurrent.*;
 
 import com.oracle.graal.alloc.simple.*;
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.alloc.*;
 import com.oracle.graal.compiler.gen.*;
@@ -41,7 +42,6 @@
 import com.oracle.graal.lir.asm.*;
 import com.oracle.graal.lir.cfg.*;
 import com.oracle.graal.nodes.*;
-import com.oracle.max.cri.ci.*;
 import com.oracle.max.cri.xir.*;
 
 public class GraalCompiler {
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/OptimisticOptimizations.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/OptimisticOptimizations.java	Thu Jun 07 18:55:34 2012 +0200
@@ -24,9 +24,9 @@
 
 import java.util.*;
 
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.debug.*;
-import com.oracle.max.cri.ci.*;
 import com.oracle.max.criutils.*;
 
 
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/Interval.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/Interval.java	Thu Jun 07 18:55:34 2012 +0200
@@ -26,8 +26,8 @@
 
 import java.util.*;
 
-import com.oracle.max.cri.ci.*;
 import com.oracle.max.criutils.*;
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.*;
 import com.oracle.graal.compiler.util.*;
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScan.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScan.java	Thu Jun 07 18:55:34 2012 +0200
@@ -22,14 +22,12 @@
  */
 package com.oracle.graal.compiler.alloc;
 
-import static com.oracle.max.cri.ci.CiUtil.*;
-import static com.oracle.max.cri.ci.CiValueUtil.*;
 import static com.oracle.graal.alloc.util.LocationUtil.*;
-
+import static com.oracle.graal.api.code.CiUtil.*;
 import java.util.*;
 
-import com.oracle.max.cri.ci.*;
 import com.oracle.max.criutils.*;
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.*;
 import com.oracle.graal.compiler.alloc.Interval.RegisterBinding;
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScanWalker.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScanWalker.java	Thu Jun 07 18:55:34 2012 +0200
@@ -22,14 +22,14 @@
  */
 package com.oracle.graal.compiler.alloc;
 
-import static com.oracle.max.cri.ci.CiUtil.*;
 import static com.oracle.graal.alloc.util.LocationUtil.*;
+import static com.oracle.graal.api.code.CiUtil.*;
 
 import java.util.*;
 
-import com.oracle.max.cri.ci.*;
-import com.oracle.max.cri.ci.CiRegister.RegisterFlag;
 import com.oracle.max.criutils.*;
+import com.oracle.graal.api.code.*;
+import com.oracle.graal.api.code.CiRegister.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.*;
 import com.oracle.graal.compiler.alloc.Interval.RegisterBinding;
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/MoveResolver.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/MoveResolver.java	Thu Jun 07 18:55:34 2012 +0200
@@ -22,12 +22,12 @@
  */
 package com.oracle.graal.compiler.alloc;
 
-import static com.oracle.max.cri.ci.CiValueUtil.*;
+import static com.oracle.graal.api.code.CiValueUtil.*;
 
 import java.util.*;
 
-import com.oracle.max.cri.ci.*;
 import com.oracle.max.criutils.*;
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.*;
 import com.oracle.graal.lir.*;
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/RegisterVerifier.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/RegisterVerifier.java	Thu Jun 07 18:55:34 2012 +0200
@@ -22,12 +22,12 @@
  */
 package com.oracle.graal.compiler.alloc;
 
-import static com.oracle.max.cri.ci.CiValueUtil.*;
+import static com.oracle.graal.api.code.CiValueUtil.*;
 
 import java.util.*;
 
-import com.oracle.max.cri.ci.*;
 import com.oracle.max.criutils.*;
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.*;
 import com.oracle.graal.compiler.util.*;
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/DebugInfoBuilder.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/DebugInfoBuilder.java	Thu Jun 07 18:55:34 2012 +0200
@@ -25,7 +25,7 @@
 import java.util.*;
 import java.util.Map.Entry;
 
-import com.oracle.max.cri.ci.*;
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.gen.LIRGenerator.LockScope;
 import com.oracle.graal.debug.*;
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/LIRGenerator.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/LIRGenerator.java	Thu Jun 07 18:55:34 2012 +0200
@@ -22,13 +22,15 @@
  */
 package com.oracle.graal.compiler.gen;
 
+import static com.oracle.graal.api.code.CiCallingConvention.Type.*;
 import static com.oracle.graal.api.meta.RiValue.*;
 import static com.oracle.graal.lir.ValueUtil.*;
-import static com.oracle.max.cri.ci.CiCallingConvention.Type.*;
 
 import java.util.*;
 import java.util.Map.Entry;
 
+import com.oracle.graal.api.code.*;
+import com.oracle.graal.api.code.CiTargetMethod.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.api.meta.RiType.*;
 import com.oracle.graal.compiler.*;
@@ -51,9 +53,6 @@
 import com.oracle.graal.nodes.type.*;
 import com.oracle.graal.nodes.virtual.*;
 import com.oracle.max.asm.*;
-import com.oracle.max.cri.ci.*;
-import com.oracle.max.cri.ci.CiTargetMethod.Mark;
-import com.oracle.max.cri.ri.*;
 import com.oracle.max.cri.xir.CiXirAssembler.XirConstant;
 import com.oracle.max.cri.xir.CiXirAssembler.XirInstruction;
 import com.oracle.max.cri.xir.CiXirAssembler.XirMark;
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/CanonicalizerPhase.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/CanonicalizerPhase.java	Thu Jun 07 18:55:34 2012 +0200
@@ -22,6 +22,7 @@
  */
 package com.oracle.graal.compiler.phases;
 
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.debug.*;
 import com.oracle.graal.graph.*;
@@ -30,8 +31,6 @@
 import com.oracle.graal.nodes.calc.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.util.*;
-import com.oracle.max.cri.ci.*;
-import com.oracle.max.cri.ri.*;
 
 public class CanonicalizerPhase extends Phase {
     private static final int MAX_ITERATION_PER_NODE = 10;
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/EscapeAnalysisPhase.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/EscapeAnalysisPhase.java	Thu Jun 07 18:55:34 2012 +0200
@@ -24,8 +24,8 @@
 
 import java.util.*;
 
-import com.oracle.max.cri.ci.*;
 import com.oracle.max.criutils.*;
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.compiler.*;
 import com.oracle.graal.compiler.graph.*;
 import com.oracle.graal.compiler.util.*;
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/InliningPhase.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/InliningPhase.java	Thu Jun 07 18:55:34 2012 +0200
@@ -26,6 +26,7 @@
 import java.util.*;
 import java.util.concurrent.*;
 
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.*;
 import com.oracle.graal.compiler.phases.PhasePlan.PhasePosition;
@@ -37,7 +38,6 @@
 import com.oracle.graal.debug.internal.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.*;
-import com.oracle.max.cri.ci.*;
 
 
 public class InliningPhase extends Phase implements InliningCallback {
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/LoweringPhase.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/LoweringPhase.java	Thu Jun 07 18:55:34 2012 +0200
@@ -22,6 +22,7 @@
  */
 package com.oracle.graal.compiler.phases;
 
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.*;
 import com.oracle.graal.cri.*;
@@ -31,7 +32,6 @@
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.calc.*;
 import com.oracle.graal.nodes.spi.*;
-import com.oracle.max.cri.ci.*;
 
 /**
  * Processes all {@link Lowerable} nodes to do their lowering.
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/SnippetIntrinsificationPhase.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/SnippetIntrinsificationPhase.java	Thu Jun 07 18:55:34 2012 +0200
@@ -25,6 +25,7 @@
 import java.lang.reflect.*;
 import java.util.*;
 
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.Node.ConstantNodeParameter;
@@ -34,8 +35,6 @@
 import com.oracle.graal.nodes.extended.*;
 import com.oracle.graal.nodes.java.*;
 import com.oracle.graal.nodes.util.*;
-import com.oracle.max.cri.ci.*;
-import com.oracle.max.cri.ri.*;
 
 public class SnippetIntrinsificationPhase extends Phase {
 
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/target/Backend.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/target/Backend.java	Thu Jun 07 18:55:34 2012 +0200
@@ -24,14 +24,13 @@
 
 import java.lang.reflect.*;
 
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.*;
 import com.oracle.graal.compiler.gen.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.asm.*;
-import com.oracle.max.cri.ci.*;
-import com.oracle.max.cri.ri.*;
 import com.oracle.max.cri.xir.*;
 
 /**
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/target/amd64/AMD64DeoptimizationStub.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/target/amd64/AMD64DeoptimizationStub.java	Thu Jun 07 18:55:34 2012 +0200
@@ -24,6 +24,7 @@
 
 import java.util.*;
 
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.*;
 import com.oracle.graal.lir.*;
@@ -31,7 +32,6 @@
 import com.oracle.graal.lir.asm.*;
 import com.oracle.max.asm.*;
 import com.oracle.max.asm.target.amd64.*;
-import com.oracle.max.cri.ci.*;
 
 public class AMD64DeoptimizationStub extends AMD64Code {
     public final Label label = new Label();
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/target/amd64/AMD64LIRGenerator.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/target/amd64/AMD64LIRGenerator.java	Thu Jun 07 18:55:34 2012 +0200
@@ -23,7 +23,7 @@
 
 package com.oracle.graal.compiler.target.amd64;
 
-import static com.oracle.max.cri.ci.CiValueUtil.*;
+import static com.oracle.graal.api.code.CiValueUtil.*;
 import static com.oracle.graal.lir.amd64.AMD64Arithmetic.*;
 import static com.oracle.graal.lir.amd64.AMD64Compare.*;
 
@@ -32,11 +32,10 @@
 import com.oracle.max.asm.*;
 import com.oracle.max.asm.target.amd64.*;
 import com.oracle.max.asm.target.amd64.AMD64Assembler.ConditionFlag;
-import com.oracle.max.cri.ci.*;
-import com.oracle.max.cri.ci.CiTargetMethod.Mark;
-import com.oracle.max.cri.ri.*;
 import com.oracle.max.cri.xir.CiXirAssembler.XirMark;
 import com.oracle.max.cri.xir.*;
+import com.oracle.graal.api.code.*;
+import com.oracle.graal.api.code.CiTargetMethod.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.gen.*;
 import com.oracle.graal.compiler.target.*;
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/target/amd64/AMD64XirAssembler.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/target/amd64/AMD64XirAssembler.java	Thu Jun 07 18:55:34 2012 +0200
@@ -26,9 +26,9 @@
 
 import java.util.*;
 
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.max.asm.target.amd64.*;
-import com.oracle.max.cri.ci.*;
 import com.oracle.max.cri.xir.*;
 
 /**
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/target/amd64/AMD64XirOp.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/target/amd64/AMD64XirOp.java	Thu Jun 07 18:55:34 2012 +0200
@@ -22,12 +22,14 @@
  */
 package com.oracle.graal.compiler.target.amd64;
 
+import static com.oracle.graal.api.code.CiCallingConvention.Type.*;
+import static com.oracle.graal.api.code.CiValueUtil.*;
 import static com.oracle.graal.api.meta.RiValue.*;
-import static com.oracle.max.cri.ci.CiCallingConvention.Type.*;
-import static com.oracle.max.cri.ci.CiValueUtil.*;
 
 import java.util.*;
 
+import com.oracle.graal.api.code.*;
+import com.oracle.graal.api.code.CiTargetMethod.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.lir.*;
@@ -36,8 +38,6 @@
 import com.oracle.max.asm.*;
 import com.oracle.max.asm.target.amd64.*;
 import com.oracle.max.asm.target.amd64.AMD64Assembler.ConditionFlag;
-import com.oracle.max.cri.ci.*;
-import com.oracle.max.cri.ci.CiTargetMethod.Mark;
 import com.oracle.max.cri.xir.*;
 import com.oracle.max.cri.xir.CiXirAssembler.RuntimeCallInformation;
 import com.oracle.max.cri.xir.CiXirAssembler.XirInstruction;
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/types/PropagateTypeCachePhase.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/types/PropagateTypeCachePhase.java	Thu Jun 07 18:55:34 2012 +0200
@@ -25,6 +25,7 @@
 import java.io.*;
 import java.util.*;
 
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.compiler.phases.*;
 import com.oracle.graal.compiler.schedule.*;
 import com.oracle.graal.debug.*;
@@ -35,8 +36,6 @@
 import com.oracle.graal.nodes.calc.*;
 import com.oracle.graal.nodes.spi.types.*;
 import com.oracle.graal.nodes.spi.types.TypeCanonicalizable.Result;
-import com.oracle.max.cri.ci.*;
-import com.oracle.max.cri.ri.*;
 
 public class PropagateTypeCachePhase extends Phase {
 
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/types/TypeFeedbackCache.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/types/TypeFeedbackCache.java	Thu Jun 07 18:55:34 2012 +0200
@@ -25,10 +25,10 @@
 import java.util.*;
 import java.util.Map.Entry;
 
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.types.*;
-import com.oracle.max.cri.ri.*;
 
 public class TypeFeedbackCache implements TypeFeedbackTool, Cloneable {
 
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/util/InliningUtil.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/util/InliningUtil.java	Thu Jun 07 18:55:34 2012 +0200
@@ -26,6 +26,7 @@
 import java.util.*;
 import java.util.concurrent.*;
 
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.api.meta.RiTypeProfile.*;
 import com.oracle.graal.compiler.*;
@@ -40,7 +41,6 @@
 import com.oracle.graal.nodes.java.MethodCallTargetNode.InvokeKind;
 import com.oracle.graal.nodes.type.*;
 import com.oracle.graal.nodes.util.*;
-import com.oracle.max.cri.ci.*;
 
 public class InliningUtil {
 
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/util/Util.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/util/Util.java	Thu Jun 07 18:55:34 2012 +0200
@@ -24,10 +24,10 @@
 
 import java.util.*;
 
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.calc.*;
-import com.oracle.max.cri.ci.*;
 import com.oracle.max.criutils.*;
 
 /**
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java	Thu Jun 07 18:55:34 2012 +0200
@@ -24,13 +24,13 @@
 
 import java.util.concurrent.*;
 
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.*;
 import com.oracle.graal.compiler.phases.*;
 import com.oracle.graal.debug.*;
 import com.oracle.graal.hotspot.ri.*;
 import com.oracle.graal.nodes.*;
-import com.oracle.max.cri.ci.*;
 import com.oracle.max.criutils.*;
 
 
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/Compiler.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/Compiler.java	Thu Jun 07 18:55:34 2012 +0200
@@ -22,11 +22,11 @@
  */
 package com.oracle.graal.hotspot;
 
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.*;
 import com.oracle.graal.hotspot.bridge.*;
 import com.oracle.graal.hotspot.ri.*;
-import com.oracle.max.cri.ci.*;
 
 public interface Compiler {
 
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilerImpl.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilerImpl.java	Thu Jun 07 18:55:34 2012 +0200
@@ -26,6 +26,7 @@
 import java.lang.reflect.*;
 import java.net.*;
 
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.*;
 import com.oracle.graal.compiler.target.*;
@@ -35,7 +36,6 @@
 import com.oracle.graal.hotspot.ri.*;
 import com.oracle.graal.hotspot.server.*;
 import com.oracle.max.asm.target.amd64.*;
-import com.oracle.max.cri.ci.*;
 import com.oracle.max.cri.xir.*;
 
 /**
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotDebugConfig.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotDebugConfig.java	Thu Jun 07 18:55:34 2012 +0200
@@ -25,12 +25,12 @@
 import java.io.*;
 import java.util.*;
 
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.*;
 import com.oracle.graal.debug.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.printer.*;
-import com.oracle.max.cri.ci.*;
 import com.oracle.max.criutils.*;
 
 public class HotSpotDebugConfig implements DebugConfig {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotTargetMethod.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotTargetMethod.java	Thu Jun 07 18:55:34 2012 +0200
@@ -24,8 +24,8 @@
 
 import java.util.*;
 
-import com.oracle.max.cri.ci.*;
-import com.oracle.max.cri.ci.CiTargetMethod.*;
+import com.oracle.graal.api.code.*;
+import com.oracle.graal.api.code.CiTargetMethod.*;
 import com.oracle.graal.hotspot.logging.*;
 import com.oracle.graal.hotspot.ri.*;
 
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVM.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVM.java	Thu Jun 07 18:55:34 2012 +0200
@@ -25,7 +25,7 @@
 
 import java.lang.reflect.*;
 
-import com.oracle.max.cri.ci.*;
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.hotspot.*;
 import com.oracle.graal.hotspot.ri.*;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVMImpl.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVMImpl.java	Thu Jun 07 18:55:34 2012 +0200
@@ -25,7 +25,7 @@
 
 import java.lang.reflect.*;
 
-import com.oracle.max.cri.ci.*;
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.hotspot.*;
 import com.oracle.graal.hotspot.ri.*;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java	Thu Jun 07 18:55:34 2012 +0200
@@ -29,6 +29,7 @@
 import java.util.concurrent.*;
 import java.util.concurrent.atomic.*;
 
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.*;
 import com.oracle.graal.compiler.phases.*;
@@ -43,7 +44,6 @@
 import com.oracle.graal.hotspot.snippets.*;
 import com.oracle.graal.java.*;
 import com.oracle.graal.snippets.*;
-import com.oracle.max.cri.ci.*;
 import com.oracle.max.criutils.*;
 
 /**
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/counters/MethodEntryCounters.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/counters/MethodEntryCounters.java	Thu Jun 07 18:55:34 2012 +0200
@@ -22,12 +22,13 @@
  */
 package com.oracle.graal.hotspot.counters;
 
-import static com.oracle.max.cri.ci.CiValueUtil.*;
+import static com.oracle.graal.api.code.CiValueUtil.*;
 
 import java.util.*;
 
 import sun.misc.*;
 
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.*;
 import com.oracle.graal.compiler.gen.*;
@@ -39,7 +40,6 @@
 import com.oracle.max.asm.*;
 import com.oracle.max.asm.target.amd64.*;
 import com.oracle.max.asm.target.amd64.AMD64Assembler.ConditionFlag;
-import com.oracle.max.cri.ci.*;
 import com.oracle.max.criutils.*;
 
 
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/CurrentThread.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/CurrentThread.java	Thu Jun 07 18:55:34 2012 +0200
@@ -23,8 +23,7 @@
 package com.oracle.graal.hotspot.nodes;
 
 import com.oracle.max.asm.target.amd64.*;
-import com.oracle.max.cri.ci.*;
-import com.oracle.max.cri.ri.*;
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.nodes.calc.*;
 import com.oracle.graal.nodes.spi.*;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/TailcallNode.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/TailcallNode.java	Thu Jun 07 18:55:34 2012 +0200
@@ -25,7 +25,7 @@
 import java.lang.reflect.*;
 import java.util.*;
 
-import com.oracle.max.cri.ci.*;
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.gen.*;
 import com.oracle.graal.hotspot.*;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/WriteBarrier.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/WriteBarrier.java	Thu Jun 07 18:55:34 2012 +0200
@@ -22,7 +22,7 @@
  */
 package com.oracle.graal.hotspot.nodes;
 
-import com.oracle.max.cri.ci.*;
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.hotspot.*;
 import com.oracle.graal.nodes.*;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotCodeInfo.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotCodeInfo.java	Thu Jun 07 18:55:34 2012 +0200
@@ -22,10 +22,10 @@
  */
 package com.oracle.graal.hotspot.ri;
 
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.hotspot.*;
 import com.oracle.graal.hotspot.Compiler;
-import com.oracle.max.cri.ci.*;
 
 /**
  * Implementation of {@link RiCodeInfo} for HotSpot.
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotCompiledMethod.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotCompiledMethod.java	Thu Jun 07 18:55:34 2012 +0200
@@ -24,7 +24,7 @@
 
 import java.lang.reflect.*;
 
-import com.oracle.max.cri.ci.*;
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.hotspot.*;
 import com.oracle.graal.hotspot.Compiler;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotField.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotField.java	Thu Jun 07 18:55:34 2012 +0200
@@ -26,7 +26,7 @@
 import java.lang.annotation.*;
 import java.lang.reflect.*;
 
-import com.oracle.max.cri.ci.*;
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.api.meta.RiType.*;
 import com.oracle.graal.compiler.*;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotMethodResolvedImpl.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotMethodResolvedImpl.java	Thu Jun 07 18:55:34 2012 +0200
@@ -28,12 +28,12 @@
 import java.util.*;
 import java.util.concurrent.*;
 
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.*;
 import com.oracle.graal.hotspot.*;
 import com.oracle.graal.hotspot.counters.*;
 import com.oracle.graal.java.bytecode.*;
-import com.oracle.max.cri.ci.*;
 import com.oracle.max.criutils.*;
 
 /**
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotProfilingInfo.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotProfilingInfo.java	Thu Jun 07 18:55:34 2012 +0200
@@ -22,7 +22,7 @@
  */
 package com.oracle.graal.hotspot.ri;
 
-import com.oracle.max.cri.ci.*;
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.debug.*;
 import com.oracle.graal.hotspot.*;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotRegisterConfig.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotRegisterConfig.java	Thu Jun 07 18:55:34 2012 +0200
@@ -27,9 +27,9 @@
 import java.util.*;
 
 import com.oracle.max.asm.target.amd64.*;
-import com.oracle.max.cri.ci.*;
-import com.oracle.max.cri.ci.CiCallingConvention.Type;
-import com.oracle.max.cri.ci.CiRegister.RegisterFlag;
+import com.oracle.graal.api.code.*;
+import com.oracle.graal.api.code.CiCallingConvention.*;
+import com.oracle.graal.api.code.CiRegister.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.hotspot.*;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotRuntime.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotRuntime.java	Thu Jun 07 18:55:34 2012 +0200
@@ -27,6 +27,9 @@
 import java.lang.reflect.*;
 import java.util.*;
 
+import com.oracle.graal.api.code.*;
+import com.oracle.graal.api.code.CiTargetMethod.*;
+import com.oracle.graal.api.code.CiUtil.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.api.meta.RiType.*;
 import com.oracle.graal.compiler.*;
@@ -44,12 +47,6 @@
 import com.oracle.graal.nodes.java.*;
 import com.oracle.graal.nodes.type.*;
 import com.oracle.graal.snippets.*;
-import com.oracle.max.cri.ci.*;
-import com.oracle.max.cri.ci.CiTargetMethod.Call;
-import com.oracle.max.cri.ci.CiTargetMethod.DataPatch;
-import com.oracle.max.cri.ci.CiTargetMethod.Mark;
-import com.oracle.max.cri.ci.CiTargetMethod.Safepoint;
-import com.oracle.max.cri.ci.CiUtil.RefMapFormatter;
 import com.oracle.max.criutils.*;
 
 /**
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotXirGenerator.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/ri/HotSpotXirGenerator.java	Thu Jun 07 18:55:34 2012 +0200
@@ -22,8 +22,8 @@
  */
 package com.oracle.graal.hotspot.ri;
 
+import static com.oracle.graal.api.code.CiValueUtil.*;
 import static com.oracle.graal.hotspot.ri.TemplateFlag.*;
-import static com.oracle.max.cri.ci.CiValueUtil.*;
 
 import java.io.*;
 import java.util.*;
@@ -31,14 +31,14 @@
 
 import sun.misc.*;
 
+import com.oracle.graal.api.code.*;
+import com.oracle.graal.api.code.CiAddress.*;
+import com.oracle.graal.api.code.CiRegister.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.*;
 import com.oracle.graal.hotspot.*;
 import com.oracle.graal.hotspot.Compiler;
 import com.oracle.max.asm.target.amd64.*;
-import com.oracle.max.cri.ci.CiAddress.Scale;
-import com.oracle.max.cri.ci.*;
-import com.oracle.max.cri.ci.CiRegister.RegisterFlag;
 import com.oracle.max.cri.xir.*;
 import com.oracle.max.cri.xir.CiXirAssembler.XirConstant;
 import com.oracle.max.cri.xir.CiXirAssembler.XirLabel;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/ArrayCopySnippets.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/ArrayCopySnippets.java	Thu Jun 07 18:55:34 2012 +0200
@@ -29,8 +29,6 @@
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.type.*;
 import com.oracle.graal.snippets.*;
-import com.oracle.max.cri.ci.*;
-import com.oracle.max.cri.ri.*;
 
 
 @SuppressWarnings("unused")
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/CheckCastSnippets.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/CheckCastSnippets.java	Thu Jun 07 18:55:34 2012 +0200
@@ -31,6 +31,7 @@
 
 import sun.misc.*;
 
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.*;
 import com.oracle.graal.compiler.phases.*;
@@ -50,8 +51,6 @@
 import com.oracle.graal.snippets.SnippetTemplate.Cache;
 import com.oracle.graal.snippets.SnippetTemplate.Key;
 import com.oracle.graal.snippets.nodes.*;
-import com.oracle.max.cri.ci.*;
-import com.oracle.max.cri.ri.*;
 import com.oracle.max.criutils.*;
 
 /**
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/DirectStoreNode.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/DirectStoreNode.java	Thu Jun 07 18:55:34 2012 +0200
@@ -22,12 +22,12 @@
  */
 package com.oracle.graal.hotspot.snippets;
 
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.extended.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.type.*;
-import com.oracle.max.cri.ci.*;
 
 /**
  * A special purpose store node that differs from {@link UnsafeStoreNode} in that
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/IntrinsifyArrayCopyPhase.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/IntrinsifyArrayCopyPhase.java	Thu Jun 07 18:55:34 2012 +0200
@@ -24,7 +24,7 @@
 
 import java.lang.reflect.*;
 
-import com.oracle.max.cri.ri.*;
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.*;
 import com.oracle.graal.compiler.phases.*;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/SystemSnippets.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/SystemSnippets.java	Thu Jun 07 18:55:34 2012 +0200
@@ -22,7 +22,7 @@
  */
 package com.oracle.graal.hotspot.snippets;
 
-import com.oracle.max.cri.ci.*;
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.nodes.extended.*;
 import com.oracle.graal.snippets.*;
 
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/target/amd64/AMD64SafepointOp.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/target/amd64/AMD64SafepointOp.java	Thu Jun 07 18:55:34 2012 +0200
@@ -27,13 +27,13 @@
 
 import java.util.*;
 
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.hotspot.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.amd64.*;
 import com.oracle.graal.lir.asm.*;
 import com.oracle.max.asm.target.amd64.*;
-import com.oracle.max.cri.ci.*;
 
 /**
  * Emits a safepoint poll.
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/target/amd64/AMD64TailcallOp.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/target/amd64/AMD64TailcallOp.java	Thu Jun 07 18:55:34 2012 +0200
@@ -22,7 +22,7 @@
  */
 package com.oracle.graal.hotspot.target.amd64;
 
-import static com.oracle.max.cri.ci.CiValueUtil.*;
+import static com.oracle.graal.api.code.CiValueUtil.*;
 
 import java.util.*;
 
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/target/amd64/HotSpotAMD64Backend.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/target/amd64/HotSpotAMD64Backend.java	Thu Jun 07 18:55:34 2012 +0200
@@ -22,13 +22,14 @@
  */
 package com.oracle.graal.hotspot.target.amd64;
 
+import static com.oracle.graal.api.code.CiCallingConvention.Type.*;
+import static com.oracle.graal.api.code.CiValueUtil.*;
 import static com.oracle.graal.hotspot.ri.HotSpotXirGenerator.*;
 import static com.oracle.max.asm.target.amd64.AMD64.*;
-import static com.oracle.max.cri.ci.CiCallingConvention.Type.*;
-import static com.oracle.max.cri.ci.CiValueUtil.*;
 
 import java.lang.reflect.*;
 
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.*;
 import com.oracle.graal.compiler.gen.*;
@@ -46,8 +47,6 @@
 import com.oracle.max.asm.*;
 import com.oracle.max.asm.target.amd64.AMD64Assembler.ConditionFlag;
 import com.oracle.max.asm.target.amd64.*;
-import com.oracle.max.cri.ci.*;
-import com.oracle.max.cri.ri.*;
 import com.oracle.max.cri.xir.*;
 
 public class HotSpotAMD64Backend extends Backend {
--- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/BciBlockMapping.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/BciBlockMapping.java	Thu Jun 07 18:55:34 2012 +0200
@@ -26,13 +26,13 @@
 
 import java.util.*;
 
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.*;
 import com.oracle.graal.debug.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.java.bytecode.*;
 import com.oracle.graal.nodes.*;
-import com.oracle.max.cri.ci.*;
 
 /**
  * Builds a mapping between bytecodes and basic blocks and builds a conservative control flow graph (CFG).
--- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java	Thu Jun 07 18:55:34 2012 +0200
@@ -28,6 +28,7 @@
 import java.lang.reflect.*;
 import java.util.*;
 
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.api.meta.RiType.*;
 import com.oracle.graal.api.meta.RiTypeProfile.*;
@@ -46,8 +47,6 @@
 import com.oracle.graal.nodes.java.MethodCallTargetNode.InvokeKind;
 import com.oracle.graal.nodes.type.*;
 import com.oracle.graal.nodes.util.*;
-import com.oracle.max.cri.ci.*;
-import com.oracle.max.cri.ri.*;
 import com.oracle.max.criutils.*;
 
 /**
--- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/JsrNotSupportedBailout.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/JsrNotSupportedBailout.java	Thu Jun 07 18:55:34 2012 +0200
@@ -22,7 +22,7 @@
  */
 package com.oracle.graal.java;
 
-import com.oracle.max.cri.ci.*;
+import com.oracle.graal.api.code.*;
 
 
 public class JsrNotSupportedBailout extends CiBailout{
--- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Arithmetic.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Arithmetic.java	Thu Jun 07 18:55:34 2012 +0200
@@ -22,7 +22,7 @@
  */
 package com.oracle.graal.lir.amd64;
 
-import static com.oracle.max.cri.ci.CiValueUtil.*;
+import static com.oracle.graal.api.code.CiValueUtil.*;
 
 import java.util.*;
 
--- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Call.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Call.java	Thu Jun 07 18:55:34 2012 +0200
@@ -22,14 +22,14 @@
  */
 package com.oracle.graal.lir.amd64;
 
-import static com.oracle.max.cri.ci.CiValueUtil.*;
+import static com.oracle.graal.api.code.CiValueUtil.*;
 
 import java.util.*;
 
 import com.oracle.max.asm.target.amd64.*;
-import com.oracle.max.cri.ci.*;
-import com.oracle.max.cri.ci.CiTargetMethod.Mark;
 import com.oracle.max.cri.xir.CiXirAssembler.XirMark;
+import com.oracle.graal.api.code.*;
+import com.oracle.graal.api.code.CiTargetMethod.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.lir.*;
--- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Compare.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Compare.java	Thu Jun 07 18:55:34 2012 +0200
@@ -22,7 +22,7 @@
  */
 package com.oracle.graal.lir.amd64;
 
-import static com.oracle.max.cri.ci.CiValueUtil.*;
+import static com.oracle.graal.api.code.CiValueUtil.*;
 
 import java.util.*;
 
--- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64ControlFlow.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64ControlFlow.java	Thu Jun 07 18:55:34 2012 +0200
@@ -22,16 +22,16 @@
  */
 package com.oracle.graal.lir.amd64;
 
-import static com.oracle.max.cri.ci.CiValueUtil.*;
+import static com.oracle.graal.api.code.CiValueUtil.*;
 
 import java.util.*;
 
 import com.oracle.max.asm.*;
 import com.oracle.max.asm.target.amd64.*;
 import com.oracle.max.asm.target.amd64.AMD64Assembler.ConditionFlag;
-import com.oracle.max.cri.ci.*;
-import com.oracle.max.cri.ci.CiAddress.Scale;
-import com.oracle.max.cri.ci.CiTargetMethod.JumpTable;
+import com.oracle.graal.api.code.*;
+import com.oracle.graal.api.code.CiAddress.*;
+import com.oracle.graal.api.code.CiTargetMethod.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.lir.*;
--- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Move.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Move.java	Thu Jun 07 18:55:34 2012 +0200
@@ -22,7 +22,7 @@
  */
 package com.oracle.graal.lir.amd64;
 
-import static com.oracle.max.cri.ci.CiValueUtil.*;
+import static com.oracle.graal.api.code.CiValueUtil.*;
 import static java.lang.Double.*;
 import static java.lang.Float.*;
 
@@ -30,7 +30,7 @@
 
 import com.oracle.max.asm.*;
 import com.oracle.max.asm.target.amd64.*;
-import com.oracle.max.cri.ci.*;
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.lir.*;
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/FrameMap.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/FrameMap.java	Thu Jun 07 18:55:34 2012 +0200
@@ -22,15 +22,14 @@
  */
 package com.oracle.graal.lir;
 
-import static com.oracle.max.cri.ci.CiValueUtil.*;
+import static com.oracle.graal.api.code.CiValueUtil.*;
 
 import java.util.*;
 
+import com.oracle.graal.api.code.*;
+import com.oracle.graal.api.code.CiCallingConvention.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.max.asm.*;
-import com.oracle.max.cri.ci.*;
-import com.oracle.max.cri.ci.CiCallingConvention.Type;
-import com.oracle.max.cri.ri.*;
 
 /**
  * This class is used to build the stack frame layout for a compiled method.
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRDebugInfo.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRDebugInfo.java	Thu Jun 07 18:55:34 2012 +0200
@@ -22,11 +22,11 @@
  */
 package com.oracle.graal.lir;
 
-import static com.oracle.max.cri.ci.CiValueUtil.*;
+import static com.oracle.graal.api.code.CiValueUtil.*;
 
 import java.util.*;
 
-import com.oracle.max.cri.ci.*;
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.lir.LIRInstruction.OperandFlag;
 import com.oracle.graal.lir.LIRInstruction.OperandMode;
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRInstruction.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRInstruction.java	Thu Jun 07 18:55:34 2012 +0200
@@ -22,11 +22,11 @@
  */
 package com.oracle.graal.lir;
 
-import static com.oracle.max.cri.ci.CiValueUtil.*;
+import static com.oracle.graal.api.code.CiValueUtil.*;
 
 import java.util.*;
 
-import com.oracle.max.cri.ci.*;
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.lir.asm.*;
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRVerifier.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRVerifier.java	Thu Jun 07 18:55:34 2012 +0200
@@ -22,13 +22,13 @@
  */
 package com.oracle.graal.lir;
 
-import static com.oracle.max.cri.ci.CiValueUtil.*;
+import static com.oracle.graal.api.code.CiValueUtil.*;
 import static com.oracle.graal.lir.ValueUtil.*;
 
 import java.util.*;
 
-import com.oracle.max.cri.ci.*;
 import com.oracle.max.criutils.*;
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.lir.LIRInstruction.*;
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRXirInstruction.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRXirInstruction.java	Thu Jun 07 18:55:34 2012 +0200
@@ -22,7 +22,7 @@
  */
 package com.oracle.graal.lir;
 
-import static com.oracle.max.cri.ci.CiValueUtil.*;
+import static com.oracle.graal.api.code.CiValueUtil.*;
 
 import java.util.*;
 
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/ValueUtil.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/ValueUtil.java	Thu Jun 07 18:55:34 2012 +0200
@@ -22,8 +22,8 @@
  */
 package com.oracle.graal.lir;
 
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
-import com.oracle.max.cri.ci.*;
 
 public class ValueUtil extends CiValueUtil {
 
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/Variable.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/Variable.java	Thu Jun 07 18:55:34 2012 +0200
@@ -22,8 +22,8 @@
  */
 package com.oracle.graal.lir;
 
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
-import com.oracle.max.cri.ci.*;
 
 /**
  * Represents a value that is yet to be bound to a machine location (such as
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/asm/TargetMethodAssembler.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/asm/TargetMethodAssembler.java	Thu Jun 07 18:55:34 2012 +0200
@@ -22,18 +22,17 @@
  */
 package com.oracle.graal.lir.asm;
 
-import static com.oracle.max.cri.ci.CiValueUtil.*;
+import static com.oracle.graal.api.code.CiValueUtil.*;
 
 import java.util.*;
 
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.debug.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.LIR.Code;
 import com.oracle.max.asm.*;
-import com.oracle.max.cri.ci.*;
-import com.oracle.max.cri.ri.*;
 
 public class TargetMethodAssembler {
 
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/cri/CiLoweringTool.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/cri/CiLoweringTool.java	Thu Jun 07 18:55:34 2012 +0200
@@ -22,9 +22,9 @@
  */
 package com.oracle.graal.cri;
 
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.nodes.*;
-import com.oracle.max.cri.ci.*;
 
 public interface CiLoweringTool {
     ExtendedRiRuntime getRuntime();
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/cri/ExtendedRiRuntime.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/cri/ExtendedRiRuntime.java	Thu Jun 07 18:55:34 2012 +0200
@@ -24,11 +24,10 @@
 
 import java.util.*;
 
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.*;
-import com.oracle.max.cri.ci.*;
-import com.oracle.max.cri.ri.*;
 
 /**
  * Graal-specific extensions for the runtime interface that must be implemented by the VM.
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ConstantNode.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ConstantNode.java	Thu Jun 07 18:55:34 2012 +0200
@@ -22,7 +22,7 @@
  */
 package com.oracle.graal.nodes;
 
-import com.oracle.max.cri.ri.*;
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.iterators.*;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/DeoptimizeNode.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/DeoptimizeNode.java	Thu Jun 07 18:55:34 2012 +0200
@@ -22,11 +22,11 @@
  */
 package com.oracle.graal.nodes;
 
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.type.*;
-import com.oracle.max.cri.ci.*;
 
 @NodeInfo(shortName = "Deopt")
 public class DeoptimizeNode extends FixedNode implements Node.IterableNodeType, LIRLowerable {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FixedGuardNode.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FixedGuardNode.java	Thu Jun 07 18:55:34 2012 +0200
@@ -22,12 +22,12 @@
  */
 package com.oracle.graal.nodes;
 
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.cri.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.type.*;
-import com.oracle.max.cri.ci.*;
 
 public final class FixedGuardNode extends FixedWithNextNode implements Simplifiable, Lowerable, LIRLowerable, Node.IterableNodeType, Negatable {
 
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FrameState.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FrameState.java	Thu Jun 07 18:55:34 2012 +0200
@@ -24,7 +24,7 @@
 
 import java.util.*;
 
-import com.oracle.max.cri.ci.*;
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.iterators.*;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardNode.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardNode.java	Thu Jun 07 18:55:34 2012 +0200
@@ -22,13 +22,13 @@
  */
 package com.oracle.graal.nodes;
 
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.calc.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.spi.types.*;
 import com.oracle.graal.nodes.type.*;
-import com.oracle.max.cri.ci.*;
 
 /**
  * A guard is a node that deoptimizes based on a conditional expression. Guards are not attached to a certain frame
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/InvokeNode.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/InvokeNode.java	Thu Jun 07 18:55:34 2012 +0200
@@ -24,7 +24,7 @@
 
 import java.util.*;
 
-import com.oracle.max.cri.ci.*;
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.extended.*;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/InvokeWithExceptionNode.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/InvokeWithExceptionNode.java	Thu Jun 07 18:55:34 2012 +0200
@@ -24,7 +24,7 @@
 
 import java.util.*;
 
-import com.oracle.max.cri.ci.*;
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.extended.*;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/UnwindNode.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/UnwindNode.java	Thu Jun 07 18:55:34 2012 +0200
@@ -22,7 +22,7 @@
  */
 package com.oracle.graal.nodes;
 
-import com.oracle.max.cri.ci.*;
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.spi.*;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/CompareNode.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/CompareNode.java	Thu Jun 07 18:55:34 2012 +0200
@@ -22,12 +22,12 @@
  */
 package com.oracle.graal.nodes.calc;
 
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.type.*;
-import com.oracle.max.cri.ri.*;
 
 /* TODO (thomaswue/gdub) For high-level optimization purpose the compare node should be a boolean *value* (it is currently only a helper node)
  * But in the back-end the comparison should not always be materialized (for example in x86 the comparison result will not be in a register but in a flag)
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/Condition.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/Condition.java	Thu Jun 07 18:55:34 2012 +0200
@@ -22,9 +22,9 @@
  */
 package com.oracle.graal.nodes.calc;
 
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.graph.*;
-import com.oracle.max.cri.ri.*;
 import com.oracle.max.cri.util.*;
 
 /**
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerMulNode.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerMulNode.java	Thu Jun 07 18:55:34 2012 +0200
@@ -22,7 +22,7 @@
  */
 package com.oracle.graal.nodes.calc;
 
-import com.oracle.max.cri.ci.*;
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.*;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/BoxingMethodPool.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/BoxingMethodPool.java	Thu Jun 07 18:55:34 2012 +0200
@@ -24,8 +24,8 @@
 
 import java.util.*;
 
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
-import com.oracle.max.cri.ri.*;
 
 public class BoxingMethodPool {
 
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/FloatingReadNode.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/FloatingReadNode.java	Thu Jun 07 18:55:34 2012 +0200
@@ -24,12 +24,12 @@
 
 import java.util.*;
 
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.type.*;
-import com.oracle.max.cri.ri.*;
 
 /**
  * A floating read of a value from memory specified in terms of an object base and an object relative location.
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ReadHubNode.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ReadHubNode.java	Thu Jun 07 18:55:34 2012 +0200
@@ -22,13 +22,13 @@
  */
 package com.oracle.graal.nodes.extended;
 
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.api.meta.RiType.*;
 import com.oracle.graal.cri.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.type.*;
-import com.oracle.max.cri.ri.*;
 
 // TODO (chaeubl) this should be a FloatingNode but Lowering is not possible in that case
 public final class ReadHubNode extends FixedWithNextNode implements Lowerable, Canonicalizable {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ReadNode.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ReadNode.java	Thu Jun 07 18:55:34 2012 +0200
@@ -22,7 +22,7 @@
  */
 package com.oracle.graal.nodes.extended;
 
-import com.oracle.max.cri.ri.*;
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.*;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/RuntimeCallNode.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/RuntimeCallNode.java	Thu Jun 07 18:55:34 2012 +0200
@@ -22,7 +22,7 @@
  */
 package com.oracle.graal.nodes.extended;
 
-import com.oracle.max.cri.ci.*;
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.type.*;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AccessFieldNode.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AccessFieldNode.java	Thu Jun 07 18:55:34 2012 +0200
@@ -25,12 +25,12 @@
 import java.lang.reflect.*;
 import java.util.*;
 
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.cri.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.type.*;
-import com.oracle.max.cri.ci.*;
 
 /**
  * The base class of all instructions that access fields.
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AccessMonitorNode.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AccessMonitorNode.java	Thu Jun 07 18:55:34 2012 +0200
@@ -22,7 +22,6 @@
  */
 package com.oracle.graal.nodes.java;
 
-import com.oracle.max.cri.ci.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.extended.*;
 import com.oracle.graal.nodes.type.*;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/ArrayLengthNode.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/ArrayLengthNode.java	Thu Jun 07 18:55:34 2012 +0200
@@ -22,7 +22,7 @@
  */
 package com.oracle.graal.nodes.java;
 
-import com.oracle.max.cri.ri.*;
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.cri.*;
 import com.oracle.graal.nodes.*;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/ExceptionObjectNode.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/ExceptionObjectNode.java	Thu Jun 07 18:55:34 2012 +0200
@@ -22,11 +22,11 @@
  */
 package com.oracle.graal.nodes.java;
 
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.extended.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.type.*;
-import com.oracle.max.cri.ri.*;
 
 /**
  * The {@code ExceptionObject} instruction represents the incoming exception object to an exception handler.
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoadFieldNode.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoadFieldNode.java	Thu Jun 07 18:55:34 2012 +0200
@@ -22,7 +22,7 @@
  */
 package com.oracle.graal.nodes.java;
 
-import com.oracle.max.cri.ri.*;
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.*;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoadIndexedNode.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoadIndexedNode.java	Thu Jun 07 18:55:34 2012 +0200
@@ -24,13 +24,13 @@
 
 import java.lang.reflect.*;
 
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.cri.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.type.*;
-import com.oracle.max.cri.ri.*;
 
 /**
  * The {@code LoadIndexedNode} represents a read from an element of an array.
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/RegisterFinalizerNode.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/RegisterFinalizerNode.java	Thu Jun 07 18:55:34 2012 +0200
@@ -22,10 +22,10 @@
  */
 package com.oracle.graal.nodes.java;
 
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.type.*;
-import com.oracle.max.cri.ci.*;
 
 /**
  * This node is used to perform the finalizer registration at the end of the java.lang.Object constructor.
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/CanonicalizerTool.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/CanonicalizerTool.java	Thu Jun 07 18:55:34 2012 +0200
@@ -22,9 +22,8 @@
  */
 package com.oracle.graal.nodes.spi;
 
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
-import com.oracle.max.cri.ci.*;
-import com.oracle.max.cri.ri.*;
 
 
 public interface CanonicalizerTool {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/LIRGeneratorTool.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/LIRGeneratorTool.java	Thu Jun 07 18:55:34 2012 +0200
@@ -22,12 +22,12 @@
  */
 package com.oracle.graal.nodes.spi;
 
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.calc.*;
 import com.oracle.graal.nodes.extended.*;
 import com.oracle.graal.nodes.java.*;
-import com.oracle.max.cri.ci.*;
 
 public abstract class LIRGeneratorTool {
     public abstract CiTarget target();
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/types/TypeFeedbackTool.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/types/TypeFeedbackTool.java	Thu Jun 07 18:55:34 2012 +0200
@@ -22,7 +22,7 @@
  */
 package com.oracle.graal.nodes.spi.types;
 
-import com.oracle.max.cri.ri.*;
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.nodes.*;
 
 public interface TypeFeedbackTool {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/StampFactory.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/StampFactory.java	Thu Jun 07 18:55:34 2012 +0200
@@ -24,10 +24,10 @@
 
 import java.util.*;
 
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.type.GenericStamp.GenericStampType;
-import com.oracle.max.cri.ri.*;
 
 
 public class StampFactory {
--- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CFGPrinter.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CFGPrinter.java	Thu Jun 07 18:55:34 2012 +0200
@@ -22,14 +22,14 @@
  */
 package com.oracle.graal.printer;
 
-import static com.oracle.max.cri.ci.CiValueUtil.*;
+import static com.oracle.graal.api.code.CiValueUtil.*;
 
 import java.io.*;
 import java.util.*;
 
-import com.oracle.max.cri.ci.*;
 import com.oracle.max.criutils.*;
 import com.oracle.graal.alloc.util.*;
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.alloc.*;
 import com.oracle.graal.compiler.alloc.Interval.UsePosList;
--- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CFGPrinterObserver.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CFGPrinterObserver.java	Thu Jun 07 18:55:34 2012 +0200
@@ -25,10 +25,9 @@
 import java.io.*;
 import java.util.*;
 
-import com.oracle.max.cri.ci.*;
-import com.oracle.max.cri.ri.*;
 import com.oracle.max.criutils.*;
 import com.oracle.graal.alloc.util.*;
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.*;
 import com.oracle.graal.compiler.alloc.*;
--- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/IdealGraphPrinterDumpHandler.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/IdealGraphPrinterDumpHandler.java	Thu Jun 07 18:55:34 2012 +0200
@@ -26,8 +26,8 @@
 import java.net.*;
 import java.util.*;
 
-import com.oracle.max.cri.ci.*;
 import com.oracle.max.criutils.*;
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.debug.*;
 import com.oracle.graal.graph.*;
--- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/GraalIntrinsics.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/GraalIntrinsics.java	Thu Jun 07 18:55:34 2012 +0200
@@ -22,9 +22,9 @@
  */
 package com.oracle.graal.snippets;
 
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.compiler.*;
 import com.oracle.graal.cri.*;
-import com.oracle.max.cri.ci.*;
 
 /**
  * Definition of the snippets that are VM-independent and can be intrinsified by Graal in any VM.
--- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/MathSnippetsX86.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/MathSnippetsX86.java	Thu Jun 07 18:55:34 2012 +0200
@@ -22,7 +22,7 @@
  */
 package com.oracle.graal.snippets;
 
-import com.oracle.max.cri.ci.*;
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.nodes.extended.*;
 import com.oracle.graal.snippets.nodes.*;
 import com.oracle.graal.snippets.nodes.MathIntrinsicNode.Operation;
--- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/NodeClassSnippets.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/NodeClassSnippets.java	Thu Jun 07 18:55:34 2012 +0200
@@ -22,8 +22,6 @@
  */
 package com.oracle.graal.snippets;
 
-import com.oracle.max.cri.ci.*;
-import com.oracle.max.cri.ri.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.extended.*;
--- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/SnippetTemplate.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/SnippetTemplate.java	Thu Jun 07 18:55:34 2012 +0200
@@ -27,6 +27,7 @@
 import java.util.Map.Entry;
 import java.util.concurrent.*;
 
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.loop.*;
 import com.oracle.graal.compiler.phases.*;
@@ -41,8 +42,6 @@
 import com.oracle.graal.snippets.Snippet.Multiple;
 import com.oracle.graal.snippets.Snippet.Parameter;
 import com.oracle.graal.snippets.nodes.*;
-import com.oracle.max.cri.ci.*;
-import com.oracle.max.cri.ri.*;
 
 /**
  * A snippet template is a graph created by parsing a snippet method and then
--- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/Snippets.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/Snippets.java	Thu Jun 07 18:55:34 2012 +0200
@@ -25,6 +25,7 @@
 import java.lang.reflect.*;
 import java.util.concurrent.*;
 
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.*;
 import com.oracle.graal.compiler.phases.*;
@@ -36,7 +37,6 @@
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.extended.*;
 import com.oracle.graal.nodes.java.*;
-import com.oracle.max.cri.ci.*;
 
 /**
  * Utilities for snippet installation and management.
--- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/target/amd64/AMD64MathIntrinsicOp.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/target/amd64/AMD64MathIntrinsicOp.java	Thu Jun 07 18:55:34 2012 +0200
@@ -22,7 +22,7 @@
  */
 package com.oracle.graal.snippets.target.amd64;
 
-import static com.oracle.max.cri.ci.CiValueUtil.*;
+import static com.oracle.graal.api.code.CiValueUtil.*;
 
 import java.util.*;
 
--- a/graal/com.oracle.graal.tests/src/com/oracle/graal/compiler/tests/GraphTest.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.graal.tests/src/com/oracle/graal/compiler/tests/GraphTest.java	Thu Jun 07 18:55:34 2012 +0200
@@ -27,6 +27,7 @@
 
 import junit.framework.*;
 
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.*;
 import com.oracle.graal.compiler.phases.*;
@@ -39,7 +40,6 @@
 import com.oracle.graal.java.*;
 import com.oracle.graal.lir.cfg.*;
 import com.oracle.graal.nodes.*;
-import com.oracle.max.cri.ci.*;
 
 /**
  * Base class for Graal compiler unit tests. These are white box tests
--- a/graal/com.oracle.max.asm/src/com/oracle/max/asm/AbstractAssembler.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.max.asm/src/com/oracle/max/asm/AbstractAssembler.java	Thu Jun 07 18:55:34 2012 +0200
@@ -22,8 +22,8 @@
  */
 package com.oracle.max.asm;
 
-import com.oracle.max.cri.ci.*;
-import com.oracle.max.cri.ci.CiArchitecture.*;
+import com.oracle.graal.api.code.*;
+import com.oracle.graal.api.code.CiArchitecture.*;
 
 /**
  * The platform-independent base class for the assembler.
--- a/graal/com.oracle.max.asm/src/com/oracle/max/asm/target/amd64/AMD64.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.max.asm/src/com/oracle/max/asm/target/amd64/AMD64.java	Thu Jun 07 18:55:34 2012 +0200
@@ -22,12 +22,12 @@
  */
 package com.oracle.max.asm.target.amd64;
 
+import static com.oracle.graal.api.code.CiRegister.RegisterFlag.*;
 import static com.oracle.graal.api.meta.RiKind.*;
-import static com.oracle.max.cri.ci.CiRegister.RegisterFlag.*;
 import static com.oracle.max.cri.util.MemoryBarriers.*;
 
-import com.oracle.max.cri.ci.*;
-import com.oracle.max.cri.ci.CiRegister.*;
+import com.oracle.graal.api.code.*;
+import com.oracle.graal.api.code.CiRegister.*;
 
 /**
  * Represents the AMD64 architecture.
--- a/graal/com.oracle.max.asm/src/com/oracle/max/asm/target/amd64/AMD64Assembler.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.max.asm/src/com/oracle/max/asm/target/amd64/AMD64Assembler.java	Thu Jun 07 18:55:34 2012 +0200
@@ -22,14 +22,14 @@
  */
 package com.oracle.max.asm.target.amd64;
 
+import static com.oracle.graal.api.code.CiValueUtil.*;
 import static com.oracle.max.asm.NumUtil.*;
 import static com.oracle.max.asm.target.amd64.AMD64.*;
-import static com.oracle.max.cri.ci.CiValueUtil.*;
 import static com.oracle.max.cri.util.MemoryBarriers.*;
 
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.max.asm.*;
-import com.oracle.max.cri.ci.*;
 
 /**
  * This class implements an assembler that can encode most X86 instructions.
--- a/graal/com.oracle.max.asm/src/com/oracle/max/asm/target/amd64/AMD64MacroAssembler.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.max.asm/src/com/oracle/max/asm/target/amd64/AMD64MacroAssembler.java	Thu Jun 07 18:55:34 2012 +0200
@@ -22,9 +22,9 @@
  */
 package com.oracle.max.asm.target.amd64;
 
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.max.asm.*;
-import com.oracle.max.cri.ci.*;
 
 /**
  * This class implements commonly used X86 code patterns.
--- a/graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiAddress.java	Thu Jun 07 18:41:37 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,177 +0,0 @@
-/*
- * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.max.cri.ci;
-
-import static com.oracle.max.cri.ci.CiValueUtil.*;
-
-import com.oracle.graal.api.meta.*;
-
-/**
- * Represents an address in target machine memory, specified via some combination of a base register, an index register,
- * a displacement and a scale. Note that the base and index registers may be a variable that will get a register assigned
- * later by the register allocator.
- */
-public final class CiAddress extends RiValue {
-    private static final long serialVersionUID = -1003772042519945089L;
-
-    /**
-     * A sentinel value used as a place holder in an instruction stream for an address that will be patched.
-     */
-    public static final CiAddress Placeholder = new CiAddress(RiKind.Illegal, RiValue.IllegalValue);
-
-    /**
-     * Base register that defines the start of the address computation.
-     * If not present, is denoted by {@link RiValue#IllegalValue}.
-     */
-    public RiValue base;
-
-    /**
-     * Index register, the value of which (possibly scaled by {@link #scale}) is added to {@link #base}.
-     * If not present, is denoted by {@link RiValue#IllegalValue}.
-     */
-    public RiValue index;
-
-    /**
-     * Scaling factor for indexing, dependent on target operand size.
-     */
-    public final Scale scale;
-
-    /**
-     * Optional additive displacement.
-     */
-    public final int displacement;
-
-    /**
-     * Creates a {@code CiAddress} with given base register, no scaling and no displacement.
-     * @param kind the kind of the value being addressed
-     * @param base the base register
-     */
-    public CiAddress(RiKind kind, RiValue base) {
-        this(kind, base, IllegalValue, Scale.Times1, 0);
-    }
-
-    /**
-     * Creates a {@code CiAddress} with given base register, no scaling and a given displacement.
-     * @param kind the kind of the value being addressed
-     * @param base the base register
-     * @param displacement the displacement
-     */
-    public CiAddress(RiKind kind, RiValue base, int displacement) {
-        this(kind, base, IllegalValue, Scale.Times1, displacement);
-    }
-
-    /**
-     * Creates a {@code CiAddress} with given base and index registers, scaling and displacement.
-     * This is the most general constructor..
-     * @param kind the kind of the value being addressed
-     * @param base the base register
-     * @param index the index register
-     * @param scale the scaling factor
-     * @param displacement the displacement
-     */
-    public CiAddress(RiKind kind, RiValue base, RiValue index, Scale scale, int displacement) {
-        super(kind);
-        this.base = base;
-        this.index = index;
-        this.scale = scale;
-        this.displacement = displacement;
-
-        assert !isConstant(base) && !isStackSlot(base);
-        assert !isConstant(index) && !isStackSlot(index);
-    }
-
-    /**
-     * A scaling factor used in complex addressing modes such as those supported by x86 platforms.
-     */
-    public enum Scale {
-        Times1(1, 0),
-        Times2(2, 1),
-        Times4(4, 2),
-        Times8(8, 3);
-
-        private Scale(int value, int log2) {
-            this.value = value;
-            this.log2 = log2;
-        }
-
-        /**
-         * The value (or multiplier) of this scale.
-         */
-        public final int value;
-
-        /**
-         * The {@linkplain #value value} of this scale log 2.
-         */
-        public final int log2;
-
-        public static Scale fromInt(int scale) {
-            switch (scale) {
-                case 1:  return Times1;
-                case 2:  return Times2;
-                case 4:  return Times4;
-                case 8:  return Times8;
-                default: throw new IllegalArgumentException(String.valueOf(scale));
-            }
-        }
-    }
-
-    @Override
-    public String toString() {
-        if (this == Placeholder) {
-            return "[<placeholder>]";
-        }
-
-        StringBuilder s = new StringBuilder();
-        s.append(kind.javaName).append("[");
-        String sep = "";
-        if (isLegal(base)) {
-            s.append(base);
-            sep = " + ";
-        }
-        if (isLegal(index)) {
-            s.append(sep).append(index).append(" * ").append(scale.value);
-            sep = " + ";
-        }
-        if (displacement < 0) {
-            s.append(" - ").append(-displacement);
-        } else if (displacement > 0) {
-            s.append(sep).append(displacement);
-        }
-        s.append("]");
-        return s.toString();
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (obj instanceof CiAddress) {
-            CiAddress addr = (CiAddress) obj;
-            return kind == addr.kind && displacement == addr.displacement && base.equals(addr.base) && scale == addr.scale && index.equals(addr.index);
-        }
-        return false;
-    }
-
-    @Override
-    public int hashCode() {
-        return base.hashCode() ^ index.hashCode() ^ (displacement << 4) ^ (scale.value << 8) ^ (kind.ordinal() << 12);
-    }
-}
--- a/graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiArchitecture.java	Thu Jun 07 18:41:37 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,212 +0,0 @@
-/*
- * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.max.cri.ci;
-
-import java.util.*;
-
-import com.oracle.max.cri.ci.CiRegister.*;
-import com.oracle.max.cri.util.*;
-
-
-/**
- * Represents a CPU architecture, including information such as its endianness, CPU
- * registers, word width, etc.
- */
-public abstract class CiArchitecture {
-
-    /**
-     * The endianness of the architecture.
-     */
-    public static enum ByteOrder {
-        LittleEndian,
-        BigEndian
-    }
-
-    /**
-     * The number of bits required in a bit map covering all the registers that may store references.
-     * The bit position of a register in the map is the register's {@linkplain CiRegister#number number}.
-     */
-    public final int registerReferenceMapBitCount;
-
-    /**
-     * Represents the natural size of words (typically registers and pointers) of this architecture, in bytes.
-     */
-    public final int wordSize;
-
-    /**
-     * The name of this architecture (e.g. "AMD64", "SPARCv9").
-     */
-    public final String name;
-
-    /**
-     * Array of all available registers on this architecture. The index of each register in this
-     * array is equal to its {@linkplain CiRegister#number number}.
-     */
-    public final CiRegister[] registers;
-
-    /**
-     * Map of all registers keyed by their {@linkplain CiRegister#name names}.
-     */
-    public final HashMap<String, CiRegister> registersByName;
-
-    /**
-     * The byte ordering can be either little or big endian.
-     */
-    public final ByteOrder byteOrder;
-
-    /**
-     * Mask of the barrier constants defined in {@link MemoryBarriers} denoting the barriers that
-     * are not required to be explicitly inserted under this architecture.
-     */
-    public final int implicitMemoryBarriers;
-
-    /**
-     * Determines the barriers in a given barrier mask that are explicitly required on this architecture.
-     *
-     * @param barriers a mask of the barrier constants defined in {@link MemoryBarriers}
-     * @return the value of {@code barriers} minus the barriers unnecessary on this architecture
-     */
-    public final int requiredBarriers(int barriers) {
-        return barriers & ~implicitMemoryBarriers;
-    }
-
-    /**
-     * Offset in bytes from the beginning of a call instruction to the displacement.
-     */
-    public final int machineCodeCallDisplacementOffset;
-
-    /**
-     * The size of the return address pushed to the stack by a call instruction.
-     * A value of 0 denotes that call linkage uses registers instead (e.g. SPARC).
-     */
-    public final int returnAddressSize;
-
-    private final EnumMap<RegisterFlag, CiRegister[]> registersByTypeAndEncoding;
-
-    /**
-     * Gets the register for a given {@linkplain CiRegister#encoding encoding} and type.
-     *
-     * @param encoding a register value as used in a machine instruction
-     * @param type the type of the register
-     */
-    public CiRegister registerFor(int encoding, RegisterFlag type) {
-        CiRegister[] regs = registersByTypeAndEncoding.get(type);
-        assert encoding >= 0 && encoding < regs.length;
-        CiRegister reg = regs[encoding];
-        assert reg != null;
-        return reg;
-    }
-
-    protected CiArchitecture(String name,
-                    int wordSize,
-                    ByteOrder byteOrder,
-                    CiRegister[] registers,
-                    int implicitMemoryBarriers,
-                    int nativeCallDisplacementOffset,
-                    int registerReferenceMapBitCount,
-                    int returnAddressSize) {
-        this.name = name;
-        this.registers = registers;
-        this.wordSize = wordSize;
-        this.byteOrder = byteOrder;
-        this.implicitMemoryBarriers = implicitMemoryBarriers;
-        this.machineCodeCallDisplacementOffset = nativeCallDisplacementOffset;
-        this.registerReferenceMapBitCount = registerReferenceMapBitCount;
-        this.returnAddressSize = returnAddressSize;
-
-        registersByName = new HashMap<>(registers.length);
-        for (CiRegister register : registers) {
-            registersByName.put(register.name, register);
-            assert registers[register.number] == register;
-        }
-
-        registersByTypeAndEncoding = new EnumMap<>(RegisterFlag.class);
-        EnumMap<RegisterFlag, CiRegister[]> categorizedRegs = CiRegister.categorize(registers);
-        for (RegisterFlag type : RegisterFlag.values()) {
-            CiRegister[] regs = categorizedRegs.get(type);
-            int max = CiRegister.maxRegisterEncoding(regs);
-            CiRegister[] regsByEnc = new CiRegister[max + 1];
-            for (CiRegister reg : regs) {
-                regsByEnc[reg.encoding] = reg;
-            }
-            registersByTypeAndEncoding.put(type, regsByEnc);
-        }
-    }
-
-    /**
-     * Converts this architecture to a string.
-     * @return the string representation of this architecture
-     */
-    @Override
-    public final String toString() {
-        return name.toLowerCase();
-    }
-
-    /**
-     * Checks whether this is a 32-bit architecture.
-     * @return {@code true} if this architecture is 32-bit
-     */
-    public final boolean is32bit() {
-        return wordSize == 4;
-    }
-
-    /**
-     * Checks whether this is a 64-bit architecture.
-     * @return {@code true} if this architecture is 64-bit
-     */
-    public final boolean is64bit() {
-        return wordSize == 8;
-    }
-
-    // The following methods are architecture specific and not dependent on state
-    // stored in this class. They have convenient default implementations.
-
-    /**
-     * Checks whether this architecture's normal arithmetic instructions use a two-operand form
-     * (e.g. x86 which overwrites one operand register with the result when adding).
-     * @return {@code true} if this architecture uses two-operand mode
-     */
-    public boolean twoOperandMode() {
-        return false;
-    }
-
-    // TODO: Why enumerate the concrete subclasses here rather
-    // than use instanceof comparisons in code that cares?
-
-    /**
-     * Checks whether the architecture is x86.
-     * @return {@code true} if the architecture is x86
-     */
-    public boolean isX86() {
-        return false;
-    }
-
-    /**
-     * Checks whether the architecture is SPARC.
-     * @return {@code true} if the architecture is SPARC
-     */
-    public boolean isSPARC() {
-        return false;
-    }
-
-}
--- a/graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiAssumptions.java	Thu Jun 07 18:41:37 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,262 +0,0 @@
-/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.max.cri.ci;
-
-import java.io.*;
-import java.util.*;
-
-import com.oracle.graal.api.meta.*;
-
-/**
- * Class for recording optimistic assumptions made during compilation.
- * Recorded assumption can be visited for subsequent processing using
- * an implementation of the {@link CiAssumptionProcessor} interface.
- */
-public final class CiAssumptions implements Serializable, Iterable<CiAssumptions.Assumption> {
-
-    private static final long serialVersionUID = 5152062717588239131L;
-
-    public abstract static class Assumption implements Serializable {
-
-        private static final long serialVersionUID = -1936652569665112915L;
-    }
-
-    /**
-     * An assumption about a unique subtype of a given type.
-     */
-    public static final class ConcreteSubtype extends Assumption {
-
-        private static final long serialVersionUID = -1457173265437676252L;
-
-        /**
-         * Type the assumption is made about.
-         */
-        public final RiResolvedType context;
-
-        /**
-         * Assumed unique concrete sub-type of the context type.
-         */
-        public final RiResolvedType subtype;
-
-        public ConcreteSubtype(RiResolvedType context, RiResolvedType subtype) {
-            this.context = context;
-            this.subtype = subtype;
-        }
-
-        @Override
-        public int hashCode() {
-            final int prime = 31;
-            int result = 1;
-            result = prime * result + context.hashCode();
-            result = prime * result + subtype.hashCode();
-            return result;
-        }
-
-        @Override
-        public boolean equals(Object obj) {
-            if (obj instanceof ConcreteSubtype) {
-                ConcreteSubtype other = (ConcreteSubtype) obj;
-                return other.context == context && other.subtype == subtype;
-            }
-            return false;
-        }
-    }
-
-    /**
-     * An assumption about a unique implementation of a virtual method.
-     */
-    public static final class ConcreteMethod extends Assumption {
-
-        private static final long serialVersionUID = -7636746737947390059L;
-
-        /**
-         * A virtual (or interface) method whose unique implementation for the receiver type
-         * in {@link #context} is {@link #impl}.
-         */
-        public final RiResolvedMethod method;
-
-        /**
-         * A receiver type.
-         */
-        public final RiResolvedType context;
-
-        /**
-         * The unique implementation of {@link #method} for {@link #context}.
-         */
-        public final RiResolvedMethod impl;
-
-        public ConcreteMethod(RiResolvedMethod method, RiResolvedType context, RiResolvedMethod impl) {
-            this.method = method;
-            this.context = context;
-            this.impl = impl;
-        }
-
-        @Override
-        public int hashCode() {
-            final int prime = 31;
-            int result = 1;
-            result = prime * result + method.hashCode();
-            result = prime * result + context.hashCode();
-            result = prime * result + impl.hashCode();
-            return result;
-        }
-
-        @Override
-        public boolean equals(Object obj) {
-            if (obj instanceof ConcreteMethod) {
-                ConcreteMethod other = (ConcreteMethod) obj;
-                return other.method == method && other.context == context && other.impl == impl;
-            }
-            return false;
-        }
-    }
-
-    /**
-     * An assumption that specified that a method was used during the compilation.
-     */
-    public static final class MethodContents extends Assumption {
-
-        private static final long serialVersionUID = -4821594103928571659L;
-
-        public final RiResolvedMethod method;
-
-        public MethodContents(RiResolvedMethod method) {
-            this.method = method;
-        }
-
-        @Override
-        public int hashCode() {
-            final int prime = 31;
-            int result = 1;
-            result = prime * result + method.hashCode();
-            return result;
-        }
-
-        @Override
-        public boolean equals(Object obj) {
-            if (obj instanceof ConcreteMethod) {
-                ConcreteMethod other = (ConcreteMethod) obj;
-                return other.method == method;
-            }
-            return false;
-        }
-    }
-
-    /**
-     * Array with the assumptions. This field is directly accessed from C++ code in the Graal/HotSpot implementation.
-     */
-    private Assumption[] list;
-
-    private int count;
-
-    /**
-     * Returns whether any assumptions have been registered.
-     * @return {@code true} if at least one assumption has been registered, {@code false} otherwise.
-     */
-    public boolean isEmpty() {
-        return count == 0;
-    }
-
-    @Override
-    public Iterator<Assumption> iterator() {
-        return new Iterator<CiAssumptions.Assumption>() {
-            int index;
-            public void remove() {
-                throw new UnsupportedOperationException();
-            }
-            public Assumption next() {
-                if (index >= count) {
-                    throw new NoSuchElementException();
-                }
-                return list[index++];
-            }
-            public boolean hasNext() {
-                return index < count;
-            }
-        };
-    }
-
-    /**
-     * Records an assumption that the specified type has no finalizable subclasses.
-     *
-     * @param receiverType the type that is assumed to have no finalizable subclasses
-     * @return {@code true} if the assumption was recorded and can be assumed; {@code false} otherwise
-     */
-    @SuppressWarnings("static-method")
-    public boolean recordNoFinalizableSubclassAssumption(RiResolvedType receiverType) {
-        // TODO (thomaswue): Record that assumption correctly.
-        return false;
-    }
-
-    /**
-     * Records that {@code subtype} is the only concrete subtype in the class hierarchy below {@code context}.
-     * @param context the root of the subtree of the class hierarchy that this assumptions is about
-     * @param subtype the one concrete subtype
-     */
-    public void recordConcreteSubtype(RiResolvedType context, RiResolvedType subtype) {
-        record(new ConcreteSubtype(context, subtype));
-    }
-
-    /**
-     * Records that {@code impl} is the only possible concrete target for a virtual call to
-     * {@code method} with a receiver of type {@code context}.
-     *
-     * @param method a method that is the target of a virtual call
-     * @param context the receiver type of a call to {@code method}
-     * @param impl the concrete method that is the only possible target for the virtual call
-     */
-    public void recordConcreteMethod(RiResolvedMethod method, RiResolvedType context, RiResolvedMethod impl) {
-        record(new ConcreteMethod(method, context, impl));
-    }
-
-    /**
-     * Records that {@code method} was used during the compilation.
-     *
-     * @param method a method whose contents were used
-     */
-    public void recordMethodContents(RiResolvedMethod method) {
-        record(new MethodContents(method));
-    }
-
-    private void record(Assumption assumption) {
-        if (list == null) {
-            list = new Assumption[4];
-        } else {
-            for (int i = 0; i < count; ++i) {
-                if (assumption.equals(list[i])) {
-                    return;
-                }
-            }
-        }
-        if (list.length == count) {
-            Assumption[] newList = new Assumption[list.length * 2];
-            for (int i = 0; i < list.length; ++i) {
-                newList[i] = list[i];
-            }
-            list = newList;
-        }
-        list[count] = assumption;
-        count++;
-    }
-
-}
--- a/graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiBailout.java	Thu Jun 07 18:41:37 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.max.cri.ci;
-
-import java.util.*;
-
-/**
- * {@code CiBailout} is thrown when the compiler refuses to compile a method because of problems with the method.
- * e.g. bytecode wouldn't verify, too big, JSR/ret too complicated, etc. This exception is <i>not</i>
- * meant to indicate problems with the compiler itself.
- */
-public class CiBailout extends RuntimeException {
-
-    public static final long serialVersionUID = 8974598793458772L;
-
-    /**
-     * Create a new {@code CiBailout}.
-     * @param reason a message indicating the reason
-     */
-    public CiBailout(String reason) {
-        super(reason);
-    }
-
-    /**
-     * Create a new {@code CiBailout}.
-     * @param reason a message indicating the reason with a String.format - syntax
-     * @param args parameters to the formatter
-     */
-    public CiBailout(String format, Object... args) {
-        this(String.format(Locale.ENGLISH, format, args));
-    }
-
-    /**
-     * Create a new {@code CiBailout} t due to an internal exception being thrown.
-     * @param reason a message indicating the reason
-     * @param cause the throwable that was the cause of the bailout
-     */
-    public CiBailout(String reason, Throwable cause) {
-        super(reason);
-        initCause(cause);
-    }
-}
--- a/graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiCalleeSaveLayout.java	Thu Jun 07 18:41:37 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,178 +0,0 @@
-/*
- * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.max.cri.ci;
-
-import java.util.*;
-
-
-/**
- * The callee save area (CSA) is a contiguous space in a stack frame
- * used to save (and restore) the values of the caller's registers.
- * This class describes the layout of a CSA in terms of its
- * {@linkplain #size size}, {@linkplain #slotSize slot size} and
- * the {@linkplain #registers callee save registers} covered by the CSA.
- */
-public class CiCalleeSaveLayout {
-
-    /**
-     * The size (in bytes) of the CSA.
-     */
-    public final int size;
-
-    /**
-     * The size (in bytes) of an {@linkplain #registerAtIndex(int) indexable} slot in the CSA.
-     */
-    public final int slotSize;
-
-    /**
-     * Map from {@linkplain CiRegister#number register numbers} to slot indexes in the CSA.
-     */
-    private final int[] regNumToIndex;
-
-    private final CiRegister[] indexToReg;
-
-    /**
-     * The list of registers {@linkplain #contains(CiRegister) contained} by this CSA.
-     */
-    public final CiRegister[] registers;
-
-    /**
-     * The offset from the frame pointer to the CSA. If this is not known, then this field
-     * will have the value {@link Integer#MAX_VALUE}.
-     */
-    public final int frameOffsetToCSA;
-
-    /**
-     * Creates a CSA layout.
-     *
-     * @param size size (in bytes) of the CSA. If this is {@code -1}, then the CSA size will be computed from {@code registers}.
-     * @param slotSize the size (in bytes) of an {@linkplain #registerAtIndex(int) indexable} slot in the CSA
-     * @param registers the registers that can be saved in the CSA
-     */
-    public CiCalleeSaveLayout(int frameOffsetToCSA, int size, int slotSize, CiRegister... registers) {
-        this.frameOffsetToCSA = frameOffsetToCSA;
-        assert slotSize == 0 || CiUtil.isPowerOf2(slotSize);
-        this.slotSize = slotSize;
-        int maxRegNum = -1;
-        int maxOffset = 0;
-        this.registers = registers;
-        int offset = 0;
-        for (CiRegister reg : registers) {
-            assert offset % slotSize == 0;
-            assert reg.number >= 0;
-            if (reg.number > maxRegNum) {
-                maxRegNum = reg.number;
-            }
-            if (offset > maxOffset) {
-                maxOffset = offset;
-            }
-            offset += reg.spillSlotSize;
-        }
-        if (size == -1) {
-            this.size = offset;
-        } else {
-            assert offset <= size;
-            this.size = size;
-        }
-
-        this.regNumToIndex = new int[maxRegNum + 1];
-        this.indexToReg = offset == 0 ? new CiRegister[0] : new CiRegister[offset / slotSize];
-        Arrays.fill(regNumToIndex, -1);
-        offset = 0;
-        for (CiRegister reg : registers) {
-            int index = offset / slotSize;
-            regNumToIndex[reg.number] = index;
-            indexToReg[index] = reg;
-            offset += reg.spillSlotSize;
-        }
-    }
-
-    /**
-     * Gets the offset of a given register in the CSA.
-     *
-     * @return the offset (in bytes) of {@code reg} in the CSA
-     * @throws IllegalArgumentException if {@code reg} does not have a slot in the CSA
-     */
-    public int offsetOf(int reg) {
-        return indexOf(reg) * slotSize;
-    }
-
-    /**
-     * Gets the index of a given register in the CSA.
-     *
-     * @return the index of {@code reg} in the CSA
-     * @throws IllegalArgumentException if {@code reg} does not have a slot in the CSA
-     */
-    public int indexOf(int reg) {
-        if (!contains(reg)) {
-            throw new IllegalArgumentException(String.valueOf(reg));
-        }
-        return regNumToIndex[reg];
-    }
-
-    /**
-     * Gets the offset of a given register in the CSA.
-     *
-     * @return the offset (in bytes) of {@code reg} in the CSA
-     * @throws IllegalArgumentException if {@code reg} does not have a slot in the CSA
-     */
-    public int offsetOf(CiRegister reg) {
-        return offsetOf(reg.number);
-    }
-
-    /**
-     * Determines if the CSA includes a slot for a given register.
-     *
-     * @param reg the register to test
-     * @return true if the CSA contains a slot for {@code reg}
-     */
-    public boolean contains(int reg) {
-        return reg >= 0 && reg < regNumToIndex.length && regNumToIndex[reg] != -1;
-    }
-
-    /**
-     * Gets the register whose slot in the CSA is at a given index.
-     *
-     * @param index an index of a slot in the CSA
-     * @return the register whose slot in the CSA is at  {@code index} or {@code null} if {@code index} does not denote a
-     *         slot in the CSA aligned with a register
-     */
-    public CiRegister registerAt(int index) {
-        if (index < 0 || index >= indexToReg.length) {
-            return null;
-        }
-        return indexToReg[index];
-    }
-
-    @Override
-    public String toString() {
-        StringBuilder sb = new StringBuilder("[");
-        for (CiRegister reg : registers) {
-            if (sb.length() != 1) {
-                sb.append(", ");
-            }
-            sb.append(reg).append("{+").append(offsetOf(reg)).append('}');
-        }
-        return sb.append("] size=").append(size).toString();
-    }
-}
--- a/graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiCallingConvention.java	Thu Jun 07 18:41:37 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,107 +0,0 @@
-/*
- * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.max.cri.ci;
-
-import static com.oracle.max.cri.ci.CiValueUtil.*;
-
-import com.oracle.graal.api.meta.*;
-
-
-/**
- * A calling convention describes the locations in which the arguments for a call are placed.
- */
-public class CiCallingConvention {
-
-    /**
-     * Constants denoting the type of a call for which a calling convention is
-     * {@linkplain CiRegisterConfig#getCallingConvention(Type, CiKind[], CiTarget, boolean) requested}.
-     */
-    public enum Type {
-        /**
-         * A request for the outgoing argument locations at a call site to Java code.
-         */
-        JavaCall(true),
-
-        /**
-         * A request for the incoming argument locations.
-         */
-        JavaCallee(false),
-
-        /**
-         * A request for the outgoing argument locations at a call site to the runtime (which may be Java or native code).
-         */
-        RuntimeCall(true),
-
-        /**
-         * A request for the outgoing argument locations at a call site to
-         * external native code that complies with the platform ABI.
-         */
-        NativeCall(true);
-
-        /**
-         * Determines if this is a request for the outgoing argument locations at a call site.
-         */
-        public final boolean out;
-
-        public static final Type[] VALUES = values();
-
-        private Type(boolean out) {
-            this.out = out;
-        }
-    }
-
-    /**
-     * The amount of stack space (in bytes) required for the stack-based arguments of the call.
-     */
-    public final int stackSize;
-
-    /**
-     * The locations in which the arguments are placed. This array ordered by argument index.
-     */
-    public final RiValue[] locations;
-
-    public CiCallingConvention(RiValue[] locations, int stackSize) {
-        this.locations = locations;
-        this.stackSize = stackSize;
-        assert verify();
-    }
-
-    @Override
-    public String toString() {
-        StringBuilder result = new StringBuilder();
-        result.append("CallingConvention[");
-        for (RiValue op : locations) {
-            result.append(op.toString()).append(" ");
-        }
-        result.append("]");
-        return result.toString();
-    }
-
-    private boolean verify() {
-        for (int i = 0; i < locations.length; i++) {
-            RiValue location = locations[i];
-            assert isStackSlot(location) || isRegister(location);
-        }
-        return true;
-    }
-}
--- a/graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiCodePos.java	Thu Jun 07 18:41:37 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,103 +0,0 @@
-/*
- * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.max.cri.ci;
-
-import java.io.*;
-
-import com.oracle.graal.api.meta.*;
-
-/**
- * Represents a code position, that is, a chain of inlined methods with bytecode
- * locations, that is communicated from the compiler to the runtime system. A code position
- * can be used by the runtime system to reconstruct a source-level stack trace
- * for exceptions and to create {@linkplain CiFrame frames} for deoptimization.
- */
-public abstract class CiCodePos implements Serializable {
-
-    private static final long serialVersionUID = 8633885274526033515L;
-
-    /**
-     * The position where this position has been called, {@code null} if none.
-     */
-    public final CiCodePos caller;
-
-    /**
-     * The runtime interface method for this position.
-     */
-    public final RiResolvedMethod method;
-
-    /**
-     * The location within the method, as a bytecode index. The constant
-     * {@code -1} may be used to indicate the location is unknown, for example
-     * within code synthesized by the compiler.
-     */
-    public final int bci;
-
-    /**
-     * Constructs a new object representing a given parent/caller, a given method, and a given BCI.
-     *
-     * @param caller the parent position
-     * @param method the method
-     * @param bci a BCI within the method
-     */
-    public CiCodePos(CiCodePos caller, RiResolvedMethod method, int bci) {
-        assert method != null;
-        this.caller = caller;
-        this.method = method;
-        this.bci = bci;
-    }
-
-    /**
-     * Converts this code position to a string representation.
-     * @return a string representation of this code position
-     */
-    @Override
-    public String toString() {
-        return CiUtil.append(new StringBuilder(100), this).toString();
-    }
-
-    /**
-     * Deep equality test.
-     */
-    @Override
-    public boolean equals(Object obj) {
-        if (obj == this) {
-            return true;
-        }
-        if (obj instanceof CiCodePos) {
-            CiCodePos other = (CiCodePos) obj;
-            if (other.method.equals(method) && other.bci == bci) {
-                if (caller == null) {
-                    return other.caller == null;
-                }
-                return caller.equals(other.caller);
-            }
-        }
-        return false;
-    }
-
-    @Override
-    public int hashCode() {
-        return bci;
-    }
-}
--- a/graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiCompilationStatistics.java	Thu Jun 07 18:41:37 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,212 +0,0 @@
-/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.max.cri.ci;
-
-import java.io.*;
-import java.lang.annotation.*;
-import java.lang.reflect.*;
-import java.util.*;
-import java.util.concurrent.*;
-
-import com.oracle.graal.api.meta.*;
-import com.oracle.max.cri.ri.*;
-
-@SuppressWarnings("unused")
-public final class CiCompilationStatistics {
-
-    private static final long RESOLUTION = 100000000;
-    private static final boolean TIMELINE_ENABLED = System.getProperty("stats.timeline.file") != null;
-    private static final boolean COMPILATIONSTATS_ENABLED = System.getProperty("stats.compilations.file") != null;
-    private static final boolean ENABLED = TIMELINE_ENABLED || COMPILATIONSTATS_ENABLED;
-
-    private static final CiCompilationStatistics DUMMY = new CiCompilationStatistics(null);
-
-    private static ConcurrentLinkedDeque<CiCompilationStatistics> list = new ConcurrentLinkedDeque<>();
-
-    private static final ThreadLocal<Deque<CiCompilationStatistics>> current = new ThreadLocal<Deque<CiCompilationStatistics>>() {
-
-        @Override
-        protected Deque<CiCompilationStatistics> initialValue() {
-            return new ArrayDeque<>();
-        }
-    };
-
-    @Retention(RetentionPolicy.RUNTIME)
-    @Target(ElementType.FIELD)
-    private static @interface AbsoluteTimeValue {
-    }
-
-    @Retention(RetentionPolicy.RUNTIME)
-    @Target(ElementType.FIELD)
-    private static @interface TimeValue {
-    }
-
-    private static long zeroTime = System.nanoTime();
-
-    private final String holder;
-    private final String name;
-    private final String signature;
-    @AbsoluteTimeValue
-    private final long startTime;
-    @TimeValue
-    private long duration;
-    private int startInvCount;
-    private int endInvCount;
-    private int bytecodeCount;
-    private int codeSize;
-    private int deoptCount;
-
-    private CiCompilationStatistics(RiResolvedMethod method) {
-        if (method != null) {
-            holder = CiUtil.format("%H", method);
-            name = method.name();
-            signature = CiUtil.format("%p", method);
-            startTime = System.nanoTime();
-            startInvCount = method.invocationCount();
-            bytecodeCount = method.codeSize();
-        } else {
-            holder = "";
-            name = "";
-            signature = "";
-            startTime = 0;
-        }
-    }
-
-    public void finish(RiResolvedMethod method) {
-        if (ENABLED) {
-            duration = System.nanoTime() - startTime;
-            endInvCount = method.invocationCount();
-            codeSize = method.compiledCodeSize();
-            if (current.get().getLast() != this) {
-                throw new RuntimeException("mismatch in finish()");
-            }
-            current.get().removeLast();
-        }
-    }
-
-    public static CiCompilationStatistics current() {
-        return current.get().isEmpty() ? null : current.get().getLast();
-    }
-
-    public static CiCompilationStatistics create(RiResolvedMethod method) {
-        if (ENABLED) {
-            CiCompilationStatistics stats = new CiCompilationStatistics(method);
-            list.add(stats);
-            current.get().addLast(stats);
-            return stats;
-        } else {
-            return DUMMY;
-        }
-    }
-
-    @SuppressWarnings("deprecation")
-    public static void clear(String dumpName) {
-        if (!ENABLED) {
-            return;
-        }
-        try {
-            ConcurrentLinkedDeque<CiCompilationStatistics> snapshot = list;
-            long snapshotZeroTime = zeroTime;
-
-            list = new ConcurrentLinkedDeque<>();
-            zeroTime = System.nanoTime();
-
-            Date now = new Date();
-            String dateString = (now.getYear() + 1900) + "_" + (now.getMonth() + 1) + "_" + now.getDate() + " " + now.getHours() + "_" + now.getMinutes() + "_" + now.getSeconds();
-            try (PrintStream out = new PrintStream("compilations " + dateString + " " + dumpName + ".csv")) {
-                // output the list of all compilations
-
-                Field[] declaredFields = CiCompilationStatistics.class.getDeclaredFields();
-                ArrayList<Field> fields = new ArrayList<>();
-                for (Field field : declaredFields) {
-                    if (!Modifier.isStatic(field.getModifiers())) {
-                        fields.add(field);
-                    }
-                }
-                for (Field field : fields) {
-                    out.print(field.getName() + ";");
-                }
-                out.println();
-                for (CiCompilationStatistics stats : snapshot) {
-                    for (Field field : fields) {
-                        if (field.isAnnotationPresent(AbsoluteTimeValue.class)) {
-                            double value = (field.getLong(stats) - snapshotZeroTime) / 1000000d;
-                            out.print(String.format(Locale.ENGLISH, "%.3f", value) + ";");
-                        } else if (field.isAnnotationPresent(TimeValue.class)) {
-                            double value = field.getLong(stats) / 1000000d;
-                            out.print(String.format(Locale.ENGLISH, "%.3f", value) + ";");
-                        } else {
-                            out.print(field.get(stats) + ";");
-                        }
-                    }
-                    out.println();
-                }
-            }
-
-            String timelineFile = System.getProperty("stats.timeline.file");
-            if (timelineFile == null || timelineFile.isEmpty()) {
-                timelineFile = "timeline " + dateString;
-            }
-            try (FileOutputStream fos = new FileOutputStream(timelineFile + " " + dumpName + ".csv", true); PrintStream out = new PrintStream(fos)) {
-
-                long[] timeSpent = new long[10000];
-                int maxTick = 0;
-                for (CiCompilationStatistics stats : snapshot) {
-                    long start = stats.startTime - snapshotZeroTime;
-                    long duration = stats.duration;
-                    if (start < 0) {
-                        duration -= -start;
-                        start = 0;
-                    }
-
-                    int tick = (int) (start / RESOLUTION);
-                    long timeLeft = RESOLUTION - (start % RESOLUTION);
-
-                    while (tick < timeSpent.length && duration > 0) {
-                        if (tick > maxTick) {
-                            maxTick = tick;
-                        }
-                        timeSpent[tick] += Math.min(timeLeft, duration);
-                        duration -= timeLeft;
-                        tick++;
-                        timeLeft = RESOLUTION;
-                    }
-                }
-                String timelineName = System.getProperty("stats.timeline.name");
-                if (timelineName != null && !timelineName.isEmpty()) {
-                    out.print(timelineName + ";");
-                }
-                for (int i = 0; i <= maxTick; i++) {
-                    out.print((timeSpent[i] * 100 / RESOLUTION) + ";");
-                }
-                out.println();
-            }
-        } catch (Exception e) {
-            throw new RuntimeException(e);
-        }
-    }
-
-    public void setDeoptCount(int count) {
-        this.deoptCount = count;
-    }
-}
--- a/graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiDebugInfo.java	Thu Jun 07 18:41:37 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,107 +0,0 @@
-/*
- * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.max.cri.ci;
-
-import java.io.*;
-
-import com.oracle.graal.api.meta.*;
-
-/**
- * Represents the debugging information for a particular place in the code,
- * which includes the code position, a reference map, and deoptimization information.
- */
-public class CiDebugInfo implements Serializable {
-
-    private static final long serialVersionUID = -6047206624915812516L;
-
-    /**
-     * The code position (including all inlined methods) of this debug info.
-     * If this is a {@link CiFrame} instance, then it is also the deoptimization information for each inlined frame.
-     */
-    public final CiCodePos codePos;
-
-    /**
-     * The reference map for the registers at this point. The reference map is <i>packed</i> in that
-     * for bit {@code k} in byte {@code n}, it refers to the register whose
-     * {@linkplain CiRegister#number number} is {@code (k + n * 8)}.
-     */
-    public final RiBitMap registerRefMap;
-
-    /**
-     * The reference map for the stack frame at this point. A set bit at {@code k} in the map
-     * represents stack slot number {@code k}.
-     */
-    public final RiBitMap frameRefMap;
-
-    /**
-     * Creates a new {@code CiDebugInfo} from the given values.
-     *
-     * @param codePos the {@linkplain CiCodePos code position} or {@linkplain CiFrame frame} info
-     * @param registerRefMap the register map
-     * @param frameRefMap the reference map for {@code frame}, which may be {@code null}
-     */
-    public CiDebugInfo(CiCodePos codePos, RiBitMap registerRefMap, RiBitMap frameRefMap) {
-        this.codePos = codePos;
-        this.registerRefMap = registerRefMap;
-        this.frameRefMap = frameRefMap;
-    }
-
-    /**
-     * @return {@code true} if this debug information has a frame
-     */
-    public boolean hasFrame() {
-        return codePos instanceof CiFrame;
-    }
-
-    /**
-     * @return {@code true} if this debug info has a reference map for the registers
-     */
-    public boolean hasRegisterRefMap() {
-        return registerRefMap != null && registerRefMap.size() > 0;
-    }
-
-    /**
-     * @return {@code true} if this debug info has a reference map for the stack
-     */
-    public boolean hasStackRefMap() {
-        return frameRefMap != null && frameRefMap.size() > 0;
-    }
-
-
-    /**
-     * Gets the deoptimization information for each inlined frame (if available).
-     *
-     * @return {@code null} if no frame de-opt info is {@linkplain #hasDebugFrame available}
-     */
-    public CiFrame frame() {
-        if (hasFrame()) {
-            return (CiFrame) codePos;
-        }
-        return null;
-    }
-
-    @Override
-    public String toString() {
-        return CiUtil.append(new StringBuilder(100), this, null).toString();
-    }
-}
--- a/graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiDeoptAction.java	Thu Jun 07 18:41:37 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.max.cri.ci;
-
-
-public enum CiDeoptAction {
-    None,                           // just interpret, do not invalidate nmethod
-    RecompileIfTooManyDeopts,       // recompile the nmethod; need not invalidate
-    InvalidateReprofile,            // invalidate the nmethod, reset IC, maybe recompile
-    InvalidateRecompile,            // invalidate the nmethod, recompile (probably)
-    InvalidateStopCompiling;        // invalidate the nmethod and do not compile
-}
--- a/graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiExceptionHandler.java	Thu Jun 07 18:41:37 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,93 +0,0 @@
-/*
- * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.max.cri.ci;
-
-import com.oracle.graal.api.meta.*;
-
-/**
- * An implementation of the {@link RiExceptionHandler} interface.
- */
-public class CiExceptionHandler implements RiExceptionHandler {
-
-    public static final CiExceptionHandler[] NONE = {};
-
-    public final int startBCI;
-    public final int endBCI;
-    public final int handlerBCI;
-    public final int catchTypeCPI;
-    public final RiType catchType;
-
-    /**
-     * Creates a new exception handler with the specified ranges.
-     * @param startBCI the start index of the protected range
-     * @param endBCI the end index of the protected range
-     * @param catchBCI the index of the handler
-     * @param catchTypeCPI the index of the throwable class in the constant pool
-     * @param catchType the type caught by this exception handler
-     */
-    public CiExceptionHandler(int startBCI, int endBCI, int catchBCI, int catchTypeCPI, RiType catchType) {
-        this.startBCI = startBCI;
-        this.endBCI = endBCI;
-        this.handlerBCI = catchBCI;
-        this.catchTypeCPI = catchTypeCPI;
-        this.catchType = catchType;
-    }
-
-    public int startBCI() {
-        return startBCI;
-    }
-
-    public int endBCI() {
-        return endBCI;
-    }
-
-    public int handlerBCI() {
-        return handlerBCI;
-    }
-
-    public int catchTypeCPI() {
-        return catchTypeCPI;
-    }
-
-    public boolean isCatchAll() {
-        return catchTypeCPI == 0;
-    }
-
-    public RiType catchType() {
-        return catchType;
-    }
-
-    @Override
-    public String toString() {
-        return new StringBuilder(20).
-            append('[').
-            append(startBCI).
-            append(" - ").
-            append(endBCI).
-            append(") -> ").
-            append(handlerBCI).
-            append(" type=").
-            append(catchType == null ? "*any*" : catchType.name()).
-            toString();
-    }
-}
--- a/graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiFrame.java	Thu Jun 07 18:41:37 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,143 +0,0 @@
-/*
- * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.max.cri.ci;
-
-import java.io.*;
-
-import com.oracle.graal.api.meta.*;
-
-/**
- * Represents the Java bytecode frame state(s) at a given position
- * including {@link RiValue locations} where to find the local variables,
- * operand stack values and locked objects of the bytecode frame(s).
- */
-public class CiFrame extends CiCodePos implements Serializable {
-    private static final long serialVersionUID = -345025397165977565L;
-
-    /**
-     * An array of values representing how to reconstruct the state of the Java frame.
-     * This is array is partitioned as follows:
-     * <p>
-     * <table border="1" cellpadding="5" frame="void", rules="all">
-     * <tr><th>Start index (inclusive)</th><th>End index (exclusive)</th><th>Description</th></tr>
-     * <tr><td>0</td>                   <td>numLocals</td>           <td>Local variables</td></tr>
-     * <tr><td>numLocals</td>           <td>numLocals + numStack</td><td>Operand stack</td></tr>
-     * <tr><td>numLocals + numStack</td><td>values.length</td>       <td>Locked objects</td></tr>
-     * </table>
-     * <p>
-     * Note that the number of locals and the number of stack slots may be smaller than the
-     * maximum number of locals and stack slots as specified in the compiled method.
-     */
-    public final RiValue[] values;
-
-    /**
-     * The number of locals in the values array.
-     */
-    public final int numLocals;
-
-    /**
-     * The number of stack slots in the values array.
-     */
-    public final int numStack;
-
-    /**
-     * The number of locks in the values array.
-     */
-    public final int numLocks;
-
-    /**
-     * In case this frame state belongs to a deoptimization, the leafGraphId will contain the StructuredGraph.graphId() of the graph that originally introduced this deoptimization point.
-     * This id is later on used by the runtime system to evict graphs from the graph cache when deoptimizations originating from them have been hit.
-     */
-    public final long leafGraphId;
-
-    public final boolean rethrowException;
-
-    public final boolean duringCall;
-
-    /**
-     * Creates a new frame object.
-     *
-     * @param caller the caller frame (which may be {@code null})
-     * @param method the method
-     * @param bci a BCI within the method
-     * @param rethrowException specifies if the VM should re-throw the pending exception when deopt'ing using this frame
-     * @param values the frame state {@link #values}
-     * @param numLocals the number of local variables
-     * @param numStack the depth of the stack
-     * @param numLocks the number of locked objects
-     */
-    public CiFrame(CiFrame caller, RiResolvedMethod method, int bci, boolean rethrowException, boolean duringCall, RiValue[] values, int numLocals, int numStack, int numLocks, long leafGraphId) {
-        super(caller, method, bci);
-        assert values != null;
-        this.rethrowException = rethrowException;
-        this.duringCall = duringCall;
-        this.values = values;
-        this.numLocals = numLocals;
-        this.numStack = numStack;
-        this.numLocks = numLocks;
-        this.leafGraphId = leafGraphId;
-        assert !rethrowException || numStack == 1 : "must have exception on top of the stack";
-    }
-
-    /**
-     * Gets the value representing the specified local variable.
-     * @param i the local variable index
-     * @return the value that can be used to reconstruct the local's current value
-     */
-    public RiValue getLocalValue(int i) {
-        return values[i];
-    }
-
-    /**
-     * Gets the value representing the specified stack slot.
-     * @param i the stack index
-     * @return the value that can be used to reconstruct the stack slot's current value
-     */
-    public RiValue getStackValue(int i) {
-        return values[i + numLocals];
-    }
-
-    /**
-     * Gets the value representing the specified lock.
-     * @param i the lock index
-     * @return the value that can be used to reconstruct the lock's current value
-     */
-    public RiValue getLockValue(int i) {
-        return values[i + numLocals + numStack];
-    }
-
-    /**
-     * Gets the caller of this frame.
-     *
-     * @return {@code null} if this frame has no caller
-     */
-    public CiFrame caller() {
-        return (CiFrame) caller;
-    }
-
-    @Override
-    public String toString() {
-        return CiUtil.append(new StringBuilder(100), this).toString();
-    }
-}
--- a/graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiGenericCallback.java	Thu Jun 07 18:41:37 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.max.cri.ci;
-
-/**
- * This interface is used for {@link CiRuntimeCall#GenericCallback} runtime calls.
- */
-public abstract class CiGenericCallback {
-
-    @SuppressWarnings("unused")
-    private Object callbackInternal(Object arg) {
-        try {
-            return callback(arg);
-        } catch (Throwable t) {
-            t.printStackTrace();
-            return null;
-        }
-    }
-
-    public abstract Object callback(Object arg);
-}
--- a/graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiMonitorValue.java	Thu Jun 07 18:41:37 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.max.cri.ci;
-
-import com.oracle.graal.api.meta.*;
-
-public final class CiMonitorValue extends RiValue {
-    private static final long serialVersionUID = 8241681800464483691L;
-
-    public RiValue owner;
-    public final RiValue lockData;
-    public final boolean eliminated;
-
-    public CiMonitorValue(RiValue owner, RiValue lockData, boolean eliminated) {
-        super(RiKind.Illegal);
-        this.owner = owner;
-        this.lockData = lockData;
-        this.eliminated = eliminated;
-    }
-
-    @Override
-    public String toString() {
-        return "monitor[" + owner + (lockData != null ? ", " + lockData : "") + (eliminated ? ", eliminated" : "") + "]";
-    }
-}
--- a/graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiRegister.java	Thu Jun 07 18:41:37 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,256 +0,0 @@
-/*
- * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.max.cri.ci;
-
-import java.io.*;
-import java.util.*;
-
-import com.oracle.graal.api.meta.*;
-
-/**
- * Represents a target machine register.
- */
-public final class CiRegister implements Comparable<CiRegister>, Serializable {
-
-    private static final long serialVersionUID = -7213269157816016300L;
-
-    /**
-     * Invalid register.
-     */
-    public static final CiRegister None = new CiRegister(-1, -1, 0, "noreg");
-
-    /**
-     * Frame pointer of the current method. All spill slots and outgoing stack-based arguments
-     * are addressed relative to this register.
-     */
-    public static final CiRegister Frame = new CiRegister(-2, -2, 0, "framereg", RegisterFlag.CPU);
-
-    public static final CiRegister CallerFrame = new CiRegister(-3, -3, 0, "callerframereg", RegisterFlag.CPU);
-
-    /**
-     * The identifier for this register that is unique across all the registers in a {@link CiArchitecture}.
-     * A valid register has {@code number > 0}.
-     */
-    public final int number;
-
-    /**
-     * The mnemonic of this register.
-     */
-    public final String name;
-
-    /**
-     * The actual encoding in a target machine instruction for this register, which may or
-     * may not be the same as {@link #number}.
-     */
-    public final int encoding;
-
-    /**
-     * The size of the stack slot used to spill the value of this register.
-     */
-    public final int spillSlotSize;
-
-    /**
-     * The set of {@link RegisterFlag} values associated with this register.
-     */
-    private final int flags;
-
-    /**
-     * An array of {@link CiRegisterValue} objects, for this register, with one entry
-     * per {@link RiKind}, indexed by {@link RiKind#ordinal}.
-     */
-    private final CiRegisterValue[] values;
-
-    /**
-     * Attributes that characterize a register in a useful way.
-     *
-     */
-    public enum RegisterFlag {
-        /**
-         * Denotes an integral (i.e. non floating point) register.
-         */
-        CPU,
-
-        /**
-         * Denotes a register whose lowest order byte can be addressed separately.
-         */
-        Byte,
-
-        /**
-         * Denotes a floating point register.
-         */
-        FPU;
-
-        public final int mask = 1 << (ordinal() + 1);
-    }
-
-    /**
-     * Creates a {@code CiRegister} instance.
-     *
-     * @param number unique identifier for the register
-     * @param encoding the target machine encoding for the register
-     * @param spillSlotSize the size of the stack slot used to spill the value of the register
-     * @param name the mnemonic name for the register
-     * @param flags the set of {@link RegisterFlag} values for the register
-     */
-    public CiRegister(int number, int encoding, int spillSlotSize, String name, RegisterFlag... flags) {
-        this.number = number;
-        this.name = name;
-        this.spillSlotSize = spillSlotSize;
-        this.flags = createMask(flags);
-        this.encoding = encoding;
-
-        values = new CiRegisterValue[RiKind.VALUES.length];
-        for (RiKind kind : RiKind.VALUES) {
-            values[kind.ordinal()] = new CiRegisterValue(kind, this);
-        }
-    }
-
-    private static int createMask(RegisterFlag... flags) {
-        int result = 0;
-        for (RegisterFlag f : flags) {
-            result |= f.mask;
-        }
-        return result;
-    }
-
-    public boolean isSet(RegisterFlag f) {
-        return (flags & f.mask) != 0;
-    }
-
-    /**
-     * Gets this register as a {@linkplain CiRegisterValue value} with a specified kind.
-     * @param kind the specified kind
-     * @return the {@link CiRegisterValue}
-     */
-    public CiRegisterValue asValue(RiKind kind) {
-        return values[kind.ordinal()];
-    }
-
-    /**
-     * Gets this register as a {@linkplain CiRegisterValue value} with no particular kind.
-     * @return a {@link CiRegisterValue} with {@link RiKind#Illegal} kind.
-     */
-    public CiRegisterValue asValue() {
-        return asValue(RiKind.Illegal);
-    }
-
-    /**
-     * Determines if this is a valid register.
-     * @return {@code true} iff this register is valid
-     */
-    public boolean isValid() {
-        return number >= 0;
-    }
-
-    /**
-     * Determines if this a floating point register.
-     */
-    public boolean isFpu() {
-        return isSet(RegisterFlag.FPU);
-    }
-
-    /**
-     * Determines if this a general purpose register.
-     */
-    public boolean isCpu() {
-        return isSet(RegisterFlag.CPU);
-    }
-
-    /**
-     * Determines if this register has the {@link RegisterFlag#Byte} attribute set.
-     * @return {@code true} iff this register has the {@link RegisterFlag#Byte} attribute set.
-     */
-    public boolean isByte() {
-        return isSet(RegisterFlag.Byte);
-    }
-
-    /**
-     * Categorizes a set of registers by {@link RegisterFlag}.
-     *
-     * @param registers a list of registers to be categorized
-     * @return a map from each {@link RegisterFlag} constant to the list of registers for which the flag is
-     *         {@linkplain #isSet(RegisterFlag) set}
-     */
-    public static EnumMap<RegisterFlag, CiRegister[]> categorize(CiRegister[] registers) {
-        EnumMap<RegisterFlag, CiRegister[]> result = new EnumMap<>(RegisterFlag.class);
-        for (RegisterFlag flag : RegisterFlag.values()) {
-            ArrayList<CiRegister> list = new ArrayList<>();
-            for (CiRegister r : registers) {
-                if (r.isSet(flag)) {
-                    list.add(r);
-                }
-            }
-            result.put(flag, list.toArray(new CiRegister[list.size()]));
-        }
-        return result;
-    }
-
-    /**
-     * Gets the maximum register {@linkplain #number number} in a given set of registers.
-     *
-     * @param registers the set of registers to process
-     * @return the maximum register number for any register in {@code registers}
-     */
-    public static int maxRegisterNumber(CiRegister[] registers) {
-        int max = Integer.MIN_VALUE;
-        for (CiRegister r : registers) {
-            if (r.number > max) {
-                max = r.number;
-            }
-        }
-        return max;
-    }
-
-    /**
-     * Gets the maximum register {@linkplain #encoding encoding} in a given set of registers.
-     *
-     * @param registers the set of registers to process
-     * @return the maximum register encoding for any register in {@code registers}
-     */
-    public static int maxRegisterEncoding(CiRegister[] registers) {
-        int max = Integer.MIN_VALUE;
-        for (CiRegister r : registers) {
-            if (r.encoding > max) {
-                max = r.encoding;
-            }
-        }
-        return max;
-    }
-
-    @Override
-    public String toString() {
-        return name;
-    }
-
-    @Override
-    public int compareTo(CiRegister o) {
-        if (number < o.number) {
-            return -1;
-        }
-        if (number > o.number) {
-            return 1;
-        }
-        return 0;
-    }
-
-}
--- a/graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiRegisterAttributes.java	Thu Jun 07 18:41:37 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,95 +0,0 @@
-/*
- * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.max.cri.ci;
-
-import java.util.*;
-
-/**
- * A collection of register attributes. The specific attribute values for a register may be
- * local to a compilation context. For example, a {@link CiRegisterConfig} in use during
- * a compilation will determine which registers are callee saved.
- */
-public class CiRegisterAttributes {
-
-    /**
-     * Denotes a register whose value preservation (if required) across a call is the responsibility of the caller.
-     */
-    public final boolean isCallerSave;
-
-    /**
-     * Denotes a register whose value preservation (if required) across a call is the responsibility of the callee.
-     */
-    public final boolean isCalleeSave;
-
-    /**
-     * Denotes a register that is available for use by a register allocator.
-     */
-    public final boolean isAllocatable;
-
-    /**
-     * Denotes a register guaranteed to be non-zero if read in compiled Java code.
-     * For example, a register dedicated to holding the current thread.
-     */
-    public boolean isNonZero;
-
-    public CiRegisterAttributes(boolean isCallerSave, boolean isCalleeSave, boolean isAllocatable) {
-        this.isCallerSave = isCallerSave;
-        this.isCalleeSave = isCalleeSave;
-        this.isAllocatable = isAllocatable;
-    }
-
-    public static final CiRegisterAttributes NONE = new CiRegisterAttributes(false, false, false);
-
-    /**
-     * Creates a map from register {@linkplain CiRegister#number numbers} to register
-     * {@linkplain CiRegisterAttributes attributes} for a given register configuration and set of
-     * registers.
-     *
-     * @param registerConfig a register configuration
-     * @param registers a set of registers
-     * @return an array whose length is the max register number in {@code registers} plus 1. An element at index i holds
-     *         the attributes of the register whose number is i.
-     */
-    public static CiRegisterAttributes[] createMap(CiRegisterConfig registerConfig, CiRegister[] registers) {
-        CiRegisterAttributes[] map = new CiRegisterAttributes[registers.length];
-        for (CiRegister reg : registers) {
-            if (reg != null) {
-                CiCalleeSaveLayout csl = registerConfig.getCalleeSaveLayout();
-                CiRegisterAttributes attr = new CiRegisterAttributes(
-                                Arrays.asList(registerConfig.getCallerSaveRegisters()).contains(reg),
-                                csl == null ? false : Arrays.asList(csl.registers).contains(reg),
-                                Arrays.asList(registerConfig.getAllocatableRegisters()).contains(reg));
-                if (map.length <= reg.number) {
-                    map = Arrays.copyOf(map, reg.number + 1);
-                }
-                map[reg.number] = attr;
-            }
-        }
-        for (int i = 0; i < map.length; i++) {
-            if (map[i] == null) {
-                map[i] = NONE;
-            }
-        }
-        return map;
-    }
-}
--- a/graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiRegisterConfig.java	Thu Jun 07 18:41:37 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,113 +0,0 @@
-/*
- * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.max.cri.ci;
-
-import java.util.*;
-
-import com.oracle.graal.api.meta.*;
-import com.oracle.max.cri.ci.CiCallingConvention.*;
-import com.oracle.max.cri.ci.CiRegister.*;
-
-/**
- * A register configuration binds roles and {@linkplain CiRegisterAttributes attributes}
- * to physical registers.
- */
-public interface CiRegisterConfig {
-
-    /**
-     * Gets the register to be used for returning a value of a given kind.
-     */
-    CiRegister getReturnRegister(RiKind kind);
-
-    /**
-     * Gets the register to which {@link CiRegister#Frame} and {@link CiRegister#CallerFrame} are bound.
-     */
-    CiRegister getFrameRegister();
-
-    CiRegister getScratchRegister();
-
-    /**
-     * Gets the calling convention describing how arguments are passed.
-     *
-     * @param type the type of calling convention being requested
-     * @param parameters the types of the arguments of the call
-     * @param target the target platform
-     * @param stackOnly ignore registers
-     */
-    CiCallingConvention getCallingConvention(Type type, RiKind[] parameters, CiTarget target, boolean stackOnly);
-
-    /**
-     * Gets the ordered set of registers that are can be used to pass parameters
-     * according to a given calling convention.
-     *
-     * @param type the type of calling convention
-     * @param flag specifies whether registers for {@linkplain RegisterFlag#CPU integral} or
-     *             {@linkplain} RegisterFlag#FPU floating point} parameters are being requested
-     * @return the ordered set of registers that may be used to pass parameters in a call conforming to {@code type}
-     */
-    CiRegister[] getCallingConventionRegisters(Type type, RegisterFlag flag);
-
-    /**
-     * Gets the set of registers that can be used by the register allocator.
-     */
-    CiRegister[] getAllocatableRegisters();
-
-    /**
-     * Gets the set of registers that can be used by the register allocator,
-     * {@linkplain CiRegister#categorize(CiRegister[]) categorized} by register {@linkplain RegisterFlag flags}.
-     *
-     * @return a map from each {@link RegisterFlag} constant to the list of {@linkplain #getAllocatableRegisters()
-     *         allocatable} registers for which the flag is {@linkplain #isSet(RegisterFlag) set}
-     *
-     */
-    EnumMap<RegisterFlag, CiRegister[]> getCategorizedAllocatableRegisters();
-
-    /**
-     * Gets the registers whose values must be preserved by a method across any call it makes.
-     */
-    CiRegister[] getCallerSaveRegisters();
-
-    /**
-     * Gets the layout of the callee save area of this register configuration.
-     *
-     * @return {@code null} if there is no callee save area
-     */
-    CiCalleeSaveLayout getCalleeSaveLayout();
-
-    /**
-     * Gets a map from register {@linkplain CiRegister#number numbers} to register
-     * {@linkplain CiRegisterAttributes attributes} for this register configuration.
-     *
-     * @return an array where an element at index i holds the attributes of the register whose number is i
-     * @see CiRegister#categorize(CiRegister[])
-     */
-    CiRegisterAttributes[] getAttributesMap();
-
-    /**
-     * Gets the register corresponding to a runtime-defined role.
-     *
-     * @param id the identifier of a runtime-defined register role
-     * @return the register playing the role specified by {@code id}
-     */
-    CiRegister getRegisterForRole(int id);
-}
--- a/graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiRegisterConfigImpl.java	Thu Jun 07 18:41:37 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,298 +0,0 @@
-/*
- * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.max.cri.ci;
-
-import java.util.*;
-
-import com.oracle.graal.api.meta.*;
-import com.oracle.max.cri.ci.CiCallingConvention.*;
-import com.oracle.max.cri.ci.CiRegister.*;
-
-/**
- * A default implementation of {@link CiRegisterConfig}.
- */
-public class CiRegisterConfigImpl implements CiRegisterConfig {
-
-    /**
-     * The object describing the callee save area of this register configuration.
-     */
-    public CiCalleeSaveLayout csl;
-
-    /**
-     * The minimum register role identifier.
-     */
-    public final int minRole;
-
-    /**
-     * The map from register role IDs to registers.
-     */
-    public final CiRegister[] registersRoleMap;
-
-    /**
-     * The set of registers that can be used by the register allocator.
-     */
-    public final CiRegister[] allocatable;
-
-    /**
-     * The set of registers that can be used by the register allocator,
-     * {@linkplain CiRegister#categorize(CiRegister[]) categorized} by register
-     * {@linkplain RegisterFlag flags}.
-     */
-    public final EnumMap<RegisterFlag, CiRegister[]> categorized;
-
-    /**
-     * The ordered set of registers used to pass integral arguments.
-     */
-    public final CiRegister[] cpuParameters;
-
-    /**
-     * The ordered set of registers used to pass floating point arguments.
-     */
-    public final CiRegister[] fpuParameters;
-
-    /**
-     * The caller saved registers.
-     */
-    public final CiRegister[] callerSave;
-
-    /**
-     * The register to which {@link CiRegister#Frame} and {@link CiRegister#CallerFrame} are bound.
-     */
-    public final CiRegister frame;
-
-    /**
-     * Register for returning an integral value.
-     */
-    public final CiRegister integralReturn;
-
-    /**
-     * Register for returning a floating point value.
-     */
-    public final CiRegister floatingPointReturn;
-
-    /**
-     * The map from register {@linkplain CiRegister#number numbers} to register
-     * {@linkplain CiRegisterAttributes attributes} for this register configuration.
-     */
-    public final CiRegisterAttributes[] attributesMap;
-
-    /**
-     * The scratch register.
-     */
-    public final CiRegister scratch;
-
-    /**
-     * The frame offset of the first stack argument for each calling convention {@link CiCallingConvention.Type}.
-     */
-    public final int[] stackArg0Offsets = new int[CiCallingConvention.Type.VALUES.length];
-
-    public CiRegisterConfigImpl(
-                    CiRegister frame,
-                    CiRegister integralReturn,
-                    CiRegister floatingPointReturn,
-                    CiRegister scratch,
-                    CiRegister[] allocatable,
-                    CiRegister[] callerSave,
-                    CiRegister[] parameters,
-                    CiCalleeSaveLayout csl,
-                    CiRegister[] allRegisters,
-                    Map<Integer, CiRegister> roles) {
-        this.frame = frame;
-        this.csl = csl;
-        this.allocatable = allocatable;
-        this.callerSave = callerSave;
-        assert !Arrays.asList(allocatable).contains(scratch);
-        this.scratch = scratch;
-        EnumMap<RegisterFlag, CiRegister[]> categorizedParameters = CiRegister.categorize(parameters);
-        this.cpuParameters = categorizedParameters.get(RegisterFlag.CPU);
-        this.fpuParameters = categorizedParameters.get(RegisterFlag.FPU);
-        categorized = CiRegister.categorize(allocatable);
-        attributesMap = CiRegisterAttributes.createMap(this, allRegisters);
-        this.floatingPointReturn = floatingPointReturn;
-        this.integralReturn = integralReturn;
-        int minRoleId = Integer.MAX_VALUE;
-        int maxRoleId = Integer.MIN_VALUE;
-        for (Map.Entry<Integer, CiRegister> e : roles.entrySet()) {
-            int id = e.getKey();
-            assert id >= 0;
-            if (minRoleId > id) {
-                minRoleId = id;
-            }
-            if (maxRoleId < id) {
-                maxRoleId = id;
-            }
-        }
-        registersRoleMap = new CiRegister[(maxRoleId - minRoleId) + 1];
-        for (Map.Entry<Integer, CiRegister> e : roles.entrySet()) {
-            int id = e.getKey();
-            registersRoleMap[id] = e.getValue();
-        }
-        minRole = minRoleId;
-    }
-
-    public CiRegisterConfigImpl(CiRegisterConfigImpl src, CiCalleeSaveLayout csl) {
-        this.frame = src.frame;
-        this.csl = csl;
-        this.allocatable = src.allocatable;
-        this.callerSave = src.callerSave;
-        this.scratch = src.scratch;
-        this.cpuParameters = src.cpuParameters;
-        this.fpuParameters = src.fpuParameters;
-        this.categorized = src.categorized;
-        this.attributesMap = src.attributesMap;
-        this.floatingPointReturn = src.floatingPointReturn;
-        this.integralReturn = src.integralReturn;
-        this.registersRoleMap = src.registersRoleMap;
-        this.minRole = src.minRole;
-        System.arraycopy(src.stackArg0Offsets, 0, stackArg0Offsets, 0, stackArg0Offsets.length);
-    }
-
-    public CiRegister getReturnRegister(RiKind kind) {
-        if (kind.isDouble() || kind.isFloat()) {
-            return floatingPointReturn;
-        }
-        return integralReturn;
-    }
-
-    public CiRegister getFrameRegister() {
-        return frame;
-    }
-
-    public CiRegister getScratchRegister() {
-        return scratch;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * This implementation assigns all available registers to parameters before assigning
-     * any stack slots to parameters.
-     */
-    public CiCallingConvention getCallingConvention(Type type, RiKind[] parameters, CiTarget target, boolean stackOnly) {
-        RiValue[] locations = new RiValue[parameters.length];
-
-        int currentGeneral = 0;
-        int currentXMM = 0;
-        int currentStackOffset = stackArg0Offsets[type.ordinal()];
-
-        for (int i = 0; i < parameters.length; i++) {
-            final RiKind kind = parameters[i];
-
-            switch (kind) {
-                case Byte:
-                case Boolean:
-                case Short:
-                case Char:
-                case Int:
-                case Long:
-                case Object:
-                    if (!stackOnly && currentGeneral < cpuParameters.length) {
-                        CiRegister register = cpuParameters[currentGeneral++];
-                        locations[i] = register.asValue(kind);
-                    }
-                    break;
-
-                case Float:
-                case Double:
-                    if (!stackOnly && currentXMM < fpuParameters.length) {
-                        CiRegister register = fpuParameters[currentXMM++];
-                        locations[i] = register.asValue(kind);
-                    }
-                    break;
-
-                default:
-                    throw new InternalError("Unexpected parameter kind: " + kind);
-            }
-
-            if (locations[i] == null) {
-                locations[i] = CiStackSlot.get(kind.stackKind(), currentStackOffset, !type.out);
-                currentStackOffset += Math.max(target.sizeInBytes(kind), target.wordSize);
-            }
-        }
-
-        return new CiCallingConvention(locations, currentStackOffset);
-    }
-
-    public CiRegister[] getCallingConventionRegisters(Type type, RegisterFlag flag) {
-        if (flag == RegisterFlag.CPU) {
-            return cpuParameters;
-        }
-        assert flag == RegisterFlag.FPU;
-        return fpuParameters;
-    }
-
-    public CiRegister[] getAllocatableRegisters() {
-        return allocatable;
-    }
-
-    public EnumMap<RegisterFlag, CiRegister[]> getCategorizedAllocatableRegisters() {
-        return categorized;
-    }
-
-    public CiRegister[] getCallerSaveRegisters() {
-        return callerSave;
-    }
-
-    public CiCalleeSaveLayout getCalleeSaveLayout() {
-        return csl;
-    }
-
-    public CiRegisterAttributes[] getAttributesMap() {
-        return attributesMap;
-    }
-
-    public CiRegister getRegisterForRole(int id) {
-        return registersRoleMap[id - minRole];
-    }
-
-    @Override
-    public String toString() {
-        StringBuilder roleMap = new StringBuilder();
-        for (int i = 0; i < registersRoleMap.length; ++i) {
-            CiRegister reg = registersRoleMap[i];
-            if (reg != null) {
-                if (roleMap.length() != 0) {
-                    roleMap.append(", ");
-                }
-                roleMap.append(i + minRole).append(" -> ").append(reg);
-            }
-        }
-        StringBuilder stackArg0OffsetsMap = new StringBuilder();
-        for (Type t : Type.VALUES) {
-            if (stackArg0OffsetsMap.length() != 0) {
-                stackArg0OffsetsMap.append(", ");
-            }
-            stackArg0OffsetsMap.append(t).append(" -> ").append(stackArg0Offsets[t.ordinal()]);
-        }
-        String res = String.format(
-             "Allocatable: " + Arrays.toString(getAllocatableRegisters()) + "%n" +
-             "CallerSave:  " + Arrays.toString(getCallerSaveRegisters()) + "%n" +
-             "CalleeSave:  " + getCalleeSaveLayout() + "%n" +
-             "CPU Params:  " + Arrays.toString(cpuParameters) + "%n" +
-             "FPU Params:  " + Arrays.toString(fpuParameters) + "%n" +
-             "VMRoles:     " + roleMap + "%n" +
-             "stackArg0:   " + stackArg0OffsetsMap + "%n" +
-             "Scratch:     " + getScratchRegister() + "%n");
-        return res;
-    }
-}
--- a/graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiRegisterValue.java	Thu Jun 07 18:41:37 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-/*
- * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.max.cri.ci;
-
-import com.oracle.graal.api.meta.*;
-
-/**
- * Denotes a register that stores a value of a fixed kind. There is exactly one (canonical) instance of {@code
- * CiRegisterValue} for each ({@link CiRegister}, {@link RiKind}) pair. Use {@link CiRegister#asValue(RiKind)} to
- * retrieve the canonical {@link CiRegisterValue} instance for a given (register,kind) pair.
- */
-public final class CiRegisterValue extends RiValue {
-    private static final long serialVersionUID = 7999341472196897163L;
-
-    /**
-     * The register.
-     */
-    public final CiRegister reg;
-
-    /**
-     * Should only be called from {@link CiRegister#CiRegister} to ensure canonicalization.
-     */
-    protected CiRegisterValue(RiKind kind, CiRegister register) {
-        super(kind);
-        this.reg = register;
-    }
-
-    @Override
-    public int hashCode() {
-        return (reg.number << 4) ^ kind.ordinal();
-    }
-
-    @Override
-    public String toString() {
-        return reg.name + kindSuffix();
-    }
-}
--- a/graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiRuntimeCall.java	Thu Jun 07 18:41:37 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.max.cri.ci;
-
-import static com.oracle.graal.api.meta.RiKind.*;
-
-import com.oracle.graal.api.meta.*;
-
-/**
- * Enumerates the calls that must be provided by the runtime system. The compiler
- * may generate code that calls the runtime services for unresolved and slow cases of some
- * bytecodes.
- */
-public enum CiRuntimeCall {
-    UnwindException(Void, Object),
-    Deoptimize(Void),
-    RegisterFinalizer(Void, Object),
-    SetDeoptInfo(Void, Object),
-    CreateNullPointerException(Object),
-    CreateOutOfBoundsException(Object, Int),
-    JavaTimeMillis(Long),
-    JavaTimeNanos(Long),
-    Debug(Void),
-    ArithmeticFrem(Float, Float, Float),
-    ArithmeticDrem(Double, Double, Double),
-    ArithmeticCos(Double, Double),
-    ArithmeticTan(Double, Double),
-    ArithmeticSin(Double, Double),
-    GenericCallback(Object, Object, Object);
-
-    public final RiKind resultKind;
-    public final RiKind[] arguments;
-
-    private CiRuntimeCall(RiKind resultKind, RiKind... args) {
-        this.resultKind = resultKind;
-        this.arguments = args;
-    }
-}
--- a/graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiStackSlot.java	Thu Jun 07 18:41:37 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,175 +0,0 @@
-/*
- * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.max.cri.ci;
-
-import static com.oracle.graal.api.meta.RiKind.*;
-
-import com.oracle.graal.api.meta.*;
-
-/**
- * Represents a compiler spill slot or an outgoing stack-based argument in a method's frame
- * or an incoming stack-based argument in a method's {@linkplain #inCallerFrame() caller's frame}.
- */
-public final class CiStackSlot extends RiValue {
-    private static final long serialVersionUID = -7725071921307318433L;
-
-    private final int offset;
-    private final boolean addFrameSize;
-
-    /**
-     * Gets a {@link CiStackSlot} instance representing a stack slot at a given index
-     * holding a value of a given kind.
-     *
-     * @param kind The kind of the value stored in the stack slot.
-     * @param offset The offset of the stack slot (in bytes)
-     * @param inCallerFrame Specifies if the offset is relative to the stack pointer,
-     *        or the beginning of the frame (stack pointer + total frame size).
-     */
-    public static CiStackSlot get(RiKind kind, int offset, boolean addFrameSize) {
-        assert kind.stackKind() == kind;
-        assert addFrameSize || offset >= 0;
-
-        if (offset % CACHE_GRANULARITY == 0) {
-            CiStackSlot[][] cache;
-            int index = offset / CACHE_GRANULARITY;
-            if (!addFrameSize) {
-                cache = OUT_CACHE;
-            } else if (offset >= 0) {
-                cache = IN_CACHE;
-            } else {
-                cache = SPILL_CACHE;
-                index = -index;
-            }
-            CiStackSlot[] slots = cache[kind.ordinal()];
-            if (index < slots.length) {
-                CiStackSlot slot = slots[index];
-                assert slot.kind == kind && slot.offset == offset && slot.addFrameSize == addFrameSize;
-                return slot;
-            }
-        }
-        return new CiStackSlot(kind, offset, addFrameSize);
-    }
-
-    /**
-     * Private constructor to enforce use of {@link #get()} so that a cache can be used.
-     */
-    private CiStackSlot(RiKind kind, int offset, boolean addFrameSize) {
-        super(kind);
-        this.offset = offset;
-        this.addFrameSize = addFrameSize;
-    }
-
-    /**
-     * Gets the offset of this stack slot, relative to the stack pointer.
-     * @return The offset of this slot (in bytes).
-     */
-    public int offset(int totalFrameSize) {
-        assert totalFrameSize > 0 || !addFrameSize;
-        int result = offset + (addFrameSize ? totalFrameSize : 0);
-        assert result >= 0;
-        return result;
-    }
-
-    public boolean inCallerFrame() {
-        return addFrameSize && offset >= 0;
-    }
-
-    public int rawOffset() {
-        return offset;
-    }
-
-    public boolean rawAddFrameSize() {
-        return addFrameSize;
-    }
-
-    @Override
-    public int hashCode() {
-        return kind.ordinal() ^ (offset << 4) ^ (addFrameSize ? 15 : 0);
-    }
-
-    @Override
-    public boolean equals(Object o) {
-        if (o == this) {
-            return true;
-        }
-        if (o instanceof CiStackSlot) {
-            CiStackSlot l = (CiStackSlot) o;
-            return l.kind == kind && l.offset == offset && l.addFrameSize == addFrameSize;
-        }
-        return false;
-    }
-
-    @Override
-    public String toString() {
-        if (!addFrameSize) {
-            return "out:" + offset + kindSuffix();
-        } else if (offset >= 0) {
-            return "in:" + offset + kindSuffix();
-        } else {
-            return "stack:" + (-offset) + kindSuffix();
-        }
-    }
-
-    /**
-     * Gets this stack slot used to pass an argument from the perspective of a caller.
-     */
-    public CiStackSlot asOutArg() {
-        assert offset >= 0;
-        if (addFrameSize) {
-            return get(kind, offset, false);
-        }
-        return this;
-    }
-
-    /**
-     * Gets this stack slot used to pass an argument from the perspective of a callee.
-     */
-    public CiStackSlot asInArg() {
-        assert offset >= 0;
-        if (!addFrameSize) {
-            return get(kind, offset, true);
-        }
-        return this;
-    }
-
-
-    private static final int CACHE_GRANULARITY = 8;
-    private static final int SPILL_CACHE_PER_KIND_SIZE = 100;
-    private static final int PARAM_CACHE_PER_KIND_SIZE = 10;
-
-    private static final CiStackSlot[][] SPILL_CACHE = makeCache(SPILL_CACHE_PER_KIND_SIZE, -1, true);
-    private static final CiStackSlot[][] IN_CACHE = makeCache(PARAM_CACHE_PER_KIND_SIZE, 1, true);
-    private static final CiStackSlot[][] OUT_CACHE = makeCache(PARAM_CACHE_PER_KIND_SIZE, 1, false);
-
-    private static CiStackSlot[][] makeCache(int cachePerKindSize, int sign, boolean addFrameSize) {
-        CiStackSlot[][] cache = new CiStackSlot[RiKind.VALUES.length][];
-        for (RiKind kind : new RiKind[] {Illegal, Int, Long, Float, Double, Object, Jsr}) {
-            CiStackSlot[] slots = new CiStackSlot[cachePerKindSize];
-            for (int i = 0; i < cachePerKindSize; i++) {
-                slots[i] = new CiStackSlot(kind, sign * i * CACHE_GRANULARITY, addFrameSize);
-            }
-            cache[kind.ordinal()] = slots;
-        }
-        return cache;
-    }
-}
--- a/graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiTarget.java	Thu Jun 07 18:41:37 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,159 +0,0 @@
-/*
- * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.max.cri.ci;
-
-import com.oracle.graal.api.meta.*;
-
-
-/**
- * Represents the target machine for a compiler, including the CPU architecture, the size of pointers and references,
- * alignment of stacks, caches, etc.
- */
-public class CiTarget {
-    public final CiArchitecture arch;
-
-    /**
-     * The OS page size.
-     */
-    public final int pageSize;
-
-    /**
-     * Specifies if this is a multi-processor system.
-     */
-    public final boolean isMP;
-
-    /**
-     * Specifies if this target supports encoding objects inline in the machine code.
-     */
-    public final boolean inlineObjects;
-
-    /**
-     * The machine word size on this target.
-     */
-    public final int wordSize;
-
-    /**
-     * The CiKind to be used for representing raw pointers and CPU registers.
-     */
-    public final RiKind wordKind;
-
-    /**
-     * The stack alignment requirement of the platform. For example,
-     * from Appendix D of <a href="http://www.intel.com/Assets/PDF/manual/248966.pdf">Intel 64 and IA-32 Architectures Optimization Reference Manual</a>:
-     * <pre>
-     *     "It is important to ensure that the stack frame is aligned to a
-     *      16-byte boundary upon function entry to keep local __m128 data,
-     *      parameters, and XMM register spill locations aligned throughout
-     *      a function invocation."
-     * </pre>
-     */
-    public final int stackAlignment;
-
-    /**
-     * @see http://docs.sun.com/app/docs/doc/806-0477/6j9r2e2b9?a=view
-     */
-    public final int stackBias;
-
-    /**
-     * The cache alignment.
-     */
-    public final int cacheAlignment;
-
-    /**
-     * Specifies how {@code long} and {@code double} constants are to be stored
-     * in {@linkplain CiFrame frames}. This is useful for VMs such as HotSpot
-     * where convention the interpreter uses is that the second local
-     * holds the first raw word of the native long or double representation.
-     * This is actually reasonable, since locals and stack arrays
-     * grow downwards in all implementations.
-     * If, on some machine, the interpreter's Java locals or stack
-     * were to grow upwards, the embedded doubles would be word-swapped.)
-     */
-    public final boolean debugInfoDoubleWordsInSecondSlot;
-
-    /**
-     * Temporary flag to distinguish between the semantics necessary for HotSpot and Maxine.
-     */
-    // TODO This should go away when XIR goes away, and the logic be part of the VM-specific lowering.
-    public final boolean invokeSnippetAfterArguments;
-
-    public CiTarget(CiArchitecture arch,
-             boolean isMP,
-             int stackAlignment,
-             int pageSize,
-             int cacheAlignment,
-             boolean inlineObjects,
-             boolean debugInfoDoubleWordsInSecondSlot,
-             boolean invokeSnippetAfterArguments) {
-        this.arch = arch;
-        this.pageSize = pageSize;
-        this.isMP = isMP;
-        this.wordSize = arch.wordSize;
-        if (wordSize == 8) {
-            this.wordKind = RiKind.Long;
-        } else {
-            this.wordKind = RiKind.Int;
-        }
-        this.stackAlignment = stackAlignment;
-        this.stackBias = 0; // TODO: configure with param once SPARC port exists
-        this.cacheAlignment = cacheAlignment;
-        this.inlineObjects = inlineObjects;
-        this.debugInfoDoubleWordsInSecondSlot = debugInfoDoubleWordsInSecondSlot;
-        this.invokeSnippetAfterArguments = invokeSnippetAfterArguments;
-    }
-
-    /**
-     * Gets the size in bytes of the specified kind for this target.
-     *
-     * @param kind the kind for which to get the size
-     * @return the size in bytes of {@code kind}
-     */
-    public int sizeInBytes(RiKind kind) {
-        // Checkstyle: stop
-        switch (kind) {
-            case Boolean: return 1;
-            case Byte: return 1;
-            case Char: return 2;
-            case Short: return 2;
-            case Int: return 4;
-            case Long: return 8;
-            case Float: return 4;
-            case Double: return 8;
-            case Object: return wordSize;
-            case Jsr: return 4;
-            default: return 0;
-        }
-        // Checkstyle: resume
-    }
-
-    /**
-     * Aligns the given frame size (without return instruction pointer) to the stack
-     * alignment size and return the aligned size (without return instruction pointer).
-     * @param frameSize the initial frame size to be aligned
-     * @return the aligned frame size
-     */
-    public int alignFrameSize(int frameSize) {
-        int x = frameSize + arch.returnAddressSize + (stackAlignment - 1);
-        return (x / stackAlignment) * stackAlignment - arch.returnAddressSize;
-    }
-}
--- a/graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiTargetMethod.java	Thu Jun 07 18:41:37 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,556 +0,0 @@
-/*
- * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.max.cri.ci;
-
-import java.io.*;
-import java.util.*;
-
-import com.oracle.graal.api.meta.*;
-import com.oracle.max.cri.ri.*;
-
-/**
- * Represents the output from compiling a method, including the compiled machine code, associated data and references,
- * relocation information, deoptimization information, etc. It is the essential component of a {@link CiResult}, which also includes
- * {@linkplain CiStatistics compilation statistics} and {@linkplain CiBailout failure information}.
- */
-public class CiTargetMethod implements Serializable {
-
-    private static final long serialVersionUID = -1319947729753702434L;
-
-    /**
-     * Represents a code position with associated additional information.
-     */
-    public abstract static class Site implements Serializable {
-        private static final long serialVersionUID = -8214214947651979102L;
-        /**
-         * 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;
-        }
-    }
-
-    /**
-     * Represents a safepoint with associated debug info.
-     */
-    public static class Safepoint extends Site implements Comparable<Safepoint> {
-        private static final long serialVersionUID = 2479806696381720162L;
-        public final CiDebugInfo debugInfo;
-
-        Safepoint(int pcOffset, CiDebugInfo debugInfo) {
-            super(pcOffset);
-            this.debugInfo = debugInfo;
-        }
-
-        @Override
-        public String toString() {
-            StringBuilder sb = new StringBuilder();
-            sb.append(pcOffset);
-            sb.append("[<safepoint>]");
-            appendDebugInfo(sb, debugInfo);
-            return sb.toString();
-        }
-
-        @Override
-        public int compareTo(Safepoint o) {
-            if (pcOffset < o.pcOffset) {
-                return -1;
-            } else if (pcOffset > o.pcOffset) {
-                return 1;
-            }
-            return 0;
-        }
-    }
-
-    /**
-     * Represents a call in the code.
-     */
-    public static final class Call extends Safepoint {
-        private static final long serialVersionUID = 1440741241631046954L;
-
-        /**
-         * The target of the call.
-         */
-        public final Object 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;
-
-        Call(Object target, int pcOffset, int size, boolean direct, CiDebugInfo debugInfo) {
-            super(pcOffset, debugInfo);
-            this.size = size;
-            this.target = target;
-            this.direct = direct;
-        }
-
-        @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 a reference to data from the code. The associated data can be any constant.
-     */
-    public static final class DataPatch extends Site {
-        private static final long serialVersionUID = 5771730331604867476L;
-        public final RiConstant constant;
-        public final int alignment;
-
-        DataPatch(int pcOffset, RiConstant data, int alignment) {
-            super(pcOffset);
-            this.constant = data;
-            this.alignment = alignment;
-        }
-
-        @Override
-        public String toString() {
-            return String.format("%d[<data patch referring to data %s>]", pcOffset, constant);
-        }
-    }
-
-    /**
-     * Provides extra information about instructions or data at specific positions in {@link CiTargetMethod#targetCode()}.
-     * This is optional information that can be used to enhance a disassembly of the code.
-     */
-    public abstract static class CodeAnnotation implements Serializable {
-        private static final long serialVersionUID = -7903959680749520748L;
-        public final int position;
-
-        public CodeAnnotation(int position) {
-            this.position = position;
-        }
-    }
-
-    /**
-     * A string comment about one or more instructions at a specific position in the code.
-     */
-    public static final class CodeComment extends CodeAnnotation {
-        /**
-         *
-         */
-        private static final long serialVersionUID = 6802287188701961401L;
-        public final String value;
-        public CodeComment(int position, String comment) {
-            super(position);
-            this.value = comment;
-        }
-
-        @Override
-        public String toString() {
-            return getClass().getSimpleName() + "@" + position + ": " + value;
-        }
-    }
-
-    /**
-     * Labels some inline data in the code.
-     */
-    public static final class InlineData extends CodeAnnotation {
-        private static final long serialVersionUID = 305997507263827108L;
-        public final int size;
-        public InlineData(int position, int size) {
-            super(position);
-            this.size = size;
-        }
-
-        @Override
-        public String toString() {
-            return getClass().getSimpleName() + "@" + position + ": size=" + size;
-        }
-    }
-
-    /**
-     * 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 {
-        private static final long serialVersionUID = 2222194398353801831L;
-
-        /**
-         * 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 String toString() {
-            return getClass().getSimpleName() + "@" + position + ": [" + low + " .. " + high + "]";
-        }
-    }
-
-    /**
-     * Describes a table of key and offset pairs. The offset in each table entry is relative to the address of
-     * the table. This type of table maybe generated when translating a multi-way branch
-     * based on a key value from a sparse value set (e.g. the {@code lookupswitch} JVM instruction).
-     */
-    public static final class LookupTable extends CodeAnnotation {
-        private static final long serialVersionUID = 8367952567559116160L;
-
-        /**
-         * The number of entries in the table.
-         */
-        public final int npairs;
-
-        /**
-         * The size (in bytes) of entry's key.
-         */
-        public final int keySize;
-
-        /**
-         * The size (in bytes) of entry's offset value.
-         */
-        public final int offsetSize;
-
-        public LookupTable(int position, int npairs, int keySize, int offsetSize) {
-            super(position);
-            this.npairs = npairs;
-            this.keySize = keySize;
-            this.offsetSize = offsetSize;
-        }
-
-        @Override
-        public String toString() {
-            return getClass().getSimpleName() + "@" + position + ": [npairs=" + npairs + ", keySize=" + keySize + ", offsetSize=" + offsetSize + "]";
-        }
-    }
-
-    /**
-     * 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 {
-        private static final long serialVersionUID = 4897339464722665281L;
-        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);
-        }
-    }
-
-    public static final class Mark extends Site {
-        private static final long serialVersionUID = 3612943150662354844L;
-        public final Object id;
-        public final Mark[] references;
-
-        Mark(int pcOffset, Object id, Mark[] references) {
-            super(pcOffset);
-            this.id = id;
-            this.references = references;
-        }
-
-        @Override
-        public String toString() {
-            if (id == null) {
-                return String.format("%d[<mark with %d references>]", pcOffset, references.length);
-            } else if (id instanceof Integer) {
-                return String.format("%d[<mark with %d references and id %s>]", pcOffset, references.length, Integer.toHexString((Integer) id));
-            } else {
-                return String.format("%d[<mark with %d references and id %s>]", pcOffset, references.length, id.toString());
-            }
-        }
-    }
-
-    /**
-     * List of safepoints, sorted by {@link Site#pcOffset}.
-     */
-    public final List<Safepoint> safepoints = new ArrayList<>();
-
-    /**
-     * List of data references.
-     */
-    public final List<DataPatch> dataReferences = new ArrayList<>();
-
-    /**
-     * List of exception handlers.
-     */
-    public final List<ExceptionHandler> exceptionHandlers = new ArrayList<>();
-
-    /**
-     * List of marks.
-     */
-    public final List<Mark> marks = new ArrayList<>();
-
-    private int frameSize = -1;
-    private int customStackAreaOffset = -1;
-    private int registerRestoreEpilogueOffset = -1;
-    /**
-     * 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 CiAssumptions assumptions;
-
-    /**
-     * Constructs a new target method.
-     */
-    public CiTargetMethod() {
-    }
-
-    public void setAssumptions(CiAssumptions assumptions) {
-        this.assumptions = assumptions;
-    }
-
-    public CiAssumptions assumptions() {
-        return assumptions;
-    }
-
-    /**
-     * Sets the frame size in bytes. Does not include the return address pushed onto the
-     * stack, if any.
-     *
-     * @param size the size of the frame in bytes
-     */
-    public void setFrameSize(int size) {
-        frameSize = 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) {
-        targetCode = code;
-        targetCodeSize = size;
-    }
-
-    /**
-     * Records a reference to the data section in the code section (e.g. to load an integer or floating point constant).
-     *
-     * @param codePos the position in the code where the data reference occurs
-     * @param data the data that is referenced
-     * @param alignment the alignment requirement of the data or 0 if there is no alignment requirement
-     */
-    public void recordDataReference(int codePos, RiConstant data, int alignment) {
-        assert codePos >= 0 && data != null;
-        dataReferences.add(new DataPatch(codePos, data, alignment));
-    }
-
-    /**
-     * 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 {@link RiRuntime#asCallTarget(Object) target} 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, Object target, CiDebugInfo debugInfo, boolean direct) {
-        final Call call = new Call(target, codePos, size, direct, debugInfo);
-        addSafepoint(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
-     * @param throwableType the type of exceptions handled by the handler
-     */
-    public void recordExceptionHandler(int codePos, int handlerPos) {
-        exceptionHandlers.add(new ExceptionHandler(codePos, handlerPos));
-    }
-
-    /**
-     * Records a safepoint in the code array.
-     *
-     * @param codePos the position of the safepoint in the code array
-     * @param debugInfo the debug info for the safepoint
-     */
-    public void recordSafepoint(int codePos, CiDebugInfo debugInfo) {
-        addSafepoint(new Safepoint(codePos, debugInfo));
-    }
-
-    private void addSafepoint(Safepoint safepoint) {
-        // The safepoints list must always be sorted
-        if (!safepoints.isEmpty() && safepoints.get(safepoints.size() - 1).pcOffset >= safepoint.pcOffset) {
-            // This re-sorting should be very rare
-            Collections.sort(safepoints);
-        }
-        safepoints.add(safepoint);
-    }
-
-    /**
-     * Records an instruction mark within this method.
-     *
-     * @param codePos the position in the code that is covered by the handler
-     * @param id the identifier for this mark
-     * @param references an array of other marks that this mark references
-     */
-    public Mark recordMark(int codePos, Object id, Mark[] references) {
-        Mark mark = new Mark(codePos, id, references);
-        marks.add(mark);
-        return mark;
-    }
-
-    /**
-     * Allows a method to specify the offset of the epilogue that restores the callee saved registers. Must be called
-     * iff the method is a callee saved method and stores callee registers on the stack.
-     *
-     * @param registerRestoreEpilogueOffset the offset in the machine code where the epilogue begins
-     */
-    public void setRegisterRestoreEpilogueOffset(int registerRestoreEpilogueOffset) {
-        assert this.registerRestoreEpilogueOffset == -1;
-        this.registerRestoreEpilogueOffset = registerRestoreEpilogueOffset;
-    }
-
-    /**
-     * The frame size of the method in bytes.
-     *
-     * @return the frame size
-     */
-    public int frameSize() {
-        assert frameSize != -1 : "frame size not yet initialized!";
-        return frameSize;
-    }
-
-    /**
-     * @return the code offset of the start of the epilogue that restores all callee saved registers, or -1 if this is
-     *         not a callee saved method
-     */
-    public int registerRestoreEpilogueOffset() {
-        return registerRestoreEpilogueOffset;
-    }
-
-    /**
-     * Offset in bytes for the custom stack area (relative to sp).
-     * @return the offset in bytes
-     */
-    public int customStackAreaOffset() {
-        return customStackAreaOffset;
-    }
-
-    /**
-     * @see #customStackAreaOffset()
-     * @param offset
-     */
-    public void setCustomStackAreaOffset(int offset) {
-        customStackAreaOffset = offset;
-    }
-
-    /**
-     * @return the machine code generated for this method
-     */
-    public byte[] targetCode() {
-        return targetCode;
-    }
-
-    /**
-     * @return the size of the machine code generated for this method
-     */
-    public int targetCodeSize() {
-        return targetCodeSize;
-    }
-
-    /**
-     * @return the code annotations or {@code null} if there are none
-     */
-    public List<CodeAnnotation> annotations() {
-        return annotations;
-    }
-
-    public void addAnnotation(CodeAnnotation annotation) {
-        assert annotation != null;
-        if (annotations == null) {
-            annotations = new ArrayList<>();
-        }
-        annotations.add(annotation);
-    }
-
-    private static void appendDebugInfo(StringBuilder sb, CiDebugInfo info) {
-        if (info != null) {
-            appendRefMap(sb, "stackMap", info.frameRefMap);
-            appendRefMap(sb, "registerMap", info.registerRefMap);
-            CiCodePos codePos = info.codePos;
-            if (codePos != null) {
-                CiUtil.appendLocation(sb.append(" "), codePos.method, codePos.bci);
-                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);
-                    }
-                }
-            }
-        }
-    }
-
-    private static void appendRefMap(StringBuilder sb, String name, RiBitMap map) {
-        if (map != null) {
-            sb.append(' ').append(name).append('[').append(map.toBinaryString()).append(']');
-        }
-    }
-}
--- a/graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiUtil.java	Thu Jun 07 18:41:37 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,705 +0,0 @@
-/*
- * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.max.cri.ci;
-
-import static java.lang.reflect.Modifier.*;
-
-import java.lang.annotation.*;
-import java.util.*;
-
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.api.meta.RiTypeProfile.*;
-
-/**
- * Miscellaneous collection of utility methods used in the {@code CRI} project.
- */
-public class CiUtil {
-
-    public static final String NEW_LINE = String.format("%n");
-
-    /**
-     * Gets the annotation of a particular type for a formal parameter of a given method.
-     *
-     * @param annotationClass the Class object corresponding to the annotation type
-     * @param parameterIndex the index of a formal parameter of {@code method}
-     * @param method the method for which a parameter annotation is being requested
-     * @return the annotation of type {@code annotationClass} for the formal parameter present, else null
-     * @throws IndexOutOfBoundsException if {@code parameterIndex} does not denote a formal parameter
-     */
-    public static <T extends Annotation> T getParameterAnnotation(Class<T> annotationClass, int parameterIndex, RiResolvedMethod method) {
-        if (parameterIndex >= 0) {
-            Annotation[][] parameterAnnotations = method.getParameterAnnotations();
-            for (Annotation a : parameterAnnotations[parameterIndex]) {
-                if (a.annotationType() == annotationClass) {
-                    return annotationClass.cast(a);
-                }
-            }
-        }
-        return null;
-    }
-
-    public static final int K = 1024;
-    public static final int M = 1024 * 1024;
-
-    public static boolean isOdd(int n) {
-        return (n & 1) == 1;
-    }
-
-    public static boolean isEven(int n) {
-        return (n & 1) == 0;
-    }
-
-    /**
-     * Checks whether the specified integer is a power of two.
-     *
-     * @param val the value to check
-     * @return {@code true} if the value is a power of two; {@code false} otherwise
-     */
-    public static boolean isPowerOf2(int val) {
-        return val != 0 && (val & val - 1) == 0;
-    }
-
-    /**
-     * Checks whether the specified long is a power of two.
-     *
-     * @param val the value to check
-     * @return {@code true} if the value is a power of two; {@code false} otherwise
-     */
-    public static boolean isPowerOf2(long val) {
-        return val != 0 && (val & val - 1) == 0;
-    }
-
-    /**
-     * Computes the log (base 2) of the specified integer, rounding down. (E.g {@code log2(8) = 3}, {@code log2(21) = 4}
-     * )
-     *
-     * @param val the value
-     * @return the log base 2 of the value
-     */
-    public static int log2(int val) {
-        assert val > 0 && isPowerOf2(val);
-        return 31 - Integer.numberOfLeadingZeros(val);
-    }
-
-    /**
-     * Computes the log (base 2) of the specified long, rounding down. (E.g {@code log2(8) = 3}, {@code log2(21) = 4})
-     *
-     * @param val the value
-     * @return the log base 2 of the value
-     */
-    public static int log2(long val) {
-        assert val > 0 && isPowerOf2(val);
-        return 63 - Long.numberOfLeadingZeros(val);
-    }
-
-    public static int align(int size, int align) {
-        assert isPowerOf2(align);
-        return (size + align - 1) & ~(align - 1);
-    }
-
-    /**
-     * Gets a word with the nth bit set.
-     *
-     * @param n the nth bit to set
-     * @return an integer value with the nth bit set
-     */
-    public static int nthBit(int n) {
-        return n >= Integer.SIZE ? 0 : 1 << n;
-    }
-
-    /**
-     * Gets a word with the right-most n bits set.
-     *
-     * @param n the number of right most bits to set
-     * @return an integer value with the right-most n bits set
-     */
-    public static int rightNBits(int n) {
-        return nthBit(n) - 1;
-    }
-
-    /**
-     * Gets a string for a given method formatted according to a given format specification. A format specification is
-     * composed of characters that are to be copied verbatim to the result and specifiers that denote an attribute of
-     * the method that is to be copied to the result. A specifier is a single character preceded by a '%' character. The
-     * accepted specifiers and the method attributes they denote are described below:
-     *
-     * <pre>
-     *     Specifier | Description                                          | Example(s)
-     *     ----------+------------------------------------------------------------------------------------------
-     *     'R'       | Qualified return type                                | "int" "java.lang.String"
-     *     'r'       | Unqualified return type                              | "int" "String"
-     *     'H'       | Qualified holder                                     | "java.util.Map.Entry"
-     *     'h'       | Unqualified holder                                   | "Entry"
-     *     'n'       | Method name                                          | "add"
-     *     'P'       | Qualified parameter types, separated by ', '         | "int, java.lang.String"
-     *     'p'       | Unqualified parameter types, separated by ', '       | "int, String"
-     *     'f'       | Indicator if method is unresolved, static or virtual | "unresolved" "static" "virtual"
-     *     '%'       | A '%' character                                      | "%"
-     * </pre>
-     *
-     * @param format a format specification
-     * @param method the method to be formatted
-     * @param kinds if {@code true} then the types in {@code method}'s signature are printed in the
-     *            {@linkplain RiKind#jniName JNI} form of their {@linkplain RiKind kind}
-     * @return the result of formatting this method according to {@code format}
-     * @throws IllegalFormatException if an illegal specifier is encountered in {@code format}
-     */
-    public static String format(String format, RiMethod method) throws IllegalFormatException {
-        final StringBuilder sb = new StringBuilder();
-        int index = 0;
-        RiSignature sig = null;
-        while (index < format.length()) {
-            final char ch = format.charAt(index++);
-            if (ch == '%') {
-                if (index >= format.length()) {
-                    throw new UnknownFormatConversionException("An unquoted '%' character cannot terminate a method format specification");
-                }
-                final char specifier = format.charAt(index++);
-                boolean qualified = false;
-                switch (specifier) {
-                    case 'R':
-                        qualified = true;
-                        // fall through
-                    case 'r': {
-                        if (sig == null) {
-                            sig = method.signature();
-                        }
-                        sb.append(RiUtil.toJavaName(sig.returnType(null), qualified));
-                        break;
-                    }
-                    case 'H':
-                        qualified = true;
-                        // fall through
-                    case 'h': {
-                        sb.append(RiUtil.toJavaName(method.holder(), qualified));
-                        break;
-                    }
-                    case 'n': {
-                        sb.append(method.name());
-                        break;
-                    }
-                    case 'P':
-                        qualified = true;
-                        // fall through
-                    case 'p': {
-                        if (sig == null) {
-                            sig = method.signature();
-                        }
-                        for (int i = 0; i < sig.argumentCount(false); i++) {
-                            if (i != 0) {
-                                sb.append(", ");
-                            }
-                            sb.append(RiUtil.toJavaName(sig.argumentTypeAt(i, null), qualified));
-                        }
-                        break;
-                    }
-                    case 'f': {
-                        sb.append(!(method instanceof RiResolvedMethod) ? "unresolved" : isStatic(((RiResolvedMethod) method).accessFlags()) ? "static" : "virtual");
-                        break;
-                    }
-                    case '%': {
-                        sb.append('%');
-                        break;
-                    }
-                    default: {
-                        throw new UnknownFormatConversionException(String.valueOf(specifier));
-                    }
-                }
-            } else {
-                sb.append(ch);
-            }
-        }
-        return sb.toString();
-    }
-
-    /**
-     * Gets a string for a given field formatted according to a given format specification. A format specification is
-     * composed of characters that are to be copied verbatim to the result and specifiers that denote an attribute of
-     * the field that is to be copied to the result. A specifier is a single character preceded by a '%' character. The
-     * accepted specifiers and the field attributes they denote are described below:
-     *
-     * <pre>
-     *     Specifier | Description                                          | Example(s)
-     *     ----------+------------------------------------------------------------------------------------------
-     *     'T'       | Qualified type                                       | "int" "java.lang.String"
-     *     't'       | Unqualified type                                     | "int" "String"
-     *     'H'       | Qualified holder                                     | "java.util.Map.Entry"
-     *     'h'       | Unqualified holder                                   | "Entry"
-     *     'n'       | Field name                                           | "age"
-     *     'f'       | Indicator if field is unresolved, static or instance | "unresolved" "static" "instance"
-     *     '%'       | A '%' character                                      | "%"
-     * </pre>
-     *
-     * @param format a format specification
-     * @param field the field to be formatted
-     * @param kinds if {@code true} then {@code field}'s type is printed in the {@linkplain RiKind#jniName JNI} form of
-     *            its {@linkplain RiKind kind}
-     * @return the result of formatting this field according to {@code format}
-     * @throws IllegalFormatException if an illegal specifier is encountered in {@code format}
-     */
-    public static String format(String format, RiField field) throws IllegalFormatException {
-        final StringBuilder sb = new StringBuilder();
-        int index = 0;
-        RiType type = field.type();
-        while (index < format.length()) {
-            final char ch = format.charAt(index++);
-            if (ch == '%') {
-                if (index >= format.length()) {
-                    throw new UnknownFormatConversionException("An unquoted '%' character cannot terminate a field format specification");
-                }
-                final char specifier = format.charAt(index++);
-                boolean qualified = false;
-                switch (specifier) {
-                    case 'T':
-                        qualified = true;
-                        // fall through
-                    case 't': {
-                        sb.append(RiUtil.toJavaName(type, qualified));
-                        break;
-                    }
-                    case 'H':
-                        qualified = true;
-                        // fall through
-                    case 'h': {
-                        sb.append(RiUtil.toJavaName(field.holder(), qualified));
-                        break;
-                    }
-                    case 'n': {
-                        sb.append(field.name());
-                        break;
-                    }
-                    case 'f': {
-                        sb.append(!(field instanceof RiResolvedField) ? "unresolved" : isStatic(((RiResolvedField) field).accessFlags()) ? "static" : "instance");
-                        break;
-                    }
-                    case '%': {
-                        sb.append('%');
-                        break;
-                    }
-                    default: {
-                        throw new UnknownFormatConversionException(String.valueOf(specifier));
-                    }
-                }
-            } else {
-                sb.append(ch);
-            }
-        }
-        return sb.toString();
-    }
-
-    /**
-     * Converts a Java source-language class name into the internal form.
-     *
-     * @param className the class name
-     * @return the internal name form of the class name
-     */
-    public static String toInternalName(String className) {
-        return "L" + className.replace('.', '/') + ";";
-    }
-
-    /**
-     * Creates a set that uses reference-equality instead of {@link Object#equals(Object)} when comparing values.
-     *
-     * @param <T> the type of elements in the set
-     * @return a set based on reference-equality
-     */
-    public static <T> Set<T> newIdentityHashSet() {
-        return Collections.newSetFromMap(new IdentityHashMap<T, Boolean>());
-    }
-
-    /**
-     * Prepends the String {@code indentation} to every line in String {@code lines}, including a possibly non-empty
-     * line following the final newline.
-     */
-    public static String indent(String lines, String indentation) {
-        if (lines.length() == 0) {
-            return lines;
-        }
-        final String newLine = "\n";
-        if (lines.endsWith(newLine)) {
-            return indentation + (lines.substring(0, lines.length() - 1)).replace(newLine, newLine + indentation) + newLine;
-        }
-        return indentation + lines.replace(newLine, newLine + indentation);
-    }
-
-    /**
-     * Formats the values in a frame as a tabulated string.
-     *
-     * @param frame
-     * @return the values in {@code frame} as a tabulated string
-     */
-    public static String tabulateValues(CiFrame frame) {
-        int cols = Math.max(frame.numLocals, Math.max(frame.numStack, frame.numLocks));
-        assert cols > 0;
-        ArrayList<Object> cells = new ArrayList<>();
-        cells.add("");
-        for (int i = 0; i < cols; i++) {
-            cells.add(i);
-        }
-        cols++;
-        if (frame.numLocals != 0) {
-            cells.add("locals:");
-            cells.addAll(Arrays.asList(frame.values).subList(0, frame.numLocals));
-            cells.addAll(Collections.nCopies(cols - frame.numLocals - 1, ""));
-        }
-        if (frame.numStack != 0) {
-            cells.add("stack:");
-            cells.addAll(Arrays.asList(frame.values).subList(frame.numLocals, frame.numLocals + frame.numStack));
-            cells.addAll(Collections.nCopies(cols - frame.numStack - 1, ""));
-        }
-        if (frame.numLocks != 0) {
-            cells.add("locks:");
-            cells.addAll(Arrays.asList(frame.values).subList(frame.numLocals + frame.numStack, frame.values.length));
-            cells.addAll(Collections.nCopies(cols - frame.numLocks - 1, ""));
-        }
-        Object[] cellArray = cells.toArray();
-        for (int i = 0; i < cellArray.length; i++) {
-            if ((i % cols) != 0) {
-                cellArray[i] = "|" + cellArray[i];
-            }
-        }
-        return CiUtil.tabulate(cellArray, cols, 1, 1);
-    }
-
-    /**
-     * Formats a given table as a string. The value of each cell is produced by {@link String#valueOf(Object)}.
-     *
-     * @param cells the cells of the table in row-major order
-     * @param cols the number of columns per row
-     * @param lpad the number of space padding inserted before each formatted cell value
-     * @param rpad the number of space padding inserted after each formatted cell value
-     * @return a string with one line per row and each column left-aligned
-     */
-    public static String tabulate(Object[] cells, int cols, int lpad, int rpad) {
-        int rows = (cells.length + (cols - 1)) / cols;
-        int[] colWidths = new int[cols];
-        for (int col = 0; col < cols; col++) {
-            for (int row = 0; row < rows; row++) {
-                int index = col + (row * cols);
-                if (index < cells.length) {
-                    Object cell = cells[index];
-                    colWidths[col] = Math.max(colWidths[col], String.valueOf(cell).length());
-                }
-            }
-        }
-        StringBuilder sb = new StringBuilder();
-        String nl = NEW_LINE;
-        for (int row = 0; row < rows; row++) {
-            for (int col = 0; col < cols; col++) {
-                int index = col + (row * cols);
-                if (index < cells.length) {
-                    for (int i = 0; i < lpad; i++) {
-                        sb.append(' ');
-                    }
-                    Object cell = cells[index];
-                    String s = String.valueOf(cell);
-                    int w = s.length();
-                    sb.append(s);
-                    while (w < colWidths[col]) {
-                        sb.append(' ');
-                        w++;
-                    }
-                    for (int i = 0; i < rpad; i++) {
-                        sb.append(' ');
-                    }
-                }
-            }
-            sb.append(nl);
-        }
-        return sb.toString();
-    }
-
-    /**
-     * Convenient shortcut for calling {@link #appendLocation(StringBuilder, RiMethod, int)} without having to supply a
-     * a {@link StringBuilder} instance and convert the result to a string.
-     */
-    public static String toLocation(RiResolvedMethod method, int bci) {
-        return appendLocation(new StringBuilder(), method, bci).toString();
-    }
-
-    /**
-     * Appends a string representation of a location specified by a given method and bci to a given
-     * {@link StringBuilder}. If a stack trace element with a non-null file name and non-negative line number is
-     * {@linkplain RiMethod#toStackTraceElement(int) available} for the given method, then the string returned is the
-     * {@link StackTraceElement#toString()} value of the stack trace element, suffixed by the bci location. For example:
-     *
-     * <pre>
-     *     java.lang.String.valueOf(String.java:2930) [bci: 12]
-     * </pre>
-     *
-     * Otherwise, the string returned is the value of {@code CiUtil.format("%H.%n(%p)"}, suffixed by the bci location.
-     * For example:
-     *
-     * <pre>
-     *     java.lang.String.valueOf(int) [bci: 12]
-     * </pre>
-     *
-     * @param sb
-     * @param method
-     * @param bci
-     * @return
-     */
-    public static StringBuilder appendLocation(StringBuilder sb, RiResolvedMethod method, int bci) {
-        if (method != null) {
-            StackTraceElement ste = method.toStackTraceElement(bci);
-            if (ste.getFileName() != null && ste.getLineNumber() > 0) {
-                sb.append(ste);
-            } else {
-                sb.append(CiUtil.format("%H.%n(%p)", method));
-            }
-        } else {
-            sb.append("Null method");
-        }
-        return sb.append(" [bci: ").append(bci).append(']');
-    }
-
-    /**
-     * Appends a formatted code position to a {@link StringBuilder}.
-     *
-     * @param sb the {@link StringBuilder} to append to
-     * @param pos the code position to format and append to {@code sb}
-     * @return the value of {@code sb}
-     */
-    public static StringBuilder append(StringBuilder sb, CiCodePos pos) {
-        appendLocation(sb.append("at "), pos.method, pos.bci);
-        if (pos.caller != null) {
-            sb.append(NEW_LINE);
-            append(sb, pos.caller);
-        }
-        return sb;
-    }
-
-    /**
-     * Appends a formatted frame to a {@link StringBuilder}.
-     *
-     * @param sb the {@link StringBuilder} to append to
-     * @param frame the frame to format and append to {@code sb}
-     * @return the value of {@code sb}
-     */
-    public static StringBuilder append(StringBuilder sb, CiFrame frame) {
-        appendLocation(sb.append("at "), frame.method, frame.bci);
-        if (frame.values != null && frame.values.length > 0) {
-            sb.append(NEW_LINE);
-            String table = tabulateValues(frame);
-            String[] rows = table.split(NEW_LINE);
-            for (int i = 0; i < rows.length; i++) {
-                String row = rows[i];
-                if (!row.trim().isEmpty()) {
-                    sb.append("  ").append(row);
-                    if (i != rows.length - 1) {
-                        sb.append(NEW_LINE);
-                    }
-                }
-            }
-        }
-        if (frame.caller() != null) {
-            sb.append(NEW_LINE);
-            append(sb, frame.caller());
-        } else if (frame.caller != null) {
-            sb.append(NEW_LINE);
-            append(sb, frame.caller);
-        }
-        return sb;
-    }
-
-    /**
-     * Formats a location present in a register or frame reference map.
-     */
-    public static class RefMapFormatter {
-
-        /**
-         * The size of a stack slot.
-         */
-        public final int slotSize;
-
-        /**
-         * The register used as the frame pointer.
-         */
-        public final CiRegister fp;
-
-        public final CiArchitecture arch;
-
-        /**
-         * The offset (in bytes) from the slot pointed to by {@link #fp} to the slot corresponding to bit 0 in the frame
-         * reference map.
-         */
-        public final int refMapToFPOffset;
-
-        public RefMapFormatter(CiArchitecture arch, int slotSize, CiRegister fp, int refMapToFPOffset) {
-            this.arch = arch;
-            this.slotSize = slotSize;
-            this.fp = fp;
-            this.refMapToFPOffset = refMapToFPOffset;
-        }
-
-        public String formatStackSlot(int frameRefMapIndex) {
-            int refMapOffset = frameRefMapIndex * slotSize;
-            int fpOffset = refMapOffset + refMapToFPOffset;
-            if (fpOffset >= 0) {
-                return fp + "+" + fpOffset;
-            }
-            return fp.name + fpOffset;
-        }
-
-        public String formatRegister(int regRefMapIndex) {
-            return arch.registers[regRefMapIndex].toString();
-        }
-    }
-
-    /**
-     * Appends a formatted debug info to a {@link StringBuilder}.
-     *
-     * @param sb the {@link StringBuilder} to append to
-     * @param info the debug info to format and append to {@code sb}
-     * @return the value of {@code sb}
-     */
-    public static StringBuilder append(StringBuilder sb, CiDebugInfo info, RefMapFormatter formatter) {
-        String nl = NEW_LINE;
-        if (info.hasRegisterRefMap()) {
-            sb.append("  reg-ref-map:");
-            RiBitMap bm = info.registerRefMap;
-            if (formatter != null) {
-                for (int reg = bm.nextSetBit(0); reg >= 0; reg = bm.nextSetBit(reg + 1)) {
-                    sb.append(" " + formatter.formatRegister(reg));
-                }
-            }
-            sb.append(' ').append(bm).append(nl);
-        }
-        if (info.hasStackRefMap()) {
-            sb.append("frame-ref-map:");
-            RiBitMap bm = info.frameRefMap;
-            if (formatter != null) {
-                for (int i = bm.nextSetBit(0); i >= 0; i = bm.nextSetBit(i + 1)) {
-                    sb.append(" " + formatter.formatStackSlot(i));
-                }
-            }
-            sb.append(' ').append(bm).append(nl);
-        }
-        CiFrame frame = info.frame();
-        if (frame != null) {
-            append(sb, frame);
-        } else if (info.codePos != null) {
-            append(sb, info.codePos);
-        }
-        return sb;
-    }
-
-    public static RiKind[] signatureToKinds(RiResolvedMethod method) {
-        RiKind receiver = isStatic(method.accessFlags()) ? null : method.holder().kind(true);
-        return signatureToKinds(method.signature(), receiver);
-    }
-
-    public static RiKind[] signatureToKinds(RiSignature signature, RiKind receiverKind) {
-        int args = signature.argumentCount(false);
-        RiKind[] result;
-        int i = 0;
-        if (receiverKind != null) {
-            result = new RiKind[args + 1];
-            result[0] = receiverKind;
-            i = 1;
-        } else {
-            result = new RiKind[args];
-        }
-        for (int j = 0; j < args; j++) {
-            result[i + j] = signature.argumentKindAt(j, true);
-        }
-        return result;
-    }
-
-    public static Class< ? >[] signatureToTypes(RiSignature signature, RiResolvedType accessingClass) {
-        int count = signature.argumentCount(false);
-        Class< ? >[] result = new Class< ? >[count];
-        for (int i = 0; i < result.length; ++i) {
-            result[i] = signature.argumentTypeAt(i, accessingClass).resolve(accessingClass).toJava();
-        }
-        return result;
-    }
-
-    /**
-     * Formats some profiling information associated as a string.
-     *
-     * @param info the profiling info to format
-     * @param method an optional method that augments the profile string returned
-     * @param sep the separator to use for each separate profile record
-     */
-    public static String profileToString(RiProfilingInfo info, RiResolvedMethod method, String sep) {
-        StringBuilder buf = new StringBuilder(100);
-        if (method != null) {
-            buf.append(String.format("canBeStaticallyBound: %b%s", method.canBeStaticallyBound(), sep)).
-            append(String.format("invocationCount: %d%s", method.invocationCount(), sep));
-        }
-        for (int i = 0; i < info.codeSize(); i++) {
-            if (info.getExecutionCount(i) != -1) {
-                buf.append(String.format("executionCount@%d: %d%s", i, info.getExecutionCount(i), sep));
-            }
-
-            if (info.getBranchTakenProbability(i) != -1) {
-                buf.append(String.format("branchProbability@%d: %.3f%s", i, info.getBranchTakenProbability(i), sep));
-            }
-
-            double[] switchProbabilities = info.getSwitchProbabilities(i);
-            if (switchProbabilities != null) {
-                buf.append(String.format("switchProbabilities@%d:", i));
-                for (int j = 0; j < switchProbabilities.length; j++) {
-                    buf.append(String.format(" %.3f", switchProbabilities[j]));
-                }
-                buf.append(sep);
-            }
-
-            if (info.getExceptionSeen(i) != RiExceptionSeen.FALSE) {
-                buf.append(String.format("exceptionSeen@%d: %s%s", i, info.getExceptionSeen(i).name(), sep));
-            }
-
-            RiTypeProfile typeProfile = info.getTypeProfile(i);
-            if (typeProfile != null) {
-                ProfiledType[] ptypes = typeProfile.getTypes();
-                if (ptypes != null) {
-                    buf.append(String.format("types@%d:", i));
-                    for (int j = 0; j < ptypes.length; j++) {
-                        ProfiledType ptype = ptypes[j];
-                        buf.append(String.format(" %.3f (%s)%s", ptype.probability, ptype.type, sep));
-                    }
-                    buf.append(String.format(" %.3f <not recorded>%s", typeProfile.getNotRecordedProbability(), sep));
-                }
-            }
-        }
-
-        boolean firstDeoptReason = true;
-        for (RiDeoptReason reason: RiDeoptReason.values()) {
-            int count = info.getDeoptimizationCount(reason);
-            if (count > 0) {
-                if (firstDeoptReason) {
-                    buf.append("deoptimization history").append(sep);
-                    firstDeoptReason = false;
-                }
-                buf.append(String.format(" %s: %d%s", reason.name(), count, sep));
-            }
-        }
-        if (buf.length() == 0) {
-            return "";
-        }
-        String s = buf.toString();
-        assert s.endsWith(sep);
-        return s.substring(0, s.length() - sep.length());
-    }
-}
--- a/graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiValueUtil.java	Thu Jun 07 18:41:37 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,130 +0,0 @@
-/*
- * Copyright (c) 2012, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.max.cri.ci;
-
-import com.oracle.graal.api.meta.*;
-
-public class CiValueUtil {
-    public static boolean isIllegal(RiValue value) {
-        assert value != null;
-        return value == RiValue.IllegalValue;
-    }
-
-    public static boolean isLegal(RiValue value) {
-        return !isIllegal(value);
-    }
-
-    public static boolean isVirtualObject(RiValue value) {
-        assert value != null;
-        return value instanceof CiVirtualObject;
-    }
-
-    public static CiVirtualObject asVirtualObject(RiValue value) {
-        assert value != null;
-        return (CiVirtualObject) value;
-    }
-
-    public static boolean isConstant(RiValue value) {
-        assert value != null;
-        return value instanceof RiConstant;
-    }
-
-    public static RiConstant asConstant(RiValue value) {
-        assert value != null;
-        return (RiConstant) value;
-    }
-
-
-    public static boolean isStackSlot(RiValue value) {
-        assert value != null;
-        return value instanceof CiStackSlot;
-    }
-
-    public static CiStackSlot asStackSlot(RiValue value) {
-        assert value != null;
-        return (CiStackSlot) value;
-    }
-
-    public static boolean isAddress(RiValue value) {
-        assert value != null;
-        return value instanceof CiAddress;
-    }
-
-    public static CiAddress asAddress(RiValue value) {
-        assert value != null;
-        return (CiAddress) value;
-    }
-
-
-    public static boolean isRegister(RiValue value) {
-        assert value != null;
-        return value instanceof CiRegisterValue;
-    }
-
-    public static CiRegister asRegister(RiValue value) {
-        assert value != null;
-        return ((CiRegisterValue) value).reg;
-    }
-
-    public static CiRegister asIntReg(RiValue value) {
-        assert value.kind == RiKind.Int || value.kind == RiKind.Jsr;
-        return asRegister(value);
-    }
-
-    public static CiRegister asLongReg(RiValue value) {
-        assert value.kind == RiKind.Long : value.kind;
-        return asRegister(value);
-    }
-
-    public static CiRegister asObjectReg(RiValue value) {
-        assert value.kind == RiKind.Object;
-        return asRegister(value);
-    }
-
-    public static CiRegister asFloatReg(RiValue value) {
-        assert value.kind == RiKind.Float;
-        return asRegister(value);
-    }
-
-    public static CiRegister asDoubleReg(RiValue value) {
-        assert value.kind == RiKind.Double;
-        return asRegister(value);
-    }
-
-
-    public static boolean sameRegister(RiValue v1, RiValue v2) {
-        return isRegister(v1) && isRegister(v2) && asRegister(v1) == asRegister(v2);
-    }
-
-    public static boolean sameRegister(RiValue v1, RiValue v2, RiValue v3) {
-        return sameRegister(v1, v2) && sameRegister(v1, v3);
-    }
-
-    public static boolean differentRegisters(RiValue v1, RiValue v2) {
-        return !isRegister(v1) || !isRegister(v2) || asRegister(v1) != asRegister(v2);
-    }
-
-    public static boolean differentRegisters(RiValue v1, RiValue v2, RiValue v3) {
-        return differentRegisters(v1, v2) && differentRegisters(v1, v3) && differentRegisters(v2, v3);
-    }
-}
--- a/graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiVirtualObject.java	Thu Jun 07 18:41:37 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,165 +0,0 @@
-/*
- * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.max.cri.ci;
-
-import com.oracle.graal.api.meta.*;
-import com.oracle.max.cri.ri.*;
-
-/**
- * An instance of this class represents an object whose allocation was removed by escape analysis. The information stored in the {@link CiVirtualObject} is used during
- * deoptimization to recreate the object.
- */
-public final class CiVirtualObject extends RiValue {
-    private static final long serialVersionUID = -2907197776426346021L;
-
-    private final RiType type;
-    private RiValue[] values;
-    private final int id;
-
-    /**
-     * Creates a new CiVirtualObject for the given type, with the given fields. If the type is an instance class then the values array needs to have one entry for each field, ordered in
-     * like the fields returned by {@link RiResolvedType#declaredFields()}. If the type is an array then the length of the values array determines the reallocated array length.
-     * @param type the type of the object whose allocation was removed during compilation. This can be either an instance of an array type.
-     * @param values an array containing all the values to be stored into the object when it is recreated.
-     * @param id a unique id that identifies the object within the debug information for one position in the compiled code.
-     * @return a new CiVirtualObject instance.
-     */
-    public static CiVirtualObject get(RiType type, RiValue[] values, int id) {
-        return new CiVirtualObject(type, values, id);
-    }
-
-    private CiVirtualObject(RiType type, RiValue[] values, int id) {
-        super(RiKind.Object);
-        this.type = type;
-        this.values = values;
-        this.id = id;
-    }
-
-    @Override
-    public String toString() {
-        return "vobject:" + id;
-    }
-
-    /**
-     * @return the type of the object whose allocation was removed during compilation. This can be either an instance of an array type.
-     */
-    public RiType type() {
-        return type;
-    }
-
-    /**
-     * @return an array containing all the values to be stored into the object when it is recreated.
-     */
-    public RiValue[] values() {
-        return values;
-    }
-
-    /**
-     * @return the unique id that identifies the object within the debug information for one position in the compiled code.
-     */
-    public int id() {
-        return id;
-    }
-
-    /**
-     * Overwrites the current set of values with a new one.
-     * @param values an array containing all the values to be stored into the object when it is recreated.
-     */
-    public void setValues(RiValue[] values) {
-        this.values = values;
-    }
-
-    @Override
-    public int hashCode() {
-        return kind.ordinal() + type.hashCode();
-    }
-
-    @Override
-    public boolean equals(Object o) {
-        if (o == this) {
-            return true;
-        }
-        if (o instanceof CiVirtualObject) {
-            CiVirtualObject l = (CiVirtualObject) o;
-            if (l.type != type || l.values.length != values.length) {
-                return false;
-            }
-            for (int i = 0; i < values.length; i++) {
-                if (values[i] != l.values[i]) {
-                    return false;
-                }
-            }
-            return true;
-        }
-        return false;
-    }
-
-    /**
-     * This is a helper class used to create virtual objects for a number of different JDK classes.
-     */
-    public static class CiVirtualObjectFactory {
-        private int nextId = 0;
-        private final RiRuntime runtime;
-
-        public CiVirtualObjectFactory(RiRuntime runtime) {
-            this.runtime = runtime;
-        }
-
-        public CiVirtualObject constantProxy(RiKind kind, RiValue objectValue, RiValue primitiveValue) {
-            RiConstant cKind = RiConstant.forObject(kind);
-            // TODO: here the ordering is hard coded... we should query RiType.fields() and act accordingly
-            return new CiVirtualObject(runtime.getType(RiConstant.class), new RiValue[] {cKind, primitiveValue, RiValue.IllegalValue, objectValue}, nextId++);
-        }
-
-        public RiValue proxy(RiValue ciValue) {
-            switch (ciValue.kind) {
-                case Boolean:
-                    return new CiVirtualObject(runtime.getType(Boolean.class), new RiValue[] {ciValue}, nextId++);
-                case Byte:
-                    return new CiVirtualObject(runtime.getType(Byte.class), new RiValue[] {ciValue}, nextId++);
-                case Char:
-                    return new CiVirtualObject(runtime.getType(Character.class), new RiValue[] {ciValue}, nextId++);
-                case Double:
-                    return new CiVirtualObject(runtime.getType(Double.class), new RiValue[] {ciValue, RiValue.IllegalValue}, nextId++);
-                case Float:
-                    return new CiVirtualObject(runtime.getType(Float.class), new RiValue[] {ciValue}, nextId++);
-                case Int:
-                    return new CiVirtualObject(runtime.getType(Integer.class), new RiValue[] {ciValue}, nextId++);
-                case Long:
-                    return new CiVirtualObject(runtime.getType(Long.class), new RiValue[] {ciValue, RiValue.IllegalValue}, nextId++);
-                case Object:
-                    return ciValue;
-                case Short:
-                    return new CiVirtualObject(runtime.getType(Short.class), new RiValue[] {ciValue}, nextId++);
-                default:
-                    assert false : ciValue.kind;
-                    return null;
-            }
-        }
-
-        public CiVirtualObject arrayProxy(RiType arrayType, RiValue[] values) {
-            return new CiVirtualObject(arrayType, values, nextId++);
-        }
-
-    }
-}
--- a/graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/package-info.java	Thu Jun 07 18:41:37 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/**
- * The compiler-provided part of the bi-directional interface between the compiler and the runtime system of a virtual machine for the instruction set defined in
- * {@link com.oracle.graal.compiler.graphbuilder.Bytecodes}.
- *
- * The target hardware architecture is represented by {@link com.oracle.max.cri.ci.CiArchitecture} and the specific target machine
- * environment for a compiler instance is represented by {@link com.oracle.max.cri.ci.CiTarget}.
- * <p>
- * A {@code CiResult} encapsulates
- * {@linkplain com.oracle.max.cri.ci.CiStatistics compilation statistics}, possible {@linkplain com.oracle.max.cri.ci.CiBailout error state}
- * and the {@linkplain com.oracle.max.cri.ci.CiTargetMethod compiled code and metadata}.
- * {@link com.oracle.max.cri.ci.CiCodePos} and {@link com.oracle.max.cri.ci.CiDebugInfo} provide detailed information to the
- * runtime to support debugging and deoptimization of the compiled code.
- * <p>
- * The compiler manipulates {@link com.oracle.graal.api.meta.RiValue} instances that have a {@link com.oracle.graal.api.meta.RiKind}, and are
- * immutable. A concrete {@link com.oracle.graal.api.meta.RiValue value} is one of the following subclasses:
- * <ul>
- * <li>{@link com.oracle.graal.api.meta.RiConstant}: a constant value.
- * <li>{@link com.oracle.max.cri.ci.CiRegisterValue}: a value stored in a {@linkplain com.oracle.max.cri.ci.CiRegister target machine register}.
- * <li>{@link com.oracle.max.cri.ci.CiStackSlot}: a spill slot or an outgoing stack-based argument in a method's frame.
- * <li>{@link com.oracle.max.cri.ci.CiAddress}: an address in target machine memory.
- * <li>{@link com.oracle.graal.compiler.lir.CiVariable}: a value (cf. virtual register) that is yet to be bound to a target machine location (physical register or memory address).
- *</ul>
- */
-package com.oracle.max.cri.ci;
-
--- a/graal/com.oracle.max.cri/src/com/oracle/max/cri/ri/RiRuntime.java	Thu Jun 07 18:41:37 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,149 +0,0 @@
-/*
- * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.max.cri.ri;
-
-import java.lang.reflect.*;
-
-import com.oracle.graal.api.meta.*;
-import com.oracle.max.cri.ci.*;
-
-/**
- * Encapsulates the main functionality of the runtime for the compiler, including access
- * to constant pools, OSR frames, inlining requirements, and runtime calls such as checkcast.
-s */
-public interface RiRuntime {
-
-    /**
-     * Get the size in bytes for locking information on the stack.
-     */
-    int sizeOfLockData();
-
-    /**
-     * Returns a disassembly of the given installed code.
-     *
-     * @param code the code that should be disassembled
-     * @return a disassembly. This will be of length 0 if the runtime does not support disassembling.
-     */
-    String disassemble(RiCodeInfo code, CiTargetMethod tm);
-
-    /**
-     * Returns the disassembly of the given method in a {@code javap}-like format.
-     *
-     * @param method the method that should be disassembled
-     * @return the disassembly. This will be of length 0 if the runtime does not support disassembling.
-     */
-    String disassemble(RiResolvedMethod method);
-
-    /**
-     * Returns the RiType object representing the base type for the given kind.
-     */
-    RiResolvedType asRiType(RiKind kind);
-
-    /**
-     * Returns the type of the given constant object.
-     *
-     * @return {@code null} if {@code constant.isNull() || !constant.kind.isObject()}
-     */
-    RiResolvedType getTypeOf(RiConstant constant);
-
-
-    RiResolvedType getType(Class<?> clazz);
-
-    /**
-     * Used by the canonicalizer to compare objects, since a given runtime might not want to expose the real objects to the compiler.
-     *
-     * @return true if the two parameters represent the same runtime object, false otherwise
-     */
-    boolean areConstantObjectsEqual(RiConstant x, RiConstant y);
-
-    /**
-     * Gets the register configuration to use when compiling a given method.
-     *
-     * @param method the top level method of a compilation
-     */
-    CiRegisterConfig getRegisterConfig(RiMethod method);
-
-    CiRegisterConfig getGlobalStubRegisterConfig();
-
-    /**
-     * Custom area on the stack of each compiled method that the VM can use for its own purposes.
-     * @return the size of the custom area in bytes
-     */
-    int getCustomStackAreaSize();
-
-    /**
-     * Minimum size of the stack area reserved for outgoing parameters. This area is reserved in all cases, even when
-     * the compiled method has no regular call instructions.
-     * @return the minimum size of the outgoing parameter area in bytes
-     */
-    int getMinimumOutgoingSize();
-
-    /**
-     * Gets the length of the array that is wrapped in a CiConstant object.
-     */
-    int getArrayLength(RiConstant array);
-
-    /**
-     * Performs any runtime-specific conversion on the object used to describe the target of a call.
-     */
-    Object asCallTarget(Object target);
-
-    /**
-     * Returns the maximum absolute offset of a runtime call target from any position in the code cache or -1
-     * when not known or not applicable. Intended for determining the required size of address/offset fields.
-     */
-    long getMaxCallTargetOffset(CiRuntimeCall rtcall);
-
-    /**
-     * Provides the {@link RiMethod} for a {@link Method} obtained via reflection.
-     */
-    RiResolvedMethod getRiMethod(Method reflectionMethod);
-
-    /**
-     * Adds the given machine code as an implementation of the given method without making it the default implementation.
-     * @param method a method to which the executable code is begin added
-     * @param code the code to be added
-     * @param info the object into which details of the installed code will be written.
-     *        Ignored if null, otherwise the info is written to index 0 of this array.
-     * @return a reference to the compiled and ready-to-run code
-     */
-    RiCompiledMethod addMethod(RiResolvedMethod method, CiTargetMethod code, RiCodeInfo[] info);
-
-    /**
-     * Encodes a deoptimization action and a deoptimization reason in an integer value.
-     * @return the encoded value as an integer
-     */
-    int encodeDeoptActionAndReason(CiDeoptAction action, RiDeoptReason reason);
-
-    /**
-     * Converts a RiDeoptReason into an integer value.
-     * @return An integer value representing the given RiDeoptReason.
-     */
-    int convertDeoptReason(RiDeoptReason reason);
-
-    /**
-     * Converts a RiDeoptAction into an integer value.
-     * @return An integer value representing the given RiDeoptAction.
-     */
-    int convertDeoptAction(CiDeoptAction action);
-}
--- a/graal/com.oracle.max.cri/src/com/oracle/max/cri/xir/CiXirAssembler.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.max.cri/src/com/oracle/max/cri/xir/CiXirAssembler.java	Thu Jun 07 18:55:34 2012 +0200
@@ -26,9 +26,9 @@
 
 import java.util.*;
 
+import com.oracle.graal.api.code.*;
+import com.oracle.graal.api.code.CiAddress.*;
 import com.oracle.graal.api.meta.*;
-import com.oracle.max.cri.ci.*;
-import com.oracle.max.cri.ci.CiAddress.*;
 
 /**
  * Represents an assembler that allows a client such as the runtime system to
--- a/graal/com.oracle.max.cri/src/com/oracle/max/cri/xir/XirSite.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.max.cri/src/com/oracle/max/cri/xir/XirSite.java	Thu Jun 07 18:55:34 2012 +0200
@@ -22,7 +22,7 @@
  */
 package com.oracle.max.cri.xir;
 
-import com.oracle.max.cri.ci.*;
+import com.oracle.graal.api.code.*;
 
 /**
  * Encapsulates the notion of a site where XIR can be supplied. It is supplied to the {@link RiXirGenerator} by the
--- a/graal/com.oracle.max.cri/src/com/oracle/max/cri/xir/XirSnippet.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.max.cri/src/com/oracle/max/cri/xir/XirSnippet.java	Thu Jun 07 18:55:34 2012 +0200
@@ -24,8 +24,8 @@
 
 import java.util.*;
 
+import com.oracle.graal.api.code.CiTargetMethod.*;
 import com.oracle.graal.api.meta.*;
-import com.oracle.max.cri.ci.CiTargetMethod.*;
 import com.oracle.max.cri.xir.CiXirAssembler.*;
 
 /**
--- a/graal/com.oracle.max.criutils/src/com/oracle/max/criutils/BaseProfilingInfo.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.max.criutils/src/com/oracle/max/criutils/BaseProfilingInfo.java	Thu Jun 07 18:55:34 2012 +0200
@@ -22,8 +22,8 @@
  */
 package com.oracle.max.criutils;
 
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
-import com.oracle.max.cri.ci.*;
 
 
 /**
--- a/graal/com.oracle.max.criutils/src/com/oracle/max/criutils/BaseUnresolvedField.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.max.criutils/src/com/oracle/max/criutils/BaseUnresolvedField.java	Thu Jun 07 18:55:34 2012 +0200
@@ -22,8 +22,8 @@
  */
 package com.oracle.max.criutils;
 
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
-import com.oracle.max.cri.ci.*;
 
 /**
  * A implementation of {@link RiField} for an unresolved field.
--- a/graal/com.oracle.max.criutils/src/com/oracle/max/criutils/BaseUnresolvedMethod.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.max.criutils/src/com/oracle/max/criutils/BaseUnresolvedMethod.java	Thu Jun 07 18:55:34 2012 +0200
@@ -22,8 +22,8 @@
  */
 package com.oracle.max.criutils;
 
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
-import com.oracle.max.cri.ci.*;
 
 /**
  * A implementation of {@link RiMethod} for an unresolved method.
--- a/graal/com.oracle.max.criutils/src/com/oracle/max/criutils/CompilationPrinter.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.max.criutils/src/com/oracle/max/criutils/CompilationPrinter.java	Thu Jun 07 18:55:34 2012 +0200
@@ -22,13 +22,13 @@
  */
 package com.oracle.max.criutils;
 
-import static com.oracle.max.cri.ci.CiValueUtil.*;
+import static com.oracle.graal.api.code.CiValueUtil.*;
 
 import java.io.*;
 import java.util.*;
 
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
-import com.oracle.max.cri.ci.*;
 
 /**
  * Utility for printing compilation related data structures at various compilation phases.
--- a/graal/com.oracle.max.criutils/src/com/oracle/max/criutils/HexCodeFile.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.max.criutils/src/com/oracle/max/criutils/HexCodeFile.java	Thu Jun 07 18:55:34 2012 +0200
@@ -27,8 +27,8 @@
 import java.util.*;
 import java.util.regex.*;
 
-import com.oracle.max.cri.ci.*;
-import com.oracle.max.cri.ci.CiTargetMethod.*;
+import com.oracle.graal.api.code.*;
+import com.oracle.graal.api.code.CiTargetMethod.*;
 
 
 /**
--- a/graal/com.oracle.max.criutils/src/com/oracle/max/criutils/SnapshotProfilingInfo.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.max.criutils/src/com/oracle/max/criutils/SnapshotProfilingInfo.java	Thu Jun 07 18:55:34 2012 +0200
@@ -24,9 +24,8 @@
 
 import java.io.*;
 
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
-import com.oracle.max.cri.ci.*;
-import com.oracle.max.cri.ri.*;
 
 /**
  * A profiling info snapshot that can be {@linkplain #save(File, File) saved} to
--- a/graal/com.oracle.max.criutils/src/com/oracle/max/criutils/TypeCheckHints.java	Thu Jun 07 18:41:37 2012 +0200
+++ b/graal/com.oracle.max.criutils/src/com/oracle/max/criutils/TypeCheckHints.java	Thu Jun 07 18:55:34 2012 +0200
@@ -25,9 +25,9 @@
 import java.lang.reflect.*;
 import java.util.*;
 
+import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.api.meta.RiTypeProfile.*;
-import com.oracle.max.cri.ci.*;
 
 /**
  * Utility for deriving hint types for a type check instruction (e.g. checkcast or instanceof)
--- a/mx/projects	Thu Jun 07 18:41:37 2012 +0200
+++ b/mx/projects	Thu Jun 07 18:55:34 2012 +0200
@@ -153,7 +153,7 @@
 # max.cri
 project@com.oracle.max.cri@subDir=graal
 project@com.oracle.max.cri@sourceDirs=src
-project@com.oracle.max.cri@dependencies=com.oracle.graal.api.meta
+project@com.oracle.max.cri@dependencies=com.oracle.graal.api.meta,com.oracle.graal.api.code
 project@com.oracle.max.cri@checkstyle=com.oracle.graal.graph
 project@com.oracle.max.cri@javaCompliance=1.7