changeset 21578:a880844225e4

Merge with f41409c6ff26923655747d1a36ac51892b1153ac
author Michael Van De Vanter <michael.van.de.vanter@oracle.com>
date Thu, 28 May 2015 21:11:28 -0700
parents 8a01110bfbaf (current diff) f41409c6ff26 (diff)
children 6fffb62ccb32
files graal/com.oracle.graal.api.code/overview.html graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/AbstractAddress.java graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/Architecture.java graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/ArithmeticOperation.java graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/BailoutException.java graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/BytecodeFrame.java graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/BytecodePosition.java graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CalleeSaveLayout.java graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CallingConvention.java graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CodeCacheProvider.java graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CodeUtil.java graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CompilationResult.java graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/DataSection.java graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/DebugInfo.java graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/DisassemblerProvider.java graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/ForeignCallLinkage.java graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/ForeignCallsProvider.java graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/InfopointReason.java graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/InstalledCode.java graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/InvalidInstalledCodeException.java graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/MemoryBarriers.java graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/ReferenceMap.java graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/Register.java graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/RegisterAttributes.java graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/RegisterConfig.java graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/RegisterSaveLayout.java graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/RegisterValue.java graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/SourceStackTrace.java graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/SpeculationLog.java graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/StackLockValue.java graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/StackSlot.java graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/StackSlotValue.java graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/TargetDescription.java graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/TypeCheckHints.java graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/UnsignedMath.java graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/ValueUtil.java graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/VirtualObject.java graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/VirtualStackSlot.java graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/package-info.java graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/stack/InspectedFrame.java graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/stack/InspectedFrameVisitor.java graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/stack/StackIntrospection.java graal/com.oracle.graal.api.meta.test/src/com/oracle/graal/api/meta/test/ConstantTest.java graal/com.oracle.graal.api.meta.test/src/com/oracle/graal/api/meta/test/FieldUniverse.java graal/com.oracle.graal.api.meta.test/src/com/oracle/graal/api/meta/test/MethodUniverse.java graal/com.oracle.graal.api.meta.test/src/com/oracle/graal/api/meta/test/NameAndSignature.java graal/com.oracle.graal.api.meta.test/src/com/oracle/graal/api/meta/test/ResolvedJavaTypeResolveConcreteMethodTest.java graal/com.oracle.graal.api.meta.test/src/com/oracle/graal/api/meta/test/ResolvedJavaTypeResolveMethodTest.java graal/com.oracle.graal.api.meta.test/src/com/oracle/graal/api/meta/test/TestBytecodeDisassemblerProvider.java graal/com.oracle.graal.api.meta.test/src/com/oracle/graal/api/meta/test/TestConstantReflectionProvider.java graal/com.oracle.graal.api.meta.test/src/com/oracle/graal/api/meta/test/TestJavaField.java graal/com.oracle.graal.api.meta.test/src/com/oracle/graal/api/meta/test/TestJavaMethod.java graal/com.oracle.graal.api.meta.test/src/com/oracle/graal/api/meta/test/TestJavaType.java graal/com.oracle.graal.api.meta.test/src/com/oracle/graal/api/meta/test/TestMetaAccessProvider.java graal/com.oracle.graal.api.meta.test/src/com/oracle/graal/api/meta/test/TestResolvedJavaField.java graal/com.oracle.graal.api.meta.test/src/com/oracle/graal/api/meta/test/TestResolvedJavaMethod.java graal/com.oracle.graal.api.meta.test/src/com/oracle/graal/api/meta/test/TestResolvedJavaType.java graal/com.oracle.graal.api.meta.test/src/com/oracle/graal/api/meta/test/TypeUniverse.java graal/com.oracle.graal.api.meta/overview.html graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/AbstractJavaProfile.java graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/AbstractProfiledItem.java graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/AbstractValue.java graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/AllocatableValue.java graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Assumptions.java graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/BytecodeDisassemblerProvider.java graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Constant.java graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ConstantPool.java graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ConstantReflectionProvider.java graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/DefaultProfilingInfo.java graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/DeoptimizationAction.java graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/DeoptimizationReason.java graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ExceptionHandler.java graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ExcludeFromIdentityComparisonVerification.java graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ForeignCallDescriptor.java graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/InvokeTarget.java graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/JavaConstant.java graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/JavaField.java graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/JavaMethod.java graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/JavaMethodProfile.java graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/JavaType.java graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/JavaTypeProfile.java graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/JavaValue.java graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Kind.java graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/KindProvider.java graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/LIRKind.java graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/LineNumberTable.java graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/LineNumberTableImpl.java graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Local.java graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/LocalImpl.java graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/LocalVariableTable.java graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/LocalVariableTableImpl.java graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/LocationIdentity.java graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/MemoryAccessProvider.java graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/MetaAccessProvider.java graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/MetaUtil.java graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/MethodHandleAccessProvider.java graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ModifiersProvider.java graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/NamedLocationIdentity.java graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/NullConstant.java graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/PlatformKind.java graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/PrimitiveConstant.java graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ProfilingInfo.java graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/RawConstant.java graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ResolvedJavaField.java graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ResolvedJavaMethod.java graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ResolvedJavaType.java graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/SerializableConstant.java graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Signature.java graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/TriState.java graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/TrustedInterface.java graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/VMConstant.java graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Value.java graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/package-info.java graal/com.oracle.graal.api.runtime/src/com/oracle/graal/api/runtime/Service.java graal/com.oracle.graal.api.runtime/src/com/oracle/graal/api/runtime/ServiceProvider.java graal/com.oracle.graal.api.runtime/src/com/oracle/graal/api/runtime/Services.java graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/GraalInternalError.java graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/UnsafeAccess.java graal/com.oracle.graal.debug.test/src/com/oracle/graal/debug/test/DebugHistogramTest.java graal/com.oracle.graal.debug.test/src/com/oracle/graal/debug/test/DebugTimerTest.java graal/com.oracle.graal.debug/overview.html graal/com.oracle.graal.debug/src/com/oracle/graal/debug/AnsiColor.java graal/com.oracle.graal.debug/src/com/oracle/graal/debug/Debug.java graal/com.oracle.graal.debug/src/com/oracle/graal/debug/DebugCloseable.java graal/com.oracle.graal.debug/src/com/oracle/graal/debug/DebugConfig.java graal/com.oracle.graal.debug/src/com/oracle/graal/debug/DebugConfigScope.java graal/com.oracle.graal.debug/src/com/oracle/graal/debug/DebugDumpHandler.java graal/com.oracle.graal.debug/src/com/oracle/graal/debug/DebugDumpScope.java graal/com.oracle.graal.debug/src/com/oracle/graal/debug/DebugHistogram.java graal/com.oracle.graal.debug/src/com/oracle/graal/debug/DebugMemUseTracker.java graal/com.oracle.graal.debug/src/com/oracle/graal/debug/DebugMetric.java graal/com.oracle.graal.debug/src/com/oracle/graal/debug/DebugTimer.java graal/com.oracle.graal.debug/src/com/oracle/graal/debug/DebugVerifyHandler.java graal/com.oracle.graal.debug/src/com/oracle/graal/debug/DelegatingDebugConfig.java graal/com.oracle.graal.debug/src/com/oracle/graal/debug/Fingerprint.java graal/com.oracle.graal.debug/src/com/oracle/graal/debug/Indent.java graal/com.oracle.graal.debug/src/com/oracle/graal/debug/LogStream.java graal/com.oracle.graal.debug/src/com/oracle/graal/debug/TTY.java graal/com.oracle.graal.debug/src/com/oracle/graal/debug/TopLevelDebugConfig.java graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/AccumulatedDebugValue.java graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/CloseableCounterImpl.java graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/DebugHistogramAsciiPrinter.java graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/DebugHistogramImpl.java graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/DebugHistogramRPrinter.java graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/DebugScope.java graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/DebugValue.java graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/DebugValueMap.java graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/KeyRegistry.java graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/MemUseTrackerImpl.java graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/MetricImpl.java graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/TimerImpl.java graal/com.oracle.graal.graph/src/com/oracle/graal/graph/GraalGraphInternalError.java graal/com.oracle.graal.graphbuilderconf/src/com/oracle/graal/graphbuilderconf/MethodIdHolder.java graal/com.oracle.graal.graphbuilderconf/src/com/oracle/graal/graphbuilderconf/MethodIdMap.java graal/com.oracle.graal.hotspot.loader/src/com/oracle/graal/hotspot/loader/Factory.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotCompiledCode.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotCompiledNmethod.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotOptions.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotProxified.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotReferenceMap.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotStackFrameReference.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConfig.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConfigVerifier.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVmSymbols.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/InitTimer.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/PrintStreamOption.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/Stable.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/logging/CountingProxy.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/logging/Logger.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/logging/LoggingProxy.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/logging/ProxyUtil.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/logging/package-info.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotCodeCacheProvider.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotCompressedNullConstant.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotConstant.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotConstantPool.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotConstantReflectionProvider.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotInstalledCode.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotJavaType.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMemoryAccessProvider.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMemoryAccessProviderImpl.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMetaAccessProvider.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMetaspaceConstant.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMetaspaceConstantImpl.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMethod.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMethodData.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMethodDataAccessor.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMethodUnresolved.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotNmethod.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotObjectConstant.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotObjectConstantImpl.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotProfilingInfo.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaField.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaFieldImpl.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaMethod.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaMethodImpl.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaType.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedObjectType.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedObjectTypeImpl.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedPrimitiveType.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotSignature.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotSpeculationLog.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotUnresolvedField.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotUnresolvedJavaType.java graal/com.oracle.graal.hotspotvmconfig.processor/src/META-INF/services/javax.annotation.processing.Processor graal/com.oracle.graal.hotspotvmconfig.processor/src/com/oracle/graal/hotspotvmconfig/processor/HotSpotVMConfigProcessor.java graal/com.oracle.graal.hotspotvmconfig/src/com/oracle/graal/hotspotvmconfig/HotSpotVMConstant.java graal/com.oracle.graal.hotspotvmconfig/src/com/oracle/graal/hotspotvmconfig/HotSpotVMField.java graal/com.oracle.graal.hotspotvmconfig/src/com/oracle/graal/hotspotvmconfig/HotSpotVMFlag.java graal/com.oracle.graal.hotspotvmconfig/src/com/oracle/graal/hotspotvmconfig/HotSpotVMType.java graal/com.oracle.graal.hotspotvmconfig/src/com/oracle/graal/hotspotvmconfig/HotSpotVMValue.java graal/com.oracle.graal.options.processor/src/META-INF/services/javax.annotation.processing.Processor graal/com.oracle.graal.options.processor/src/com/oracle/graal/options/processor/GraalJars.java graal/com.oracle.graal.options.processor/src/com/oracle/graal/options/processor/OptionProcessor.java graal/com.oracle.graal.options.processor/src/com/oracle/graal/options/processor/OptionsVerifier.java graal/com.oracle.graal.options.test/src/com/oracle/graal/options/test/NestedBooleanOptionValueTest.java graal/com.oracle.graal.options.test/src/com/oracle/graal/options/test/TestOptionValue.java graal/com.oracle.graal.options/src/com/oracle/graal/options/DerivedOptionValue.java graal/com.oracle.graal.options/src/com/oracle/graal/options/NestedBooleanOptionValue.java graal/com.oracle.graal.options/src/com/oracle/graal/options/Option.java graal/com.oracle.graal.options/src/com/oracle/graal/options/OptionDescriptor.java graal/com.oracle.graal.options/src/com/oracle/graal/options/OptionType.java graal/com.oracle.graal.options/src/com/oracle/graal/options/OptionUtils.java graal/com.oracle.graal.options/src/com/oracle/graal/options/OptionValue.java graal/com.oracle.graal.options/src/com/oracle/graal/options/Options.java graal/com.oracle.graal.options/src/com/oracle/graal/options/OptionsLoader.java graal/com.oracle.graal.options/src/com/oracle/graal/options/StableOptionValue.java graal/com.oracle.graal.printer/src/com/oracle/graal/printer/HexCodeFile.java graal/com.oracle.graal.service.processor/src/META-INF/services/javax.annotation.processing.Processor graal/com.oracle.graal.service.processor/src/com/oracle/graal/service/processor/ServiceProviderProcessor.java graal/com.oracle.truffle.interop/src/com/oracle/truffle/interop/SymbolInvokerImpl.java graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/SLMain.java make/bsd/makefiles/graal.make make/linux/makefiles/graal.make make/solaris/makefiles/graal.make mx/mx_graal.py mx/suite.py src/cpu/ppc/vm/graalGlobals_ppc.hpp src/cpu/sparc/vm/graalCodeInstaller_sparc.cpp src/cpu/sparc/vm/graalGlobals_sparc.hpp src/cpu/x86/vm/graalCodeInstaller_x86.cpp src/cpu/x86/vm/graalGlobals_x86.hpp src/share/vm/graal/graalCodeInstaller.cpp src/share/vm/graal/graalCodeInstaller.hpp src/share/vm/graal/graalCompiler.cpp src/share/vm/graal/graalCompiler.hpp src/share/vm/graal/graalCompilerToVM.cpp src/share/vm/graal/graalCompilerToVM.hpp src/share/vm/graal/graalEnv.cpp src/share/vm/graal/graalEnv.hpp src/share/vm/graal/graalGlobals.cpp src/share/vm/graal/graalGlobals.hpp src/share/vm/graal/graalHashtable.cpp src/share/vm/graal/graalHashtable.hpp src/share/vm/graal/graalJavaAccess.cpp src/share/vm/graal/graalJavaAccess.hpp src/share/vm/graal/graalOptions.cpp src/share/vm/graal/graalOptions.hpp src/share/vm/graal/graalRuntime.cpp src/share/vm/graal/graalRuntime.hpp src/share/vm/graal/vmStructs_graal.hpp
diffstat 1571 files changed, 49638 insertions(+), 47552 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.amd64/src/com/oracle/graal/amd64/AMD64.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.amd64/src/com/oracle/graal/amd64/AMD64.java	Thu May 28 21:11:28 2015 -0700
@@ -22,15 +22,17 @@
  */
 package com.oracle.graal.amd64;
 
-import static com.oracle.graal.api.code.MemoryBarriers.*;
-import static com.oracle.graal.api.code.Register.*;
+import com.oracle.jvmci.code.Architecture;
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.meta.Kind;
+import com.oracle.jvmci.meta.PlatformKind;
+import static com.oracle.jvmci.code.MemoryBarriers.*;
+import static com.oracle.jvmci.code.Register.*;
 
 import java.nio.*;
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.code.Register.RegisterCategory;
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.code.Register.RegisterCategory;
 
 /**
  * Represents the AMD64 architecture.
--- a/graal/com.oracle.graal.api.code/overview.html	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
-<head>
-<!--
-
-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.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-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.
--->
-
-</head>
-<body>
-
-The <code>com.oracle.graal.api.code</code> project provides an API to the runtime's native code cache.
-It allows installation and execution of native code.
-
-</body>
-</html>
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/AbstractAddress.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.api.code;
-
-/**
- * Abstract base class that represents a platform specific address.
- */
-public abstract class AbstractAddress {
-}
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/Architecture.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,249 +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.graal.api.code;
-
-import java.nio.*;
-import java.util.*;
-
-import com.oracle.graal.api.code.Register.RegisterCategory;
-import com.oracle.graal.api.meta.*;
-
-/**
- * Represents a CPU architecture, including information such as its endianness, CPU registers, word
- * width, etc.
- */
-public abstract class Architecture {
-
-    /**
-     * The number of entries required in a {@link ReferenceMap} covering all the registers that may
-     * store references. The index of a register in the reference map is given by
-     * {@link Register#getReferenceMapIndex()}.
-     */
-    private final int registerReferenceMapSize;
-
-    /**
-     * Represents the natural size of words (typically registers and pointers) of this architecture,
-     * in bytes.
-     */
-    private final int wordSize;
-
-    /**
-     * The name of this architecture (e.g. "AMD64", "SPARCv9").
-     */
-    private final String name;
-
-    /**
-     * Array of all available registers on this architecture. The index of each register in this
-     * array is equal to its {@linkplain Register#number number}.
-     */
-    private final Register[] registers;
-
-    /**
-     * The byte ordering can be either little or big endian.
-     */
-    private final ByteOrder byteOrder;
-
-    /**
-     * Whether the architecture supports unaligned memory accesses.
-     */
-    private final boolean unalignedMemoryAccess;
-
-    /**
-     * Mask of the barrier constants denoting the barriers that are not required to be explicitly
-     * inserted under this architecture.
-     */
-    private final int implicitMemoryBarriers;
-
-    /**
-     * Offset in bytes from the beginning of a call instruction to the displacement.
-     */
-    private 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).
-     */
-    private final int returnAddressSize;
-
-    protected Architecture(String name, int wordSize, ByteOrder byteOrder, boolean unalignedMemoryAccess, Register[] registers, int implicitMemoryBarriers, int nativeCallDisplacementOffset,
-                    int registerReferenceMapSize, int returnAddressSize) {
-        this.name = name;
-        this.registers = registers;
-        this.wordSize = wordSize;
-        this.byteOrder = byteOrder;
-        this.unalignedMemoryAccess = unalignedMemoryAccess;
-        this.implicitMemoryBarriers = implicitMemoryBarriers;
-        this.machineCodeCallDisplacementOffset = nativeCallDisplacementOffset;
-        this.registerReferenceMapSize = registerReferenceMapSize;
-        this.returnAddressSize = returnAddressSize;
-    }
-
-    /**
-     * Converts this architecture to a string.
-     *
-     * @return the string representation of this architecture
-     */
-    @Override
-    public final String toString() {
-        return getName().toLowerCase();
-    }
-
-    public int getRegisterReferenceMapSize() {
-        return registerReferenceMapSize;
-    }
-
-    /**
-     * Gets the natural size of words (typically registers and pointers) of this architecture, in
-     * bytes.
-     */
-    public int getWordSize() {
-        return wordSize;
-    }
-
-    /**
-     * Gets the name of this architecture.
-     */
-    public String getName() {
-        return name;
-    }
-
-    /**
-     * Gets an array of all available registers on this architecture. The index of each register in
-     * this array is equal to its {@linkplain Register#number number}.
-     */
-    public Register[] getRegisters() {
-        return registers.clone();
-    }
-
-    public ByteOrder getByteOrder() {
-        return byteOrder;
-    }
-
-    /**
-     * @return true if the architecture supports unaligned memory accesses.
-     */
-    public boolean supportsUnalignedMemoryAccess() {
-        return unalignedMemoryAccess;
-    }
-
-    /**
-     * Gets 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.
-     */
-    public int getReturnAddressSize() {
-        return returnAddressSize;
-    }
-
-    /**
-     * Gets the offset in bytes from the beginning of a call instruction to the displacement.
-     */
-    public int getMachineCodeCallDisplacementOffset() {
-        return machineCodeCallDisplacementOffset;
-    }
-
-    /**
-     * Determines the barriers in a given barrier mask that are explicitly required on this
-     * architecture.
-     *
-     * @param barriers a mask of the barrier constants
-     * @return the value of {@code barriers} minus the barriers unnecessary on this architecture
-     */
-    public final int requiredBarriers(int barriers) {
-        return barriers & ~implicitMemoryBarriers;
-    }
-
-    /**
-     * 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 getSizeInBytes(PlatformKind kind) {
-        switch ((Kind) 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;
-            default:
-                return 0;
-        }
-    }
-
-    /**
-     * Determine whether a kind can be stored in a register of a given category.
-     *
-     * @param category the category of the register
-     * @param kind the kind that should be stored in the register
-     */
-    public abstract boolean canStoreValue(RegisterCategory category, PlatformKind kind);
-
-    /**
-     * Return the largest kind that can be stored in a register of a given category.
-     *
-     * @param category the category of the register
-     * @return the largest kind that can be stored in a register {@code category}
-     */
-    public abstract PlatformKind getLargestStorableKind(RegisterCategory category);
-
-    @Override
-    public final boolean equals(Object obj) {
-        if (obj == this) {
-            return true;
-        }
-        if (obj instanceof Architecture) {
-            Architecture that = (Architecture) obj;
-            if (this.name.equals(that.name)) {
-                assert this.byteOrder.equals(that.byteOrder);
-                assert this.implicitMemoryBarriers == that.implicitMemoryBarriers;
-                assert this.machineCodeCallDisplacementOffset == that.machineCodeCallDisplacementOffset;
-                assert this.registerReferenceMapSize == that.registerReferenceMapSize;
-                assert Arrays.equals(this.registers, that.registers);
-                assert this.returnAddressSize == that.returnAddressSize;
-                assert this.unalignedMemoryAccess == that.unalignedMemoryAccess;
-                assert this.wordSize == that.wordSize;
-                return true;
-            }
-        }
-        return false;
-    }
-
-    @Override
-    public final int hashCode() {
-        return name.hashCode();
-    }
-}
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/ArithmeticOperation.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.api.code;
-
-/**
- * An {@code ArithmeticOperation} is an operation that does primitive value arithmetic without side
- * effect.
- */
-public interface ArithmeticOperation {
-}
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/BailoutException.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,76 +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.graal.api.code;
-
-import java.util.*;
-
-/**
- * Exception 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 BailoutException extends RuntimeException {
-
-    public static final long serialVersionUID = 8974598793458772L;
-    private final boolean permanent;
-
-    /**
-     * Creates a new {@link BailoutException}.
-     *
-     *
-     * @param args parameters to the formatter
-     */
-    public BailoutException(String format, Object... args) {
-        super(String.format(Locale.ENGLISH, format, args));
-        this.permanent = true;
-    }
-
-    /**
-     * Creates a new {@link BailoutException}.
-     *
-     *
-     * @param args parameters to the formatter
-     */
-    public BailoutException(Throwable cause, String format, Object... args) {
-        super(String.format(Locale.ENGLISH, format, args), cause);
-        this.permanent = true;
-    }
-
-    /**
-     * Creates a new {@link BailoutException}.
-     *
-     * @param permanent specifies whether this exception will occur again if compilation is retried
-     * @param args parameters to the formatter
-     */
-    public BailoutException(boolean permanent, String format, Object... args) {
-        super(String.format(Locale.ENGLISH, format, args));
-        this.permanent = permanent;
-    }
-
-    /**
-     * @return whether this exception will occur again if compilation is retried
-     */
-    public boolean isPermanent() {
-        return permanent;
-    }
-}
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/BytecodeFrame.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,271 +0,0 @@
-/*
- * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.api.code;
-
-import java.util.*;
-
-import com.oracle.graal.api.meta.*;
-
-/**
- * Represents the Java bytecode frame state(s) at a given position including {@link Value locations}
- * where to find the local variables, operand stack values and locked objects of the bytecode
- * frame(s).
- */
-public class BytecodeFrame extends BytecodePosition {
-
-    /**
-     * An array of values representing how to reconstruct the state of the Java frame. This is array
-     * is partitioned as follows:
-     * <p>
-     * <table summary="" 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 Value[] 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;
-
-    /**
-     * True if this is a position inside an exception handler before the exception object has been
-     * consumed. In this case, {@link #numStack} {@code == 1} and {@link #getStackValue(int)
-     * getStackValue(0)} is the location of the exception object. If deoptimization happens at this
-     * position, the interpreter will rethrow the exception instead of executing the bytecode
-     * instruction at this position.
-     */
-    public final boolean rethrowException;
-
-    public final boolean duringCall;
-
-    /**
-     * This BCI should be used for frame states that are built for code with no meaningful BCI.
-     */
-    public static final int UNKNOWN_BCI = -5;
-
-    /**
-     * The BCI for exception unwind. This is synthetic code and has no representation in bytecode.
-     * In contrast with {@link #AFTER_EXCEPTION_BCI}, at this point, if the method is synchronized,
-     * the monitor is still held.
-     */
-    public static final int UNWIND_BCI = -1;
-
-    /**
-     * The BCI for the state before starting to execute a method. Note that if the method is
-     * synchronized, the monitor is not yet held.
-     */
-    public static final int BEFORE_BCI = -2;
-
-    /**
-     * The BCI for the state after finishing the execution of a method and returning normally. Note
-     * that if the method was synchronized the monitor is already released.
-     */
-    public static final int AFTER_BCI = -3;
-
-    /**
-     * The BCI for exception unwind. This is synthetic code and has no representation in bytecode.
-     * In contrast with {@link #UNWIND_BCI}, at this point, if the method is synchronized, the
-     * monitor is already released.
-     */
-    public static final int AFTER_EXCEPTION_BCI = -4;
-
-    /**
-     * This BCI should be used for states that cannot be the target of a deoptimization, like
-     * snippet frame states.
-     */
-    public static final int INVALID_FRAMESTATE_BCI = -6;
-
-    /**
-     * Determines if a given BCI matches one of the placeholder BCI constants defined in this class.
-     */
-    public static boolean isPlaceholderBci(int bci) {
-        return bci < 0;
-    }
-
-    /**
-     * Gets the name of a given placeholder BCI.
-     */
-    public static String getPlaceholderBciName(int bci) {
-        assert isPlaceholderBci(bci);
-        if (bci == BytecodeFrame.AFTER_BCI) {
-            return "AFTER_BCI";
-        } else if (bci == BytecodeFrame.AFTER_EXCEPTION_BCI) {
-            return "AFTER_EXCEPTION_BCI";
-        } else if (bci == BytecodeFrame.INVALID_FRAMESTATE_BCI) {
-            return "INVALID_FRAMESTATE_BCI";
-        } else if (bci == BytecodeFrame.BEFORE_BCI) {
-            return "BEFORE_BCI";
-        } else if (bci == BytecodeFrame.UNKNOWN_BCI) {
-            return "UNKNOWN_BCI";
-        } else {
-            assert bci == BytecodeFrame.UNWIND_BCI;
-            return "UNWIND_BCI";
-        }
-    }
-
-    /**
-     * 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 BytecodeFrame(BytecodeFrame caller, ResolvedJavaMethod method, int bci, boolean rethrowException, boolean duringCall, Value[] values, int numLocals, int numStack, int numLocks) {
-        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;
-        assert !rethrowException || numStack == 1 : "must have exception on top of the stack";
-    }
-
-    /**
-     * Ensure that the frame state is formatted as expected by the JVM, with null or Illegal in the
-     * slot following a double word item. This should really be checked in FrameState itself but
-     * because of Word type rewriting and alternative backends that can't be done.
-     */
-    public boolean validateFormat(boolean derivedOk) {
-        if (caller() != null) {
-            caller().validateFormat(derivedOk);
-        }
-        for (int i = 0; i < numLocals + numStack; i++) {
-            if (values[i] != null) {
-                Kind kind = values[i].getKind();
-                if (kind.needsTwoSlots()) {
-                    assert values.length > i + 1 : String.format("missing second word %s", this);
-                    assert values[i + 1] == null || values[i + 1].getKind() == Kind.Illegal : this;
-                }
-                assert derivedOk || ValueUtil.isIllegal(values[i]) || !values[i].getLIRKind().isDerivedReference() : "Unexpected derived value: " + values[i];
-            }
-        }
-        return true;
-    }
-
-    /**
-     * 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 Value 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 Value 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 Value getLockValue(int i) {
-        return values[i + numLocals + numStack];
-    }
-
-    /**
-     * Gets the caller of this frame.
-     *
-     * @return {@code null} if this frame has no caller
-     */
-    public BytecodeFrame caller() {
-        return (BytecodeFrame) getCaller();
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj instanceof BytecodeFrame && super.equals(obj)) {
-            BytecodeFrame that = (BytecodeFrame) obj;
-            // @formatter:off
-            if (this.duringCall == that.duringCall &&
-                this.rethrowException == that.rethrowException &&
-                this.numLocals == that.numLocals &&
-                this.numLocks == that.numLocks &&
-                this.numStack == that.numStack &&
-                Arrays.equals(this.values, that.values)) {
-                return true;
-            }
-            // @formatter:off
-            return true;
-        }
-        return false;
-    }
-
-    @Override
-    public String toString() {
-        return CodeUtil.append(new StringBuilder(100), this).toString();
-    }
-}
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/BytecodePosition.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,120 +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.graal.api.code;
-
-import java.util.*;
-
-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 BytecodeFrame frames} for deoptimization.
- */
-public class BytecodePosition {
-
-    private final BytecodePosition caller;
-    private final ResolvedJavaMethod method;
-    private 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 BytecodePosition(BytecodePosition caller, ResolvedJavaMethod 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 CodeUtil.append(new StringBuilder(100), this).toString();
-    }
-
-    /**
-     * Deep equality test.
-     */
-    @Override
-    public boolean equals(Object obj) {
-        if (obj == this) {
-            return true;
-        }
-        if (obj != null && getClass() == obj.getClass()) {
-            BytecodePosition that = (BytecodePosition) obj;
-            if (this.bci == that.bci && Objects.equals(this.getMethod(), that.getMethod()) && Objects.equals(this.caller, that.caller)) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    @Override
-    public int hashCode() {
-        return getBCI();
-    }
-
-    /**
-     * @return 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 int getBCI() {
-        return bci;
-    }
-
-    /**
-     * @return The runtime interface method for this position.
-     */
-    public ResolvedJavaMethod getMethod() {
-        return method;
-    }
-
-    /**
-     * The position where this position has been called, {@code null} if none.
-     */
-    public BytecodePosition getCaller() {
-        return caller;
-    }
-
-    /**
-     * Adds a caller to the current position returning the new position.
-     */
-    public BytecodePosition addCaller(BytecodePosition link) {
-        if (getCaller() == null) {
-            return new BytecodePosition(link, getMethod(), getBCI());
-        } else {
-            return new BytecodePosition(getCaller().addCaller(link), getMethod(), getBCI());
-        }
-    }
-}
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CalleeSaveLayout.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,182 +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.graal.api.code;
-
-import java.util.*;
-
-import com.oracle.graal.api.meta.*;
-
-/**
- * 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 CalleeSaveLayout {
-
-    /**
-     * The size (in bytes) of the CSA.
-     */
-    public final int size;
-
-    /**
-     * The size (in bytes) of an {@linkplain #registerAt(int) indexable} slot in the CSA.
-     */
-    public final int slotSize;
-
-    /**
-     * Map from {@linkplain Register#number register numbers} to slot indexes in the CSA.
-     */
-    private final int[] regNumToIndex;
-
-    private final Register[] indexToReg;
-
-    /**
-     * The list of registers {@linkplain #contains(int) contained} by this CSA.
-     */
-    public final Register[] 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 #registerAt(int) indexable} slot in the
-     *            CSA
-     * @param registers the registers that can be saved in the CSA
-     */
-    public CalleeSaveLayout(TargetDescription target, int frameOffsetToCSA, int size, int slotSize, Register... registers) {
-        this.frameOffsetToCSA = frameOffsetToCSA;
-        assert slotSize == 0 || CodeUtil.isPowerOf2(slotSize);
-        this.slotSize = slotSize;
-        int maxRegNum = -1;
-        int maxOffset = 0;
-        this.registers = registers;
-        int offset = 0;
-        for (Register reg : registers) {
-            assert offset % slotSize == 0;
-            assert reg.number >= 0;
-            if (reg.number > maxRegNum) {
-                maxRegNum = reg.number;
-            }
-            if (offset > maxOffset) {
-                maxOffset = offset;
-            }
-            PlatformKind kind = target.arch.getLargestStorableKind(reg.getRegisterCategory());
-            offset += target.getSizeInBytes(kind);
-        }
-        if (size == -1) {
-            this.size = offset;
-        } else {
-            assert offset <= size;
-            this.size = size;
-        }
-
-        this.regNumToIndex = new int[maxRegNum + 1];
-        this.indexToReg = offset == 0 ? new Register[0] : new Register[offset / slotSize];
-        Arrays.fill(regNumToIndex, -1);
-        offset = 0;
-        for (Register reg : registers) {
-            int index = offset / slotSize;
-            regNumToIndex[reg.number] = index;
-            indexToReg[index] = reg;
-            PlatformKind kind = target.arch.getLargestStorableKind(reg.getRegisterCategory());
-            offset += target.getSizeInBytes(kind);
-        }
-    }
-
-    /**
-     * 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(Register 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 Register registerAt(int index) {
-        if (index < 0 || index >= indexToReg.length) {
-            return null;
-        }
-        return indexToReg[index];
-    }
-
-    @Override
-    public String toString() {
-        StringBuilder sb = new StringBuilder("[");
-        for (Register 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.graal.api.code/src/com/oracle/graal/api/code/CallingConvention.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,158 +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.graal.api.code;
-
-import static com.oracle.graal.api.code.ValueUtil.*;
-
-import com.oracle.graal.api.meta.*;
-
-/**
- * A calling convention describes the locations in which the arguments for a call are placed and the
- * location in which the return value is placed if the call is not void.
- */
-public class CallingConvention {
-
-    /**
-     * Constants denoting the type of a call for which a calling convention is 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 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.
-     */
-    private final int stackSize;
-
-    private final AllocatableValue returnLocation;
-
-    /**
-     * The ordered locations in which the arguments are placed.
-     */
-    private final AllocatableValue[] argumentLocations;
-
-    /**
-     * Creates a description of the registers and stack locations used by a call.
-     *
-     * @param stackSize amount of stack space (in bytes) required for the stack-based arguments of
-     *            the call
-     * @param returnLocation the location for the return value or {@link Value#ILLEGAL} if a void
-     *            call
-     * @param argumentLocations the ordered locations in which the arguments are placed
-     */
-    public CallingConvention(int stackSize, AllocatableValue returnLocation, AllocatableValue... argumentLocations) {
-        assert argumentLocations != null;
-        assert returnLocation != null;
-        this.argumentLocations = argumentLocations;
-        this.stackSize = stackSize;
-        this.returnLocation = returnLocation;
-        assert verify();
-    }
-
-    /**
-     * Gets the location for the return value or {@link Value#ILLEGAL} if a void call.
-     */
-    public AllocatableValue getReturn() {
-        return returnLocation;
-    }
-
-    /**
-     * Gets the location for the {@code index}'th argument.
-     */
-    public AllocatableValue getArgument(int index) {
-        return argumentLocations[index];
-    }
-
-    /**
-     * Gets the amount of stack space (in bytes) required for the stack-based arguments of the call.
-     */
-    public int getStackSize() {
-        return stackSize;
-    }
-
-    /**
-     * Gets the number of locations required for the arguments.
-     */
-    public int getArgumentCount() {
-        return argumentLocations.length;
-    }
-
-    /**
-     * Gets the locations required for the arguments.
-     */
-    public AllocatableValue[] getArguments() {
-        if (argumentLocations.length == 0) {
-            return argumentLocations;
-        }
-        return argumentLocations.clone();
-    }
-
-    @Override
-    public String toString() {
-        StringBuilder sb = new StringBuilder();
-        sb.append("CallingConvention[");
-        String sep = "";
-        for (Value op : argumentLocations) {
-            sb.append(sep).append(op);
-            sep = ", ";
-        }
-        if (!returnLocation.equals(Value.ILLEGAL)) {
-            sb.append(" -> ").append(returnLocation);
-        }
-        sb.append("]");
-        return sb.toString();
-    }
-
-    private boolean verify() {
-        for (int i = 0; i < argumentLocations.length; i++) {
-            Value location = argumentLocations[i];
-            assert isStackSlot(location) || isAllocatableValue(location);
-        }
-        return true;
-    }
-}
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CodeCacheProvider.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,101 +0,0 @@
-/*
- * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.api.code;
-
-import com.oracle.graal.api.code.CompilationResult.DataPatch;
-import com.oracle.graal.api.code.DataSection.Data;
-import com.oracle.graal.api.meta.*;
-
-/**
- * Access to code cache related details and requirements.
- */
-public interface CodeCacheProvider {
-
-    /**
-     * Adds the given compilation result 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 compResult the compilation result to be added
-     * @param speculationLog the speculation log to be used
-     * @return a reference to the compiled and ready-to-run code or throws a
-     *         {@link BailoutException} if the code installation failed
-     */
-    InstalledCode addMethod(ResolvedJavaMethod method, CompilationResult compResult, SpeculationLog speculationLog, InstalledCode predefinedInstalledCode);
-
-    /**
-     * Sets the given compilation result as the default implementation of the given method.
-     *
-     * @param method a method to which the executable code is begin added
-     * @param compResult the compilation result to be added
-     * @return a reference to the compiled and ready-to-run code or null if the code installation
-     *         failed
-     */
-    InstalledCode setDefaultMethod(ResolvedJavaMethod method, CompilationResult compResult);
-
-    /**
-     * Returns a disassembly of some compiled code.
-     *
-     * @param compResult some compiled code
-     * @param installedCode the result of installing the code in {@code compResult} or null if the
-     *            code has not yet been installed
-     *
-     * @return a disassembly. This will be of length 0 if the runtime does not support
-     *         disassembling.
-     */
-    String disassemble(CompilationResult compResult, InstalledCode installedCode);
-
-    /**
-     * Gets the register configuration to use when compiling a given method.
-     */
-    RegisterConfig getRegisterConfig();
-
-    /**
-     * 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();
-
-    /**
-     * Determines if a {@link DataPatch} should be created for a given primitive constant that is
-     * part of a {@link CompilationResult}. A data patch is always created for an object constant.
-     */
-    boolean needsDataPatch(JavaConstant constant);
-
-    /**
-     * Create a {@link Data} item for a {@link Constant}, that can be used in a {@link DataPatch}.
-     */
-    Data createDataItem(Constant constant);
-
-    /**
-     * Gets a description of the target architecture.
-     */
-    TargetDescription getTarget();
-
-    /**
-     * Create a new speculation log for the target runtime.
-     */
-    SpeculationLog createSpeculationLog();
-}
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CodeUtil.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,479 +0,0 @@
-/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.api.code;
-
-import java.util.*;
-
-import com.oracle.graal.api.meta.*;
-
-/**
- * Miscellaneous collection of utility methods used by {@code com.oracle.graal.api.code} and its
- * clients.
- */
-public class CodeUtil {
-
-    public static final String NEW_LINE = String.format("%n");
-
-    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;
-        return (Integer.SIZE - 1) - 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;
-        return (Long.SIZE - 1) - Long.numberOfLeadingZeros(val);
-    }
-
-    /**
-     * Narrow an integer value to a given bit width, and return the result as a signed long.
-     *
-     * @param value the value
-     * @param resultBits the result bit width
-     * @return {@code value} interpreted as {@code resultBits} bit number, encoded as signed long
-     */
-    public static long narrow(long value, int resultBits) {
-        long ret = value & mask(resultBits);
-        return signExtend(ret, resultBits);
-    }
-
-    /**
-     * Sign extend an integer.
-     *
-     * @param value the input value
-     * @param inputBits the bit width of the input value
-     * @return a signed long with the same value as the signed {@code inputBits}-bit number
-     *         {@code value}
-     */
-    public static long signExtend(long value, int inputBits) {
-        if (inputBits < 64) {
-            if ((value >>> (inputBits - 1) & 1) == 1) {
-                return value | (-1L << inputBits);
-            } else {
-                return value & ~(-1L << inputBits);
-            }
-        } else {
-            return value;
-        }
-    }
-
-    /**
-     * Zero extend an integer.
-     *
-     * @param value the input value
-     * @param inputBits the bit width of the input value
-     * @return an unsigned long with the same value as the unsigned {@code inputBits}-bit number
-     *         {@code value}
-     */
-    public static long zeroExtend(long value, int inputBits) {
-        if (inputBits < 64) {
-            return value & ~(-1L << inputBits);
-        } else {
-            return value;
-        }
-    }
-
-    /**
-     * Convert an integer to long.
-     *
-     * @param value the input value
-     * @param inputBits the bit width of the input value
-     * @param unsigned whether the values should be interpreted as signed or unsigned
-     * @return a long with the same value as the {@code inputBits}-bit number {@code value}
-     */
-    public static long convert(long value, int inputBits, boolean unsigned) {
-        if (unsigned) {
-            return zeroExtend(value, inputBits);
-        } else {
-            return signExtend(value, inputBits);
-        }
-    }
-
-    /**
-     * Get a bitmask with the low {@code bits} bit set and the high {@code 64 - bits} bit clear.
-     */
-    public static long mask(int bits) {
-        assert 0 <= bits && bits <= 64;
-        if (bits == 64) {
-            return 0xffffffffffffffffL;
-        } else {
-            return (1L << bits) - 1;
-        }
-    }
-
-    /**
-     * Get the minimum value representable in a {@code bits} bit signed integer.
-     */
-    public static long minValue(int bits) {
-        assert 0 < bits && bits <= 64;
-        return -1L << (bits - 1);
-    }
-
-    /**
-     * Get the maximum value representable in a {@code bits} bit signed integer.
-     */
-    public static long maxValue(int bits) {
-        assert 0 < bits && bits <= 64;
-        return mask(bits - 1);
-    }
-
-    /**
-     * 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(BytecodeFrame 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 CodeUtil.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();
-    }
-
-    /**
-     * 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, BytecodePosition pos) {
-        MetaUtil.appendLocation(sb.append("at "), pos.getMethod(), pos.getBCI());
-        if (pos.getCaller() != null) {
-            sb.append(NEW_LINE);
-            append(sb, pos.getCaller());
-        }
-        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, BytecodeFrame frame) {
-        MetaUtil.appendLocation(sb.append("at "), frame.getMethod(), frame.getBCI());
-        assert sb.charAt(sb.length() - 1) == ']';
-        sb.deleteCharAt(sb.length() - 1);
-        sb.append(", duringCall: ").append(frame.duringCall).append(", rethrow: ").append(frame.rethrowException).append(']');
-        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.getCaller() != null) {
-            sb.append(NEW_LINE);
-            append(sb, frame.getCaller());
-        }
-        return sb;
-    }
-
-    public interface RefMapFormatter {
-
-        String formatStackSlot(int frameRefMapIndex);
-
-        String formatRegister(int regRefMapIndex);
-    }
-
-    /**
-     * Formats a location in a register reference map.
-     */
-    public static class DefaultRegFormatter implements RefMapFormatter {
-
-        private final Register[] registers;
-
-        public DefaultRegFormatter(Architecture arch) {
-            registers = new Register[arch.getRegisterReferenceMapSize()];
-            for (Register r : arch.getRegisters()) {
-                if (r.getReferenceMapIndex() >= 0) {
-                    registers[r.getReferenceMapIndex()] = r;
-                }
-            }
-        }
-
-        public String formatStackSlot(int frameRefMapIndex) {
-            return null;
-        }
-
-        public String formatRegister(int regRefMapIndex) {
-            int i = regRefMapIndex;
-            int idx = 0;
-            while (registers[i] == null) {
-                i--;
-                idx++;
-            }
-            if (idx == 0) {
-                return registers[i].toString();
-            } else {
-                return String.format("%s+%d", registers[i].toString(), idx);
-            }
-        }
-    }
-
-    /**
-     * Formats a location present in a register or frame reference map.
-     */
-    public static class DefaultRefMapFormatter extends DefaultRegFormatter {
-
-        /**
-         * The size of a stack slot.
-         */
-        public final int slotSize;
-
-        /**
-         * The register used as the frame pointer.
-         */
-        public final Register fp;
-
-        /**
-         * 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 DefaultRefMapFormatter(Architecture arch, int slotSize, Register fp, int refMapToFPOffset) {
-            super(arch);
-            this.slotSize = slotSize;
-            this.fp = fp;
-            this.refMapToFPOffset = refMapToFPOffset;
-        }
-
-        @Override
-        public String formatStackSlot(int frameRefMapIndex) {
-            int refMapOffset = frameRefMapIndex * slotSize;
-            int fpOffset = refMapOffset + refMapToFPOffset;
-            if (fpOffset >= 0) {
-                return fp + "+" + fpOffset;
-            }
-            return fp.name + fpOffset;
-        }
-    }
-
-    public static class NumberedRefMapFormatter implements RefMapFormatter {
-
-        public String formatStackSlot(int frameRefMapIndex) {
-            return "s" + frameRefMapIndex;
-        }
-
-        public String formatRegister(int regRefMapIndex) {
-            return "r" + regRefMapIndex;
-        }
-    }
-
-    /**
-     * 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, DebugInfo info, RefMapFormatter formatterArg) {
-        RefMapFormatter formatter = formatterArg;
-        if (formatter == null) {
-            formatter = new NumberedRefMapFormatter();
-        }
-        String nl = NEW_LINE;
-        ReferenceMap refMap = info.getReferenceMap();
-        if (refMap != null && refMap.hasRegisterRefMap()) {
-            sb.append("  reg-ref-map:");
-            refMap.appendRegisterMap(sb, formatter);
-            sb.append(nl);
-        }
-        if (refMap != null && refMap.hasFrameRefMap()) {
-            sb.append("frame-ref-map:");
-            refMap.appendFrameMap(sb, formatter);
-            sb.append(nl);
-        }
-        RegisterSaveLayout calleeSaveInfo = info.getCalleeSaveInfo();
-        if (calleeSaveInfo != null) {
-            sb.append("callee-save-info:").append(nl);
-            Map<Integer, Register> map = calleeSaveInfo.slotsToRegisters(true);
-            for (Map.Entry<Integer, Register> e : map.entrySet()) {
-                sb.append("    ").append(e.getValue()).append(" -> ").append(formatter.formatStackSlot(e.getKey())).append(nl);
-            }
-        }
-        BytecodeFrame frame = info.frame();
-        if (frame != null) {
-            append(sb, frame);
-        } else if (info.getBytecodePosition() != null) {
-            append(sb, info.getBytecodePosition());
-        }
-        return sb;
-    }
-
-    /**
-     * Create a calling convention from a {@link ResolvedJavaMethod}.
-     */
-    public static CallingConvention getCallingConvention(CodeCacheProvider codeCache, CallingConvention.Type type, ResolvedJavaMethod method, boolean stackOnly) {
-        Signature sig = method.getSignature();
-        JavaType retType = sig.getReturnType(null);
-        int sigCount = sig.getParameterCount(false);
-        JavaType[] argTypes;
-        int argIndex = 0;
-        if (!method.isStatic()) {
-            argTypes = new JavaType[sigCount + 1];
-            argTypes[argIndex++] = method.getDeclaringClass();
-        } else {
-            argTypes = new JavaType[sigCount];
-        }
-        for (int i = 0; i < sigCount; i++) {
-            argTypes[argIndex++] = sig.getParameterType(i, null);
-        }
-
-        RegisterConfig registerConfig = codeCache.getRegisterConfig();
-        return registerConfig.getCallingConvention(type, retType, argTypes, codeCache.getTarget(), stackOnly);
-    }
-}
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CompilationResult.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,949 +0,0 @@
-/*
- * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.api.code;
-
-import static com.oracle.graal.api.meta.MetaUtil.*;
-import static java.util.Collections.*;
-
-import java.util.*;
-
-import com.oracle.graal.api.code.CodeUtil.RefMapFormatter;
-import com.oracle.graal.api.meta.Assumptions.Assumption;
-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.
- */
-public class CompilationResult {
-
-    /**
-     * Represents a code position with associated additional information.
-     */
-    public abstract static class Site {
-
-        /**
-         * The position (or offset) of this site with respect to the start of the target method.
-         */
-        public final int pcOffset;
-
-        public Site(int pos) {
-            this.pcOffset = pos;
-        }
-
-        @Override
-        public final int hashCode() {
-            throw new UnsupportedOperationException("hashCode");
-        }
-
-        @Override
-        public String toString() {
-            return identityHashCodeString(this);
-        }
-
-        @Override
-        public abstract boolean equals(Object obj);
-    }
-
-    /**
-     * Represents an infopoint with associated debug info. Note that safepoints are also infopoints.
-     */
-    public static class Infopoint extends Site implements Comparable<Infopoint> {
-
-        public final DebugInfo debugInfo;
-
-        public final InfopointReason reason;
-
-        public Infopoint(int pcOffset, DebugInfo debugInfo, InfopointReason reason) {
-            super(pcOffset);
-            this.debugInfo = debugInfo;
-            this.reason = reason;
-        }
-
-        @Override
-        public String toString() {
-            StringBuilder sb = new StringBuilder();
-            sb.append(pcOffset);
-            sb.append("[<infopoint>]");
-            appendDebugInfo(sb, debugInfo);
-            return sb.toString();
-        }
-
-        @Override
-        public int compareTo(Infopoint o) {
-            if (pcOffset < o.pcOffset) {
-                return -1;
-            } else if (pcOffset > o.pcOffset) {
-                return 1;
-            }
-            return this.reason.compareTo(o.reason);
-        }
-
-        @Override
-        public boolean equals(Object obj) {
-            if (this == obj) {
-                return true;
-            }
-            if (obj != null && obj.getClass() == getClass()) {
-                Infopoint that = (Infopoint) obj;
-                if (this.pcOffset == that.pcOffset && Objects.equals(this.debugInfo, that.debugInfo) && Objects.equals(this.reason, that.reason)) {
-                    return true;
-                }
-            }
-            return false;
-        }
-    }
-
-    /**
-     * Represents a call in the code.
-     */
-    public static final class Call extends Infopoint {
-
-        /**
-         * The target of the call.
-         */
-        public final InvokeTarget target;
-
-        /**
-         * The size of the call instruction.
-         */
-        public final int size;
-
-        /**
-         * Specifies if this call is direct or indirect. A direct call has an immediate operand
-         * encoding the absolute or relative (to the call itself) address of the target. An indirect
-         * call has a register or memory operand specifying the target address of the call.
-         */
-        public final boolean direct;
-
-        public Call(InvokeTarget target, int pcOffset, int size, boolean direct, DebugInfo debugInfo) {
-            super(pcOffset, debugInfo, InfopointReason.CALL);
-            this.size = size;
-            this.target = target;
-            this.direct = direct;
-        }
-
-        @Override
-        public boolean equals(Object obj) {
-            if (this == obj) {
-                return true;
-            }
-            if (obj instanceof Call && super.equals(obj)) {
-                Call that = (Call) obj;
-                if (this.size == that.size && this.direct == that.direct && Objects.equals(this.target, that.target)) {
-                    return true;
-                }
-            }
-            return false;
-        }
-
-        @Override
-        public String toString() {
-            StringBuilder sb = new StringBuilder();
-            sb.append(pcOffset);
-            sb.append('[');
-            sb.append(target);
-            sb.append(']');
-
-            if (debugInfo != null) {
-                appendDebugInfo(sb, debugInfo);
-            }
-
-            return sb.toString();
-        }
-    }
-
-    /**
-     * Represents some external data that is referenced by the code.
-     */
-    public abstract static class Reference {
-
-        @Override
-        public abstract int hashCode();
-
-        @Override
-        public abstract boolean equals(Object obj);
-    }
-
-    public static final class ConstantReference extends Reference {
-
-        private final VMConstant constant;
-
-        public ConstantReference(VMConstant constant) {
-            this.constant = constant;
-        }
-
-        public VMConstant getConstant() {
-            return constant;
-        }
-
-        @Override
-        public String toString() {
-            return constant.toString();
-        }
-
-        @Override
-        public int hashCode() {
-            return constant.hashCode();
-        }
-
-        @Override
-        public boolean equals(Object obj) {
-            if (this == obj) {
-                return true;
-            }
-            if (obj instanceof ConstantReference) {
-                ConstantReference that = (ConstantReference) obj;
-                return Objects.equals(this.constant, that.constant);
-            }
-            return false;
-        }
-    }
-
-    public static final class DataSectionReference extends Reference {
-
-        private boolean initialized;
-        private int offset;
-
-        public DataSectionReference() {
-            // will be set after the data section layout is fixed
-            offset = 0xDEADDEAD;
-        }
-
-        public int getOffset() {
-            assert initialized;
-
-            return offset;
-        }
-
-        public void setOffset(int offset) {
-            assert !initialized;
-            initialized = true;
-
-            this.offset = offset;
-        }
-
-        @Override
-        public int hashCode() {
-            return offset;
-        }
-
-        @Override
-        public boolean equals(Object obj) {
-            if (this == obj) {
-                return true;
-            }
-            if (obj instanceof DataSectionReference) {
-                DataSectionReference that = (DataSectionReference) obj;
-                return this.offset == that.offset;
-            }
-            return false;
-        }
-    }
-
-    /**
-     * Represents a code site that references some data. The associated data can be either a
-     * {@link DataSectionReference reference} to the data section, or it may be an inlined
-     * {@link JavaConstant} that needs to be patched.
-     */
-    public static final class DataPatch extends Site {
-
-        public Reference reference;
-
-        public DataPatch(int pcOffset, Reference reference) {
-            super(pcOffset);
-            this.reference = reference;
-        }
-
-        @Override
-        public String toString() {
-            return String.format("%d[<data patch referring to %s>]", pcOffset, reference.toString());
-        }
-
-        @Override
-        public boolean equals(Object obj) {
-            if (this == obj) {
-                return true;
-            }
-            if (obj instanceof DataPatch) {
-                DataPatch that = (DataPatch) obj;
-                if (this.pcOffset == that.pcOffset && Objects.equals(this.reference, that.reference)) {
-                    return true;
-                }
-            }
-            return false;
-        }
-    }
-
-    /**
-     * Provides extra information about instructions or data at specific positions in
-     * {@link CompilationResult#getTargetCode()}. This is optional information that can be used to
-     * enhance a disassembly of the code.
-     */
-    public abstract static class CodeAnnotation {
-
-        public final int position;
-
-        public CodeAnnotation(int position) {
-            this.position = position;
-        }
-
-        @Override
-        public final int hashCode() {
-            throw new UnsupportedOperationException("hashCode");
-        }
-
-        @Override
-        public String toString() {
-            return identityHashCodeString(this);
-        }
-
-        @Override
-        public abstract boolean equals(Object obj);
-    }
-
-    /**
-     * A string comment about one or more instructions at a specific position in the code.
-     */
-    public static final class CodeComment extends CodeAnnotation {
-
-        public final String value;
-
-        public CodeComment(int position, String comment) {
-            super(position);
-            this.value = comment;
-        }
-
-        @Override
-        public boolean equals(Object obj) {
-            if (this == obj) {
-                return true;
-            }
-            if (obj instanceof CodeComment) {
-                CodeComment that = (CodeComment) obj;
-                if (this.position == that.position && this.value.equals(that.value)) {
-                    return true;
-                }
-            }
-            return false;
-        }
-
-        @Override
-        public String toString() {
-            return getClass().getSimpleName() + "@" + position + ": " + value;
-        }
-    }
-
-    /**
-     * Describes a table of signed offsets embedded in the code. The offsets are relative to the
-     * starting address of the table. This type of table maybe generated when translating a
-     * multi-way branch based on a key value from a dense value set (e.g. the {@code tableswitch}
-     * JVM instruction).
-     *
-     * The table is indexed by the contiguous range of integers from {@link #low} to {@link #high}
-     * inclusive.
-     */
-    public static final class JumpTable extends CodeAnnotation {
-
-        /**
-         * The low value in the key range (inclusive).
-         */
-        public final int low;
-
-        /**
-         * The high value in the key range (inclusive).
-         */
-        public final int high;
-
-        /**
-         * The size (in bytes) of each table entry.
-         */
-        public final int entrySize;
-
-        public JumpTable(int position, int low, int high, int entrySize) {
-            super(position);
-            this.low = low;
-            this.high = high;
-            this.entrySize = entrySize;
-        }
-
-        @Override
-        public boolean equals(Object obj) {
-            if (this == obj) {
-                return true;
-            }
-            if (obj instanceof JumpTable) {
-                JumpTable that = (JumpTable) obj;
-                if (this.position == that.position && this.entrySize == that.entrySize && this.low == that.low && this.high == that.high) {
-                    return true;
-                }
-            }
-            return false;
-        }
-
-        @Override
-        public String toString() {
-            return getClass().getSimpleName() + "@" + position + ": [" + low + " .. " + high + "]";
-        }
-    }
-
-    /**
-     * Represents exception handler information for a specific code position. It includes the catch
-     * code position as well as the caught exception type.
-     */
-    public static final class ExceptionHandler extends Site {
-
-        public final int handlerPos;
-
-        ExceptionHandler(int pcOffset, int handlerPos) {
-            super(pcOffset);
-            this.handlerPos = handlerPos;
-        }
-
-        @Override
-        public String toString() {
-            return String.format("%d[<exception edge to %d>]", pcOffset, handlerPos);
-        }
-
-        @Override
-        public boolean equals(Object obj) {
-            if (this == obj) {
-                return true;
-            }
-            if (obj instanceof ExceptionHandler) {
-                ExceptionHandler that = (ExceptionHandler) obj;
-                if (this.pcOffset == that.pcOffset && this.handlerPos == that.handlerPos) {
-                    return true;
-                }
-            }
-            return false;
-        }
-    }
-
-    /**
-     * Represents a mark in the machine code that can be used by the runtime for its own purposes. A
-     * mark can reference other marks.
-     */
-    public static final class Mark extends Site {
-
-        public final Object id;
-
-        public Mark(int pcOffset, Object id) {
-            super(pcOffset);
-            this.id = id;
-        }
-
-        @Override
-        public String toString() {
-            if (id == null) {
-                return String.format("%d[<mar>]", pcOffset);
-            } else if (id instanceof Integer) {
-                return String.format("%d[<mark with id %s>]", pcOffset, Integer.toHexString((Integer) id));
-            } else {
-                return String.format("%d[<mark with id %s>]", pcOffset, id.toString());
-            }
-        }
-
-        @Override
-        public boolean equals(Object obj) {
-            if (this == obj) {
-                return true;
-            }
-            if (obj instanceof Mark) {
-                Mark that = (Mark) obj;
-                if (this.pcOffset == that.pcOffset && Objects.equals(this.id, that.id)) {
-                    return true;
-                }
-            }
-            return false;
-        }
-    }
-
-    private int id = -1;
-    private int entryBCI = -1;
-
-    private final DataSection dataSection = new DataSection();
-
-    private final List<Infopoint> infopoints = new ArrayList<>();
-    private final List<DataPatch> dataPatches = new ArrayList<>();
-    private final List<ExceptionHandler> exceptionHandlers = new ArrayList<>();
-    private final List<Mark> marks = new ArrayList<>();
-
-    private int totalFrameSize = -1;
-    private int customStackAreaOffset = -1;
-
-    private final String name;
-
-    /**
-     * The buffer containing the emitted machine code.
-     */
-    private byte[] targetCode;
-
-    /**
-     * The leading number of bytes in {@link #targetCode} containing the emitted machine code.
-     */
-    private int targetCodeSize;
-
-    private ArrayList<CodeAnnotation> annotations;
-
-    private Assumption[] assumptions;
-
-    /**
-     * The list of the methods whose bytecodes were used as input to the compilation. If
-     * {@code null}, then the compilation did not record method dependencies. Otherwise, the first
-     * element of this array is the root method of the compilation.
-     */
-    private ResolvedJavaMethod[] methods;
-
-    public CompilationResult() {
-        this(null);
-    }
-
-    public CompilationResult(String name) {
-        this.name = name;
-    }
-
-    @Override
-    public int hashCode() {
-        // CompilationResult instances should not be used as hash map keys
-        throw new UnsupportedOperationException("hashCode");
-    }
-
-    @Override
-    public String toString() {
-        if (methods != null) {
-            return getClass().getName() + "[" + methods[0].format("%H.%n(%p)%r") + "]";
-        }
-        return identityHashCodeString(this);
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj != null && obj.getClass() == getClass()) {
-            CompilationResult that = (CompilationResult) obj;
-            // @formatter:off
-            if (this.entryBCI == that.entryBCI &&
-                this.id == that.id &&
-                this.customStackAreaOffset == that.customStackAreaOffset &&
-                this.totalFrameSize == that.totalFrameSize &&
-                this.targetCodeSize == that.targetCodeSize &&
-                Objects.equals(this.name, that.name) &&
-                Objects.equals(this.annotations, that.annotations) &&
-                Objects.equals(this.dataSection, that.dataSection) &&
-                Objects.equals(this.exceptionHandlers, that.exceptionHandlers) &&
-                Objects.equals(this.dataPatches, that.dataPatches) &&
-                Objects.equals(this.infopoints, that.infopoints) &&
-                Objects.equals(this.marks,  that.marks) &&
-                Arrays.equals(this.assumptions, that.assumptions) &&
-                Arrays.equals(targetCode, that.targetCode)) {
-                return true;
-            }
-            // @formatter:on
-        }
-        return false;
-    }
-
-    /**
-     * @return the compile id
-     */
-    public int getId() {
-        return id;
-    }
-
-    /**
-     * @param id the compile id to set
-     */
-    public void setId(int id) {
-        this.id = id;
-    }
-
-    /**
-     * @return the entryBCI
-     */
-    public int getEntryBCI() {
-        return entryBCI;
-    }
-
-    /**
-     * @param entryBCI the entryBCI to set
-     */
-    public void setEntryBCI(int entryBCI) {
-        this.entryBCI = entryBCI;
-    }
-
-    /**
-     * Sets the assumptions made during compilation.
-     */
-    public void setAssumptions(Assumption[] assumptions) {
-        this.assumptions = assumptions;
-    }
-
-    /**
-     * Gets the assumptions made during compilation.
-     */
-    public Assumption[] getAssumptions() {
-        return assumptions;
-    }
-
-    /**
-     * Sets the methods whose bytecodes were used as input to the compilation.
-     *
-     * @param rootMethod the root method of the compilation
-     * @param inlinedMethods the methods inlined during compilation
-     */
-    public void setMethods(ResolvedJavaMethod rootMethod, Collection<ResolvedJavaMethod> inlinedMethods) {
-        assert rootMethod != null;
-        assert inlinedMethods != null;
-        if (inlinedMethods.contains(rootMethod)) {
-            methods = inlinedMethods.toArray(new ResolvedJavaMethod[inlinedMethods.size()]);
-            for (int i = 0; i < methods.length; i++) {
-                if (methods[i].equals(rootMethod)) {
-                    if (i != 0) {
-                        ResolvedJavaMethod tmp = methods[0];
-                        methods[0] = methods[i];
-                        methods[i] = tmp;
-                    }
-                    break;
-                }
-            }
-        } else {
-            methods = new ResolvedJavaMethod[1 + inlinedMethods.size()];
-            methods[0] = rootMethod;
-            int i = 1;
-            for (ResolvedJavaMethod m : inlinedMethods) {
-                methods[i++] = m;
-            }
-        }
-    }
-
-    /**
-     * Gets the methods whose bytecodes were used as input to the compilation.
-     *
-     * @return {@code null} if the compilation did not record method dependencies otherwise the
-     *         methods whose bytecodes were used as input to the compilation with the first element
-     *         being the root method of the compilation
-     */
-    public ResolvedJavaMethod[] getMethods() {
-        return methods;
-    }
-
-    public DataSection getDataSection() {
-        return dataSection;
-    }
-
-    /**
-     * The total frame size of the method in bytes. This includes the return address pushed onto the
-     * stack, if any.
-     *
-     * @return the frame size
-     */
-    public int getTotalFrameSize() {
-        assert totalFrameSize != -1 : "frame size not yet initialized!";
-        return totalFrameSize;
-    }
-
-    /**
-     * Sets the total frame size in bytes. This includes the return address pushed onto the stack,
-     * if any.
-     *
-     * @param size the size of the frame in bytes
-     */
-    public void setTotalFrameSize(int size) {
-        totalFrameSize = size;
-    }
-
-    /**
-     * Sets the machine that has been generated by the compiler.
-     *
-     * @param code the machine code generated
-     * @param size the size of the machine code
-     */
-    public void setTargetCode(byte[] code, int size) {
-        targetCode = code;
-        targetCodeSize = size;
-    }
-
-    /**
-     * Records a data patch in the code section. The data patch can refer to something in the
-     * {@link DataSectionReference data section} or directly to an {@link ConstantReference inlined
-     * constant}.
-     *
-     * @param codePos The position in the code that needs to be patched.
-     * @param ref The reference that should be inserted in the code.
-     */
-    public void recordDataPatch(int codePos, Reference ref) {
-        assert codePos >= 0 && ref != null;
-        dataPatches.add(new DataPatch(codePos, ref));
-    }
-
-    /**
-     * Records a call in the code array.
-     *
-     * @param codePos the position of the call in the code array
-     * @param size the size of the call instruction
-     * @param target the being called
-     * @param debugInfo the debug info for the call
-     * @param direct specifies if this is a {@linkplain Call#direct direct} call
-     */
-    public void recordCall(int codePos, int size, InvokeTarget target, DebugInfo debugInfo, boolean direct) {
-        final Call call = new Call(target, codePos, size, direct, debugInfo);
-        addInfopoint(call);
-    }
-
-    /**
-     * Records an exception handler for this method.
-     *
-     * @param codePos the position in the code that is covered by the handler
-     * @param handlerPos the position of the handler
-     */
-    public void recordExceptionHandler(int codePos, int handlerPos) {
-        assert validateExceptionHandlerAdd(codePos, handlerPos) : String.format("Duplicate exception handler for pc 0x%x handlerPos 0x%x", codePos, handlerPos);
-        exceptionHandlers.add(new ExceptionHandler(codePos, handlerPos));
-    }
-
-    /**
-     * Validate if the exception handler for codePos already exists and handlerPos is different.
-     *
-     * @param codePos
-     * @param handlerPos
-     * @return true if the validation is successful
-     */
-    private boolean validateExceptionHandlerAdd(int codePos, int handlerPos) {
-        ExceptionHandler exHandler = getExceptionHandlerForCodePos(codePos);
-        return exHandler == null || exHandler.handlerPos == handlerPos;
-    }
-
-    /**
-     * Returns the first ExceptionHandler which matches codePos.
-     *
-     * @param codePos position to search for
-     * @return first matching ExceptionHandler
-     */
-    private ExceptionHandler getExceptionHandlerForCodePos(int codePos) {
-        for (ExceptionHandler h : exceptionHandlers) {
-            if (h.pcOffset == codePos) {
-                return h;
-            }
-        }
-        return null;
-    }
-
-    /**
-     * Records an infopoint in the code array.
-     *
-     * @param codePos the position of the infopoint in the code array
-     * @param debugInfo the debug info for the infopoint
-     */
-    public void recordInfopoint(int codePos, DebugInfo debugInfo, InfopointReason reason) {
-        addInfopoint(new Infopoint(codePos, debugInfo, reason));
-    }
-
-    /**
-     * Records a custom infopoint in the code section.
-     *
-     * Compiler implementations can use this method to record non-standard infopoints, which are not
-     * handled by the dedicated methods like {@link #recordCall}.
-     *
-     * @param infopoint the infopoint to record, usually a derived class from {@link Infopoint}
-     */
-    public void addInfopoint(Infopoint infopoint) {
-        // The infopoints list must always be sorted
-        if (!infopoints.isEmpty()) {
-            Infopoint previousInfopoint = infopoints.get(infopoints.size() - 1);
-            if (previousInfopoint.pcOffset > infopoint.pcOffset) {
-                // This re-sorting should be very rare
-                Collections.sort(infopoints);
-                previousInfopoint = infopoints.get(infopoints.size() - 1);
-            }
-            if (previousInfopoint.pcOffset == infopoint.pcOffset) {
-                if (infopoint.reason.canBeOmitted()) {
-                    return;
-                }
-                if (previousInfopoint.reason.canBeOmitted()) {
-                    Infopoint removed = infopoints.remove(infopoints.size() - 1);
-                    assert removed == previousInfopoint;
-                } else {
-                    throw new RuntimeException("Infopoints that can not be omited should have distinct PCs");
-                }
-            }
-        }
-        infopoints.add(infopoint);
-    }
-
-    /**
-     * Records an instruction mark within this method.
-     *
-     * @param codePos the position in the code that is covered by the handler
-     * @param markId the identifier for this mark
-     */
-    public Mark recordMark(int codePos, Object markId) {
-        Mark mark = new Mark(codePos, markId);
-        marks.add(mark);
-        return mark;
-    }
-
-    /**
-     * Offset in bytes for the custom stack area (relative to sp).
-     *
-     * @return the offset in bytes
-     */
-    public int getCustomStackAreaOffset() {
-        return customStackAreaOffset;
-    }
-
-    /**
-     * @see #getCustomStackAreaOffset()
-     * @param offset
-     */
-    public void setCustomStackAreaOffset(int offset) {
-        customStackAreaOffset = offset;
-    }
-
-    /**
-     * @return the machine code generated for this method
-     */
-    public byte[] getTargetCode() {
-        return targetCode;
-    }
-
-    /**
-     * @return the size of the machine code generated for this method
-     */
-    public int getTargetCodeSize() {
-        return targetCodeSize;
-    }
-
-    /**
-     * @return the code annotations or {@code null} if there are none
-     */
-    public List<CodeAnnotation> getAnnotations() {
-        if (annotations == null) {
-            return Collections.emptyList();
-        }
-        return annotations;
-    }
-
-    public void addAnnotation(CodeAnnotation annotation) {
-        assert annotation != null;
-        if (annotations == null) {
-            annotations = new ArrayList<>();
-        }
-        annotations.add(annotation);
-    }
-
-    private static void appendDebugInfo(StringBuilder sb, DebugInfo info) {
-        if (info != null) {
-            ReferenceMap refMap = info.getReferenceMap();
-            if (refMap != null) {
-                RefMapFormatter formatter = new CodeUtil.NumberedRefMapFormatter();
-                if (refMap.hasFrameRefMap()) {
-                    sb.append(" stackMap[");
-                    refMap.appendFrameMap(sb, formatter);
-                    sb.append(']');
-                }
-                if (refMap.hasRegisterRefMap()) {
-                    sb.append(" registerMap[");
-                    refMap.appendRegisterMap(sb, formatter);
-                    sb.append(']');
-                }
-            }
-            RegisterSaveLayout calleeSaveInfo = info.getCalleeSaveInfo();
-            if (calleeSaveInfo != null) {
-                sb.append(" callee-save-info[");
-                String sep = "";
-                for (Map.Entry<Register, Integer> e : calleeSaveInfo.registersToSlots(true).entrySet()) {
-                    sb.append(sep).append(e.getKey()).append("->").append(e.getValue());
-                    sep = ", ";
-                }
-                sb.append(']');
-            }
-            BytecodePosition codePos = info.getBytecodePosition();
-            if (codePos != null) {
-                MetaUtil.appendLocation(sb.append(" "), codePos.getMethod(), codePos.getBCI());
-                if (info.hasFrame()) {
-                    sb.append(" #locals=").append(info.frame().numLocals).append(" #expr=").append(info.frame().numStack);
-                    if (info.frame().numLocks > 0) {
-                        sb.append(" #locks=").append(info.frame().numLocks);
-                    }
-                }
-            }
-        }
-    }
-
-    /**
-     * @return the list of infopoints, sorted by {@link Site#pcOffset}
-     */
-    public List<Infopoint> getInfopoints() {
-        if (infopoints.isEmpty()) {
-            return emptyList();
-        }
-        return unmodifiableList(infopoints);
-    }
-
-    /**
-     * @return the list of data references
-     */
-    public List<DataPatch> getDataPatches() {
-        if (dataPatches.isEmpty()) {
-            return emptyList();
-        }
-        return unmodifiableList(dataPatches);
-    }
-
-    /**
-     * @return the list of exception handlers
-     */
-    public List<ExceptionHandler> getExceptionHandlers() {
-        if (exceptionHandlers.isEmpty()) {
-            return emptyList();
-        }
-        return unmodifiableList(exceptionHandlers);
-    }
-
-    /**
-     * @return the list of marks
-     */
-    public List<Mark> getMarks() {
-        if (marks.isEmpty()) {
-            return emptyList();
-        }
-        return unmodifiableList(marks);
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    public void reset() {
-        infopoints.clear();
-        dataPatches.clear();
-        exceptionHandlers.clear();
-        marks.clear();
-        if (annotations != null) {
-            annotations.clear();
-        }
-    }
-}
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/DataSection.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,278 +0,0 @@
-/*
- * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.api.code;
-
-import static com.oracle.graal.api.meta.MetaUtil.*;
-
-import java.nio.*;
-import java.util.*;
-import java.util.function.*;
-
-import com.oracle.graal.api.code.CompilationResult.DataPatch;
-import com.oracle.graal.api.code.CompilationResult.DataSectionReference;
-import com.oracle.graal.api.code.DataSection.Data;
-import com.oracle.graal.api.meta.*;
-
-public final class DataSection implements Iterable<Data> {
-
-    @FunctionalInterface
-    public interface DataBuilder {
-
-        void emit(ByteBuffer buffer, Consumer<DataPatch> patch);
-
-        static DataBuilder raw(byte[] data) {
-            return (buffer, patch) -> buffer.put(data);
-        }
-
-        static DataBuilder serializable(SerializableConstant c) {
-            return (buffer, patch) -> c.serialize(buffer);
-        }
-
-        static DataBuilder zero(int size) {
-            switch (size) {
-                case 1:
-                    return (buffer, patch) -> buffer.put((byte) 0);
-                case 2:
-                    return (buffer, patch) -> buffer.putShort((short) 0);
-                case 4:
-                    return (buffer, patch) -> buffer.putInt(0);
-                case 8:
-                    return (buffer, patch) -> buffer.putLong(0L);
-                default:
-                    return (buffer, patch) -> {
-                        int rest = size;
-                        while (rest > 8) {
-                            buffer.putLong(0L);
-                            rest -= 8;
-                        }
-                        while (rest > 0) {
-                            buffer.put((byte) 0);
-                            rest--;
-                        }
-                    };
-            }
-        }
-    }
-
-    public static final class Data {
-
-        private int alignment;
-        private final int size;
-        private final DataBuilder builder;
-
-        private DataSectionReference ref;
-
-        public Data(int alignment, int size, DataBuilder builder) {
-            this.alignment = alignment;
-            this.size = size;
-            this.builder = builder;
-
-            // initialized in DataSection.insertData(Data)
-            ref = null;
-        }
-
-        public void updateAlignment(int newAlignment) {
-            if (newAlignment == alignment) {
-                return;
-            }
-            alignment = lcm(alignment, newAlignment);
-        }
-
-        public int getAlignment() {
-            return alignment;
-        }
-
-        public int getSize() {
-            return size;
-        }
-
-        public DataBuilder getBuilder() {
-            return builder;
-        }
-
-        @Override
-        public int hashCode() {
-            // Data instances should not be used as hash map keys
-            throw new UnsupportedOperationException("hashCode");
-        }
-
-        @Override
-        public String toString() {
-            return identityHashCodeString(this);
-        }
-
-        @Override
-        public boolean equals(Object obj) {
-            assert ref != null;
-            if (obj == this) {
-                return true;
-            }
-            if (obj instanceof Data) {
-                Data that = (Data) obj;
-                if (this.alignment == that.alignment && this.size == that.size && this.ref.equals(that.ref)) {
-                    return true;
-                }
-            }
-            return false;
-        }
-    }
-
-    private final ArrayList<Data> dataItems = new ArrayList<>();
-
-    private boolean finalLayout;
-    private int sectionAlignment;
-    private int sectionSize;
-
-    @Override
-    public int hashCode() {
-        // DataSection instances should not be used as hash map keys
-        throw new UnsupportedOperationException("hashCode");
-    }
-
-    @Override
-    public String toString() {
-        return identityHashCodeString(this);
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj instanceof DataSection) {
-            DataSection that = (DataSection) obj;
-            if (this.finalLayout == that.finalLayout && this.sectionAlignment == that.sectionAlignment && this.sectionSize == that.sectionSize && Objects.equals(this.dataItems, that.dataItems)) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    /**
-     * Insert a {@link Data} item into the data section. If the item is already in the data section,
-     * the same {@link DataSectionReference} is returned.
-     *
-     * @param data the {@link Data} item to be inserted
-     * @return a unique {@link DataSectionReference} identifying the {@link Data} item
-     */
-    public DataSectionReference insertData(Data data) {
-        assert !finalLayout;
-        if (data.ref == null) {
-            data.ref = new DataSectionReference();
-            dataItems.add(data);
-        }
-        return data.ref;
-    }
-
-    /**
-     * Compute the layout of the data section. This can be called only once, and after it has been
-     * called, the data section can no longer be modified.
-     */
-    public void finalizeLayout() {
-        assert !finalLayout;
-        finalLayout = true;
-
-        // simple heuristic: put items with larger alignment requirement first
-        dataItems.sort((a, b) -> a.alignment - b.alignment);
-
-        int position = 0;
-        for (Data d : dataItems) {
-            sectionAlignment = lcm(sectionAlignment, d.alignment);
-            position = align(position, d.alignment);
-
-            d.ref.setOffset(position);
-            position += d.size;
-        }
-
-        sectionSize = position;
-    }
-
-    /**
-     * Get the size of the data section. Can only be called after {@link #finalizeLayout}.
-     */
-    public int getSectionSize() {
-        assert finalLayout;
-        return sectionSize;
-    }
-
-    /**
-     * Get the minimum alignment requirement of the data section. Can only be called after
-     * {@link #finalizeLayout}.
-     */
-    public int getSectionAlignment() {
-        assert finalLayout;
-        return sectionAlignment;
-    }
-
-    /**
-     * Build the data section. Can only be called after {@link #finalizeLayout}.
-     *
-     * @param buffer The {@link ByteBuffer} where the data section should be built. The buffer must
-     *            hold at least {@link #getSectionSize()} bytes.
-     * @param patch A {@link Consumer} to receive {@link DataPatch data patches} for relocations in
-     *            the data section.
-     */
-    public void buildDataSection(ByteBuffer buffer, Consumer<DataPatch> patch) {
-        assert finalLayout;
-        for (Data d : dataItems) {
-            buffer.position(d.ref.getOffset());
-            d.builder.emit(buffer, patch);
-        }
-    }
-
-    public Data findData(DataSectionReference ref) {
-        for (Data d : dataItems) {
-            if (d.ref == ref) {
-                return d;
-            }
-        }
-        return null;
-    }
-
-    public Iterator<Data> iterator() {
-        return dataItems.iterator();
-    }
-
-    private static int lcm(int x, int y) {
-        if (x == 0) {
-            return y;
-        } else if (y == 0) {
-            return x;
-        }
-
-        int a = Math.max(x, y);
-        int b = Math.min(x, y);
-        while (b > 0) {
-            int tmp = a % b;
-            a = b;
-            b = tmp;
-        }
-
-        int gcd = a;
-        return x * y / gcd;
-    }
-
-    private static int align(int position, int alignment) {
-        return ((position + alignment - 1) / alignment) * alignment;
-    }
-}
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/DebugInfo.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,137 +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.graal.api.code;
-
-import java.util.*;
-
-import com.oracle.graal.api.meta.*;
-
-/**
- * Represents the debugging information for a particular point of execution. This information
- * includes:
- * <ul>
- * <li>a {@linkplain #getBytecodePosition() bytecode position}</li>
- * <li>a reference map for registers and stack slots in the current frame</li>
- * <li>a map from bytecode locals and operand stack slots to their values or locations from which
- * their values can be read</li>
- * <li>a map from the registers (in the caller's frame) to the slots where they are saved in the
- * current frame</li>
- * </ul>
- */
-public final class DebugInfo {
-
-    private final BytecodePosition bytecodePosition;
-    private final ReferenceMap referenceMap;
-    @SuppressWarnings("unused") private final Value[] virtualObjectMapping;
-    private RegisterSaveLayout calleeSaveInfo;
-
-    /**
-     * Creates a new {@link DebugInfo} from the given values.
-     *
-     * @param codePos the {@linkplain BytecodePosition code position} or {@linkplain BytecodeFrame
-     *            frame} info
-     * @param referenceMap the reference map
-     * @param virtualObjectMapping the mapping of {@link VirtualObject}s to their real values
-     */
-    public DebugInfo(BytecodePosition codePos, ReferenceMap referenceMap, Value[] virtualObjectMapping) {
-        this.bytecodePosition = codePos;
-        this.referenceMap = referenceMap;
-        this.virtualObjectMapping = virtualObjectMapping;
-    }
-
-    public DebugInfo(BytecodePosition codePos) {
-        this(codePos, null, null);
-    }
-
-    /**
-     * @return {@code true} if this debug information has a frame
-     */
-    public boolean hasFrame() {
-        return getBytecodePosition() instanceof BytecodeFrame;
-    }
-
-    /**
-     * Gets the deoptimization information for each inlined frame (if available).
-     *
-     * @return {@code null} if no frame de-opt info is {@linkplain #hasFrame() available}
-     */
-    public BytecodeFrame frame() {
-        if (hasFrame()) {
-            return (BytecodeFrame) getBytecodePosition();
-        }
-        return null;
-    }
-
-    @Override
-    public String toString() {
-        return CodeUtil.append(new StringBuilder(100), this, null).toString();
-    }
-
-    /**
-     * @return The code position (including all inlined methods) of this debug info. If this is a
-     *         {@link BytecodeFrame} instance, then it is also the deoptimization information for
-     *         each inlined frame.
-     */
-    public BytecodePosition getBytecodePosition() {
-        return bytecodePosition;
-    }
-
-    public ReferenceMap getReferenceMap() {
-        return referenceMap;
-    }
-
-    /**
-     * Sets the map from the registers (in the caller's frame) to the slots where they are saved in
-     * the current frame.
-     */
-    public void setCalleeSaveInfo(RegisterSaveLayout calleeSaveInfo) {
-        this.calleeSaveInfo = calleeSaveInfo;
-    }
-
-    /**
-     * Gets the map from the registers (in the caller's frame) to the slots where they are saved in
-     * the current frame. If no such information is available, {@code null} is returned.
-     */
-    public RegisterSaveLayout getCalleeSaveInfo() {
-        return calleeSaveInfo;
-    }
-
-    @Override
-    public int hashCode() {
-        throw new UnsupportedOperationException("hashCode");
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj instanceof DebugInfo) {
-            DebugInfo that = (DebugInfo) obj;
-            if (Objects.equals(this.bytecodePosition, that.bytecodePosition) && Objects.equals(this.calleeSaveInfo, that.calleeSaveInfo) && Objects.equals(this.referenceMap, that.referenceMap)) {
-                return true;
-            }
-        }
-        return false;
-    }
-}
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/DisassemblerProvider.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.api.code;
-
-/**
- * Interface providing capability for disassembling machine code.
- */
-public interface DisassemblerProvider {
-
-    /**
-     * Gets a textual disassembly of some given installed code.
-     *
-     * @return a non-zero length string containing a disassembly of {@code code} or null if
-     *         {@code code} is {@link InstalledCode#isValid() invalid} or it could not be
-     *         disassembled for some other reason
-     */
-    String disassemble(InstalledCode code);
-}
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/ForeignCallLinkage.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,72 +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.graal.api.code;
-
-import com.oracle.graal.api.meta.*;
-
-/**
- * The runtime specific details of a {@linkplain ForeignCallDescriptor foreign} call.
- */
-public interface ForeignCallLinkage extends InvokeTarget {
-
-    /**
-     * Gets the details of where parameters are passed and value(s) are returned from the caller's
-     * perspective.
-     */
-    CallingConvention getOutgoingCallingConvention();
-
-    /**
-     * Gets the details of where parameters are passed and value(s) are returned from the callee's
-     * perspective.
-     */
-    CallingConvention getIncomingCallingConvention();
-
-    /**
-     * Returns the maximum absolute offset of PC relative call to this stub from any position in the
-     * code cache or -1 when not applicable. Intended for determining the required size of
-     * address/offset fields.
-     */
-    long getMaxCallTargetOffset();
-
-    ForeignCallDescriptor getDescriptor();
-
-    /**
-     * Gets the values used/killed by this foreign call.
-     */
-    Value[] getTemporaries();
-
-    /**
-     * Determines if the foreign call target destroys all registers.
-     *
-     * @return {@code true} if the register allocator must save all live registers around a call to
-     *         this target
-     */
-    boolean destroysRegisters();
-
-    /**
-     * Determines if this is call to a function that does not deoptimize, and therefore also does
-     * not lock, GC or throw exceptions. That is, the thread's execution state during the call is
-     * never inspected by another thread.
-     */
-    boolean canDeoptimize();
-}
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/ForeignCallsProvider.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.api.code;
-
-import com.oracle.graal.api.meta.*;
-
-/**
- * Details about a set of supported {@link ForeignCallDescriptor foreign calls}.
- */
-public interface ForeignCallsProvider {
-
-    /**
-     * Determines if a given foreign call is side-effect free. Deoptimization cannot return
-     * execution to a point before a foreign call that has a side effect.
-     */
-    boolean isReexecutable(ForeignCallDescriptor descriptor);
-
-    /**
-     * Gets the set of memory locations killed by a given foreign call. Returning the special value
-     * {@link LocationIdentity#any()} denotes that the call kills all memory locations. Returning
-     * any empty array denotes that the call does not kill any memory locations.
-     */
-    LocationIdentity[] getKilledLocations(ForeignCallDescriptor descriptor);
-
-    /**
-     * Determines if deoptimization can occur during a given foreign call.
-     */
-    boolean canDeoptimize(ForeignCallDescriptor descriptor);
-
-    /**
-     * Gets the linkage for a foreign call.
-     */
-    ForeignCallLinkage lookupForeignCall(ForeignCallDescriptor descriptor);
-}
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/InfopointReason.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.api.code;
-
-/**
- * A reason for infopoint insertion.
- */
-public enum InfopointReason {
-    UNKNOWN(false),
-    SAFEPOINT(false),
-    CALL(false),
-    IMPLICIT_EXCEPTION(false),
-    METHOD_START(true),
-    METHOD_END(true),
-    LINE_NUMBER(true);
-
-    private InfopointReason(boolean canBeOmitted) {
-        this.canBeOmitted = canBeOmitted;
-    }
-
-    private final boolean canBeOmitted;
-
-    public boolean canBeOmitted() {
-        return canBeOmitted;
-    }
-}
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/InstalledCode.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,121 +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.graal.api.code;
-
-/**
- * Represents a compiled instance of a method. It may have been invalidated or removed in the
- * meantime.
- */
-public class InstalledCode {
-
-    /**
-     * Raw address of this code blob.
-     */
-    private long address;
-
-    /**
-     * Counts how often the address field was reassigned.
-     */
-    private long version;
-
-    protected final String name;
-
-    public InstalledCode(String name) {
-        this.name = name;
-    }
-
-    public final void setAddress(long address) {
-        this.address = address;
-        version++;
-    }
-
-    /**
-     * @return the address of this code blob
-     */
-    public final long getAddress() {
-        return address;
-    }
-
-    /**
-     * @return the address of this code blob
-     */
-    public final long getVersion() {
-        return version;
-    }
-
-    /**
-     * Returns the name of this code blob.
-     */
-    public String getName() {
-        return name;
-    }
-
-    /**
-     * Returns the start address of this installed code if it is {@linkplain #isValid() valid}, 0
-     * otherwise.
-     */
-    public long getStart() {
-        return 0;
-    }
-
-    /**
-     * Returns the number of instruction bytes for this code.
-     */
-    public long getCodeSize() {
-        return 0;
-    }
-
-    /**
-     * Returns a copy of this installed code if it is {@linkplain #isValid() valid}, null otherwise.
-     */
-    public byte[] getCode() {
-        return null;
-    }
-
-    /**
-     * @return true if the code represented by this object is still valid, false otherwise (may
-     *         happen due to deopt, etc.)
-     */
-    public boolean isValid() {
-        return address != 0;
-    }
-
-    /**
-     * Invalidates this installed code such that any subsequent invocation will throw an
-     * {@link InvalidInstalledCodeException}.
-     */
-    public void invalidate() {
-        throw new UnsupportedOperationException();
-    }
-
-    /**
-     * Executes the installed code with a variable number of arguments.
-     *
-     * @param args the array of object arguments
-     * @return the value returned by the executed code
-     */
-    @SuppressWarnings("unused")
-    public Object executeVarargs(Object... args) throws InvalidInstalledCodeException {
-        throw new UnsupportedOperationException();
-    }
-}
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/InvalidInstalledCodeException.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.api.code;
-
-/**
- * Exception thrown by the runtime in case an invalidated machine code is called.
- */
-public final class InvalidInstalledCodeException extends Exception {
-
-    private static final long serialVersionUID = -3540232440794244844L;
-}
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/MemoryBarriers.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,121 +0,0 @@
-/*
- * Copyright (c) 2011, 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;
-
-/**
- * Constants and intrinsic definition for memory barriers.
- *
- * The documentation for each constant is taken from Doug Lea's <a
- * href="http://gee.cs.oswego.edu/dl/jmm/cookbook.html">The JSR-133 Cookbook for Compiler
- * Writers</a>.
- * <p>
- * The {@code JMM_*} constants capture the memory barriers necessary to implement the Java Memory
- * Model with respect to volatile field accesses. Their values are explained by this comment from
- * templateTable_i486.cpp in the HotSpot source code:
- *
- * <pre>
- * Volatile variables demand their effects be made known to all CPU's in
- * order.  Store buffers on most chips allow reads &amp; writes to reorder; the
- * JMM's ReadAfterWrite.java test fails in -Xint mode without some kind of
- * memory barrier (i.e., it's not sufficient that the interpreter does not
- * reorder volatile references, the hardware also must not reorder them).
- *
- * According to the new Java Memory Model (JMM):
- * (1) All volatiles are serialized wrt to each other.
- * ALSO reads &amp; writes act as acquire &amp; release, so:
- * (2) A read cannot let unrelated NON-volatile memory refs that happen after
- * the read float up to before the read.  It's OK for non-volatile memory refs
- * that happen before the volatile read to float down below it.
- * (3) Similarly, a volatile write cannot let unrelated NON-volatile memory refs
- * that happen BEFORE the write float down to after the write.  It's OK for
- * non-volatile memory refs that happen after the volatile write to float up
- * before it.
- *
- * We only put in barriers around volatile refs (they are expensive), not
- * _between_ memory refs (which would require us to track the flavor of the
- * previous memory refs).  Requirements (2) and (3) require some barriers
- * before volatile stores and after volatile loads.  These nearly cover
- * requirement (1) but miss the volatile-store-volatile-load case.  This final
- * case is placed after volatile-stores although it could just as well go
- * before volatile-loads.
- * </pre>
- */
-public class MemoryBarriers {
-
-    /**
-     * The sequence {@code Load1; LoadLoad; Load2} ensures that {@code Load1}'s data are loaded
-     * before data accessed by {@code Load2} and all subsequent load instructions are loaded. In
-     * general, explicit {@code LoadLoad} barriers are needed on processors that perform speculative
-     * loads and/or out-of-order processing in which waiting load instructions can bypass waiting
-     * stores. On processors that guarantee to always preserve load ordering, these barriers amount
-     * to no-ops.
-     */
-    public static final int LOAD_LOAD = 0x0001;
-
-    /**
-     * The sequence {@code Load1; LoadStore; Store2} ensures that {@code Load1}'s data are loaded
-     * before all data associated with {@code Store2} and subsequent store instructions are flushed.
-     * {@code LoadStore} barriers are needed only on those out-of-order processors in which waiting
-     * store instructions can bypass loads.
-     */
-    public static final int LOAD_STORE = 0x0002;
-
-    /**
-     * The sequence {@code Store1; StoreLoad; Load2} ensures that {@code Store1}'s data are made
-     * visible to other processors (i.e., flushed to main memory) before data accessed by
-     * {@code Load2} and all subsequent load instructions are loaded. {@code StoreLoad} barriers
-     * protect against a subsequent load incorrectly using {@code Store1}'s data value rather than
-     * that from a more recent store to the same location performed by a different processor.
-     * Because of this, on the processors discussed below, a {@code StoreLoad} is strictly necessary
-     * only for separating stores from subsequent loads of the same location(s) as were stored
-     * before the barrier. {@code StoreLoad} barriers are needed on nearly all recent
-     * multiprocessors, and are usually the most expensive kind. Part of the reason they are
-     * expensive is that they must disable mechanisms that ordinarily bypass cache to satisfy loads
-     * from write-buffers. This might be implemented by letting the buffer fully flush, among other
-     * possible stalls.
-     */
-    public static final int STORE_LOAD = 0x0004;
-
-    /**
-     * The sequence {@code Store1; StoreStore; Store2} ensures that {@code Store1}'s data are
-     * visible to other processors (i.e., flushed to memory) before the data associated with
-     * {@code Store2} and all subsequent store instructions. In general, {@code StoreStore} barriers
-     * are needed on processors that do not otherwise guarantee strict ordering of flushes from
-     * write buffers and/or caches to other processors or main memory.
-     */
-    public static final int STORE_STORE = 0x0008;
-
-    public static final int JMM_PRE_VOLATILE_WRITE = LOAD_STORE | STORE_STORE;
-    public static final int JMM_POST_VOLATILE_WRITE = STORE_LOAD | STORE_STORE;
-    public static final int JMM_PRE_VOLATILE_READ = 0;
-    public static final int JMM_POST_VOLATILE_READ = LOAD_LOAD | LOAD_STORE;
-
-    public static String barriersString(int barriers) {
-        StringBuilder sb = new StringBuilder();
-        sb.append((barriers & LOAD_LOAD) != 0 ? "LOAD_LOAD " : "");
-        sb.append((barriers & LOAD_STORE) != 0 ? "LOAD_STORE " : "");
-        sb.append((barriers & STORE_LOAD) != 0 ? "STORE_LOAD " : "");
-        sb.append((barriers & STORE_STORE) != 0 ? "STORE_STORE " : "");
-        return sb.toString().trim();
-    }
-}
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/ReferenceMap.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 2009, 2015, 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.code.CodeUtil.RefMapFormatter;
-import com.oracle.graal.api.meta.*;
-
-public abstract class ReferenceMap implements Cloneable {
-
-    public abstract void setRegister(int idx, LIRKind kind);
-
-    public abstract void setStackSlot(int offset, LIRKind kind);
-
-    public abstract boolean hasRegisterRefMap();
-
-    public abstract boolean hasFrameRefMap();
-
-    public abstract void appendRegisterMap(StringBuilder sb, RefMapFormatter formatterArg);
-
-    public abstract void appendFrameMap(StringBuilder sb, RefMapFormatter formatterArg);
-}
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/Register.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,241 +0,0 @@
-/*
- * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.api.code;
-
-import com.oracle.graal.api.meta.*;
-
-/**
- * Represents a target machine register.
- */
-public final class Register implements Comparable<Register> {
-
-    public static final RegisterCategory SPECIAL = new RegisterCategory("SPECIAL");
-
-    /**
-     * Invalid register.
-     */
-    public static final Register None = new Register(-1, -1, "noreg", SPECIAL);
-
-    /**
-     * Frame pointer of the current method. All spill slots and outgoing stack-based arguments are
-     * addressed relative to this register.
-     */
-    public static final Register Frame = new Register(-2, -2, "framereg", SPECIAL);
-
-    public static final Register CallerFrame = new Register(-3, -3, "callerframereg", SPECIAL);
-
-    /**
-     * The identifier for this register that is unique across all the registers in a
-     * {@link Architecture}. 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 assembler calls this method to get the register's encoding.
-     */
-    public int encoding() {
-        return encoding;
-    }
-
-    /**
-     * A platform specific register category that describes which values can be stored in a
-     * register.
-     */
-    private final RegisterCategory registerCategory;
-
-    /**
-     * A platform specific register type that describes which values can be stored in a register.
-     */
-    public static class RegisterCategory {
-
-        private final String name;
-
-        private final int referenceMapOffset;
-        private final int referenceMapShift;
-
-        public RegisterCategory(String name) {
-            this(name, 0, 0);
-        }
-
-        public RegisterCategory(String name, int referenceMapOffset) {
-            this(name, referenceMapOffset, 0);
-        }
-
-        public RegisterCategory(String name, int referenceMapOffset, int referenceMapShift) {
-            this.name = name;
-            this.referenceMapOffset = referenceMapOffset;
-            this.referenceMapShift = referenceMapShift;
-        }
-
-        @Override
-        public String toString() {
-            return name;
-        }
-
-        @Override
-        public int hashCode() {
-            return 23 + name.hashCode();
-        }
-
-        @Override
-        public boolean equals(Object obj) {
-            if (obj instanceof RegisterCategory) {
-                RegisterCategory that = (RegisterCategory) obj;
-                return this.referenceMapOffset == that.referenceMapOffset && this.referenceMapShift == that.referenceMapShift && this.name.equals(that.name);
-            }
-            return false;
-        }
-    }
-
-    /**
-     * Creates a {@link Register} instance.
-     *
-     * @param number unique identifier for the register
-     * @param encoding the target machine encoding for the register
-     * @param name the mnemonic name for the register
-     * @param registerCategory the register category
-     */
-    public Register(int number, int encoding, String name, RegisterCategory registerCategory) {
-        this.number = number;
-        this.name = name;
-        this.registerCategory = registerCategory;
-        this.encoding = encoding;
-    }
-
-    public RegisterCategory getRegisterCategory() {
-        return registerCategory;
-    }
-
-    /**
-     * Get the start index of this register in the {@link ReferenceMap}.
-     */
-    public int getReferenceMapIndex() {
-        return (encoding << registerCategory.referenceMapShift) + registerCategory.referenceMapOffset;
-    }
-
-    /**
-     * Gets this register as a {@linkplain RegisterValue value} with a specified kind.
-     *
-     * @param kind the specified kind
-     * @return the {@link RegisterValue}
-     */
-    public RegisterValue asValue(LIRKind kind) {
-        return new RegisterValue(kind, this);
-    }
-
-    /**
-     * Gets this register as a {@linkplain RegisterValue value} with no particular kind.
-     *
-     * @return a {@link RegisterValue} with {@link Kind#Illegal} kind.
-     */
-    public RegisterValue asValue() {
-        return asValue(LIRKind.Illegal);
-    }
-
-    /**
-     * Determines if this is a valid register.
-     *
-     * @return {@code true} iff this register is valid
-     */
-    public boolean isValid() {
-        return number >= 0;
-    }
-
-    /**
-     * 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(Register[] registers) {
-        int max = Integer.MIN_VALUE;
-        for (Register 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(Register[] registers) {
-        int max = Integer.MIN_VALUE;
-        for (Register r : registers) {
-            if (r.encoding > max) {
-                max = r.encoding;
-            }
-        }
-        return max;
-    }
-
-    @Override
-    public String toString() {
-        return name;
-    }
-
-    @Override
-    public int compareTo(Register o) {
-        if (number < o.number) {
-            return -1;
-        }
-        if (number > o.number) {
-            return 1;
-        }
-        return 0;
-    }
-
-    @Override
-    public int hashCode() {
-        return 17 + name.hashCode();
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (obj instanceof Register) {
-            Register other = (Register) obj;
-            if (number == other.number) {
-                assert name.equals(other.name);
-                assert encoding == other.encoding;
-                assert registerCategory.equals(other.registerCategory);
-                return true;
-            }
-        }
-        return false;
-    }
-}
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/RegisterAttributes.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,99 +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.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 RegisterConfig} in use during a compilation will
- * determine which registers are callee saved.
- */
-public class RegisterAttributes {
-
-    private final boolean callerSave;
-    private final boolean calleeSave;
-    private final boolean allocatable;
-
-    public RegisterAttributes(boolean isCallerSave, boolean isCalleeSave, boolean isAllocatable) {
-        this.callerSave = isCallerSave;
-        this.calleeSave = isCalleeSave;
-        this.allocatable = isAllocatable;
-    }
-
-    public static final RegisterAttributes NONE = new RegisterAttributes(false, false, false);
-
-    /**
-     * Creates a map from register {@linkplain Register#number numbers} to register
-     * {@linkplain RegisterAttributes 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 RegisterAttributes[] createMap(RegisterConfig registerConfig, Register[] registers) {
-        RegisterAttributes[] map = new RegisterAttributes[registers.length];
-        for (Register reg : registers) {
-            if (reg != null) {
-                CalleeSaveLayout csl = registerConfig.getCalleeSaveLayout();
-                RegisterAttributes attr = new RegisterAttributes(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;
-    }
-
-    /**
-     * @return Denotes a register that is available for use by a register allocator.
-     */
-    public boolean isAllocatable() {
-        return allocatable;
-    }
-
-    /**
-     * @return Denotes a register whose value preservation (if required) across a call is the
-     *         responsibility of the callee.
-     */
-    public boolean isCalleeSave() {
-        return calleeSave;
-    }
-
-    /**
-     * @return Denotes a register whose value preservation (if required) across a call is the
-     *         responsibility of the caller.
-     */
-    public boolean isCallerSave() {
-        return callerSave;
-    }
-}
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/RegisterConfig.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,122 +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.graal.api.code;
-
-import com.oracle.graal.api.code.CallingConvention.Type;
-import com.oracle.graal.api.meta.*;
-
-/**
- * A register configuration binds roles and {@linkplain RegisterAttributes attributes} to physical
- * registers.
- */
-public interface RegisterConfig {
-
-    /**
-     * Gets the register to be used for returning a value of a given kind.
-     */
-    Register getReturnRegister(Kind kind);
-
-    /**
-     * Gets the maximum allowed size of the frame.
-     */
-    default int getMaximumFrameSize() {
-        return Integer.MAX_VALUE;
-    }
-
-    /**
-     * Gets the register to which {@link Register#Frame} and {@link Register#CallerFrame} are bound.
-     */
-    Register getFrameRegister();
-
-    /**
-     * Gets the calling convention describing how arguments are passed.
-     *
-     * @param type the type of calling convention being requested
-     * @param returnType the return type (can be null for methods returning {@code void})
-     * @param parameterTypes the types of the arguments of the call
-     * @param target the target platform
-     * @param stackOnly ignore registers
-     */
-    CallingConvention getCallingConvention(Type type, JavaType returnType, JavaType[] parameterTypes, TargetDescription 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 kind specifies what kind of registers is being requested
-     * @return the ordered set of registers that may be used to pass parameters in a call conforming
-     *         to {@code type}
-     */
-    Register[] getCallingConventionRegisters(Type type, Kind kind);
-
-    /**
-     * Gets the set of all registers that might be used by the register allocator.
-     *
-     * To get the set of registers the register allocator is allowed to use see
-     * {@link RegisterAllocationConfig#getAllocatableRegisters()}
-     */
-    @SuppressWarnings("javadoc")
-    Register[] getAllocatableRegisters();
-
-    /**
-     * Filters a set of registers and returns only those that can be used by the register allocator
-     * for a value of a particular kind.
-     */
-    Register[] filterAllocatableRegisters(PlatformKind kind, Register[] registers);
-
-    /**
-     * Gets the registers whose values must be preserved by a method across any call it makes.
-     */
-    Register[] getCallerSaveRegisters();
-
-    /**
-     * Gets the layout of the callee save area of this register configuration.
-     *
-     * @return {@code null} if there is no callee save area
-     */
-    CalleeSaveLayout getCalleeSaveLayout();
-
-    /**
-     * Gets a map from register {@linkplain Register#number numbers} to register
-     * {@linkplain RegisterAttributes attributes} for this register configuration.
-     *
-     * @return an array where an element at index i holds the attributes of the register whose
-     *         number is i
-     */
-    RegisterAttributes[] 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}
-     */
-    Register getRegisterForRole(int id);
-
-    /**
-     * Determines if all {@link #getAllocatableRegisters() allocatable} registers are
-     * {@link #getCallerSaveRegisters() caller saved}.
-     */
-    boolean areAllAllocatableRegistersCallerSaved();
-}
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/RegisterSaveLayout.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,127 +0,0 @@
-/*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.api.code;
-
-import java.util.*;
-
-/**
- * A map from registers to frame slots. This can be used to describe where callee saved registers
- * are saved in a callee's frame.
- */
-public final class RegisterSaveLayout {
-
-    /**
-     * Keys.
-     */
-    private final Register[] registers;
-
-    /**
-     * Slot indexes relative to stack pointer.
-     */
-    private final int[] slots;
-
-    /**
-     * Creates a map from registers to frame slots.
-     *
-     * @param registers the keys in the map
-     * @param slots frame slot index for each register in {@code registers}
-     */
-    public RegisterSaveLayout(Register[] registers, int[] slots) {
-        assert registers.length == slots.length;
-        this.registers = registers;
-        this.slots = slots;
-        assert registersToSlots(false).size() == registers.length : "non-unique registers";
-        assert new HashSet<>(registersToSlots(false).values()).size() == slots.length : "non-unqiue slots";
-    }
-
-    /**
-     * Gets the frame slot index for a given register.
-     *
-     * @param register register to get the frame slot index for
-     * @return frame slot index
-     */
-    public int registerToSlot(Register register) {
-        for (int i = 0; i < registers.length; i++) {
-            if (register.equals(registers[i])) {
-                return slots[i];
-            }
-        }
-        throw new IllegalArgumentException(register + " not saved by this layout: " + this);
-    }
-
-    /**
-     * Gets this layout information as a {@link Map} from registers to slots.
-     */
-    public Map<Register, Integer> registersToSlots(boolean sorted) {
-        Map<Register, Integer> result;
-        if (sorted) {
-            result = new TreeMap<>();
-        } else {
-            result = new HashMap<>();
-        }
-        for (int i = 0; i < registers.length; i++) {
-            result.put(registers[i], slots[i]);
-        }
-        return result;
-    }
-
-    /**
-     * Gets this layout information as a {@link Map} from slots to registers.
-     */
-    public Map<Integer, Register> slotsToRegisters(boolean sorted) {
-        Map<Integer, Register> result;
-        if (sorted) {
-            result = new TreeMap<>();
-        } else {
-            result = new HashMap<>();
-        }
-        for (int i = 0; i < registers.length; i++) {
-            result.put(slots[i], registers[i]);
-        }
-        return result;
-    }
-
-    @Override
-    public int hashCode() {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj instanceof RegisterSaveLayout) {
-            RegisterSaveLayout that = (RegisterSaveLayout) obj;
-            if (Arrays.equals(registers, that.registers) && Arrays.equals(slots, that.slots)) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    @Override
-    public String toString() {
-        return registersToSlots(true).toString();
-    }
-}
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/RegisterValue.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
-/*
- * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package 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 {@link RegisterValue} for each ({@link Register}, {@link Kind}) pair. Use
- * {@link Register#asValue(LIRKind)} to retrieve the canonical {@link RegisterValue} instance for a
- * given (register,kind) pair.
- */
-public final class RegisterValue extends AllocatableValue {
-
-    private final Register reg;
-
-    /**
-     * Should only be called from {@link Register#Register} to ensure canonicalization.
-     */
-    protected RegisterValue(LIRKind kind, Register register) {
-        super(kind);
-        this.reg = register;
-    }
-
-    @Override
-    public String toString() {
-        return getRegister().name + getKindSuffix();
-    }
-
-    /**
-     * @return the register that contains the value
-     */
-    public Register getRegister() {
-        return reg;
-    }
-
-    @Override
-    public int hashCode() {
-        return 29 * super.hashCode() + reg.hashCode();
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (obj instanceof RegisterValue) {
-            RegisterValue other = (RegisterValue) obj;
-            return super.equals(obj) && reg.equals(other.reg);
-        }
-        return false;
-    }
-}
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/SourceStackTrace.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-/*
- * Copyright (c) 2015, 2015, 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;
-
-/**
- * Class representing a exception with a stack trace of the currently processed position in the
- * compiled Java program instead of the stack trace of the compiler. The exception of the compiler
- * is saved as the cause of this exception.
- */
-public abstract class SourceStackTrace extends BailoutException {
-    private static final long serialVersionUID = 2144811793442316776L;
-
-    public static SourceStackTrace create(Throwable cause, String format, StackTraceElement[] elements) {
-        return new SourceStackTrace(cause, format) {
-
-            private static final long serialVersionUID = 6279381376051787907L;
-
-            @Override
-            public final synchronized Throwable fillInStackTrace() {
-                assert elements != null;
-                setStackTrace(elements);
-                return this;
-            }
-        };
-    }
-
-    private SourceStackTrace(Throwable cause, String format) {
-        super(cause, format);
-    }
-}
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/SpeculationLog.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
-/*
- * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.api.code;
-
-import java.util.*;
-import java.util.concurrent.*;
-
-import com.oracle.graal.api.meta.*;
-
-/**
- * Manages a list of unique deoptimization reasons.
- *
- */
-public abstract class SpeculationLog {
-    private volatile Object lastFailed;
-    private volatile Collection<Object> speculations;
-    private Set<Object> failedSpeculations;
-
-    public synchronized void collectFailedSpeculations() {
-        if (lastFailed != null) {
-            if (failedSpeculations == null) {
-                failedSpeculations = new HashSet<>(2);
-            }
-            failedSpeculations.add(lastFailed);
-            lastFailed = null;
-            speculations = null;
-        }
-    }
-
-    public boolean maySpeculate(Object reason) {
-        if (failedSpeculations != null && failedSpeculations.contains(reason)) {
-            return false;
-        }
-        return true;
-    }
-
-    protected void addSpeculation(Object reason) {
-        assert maySpeculate(reason);
-        if (speculations == null) {
-            synchronized (this) {
-                if (speculations == null) {
-                    speculations = new ConcurrentLinkedQueue<>();
-                }
-            }
-        }
-        speculations.add(reason);
-    }
-
-    public abstract JavaConstant speculate(Object reason);
-}
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/StackLockValue.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,89 +0,0 @@
-/*
- * Copyright (c) 2011, 2015, 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.ValueUtil.*;
-
-import com.oracle.graal.api.meta.*;
-
-/**
- * Represents lock information in the debug information.
- */
-public final class StackLockValue extends AbstractValue implements JavaValue {
-
-    private Value owner;
-    private StackSlotValue slot;
-    private final boolean eliminated;
-
-    public StackLockValue(Value object, StackSlotValue slot, boolean eliminated) {
-        super(LIRKind.Illegal);
-        this.owner = object;
-        this.slot = slot;
-        this.eliminated = eliminated;
-    }
-
-    public Value getOwner() {
-        return owner;
-    }
-
-    public void setOwner(Value newOwner) {
-        this.owner = newOwner;
-    }
-
-    public Value getSlot() {
-        return slot;
-    }
-
-    public boolean isEliminated() {
-        return eliminated;
-    }
-
-    @Override
-    public String toString() {
-        return "monitor[" + owner + (slot != null ? ", " + slot : "") + (eliminated ? ", eliminated" : "") + "]";
-    }
-
-    @Override
-    public int hashCode() {
-        final int prime = 43;
-        int result = super.hashCode();
-        result = prime * result + (eliminated ? 1231 : 1237);
-        result = prime * result + owner.hashCode();
-        result = prime * result + slot.hashCode();
-        return result;
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (obj instanceof StackLockValue) {
-            StackLockValue other = (StackLockValue) obj;
-            return super.equals(obj) && eliminated == other.eliminated && owner.equals(other.owner) && slot.equals(other.slot);
-        }
-        return false;
-    }
-
-    public void setSlot(StackSlotValue stackSlot) {
-        assert slot == null || (isVirtualStackSlot(slot) && (slot.equals(stackSlot) || isStackSlot(stackSlot))) : String.format("Can not set slot for %s to %s", this, stackSlot);
-        slot = stackSlot;
-    }
-}
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/StackSlot.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,134 +0,0 @@
-/*
- * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.api.code;
-
-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 #isInCallerFrame() caller's frame}.
- */
-public final class StackSlot extends StackSlotValue {
-
-    private final int offset;
-    private final boolean addFrameSize;
-
-    /**
-     * Gets a {@link StackSlot} 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 addFrameSize Specifies if the offset is relative to the stack pointer, or the
-     *            beginning of the frame (stack pointer + total frame size).
-     */
-    public static StackSlot get(LIRKind kind, int offset, boolean addFrameSize) {
-        assert addFrameSize || offset >= 0;
-        return new StackSlot(kind, offset, addFrameSize);
-    }
-
-    /**
-     * Private constructor to enforce use of {@link #get(LIRKind, int, boolean)} so that a cache can
-     * be used.
-     */
-    private StackSlot(LIRKind 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 getOffset(int totalFrameSize) {
-        assert totalFrameSize > 0 || !addFrameSize;
-        int result = offset + (addFrameSize ? totalFrameSize : 0);
-        assert result >= 0;
-        return result;
-    }
-
-    public boolean isInCallerFrame() {
-        return addFrameSize && offset >= 0;
-    }
-
-    public int getRawOffset() {
-        return offset;
-    }
-
-    public boolean getRawAddFrameSize() {
-        return addFrameSize;
-    }
-
-    @Override
-    public String toString() {
-        if (!addFrameSize) {
-            return "out:" + offset + getKindSuffix();
-        } else if (offset >= 0) {
-            return "in:" + offset + getKindSuffix();
-        } else {
-            return "stack:" + (-offset) + getKindSuffix();
-        }
-    }
-
-    /**
-     * Gets this stack slot used to pass an argument from the perspective of a caller.
-     */
-    public StackSlot asOutArg() {
-        assert offset >= 0;
-        if (addFrameSize) {
-            return get(getLIRKind(), offset, false);
-        }
-        return this;
-    }
-
-    /**
-     * Gets this stack slot used to pass an argument from the perspective of a callee.
-     */
-    public StackSlot asInArg() {
-        assert offset >= 0;
-        if (!addFrameSize) {
-            return get(getLIRKind(), offset, true);
-        }
-        return this;
-    }
-
-    @Override
-    public int hashCode() {
-        final int prime = 37;
-        int result = super.hashCode();
-        result = prime * result + (addFrameSize ? 1231 : 1237);
-        result = prime * result + offset;
-        return result;
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (obj instanceof StackSlot) {
-            StackSlot other = (StackSlot) obj;
-            return super.equals(obj) && addFrameSize == other.addFrameSize && offset == other.offset;
-        }
-        return false;
-    }
-}
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/StackSlotValue.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.api.code;
-
-import com.oracle.graal.api.meta.*;
-
-/**
- * Common base class for {@linkplain StackSlot real} and {@linkplain VirtualStackSlot virtual} stack
- * slots.
- */
-public abstract class StackSlotValue extends AllocatableValue {
-
-    public StackSlotValue(LIRKind lirKind) {
-        super(lirKind);
-    }
-
-}
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/TargetDescription.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,142 +0,0 @@
-/*
- * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.api.code;
-
-import static com.oracle.graal.api.meta.MetaUtil.*;
-
-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 abstract class TargetDescription {
-
-    public final Architecture arch;
-
-    /**
-     * 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 kind to be used for representing raw pointers and CPU registers.
-     */
-    public final Kind 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;
-
-    /**
-     * Maximum constant displacement at which a memory access can no longer be an implicit null
-     * check.
-     */
-    public final int implicitNullCheckLimit;
-
-    public TargetDescription(Architecture arch, boolean isMP, int stackAlignment, int implicitNullCheckLimit, boolean inlineObjects) {
-        this.arch = arch;
-        this.isMP = isMP;
-        this.wordSize = arch.getWordSize();
-        this.wordKind = Kind.fromWordSize(wordSize);
-        this.stackAlignment = stackAlignment;
-        this.implicitNullCheckLimit = implicitNullCheckLimit;
-        this.inlineObjects = inlineObjects;
-    }
-
-    @Override
-    public final int hashCode() {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public final boolean equals(Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj instanceof TargetDescription) {
-            TargetDescription that = (TargetDescription) obj;
-            // @formatter:off
-            if (this.implicitNullCheckLimit == that.implicitNullCheckLimit &&
-                this.inlineObjects == that.inlineObjects &&
-                this.isMP == that.isMP &&
-                this.stackAlignment == that.stackAlignment &&
-                this.wordKind.equals(that.wordKind) &&
-                this.wordSize == that.wordSize &&
-                this.arch.equals(that.arch)) {
-                return true;
-            }
-            // @formatter:on
-        }
-        return false;
-    }
-
-    @Override
-    public String toString() {
-        return identityHashCodeString(this);
-    }
-
-    public int getSizeInBytes(PlatformKind kind) {
-        return arch.getSizeInBytes(kind);
-    }
-
-    public LIRKind getLIRKind(Kind javaKind) {
-        switch (javaKind) {
-            case Boolean:
-            case Byte:
-            case Short:
-            case Char:
-            case Int:
-            case Long:
-            case Float:
-            case Double:
-                return LIRKind.value(javaKind);
-            case Object:
-                return LIRKind.reference(javaKind);
-            default:
-                return LIRKind.Illegal;
-        }
-    }
-
-    public abstract ReferenceMap createReferenceMap(boolean hasRegisters, int stackSlotCount);
-}
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/TypeCheckHints.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,158 +0,0 @@
-/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.api.code;
-
-import java.util.*;
-
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.api.meta.Assumptions.AssumptionResult;
-import com.oracle.graal.api.meta.JavaTypeProfile.ProfiledType;
-
-/**
- * Utility for deriving hint types for a type check instruction (e.g. checkcast or instanceof) based
- * on the target type of the check and any profiling information available for the instruction.
- */
-public class TypeCheckHints {
-
-    /**
-     * A receiver type profiled in a type check instruction.
-     */
-    public static class Hint {
-
-        /**
-         * A type seen while profiling a type check instruction.
-         */
-        public final ResolvedJavaType type;
-
-        /**
-         * Specifies if {@link #type} is a sub-type of the checked type.
-         */
-        public final boolean positive;
-
-        Hint(ResolvedJavaType type, boolean positive) {
-            this.type = type;
-            this.positive = positive;
-        }
-    }
-
-    private static final Hint[] NO_HINTS = {};
-
-    /**
-     * If non-null, then this is the only type that could pass the type check because the target of
-     * the type check is a final class or has been speculated to be a final class and this value is
-     * the only concrete subclass of the target type.
-     */
-    public final ResolvedJavaType exact;
-
-    /**
-     * The most likely types that the type check instruction will see.
-     */
-    public final Hint[] hints;
-
-    /**
-     * The profile from which this information was derived.
-     */
-    public final JavaTypeProfile profile;
-
-    /**
-     * The total probability that the type check will hit one of the types in {@link #hints}.
-     */
-    public final double hintHitProbability;
-
-    /**
-     * Derives hint information for use when generating the code for a type check instruction.
-     *
-     * @param targetType the target type of the type check
-     * @param profile the profiling information available for the instruction (if any)
-     * @param assumptions the object in which speculations are recorded. This is null if
-     *            speculations are not supported.
-     * @param minHintHitProbability if the probability that the type check will hit one of the
-     *            profiled types (up to {@code maxHints}) is below this value, then {@link #hints}
-     *            will be null
-     * @param maxHints the maximum length of {@link #hints}
-     */
-    public TypeCheckHints(ResolvedJavaType targetType, JavaTypeProfile profile, Assumptions assumptions, double minHintHitProbability, int maxHints) {
-        this.profile = profile;
-        if (targetType != null && !canHaveSubtype(targetType)) {
-            exact = targetType;
-        } else {
-            if (assumptions != null) {
-                AssumptionResult<ResolvedJavaType> leafConcreteSubtype = targetType == null ? null : targetType.findLeafConcreteSubtype();
-                if (leafConcreteSubtype != null) {
-                    assumptions.record(leafConcreteSubtype);
-                    exact = leafConcreteSubtype.getResult();
-                } else {
-                    exact = null;
-                }
-            } else {
-                exact = null;
-            }
-        }
-        Double[] hitProbability = {null};
-        this.hints = makeHints(targetType, profile, minHintHitProbability, maxHints, hitProbability);
-        this.hintHitProbability = hitProbability[0];
-    }
-
-    private static Hint[] makeHints(ResolvedJavaType targetType, JavaTypeProfile profile, double minHintHitProbability, int maxHints, Double[] hitProbability) {
-        double hitProb = 0.0d;
-        Hint[] hintsBuf = NO_HINTS;
-        if (profile != null) {
-            double notRecordedTypes = profile.getNotRecordedProbability();
-            ProfiledType[] ptypes = profile.getTypes();
-            if (notRecordedTypes < (1D - minHintHitProbability) && ptypes != null && ptypes.length > 0) {
-                hintsBuf = new Hint[ptypes.length];
-                int hintCount = 0;
-                for (ProfiledType ptype : ptypes) {
-                    if (targetType != null) {
-                        ResolvedJavaType hintType = ptype.getType();
-                        hintsBuf[hintCount++] = new Hint(hintType, targetType.isAssignableFrom(hintType));
-                        hitProb += ptype.getProbability();
-                    }
-                    if (hintCount == maxHints) {
-                        break;
-                    }
-                }
-                if (hitProb >= minHintHitProbability) {
-                    if (hintsBuf.length != hintCount || hintCount > maxHints) {
-                        hintsBuf = Arrays.copyOf(hintsBuf, Math.min(maxHints, hintCount));
-                    }
-                } else {
-                    hintsBuf = NO_HINTS;
-                    hitProb = 0.0d;
-                }
-            }
-        }
-        hitProbability[0] = hitProb;
-        return hintsBuf;
-    }
-
-    /**
-     * Determines if a given type can have subtypes other than itself. This analysis is purely
-     * static; no assumptions are made.
-     *
-     * @return true if {@code type} can have subtypes
-     */
-    public static boolean canHaveSubtype(ResolvedJavaType type) {
-        return !type.getElementalType().isFinal();
-    }
-}
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/UnsignedMath.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,124 +0,0 @@
-/*
- * Copyright (c) 2011, 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.math.*;
-
-//JaCoCo Exclude
-
-/**
- * Utilities for unsigned comparisons. All methods have correct, but slow, standard Java
- * implementations so that they can be used with compilers not supporting the intrinsics.
- */
-public class UnsignedMath {
-
-    private static final long MASK = 0xffffffffL;
-
-    /**
-     * Unsigned comparison aboveThan for two numbers.
-     */
-    public static boolean aboveThan(int a, int b) {
-        return (a & MASK) > (b & MASK);
-    }
-
-    /**
-     * Unsigned comparison aboveOrEqual for two numbers.
-     */
-    public static boolean aboveOrEqual(int a, int b) {
-        return (a & MASK) >= (b & MASK);
-    }
-
-    /**
-     * Unsigned comparison belowThan for two numbers.
-     */
-    public static boolean belowThan(int a, int b) {
-        return (a & MASK) < (b & MASK);
-    }
-
-    /**
-     * Unsigned comparison belowOrEqual for two numbers.
-     */
-    public static boolean belowOrEqual(int a, int b) {
-        return (a & MASK) <= (b & MASK);
-    }
-
-    /**
-     * Unsigned comparison aboveThan for two numbers.
-     */
-    public static boolean aboveThan(long a, long b) {
-        return (a > b) ^ ((a < 0) != (b < 0));
-    }
-
-    /**
-     * Unsigned comparison aboveOrEqual for two numbers.
-     */
-    public static boolean aboveOrEqual(long a, long b) {
-        return (a >= b) ^ ((a < 0) != (b < 0));
-    }
-
-    /**
-     * Unsigned comparison belowThan for two numbers.
-     */
-    public static boolean belowThan(long a, long b) {
-        return (a < b) ^ ((a < 0) != (b < 0));
-    }
-
-    /**
-     * Unsigned comparison belowOrEqual for two numbers.
-     */
-    public static boolean belowOrEqual(long a, long b) {
-        return (a <= b) ^ ((a < 0) != (b < 0));
-    }
-
-    /**
-     * Unsigned division for two numbers.
-     */
-    public static int divide(int a, int b) {
-        return (int) ((a & MASK) / (b & MASK));
-    }
-
-    /**
-     * Unsigned remainder for two numbers.
-     */
-    public static int remainder(int a, int b) {
-        return (int) ((a & MASK) % (b & MASK));
-    }
-
-    /**
-     * Unsigned division for two numbers.
-     */
-    public static long divide(long a, long b) {
-        return bi(a).divide(bi(b)).longValue();
-    }
-
-    /**
-     * Unsigned remainder for two numbers.
-     */
-    public static long remainder(long a, long b) {
-        return bi(a).remainder(bi(b)).longValue();
-    }
-
-    private static BigInteger bi(long unsigned) {
-        return unsigned >= 0 ? BigInteger.valueOf(unsigned) : BigInteger.valueOf(unsigned & 0x7fffffffffffffffL).setBit(63);
-    }
-}
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/ValueUtil.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,187 +0,0 @@
-/*
- * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.api.code;
-
-import java.util.*;
-
-import com.oracle.graal.api.meta.*;
-
-/**
- * Utility class for working with the {@link Value} class and its subclasses.
- */
-public final class ValueUtil {
-
-    public static boolean isIllegal(Value value) {
-        assert value != null;
-        return Value.ILLEGAL.equals(value);
-    }
-
-    public static boolean isLegal(Value value) {
-        return !isIllegal(value);
-    }
-
-    public static boolean isVirtualObject(Value value) {
-        assert value != null;
-        return value instanceof VirtualObject;
-    }
-
-    public static VirtualObject asVirtualObject(Value value) {
-        assert value != null;
-        return (VirtualObject) value;
-    }
-
-    public static boolean isConstant(Value value) {
-        assert value != null;
-        return value instanceof JavaConstant;
-    }
-
-    public static JavaConstant asConstant(Value value) {
-        assert value != null;
-        return (JavaConstant) value;
-    }
-
-    public static boolean isAllocatableValue(Value value) {
-        assert value != null;
-        return value instanceof AllocatableValue;
-    }
-
-    public static AllocatableValue asAllocatableValue(Value value) {
-        assert value != null;
-        return (AllocatableValue) value;
-    }
-
-    public static boolean isStackSlot(Value value) {
-        assert value != null;
-        return value instanceof StackSlot;
-    }
-
-    public static StackSlot asStackSlot(Value value) {
-        assert value != null;
-        return (StackSlot) value;
-    }
-
-    public static boolean isStackSlotValue(Value value) {
-        assert value != null;
-        return value instanceof StackSlotValue;
-    }
-
-    public static StackSlotValue asStackSlotValue(Value value) {
-        assert value != null;
-        return (StackSlotValue) value;
-    }
-
-    public static boolean isVirtualStackSlot(Value value) {
-        assert value != null;
-        return value instanceof VirtualStackSlot;
-    }
-
-    public static VirtualStackSlot asVirtualStackSlot(Value value) {
-        assert value != null;
-        return (VirtualStackSlot) value;
-    }
-
-    public static boolean isRegister(Value value) {
-        assert value != null;
-        return value instanceof RegisterValue;
-    }
-
-    public static Register asRegister(Value value) {
-        assert value != null;
-        return ((RegisterValue) value).getRegister();
-    }
-
-    public static Register asIntReg(Value value) {
-        if (value.getKind().getStackKind() != Kind.Int) {
-            throw new InternalError("needed Int got: " + value.getKind());
-        } else {
-            return asRegister(value);
-        }
-    }
-
-    public static Register asLongReg(Value value) {
-        if (value.getKind() != Kind.Long) {
-            throw new InternalError("needed Long got: " + value.getKind());
-        } else {
-            return asRegister(value);
-        }
-    }
-
-    public static Register asObjectReg(Value value) {
-        assert value.getKind() == Kind.Object : value.getKind();
-        return asRegister(value);
-    }
-
-    public static Register asFloatReg(Value value) {
-        assert value.getKind() == Kind.Float : value.getKind();
-        return asRegister(value);
-    }
-
-    public static Register asDoubleReg(Value value) {
-        assert value.getKind() == Kind.Double : value.getKind();
-        return asRegister(value);
-    }
-
-    public static boolean sameRegister(Value v1, Value v2) {
-        return isRegister(v1) && isRegister(v2) && asRegister(v1).equals(asRegister(v2));
-    }
-
-    public static boolean sameRegister(Value v1, Value v2, Value v3) {
-        return sameRegister(v1, v2) && sameRegister(v1, v3);
-    }
-
-    /**
-     * Checks if all the provided values are different physical registers. The parameters can be
-     * either {@link Register registers}, {@link Value values} or arrays of them. All values that
-     * are not {@link RegisterValue registers} are ignored.
-     */
-    public static boolean differentRegisters(Object... values) {
-        List<Register> registers = collectRegisters(values, new ArrayList<Register>());
-        for (int i = 1; i < registers.size(); i++) {
-            Register r1 = registers.get(i);
-            for (int j = 0; j < i; j++) {
-                Register r2 = registers.get(j);
-                if (r1.equals(r2)) {
-                    return false;
-                }
-            }
-        }
-        return true;
-    }
-
-    private static List<Register> collectRegisters(Object[] values, List<Register> registers) {
-        for (Object o : values) {
-            if (o instanceof Register) {
-                registers.add((Register) o);
-            } else if (o instanceof Value) {
-                if (isRegister((Value) o)) {
-                    registers.add(asRegister((Value) o));
-                }
-            } else if (o instanceof Object[]) {
-                collectRegisters((Object[]) o, registers);
-            } else {
-                throw new IllegalArgumentException("Not a Register or Value: " + o);
-            }
-        }
-        return registers;
-    }
-}
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/VirtualObject.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,213 +0,0 @@
-/*
- * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.api.code;
-
-import java.util.*;
-
-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 VirtualObject} is used during deoptimization to recreate the
- * object.
- */
-public final class VirtualObject extends AbstractValue implements JavaValue {
-
-    private final ResolvedJavaType type;
-    private Value[] values;
-    private final int id;
-
-    /**
-     * Creates a new {@link VirtualObject} for the given type, with the given fields. If
-     * {@code type} is an instance class then {@code values} provides the values for the fields
-     * returned by {@link ResolvedJavaType#getInstanceFields(boolean) getInstanceFields(true)}. If
-     * {@code 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 {@link VirtualObject} instance.
-     */
-    public static VirtualObject get(ResolvedJavaType type, Value[] values, int id) {
-        return new VirtualObject(type, values, id);
-    }
-
-    private VirtualObject(ResolvedJavaType type, Value[] values, int id) {
-        super(LIRKind.reference(Kind.Object));
-        this.type = type;
-        this.values = values;
-        this.id = id;
-    }
-
-    private static StringBuilder appendValue(StringBuilder buf, Value value, Set<VirtualObject> visited) {
-        if (value instanceof VirtualObject) {
-            VirtualObject vo = (VirtualObject) value;
-            buf.append("vobject:").append(vo.type.toJavaName(false)).append(':').append(vo.id);
-            if (!visited.contains(vo)) {
-                visited.add(vo);
-                buf.append('{');
-                if (vo.values == null) {
-                    buf.append("<uninitialized>");
-                } else {
-                    if (vo.type.isArray()) {
-                        for (int i = 0; i < vo.values.length; i++) {
-                            if (i != 0) {
-                                buf.append(',');
-                            }
-                            buf.append(i).append('=');
-                            appendValue(buf, vo.values[i], visited);
-                        }
-                    } else {
-                        ResolvedJavaField[] fields = vo.type.getInstanceFields(true);
-                        assert fields.length == vo.values.length : vo.type + ", fields=" + Arrays.toString(fields) + ", values=" + Arrays.toString(vo.values);
-                        for (int i = 0; i < vo.values.length; i++) {
-                            if (i != 0) {
-                                buf.append(',');
-                            }
-                            buf.append(fields[i].getName()).append('=');
-                            appendValue(buf, vo.values[i], visited);
-                        }
-                    }
-                }
-                buf.append('}');
-            }
-        } else {
-            buf.append(value);
-        }
-        return buf;
-    }
-
-    @Override
-    public String toString() {
-        Set<VirtualObject> visited = Collections.newSetFromMap(new IdentityHashMap<VirtualObject, Boolean>());
-        return appendValue(new StringBuilder(), this, visited).toString();
-    }
-
-    /**
-     * Returns the type of the object whose allocation was removed during compilation. This can be
-     * either an instance of an array type.
-     */
-    public ResolvedJavaType getType() {
-        return type;
-    }
-
-    /**
-     * Returns an array containing all the values to be stored into the object when it is recreated.
-     */
-    public Value[] getValues() {
-        return values;
-    }
-
-    /**
-     * Returns the unique id that identifies the object within the debug information for one
-     * position in the compiled code.
-     */
-    public int getId() {
-        return id;
-    }
-
-    private static boolean checkValues(ResolvedJavaType type, Value[] values) {
-        if (values != null) {
-            if (!type.isArray()) {
-                ResolvedJavaField[] fields = type.getInstanceFields(true);
-                int fieldIndex = 0;
-                for (int i = 0; i < values.length; i++) {
-                    ResolvedJavaField field = fields[fieldIndex++];
-                    Kind valKind = values[i].getKind().getStackKind();
-                    if (field.getKind() == Kind.Object) {
-                        assert values[i].getLIRKind().isReference(0) : field + ": " + valKind + " != " + field.getKind();
-                    } else {
-                        if ((valKind == Kind.Double || valKind == Kind.Long) && field.getKind() == Kind.Int) {
-                            assert fields[fieldIndex].getKind() == Kind.Int;
-                            fieldIndex++;
-                        } else {
-                            assert valKind == field.getKind().getStackKind() : field + ": " + valKind + " != " + field.getKind();
-                        }
-                    }
-                }
-                assert fields.length == fieldIndex : type + ": fields=" + Arrays.toString(fields) + ", field values=" + Arrays.toString(values);
-            } else {
-                Kind componentKind = type.getComponentType().getKind().getStackKind();
-                if (componentKind == Kind.Object) {
-                    for (int i = 0; i < values.length; i++) {
-                        assert values[i].getLIRKind().isReference(0) : values[i].getKind() + " != " + componentKind;
-                    }
-                } else {
-                    for (int i = 0; i < values.length; i++) {
-                        assert values[i].getKind() == componentKind || componentKind.getBitCount() >= values[i].getKind().getBitCount() ||
-                                        (componentKind == Kind.Int && values[i].getKind().getBitCount() >= Kind.Int.getBitCount()) : values[i].getKind() + " != " + componentKind;
-                    }
-                }
-            }
-        }
-        return true;
-    }
-
-    /**
-     * 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(Value[] values) {
-        assert checkValues(type, values);
-        this.values = values;
-    }
-
-    @Override
-    public int hashCode() {
-        return getLIRKind().hashCode() + type.hashCode();
-    }
-
-    @Override
-    public boolean equals(Object o) {
-        if (o == this) {
-            return true;
-        }
-        if (o instanceof VirtualObject) {
-            VirtualObject l = (VirtualObject) o;
-            if (!l.type.equals(type) || l.values.length != values.length) {
-                return false;
-            }
-            for (int i = 0; i < values.length; i++) {
-                /*
-                 * Virtual objects can form cycles. Calling equals() could therefore lead to
-                 * infinite recursion.
-                 */
-                if (!same(values[i], l.values[i])) {
-                    return false;
-                }
-            }
-            return true;
-        }
-        return false;
-    }
-
-    private static boolean same(Object o1, Object o2) {
-        return o1 == o2;
-    }
-}
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/VirtualStackSlot.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,75 +0,0 @@
-/*
- * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.api.code;
-
-import com.oracle.graal.api.meta.*;
-
-/**
- * {@link VirtualStackSlot}s are stack slots that are not yet fixed to specific frame offset. They
- * are replaced by real {@link StackSlot}s with a fixed position in the frame before code emission.
- */
-public abstract class VirtualStackSlot extends StackSlotValue {
-
-    private final int id;
-
-    public VirtualStackSlot(int id, LIRKind lirKind) {
-        super(lirKind);
-        this.id = id;
-    }
-
-    public int getId() {
-        return id;
-    }
-
-    @Override
-    public String toString() {
-        return "vstack:" + id + getKindSuffix();
-    }
-
-    @Override
-    public int hashCode() {
-        final int prime = 31;
-        int result = super.hashCode();
-        result = prime * result + id;
-        return result;
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (!super.equals(obj)) {
-            return false;
-        }
-        if (getClass() != obj.getClass()) {
-            return false;
-        }
-        VirtualStackSlot other = (VirtualStackSlot) obj;
-        if (id != other.id) {
-            return false;
-        }
-        return true;
-    }
-
-}
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/package-info.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +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 that defines the interface between a Java application that wants to install code and the runtime.
- * The runtime provides in implementation of the {@link com.oracle.graal.api.code.CodeCacheProvider} interface.
- * The method {@link com.oracle.graal.api.code.CodeCacheProvider#addMethod(com.oracle.graal.api.meta.ResolvedJavaMethod, CompilationResult, SpeculationLog, InstalledCode)}
- * can be used to install code for a given method.
- */
-package com.oracle.graal.api.code;
-
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/stack/InspectedFrame.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,69 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.api.code.stack;
-
-import com.oracle.graal.api.meta.*;
-
-public interface InspectedFrame {
-
-    /**
-     * Returns the value of the local at the given index. Currently only works for object values.
-     * This value is a copy iff {@link #isVirtual(int)} is true.
-     */
-    Object getLocal(int index);
-
-    /**
-     * Returns whether the local at the given index is a virtual object, and therefore the object
-     * returned by {@link #getLocal(int)} is a copy.
-     */
-    boolean isVirtual(int index);
-
-    /**
-     * Returns true if the stack frame is a compiled stack frame and there are virtual objects
-     * anywhere in the current state of the compiled method. This can return true even if
-     * {@link #isVirtual(int)} return false for all locals.
-     */
-    boolean hasVirtualObjects();
-
-    /**
-     * This method will materialize all virtual objects, deoptimize the stack frame and make sure
-     * that subsequent execution of the deoptimized frame uses the materialized values.
-     */
-    void materializeVirtualObjects(boolean invalidateCode);
-
-    /**
-     * @return the current bytecode index
-     */
-    int getBytecodeIndex();
-
-    /**
-     * @return the current method
-     */
-    ResolvedJavaMethod getMethod();
-
-    /**
-     * Checks if the current method is equal to the given method. This is semantically equivalent to
-     * {@code method.equals(getMethod())}, but can be implemented more efficiently.
-     */
-    boolean isMethod(ResolvedJavaMethod method);
-}
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/stack/InspectedFrameVisitor.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.api.code.stack;
-
-/**
- * Callback interface for {@link StackIntrospection#iterateFrames}. Implementations of
- * {@link #visitFrame} return null to indicate that frame iteration should continue and the next
- * caller frame should be visited; and return any non-null value to indicate that frame iteration
- * should stop.
- */
-public interface InspectedFrameVisitor<T> {
-
-    T visitFrame(InspectedFrame frame);
-}
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/stack/StackIntrospection.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.api.code.stack;
-
-import com.oracle.graal.api.meta.*;
-
-public interface StackIntrospection {
-
-    /**
-     * Accesses the current stack, providing {@link InspectedFrame}s to the visitor that can be used
-     * to inspect the stack frames' contents. Iteration continues as long as
-     * {@link InspectedFrameVisitor#visitFrame}, which is invoked for every {@link InspectedFrame},
-     * returns null. Any non-null result of the visitor indicates that frame iteration should stop.
-     *
-     * @param initialMethods if this is non-{@code null}, then the stack trace will start at these
-     *            methods
-     * @param matchingMethods if this is non-{@code null}, then only matching stack frames are
-     *            returned
-     * @param initialSkip the number of matching methods to skip (including the initial method)
-     * @param visitor the visitor that is called for every matching method
-     * @return the last result returned by the visitor (which is non-null to indicate that iteration
-     *         should stop), or null if the whole stack was iterated.
-     */
-    <T> T iterateFrames(ResolvedJavaMethod[] initialMethods, ResolvedJavaMethod[] matchingMethods, int initialSkip, InspectedFrameVisitor<T> visitor);
-}
--- a/graal/com.oracle.graal.api.directives.test/src/com/oracle/graal/api/directives/test/ControlFlowAnchorDirectiveTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.api.directives.test/src/com/oracle/graal/api/directives/test/ControlFlowAnchorDirectiveTest.java	Thu May 28 21:11:28 2015 -0700
@@ -22,13 +22,13 @@
  */
 package com.oracle.graal.api.directives.test;
 
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
 import java.lang.annotation.*;
 import java.util.*;
 
 import org.junit.*;
 
 import com.oracle.graal.api.directives.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.test.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.iterators.*;
--- a/graal/com.oracle.graal.api.directives.test/src/com/oracle/graal/api/directives/test/DeoptimizeDirectiveTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.api.directives.test/src/com/oracle/graal/api/directives/test/DeoptimizeDirectiveTest.java	Thu May 28 21:11:28 2015 -0700
@@ -22,11 +22,11 @@
  */
 package com.oracle.graal.api.directives.test;
 
+import com.oracle.jvmci.code.InstalledCode;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
 import org.junit.*;
 
-import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.directives.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.test.*;
 
 public class DeoptimizeDirectiveTest extends GraalCompilerTest {
--- a/graal/com.oracle.graal.api.meta.test/src/com/oracle/graal/api/meta/test/ConstantTest.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +0,0 @@
-/*
- * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.api.meta.test;
-
-import org.junit.*;
-
-import com.oracle.graal.api.meta.*;
-
-public class ConstantTest extends FieldUniverse {
-
-    @Test
-    public void testNegativeZero() {
-        Assert.assertTrue("Constant for 0.0f must be different from -0.0f", JavaConstant.FLOAT_0 != JavaConstant.forFloat(-0.0F));
-        Assert.assertTrue("Constant for 0.0d must be different from -0.0d", JavaConstant.DOUBLE_0 != JavaConstant.forDouble(-0.0d));
-    }
-
-    @Test
-    public void testNullIsNull() {
-        Assert.assertTrue(JavaConstant.NULL_POINTER.isNull());
-    }
-
-    @Test
-    public void testOne() {
-        for (Kind kind : Kind.values()) {
-            if (kind.isNumericInteger() || kind.isNumericFloat()) {
-                Assert.assertTrue(JavaConstant.one(kind).getKind() == kind);
-            }
-        }
-        Assert.assertEquals(1, JavaConstant.one(Kind.Int).asInt());
-        Assert.assertEquals(1L, JavaConstant.one(Kind.Long).asLong());
-        Assert.assertEquals(1, JavaConstant.one(Kind.Byte).asInt());
-        Assert.assertEquals(1, JavaConstant.one(Kind.Short).asInt());
-        Assert.assertEquals(1, JavaConstant.one(Kind.Char).asInt());
-        Assert.assertTrue(1F == JavaConstant.one(Kind.Float).asFloat());
-        Assert.assertTrue(1D == JavaConstant.one(Kind.Double).asDouble());
-    }
-
-    @Test(expected = IllegalArgumentException.class)
-    public void testIllegalOne() {
-        JavaConstant.one(Kind.Illegal);
-    }
-
-    @Test(expected = IllegalArgumentException.class)
-    public void testVoidOne() {
-        JavaConstant.one(Kind.Void);
-    }
-}
--- a/graal/com.oracle.graal.api.meta.test/src/com/oracle/graal/api/meta/test/FieldUniverse.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.api.meta.test;
-
-import java.lang.reflect.*;
-import java.util.*;
-
-import com.oracle.graal.api.meta.*;
-
-/**
- * Context for field related api.meta tests.
- */
-public class FieldUniverse extends TypeUniverse {
-
-    public final Map<Field, ResolvedJavaField> fields = new HashMap<>();
-
-    public FieldUniverse() {
-        for (Class<?> c : classes) {
-            for (Field f : c.getDeclaredFields()) {
-                ResolvedJavaField field = metaAccess.lookupJavaField(f);
-                fields.put(f, field);
-            }
-        }
-    }
-}
--- a/graal/com.oracle.graal.api.meta.test/src/com/oracle/graal/api/meta/test/MethodUniverse.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.api.meta.test;
-
-import java.lang.reflect.*;
-import java.util.*;
-
-import com.oracle.graal.api.meta.*;
-
-/**
- * Context for method related api.meta tests.
- */
-public class MethodUniverse extends TypeUniverse {
-
-    public final Map<Method, ResolvedJavaMethod> methods = new HashMap<>();
-    public final Map<Constructor<?>, ResolvedJavaMethod> constructors = new HashMap<>();
-
-    public MethodUniverse() {
-        for (Class<?> c : classes) {
-            for (Method m : c.getDeclaredMethods()) {
-                ResolvedJavaMethod method = metaAccess.lookupJavaMethod(m);
-                methods.put(m, method);
-            }
-            for (Constructor<?> m : c.getDeclaredConstructors()) {
-                constructors.put(m, metaAccess.lookupJavaMethod(m));
-            }
-        }
-    }
-}
--- a/graal/com.oracle.graal.api.meta.test/src/com/oracle/graal/api/meta/test/NameAndSignature.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,88 +0,0 @@
-/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.api.meta.test;
-
-import java.lang.reflect.*;
-import java.util.*;
-
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.api.runtime.*;
-import com.oracle.graal.runtime.*;
-
-class NameAndSignature {
-
-    public static final MetaAccessProvider metaAccess = Graal.getRequiredCapability(RuntimeProvider.class).getHostBackend().getProviders().getMetaAccess();
-
-    final String name;
-    final Class<?> returnType;
-    final Class<?>[] parameterTypes;
-
-    public NameAndSignature(Method m) {
-        this.name = m.getName();
-        this.returnType = m.getReturnType();
-        this.parameterTypes = m.getParameterTypes();
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (obj instanceof NameAndSignature) {
-            NameAndSignature s = (NameAndSignature) obj;
-            return s.returnType == returnType && name.equals(s.name) && Arrays.equals(s.parameterTypes, parameterTypes);
-        }
-        return false;
-    }
-
-    @Override
-    public int hashCode() {
-        return name.hashCode();
-    }
-
-    @Override
-    public String toString() {
-        StringBuilder sb = new StringBuilder(name + "(");
-        String sep = "";
-        for (Class<?> p : parameterTypes) {
-            sb.append(sep);
-            sep = ", ";
-            sb.append(p.getName());
-        }
-        return sb.append(')').append(returnType.getName()).toString();
-    }
-
-    public boolean signatureEquals(ResolvedJavaMethod m) {
-        Signature s = m.getSignature();
-        ResolvedJavaType declaringClass = m.getDeclaringClass();
-        if (!s.getReturnType(declaringClass).resolve(declaringClass).equals(metaAccess.lookupJavaType(returnType))) {
-            return false;
-        }
-        if (s.getParameterCount(false) != parameterTypes.length) {
-            return false;
-        }
-        for (int i = 0; i < parameterTypes.length; i++) {
-            if (!s.getParameterType(i, declaringClass).resolve(declaringClass).equals(metaAccess.lookupJavaType(parameterTypes[i]))) {
-                return false;
-            }
-        }
-        return true;
-    }
-}
--- a/graal/com.oracle.graal.api.meta.test/src/com/oracle/graal/api/meta/test/ResolvedJavaTypeResolveConcreteMethodTest.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,173 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.api.meta.test;
-
-import static org.junit.Assert.*;
-
-import org.junit.*;
-
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.api.runtime.*;
-import com.oracle.graal.phases.util.*;
-import com.oracle.graal.runtime.*;
-
-public class ResolvedJavaTypeResolveConcreteMethodTest {
-    public final MetaAccessProvider metaAccess;
-
-    public ResolvedJavaTypeResolveConcreteMethodTest() {
-        Providers providers = Graal.getRequiredCapability(RuntimeProvider.class).getHostBackend().getProviders();
-        metaAccess = providers.getMetaAccess();
-    }
-
-    protected abstract static class A {
-        @SuppressWarnings("unused")
-        private void priv() {
-        }
-
-        public void v1() {
-        }
-
-        public void v2() {
-        }
-
-        public abstract void abs();
-    }
-
-    protected static class B extends A implements I {
-        public void i() {
-        }
-
-        @Override
-        public void v2() {
-        }
-
-        @Override
-        public void abs() {
-
-        }
-    }
-
-    protected static class C extends B {
-        public void d() {
-        }
-    }
-
-    protected abstract static class D extends A {
-
-    }
-
-    protected static class E extends D {
-        @Override
-        public void abs() {
-        }
-    }
-
-    protected interface I {
-        void i();
-
-        default void d() {
-        }
-    }
-
-    @Test
-    public void testDefaultMethod() {
-        ResolvedJavaType i = getType(I.class);
-        ResolvedJavaType b = getType(B.class);
-        ResolvedJavaType c = getType(C.class);
-        ResolvedJavaMethod di = getMethod(i, "d");
-        ResolvedJavaMethod dc = getMethod(c, "d");
-
-        assertEquals(di, i.resolveConcreteMethod(di, c));
-        assertEquals(di, b.resolveConcreteMethod(di, c));
-        assertEquals(dc, c.resolveConcreteMethod(di, c));
-    }
-
-    @Test
-    public void testPrivateMethod() {
-        ResolvedJavaType a = getType(A.class);
-        ResolvedJavaType b = getType(B.class);
-        ResolvedJavaType c = getType(C.class);
-        ResolvedJavaMethod priv = getMethod(a, "priv");
-
-        assertNull(a.resolveConcreteMethod(priv, c));
-        assertNull(b.resolveConcreteMethod(priv, c));
-    }
-
-    @Test
-    public void testAbstractMethod() {
-        ResolvedJavaType a = getType(A.class);
-        ResolvedJavaType b = getType(B.class);
-        ResolvedJavaType c = getType(C.class);
-        ResolvedJavaType d = getType(D.class);
-        ResolvedJavaType e = getType(E.class);
-        ResolvedJavaMethod absa = getMethod(a, "abs");
-        ResolvedJavaMethod absb = getMethod(b, "abs");
-        ResolvedJavaMethod abse = getMethod(e, "abs");
-
-        assertNull(a.resolveConcreteMethod(absa, c));
-        assertNull(d.resolveConcreteMethod(absa, c));
-
-        assertEquals(absb, b.resolveConcreteMethod(absa, c));
-        assertEquals(absb, b.resolveConcreteMethod(absb, c));
-        assertEquals(absb, c.resolveConcreteMethod(absa, c));
-        assertEquals(absb, c.resolveConcreteMethod(absb, c));
-        assertEquals(abse, e.resolveConcreteMethod(absa, c));
-        assertNull(e.resolveConcreteMethod(absb, c));
-        assertEquals(abse, e.resolveConcreteMethod(abse, c));
-    }
-
-    @Test
-    public void testVirtualMethod() {
-        ResolvedJavaType a = getType(A.class);
-        ResolvedJavaType b = getType(B.class);
-        ResolvedJavaType c = getType(C.class);
-        ResolvedJavaMethod v1a = getMethod(a, "v1");
-        ResolvedJavaMethod v2a = getMethod(a, "v2");
-        ResolvedJavaMethod v2b = getMethod(b, "v2");
-
-        assertEquals(v1a, a.resolveConcreteMethod(v1a, c));
-        assertEquals(v1a, b.resolveConcreteMethod(v1a, c));
-        assertEquals(v1a, c.resolveConcreteMethod(v1a, c));
-        assertEquals(v2a, a.resolveConcreteMethod(v2a, c));
-        assertEquals(v2b, b.resolveConcreteMethod(v2a, c));
-        assertEquals(v2b, b.resolveConcreteMethod(v2b, c));
-        assertEquals(v2b, c.resolveConcreteMethod(v2a, c));
-        assertEquals(v2b, c.resolveConcreteMethod(v2b, c));
-
-    }
-
-    static ResolvedJavaMethod getMethod(ResolvedJavaType type, String methodName) {
-        for (ResolvedJavaMethod method : type.getDeclaredMethods()) {
-            if (method.getName().equals(methodName)) {
-                return method;
-            }
-        }
-        throw new IllegalArgumentException();
-    }
-
-    protected ResolvedJavaType getType(Class<?> clazz) {
-        ResolvedJavaType type = metaAccess.lookupJavaType(clazz);
-        type.initialize();
-        return type;
-    }
-}
--- a/graal/com.oracle.graal.api.meta.test/src/com/oracle/graal/api/meta/test/ResolvedJavaTypeResolveMethodTest.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,173 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.api.meta.test;
-
-import static org.junit.Assert.*;
-
-import org.junit.*;
-
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.api.runtime.*;
-import com.oracle.graal.phases.util.*;
-import com.oracle.graal.runtime.*;
-
-public class ResolvedJavaTypeResolveMethodTest {
-    public final MetaAccessProvider metaAccess;
-
-    public ResolvedJavaTypeResolveMethodTest() {
-        Providers providers = Graal.getRequiredCapability(RuntimeProvider.class).getHostBackend().getProviders();
-        metaAccess = providers.getMetaAccess();
-    }
-
-    protected abstract static class A {
-        @SuppressWarnings("unused")
-        private void priv() {
-        }
-
-        public void v1() {
-        }
-
-        public void v2() {
-        }
-
-        public abstract void abs();
-    }
-
-    protected static class B extends A implements I {
-        public void i() {
-        }
-
-        @Override
-        public void v2() {
-        }
-
-        @Override
-        public void abs() {
-
-        }
-    }
-
-    protected static class C extends B {
-        public void d() {
-        }
-    }
-
-    protected abstract static class D extends A {
-
-    }
-
-    protected static class E extends D {
-        @Override
-        public void abs() {
-        }
-    }
-
-    protected interface I {
-        void i();
-
-        default void d() {
-        }
-    }
-
-    @Test
-    public void testDefaultMethod() {
-        ResolvedJavaType i = getType(I.class);
-        ResolvedJavaType b = getType(B.class);
-        ResolvedJavaType c = getType(C.class);
-        ResolvedJavaMethod di = getMethod(i, "d");
-        ResolvedJavaMethod dc = getMethod(c, "d");
-
-        assertEquals(di, i.resolveMethod(di, c, true));
-        assertEquals(di, b.resolveMethod(di, c, true));
-        assertEquals(dc, c.resolveMethod(di, c, true));
-    }
-
-    @Test
-    public void testPrivateMethod() {
-        ResolvedJavaType a = getType(A.class);
-        ResolvedJavaType b = getType(B.class);
-        ResolvedJavaType c = getType(C.class);
-        ResolvedJavaMethod priv = getMethod(a, "priv");
-
-        assertNull(a.resolveMethod(priv, c, true));
-        assertNull(b.resolveMethod(priv, c, true));
-    }
-
-    @Test
-    public void testAbstractMethod() {
-        ResolvedJavaType a = getType(A.class);
-        ResolvedJavaType b = getType(B.class);
-        ResolvedJavaType c = getType(C.class);
-        ResolvedJavaType d = getType(D.class);
-        ResolvedJavaType e = getType(E.class);
-        ResolvedJavaMethod absa = getMethod(a, "abs");
-        ResolvedJavaMethod absb = getMethod(b, "abs");
-        ResolvedJavaMethod abse = getMethod(e, "abs");
-
-        assertEquals(absa, a.resolveMethod(absa, c, true));
-        assertEquals(absa, d.resolveMethod(absa, c, true));
-
-        assertEquals(absb, b.resolveMethod(absa, c, true));
-        assertEquals(absb, b.resolveMethod(absb, c, true));
-        assertEquals(absb, c.resolveMethod(absa, c, true));
-        assertEquals(absb, c.resolveMethod(absb, c, true));
-        assertEquals(abse, e.resolveMethod(absa, c, true));
-        assertNull(e.resolveMethod(absb, c, true));
-        assertEquals(abse, e.resolveMethod(abse, c, true));
-    }
-
-    @Test
-    public void testVirtualMethod() {
-        ResolvedJavaType a = getType(A.class);
-        ResolvedJavaType b = getType(B.class);
-        ResolvedJavaType c = getType(C.class);
-        ResolvedJavaMethod v1a = getMethod(a, "v1");
-        ResolvedJavaMethod v2a = getMethod(a, "v2");
-        ResolvedJavaMethod v2b = getMethod(b, "v2");
-
-        assertEquals(v1a, a.resolveMethod(v1a, c, true));
-        assertEquals(v1a, b.resolveMethod(v1a, c, true));
-        assertEquals(v1a, c.resolveMethod(v1a, c, true));
-        assertEquals(v2a, a.resolveMethod(v2a, c, true));
-        assertEquals(v2b, b.resolveMethod(v2a, c, true));
-        assertEquals(v2b, b.resolveMethod(v2b, c, true));
-        assertEquals(v2b, c.resolveMethod(v2a, c, true));
-        assertEquals(v2b, c.resolveMethod(v2b, c, true));
-
-    }
-
-    static ResolvedJavaMethod getMethod(ResolvedJavaType type, String methodName) {
-        for (ResolvedJavaMethod method : type.getDeclaredMethods()) {
-            if (method.getName().equals(methodName)) {
-                return method;
-            }
-        }
-        throw new IllegalArgumentException();
-    }
-
-    protected ResolvedJavaType getType(Class<?> clazz) {
-        ResolvedJavaType type = metaAccess.lookupJavaType(clazz);
-        type.initialize();
-        return type;
-    }
-}
--- a/graal/com.oracle.graal.api.meta.test/src/com/oracle/graal/api/meta/test/TestBytecodeDisassemblerProvider.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.api.meta.test;
-
-import org.junit.*;
-
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.java.*;
-
-/**
- * Tests for {@link BytecodeDisassemblerProvider}.
- */
-public class TestBytecodeDisassemblerProvider extends MethodUniverse {
-
-    public TestBytecodeDisassemblerProvider() {
-    }
-
-    /**
-     * Tests that successive disassembling of the same method produces the same result.
-     */
-    @Test
-    public void disassembleTest() {
-        BytecodeDisassemblerProvider dis = new BytecodeDisassembler();
-        if (dis != null) {
-            int count = 0;
-            for (ResolvedJavaMethod m : methods.values()) {
-                String disasm1 = dis.disassemble(m);
-                String disasm2 = dis.disassemble(m);
-                if (disasm1 == null) {
-                    Assert.assertTrue(disasm2 == null);
-                } else {
-                    Assert.assertTrue(String.valueOf(m), disasm1.length() > 0);
-                    Assert.assertEquals(String.valueOf(m), disasm1, disasm2);
-                }
-                if (count++ > 20) {
-                    break;
-                }
-            }
-        }
-    }
-}
--- a/graal/com.oracle.graal.api.meta.test/src/com/oracle/graal/api/meta/test/TestConstantReflectionProvider.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,103 +0,0 @@
-/*
- * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.api.meta.test;
-
-import static org.junit.Assert.*;
-
-import java.lang.reflect.*;
-
-import org.junit.*;
-
-import com.oracle.graal.api.meta.*;
-
-/**
- * Tests for {@link ConstantReflectionProvider}. It assumes an implementation of the interface that
- * actually returns non-null results for access operations that are possible, i.e., the tests will
- * fail for an implementation that spuriously returns null (which is allowed by the specification).
- */
-public class TestConstantReflectionProvider extends TypeUniverse {
-
-    @Test
-    public void constantEqualsTest() {
-        for (JavaConstant c1 : constants) {
-            for (JavaConstant c2 : constants) {
-                // test symmetry
-                assertEquals(constantReflection.constantEquals(c1, c2), constantReflection.constantEquals(c2, c1));
-                if (c1.getKind() != Kind.Object && c2.getKind() != Kind.Object) {
-                    assertEquals(c1.equals(c2), constantReflection.constantEquals(c2, c1));
-                }
-            }
-        }
-    }
-
-    @Test
-    public void readArrayLengthTest() {
-        for (JavaConstant c : constants) {
-            Integer actual = constantReflection.readArrayLength(c);
-            if (c.getKind() != Kind.Object || c.isNull() || !snippetReflection.asObject(Object.class, c).getClass().isArray()) {
-                assertNull(actual);
-            } else {
-                assertNotNull(actual);
-                int actualInt = actual;
-                assertEquals(Array.getLength(snippetReflection.asObject(Object.class, c)), actualInt);
-            }
-        }
-    }
-
-    @Test
-    public void boxTest() {
-        for (JavaConstant c : constants) {
-            JavaConstant boxed = constantReflection.boxPrimitive(c);
-            if (c.getKind().isPrimitive()) {
-                assertTrue(boxed.getKind().isObject());
-                assertFalse(boxed.isNull());
-            }
-        }
-
-        assertEquals(Long.valueOf(42), snippetReflection.asObject(Long.class, constantReflection.boxPrimitive(JavaConstant.forLong(42))));
-        assertEquals(Integer.valueOf(66), snippetReflection.asObject(Integer.class, constantReflection.boxPrimitive(JavaConstant.forInt(66))));
-        assertEquals(Byte.valueOf((byte) 123), snippetReflection.asObject(Byte.class, constantReflection.boxPrimitive(JavaConstant.forByte((byte) 123))));
-        assertSame(Boolean.TRUE, snippetReflection.asObject(Boolean.class, constantReflection.boxPrimitive(JavaConstant.forBoolean(true))));
-
-        assertNull(constantReflection.boxPrimitive(JavaConstant.NULL_POINTER));
-        assertNull(constantReflection.boxPrimitive(snippetReflection.forObject("abc")));
-    }
-
-    @Test
-    public void unboxTest() {
-        for (JavaConstant c : constants) {
-            JavaConstant unboxed = c.isNull() ? null : constantReflection.unboxPrimitive(c);
-            if (unboxed != null) {
-                assertFalse(unboxed.getKind().isObject());
-            }
-        }
-
-        assertEquals(JavaConstant.forLong(42), constantReflection.unboxPrimitive(snippetReflection.forObject(Long.valueOf(42))));
-        assertEquals(JavaConstant.forInt(66), constantReflection.unboxPrimitive(snippetReflection.forObject(Integer.valueOf(66))));
-        assertEquals(JavaConstant.forByte((byte) 123), constantReflection.unboxPrimitive(snippetReflection.forObject(Byte.valueOf((byte) 123))));
-        assertSame(JavaConstant.forBoolean(true), constantReflection.unboxPrimitive(snippetReflection.forObject(Boolean.TRUE)));
-
-        assertNull(constantReflection.unboxPrimitive(JavaConstant.NULL_POINTER));
-        assertNull(constantReflection.unboxPrimitive(snippetReflection.forObject("abc")));
-    }
-}
--- a/graal/com.oracle.graal.api.meta.test/src/com/oracle/graal/api/meta/test/TestJavaField.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,76 +0,0 @@
-/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.api.meta.test;
-
-import static org.junit.Assert.*;
-
-import java.lang.reflect.*;
-import java.util.*;
-
-import org.junit.*;
-
-import com.oracle.graal.api.meta.*;
-
-/**
- * Tests for {@link JavaField}.
- */
-public class TestJavaField extends FieldUniverse {
-
-    @Test
-    public void getNameTest() {
-        for (Map.Entry<Field, ResolvedJavaField> e : fields.entrySet()) {
-            String expected = e.getKey().getName();
-            String actual = e.getValue().getName();
-            assertEquals(expected, actual);
-        }
-    }
-
-    @Test
-    public void getTypeTest() {
-        for (Map.Entry<Field, ResolvedJavaField> e : fields.entrySet()) {
-            // Must resolve types first as a resolved types != unresolved types
-            ResolvedJavaField rf = e.getValue();
-            JavaType expected = metaAccess.lookupJavaType(e.getKey().getType()).resolve(rf.getDeclaringClass());
-            JavaType actual = rf.getType().resolve(rf.getDeclaringClass());
-            assertEquals(expected, actual);
-        }
-    }
-
-    @Test
-    public void getKindTest() {
-        for (Map.Entry<Field, ResolvedJavaField> e : fields.entrySet()) {
-            Kind expected = metaAccess.lookupJavaType(e.getKey().getType()).getKind();
-            Kind actual = e.getValue().getKind();
-            assertEquals(expected, actual);
-        }
-    }
-
-    @Test
-    public void getDeclaringClassTest() {
-        for (Map.Entry<Field, ResolvedJavaField> e : fields.entrySet()) {
-            Class<?> expected = e.getKey().getDeclaringClass();
-            ResolvedJavaType actual = e.getValue().getDeclaringClass();
-            assertTrue(actual.equals(metaAccess.lookupJavaType(expected)));
-        }
-    }
-}
--- a/graal/com.oracle.graal.api.meta.test/src/com/oracle/graal/api/meta/test/TestJavaMethod.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.api.meta.test;
-
-import static org.junit.Assert.*;
-
-import java.lang.reflect.*;
-import java.util.*;
-
-import org.junit.*;
-
-import com.oracle.graal.api.meta.*;
-
-/**
- * Tests for {@link JavaMethod}.
- */
-public class TestJavaMethod extends MethodUniverse {
-
-    @Test
-    public void getNameTest() {
-        for (Map.Entry<Method, ResolvedJavaMethod> e : methods.entrySet()) {
-            String expected = e.getKey().getName();
-            String actual = e.getValue().getName();
-            assertEquals(expected, actual);
-        }
-    }
-
-    @Test
-    public void getDeclaringClassTest() {
-        for (Map.Entry<Method, ResolvedJavaMethod> e : methods.entrySet()) {
-            Class<?> expected = e.getKey().getDeclaringClass();
-            ResolvedJavaType actual = e.getValue().getDeclaringClass();
-            assertTrue(actual.equals(metaAccess.lookupJavaType(expected)));
-        }
-    }
-
-    @Test
-    public void getSignatureTest() {
-        for (Map.Entry<Method, ResolvedJavaMethod> e : methods.entrySet()) {
-            assertTrue(new NameAndSignature(e.getKey()).signatureEquals(e.getValue()));
-        }
-    }
-}
--- a/graal/com.oracle.graal.api.meta.test/src/com/oracle/graal/api/meta/test/TestJavaType.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.api.meta.test;
-
-import static org.junit.Assert.*;
-
-import org.junit.*;
-
-import com.oracle.graal.api.meta.*;
-
-/**
- * Tests for {@link JavaType}.
- */
-public class TestJavaType extends TypeUniverse {
-
-    public TestJavaType() {
-    }
-
-    @Test
-    public void getKindTest() {
-        for (Class<?> c : classes) {
-            JavaType type = metaAccess.lookupJavaType(c);
-            Kind expected = Kind.fromJavaClass(c);
-            Kind actual = type.getKind();
-            assertEquals(expected, actual);
-        }
-    }
-}
--- a/graal/com.oracle.graal.api.meta.test/src/com/oracle/graal/api/meta/test/TestMetaAccessProvider.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,93 +0,0 @@
-/*
- * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.api.meta.test;
-
-import static com.oracle.graal.api.meta.MetaUtil.*;
-import static org.junit.Assert.*;
-
-import java.lang.reflect.*;
-
-import org.junit.*;
-
-import com.oracle.graal.api.meta.*;
-
-/**
- * Tests for {@link MetaAccessProvider}.
- */
-public class TestMetaAccessProvider extends TypeUniverse {
-
-    @Test
-    public void lookupJavaTypeTest() {
-        for (Class<?> c : classes) {
-            ResolvedJavaType type = metaAccess.lookupJavaType(c);
-            assertNotNull(type);
-            assertEquals(c.getModifiers(), type.getModifiers());
-            if (!type.isArray()) {
-                assertEquals(type.getName(), toInternalName(c.getName()));
-                assertEquals(type.toJavaName(), c.getName());
-            }
-        }
-    }
-
-    @Test
-    public void lookupJavaMethodTest() {
-        for (Class<?> c : classes) {
-            for (Method reflect : c.getDeclaredMethods()) {
-                ResolvedJavaMethod method = metaAccess.lookupJavaMethod(reflect);
-                assertNotNull(method);
-                int expected = reflect.getModifiers() & Modifier.methodModifiers();
-                int actual = method.getModifiers();
-                assertEquals(String.format("%s: 0x%x != 0x%x", reflect, expected, actual), expected, actual);
-                assertTrue(method.getDeclaringClass().equals(metaAccess.lookupJavaType(reflect.getDeclaringClass())));
-            }
-        }
-    }
-
-    @Test
-    public void lookupJavaFieldTest() {
-        for (Class<?> c : classes) {
-            for (Field reflect : c.getDeclaredFields()) {
-                ResolvedJavaField field = metaAccess.lookupJavaField(reflect);
-                assertNotNull(field);
-                int expected = reflect.getModifiers();
-                int actual = field.getModifiers();
-                assertEquals(String.format("%s: 0x%x != 0x%x", reflect, expected, actual), expected, actual);
-                assertTrue(field.getDeclaringClass().equals(metaAccess.lookupJavaType(reflect.getDeclaringClass())));
-            }
-        }
-    }
-
-    @Test
-    public void lookupJavaTypeConstantTest() {
-        for (JavaConstant c : constants) {
-            if (c.getKind() == Kind.Object && !c.isNull()) {
-                Object o = snippetReflection.asObject(Object.class, c);
-                ResolvedJavaType type = metaAccess.lookupJavaType(c);
-                assertNotNull(type);
-                assertTrue(type.equals(metaAccess.lookupJavaType(o.getClass())));
-            } else {
-                assertEquals(metaAccess.lookupJavaType(c), null);
-            }
-        }
-    }
-}
--- a/graal/com.oracle.graal.api.meta.test/src/com/oracle/graal/api/meta/test/TestResolvedJavaField.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,137 +0,0 @@
-/*
- * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.api.meta.test;
-
-import static org.junit.Assert.*;
-
-import java.lang.annotation.*;
-import java.lang.reflect.*;
-import java.util.*;
-
-import org.junit.*;
-
-import com.oracle.graal.api.meta.*;
-
-/**
- * Tests for {@link ResolvedJavaField}.
- */
-public class TestResolvedJavaField extends FieldUniverse {
-
-    public TestResolvedJavaField() {
-    }
-
-    @Test
-    public void getModifiersTest() {
-        for (Map.Entry<Field, ResolvedJavaField> e : fields.entrySet()) {
-            int expected = e.getKey().getModifiers();
-            int actual = e.getValue().getModifiers();
-            assertEquals(expected, actual);
-        }
-    }
-
-    @Test
-    public void isSyntheticTest() {
-        for (Map.Entry<Field, ResolvedJavaField> e : fields.entrySet()) {
-            boolean expected = e.getKey().isSynthetic();
-            boolean actual = e.getValue().isSynthetic();
-            assertEquals(expected, actual);
-        }
-    }
-
-    @Test
-    public void getAnnotationTest() {
-        for (Map.Entry<Field, ResolvedJavaField> e : fields.entrySet()) {
-            for (Annotation expected : e.getKey().getAnnotations()) {
-                if (expected != null) {
-                    Annotation actual = e.getValue().getAnnotation(expected.annotationType());
-                    assertEquals(expected, actual);
-                }
-            }
-        }
-    }
-
-    @Test
-    public void getLocationIdentityTest() {
-        for (Map.Entry<Field, ResolvedJavaField> e : fields.entrySet()) {
-            LocationIdentity identity = e.getValue().getLocationIdentity();
-            assertTrue(identity != null);
-        }
-    }
-
-    @Test
-    public void readConstantValueTest() throws NoSuchFieldException {
-        ResolvedJavaField field = metaAccess.lookupJavaField(getClass().getDeclaredField("stringField"));
-        for (Object receiver : new Object[]{this, null, new String()}) {
-            JavaConstant value = constantReflection.readConstantFieldValue(field, snippetReflection.forObject(receiver));
-            assertNull(value);
-        }
-
-        ResolvedJavaField constField = metaAccess.lookupJavaField(getClass().getDeclaredField("constantStringField"));
-        for (Object receiver : new Object[]{this, null, new String()}) {
-            JavaConstant value = constantReflection.readConstantFieldValue(constField, snippetReflection.forObject(receiver));
-            if (value != null) {
-                Object expected = "constantField";
-                assertTrue(snippetReflection.asObject(Object.class, value) == expected);
-            }
-        }
-    }
-
-    String stringField = "field";
-    final String constantStringField = "constantField";
-
-    private Method findTestMethod(Method apiMethod) {
-        String testName = apiMethod.getName() + "Test";
-        for (Method m : getClass().getDeclaredMethods()) {
-            if (m.getName().equals(testName) && m.getAnnotation(Test.class) != null) {
-                return m;
-            }
-        }
-        return null;
-    }
-
-    // @formatter:off
-    private static final String[] untestedApiMethods = {
-        "getDeclaringClass",
-        "isInternal"
-    };
-    // @formatter:on
-
-    /**
-     * Ensures that any new methods added to {@link ResolvedJavaMethod} either have a test written
-     * for them or are added to {@link #untestedApiMethods}.
-     */
-    @Test
-    public void testCoverage() {
-        Set<String> known = new HashSet<>(Arrays.asList(untestedApiMethods));
-        for (Method m : ResolvedJavaField.class.getDeclaredMethods()) {
-            if (m.isSynthetic()) {
-                continue;
-            }
-            if (findTestMethod(m) == null) {
-                assertTrue("test missing for " + m, known.contains(m.getName()));
-            } else {
-                assertFalse("test should be removed from untestedApiMethods" + m, known.contains(m.getName()));
-            }
-        }
-    }
-}
--- a/graal/com.oracle.graal.api.meta.test/src/com/oracle/graal/api/meta/test/TestResolvedJavaMethod.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,379 +0,0 @@
-/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.api.meta.test;
-
-import static org.junit.Assert.*;
-
-import java.lang.annotation.*;
-import java.lang.reflect.*;
-import java.util.*;
-
-import org.junit.*;
-
-import com.oracle.graal.api.meta.*;
-
-/**
- * Tests for {@link ResolvedJavaMethod}.
- */
-public class TestResolvedJavaMethod extends MethodUniverse {
-
-    public TestResolvedJavaMethod() {
-    }
-
-    /**
-     * @see ResolvedJavaMethod#getCode()
-     */
-    @Test
-    public void getCodeTest() {
-        for (Map.Entry<Method, ResolvedJavaMethod> e : methods.entrySet()) {
-            ResolvedJavaMethod m = e.getValue();
-            byte[] code = m.getCode();
-            if (code == null) {
-                assertTrue(m.getCodeSize() == 0);
-            } else {
-                if (m.isAbstract()) {
-                    assertTrue(code.length == 0);
-                } else if (!m.isNative()) {
-                    assertTrue(code.length > 0);
-                }
-            }
-        }
-    }
-
-    /**
-     * @see ResolvedJavaMethod#getCodeSize()
-     */
-    @Test
-    public void getCodeSizeTest() {
-        for (Map.Entry<Method, ResolvedJavaMethod> e : methods.entrySet()) {
-            ResolvedJavaMethod m = e.getValue();
-            int codeSize = m.getCodeSize();
-            if (m.isAbstract()) {
-                assertTrue(codeSize == 0);
-            } else if (!m.isNative()) {
-                assertTrue(codeSize > 0);
-            }
-        }
-    }
-
-    @Test
-    public void getModifiersTest() {
-        for (Map.Entry<Method, ResolvedJavaMethod> e : methods.entrySet()) {
-            ResolvedJavaMethod m = e.getValue();
-            int expected = e.getKey().getModifiers() & Modifier.methodModifiers();
-            int actual = m.getModifiers();
-            assertEquals(expected, actual);
-        }
-    }
-
-    /**
-     * @see ResolvedJavaMethod#isClassInitializer()
-     */
-    @Test
-    public void isClassInitializerTest() {
-        for (Map.Entry<Method, ResolvedJavaMethod> e : methods.entrySet()) {
-            // Class initializers are hidden from reflection
-            ResolvedJavaMethod m = e.getValue();
-            assertFalse(m.isClassInitializer());
-        }
-        for (Map.Entry<Constructor<?>, ResolvedJavaMethod> e : constructors.entrySet()) {
-            ResolvedJavaMethod m = e.getValue();
-            assertFalse(m.isClassInitializer());
-        }
-    }
-
-    @Test
-    public void isConstructorTest() {
-        for (Map.Entry<Method, ResolvedJavaMethod> e : methods.entrySet()) {
-            ResolvedJavaMethod m = e.getValue();
-            assertFalse(m.isConstructor());
-        }
-        for (Map.Entry<Constructor<?>, ResolvedJavaMethod> e : constructors.entrySet()) {
-            ResolvedJavaMethod m = e.getValue();
-            assertTrue(m.isConstructor());
-        }
-    }
-
-    @Test
-    public void isSyntheticTest() {
-        for (Map.Entry<Method, ResolvedJavaMethod> e : methods.entrySet()) {
-            ResolvedJavaMethod m = e.getValue();
-            assertEquals(e.getKey().isSynthetic(), m.isSynthetic());
-        }
-        for (Map.Entry<Constructor<?>, ResolvedJavaMethod> e : constructors.entrySet()) {
-            ResolvedJavaMethod m = e.getValue();
-            assertEquals(e.getKey().isSynthetic(), m.isSynthetic());
-        }
-    }
-
-    @Test
-    public void isSynchronizedTest() {
-        for (Map.Entry<Method, ResolvedJavaMethod> e : methods.entrySet()) {
-            ResolvedJavaMethod m = e.getValue();
-            assertEquals(Modifier.isSynchronized(e.getKey().getModifiers()), m.isSynchronized());
-        }
-        for (Map.Entry<Constructor<?>, ResolvedJavaMethod> e : constructors.entrySet()) {
-            ResolvedJavaMethod m = e.getValue();
-            assertEquals(Modifier.isSynchronized(e.getKey().getModifiers()), m.isSynchronized());
-        }
-    }
-
-    @Test
-    public void canBeStaticallyBoundTest() {
-        for (Map.Entry<Method, ResolvedJavaMethod> e : methods.entrySet()) {
-            ResolvedJavaMethod m = e.getValue();
-            assertEquals(m.canBeStaticallyBound(), canBeStaticallyBound(e.getKey()));
-        }
-        for (Map.Entry<Constructor<?>, ResolvedJavaMethod> e : constructors.entrySet()) {
-            ResolvedJavaMethod m = e.getValue();
-            assertEquals(m.canBeStaticallyBound(), canBeStaticallyBound(e.getKey()));
-        }
-    }
-
-    private static boolean canBeStaticallyBound(Member method) {
-        int modifiers = method.getModifiers();
-        return (Modifier.isFinal(modifiers) || Modifier.isPrivate(modifiers) || Modifier.isStatic(modifiers) || Modifier.isFinal(method.getDeclaringClass().getModifiers())) &&
-                        !Modifier.isAbstract(modifiers);
-    }
-
-    private static String methodWithExceptionHandlers(String p1, Object o2) {
-        try {
-            return p1.substring(100) + o2.toString();
-        } catch (IndexOutOfBoundsException e) {
-            e.printStackTrace();
-        } catch (NullPointerException e) {
-            e.printStackTrace();
-        } catch (RuntimeException e) {
-            e.printStackTrace();
-        }
-        return null;
-    }
-
-    @Test
-    public void getExceptionHandlersTest() throws NoSuchMethodException {
-        ResolvedJavaMethod method = metaAccess.lookupJavaMethod(getClass().getDeclaredMethod("methodWithExceptionHandlers", String.class, Object.class));
-        ExceptionHandler[] handlers = method.getExceptionHandlers();
-        assertNotNull(handlers);
-        assertEquals(handlers.length, 3);
-        handlers[0].getCatchType().equals(metaAccess.lookupJavaType(IndexOutOfBoundsException.class));
-        handlers[1].getCatchType().equals(metaAccess.lookupJavaType(NullPointerException.class));
-        handlers[2].getCatchType().equals(metaAccess.lookupJavaType(RuntimeException.class));
-    }
-
-    private static String nullPointerExceptionOnFirstLine(Object o, String ignored) {
-        return o.toString() + ignored;
-    }
-
-    @Test
-    public void asStackTraceElementTest() throws NoSuchMethodException {
-        try {
-            nullPointerExceptionOnFirstLine(null, "ignored");
-            Assert.fail("should not reach here");
-        } catch (NullPointerException e) {
-            StackTraceElement expected = e.getStackTrace()[0];
-            ResolvedJavaMethod method = metaAccess.lookupJavaMethod(getClass().getDeclaredMethod("nullPointerExceptionOnFirstLine", Object.class, String.class));
-            StackTraceElement actual = method.asStackTraceElement(0);
-            assertEquals(expected, actual);
-        }
-    }
-
-    @Test
-    public void getConstantPoolTest() {
-        for (Map.Entry<Method, ResolvedJavaMethod> e : methods.entrySet()) {
-            ResolvedJavaMethod m = e.getValue();
-            ConstantPool cp = m.getConstantPool();
-            assertTrue(cp.length() > 0);
-        }
-    }
-
-    @Test(timeout = 1000L)
-    public void getAnnotationTest() throws NoSuchMethodException {
-        ResolvedJavaMethod method = metaAccess.lookupJavaMethod(getClass().getDeclaredMethod("getAnnotationTest"));
-        Test annotation = method.getAnnotation(Test.class);
-        assertNotNull(annotation);
-        assertEquals(1000L, annotation.timeout());
-    }
-
-    @Test(timeout = 1000L)
-    public void getAnnotationsTest() throws NoSuchMethodException {
-        ResolvedJavaMethod method = metaAccess.lookupJavaMethod(getClass().getDeclaredMethod("getAnnotationsTest"));
-        Annotation[] annotations = method.getAnnotations();
-        assertNotNull(annotations);
-        assertEquals(1, annotations.length);
-        assertEquals(1000L, ((Test) annotations[0]).timeout());
-    }
-
-    @Retention(RetentionPolicy.RUNTIME)
-    @Target(ElementType.PARAMETER)
-    @interface NonNull {
-    }
-
-    @Retention(RetentionPolicy.RUNTIME)
-    @Target(ElementType.PARAMETER)
-    @interface Special {
-    }
-
-    private static native void methodWithAnnotatedParameters(@NonNull HashMap<String, String> p1, @Special @NonNull Class<? extends Annotation> p2);
-
-    @Test
-    public void getParameterAnnotationsTest() throws NoSuchMethodException {
-        ResolvedJavaMethod method = metaAccess.lookupJavaMethod(getClass().getDeclaredMethod("methodWithAnnotatedParameters", HashMap.class, Class.class));
-        Annotation[][] annotations = method.getParameterAnnotations();
-        assertEquals(2, annotations.length);
-        assertEquals(1, annotations[0].length);
-        assertEquals(NonNull.class, annotations[0][0].annotationType());
-        assertEquals(2, annotations[1].length);
-        assertEquals(Special.class, annotations[1][0].annotationType());
-        assertEquals(NonNull.class, annotations[1][1].annotationType());
-    }
-
-    @Test
-    public void getGenericParameterTypesTest() throws NoSuchMethodException {
-        ResolvedJavaMethod method = metaAccess.lookupJavaMethod(getClass().getDeclaredMethod("methodWithAnnotatedParameters", HashMap.class, Class.class));
-        Type[] genericParameterTypes = method.getGenericParameterTypes();
-        assertEquals(2, genericParameterTypes.length);
-        assertEquals("java.util.HashMap<java.lang.String, java.lang.String>", genericParameterTypes[0].toString());
-        assertEquals("java.lang.Class<? extends java.lang.annotation.Annotation>", genericParameterTypes[1].toString());
-    }
-
-    @Test
-    public void getMaxLocalsTest() throws NoSuchMethodException {
-        ResolvedJavaMethod method1 = metaAccess.lookupJavaMethod(getClass().getDeclaredMethod("methodWithAnnotatedParameters", HashMap.class, Class.class));
-        ResolvedJavaMethod method2 = metaAccess.lookupJavaMethod(getClass().getDeclaredMethod("nullPointerExceptionOnFirstLine", Object.class, String.class));
-        assertEquals(0, method1.getMaxLocals());
-        assertEquals(2, method2.getMaxLocals());
-
-    }
-
-    @Test
-    public void getMaxStackSizeTest() throws NoSuchMethodException {
-        ResolvedJavaMethod method1 = metaAccess.lookupJavaMethod(getClass().getDeclaredMethod("methodWithAnnotatedParameters", HashMap.class, Class.class));
-        ResolvedJavaMethod method2 = metaAccess.lookupJavaMethod(getClass().getDeclaredMethod("nullPointerExceptionOnFirstLine", Object.class, String.class));
-        assertEquals(0, method1.getMaxStackSize());
-        // some versions of javac produce bytecode with a stacksize of 2 for this method
-        // JSR 292 also sometimes need one more stack slot
-        int method2StackSize = method2.getMaxStackSize();
-        assertTrue(2 <= method2StackSize && method2StackSize <= 4);
-    }
-
-    @Test
-    public void isDefaultTest() {
-        for (Map.Entry<Method, ResolvedJavaMethod> e : methods.entrySet()) {
-            ResolvedJavaMethod m = e.getValue();
-            assertEquals(e.getKey().isDefault(), m.isDefault());
-        }
-        for (Map.Entry<Constructor<?>, ResolvedJavaMethod> e : constructors.entrySet()) {
-            ResolvedJavaMethod m = e.getValue();
-            assertFalse(m.isDefault());
-        }
-    }
-
-    @Test
-    public void hasReceiverTest() {
-        for (Map.Entry<Method, ResolvedJavaMethod> e : methods.entrySet()) {
-            ResolvedJavaMethod m = e.getValue();
-            assertTrue(m.hasReceiver() != Modifier.isStatic(e.getKey().getModifiers()));
-        }
-        for (Map.Entry<Constructor<?>, ResolvedJavaMethod> e : constructors.entrySet()) {
-            ResolvedJavaMethod m = e.getValue();
-            assertTrue(m.hasReceiver());
-        }
-    }
-
-    @Test
-    public void hasBytecodesTest() {
-        for (Map.Entry<Method, ResolvedJavaMethod> e : methods.entrySet()) {
-            ResolvedJavaMethod m = e.getValue();
-            assertTrue(m.hasBytecodes() == (m.isConcrete() && !m.isNative()));
-        }
-        for (Map.Entry<Constructor<?>, ResolvedJavaMethod> e : constructors.entrySet()) {
-            ResolvedJavaMethod m = e.getValue();
-            assertTrue(m.hasBytecodes());
-        }
-    }
-
-    @Test
-    public void isJavaLangObjectInitTest() throws NoSuchMethodException {
-        ResolvedJavaMethod method = metaAccess.lookupJavaMethod(Object.class.getConstructor());
-        assertTrue(method.isJavaLangObjectInit());
-        for (Map.Entry<Method, ResolvedJavaMethod> e : methods.entrySet()) {
-            ResolvedJavaMethod m = e.getValue();
-            assertFalse(m.isJavaLangObjectInit());
-        }
-        for (Map.Entry<Constructor<?>, ResolvedJavaMethod> e : constructors.entrySet()) {
-            ResolvedJavaMethod m = e.getValue();
-            Constructor<?> key = e.getKey();
-            if (key.getDeclaringClass() == Object.class && key.getParameters().length == 0) {
-                assertTrue(m.isJavaLangObjectInit());
-            } else {
-                assertFalse(m.isJavaLangObjectInit());
-            }
-        }
-    }
-
-    private Method findTestMethod(Method apiMethod) {
-        String testName = apiMethod.getName() + "Test";
-        for (Method m : getClass().getDeclaredMethods()) {
-            if (m.getName().equals(testName) && m.getAnnotation(Test.class) != null) {
-                return m;
-            }
-        }
-        return null;
-    }
-
-    // @formatter:off
-    private static final String[] untestedApiMethods = {
-        "invoke",
-        "newInstance",
-        "getDeclaringClass",
-        "getEncoding",
-        "getProfilingInfo",
-        "reprofile",
-        "getCompilerStorage",
-        "canBeInlined",
-        "shouldBeInlined",
-        "getLineNumberTable",
-        "getLocalVariableTable",
-        "isInVirtualMethodTable",
-        "toParameterTypes",
-        "getParameterAnnotation",
-        "$jacocoInit"
-    };
-    // @formatter:on
-
-    /**
-     * Ensures that any new methods added to {@link ResolvedJavaMethod} either have a test written
-     * for them or are added to {@link #untestedApiMethods}.
-     */
-    @Test
-    public void testCoverage() {
-        Set<String> known = new HashSet<>(Arrays.asList(untestedApiMethods));
-        for (Method m : ResolvedJavaMethod.class.getDeclaredMethods()) {
-            if (findTestMethod(m) == null) {
-                assertTrue("test missing for " + m, known.contains(m.getName()));
-            } else {
-                assertFalse("test should be removed from untestedApiMethods" + m, known.contains(m.getName()));
-            }
-        }
-    }
-}
--- a/graal/com.oracle.graal.api.meta.test/src/com/oracle/graal/api/meta/test/TestResolvedJavaType.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,874 +0,0 @@
-/*
- * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.api.meta.test;
-
-import static java.lang.reflect.Modifier.*;
-import static org.junit.Assert.*;
-
-import java.lang.annotation.*;
-import java.lang.reflect.*;
-import java.net.*;
-import java.util.*;
-
-import org.junit.*;
-
-import sun.reflect.ConstantPool;
-
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.api.meta.Assumptions.AssumptionResult;
-import com.oracle.graal.compiler.common.*;
-
-/**
- * Tests for {@link ResolvedJavaType}.
- */
-public class TestResolvedJavaType extends TypeUniverse {
-
-    public TestResolvedJavaType() {
-    }
-
-    @Test
-    public void findInstanceFieldWithOffsetTest() {
-        for (Class<?> c : classes) {
-            ResolvedJavaType type = metaAccess.lookupJavaType(c);
-            Set<Field> reflectionFields = getInstanceFields(c, true);
-            for (Field f : reflectionFields) {
-                ResolvedJavaField rf = lookupField(type.getInstanceFields(true), f);
-                assertNotNull(rf);
-                long offset = isStatic(f.getModifiers()) ? unsafe.staticFieldOffset(f) : unsafe.objectFieldOffset(f);
-                ResolvedJavaField result = type.findInstanceFieldWithOffset(offset, rf.getKind());
-                assertNotNull(result);
-                assertTrue(fieldsEqual(f, result));
-            }
-        }
-    }
-
-    @Test
-    public void isInterfaceTest() {
-        for (Class<?> c : classes) {
-            ResolvedJavaType type = metaAccess.lookupJavaType(c);
-            boolean expected = c.isInterface();
-            boolean actual = type.isInterface();
-            assertEquals(expected, actual);
-        }
-    }
-
-    @Test
-    public void isInstanceClassTest() {
-        for (Class<?> c : classes) {
-            ResolvedJavaType type = metaAccess.lookupJavaType(c);
-            boolean expected = !c.isArray() && !c.isPrimitive() && !c.isInterface();
-            boolean actual = type.isInstanceClass();
-            assertEquals(expected, actual);
-        }
-    }
-
-    @Test
-    public void isArrayTest() {
-        for (Class<?> c : classes) {
-            ResolvedJavaType type = metaAccess.lookupJavaType(c);
-            boolean expected = c.isArray();
-            boolean actual = type.isArray();
-            assertEquals(expected, actual);
-        }
-    }
-
-    @Test
-    public void getModifiersTest() {
-        for (Class<?> c : classes) {
-            ResolvedJavaType type = metaAccess.lookupJavaType(c);
-            int expected = c.getModifiers();
-            int actual = type.getModifiers();
-            assertEquals(expected, actual);
-        }
-    }
-
-    @Test
-    public void isAssignableFromTest() {
-        Class<?>[] all = classes.toArray(new Class[classes.size()]);
-        for (int i = 0; i < all.length; i++) {
-            Class<?> c1 = all[i];
-            for (int j = i; j < all.length; j++) {
-                Class<?> c2 = all[j];
-                ResolvedJavaType t1 = metaAccess.lookupJavaType(c1);
-                ResolvedJavaType t2 = metaAccess.lookupJavaType(c2);
-                boolean expected = c1.isAssignableFrom(c2);
-                boolean actual = t1.isAssignableFrom(t2);
-                assertEquals(expected, actual);
-                if (expected && t1 != t2) {
-                    assertFalse(t2.isAssignableFrom(t1));
-                }
-            }
-        }
-    }
-
-    @Test
-    public void isInstanceTest() {
-        for (JavaConstant c : constants) {
-            if (c.getKind() == Kind.Object && !c.isNull()) {
-                Object o = snippetReflection.asObject(Object.class, c);
-                Class<? extends Object> cls = o.getClass();
-                while (cls != null) {
-                    ResolvedJavaType type = metaAccess.lookupJavaType(cls);
-                    boolean expected = cls.isInstance(o);
-                    boolean actual = type.isInstance(c);
-                    assertEquals(expected, actual);
-                    cls = cls.getSuperclass();
-                }
-            }
-        }
-    }
-
-    private static Class<?> asExactClass(Class<?> c) {
-        if (c.isArray()) {
-            if (asExactClass(c.getComponentType()) != null) {
-                return c;
-            }
-        } else {
-            if (c.isPrimitive() || Modifier.isFinal(c.getModifiers())) {
-                return c;
-            }
-        }
-        return null;
-    }
-
-    @Test
-    public void asExactTypeTest() {
-        for (Class<?> c : classes) {
-            ResolvedJavaType type = metaAccess.lookupJavaType(c);
-            ResolvedJavaType exactType = type.asExactType();
-            Class<?> expected = asExactClass(c);
-            if (expected == null) {
-                assertTrue("exact(" + c.getName() + ") != null", exactType == null);
-            } else {
-                assertNotNull(exactType);
-                assertTrue(exactType.equals(metaAccess.lookupJavaType(expected)));
-            }
-        }
-    }
-
-    @Test
-    public void getSuperclassTest() {
-        for (Class<?> c : classes) {
-            ResolvedJavaType type = metaAccess.lookupJavaType(c);
-            Class<?> expected = c.getSuperclass();
-            ResolvedJavaType actual = type.getSuperclass();
-            if (expected == null) {
-                assertTrue(actual == null);
-            } else {
-                assertNotNull(actual);
-                assertTrue(actual.equals(metaAccess.lookupJavaType(expected)));
-            }
-        }
-    }
-
-    @Test
-    public void getInterfacesTest() {
-        for (Class<?> c : classes) {
-            ResolvedJavaType type = metaAccess.lookupJavaType(c);
-            Class<?>[] expected = c.getInterfaces();
-            ResolvedJavaType[] actual = type.getInterfaces();
-            assertEquals(expected.length, actual.length);
-            for (int i = 0; i < expected.length; i++) {
-                assertTrue(actual[i].equals(metaAccess.lookupJavaType(expected[i])));
-            }
-        }
-    }
-
-    public Class<?> getSupertype(Class<?> c) {
-        assert !c.isPrimitive();
-        if (c.isArray()) {
-            Class<?> componentType = c.getComponentType();
-            if (componentType.isPrimitive() || componentType == Object.class) {
-                return Object.class;
-            }
-            return getArrayClass(getSupertype(componentType));
-        }
-        if (c.isInterface()) {
-            return Object.class;
-        }
-        return c.getSuperclass();
-    }
-
-    public Class<?> findLeastCommonAncestor(Class<?> c1Initial, Class<?> c2Initial) {
-        if (c1Initial.isPrimitive() || c2Initial.isPrimitive()) {
-            return null;
-        } else {
-            Class<?> c1 = c1Initial;
-            Class<?> c2 = c2Initial;
-            while (true) {
-                if (c1.isAssignableFrom(c2)) {
-                    return c1;
-                }
-                if (c2.isAssignableFrom(c1)) {
-                    return c2;
-                }
-                c1 = getSupertype(c1);
-                c2 = getSupertype(c2);
-            }
-        }
-    }
-
-    @Test
-    public void findLeastCommonAncestorTest() {
-        Class<?>[] all = classes.toArray(new Class[classes.size()]);
-        for (int i = 0; i < all.length; i++) {
-            Class<?> c1 = all[i];
-            for (int j = i; j < all.length; j++) {
-                Class<?> c2 = all[j];
-                ResolvedJavaType t1 = metaAccess.lookupJavaType(c1);
-                ResolvedJavaType t2 = metaAccess.lookupJavaType(c2);
-                Class<?> expected = findLeastCommonAncestor(c1, c2);
-                ResolvedJavaType actual = t1.findLeastCommonAncestor(t2);
-                if (expected == null) {
-                    assertTrue(actual == null);
-                } else {
-                    assertNotNull(actual);
-                    assertTrue(actual.equals(metaAccess.lookupJavaType(expected)));
-                }
-            }
-        }
-    }
-
-    private static class Base {
-    }
-
-    abstract static class Abstract1 extends Base {
-    }
-
-    interface Interface1 {
-    }
-
-    static class Concrete1 extends Abstract1 {
-    }
-
-    static class Concrete2 extends Abstract1 implements Interface1 {
-    }
-
-    static class Concrete3 extends Concrete2 {
-    }
-
-    static final class Final1 extends Abstract1 {
-    }
-
-    abstract static class Abstract4 extends Concrete3 {
-    }
-
-    void checkConcreteSubtype(ResolvedJavaType type, ResolvedJavaType expected) {
-        AssumptionResult<ResolvedJavaType> leafConcreteSubtype = type.findLeafConcreteSubtype();
-        if (leafConcreteSubtype == null) {
-            // findLeafConcreteSubtype() is conservative
-        } else {
-            if (expected == null) {
-                assertNull(leafConcreteSubtype);
-            } else {
-                assertTrue(leafConcreteSubtype.getResult().equals(expected));
-            }
-        }
-
-        if (!type.isArray()) {
-            ResolvedJavaType arrayType = type.getArrayClass();
-            AssumptionResult<ResolvedJavaType> arraySubtype = arrayType.findLeafConcreteSubtype();
-            if (arraySubtype != null) {
-                assertEquals(arraySubtype.getResult(), arrayType);
-            } else {
-                // findLeafConcreteSubtype() method is conservative
-            }
-        }
-    }
-
-    @Test
-    public void findLeafConcreteSubtypeTest() {
-        ResolvedJavaType base = metaAccess.lookupJavaType(Base.class);
-        checkConcreteSubtype(base, base);
-
-        ResolvedJavaType a1 = metaAccess.lookupJavaType(Abstract1.class);
-        ResolvedJavaType c1 = metaAccess.lookupJavaType(Concrete1.class);
-
-        checkConcreteSubtype(base, null);
-        checkConcreteSubtype(a1, c1);
-        checkConcreteSubtype(c1, c1);
-
-        ResolvedJavaType i1 = metaAccess.lookupJavaType(Interface1.class);
-        ResolvedJavaType c2 = metaAccess.lookupJavaType(Concrete2.class);
-
-        checkConcreteSubtype(base, null);
-        checkConcreteSubtype(a1, null);
-        checkConcreteSubtype(c1, c1);
-        checkConcreteSubtype(i1, c2);
-        checkConcreteSubtype(c2, c2);
-
-        ResolvedJavaType c3 = metaAccess.lookupJavaType(Concrete3.class);
-        checkConcreteSubtype(c2, null);
-        checkConcreteSubtype(c3, c3);
-
-        ResolvedJavaType a4 = metaAccess.lookupJavaType(Abstract4.class);
-        checkConcreteSubtype(c3, null);
-        checkConcreteSubtype(a4, null);
-
-        ResolvedJavaType a1a = metaAccess.lookupJavaType(Abstract1[].class);
-        checkConcreteSubtype(a1a, null);
-        ResolvedJavaType c1a = metaAccess.lookupJavaType(Concrete1[].class);
-        checkConcreteSubtype(c1a, null);
-        ResolvedJavaType f1a = metaAccess.lookupJavaType(Final1[].class);
-        checkConcreteSubtype(f1a, f1a);
-
-        ResolvedJavaType obja = metaAccess.lookupJavaType(Object[].class);
-        checkConcreteSubtype(obja, null);
-
-        ResolvedJavaType inta = metaAccess.lookupJavaType(int[].class);
-        checkConcreteSubtype(inta, inta);
-    }
-
-    interface NoImplementor {
-    }
-
-    interface SingleImplementorInterface {
-    }
-
-    static class SingleConcreteImplementor implements SingleImplementorInterface {
-    }
-
-    interface SingleAbstractImplementorInterface {
-    }
-
-    abstract static class SingleAbstractImplementor implements SingleAbstractImplementorInterface {
-    }
-
-    interface MultiImplementorInterface {
-    }
-
-    static class ConcreteImplementor1 implements MultiImplementorInterface {
-    }
-
-    static class ConcreteImplementor2 implements MultiImplementorInterface {
-    }
-
-    interface MultipleAbstractImplementorInterface {
-    }
-
-    abstract static class MultiAbstractImplementor1 implements MultipleAbstractImplementorInterface {
-    }
-
-    abstract static class MultiAbstractImplementor2 implements MultipleAbstractImplementorInterface {
-    }
-
-    interface SingleAbstractImplementorInterface2 {
-    }
-
-    interface ExtendedSingleImplementorInterface {
-    }
-
-    abstract static class SingleAbstractImplementor2 implements SingleAbstractImplementorInterface2 {
-    }
-
-    static class ConcreteTransitiveImplementor1 extends SingleAbstractImplementor2 implements ExtendedSingleImplementorInterface {
-    }
-
-    static class ConcreteTransitiveImplementor2 extends SingleAbstractImplementor2 implements ExtendedSingleImplementorInterface {
-    }
-
-    @Test
-    public void getSingleImplementorTest() {
-        ResolvedJavaType iNi = metaAccess.lookupJavaType(NoImplementor.class);
-        assertNull(iNi.getSingleImplementor());
-
-        ResolvedJavaType iSi = metaAccess.lookupJavaType(SingleImplementorInterface.class);
-        ResolvedJavaType cSi = metaAccess.lookupJavaType(SingleConcreteImplementor.class);
-        assertEquals(cSi, iSi.getSingleImplementor());
-
-        ResolvedJavaType iSai = metaAccess.lookupJavaType(SingleAbstractImplementorInterface.class);
-        ResolvedJavaType aSai = metaAccess.lookupJavaType(SingleAbstractImplementor.class);
-        assertEquals(aSai, iSai.getSingleImplementor());
-
-        ResolvedJavaType iMi = metaAccess.lookupJavaType(MultiImplementorInterface.class);
-        metaAccess.lookupJavaType(ConcreteImplementor1.class);
-        metaAccess.lookupJavaType(ConcreteImplementor2.class);
-        assertEquals(iMi, iMi.getSingleImplementor());
-
-        ResolvedJavaType iMai = metaAccess.lookupJavaType(MultipleAbstractImplementorInterface.class);
-        metaAccess.lookupJavaType(MultiAbstractImplementor1.class);
-        metaAccess.lookupJavaType(MultiAbstractImplementor2.class);
-        assertEquals(iMai, iMai.getSingleImplementor());
-
-        ResolvedJavaType iSai2 = metaAccess.lookupJavaType(SingleAbstractImplementorInterface2.class);
-        ResolvedJavaType aSai2 = metaAccess.lookupJavaType(SingleAbstractImplementor2.class);
-        metaAccess.lookupJavaType(ConcreteTransitiveImplementor1.class);
-        metaAccess.lookupJavaType(ConcreteTransitiveImplementor2.class);
-        assertEquals(aSai2, iSai2.getSingleImplementor());
-    }
-
-    @Test(expected = GraalInternalError.class)
-    public void getSingleImplementorTestClassReceiver() {
-        ResolvedJavaType base = metaAccess.lookupJavaType(Base.class);
-        base.getSingleImplementor();
-    }
-
-    @Test(expected = GraalInternalError.class)
-    public void getSingleImplementorTestPrimitiveReceiver() {
-        ResolvedJavaType primitive = metaAccess.lookupJavaType(int.class);
-        primitive.getSingleImplementor();
-    }
-
-    @Test
-    public void getComponentTypeTest() {
-        for (Class<?> c : classes) {
-            ResolvedJavaType type = metaAccess.lookupJavaType(c);
-            Class<?> expected = c.getComponentType();
-            ResolvedJavaType actual = type.getComponentType();
-            if (expected == null) {
-                assertNull(actual);
-            } else {
-                assertTrue(actual.equals(metaAccess.lookupJavaType(expected)));
-            }
-        }
-    }
-
-    @Test
-    public void getArrayClassTest() {
-        for (Class<?> c : classes) {
-            if (c != void.class) {
-                ResolvedJavaType type = metaAccess.lookupJavaType(c);
-                Class<?> expected = getArrayClass(c);
-                ResolvedJavaType actual = type.getArrayClass();
-                assertTrue(actual.equals(metaAccess.lookupJavaType(expected)));
-            }
-        }
-    }
-
-    static class Declarations {
-
-        final Method implementation;
-        final Set<Method> declarations;
-
-        public Declarations(Method impl) {
-            this.implementation = impl;
-            declarations = new HashSet<>();
-        }
-    }
-
-    /**
-     * See <a href="http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-5.html#jvms-5.4.5">Method
-     * overriding</a>.
-     */
-    static boolean isOverriderOf(Method impl, Method m) {
-        if (!isPrivate(m.getModifiers()) && !isFinal(m.getModifiers())) {
-            if (m.getName().equals(impl.getName())) {
-                if (m.getReturnType() == impl.getReturnType()) {
-                    if (Arrays.equals(m.getParameterTypes(), impl.getParameterTypes())) {
-                        if (isPublic(m.getModifiers()) || isProtected(m.getModifiers())) {
-                            // m is public or protected
-                            return isPublic(impl.getModifiers()) || isProtected(impl.getModifiers());
-                        } else {
-                            // m is package-private
-                            return impl.getDeclaringClass().getPackage() == m.getDeclaringClass().getPackage();
-                        }
-                    }
-                }
-            }
-        }
-        return false;
-    }
-
-    static final Map<Class<?>, VTable> vtables = new HashMap<>();
-
-    static class VTable {
-
-        final Map<NameAndSignature, Method> methods = new HashMap<>();
-    }
-
-    static synchronized VTable getVTable(Class<?> c) {
-        VTable vtable = vtables.get(c);
-        if (vtable == null) {
-            vtable = new VTable();
-            if (c != Object.class) {
-                VTable superVtable = getVTable(c.getSuperclass());
-                vtable.methods.putAll(superVtable.methods);
-            }
-            for (Method m : c.getDeclaredMethods()) {
-                if (!isStatic(m.getModifiers()) && !isPrivate(m.getModifiers())) {
-                    if (isAbstract(m.getModifiers())) {
-                        // A subclass makes a concrete method in a superclass abstract
-                        vtable.methods.remove(new NameAndSignature(m));
-                    } else {
-                        vtable.methods.put(new NameAndSignature(m), m);
-                    }
-                }
-            }
-            vtables.put(c, vtable);
-        }
-        return vtable;
-    }
-
-    static Set<Method> findDeclarations(Method impl, Class<?> c) {
-        Set<Method> declarations = new HashSet<>();
-        NameAndSignature implSig = new NameAndSignature(impl);
-        if (c != null) {
-            for (Method m : c.getDeclaredMethods()) {
-                if (new NameAndSignature(m).equals(implSig)) {
-                    declarations.add(m);
-                    break;
-                }
-            }
-            if (!c.isInterface()) {
-                declarations.addAll(findDeclarations(impl, c.getSuperclass()));
-            }
-            for (Class<?> i : c.getInterfaces()) {
-                declarations.addAll(findDeclarations(impl, i));
-            }
-        }
-        return declarations;
-    }
-
-    private static void checkResolveMethod(ResolvedJavaType type, ResolvedJavaType context, ResolvedJavaMethod decl, ResolvedJavaMethod expected) {
-        ResolvedJavaMethod impl = type.resolveConcreteMethod(decl, context);
-        assertEquals(expected, impl);
-    }
-
-    @Test
-    public void resolveMethodTest() {
-        ResolvedJavaType context = metaAccess.lookupJavaType(TestResolvedJavaType.class);
-        for (Class<?> c : classes) {
-            if (c.isInterface() || c.isPrimitive()) {
-                ResolvedJavaType type = metaAccess.lookupJavaType(c);
-                for (Method m : c.getDeclaredMethods()) {
-                    if (JAVA_VERSION <= 1.7D || (!isStatic(m.getModifiers()) && !isPrivate(m.getModifiers()))) {
-                        ResolvedJavaMethod resolved = metaAccess.lookupJavaMethod(m);
-                        ResolvedJavaMethod impl = type.resolveMethod(resolved, context, true);
-                        ResolvedJavaMethod expected = resolved.isDefault() || resolved.isAbstract() ? resolved : null;
-                        assertEquals(m.toString(), expected, impl);
-                    } else {
-                        // As of JDK 8, interfaces can have static and private methods
-                    }
-                }
-            } else {
-                ResolvedJavaType type = metaAccess.lookupJavaType(c);
-                VTable vtable = getVTable(c);
-                for (Method impl : vtable.methods.values()) {
-                    Set<Method> decls = findDeclarations(impl, c);
-                    for (Method decl : decls) {
-                        ResolvedJavaMethod m = metaAccess.lookupJavaMethod(decl);
-                        if (m.isPublic()) {
-                            ResolvedJavaMethod i = metaAccess.lookupJavaMethod(impl);
-                            checkResolveMethod(type, context, m, i);
-                        }
-                    }
-                }
-            }
-        }
-    }
-
-    @Test
-    public void resolveConcreteMethodTest() {
-        ResolvedJavaType context = metaAccess.lookupJavaType(TestResolvedJavaType.class);
-        for (Class<?> c : classes) {
-            if (c.isInterface() || c.isPrimitive()) {
-                ResolvedJavaType type = metaAccess.lookupJavaType(c);
-                for (Method m : c.getDeclaredMethods()) {
-                    if (JAVA_VERSION <= 1.7D || (!isStatic(m.getModifiers()) && !isPrivate(m.getModifiers()))) {
-                        ResolvedJavaMethod resolved = metaAccess.lookupJavaMethod(m);
-                        ResolvedJavaMethod impl = type.resolveConcreteMethod(resolved, context);
-                        ResolvedJavaMethod expected = resolved.isDefault() ? resolved : null;
-                        assertEquals(m.toString(), expected, impl);
-                    } else {
-                        // As of JDK 8, interfaces can have static and private methods
-                    }
-                }
-            } else {
-                ResolvedJavaType type = metaAccess.lookupJavaType(c);
-                VTable vtable = getVTable(c);
-                for (Method impl : vtable.methods.values()) {
-                    Set<Method> decls = findDeclarations(impl, c);
-                    for (Method decl : decls) {
-                        ResolvedJavaMethod m = metaAccess.lookupJavaMethod(decl);
-                        if (m.isPublic()) {
-                            ResolvedJavaMethod i = metaAccess.lookupJavaMethod(impl);
-                            checkResolveMethod(type, context, m, i);
-                        }
-                    }
-                }
-                for (Method m : c.getDeclaredMethods()) {
-                    ResolvedJavaMethod impl = type.resolveConcreteMethod(metaAccess.lookupJavaMethod(m), context);
-                    ResolvedJavaMethod expected = isAbstract(m.getModifiers()) ? null : impl;
-                    assertEquals(type + " " + m.toString(), expected, impl);
-                }
-            }
-        }
-    }
-
-    @Test
-    public void findUniqueConcreteMethodTest() throws NoSuchMethodException {
-        ResolvedJavaMethod thisMethod = metaAccess.lookupJavaMethod(getClass().getDeclaredMethod("findUniqueConcreteMethodTest"));
-        ResolvedJavaMethod ucm = metaAccess.lookupJavaType(getClass()).findUniqueConcreteMethod(thisMethod).getResult();
-        assertEquals(thisMethod, ucm);
-    }
-
-    public static Set<Field> getInstanceFields(Class<?> c, boolean includeSuperclasses) {
-        if (c.isArray() || c.isPrimitive() || c.isInterface()) {
-            return Collections.emptySet();
-        }
-        Set<Field> result = new HashSet<>();
-        for (Field f : c.getDeclaredFields()) {
-            if (!Modifier.isStatic(f.getModifiers())) {
-                result.add(f);
-            }
-        }
-        if (includeSuperclasses && c != Object.class) {
-            result.addAll(getInstanceFields(c.getSuperclass(), true));
-        }
-        return result;
-    }
-
-    public static Set<Field> getStaticFields(Class<?> c) {
-        Set<Field> result = new HashSet<>();
-        for (Field f : c.getDeclaredFields()) {
-            if (Modifier.isStatic(f.getModifiers())) {
-                result.add(f);
-            }
-        }
-        return result;
-    }
-
-    public boolean fieldsEqual(Field f, ResolvedJavaField rjf) {
-        return rjf.getDeclaringClass().equals(metaAccess.lookupJavaType(f.getDeclaringClass())) && rjf.getName().equals(f.getName()) &&
-                        rjf.getType().resolve(rjf.getDeclaringClass()).equals(metaAccess.lookupJavaType(f.getType()));
-    }
-
-    public ResolvedJavaField lookupField(ResolvedJavaField[] fields, Field key) {
-        for (ResolvedJavaField rf : fields) {
-            if (fieldsEqual(key, rf)) {
-                return rf;
-            }
-        }
-        return null;
-    }
-
-    public Field lookupField(Set<Field> fields, ResolvedJavaField key) {
-        for (Field f : fields) {
-            if (fieldsEqual(f, key)) {
-                return f;
-            }
-        }
-        return null;
-    }
-
-    private boolean isHiddenFromReflection(ResolvedJavaField f) {
-        if (f.getDeclaringClass().equals(metaAccess.lookupJavaType(Throwable.class)) && f.getName().equals("backtrace")) {
-            return true;
-        }
-        if (f.getDeclaringClass().equals(metaAccess.lookupJavaType(ConstantPool.class)) && f.getName().equals("constantPoolOop")) {
-            return true;
-        }
-        if (f.getDeclaringClass().equals(metaAccess.lookupJavaType(Class.class)) && f.getName().equals("classLoader")) {
-            return true;
-        }
-        return false;
-    }
-
-    @Test
-    public void getInstanceFieldsTest() {
-        for (Class<?> c : classes) {
-            ResolvedJavaType type = metaAccess.lookupJavaType(c);
-            for (boolean includeSuperclasses : new boolean[]{true, false}) {
-                Set<Field> expected = getInstanceFields(c, includeSuperclasses);
-                ResolvedJavaField[] actual = type.getInstanceFields(includeSuperclasses);
-                for (Field f : expected) {
-                    assertNotNull(lookupField(actual, f));
-                }
-                for (ResolvedJavaField rf : actual) {
-                    if (!isHiddenFromReflection(rf)) {
-                        assertEquals(rf.toString(), lookupField(expected, rf) != null, !rf.isInternal());
-                    }
-                }
-
-                // Test stability of getInstanceFields
-                ResolvedJavaField[] actual2 = type.getInstanceFields(includeSuperclasses);
-                assertArrayEquals(actual, actual2);
-            }
-        }
-    }
-
-    @Test
-    public void getStaticFieldsTest() {
-        for (Class<?> c : classes) {
-            ResolvedJavaType type = metaAccess.lookupJavaType(c);
-            Set<Field> expected = getStaticFields(c);
-            ResolvedJavaField[] actual = type.getStaticFields();
-            for (Field f : expected) {
-                assertNotNull(lookupField(actual, f));
-            }
-            for (ResolvedJavaField rf : actual) {
-                if (!isHiddenFromReflection(rf)) {
-                    assertEquals(lookupField(expected, rf) != null, !rf.isInternal());
-                }
-            }
-
-            // Test stability of getStaticFields
-            ResolvedJavaField[] actual2 = type.getStaticFields();
-            assertArrayEquals(actual, actual2);
-        }
-    }
-
-    @Test
-    public void getDeclaredMethodsTest() {
-        for (Class<?> c : classes) {
-            ResolvedJavaType type = metaAccess.lookupJavaType(c);
-            Method[] raw = c.getDeclaredMethods();
-            Set<ResolvedJavaMethod> expected = new HashSet<>();
-            for (Method m : raw) {
-                ResolvedJavaMethod resolvedMethod = metaAccess.lookupJavaMethod(m);
-                assertNotNull(resolvedMethod);
-                expected.add(resolvedMethod);
-            }
-            Set<ResolvedJavaMethod> actual = new HashSet<>(Arrays.asList(type.getDeclaredMethods()));
-            assertEquals(expected, actual);
-        }
-    }
-
-    static class A {
-        static String name = "foo";
-    }
-
-    static class B extends A {
-    }
-
-    static class C {
-    }
-
-    static class D {
-        void foo() {
-            // use of assertions causes the class to have a <clinit>
-            assert getClass() != null;
-        }
-    }
-
-    @Test
-    public void getClassInitializerTest() {
-        assertNotNull(metaAccess.lookupJavaType(A.class).getClassInitializer());
-        assertNotNull(metaAccess.lookupJavaType(D.class).getClassInitializer());
-        assertNull(metaAccess.lookupJavaType(B.class).getClassInitializer());
-        assertNull(metaAccess.lookupJavaType(C.class).getClassInitializer());
-        assertNull(metaAccess.lookupJavaType(int.class).getClassInitializer());
-        assertNull(metaAccess.lookupJavaType(void.class).getClassInitializer());
-    }
-
-    @Test
-    public void getAnnotationTest() {
-        for (Class<?> c : classes) {
-            ResolvedJavaType type = metaAccess.lookupJavaType(c);
-            for (Annotation a : c.getAnnotations()) {
-                assertEquals(a, type.getAnnotation(a.annotationType()));
-            }
-        }
-    }
-
-    @Test
-    public void memberClassesTest() {
-        for (Class<?> c : classes) {
-            ResolvedJavaType type = metaAccess.lookupJavaType(c);
-            assertEquals(c.isLocalClass(), type.isLocal());
-            assertEquals(c.isMemberClass(), type.isMember());
-            Class<?> enclc = c.getEnclosingClass();
-            ResolvedJavaType enclt = type.getEnclosingType();
-            assertFalse(enclc == null ^ enclt == null);
-            if (enclc != null) {
-                assertEquals(enclt, metaAccess.lookupJavaType(enclc));
-            }
-        }
-    }
-
-    @Test
-    public void classFilePathTest() {
-        for (Class<?> c : classes) {
-            ResolvedJavaType type = metaAccess.lookupJavaType(c);
-            URL path = type.getClassFilePath();
-            if (type.isPrimitive() || type.isArray()) {
-                assertEquals(null, path);
-            } else {
-                assertNotNull(path);
-                String pathString = path.getPath();
-                if (type.isLocal() || type.isMember()) {
-                    assertTrue(pathString.indexOf('$') > 0);
-                }
-            }
-        }
-    }
-
-    @Test
-    public void isTrustedInterfaceTypeTest() {
-        for (Class<?> c : classes) {
-            ResolvedJavaType type = metaAccess.lookupJavaType(c);
-            if (TrustedInterface.class.isAssignableFrom(c)) {
-                assertTrue(type.isTrustedInterfaceType());
-            }
-        }
-    }
-
-    private Method findTestMethod(Method apiMethod) {
-        String testName = apiMethod.getName() + "Test";
-        for (Method m : getClass().getDeclaredMethods()) {
-            if (m.getName().equals(testName) && m.getAnnotation(Test.class) != null) {
-                return m;
-            }
-        }
-        return null;
-    }
-
-    // @formatter:off
-    private static final String[] untestedApiMethods = {
-        "initialize",
-        "isPrimitive",
-        "newArray",
-        "getDeclaredConstructors",
-        "isInitialized",
-        "isLinked",
-        "getJavaClass",
-        "getObjectHub",
-        "hasFinalizableSubclass",
-        "hasFinalizer",
-        "getSourceFileName",
-        "getClassFilePath",
-        "isLocal",
-        "isJavaLangObject",
-        "isMember",
-        "getElementalType",
-        "getEnclosingType",
-        "$jacocoInit"
-    };
-    // @formatter:on
-
-    /**
-     * Ensures that any new methods added to {@link ResolvedJavaMethod} either have a test written
-     * for them or are added to {@link #untestedApiMethods}.
-     */
-    @Test
-    public void testCoverage() {
-        Set<String> known = new HashSet<>(Arrays.asList(untestedApiMethods));
-        for (Method m : ResolvedJavaType.class.getDeclaredMethods()) {
-            if (findTestMethod(m) == null) {
-                assertTrue("test missing for " + m, known.contains(m.getName()));
-            } else {
-                assertFalse("test should be removed from untestedApiMethods" + m, known.contains(m.getName()));
-            }
-        }
-    }
-}
--- a/graal/com.oracle.graal.api.meta.test/src/com/oracle/graal/api/meta/test/TypeUniverse.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,150 +0,0 @@
-/*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.api.meta.test;
-
-import java.io.*;
-import java.lang.reflect.*;
-import java.util.*;
-import java.util.Queue;
-
-import org.junit.*;
-
-import sun.misc.*;
-
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.api.replacements.*;
-import com.oracle.graal.api.runtime.*;
-import com.oracle.graal.phases.util.*;
-import com.oracle.graal.runtime.*;
-
-/**
- * Context for type related api.meta tests.
- */
-public class TypeUniverse {
-
-    public final Unsafe unsafe;
-    public static final double JAVA_VERSION = Double.valueOf(System.getProperty("java.specification.version"));
-
-    public final MetaAccessProvider metaAccess;
-    public final ConstantReflectionProvider constantReflection;
-    public final SnippetReflectionProvider snippetReflection;
-    public final Collection<Class<?>> classes = new HashSet<>();
-    public final Map<Class<?>, Class<?>> arrayClasses = new HashMap<>();
-    public final List<JavaConstant> constants = new ArrayList<>();
-
-    public TypeUniverse() {
-        Providers providers = Graal.getRequiredCapability(RuntimeProvider.class).getHostBackend().getProviders();
-        metaAccess = providers.getMetaAccess();
-        constantReflection = providers.getConstantReflection();
-        snippetReflection = Graal.getRequiredCapability(SnippetReflectionProvider.class);
-        Unsafe theUnsafe = null;
-        try {
-            theUnsafe = Unsafe.getUnsafe();
-        } catch (Exception e) {
-            try {
-                Field theUnsafeField = Unsafe.class.getDeclaredField("theUnsafe");
-                theUnsafeField.setAccessible(true);
-                theUnsafe = (Unsafe) theUnsafeField.get(null);
-            } catch (Exception e1) {
-                throw (InternalError) new InternalError("unable to initialize unsafe").initCause(e1);
-            }
-        }
-        unsafe = theUnsafe;
-
-        Class<?>[] initialClasses = {void.class, boolean.class, byte.class, short.class, char.class, int.class, float.class, long.class, double.class, Object.class, Class.class, ClassLoader.class,
-                        String.class, Serializable.class, Cloneable.class, Test.class, TestMetaAccessProvider.class, List.class, Collection.class, Map.class, Queue.class, HashMap.class,
-                        LinkedHashMap.class, IdentityHashMap.class, AbstractCollection.class, AbstractList.class, ArrayList.class, TrustedInterface.class};
-        for (Class<?> c : initialClasses) {
-            addClass(c);
-        }
-        for (Field f : JavaConstant.class.getDeclaredFields()) {
-            int mods = f.getModifiers();
-            if (f.getType() == JavaConstant.class && Modifier.isPublic(mods) && Modifier.isStatic(mods) && Modifier.isFinal(mods)) {
-                try {
-                    JavaConstant c = (JavaConstant) f.get(null);
-                    if (c != null) {
-                        constants.add(c);
-                    }
-                } catch (Exception e) {
-                }
-            }
-        }
-        for (Class<?> c : classes) {
-            if (c != void.class && !c.isArray()) {
-                constants.add(snippetReflection.forObject(Array.newInstance(c, 42)));
-            }
-        }
-        constants.add(snippetReflection.forObject(new ArrayList<>()));
-        constants.add(snippetReflection.forObject(new IdentityHashMap<>()));
-        constants.add(snippetReflection.forObject(new LinkedHashMap<>()));
-        constants.add(snippetReflection.forObject(new TreeMap<>()));
-        constants.add(snippetReflection.forObject(new ArrayDeque<>()));
-        constants.add(snippetReflection.forObject(new LinkedList<>()));
-        constants.add(snippetReflection.forObject("a string"));
-        constants.add(snippetReflection.forObject(42));
-        constants.add(snippetReflection.forObject(String.class));
-        constants.add(snippetReflection.forObject(String[].class));
-    }
-
-    public synchronized Class<?> getArrayClass(Class<?> componentType) {
-        Class<?> arrayClass = arrayClasses.get(componentType);
-        if (arrayClass == null) {
-            arrayClass = Array.newInstance(componentType, 0).getClass();
-            arrayClasses.put(componentType, arrayClass);
-        }
-        return arrayClass;
-    }
-
-    public static int dimensions(Class<?> c) {
-        if (c.getComponentType() != null) {
-            return 1 + dimensions(c.getComponentType());
-        }
-        return 0;
-    }
-
-    private void addClass(Class<?> c) {
-        if (classes.add(c)) {
-            if (c.getSuperclass() != null) {
-                addClass(c.getSuperclass());
-            }
-            for (Class<?> sc : c.getInterfaces()) {
-                addClass(sc);
-            }
-            for (Class<?> dc : c.getDeclaredClasses()) {
-                addClass(dc);
-            }
-            for (Method m : c.getDeclaredMethods()) {
-                addClass(m.getReturnType());
-                for (Class<?> p : m.getParameterTypes()) {
-                    addClass(p);
-                }
-            }
-
-            if (c != void.class && dimensions(c) < 2) {
-                Class<?> arrayClass = Array.newInstance(c, 0).getClass();
-                arrayClasses.put(c, arrayClass);
-                addClass(arrayClass);
-            }
-        }
-    }
-}
--- a/graal/com.oracle.graal.api.meta/overview.html	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
-<head>
-<!--
-
-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.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-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.
--->
-
-</head>
-<body>
-
-The <code>com.oracle.graal.api.meta</code> project provides an API to the runtime data structures
-for various Java elements. Unlike standard Java reflection, it can model elements that are not yet loaded.
-It can also expose profiling information collected by the runtime system.
-
-</body>
-</html>
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/AbstractJavaProfile.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,158 +0,0 @@
-/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.api.meta;
-
-/**
- * This object holds probability information for a set of items that were profiled at a specific
- * BCI. The precision of the supplied values may vary, but a runtime that provides this information
- * should be aware that it will be used to guide performance-critical decisions like speculative
- * inlining, etc.
- *
- * @param <T> a subclass of AbstractProfiledItem
- * @param <U> the class of the items that are profiled at the specific BCI and for which
- *            probabilities are stored. E.g., a ResolvedJavaType or a ResolvedJavaMethod.
- */
-public abstract class AbstractJavaProfile<T extends AbstractProfiledItem<U>, U> {
-
-    private final double notRecordedProbability;
-    private final T[] pitems;
-
-    public AbstractJavaProfile(double notRecordedProbability, T[] pitems) {
-        this.pitems = pitems;
-        assert !Double.isNaN(notRecordedProbability);
-        this.notRecordedProbability = notRecordedProbability;
-        assert isSorted();
-        assert totalProbablility() >= 0 && totalProbablility() <= 1.0001 : totalProbablility() + " " + this;
-    }
-
-    private double totalProbablility() {
-        double total = notRecordedProbability;
-        for (T item : pitems) {
-            total += item.probability;
-        }
-        return total;
-    }
-
-    /**
-     * Determines if an array of profiled items are sorted in descending order of their
-     * probabilities.
-     */
-    private boolean isSorted() {
-        for (int i = 1; i < pitems.length; i++) {
-            if (pitems[i - 1].getProbability() < pitems[i].getProbability()) {
-                return false;
-            }
-        }
-        return true;
-    }
-
-    /**
-     * Returns the estimated probability of all types that could not be recorded due to profiling
-     * limitations.
-     *
-     * @return double value &ge; 0.0 and &le; 1.0
-     */
-    public double getNotRecordedProbability() {
-        return notRecordedProbability;
-    }
-
-    protected T[] getItems() {
-        return pitems;
-    }
-
-    /**
-     * Searches for an entry of a given resolved Java type.
-     *
-     * @param type the type for which an entry should be searched
-     * @return the entry or null if no entry for this type can be found
-     */
-    public T findEntry(ResolvedJavaType type) {
-        if (pitems != null) {
-            for (T pt : pitems) {
-                if (pt.getItem().equals(type)) {
-                    return pt;
-                }
-            }
-        }
-        return null;
-    }
-
-    @Override
-    public String toString() {
-        StringBuilder builder = new StringBuilder();
-        builder.append(this.getClass().getName());
-        builder.append("[");
-        if (pitems != null) {
-            for (T pt : pitems) {
-                builder.append(pt.toString());
-                builder.append(", ");
-            }
-        }
-        builder.append(this.notRecordedProbability);
-        builder.append("]");
-        return builder.toString();
-    }
-
-    public boolean isIncluded(U item) {
-        if (this.getNotRecordedProbability() > 0.0) {
-            return true;
-        } else {
-            for (int i = 0; i < getItems().length; i++) {
-                T pitem = getItems()[i];
-                U curType = pitem.getItem();
-                if (curType == item) {
-                    return true;
-                }
-            }
-        }
-        return false;
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (obj == this) {
-            return true;
-        }
-        if (!(obj instanceof AbstractJavaProfile)) {
-            return false;
-        }
-        AbstractJavaProfile<?, ?> that = (AbstractJavaProfile<?, ?>) obj;
-        if (that.notRecordedProbability != notRecordedProbability) {
-            return false;
-        }
-        if (that.pitems.length != pitems.length) {
-            return false;
-        }
-        for (int i = 0; i < pitems.length; ++i) {
-            if (!pitems[i].equals(that.pitems[i])) {
-                return false;
-            }
-        }
-        return true;
-    }
-
-    @Override
-    public int hashCode() {
-        return (int) Double.doubleToLongBits(notRecordedProbability) + pitems.length * 13;
-    }
-}
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/AbstractProfiledItem.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,95 +0,0 @@
-/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.api.meta;
-
-/**
- * A profiled type that has a probability. Profiled types are naturally sorted in descending order
- * of their probabilities.
- */
-public abstract class AbstractProfiledItem<T> implements Comparable<AbstractProfiledItem<?>> {
-
-    protected final T item;
-    protected final double probability;
-
-    public AbstractProfiledItem(T item, double probability) {
-        assert item != null;
-        assert probability >= 0.0D && probability <= 1.0D;
-        this.item = item;
-        this.probability = probability;
-    }
-
-    protected T getItem() {
-        return item;
-    }
-
-    /**
-     * Returns the estimated probability of {@link #getItem()}.
-     *
-     * @return double value &ge; 0.0 and &le; 1.0
-     */
-    public double getProbability() {
-        return probability;
-    }
-
-    @Override
-    public int compareTo(AbstractProfiledItem<?> o) {
-        if (getProbability() > o.getProbability()) {
-            return -1;
-        } else if (getProbability() < o.getProbability()) {
-            return 1;
-        }
-        return 0;
-    }
-
-    @Override
-    public int hashCode() {
-        final int prime = 31;
-        int result = 1;
-        long temp;
-        temp = Double.doubleToLongBits(probability);
-        result = prime * result + (int) (temp ^ (temp >>> 32));
-        result = prime * result + item.hashCode();
-        return result;
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj == null) {
-            return false;
-        }
-        if (getClass() != obj.getClass()) {
-            return false;
-        }
-        AbstractProfiledItem<?> other = (AbstractProfiledItem<?>) obj;
-        if (Double.doubleToLongBits(probability) != Double.doubleToLongBits(other.probability)) {
-            return false;
-        }
-        return item.equals(other.item);
-    }
-
-    @Override
-    public abstract String toString();
-}
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/AbstractValue.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,99 +0,0 @@
-/*
- * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.api.meta;
-
-/**
- * Abstract base class for values.
- */
-public abstract class AbstractValue implements Value, KindProvider {
-
-    public static final AllocatableValue ILLEGAL = Value.ILLEGAL;
-
-    private final Kind kind;
-    private final LIRKind lirKind;
-
-    /**
-     * Initializes a new value of the specified kind.
-     *
-     * @param lirKind the kind
-     */
-    protected AbstractValue(LIRKind lirKind) {
-        this.lirKind = lirKind;
-        if (getPlatformKind() instanceof Kind) {
-            this.kind = (Kind) getPlatformKind();
-        } else {
-            this.kind = Kind.Illegal;
-        }
-    }
-
-    /**
-     * Returns a String representation of the kind, which should be the end of all
-     * {@link #toString()} implementation of subclasses.
-     */
-    protected final String getKindSuffix() {
-        return "|" + getKind().getTypeChar();
-    }
-
-    /**
-     * Returns the kind of this value.
-     */
-    public final Kind getKind() {
-        return kind;
-    }
-
-    public final LIRKind getLIRKind() {
-        return lirKind;
-    }
-
-    /**
-     * Returns the platform specific kind used to store this value.
-     */
-    public final PlatformKind getPlatformKind() {
-        return lirKind.getPlatformKind();
-    }
-
-    @Override
-    public int hashCode() {
-        return 41 + lirKind.hashCode();
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (obj instanceof AbstractValue) {
-            AbstractValue that = (AbstractValue) obj;
-            return kind.equals(that.kind) && lirKind.equals(that.lirKind);
-        }
-        return false;
-    }
-
-    /**
-     * Checks if this value is identical to {@code other}.
-     *
-     * Warning: Use with caution! Usually equivalence {@link #equals(Object)} is sufficient and
-     * should be used.
-     */
-    @ExcludeFromIdentityComparisonVerification
-    public final boolean identityEquals(AbstractValue other) {
-        return this == other;
-    }
-}
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/AllocatableValue.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.api.meta;
-
-/**
- * Common base class for values that are stored in some location that's managed by the register
- * allocator (e.g. register, stack slot).
- */
-public abstract class AllocatableValue extends AbstractValue implements JavaValue, KindProvider {
-
-    public static final AllocatableValue[] NONE = {};
-
-    public AllocatableValue(LIRKind lirKind) {
-        super(lirKind);
-    }
-}
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Assumptions.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,380 +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.graal.api.meta;
-
-import java.lang.invoke.*;
-import java.util.*;
-
-/**
- * Class for recording assumptions made during compilation.
- */
-public final class Assumptions implements Iterable<Assumptions.Assumption> {
-
-    /**
-     * Abstract base class for assumptions. An assumption assumes a property of the runtime that may
-     * be invalidated by subsequent execution (e.g., that a class has no subclasses implementing
-     * {@link NoFinalizableSubclass Object.finalize()}).
-     */
-    public abstract static class Assumption {
-    }
-
-    /**
-     * A class for providing information that is only valid in association with a set of
-     * {@link Assumption}s.
-     *
-     * @param <T>
-     */
-    public static class AssumptionResult<T> {
-        Assumption[] assumptions;
-        final T result;
-
-        private static final Assumption[] EMPTY = new Assumption[0];
-
-        public AssumptionResult(T result, Assumption... assumptions) {
-            this.result = result;
-            this.assumptions = assumptions;
-        }
-
-        public AssumptionResult(T result) {
-            this(result, EMPTY);
-        }
-
-        public T getResult() {
-            return result;
-        }
-
-        public boolean isAssumptionFree() {
-            return assumptions.length == 0;
-        }
-
-        public void add(AssumptionResult<T> other) {
-            Assumption[] newAssumptions = Arrays.copyOf(this.assumptions, this.assumptions.length + other.assumptions.length);
-            System.arraycopy(other.assumptions, 0, newAssumptions, this.assumptions.length, other.assumptions.length);
-            this.assumptions = newAssumptions;
-        }
-    }
-
-    /**
-     * An assumption that a given class has no subclasses implementing {@link Object#finalize()}).
-     */
-    public static final class NoFinalizableSubclass extends Assumption {
-
-        private ResolvedJavaType receiverType;
-
-        public NoFinalizableSubclass(ResolvedJavaType receiverType) {
-            this.receiverType = receiverType;
-        }
-
-        @Override
-        public int hashCode() {
-            return 31 + receiverType.hashCode();
-        }
-
-        @Override
-        public boolean equals(Object obj) {
-            if (obj instanceof NoFinalizableSubclass) {
-                NoFinalizableSubclass other = (NoFinalizableSubclass) obj;
-                return other.receiverType.equals(receiverType);
-            }
-            return false;
-        }
-
-        @Override
-        public String toString() {
-            return "NoFinalizableSubclass[receiverType=" + receiverType.toJavaName() + "]";
-        }
-
-    }
-
-    /**
-     * An assumption that a given abstract or interface type has one direct concrete subtype. There
-     * is no requirement that the subtype is a leaf type.
-     */
-    public static final class ConcreteSubtype extends Assumption {
-
-        /**
-         * Type the assumption is made about.
-         */
-        public final ResolvedJavaType context;
-
-        /**
-         * Assumed concrete sub-type of the context type.
-         */
-        public final ResolvedJavaType subtype;
-
-        public ConcreteSubtype(ResolvedJavaType context, ResolvedJavaType subtype) {
-            this.context = context;
-            this.subtype = subtype;
-            assert context.isAbstract();
-            assert subtype.isConcrete() || context.isInterface() : subtype.toString() + " : " + context.toString();
-            assert !subtype.isArray() || subtype.getElementalType().isFinal() : subtype.toString() + " : " + context.toString();
-        }
-
-        @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.equals(context) && other.subtype.equals(subtype);
-            }
-            return false;
-        }
-
-        @Override
-        public String toString() {
-            return "ConcreteSubtype[context=" + context.toJavaName() + ", subtype=" + subtype.toJavaName() + "]";
-        }
-    }
-
-    /**
-     * An assumption that a given type has no subtypes.
-     */
-    public static final class LeafType extends Assumption {
-
-        /**
-         * Type the assumption is made about.
-         */
-        public final ResolvedJavaType context;
-
-        public LeafType(ResolvedJavaType context) {
-            this.context = context;
-        }
-
-        @Override
-        public int hashCode() {
-            final int prime = 31;
-            int result = 1;
-            result = prime * result + context.hashCode();
-            return result;
-        }
-
-        @Override
-        public boolean equals(Object obj) {
-            if (obj instanceof LeafType) {
-                LeafType other = (LeafType) obj;
-                return other.context.equals(context);
-            }
-            return false;
-        }
-
-        @Override
-        public String toString() {
-            return "LeafSubtype[context=" + context.toJavaName() + "]";
-        }
-    }
-
-    /**
-     * An assumption that a given virtual method has a given unique implementation.
-     */
-    public static final class ConcreteMethod extends Assumption {
-
-        /**
-         * A virtual (or interface) method whose unique implementation for the receiver type in
-         * {@link #context} is {@link #impl}.
-         */
-        public final ResolvedJavaMethod method;
-
-        /**
-         * A receiver type.
-         */
-        public final ResolvedJavaType context;
-
-        /**
-         * The unique implementation of {@link #method} for {@link #context}.
-         */
-        public final ResolvedJavaMethod impl;
-
-        public ConcreteMethod(ResolvedJavaMethod method, ResolvedJavaType context, ResolvedJavaMethod 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.equals(method) && other.context.equals(context) && other.impl.equals(impl);
-            }
-            return false;
-        }
-
-        @Override
-        public String toString() {
-            return "ConcreteMethod[method=" + method.format("%H.%n(%p)%r") + ", context=" + context.toJavaName() + ", impl=" + impl.format("%H.%n(%p)%r") + "]";
-        }
-    }
-
-    /**
-     * An assumption that a given call site's method handle did not change.
-     */
-    public static final class CallSiteTargetValue extends Assumption {
-
-        public final CallSite callSite;
-        public final MethodHandle methodHandle;
-
-        public CallSiteTargetValue(CallSite callSite, MethodHandle methodHandle) {
-            this.callSite = callSite;
-            this.methodHandle = methodHandle;
-        }
-
-        @Override
-        public int hashCode() {
-            final int prime = 31;
-            int result = 1;
-            result = prime * result + callSite.hashCode();
-            result = prime * result + methodHandle.hashCode();
-            return result;
-        }
-
-        @Override
-        public boolean equals(Object obj) {
-            if (obj instanceof CallSiteTargetValue) {
-                CallSiteTargetValue other = (CallSiteTargetValue) obj;
-                return callSite.equals(other.callSite) && methodHandle.equals(other.methodHandle);
-            }
-            return false;
-        }
-
-        @Override
-        public String toString() {
-            return "CallSiteTargetValue[callSite=" + callSite + ", methodHandle=" + methodHandle + "]";
-        }
-    }
-
-    private final Set<Assumption> assumptions = new HashSet<>();
-
-    /**
-     * 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 assumptions.isEmpty();
-    }
-
-    @Override
-    public int hashCode() {
-        throw new UnsupportedOperationException("hashCode");
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj instanceof Assumptions) {
-            Assumptions that = (Assumptions) obj;
-            if (!this.assumptions.equals(that.assumptions)) {
-                return false;
-            }
-            return true;
-        }
-        return false;
-    }
-
-    @Override
-    public Iterator<Assumption> iterator() {
-        return assumptions.iterator();
-    }
-
-    /**
-     * Records an assumption that the specified type has no finalizable subclasses.
-     *
-     * @param receiverType the type that is assumed to have no finalizable subclasses
-     */
-    public void recordNoFinalizableSubclassAssumption(ResolvedJavaType receiverType) {
-        record(new NoFinalizableSubclass(receiverType));
-    }
-
-    /**
-     * 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(ResolvedJavaType context, ResolvedJavaType 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(ResolvedJavaMethod method, ResolvedJavaType context, ResolvedJavaMethod impl) {
-        record(new ConcreteMethod(method, context, impl));
-    }
-
-    public void record(AssumptionResult<?> result) {
-        for (Assumption assumption : result.assumptions) {
-            record(assumption);
-        }
-    }
-
-    public void record(Assumption assumption) {
-        assumptions.add(assumption);
-    }
-
-    /**
-     * Gets a copy of the assumptions recorded in this object as an array.
-     */
-    public Assumption[] toArray() {
-        return assumptions.toArray(new Assumption[assumptions.size()]);
-    }
-
-    /**
-     * Copies assumptions recorded by another {@link Assumptions} object into this object.
-     */
-    public void record(Assumptions other) {
-        assert other != this;
-        assumptions.addAll(other.assumptions);
-    }
-
-    @Override
-    public String toString() {
-        return "Assumptions[" + assumptions + "]";
-    }
-}
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/BytecodeDisassemblerProvider.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.api.meta;
-
-/**
- * Interface for disassembling bytecode.
- */
-public interface BytecodeDisassemblerProvider {
-
-    /**
-     * Gets a textual disassembly of the bytecode for a given method. In the absence of bytecode
-     * rewriting, disassembling a method will produce the same result.
-     *
-     * @return a non-zero length string containing a disassembly of {@code method}'s bytecode or
-     *         null if {@code method} has no bytecode (i.e., {@code method.getCodeSize() == 0})
-     */
-    String disassemble(ResolvedJavaMethod method);
-}
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Constant.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.api.meta;
-
-/**
- * Represents a compile-time constant (boxed) value within the compiler.
- */
-public interface Constant {
-
-    boolean isDefaultForKind();
-
-    String toValueString();
-}
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ConstantPool.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,121 +0,0 @@
-/*
- * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.api.meta;
-
-/**
- * Represents the runtime representation of the constant pool that is used by the compiler when
- * parsing bytecode. Provides methods to look up a constant pool entry without performing
- * resolution. They are used during compilation.
- */
-public interface ConstantPool {
-
-    /**
-     * Returns the number of entries the constant pool.
-     *
-     * @return number of entries in the constant pool
-     */
-    int length();
-
-    /**
-     * Ensures that the type referenced by the specified constant pool entry is loaded and
-     * initialized. This can be used to compile time resolve a type. It works for field, method, or
-     * type constant pool entries.
-     *
-     * @param cpi the index of the constant pool entry that references the type
-     * @param opcode the opcode of the instruction that references the type
-     */
-    void loadReferencedType(int cpi, int opcode);
-
-    /**
-     * Looks up a reference to a field. If {@code opcode} is non-negative, then resolution checks
-     * specific to the bytecode it denotes are performed if the field is already resolved. Should
-     * any of these checks fail, an unresolved field reference is returned.
-     *
-     * @param cpi the constant pool index
-     * @param opcode the opcode of the instruction for which the lookup is being performed or
-     *            {@code -1}
-     * @return a reference to the field at {@code cpi} in this pool
-     * @throws ClassFormatError if the entry at {@code cpi} is not a field
-     */
-    JavaField lookupField(int cpi, int opcode);
-
-    /**
-     * Looks up a reference to a method. If {@code opcode} is non-negative, then resolution checks
-     * specific to the bytecode it denotes are performed if the method is already resolved. Should
-     * any of these checks fail, an unresolved method reference is returned.
-     *
-     * @param cpi the constant pool index
-     * @param opcode the opcode of the instruction for which the lookup is being performed or
-     *            {@code -1}
-     * @return a reference to the method at {@code cpi} in this pool
-     * @throws ClassFormatError if the entry at {@code cpi} is not a method
-     */
-    JavaMethod lookupMethod(int cpi, int opcode);
-
-    /**
-     * Looks up a reference to a type. If {@code opcode} is non-negative, then resolution checks
-     * specific to the bytecode it denotes are performed if the type is already resolved. Should any
-     * of these checks fail, an unresolved type reference is returned.
-     *
-     * @param cpi the constant pool index
-     * @param opcode the opcode of the instruction for which the lookup is being performed or
-     *            {@code -1}
-     * @return a reference to the compiler interface type
-     */
-    JavaType lookupType(int cpi, int opcode);
-
-    /**
-     * Looks up an Utf8 string.
-     *
-     * @param cpi the constant pool index
-     * @return the Utf8 string at index {@code cpi} in this constant pool
-     */
-    String lookupUtf8(int cpi);
-
-    /**
-     * Looks up a method signature.
-     *
-     * @param cpi the constant pool index
-     * @return the method signature at index {@code cpi} in this constant pool
-     */
-    Signature lookupSignature(int cpi);
-
-    /**
-     * Looks up a constant at the specified index.
-     *
-     * @param cpi the constant pool index
-     * @return the {@code Constant} or {@code JavaType} instance representing the constant pool
-     *         entry
-     */
-    Object lookupConstant(int cpi);
-
-    /**
-     * Looks up the appendix at the specified index.
-     *
-     * @param cpi the constant pool index
-     * @param opcode the opcode of the instruction for which the lookup is being performed or
-     *            {@code -1}
-     * @return the appendix if it exists and is resolved or {@code null}
-     */
-    JavaConstant lookupAppendix(int cpi, int opcode);
-}
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ConstantReflectionProvider.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,152 +0,0 @@
-/*
- * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.api.meta;
-
-import java.lang.invoke.*;
-
-/**
- * Reflection operations on values represented as {@linkplain JavaConstant constants}. All methods
- * in this interface require the VM to access the actual object encapsulated in {@link Kind#Object
- * object} constants. This access is not always possible, depending on kind of VM and the state that
- * the VM is in. Therefore, all methods can return {@code null} at any time, to indicate that the
- * result is not available at this point. The caller is responsible to check for {@code null}
- * results and handle them properly, e.g., not perform an optimization.
- */
-public interface ConstantReflectionProvider {
-
-    /**
-     * Compares two constants for equality. The equality relationship is symmetric. Returns
-     * {@link Boolean#TRUE true} if the two constants represent the same run time value,
-     * {@link Boolean#FALSE false} if they are different. Returns {@code null} if the constants
-     * cannot be compared at this point.
-     */
-    Boolean constantEquals(Constant x, Constant y);
-
-    /**
-     * Returns the length of the array constant. Returns {@code null} if the constant is not an
-     * array, or if the array length is not available at this point.
-     */
-    Integer readArrayLength(JavaConstant array);
-
-    /**
-     * Reads a value from the given array at the given index. Returns {@code null} if the constant
-     * is not an array, if the index is out of bounds, or if the value is not available at this
-     * point.
-     */
-    JavaConstant readArrayElement(JavaConstant array, int index);
-
-    /**
-     * Reads a value from the given array at the given index if it is a stable array. Returns
-     * {@code null} if the constant is not a stable array, if it is a default value, if the index is
-     * out of bounds, or if the value is not available at this point.
-     */
-    JavaConstant readConstantArrayElement(JavaConstant array, int index);
-
-    /**
-     * Reads a value from the given array at the given offset if it is a stable array. The offset
-     * will decoded relative to the platform addressing into an index into the array. Returns
-     * {@code null} if the constant is not a stable array, if it is a default value, if the offset
-     * is out of bounds, or if the value is not available at this point.
-     */
-    JavaConstant readConstantArrayElementForOffset(JavaConstant array, long offset);
-
-    /**
-     * Gets the constant value of this field. Note that a {@code static final} field may not be
-     * considered constant if its declaring class is not yet initialized or if it is a well known
-     * field that can be updated via other means (e.g., {@link System#setOut(java.io.PrintStream)}).
-     *
-     * @param receiver object from which this field's value is to be read. This value is ignored if
-     *            this field is static.
-     * @return the constant value of this field or {@code null} if this field is not considered
-     *         constant by the runtime
-     */
-    JavaConstant readConstantFieldValue(JavaField field, JavaConstant receiver);
-
-    /**
-     * Gets the current value of this field for a given object, if available.
-     *
-     * There is no guarantee that the same value will be returned by this method for a field unless
-     * the field is considered to be {@linkplain #readConstantFieldValue(JavaField, JavaConstant)
-     * constant} by the runtime.
-     *
-     * @param receiver object from which this field's value is to be read. This value is ignored if
-     *            this field is static.
-     * @return the value of this field or {@code null} if the value is not available (e.g., because
-     *         the field holder is not yet initialized).
-     */
-    JavaConstant readFieldValue(JavaField field, JavaConstant receiver);
-
-    /**
-     * Gets the current value of this field for a given object, if available. Like
-     * {@link #readFieldValue(JavaField, JavaConstant)} but treats array fields as stable.
-     *
-     * There is no guarantee that the same value will be returned by this method for a field unless
-     * the field is considered to be {@linkplain #readConstantFieldValue(JavaField, JavaConstant)
-     * constant} by the runtime.
-     *
-     * @param receiver object from which this field's value is to be read. This value is ignored if
-     *            this field is static.
-     * @param isDefaultStable if {@code true}, default values are considered stable
-     * @return the value of this field or {@code null} if the value is not available (e.g., because
-     *         the field holder is not yet initialized).
-     */
-    JavaConstant readStableFieldValue(JavaField field, JavaConstant receiver, boolean isDefaultStable);
-
-    /**
-     * Converts the given {@link Kind#isPrimitive() primitive} constant to a boxed
-     * {@link Kind#Object object} constant, according to the Java boxing rules. Returns {@code null}
-     * if the source is is not a primitive constant, or the boxed value is not available at this
-     * point.
-     */
-    JavaConstant boxPrimitive(JavaConstant source);
-
-    /**
-     * Converts the given {@link Kind#Object object} constant to a {@link Kind#isPrimitive()
-     * primitive} constant, according to the Java unboxing rules. Returns {@code null} if the source
-     * is is not an object constant that can be unboxed, or the unboxed value is not available at
-     * this point.
-     */
-    JavaConstant unboxPrimitive(JavaConstant source);
-
-    /**
-     * Gets a string as a {@link JavaConstant}.
-     */
-    JavaConstant forString(String value);
-
-    /**
-     * Returns the {@link ResolvedJavaType} for a {@link Class} object (or any other object regarded
-     * as a class by the VM) encapsulated in the given constant. Returns {@code null} if the
-     * constant does not encapsulate a class, or if the type is not available at this point.
-     */
-    ResolvedJavaType asJavaType(Constant constant);
-
-    /**
-     * Gets access to the internals of {@link MethodHandle}.
-     */
-    MethodHandleAccessProvider getMethodHandleAccess();
-
-    /**
-     * Gets raw memory access.
-     */
-    MemoryAccessProvider getMemoryAccessProvider();
-}
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/DefaultProfilingInfo.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,110 +0,0 @@
-/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.api.meta;
-
-/**
- * An implementation of {@link ProfilingInfo} that can used in the absence of real profile
- * information.
- */
-public final class DefaultProfilingInfo implements ProfilingInfo {
-
-    private static final ProfilingInfo[] NO_PROFILING_INFO = new ProfilingInfo[]{new DefaultProfilingInfo(TriState.TRUE), new DefaultProfilingInfo(TriState.FALSE),
-                    new DefaultProfilingInfo(TriState.UNKNOWN)};
-
-    private final TriState exceptionSeen;
-
-    DefaultProfilingInfo(TriState exceptionSeen) {
-        this.exceptionSeen = exceptionSeen;
-    }
-
-    @Override
-    public int getCodeSize() {
-        return 0;
-    }
-
-    @Override
-    public JavaTypeProfile getTypeProfile(int bci) {
-        return null;
-    }
-
-    @Override
-    public JavaMethodProfile getMethodProfile(int bci) {
-        return null;
-    }
-
-    @Override
-    public double getBranchTakenProbability(int bci) {
-        return -1;
-    }
-
-    @Override
-    public double[] getSwitchProbabilities(int bci) {
-        return null;
-    }
-
-    @Override
-    public TriState getExceptionSeen(int bci) {
-        return exceptionSeen;
-    }
-
-    @Override
-    public TriState getNullSeen(int bci) {
-        return TriState.UNKNOWN;
-    }
-
-    @Override
-    public int getExecutionCount(int bci) {
-        return -1;
-    }
-
-    public static ProfilingInfo get(TriState exceptionSeen) {
-        return NO_PROFILING_INFO[exceptionSeen.ordinal()];
-    }
-
-    @Override
-    public int getDeoptimizationCount(DeoptimizationReason reason) {
-        return 0;
-    }
-
-    @Override
-    public boolean isMature() {
-        return false;
-    }
-
-    @Override
-    public String toString() {
-        return "BaseProfilingInfo<" + this.toString(null, "; ") + ">";
-    }
-
-    public void setMature() {
-        // Do nothing
-    }
-
-    public boolean setCompilerIRSize(Class<?> irType, int nodeCount) {
-        return false;
-    }
-
-    public int getCompilerIRSize(Class<?> irType) {
-        return -1;
-    }
-}
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/DeoptimizationAction.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
-/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.api.meta;
-
-/**
- * Specifies the action that should be taken by the runtime in case a certain deoptimization is
- * triggered.
- */
-public enum DeoptimizationAction {
-    /**
-     * Do not invalidate the machine code. This is typically used when deoptimizing at a point where
-     * it's highly likely nothing will change the likelihood of the deoptimization happening again.
-     * For example, a compiled array allocation where the size is negative.
-     */
-    None(false),
-
-    /**
-     * Do not invalidate the machine code, but schedule a recompilation if this deoptimization is
-     * triggered too often.
-     */
-    RecompileIfTooManyDeopts(true),
-
-    /**
-     * Invalidate the machine code and reset the profiling information.
-     */
-    InvalidateReprofile(true),
-
-    /**
-     * Invalidate the machine code and immediately schedule a recompilation. This is typically used
-     * when deoptimizing to resolve an unresolved symbol in which case extra profiling is not
-     * required to determine that the deoptimization will not re-occur.
-     */
-    InvalidateRecompile(true),
-
-    /**
-     * Invalidate the machine code and stop compiling the outermost method of this compilation.
-     */
-    InvalidateStopCompiling(true);
-
-    private final boolean invalidatesCompilation;
-
-    private DeoptimizationAction(boolean invalidatesCompilation) {
-        this.invalidatesCompilation = invalidatesCompilation;
-    }
-
-    public boolean doesInvalidateCompilation() {
-        return invalidatesCompilation;
-    }
-
-}
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/DeoptimizationReason.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +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.graal.api.meta;
-
-/**
- * Enumeration of reasons for why a deoptimization is happening.
- */
-public enum DeoptimizationReason {
-    None,
-    NullCheckException,
-    BoundsCheckException,
-    ClassCastException,
-    ArrayStoreException,
-    UnreachedCode,
-    TypeCheckedInliningViolated,
-    OptimizedTypeCheckViolated,
-    NotCompiledExceptionHandler,
-    Unresolved,
-    JavaSubroutineMismatch,
-    ArithmeticException,
-    RuntimeConstraint,
-    LoopLimitCheck,
-    Aliasing,
-    TransferToInterpreter,
-}
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ExceptionHandler.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,121 +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.graal.api.meta;
-
-import java.util.*;
-
-/**
- * Represents an exception handler within the bytecodes.
- */
-public final class ExceptionHandler {
-
-    private final int startBCI;
-    private final int endBCI;
-    private final int handlerBCI;
-    private final int catchTypeCPI;
-    private final JavaType 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 ExceptionHandler(int startBCI, int endBCI, int catchBCI, int catchTypeCPI, JavaType catchType) {
-        this.startBCI = startBCI;
-        this.endBCI = endBCI;
-        this.handlerBCI = catchBCI;
-        this.catchTypeCPI = catchTypeCPI;
-        this.catchType = catchType;
-    }
-
-    /**
-     * Returns the start bytecode index of the protected range of this handler.
-     */
-    public int getStartBCI() {
-        return startBCI;
-    }
-
-    /**
-     * Returns the end bytecode index of the protected range of this handler.
-     */
-    public int getEndBCI() {
-        return endBCI;
-    }
-
-    /**
-     * Returns the bytecode index of the handler block of this handler.
-     */
-    public int getHandlerBCI() {
-        return handlerBCI;
-    }
-
-    /**
-     * Returns the index into the constant pool representing the type of exception caught by this
-     * handler.
-     */
-    public int catchTypeCPI() {
-        return catchTypeCPI;
-    }
-
-    /**
-     * Checks whether this handler catches all exceptions.
-     *
-     * @return {@code true} if this handler catches all exceptions
-     */
-    public boolean isCatchAll() {
-        return catchTypeCPI == 0;
-    }
-
-    /**
-     * Returns the type of exception caught by this exception handler.
-     */
-    public JavaType getCatchType() {
-        return catchType;
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (!(obj instanceof ExceptionHandler)) {
-            return false;
-        }
-        ExceptionHandler that = (ExceptionHandler) obj;
-        if (this.startBCI != that.startBCI || this.endBCI != that.endBCI || this.handlerBCI != that.handlerBCI || this.catchTypeCPI != that.catchTypeCPI) {
-            return false;
-        }
-        return Objects.equals(this.catchType, that.catchType);
-    }
-
-    @Override
-    public String toString() {
-        return "ExceptionHandler<startBCI=" + startBCI + ", endBCI=" + endBCI + ", handlerBCI=" + handlerBCI + ", catchTypeCPI=" + catchTypeCPI + ", catchType=" + catchType + ">";
-    }
-
-    @Override
-    public int hashCode() {
-        return catchTypeCPI ^ endBCI ^ handlerBCI;
-    }
-}
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ExcludeFromIdentityComparisonVerification.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.api.meta;
-
-import java.lang.annotation.*;
-
-/**
- * This annotation denotes methods which are allowed to use identity checks (==/!=) on restricted
- * types.
- *
- * @see CheckGraalInvariants
- */
-@SuppressWarnings("javadoc")
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.METHOD)
-public @interface ExcludeFromIdentityComparisonVerification {
-
-}
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ForeignCallDescriptor.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,98 +0,0 @@
-/*
- * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.api.meta;
-
-import java.util.*;
-
-/**
- * The name and signature of a foreign call. A foreign call differs from a normal compiled Java call
- * in at least one of these aspects:
- * <ul>
- * <li>The call is to C/C++/assembler code.</li>
- * <li>The call uses different conventions for passing parameters or returning values.</li>
- * <li>The callee has different register saving semantics. For example, the callee may save all
- * registers (apart from some specified temporaries) in which case the register allocator doesn't
- * not need to spill all live registers around the call site.</li>
- * <li>The call does not occur at an INVOKE* bytecode. Such a call could be transformed into a
- * standard Java call if the foreign routine is a normal Java method and the runtime supports
- * linking Java calls at arbitrary bytecodes.</li>
- * </ul>
- */
-public class ForeignCallDescriptor {
-
-    private final String name;
-    private final Class<?> resultType;
-    private final Class<?>[] argumentTypes;
-
-    public ForeignCallDescriptor(String name, Class<?> resultType, Class<?>... argumentTypes) {
-        this.name = name;
-        this.resultType = resultType;
-        this.argumentTypes = argumentTypes;
-    }
-
-    /**
-     * Gets the name of this foreign call.
-     */
-    public String getName() {
-        return name;
-    }
-
-    /**
-     * Gets the return type of this foreign call.
-     */
-    public Class<?> getResultType() {
-        return resultType;
-    }
-
-    /**
-     * Gets the argument types of this foreign call.
-     */
-    public Class<?>[] getArgumentTypes() {
-        return argumentTypes.clone();
-    }
-
-    @Override
-    public int hashCode() {
-        return name.hashCode();
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (obj instanceof ForeignCallDescriptor) {
-            ForeignCallDescriptor other = (ForeignCallDescriptor) obj;
-            return other.name.equals(name) && other.resultType.equals(resultType) && Arrays.equals(other.argumentTypes, argumentTypes);
-        }
-        return false;
-    }
-
-    @Override
-    public String toString() {
-        StringBuilder sb = new StringBuilder(name).append('(');
-        String sep = "";
-        for (Class<?> arg : argumentTypes) {
-            sb.append(sep).append(arg.getSimpleName());
-            sep = ",";
-        }
-        return sb.append(')').append(resultType.getSimpleName()).toString();
-    }
-}
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/InvokeTarget.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2013, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.api.meta;
-
-/**
- * Represents the resolved target of an invocation.
- */
-public interface InvokeTarget {
-}
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/JavaConstant.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,458 +0,0 @@
-/*
- * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.api.meta;
-
-/**
- * Represents a constant (boxed) value, such as an integer, floating point number, or object
- * reference, within the compiler and across the compiler/runtime interface. Exports a set of
- * {@code JavaConstant} instances that represent frequently used constant values, such as
- * {@link #NULL_POINTER}.
- */
-public interface JavaConstant extends Constant, JavaValue, Value {
-
-    /*
-     * Using a larger cache for integers leads to only a slight increase in cache hit ratio which is
-     * not enough to justify the impact on startup time.
-     */
-    JavaConstant NULL_POINTER = new NullConstant();
-    PrimitiveConstant INT_MINUS_1 = new PrimitiveConstant(Kind.Int, -1);
-    PrimitiveConstant INT_0 = new PrimitiveConstant(Kind.Int, 0);
-    PrimitiveConstant INT_1 = new PrimitiveConstant(Kind.Int, 1);
-    PrimitiveConstant INT_2 = new PrimitiveConstant(Kind.Int, 2);
-    PrimitiveConstant LONG_0 = new PrimitiveConstant(Kind.Long, 0L);
-    PrimitiveConstant LONG_1 = new PrimitiveConstant(Kind.Long, 1L);
-    PrimitiveConstant FLOAT_0 = new PrimitiveConstant(Kind.Float, Float.floatToRawIntBits(0.0F));
-    PrimitiveConstant FLOAT_1 = new PrimitiveConstant(Kind.Float, Float.floatToRawIntBits(1.0F));
-    PrimitiveConstant DOUBLE_0 = new PrimitiveConstant(Kind.Double, Double.doubleToRawLongBits(0.0D));
-    PrimitiveConstant DOUBLE_1 = new PrimitiveConstant(Kind.Double, Double.doubleToRawLongBits(1.0D));
-    PrimitiveConstant TRUE = new PrimitiveConstant(Kind.Boolean, 1L);
-    PrimitiveConstant FALSE = new PrimitiveConstant(Kind.Boolean, 0L);
-
-    /**
-     * Checks whether this constant is null.
-     *
-     * @return {@code true} if this constant is the null constant
-     */
-    boolean isNull();
-
-    static boolean isNull(Constant c) {
-        if (c instanceof JavaConstant) {
-            return ((JavaConstant) c).isNull();
-        } else {
-            return false;
-        }
-    }
-
-    /**
-     * Checks whether this constant is non-null.
-     *
-     * @return {@code true} if this constant is a primitive, or an object constant that is not null
-     */
-    default boolean isNonNull() {
-        return !isNull();
-    }
-
-    /**
-     * Checks whether this constant is the default value for its kind (null, 0, 0.0, false).
-     *
-     * @return {@code true} if this constant is the default value for its kind
-     */
-    boolean isDefaultForKind();
-
-    /**
-     * Returns the value of this constant as a boxed Java value.
-     *
-     * @return the value of this constant
-     */
-    Object asBoxedPrimitive();
-
-    /**
-     * Returns the primitive int value this constant represents. The constant must have a
-     * {@link Kind#getStackKind()} of {@link Kind#Int}.
-     *
-     * @return the constant value
-     */
-    int asInt();
-
-    /**
-     * Returns the primitive boolean value this constant represents. The constant must have kind
-     * {@link Kind#Boolean}.
-     *
-     * @return the constant value
-     */
-    boolean asBoolean();
-
-    /**
-     * Returns the primitive long value this constant represents. The constant must have kind
-     * {@link Kind#Long}, a {@link Kind#getStackKind()} of {@link Kind#Int}.
-     *
-     * @return the constant value
-     */
-    long asLong();
-
-    /**
-     * Returns the primitive float value this constant represents. The constant must have kind
-     * {@link Kind#Float}.
-     *
-     * @return the constant value
-     */
-    float asFloat();
-
-    /**
-     * Returns the primitive double value this constant represents. The constant must have kind
-     * {@link Kind#Double}.
-     *
-     * @return the constant value
-     */
-    double asDouble();
-
-    default String toValueString() {
-        if (getKind() == Kind.Illegal) {
-            return "illegal";
-        } else {
-            return getKind().format(asBoxedPrimitive());
-        }
-    }
-
-    static String toString(JavaConstant constant) {
-        if (constant.getKind() == Kind.Illegal) {
-            return "illegal";
-        } else {
-            return constant.getKind().getJavaName() + "[" + constant.toValueString() + "]";
-        }
-    }
-
-    /**
-     * Creates a boxed double constant.
-     *
-     * @param d the double value to box
-     * @return a boxed copy of {@code value}
-     */
-    static PrimitiveConstant forDouble(double d) {
-        if (Double.compare(0.0D, d) == 0) {
-            return DOUBLE_0;
-        }
-        if (Double.compare(d, 1.0D) == 0) {
-            return DOUBLE_1;
-        }
-        return new PrimitiveConstant(Kind.Double, Double.doubleToRawLongBits(d));
-    }
-
-    /**
-     * Creates a boxed float constant.
-     *
-     * @param f the float value to box
-     * @return a boxed copy of {@code value}
-     */
-    static PrimitiveConstant forFloat(float f) {
-        if (Float.compare(f, 0.0F) == 0) {
-            return FLOAT_0;
-        }
-        if (Float.compare(f, 1.0F) == 0) {
-            return FLOAT_1;
-        }
-        return new PrimitiveConstant(Kind.Float, Float.floatToRawIntBits(f));
-    }
-
-    /**
-     * Creates a boxed long constant.
-     *
-     * @param i the long value to box
-     * @return a boxed copy of {@code value}
-     */
-    static PrimitiveConstant forLong(long i) {
-        if (i == 0) {
-            return LONG_0;
-        } else if (i == 1) {
-            return LONG_1;
-        } else {
-            return new PrimitiveConstant(Kind.Long, i);
-        }
-    }
-
-    /**
-     * Creates a boxed integer constant.
-     *
-     * @param i the integer value to box
-     * @return a boxed copy of {@code value}
-     */
-    static PrimitiveConstant forInt(int i) {
-        switch (i) {
-            case -1:
-                return INT_MINUS_1;
-            case 0:
-                return INT_0;
-            case 1:
-                return INT_1;
-            case 2:
-                return INT_2;
-            default:
-                return new PrimitiveConstant(Kind.Int, i);
-        }
-    }
-
-    /**
-     * Creates a boxed byte constant.
-     *
-     * @param i the byte value to box
-     * @return a boxed copy of {@code value}
-     */
-    static PrimitiveConstant forByte(byte i) {
-        return new PrimitiveConstant(Kind.Byte, i);
-    }
-
-    /**
-     * Creates a boxed boolean constant.
-     *
-     * @param i the boolean value to box
-     * @return a boxed copy of {@code value}
-     */
-    static PrimitiveConstant forBoolean(boolean i) {
-        return i ? TRUE : FALSE;
-    }
-
-    /**
-     * Creates a boxed char constant.
-     *
-     * @param i the char value to box
-     * @return a boxed copy of {@code value}
-     */
-    static PrimitiveConstant forChar(char i) {
-        return new PrimitiveConstant(Kind.Char, i);
-    }
-
-    /**
-     * Creates a boxed short constant.
-     *
-     * @param i the short value to box
-     * @return a boxed copy of {@code value}
-     */
-    static PrimitiveConstant forShort(short i) {
-        return new PrimitiveConstant(Kind.Short, i);
-    }
-
-    /**
-     * Creates a {@link JavaConstant} from a primitive integer of a certain kind.
-     */
-    static PrimitiveConstant forIntegerKind(Kind kind, long i) {
-        switch (kind) {
-            case Boolean:
-                return forBoolean(i != 0);
-            case Byte:
-                return forByte((byte) i);
-            case Short:
-                return forShort((short) i);
-            case Char:
-                return forChar((char) i);
-            case Int:
-                return forInt((int) i);
-            case Long:
-                return forLong(i);
-            default:
-                throw new IllegalArgumentException("not an integer kind: " + kind);
-        }
-    }
-
-    /**
-     * Creates a {@link JavaConstant} from a primitive integer of a certain width.
-     */
-    static PrimitiveConstant forPrimitiveInt(int bits, long i) {
-        assert bits <= 64;
-        switch (bits) {
-            case 1:
-                return forBoolean(i != 0);
-            case 8:
-                return forByte((byte) i);
-            case 16:
-                return forShort((short) i);
-            case 32:
-                return forInt((int) i);
-            case 64:
-                return forLong(i);
-            default:
-                throw new IllegalArgumentException("unsupported integer width: " + bits);
-        }
-    }
-
-    /**
-     * Creates a boxed constant for the given boxed primitive value.
-     *
-     * @param value the Java boxed value
-     * @return the primitive constant holding the {@code value}
-     */
-    static PrimitiveConstant forBoxedPrimitive(Object value) {
-        if (value instanceof Boolean) {
-            return forBoolean((Boolean) value);
-        } else if (value instanceof Byte) {
-            return forByte((Byte) value);
-        } else if (value instanceof Character) {
-            return forChar((Character) value);
-        } else if (value instanceof Short) {
-            return forShort((Short) value);
-        } else if (value instanceof Integer) {
-            return forInt((Integer) value);
-        } else if (value instanceof Long) {
-            return forLong((Long) value);
-        } else if (value instanceof Float) {
-            return forFloat((Float) value);
-        } else if (value instanceof Double) {
-            return forDouble((Double) value);
-        } else {
-            return null;
-        }
-    }
-
-    static PrimitiveConstant forIllegal() {
-        return new PrimitiveConstant(Kind.Illegal, 0);
-    }
-
-    /**
-     * Returns a constant with the default value for the given kind.
-     */
-    static JavaConstant defaultForKind(Kind kind) {
-        switch (kind) {
-            case Boolean:
-                return FALSE;
-            case Byte:
-                return forByte((byte) 0);
-            case Char:
-                return forChar((char) 0);
-            case Short:
-                return forShort((short) 0);
-            case Int:
-                return INT_0;
-            case Double:
-                return DOUBLE_0;
-            case Float:
-                return FLOAT_0;
-            case Long:
-                return LONG_0;
-            case Object:
-                return NULL_POINTER;
-            default:
-                throw new IllegalArgumentException(kind.toString());
-        }
-    }
-
-    /**
-     * Returns the zero value for a given numeric kind.
-     */
-    static JavaConstant zero(Kind kind) {
-        switch (kind) {
-            case Boolean:
-                return FALSE;
-            case Byte:
-                return forByte((byte) 0);
-            case Char:
-                return forChar((char) 0);
-            case Double:
-                return DOUBLE_0;
-            case Float:
-                return FLOAT_0;
-            case Int:
-                return INT_0;
-            case Long:
-                return LONG_0;
-            case Short:
-                return forShort((short) 0);
-            default:
-                throw new IllegalArgumentException(kind.toString());
-        }
-    }
-
-    /**
-     * Returns the one value for a given numeric kind.
-     */
-    static JavaConstant one(Kind kind) {
-        switch (kind) {
-            case Boolean:
-                return TRUE;
-            case Byte:
-                return forByte((byte) 1);
-            case Char:
-                return forChar((char) 1);
-            case Double:
-                return DOUBLE_1;
-            case Float:
-                return FLOAT_1;
-            case Int:
-                return INT_1;
-            case Long:
-                return LONG_1;
-            case Short:
-                return forShort((short) 1);
-            default:
-                throw new IllegalArgumentException(kind.toString());
-        }
-    }
-
-    /**
-     * Adds two numeric constants.
-     */
-    static JavaConstant add(JavaConstant x, JavaConstant y) {
-        assert x.getKind() == y.getKind();
-        switch (x.getKind()) {
-            case Byte:
-                return forByte((byte) (x.asInt() + y.asInt()));
-            case Char:
-                return forChar((char) (x.asInt() + y.asInt()));
-            case Double:
-                return forDouble(x.asDouble() + y.asDouble());
-            case Float:
-                return forFloat(x.asFloat() + y.asFloat());
-            case Int:
-                return forInt(x.asInt() + y.asInt());
-            case Long:
-                return forLong(x.asLong() + y.asLong());
-            case Short:
-                return forShort((short) (x.asInt() + y.asInt()));
-            default:
-                throw new IllegalArgumentException(x.getKind().toString());
-        }
-    }
-
-    /**
-     * Multiplies two numeric constants.
-     */
-    static PrimitiveConstant mul(JavaConstant x, JavaConstant y) {
-        assert x.getKind() == y.getKind();
-        switch (x.getKind()) {
-            case Byte:
-                return forByte((byte) (x.asInt() * y.asInt()));
-            case Char:
-                return forChar((char) (x.asInt() * y.asInt()));
-            case Double:
-                return forDouble(x.asDouble() * y.asDouble());
-            case Float:
-                return forFloat(x.asFloat() * y.asFloat());
-            case Int:
-                return forInt(x.asInt() * y.asInt());
-            case Long:
-                return forLong(x.asLong() * y.asLong());
-            case Short:
-                return forShort((short) (x.asInt() * y.asInt()));
-            default:
-                throw new IllegalArgumentException(x.getKind().toString());
-        }
-    }
-}
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/JavaField.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,129 +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.graal.api.meta;
-
-import java.util.*;
-
-/**
- * Represents a reference to a Java field, either resolved or unresolved fields. Fields, like
- * methods and types, are resolved through {@link ConstantPool constant pools}.
- */
-public interface JavaField extends TrustedInterface {
-
-    /**
-     * Returns the name of this field.
-     */
-    String getName();
-
-    /**
-     * Returns a {@link JavaType} object that identifies the declared type for this field.
-     */
-    JavaType getType();
-
-    /**
-     * Returns the kind of this field. This is the same as calling {@link #getType}.
-     * {@link JavaType#getKind getKind}.
-     */
-    default Kind getKind() {
-        return getType().getKind();
-    }
-
-    /**
-     * Returns the {@link JavaType} object representing the class or interface that declares this
-     * field.
-     */
-    JavaType getDeclaringClass();
-
-    /**
-     * Gets a string for this 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 this 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
-     * @return the result of formatting this field according to {@code format}
-     * @throws IllegalFormatException if an illegal specifier is encountered in {@code format}
-     */
-    default String format(String format) throws IllegalFormatException {
-        StringBuilder sb = new StringBuilder();
-        int index = 0;
-        JavaType type = getType();
-        while (index < format.length()) {
-            char ch = format.charAt(index++);
-            if (ch == '%') {
-                if (index >= format.length()) {
-                    throw new UnknownFormatConversionException("An unquoted '%' character cannot terminate a field format specification");
-                }
-                char specifier = format.charAt(index++);
-                boolean qualified = false;
-                switch (specifier) {
-                    case 'T':
-                        qualified = true;
-                        // fall through
-                    case 't': {
-                        sb.append(type.toJavaName(qualified));
-                        break;
-                    }
-                    case 'H':
-                        qualified = true;
-                        // fall through
-                    case 'h': {
-                        sb.append(getDeclaringClass().toJavaName(qualified));
-                        break;
-                    }
-                    case 'n': {
-                        sb.append(getName());
-                        break;
-                    }
-                    case 'f': {
-                        sb.append(!(this instanceof ResolvedJavaField) ? "unresolved" : ((ResolvedJavaField) this).isStatic() ? "static" : "instance");
-                        break;
-                    }
-                    case '%': {
-                        sb.append('%');
-                        break;
-                    }
-                    default: {
-                        throw new UnknownFormatConversionException(String.valueOf(specifier));
-                    }
-                }
-            } else {
-                sb.append(ch);
-            }
-        }
-        return sb.toString();
-    }
-}
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/JavaMethod.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,141 +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.graal.api.meta;
-
-import java.util.*;
-
-/**
- * Represents a reference to a Java method, either resolved or unresolved. Methods, like fields and
- * types, are resolved through {@link ConstantPool constant pools}.
- */
-public interface JavaMethod extends TrustedInterface {
-
-    /**
-     * Returns the name of this method.
-     */
-    String getName();
-
-    /**
-     * Returns the {@link JavaType} object representing the class or interface that declares this
-     * method.
-     */
-    JavaType getDeclaringClass();
-
-    /**
-     * Returns the signature of this method.
-     */
-    Signature getSignature();
-
-    /**
-     * Gets a string for this 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 this 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
-     * @return the result of formatting this method according to {@code format}
-     * @throws IllegalFormatException if an illegal specifier is encountered in {@code format}
-     */
-    default String format(String format) throws IllegalFormatException {
-        StringBuilder sb = new StringBuilder();
-        int index = 0;
-        Signature sig = null;
-        while (index < format.length()) {
-            char ch = format.charAt(index++);
-            if (ch == '%') {
-                if (index >= format.length()) {
-                    throw new UnknownFormatConversionException("An unquoted '%' character cannot terminate a method format specification");
-                }
-                char specifier = format.charAt(index++);
-                boolean qualified = false;
-                switch (specifier) {
-                    case 'R':
-                        qualified = true;
-                        // fall through
-                    case 'r': {
-                        if (sig == null) {
-                            sig = getSignature();
-                        }
-                        sb.append(sig.getReturnType(null).toJavaName(qualified));
-                        break;
-                    }
-                    case 'H':
-                        qualified = true;
-                        // fall through
-                    case 'h': {
-                        sb.append(getDeclaringClass().toJavaName(qualified));
-                        break;
-                    }
-                    case 'n': {
-                        sb.append(getName());
-                        break;
-                    }
-                    case 'P':
-                        qualified = true;
-                        // fall through
-                    case 'p': {
-                        if (sig == null) {
-                            sig = getSignature();
-                        }
-                        for (int i = 0; i < sig.getParameterCount(false); i++) {
-                            if (i != 0) {
-                                sb.append(", ");
-                            }
-                            sb.append(sig.getParameterType(i, null).toJavaName(qualified));
-                        }
-                        break;
-                    }
-                    case 'f': {
-                        sb.append(!(this instanceof ResolvedJavaMethod) ? "unresolved" : ((ResolvedJavaMethod) this).isStatic() ? "static" : "virtual");
-                        break;
-                    }
-                    case '%': {
-                        sb.append('%');
-                        break;
-                    }
-                    default: {
-                        throw new UnknownFormatConversionException(String.valueOf(specifier));
-                    }
-                }
-            } else {
-                sb.append(ch);
-            }
-        }
-        return sb.toString();
-    }
-}
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/JavaMethodProfile.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.api.meta;
-
-import com.oracle.graal.api.meta.JavaMethodProfile.ProfiledMethod;
-
-/**
- * This profile object represents the method profile at a specific BCI. The precision of the
- * supplied values may vary, but a runtime that provides this information should be aware that it
- * will be used to guide performance-critical decisions like speculative inlining, etc.
- */
-public final class JavaMethodProfile extends AbstractJavaProfile<ProfiledMethod, ResolvedJavaMethod> {
-
-    public JavaMethodProfile(double notRecordedProbability, ProfiledMethod[] pitems) {
-        super(notRecordedProbability, pitems);
-    }
-
-    public ProfiledMethod[] getMethods() {
-        return super.getItems();
-    }
-
-    public static class ProfiledMethod extends AbstractProfiledItem<ResolvedJavaMethod> {
-
-        public ProfiledMethod(ResolvedJavaMethod method, double probability) {
-            super(method, probability);
-        }
-
-        /**
-         * Returns the type for this profile entry.
-         */
-        public ResolvedJavaMethod getMethod() {
-            return getItem();
-        }
-
-        @Override
-        public String toString() {
-            return "{" + item.getName() + ", " + probability + "}";
-        }
-    }
-}
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/JavaType.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,153 +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.graal.api.meta;
-
-import static com.oracle.graal.api.meta.MetaUtil.*;
-
-/**
- * Represents a resolved or unresolved type. Types include primitives, objects, {@code void}, and
- * arrays thereof.
- */
-public interface JavaType extends TrustedInterface {
-
-    /**
-     * Returns the name of this type in internal form. The following are examples of strings
-     * returned by this method:
-     *
-     * <pre>
-     *     "Ljava/lang/Object;"
-     *     "I"
-     *     "[[B"
-     * </pre>
-     */
-    String getName();
-
-    /**
-     * Returns an unqualified name of this type.
-     *
-     * <pre>
-     *     "Object"
-     *     "Integer"
-     * </pre>
-     */
-    default String getUnqualifiedName() {
-        String name = getName();
-        if (name.indexOf('/') != -1) {
-            name = name.substring(name.lastIndexOf('/') + 1);
-        }
-        if (name.endsWith(";")) {
-            name = name.substring(0, name.length() - 1);
-        }
-        return name;
-    }
-
-    /**
-     * For array types, gets the type of the components, or {@code null} if this is not an array
-     * type. This method is analogous to {@link Class#getComponentType()}.
-     */
-    JavaType getComponentType();
-
-    /**
-     * Gets the elemental type for this given type. The elemental type is the corresponding zero
-     * dimensional type of an array type. For example, the elemental type of {@code int[][][]} is
-     * {@code int}. A non-array type is its own elemental type.
-     */
-    default JavaType getElementalType() {
-        JavaType t = this;
-        while (t.getComponentType() != null) {
-            t = t.getComponentType();
-        }
-        return t;
-    }
-
-    /**
-     * Gets the array class type representing an array with elements of this type.
-     */
-    JavaType getArrayClass();
-
-    /**
-     * Gets the kind of this type.
-     */
-    Kind getKind();
-
-    /**
-     * Resolves this type to a {@link ResolvedJavaType}.
-     *
-     * @param accessingClass the context of resolution (must not be null)
-     * @return the resolved Java type
-     * @throws LinkageError if the resolution failed
-     * @throws NullPointerException if {@code accessingClass} is {@code null}
-     */
-    ResolvedJavaType resolve(ResolvedJavaType accessingClass);
-
-    /**
-     * Gets the Java programming language name for this type. The following are examples of strings
-     * returned by this method:
-     *
-     * <pre>
-     *      java.lang.Object
-     *      int
-     *      boolean[][]
-     * </pre>
-     *
-     * @return the Java name corresponding to this type
-     */
-    default String toJavaName() {
-        return internalNameToJava(getName(), true, false);
-    }
-
-    /**
-     * Gets the Java programming language name for this type. The following are examples of strings
-     * returned by this method:
-     *
-     * <pre>
-     *     qualified == true:
-     *         java.lang.Object
-     *         int
-     *         boolean[][]
-     *     qualified == false:
-     *         Object
-     *         int
-     *         boolean[][]
-     * </pre>
-     *
-     * @param qualified specifies if the package prefix of this type should be included in the
-     *            returned name
-     * @return the Java name corresponding to this type
-     */
-    default String toJavaName(boolean qualified) {
-        Kind kind = getKind();
-        if (kind == Kind.Object) {
-            return internalNameToJava(getName(), qualified, false);
-        }
-        return getKind().getJavaName();
-    }
-
-    /**
-     * Returns this type's name in the same format as {@link Class#getName()}.
-     */
-    default String toClassName() {
-        return internalNameToJava(getName(), true, true);
-    }
-
-}
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/JavaTypeProfile.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,195 +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.graal.api.meta;
-
-import java.util.*;
-
-import com.oracle.graal.api.meta.JavaTypeProfile.ProfiledType;
-
-/**
- * This profile object represents the type profile at a specific BCI. The precision of the supplied
- * values may vary, but a runtime that provides this information should be aware that it will be
- * used to guide performance-critical decisions like speculative inlining, etc.
- */
-public final class JavaTypeProfile extends AbstractJavaProfile<ProfiledType, ResolvedJavaType> {
-
-    private static final ProfiledType[] EMPTY_ARRAY = new ProfiledType[0];
-
-    private final TriState nullSeen;
-
-    public JavaTypeProfile(TriState nullSeen, double notRecordedProbability, ProfiledType[] pitems) {
-        super(notRecordedProbability, pitems);
-        this.nullSeen = nullSeen;
-    }
-
-    /**
-     * Returns whether a null value was at the type check.
-     */
-    public TriState getNullSeen() {
-        return nullSeen;
-    }
-
-    /**
-     * A list of types for which the runtime has recorded probability information. Note that this
-     * includes both positive and negative types where a positive type is a subtype of the checked
-     * type and a negative type is not.
-     */
-    public ProfiledType[] getTypes() {
-        return getItems();
-    }
-
-    public JavaTypeProfile restrict(JavaTypeProfile otherProfile) {
-        if (otherProfile.getNotRecordedProbability() > 0.0) {
-            // Not useful for restricting since there is an unknown set of types occurring.
-            return this;
-        }
-
-        if (this.getNotRecordedProbability() > 0.0) {
-            // We are unrestricted, so the other profile is always a better estimate.
-            return otherProfile;
-        }
-
-        ArrayList<ProfiledType> result = new ArrayList<>();
-        for (int i = 0; i < getItems().length; i++) {
-            ProfiledType ptype = getItems()[i];
-            ResolvedJavaType type = ptype.getItem();
-            if (otherProfile.isIncluded(type)) {
-                result.add(ptype);
-            }
-        }
-
-        TriState newNullSeen = (otherProfile.getNullSeen() == TriState.FALSE) ? TriState.FALSE : getNullSeen();
-        double newNotRecorded = getNotRecordedProbability();
-        return createAdjustedProfile(result, newNullSeen, newNotRecorded);
-    }
-
-    public JavaTypeProfile restrict(ResolvedJavaType declaredType, boolean nonNull) {
-        ArrayList<ProfiledType> result = new ArrayList<>();
-        for (int i = 0; i < getItems().length; i++) {
-            ProfiledType ptype = getItems()[i];
-            ResolvedJavaType type = ptype.getItem();
-            if (declaredType.isAssignableFrom(type)) {
-                result.add(ptype);
-            }
-        }
-
-        TriState newNullSeen = (nonNull) ? TriState.FALSE : getNullSeen();
-        double newNotRecorded = this.getNotRecordedProbability();
-        // Assume for the types not recorded, the incompatibility rate is the same.
-        if (getItems().length != 0) {
-            newNotRecorded *= ((double) result.size() / (double) getItems().length);
-        }
-        return createAdjustedProfile(result, newNullSeen, newNotRecorded);
-    }
-
-    private JavaTypeProfile createAdjustedProfile(ArrayList<ProfiledType> result, TriState newNullSeen, double newNotRecorded) {
-        if (result.size() != this.getItems().length || newNotRecorded != getNotRecordedProbability() || newNullSeen != getNullSeen()) {
-            if (result.size() == 0) {
-                return new JavaTypeProfile(newNullSeen, 1.0, EMPTY_ARRAY);
-            }
-            double factor;
-            if (result.size() == this.getItems().length) {
-                /* List of types did not change, no need to recompute probabilities. */
-                factor = 1.0;
-            } else {
-                double probabilitySum = 0.0;
-                for (int i = 0; i < result.size(); i++) {
-                    probabilitySum += result.get(i).getProbability();
-                }
-                probabilitySum += newNotRecorded;
-
-                factor = 1.0 / probabilitySum; // Normalize to 1.0
-                assert factor >= 1.0;
-            }
-            ProfiledType[] newResult = new ProfiledType[result.size()];
-            for (int i = 0; i < newResult.length; ++i) {
-                ProfiledType curType = result.get(i);
-                newResult[i] = new ProfiledType(curType.getItem(), Math.min(1.0, curType.getProbability() * factor));
-            }
-            double newNotRecordedTypeProbability = Math.min(1.0, newNotRecorded * factor);
-            return new JavaTypeProfile(newNullSeen, newNotRecordedTypeProbability, newResult);
-        }
-        return this;
-    }
-
-    @Override
-    public boolean equals(Object other) {
-        return super.equals(other) && nullSeen.equals(((JavaTypeProfile) other).nullSeen);
-    }
-
-    @Override
-    public int hashCode() {
-        return nullSeen.hashCode() + super.hashCode();
-    }
-
-    public static class ProfiledType extends AbstractProfiledItem<ResolvedJavaType> {
-
-        public ProfiledType(ResolvedJavaType type, double probability) {
-            super(type, probability);
-            assert type.isArray() || type.isConcrete() : type;
-        }
-
-        /**
-         * Returns the type for this profile entry.
-         */
-        public ResolvedJavaType getType() {
-            return getItem();
-        }
-
-        @Override
-        public String toString() {
-            return String.format("%.6f#%s", probability, item);
-        }
-    }
-
-    @Override
-    public String toString() {
-        StringBuilder buf = new StringBuilder("JavaTypeProfile<nullSeen=").append(getNullSeen()).append(", types=[");
-        for (int j = 0; j < getTypes().length; j++) {
-            if (j != 0) {
-                buf.append(", ");
-            }
-            ProfiledType ptype = getTypes()[j];
-            buf.append(String.format("%.6f:%s", ptype.getProbability(), ptype.getType()));
-        }
-        return buf.append(String.format("], notRecorded:%.6f>", getNotRecordedProbability())).toString();
-    }
-
-    /**
-     * Returns {@code true} if all types seen at this location have been recorded in the profile.
-     */
-    public boolean allTypesRecorded() {
-        return this.getNotRecordedProbability() == 0.0;
-    }
-
-    /**
-     * Returns the single monormorphic type representing this profile or {@code null} if no such
-     * type exists.
-     */
-    public ResolvedJavaType asSingleType() {
-        if (allTypesRecorded() && this.getTypes().length == 1) {
-            return getTypes()[0].getType();
-        }
-        return null;
-    }
-}
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/JavaValue.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.api.meta;
-
-/**
- * Interface for things that represent a Java value.
- */
-public interface JavaValue {
-
-    /**
-     * Returns the kind of this value.
-     */
-    Kind getKind();
-}
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Kind.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,486 +0,0 @@
-/*
- * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.api.meta;
-
-import java.lang.reflect.*;
-
-//JaCoCo Exclude
-
-/**
- * Denotes the basic kinds of types in CRI, including the all the Java primitive types, for example,
- * {@link Kind#Int} for {@code int} and {@link Kind#Object} for all object types. A kind has a
- * single character short name, a Java name, and a set of flags further describing its behavior.
- */
-public enum Kind implements PlatformKind {
-    /** The primitive boolean kind, represented as an int on the stack. */
-    Boolean('z', "boolean", 1, true, java.lang.Boolean.TYPE, java.lang.Boolean.class),
-
-    /** The primitive byte kind, represented as an int on the stack. */
-    Byte('b', "byte", 1, true, java.lang.Byte.TYPE, java.lang.Byte.class),
-
-    /** The primitive short kind, represented as an int on the stack. */
-    Short('s', "short", 1, true, java.lang.Short.TYPE, java.lang.Short.class),
-
-    /** The primitive char kind, represented as an int on the stack. */
-    Char('c', "char", 1, true, java.lang.Character.TYPE, java.lang.Character.class),
-
-    /** The primitive int kind, represented as an int on the stack. */
-    Int('i', "int", 1, true, java.lang.Integer.TYPE, java.lang.Integer.class),
-
-    /** The primitive float kind. */
-    Float('f', "float", 1, false, java.lang.Float.TYPE, java.lang.Float.class),
-
-    /** The primitive long kind. */
-    Long('j', "long", 2, false, java.lang.Long.TYPE, java.lang.Long.class),
-
-    /** The primitive double kind. */
-    Double('d', "double", 2, false, java.lang.Double.TYPE, java.lang.Double.class),
-
-    /** The Object kind, also used for arrays. */
-    Object('a', "Object", 1, false, null, null),
-
-    /** The void float kind. */
-    Void('v', "void", 0, false, java.lang.Void.TYPE, java.lang.Void.class),
-
-    /** The non-type. */
-    Illegal('-', "illegal", 0, false, null, null);
-
-    private final char typeChar;
-    private final String javaName;
-    private final boolean isStackInt;
-    private final Class<?> primitiveJavaClass;
-    private final Class<?> boxedJavaClass;
-    private final EnumKey key = new EnumKey(this);
-    private final int slotCount;
-
-    private Kind(char typeChar, String javaName, int slotCount, boolean isStackInt, Class<?> primitiveJavaClass, Class<?> boxedJavaClass) {
-        this.typeChar = typeChar;
-        this.javaName = javaName;
-        this.slotCount = slotCount;
-        this.isStackInt = isStackInt;
-        this.primitiveJavaClass = primitiveJavaClass;
-        this.boxedJavaClass = boxedJavaClass;
-        assert primitiveJavaClass == null || javaName.equals(primitiveJavaClass.getName());
-    }
-
-    /**
-     * Returns the number of stack slots occupied by this kind according to the Java bytecodes
-     * specification.
-     */
-    public int getSlotCount() {
-        return this.slotCount;
-    }
-
-    /**
-     * Returns whether this kind occupied two stack slots.
-     */
-    public boolean needsTwoSlots() {
-        return this.slotCount == 2;
-    }
-
-    /**
-     * Returns the name of the kind as a single character.
-     */
-    public char getTypeChar() {
-        return typeChar;
-    }
-
-    /**
-     * Returns the name of this kind which will also be it Java programming language name if it is
-     * {@linkplain #isPrimitive() primitive} or {@code void}.
-     */
-    public String getJavaName() {
-        return javaName;
-    }
-
-    public Key getKey() {
-        return key;
-    }
-
-    /**
-     * Checks whether this type is a Java primitive type.
-     *
-     * @return {@code true} if this is {@link #Boolean}, {@link #Byte}, {@link #Char},
-     *         {@link #Short}, {@link #Int}, {@link #Long}, {@link #Float}, {@link #Double}, or
-     *         {@link #Void}.
-     */
-    public boolean isPrimitive() {
-        return primitiveJavaClass != null;
-    }
-
-    /**
-     * Returns the kind that represents this kind when on the Java operand stack.
-     *
-     * @return the kind used on the operand stack
-     */
-    public Kind getStackKind() {
-        if (isStackInt) {
-            return Int;
-        }
-        return this;
-    }
-
-    /**
-     * Checks whether this type is a Java primitive type representing an integer number.
-     *
-     * @return {@code true} if the stack kind is {@link #Int} or {@link #Long}.
-     */
-    public boolean isNumericInteger() {
-        return isStackInt || this == Kind.Long;
-    }
-
-    /**
-     * Checks whether this type is a Java primitive type representing an unsigned number.
-     *
-     * @return {@code true} if the kind is {@link #Boolean} or {@link #Char}.
-     */
-    public boolean isUnsigned() {
-        return this == Kind.Boolean || this == Kind.Char;
-    }
-
-    /**
-     * Checks whether this type is a Java primitive type representing a floating point number.
-     *
-     * @return {@code true} if this is {@link #Float} or {@link #Double}.
-     */
-    public boolean isNumericFloat() {
-        return this == Kind.Float || this == Kind.Double;
-    }
-
-    /**
-     * Checks whether this represent an Object of some sort.
-     *
-     * @return {@code true} if this is {@link #Object}.
-     */
-    public boolean isObject() {
-        return this == Kind.Object;
-    }
-
-    /**
-     * Returns the kind corresponding to the Java type string.
-     *
-     * @param typeString the Java type string
-     * @return the kind
-     */
-    public static Kind fromTypeString(String typeString) {
-        assert typeString.length() > 0;
-        final char first = typeString.charAt(0);
-        if (first == '[' || first == 'L') {
-            return Kind.Object;
-        }
-        return Kind.fromPrimitiveOrVoidTypeChar(first);
-    }
-
-    /**
-     * Returns the kind of a word given the size of a word in bytes.
-     *
-     * @param wordSizeInBytes the size of a word in bytes
-     * @return the kind representing a word value
-     */
-    public static Kind fromWordSize(int wordSizeInBytes) {
-        if (wordSizeInBytes == 8) {
-            return Kind.Long;
-        } else {
-            assert wordSizeInBytes == 4 : "Unsupported word size!";
-            return Kind.Int;
-        }
-    }
-
-    /**
-     * Returns the kind from the character describing a primitive or void.
-     *
-     * @param ch the character
-     * @return the kind
-     */
-    public static Kind fromPrimitiveOrVoidTypeChar(char ch) {
-        switch (ch) {
-            case 'Z':
-                return Boolean;
-            case 'C':
-                return Char;
-            case 'F':
-                return Float;
-            case 'D':
-                return Double;
-            case 'B':
-                return Byte;
-            case 'S':
-                return Short;
-            case 'I':
-                return Int;
-            case 'J':
-                return Long;
-            case 'V':
-                return Void;
-        }
-        throw new IllegalArgumentException("unknown primitive or void type character: " + ch);
-    }
-
-    /**
-     * Returns the Kind representing the given Java class.
-     *
-     * @param klass the class
-     * @return the kind
-     */
-    public static Kind fromJavaClass(Class<?> klass) {
-        if (klass == Boolean.primitiveJavaClass) {
-            return Boolean;
-        } else if (klass == Byte.primitiveJavaClass) {
-            return Byte;
-        } else if (klass == Short.primitiveJavaClass) {
-            return Short;
-        } else if (klass == Char.primitiveJavaClass) {
-            return Char;
-        } else if (klass == Int.primitiveJavaClass) {
-            return Int;
-        } else if (klass == Long.primitiveJavaClass) {
-            return Long;
-        } else if (klass == Float.primitiveJavaClass) {
-            return Float;
-        } else if (klass == Double.primitiveJavaClass) {
-            return Double;
-        } else if (klass == Void.primitiveJavaClass) {
-            return Void;
-        } else {
-            return Object;
-        }
-    }
-
-    /**
-     * Returns the Java class representing this kind.
-     *
-     * @return the Java class
-     */
-    public Class<?> toJavaClass() {
-        return primitiveJavaClass;
-    }
-
-    /**
-     * Returns the Java class for instances of boxed values of this kind.
-     *
-     * @return the Java class
-     */
-    public Class<?> toBoxedJavaClass() {
-        return boxedJavaClass;
-    }
-
-    /**
-     * Converts this value type to a string.
-     */
-    @Override
-    public String toString() {
-        return javaName;
-    }
-
-    /**
-     * Marker interface for types that should be {@linkplain Kind#format(Object) formatted} with
-     * their {@link Object#toString()} value. Calling {@link Object#toString()} on other objects
-     * poses a security risk because it can potentially call user code.
-     */
-    public interface FormatWithToString {
-    }
-
-    /**
-     * Classes for which invoking {@link Object#toString()} does not run user code.
-     */
-    private static boolean isToStringSafe(Class<?> c) {
-        return c == Boolean.class || c == Byte.class || c == Character.class || c == Short.class || c == Integer.class || c == Float.class || c == Long.class || c == Double.class;
-    }
-
-    /**
-     * Gets a formatted string for a given value of this kind.
-     *
-     * @param value a value of this kind
-     * @return a formatted string for {@code value} based on this kind
-     */
-    public String format(Object value) {
-        if (isPrimitive()) {
-            assert isToStringSafe(value.getClass());
-            return value.toString();
-        } else {
-            if (value == null) {
-                return "null";
-            } else {
-                if (value instanceof String) {
-                    String s = (String) value;
-                    if (s.length() > 50) {
-                        return "String:\"" + s.substring(0, 30) + "...\"";
-                    } else {
-                        return "String:\"" + s + '"';
-                    }
-                } else if (value instanceof JavaType) {
-                    return "JavaType:" + ((JavaType) value).toJavaName();
-                } else if (value instanceof Enum) {
-                    return MetaUtil.getSimpleName(value.getClass(), true) + ":" + ((Enum<?>) value).name();
-                } else if (value instanceof FormatWithToString) {
-                    return MetaUtil.getSimpleName(value.getClass(), true) + ":" + String.valueOf(value);
-                } else if (value instanceof Class<?>) {
-                    return "Class:" + ((Class<?>) value).getName();
-                } else if (isToStringSafe(value.getClass())) {
-                    return value.toString();
-                } else if (value.getClass().isArray()) {
-                    return formatArray(value);
-                } else {
-                    return MetaUtil.getSimpleName(value.getClass(), true) + "@" + System.identityHashCode(value);
-                }
-            }
-        }
-    }
-
-    private static final int MAX_FORMAT_ARRAY_LENGTH = 5;
-
-    private static String formatArray(Object array) {
-        Class<?> componentType = array.getClass().getComponentType();
-        assert componentType != null;
-        int arrayLength = Array.getLength(array);
-        StringBuilder buf = new StringBuilder(MetaUtil.getSimpleName(componentType, true)).append('[').append(arrayLength).append("]{");
-        int length = Math.min(MAX_FORMAT_ARRAY_LENGTH, arrayLength);
-        boolean primitive = componentType.isPrimitive();
-        for (int i = 0; i < length; i++) {
-            if (primitive) {
-                buf.append(Array.get(array, i));
-            } else {
-                Object o = ((Object[]) array)[i];
-                buf.append(Kind.Object.format(o));
-            }
-            if (i != length - 1) {
-                buf.append(", ");
-            }
-        }
-        if (arrayLength != length) {
-            buf.append(", ...");
-        }
-        return buf.append('}').toString();
-    }
-
-    /**
-     * The minimum value that can be represented as a value of this kind.
-     *
-     * @return the minimum value
-     */
-    public long getMinValue() {
-        switch (this) {
-            case Boolean:
-                return 0;
-            case Byte:
-                return java.lang.Byte.MIN_VALUE;
-            case Char:
-                return java.lang.Character.MIN_VALUE;
-            case Short:
-                return java.lang.Short.MIN_VALUE;
-            case Int:
-                return java.lang.Integer.MIN_VALUE;
-            case Long:
-                return java.lang.Long.MIN_VALUE;
-            default:
-                throw new IllegalArgumentException("illegal call to minValue on " + this);
-        }
-    }
-
-    /**
-     * The maximum value that can be represented as a value of this kind.
-     *
-     * @return the maximum value
-     */
-    public long getMaxValue() {
-        switch (this) {
-            case Boolean:
-                return 1;
-            case Byte:
-                return java.lang.Byte.MAX_VALUE;
-            case Char:
-                return java.lang.Character.MAX_VALUE;
-            case Short:
-                return java.lang.Short.MAX_VALUE;
-            case Int:
-                return java.lang.Integer.MAX_VALUE;
-            case Long:
-                return java.lang.Long.MAX_VALUE;
-            default:
-                throw new IllegalArgumentException("illegal call to maxValue on " + this);
-        }
-    }
-
-    /**
-     * Number of bytes that are necessary to represent a value of this kind.
-     *
-     * @return the number of bytes
-     */
-    public int getByteCount() {
-        if (this == Boolean) {
-            return 1;
-        } else {
-            return getBitCount() >> 3;
-        }
-    }
-
-    /**
-     * Number of bits that are necessary to represent a value of this kind.
-     *
-     * @return the number of bits
-     */
-    public int getBitCount() {
-        switch (this) {
-            case Boolean:
-                return 1;
-            case Byte:
-                return 8;
-            case Char:
-            case Short:
-                return 16;
-            case Float:
-                return 32;
-            case Int:
-                return 32;
-            case Double:
-                return 64;
-            case Long:
-                return 64;
-            default:
-                throw new IllegalArgumentException("illegal call to bits on " + this);
-        }
-    }
-
-    public JavaConstant getDefaultValue() {
-        switch (this) {
-            case Boolean:
-                return JavaConstant.FALSE;
-            case Int:
-                return JavaConstant.INT_0;
-            case Long:
-                return JavaConstant.LONG_0;
-            case Float:
-                return JavaConstant.FLOAT_0;
-            case Double:
-                return JavaConstant.DOUBLE_0;
-            case Object:
-                return JavaConstant.NULL_POINTER;
-            case Byte:
-            case Char:
-            case Short:
-                return new PrimitiveConstant(this, 0);
-            default:
-                throw new IllegalArgumentException("illegal call to getDefaultValue on " + this);
-        }
-    }
-}
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/KindProvider.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.oracle.graal.api.meta;
-
-/**
- * Interface for classes which can be associated with a Kind.
- */
-public interface KindProvider {
-
-    Kind getKind();
-
-}
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/LIRKind.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,349 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.api.meta;
-
-import java.util.*;
-
-/**
- * Represents the type of values in the LIR. It is composed of a {@link PlatformKind} that gives the
- * low level representation of the value, and a {@link #referenceMask} that describes the location
- * of object references in the value.
- *
- * <h2>Constructing {@link LIRKind} instances</h2>
- *
- * During LIR generation, every new {@link Value} should get a {@link LIRKind} of the correct
- * {@link PlatformKind} that also contains the correct reference information. {@linkplain LIRKind
- * LIRKinds} should be created as follows:
- *
- * <p>
- * If the result value is created from one or more input values, the {@link LIRKind} should be
- * created with {@link LIRKind#derive}(inputs). If the result has a different {@link PlatformKind}
- * than the inputs, {@link LIRKind#derive}(inputs).{@link #changeType}(resultKind) should be used.
- * <p>
- * If the result is an exact copy of one of the inputs, {@link Value#getLIRKind()} can be used. Note
- * that this is only correct for move-like operations, like conditional move or compare-and-swap.
- * For convert operations, {@link LIRKind#derive} should be used.
- * <p>
- * If it is known that the result will be a reference (e.g. pointer arithmetic where the end result
- * is a valid oop), {@link LIRKind#reference} should be used.
- * <p>
- * If it is known that the result will neither be a reference nor be derived from a reference,
- * {@link LIRKind#value} can be used. If the operation producing this value has inputs, this is very
- * likely wrong, and {@link LIRKind#derive} should be used instead.
- * <p>
- * If it is known that the result is derived from a reference, {@link LIRKind#derivedReference} can
- * be used. In most cases, {@link LIRKind#derive} should be used instead, since it is able to detect
- * this automatically.
- */
-public final class LIRKind {
-
-    /**
-     * The non-type. This uses {@link #derivedReference}, so it can never be part of an oop map.
-     */
-    public static final LIRKind Illegal = derivedReference(Kind.Illegal);
-
-    private final PlatformKind platformKind;
-    private final int referenceMask;
-
-    private static final int DERIVED_REFERENCE = -1;
-
-    private LIRKind(PlatformKind platformKind, int referenceMask) {
-        this.platformKind = platformKind;
-        this.referenceMask = referenceMask;
-    }
-
-    /**
-     * Create a {@link LIRKind} of type {@code platformKind} that contains a primitive value. Should
-     * be only used when it's guaranteed that the value is not even indirectly derived from a
-     * reference. Otherwise, {@link #derive(Value...)} should be used instead.
-     */
-    public static LIRKind value(PlatformKind platformKind) {
-        assert platformKind != Kind.Object : "Object should always be used as reference type";
-        return new LIRKind(platformKind, 0);
-    }
-
-    /**
-     * Create a {@link LIRKind} of type {@code platformKind} that contains a single tracked oop
-     * reference.
-     */
-    public static LIRKind reference(PlatformKind platformKind) {
-        int length = platformKind.getVectorLength();
-        assert 0 < length && length < 32 : "vector of " + length + " references not supported";
-        return new LIRKind(platformKind, (1 << length) - 1);
-    }
-
-    /**
-     * Create a {@link LIRKind} of type {@code platformKind} that contains a value that is derived
-     * from a reference. Values of this {@link LIRKind} can not be live at safepoints. In most
-     * cases, this should not be called directly. {@link #derive} should be used instead to
-     * automatically propagate this information.
-     */
-    public static LIRKind derivedReference(PlatformKind platformKind) {
-        return new LIRKind(platformKind, DERIVED_REFERENCE);
-    }
-
-    /**
-     * Derive a new type from inputs. The result will have the {@link PlatformKind} of one of the
-     * inputs. If all inputs are values, the result is a value. Otherwise, the result is a derived
-     * reference.
-     *
-     * This method should be used to construct the result {@link LIRKind} of any operation that
-     * modifies values (e.g. arithmetics).
-     */
-    public static LIRKind derive(Value... inputs) {
-        assert inputs.length > 0;
-        for (Value input : inputs) {
-            LIRKind kind = input.getLIRKind();
-            if (kind.isDerivedReference()) {
-                return kind;
-            } else if (!kind.isValue()) {
-                return kind.makeDerivedReference();
-            }
-        }
-
-        // all inputs are values, just return one of them
-        return inputs[0].getLIRKind();
-    }
-
-    /**
-     * Merge the types of the inputs. The result will have the {@link PlatformKind} of one of the
-     * inputs. If all inputs are values (references), the result is a value (reference). Otherwise,
-     * the result is a derived reference.
-     *
-     * This method should be used to construct the result {@link LIRKind} of merge operation that do
-     * not modify values (e.g. phis).
-     */
-    public static LIRKind merge(Value... inputs) {
-        assert inputs.length > 0;
-        ArrayList<LIRKind> kinds = new ArrayList<>(inputs.length);
-        for (int i = 0; i < inputs.length; i++) {
-            kinds.add(inputs[i].getLIRKind());
-        }
-        return merge(kinds);
-    }
-
-    /**
-     * @see #merge(Value...)
-     */
-    public static LIRKind merge(Iterable<LIRKind> kinds) {
-        LIRKind mergeKind = null;
-
-        for (LIRKind kind : kinds) {
-
-            assert mergeKind == null || verifyMoveKinds(mergeKind, kind) : String.format("Input kinds do not match %s vs. %s", mergeKind, kind);
-
-            if (kind.isDerivedReference()) {
-                /**
-                 * Kind is a derived reference therefore the result can only be also a derived
-                 * reference.
-                 */
-                return kind;
-            }
-            if (mergeKind == null) {
-                mergeKind = kind;
-                continue;
-            }
-
-            if (kind.isValue()) {
-                /* Kind is a value. */
-                if (mergeKind.referenceMask != 0) {
-                    /*
-                     * Inputs consists of values and references. Make the result a derived
-                     * reference.
-                     */
-                    return mergeKind.makeDerivedReference();
-                }
-                /* Check that other inputs are also values. */
-            } else {
-                /* Kind is a reference. */
-                if (mergeKind.referenceMask != kind.referenceMask) {
-                    /*
-                     * Reference maps do not match so the result can only be a derived reference.
-                     */
-                    return mergeKind.makeDerivedReference();
-                }
-            }
-
-        }
-        assert mergeKind != null;
-
-        // all inputs are values or references, just return one of them
-        return mergeKind;
-    }
-
-    /**
-     * Create a new {@link LIRKind} with the same reference information and a new
-     * {@linkplain #getPlatformKind platform kind}. If the new kind is a longer vector than this,
-     * the new elements are marked as untracked values.
-     */
-    public LIRKind changeType(PlatformKind newPlatformKind) {
-        if (newPlatformKind == platformKind) {
-            return this;
-        } else if (isDerivedReference()) {
-            return derivedReference(newPlatformKind);
-        } else if (referenceMask == 0) {
-            // value type
-            return new LIRKind(newPlatformKind, 0);
-        } else {
-            // reference type
-            int newLength = Math.min(32, newPlatformKind.getVectorLength());
-            int newReferenceMask = referenceMask & (0xFFFFFFFF >>> (32 - newLength));
-            assert newReferenceMask != DERIVED_REFERENCE;
-            return new LIRKind(newPlatformKind, newReferenceMask);
-        }
-    }
-
-    /**
-     * Create a new {@link LIRKind} with a new {@linkplain #getPlatformKind platform kind}. If the
-     * new kind is longer than this, the reference positions are repeated to fill the vector.
-     */
-    public LIRKind repeat(PlatformKind newPlatformKind) {
-        if (isDerivedReference()) {
-            return derivedReference(newPlatformKind);
-        } else if (referenceMask == 0) {
-            // value type
-            return new LIRKind(newPlatformKind, 0);
-        } else {
-            // reference type
-            int oldLength = platformKind.getVectorLength();
-            int newLength = newPlatformKind.getVectorLength();
-            assert oldLength <= newLength && newLength < 32 && (newLength % oldLength) == 0;
-
-            // repeat reference mask to fill new kind
-            int newReferenceMask = 0;
-            for (int i = 0; i < newLength; i += platformKind.getVectorLength()) {
-                newReferenceMask |= referenceMask << i;
-            }
-
-            assert newReferenceMask != DERIVED_REFERENCE;
-            return new LIRKind(newPlatformKind, newReferenceMask);
-        }
-    }
-
-    /**
-     * Create a new {@link LIRKind} with the same type, but marked as containing a derivedReference.
-     */
-    public LIRKind makeDerivedReference() {
-        return new LIRKind(platformKind, DERIVED_REFERENCE);
-    }
-
-    /**
-     * Get the low level type that is used in code generation.
-     */
-    public PlatformKind getPlatformKind() {
-        return platformKind;
-    }
-
-    /**
-     * Check whether this value is derived from a reference. If this returns {@code true}, this
-     * value must not be live at safepoints.
-     */
-    public boolean isDerivedReference() {
-        return referenceMask == DERIVED_REFERENCE;
-    }
-
-    /**
-     * Check whether the {@code idx}th part of this value is a reference that must be tracked at
-     * safepoints.
-     *
-     * @param idx The index into the vector if this is a vector kind. Must be 0 if this is a scalar
-     *            kind.
-     */
-    public boolean isReference(int idx) {
-        assert 0 <= idx && idx < platformKind.getVectorLength() : "invalid index " + idx + " in " + this;
-        return !isDerivedReference() && (referenceMask & 1 << idx) != 0;
-    }
-
-    /**
-     * Check whether this kind is a value type that doesn't need to be tracked at safepoints.
-     */
-    public boolean isValue() {
-        return referenceMask == 0;
-    }
-
-    @Override
-    public String toString() {
-        if (isValue()) {
-            return platformKind.name();
-        } else if (isDerivedReference()) {
-            return platformKind.name() + "[*]";
-        } else {
-            StringBuilder ret = new StringBuilder();
-            ret.append(platformKind.name());
-            ret.append('[');
-            for (int i = 0; i < platformKind.getVectorLength(); i++) {
-                if (isReference(i)) {
-                    ret.append('.');
-                } else {
-                    ret.append(' ');
-                }
-            }
-            ret.append(']');
-            return ret.toString();
-        }
-    }
-
-    @Override
-    public int hashCode() {
-        final int prime = 31;
-        int result = 1;
-        result = prime * result + ((platformKind == null) ? 0 : platformKind.hashCode());
-        result = prime * result + referenceMask;
-        return result;
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (!(obj instanceof LIRKind)) {
-            return false;
-        }
-
-        LIRKind other = (LIRKind) obj;
-        return platformKind == other.platformKind && referenceMask == other.referenceMask;
-    }
-
-    public static boolean verifyMoveKinds(LIRKind dst, LIRKind src) {
-        if (src.equals(dst)) {
-            return true;
-        }
-        /*
-         * TODO(je,rs) What we actually want is toStackKind(src.getPlatformKind()).equals(
-         * dst.getPlatformKind()) but due to the handling of sub-integer at the current point
-         * (phi-)moves from e.g. integer to short can happen. Therefore we compare stack kinds.
-         */
-        if (toStackKind(src.getPlatformKind()).equals(toStackKind(dst.getPlatformKind()))) {
-            return !src.isDerivedReference() || dst.isDerivedReference();
-        }
-        return false;
-    }
-
-    private static PlatformKind toStackKind(PlatformKind platformKind) {
-        if (platformKind instanceof Kind) {
-            return ((Kind) platformKind).getStackKind();
-        }
-        return platformKind;
-    }
-}
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/LineNumberTable.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +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.graal.api.meta;
-
-public interface LineNumberTable {
-
-    int[] getLineNumberEntries();
-
-    int[] getBciEntries();
-
-    int getLineNumber(int bci);
-}
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/LineNumberTableImpl.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +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.graal.api.meta;
-
-public class LineNumberTableImpl implements LineNumberTable {
-
-    private final int[] lineNumbers;
-    private final int[] bci;
-
-    public LineNumberTableImpl(int[] lineNumbers, int[] bci) {
-        this.lineNumbers = lineNumbers;
-        this.bci = bci;
-    }
-
-    @Override
-    public int[] getLineNumberEntries() {
-        return lineNumbers;
-    }
-
-    @Override
-    public int[] getBciEntries() {
-        return bci;
-    }
-
-    @Override
-    public int getLineNumber(@SuppressWarnings("hiding") int bci) {
-        for (int i = 0; i < this.bci.length - 1; i++) {
-            if (this.bci[i] <= bci && bci < this.bci[i + 1]) {
-                return lineNumbers[i];
-            }
-        }
-        return lineNumbers[lineNumbers.length - 1];
-    }
-}
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Local.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +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.graal.api.meta;
-
-public interface Local {
-
-    int getStartBCI();
-
-    int getEndBCI();
-
-    int getSlot();
-
-    String getName();
-
-    JavaType getType();
-}
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/LocalImpl.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,84 +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.graal.api.meta;
-
-public class LocalImpl implements Local {
-
-    private final String name;
-    private final int startBci;
-    private final int endBci;
-    private final int slot;
-    private final JavaType type;
-
-    public LocalImpl(String name, JavaType type, int startBci, int endBci, int slot) {
-        this.name = name;
-        this.startBci = startBci;
-        this.endBci = endBci;
-        this.slot = slot;
-        this.type = type;
-    }
-
-    @Override
-    public int getStartBCI() {
-        return startBci;
-    }
-
-    @Override
-    public int getEndBCI() {
-        return endBci;
-    }
-
-    @Override
-    public String getName() {
-        return name;
-    }
-
-    @Override
-    public JavaType getType() {
-        return type;
-    }
-
-    @Override
-    public int getSlot() {
-        return slot;
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (!(obj instanceof LocalImpl)) {
-            return false;
-        }
-        LocalImpl that = (LocalImpl) obj;
-        return this.name.equals(that.name) && this.startBci == that.startBci && this.endBci == that.endBci && this.slot == that.slot && this.type.equals(that.type);
-    }
-
-    @Override
-    public int hashCode() {
-        return super.hashCode();
-    }
-
-    @Override
-    public String toString() {
-        return "LocalImpl<name=" + name + ", type=" + type + ", startBci=" + startBci + ", endBci=" + endBci + ", slot=" + slot + ">";
-    }
-}
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/LocalVariableTable.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +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.graal.api.meta;
-
-public interface LocalVariableTable {
-
-    Local[] getLocals();
-
-    Local[] getLocalsAt(int bci);
-
-    Local getLocal(int slot, int bci);
-}
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/LocalVariableTableImpl.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +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.graal.api.meta;
-
-import java.util.*;
-
-public class LocalVariableTableImpl implements LocalVariableTable {
-
-    private final Local[] locals;
-
-    public LocalVariableTableImpl(Local[] locals) {
-        this.locals = locals;
-    }
-
-    @Override
-    public Local getLocal(int slot, int bci) {
-        Local result = null;
-        for (Local local : locals) {
-            if (local.getSlot() == slot && local.getStartBCI() <= bci && local.getEndBCI() >= bci) {
-                if (result == null) {
-                    result = local;
-                } else {
-                    throw new IllegalStateException("Locals overlap!");
-                }
-            }
-        }
-        return result;
-    }
-
-    @Override
-    public Local[] getLocals() {
-        return locals;
-    }
-
-    @Override
-    public Local[] getLocalsAt(int bci) {
-        List<Local> result = new ArrayList<>();
-        for (Local l : locals) {
-            if (l.getStartBCI() <= bci && bci <= l.getEndBCI()) {
-                result.add(l);
-            }
-        }
-        return result.toArray(new Local[result.size()]);
-    }
-
-}
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/LocationIdentity.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,82 +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.graal.api.meta;
-
-import java.util.*;
-
-// JaCoCo Exclude
-
-/**
- * Marker interface for location identities. Apart from the special values {@link #ANY_LOCATION} and
- * {@link #FINAL_LOCATION}, a different location identity of two memory accesses guarantees that the
- * two accesses do not interfere.
- *
- * Clients of {@link LocationIdentity} must use {@link #equals(Object)}, not {@code ==}, when
- * comparing two {@link LocationIdentity} values for equality. Likewise, they must not use
- * {@link IdentityHashMap}s with {@link LocationIdentity} values as keys.
- */
-public abstract class LocationIdentity {
-
-    /**
-     * Denotes any location. A write to such a location kills all values in a memory map during an
-     * analysis of memory accesses. A read from this location cannot be moved or coalesced with
-     * other reads because its interaction with other reads is not known.
-     */
-    private static final LocationIdentity ANY_LOCATION = NamedLocationIdentity.mutable("ANY_LOCATION");
-
-    /**
-     * Denotes the location of a value that is guaranteed to be unchanging.
-     */
-    public static final LocationIdentity FINAL_LOCATION = NamedLocationIdentity.immutable("FINAL_LOCATION");
-
-    /**
-     * Denotes the location of the length field of a Java array.
-     */
-    public static final LocationIdentity ARRAY_LENGTH_LOCATION = NamedLocationIdentity.immutable("[].length");
-
-    public static LocationIdentity any() {
-        return ANY_LOCATION;
-    }
-
-    /**
-     * Denotes a location is unchanging in all cases. Not that this is different than the Java
-     * notion of final which only requires definite assignment.
-     */
-    public abstract boolean isImmutable();
-
-    public final boolean isMutable() {
-        return !isImmutable();
-    }
-
-    public final boolean isAny() {
-        return this == ANY_LOCATION;
-    }
-
-    public final boolean isSingle() {
-        return this != ANY_LOCATION;
-    }
-
-    public final boolean overlaps(LocationIdentity other) {
-        return isAny() || other.isAny() || this.equals(other);
-    }
-}
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/MemoryAccessProvider.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.api.meta;
-
-/**
- * Provides memory access operations for the target VM.
- */
-public interface MemoryAccessProvider {
-
-    /**
-     * Reads a value of this kind using a base address and a displacement. No bounds checking or
-     * type checking is performed. Returns {@code null} if the value is not available at this point.
-     *
-     * @param base the base address from which the value is read.
-     * @param displacement the displacement within the object in bytes
-     * @return the read value encapsulated in a {@link JavaConstant} object, or {@code null} if the
-     *         value cannot be read.
-     */
-    JavaConstant readUnsafeConstant(Kind kind, JavaConstant base, long displacement);
-
-    /**
-     * Reads a primitive value using a base address and a displacement.
-     *
-     * @param kind the {@link Kind} of the returned {@link JavaConstant} object
-     * @param base the base address from which the value is read
-     * @param displacement the displacement within the object in bytes
-     * @param bits the number of bits to read from memory
-     * @return the read value encapsulated in a {@link JavaConstant} object of {@link Kind} kind
-     */
-    JavaConstant readPrimitiveConstant(Kind kind, Constant base, long displacement, int bits);
-
-    /**
-     * Reads a Java {@link Object} value using a base address and a displacement.
-     *
-     * @param base the base address from which the value is read
-     * @param displacement the displacement within the object in bytes
-     * @return the read value encapsulated in a {@link Constant} object
-     */
-    JavaConstant readObjectConstant(Constant base, long displacement);
-}
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/MetaAccessProvider.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,104 +0,0 @@
-/*
- * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.api.meta;
-
-import java.lang.reflect.*;
-
-/**
- * Provides access to the metadata of a class typically provided in a class file.
- */
-public interface MetaAccessProvider {
-
-    /**
-     * Returns the resolved Java type representing a given Java class.
-     *
-     * @param clazz the Java class object
-     * @return the resolved Java type object
-     */
-    ResolvedJavaType lookupJavaType(Class<?> clazz);
-
-    /**
-     * Returns the resolved Java types representing some given Java classes.
-     *
-     * @param classes the Java class objects
-     * @return the resolved Java type objects
-     */
-    default ResolvedJavaType[] lookupJavaTypes(Class<?>[] classes) {
-        ResolvedJavaType[] result = new ResolvedJavaType[classes.length];
-        for (int i = 0; i < result.length; i++) {
-            result[i] = lookupJavaType(classes[i]);
-        }
-        return result;
-    }
-
-    /**
-     * Provides the {@link ResolvedJavaMethod} for a {@link Method} or {@link Constructor} obtained
-     * via reflection.
-     */
-    ResolvedJavaMethod lookupJavaMethod(Executable reflectionMethod);
-
-    /**
-     * Provides the {@link ResolvedJavaField} for a {@link Field} obtained via reflection.
-     */
-    ResolvedJavaField lookupJavaField(Field reflectionField);
-
-    /**
-     * Returns the resolved Java type of the given {@link JavaConstant} object.
-     *
-     * @return {@code null} if {@code constant.isNull() || !constant.kind.isObject()}
-     */
-    ResolvedJavaType lookupJavaType(JavaConstant constant);
-
-    /**
-     * Returns the number of bytes occupied by this constant value or constant object.
-     *
-     * @param constant the constant whose bytes should be measured
-     * @return the number of bytes occupied by this constant
-     */
-    long getMemorySize(JavaConstant constant);
-
-    /**
-     * Parses a <a
-     * href="http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.3.3">method
-     * descriptor</a> into a {@link Signature}. The behavior of this method is undefined if the
-     * method descriptor is not well formed.
-     */
-    Signature parseMethodDescriptor(String methodDescriptor);
-
-    /**
-     * Encodes a deoptimization action and a deoptimization reason in an integer value.
-     *
-     * @param debugId an integer that can be used to track the origin of a deoptimization at
-     *            runtime. There is no guarantee that the runtime will use this value. The runtime
-     *            may even keep fewer than 32 bits.
-     *
-     * @return the encoded value as an integer
-     */
-    JavaConstant encodeDeoptActionAndReason(DeoptimizationAction action, DeoptimizationReason reason, int debugId);
-
-    DeoptimizationReason decodeDeoptReason(JavaConstant constant);
-
-    DeoptimizationAction decodeDeoptAction(JavaConstant constant);
-
-    int decodeDebugId(JavaConstant constant);
-}
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/MetaUtil.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,341 +0,0 @@
-/*
- * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.api.meta;
-
-import java.io.*;
-import java.util.*;
-
-/**
- * Miscellaneous collection of utility methods used by {@code com.oracle.graal.api.meta} and its
- * clients.
- */
-public class MetaUtil {
-
-    private static class ClassInfo {
-        public long totalSize;
-        public long instanceCount;
-
-        @Override
-        public String toString() {
-            return "totalSize=" + totalSize + ", instanceCount=" + instanceCount;
-        }
-    }
-
-    /**
-     * Returns the number of bytes occupied by this constant value or constant object and
-     * recursively all values reachable from this value.
-     *
-     * @param constant the constant whose bytes should be measured
-     * @param printTopN print total size and instance count of the top n classes is desired
-     * @return the number of bytes occupied by this constant
-     */
-    public static long getMemorySizeRecursive(MetaAccessProvider access, ConstantReflectionProvider constantReflection, JavaConstant constant, PrintStream out, int printTopN) {
-        Set<JavaConstant> marked = new HashSet<>();
-        Deque<JavaConstant> stack = new ArrayDeque<>();
-        if (constant.getKind() == Kind.Object && constant.isNonNull()) {
-            marked.add(constant);
-        }
-        final HashMap<ResolvedJavaType, ClassInfo> histogram = new HashMap<>();
-        stack.push(constant);
-        long sum = 0;
-        while (!stack.isEmpty()) {
-            JavaConstant c = stack.pop();
-            long memorySize = access.getMemorySize(constant);
-            sum += memorySize;
-            if (c.getKind() == Kind.Object && c.isNonNull()) {
-                ResolvedJavaType clazz = access.lookupJavaType(c);
-                if (!histogram.containsKey(clazz)) {
-                    histogram.put(clazz, new ClassInfo());
-                }
-                ClassInfo info = histogram.get(clazz);
-                info.instanceCount++;
-                info.totalSize += memorySize;
-                ResolvedJavaType type = access.lookupJavaType(c);
-                if (type.isArray()) {
-                    if (!type.getComponentType().isPrimitive()) {
-                        int length = constantReflection.readArrayLength(c);
-                        for (int i = 0; i < length; i++) {
-                            JavaConstant value = constantReflection.readArrayElement(c, i);
-                            pushConstant(marked, stack, value);
-                        }
-                    }
-                } else {
-                    ResolvedJavaField[] instanceFields = type.getInstanceFields(true);
-                    for (ResolvedJavaField f : instanceFields) {
-                        if (f.getKind() == Kind.Object) {
-                            JavaConstant value = constantReflection.readFieldValue(f, c);
-                            pushConstant(marked, stack, value);
-                        }
-                    }
-                }
-            }
-        }
-        ArrayList<ResolvedJavaType> clazzes = new ArrayList<>();
-        clazzes.addAll(histogram.keySet());
-        Collections.sort(clazzes, new Comparator<ResolvedJavaType>() {
-
-            @Override
-            public int compare(ResolvedJavaType o1, ResolvedJavaType o2) {
-                long l1 = histogram.get(o1).totalSize;
-                long l2 = histogram.get(o2).totalSize;
-                if (l1 > l2) {
-                    return -1;
-                } else if (l1 == l2) {
-                    return 0;
-                } else {
-                    return 1;
-                }
-            }
-        });
-
-        int z = 0;
-        for (ResolvedJavaType c : clazzes) {
-            if (z > printTopN) {
-                break;
-            }
-            out.println("Class " + c + ", " + histogram.get(c));
-            ++z;
-        }
-
-        return sum;
-    }
-
-    private static void pushConstant(Set<JavaConstant> marked, Deque<JavaConstant> stack, JavaConstant value) {
-        if (value.isNonNull()) {
-            if (!marked.contains(value)) {
-                marked.add(value);
-                stack.push(value);
-            }
-        }
-    }
-
-    /**
-     * Calls {@link JavaType#resolve(ResolvedJavaType)} on an array of types.
-     */
-    public static ResolvedJavaType[] resolveJavaTypes(JavaType[] types, ResolvedJavaType accessingClass) {
-        ResolvedJavaType[] result = new ResolvedJavaType[types.length];
-        for (int i = 0; i < result.length; i++) {
-            result[i] = types[i].resolve(accessingClass);
-        }
-        return result;
-    }
-
-    /**
-     * Extends the functionality of {@link Class#getSimpleName()} to include a non-empty string for
-     * anonymous and local classes.
-     *
-     * @param clazz the class for which the simple name is being requested
-     * @param withEnclosingClass specifies if the returned name should be qualified with the name(s)
-     *            of the enclosing class/classes of {@code clazz} (if any). This option is ignored
-     *            if {@code clazz} denotes an anonymous or local class.
-     * @return the simple name
-     */
-    public static String getSimpleName(Class<?> clazz, boolean withEnclosingClass) {
-        final String simpleName = clazz.getSimpleName();
-        if (simpleName.length() != 0) {
-            if (withEnclosingClass) {
-                String prefix = "";
-                Class<?> enclosingClass = clazz;
-                while ((enclosingClass = enclosingClass.getEnclosingClass()) != null) {
-                    prefix = enclosingClass.getSimpleName() + "." + prefix;
-                }
-                return prefix + simpleName;
-            }
-            return simpleName;
-        }
-        // Must be an anonymous or local class
-        final String name = clazz.getName();
-        int index = name.indexOf('$');
-        if (index == -1) {
-            return name;
-        }
-        index = name.lastIndexOf('.', index);
-        if (index == -1) {
-            return name;
-        }
-        return name.substring(index + 1);
-    }
-
-    static String internalNameToJava(String name, boolean qualified, boolean classForNameCompatible) {
-        switch (name.charAt(0)) {
-            case 'L': {
-                String result = name.substring(1, name.length() - 1).replace('/', '.');
-                if (!qualified) {
-                    final int lastDot = result.lastIndexOf('.');
-                    if (lastDot != -1) {
-                        result = result.substring(lastDot + 1);
-                    }
-                }
-                return result;
-            }
-            case '[':
-                return classForNameCompatible ? name.replace('/', '.') : internalNameToJava(name.substring(1), qualified, classForNameCompatible) + "[]";
-            default:
-                if (name.length() != 1) {
-                    throw new IllegalArgumentException("Illegal internal name: " + name);
-                }
-                return Kind.fromPrimitiveOrVoidTypeChar(name.charAt(0)).getJavaName();
-        }
-    }
-
-    /**
-     * Turns an class name in internal format into a resolved Java type.
-     */
-    public static ResolvedJavaType classForName(String internal, MetaAccessProvider metaAccess, ClassLoader cl) {
-        Kind k = Kind.fromTypeString(internal);
-        try {
-            String n = internalNameToJava(internal, true, true);
-            return metaAccess.lookupJavaType(k.isPrimitive() ? k.toJavaClass() : Class.forName(n, true, cl));
-        } catch (ClassNotFoundException cnfe) {
-            throw new IllegalArgumentException("could not instantiate class described by " + internal, cnfe);
-        }
-    }
-
-    /**
-     * Convenient shortcut for calling
-     * {@link #appendLocation(StringBuilder, ResolvedJavaMethod, int)} without having to supply a
-     * {@link StringBuilder} instance and convert the result to a string.
-     */
-    public static String toLocation(ResolvedJavaMethod 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 ResolvedJavaMethod#asStackTraceElement(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 applying {@link JavaMethod#format(String)}
-     * with the format string {@code "%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
-     */
-    public static StringBuilder appendLocation(StringBuilder sb, ResolvedJavaMethod method, int bci) {
-        if (method != null) {
-            StackTraceElement ste = method.asStackTraceElement(bci);
-            if (ste.getFileName() != null && ste.getLineNumber() > 0) {
-                sb.append(ste);
-            } else {
-                sb.append(method.format("%H.%n(%p)"));
-            }
-        } else {
-            sb.append("Null method");
-        }
-        return sb.append(" [bci: ").append(bci).append(']');
-    }
-
-    static void appendProfile(StringBuilder buf, AbstractJavaProfile<?, ?> profile, int bci, String type, String sep) {
-        if (profile != null) {
-            AbstractProfiledItem<?>[] pitems = profile.getItems();
-            if (pitems != null) {
-                buf.append(String.format("%s@%d:", type, bci));
-                for (int j = 0; j < pitems.length; j++) {
-                    AbstractProfiledItem<?> pitem = pitems[j];
-                    buf.append(String.format(" %.6f (%s)%s", pitem.getProbability(), pitem.getItem(), sep));
-                }
-                if (profile.getNotRecordedProbability() != 0) {
-                    buf.append(String.format(" %.6f <other %s>%s", profile.getNotRecordedProbability(), type, sep));
-                } else {
-                    buf.append(String.format(" <no other %s>%s", type, sep));
-                }
-            }
-        }
-    }
-
-    /**
-     * 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) {
-        String prefix = "";
-        String base = className;
-        while (base.endsWith("[]")) {
-            prefix += "[";
-            base = base.substring(base.length() - 2);
-        }
-
-        switch (className) {
-            case "boolean":
-                return prefix + "Z";
-            case "byte":
-                return prefix + "B";
-            case "short":
-                return prefix + "S";
-            case "char":
-                return prefix + "C";
-            case "int":
-                return prefix + "I";
-            case "float":
-                return prefix + "F";
-            case "long":
-                return prefix + "J";
-            case "double":
-                return prefix + "D";
-            case "void":
-                return prefix + "V";
-            default:
-                return prefix + "L" + className.replace('.', '/') + ";";
-        }
-    }
-
-    /**
-     * 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);
-    }
-
-    /**
-     * Gets a string representation of an object based soley on its class and its
-     * {@linkplain System#identityHashCode(Object) identity hash code}. This avoids and calls to
-     * virtual methods on the object such as {@link Object#hashCode()}.
-     */
-    public static String identityHashCodeString(Object obj) {
-        if (obj == null) {
-            return "null";
-        }
-        return obj.getClass().getName() + "@" + System.identityHashCode(obj);
-    }
-}
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/MethodHandleAccessProvider.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,76 +0,0 @@
-/*
- * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.api.meta;
-
-import java.lang.invoke.*;
-
-/**
- * Interface to access the internals of the {@link MethodHandle} implementation of the VM. An
- * implementation of this interface is usually required to access non-public classes, methods, and
- * fields of {@link MethodHandle}, i.e., data that is not standardized by the Java specification.
- */
-public interface MethodHandleAccessProvider {
-
-    /**
-     * Identification for methods defined on the class {@link MethodHandle} that are processed by
-     * the {@link MethodHandleAccessProvider}.
-     */
-    public enum IntrinsicMethod {
-        /** The method {@code MethodHandle.invokeBasic}. */
-        INVOKE_BASIC,
-        /** The method {@code MethodHandle.linkToStatic}. */
-        LINK_TO_STATIC,
-        /** The method {@code MethodHandle.linkToSpecial}. */
-        LINK_TO_SPECIAL,
-        /** The method {@code MethodHandle.linkToVirtual}. */
-        LINK_TO_VIRTUAL,
-        /** The method {@code MethodHandle.linkToInterface}. */
-        LINK_TO_INTERFACE
-    }
-
-    /**
-     * Returns the method handle method intrinsic identifier for the provided method, or
-     * {@code null} if the method is not an intrinsic processed by this interface.
-     */
-    IntrinsicMethod lookupMethodHandleIntrinsic(ResolvedJavaMethod method);
-
-    /**
-     * Resolves the invocation target for an invocation of {@link IntrinsicMethod#INVOKE_BASIC
-     * MethodHandle.invokeBasic} with the given constant receiver {@link MethodHandle}. Returns
-     * {@code null} if the invocation target is not available at this time.
-     * <p>
-     * The first invocations of a method handle can use an interpreter to lookup the actual invoked
-     * method; frequently executed method handles can use Java bytecode generation to avoid the
-     * interpreter overhead. If the parameter forceBytecodeGeneration is set to true, the VM should
-     * try to generate bytecodes before this method returns.
-     */
-    ResolvedJavaMethod resolveInvokeBasicTarget(JavaConstant methodHandle, boolean forceBytecodeGeneration);
-
-    /**
-     * Resolves the invocation target for an invocation of a {@code MethodHandle.linkTo*} method
-     * with the given constant member name. The member name is the last parameter of the
-     * {@code linkTo*} method. Returns {@code null} if the invocation target is not available at
-     * this time.
-     */
-    ResolvedJavaMethod resolveLinkToTarget(JavaConstant memberName);
-}
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ModifiersProvider.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,140 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.api.meta;
-
-import static java.lang.reflect.Modifier.*;
-
-import java.lang.reflect.*;
-
-/**
- * A Java element (i.e., a class, interface, field or method) that is described by a set of Java
- * language {@linkplain #getModifiers() modifiers}.
- */
-public interface ModifiersProvider {
-
-    /**
-     * Returns the Java language modifiers for this element.
-     */
-    int getModifiers();
-
-    /**
-     * @see Modifier#isInterface(int)
-     */
-    default boolean isInterface() {
-        return Modifier.isInterface(getModifiers());
-    }
-
-    /**
-     * @see Modifier#isSynchronized(int)
-     */
-    default boolean isSynchronized() {
-        return Modifier.isSynchronized(getModifiers());
-    }
-
-    /**
-     * @see Modifier#isStatic(int)
-     */
-    default boolean isStatic() {
-        return Modifier.isStatic(getModifiers());
-    }
-
-    /**
-     * @see Modifier#isFinal(int)
-     */
-    default boolean isFinal() {
-        return Modifier.isFinal(getModifiers());
-    }
-
-    /**
-     * @see Modifier#isPublic(int)
-     */
-    default boolean isPublic() {
-        return Modifier.isPublic(getModifiers());
-    }
-
-    /**
-     * Determines if this element is neither {@linkplain #isPublic() public},
-     * {@linkplain #isProtected() protected} nor {@linkplain #isPrivate() private}.
-     */
-    default boolean isPackagePrivate() {
-        return ((PUBLIC | PROTECTED | PRIVATE) & getModifiers()) == 0;
-    }
-
-    /**
-     * @see Modifier#isPrivate(int)
-     */
-    default boolean isPrivate() {
-        return Modifier.isPrivate(getModifiers());
-    }
-
-    /**
-     * @see Modifier#isProtected(int)
-     */
-    default boolean isProtected() {
-        return Modifier.isProtected(getModifiers());
-    }
-
-    /**
-     * @see Modifier#isTransient(int)
-     */
-    default boolean isTransient() {
-        return Modifier.isTransient(getModifiers());
-    }
-
-    /**
-     * @see Modifier#isStrict(int)
-     */
-    default boolean isStrict() {
-        return Modifier.isStrict(getModifiers());
-    }
-
-    /**
-     * @see Modifier#isVolatile(int)
-     */
-    default boolean isVolatile() {
-        return Modifier.isVolatile(getModifiers());
-    }
-
-    /**
-     * @see Modifier#isNative(int)
-     */
-    default boolean isNative() {
-        return Modifier.isNative(getModifiers());
-    }
-
-    /**
-     * @see Modifier#isAbstract(int)
-     */
-    default boolean isAbstract() {
-        return Modifier.isAbstract(getModifiers());
-    }
-
-    /**
-     * Checks that the method is concrete and not abstract.
-     *
-     * @return whether the method is a concrete method
-     */
-    default boolean isConcrete() {
-        return !isAbstract();
-    }
-}
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/NamedLocationIdentity.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,118 +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.graal.api.meta;
-
-import java.util.*;
-
-import com.oracle.graal.api.meta.Kind.FormatWithToString;
-
-/**
- * A {@link LocationIdentity} with a name.
- */
-public final class NamedLocationIdentity extends LocationIdentity implements FormatWithToString {
-
-    /**
-     * Map for asserting all {@link NamedLocationIdentity} instances have a unique name.
-     */
-    static class DB {
-        private static final HashMap<String, NamedLocationIdentity> map = new HashMap<>();
-
-        static boolean checkUnique(NamedLocationIdentity identity) {
-            NamedLocationIdentity oldValue = map.put(identity.name, identity);
-            if (oldValue != null) {
-                throw new AssertionError("identity " + identity + " already exists");
-            }
-            return true;
-        }
-    }
-
-    private final String name;
-    private final boolean immutable;
-
-    private NamedLocationIdentity(String name, boolean immutable) {
-        this.name = name;
-        this.immutable = immutable;
-    }
-
-    /**
-     * Creates a named unique location identity for read and write operations against mutable
-     * memory.
-     *
-     * @param name the name of the new location identity
-     */
-    public static NamedLocationIdentity mutable(String name) {
-        return create(name, false);
-    }
-
-    /**
-     * Creates a named unique location identity for read operations against immutable memory.
-     * Immutable memory will never have a visible write in the graph, which is more restictive than
-     * Java final.
-     *
-     * @param name the name of the new location identity
-     */
-    public static NamedLocationIdentity immutable(String name) {
-        return create(name, true);
-    }
-
-    /**
-     * Creates a named unique location identity for read and write operations.
-     *
-     * @param name the name of the new location identity
-     * @param immutable true if the location is immutable
-     */
-    private static NamedLocationIdentity create(String name, boolean immutable) {
-        NamedLocationIdentity id = new NamedLocationIdentity(name, immutable);
-        assert DB.checkUnique(id);
-        return id;
-    }
-
-    @Override
-    public boolean isImmutable() {
-        return immutable;
-    }
-
-    @Override
-    public String toString() {
-        return name + (isImmutable() ? ":final" : "");
-    }
-
-    /**
-     * Returns the named location identity for an array of the given element kind. Array accesses of
-     * the same kind must have the same location identity unless an alias analysis guarantees that
-     * two distinct arrays are accessed.
-     */
-    public static LocationIdentity getArrayLocation(Kind elementKind) {
-        return ARRAY_LOCATIONS.get(elementKind);
-    }
-
-    private static final EnumMap<Kind, LocationIdentity> ARRAY_LOCATIONS = initArrayLocations();
-
-    private static EnumMap<Kind, LocationIdentity> initArrayLocations() {
-        EnumMap<Kind, LocationIdentity> result = new EnumMap<>(Kind.class);
-        for (Kind kind : Kind.values()) {
-            result.put(kind, NamedLocationIdentity.mutable("Array: " + kind.getJavaName()));
-        }
-        return result;
-    }
-}
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/NullConstant.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,93 +0,0 @@
-/*
- * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.api.meta;
-
-/**
- * The implementation type of the {@link JavaConstant#NULL_POINTER null constant}.
- */
-final class NullConstant extends AbstractValue implements JavaConstant {
-
-    protected NullConstant() {
-        super(LIRKind.reference(Kind.Object));
-    }
-
-    @Override
-    public boolean isNull() {
-        return true;
-    }
-
-    @Override
-    public boolean isDefaultForKind() {
-        return true;
-    }
-
-    @Override
-    public Object asBoxedPrimitive() {
-        throw new IllegalArgumentException();
-    }
-
-    @Override
-    public int asInt() {
-        throw new IllegalArgumentException();
-    }
-
-    @Override
-    public boolean asBoolean() {
-        throw new IllegalArgumentException();
-    }
-
-    @Override
-    public long asLong() {
-        throw new IllegalArgumentException();
-    }
-
-    @Override
-    public float asFloat() {
-        throw new IllegalArgumentException();
-    }
-
-    @Override
-    public double asDouble() {
-        throw new IllegalArgumentException();
-    }
-
-    @Override
-    public String toString() {
-        return JavaConstant.toString(this);
-    }
-
-    @Override
-    public String toValueString() {
-        return "null";
-    }
-
-    @Override
-    public int hashCode() {
-        return 13;
-    }
-
-    @Override
-    public boolean equals(Object o) {
-        return o instanceof NullConstant;
-    }
-}
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/PlatformKind.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,74 +0,0 @@
-/*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.api.meta;
-
-/**
- * Represents a platform-specific low-level type for values.
- */
-public interface PlatformKind {
-
-    String name();
-
-    JavaConstant getDefaultValue();
-
-    public interface Key {
-
-    }
-
-    public class EnumKey implements Key {
-        @SuppressWarnings("rawtypes") private final Enum e;
-
-        @SuppressWarnings("rawtypes")
-        public EnumKey(Enum e) {
-            this.e = e;
-        }
-
-        @Override
-        public int hashCode() {
-            return e.ordinal() ^ e.name().hashCode();
-        }
-
-        @Override
-        public boolean equals(Object obj) {
-            if (obj == this) {
-                return true;
-            }
-            if (obj instanceof EnumKey) {
-                EnumKey that = (EnumKey) obj;
-                return this.e == that.e;
-            }
-            return false;
-        }
-    }
-
-    /**
-     * Gets a value associated with this object that can be used as a stable key in a map. The
-     * {@link Object#hashCode()} implementation of the returned value should be stable between VM
-     * executions.
-     */
-    Key getKey();
-
-    default int getVectorLength() {
-        return 1;
-    }
-}
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/PrimitiveConstant.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,164 +0,0 @@
-/*
- * Copyright (c) 2009, 2015, 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.meta;
-
-import java.nio.*;
-
-/**
- * Represents a primitive constant value, such as an integer or floating point number, within the
- * compiler and across the compiler/runtime interface.
- */
-public class PrimitiveConstant extends AbstractValue implements JavaConstant, SerializableConstant {
-
-    /**
-     * The boxed primitive value as a {@code long}. For {@code float} and {@code double} values,
-     * this value is the result of {@link Float#floatToRawIntBits(float)} and
-     * {@link Double#doubleToRawLongBits(double)} respectively.
-     */
-    private final long primitive;
-
-    protected PrimitiveConstant(Kind kind, long primitive) {
-        super(LIRKind.value(kind));
-        this.primitive = primitive;
-
-        assert kind.isPrimitive() || kind == Kind.Illegal;
-    }
-
-    @Override
-    public boolean isNull() {
-        return false;
-    }
-
-    @Override
-    public boolean isDefaultForKind() {
-        return primitive == 0;
-    }
-
-    @Override
-    public boolean asBoolean() {
-        assert getKind() == Kind.Boolean;
-        return primitive != 0L;
-    }
-
-    @Override
-    public int asInt() {
-        assert getKind().getStackKind() == Kind.Int : getKind().getStackKind();
-        return (int) primitive;
-    }
-
-    @Override
-    public long asLong() {
-        assert getKind().isNumericInteger();
-        return primitive;
-    }
-
-    @Override
-    public float asFloat() {
-        assert getKind() == Kind.Float;
-        return Float.intBitsToFloat((int) primitive);
-    }
-
-    @Override
-    public double asDouble() {
-        assert getKind() == Kind.Double;
-        return Double.longBitsToDouble(primitive);
-    }
-
-    @Override
-    public Object asBoxedPrimitive() {
-        switch (getKind()) {
-            case Byte:
-                return Byte.valueOf((byte) primitive);
-            case Boolean:
-                return Boolean.valueOf(asBoolean());
-            case Short:
-                return Short.valueOf((short) primitive);
-            case Char:
-                return Character.valueOf((char) primitive);
-            case Int:
-                return Integer.valueOf(asInt());
-            case Long:
-                return Long.valueOf(asLong());
-            case Float:
-                return Float.valueOf(asFloat());
-            case Double:
-                return Double.valueOf(asDouble());
-            default:
-                throw new IllegalArgumentException("unexpected kind " + getKind());
-        }
-    }
-
-    @Override
-    public int getSerializedSize() {
-        return getKind().getByteCount();
-    }
-
-    @Override
-    public void serialize(ByteBuffer buffer) {
-        switch (getKind()) {
-            case Byte:
-            case Boolean:
-                buffer.put((byte) primitive);
-                break;
-            case Short:
-                buffer.putShort((short) primitive);
-                break;
-            case Char:
-                buffer.putChar((char) primitive);
-                break;
-            case Int:
-                buffer.putInt(asInt());
-                break;
-            case Long:
-                buffer.putLong(asLong());
-                break;
-            case Float:
-                buffer.putFloat(asFloat());
-                break;
-            case Double:
-                buffer.putDouble(asDouble());
-                break;
-            default:
-                throw new IllegalArgumentException("unexpected kind " + getKind());
-        }
-    }
-
-    @Override
-    public int hashCode() {
-        return (int) (primitive ^ (primitive >>> 32)) * (getKind().ordinal() + 31);
-    }
-
-    @Override
-    public boolean equals(Object o) {
-        return o == this || (o instanceof PrimitiveConstant && super.equals(o) && primitive == ((PrimitiveConstant) o).primitive);
-    }
-
-    @Override
-    public String toString() {
-        if (getKind() == Kind.Illegal) {
-            return "illegal";
-        } else {
-            return getKind().getJavaName() + "[" + asBoxedPrimitive() + "|0x" + Long.toHexString(primitive) + "]";
-        }
-    }
-}
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ProfilingInfo.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,199 +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.graal.api.meta;
-
-/**
- * Provides access to the profiling information of one specific method. Every accessor method
- * returns the information that is available at the time of invocation. If a method is invoked
- * multiple times, it may return significantly different results for every invocation as the
- * profiling information may be changed by other Java threads at any time.
- */
-public interface ProfilingInfo {
-
-    /**
-     * Returns the length of the bytecodes associated with this profile.
-     */
-    int getCodeSize();
-
-    /**
-     * Returns an estimate of how often the branch at the given byte code was taken.
-     *
-     * @return The estimated probability, with 0.0 meaning never and 1.0 meaning always, or -1 if
-     *         this information is not available.
-     */
-    double getBranchTakenProbability(int bci);
-
-    /**
-     * Returns an estimate of how often the switch cases are taken at the given BCI. The default
-     * case is stored as the last entry.
-     *
-     * @return A double value that contains the estimated probabilities, with 0.0 meaning never and
-     *         1.0 meaning always, or -1 if this information is not available.
-     */
-    double[] getSwitchProbabilities(int bci);
-
-    /**
-     * Returns the TypeProfile for the given BCI.
-     *
-     * @return Returns a JavaTypeProfile object, or null if not available.
-     */
-    JavaTypeProfile getTypeProfile(int bci);
-
-    /**
-     * Returns the MethodProfile for the given BCI.
-     *
-     * @return Returns a JavaMethodProfile object, or null if not available.
-     */
-    JavaMethodProfile getMethodProfile(int bci);
-
-    /**
-     * Returns information if the given BCI did ever throw an exception.
-     *
-     * @return {@link TriState#TRUE} if the instruction has thrown an exception at least once,
-     *         {@link TriState#FALSE} if it never threw an exception, and {@link TriState#UNKNOWN}
-     *         if this information was not recorded.
-     */
-    TriState getExceptionSeen(int bci);
-
-    /**
-     * Returns information if null was ever seen for the given BCI. This information is collected
-     * for the aastore, checkcast and instanceof bytecodes.
-     *
-     * @return {@link TriState#TRUE} if null was seen for the instruction, {@link TriState#FALSE} if
-     *         null was NOT seen, and {@link TriState#UNKNOWN} if this information was not recorded.
-     */
-    TriState getNullSeen(int bci);
-
-    /**
-     * Returns an estimate how often the current BCI was executed. Avoid comparing execution counts
-     * to each other, as the returned value highly depends on the time of invocation.
-     *
-     * @return the estimated execution count or -1 if not available.
-     */
-    int getExecutionCount(int bci);
-
-    /**
-     * Returns how frequently a method was deoptimized for the given deoptimization reason. This
-     * only indicates how often the method did fall back to the interpreter for the execution and
-     * does not indicate how often it was recompiled.
-     *
-     * @param reason the reason for which the number of deoptimizations should be queried
-     * @return the number of times the compiled method deoptimized for the given reason.
-     */
-    int getDeoptimizationCount(DeoptimizationReason reason);
-
-    /**
-     * Records the size of the compiler intermediate representation (IR) associated with this
-     * method.
-     *
-     * @param irType the IR type for which the size is being recorded
-     * @param irSize the IR size to be recorded. The unit depends on the IR.
-     * @return whether recording this information for {@code irType} is supported
-     */
-    boolean setCompilerIRSize(Class<?> irType, int irSize);
-
-    /**
-     * Gets the size of the compiler intermediate representation (IR) associated with this method
-     * last recorded by {@link #setCompilerIRSize(Class, int)}.
-     *
-     * @param irType the IR type for which the size is being requested
-     * @return the requested IR size or -1 if it is unavailable for {@code irType}
-     */
-    int getCompilerIRSize(Class<?> irType);
-
-    /**
-     * Returns true if the profiling information can be assumed as sufficiently accurate.
-     *
-     * @return true if the profiling information was recorded often enough mature enough, false
-     *         otherwise.
-     */
-    boolean isMature();
-
-    /**
-     * Force data to be treated as mature if possible.
-     */
-    void setMature();
-
-    /**
-     * Formats this profiling information to a string.
-     *
-     * @param method an optional method that augments the profile string returned
-     * @param sep the separator to use for each separate profile record
-     */
-    default String toString(ResolvedJavaMethod method, String sep) {
-        StringBuilder buf = new StringBuilder(100);
-        if (method != null) {
-            buf.append(String.format("canBeStaticallyBound: %b%s", method.canBeStaticallyBound(), sep));
-        }
-        for (int i = 0; i < getCodeSize(); i++) {
-            if (getExecutionCount(i) != -1) {
-                buf.append(String.format("executionCount@%d: %d%s", i, getExecutionCount(i), sep));
-            }
-
-            if (getBranchTakenProbability(i) != -1) {
-                buf.append(String.format("branchProbability@%d: %.6f%s", i, getBranchTakenProbability(i), sep));
-            }
-
-            double[] switchProbabilities = getSwitchProbabilities(i);
-            if (switchProbabilities != null) {
-                buf.append(String.format("switchProbabilities@%d:", i));
-                for (int j = 0; j < switchProbabilities.length; j++) {
-                    buf.append(String.format(" %.6f", switchProbabilities[j]));
-                }
-                buf.append(sep);
-            }
-
-            if (getExceptionSeen(i) != TriState.UNKNOWN) {
-                buf.append(String.format("exceptionSeen@%d: %s%s", i, getExceptionSeen(i).name(), sep));
-            }
-
-            if (getNullSeen(i) != TriState.UNKNOWN) {
-                buf.append(String.format("nullSeen@%d: %s%s", i, getNullSeen(i).name(), sep));
-            }
-
-            JavaTypeProfile typeProfile = getTypeProfile(i);
-            MetaUtil.appendProfile(buf, typeProfile, i, "types", sep);
-
-            JavaMethodProfile methodProfile = getMethodProfile(i);
-            MetaUtil.appendProfile(buf, methodProfile, i, "methods", sep);
-        }
-
-        boolean firstDeoptReason = true;
-        for (DeoptimizationReason reason : DeoptimizationReason.values()) {
-            int count = 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();
-        return s.substring(0, s.length() - sep.length());
-    }
-
-}
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/RawConstant.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.api.meta;
-
-public class RawConstant extends PrimitiveConstant {
-
-    public RawConstant(long rawValue) {
-        super(Kind.Int, rawValue);
-    }
-}
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ResolvedJavaField.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,75 +0,0 @@
-/*
- * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.api.meta;
-
-import java.lang.annotation.*;
-import java.lang.reflect.*;
-
-/**
- * Represents a reference to a resolved Java field. Fields, like methods and types, are resolved
- * through {@link ConstantPool constant pools}.
- */
-public interface ResolvedJavaField extends JavaField, ModifiersProvider {
-
-    /**
-     * {@inheritDoc}
-     * <p>
-     * Only the {@linkplain Modifier#fieldModifiers() field flags} specified in the JVM
-     * specification will be included in the returned mask.
-     */
-    int getModifiers();
-
-    /**
-     * Determines if this field was injected by the VM. Such a field, for example, is not derived
-     * from a class file.
-     */
-    boolean isInternal();
-
-    /**
-     * Determines if this field is a synthetic field as defined by the Java Language Specification.
-     */
-    boolean isSynthetic();
-
-    /**
-     * Returns the {@link ResolvedJavaType} object representing the class or interface that declares
-     * this field.
-     */
-    ResolvedJavaType getDeclaringClass();
-
-    /**
-     * Returns the annotation for the specified type of this field, if such an annotation is
-     * present.
-     *
-     * @param annotationClass the Class object corresponding to the annotation type
-     * @return this element's annotation for the specified annotation type if present on this field,
-     *         else {@code null}
-     */
-    <T extends Annotation> T getAnnotation(Class<T> annotationClass);
-
-    /**
-     * Returns an object representing the unique location identity of this resolved Java field.
-     * 
-     * @return the location identity of the field
-     */
-    LocationIdentity getLocationIdentity();
-}
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ResolvedJavaMethod.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,298 +0,0 @@
-/*
- * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.api.meta;
-
-import java.lang.annotation.*;
-import java.lang.reflect.*;
-
-/**
- * Represents a resolved Java method. Methods, like fields and types, are resolved through
- * {@link ConstantPool constant pools}.
- */
-public interface ResolvedJavaMethod extends JavaMethod, InvokeTarget, ModifiersProvider {
-
-    /**
-     * Returns the bytecode of this method, if the method has code. The returned byte array does not
-     * contain breakpoints or non-Java bytecodes. This may return null if the
-     * {@link #getDeclaringClass() holder} is not {@link ResolvedJavaType#isLinked() linked}.
-     *
-     * The contained constant pool indices may not be the ones found in the original class file but
-     * they can be used with the Graal API (e.g. methods in {@link ConstantPool}).
-     *
-     * @return the bytecode of the method, or {@code null} if {@code getCodeSize() == 0} or if the
-     *         code is not ready.
-     */
-    byte[] getCode();
-
-    /**
-     * Returns the size of the bytecode of this method, if the method has code. This is equivalent
-     * to {@link #getCode()}. {@code length} if the method has code.
-     *
-     * @return the size of the bytecode in bytes, or 0 if no bytecode is available
-     */
-    int getCodeSize();
-
-    /**
-     * Returns the {@link ResolvedJavaType} object representing the class or interface that declares
-     * this method.
-     */
-    ResolvedJavaType getDeclaringClass();
-
-    /**
-     * Returns the maximum number of locals used in this method's bytecodes.
-     */
-    int getMaxLocals();
-
-    /**
-     * Returns the maximum number of stack slots used in this method's bytecodes.
-     */
-    int getMaxStackSize();
-
-    /**
-     * {@inheritDoc}
-     * <p>
-     * Only the {@linkplain Modifier#methodModifiers() method flags} specified in the JVM
-     * specification will be included in the returned mask.
-     */
-    int getModifiers();
-
-    /**
-     * Determines if this method is a synthetic method as defined by the Java Language
-     * Specification.
-     */
-    boolean isSynthetic();
-
-    /**
-     * Returns {@code true} if this method is a default method; returns {@code false} otherwise.
-     *
-     * A default method is a public non-abstract instance method, that is, a non-static method with
-     * a body, declared in an interface type.
-     *
-     * @return true if and only if this method is a default method as defined by the Java Language
-     *         Specification.
-     */
-    boolean isDefault();
-
-    /**
-     * Checks whether this method is a class initializer.
-     *
-     * @return {@code true} if the method is a class initializer
-     */
-    boolean isClassInitializer();
-
-    /**
-     * Checks whether this method is a constructor.
-     *
-     * @return {@code true} if the method is a constructor
-     */
-    boolean isConstructor();
-
-    /**
-     * Checks whether this method can be statically bound (usually, that means it is final or
-     * private or static, but not abstract, or the declaring class is final).
-     *
-     * @return {@code true} if this method can be statically bound
-     */
-    boolean canBeStaticallyBound();
-
-    /**
-     * Returns the list of exception handlers for this method.
-     */
-    ExceptionHandler[] getExceptionHandlers();
-
-    /**
-     * Returns a stack trace element for this method and a given bytecode index.
-     */
-    StackTraceElement asStackTraceElement(int bci);
-
-    /**
-     * Returns an object that provides access to the profiling information recorded for this method.
-     */
-    ProfilingInfo getProfilingInfo();
-
-    /**
-     * Invalidates the profiling information and restarts profiling upon the next invocation.
-     */
-    void reprofile();
-
-    /**
-     * Returns the constant pool of this method.
-     */
-    ConstantPool getConstantPool();
-
-    /**
-     * Returns all annotations of this method. If no annotations are present, an array of length 0
-     * is returned.
-     */
-    Annotation[] getAnnotations();
-
-    /**
-     * Returns the annotation for the specified type of this method, if such an annotation is
-     * present.
-     *
-     * @param annotationClass the Class object corresponding to the annotation type
-     * @return this element's annotation for the specified annotation type if present on this
-     *         method, else {@code null}
-     */
-    <T extends Annotation> T getAnnotation(Class<T> annotationClass);
-
-    /**
-     * Returns an array of arrays that represent the annotations on the formal parameters, in
-     * declaration order, of this method.
-     *
-     * @see Method#getParameterAnnotations()
-     */
-    Annotation[][] getParameterAnnotations();
-
-    /**
-     * Returns an array of {@link Type} objects that represent the formal parameter types, in
-     * declaration order, of this method.
-     *
-     * @see Method#getGenericParameterTypes()
-     */
-    Type[] getGenericParameterTypes();
-
-    /**
-     * Returns {@code true} if this method is not excluded from inlining and has associated Java
-     * bytecodes (@see {@link ResolvedJavaMethod#hasBytecodes()}).
-     */
-    boolean canBeInlined();
-
-    /**
-     * Returns {@code true} if the inlining of this method should be forced.
-     */
-    boolean shouldBeInlined();
-
-    /**
-     * Returns the LineNumberTable of this method or null if this method does not have a line
-     * numbers table.
-     */
-    LineNumberTable getLineNumberTable();
-
-    /**
-     * Returns the local variable table of this method or null if this method does not have a local
-     * variable table.
-     */
-    LocalVariableTable getLocalVariableTable();
-
-    /**
-     * Invokes the underlying method represented by this object, on the specified object with the
-     * specified parameters. This method is similar to a reflective method invocation by
-     * {@link Method#invoke}.
-     *
-     * @param receiver The receiver for the invocation, or {@code null} if it is a static method.
-     * @param arguments The arguments for the invocation.
-     * @return The value returned by the method invocation, or {@code null} if the return type is
-     *         {@code void}.
-     */
-    JavaConstant invoke(JavaConstant receiver, JavaConstant[] arguments);
-
-    /**
-     * Gets the encoding of (that is, a constant representing the value of) this method.
-     *
-     * @return a constant representing a reference to this method
-     */
-    Constant getEncoding();
-
-    /**
-     * Checks if this method is present in the virtual table for subtypes of the specified
-     * {@linkplain ResolvedJavaType type}.
-     *
-     * @return true is this method is present in the virtual table for subtypes of this type.
-     */
-    boolean isInVirtualMethodTable(ResolvedJavaType resolved);
-
-    /**
-     * Gets the annotation of a particular type for a formal parameter of this method.
-     *
-     * @param annotationClass the Class object corresponding to the annotation type
-     * @param parameterIndex the index of a formal parameter of {@code method}
-     * @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
-     */
-    default <T extends Annotation> T getParameterAnnotation(Class<T> annotationClass, int parameterIndex) {
-        if (parameterIndex >= 0) {
-            Annotation[][] parameterAnnotations = getParameterAnnotations();
-            for (Annotation a : parameterAnnotations[parameterIndex]) {
-                if (a.annotationType() == annotationClass) {
-                    return annotationClass.cast(a);
-                }
-            }
-        }
-        return null;
-    }
-
-    default JavaType[] toParameterTypes() {
-        JavaType receiver = isStatic() || isConstructor() ? null : getDeclaringClass();
-        return getSignature().toParameterTypes(receiver);
-    }
-
-    /**
-     * Gets the annotations of a particular type for the formal parameters of this method.
-     *
-     * @param annotationClass the Class object corresponding to the annotation type
-     * @return the annotation of type {@code annotationClass} (if any) for each formal parameter
-     *         present
-     */
-    @SuppressWarnings("unchecked")
-    default <T extends Annotation> T[] getParameterAnnotations(Class<T> annotationClass) {
-        Annotation[][] parameterAnnotations = getParameterAnnotations();
-        T[] result = (T[]) Array.newInstance(annotationClass, parameterAnnotations.length);
-        for (int i = 0; i < parameterAnnotations.length; i++) {
-            for (Annotation a : parameterAnnotations[i]) {
-                if (a.annotationType() == annotationClass) {
-                    result[i] = annotationClass.cast(a);
-                }
-            }
-        }
-        return result;
-    }
-
-    /**
-     * Checks whether the method has bytecodes associated with it. Methods without bytecodes are
-     * either abstract or native methods.
-     *
-     * @return whether the definition of this method is Java bytecodes
-     */
-    default boolean hasBytecodes() {
-        return isConcrete() && !isNative();
-    }
-
-    /**
-     * Checks whether the method has a receiver parameter - i.e., whether it is not static.
-     *
-     * @return whether the method has a receiver parameter
-     */
-    default boolean hasReceiver() {
-        return !isStatic();
-    }
-
-    /**
-     * Determines if this method is {@link java.lang.Object#Object()}.
-     */
-    default boolean isJavaLangObjectInit() {
-        return getDeclaringClass().isJavaLangObject() && getName().equals("<init>");
-    }
-}
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ResolvedJavaType.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,354 +0,0 @@
-/*
- * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.api.meta;
-
-import java.lang.annotation.*;
-import java.net.*;
-
-import com.oracle.graal.api.meta.Assumptions.AssumptionResult;
-
-/**
- * Represents a resolved Java type. Types include primitives, objects, {@code void}, and arrays
- * thereof. Types, like fields and methods, are resolved through {@link ConstantPool constant pools}
- * .
- */
-public interface ResolvedJavaType extends JavaType, ModifiersProvider {
-
-    /**
-     * Gets the runtime representation of the Java class object of this type.
-     */
-    JavaConstant getJavaClass();
-
-    /**
-     * Gets the runtime representation of the "hub" of this type--that is, the closest part of the
-     * type representation which is typically stored in the object header.
-     */
-    Constant getObjectHub();
-
-    /**
-     * Checks whether this type has a finalizer method.
-     *
-     * @return {@code true} if this class has a finalizer
-     */
-    boolean hasFinalizer();
-
-    /**
-     * Checks whether this type has any finalizable subclasses so far. Any decisions based on this
-     * information require the registration of a dependency, since this information may change.
-     *
-     * @return {@code true} if this class has any subclasses with finalizers
-     */
-    AssumptionResult<Boolean> hasFinalizableSubclass();
-
-    /**
-     * Checks whether this type is an interface.
-     *
-     * @return {@code true} if this type is an interface
-     */
-    boolean isInterface();
-
-    /**
-     * Checks whether this type is an instance class.
-     *
-     * @return {@code true} if this type is an instance class
-     */
-    boolean isInstanceClass();
-
-    /**
-     * Checks whether this type is an array class.
-     *
-     * @return {@code true} if this type is an array class
-     */
-    boolean isArray();
-
-    /**
-     * Checks whether this type is primitive.
-     *
-     * @return {@code true} if this type is primitive
-     */
-    boolean isPrimitive();
-
-    /**
-     * {@inheritDoc}
-     * <p>
-     * Only the flags specified in the JVM specification will be included in the returned mask. This
-     * method is identical to {@link Class#getModifiers()} in terms of the value return for this
-     * type.
-     */
-    int getModifiers();
-
-    /**
-     * Checks whether this type is initialized. If a type is initialized it implies that it was
-     * {@link #isLinked() linked} and that the static initializer has run.
-     *
-     * @return {@code true} if this type is initialized
-     */
-    boolean isInitialized();
-
-    /**
-     * Initializes this type.
-     */
-    void initialize();
-
-    /**
-     * Checks whether this type is linked and verified. When a type is linked the static initializer
-     * has not necessarily run. An {@link #isInitialized() initialized} type is always linked.
-     *
-     * @return {@code true} if this type is linked
-     */
-    boolean isLinked();
-
-    /**
-     * Determines if this type is either the same as, or is a superclass or superinterface of, the
-     * type represented by the specified parameter. This method is identical to
-     * {@link Class#isAssignableFrom(Class)} in terms of the value return for this type.
-     */
-    boolean isAssignableFrom(ResolvedJavaType other);
-
-    /**
-     * Returns true if this type is exactly the type {@link java.lang.Object}.
-     */
-    default boolean isJavaLangObject() {
-        // Removed assertion due to https://bugs.eclipse.org/bugs/show_bug.cgi?id=434442
-        return getSuperclass() == null && !isInterface() && getKind() == Kind.Object;
-    }
-
-    /**
-     * Checks whether the specified object is an instance of this type.
-     *
-     * @param obj the object to test
-     * @return {@code true} if the object is an instance of this type
-     */
-    boolean isInstance(JavaConstant obj);
-
-    /**
-     * Returns this type if it is an exact type otherwise returns null. This type is exact if it is
-     * void, primitive, final, or an array of a final or primitive type.
-     *
-     * @return this type if it is exact; {@code null} otherwise
-     */
-    ResolvedJavaType asExactType();
-
-    /**
-     * Gets the super class of this type. If this type represents either the {@code Object} class,
-     * an interface, a primitive type, or void, then null is returned. If this object represents an
-     * array class then the type object representing the {@code Object} class is returned.
-     */
-    ResolvedJavaType getSuperclass();
-
-    /**
-     * Gets the interfaces implemented or extended by this type. This method is analogous to
-     * {@link Class#getInterfaces()} and as such, only returns the interfaces directly implemented
-     * or extended by this type.
-     */
-    ResolvedJavaType[] getInterfaces();
-
-    /**
-     * Gets the single implementor of this type. Calling this method on a non-interface type causes
-     * an exception.
-     * <p>
-     * If the compiler uses the result of this method for its compilation, the usage must be guarded
-     * because the verifier can not guarantee that the assigned type really implements this
-     * interface. Additionally, class loading can invalidate the result of this method.
-     *
-     * @return {@code null} if there is no implementor, the implementor if there is only one, or
-     *         {@code this} if there are more than one.
-     */
-    ResolvedJavaType getSingleImplementor();
-
-    /**
-     * Walks the class hierarchy upwards and returns the least common class that is a superclass of
-     * both the current and the given type.
-     *
-     * @return the least common type that is a super type of both the current and the given type, or
-     *         {@code null} if primitive types are involved.
-     */
-    ResolvedJavaType findLeastCommonAncestor(ResolvedJavaType otherType);
-
-    /**
-     * Attempts to get a leaf concrete subclass of this type.
-     * <p>
-     * For an {@linkplain #isArray() array} type A, the leaf concrete subclass is A if the
-     * {@linkplain #getElementalType() elemental} type of A is final (which includes primitive
-     * types). Otherwise {@code null} is returned for A.
-     * <p>
-     * For a non-array type T, the result is the leaf concrete type in the current hierarchy of T.
-     * <p>
-     * A runtime may decide not to manage or walk a large hierarchy and so the result is
-     * conservative. That is, a non-null result is guaranteed to be the leaf concrete class in T's
-     * hierarchy <b>at the current point in time</b> but a null result does not necessarily imply
-     * that there is no leaf concrete class in T's hierarchy.
-     * <p>
-     * If the compiler uses the result of this method for its compilation, it must register the
-     * {@link AssumptionResult} in its {@link Assumptions} because dynamic class loading can
-     * invalidate the result of this method.
-     *
-     * @return an {@link AssumptionResult} containing the leaf concrete subclass for this type as
-     *         described above
-     */
-    AssumptionResult<ResolvedJavaType> findLeafConcreteSubtype();
-
-    ResolvedJavaType getComponentType();
-
-    default ResolvedJavaType getElementalType() {
-        ResolvedJavaType t = this;
-        while (t.isArray()) {
-            t = t.getComponentType();
-        }
-        return t;
-    }
-
-    ResolvedJavaType getArrayClass();
-
-    /**
-     * Resolves the method implementation for virtual dispatches on objects of this dynamic type.
-     * This resolution process only searches "up" the class hierarchy of this type.
-     *
-     * @param method the method to select the implementation of
-     * @param callerType the caller or context type used to perform access checks
-     * @param includeAbstract whether abstract methods should be returned. If it is {@code false}
-     *            this method behaves like {@link #resolveConcreteMethod}. This is just a temporary
-     *            parameter to highlight the changed semantics of this method. TODO (je) remove this
-     *            flag.
-     * @return the link-time resolved method (might be abstract) or {@code null} if it can not be
-     *         linked
-     */
-    ResolvedJavaMethod resolveMethod(ResolvedJavaMethod method, ResolvedJavaType callerType, boolean includeAbstract);
-
-    /**
-     * Resolves the method implementation for virtual dispatches on objects of this dynamic type.
-     * This resolution process only searches "up" the class hierarchy of this type. A broader search
-     * that also walks "down" the hierarchy is implemented by
-     * {@link #findUniqueConcreteMethod(ResolvedJavaMethod)}.
-     *
-     * @param method the method to select the implementation of
-     * @param callerType the caller or context type used to perform access checks
-     * @return the concrete method that would be selected at runtime, or {@code null} if there is no
-     *         concrete implementation of {@code method} in this type or any of its superclasses
-     */
-    ResolvedJavaMethod resolveConcreteMethod(ResolvedJavaMethod method, ResolvedJavaType callerType);
-
-    /**
-     * Given a {@link ResolvedJavaMethod} A, returns a concrete {@link ResolvedJavaMethod} B that is
-     * the only possible unique target for a virtual call on A(). Returns {@code null} if either no
-     * such concrete method or more than one such method exists. Returns the method A if A is a
-     * concrete method that is not overridden.
-     * <p>
-     * If the compiler uses the result of this method for its compilation, it must register an
-     * assumption because dynamic class loading can invalidate the result of this method.
-     *
-     * @param method the method A for which a unique concrete target is searched
-     * @return the unique concrete target or {@code null} if no such target exists or assumptions
-     *         are not supported by this runtime
-     */
-    AssumptionResult<ResolvedJavaMethod> findUniqueConcreteMethod(ResolvedJavaMethod method);
-
-    /**
-     * Returns the instance fields of this class, including
-     * {@linkplain ResolvedJavaField#isInternal() internal} fields. A zero-length array is returned
-     * for array and primitive types. The order of fields returned by this method is stable. That
-     * is, for a single JVM execution the same order is returned each time this method is called. It
-     * is also the "natural" order, which means that the JVM would expect the fields in this order
-     * if no specific order is given.
-     *
-     * @param includeSuperclasses if true, then instance fields for the complete hierarchy of this
-     *            type are included in the result
-     * @return an array of instance fields
-     */
-    ResolvedJavaField[] getInstanceFields(boolean includeSuperclasses);
-
-    /**
-     * Returns the static fields of this class, including
-     * {@linkplain ResolvedJavaField#isInternal() internal} fields. A zero-length array is returned
-     * for array and primitive types. The order of fields returned by this method is stable. That
-     * is, for a single JVM execution the same order is returned each time this method is called.
-     */
-    ResolvedJavaField[] getStaticFields();
-
-    /**
-     * Returns the annotation for the specified type of this class, if such an annotation is
-     * present.
-     *
-     * @param annotationClass the Class object corresponding to the annotation type
-     * @return this element's annotation for the specified annotation type if present on this class,
-     *         else {@code null}
-     */
-    <T extends Annotation> T getAnnotation(Class<T> annotationClass);
-
-    /**
-     * Returns the instance field of this class (or one of its super classes) at the given offset,
-     * or {@code null} if there is no such field.
-     *
-     * @param offset the offset of the field to look for
-     * @return the field with the given offset, or {@code null} if there is no such field.
-     */
-    ResolvedJavaField findInstanceFieldWithOffset(long offset, Kind expectedKind);
-
-    /**
-     * Returns name of source file of this type.
-     */
-    String getSourceFileName();
-
-    /**
-     * Returns the class file path - if available - of this type, or {@code null}.
-     */
-    URL getClassFilePath();
-
-    /**
-     * Returns {@code true} if the type is a local type.
-     */
-    boolean isLocal();
-
-    /**
-     * Returns {@code true} if the type is a member type.
-     */
-    boolean isMember();
-
-    /**
-     * Returns the enclosing type of this type, if it exists, or {@code null}.
-     */
-    ResolvedJavaType getEnclosingType();
-
-    /**
-     * Returns an array reflecting all the constructors declared by this type. This method is
-     * similar to {@link Class#getDeclaredConstructors()} in terms of returned constructors.
-     */
-    ResolvedJavaMethod[] getDeclaredConstructors();
-
-    /**
-     * Returns an array reflecting all the methods declared by this type. This method is similar to
-     * {@link Class#getDeclaredMethods()} in terms of returned methods.
-     */
-    ResolvedJavaMethod[] getDeclaredMethods();
-
-    /**
-     * Returns the {@code <clinit>} method for this class if there is one.
-     */
-    ResolvedJavaMethod getClassInitializer();
-
-    /**
-     * Returns true if this type represents an interface and it should be trusted even in places
-     * where the JVM verifier would not give any guarantees other than {@link Object}.
-     */
-    boolean isTrustedInterfaceType();
-}
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/SerializableConstant.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2014, 2015, 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.meta;
-
-import java.nio.*;
-
-/**
- * Represents a compile-time constant that can be converted to a byte array.
- */
-public interface SerializableConstant extends Constant {
-
-    /**
-     * Return the size in bytes of the serialized representation of this constant.
-     */
-    int getSerializedSize();
-
-    /**
-     * Serialize the constant into the ByteBuffer. There must be at least
-     * {@link #getSerializedSize()} bytes available capacity in the buffer.
-     */
-    void serialize(ByteBuffer buffer);
-}
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Signature.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,122 +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.graal.api.meta;
-
-/**
- * Represents a method signature provided by the runtime.
- *
- * @see <a href="http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.3.3">Method
- *      Descriptors</a>
- */
-public interface Signature {
-
-    /**
-     * Returns the number of parameters in this signature, adding 1 for a receiver if requested.
-     *
-     * @param receiver true if 1 is to be added to the result for a receiver
-     * @return the number of parameters; + 1 iff {@code receiver == true}
-     */
-    int getParameterCount(boolean receiver);
-
-    /**
-     * Gets the parameter type at the specified position.
-     *
-     * @param index the index into the parameters, with {@code 0} indicating the first parameter
-     * @param accessingClass the context of the type lookup. If non-null, its class loader is used
-     *            for resolving the type. If {@code null}, then the type returned is either
-     *            unresolved or a resolved type whose resolution is context free (e.g., a primitive
-     *            type or a type in a java.* package).
-     * @return the {@code index}'th parameter type
-     * @throws LinkageError if {@code accessingClass != null} and resolution fails
-     *
-     */
-    JavaType getParameterType(int index, ResolvedJavaType accessingClass);
-
-    /**
-     * Gets the parameter kind at the specified position. This is the same as calling
-     * {@link #getParameterType}. {@link JavaType#getKind getKind}.
-     *
-     * @param index the index into the parameters, with {@code 0} indicating the first parameter
-     * @return the kind of the parameter at the specified position
-     */
-    default Kind getParameterKind(int index) {
-        return getParameterType(index, null).getKind();
-    }
-
-    /**
-     * Gets the return type of this signature.
-     *
-     * @param accessingClass the context of the type lookup. If non-null, its class loader is used
-     *            for resolving the type. If {@code null}, then the type returned is either
-     *            unresolved or a resolved type whose resolution is context free (e.g., a primitive
-     *            type or a type in a java.* package).
-     * @return the return type
-     * @throws LinkageError if {@code accessingClass != null} and resolution fails
-     */
-    JavaType getReturnType(ResolvedJavaType accessingClass);
-
-    /**
-     * Gets the return kind of this signature. This is the same as calling {@link #getReturnType}.
-     * {@link JavaType#getKind getKind}.
-     */
-    default Kind getReturnKind() {
-        return getReturnType(null).getKind();
-    }
-
-    /**
-     * Gets the <a
-     * href="http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.3.3">method
-     * descriptor</a> corresponding to this signature. For example:
-     *
-     * <pre>
-     * (ILjava/lang/String;D)V
-     * </pre>
-     *
-     * @return the signature as a string
-     */
-    default String toMethodDescriptor() {
-        StringBuilder sb = new StringBuilder("(");
-        for (int i = 0; i < getParameterCount(false); ++i) {
-            sb.append(getParameterType(i, null).getName());
-        }
-        sb.append(')').append(getReturnType(null).getName());
-        return sb.toString();
-    }
-
-    default JavaType[] toParameterTypes(JavaType receiverType) {
-        int args = getParameterCount(false);
-        JavaType[] result;
-        int i = 0;
-        if (receiverType != null) {
-            result = new JavaType[args + 1];
-            result[0] = receiverType;
-            i = 1;
-        } else {
-            result = new JavaType[args];
-        }
-        for (int j = 0; j < args; j++) {
-            result[i + j] = getParameterType(j, null);
-        }
-        return result;
-    }
-}
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/TriState.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +0,0 @@
-/*
- * Copyright (c) 2012, 2015, 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.meta;
-
-/**
- * Represents a logic value that can be either {@link #TRUE}, {@link #FALSE}, or {@link #UNKNOWN}.
- */
-public enum TriState {
-    TRUE,
-    FALSE,
-    UNKNOWN;
-
-    public static TriState get(boolean value) {
-        return value ? TRUE : FALSE;
-    }
-
-    /**
-     * This is optimistic about {@link #UNKNOWN} (it prefers known values over {@link #UNKNOWN}) and
-     * pesimistic about known (it perfers {@link #TRUE} over {@link #FALSE}).
-     */
-    public static TriState merge(TriState a, TriState b) {
-        if (a == TRUE || b == TRUE) {
-            return TRUE;
-        }
-        if (a == FALSE || b == FALSE) {
-            return FALSE;
-        }
-        assert a == UNKNOWN && b == UNKNOWN;
-        return UNKNOWN;
-    }
-
-    public boolean isTrue() {
-        return this == TRUE;
-    }
-
-    public boolean isFalse() {
-        return this == FALSE;
-    }
-
-    public boolean isUnknown() {
-        return this == UNKNOWN;
-    }
-
-    public boolean isKnown() {
-        return this != UNKNOWN;
-    }
-
-    public boolean toBoolean() {
-        if (isTrue()) {
-            return true;
-        } else if (isFalse()) {
-            return false;
-        } else {
-            throw new IllegalStateException("Cannot convert to boolean, TriState is in an unknown state");
-        }
-    }
-}
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/TrustedInterface.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-/*
- * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.api.meta;
-
-/**
- * Interfaces extanding this interface should be trusted by the compiler. See
- * {@link ResolvedJavaType#isTrustedInterfaceType()}.
- *
- */
-public interface TrustedInterface {
-
-}
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/VMConstant.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-/*
- * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.api.meta;
-
-public interface VMConstant extends Constant {
-}
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Value.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.api.meta;
-
-/**
- * Interface for values manipulated by the compiler. All values have a {@linkplain Kind kind} and
- * are immutable.
- */
-public interface Value extends KindProvider, TrustedInterface {
-
-    AllocatableValue ILLEGAL = new AllocatableValue(LIRKind.Illegal) {
-
-        @Override
-        public String toString() {
-            return "-";
-        }
-
-        @Override
-        public boolean equals(Object other) {
-            // Due to de-serialization this object may exist multiple times. So we compare classes
-            // instead of the individual objects. (This anonymous class has always the same meaning)
-            return other != null && this.getClass() == other.getClass();
-        }
-    };
-
-    LIRKind getLIRKind();
-
-    /**
-     * Returns the platform specific kind used to store this value.
-     */
-    PlatformKind getPlatformKind();
-
-    /**
-     * Checks if this value is identical to {@code other}.
-     *
-     * Warning: Use with caution! Usually equivalence {@link #equals(Object)} is sufficient and
-     * should be used.
-     */
-    @ExcludeFromIdentityComparisonVerification
-    default boolean identityEquals(Value other) {
-        return this == other;
-    }
-}
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/package-info.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +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 that defines the interface between a runtime and a Java application that wants to access meta information. The runtime
- * provides an implementation of the {@link com.oracle.graal.api.meta.MetaAccessProvider} interface.
- */
-package com.oracle.graal.api.meta;
-
--- a/graal/com.oracle.graal.api.replacements/src/com/oracle/graal/api/replacements/MethodSubstitution.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.api.replacements/src/com/oracle/graal/api/replacements/MethodSubstitution.java	Thu May 28 21:11:28 2015 -0700
@@ -24,7 +24,7 @@
 
 import java.lang.annotation.*;
 
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * Denotes a substitute method. A substitute method can call the original/substituted method by
--- a/graal/com.oracle.graal.api.replacements/src/com/oracle/graal/api/replacements/SnippetReflectionProvider.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.api.replacements/src/com/oracle/graal/api/replacements/SnippetReflectionProvider.java	Thu May 28 21:11:28 2015 -0700
@@ -22,11 +22,15 @@
  */
 package com.oracle.graal.api.replacements;
 
+import com.oracle.jvmci.meta.JavaField;
+import com.oracle.jvmci.meta.JavaType;
+import com.oracle.jvmci.meta.ResolvedJavaType;
+import com.oracle.jvmci.meta.JavaConstant;
+import com.oracle.jvmci.meta.Kind;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
 import java.lang.reflect.*;
 import java.util.*;
 
-import com.oracle.graal.api.meta.*;
-
 /**
  * Reflection operations on values represented as {@linkplain JavaConstant constants} for the
  * processing of snippets. Snippets need a direct access to the value of object constants, which is
@@ -88,7 +92,7 @@
         try {
             return Class.forName(type.toClassName());
         } catch (ClassNotFoundException e) {
-            // Support for -XX:-UseGraalClassLoader
+            // Support for -XX:-UseJVMCIClassLoader
             return Class.forName(type.toClassName(), false, ClassLoader.getSystemClassLoader());
         }
     }
--- a/graal/com.oracle.graal.api.runtime/src/com/oracle/graal/api/runtime/Graal.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.api.runtime/src/com/oracle/graal/api/runtime/Graal.java	Thu May 28 21:11:28 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,42 +22,60 @@
  */
 package com.oracle.graal.api.runtime;
 
+import java.util.*;
+
 import sun.reflect.*;
 
+import com.oracle.jvmci.runtime.*;
+
+/**
+ * Access point for {@linkplain #getRuntime() retrieving} the single {@link GraalRuntime} instance.
+ */
 public class Graal {
 
-    private static final GraalRuntime runtime;
+    private static final GraalRuntime runtime = initializeRuntime();
 
-    private static native GraalRuntime initializeRuntime();
+    private static GraalRuntime initializeRuntime() {
+        GraalRuntime rt = null;
+        for (GraalRuntimeFactory factory : Services.load(GraalRuntimeFactory.class)) {
+            assert rt == null : String.format("Multiple %s implementations found: %s, %s", GraalRuntime.class.getName(), rt.getClass().getName(), factory.getRuntime().getClass().getName());
+            rt = factory.getRuntime();
+        }
+        if (rt != null) {
+            // The constant is patched in-situ by the build system
+            System.setProperty("graal.version", "@@graal.version@@");
+            assert !System.getProperty("graal.version").startsWith("@@") && !System.getProperty("graal.version").endsWith("@@") : "Graal version string constant was not patched by build system";
+            return rt;
+        }
+        return new InvalidGraalRuntime();
+    }
 
+    /**
+     * Gets the singleton {@link GraalRuntime} instance available to the application.
+     */
     public static GraalRuntime getRuntime() {
         return runtime;
     }
 
-    static {
-        GraalRuntime rt;
-        try {
-            rt = initializeRuntime();
-        } catch (UnsatisfiedLinkError e) {
-            rt = new InvalidGraalRuntime();
-        }
-        runtime = rt;
-    }
-
+    /**
+     * Gets a capability provided by the {@link GraalRuntime} instance available to the application.
+     *
+     * @throws UnsupportedOperationException if the capability is not available
+     */
     @CallerSensitive
     public static <T> T getRequiredCapability(Class<T> clazz) {
         T t = getRuntime().getCapability(clazz);
         if (t == null) {
             String javaHome = System.getProperty("java.home");
             String vmName = System.getProperty("java.vm.name");
-            StringBuilder errorMessage = new StringBuilder();
+            Formatter errorMessage = new Formatter();
             if (runtime.getClass() == InvalidGraalRuntime.class) {
-                errorMessage.append(String.format("The VM does not support the Graal API.\n"));
+                errorMessage.format("The VM does not support the Graal API.%n");
             } else {
-                errorMessage.append(String.format("The VM does not expose required Graal capability %s.\n", clazz.getName()));
+                errorMessage.format("The VM does not expose required Graal capability %s.%n", clazz.getName());
             }
-            errorMessage.append(String.format("Currently used Java home directory is %s.\n", javaHome));
-            errorMessage.append(String.format("Currently used VM configuration is: %s", vmName));
+            errorMessage.format("Currently used Java home directory is %s.%n", javaHome);
+            errorMessage.format("Currently used VM configuration is: %s", vmName);
             throw new UnsupportedOperationException(errorMessage.toString());
         }
         return t;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.api.runtime/src/com/oracle/graal/api/runtime/GraalRuntimeFactory.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2015, 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.runtime;
+
+import com.oracle.jvmci.runtime.*;
+
+public interface GraalRuntimeFactory extends Service {
+
+    GraalRuntime getRuntime();
+}
--- a/graal/com.oracle.graal.api.runtime/src/com/oracle/graal/api/runtime/Service.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.api.runtime;
-
-/**
- * Denotes a service that may be efficiently loaded by {@link Services#load(Class)}.
- */
-public interface Service {
-}
--- a/graal/com.oracle.graal.api.runtime/src/com/oracle/graal/api/runtime/ServiceProvider.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.api.runtime;
-
-import java.lang.annotation.*;
-
-@Retention(RetentionPolicy.CLASS)
-@Target(ElementType.TYPE)
-public @interface ServiceProvider {
-
-    Class<?> value();
-}
--- a/graal/com.oracle.graal.api.runtime/src/com/oracle/graal/api/runtime/Services.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,65 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.api.runtime;
-
-import static java.lang.String.*;
-
-import java.util.*;
-
-/**
- * A mechanism on top of the standard {@link ServiceLoader} that enables a runtime to efficiently
- * load services marked by {@link Service}. This may be important for services loaded early in the
- * runtime initialization process.
- */
-public class Services {
-
-    private static final ClassValue<List<Service>> cache = new ClassValue<List<Service>>() {
-        @Override
-        protected List<Service> computeValue(Class<?> type) {
-            Service[] names = getServiceImpls(type);
-            if (names == null || names.length == 0) {
-                throw new InternalError(
-                                format("No implementations for %s found (ensure %s extends %s and that in suite.py the \"annotationProcessors\" attribute for the project enclosing %s includes \"com.oracle.graal.service.processor\")",
-                                                type.getSimpleName(), type.getSimpleName(), Service.class, type.getSimpleName()));
-            }
-            return Arrays.asList(names);
-        }
-    };
-
-    /**
-     * Gets an {@link Iterable} of the implementations available for a given service.
-     */
-    @SuppressWarnings("unchecked")
-    public static <S> Iterable<S> load(Class<S> service) {
-        if (Service.class.isAssignableFrom(service)) {
-            try {
-                return (Iterable<S>) cache.get(service);
-            } catch (UnsatisfiedLinkError e) {
-                // Fall back to standard SerivceLoader
-            }
-        }
-        return ServiceLoader.load(service, Services.class.getClassLoader());
-    }
-
-    private static native <S> S[] getServiceImpls(Class<?> service);
-}
--- a/graal/com.oracle.graal.asm.amd64.test/src/com/oracle/graal/asm/amd64/test/BitOpsTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.asm.amd64.test/src/com/oracle/graal/asm/amd64/test/BitOpsTest.java	Thu May 28 21:11:28 2015 -0700
@@ -23,10 +23,16 @@
 
 package com.oracle.graal.asm.amd64.test;
 
-import static com.oracle.graal.api.code.ValueUtil.*;
+import com.oracle.jvmci.code.RegisterConfig;
+import com.oracle.jvmci.code.TargetDescription;
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.code.CallingConvention;
+import com.oracle.jvmci.code.CompilationResult;
+import com.oracle.jvmci.meta.Kind;
+import static com.oracle.jvmci.code.ValueUtil.*;
 import static com.oracle.graal.asm.amd64.AMD64Assembler.AMD64RMOp.*;
 import static com.oracle.graal.asm.amd64.AMD64Assembler.OperandSize.*;
-import static com.oracle.graal.compiler.common.UnsafeAccess.*;
+import static com.oracle.jvmci.common.UnsafeAccess.*;
 import static org.junit.Assume.*;
 
 import java.lang.reflect.*;
@@ -36,8 +42,6 @@
 
 import com.oracle.graal.amd64.*;
 import com.oracle.graal.amd64.AMD64.CPUFeature;
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.asm.amd64.*;
 import com.oracle.graal.asm.test.*;
 
--- a/graal/com.oracle.graal.asm.amd64.test/src/com/oracle/graal/asm/amd64/test/IncrementDecrementMacroTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.asm.amd64.test/src/com/oracle/graal/asm/amd64/test/IncrementDecrementMacroTest.java	Thu May 28 21:11:28 2015 -0700
@@ -22,8 +22,14 @@
  */
 package com.oracle.graal.asm.amd64.test;
 
-import static com.oracle.graal.api.code.ValueUtil.*;
-import static com.oracle.graal.compiler.common.UnsafeAccess.*;
+import com.oracle.jvmci.code.RegisterConfig;
+import com.oracle.jvmci.code.TargetDescription;
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.code.CallingConvention;
+import com.oracle.jvmci.code.CompilationResult;
+import com.oracle.jvmci.meta.Kind;
+import static com.oracle.jvmci.code.ValueUtil.*;
+import static com.oracle.jvmci.common.UnsafeAccess.*;
 import static org.junit.Assume.*;
 
 import java.lang.reflect.*;
@@ -31,8 +37,6 @@
 import org.junit.*;
 
 import com.oracle.graal.amd64.*;
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.asm.amd64.*;
 import com.oracle.graal.asm.test.*;
 
--- a/graal/com.oracle.graal.asm.amd64.test/src/com/oracle/graal/asm/amd64/test/SimpleAssemblerTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.asm.amd64.test/src/com/oracle/graal/asm/amd64/test/SimpleAssemblerTest.java	Thu May 28 21:11:28 2015 -0700
@@ -22,6 +22,13 @@
  */
 package com.oracle.graal.asm.amd64.test;
 
+import com.oracle.jvmci.code.RegisterConfig;
+import com.oracle.jvmci.code.TargetDescription;
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.code.CallingConvention;
+import com.oracle.jvmci.code.CompilationResult;
+import com.oracle.jvmci.meta.JavaConstant;
+import com.oracle.jvmci.meta.Kind;
 import static org.junit.Assume.*;
 
 import java.nio.*;
@@ -29,11 +36,9 @@
 import org.junit.*;
 
 import com.oracle.graal.amd64.*;
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.code.CompilationResult.DataSectionReference;
-import com.oracle.graal.api.code.DataSection.Data;
-import com.oracle.graal.api.code.DataSection.DataBuilder;
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.code.CompilationResult.DataSectionReference;
+import com.oracle.jvmci.code.DataSection.Data;
+import com.oracle.jvmci.code.DataSection.DataBuilder;
 import com.oracle.graal.asm.amd64.*;
 import com.oracle.graal.asm.test.*;
 
--- a/graal/com.oracle.graal.asm.amd64/src/com/oracle/graal/asm/amd64/AMD64Address.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.asm.amd64/src/com/oracle/graal/asm/amd64/AMD64Address.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,8 @@
  */
 package com.oracle.graal.asm.amd64;
 
-import com.oracle.graal.api.code.*;
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.code.AbstractAddress;
 
 /**
  * Represents an address in target machine memory, specified via some combination of a base
--- a/graal/com.oracle.graal.asm.amd64/src/com/oracle/graal/asm/amd64/AMD64Assembler.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.asm.amd64/src/com/oracle/graal/asm/amd64/AMD64Assembler.java	Thu May 28 21:11:28 2015 -0700
@@ -22,8 +22,11 @@
  */
 package com.oracle.graal.asm.amd64;
 
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.code.TargetDescription;
+import com.oracle.jvmci.code.RegisterConfig;
 import static com.oracle.graal.amd64.AMD64.*;
-import static com.oracle.graal.api.code.MemoryBarriers.*;
+import static com.oracle.jvmci.code.MemoryBarriers.*;
 import static com.oracle.graal.asm.NumUtil.*;
 import static com.oracle.graal.asm.amd64.AMD64AsmOptions.*;
 import static com.oracle.graal.asm.amd64.AMD64Assembler.AMD64BinaryArithmetic.*;
@@ -32,8 +35,7 @@
 
 import com.oracle.graal.amd64.*;
 import com.oracle.graal.amd64.AMD64.CPUFeature;
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.code.Register.RegisterCategory;
+import com.oracle.jvmci.code.Register.RegisterCategory;
 import com.oracle.graal.asm.*;
 
 /**
--- a/graal/com.oracle.graal.asm.amd64/src/com/oracle/graal/asm/amd64/AMD64MacroAssembler.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.asm.amd64/src/com/oracle/graal/asm/amd64/AMD64MacroAssembler.java	Thu May 28 21:11:28 2015 -0700
@@ -22,11 +22,14 @@
  */
 package com.oracle.graal.asm.amd64;
 
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.code.CalleeSaveLayout;
+import com.oracle.jvmci.code.TargetDescription;
+import com.oracle.jvmci.code.RegisterConfig;
+import com.oracle.jvmci.meta.Kind;
 import static com.oracle.graal.asm.amd64.AMD64AsmOptions.*;
 
 import com.oracle.graal.amd64.*;
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.asm.*;
 
 /**
--- a/graal/com.oracle.graal.asm.sparc/src/com/oracle/graal/asm/sparc/SPARCAddress.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.asm.sparc/src/com/oracle/graal/asm/sparc/SPARCAddress.java	Thu May 28 21:11:28 2015 -0700
@@ -22,11 +22,12 @@
  */
 package com.oracle.graal.asm.sparc;
 
+import com.oracle.jvmci.code.AbstractAddress;
+import com.oracle.jvmci.code.Register;
 import static com.oracle.graal.sparc.SPARC.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.sparc.*;
+import com.oracle.jvmci.common.*;
 
 public class SPARCAddress extends AbstractAddress {
 
@@ -113,7 +114,7 @@
      */
     public int getDisplacement() {
         if (hasIndex()) {
-            throw GraalInternalError.shouldNotReachHere("address has index register");
+            throw JVMCIError.shouldNotReachHere("address has index register");
         }
         // TODO Should we also hide the register save area size here?
         if (getBase().equals(sp) || getBase().equals(fp)) {
--- a/graal/com.oracle.graal.asm.sparc/src/com/oracle/graal/asm/sparc/SPARCAssembler.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.asm.sparc/src/com/oracle/graal/asm/sparc/SPARCAssembler.java	Thu May 28 21:11:28 2015 -0700
@@ -22,6 +22,11 @@
  */
 package com.oracle.graal.asm.sparc;
 
+import com.oracle.jvmci.code.TargetDescription;
+import com.oracle.jvmci.code.RegisterConfig;
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.meta.Kind;
+import com.oracle.jvmci.meta.JavaConstant;
 import static com.oracle.graal.asm.sparc.SPARCAssembler.CC.*;
 import static com.oracle.graal.asm.sparc.SPARCAssembler.ConditionFlag.*;
 import static com.oracle.graal.asm.sparc.SPARCAssembler.Op.*;
@@ -31,13 +36,11 @@
 import static com.oracle.graal.sparc.SPARC.*;
 import static java.lang.String.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.asm.*;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.calc.*;
 import com.oracle.graal.sparc.*;
 import com.oracle.graal.sparc.SPARC.CPUFeature;
+import com.oracle.jvmci.common.*;
 
 /**
  * This class implements an assembler that can encode most SPARC instructions.
@@ -580,7 +583,7 @@
             } else if (isFloat) {
                 return Fcc0;
             } else {
-                throw GraalInternalError.shouldNotReachHere();
+                throw JVMCIError.shouldNotReachHere();
             }
         }
     }
@@ -696,7 +699,7 @@
                 case OverflowSet              : return OverflowClear;
                 case OverflowClear            : return OverflowSet;
                 default:
-                    GraalInternalError.unimplemented();
+                    JVMCIError.unimplemented();
             }
             //@formatter:on
             return null;
@@ -753,7 +756,7 @@
                         case GT:
                             return Greater;
                     }
-                    throw GraalInternalError.shouldNotReachHere("Unimplemented for: " + cond);
+                    throw JVMCIError.shouldNotReachHere("Unimplemented for: " + cond);
                 case Fcc0:
                 case Fcc1:
                 case Fcc2:
@@ -772,9 +775,9 @@
                         case GT:
                             return unorderedIsTrue ? F_UnorderedOrGreater : F_Greater;
                     }
-                    throw GraalInternalError.shouldNotReachHere("Unkown condition: " + cond);
+                    throw JVMCIError.shouldNotReachHere("Unkown condition: " + cond);
             }
-            throw GraalInternalError.shouldNotReachHere("Unknown condition flag register " + conditionFlagsRegister);
+            throw JVMCIError.shouldNotReachHere("Unknown condition flag register " + conditionFlagsRegister);
         }
     }
 
--- a/graal/com.oracle.graal.asm.sparc/src/com/oracle/graal/asm/sparc/SPARCMacroAssembler.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.asm.sparc/src/com/oracle/graal/asm/sparc/SPARCMacroAssembler.java	Thu May 28 21:11:28 2015 -0700
@@ -22,15 +22,18 @@
  */
 package com.oracle.graal.asm.sparc;
 
+import com.oracle.jvmci.code.AbstractAddress;
+import com.oracle.jvmci.code.TargetDescription;
+import com.oracle.jvmci.code.RegisterConfig;
+import com.oracle.jvmci.code.Register;
 import static com.oracle.graal.asm.sparc.SPARCAssembler.Annul.*;
 import static com.oracle.graal.asm.sparc.SPARCAssembler.ConditionFlag.*;
 import static com.oracle.graal.sparc.SPARC.*;
 
 import java.util.function.*;
 
-import com.oracle.graal.api.code.*;
 import com.oracle.graal.asm.*;
-import com.oracle.graal.compiler.common.*;
+import com.oracle.jvmci.common.*;
 
 public class SPARCMacroAssembler extends SPARCAssembler {
 
@@ -103,7 +106,7 @@
                 }
                 break;
             default:
-                throw GraalInternalError.shouldNotReachHere("Unknown op2 " + op2);
+                throw JVMCIError.shouldNotReachHere("Unknown op2 " + op2);
         }
         int newInst = ~maskBits & inst;
         newInst |= setBits;
--- a/graal/com.oracle.graal.asm.test/src/com/oracle/graal/asm/test/AssemblerTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.asm.test/src/com/oracle/graal/asm/test/AssemblerTest.java	Thu May 28 21:11:28 2015 -0700
@@ -22,18 +22,27 @@
  */
 package com.oracle.graal.asm.test;
 
+import com.oracle.jvmci.code.RegisterConfig;
+import com.oracle.jvmci.code.CompilationResult;
+import com.oracle.jvmci.code.CodeUtil;
+import com.oracle.jvmci.code.InstalledCode;
+import com.oracle.jvmci.code.CallingConvention;
+import com.oracle.jvmci.code.DisassemblerProvider;
+import com.oracle.jvmci.code.TargetDescription;
+import com.oracle.jvmci.code.CodeCacheProvider;
+import com.oracle.jvmci.code.InvalidInstalledCodeException;
+import com.oracle.jvmci.meta.MetaAccessProvider;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
 import java.lang.reflect.*;
 
 import org.junit.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.api.runtime.*;
-import com.oracle.graal.debug.*;
-import com.oracle.graal.debug.Debug.Scope;
 import com.oracle.graal.phases.util.*;
 import com.oracle.graal.runtime.*;
 import com.oracle.graal.test.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.debug.Debug.Scope;
 
 public abstract class AssemblerTest extends GraalTest {
 
--- a/graal/com.oracle.graal.asm/src/com/oracle/graal/asm/Assembler.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.asm/src/com/oracle/graal/asm/Assembler.java	Thu May 28 21:11:28 2015 -0700
@@ -25,7 +25,7 @@
 import java.nio.*;
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
+import com.oracle.jvmci.code.*;
 
 /**
  * The platform-independent base class for the assembler.
--- a/graal/com.oracle.graal.bytecode/src/com/oracle/graal/bytecode/Bytecodes.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.bytecode/src/com/oracle/graal/bytecode/Bytecodes.java	Thu May 28 21:11:28 2015 -0700
@@ -27,15 +27,9 @@
 import java.lang.reflect.*;
 
 /**
- * The definitions of the bytecodes that are valid input to the compiler and related utility
- * methods. This comprises two groups: the standard Java bytecodes defined by <a href=
+ * Definitions of the standard Java bytecodes defined by <a href=
  * "http://java.sun.com/docs/books/jvms/second_edition/html/VMSpecTOC.doc.html"> Java Virtual
- * Machine Specification</a>, and a set of <i>extended</i> bytecodes that support low-level
- * programming, for example, memory barriers.
- *
- * The extended bytecodes are one or three bytes in size. The one-byte bytecodes follow the values
- * in the standard set, with no gap. The three-byte extended bytecodes share a common first byte and
- * carry additional instruction-specific information in the second and third bytes.
+ * Machine Specification</a>.
  */
 public class Bytecodes {
 
@@ -340,8 +334,7 @@
 
     /**
      * An array that maps from a bytecode value to a {@link String} for the corresponding
-     * instruction mnemonic. This will include the root instruction for the three-byte extended
-     * instructions.
+     * instruction mnemonic.
      */
     private static final String[] nameArray = new String[256];
 
--- a/graal/com.oracle.graal.compiler.amd64.test/src/com/oracle/graal/compiler/amd64/test/ConstantStackMoveTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler.amd64.test/src/com/oracle/graal/compiler/amd64/test/ConstantStackMoveTest.java	Thu May 28 21:11:28 2015 -0700
@@ -22,13 +22,14 @@
  */
 package com.oracle.graal.compiler.amd64.test;
 
+import com.oracle.jvmci.code.StackSlotValue;
+import com.oracle.jvmci.meta.JavaConstant;
+import com.oracle.jvmci.meta.PrimitiveConstant;
 import static org.junit.Assume.*;
 
 import org.junit.*;
 
 import com.oracle.graal.amd64.*;
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.lir.framemap.*;
 import com.oracle.graal.lir.gen.*;
 import com.oracle.graal.lir.jtt.*;
--- a/graal/com.oracle.graal.compiler.amd64.test/src/com/oracle/graal/compiler/amd64/test/StackStoreTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler.amd64.test/src/com/oracle/graal/compiler/amd64/test/StackStoreTest.java	Thu May 28 21:11:28 2015 -0700
@@ -22,13 +22,16 @@
  */
 package com.oracle.graal.compiler.amd64.test;
 
+import com.oracle.jvmci.code.StackSlotValue;
+import com.oracle.jvmci.meta.JavaConstant;
+import com.oracle.jvmci.meta.LIRKind;
+import com.oracle.jvmci.meta.Kind;
+import com.oracle.jvmci.meta.Value;
 import static org.junit.Assume.*;
 
 import org.junit.*;
 
 import com.oracle.graal.amd64.*;
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.lir.framemap.*;
 import com.oracle.graal.lir.gen.*;
 import com.oracle.graal.lir.jtt.*;
--- a/graal/com.oracle.graal.compiler.amd64/src/com/oracle/graal/compiler/amd64/AMD64LIRGenerator.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler.amd64/src/com/oracle/graal/compiler/amd64/AMD64LIRGenerator.java	Thu May 28 21:11:28 2015 -0700
@@ -23,7 +23,22 @@
 
 package com.oracle.graal.compiler.amd64;
 
-import static com.oracle.graal.api.code.ValueUtil.*;
+import com.oracle.jvmci.code.RegisterConfig;
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.code.ForeignCallLinkage;
+import com.oracle.jvmci.code.CodeUtil;
+import com.oracle.jvmci.code.Architecture;
+import com.oracle.jvmci.code.StackSlotValue;
+import com.oracle.jvmci.code.CallingConvention;
+import com.oracle.jvmci.code.RegisterValue;
+import com.oracle.jvmci.code.VirtualStackSlot;
+import com.oracle.jvmci.meta.Kind;
+import com.oracle.jvmci.meta.JavaConstant;
+import com.oracle.jvmci.meta.PlatformKind;
+import com.oracle.jvmci.meta.Value;
+import com.oracle.jvmci.meta.AllocatableValue;
+import com.oracle.jvmci.meta.LIRKind;
+import static com.oracle.jvmci.code.ValueUtil.*;
 import static com.oracle.graal.asm.amd64.AMD64Assembler.AMD64BinaryArithmetic.*;
 import static com.oracle.graal.asm.amd64.AMD64Assembler.AMD64MOp.*;
 import static com.oracle.graal.asm.amd64.AMD64Assembler.AMD64RMOp.*;
@@ -35,8 +50,6 @@
 import java.util.*;
 
 import com.oracle.graal.amd64.*;
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.asm.*;
 import com.oracle.graal.asm.amd64.AMD64Address.Scale;
 import com.oracle.graal.asm.amd64.AMD64Assembler.AMD64BinaryArithmetic;
@@ -49,7 +62,6 @@
 import com.oracle.graal.asm.amd64.AMD64Assembler.ConditionFlag;
 import com.oracle.graal.asm.amd64.AMD64Assembler.OperandSize;
 import com.oracle.graal.asm.amd64.AMD64Assembler.SSEOp;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.calc.*;
 import com.oracle.graal.compiler.common.spi.*;
 import com.oracle.graal.compiler.common.util.*;
@@ -75,6 +87,7 @@
 import com.oracle.graal.lir.framemap.*;
 import com.oracle.graal.lir.gen.*;
 import com.oracle.graal.phases.util.*;
+import com.oracle.jvmci.common.*;
 
 /**
  * This class implements the AMD64 specific portion of the LIR generator.
@@ -327,7 +340,7 @@
                 append(new AMD64Unary.MemoryOp(MOVSD, SD, result, loadAddress, state));
                 break;
             default:
-                throw GraalInternalError.shouldNotReachHere();
+                throw JVMCIError.shouldNotReachHere();
         }
         return result;
     }
@@ -371,7 +384,7 @@
                     imm = Double.doubleToRawLongBits(value.asDouble());
                     break;
                 default:
-                    throw GraalInternalError.shouldNotReachHere("unexpected kind " + kind);
+                    throw JVMCIError.shouldNotReachHere("unexpected kind " + kind);
             }
 
             if (NumUtil.isInt(imm)) {
@@ -406,7 +419,7 @@
                 append(new AMD64BinaryConsumer.MemoryMROp(AMD64MROp.MOVSD, SD, address, value, state));
                 break;
             default:
-                throw GraalInternalError.shouldNotReachHere();
+                throw JVMCIError.shouldNotReachHere();
         }
     }
 
@@ -564,7 +577,7 @@
                 append(new AMD64BinaryConsumer.Op(SSEOp.UCOMIS, PD, left, asAllocatable(right)));
                 return;
             default:
-                throw GraalInternalError.shouldNotReachHere("unexpected kind: " + cmpKind);
+                throw JVMCIError.shouldNotReachHere("unexpected kind: " + cmpKind);
         }
 
         if (isConstant(right)) {
@@ -615,7 +628,7 @@
                 append(new AMD64BinaryConsumer.MemoryRMOp(SSEOp.UCOMIS, PD, asAllocatable(a), b, state));
                 return false;
             default:
-                throw GraalInternalError.shouldNotReachHere("unexpected kind: " + cmpKind);
+                throw JVMCIError.shouldNotReachHere("unexpected kind: " + cmpKind);
         }
 
         if (isConstant(a)) {
@@ -683,7 +696,7 @@
                 append(new AMD64Binary.DataOp(SSEOp.XOR, PD, result, input, JavaConstant.forDouble(Double.longBitsToDouble(0x8000000000000000L)), 16));
                 break;
             default:
-                throw GraalInternalError.shouldNotReachHere();
+                throw JVMCIError.shouldNotReachHere();
         }
         return result;
     }
@@ -700,7 +713,7 @@
                 append(new AMD64Unary.MOp(NOT, QWORD, result, input));
                 break;
             default:
-                throw GraalInternalError.shouldNotReachHere();
+                throw JVMCIError.shouldNotReachHere();
         }
         return result;
     }
@@ -763,7 +776,7 @@
             case Double:
                 return emitBinary(SSEOp.ADD, SD, true, a, b);
             default:
-                throw GraalInternalError.shouldNotReachHere();
+                throw JVMCIError.shouldNotReachHere();
         }
     }
 
@@ -779,7 +792,7 @@
             case Double:
                 return emitBinary(SSEOp.SUB, SD, false, a, b);
             default:
-                throw GraalInternalError.shouldNotReachHere();
+                throw JVMCIError.shouldNotReachHere();
         }
     }
 
@@ -823,7 +836,7 @@
             case Double:
                 return emitBinary(SSEOp.MUL, SD, true, a, b);
             default:
-                throw GraalInternalError.shouldNotReachHere();
+                throw JVMCIError.shouldNotReachHere();
         }
     }
 
@@ -846,7 +859,7 @@
             case Long:
                 return emitMulHigh(AMD64MOp.IMUL, QWORD, a, b);
             default:
-                throw GraalInternalError.shouldNotReachHere();
+                throw JVMCIError.shouldNotReachHere();
         }
     }
 
@@ -858,7 +871,7 @@
             case Long:
                 return emitMulHigh(AMD64MOp.MUL, QWORD, a, b);
             default:
-                throw GraalInternalError.shouldNotReachHere();
+                throw JVMCIError.shouldNotReachHere();
         }
     }
 
@@ -894,7 +907,7 @@
                 append(new AMD64Unary.MemoryOp(MOV, QWORD, result, address, state));
                 break;
             default:
-                throw GraalInternalError.shouldNotReachHere();
+                throw JVMCIError.shouldNotReachHere();
         }
         return result;
     }
@@ -925,7 +938,7 @@
                 op = emitIDIV(QWORD, a, b, state);
                 break;
             default:
-                throw GraalInternalError.shouldNotReachHere();
+                throw JVMCIError.shouldNotReachHere();
         }
         return new Value[]{emitMove(op.getQuotient()), emitMove(op.getRemainder())};
     }
@@ -944,7 +957,7 @@
             case Double:
                 return emitBinary(SSEOp.DIV, SD, false, a, b);
             default:
-                throw GraalInternalError.shouldNotReachHere();
+                throw JVMCIError.shouldNotReachHere();
         }
     }
 
@@ -968,7 +981,7 @@
                 return result;
             }
             default:
-                throw GraalInternalError.shouldNotReachHere();
+                throw JVMCIError.shouldNotReachHere();
         }
     }
 
@@ -983,7 +996,7 @@
                 op = emitDIV(QWORD, a, b, state);
                 break;
             default:
-                throw GraalInternalError.shouldNotReachHere();
+                throw JVMCIError.shouldNotReachHere();
         }
         return emitMove(op.getQuotient());
     }
@@ -999,7 +1012,7 @@
                 op = emitDIV(QWORD, a, b, state);
                 break;
             default:
-                throw GraalInternalError.shouldNotReachHere();
+                throw JVMCIError.shouldNotReachHere();
         }
         return emitMove(op.getRemainder());
     }
@@ -1016,7 +1029,7 @@
             case Double:
                 return emitBinary(SSEOp.AND, PD, true, a, b);
             default:
-                throw GraalInternalError.shouldNotReachHere();
+                throw JVMCIError.shouldNotReachHere();
         }
     }
 
@@ -1032,7 +1045,7 @@
             case Double:
                 return emitBinary(SSEOp.OR, PD, true, a, b);
             default:
-                throw GraalInternalError.shouldNotReachHere();
+                throw JVMCIError.shouldNotReachHere();
         }
     }
 
@@ -1048,7 +1061,7 @@
             case Double:
                 return emitBinary(SSEOp.XOR, PD, true, a, b);
             default:
-                throw GraalInternalError.shouldNotReachHere();
+                throw JVMCIError.shouldNotReachHere();
         }
     }
 
@@ -1081,7 +1094,7 @@
             case Long:
                 return emitShift(SHL, QWORD, a, b);
             default:
-                throw GraalInternalError.shouldNotReachHere();
+                throw JVMCIError.shouldNotReachHere();
         }
     }
 
@@ -1093,7 +1106,7 @@
             case Long:
                 return emitShift(SAR, QWORD, a, b);
             default:
-                throw GraalInternalError.shouldNotReachHere();
+                throw JVMCIError.shouldNotReachHere();
         }
     }
 
@@ -1105,7 +1118,7 @@
             case Long:
                 return emitShift(SHR, QWORD, a, b);
             default:
-                throw GraalInternalError.shouldNotReachHere();
+                throw JVMCIError.shouldNotReachHere();
         }
     }
 
@@ -1116,7 +1129,7 @@
             case Long:
                 return emitShift(ROL, QWORD, a, b);
             default:
-                throw GraalInternalError.shouldNotReachHere();
+                throw JVMCIError.shouldNotReachHere();
         }
     }
 
@@ -1127,7 +1140,7 @@
             case Long:
                 return emitShift(ROR, QWORD, a, b);
             default:
-                throw GraalInternalError.shouldNotReachHere();
+                throw JVMCIError.shouldNotReachHere();
         }
     }
 
@@ -1182,7 +1195,7 @@
                 }
                 break;
         }
-        throw GraalInternalError.shouldNotReachHere();
+        throw JVMCIError.shouldNotReachHere();
     }
 
     public Value emitFloatConvert(FloatConvert op, Value input) {
@@ -1208,7 +1221,7 @@
             case L2F:
                 return emitConvertOp(LIRKind.derive(input).changeType(Kind.Float), SSEOp.CVTSI2SS, QWORD, input);
             default:
-                throw GraalInternalError.shouldNotReachHere();
+                throw JVMCIError.shouldNotReachHere();
         }
     }
 
@@ -1237,7 +1250,7 @@
                 case 32:
                     return emitConvertOp(LIRKind.derive(inputVal).changeType(Kind.Long), MOVSXD, QWORD, inputVal);
                 default:
-                    throw GraalInternalError.unimplemented("unsupported sign extension (" + fromBits + " bit -> " + toBits + " bit)");
+                    throw JVMCIError.unimplemented("unsupported sign extension (" + fromBits + " bit -> " + toBits + " bit)");
             }
         } else {
             // sign extend to 32 bits (smaller values are internally represented as 32 bit values)
@@ -1249,7 +1262,7 @@
                 case 32:
                     return inputVal;
                 default:
-                    throw GraalInternalError.unimplemented("unsupported sign extension (" + fromBits + " bit -> " + toBits + " bit)");
+                    throw JVMCIError.unimplemented("unsupported sign extension (" + fromBits + " bit -> " + toBits + " bit)");
             }
         }
     }
@@ -1383,7 +1396,7 @@
                 append(new AMD64Binary.DataOp(SSEOp.AND, PD, result, asAllocatable(input), JavaConstant.forDouble(Double.longBitsToDouble(0x7FFFFFFFFFFFFFFFL)), 16));
                 break;
             default:
-                throw GraalInternalError.shouldNotReachHere();
+                throw JVMCIError.shouldNotReachHere();
         }
         return result;
     }
@@ -1399,7 +1412,7 @@
                 append(new AMD64Unary.RMOp(SSEOp.SQRT, SD, result, asAllocatable(input)));
                 break;
             default:
-                throw GraalInternalError.shouldNotReachHere();
+                throw JVMCIError.shouldNotReachHere();
         }
         return result;
     }
--- a/graal/com.oracle.graal.compiler.amd64/src/com/oracle/graal/compiler/amd64/AMD64NodeLIRBuilder.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler.amd64/src/com/oracle/graal/compiler/amd64/AMD64NodeLIRBuilder.java	Thu May 28 21:11:28 2015 -0700
@@ -23,23 +23,27 @@
 
 package com.oracle.graal.compiler.amd64;
 
+import com.oracle.jvmci.code.CallingConvention;
+import com.oracle.jvmci.meta.Kind;
+import com.oracle.jvmci.meta.JavaType;
+import com.oracle.jvmci.meta.PlatformKind;
+import com.oracle.jvmci.meta.JavaConstant;
+import com.oracle.jvmci.meta.Value;
+import com.oracle.jvmci.meta.AllocatableValue;
+import com.oracle.jvmci.meta.LIRKind;
 import static com.oracle.graal.asm.amd64.AMD64Assembler.AMD64BinaryArithmetic.*;
 import static com.oracle.graal.asm.amd64.AMD64Assembler.AMD64RMOp.*;
 import static com.oracle.graal.asm.amd64.AMD64Assembler.OperandSize.*;
 
 import com.oracle.graal.amd64.*;
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.asm.*;
 import com.oracle.graal.asm.amd64.AMD64Assembler.AMD64MIOp;
 import com.oracle.graal.asm.amd64.AMD64Assembler.AMD64RMOp;
 import com.oracle.graal.asm.amd64.AMD64Assembler.OperandSize;
 import com.oracle.graal.asm.amd64.AMD64Assembler.SSEOp;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.calc.*;
 import com.oracle.graal.compiler.gen.*;
 import com.oracle.graal.compiler.match.*;
-import com.oracle.graal.debug.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.amd64.*;
 import com.oracle.graal.lir.amd64.AMD64ControlFlow.BranchOp;
@@ -48,6 +52,8 @@
 import com.oracle.graal.nodes.calc.*;
 import com.oracle.graal.nodes.extended.*;
 import com.oracle.graal.nodes.memory.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.debug.*;
 
 public abstract class AMD64NodeLIRBuilder extends NodeLIRBuilder {
 
@@ -132,7 +138,7 @@
             case Double:
                 return OperandSize.SD;
             default:
-                throw GraalInternalError.shouldNotReachHere("unsupported memory access type " + getMemoryKind(access));
+                throw JVMCIError.shouldNotReachHere("unsupported memory access type " + getMemoryKind(access));
         }
     }
 
@@ -258,7 +264,7 @@
                     op = MOVSXD;
                     break;
                 default:
-                    throw GraalInternalError.unimplemented("unsupported sign extension (" + fromBits + " bit -> " + toBits + " bit)");
+                    throw JVMCIError.unimplemented("unsupported sign extension (" + fromBits + " bit -> " + toBits + " bit)");
             }
         } else {
             kind = Kind.Int;
@@ -274,7 +280,7 @@
                 case 32:
                     return null;
                 default:
-                    throw GraalInternalError.unimplemented("unsupported sign extension (" + fromBits + " bit -> " + toBits + " bit)");
+                    throw JVMCIError.unimplemented("unsupported sign extension (" + fromBits + " bit -> " + toBits + " bit)");
             }
         }
         if (kind != null && op != null) {
@@ -460,7 +466,7 @@
             case L2F:
                 return emitConvertMemoryOp(Kind.Float, SSEOp.CVTSI2SS, QWORD, access);
             default:
-                throw GraalInternalError.shouldNotReachHere();
+                throw JVMCIError.shouldNotReachHere();
         }
     }
 
--- a/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/FieldIntrospection.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/FieldIntrospection.java	Thu May 28 21:11:28 2015 -0700
@@ -22,6 +22,8 @@
  */
 package com.oracle.graal.compiler.common;
 
+import com.oracle.jvmci.common.*;
+
 public abstract class FieldIntrospection<T> extends UnsafeAccess {
 
     private final Class<T> clazz;
--- a/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/Fields.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/Fields.java	Thu May 28 21:11:28 2015 -0700
@@ -22,12 +22,14 @@
  */
 package com.oracle.graal.compiler.common;
 
-import static com.oracle.graal.compiler.common.UnsafeAccess.*;
+import static com.oracle.jvmci.common.UnsafeAccess.*;
 
 import java.util.*;
 
 import sun.misc.*;
 
+import com.oracle.jvmci.common.*;
+
 /**
  * Describes fields in a class, primarily for access via {@link Unsafe}.
  */
@@ -209,7 +211,7 @@
         } else if (type == Byte.TYPE) {
             return unsafe.getByte(object, offset);
         } else {
-            throw GraalInternalError.shouldNotReachHere();
+            throw JVMCIError.shouldNotReachHere();
         }
     }
 
@@ -308,7 +310,7 @@
         } else if (type == Byte.TYPE) {
             unsafe.putByte(object, offset, (byte) value);
         } else {
-            throw GraalInternalError.shouldNotReachHere();
+            throw JVMCIError.shouldNotReachHere();
         }
     }
 
--- a/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/FieldsScanner.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/FieldsScanner.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,7 @@
  */
 package com.oracle.graal.compiler.common;
 
-import static com.oracle.graal.compiler.common.UnsafeAccess.*;
+import static com.oracle.jvmci.common.UnsafeAccess.*;
 
 import java.lang.reflect.*;
 import java.util.*;
--- a/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/GraalInternalError.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,140 +0,0 @@
-/*
- * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.compiler.common;
-
-import java.util.*;
-
-/**
- * This error represents a conditions that should never occur during normal operation.
- */
-public class GraalInternalError extends Error {
-
-    private static final long serialVersionUID = 531632331813456233L;
-    private final ArrayList<String> context = new ArrayList<>();
-
-    public static RuntimeException unimplemented() {
-        throw new GraalInternalError("unimplemented");
-    }
-
-    public static RuntimeException unimplemented(String msg) {
-        throw new GraalInternalError("unimplemented: %s", msg);
-    }
-
-    public static RuntimeException shouldNotReachHere() {
-        throw new GraalInternalError("should not reach here");
-    }
-
-    public static RuntimeException shouldNotReachHere(String msg) {
-        throw new GraalInternalError("should not reach here: %s", msg);
-    }
-
-    public static RuntimeException shouldNotReachHere(Throwable cause) {
-        throw new GraalInternalError(cause);
-    }
-
-    /**
-     * Checks a given condition and throws a {@link GraalInternalError} if it is false. Guarantees
-     * are stronger than assertions in that they are always checked. Error messages for guarantee
-     * violations should clearly indicate the nature of the problem as well as a suggested solution
-     * if possible.
-     *
-     * @param condition the condition to check
-     * @param msg the message that will be associated with the error, in
-     *            {@link String#format(String, Object...)} syntax
-     * @param args arguments to the format string
-     */
-    public static void guarantee(boolean condition, String msg, Object... args) {
-        if (!condition) {
-            throw new GraalInternalError("failed guarantee: " + msg, args);
-        }
-    }
-
-    /**
-     * This constructor creates a {@link GraalInternalError} with a message assembled via
-     * {@link String#format(String, Object...)}. It always uses the ENGLISH locale in order to
-     * always generate the same output.
-     *
-     * @param msg the message that will be associated with the error, in String.format syntax
-     * @param args parameters to String.format - parameters that implement {@link Iterable} will be
-     *            expanded into a [x, x, ...] representation.
-     */
-    public GraalInternalError(String msg, Object... args) {
-        super(format(msg, args));
-    }
-
-    /**
-     * This constructor creates a {@link GraalInternalError} for a given causing Throwable instance.
-     *
-     * @param cause the original exception that contains additional information on this error
-     */
-    public GraalInternalError(Throwable cause) {
-        super(cause);
-    }
-
-    /**
-     * This constructor creates a {@link GraalInternalError} from a given GraalInternalError
-     * instance.
-     *
-     * @param e the original GraalInternalError
-     */
-    public GraalInternalError(GraalInternalError e) {
-        super(e);
-        context.addAll(e.context);
-    }
-
-    @Override
-    public String toString() {
-        StringBuilder str = new StringBuilder();
-        str.append(super.toString());
-        for (String s : context) {
-            str.append("\n\tat ").append(s);
-        }
-        return str.toString();
-    }
-
-    private static String format(String msg, Object... args) {
-        if (args != null) {
-            // expand Iterable parameters into a list representation
-            for (int i = 0; i < args.length; i++) {
-                if (args[i] instanceof Iterable<?>) {
-                    ArrayList<Object> list = new ArrayList<>();
-                    for (Object o : (Iterable<?>) args[i]) {
-                        list.add(o);
-                    }
-                    args[i] = list.toString();
-                }
-            }
-        }
-        return String.format(Locale.ENGLISH, msg, args);
-    }
-
-    public GraalInternalError addContext(String newContext) {
-        this.context.add(newContext);
-        return this;
-    }
-
-    public GraalInternalError addContext(String name, Object obj) {
-        return addContext(format("%s: %s", name, obj));
-    }
-
-}
--- a/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/GraalOptions.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/GraalOptions.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,7 @@
  */
 package com.oracle.graal.compiler.common;
 
-import com.oracle.graal.options.*;
+import com.oracle.jvmci.options.*;
 
 /**
  * This class encapsulates options that control the behavior of the Graal compiler.
@@ -212,9 +212,6 @@
     public static final OptionValue<Boolean> ConditionalElimination = new OptionValue<>(true);
 
     @Option(help = "", type = OptionType.Debug)
-    public static final OptionValue<Boolean> UseProfilingInformation = new OptionValue<>(true);
-
-    @Option(help = "", type = OptionType.Debug)
     public static final OptionValue<Boolean> RemoveNeverExecutedCode = new OptionValue<>(true);
 
     @Option(help = "", type = OptionType.Debug)
@@ -309,12 +306,6 @@
     @Option(help = "Allow backend to match complex expressions.", type = OptionType.Debug)
     public static final OptionValue<Boolean> MatchExpressions = new OptionValue<>(true);
 
-    @Option(help = "Constant fold final fields with default values.", type = OptionType.Debug)
-    public static final OptionValue<Boolean> TrustFinalDefaultFields = new OptionValue<>(true);
-
-    @Option(help = "Mark well-known stable fields as such.", type = OptionType.Debug)
-    public static final OptionValue<Boolean> ImplicitStableValues = new OptionValue<>(true);
-
     @Option(help = "Generate SSA LIR.", type = OptionType.Debug)
     public static final OptionValue<Boolean> SSA_LIR = new OptionValue<>(false);
 
--- a/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/UnsafeAccess.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,95 +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.graal.compiler.common;
-
-import java.lang.reflect.*;
-
-import sun.misc.*;
-
-public class UnsafeAccess {
-
-    /**
-     * An instance of {@link Unsafe} for use within Graal.
-     */
-    public static final Unsafe unsafe;
-
-    static {
-        try {
-            Field theUnsafeInstance = Unsafe.class.getDeclaredField("theUnsafe");
-            theUnsafeInstance.setAccessible(true);
-            unsafe = (Unsafe) theUnsafeInstance.get(Unsafe.class);
-        } catch (Exception e) {
-            throw new RuntimeException("exception while trying to get Unsafe", e);
-        }
-    }
-
-    /**
-     * Copies the contents of a {@link String} to a native memory buffer as a {@code '\0'}
-     * terminated C string. The native memory buffer is allocated via
-     * {@link Unsafe#allocateMemory(long)}. The caller is responsible for releasing the buffer when
-     * it is no longer needed via {@link Unsafe#freeMemory(long)}.
-     *
-     * @return the native memory pointer of the C string created from {@code s}
-     */
-    public static long createCString(String s) {
-        return writeCString(s, unsafe.allocateMemory(s.length() + 1));
-    }
-
-    /**
-     * Reads a {@code '\0'} terminated C string from native memory and converts it to a
-     * {@link String}.
-     *
-     * @return a Java string
-     */
-    public static String readCString(long address) {
-        if (address == 0) {
-            return null;
-        }
-        StringBuilder sb = new StringBuilder();
-        for (int i = 0;; i++) {
-            char c = (char) unsafe.getByte(address + i);
-            if (c == 0) {
-                break;
-            }
-            sb.append(c);
-        }
-        return sb.toString();
-    }
-
-    /**
-     * Writes the contents of a {@link String} to a native memory buffer as a {@code '\0'}
-     * terminated C string. The caller is responsible for ensuring the buffer is at least
-     * {@code s.length() + 1} bytes long. The caller is also responsible for releasing the buffer
-     * when it is no longer.
-     *
-     * @return the value of {@code buf}
-     */
-    public static long writeCString(String s, long buf) {
-        int size = s.length();
-        for (int i = 0; i < size; i++) {
-            unsafe.putByte(buf + i, (byte) s.charAt(i));
-        }
-        unsafe.putByte(buf + size, (byte) '\0');
-        return buf;
-    }
-}
--- a/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/alloc/RegisterAllocationConfig.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/alloc/RegisterAllocationConfig.java	Thu May 28 21:11:28 2015 -0700
@@ -22,12 +22,13 @@
  */
 package com.oracle.graal.compiler.common.alloc;
 
+import com.oracle.jvmci.code.RegisterConfig;
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.meta.PlatformKind;
 import static com.oracle.graal.compiler.common.GraalOptions.*;
 
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.*;
 
 /**
--- a/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/calc/Condition.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/calc/Condition.java	Thu May 28 21:11:28 2015 -0700
@@ -22,9 +22,12 @@
  */
 package com.oracle.graal.compiler.common.calc;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.common.*;
+import com.oracle.jvmci.code.UnsignedMath;
+import com.oracle.jvmci.meta.PrimitiveConstant;
+import com.oracle.jvmci.meta.JavaConstant;
+import com.oracle.jvmci.meta.ConstantReflectionProvider;
+import com.oracle.jvmci.meta.Constant;
+import com.oracle.jvmci.common.*;
 
 /**
  * Condition codes used in conditionals.
@@ -370,7 +373,7 @@
                         case BT:
                             return UnsignedMath.belowThan(x, y);
                         default:
-                            throw new GraalInternalError("expected condition: %s", this);
+                            throw new JVMCIError("expected condition: %s", this);
                     }
                 }
                 case Long: {
@@ -398,7 +401,7 @@
                         case BT:
                             return UnsignedMath.belowThan(x, y);
                         default:
-                            throw new GraalInternalError("expected condition: %s", this);
+                            throw new JVMCIError("expected condition: %s", this);
                     }
                 }
                 case Float: {
@@ -421,7 +424,7 @@
                         case GE:
                             return x >= y;
                         default:
-                            throw new GraalInternalError("expected condition: %s", this);
+                            throw new JVMCIError("expected condition: %s", this);
                     }
                 }
                 case Double: {
@@ -444,16 +447,16 @@
                         case GE:
                             return x >= y;
                         default:
-                            throw new GraalInternalError("expected condition: %s", this);
+                            throw new JVMCIError("expected condition: %s", this);
                     }
                 }
                 default:
-                    throw new GraalInternalError("expected value kind %s while folding condition: %s", lp.getKind(), this);
+                    throw new JVMCIError("expected value kind %s while folding condition: %s", lp.getKind(), this);
             }
         } else {
             Boolean equal = constantReflection.constantEquals(lt, rt);
             if (equal == null) {
-                throw new GraalInternalError("could not fold %s %s %s", lt, this, rt);
+                throw new JVMCIError("could not fold %s %s %s", lt, this, rt);
             }
             switch (this) {
                 case EQ:
@@ -461,7 +464,7 @@
                 case NE:
                     return !equal.booleanValue();
                 default:
-                    throw new GraalInternalError("expected condition: %s", this);
+                    throw new JVMCIError("expected condition: %s", this);
             }
         }
     }
--- a/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/calc/FloatConvert.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/calc/FloatConvert.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,7 @@
  */
 package com.oracle.graal.compiler.common.calc;
 
-import com.oracle.graal.compiler.common.*;
+import com.oracle.jvmci.common.*;
 
 public enum FloatConvert {
     F2I,
@@ -59,7 +59,7 @@
             case L2F:
                 return F2L;
             default:
-                throw GraalInternalError.shouldNotReachHere();
+                throw JVMCIError.shouldNotReachHere();
         }
     }
 }
--- a/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/spi/CodeGenProviders.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/spi/CodeGenProviders.java	Thu May 28 21:11:28 2015 -0700
@@ -22,8 +22,10 @@
  */
 package com.oracle.graal.compiler.common.spi;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.code.CodeCacheProvider;
+import com.oracle.jvmci.code.ForeignCallsProvider;
+import com.oracle.jvmci.meta.ConstantReflectionProvider;
+import com.oracle.jvmci.meta.MetaAccessProvider;
 
 /**
  * A set of providers which are required for LIR and/or code generation. Some may not be present
--- a/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/spi/LIRKindTool.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/spi/LIRKindTool.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,7 @@
  */
 package com.oracle.graal.compiler.common.spi;
 
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.meta.LIRKind;
 
 /**
  * This interface can be used to access platform and VM specific kinds.
--- a/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/type/AbstractObjectStamp.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/type/AbstractObjectStamp.java	Thu May 28 21:11:28 2015 -0700
@@ -22,10 +22,13 @@
  */
 package com.oracle.graal.compiler.common.type;
 
+import com.oracle.jvmci.meta.ResolvedJavaType;
+import com.oracle.jvmci.meta.Kind;
+import com.oracle.jvmci.meta.JavaConstant;
+import com.oracle.jvmci.meta.MetaAccessProvider;
+import com.oracle.jvmci.meta.Constant;
 import java.util.*;
 
-import com.oracle.graal.api.meta.*;
-
 /**
  * Type describing all pointers to Java objects.
  */
--- a/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/type/AbstractPointerStamp.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/type/AbstractPointerStamp.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,9 @@
  */
 package com.oracle.graal.compiler.common.type;
 
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.meta.Kind;
+import com.oracle.jvmci.meta.JavaConstant;
+import com.oracle.jvmci.meta.Constant;
 
 /**
  * Abstract base class of all pointer types.
--- a/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/type/ArithmeticOpTable.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/type/ArithmeticOpTable.java	Thu May 28 21:11:28 2015 -0700
@@ -22,13 +22,12 @@
  */
 package com.oracle.graal.compiler.common.type;
 
-import static com.oracle.graal.api.meta.MetaUtil.*;
+import static com.oracle.jvmci.meta.MetaUtil.*;
 
 import java.util.*;
 import java.util.function.*;
 import java.util.stream.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.calc.*;
 import com.oracle.graal.compiler.common.type.ArithmeticOpTable.BinaryOp.Add;
 import com.oracle.graal.compiler.common.type.ArithmeticOpTable.BinaryOp.And;
@@ -48,6 +47,7 @@
 import com.oracle.graal.compiler.common.type.ArithmeticOpTable.UnaryOp.Neg;
 import com.oracle.graal.compiler.common.type.ArithmeticOpTable.UnaryOp.Not;
 import com.oracle.graal.compiler.common.type.ArithmeticOpTable.UnaryOp.Sqrt;
+import com.oracle.jvmci.meta.*;
 
 /**
  * Information about arithmetic operations.
--- a/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/type/ArithmeticStamp.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/type/ArithmeticStamp.java	Thu May 28 21:11:28 2015 -0700
@@ -22,11 +22,10 @@
  */
 package com.oracle.graal.compiler.common.type;
 
+import com.oracle.jvmci.meta.SerializableConstant;
 import java.nio.*;
 import java.util.*;
 
-import com.oracle.graal.api.meta.*;
-
 /**
  * Type describing values that support arithmetic operations.
  */
--- a/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/type/FloatStamp.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/type/FloatStamp.java	Thu May 28 21:11:28 2015 -0700
@@ -22,17 +22,24 @@
  */
 package com.oracle.graal.compiler.common.type;
 
+import com.oracle.jvmci.meta.PrimitiveConstant;
+import com.oracle.jvmci.meta.ResolvedJavaType;
+import com.oracle.jvmci.meta.LIRKind;
+import com.oracle.jvmci.meta.Kind;
+import com.oracle.jvmci.meta.SerializableConstant;
+import com.oracle.jvmci.meta.JavaConstant;
+import com.oracle.jvmci.meta.MetaAccessProvider;
+import com.oracle.jvmci.meta.Constant;
 import static com.oracle.graal.compiler.common.calc.FloatConvert.*;
 
 import java.nio.*;
 import java.util.function.*;
 
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.spi.*;
 import com.oracle.graal.compiler.common.type.ArithmeticOpTable.BinaryOp;
 import com.oracle.graal.compiler.common.type.ArithmeticOpTable.FloatConvertOp;
 import com.oracle.graal.compiler.common.type.ArithmeticOpTable.UnaryOp;
+import com.oracle.jvmci.common.*;
 
 public class FloatStamp extends PrimitiveStamp {
 
@@ -78,7 +85,7 @@
             case 64:
                 return JavaConstant.forDouble(buffer.getDouble());
             default:
-                throw GraalInternalError.shouldNotReachHere();
+                throw JVMCIError.shouldNotReachHere();
         }
     }
 
@@ -109,7 +116,7 @@
             case 64:
                 return metaAccess.lookupJavaType(Double.TYPE);
             default:
-                throw GraalInternalError.shouldNotReachHere();
+                throw JVMCIError.shouldNotReachHere();
         }
     }
 
@@ -282,7 +289,7 @@
                 case Double:
                     return JavaConstant.forDouble(-value.asDouble());
                 default:
-                    throw GraalInternalError.shouldNotReachHere();
+                    throw JVMCIError.shouldNotReachHere();
             }
         }
 
@@ -306,7 +313,7 @@
                 case Double:
                     return JavaConstant.forDouble(a.asDouble() + b.asDouble());
                 default:
-                    throw GraalInternalError.shouldNotReachHere();
+                    throw JVMCIError.shouldNotReachHere();
             }
         }
 
@@ -325,7 +332,7 @@
                 case Double:
                     return Double.compare(n.asDouble(), -0.0) == 0;
                 default:
-                    throw GraalInternalError.shouldNotReachHere();
+                    throw JVMCIError.shouldNotReachHere();
             }
         }
     },
@@ -343,7 +350,7 @@
                 case Double:
                     return JavaConstant.forDouble(a.asDouble() - b.asDouble());
                 default:
-                    throw GraalInternalError.shouldNotReachHere();
+                    throw JVMCIError.shouldNotReachHere();
             }
         }
 
@@ -362,7 +369,7 @@
                 case Double:
                     return Double.compare(n.asDouble(), 0.0) == 0;
                 default:
-                    throw GraalInternalError.shouldNotReachHere();
+                    throw JVMCIError.shouldNotReachHere();
             }
         }
     },
@@ -380,7 +387,7 @@
                 case Double:
                     return JavaConstant.forDouble(a.asDouble() * b.asDouble());
                 default:
-                    throw GraalInternalError.shouldNotReachHere();
+                    throw JVMCIError.shouldNotReachHere();
             }
         }
 
@@ -399,7 +406,7 @@
                 case Double:
                     return Double.compare(n.asDouble(), 1.0) == 0;
                 default:
-                    throw GraalInternalError.shouldNotReachHere();
+                    throw JVMCIError.shouldNotReachHere();
             }
         }
     },
@@ -417,7 +424,7 @@
                 case Double:
                     return JavaConstant.forDouble(a.asDouble() / b.asDouble());
                 default:
-                    throw GraalInternalError.shouldNotReachHere();
+                    throw JVMCIError.shouldNotReachHere();
             }
         }
 
@@ -436,7 +443,7 @@
                 case Double:
                     return Double.compare(n.asDouble(), 1.0) == 0;
                 default:
-                    throw GraalInternalError.shouldNotReachHere();
+                    throw JVMCIError.shouldNotReachHere();
             }
         }
     },
@@ -454,7 +461,7 @@
                 case Double:
                     return JavaConstant.forDouble(a.asDouble() % b.asDouble());
                 default:
-                    throw GraalInternalError.shouldNotReachHere();
+                    throw JVMCIError.shouldNotReachHere();
             }
         }
 
@@ -478,7 +485,7 @@
                     long d = Double.doubleToRawLongBits(value.asDouble());
                     return JavaConstant.forDouble(Double.longBitsToDouble(~d));
                 default:
-                    throw GraalInternalError.shouldNotReachHere();
+                    throw JVMCIError.shouldNotReachHere();
             }
         }
 
@@ -505,7 +512,7 @@
                     long db = Double.doubleToRawLongBits(b.asDouble());
                     return JavaConstant.forDouble(Double.longBitsToDouble(da & db));
                 default:
-                    throw GraalInternalError.shouldNotReachHere();
+                    throw JVMCIError.shouldNotReachHere();
             }
         }
 
@@ -523,7 +530,7 @@
                 case Double:
                     return Double.doubleToRawLongBits(value.asDouble()) == 0xFFFFFFFFFFFFFFFFL;
                 default:
-                    throw GraalInternalError.shouldNotReachHere();
+                    throw JVMCIError.shouldNotReachHere();
             }
         }
     },
@@ -545,7 +552,7 @@
                     long db = Double.doubleToRawLongBits(b.asDouble());
                     return JavaConstant.forDouble(Double.longBitsToDouble(da | db));
                 default:
-                    throw GraalInternalError.shouldNotReachHere();
+                    throw JVMCIError.shouldNotReachHere();
             }
         }
 
@@ -563,7 +570,7 @@
                 case Double:
                     return Double.doubleToRawLongBits(value.asDouble()) == 0L;
                 default:
-                    throw GraalInternalError.shouldNotReachHere();
+                    throw JVMCIError.shouldNotReachHere();
             }
         }
     },
@@ -585,7 +592,7 @@
                     long db = Double.doubleToRawLongBits(b.asDouble());
                     return JavaConstant.forDouble(Double.longBitsToDouble(da ^ db));
                 default:
-                    throw GraalInternalError.shouldNotReachHere();
+                    throw JVMCIError.shouldNotReachHere();
             }
         }
 
@@ -603,7 +610,7 @@
                 case Double:
                     return Double.doubleToRawLongBits(value.asDouble()) == 0L;
                 default:
-                    throw GraalInternalError.shouldNotReachHere();
+                    throw JVMCIError.shouldNotReachHere();
             }
         }
     },
@@ -621,7 +628,7 @@
                 case Double:
                     return JavaConstant.forDouble(Math.abs(value.asDouble()));
                 default:
-                    throw GraalInternalError.shouldNotReachHere();
+                    throw JVMCIError.shouldNotReachHere();
             }
         }
 
@@ -646,7 +653,7 @@
                 case Double:
                     return JavaConstant.forDouble(Math.sqrt(value.asDouble()));
                 default:
-                    throw GraalInternalError.shouldNotReachHere();
+                    throw JVMCIError.shouldNotReachHere();
             }
         }
 
--- a/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/type/IllegalStamp.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/type/IllegalStamp.java	Thu May 28 21:11:28 2015 -0700
@@ -22,9 +22,15 @@
  */
 package com.oracle.graal.compiler.common.type;
 
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.common.*;
+import com.oracle.jvmci.meta.PrimitiveConstant;
+import com.oracle.jvmci.meta.ResolvedJavaType;
+import com.oracle.jvmci.meta.LIRKind;
+import com.oracle.jvmci.meta.Kind;
+import com.oracle.jvmci.meta.MemoryAccessProvider;
+import com.oracle.jvmci.meta.MetaAccessProvider;
+import com.oracle.jvmci.meta.Constant;
 import com.oracle.graal.compiler.common.spi.*;
+import com.oracle.jvmci.common.*;
 
 /**
  * This stamp represents the type of the {@link Kind#Illegal} value in the second slot of
@@ -43,7 +49,7 @@
 
     @Override
     public LIRKind getLIRKind(LIRKindTool tool) {
-        throw GraalInternalError.shouldNotReachHere("illegal stamp should not reach backend");
+        throw JVMCIError.shouldNotReachHere("illegal stamp should not reach backend");
     }
 
     @Override
@@ -64,7 +70,7 @@
 
     @Override
     public ResolvedJavaType javaType(MetaAccessProvider metaAccess) {
-        throw GraalInternalError.shouldNotReachHere("illegal stamp has no Java type");
+        throw JVMCIError.shouldNotReachHere("illegal stamp has no Java type");
     }
 
     @Override
@@ -102,7 +108,7 @@
 
     @Override
     public Constant readConstant(MemoryAccessProvider provider, Constant base, long displacement) {
-        throw GraalInternalError.shouldNotReachHere("can't read values of illegal stamp");
+        throw JVMCIError.shouldNotReachHere("can't read values of illegal stamp");
     }
 
     private static final IllegalStamp instance = new IllegalStamp();
--- a/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/type/IntegerStamp.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/type/IntegerStamp.java	Thu May 28 21:11:28 2015 -0700
@@ -22,20 +22,27 @@
  */
 package com.oracle.graal.compiler.common.type;
 
+import com.oracle.jvmci.code.CodeUtil;
+import com.oracle.jvmci.meta.PrimitiveConstant;
+import com.oracle.jvmci.meta.ResolvedJavaType;
+import com.oracle.jvmci.meta.LIRKind;
+import com.oracle.jvmci.meta.Kind;
+import com.oracle.jvmci.meta.SerializableConstant;
+import com.oracle.jvmci.meta.JavaConstant;
+import com.oracle.jvmci.meta.MetaAccessProvider;
+import com.oracle.jvmci.meta.Constant;
 import static com.oracle.graal.compiler.common.calc.FloatConvert.*;
 
 import java.nio.*;
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.spi.*;
 import com.oracle.graal.compiler.common.type.ArithmeticOpTable.BinaryOp;
 import com.oracle.graal.compiler.common.type.ArithmeticOpTable.FloatConvertOp;
 import com.oracle.graal.compiler.common.type.ArithmeticOpTable.IntegerConvertOp;
 import com.oracle.graal.compiler.common.type.ArithmeticOpTable.ShiftOp;
 import com.oracle.graal.compiler.common.type.ArithmeticOpTable.UnaryOp;
+import com.oracle.jvmci.common.*;
 
 /**
  * Describes the possible values of a node that produces an int or long result.
@@ -113,7 +120,7 @@
             case 64:
                 return JavaConstant.forLong(buffer.getLong());
             default:
-                throw GraalInternalError.shouldNotReachHere();
+                throw JVMCIError.shouldNotReachHere();
         }
     }
 
@@ -150,7 +157,7 @@
             case 64:
                 return metaAccess.lookupJavaType(Long.TYPE);
             default:
-                throw GraalInternalError.shouldNotReachHere();
+                throw JVMCIError.shouldNotReachHere();
         }
     }
 
@@ -703,7 +710,7 @@
                 case Long:
                     return JavaConstant.forLong(c.asLong() << amount);
                 default:
-                    throw GraalInternalError.shouldNotReachHere();
+                    throw JVMCIError.shouldNotReachHere();
             }
         }
 
@@ -763,7 +770,7 @@
                 case Long:
                     return JavaConstant.forLong(c.asLong() >> amount);
                 default:
-                    throw GraalInternalError.shouldNotReachHere();
+                    throw JVMCIError.shouldNotReachHere();
             }
         }
 
@@ -807,7 +814,7 @@
                 case Long:
                     return JavaConstant.forLong(c.asLong() >>> amount);
                 default:
-                    throw GraalInternalError.shouldNotReachHere();
+                    throw JVMCIError.shouldNotReachHere();
             }
         }
 
--- a/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/type/ObjectStamp.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/type/ObjectStamp.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,10 @@
  */
 package com.oracle.graal.compiler.common.type;
 
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.meta.ResolvedJavaType;
+import com.oracle.jvmci.meta.LIRKind;
+import com.oracle.jvmci.meta.MemoryAccessProvider;
+import com.oracle.jvmci.meta.Constant;
 import com.oracle.graal.compiler.common.spi.*;
 
 public class ObjectStamp extends AbstractObjectStamp {
--- a/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/type/PrimitiveStamp.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/type/PrimitiveStamp.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,8 @@
  */
 package com.oracle.graal.compiler.common.type;
 
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.meta.MemoryAccessProvider;
+import com.oracle.jvmci.meta.Constant;
 
 /**
  * Type describing primitive values.
--- a/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/type/Stamp.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/type/Stamp.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,12 @@
  */
 package com.oracle.graal.compiler.common.type;
 
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.meta.ResolvedJavaType;
+import com.oracle.jvmci.meta.LIRKind;
+import com.oracle.jvmci.meta.Kind;
+import com.oracle.jvmci.meta.MemoryAccessProvider;
+import com.oracle.jvmci.meta.Constant;
+import com.oracle.jvmci.meta.MetaAccessProvider;
 import com.oracle.graal.compiler.common.spi.*;
 
 /**
--- a/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/type/StampFactory.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/type/StampFactory.java	Thu May 28 21:11:28 2015 -0700
@@ -22,9 +22,15 @@
  */
 package com.oracle.graal.compiler.common.type;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.common.*;
+import com.oracle.jvmci.code.CodeUtil;
+import com.oracle.jvmci.meta.JavaType;
+import com.oracle.jvmci.meta.Signature;
+import com.oracle.jvmci.meta.ResolvedJavaType;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
+import com.oracle.jvmci.meta.Kind;
+import com.oracle.jvmci.meta.JavaConstant;
+import com.oracle.jvmci.meta.MetaAccessProvider;
+import com.oracle.jvmci.common.*;
 
 public class StampFactory {
 
@@ -196,7 +202,7 @@
                     return objectNonNull();
                 }
             default:
-                throw new GraalInternalError("unexpected kind: %s", kind);
+                throw new JVMCIError("unexpected kind: %s", kind);
         }
     }
 
--- a/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/type/VoidStamp.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/type/VoidStamp.java	Thu May 28 21:11:28 2015 -0700
@@ -22,9 +22,14 @@
  */
 package com.oracle.graal.compiler.common.type;
 
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.common.*;
+import com.oracle.jvmci.meta.ResolvedJavaType;
+import com.oracle.jvmci.meta.LIRKind;
+import com.oracle.jvmci.meta.Kind;
+import com.oracle.jvmci.meta.MemoryAccessProvider;
+import com.oracle.jvmci.meta.Constant;
+import com.oracle.jvmci.meta.MetaAccessProvider;
 import com.oracle.graal.compiler.common.spi.*;
+import com.oracle.jvmci.common.*;
 
 /**
  * Singleton stamp representing the value of type {@code void}.
@@ -52,7 +57,7 @@
 
     @Override
     public LIRKind getLIRKind(LIRKindTool tool) {
-        throw GraalInternalError.shouldNotReachHere("void stamp has no value");
+        throw JVMCIError.shouldNotReachHere("void stamp has no value");
     }
 
     @Override
@@ -100,12 +105,12 @@
 
     @Override
     public Constant readConstant(MemoryAccessProvider provider, Constant base, long displacement) {
-        throw GraalInternalError.shouldNotReachHere("can't read values of void stamp");
+        throw JVMCIError.shouldNotReachHere("can't read values of void stamp");
     }
 
     @Override
     public Stamp constant(Constant c, MetaAccessProvider meta) {
-        throw GraalInternalError.shouldNotReachHere("void stamp has no value");
+        throw JVMCIError.shouldNotReachHere("void stamp has no value");
     }
 
     private static final VoidStamp instance = new VoidStamp();
--- a/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/util/UnsafeArrayTypeReader.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/util/UnsafeArrayTypeReader.java	Thu May 28 21:11:28 2015 -0700
@@ -24,7 +24,7 @@
 
 import sun.misc.*;
 
-import com.oracle.graal.compiler.common.*;
+import com.oracle.jvmci.common.*;
 
 /**
  * Provides low-level read access from a byte[] array for signed and unsigned values of size 1, 2,
--- a/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/util/UnsafeArrayTypeWriter.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/util/UnsafeArrayTypeWriter.java	Thu May 28 21:11:28 2015 -0700
@@ -25,7 +25,7 @@
 import static com.oracle.graal.compiler.common.util.TypeConversion.*;
 import sun.misc.*;
 
-import com.oracle.graal.compiler.common.*;
+import com.oracle.jvmci.common.*;
 
 /**
  * Provides low-level sequential write access to a byte[] array for signed and unsigned values of
--- a/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/util/Util.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/util/Util.java	Thu May 28 21:11:28 2015 -0700
@@ -22,10 +22,11 @@
  */
 package com.oracle.graal.compiler.common.util;
 
+import com.oracle.jvmci.code.CodeUtil;
+import com.oracle.jvmci.code.BailoutException;
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.debug.*;
+import com.oracle.jvmci.debug.*;
 
 /**
  * The {@code Util} class contains a motley collection of utility methods used throughout the
--- a/graal/com.oracle.graal.compiler.match.processor/src/com/oracle/graal/compiler/match/processor/MatchProcessor.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler.match.processor/src/com/oracle/graal/compiler/match/processor/MatchProcessor.java	Thu May 28 21:11:28 2015 -0700
@@ -34,11 +34,11 @@
 import javax.tools.Diagnostic.Kind;
 import javax.tools.*;
 
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.gen.*;
 import com.oracle.graal.compiler.match.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.*;
+import com.oracle.jvmci.common.*;
 
 /**
  * Processes classes annotated with {@link MatchRule}. A {@link MatchStatementSet} service is
@@ -360,7 +360,7 @@
         if (p != null) {
             return p.getQualifiedName().toString();
         }
-        throw new GraalInternalError("can't find package for %s", type);
+        throw new JVMCIError("can't find package for %s", type);
     }
 
     class MatchDescriptor {
@@ -755,7 +755,7 @@
         }
     }
 
-    private void processMatchableNode(Element element, TypeElement topDeclaringType, MatchableNode matchable, AnnotationMirror mirror) throws GraalInternalError {
+    private void processMatchableNode(Element element, TypeElement topDeclaringType, MatchableNode matchable, AnnotationMirror mirror) throws JVMCIError {
         logMessage("processMatchableNode %s %s %s\n", topDeclaringType, element, matchable);
         String nodeClass;
         String nodePackage;
@@ -766,7 +766,7 @@
             nodeClassMirror = e.getTypeMirror();
         }
         if (nodeClassMirror == null) {
-            throw new GraalInternalError("Can't get mirror for node class %s", element);
+            throw new JVMCIError("Can't get mirror for node class %s", element);
         }
         if (nodeClassMirror.toString().equals(MatchableNode.class.getName())) {
             nodeClass = topDeclaringType.getQualifiedName().toString();
--- a/graal/com.oracle.graal.compiler.sparc/src/com/oracle/graal/compiler/sparc/SPARCLIRGenerator.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler.sparc/src/com/oracle/graal/compiler/sparc/SPARCLIRGenerator.java	Thu May 28 21:11:28 2015 -0700
@@ -23,18 +23,25 @@
 
 package com.oracle.graal.compiler.sparc;
 
-import static com.oracle.graal.api.code.ValueUtil.*;
+import com.oracle.jvmci.code.ForeignCallLinkage;
+import com.oracle.jvmci.code.CodeUtil;
+import com.oracle.jvmci.code.CallingConvention;
+import com.oracle.jvmci.code.StackSlotValue;
+import com.oracle.jvmci.meta.JavaConstant;
+import com.oracle.jvmci.meta.Value;
+import com.oracle.jvmci.meta.AllocatableValue;
+import com.oracle.jvmci.meta.PlatformKind;
+import com.oracle.jvmci.meta.Kind;
+import com.oracle.jvmci.meta.LIRKind;
+import static com.oracle.jvmci.code.ValueUtil.*;
 import static com.oracle.graal.lir.sparc.SPARCArithmetic.*;
 import static com.oracle.graal.lir.sparc.SPARCBitManipulationOp.IntrinsicOpcode.*;
 import static com.oracle.graal.lir.sparc.SPARCCompare.*;
 import static com.oracle.graal.lir.sparc.SPARCMathIntrinsicOp.IntrinsicOpcode.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.asm.sparc.*;
 import com.oracle.graal.asm.sparc.SPARCAssembler.CC;
 import com.oracle.graal.asm.sparc.SPARCAssembler.ConditionFlag;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.calc.*;
 import com.oracle.graal.compiler.common.spi.*;
 import com.oracle.graal.lir.*;
@@ -52,10 +59,21 @@
 import com.oracle.graal.lir.sparc.SPARCControlFlow.ReturnOp;
 import com.oracle.graal.lir.sparc.SPARCControlFlow.StrategySwitchOp;
 import com.oracle.graal.lir.sparc.SPARCControlFlow.TableSwitchOp;
-import com.oracle.graal.lir.sparc.SPARCMove.*;
+import com.oracle.graal.lir.sparc.SPARCMove.LoadAddressOp;
+import com.oracle.graal.lir.sparc.SPARCMove.LoadDataAddressOp;
+import com.oracle.graal.lir.sparc.SPARCMove.LoadOp;
+import com.oracle.graal.lir.sparc.SPARCMove.MembarOp;
+import com.oracle.graal.lir.sparc.SPARCMove.MoveFpGp;
+import com.oracle.graal.lir.sparc.SPARCMove.MoveFpGpVIS3;
+import com.oracle.graal.lir.sparc.SPARCMove.MoveFromRegOp;
+import com.oracle.graal.lir.sparc.SPARCMove.MoveToRegOp;
+import com.oracle.graal.lir.sparc.SPARCMove.NullCheckOp;
+import com.oracle.graal.lir.sparc.SPARCMove.SPARCStackMove;
+import com.oracle.graal.lir.sparc.SPARCMove.StackLoadAddressOp;
 import com.oracle.graal.phases.util.*;
 import com.oracle.graal.sparc.*;
 import com.oracle.graal.sparc.SPARC.CPUFeature;
+import com.oracle.jvmci.common.*;
 
 /**
  * This class implements the SPARC specific portion of the LIR generator.
@@ -270,7 +288,7 @@
                 opcode = DCMP;
                 break;
             default:
-                throw GraalInternalError.shouldNotReachHere(actualCmpKind.toString());
+                throw JVMCIError.shouldNotReachHere(actualCmpKind.toString());
         }
         append(new SPARCControlFlow.CompareBranchOp(opcode, left, right, actualCondition, trueDestination, falseDestination, actualCmpKind, unorderedIsTrue, trueDestinationProbability));
     }
@@ -334,7 +352,7 @@
                 actualFalseValue = load(falseValue);
                 break;
             default:
-                throw GraalInternalError.shouldNotReachHere();
+                throw JVMCIError.shouldNotReachHere();
         }
         Variable result = newVariable(trueValue.getLIRKind());
         ConditionFlag finalCondition = ConditionFlag.fromCondtition(conditionFlags, mirrored ? cond.mirror() : cond, unorderedIsTrue);
@@ -388,7 +406,7 @@
                 append(new CompareOp(DCMP, left, right));
                 break;
             default:
-                throw GraalInternalError.shouldNotReachHere();
+                throw JVMCIError.shouldNotReachHere();
         }
         return mirrored;
     }
@@ -411,7 +429,7 @@
                 conditionCode = CC.Icc;
                 break;
             default:
-                throw GraalInternalError.shouldNotReachHere();
+                throw JVMCIError.shouldNotReachHere();
         }
         ConditionFlag flag = ConditionFlag.fromCondtition(conditionCode, Condition.EQ, false);
         append(new CondMoveOp(result, conditionCode, flag, loadSimm11(trueValue), loadSimm11(falseValue)));
@@ -511,7 +529,7 @@
             case Double:
                 return emitUnary(DNEG, input);
             default:
-                throw GraalInternalError.shouldNotReachHere();
+                throw JVMCIError.shouldNotReachHere();
         }
     }
 
@@ -523,7 +541,7 @@
             case Long:
                 return emitUnary(LNOT, input);
             default:
-                throw GraalInternalError.shouldNotReachHere();
+                throw JVMCIError.shouldNotReachHere();
         }
     }
 
@@ -589,7 +607,7 @@
             case Double:
                 return emitBinary(DADD, true, a, b);
             default:
-                throw GraalInternalError.shouldNotReachHere();
+                throw JVMCIError.shouldNotReachHere();
         }
     }
 
@@ -605,7 +623,7 @@
             case Double:
                 return emitBinary(DSUB, false, a, b);
             default:
-                throw GraalInternalError.shouldNotReachHere("missing: " + a.getKind());
+                throw JVMCIError.shouldNotReachHere("missing: " + a.getKind());
         }
     }
 
@@ -627,7 +645,7 @@
             case Double:
                 return emitBinary(DMUL, true, a, b);
             default:
-                throw GraalInternalError.shouldNotReachHere("missing: " + a.getKind());
+                throw JVMCIError.shouldNotReachHere("missing: " + a.getKind());
         }
     }
 
@@ -639,7 +657,7 @@
             case Long:
                 return emitMulHigh(LMUL, a, b);
             default:
-                throw GraalInternalError.shouldNotReachHere();
+                throw JVMCIError.shouldNotReachHere();
         }
     }
 
@@ -651,7 +669,7 @@
             case Long:
                 return emitMulHigh(LUMUL, a, b);
             default:
-                throw GraalInternalError.shouldNotReachHere();
+                throw JVMCIError.shouldNotReachHere();
         }
     }
 
@@ -674,7 +692,7 @@
             case Double:
                 return emitBinary(DDIV, false, a, b, state);
             default:
-                throw GraalInternalError.shouldNotReachHere("missing: " + a.getKind());
+                throw JVMCIError.shouldNotReachHere("missing: " + a.getKind());
         }
     }
 
@@ -706,7 +724,7 @@
                 append(new BinaryRegReg(DSUB, result, a, q));
                 break;
             default:
-                throw GraalInternalError.shouldNotReachHere("missing: " + a.getKind());
+                throw JVMCIError.shouldNotReachHere("missing: " + a.getKind());
         }
         return result;
     }
@@ -722,7 +740,7 @@
                 append(new RemOp(LUREM, result, load(a), loadNonConst(b), state, this));
                 break;
             default:
-                throw GraalInternalError.shouldNotReachHere();
+                throw JVMCIError.shouldNotReachHere();
         }
         return result;
 
@@ -743,7 +761,7 @@
                 op = LUDIV;
                 break;
             default:
-                throw GraalInternalError.shouldNotReachHere();
+                throw JVMCIError.shouldNotReachHere();
         }
         return emitBinary(op, false, actualA, actualB, state);
     }
@@ -757,7 +775,7 @@
                 return emitBinary(LAND, true, a, b);
 
             default:
-                throw GraalInternalError.shouldNotReachHere("missing: " + a.getKind());
+                throw JVMCIError.shouldNotReachHere("missing: " + a.getKind());
         }
     }
 
@@ -769,7 +787,7 @@
             case Long:
                 return emitBinary(LOR, true, a, b);
             default:
-                throw GraalInternalError.shouldNotReachHere("missing: " + a.getKind());
+                throw JVMCIError.shouldNotReachHere("missing: " + a.getKind());
         }
     }
 
@@ -781,7 +799,7 @@
             case Long:
                 return emitBinary(LXOR, true, a, b);
             default:
-                throw GraalInternalError.shouldNotReachHere();
+                throw JVMCIError.shouldNotReachHere();
         }
     }
 
@@ -803,7 +821,7 @@
             case Long:
                 return emitShift(LSHL, a, b);
             default:
-                throw GraalInternalError.shouldNotReachHere();
+                throw JVMCIError.shouldNotReachHere();
         }
     }
 
@@ -815,7 +833,7 @@
             case Long:
                 return emitShift(LSHR, a, b);
             default:
-                throw GraalInternalError.shouldNotReachHere();
+                throw JVMCIError.shouldNotReachHere();
         }
     }
 
@@ -827,7 +845,7 @@
             case Long:
                 return emitShift(LUSHR, a, b);
             default:
-                throw GraalInternalError.shouldNotReachHere();
+                throw JVMCIError.shouldNotReachHere();
         }
     }
 
@@ -907,7 +925,7 @@
                 return convertedFloatReg;
             }
             default:
-                throw GraalInternalError.shouldNotReachHere();
+                throw JVMCIError.shouldNotReachHere();
         }
     }
 
@@ -955,7 +973,7 @@
                 case 32:
                     return emitConvert2Op(LIRKind.derive(inputVal).changeType(Kind.Long), I2L, asAllocatable(inputVal));
                 default:
-                    throw GraalInternalError.unimplemented("unsupported sign extension (" + fromBits + " bit -> " + toBits + " bit)");
+                    throw JVMCIError.unimplemented("unsupported sign extension (" + fromBits + " bit -> " + toBits + " bit)");
             }
         } else {
             // sign extend to 32 bits (smaller values are internally represented as 32 bit values)
@@ -967,7 +985,7 @@
                 case 32:
                     return inputVal;
                 default:
-                    throw GraalInternalError.unimplemented("unsupported sign extension (" + fromBits + " bit -> " + toBits + " bit)");
+                    throw JVMCIError.unimplemented("unsupported sign extension (" + fromBits + " bit -> " + toBits + " bit)");
             }
         }
     }
--- a/graal/com.oracle.graal.compiler.sparc/src/com/oracle/graal/compiler/sparc/SPARCNodeLIRBuilder.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler.sparc/src/com/oracle/graal/compiler/sparc/SPARCNodeLIRBuilder.java	Thu May 28 21:11:28 2015 -0700
@@ -23,9 +23,11 @@
 
 package com.oracle.graal.compiler.sparc;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.common.*;
+import com.oracle.jvmci.code.CallingConvention;
+import com.oracle.jvmci.meta.Value;
+import com.oracle.jvmci.meta.Kind;
+import com.oracle.jvmci.meta.JavaType;
+import com.oracle.jvmci.meta.LIRKind;
 import com.oracle.graal.compiler.gen.*;
 import com.oracle.graal.compiler.match.*;
 import com.oracle.graal.lir.*;
@@ -35,6 +37,7 @@
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.calc.*;
 import com.oracle.graal.nodes.memory.*;
+import com.oracle.jvmci.common.*;
 
 /**
  * This class implements the SPARC specific portion of the LIR generator.
@@ -99,7 +102,7 @@
                 fromKind = Kind.Int;
                 break;
             default:
-                throw GraalInternalError.unimplemented("unsupported sign extension (" + fromBits + " bit -> " + toBits + " bit)");
+                throw JVMCIError.unimplemented("unsupported sign extension (" + fromBits + " bit -> " + toBits + " bit)");
         }
 
         Kind localFromKind = fromKind;
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/CheckGraalInvariants.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/CheckGraalInvariants.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,18 @@
  */
 package com.oracle.graal.compiler.test;
 
-import static com.oracle.graal.debug.DelegatingDebugConfig.Feature.*;
+import com.oracle.jvmci.code.BailoutException;
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
+import com.oracle.jvmci.meta.JavaType;
+import com.oracle.jvmci.meta.Value;
+import com.oracle.jvmci.meta.JavaMethod;
+import com.oracle.jvmci.meta.LocationIdentity;
+import com.oracle.jvmci.meta.LIRKind;
+import com.oracle.jvmci.meta.ExcludeFromIdentityComparisonVerification;
+import com.oracle.jvmci.meta.MetaAccessProvider;
+import com.oracle.jvmci.meta.JavaField;
+import static com.oracle.jvmci.debug.DelegatingDebugConfig.Feature.*;
 
 import java.io.*;
 import java.lang.reflect.*;
@@ -32,14 +43,11 @@
 
 import org.junit.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.code.Register.RegisterCategory;
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.code.Register.RegisterCategory;
 import com.oracle.graal.api.runtime.*;
 import com.oracle.graal.compiler.*;
 import com.oracle.graal.compiler.CompilerThreadFactory.DebugConfigAccess;
 import com.oracle.graal.compiler.common.type.*;
-import com.oracle.graal.debug.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graphbuilderconf.*;
 import com.oracle.graal.graphbuilderconf.GraphBuilderConfiguration.Plugins;
@@ -55,6 +63,7 @@
 import com.oracle.graal.printer.*;
 import com.oracle.graal.runtime.*;
 import com.oracle.graal.test.*;
+import com.oracle.jvmci.debug.*;
 
 /**
  * Checks that all classes in graal*.jar from the boot classpath comply with global invariants such
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/CommonedConstantsTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/CommonedConstantsTest.java	Thu May 28 21:11:28 2015 -0700
@@ -22,11 +22,11 @@
  */
 package com.oracle.graal.compiler.test;
 
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
 import java.lang.reflect.*;
 
 import org.junit.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.phases.common.*;
 
 /**
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ConcreteSubtypeTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ConcreteSubtypeTest.java	Thu May 28 21:11:28 2015 -0700
@@ -24,7 +24,8 @@
 
 import org.junit.*;
 
-import com.oracle.graal.api.meta.Assumptions.*;
+import com.oracle.jvmci.meta.Assumptions.Assumption;
+import com.oracle.jvmci.meta.Assumptions.ConcreteSubtype;
 import com.oracle.graal.nodes.*;
 
 /**
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ConditionTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ConditionTest.java	Thu May 28 21:11:28 2015 -0700
@@ -22,13 +22,13 @@
  */
 package com.oracle.graal.compiler.test;
 
+import com.oracle.jvmci.meta.JavaConstant;
 import static org.junit.Assert.*;
 
 import java.util.*;
 
 import org.junit.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.calc.*;
 
 public class ConditionTest {
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ConditionalEliminationTestBase.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ConditionalEliminationTestBase.java	Thu May 28 21:11:28 2015 -0700
@@ -24,13 +24,13 @@
 
 import org.junit.*;
 
-import com.oracle.graal.debug.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.phases.common.*;
 import com.oracle.graal.phases.schedule.*;
 import com.oracle.graal.phases.tiers.*;
+import com.oracle.jvmci.debug.*;
 
 /**
  * Collection of tests for
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/DegeneratedLoopsTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/DegeneratedLoopsTest.java	Thu May 28 21:11:28 2015 -0700
@@ -24,13 +24,13 @@
 
 import org.junit.*;
 
-import com.oracle.graal.debug.*;
-import com.oracle.graal.debug.Debug.Scope;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions;
 import com.oracle.graal.phases.common.*;
 import com.oracle.graal.phases.common.inlining.*;
 import com.oracle.graal.phases.tiers.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.debug.Debug.Scope;
 
 /**
  * In the following tests, the usages of local variable "a" are replaced with the integer constant
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/EliminateNestedCheckCastsTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/EliminateNestedCheckCastsTest.java	Thu May 28 21:11:28 2015 -0700
@@ -24,13 +24,13 @@
 
 import org.junit.*;
 
-import com.oracle.graal.debug.*;
-import com.oracle.graal.debug.Debug.Scope;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions;
 import com.oracle.graal.nodes.java.*;
 import com.oracle.graal.phases.common.*;
 import com.oracle.graal.phases.tiers.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.debug.Debug.Scope;
 
 public class EliminateNestedCheckCastsTest extends GraalCompilerTest {
 
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/FinalizableSubclassTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/FinalizableSubclassTest.java	Thu May 28 21:11:28 2015 -0700
@@ -22,16 +22,16 @@
  */
 package com.oracle.graal.compiler.test;
 
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
+import com.oracle.jvmci.meta.Assumptions;
 import java.io.*;
 import java.lang.reflect.*;
 import java.util.*;
 
 import org.junit.*;
 
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.api.meta.Assumptions.Assumption;
-import com.oracle.graal.api.meta.Assumptions.NoFinalizableSubclass;
-import com.oracle.graal.debug.*;
+import com.oracle.jvmci.meta.Assumptions.Assumption;
+import com.oracle.jvmci.meta.Assumptions.NoFinalizableSubclass;
 import com.oracle.graal.graphbuilderconf.*;
 import com.oracle.graal.java.*;
 import com.oracle.graal.nodes.*;
@@ -41,6 +41,7 @@
 import com.oracle.graal.phases.common.*;
 import com.oracle.graal.phases.common.inlining.*;
 import com.oracle.graal.phases.tiers.*;
+import com.oracle.jvmci.debug.*;
 
 public class FinalizableSubclassTest extends GraalCompilerTest {
 
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/FindUniqueConcreteMethodBugTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/FindUniqueConcreteMethodBugTest.java	Thu May 28 21:11:28 2015 -0700
@@ -24,8 +24,8 @@
 
 import org.junit.*;
 
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.api.meta.Assumptions.AssumptionResult;
+import com.oracle.jvmci.meta.Assumptions.AssumptionResult;
+import com.oracle.jvmci.meta.*;
 
 public class FindUniqueConcreteMethodBugTest extends GraalCompilerTest {
 
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/FloatingReadTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/FloatingReadTest.java	Thu May 28 21:11:28 2015 -0700
@@ -24,8 +24,6 @@
 
 import org.junit.*;
 
-import com.oracle.graal.debug.*;
-import com.oracle.graal.debug.Debug.Scope;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions;
@@ -34,6 +32,8 @@
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.phases.common.*;
 import com.oracle.graal.phases.tiers.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.debug.Debug.Scope;
 
 public class FloatingReadTest extends GraphScheduleTest {
 
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerAssumptionsTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerAssumptionsTest.java	Thu May 28 21:11:28 2015 -0700
@@ -22,9 +22,12 @@
  */
 package com.oracle.graal.compiler.test;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.Assumptions.Assumption;
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.code.Architecture;
+import com.oracle.jvmci.code.CompilationResult;
+import com.oracle.jvmci.code.InstalledCode;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
+import com.oracle.jvmci.meta.ResolvedJavaType;
+import com.oracle.jvmci.meta.Assumptions.Assumption;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions;
 
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,22 @@
  */
 package com.oracle.graal.compiler.test;
 
-import static com.oracle.graal.api.code.CodeUtil.*;
+import com.oracle.jvmci.code.Architecture;
+import com.oracle.jvmci.code.CompilationResult;
+import com.oracle.jvmci.code.TargetDescription;
+import com.oracle.jvmci.code.SpeculationLog;
+import com.oracle.jvmci.code.InstalledCode;
+import com.oracle.jvmci.code.CallingConvention;
+import com.oracle.jvmci.code.CodeCacheProvider;
+import com.oracle.jvmci.meta.DeoptimizationReason;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
+import com.oracle.jvmci.meta.Kind;
+import com.oracle.jvmci.meta.ConstantReflectionProvider;
+import com.oracle.jvmci.meta.JavaType;
+import com.oracle.jvmci.meta.ResolvedJavaType;
+import com.oracle.jvmci.meta.ProfilingInfo;
+import com.oracle.jvmci.meta.MetaAccessProvider;
+import static com.oracle.jvmci.code.CodeUtil.*;
 import static com.oracle.graal.compiler.GraalCompiler.*;
 import static com.oracle.graal.compiler.common.GraalOptions.*;
 import static com.oracle.graal.nodes.ConstantNode.*;
@@ -35,22 +50,16 @@
 import org.junit.*;
 import org.junit.internal.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.code.CallingConvention.Type;
+import com.oracle.jvmci.code.CallingConvention.Type;
 import com.oracle.graal.api.directives.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.api.replacements.*;
 import com.oracle.graal.api.runtime.*;
 import com.oracle.graal.compiler.*;
 import com.oracle.graal.compiler.GraalCompiler.Request;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.target.*;
-import com.oracle.graal.debug.*;
-import com.oracle.graal.debug.Debug.Scope;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graphbuilderconf.*;
 import com.oracle.graal.graphbuilderconf.GraphBuilderConfiguration.Plugins;
-import com.oracle.graal.graphbuilderconf.MethodIdMap.Receiver;
 import com.oracle.graal.java.*;
 import com.oracle.graal.lir.asm.*;
 import com.oracle.graal.lir.phases.*;
@@ -60,7 +69,6 @@
 import com.oracle.graal.nodes.cfg.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.virtual.*;
-import com.oracle.graal.options.*;
 import com.oracle.graal.phases.*;
 import com.oracle.graal.phases.common.*;
 import com.oracle.graal.phases.schedule.*;
@@ -70,6 +78,10 @@
 import com.oracle.graal.printer.*;
 import com.oracle.graal.runtime.*;
 import com.oracle.graal.test.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.debug.Debug.Scope;
+import com.oracle.jvmci.options.*;
 
 /**
  * Base class for Graal compiler unit tests.
@@ -677,7 +689,7 @@
             try (Scope s = Debug.scope("CodeInstall", getCodeCache(), installedCodeOwner)) {
                 installedCode = addMethod(installedCodeOwner, compResult);
                 if (installedCode == null) {
-                    throw new GraalInternalError("Could not install code for " + installedCodeOwner.format("%H.%n(%p)"));
+                    throw new JVMCIError("Could not install code for " + installedCodeOwner.format("%H.%n(%p)"));
                 }
             } catch (Throwable e) {
                 throw Debug.handle(e);
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraphEncoderTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraphEncoderTest.java	Thu May 28 21:11:28 2015 -0700
@@ -22,12 +22,12 @@
  */
 package com.oracle.graal.compiler.test;
 
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
 import java.lang.reflect.*;
 import java.util.*;
 
 import org.junit.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions;
 import com.oracle.graal.phases.common.*;
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GuardEliminationCornerCasesTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GuardEliminationCornerCasesTest.java	Thu May 28 21:11:28 2015 -0700
@@ -25,7 +25,6 @@
 import org.junit.*;
 
 import com.oracle.graal.api.directives.*;
-import com.oracle.graal.debug.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions;
@@ -34,6 +33,7 @@
 import com.oracle.graal.phases.common.*;
 import com.oracle.graal.phases.schedule.*;
 import com.oracle.graal.phases.tiers.*;
+import com.oracle.jvmci.debug.*;
 
 public class GuardEliminationCornerCasesTest extends GraalCompilerTest {
 
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/IfCanonicalizerTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/IfCanonicalizerTest.java	Thu May 28 21:11:28 2015 -0700
@@ -26,7 +26,6 @@
 
 import org.junit.*;
 
-import com.oracle.graal.debug.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions;
@@ -34,6 +33,7 @@
 import com.oracle.graal.phases.*;
 import com.oracle.graal.phases.common.*;
 import com.oracle.graal.phases.tiers.*;
+import com.oracle.jvmci.debug.*;
 
 /**
  * In the following tests, the usages of local variable "a" are replaced with the integer constant
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/InfopointReasonTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/InfopointReasonTest.java	Thu May 28 21:11:28 2015 -0700
@@ -22,18 +22,20 @@
  */
 package com.oracle.graal.compiler.test;
 
-import static com.oracle.graal.api.code.CodeUtil.*;
+import com.oracle.jvmci.code.InfopointReason;
+import com.oracle.jvmci.code.CompilationResult;
+import com.oracle.jvmci.code.CallingConvention;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
+import static com.oracle.jvmci.code.CodeUtil.*;
 import static com.oracle.graal.compiler.GraalCompiler.*;
 import static com.oracle.graal.compiler.common.GraalOptions.*;
 import static org.junit.Assert.*;
 
 import org.junit.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.code.CallingConvention.Type;
-import com.oracle.graal.api.code.CompilationResult.Call;
-import com.oracle.graal.api.code.CompilationResult.Infopoint;
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.code.CallingConvention.Type;
+import com.oracle.jvmci.code.CompilationResult.Call;
+import com.oracle.jvmci.code.CompilationResult.Infopoint;
 import com.oracle.graal.graphbuilderconf.*;
 import com.oracle.graal.lir.asm.*;
 import com.oracle.graal.nodes.*;
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/LockEliminationTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/LockEliminationTest.java	Thu May 28 21:11:28 2015 -0700
@@ -22,9 +22,9 @@
  */
 package com.oracle.graal.compiler.test;
 
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
 import org.junit.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions;
 import com.oracle.graal.nodes.java.*;
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/LongNodeChainTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/LongNodeChainTest.java	Thu May 28 21:11:28 2015 -0700
@@ -22,9 +22,9 @@
  */
 package com.oracle.graal.compiler.test;
 
+import com.oracle.jvmci.meta.JavaConstant;
 import org.junit.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions;
 import com.oracle.graal.nodes.calc.*;
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/LoopUnswitchTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/LoopUnswitchTest.java	Thu May 28 21:11:28 2015 -0700
@@ -24,14 +24,14 @@
 
 import org.junit.*;
 
-import com.oracle.graal.debug.*;
-import com.oracle.graal.debug.Debug.Scope;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.loop.phases.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions;
 import com.oracle.graal.phases.common.*;
 import com.oracle.graal.phases.tiers.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.debug.Debug.Scope;
 
 public class LoopUnswitchTest extends GraalCompilerTest {
 
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/MemoryArithmeticTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/MemoryArithmeticTest.java	Thu May 28 21:11:28 2015 -0700
@@ -22,10 +22,10 @@
  */
 package com.oracle.graal.compiler.test;
 
+import com.oracle.jvmci.code.InstalledCode;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
 import org.junit.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.nodes.*;
 
 public class MemoryArithmeticTest extends GraalCompilerTest {
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/MemoryScheduleTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/MemoryScheduleTest.java	Thu May 28 21:11:28 2015 -0700
@@ -29,8 +29,6 @@
 import org.junit.*;
 
 import com.oracle.graal.api.directives.*;
-import com.oracle.graal.debug.*;
-import com.oracle.graal.debug.Debug.Scope;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.iterators.*;
 import com.oracle.graal.nodes.*;
@@ -39,14 +37,16 @@
 import com.oracle.graal.nodes.memory.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.util.*;
-import com.oracle.graal.options.*;
-import com.oracle.graal.options.OptionValue.OverrideScope;
 import com.oracle.graal.phases.*;
 import com.oracle.graal.phases.common.*;
 import com.oracle.graal.phases.common.inlining.*;
 import com.oracle.graal.phases.schedule.*;
 import com.oracle.graal.phases.schedule.SchedulePhase.SchedulingStrategy;
 import com.oracle.graal.phases.tiers.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.debug.Debug.Scope;
+import com.oracle.jvmci.options.*;
+import com.oracle.jvmci.options.OptionValue.OverrideScope;
 
 /**
  * In these test the FrameStates are explicitly cleared out, so that the scheduling of
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/MergeCanonicalizerTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/MergeCanonicalizerTest.java	Thu May 28 21:11:28 2015 -0700
@@ -24,11 +24,11 @@
 
 import org.junit.*;
 
-import com.oracle.graal.debug.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions;
 import com.oracle.graal.phases.common.*;
 import com.oracle.graal.phases.tiers.*;
+import com.oracle.jvmci.debug.*;
 
 public class MergeCanonicalizerTest extends GraalCompilerTest {
 
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/NestedLoopTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/NestedLoopTest.java	Thu May 28 21:11:28 2015 -0700
@@ -25,12 +25,12 @@
 import org.junit.*;
 
 import com.oracle.graal.compiler.common.cfg.*;
-import com.oracle.graal.debug.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions;
 import com.oracle.graal.nodes.cfg.*;
 import com.oracle.graal.nodes.java.*;
+import com.oracle.jvmci.debug.*;
 
 public class NestedLoopTest extends GraalCompilerTest {
 
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/PhiCreationTests.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/PhiCreationTests.java	Thu May 28 21:11:28 2015 -0700
@@ -24,9 +24,9 @@
 
 import org.junit.*;
 
-import com.oracle.graal.debug.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions;
+import com.oracle.jvmci.debug.*;
 
 /**
  * In the following tests, the correct removal of redundant phis during graph building is tested.
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ProfilingInfoTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ProfilingInfoTest.java	Thu May 28 21:11:28 2015 -0700
@@ -22,12 +22,15 @@
  */
 package com.oracle.graal.compiler.test;
 
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
+import com.oracle.jvmci.meta.ResolvedJavaType;
+import com.oracle.jvmci.meta.TriState;
+import com.oracle.jvmci.meta.ProfilingInfo;
+import com.oracle.jvmci.meta.JavaTypeProfile;
 import java.io.*;
 
 import org.junit.*;
 
-import com.oracle.graal.api.meta.*;
-
 /**
  * Tests profiling information provided by the runtime.
  * <p>
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/PushNodesThroughPiTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/PushNodesThroughPiTest.java	Thu May 28 21:11:28 2015 -0700
@@ -22,12 +22,11 @@
  */
 package com.oracle.graal.compiler.test;
 
+import com.oracle.jvmci.meta.ResolvedJavaType;
+import com.oracle.jvmci.meta.ResolvedJavaField;
 import org.junit.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
-import com.oracle.graal.debug.*;
-import com.oracle.graal.debug.Debug.Scope;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions;
 import com.oracle.graal.nodes.calc.*;
@@ -37,6 +36,8 @@
 import com.oracle.graal.nodes.type.*;
 import com.oracle.graal.phases.common.*;
 import com.oracle.graal.phases.tiers.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.debug.Debug.Scope;
 
 public class PushNodesThroughPiTest extends GraalCompilerTest {
 
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/PushThroughIfTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/PushThroughIfTest.java	Thu May 28 21:11:28 2015 -0700
@@ -24,12 +24,12 @@
 
 import org.junit.*;
 
-import com.oracle.graal.debug.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions;
 import com.oracle.graal.nodes.util.*;
 import com.oracle.graal.phases.common.*;
 import com.oracle.graal.phases.tiers.*;
+import com.oracle.jvmci.debug.*;
 
 public class PushThroughIfTest extends GraalCompilerTest {
 
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ReadAfterCheckCastTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ReadAfterCheckCastTest.java	Thu May 28 21:11:28 2015 -0700
@@ -24,14 +24,14 @@
 
 import org.junit.*;
 
-import com.oracle.graal.debug.*;
-import com.oracle.graal.debug.Debug.Scope;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions;
 import com.oracle.graal.nodes.memory.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.phases.common.*;
 import com.oracle.graal.phases.tiers.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.debug.Debug.Scope;
 
 /* consider
  *     B b = (B) a;
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ScalarTypeSystemTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ScalarTypeSystemTest.java	Thu May 28 21:11:28 2015 -0700
@@ -24,11 +24,11 @@
 
 import org.junit.*;
 
-import com.oracle.graal.debug.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions;
 import com.oracle.graal.phases.common.*;
 import com.oracle.graal.phases.tiers.*;
+import com.oracle.jvmci.debug.*;
 
 /**
  * In the following tests, the scalar type system of the compiler should be complete enough to see
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/SchedulingTest2.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/SchedulingTest2.java	Thu May 28 21:11:28 2015 -0700
@@ -27,7 +27,6 @@
 import org.junit.*;
 
 import com.oracle.graal.compiler.common.cfg.*;
-import com.oracle.graal.debug.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.DeoptimizingNode.DeoptDuring;
@@ -40,6 +39,7 @@
 import com.oracle.graal.phases.schedule.*;
 import com.oracle.graal.phases.schedule.SchedulePhase.SchedulingStrategy;
 import com.oracle.graal.phases.tiers.*;
+import com.oracle.jvmci.debug.*;
 
 public class SchedulingTest2 extends GraphScheduleTest {
 
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/SimpleCFGTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/SimpleCFGTest.java	Thu May 28 21:11:28 2015 -0700
@@ -26,10 +26,10 @@
 
 import org.junit.*;
 
-import com.oracle.graal.debug.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions;
 import com.oracle.graal.nodes.cfg.*;
+import com.oracle.jvmci.debug.*;
 
 public class SimpleCFGTest extends GraalCompilerTest {
 
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/StraighteningTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/StraighteningTest.java	Thu May 28 21:11:28 2015 -0700
@@ -24,11 +24,11 @@
 
 import org.junit.*;
 
-import com.oracle.graal.debug.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions;
 import com.oracle.graal.phases.common.*;
 import com.oracle.graal.phases.tiers.*;
+import com.oracle.jvmci.debug.*;
 
 public class StraighteningTest extends GraalCompilerTest {
 
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/TypeSystemTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/TypeSystemTest.java	Thu May 28 21:11:28 2015 -0700
@@ -26,7 +26,6 @@
 
 import org.junit.*;
 
-import com.oracle.graal.debug.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
@@ -36,6 +35,7 @@
 import com.oracle.graal.phases.common.*;
 import com.oracle.graal.phases.schedule.*;
 import com.oracle.graal.phases.tiers.*;
+import com.oracle.jvmci.debug.*;
 
 /**
  * In the following tests, the scalar type system of the compiler should be complete enough to see
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/backend/AllocatorTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/backend/AllocatorTest.java	Thu May 28 21:11:28 2015 -0700
@@ -22,19 +22,20 @@
  */
 package com.oracle.graal.compiler.test.backend;
 
+import com.oracle.jvmci.code.ValueUtil;
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.meta.Value;
 import java.util.*;
 
 import org.junit.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.cfg.*;
-import com.oracle.graal.debug.*;
-import com.oracle.graal.debug.Debug.Scope;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.StandardOp.MoveOp;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.debug.Debug.Scope;
 
 public class AllocatorTest extends BackendTest {
 
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/backend/BackendTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/backend/BackendTest.java	Thu May 28 21:11:28 2015 -0700
@@ -22,18 +22,18 @@
  */
 package com.oracle.graal.compiler.test.backend;
 
-import static com.oracle.graal.api.code.CodeUtil.*;
-
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.code.CallingConvention.Type;
+import com.oracle.jvmci.code.Architecture;
+import com.oracle.jvmci.code.CallingConvention;
+import static com.oracle.jvmci.code.CodeUtil.*;
+import com.oracle.jvmci.code.CallingConvention.Type;
 import com.oracle.graal.compiler.*;
 import com.oracle.graal.compiler.test.*;
-import com.oracle.graal.debug.*;
-import com.oracle.graal.debug.Debug.Scope;
 import com.oracle.graal.lir.gen.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.phases.*;
 import com.oracle.graal.phases.schedule.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.debug.Debug.Scope;
 
 public abstract class BackendTest extends GraalCompilerTest {
 
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/deopt/CompiledMethodTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/deopt/CompiledMethodTest.java	Thu May 28 21:11:28 2015 -0700
@@ -22,10 +22,12 @@
  */
 package com.oracle.graal.compiler.test.deopt;
 
+import com.oracle.jvmci.code.InvalidInstalledCodeException;
+import com.oracle.jvmci.code.InstalledCode;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
+import com.oracle.jvmci.meta.Kind;
 import org.junit.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.test.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions;
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/deopt/MonitorDeoptTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/deopt/MonitorDeoptTest.java	Thu May 28 21:11:28 2015 -0700
@@ -24,10 +24,11 @@
  */
 package com.oracle.graal.compiler.test.deopt;
 
+import com.oracle.jvmci.code.CompilationResult;
+import com.oracle.jvmci.code.InstalledCode;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
 import org.junit.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.test.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions;
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/EATestBase.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/EATestBase.java	Thu May 28 21:11:28 2015 -0700
@@ -22,14 +22,13 @@
  */
 package com.oracle.graal.compiler.test.ea;
 
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
+import com.oracle.jvmci.meta.JavaConstant;
 import java.util.*;
 
 import org.junit.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.test.*;
-import com.oracle.graal.debug.*;
-import com.oracle.graal.debug.Debug.Scope;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions;
 import com.oracle.graal.nodes.java.*;
@@ -38,6 +37,8 @@
 import com.oracle.graal.phases.common.inlining.*;
 import com.oracle.graal.phases.tiers.*;
 import com.oracle.graal.virtual.phases.ea.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.debug.Debug.Scope;
 
 //JaCoCo Exclude
 
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/EscapeAnalysisTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/EscapeAnalysisTest.java	Thu May 28 21:11:28 2015 -0700
@@ -22,9 +22,9 @@
  */
 package com.oracle.graal.compiler.test.ea;
 
+import com.oracle.jvmci.meta.JavaConstant;
 import org.junit.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.loop.phases.*;
 import com.oracle.graal.nodes.extended.*;
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/PEAReadEliminationTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/PEAReadEliminationTest.java	Thu May 28 21:11:28 2015 -0700
@@ -26,7 +26,6 @@
 
 import sun.misc.*;
 
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions;
 import com.oracle.graal.nodes.extended.*;
 import com.oracle.graal.nodes.java.*;
@@ -34,6 +33,7 @@
 import com.oracle.graal.phases.common.inlining.*;
 import com.oracle.graal.phases.tiers.*;
 import com.oracle.graal.virtual.phases.ea.*;
+import com.oracle.jvmci.common.*;
 
 public class PEAReadEliminationTest extends EarlyReadEliminationTest {
 
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/PoorMansEATest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/PoorMansEATest.java	Thu May 28 21:11:28 2015 -0700
@@ -25,8 +25,6 @@
 import org.junit.*;
 
 import com.oracle.graal.compiler.test.*;
-import com.oracle.graal.debug.*;
-import com.oracle.graal.debug.Debug.Scope;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions;
@@ -35,6 +33,8 @@
 import com.oracle.graal.phases.common.*;
 import com.oracle.graal.phases.common.inlining.*;
 import com.oracle.graal.phases.tiers.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.debug.Debug.Scope;
 
 /**
  * Tests {@link AbstractNewObjectNode#simplify(com.oracle.graal.graph.spi.SimplifierTool)}.
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/UnsafeEATest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/UnsafeEATest.java	Thu May 28 21:11:28 2015 -0700
@@ -22,14 +22,14 @@
  */
 package com.oracle.graal.compiler.test.ea;
 
+import com.oracle.jvmci.meta.JavaConstant;
 import org.junit.*;
 
 import sun.misc.*;
 
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.java.*;
+import com.oracle.jvmci.common.*;
 
 public class UnsafeEATest extends EATestBase {
 
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/inlining/InliningTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/inlining/InliningTest.java	Thu May 28 21:11:28 2015 -0700
@@ -22,13 +22,11 @@
  */
 package com.oracle.graal.compiler.test.inlining;
 
+import com.oracle.jvmci.code.InfopointReason;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
 import org.junit.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.test.*;
-import com.oracle.graal.debug.*;
-import com.oracle.graal.debug.Debug.Scope;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graphbuilderconf.*;
 import com.oracle.graal.nodes.*;
@@ -37,6 +35,8 @@
 import com.oracle.graal.phases.common.*;
 import com.oracle.graal.phases.common.inlining.*;
 import com.oracle.graal.phases.tiers.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.debug.Debug.Scope;
 
 public class InliningTest extends GraalCompilerTest {
 
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/tutorial/GraalTutorial.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/tutorial/GraalTutorial.java	Thu May 28 21:11:28 2015 -0700
@@ -22,10 +22,11 @@
  */
 package com.oracle.graal.compiler.test.tutorial;
 
+import com.oracle.jvmci.code.InvalidInstalledCodeException;
+import com.oracle.jvmci.code.InstalledCode;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
 import org.junit.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.java.*;
 
 /**
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/tutorial/InvokeGraal.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/tutorial/InvokeGraal.java	Thu May 28 21:11:28 2015 -0700
@@ -22,17 +22,23 @@
  */
 package com.oracle.graal.compiler.test.tutorial;
 
+import com.oracle.jvmci.code.CodeUtil;
+import com.oracle.jvmci.code.CompilationResult;
+import com.oracle.jvmci.code.TargetDescription;
+import com.oracle.jvmci.code.SpeculationLog;
+import com.oracle.jvmci.code.InstalledCode;
+import com.oracle.jvmci.code.CallingConvention;
+import com.oracle.jvmci.code.CodeCacheProvider;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
+import com.oracle.jvmci.meta.ProfilingInfo;
+import com.oracle.jvmci.meta.MetaAccessProvider;
 import java.lang.reflect.*;
 import java.util.concurrent.atomic.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.code.CallingConvention.Type;
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.code.CallingConvention.Type;
 import com.oracle.graal.api.runtime.*;
 import com.oracle.graal.compiler.*;
 import com.oracle.graal.compiler.target.*;
-import com.oracle.graal.debug.*;
-import com.oracle.graal.debug.Debug.Scope;
 import com.oracle.graal.lir.asm.*;
 import com.oracle.graal.lir.phases.*;
 import com.oracle.graal.nodes.*;
@@ -41,6 +47,8 @@
 import com.oracle.graal.phases.tiers.*;
 import com.oracle.graal.phases.util.*;
 import com.oracle.graal.runtime.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.debug.Debug.Scope;
 
 /**
  * Sample code that shows how to invoke Graal from an application.
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/tutorial/StaticAnalysis.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/tutorial/StaticAnalysis.java	Thu May 28 21:11:28 2015 -0700
@@ -22,15 +22,17 @@
  */
 package com.oracle.graal.compiler.test.tutorial;
 
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
+import com.oracle.jvmci.meta.Kind;
+import com.oracle.jvmci.meta.JavaConstant;
+import com.oracle.jvmci.meta.ResolvedJavaType;
+import com.oracle.jvmci.meta.ResolvedJavaField;
+import com.oracle.jvmci.meta.MetaAccessProvider;
 import java.util.*;
 
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.common.*;
-import com.oracle.graal.debug.*;
-import com.oracle.graal.debug.Debug.Scope;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graphbuilderconf.*;
-import com.oracle.graal.graphbuilderconf.GraphBuilderConfiguration.*;
+import com.oracle.graal.graphbuilderconf.GraphBuilderConfiguration.Plugins;
 import com.oracle.graal.java.*;
 import com.oracle.graal.nodes.CallTargetNode.InvokeKind;
 import com.oracle.graal.nodes.*;
@@ -40,6 +42,9 @@
 import com.oracle.graal.nodes.util.*;
 import com.oracle.graal.phases.*;
 import com.oracle.graal.phases.graph.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.debug.Debug.Scope;
 
 /**
  * A simple context-insensitive static analysis based on the Graal API. It is intended for
@@ -108,7 +113,7 @@
     }
 
     protected static RuntimeException error(String msg) {
-        throw GraalInternalError.shouldNotReachHere(msg);
+        throw JVMCIError.shouldNotReachHere(msg);
     }
 
     /**
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/tutorial/StaticAnalysisTests.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/tutorial/StaticAnalysisTests.java	Thu May 28 21:11:28 2015 -0700
@@ -22,12 +22,15 @@
  */
 package com.oracle.graal.compiler.test.tutorial;
 
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
+import com.oracle.jvmci.meta.ResolvedJavaType;
+import com.oracle.jvmci.meta.ResolvedJavaField;
+import com.oracle.jvmci.meta.MetaAccessProvider;
 import java.lang.reflect.*;
 import java.util.*;
 
 import org.junit.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.api.runtime.*;
 import com.oracle.graal.compiler.target.*;
 import com.oracle.graal.compiler.test.tutorial.StaticAnalysis.MethodState;
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/CompilerThread.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/CompilerThread.java	Thu May 28 21:11:28 2015 -0700
@@ -23,7 +23,7 @@
 package com.oracle.graal.compiler;
 
 import com.oracle.graal.compiler.CompilerThreadFactory.DebugConfigAccess;
-import com.oracle.graal.debug.*;
+import com.oracle.jvmci.debug.*;
 
 /**
  * A compiler thread is a daemon thread that runs at {@link Thread#MAX_PRIORITY} and executes in the
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/CompilerThreadFactory.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/CompilerThreadFactory.java	Thu May 28 21:11:28 2015 -0700
@@ -24,7 +24,7 @@
 
 import java.util.concurrent.*;
 
-import com.oracle.graal.debug.*;
+import com.oracle.jvmci.debug.*;
 
 /**
  * Facility for creating {@linkplain CompilerThread compiler threads}.
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/DebugFilter.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/DebugFilter.java	Thu May 28 21:11:28 2015 -0700
@@ -25,8 +25,8 @@
 import java.util.*;
 import java.util.regex.*;
 
-import com.oracle.graal.debug.*;
-import com.oracle.graal.debug.internal.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.debug.internal.*;
 
 /**
  * Implements the filter specified by the {@link GraalDebugConfig#Dump},
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java	Thu May 28 21:11:28 2015 -0700
@@ -22,6 +22,19 @@
  */
 package com.oracle.graal.compiler;
 
+import com.oracle.jvmci.code.CompilationResult;
+import com.oracle.jvmci.code.TargetDescription;
+import com.oracle.jvmci.code.RegisterConfig;
+import com.oracle.jvmci.code.SpeculationLog;
+import com.oracle.jvmci.code.CallingConvention;
+import com.oracle.jvmci.meta.Assumptions;
+import com.oracle.jvmci.meta.Kind;
+import com.oracle.jvmci.meta.JavaConstant;
+import com.oracle.jvmci.meta.ProfilingInfo;
+import com.oracle.jvmci.meta.TriState;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
+import com.oracle.jvmci.meta.DefaultProfilingInfo;
+import com.oracle.jvmci.meta.VMConstant;
 import static com.oracle.graal.compiler.GraalCompiler.Options.*;
 import static com.oracle.graal.compiler.common.GraalOptions.*;
 import static com.oracle.graal.compiler.common.alloc.RegisterAllocationConfig.*;
@@ -29,16 +42,12 @@
 
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.code.CompilationResult.ConstantReference;
-import com.oracle.graal.api.code.CompilationResult.DataPatch;
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.code.CompilationResult.ConstantReference;
+import com.oracle.jvmci.code.CompilationResult.DataPatch;
 import com.oracle.graal.compiler.LIRGenerationPhase.LIRGenerationContext;
 import com.oracle.graal.compiler.common.alloc.*;
 import com.oracle.graal.compiler.common.cfg.*;
 import com.oracle.graal.compiler.target.*;
-import com.oracle.graal.debug.*;
-import com.oracle.graal.debug.Debug.Scope;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.alloc.lsra.*;
 import com.oracle.graal.lir.asm.*;
@@ -51,13 +60,15 @@
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.cfg.*;
 import com.oracle.graal.nodes.spi.*;
-import com.oracle.graal.options.*;
-import com.oracle.graal.options.OptionValue.*;
 import com.oracle.graal.phases.*;
 import com.oracle.graal.phases.common.*;
 import com.oracle.graal.phases.schedule.*;
 import com.oracle.graal.phases.tiers.*;
 import com.oracle.graal.phases.util.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.debug.Debug.Scope;
+import com.oracle.jvmci.options.*;
+import com.oracle.jvmci.options.OptionValue.OverrideScope;
 
 /**
  * Static methods for orchestrating the compilation of a {@linkplain StructuredGraph graph}.
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalDebugConfig.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalDebugConfig.java	Thu May 28 21:11:28 2015 -0700
@@ -22,18 +22,19 @@
  */
 package com.oracle.graal.compiler;
 
+import com.oracle.jvmci.code.BailoutException;
+import com.oracle.jvmci.meta.JavaMethod;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
 import java.io.*;
 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.nodeinfo.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.util.*;
-import com.oracle.graal.options.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.options.*;
 
 public class GraalDebugConfig implements DebugConfig {
 
@@ -76,11 +77,11 @@
     public static final OptionValue<Boolean> LogVerbose = new OptionValue<>(false);
     // @formatter:on
 
-    public static boolean isNotEmpty(OptionValue<String> option) {
+    static boolean isNotEmpty(OptionValue<String> option) {
         return option.getValue() != null && !option.getValue().isEmpty();
     }
 
-    public static boolean areDebugScopePatternsEnabled() {
+    static boolean areDebugScopePatternsEnabled() {
         return DumpOnError.getValue() || Dump.getValue() != null || Log.getValue() != null || areScopedMetricsOrTimersEnabled();
     }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalDebugConfigOptionsParsed.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2015, 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.compiler;
+
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.runtime.*;
+
+/**
+ * Implementation of {@link OptionsParsed} for setting system properties used in the initialization
+ * of {@link Debug} based on the values specified for various {@link GraalDebugConfig} options.
+ */
+@ServiceProvider(OptionsParsed.class)
+class GraalDebugConfigOptionsParsed implements OptionsParsed {
+
+    @Override
+    public void run() {
+        assert !Debug.Initialization.isDebugInitialized();
+        if (GraalDebugConfig.areDebugScopePatternsEnabled()) {
+            System.setProperty(Debug.Initialization.INITIALIZER_PROPERTY_NAME, "true");
+        }
+        if ("".equals(GraalDebugConfig.Meter.getValue())) {
+            System.setProperty(Debug.ENABLE_UNSCOPED_METRICS_PROPERTY_NAME, "true");
+        }
+        if ("".equals(GraalDebugConfig.Time.getValue())) {
+            System.setProperty(Debug.ENABLE_UNSCOPED_TIMERS_PROPERTY_NAME, "true");
+        }
+        if ("".equals(GraalDebugConfig.TrackMemUse.getValue())) {
+            System.setProperty(Debug.ENABLE_UNSCOPED_MEM_USE_TRACKERS_PROPERTY_NAME, "true");
+        }
+    }
+}
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/LIRGenerationPhase.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/LIRGenerationPhase.java	Thu May 28 21:11:28 2015 -0700
@@ -22,11 +22,11 @@
  */
 package com.oracle.graal.compiler;
 
+import com.oracle.jvmci.code.TargetDescription;
 import static com.oracle.graal.compiler.common.GraalOptions.*;
 
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
 import com.oracle.graal.compiler.common.cfg.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.lir.gen.*;
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/MethodFilter.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/MethodFilter.java	Thu May 28 21:11:28 2015 -0700
@@ -22,11 +22,12 @@
  */
 package com.oracle.graal.compiler;
 
+import com.oracle.jvmci.meta.JavaType;
+import com.oracle.jvmci.meta.JavaMethod;
+import com.oracle.jvmci.meta.Signature;
 import java.util.*;
 import java.util.regex.*;
 
-import com.oracle.graal.api.meta.*;
-
 /**
  * This class implements a method filter that can filter based on class name, method name and
  * parameters. The syntax for the source pattern that is passed to the constructor is as follows:
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/BytecodeLIRBuilder.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/BytecodeLIRBuilder.java	Thu May 28 21:11:28 2015 -0700
@@ -22,8 +22,15 @@
  */
 package com.oracle.graal.compiler.gen;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.code.ValueUtil;
+import com.oracle.jvmci.code.StackSlot;
+import com.oracle.jvmci.code.CallingConvention;
+import com.oracle.jvmci.meta.ResolvedJavaField;
+import com.oracle.jvmci.meta.Value;
+import com.oracle.jvmci.meta.ResolvedJavaType;
+import com.oracle.jvmci.meta.JavaConstant;
+import com.oracle.jvmci.meta.Signature;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
 import com.oracle.graal.lir.gen.*;
 
 public abstract class BytecodeLIRBuilder {
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/BytecodeParserTool.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/BytecodeParserTool.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,7 @@
  */
 package com.oracle.graal.compiler.gen;
 
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.meta.Value;
 
 /**
  * visible interface of bytecode parsers.
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/DebugInfoBuilder.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/DebugInfoBuilder.java	Thu May 28 21:11:28 2015 -0700
@@ -22,19 +22,22 @@
  */
 package com.oracle.graal.compiler.gen;
 
+import com.oracle.jvmci.code.BytecodeFrame;
+import com.oracle.jvmci.code.VirtualObject;
+import com.oracle.jvmci.meta.Value;
+import com.oracle.jvmci.meta.Kind;
+import com.oracle.jvmci.meta.JavaConstant;
 import java.util.*;
 import java.util.Map.Entry;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.common.*;
-import com.oracle.graal.debug.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.util.*;
 import com.oracle.graal.nodes.virtual.*;
 import com.oracle.graal.virtual.nodes.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.debug.*;
 
 /**
  * Builds {@link LIRFrameState}s from {@link FrameState}s.
@@ -145,7 +148,7 @@
                 caller = computeFrameForState(state.outerFrameState());
             }
             return new BytecodeFrame(caller, state.method(), state.bci, state.rethrowException(), state.duringCall(), values, numLocals, numStack, numLocks);
-        } catch (GraalInternalError e) {
+        } catch (JVMCIError e) {
             throw e.addContext("FrameState: ", state);
         }
     }
@@ -192,7 +195,7 @@
                 EscapeObjectState state = objectStates.get(obj);
                 if (state == null && obj.entryCount() > 0) {
                     // null states occur for objects with 0 fields
-                    throw new GraalInternalError("no mapping found for virtual object %s", obj);
+                    throw new JVMCIError("no mapping found for virtual object %s", obj);
                 }
                 if (state instanceof MaterializedObjectState) {
                     return toValue(((MaterializedObjectState) state).materializedValue());
@@ -225,7 +228,7 @@
                     return Value.ILLEGAL;
                 }
             }
-        } catch (GraalInternalError e) {
+        } catch (JVMCIError e) {
             throw e.addContext("toValue: ", value);
         }
     }
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/InstructionPrinter.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/InstructionPrinter.java	Thu May 28 21:11:28 2015 -0700
@@ -24,8 +24,8 @@
 
 import static com.oracle.graal.compiler.gen.InstructionPrinter.InstructionLineColumn.*;
 
-import com.oracle.graal.debug.*;
 import com.oracle.graal.nodes.*;
+import com.oracle.jvmci.debug.*;
 
 /**
  * A utility for {@linkplain #printInstruction(ValueNode) printing} a node as an expression or
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/NodeLIRBuilder.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/NodeLIRBuilder.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,16 @@
  */
 package com.oracle.graal.compiler.gen;
 
-import static com.oracle.graal.api.code.ValueUtil.*;
+import com.oracle.jvmci.code.ValueUtil;
+import com.oracle.jvmci.code.StackSlot;
+import com.oracle.jvmci.code.CallingConvention;
+import com.oracle.jvmci.meta.Value;
+import com.oracle.jvmci.meta.Kind;
+import com.oracle.jvmci.meta.LIRKind;
+import com.oracle.jvmci.meta.AllocatableValue;
+import com.oracle.jvmci.meta.PlatformKind;
+import com.oracle.jvmci.meta.JavaConstant;
+import static com.oracle.jvmci.code.ValueUtil.*;
 import static com.oracle.graal.compiler.GraalDebugConfig.*;
 import static com.oracle.graal.compiler.common.GraalOptions.*;
 import static com.oracle.graal.lir.LIR.*;
@@ -30,15 +39,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.compiler.common.*;
 import com.oracle.graal.compiler.common.calc.*;
 import com.oracle.graal.compiler.common.cfg.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.compiler.match.*;
-import com.oracle.graal.debug.*;
-import com.oracle.graal.debug.Debug.Scope;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.StandardOp.JumpOp;
@@ -54,6 +58,9 @@
 import com.oracle.graal.nodes.memory.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.virtual.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.debug.Debug.Scope;
 
 /**
  * This class traverses the HIR instructions and generates LIR instructions from them.
@@ -296,10 +303,10 @@
                         if (!peephole(valueNode)) {
                             try {
                                 doRoot(valueNode);
-                            } catch (GraalInternalError e) {
-                                throw GraalGraphInternalError.transformAndAddContext(e, valueNode);
+                            } catch (JVMCIError e) {
+                                throw GraalGraphJVMCIError.transformAndAddContext(e, valueNode);
                             } catch (Throwable e) {
-                                throw new GraalGraphInternalError(e).addContext(valueNode);
+                                throw new GraalGraphJVMCIError(e).addContext(valueNode);
                             }
                         }
                     } else if (ComplexMatchValue.INTERIOR_MATCH.equals(operand)) {
@@ -327,7 +334,7 @@
                      * If we have more than one successor, we cannot just use the first one. Since
                      * successors are unordered, this would be a random choice.
                      */
-                    throw new GraalInternalError("Block without BlockEndOp: " + block.getEndNode());
+                    throw new JVMCIError("Block without BlockEndOp: " + block.getEndNode());
                 }
                 gen.emitJump(getLIRBlock((FixedNode) successors.first()));
             }
@@ -389,7 +396,7 @@
         } else if (node instanceof ArithmeticLIRLowerable) {
             ((ArithmeticLIRLowerable) node).generate(this, gen);
         } else {
-            throw GraalInternalError.shouldNotReachHere("node is not LIRLowerable: " + node);
+            throw JVMCIError.shouldNotReachHere("node is not LIRLowerable: " + node);
         }
     }
 
@@ -488,7 +495,7 @@
         } else if (node instanceof IntegerTestNode) {
             emitIntegerTestBranch((IntegerTestNode) node, trueSuccessor, falseSuccessor, trueSuccessorProbability);
         } else {
-            throw GraalInternalError.unimplemented(node.toString());
+            throw JVMCIError.unimplemented(node.toString());
         }
     }
 
@@ -533,7 +540,7 @@
             IntegerTestNode test = (IntegerTestNode) node;
             return gen.emitIntegerTestMove(operand(test.getX()), operand(test.getY()), trueValue, falseValue);
         } else {
-            throw GraalInternalError.unimplemented(node.toString());
+            throw JVMCIError.unimplemented(node.toString());
         }
     }
 
@@ -558,7 +565,7 @@
         } else if (callTarget instanceof IndirectCallTargetNode) {
             emitIndirectCall((IndirectCallTargetNode) callTarget, result, parameters, AllocatableValue.NONE, callState);
         } else {
-            throw GraalInternalError.shouldNotReachHere();
+            throw JVMCIError.shouldNotReachHere();
         }
 
         if (isLegal(result)) {
@@ -586,7 +593,7 @@
                 result[j] = operand;
                 j++;
             } else {
-                throw GraalInternalError.shouldNotReachHere("I thought we no longer have null entries for two-slot types...");
+                throw JVMCIError.shouldNotReachHere("I thought we no longer have null entries for two-slot types...");
             }
         }
         return result;
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/match/ComplexMatchResult.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/match/ComplexMatchResult.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,7 @@
  */
 package com.oracle.graal.compiler.match;
 
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.meta.Value;
 import com.oracle.graal.compiler.gen.*;
 
 /**
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/match/ComplexMatchValue.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/match/ComplexMatchValue.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,9 @@
  */
 package com.oracle.graal.compiler.match;
 
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.meta.Value;
+import com.oracle.jvmci.meta.AbstractValue;
+import com.oracle.jvmci.meta.LIRKind;
 import com.oracle.graal.compiler.gen.*;
 
 /**
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/match/MatchContext.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/match/MatchContext.java	Thu May 28 21:11:28 2015 -0700
@@ -26,13 +26,13 @@
 
 import java.util.*;
 
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.gen.*;
 import com.oracle.graal.compiler.match.MatchPattern.Result;
-import com.oracle.graal.debug.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.calc.*;
 import com.oracle.graal.nodes.virtual.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.debug.*;
 
 /**
  * Container for state captured during a match.
@@ -172,7 +172,7 @@
      *
      * @param name the name of a node in the match rule
      * @return the matched node
-     * @throws GraalInternalError is the named node doesn't exist.
+     * @throws JVMCIError is the named node doesn't exist.
      */
     public Node namedNode(String name) {
         if (namedNodes != null) {
@@ -181,7 +181,7 @@
                 return value.value;
             }
         }
-        throw new GraalInternalError("missing node %s", name);
+        throw new JVMCIError("missing node %s", name);
     }
 
     @Override
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/match/MatchPattern.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/match/MatchPattern.java	Thu May 28 21:11:28 2015 -0700
@@ -22,9 +22,9 @@
  */
 package com.oracle.graal.compiler.match;
 
-import com.oracle.graal.debug.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodeinfo.*;
+import com.oracle.jvmci.debug.*;
 
 /**
  * A simple recursive pattern matcher for a DAG of nodes.
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/match/MatchRuleRegistry.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/match/MatchRuleRegistry.java	Thu May 28 21:11:28 2015 -0700
@@ -23,15 +23,16 @@
 package com.oracle.graal.compiler.match;
 
 import static com.oracle.graal.compiler.GraalDebugConfig.*;
+
 import java.util.*;
 import java.util.Map.Entry;
 
-import com.oracle.graal.api.runtime.*;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.gen.*;
-import com.oracle.graal.debug.*;
-import com.oracle.graal.debug.Debug.Scope;
 import com.oracle.graal.graph.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.debug.Debug.Scope;
+import com.oracle.jvmci.runtime.*;
 
 public class MatchRuleRegistry {
 
@@ -54,7 +55,7 @@
                 }
             }
             if (result[i] == null) {
-                throw new GraalInternalError("unknown field \"%s\" in class %s", names[i], nodeClass);
+                throw new JVMCIError("unknown field \"%s\" in class %s", names[i], nodeClass);
             }
         }
         return result;
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/match/MatchStatement.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/match/MatchStatement.java	Thu May 28 21:11:28 2015 -0700
@@ -26,13 +26,13 @@
 
 import java.util.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.gen.*;
 import com.oracle.graal.compiler.match.MatchPattern.MatchResultCode;
 import com.oracle.graal.compiler.match.MatchPattern.Result;
-import com.oracle.graal.debug.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodeinfo.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * A named {@link MatchPattern} along with a {@link MatchGenerator} that can be evaluated to replace
@@ -124,7 +124,7 @@
             } else {
                 result[i] = context.namedNode(arguments[i]);
                 if (result[i] == null) {
-                    throw new GraalGraphInternalError("Can't find named node %s", arguments[i]);
+                    throw new GraalGraphJVMCIError("Can't find named node %s", arguments[i]);
                 }
             }
         }
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/match/MatchStatementSet.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/match/MatchStatementSet.java	Thu May 28 21:11:28 2015 -0700
@@ -24,8 +24,8 @@
 
 import java.util.*;
 
-import com.oracle.graal.api.runtime.*;
 import com.oracle.graal.compiler.gen.*;
+import com.oracle.jvmci.runtime.*;
 
 public interface MatchStatementSet extends Service {
     /**
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/BasicCompilerConfiguration.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/BasicCompilerConfiguration.java	Thu May 28 21:11:28 2015 -0700
@@ -22,13 +22,13 @@
  */
 package com.oracle.graal.compiler.phases;
 
-import com.oracle.graal.api.runtime.*;
+import com.oracle.graal.lir.phases.AllocationPhase.AllocationContext;
 import com.oracle.graal.lir.phases.*;
-import com.oracle.graal.lir.phases.PreAllocationOptimizationPhase.*;
-import com.oracle.graal.lir.phases.PostAllocationOptimizationPhase.*;
-import com.oracle.graal.lir.phases.AllocationPhase.*;
+import com.oracle.graal.lir.phases.PostAllocationOptimizationPhase.PostAllocationOptimizationContext;
+import com.oracle.graal.lir.phases.PreAllocationOptimizationPhase.PreAllocationOptimizationContext;
 import com.oracle.graal.phases.*;
 import com.oracle.graal.phases.tiers.*;
+import com.oracle.jvmci.runtime.*;
 
 @ServiceProvider(CompilerConfiguration.class)
 public class BasicCompilerConfiguration implements CompilerConfiguration {
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/EconomyCompilerConfiguration.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/EconomyCompilerConfiguration.java	Thu May 28 21:11:28 2015 -0700
@@ -22,13 +22,13 @@
  */
 package com.oracle.graal.compiler.phases;
 
-import com.oracle.graal.api.runtime.*;
+import com.oracle.graal.lir.phases.AllocationPhase.AllocationContext;
 import com.oracle.graal.lir.phases.*;
-import com.oracle.graal.lir.phases.PreAllocationOptimizationPhase.*;
-import com.oracle.graal.lir.phases.PostAllocationOptimizationPhase.*;
-import com.oracle.graal.lir.phases.AllocationPhase.*;
+import com.oracle.graal.lir.phases.PostAllocationOptimizationPhase.PostAllocationOptimizationContext;
+import com.oracle.graal.lir.phases.PreAllocationOptimizationPhase.PreAllocationOptimizationContext;
 import com.oracle.graal.phases.*;
 import com.oracle.graal.phases.tiers.*;
+import com.oracle.jvmci.runtime.*;
 
 @ServiceProvider(CompilerConfiguration.class)
 public class EconomyCompilerConfiguration implements CompilerConfiguration {
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/GraphChangeMonitoringPhase.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/GraphChangeMonitoringPhase.java	Thu May 28 21:11:28 2015 -0700
@@ -25,8 +25,6 @@
 import java.util.*;
 import java.util.stream.*;
 
-import com.oracle.graal.debug.*;
-import com.oracle.graal.debug.Debug.Scope;
 import com.oracle.graal.graph.Graph.NodeEvent;
 import com.oracle.graal.graph.Graph.NodeEventScope;
 import com.oracle.graal.graph.Node;
@@ -34,6 +32,8 @@
 import com.oracle.graal.phases.*;
 import com.oracle.graal.phases.common.util.*;
 import com.oracle.graal.phases.tiers.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.debug.Debug.Scope;
 
 /**
  * A utility phase for detecting when a phase would change the graph and reporting extra information
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/HighTier.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/HighTier.java	Thu May 28 21:11:28 2015 -0700
@@ -28,12 +28,12 @@
 
 import com.oracle.graal.loop.phases.*;
 import com.oracle.graal.nodes.spi.*;
-import com.oracle.graal.options.*;
 import com.oracle.graal.phases.*;
 import com.oracle.graal.phases.common.*;
 import com.oracle.graal.phases.common.inlining.*;
 import com.oracle.graal.phases.tiers.*;
 import com.oracle.graal.virtual.phases.ea.*;
+import com.oracle.jvmci.options.*;
 
 public class HighTier extends PhaseSuite<HighTierContext> {
 
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/LowTier.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/LowTier.java	Thu May 28 21:11:28 2015 -0700
@@ -26,10 +26,10 @@
 import static com.oracle.graal.phases.common.DeadCodeEliminationPhase.Optionality.*;
 
 import com.oracle.graal.nodes.spi.*;
-import com.oracle.graal.options.*;
 import com.oracle.graal.phases.*;
 import com.oracle.graal.phases.common.*;
 import com.oracle.graal.phases.tiers.*;
+import com.oracle.jvmci.options.*;
 
 public class LowTier extends PhaseSuite<LowTierContext> {
 
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/target/Backend.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/target/Backend.java	Thu May 28 21:11:28 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,11 +22,7 @@
  */
 package com.oracle.graal.compiler.target;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.code.stack.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.asm.*;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.alloc.*;
 import com.oracle.graal.compiler.gen.*;
 import com.oracle.graal.lir.*;
@@ -37,6 +33,10 @@
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.phases.tiers.*;
 import com.oracle.graal.phases.util.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.code.stack.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * Represents a compiler backend for Graal.
@@ -65,6 +65,14 @@
         return providers.getCodeCache();
     }
 
+    public MetaAccessProvider getMetaAccess() {
+        return providers.getMetaAccess();
+    }
+
+    public ConstantReflectionProvider getConstantReflection() {
+        return providers.getConstantReflection();
+    }
+
     public ForeignCallsProvider getForeignCalls() {
         return providers.getForeignCalls();
     }
@@ -98,7 +106,7 @@
      * @param parser the bytecode parser the BytecodeLIRBuilder should use
      */
     public BytecodeLIRBuilder newBytecodeLIRBuilder(LIRGeneratorTool gen, BytecodeParserTool parser) {
-        throw GraalInternalError.unimplemented("Baseline compilation is not available for this Backend!");
+        throw JVMCIError.unimplemented("Baseline compilation is not available for this Backend!");
     }
 
     /**
--- a/graal/com.oracle.graal.debug.test/src/com/oracle/graal/debug/test/DebugHistogramTest.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,123 +0,0 @@
-/*
- * Copyright (c) 2013, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.debug.test;
-
-import java.io.*;
-
-import org.junit.*;
-
-import com.oracle.graal.debug.*;
-import com.oracle.graal.debug.internal.*;
-
-public class DebugHistogramTest {
-
-    @Test
-    public void testEmptyHistogram() {
-        DebugHistogram histogram = Debug.createHistogram("TestHistogram");
-        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
-
-        new DebugHistogramAsciiPrinter(new PrintStream(outputStream)).print(histogram);
-        String line = outputStream.toString().split("\r?\n")[0];
-        Assert.assertEquals("TestHistogram is empty.", line);
-
-        outputStream.reset();
-        new DebugHistogramRPrinter(new PrintStream(outputStream)).print(histogram);
-        Assert.assertEquals("", outputStream.toString());
-    }
-
-    @Test
-    public void testSingleEntryHistogram() {
-        DebugHistogram histogram = Debug.createHistogram("TestHistogram");
-        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
-        histogram.add(new Integer(1));
-        histogram.add(new Integer(1));
-        new DebugHistogramAsciiPrinter(new PrintStream(outputStream)).print(histogram);
-        String[] lines = outputStream.toString().split("\r?\n");
-        // @formatter:off
-        String[] expected = {
-            "TestHistogram has 1 unique elements and 2 total elements:",
-            "--------------------------------------------------------------------------------------------------------------------------------------------------------------------------",
-            "| 1                                                  | 2          | ==================================================================================================== |",
-            "--------------------------------------------------------------------------------------------------------------------------------------------------------------------------"
-        };
-        // @formatter:on
-        Assert.assertArrayEquals(expected, lines);
-
-        outputStream.reset();
-        new DebugHistogramRPrinter(new PrintStream(outputStream)).print(histogram);
-        lines = outputStream.toString().split("\r?\n");
-        // @formatter:off
-        expected = new String[] {
-            "TestHistogram <- c(2);",
-            "names(TestHistogram) <- c(\"1\");"
-        };
-        // @formatter:on
-        Assert.assertArrayEquals(expected, lines);
-    }
-
-    @Test
-    public void testMultipleEntryHistogram() {
-        DebugHistogram histogram = Debug.createHistogram("TestHistogram");
-        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
-        histogram.add(new Integer(1));
-        histogram.add(new Integer(2));
-        histogram.add(new Integer(2));
-        new DebugHistogramAsciiPrinter(new PrintStream(outputStream)).print(histogram);
-        String[] lines = outputStream.toString().split("\r?\n");
-        // @formatter:off
-        String[] expected = new String[] {
-            "TestHistogram has 2 unique elements and 3 total elements:",
-            "--------------------------------------------------------------------------------------------------------------------------------------------------------------------------",
-            "| 2                                                  | 2          | ==================================================================================================== |",
-            "| 1                                                  | 1          | ==================================================                                                   |",
-            "--------------------------------------------------------------------------------------------------------------------------------------------------------------------------"
-        };
-        // @formatter:on
-        Assert.assertArrayEquals(expected, lines);
-
-        outputStream.reset();
-        new DebugHistogramRPrinter(new PrintStream(outputStream)).print(histogram);
-        lines = outputStream.toString().split("\r?\n");
-        // @formatter:off
-        expected = new String[] {
-            "TestHistogram <- c(2, 1);",
-            "names(TestHistogram) <- c(\"2\", \"1\");"
-        };
-        // @formatter:on
-        Assert.assertArrayEquals(expected, lines);
-    }
-
-    @Test
-    public void testTooLongValueString() {
-        DebugHistogram histogram = Debug.createHistogram("TestHistogram");
-        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
-        histogram.add("MyCustomValue");
-        new DebugHistogramAsciiPrinter(new PrintStream(outputStream), Integer.MAX_VALUE, 10, 10, 1).print(histogram);
-        String[] lines = outputStream.toString().split("\r?\n");
-        Assert.assertEquals(4, lines.length);
-        Assert.assertEquals("TestHistogram has 1 unique elements and 1 total elements:", lines[0]);
-        Assert.assertEquals("----------------------------------------", lines[1]);
-        Assert.assertEquals("| MyCusto... | 1          | ========== |", lines[2]);
-        Assert.assertEquals("----------------------------------------", lines[3]);
-    }
-}
--- a/graal/com.oracle.graal.debug.test/src/com/oracle/graal/debug/test/DebugTimerTest.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,137 +0,0 @@
-/*
- * Copyright (c) 2013, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.debug.test;
-
-import static org.junit.Assert.*;
-
-import java.lang.management.*;
-
-import org.junit.*;
-
-import com.oracle.graal.debug.*;
-
-public class DebugTimerTest {
-
-    private static final ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean();
-
-    /**
-     * Actively spins the current thread for at least a given number of milliseconds in such a way
-     * that timers for the current thread keep ticking over.
-     *
-     * @return the number of milliseconds actually spent spinning which is guaranteed to be >=
-     *         {@code ms}
-     */
-    private static long spin(long ms) {
-        long start = threadMXBean.getCurrentThreadCpuTime();
-        do {
-            long durationMS = (threadMXBean.getCurrentThreadCpuTime() - start) / 1000;
-            if (durationMS >= ms) {
-                return durationMS;
-            }
-        } while (true);
-    }
-
-    @Test
-    public void test1() {
-        DebugConfig debugConfig = Debug.fixedConfig(0, 0, false, false, true, false, null, null, System.out);
-        try (DebugConfigScope dcs = new DebugConfigScope(debugConfig); Debug.Scope s = Debug.scope("DebugTimerTest")) {
-
-            DebugTimer timerA = Debug.timer("TimerA");
-            DebugTimer timerB = Debug.timer("TimerB");
-
-            long spinA;
-            long spinB;
-
-            try (DebugCloseable a1 = timerA.start()) {
-                spinA = spin(50);
-                try (DebugCloseable b1 = timerB.start()) {
-                    spinB = spin(50);
-                }
-            }
-
-            Assert.assertTrue(timerB.getCurrentValue() < timerA.getCurrentValue());
-            if (timerA.getFlat() != null && timerB.getFlat() != null) {
-                assertTrue(spinB >= spinA || timerB.getFlat().getCurrentValue() < timerA.getFlat().getCurrentValue());
-                assertEquals(timerA.getFlat().getCurrentValue(), timerA.getCurrentValue() - timerB.getFlat().getCurrentValue(), 10D);
-            }
-        }
-    }
-
-    @Test
-    public void test2() {
-        DebugConfig debugConfig = Debug.fixedConfig(0, 0, false, false, true, false, null, null, System.out);
-        try (DebugConfigScope dcs = new DebugConfigScope(debugConfig); Debug.Scope s = Debug.scope("DebugTimerTest")) {
-            DebugTimer timerC = Debug.timer("TimerC");
-            try (DebugCloseable c1 = timerC.start()) {
-                spin(50);
-                try (DebugCloseable c2 = timerC.start()) {
-                    spin(50);
-                    try (DebugCloseable c3 = timerC.start()) {
-                        spin(50);
-                        try (DebugCloseable c4 = timerC.start()) {
-                            spin(50);
-                            try (DebugCloseable c5 = timerC.start()) {
-                                spin(50);
-                            }
-                        }
-                    }
-                }
-            }
-            if (timerC.getFlat() != null) {
-                assertEquals(timerC.getFlat().getCurrentValue(), timerC.getCurrentValue());
-            }
-        }
-    }
-
-    @Test
-    public void test3() {
-        DebugConfig debugConfig = Debug.fixedConfig(0, 0, false, false, true, false, null, null, System.out);
-        try (DebugConfigScope dcs = new DebugConfigScope(debugConfig); Debug.Scope s = Debug.scope("DebugTimerTest")) {
-
-            DebugTimer timerD = Debug.timer("TimerD");
-            DebugTimer timerE = Debug.timer("TimerE");
-
-            long spinD1;
-            long spinE;
-
-            try (DebugCloseable d1 = timerD.start()) {
-                spinD1 = spin(50);
-                try (DebugCloseable e1 = timerE.start()) {
-                    spinE = spin(50);
-                    try (DebugCloseable d2 = timerD.start()) {
-                        spin(50);
-                        try (DebugCloseable d3 = timerD.start()) {
-                            spin(50);
-                        }
-                    }
-                }
-            }
-
-            Assert.assertTrue(timerE.getCurrentValue() < timerD.getCurrentValue());
-            if (timerD.getFlat() != null && timerE.getFlat() != null) {
-                assertTrue(spinE >= spinD1 || timerE.getFlat().getCurrentValue() < timerD.getFlat().getCurrentValue());
-                assertEquals(timerD.getFlat().getCurrentValue(), timerD.getCurrentValue() - timerE.getFlat().getCurrentValue(), 10D);
-            }
-        }
-    }
-}
--- a/graal/com.oracle.graal.debug/overview.html	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
-<head>
-<!--
-
-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.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-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.
--->
-
-</head>
-<body>
-
-Documentation for the <code>com.oracle.graal.debug</code> project.
-
-</body>
-</html>
--- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/AnsiColor.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,88 +0,0 @@
-/*
- * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.debug;
-
-/**
- * Ansi terminal color escape codes.
- */
-public final class AnsiColor {
-    /** Foreground black. */
-    public static final String BLACK = "\u001b[30m";
-    /** Foreground red. */
-    public static final String RED = "\u001b[31m";
-    /** Foreground green. */
-    public static final String GREEN = "\u001b[32m";
-    /** Foreground yellow. */
-    public static final String YELLOW = "\u001b[33m";
-    /** Foreground blue. */
-    public static final String BLUE = "\u001b[34m";
-    /** Foreground magenta. */
-    public static final String MAGENTA = "\u001b[35m";
-    /** Foreground cyan. */
-    public static final String CYAN = "\u001b[36m";
-    /** Foreground white. */
-    public static final String WHITE = "\u001b[37m";
-
-    /** Foreground bold black. */
-    public static final String BOLD_BLACK = "\u001b[30;1m";
-    /** Foreground bold red. */
-    public static final String BOLD_RED = "\u001b[31;1m";
-    /** Foreground bold green. */
-    public static final String BOLD_GREEN = "\u001b[32;1m";
-    /** Foreground bold yellow. */
-    public static final String BOLD_YELLOW = "\u001b[33;1m";
-    /** Foreground bold blue. */
-    public static final String BOLD_BLUE = "\u001b[34;1m";
-    /** Foreground bold magenta. */
-    public static final String BOLD_MAGENTA = "\u001b[35;1m";
-    /** Foreground bold cyan. */
-    public static final String BOLD_CYAN = "\u001b[36;1m";
-    /** Foreground bold white. */
-    public static final String BOLD_WHITE = "\u001b[37;1m";
-
-    /** Background black. */
-    public static final String BG_BLACK = "\u001b[40m";
-    /** Background red. */
-    public static final String BG_RED = "\u001b[41m";
-    /** Background green. */
-    public static final String BG_GREEN = "\u001b[42m";
-    /** Background yellow. */
-    public static final String BG_YELLOW = "\u001b[43m";
-    /** Background blue. */
-    public static final String BG_BLUE = "\u001b[44m";
-    /** Background magenta. */
-    public static final String BG_MAGENTA = "\u001b[45m";
-    /** Background cyan. */
-    public static final String BG_CYAN = "\u001b[46m";
-    /** Background white. */
-    public static final String BG_WHITE = "\u001b[47m";
-
-    /** Reset. */
-    public static final String RESET = "\u001b[0m";
-    /** Underline. */
-    public static final String UNDERLINED = "\u001b[4m";
-
-    /** Prevent instantiation. */
-    private AnsiColor() {
-    }
-}
--- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/Debug.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1544 +0,0 @@
-/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.debug;
-
-import static com.oracle.graal.debug.Debug.Initialization.*;
-import static com.oracle.graal.debug.DelegatingDebugConfig.Feature.*;
-import static java.util.FormattableFlags.*;
-
-import java.io.*;
-import java.util.*;
-import java.util.concurrent.*;
-
-import com.oracle.graal.debug.DelegatingDebugConfig.Level;
-import com.oracle.graal.debug.internal.*;
-
-/**
- * Scope based debugging facility. This facility is {@link #isEnabled()} if assertions are enabled
- * for the {@link Debug} class or the {@value Initialization#INITIALIZER_PROPERTY_NAME} system
- * property is {@code "true"} when {@link Debug} is initialized.
- */
-public class Debug {
-
-    /**
-     * Class to assist with initialization of {@link Debug}.
-     */
-    public static class Initialization {
-
-        public static final String INITIALIZER_PROPERTY_NAME = "graal.debug.enable";
-
-        private static boolean initialized;
-
-        /**
-         * Determines if {@link Debug} has been initialized.
-         */
-        public static boolean isDebugInitialized() {
-            return initialized;
-        }
-
-    }
-
-    @SuppressWarnings("all")
-    private static boolean initialize() {
-        boolean assertionsEnabled = false;
-        assert assertionsEnabled = true;
-        Initialization.initialized = true;
-        return assertionsEnabled || Boolean.getBoolean(INITIALIZER_PROPERTY_NAME);
-    }
-
-    private static final boolean ENABLED = initialize();
-
-    public static boolean isEnabled() {
-        return ENABLED;
-    }
-
-    public static boolean isDumpEnabledForMethod() {
-        if (!ENABLED) {
-            return false;
-        }
-        DebugConfig config = DebugScope.getConfig();
-        if (config == null) {
-            return false;
-        }
-        return config.isDumpEnabledForMethod();
-    }
-
-    public static final int DEFAULT_LOG_LEVEL = 2;
-
-    public static boolean isDumpEnabled() {
-        return isDumpEnabled(DEFAULT_LOG_LEVEL);
-    }
-
-    public static boolean isDumpEnabled(int dumpLevel) {
-        return ENABLED && DebugScope.getInstance().isDumpEnabled(dumpLevel);
-    }
-
-    /**
-     * Determines if verification is enabled in the current method, regardless of the
-     * {@linkplain Debug#currentScope() current debug scope}.
-     *
-     * @see Debug#verify(Object, String)
-     */
-    public static boolean isVerifyEnabledForMethod() {
-        if (!ENABLED) {
-            return false;
-        }
-        DebugConfig config = DebugScope.getConfig();
-        if (config == null) {
-            return false;
-        }
-        return config.isVerifyEnabledForMethod();
-    }
-
-    /**
-     * Determines if verification is enabled in the {@linkplain Debug#currentScope() current debug
-     * scope}.
-     *
-     * @see Debug#verify(Object, String)
-     */
-    public static boolean isVerifyEnabled() {
-        return ENABLED && DebugScope.getInstance().isVerifyEnabled();
-    }
-
-    public static boolean isMeterEnabled() {
-        return ENABLED && DebugScope.getInstance().isMeterEnabled();
-    }
-
-    public static boolean isTimeEnabled() {
-        return ENABLED && DebugScope.getInstance().isTimeEnabled();
-    }
-
-    public static boolean isMemUseTrackingEnabled() {
-        return ENABLED && DebugScope.getInstance().isMemUseTrackingEnabled();
-    }
-
-    public static boolean isLogEnabledForMethod() {
-        if (!ENABLED) {
-            return false;
-        }
-        DebugConfig config = DebugScope.getConfig();
-        if (config == null) {
-            return false;
-        }
-        return config.isLogEnabledForMethod();
-    }
-
-    public static boolean isLogEnabled() {
-        return isLogEnabled(DEFAULT_LOG_LEVEL);
-    }
-
-    public static boolean isLogEnabled(int logLevel) {
-        return ENABLED && DebugScope.getInstance().isLogEnabled(logLevel);
-    }
-
-    @SuppressWarnings("unused")
-    public static Runnable decorateDebugRoot(Runnable runnable, String name, DebugConfig config) {
-        return runnable;
-    }
-
-    @SuppressWarnings("unused")
-    public static <T> Callable<T> decorateDebugRoot(Callable<T> callable, String name, DebugConfig config) {
-        return callable;
-    }
-
-    @SuppressWarnings("unused")
-    public static Runnable decorateScope(Runnable runnable, String name, Object... context) {
-        return runnable;
-    }
-
-    @SuppressWarnings("unused")
-    public static <T> Callable<T> decorateScope(Callable<T> callable, String name, Object... context) {
-        return callable;
-    }
-
-    /**
-     * Gets a string composed of the names in the current nesting of debug
-     * {@linkplain #scope(Object) scopes} separated by {@code '.'}.
-     */
-    public static String currentScope() {
-        if (ENABLED) {
-            return DebugScope.getInstance().getQualifiedName();
-        } else {
-            return "";
-        }
-    }
-
-    /**
-     * Represents a debug scope entered by {@link Debug#scope(Object)} or
-     * {@link Debug#sandbox(CharSequence, DebugConfig, Object...)}. Leaving the scope is achieved
-     * via {@link #close()}.
-     */
-    public interface Scope extends AutoCloseable {
-        void close();
-    }
-
-    /**
-     * Creates and enters a new debug scope which will be a child of the current debug scope.
-     * <p>
-     * It is recommended to use the try-with-resource statement for managing entering and leaving
-     * debug scopes. For example:
-     *
-     * <pre>
-     * try (Scope s = Debug.scope(&quot;InliningGraph&quot;, inlineeGraph)) {
-     *     ...
-     * } catch (Throwable e) {
-     *     throw Debug.handle(e);
-     * }
-     * </pre>
-     *
-     * The {@code name} argument is subject to the following type based conversion before having
-     * {@link Object#toString()} called on it:
-     *
-     * <pre>
-     *     Type          | Conversion
-     * ------------------+-----------------
-     *  java.lang.Class  | arg.getSimpleName()
-     *                   |
-     * </pre>
-     *
-     * @param name the name of the new scope
-     * @param contextObjects an array of object to be appended to the {@linkplain #context()
-     *            current} debug context
-     * @throws Throwable used to enforce a catch block.
-     * @return the scope entered by this method which will be exited when its {@link Scope#close()}
-     *         method is called
-     */
-    public static Scope scope(Object name, Object[] contextObjects) throws Throwable {
-        if (ENABLED) {
-            return DebugScope.getInstance().scope(convertFormatArg(name).toString(), null, contextObjects);
-        } else {
-            return null;
-        }
-    }
-
-    /**
-     * Similar to {@link #scope(Object, Object[])} but without context objects. Therefore the catch
-     * block can be omitted.
-     *
-     * @see #scope(Object, Object[])
-     */
-    public static Scope scope(Object name) {
-        if (ENABLED) {
-            return DebugScope.getInstance().scope(convertFormatArg(name).toString(), null);
-        } else {
-            return null;
-        }
-    }
-
-    /**
-     * @see #scope(Object, Object[])
-     * @param context an object to be appended to the {@linkplain #context() current} debug context
-     */
-    public static Scope scope(Object name, Object context) throws Throwable {
-        if (ENABLED) {
-            return DebugScope.getInstance().scope(convertFormatArg(name).toString(), null, context);
-        } else {
-            return null;
-        }
-    }
-
-    /**
-     * @see #scope(Object, Object[])
-     * @param context1 first object to be appended to the {@linkplain #context() current} debug
-     *            context
-     * @param context2 second object to be appended to the {@linkplain #context() current} debug
-     *            context
-     */
-    public static Scope scope(Object name, Object context1, Object context2) throws Throwable {
-        if (ENABLED) {
-            return DebugScope.getInstance().scope(convertFormatArg(name).toString(), null, context1, context2);
-        } else {
-            return null;
-        }
-    }
-
-    /**
-     * @see #scope(Object, Object[])
-     * @param context1 first object to be appended to the {@linkplain #context() current} debug
-     *            context
-     * @param context2 second object to be appended to the {@linkplain #context() current} debug
-     *            context
-     * @param context3 third object to be appended to the {@linkplain #context() current} debug
-     *            context
-     */
-    public static Scope scope(Object name, Object context1, Object context2, Object context3) throws Throwable {
-        if (ENABLED) {
-            return DebugScope.getInstance().scope(convertFormatArg(name).toString(), null, context1, context2, context3);
-        } else {
-            return null;
-        }
-    }
-
-    /**
-     * Creates and enters a new debug scope which will be disjoint from the current debug scope.
-     * <p>
-     * It is recommended to use the try-with-resource statement for managing entering and leaving
-     * debug scopes. For example:
-     *
-     * <pre>
-     * try (Scope s = Debug.sandbox(&quot;CompilingStub&quot;, null, stubGraph)) {
-     *     ...
-     * } catch (Throwable e) {
-     *     throw Debug.handle(e);
-     * }
-     * </pre>
-     *
-     * @param name the name of the new scope
-     * @param config the debug configuration to use for the new scope
-     * @param context objects to be appended to the {@linkplain #context() current} debug context
-     * @return the scope entered by this method which will be exited when its {@link Scope#close()}
-     *         method is called
-     */
-    public static Scope sandbox(CharSequence name, DebugConfig config, Object... context) throws Throwable {
-        if (ENABLED) {
-            DebugConfig sandboxConfig = config == null ? silentConfig() : config;
-            return DebugScope.getInstance().scope(name, sandboxConfig, context);
-        } else {
-            return null;
-        }
-    }
-
-    public static Scope forceLog() throws Throwable {
-        ArrayList<Object> context = new ArrayList<>();
-        for (Object obj : context()) {
-            context.add(obj);
-        }
-        return Debug.sandbox("forceLog", new DelegatingDebugConfig().override(Level.LOG, Integer.MAX_VALUE).enable(LOG_METHOD), context.toArray());
-    }
-
-    /**
-     * Opens a scope in which exception {@linkplain DebugConfig#interceptException(Throwable)
-     * interception} is disabled. It is recommended to use the try-with-resource statement for
-     * managing entering and leaving such scopes:
-     *
-     * <pre>
-     * try (DebugConfigScope s = Debug.disableIntercept()) {
-     *     ...
-     * }
-     * </pre>
-     *
-     * This is particularly useful to suppress extraneous output in JUnit tests that are expected to
-     * throw an exception.
-     */
-    public static DebugConfigScope disableIntercept() {
-        return Debug.setConfig(new DelegatingDebugConfig().disable(INTERCEPT));
-    }
-
-    /**
-     * Handles an exception in the context of the debug scope just exited. The just exited scope
-     * must have the current scope as its parent which will be the case if the try-with-resource
-     * pattern recommended by {@link #scope(Object)} and
-     * {@link #sandbox(CharSequence, DebugConfig, Object...)} is used
-     *
-     * @see #scope(Object, Object[])
-     * @see #sandbox(CharSequence, DebugConfig, Object...)
-     */
-    public static RuntimeException handle(Throwable exception) {
-        if (ENABLED) {
-            return DebugScope.getInstance().handle(exception);
-        } else {
-            if (exception instanceof Error) {
-                throw (Error) exception;
-            }
-            if (exception instanceof RuntimeException) {
-                throw (RuntimeException) exception;
-            }
-            throw new RuntimeException(exception);
-        }
-    }
-
-    public static void log(String msg) {
-        log(DEFAULT_LOG_LEVEL, msg);
-    }
-
-    /**
-     * Prints a message to the current debug scope's logging stream if logging is enabled.
-     *
-     * @param msg the message to log
-     */
-    public static void log(int logLevel, String msg) {
-        if (ENABLED) {
-            DebugScope.getInstance().log(logLevel, msg);
-        }
-    }
-
-    public static void log(String format, Object arg) {
-        log(DEFAULT_LOG_LEVEL, format, arg);
-    }
-
-    /**
-     * Prints a message to the current debug scope's logging stream if logging is enabled.
-     *
-     * @param format a format string
-     * @param arg the argument referenced by the format specifiers in {@code format}
-     */
-    public static void log(int logLevel, String format, Object arg) {
-        if (ENABLED) {
-            DebugScope.getInstance().log(logLevel, format, arg);
-        }
-    }
-
-    public static void log(String format, int arg) {
-        log(DEFAULT_LOG_LEVEL, format, arg);
-    }
-
-    /**
-     * Prints a message to the current debug scope's logging stream if logging is enabled.
-     *
-     * @param format a format string
-     * @param arg the argument referenced by the format specifiers in {@code format}
-     */
-    public static void log(int logLevel, String format, int arg) {
-        if (ENABLED) {
-            DebugScope.getInstance().log(logLevel, format, arg);
-        }
-    }
-
-    public static void log(String format, Object arg1, Object arg2) {
-        log(DEFAULT_LOG_LEVEL, format, arg1, arg2);
-    }
-
-    /**
-     * @see #log(int, String, Object)
-     */
-    public static void log(int logLevel, String format, Object arg1, Object arg2) {
-        if (ENABLED) {
-            DebugScope.getInstance().log(logLevel, format, arg1, arg2);
-        }
-    }
-
-    public static void log(String format, int arg1, Object arg2) {
-        log(DEFAULT_LOG_LEVEL, format, arg1, arg2);
-    }
-
-    /**
-     * @see #log(int, String, Object)
-     */
-    public static void log(int logLevel, String format, int arg1, Object arg2) {
-        if (ENABLED) {
-            DebugScope.getInstance().log(logLevel, format, arg1, arg2);
-        }
-    }
-
-    public static void log(String format, Object arg1, int arg2) {
-        log(DEFAULT_LOG_LEVEL, format, arg1, arg2);
-    }
-
-    /**
-     * @see #log(int, String, Object)
-     */
-    public static void log(int logLevel, String format, Object arg1, int arg2) {
-        if (ENABLED) {
-            DebugScope.getInstance().log(logLevel, format, arg1, arg2);
-        }
-    }
-
-    public static void log(String format, int arg1, int arg2) {
-        log(DEFAULT_LOG_LEVEL, format, arg1, arg2);
-    }
-
-    /**
-     * @see #log(int, String, Object)
-     */
-    public static void log(int logLevel, String format, int arg1, int arg2) {
-        if (ENABLED) {
-            DebugScope.getInstance().log(logLevel, format, arg1, arg2);
-        }
-    }
-
-    public static void log(String format, Object arg1, Object arg2, Object arg3) {
-        log(DEFAULT_LOG_LEVEL, format, arg1, arg2, arg3);
-    }
-
-    /**
-     * @see #log(int, String, Object)
-     */
-    public static void log(int logLevel, String format, Object arg1, Object arg2, Object arg3) {
-        if (ENABLED) {
-            DebugScope.getInstance().log(logLevel, format, arg1, arg2, arg3);
-        }
-    }
-
-    public static void log(String format, int arg1, int arg2, int arg3) {
-        log(DEFAULT_LOG_LEVEL, format, arg1, arg2, arg3);
-    }
-
-    /**
-     * @see #log(int, String, Object)
-     */
-    public static void log(int logLevel, String format, int arg1, int arg2, int arg3) {
-        if (ENABLED) {
-            DebugScope.getInstance().log(logLevel, format, arg1, arg2, arg3);
-        }
-    }
-
-    public static void log(String format, Object arg1, Object arg2, Object arg3, Object arg4) {
-        log(DEFAULT_LOG_LEVEL, format, arg1, arg2, arg3, arg4);
-    }
-
-    /**
-     * @see #log(int, String, Object)
-     */
-    public static void log(int logLevel, String format, Object arg1, Object arg2, Object arg3, Object arg4) {
-        if (ENABLED) {
-            DebugScope.getInstance().log(logLevel, format, arg1, arg2, arg3, arg4);
-        }
-    }
-
-    public static void log(String format, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5) {
-        log(DEFAULT_LOG_LEVEL, format, arg1, arg2, arg3, arg4, arg5);
-    }
-
-    /**
-     * @see #log(int, String, Object)
-     */
-    public static void log(int logLevel, String format, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5) {
-        if (ENABLED) {
-            DebugScope.getInstance().log(logLevel, format, arg1, arg2, arg3, arg4, arg5);
-        }
-    }
-
-    public static void log(String format, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6) {
-        log(DEFAULT_LOG_LEVEL, format, arg1, arg2, arg3, arg4, arg5, arg6);
-    }
-
-    /**
-     * @see #log(int, String, Object)
-     */
-    public static void log(int logLevel, String format, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6) {
-        if (ENABLED) {
-            DebugScope.getInstance().log(logLevel, format, arg1, arg2, arg3, arg4, arg5, arg6);
-        }
-    }
-
-    public static void log(String format, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7) {
-        log(DEFAULT_LOG_LEVEL, format, arg1, arg2, arg3, arg4, arg5, arg6, arg7);
-    }
-
-    public static void log(String format, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7, Object arg8) {
-        log(DEFAULT_LOG_LEVEL, format, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);
-    }
-
-    /**
-     * @see #log(int, String, Object)
-     */
-    public static void log(int logLevel, String format, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7) {
-        if (ENABLED) {
-            DebugScope.getInstance().log(logLevel, format, arg1, arg2, arg3, arg4, arg5, arg6, arg7);
-        }
-    }
-
-    public static void log(int logLevel, String format, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7, Object arg8) {
-        if (ENABLED) {
-            DebugScope.getInstance().log(logLevel, format, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);
-        }
-    }
-
-    public static void logv(String format, Object... args) {
-        logv(DEFAULT_LOG_LEVEL, format, args);
-    }
-
-    /**
-     * Prints a message to the current debug scope's logging stream. This method must only be called
-     * if debugging is {@linkplain Debug#isEnabled() enabled} as it incurs allocation at the call
-     * site. If possible, call one of the other {@code log()} methods in this class that take a
-     * fixed number of parameters.
-     *
-     * @param format a format string
-     * @param args the arguments referenced by the format specifiers in {@code format}
-     */
-    public static void logv(int logLevel, String format, Object... args) {
-        if (!ENABLED) {
-            throw new InternalError("Use of Debug.logv() must be guarded by a test of Debug.isEnabled()");
-        }
-        DebugScope.getInstance().log(logLevel, format, args);
-    }
-
-    /**
-     * This override exists to catch cases when {@link #log(String, Object)} is called with one
-     * argument bound to a varargs method parameter. It will bind to this method instead of the
-     * single arg variant and produce a deprecation warning instead of silently wrapping the
-     * Object[] inside of another Object[].
-     */
-    @Deprecated
-    public static void log(String format, Object[] args) {
-        assert false : "shouldn't use this";
-        log(DEFAULT_LOG_LEVEL, format, args);
-    }
-
-    /**
-     * This override exists to catch cases when {@link #log(int, String, Object)} is called with one
-     * argument bound to a varargs method parameter. It will bind to this method instead of the
-     * single arg variant and produce a deprecation warning instead of silently wrapping the
-     * Object[] inside of another Object[].
-     */
-    @Deprecated
-    public static void log(int logLevel, String format, Object[] args) {
-        assert false : "shouldn't use this";
-        logv(logLevel, format, args);
-    }
-
-    public static void dump(Object object, String msg) {
-        dump(DEFAULT_LOG_LEVEL, object, msg);
-    }
-
-    public static void dump(int dumpLevel, Object object, String msg) {
-        if (ENABLED && DebugScope.getInstance().isDumpEnabled(dumpLevel)) {
-            DebugScope.getInstance().dump(dumpLevel, object, msg);
-        }
-    }
-
-    public static void dump(Object object, String format, Object arg) {
-        dump(DEFAULT_LOG_LEVEL, object, format, arg);
-    }
-
-    public static void dump(int dumpLevel, Object object, String format, Object arg) {
-        if (ENABLED && DebugScope.getInstance().isDumpEnabled(dumpLevel)) {
-            DebugScope.getInstance().dump(dumpLevel, object, format, arg);
-        }
-    }
-
-    public static void dump(Object object, String format, Object arg1, Object arg2) {
-        dump(DEFAULT_LOG_LEVEL, object, format, arg1, arg2);
-    }
-
-    public static void dump(int dumpLevel, Object object, String format, Object arg1, Object arg2) {
-        if (ENABLED && DebugScope.getInstance().isDumpEnabled(dumpLevel)) {
-            DebugScope.getInstance().dump(dumpLevel, object, format, arg1, arg2);
-        }
-    }
-
-    public static void dump(Object object, String format, Object arg1, Object arg2, Object arg3) {
-        dump(DEFAULT_LOG_LEVEL, object, format, arg1, arg2, arg3);
-    }
-
-    public static void dump(int dumpLevel, Object object, String format, Object arg1, Object arg2, Object arg3) {
-        if (ENABLED && DebugScope.getInstance().isDumpEnabled(dumpLevel)) {
-            DebugScope.getInstance().dump(dumpLevel, object, format, arg1, arg2, arg3);
-        }
-    }
-
-    /**
-     * This override exists to catch cases when {@link #dump(Object, String, Object)} is called with
-     * one argument bound to a varargs method parameter. It will bind to this method instead of the
-     * single arg variant and produce a deprecation warning instead of silently wrapping the
-     * Object[] inside of another Object[].
-     */
-    @Deprecated
-    public static void dump(Object object, String format, Object[] args) {
-        assert false : "shouldn't use this";
-        dump(DEFAULT_LOG_LEVEL, object, format, args);
-    }
-
-    /**
-     * This override exists to catch cases when {@link #dump(int, Object, String, Object)} is called
-     * with one argument bound to a varargs method parameter. It will bind to this method instead of
-     * the single arg variant and produce a deprecation warning instead of silently wrapping the
-     * Object[] inside of another Object[].
-     */
-    @Deprecated
-    public static void dump(int dumpLevel, Object object, String format, Object[] args) {
-        assert false : "shouldn't use this";
-        if (ENABLED && DebugScope.getInstance().isDumpEnabled(dumpLevel)) {
-            DebugScope.getInstance().dump(dumpLevel, object, format, args);
-        }
-    }
-
-    /**
-     * Calls all {@link DebugVerifyHandler}s in the current {@linkplain DebugScope#getConfig()
-     * config} to perform verification on a given object.
-     *
-     * @param object object to verify
-     * @param message description of verification context
-     *
-     * @see DebugVerifyHandler#verify(Object, String)
-     */
-    public static void verify(Object object, String message) {
-        if (ENABLED && DebugScope.getInstance().isVerifyEnabled()) {
-            DebugScope.getInstance().verify(object, message);
-        }
-    }
-
-    /**
-     * Calls all {@link DebugVerifyHandler}s in the current {@linkplain DebugScope#getConfig()
-     * config} to perform verification on a given object.
-     *
-     * @param object object to verify
-     * @param format a format string for the description of the verification context
-     * @param arg the argument referenced by the format specifiers in {@code format}
-     *
-     * @see DebugVerifyHandler#verify(Object, String)
-     */
-    public static void verify(Object object, String format, Object arg) {
-        if (ENABLED && DebugScope.getInstance().isVerifyEnabled()) {
-            DebugScope.getInstance().verify(object, format, arg);
-        }
-    }
-
-    /**
-     * This override exists to catch cases when {@link #verify(Object, String, Object)} is called
-     * with one argument bound to a varargs method parameter. It will bind to this method instead of
-     * the single arg variant and produce a deprecation warning instead of silently wrapping the
-     * Object[] inside of another Object[].
-     */
-    @Deprecated
-    public static void verify(Object object, String format, Object[] args) {
-        assert false : "shouldn't use this";
-        if (ENABLED && DebugScope.getInstance().isVerifyEnabled()) {
-            DebugScope.getInstance().verify(object, format, args);
-        }
-    }
-
-    /**
-     * Opens a new indentation level (by adding some spaces) based on the current indentation level.
-     * This should be used in a {@linkplain Indent try-with-resources} pattern.
-     *
-     * @return an object that reverts to the current indentation level when
-     *         {@linkplain Indent#close() closed} or null if debugging is disabled
-     * @see #logAndIndent(int, String)
-     * @see #logAndIndent(int, String, Object)
-     */
-    public static Indent indent() {
-        if (ENABLED) {
-            DebugScope scope = DebugScope.getInstance();
-            return scope.pushIndentLogger();
-        }
-        return null;
-    }
-
-    public static Indent logAndIndent(String msg) {
-        return logAndIndent(DEFAULT_LOG_LEVEL, msg);
-    }
-
-    /**
-     * A convenience function which combines {@link #log(String)} and {@link #indent()}.
-     *
-     * @param msg the message to log
-     * @return an object that reverts to the current indentation level when
-     *         {@linkplain Indent#close() closed} or null if debugging is disabled
-     */
-    public static Indent logAndIndent(int logLevel, String msg) {
-        if (ENABLED && Debug.isLogEnabled(logLevel)) {
-            return logvAndIndentInternal(logLevel, msg);
-        }
-        return null;
-    }
-
-    public static Indent logAndIndent(String format, Object arg) {
-        return logAndIndent(DEFAULT_LOG_LEVEL, format, arg);
-    }
-
-    /**
-     * A convenience function which combines {@link #log(String, Object)} and {@link #indent()}.
-     *
-     * @param format a format string
-     * @param arg the argument referenced by the format specifiers in {@code format}
-     * @return an object that reverts to the current indentation level when
-     *         {@linkplain Indent#close() closed} or null if debugging is disabled
-     */
-    public static Indent logAndIndent(int logLevel, String format, Object arg) {
-        if (ENABLED && Debug.isLogEnabled(logLevel)) {
-            return logvAndIndentInternal(logLevel, format, arg);
-        }
-        return null;
-    }
-
-    public static Indent logAndIndent(String format, int arg) {
-        return logAndIndent(DEFAULT_LOG_LEVEL, format, arg);
-    }
-
-    /**
-     * A convenience function which combines {@link #log(String, Object)} and {@link #indent()}.
-     *
-     * @param format a format string
-     * @param arg the argument referenced by the format specifiers in {@code format}
-     * @return an object that reverts to the current indentation level when
-     *         {@linkplain Indent#close() closed} or null if debugging is disabled
-     */
-    public static Indent logAndIndent(int logLevel, String format, int arg) {
-        if (ENABLED && Debug.isLogEnabled(logLevel)) {
-            return logvAndIndentInternal(logLevel, format, arg);
-        }
-        return null;
-    }
-
-    public static Indent logAndIndent(String format, int arg1, Object arg2) {
-        return logAndIndent(DEFAULT_LOG_LEVEL, format, arg1, arg2);
-    }
-
-    /**
-     * @see #logAndIndent(int, String, Object)
-     */
-    public static Indent logAndIndent(int logLevel, String format, int arg1, Object arg2) {
-        if (ENABLED && Debug.isLogEnabled(logLevel)) {
-            return logvAndIndentInternal(logLevel, format, arg1, arg2);
-        }
-        return null;
-    }
-
-    public static Indent logAndIndent(String format, Object arg1, int arg2) {
-        return logAndIndent(DEFAULT_LOG_LEVEL, format, arg1, arg2);
-    }
-
-    /**
-     * @see #logAndIndent(int, String, Object)
-     */
-    public static Indent logAndIndent(int logLevel, String format, Object arg1, int arg2) {
-        if (ENABLED && Debug.isLogEnabled(logLevel)) {
-            return logvAndIndentInternal(logLevel, format, arg1, arg2);
-        }
-        return null;
-    }
-
-    public static Indent logAndIndent(String format, int arg1, int arg2) {
-        return logAndIndent(DEFAULT_LOG_LEVEL, format, arg1, arg2);
-    }
-
-    /**
-     * @see #logAndIndent(int, String, Object)
-     */
-    public static Indent logAndIndent(int logLevel, String format, int arg1, int arg2) {
-        if (ENABLED && Debug.isLogEnabled(logLevel)) {
-            return logvAndIndentInternal(logLevel, format, arg1, arg2);
-        }
-        return null;
-    }
-
-    public static Indent logAndIndent(String format, Object arg1, Object arg2) {
-        return logAndIndent(DEFAULT_LOG_LEVEL, format, arg1, arg2);
-    }
-
-    /**
-     * @see #logAndIndent(int, String, Object)
-     */
-    public static Indent logAndIndent(int logLevel, String format, Object arg1, Object arg2) {
-        if (ENABLED && Debug.isLogEnabled(logLevel)) {
-            return logvAndIndentInternal(logLevel, format, arg1, arg2);
-        }
-        return null;
-    }
-
-    public static Indent logAndIndent(String format, Object arg1, Object arg2, Object arg3) {
-        return logAndIndent(DEFAULT_LOG_LEVEL, format, arg1, arg2, arg3);
-    }
-
-    /**
-     * @see #logAndIndent(int, String, Object)
-     */
-    public static Indent logAndIndent(int logLevel, String format, Object arg1, Object arg2, Object arg3) {
-        if (ENABLED && Debug.isLogEnabled(logLevel)) {
-            return logvAndIndentInternal(logLevel, format, arg1, arg2, arg3);
-        }
-        return null;
-    }
-
-    public static Indent logAndIndent(String format, int arg1, int arg2, int arg3) {
-        return logAndIndent(DEFAULT_LOG_LEVEL, format, arg1, arg2, arg3);
-    }
-
-    /**
-     * @see #logAndIndent(int, String, Object)
-     */
-    public static Indent logAndIndent(int logLevel, String format, int arg1, int arg2, int arg3) {
-        if (ENABLED && Debug.isLogEnabled(logLevel)) {
-            return logvAndIndentInternal(logLevel, format, arg1, arg2, arg3);
-        }
-        return null;
-    }
-
-    public static Indent logAndIndent(String format, Object arg1, int arg2, int arg3) {
-        return logAndIndent(DEFAULT_LOG_LEVEL, format, arg1, arg2, arg3);
-    }
-
-    /**
-     * @see #logAndIndent(int, String, Object)
-     */
-    public static Indent logAndIndent(int logLevel, String format, Object arg1, int arg2, int arg3) {
-        if (ENABLED && Debug.isLogEnabled(logLevel)) {
-            return logvAndIndentInternal(logLevel, format, arg1, arg2, arg3);
-        }
-        return null;
-    }
-
-    public static Indent logAndIndent(String format, Object arg1, Object arg2, Object arg3, Object arg4) {
-        return logAndIndent(DEFAULT_LOG_LEVEL, format, arg1, arg2, arg3, arg4);
-    }
-
-    /**
-     * @see #logAndIndent(int, String, Object)
-     */
-    public static Indent logAndIndent(int logLevel, String format, Object arg1, Object arg2, Object arg3, Object arg4) {
-        if (ENABLED && Debug.isLogEnabled(logLevel)) {
-            return logvAndIndentInternal(logLevel, format, arg1, arg2, arg3, arg4);
-        }
-        return null;
-    }
-
-    public static Indent logAndIndent(String format, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5) {
-        return logAndIndent(DEFAULT_LOG_LEVEL, format, arg1, arg2, arg3, arg4, arg5);
-    }
-
-    /**
-     * @see #logAndIndent(int, String, Object)
-     */
-    public static Indent logAndIndent(int logLevel, String format, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5) {
-        if (ENABLED && Debug.isLogEnabled(logLevel)) {
-            return logvAndIndentInternal(logLevel, format, arg1, arg2, arg3, arg4, arg5);
-        }
-        return null;
-    }
-
-    public static Indent logAndIndent(String format, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6) {
-        return logAndIndent(DEFAULT_LOG_LEVEL, format, arg1, arg2, arg3, arg4, arg5, arg6);
-    }
-
-    /**
-     * @see #logAndIndent(int, String, Object)
-     */
-    public static Indent logAndIndent(int logLevel, String format, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6) {
-        if (ENABLED && Debug.isLogEnabled(logLevel)) {
-            return logvAndIndentInternal(logLevel, format, arg1, arg2, arg3, arg4, arg5, arg6);
-        }
-        return null;
-    }
-
-    /**
-     * A convenience function which combines {@link #logv(int, String, Object...)} and
-     * {@link #indent()}.
-     *
-     * @param format a format string
-     * @param args the arguments referenced by the format specifiers in {@code format}
-     * @return an object that reverts to the current indentation level when
-     *         {@linkplain Indent#close() closed} or null if debugging is disabled
-     */
-    public static Indent logvAndIndent(int logLevel, String format, Object... args) {
-        if (ENABLED) {
-            if (Debug.isLogEnabled(logLevel)) {
-                return logvAndIndentInternal(logLevel, format, args);
-            }
-            return null;
-        }
-        throw new InternalError("Use of Debug.logvAndIndent() must be guarded by a test of Debug.isEnabled()");
-    }
-
-    private static Indent logvAndIndentInternal(int logLevel, String format, Object... args) {
-        assert ENABLED && Debug.isLogEnabled(logLevel) : "must have checked Debug.isLogEnabled()";
-        DebugScope scope = DebugScope.getInstance();
-        scope.log(logLevel, format, args);
-        return scope.pushIndentLogger();
-    }
-
-    /**
-     * This override exists to catch cases when {@link #logAndIndent(String, Object)} is called with
-     * one argument bound to a varargs method parameter. It will bind to this method instead of the
-     * single arg variant and produce a deprecation warning instead of silently wrapping the
-     * Object[] inside of another Object[].
-     */
-    @Deprecated
-    public static void logAndIndent(String format, Object[] args) {
-        assert false : "shouldn't use this";
-        logAndIndent(DEFAULT_LOG_LEVEL, format, args);
-    }
-
-    /**
-     * This override exists to catch cases when {@link #logAndIndent(int, String, Object)} is called
-     * with one argument bound to a varargs method parameter. It will bind to this method instead of
-     * the single arg variant and produce a deprecation warning instead of silently wrapping the
-     * Object[] inside of another Object[].
-     */
-    @Deprecated
-    public static void logAndIndent(int logLevel, String format, Object[] args) {
-        assert false : "shouldn't use this";
-        logvAndIndent(logLevel, format, args);
-    }
-
-    public static Iterable<Object> context() {
-        if (ENABLED) {
-            return DebugScope.getInstance().getCurrentContext();
-        } else {
-            return Collections.emptyList();
-        }
-    }
-
-    @SuppressWarnings("unchecked")
-    public static <T> List<T> contextSnapshot(Class<T> clazz) {
-        if (ENABLED) {
-            List<T> result = new ArrayList<>();
-            for (Object o : context()) {
-                if (clazz.isInstance(o)) {
-                    result.add((T) o);
-                }
-            }
-            return result;
-        } else {
-            return Collections.emptyList();
-        }
-    }
-
-    /**
-     * Searches the current debug scope, bottom up, for a context object that is an instance of a
-     * given type. The first such object found is returned.
-     */
-    @SuppressWarnings("unchecked")
-    public static <T> T contextLookup(Class<T> clazz) {
-        if (ENABLED) {
-            for (Object o : context()) {
-                if (clazz.isInstance(o)) {
-                    return ((T) o);
-                }
-            }
-        }
-        return null;
-    }
-
-    /**
-     * Creates a {@linkplain DebugMemUseTracker memory use tracker} that is enabled iff debugging is
-     * {@linkplain #isEnabled() enabled}.
-     * <p>
-     * A disabled tracker has virtually no overhead.
-     */
-    public static DebugMemUseTracker memUseTracker(CharSequence name) {
-        if (!isUnconditionalMemUseTrackingEnabled && !ENABLED) {
-            return VOID_MEM_USE_TRACKER;
-        }
-        return createMemUseTracker("%s", name, null);
-    }
-
-    /**
-     * Creates a debug memory use tracker. Invoking this method is equivalent to:
-     *
-     * <pre>
-     * Debug.memUseTracker(format, arg, null)
-     * </pre>
-     *
-     * except that the string formatting only happens if metering is enabled.
-     *
-     * @see #metric(String, Object, Object)
-     */
-    public static DebugMemUseTracker memUseTracker(String format, Object arg) {
-        if (!isUnconditionalMemUseTrackingEnabled && !ENABLED) {
-            return VOID_MEM_USE_TRACKER;
-        }
-        return createMemUseTracker(format, arg, null);
-    }
-
-    /**
-     * Creates a debug memory use tracker. Invoking this method is equivalent to:
-     *
-     * <pre>
-     * Debug.memUseTracker(String.format(format, arg1, arg2))
-     * </pre>
-     *
-     * except that the string formatting only happens if memory use tracking is enabled. In
-     * addition, each argument is subject to the following type based conversion before being passed
-     * as an argument to {@link String#format(String, Object...)}:
-     *
-     * <pre>
-     *     Type          | Conversion
-     * ------------------+-----------------
-     *  java.lang.Class  | arg.getSimpleName()
-     *                   |
-     * </pre>
-     *
-     * @see #memUseTracker(CharSequence)
-     */
-    public static DebugMemUseTracker memUseTracker(String format, Object arg1, Object arg2) {
-        if (!isUnconditionalMemUseTrackingEnabled && !ENABLED) {
-            return VOID_MEM_USE_TRACKER;
-        }
-        return createMemUseTracker(format, arg1, arg2);
-    }
-
-    private static DebugMemUseTracker createMemUseTracker(String format, Object arg1, Object arg2) {
-        String name = formatDebugName(format, arg1, arg2);
-        return new MemUseTrackerImpl(name, !isUnconditionalMemUseTrackingEnabled);
-    }
-
-    /**
-     * Creates a {@linkplain DebugMetric metric} that is enabled iff debugging is
-     * {@linkplain #isEnabled() enabled} or the system property whose name is formed by adding to
-     * {@value #ENABLE_METRIC_PROPERTY_NAME_PREFIX} to {@code name} is
-     * {@linkplain Boolean#getBoolean(String) true}. If the latter condition is true, then the
-     * returned metric is {@linkplain DebugMetric#isConditional() unconditional} otherwise it is
-     * conditional.
-     * <p>
-     * A disabled metric has virtually no overhead.
-     */
-    public static DebugMetric metric(CharSequence name) {
-        if (!areUnconditionalMetricsEnabled() && !ENABLED) {
-            return VOID_METRIC;
-        }
-        return createMetric("%s", name, null);
-    }
-
-    public static String applyFormattingFlagsAndWidth(String s, int flags, int width) {
-        if (flags == 0 && width < 0) {
-            return s;
-        }
-        StringBuilder sb = new StringBuilder(s);
-
-        // apply width and justification
-        int len = sb.length();
-        if (len < width) {
-            for (int i = 0; i < width - len; i++) {
-                if ((flags & LEFT_JUSTIFY) == LEFT_JUSTIFY) {
-                    sb.append(' ');
-                } else {
-                    sb.insert(0, ' ');
-                }
-            }
-        }
-
-        String res = sb.toString();
-        if ((flags & UPPERCASE) == UPPERCASE) {
-            res = res.toUpperCase();
-        }
-        return res;
-    }
-
-    /**
-     * Creates a debug metric. Invoking this method is equivalent to:
-     *
-     * <pre>
-     * Debug.metric(format, arg, null)
-     * </pre>
-     *
-     * except that the string formatting only happens if metering is enabled.
-     *
-     * @see #metric(String, Object, Object)
-     */
-    public static DebugMetric metric(String format, Object arg) {
-        if (!areUnconditionalMetricsEnabled() && !ENABLED) {
-            return VOID_METRIC;
-        }
-        return createMetric(format, arg, null);
-    }
-
-    /**
-     * Creates a debug metric. Invoking this method is equivalent to:
-     *
-     * <pre>
-     * Debug.metric(String.format(format, arg1, arg2))
-     * </pre>
-     *
-     * except that the string formatting only happens if metering is enabled. In addition, each
-     * argument is subject to the following type based conversion before being passed as an argument
-     * to {@link String#format(String, Object...)}:
-     *
-     * <pre>
-     *     Type          | Conversion
-     * ------------------+-----------------
-     *  java.lang.Class  | arg.getSimpleName()
-     *                   |
-     * </pre>
-     *
-     * @see #metric(CharSequence)
-     */
-    public static DebugMetric metric(String format, Object arg1, Object arg2) {
-        if (!areUnconditionalMetricsEnabled() && !ENABLED) {
-            return VOID_METRIC;
-        }
-        return createMetric(format, arg1, arg2);
-    }
-
-    private static DebugMetric createMetric(String format, Object arg1, Object arg2) {
-        String name = formatDebugName(format, arg1, arg2);
-        boolean conditional = enabledMetrics == null || !findMatch(enabledMetrics, enabledMetricsSubstrings, name);
-        if (!ENABLED && conditional) {
-            return VOID_METRIC;
-        }
-        return new MetricImpl(name, conditional);
-    }
-
-    /**
-     * Changes the debug configuration for the current thread.
-     *
-     * @param config new configuration to use for the current thread
-     * @return an object that when {@linkplain DebugConfigScope#close() closed} will restore the
-     *         debug configuration for the current thread to what it was before this method was
-     *         called
-     */
-    public static DebugConfigScope setConfig(DebugConfig config) {
-        if (ENABLED) {
-            return new DebugConfigScope(config);
-        } else {
-            return null;
-        }
-    }
-
-    /**
-     * Creates an object for counting value frequencies.
-     */
-    public static DebugHistogram createHistogram(String name) {
-        return new DebugHistogramImpl(name);
-    }
-
-    public static DebugConfig silentConfig() {
-        return fixedConfig(0, 0, false, false, false, false, Collections.<DebugDumpHandler> emptyList(), Collections.<DebugVerifyHandler> emptyList(), null);
-    }
-
-    public static DebugConfig fixedConfig(final int logLevel, final int dumpLevel, final boolean isMeterEnabled, final boolean isMemUseTrackingEnabled, final boolean isTimerEnabled,
-                    final boolean isVerifyEnabled, final Collection<DebugDumpHandler> dumpHandlers, final Collection<DebugVerifyHandler> verifyHandlers, final PrintStream output) {
-        return new DebugConfig() {
-
-            @Override
-            public int getLogLevel() {
-                return logLevel;
-            }
-
-            public boolean isLogEnabledForMethod() {
-                return logLevel > 0;
-            }
-
-            @Override
-            public boolean isMeterEnabled() {
-                return isMeterEnabled;
-            }
-
-            @Override
-            public boolean isMemUseTrackingEnabled() {
-                return isMemUseTrackingEnabled;
-            }
-
-            @Override
-            public int getDumpLevel() {
-                return dumpLevel;
-            }
-
-            public boolean isDumpEnabledForMethod() {
-                return dumpLevel > 0;
-            }
-
-            @Override
-            public boolean isVerifyEnabled() {
-                return isVerifyEnabled;
-            }
-
-            public boolean isVerifyEnabledForMethod() {
-                return isVerifyEnabled;
-            }
-
-            @Override
-            public boolean isTimeEnabled() {
-                return isTimerEnabled;
-            }
-
-            @Override
-            public RuntimeException interceptException(Throwable e) {
-                return null;
-            }
-
-            @Override
-            public Collection<DebugDumpHandler> dumpHandlers() {
-                return dumpHandlers;
-            }
-
-            @Override
-            public Collection<DebugVerifyHandler> verifyHandlers() {
-                return verifyHandlers;
-            }
-
-            @Override
-            public PrintStream output() {
-                return output;
-            }
-
-            @Override
-            public void addToContext(Object o) {
-            }
-
-            @Override
-            public void removeFromContext(Object o) {
-            }
-        };
-    }
-
-    private static final DebugMetric VOID_METRIC = new DebugMetric() {
-
-        public void increment() {
-        }
-
-        public void add(long value) {
-        }
-
-        public void setConditional(boolean flag) {
-            throw new InternalError("Cannot make void metric conditional");
-        }
-
-        public boolean isConditional() {
-            return false;
-        }
-
-        public long getCurrentValue() {
-            return 0L;
-        }
-    };
-
-    private static final DebugMemUseTracker VOID_MEM_USE_TRACKER = new DebugMemUseTracker() {
-
-        public DebugCloseable start() {
-            return DebugCloseable.VOID_CLOSEABLE;
-        }
-
-        public long getCurrentValue() {
-            return 0;
-        }
-    };
-
-    public static final String ENABLE_UNSCOPED_TIMERS_PROPERTY_NAME = "graal.debug.unscopedTimers";
-    public static final String ENABLE_UNSCOPED_METRICS_PROPERTY_NAME = "graal.debug.unscopedMetrics";
-    public static final String ENABLE_UNSCOPED_MEM_USE_TRACKERS_PROPERTY_NAME = "graal.debug.unscopedMemUseTrackers";
-
-    /**
-     * @see #timer(CharSequence)
-     */
-    public static final String ENABLE_TIMER_PROPERTY_NAME_PREFIX = "graal.debug.timer.";
-
-    /**
-     * @see #metric(CharSequence)
-     */
-    public static final String ENABLE_METRIC_PROPERTY_NAME_PREFIX = "graal.debug.metric.";
-
-    /**
-     * Set of unconditionally enabled metrics. Possible values and their meanings:
-     * <ul>
-     * <li>{@code null}: no unconditionally enabled metrics</li>
-     * <li>{@code isEmpty()}: all metrics are unconditionally enabled</li>
-     * <li>{@code !isEmpty()}: use {@link #findMatch(Set, Set, String)} on this set and
-     * {@link #enabledMetricsSubstrings} to determine which metrics are unconditionally enabled</li>
-     * </ul>
-     */
-    private static final Set<String> enabledMetrics;
-
-    /**
-     * Set of unconditionally enabled timers. Same interpretation of values as for
-     * {@link #enabledMetrics}.
-     */
-    private static final Set<String> enabledTimers;
-
-    private static final Set<String> enabledMetricsSubstrings = new HashSet<>();
-    private static final Set<String> enabledTimersSubstrings = new HashSet<>();
-
-    /**
-     * Specifies if all mem use trackers are unconditionally enabled.
-     */
-    private static final boolean isUnconditionalMemUseTrackingEnabled;
-
-    static {
-        Set<String> metrics = new HashSet<>();
-        Set<String> timers = new HashSet<>();
-        parseMetricAndTimerSystemProperties(metrics, timers, enabledMetricsSubstrings, enabledTimersSubstrings);
-        metrics = metrics.isEmpty() && enabledMetricsSubstrings.isEmpty() ? null : metrics;
-        timers = timers.isEmpty() && enabledTimersSubstrings.isEmpty() ? null : timers;
-        if (metrics == null && Boolean.getBoolean(ENABLE_UNSCOPED_METRICS_PROPERTY_NAME)) {
-            metrics = Collections.emptySet();
-        }
-        if (timers == null && Boolean.getBoolean(ENABLE_UNSCOPED_TIMERS_PROPERTY_NAME)) {
-            timers = Collections.emptySet();
-        }
-        enabledMetrics = metrics;
-        enabledTimers = timers;
-        isUnconditionalMemUseTrackingEnabled = Boolean.getBoolean(ENABLE_UNSCOPED_MEM_USE_TRACKERS_PROPERTY_NAME);
-    }
-
-    private static boolean findMatch(Set<String> haystack, Set<String> haystackSubstrings, String needle) {
-        if (haystack.isEmpty()) {
-            // Empty haystack means match all
-            return true;
-        }
-        if (haystack.contains(needle)) {
-            return true;
-        }
-        if (!haystackSubstrings.isEmpty()) {
-            for (String h : haystackSubstrings) {
-                if (needle.startsWith(h)) {
-                    return true;
-                }
-            }
-        }
-        return false;
-    }
-
-    public static boolean areUnconditionalTimersEnabled() {
-        return enabledTimers != null;
-    }
-
-    public static boolean areUnconditionalMetricsEnabled() {
-        return enabledMetrics != null;
-    }
-
-    protected static void parseMetricAndTimerSystemProperties(Set<String> metrics, Set<String> timers, Set<String> metricsSubstrings, Set<String> timersSubstrings) {
-        do {
-            try {
-                for (Map.Entry<Object, Object> e : System.getProperties().entrySet()) {
-                    String name = e.getKey().toString();
-                    if (name.startsWith(ENABLE_METRIC_PROPERTY_NAME_PREFIX) && Boolean.parseBoolean(e.getValue().toString())) {
-                        if (name.endsWith("*")) {
-                            metricsSubstrings.add(name.substring(ENABLE_METRIC_PROPERTY_NAME_PREFIX.length(), name.length() - 1));
-                        } else {
-                            metrics.add(name.substring(ENABLE_METRIC_PROPERTY_NAME_PREFIX.length()));
-                        }
-                    }
-                    if (name.startsWith(ENABLE_TIMER_PROPERTY_NAME_PREFIX) && Boolean.parseBoolean(e.getValue().toString())) {
-                        if (name.endsWith("*")) {
-                            timersSubstrings.add(name.substring(ENABLE_TIMER_PROPERTY_NAME_PREFIX.length(), name.length() - 1));
-                        } else {
-                            timers.add(name.substring(ENABLE_TIMER_PROPERTY_NAME_PREFIX.length()));
-                        }
-                    }
-                }
-                return;
-            } catch (ConcurrentModificationException e) {
-                // Iterating over the system properties may race with another thread that is
-                // updating the system properties. Simply try again in this case.
-            }
-        } while (true);
-    }
-
-    /**
-     * Creates a {@linkplain DebugTimer timer} that is enabled iff debugging is
-     * {@linkplain #isEnabled() enabled} or the system property whose name is formed by adding to
-     * {@value #ENABLE_TIMER_PROPERTY_NAME_PREFIX} to {@code name} is
-     * {@linkplain Boolean#getBoolean(String) true}. If the latter condition is true, then the
-     * returned timer is {@linkplain DebugMetric#isConditional() unconditional} otherwise it is
-     * conditional.
-     * <p>
-     * A disabled timer has virtually no overhead.
-     */
-    public static DebugTimer timer(CharSequence name) {
-        if (!areUnconditionalTimersEnabled() && !ENABLED) {
-            return VOID_TIMER;
-        }
-        return createTimer("%s", name, null);
-    }
-
-    /**
-     * Creates a debug timer. Invoking this method is equivalent to:
-     *
-     * <pre>
-     * Debug.timer(format, arg, null)
-     * </pre>
-     *
-     * except that the string formatting only happens if timing is enabled.
-     *
-     * @see #timer(String, Object, Object)
-     */
-    public static DebugTimer timer(String format, Object arg) {
-        if (!areUnconditionalTimersEnabled() && !ENABLED) {
-            return VOID_TIMER;
-        }
-        return createTimer(format, arg, null);
-    }
-
-    /**
-     * Creates a debug timer. Invoking this method is equivalent to:
-     *
-     * <pre>
-     * Debug.timer(String.format(format, arg1, arg2))
-     * </pre>
-     *
-     * except that the string formatting only happens if timing is enabled. In addition, each
-     * argument is subject to the following type based conversion before being passed as an argument
-     * to {@link String#format(String, Object...)}:
-     *
-     * <pre>
-     *     Type          | Conversion
-     * ------------------+-----------------
-     *  java.lang.Class  | arg.getSimpleName()
-     *                   |
-     * </pre>
-     *
-     * @see #timer(CharSequence)
-     */
-    public static DebugTimer timer(String format, Object arg1, Object arg2) {
-        if (!areUnconditionalTimersEnabled() && !ENABLED) {
-            return VOID_TIMER;
-        }
-        return createTimer(format, arg1, arg2);
-    }
-
-    /**
-     * There are paths where construction of formatted class names are common and the code below is
-     * surprisingly expensive, so compute it once and cache it.
-     */
-    private static final ClassValue<String> formattedClassName = new ClassValue<String>() {
-        @Override
-        protected String computeValue(Class<?> c) {
-            final String simpleName = c.getSimpleName();
-            Class<?> enclosingClass = c.getEnclosingClass();
-            if (enclosingClass != null) {
-                String prefix = "";
-                while (enclosingClass != null) {
-                    prefix = enclosingClass.getSimpleName() + "_" + prefix;
-                    enclosingClass = enclosingClass.getEnclosingClass();
-                }
-                return prefix + simpleName;
-            } else {
-                return simpleName;
-            }
-        }
-    };
-
-    public static Object convertFormatArg(Object arg) {
-        if (arg instanceof Class) {
-            return formattedClassName.get((Class<?>) arg);
-        }
-        return arg;
-    }
-
-    private static String formatDebugName(String format, Object arg1, Object arg2) {
-        return String.format(format, convertFormatArg(arg1), convertFormatArg(arg2));
-    }
-
-    private static DebugTimer createTimer(String format, Object arg1, Object arg2) {
-        String name = formatDebugName(format, arg1, arg2);
-        boolean conditional = enabledTimers == null || !findMatch(enabledTimers, enabledTimersSubstrings, name);
-        if (!ENABLED && conditional) {
-            return VOID_TIMER;
-        }
-        return new TimerImpl(name, conditional);
-    }
-
-    private static final DebugTimer VOID_TIMER = new DebugTimer() {
-
-        public DebugCloseable start() {
-            return DebugCloseable.VOID_CLOSEABLE;
-        }
-
-        public void setConditional(boolean flag) {
-            throw new InternalError("Cannot make void timer conditional");
-        }
-
-        public boolean isConditional() {
-            return false;
-        }
-
-        public long getCurrentValue() {
-            return 0L;
-        }
-
-        public TimeUnit getTimeUnit() {
-            return null;
-        }
-    };
-}
--- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/DebugCloseable.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 2012, 2015, 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.debug;
-
-/**
- * An object returned by {@link DebugTimer#start()} that when closed, stops the associated timer and
- * adds the elapsed time since {@code start()} to the total for the timer.
- */
-public interface DebugCloseable extends AutoCloseable {
-
-    DebugCloseable VOID_CLOSEABLE = new DebugCloseable() {
-
-        @Override
-        public void close() {
-        }
-    };
-
-    void close();
-}
--- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/DebugConfig.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,116 +0,0 @@
-/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.debug;
-
-import java.io.*;
-import java.util.*;
-
-public interface DebugConfig {
-
-    /**
-     * Determines the current log level in the {@linkplain Debug#currentScope() current debug scope}
-     * .
-     */
-    int getLogLevel();
-
-    /**
-     * Determines the current dump level in the {@linkplain Debug#currentScope() current debug
-     * scope}.
-     */
-    int getDumpLevel();
-
-    /**
-     * Determines if logging can be enabled in the current method, regardless of the
-     * {@linkplain Debug#currentScope() current debug scope}.
-     */
-    boolean isLogEnabledForMethod();
-
-    /**
-     * Determines if metering is enabled in the {@linkplain Debug#currentScope() current debug
-     * scope}.
-     *
-     * @see Debug#metric(CharSequence)
-     */
-    boolean isMeterEnabled();
-
-    /**
-     * Determines if memory use tracking is enabled in the {@linkplain Debug#currentScope() current
-     * debug scope}.
-     *
-     * @see Debug#memUseTracker(CharSequence)
-     */
-    boolean isMemUseTrackingEnabled();
-
-    /**
-     * Determines if dumping can be enabled in the current method, regardless of the
-     * {@linkplain Debug#currentScope() current debug scope}.
-     */
-    boolean isDumpEnabledForMethod();
-
-    /**
-     * @see Debug#isVerifyEnabled()
-     */
-    boolean isVerifyEnabled();
-
-    /**
-     * @see Debug#isVerifyEnabledForMethod()
-     */
-    boolean isVerifyEnabledForMethod();
-
-    /**
-     * Adds an object the context used by this configuration to do filtering.
-     */
-    void addToContext(Object o);
-
-    /**
-     * Removes an object the context used by this configuration to do filtering.
-     *
-     * This should only removes extra context added by {@link #addToContext(Object)}.
-     */
-    void removeFromContext(Object o);
-
-    /**
-     * @see Debug#timer(CharSequence)
-     */
-    boolean isTimeEnabled();
-
-    /**
-     * Handles notification of an exception occurring within a debug scope.
-     *
-     * @return the exception object that is to be propagated to parent scope. A value of
-     *         {@code null} indicates that {@code e} is to be propagated.
-     */
-    RuntimeException interceptException(Throwable e);
-
-    /**
-     * Gets the modifiable collection of dump handlers registered with this configuration.
-     */
-    Collection<DebugDumpHandler> dumpHandlers();
-
-    PrintStream output();
-
-    /**
-     * Gets the modifiable collection of verify handlers registered with this configuration.
-     */
-    Collection<DebugVerifyHandler> verifyHandlers();
-}
--- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/DebugConfigScope.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.debug;
-
-import com.oracle.graal.debug.internal.*;
-
-/**
- * A utility for scoping a change to the current debug
- * {@linkplain DebugScope#setConfig(DebugConfig) configuration}. For example:
- *
- * <pre>
- *     DebugConfig config = ...;
- *     try (DebugConfigScope s = new DebugConfigScope(config)) {
- *         // ...
- *     }
- * </pre>
- */
-public class DebugConfigScope implements AutoCloseable {
-
-    private final DebugConfig current;
-
-    /**
-     * Sets the current debug {@linkplain DebugScope#setConfig(DebugConfig) configuration} to a
-     * given value and creates an object that when {@linkplain #close() closed} resets the
-     * configuration to the {@linkplain DebugScope#getConfig() current} configuration.
-     */
-    public DebugConfigScope(DebugConfig config) {
-        this.current = DebugScope.getConfig();
-        DebugScope.getInstance().setConfig(config);
-    }
-
-    public void close() {
-        DebugScope.getInstance().setConfig(current);
-    }
-}
--- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/DebugDumpHandler.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.debug;
-
-import java.io.*;
-
-public interface DebugDumpHandler extends Closeable {
-
-    void dump(Object object, String message);
-
-    /**
-     * Flushes and releases resources managed by this dump handler. A subsequent call to
-     * {@link #dump(Object, String)} will create and open new resources. That is, this method can be
-     * used to reset the handler.
-     */
-    @Override
-    void close();
-}
--- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/DebugDumpScope.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.debug;
-
-public class DebugDumpScope {
-
-    public final String name;
-
-    /**
-     * Specifies if this scope decorates an inner scope. A hierarchical or tree representation of
-     * nested scopes may choose to represent a decorator scope at the same level as the scope it
-     * decorates.
-     */
-    public final boolean decorator;
-
-    public DebugDumpScope(String name) {
-        this(name, false);
-    }
-
-    public DebugDumpScope(String name, boolean decorator) {
-        this.name = name;
-        this.decorator = decorator;
-    }
-
-    @Override
-    public String toString() {
-        return "DebugDumpScope[" + name + "]";
-    }
-}
--- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/DebugHistogram.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,102 +0,0 @@
-/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.debug;
-
-import java.util.*;
-
-/**
- * Facility for recording value frequencies.
- */
-public interface DebugHistogram {
-
-    /**
-     * Gets the name specified when this objected was {@linkplain Debug#createHistogram(String)
-     * created}.
-     */
-    String getName();
-
-    /**
-     * Increments the count for a given value.
-     */
-    void add(Object value);
-
-    void add(Object value, long count);
-
-    /**
-     * A value and a frequency. The ordering imposed by {@link #compareTo(CountedValue)} places
-     * values with higher frequencies first.
-     */
-    public class CountedValue implements Comparable<CountedValue> {
-
-        private long count;
-        private final Object value;
-
-        public CountedValue(long count, Object value) {
-            this.count = count;
-            this.value = value;
-        }
-
-        public int compareTo(CountedValue o) {
-            if (count < o.count) {
-                return 1;
-            } else if (count > o.count) {
-                return -1;
-            }
-            return 0;
-        }
-
-        @Override
-        public String toString() {
-            return count + " -> " + value;
-        }
-
-        public void inc() {
-            count++;
-        }
-
-        public void add(long n) {
-            count += n;
-        }
-
-        public long getCount() {
-            return count;
-        }
-
-        public Object getValue() {
-            return value;
-        }
-    }
-
-    /**
-     * Gets a list of the counted values, sorted in descending order of frequency.
-     */
-    List<CountedValue> getValues();
-
-    /**
-     * Interface for a service that can render a visualization of a histogram.
-     */
-    public interface Printer {
-
-        void print(DebugHistogram histogram);
-    }
-}
--- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/DebugMemUseTracker.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.debug;
-
-import com.sun.management.*;
-
-/**
- * Tracks memory usage within a scope using {@link ThreadMXBean}. This facility should be employed
- * using the try-with-resources pattern:
- *
- * <pre>
- * try (DebugMemUseTracker.Closeable a = memUseTracker.start()) {
- *     // the code to measure
- * }
- * </pre>
- */
-public interface DebugMemUseTracker {
-
-    /**
-     * Creates a point from which memory usage will be recorded if memory use tracking is
-     * {@linkplain Debug#isMemUseTrackingEnabled() enabled}.
-     *
-     * @return an object that must be closed once the activity has completed to add the memory used
-     *         since this call to the total for this tracker
-     */
-    DebugCloseable start();
-
-    /**
-     * Gets the current value of this tracker.
-     */
-    long getCurrentValue();
-}
--- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/DebugMetric.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,65 +0,0 @@
-/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.debug;
-
-/**
- * A counter for some value of interest.
- */
-public interface DebugMetric {
-
-    /**
-     * Adds 1 to this counter if metering is {@link Debug#isMeterEnabled() enabled} or this is an
-     * {@linkplain #isConditional() unconditional} metric.
-     */
-    void increment();
-
-    /**
-     * Adds {@code value} to this counter if metering is {@link Debug#isMeterEnabled() enabled} or
-     * this is an {@linkplain #isConditional() unconditional} metric.
-     */
-    void add(long value);
-
-    /**
-     * Sets a flag determining if this counter is only enabled if metering is
-     * {@link Debug#isMeterEnabled() enabled}.
-     */
-    void setConditional(boolean flag);
-
-    /**
-     * Determines if this counter is only enabled if metering is {@link Debug#isMeterEnabled()
-     * enabled}.
-     */
-    boolean isConditional();
-
-    /**
-     * Gets the current value of this metric.
-     */
-    long getCurrentValue();
-
-    /**
-     * Determines if this counter is enabled (either conditionally or unconditionally).
-     */
-    default boolean isEnabled() {
-        return !isConditional() || Debug.isMeterEnabled();
-    }
-}
--- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/DebugTimer.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,78 +0,0 @@
-/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.debug;
-
-import java.util.concurrent.*;
-
-/**
- * A timer for some activity of interest. A timer should be deployed using the try-with-resources
- * pattern:
- *
- * <pre>
- * try (TimerCloseable a = timer.start()) {
- *     // the code to time
- * }
- * </pre>
- */
-public interface DebugTimer {
-
-    /**
-     * Starts this timer if timing is {@linkplain Debug#isTimeEnabled() enabled} or this is an
-     * {@linkplain #isConditional() unconditional} timer.
-     *
-     * @return an object that must be closed once the activity has completed to add the elapsed time
-     *         since this call to the total for this timer
-     */
-    DebugCloseable start();
-
-    /**
-     * Sets a flag determining if this timer is only enabled if timing is
-     * {@link Debug#isTimeEnabled() enabled}.
-     */
-    void setConditional(boolean flag);
-
-    /**
-     * Determines if this timer is only enabled if timing is {@link Debug#isTimeEnabled() enabled}.
-     */
-    boolean isConditional();
-
-    /**
-     * Gets the current value of this timer.
-     */
-    long getCurrentValue();
-
-    /**
-     * Gets the time unit of this timer.
-     */
-    TimeUnit getTimeUnit();
-
-    /**
-     * Gets the timer recording the amount time spent within a timed scope minus the time spent in
-     * any nested timed scopes.
-     *
-     * @return null if this timer does not support flat timing
-     */
-    default DebugTimer getFlat() {
-        return null;
-    }
-}
--- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/DebugVerifyHandler.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.debug;
-
-/**
- * Performs some kind of verification on an object.
- */
-public interface DebugVerifyHandler {
-
-    /**
-     * Verifies that a given object satisfies some invariants.
-     *
-     * @param object object to verify
-     * @param message description of verification context
-     */
-    void verify(Object object, String message);
-}
--- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/DelegatingDebugConfig.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,238 +0,0 @@
-/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.debug;
-
-import java.io.*;
-import java.util.*;
-
-import com.oracle.graal.debug.internal.*;
-
-public class DelegatingDebugConfig implements DebugConfig {
-
-    protected final DebugConfig delegate;
-
-    /**
-     * The features of a {@link DelegatingDebugConfig} that can be force
-     * {@linkplain DelegatingDebugConfig#enable(Feature) enabled}/
-     * {@linkplain DelegatingDebugConfig#disable(Feature) disabled} or
-     * {@linkplain DelegatingDebugConfig#delegate(Feature) delegated}.
-     */
-    public enum Feature {
-        /**
-         * @see Debug#isLogEnabledForMethod()
-         */
-        LOG_METHOD,
-        /**
-         * @see Debug#isDumpEnabledForMethod()
-         */
-        DUMP_METHOD,
-        /**
-         * @see Debug#isVerifyEnabled()
-         */
-        VERIFY,
-        /**
-         * @see Debug#isVerifyEnabledForMethod()
-         */
-        VERIFY_METHOD,
-        /**
-         * @see Debug#isMeterEnabled()
-         */
-        METER,
-        /**
-         * @see Debug#isMemUseTrackingEnabled()
-         */
-        TRACK_MEM_USE,
-        /**
-         * @see Debug#isTimeEnabled()
-         */
-        TIME,
-        /**
-         * @see DebugConfig#interceptException(Throwable)
-         */
-        INTERCEPT
-    }
-
-    private final Map<Feature, Boolean> featureState = new EnumMap<>(Feature.class);
-
-    /**
-     * The debug levels of a {@link DelegatingDebugConfig} than can be
-     * {@linkplain DelegatingDebugConfig#override(Level, int) overridden} or
-     * {@linkplain DelegatingDebugConfig#delegate(Level) delegated}.
-     */
-    public enum Level {
-        LOG,
-        DUMP
-    }
-
-    private final Map<Level, Integer> levelState = new EnumMap<>(Level.class);
-
-    /**
-     * Creates a config that delegates to the {@link DebugScope#getConfig() current config}.
-     */
-    public DelegatingDebugConfig() {
-        this(DebugScope.getConfig());
-    }
-
-    /**
-     * Creates a config that delegates to a given config.
-     */
-    public DelegatingDebugConfig(DebugConfig delegate) {
-        this.delegate = delegate;
-    }
-
-    public DelegatingDebugConfig enable(Feature feature) {
-        featureState.put(feature, Boolean.TRUE);
-        return this;
-    }
-
-    public DelegatingDebugConfig disable(Feature feature) {
-        featureState.put(feature, Boolean.FALSE);
-        return this;
-    }
-
-    public DelegatingDebugConfig override(Level level, int newLevel) {
-        levelState.put(level, newLevel);
-        return this;
-    }
-
-    public DelegatingDebugConfig delegate(Feature feature) {
-        featureState.put(feature, null);
-        return this;
-    }
-
-    public DelegatingDebugConfig delegate(Level level) {
-        levelState.put(level, null);
-        return this;
-    }
-
-    @Override
-    public int getLogLevel() {
-        Integer ls = levelState.get(Level.LOG);
-        if (ls == null) {
-            return delegate.getLogLevel();
-        }
-        return ls.intValue();
-    }
-
-    public boolean isLogEnabledForMethod() {
-        Boolean fs = featureState.get(Feature.LOG_METHOD);
-        if (fs == null) {
-            return delegate.isLogEnabledForMethod();
-        }
-        return fs.booleanValue();
-    }
-
-    @Override
-    public boolean isMeterEnabled() {
-        Boolean fs = featureState.get(Feature.METER);
-        if (fs == null) {
-            return delegate.isMeterEnabled();
-        }
-        return fs.booleanValue();
-    }
-
-    public boolean isMemUseTrackingEnabled() {
-        Boolean fs = featureState.get(Feature.TRACK_MEM_USE);
-        if (fs == null) {
-            return delegate.isMemUseTrackingEnabled();
-        }
-        return fs.booleanValue();
-    }
-
-    @Override
-    public int getDumpLevel() {
-        Integer ls = levelState.get(Level.DUMP);
-        if (ls == null) {
-            return delegate.getDumpLevel();
-        }
-        return ls.intValue();
-    }
-
-    public boolean isDumpEnabledForMethod() {
-        Boolean fs = featureState.get(Feature.DUMP_METHOD);
-        if (fs == null) {
-            return delegate.isDumpEnabledForMethod();
-        }
-        return fs.booleanValue();
-    }
-
-    @Override
-    public boolean isVerifyEnabled() {
-        Boolean fs = featureState.get(Feature.VERIFY);
-        if (fs == null) {
-            return delegate.isVerifyEnabled();
-        }
-        return fs.booleanValue();
-    }
-
-    public boolean isVerifyEnabledForMethod() {
-        Boolean fs = featureState.get(Feature.VERIFY_METHOD);
-        if (fs == null) {
-            return delegate.isVerifyEnabledForMethod();
-        }
-        return fs.booleanValue();
-    }
-
-    @Override
-    public boolean isTimeEnabled() {
-        Boolean fs = featureState.get(Feature.TIME);
-        if (fs == null) {
-            return delegate.isTimeEnabled();
-        }
-        return fs.booleanValue();
-    }
-
-    @Override
-    public RuntimeException interceptException(Throwable e) {
-        Boolean fs = featureState.get(Feature.INTERCEPT);
-        if (fs == null || fs) {
-            return delegate.interceptException(e);
-        }
-        return null;
-    }
-
-    @Override
-    public Collection<DebugDumpHandler> dumpHandlers() {
-        return delegate.dumpHandlers();
-    }
-
-    @Override
-    public Collection<DebugVerifyHandler> verifyHandlers() {
-        return delegate.verifyHandlers();
-    }
-
-    @Override
-    public PrintStream output() {
-        return delegate.output();
-    }
-
-    @Override
-    public void addToContext(Object o) {
-        delegate.addToContext(o);
-    }
-
-    @Override
-    public void removeFromContext(Object o) {
-        delegate.removeFromContext(o);
-    }
-}
--- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/Fingerprint.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,145 +0,0 @@
-/*
- * Copyright (c) 2015, 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.debug;
-
-import java.util.*;
-import java.util.stream.*;
-
-/**
- * Facility for fingerprinting execution.
- */
-public class Fingerprint implements AutoCloseable {
-
-    public static final String ENABLED_PROPERTY_NAME = "graal.fingerprint";
-
-    /**
-     * Determines whether fingerprinting is enabled. This is set by the
-     * {@value #ENABLED_PROPERTY_NAME} system property when this class is initialized.
-     */
-    public static final boolean ENABLED = Boolean.getBoolean(ENABLED_PROPERTY_NAME);
-
-    private static final ThreadLocal<Fingerprint> current = ENABLED ? new ThreadLocal<>() : null;
-
-    private final List<String> events;
-    private int index;
-
-    /**
-     * Creates an object to record a fingerprint.
-     */
-    public Fingerprint() {
-        events = new ArrayList<>();
-        index = -1;
-    }
-
-    /**
-     * Creates an object to verify execution matches a given fingerprint.
-     *
-     * @param toVerifyAgainst the fingerprint events to verify against
-     */
-    public Fingerprint(List<String> toVerifyAgainst) {
-        this.events = toVerifyAgainst;
-        index = 0;
-    }
-
-    /**
-     * Creates an object to verify execution matches a given fingerprint.
-     *
-     * @param toVerifyAgainst the fingerprint to verify against
-     */
-    public Fingerprint(Fingerprint toVerifyAgainst) {
-        this(toVerifyAgainst.events);
-    }
-
-    public Collection<String> getEvents() {
-        return Collections.unmodifiableCollection(events);
-    }
-
-    /**
-     * Starts fingerprint recording or verification for the current thread. At most one fingerprint
-     * object can be active for any thread.
-     */
-    public Fingerprint open() {
-        if (ENABLED) {
-            assert current.get() == null;
-            current.set(this);
-            return this;
-        }
-        return null;
-    }
-
-    /**
-     * Finishes fingerprint recording or verification for the current thread.
-     */
-    public void close() {
-        if (ENABLED) {
-            assert current.get() == this;
-            current.set(null);
-        }
-    }
-
-    private static final int BREAKPOINT_EVENT = Integer.getInteger(ENABLED_PROPERTY_NAME + ".breakpointEvent", -1);
-
-    /**
-     * Submits an execution event for the purpose of recording or verifying a fingerprint. This must
-     * only be called if {@link #ENABLED} is {@code true}.
-     */
-    public static void submit(String format, Object... args) {
-        assert ENABLED : "fingerprinting must be enabled (-D" + ENABLED_PROPERTY_NAME + "=true)";
-        Fingerprint fingerprint = current.get();
-        if (fingerprint != null) {
-            int eventId = fingerprint.nextEventId();
-            if (eventId == BREAKPOINT_EVENT) {
-                // Set IDE breakpoint on the following line and set the relevant
-                // system property to debug a fingerprint verification error.
-                System.console();
-            }
-            fingerprint.event(String.format(eventId + ": " + format, args));
-        }
-    }
-
-    private int nextEventId() {
-        return index == -1 ? events.size() : index;
-    }
-
-    private static final int MAX_EVENT_TAIL_IN_ERROR_MESSAGE = Integer.getInteger("graal.fingerprint.errorEventTailLength", 50);
-
-    private String tail() {
-        int start = Math.max(index - MAX_EVENT_TAIL_IN_ERROR_MESSAGE, 0);
-        return events.subList(start, index).stream().collect(Collectors.joining(String.format("%n")));
-    }
-
-    private void event(String entry) {
-        if (index == -1) {
-            events.add(entry);
-        } else {
-            if (index > events.size()) {
-                throw new InternalError(String.format("%s%nOriginal fingerprint limit reached", tail()));
-            }
-            String l = events.get(index);
-            if (!l.equals(entry)) {
-                throw new InternalError(String.format("%s%nFingerprint differs at event %d%nexpected: %s%n  actual: %s", tail(), index, l, entry));
-            }
-            index++;
-        }
-    }
-}
--- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/Indent.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.debug;
-
-/**
- * Object used to close a debug {@link Debug#indent() indentation} scope.
- * <p>
- * Example usage:
- *
- * <pre>
- *
- *      try (Indent i1 = Debug.logAndIndent("header message")) {
- *          ...
- *          Debug.log("message");
- *          ...
- *          try (Indent i2 = Debug.logAndIndent(sub-header message")) {
- *              ...
- *              Debug.log("inner message");
- *              ...
- *          }
- *      }
- *
- * </pre>
- */
-public interface Indent extends AutoCloseable {
-
-    /**
-     * Closes the current indentation scope.
-     */
-    void close();
-}
--- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/LogStream.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,477 +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.graal.debug;
-
-import java.io.*;
-
-/**
- * A utility for printing compiler debug and informational output to an output stream.
- *
- * A {@link LogStream} instance maintains an internal buffer that is flushed to the underlying
- * output stream every time one of the {@code println} methods is invoked, or a newline character (
- * {@code '\n'}) is written.
- *
- * All of the {@code print} and {@code println} methods return the {code LogStream} instance on
- * which they were invoked. This allows chaining of these calls to mitigate use of String
- * concatenation by the caller.
- *
- * A {@code LogStream} maintains a current {@linkplain #indentationLevel() indentation} level. Each
- * line of output written to this stream has {@code n} spaces prefixed to it where {@code n} is the
- * value that would be returned by {@link #indentationLevel()} when the first character of a new
- * line is written.
- *
- * A {@code LogStream} maintains a current {@linkplain #position() position} for the current line
- * being written. This position can be advanced to a specified position by
- * {@linkplain #fillTo(int, char) filling} this stream with a given character.
- */
-public class LogStream {
-
-    /**
-     * Null output stream that simply swallows any output sent to it.
-     */
-    public static final LogStream SINK = new LogStream();
-
-    private static final PrintStream SINK_PS = new PrintStream(new OutputStream() {
-
-        @Override
-        public void write(int b) throws IOException {
-        }
-    });
-
-    private LogStream() {
-        this.ps = null;
-        this.lineBuffer = null;
-    }
-
-    /**
-     * The output stream to which this log stream writes.
-     */
-    private final PrintStream ps;
-
-    private final StringBuilder lineBuffer;
-    private int indentationLevel;
-    private char indentation = ' ';
-    private boolean indentationDisabled;
-
-    public final PrintStream out() {
-        if (ps == null) {
-            return SINK_PS;
-        }
-        return ps;
-    }
-
-    /**
-     * The system dependent line separator.
-     */
-    public static final String LINE_SEPARATOR = System.getProperty("line.separator");
-
-    /**
-     * Creates a new log stream.
-     *
-     * @param os the underlying output stream to which prints are sent
-     */
-    public LogStream(OutputStream os) {
-        ps = os instanceof PrintStream ? (PrintStream) os : new PrintStream(os);
-        lineBuffer = new StringBuilder(100);
-    }
-
-    /**
-     * Creates a new log stream that shares the same {@linkplain #ps output stream} as a given
-     * {@link LogStream}.
-     *
-     * @param log a LogStream whose output stream is shared with this one
-     */
-    public LogStream(LogStream log) {
-        ps = log.ps;
-        lineBuffer = new StringBuilder(100);
-    }
-
-    /**
-     * Prepends {@link #indentation} to the current output line until its write position is equal to
-     * the current {@linkplain #indentationLevel()} level.
-     */
-    private void indent() {
-        if (ps != null) {
-            if (!indentationDisabled && indentationLevel != 0) {
-                while (lineBuffer.length() < indentationLevel) {
-                    lineBuffer.append(indentation);
-                }
-            }
-        }
-    }
-
-    private LogStream flushLine(boolean withNewline) {
-        if (ps != null) {
-            if (withNewline) {
-                lineBuffer.append(LINE_SEPARATOR);
-            }
-            ps.print(lineBuffer.toString());
-            ps.flush();
-            lineBuffer.setLength(0);
-        }
-        return this;
-    }
-
-    /**
-     * Flushes the stream. This is done by terminating the current line if it is not at position 0
-     * and then flushing the underlying output stream.
-     */
-    public void flush() {
-        if (ps != null) {
-            if (lineBuffer.length() != 0) {
-                flushLine(false);
-            }
-            ps.flush();
-        }
-    }
-
-    /**
-     * Gets the current column position of this log stream.
-     *
-     * @return the current column position of this log stream
-     */
-    public int position() {
-        return lineBuffer == null ? 0 : lineBuffer.length();
-
-    }
-
-    /**
-     * Gets the current indentation level for this log stream.
-     *
-     * @return the current indentation level for this log stream.
-     */
-    public int indentationLevel() {
-        return indentationLevel;
-    }
-
-    /**
-     * Adjusts the current indentation level of this log stream.
-     *
-     * @param delta
-     */
-    public void adjustIndentation(int delta) {
-        if (delta < 0) {
-            indentationLevel = Math.max(0, indentationLevel + delta);
-        } else {
-            indentationLevel += delta;
-        }
-    }
-
-    /**
-     * Gets the current indentation character of this log stream.
-     */
-    public char indentation() {
-        return indentation;
-    }
-
-    public void disableIndentation() {
-        indentationDisabled = true;
-    }
-
-    public void enableIndentation() {
-        indentationDisabled = false;
-    }
-
-    /**
-     * Sets the character used for indentation.
-     */
-    public void setIndentation(char c) {
-        indentation = c;
-    }
-
-    /**
-     * Advances this stream's {@linkplain #position() position} to a given position by repeatedly
-     * appending a given character as necessary.
-     *
-     * @param position the position to which this stream's position will be advanced
-     * @param filler the character used to pad the stream
-     */
-    public LogStream fillTo(int position, char filler) {
-        if (ps != null) {
-            indent();
-            while (lineBuffer.length() < position) {
-                lineBuffer.append(filler);
-            }
-        }
-        return this;
-    }
-
-    /**
-     * Writes a boolean value to this stream as {@code "true"} or {@code "false"}.
-     *
-     * @param b the value to be printed
-     * @return this {@link LogStream} instance
-     */
-    public LogStream print(boolean b) {
-        if (ps != null) {
-            indent();
-            lineBuffer.append(b);
-        }
-        return this;
-    }
-
-    /**
-     * Writes a boolean value to this stream followed by a {@linkplain #LINE_SEPARATOR line
-     * separator}.
-     *
-     * @param b the value to be printed
-     * @return this {@link LogStream} instance
-     */
-    public LogStream println(boolean b) {
-        if (ps != null) {
-            indent();
-            lineBuffer.append(b);
-            return flushLine(true);
-        }
-        return this;
-    }
-
-    /**
-     * Writes a character value to this stream.
-     *
-     * @param c the value to be printed
-     * @return this {@link LogStream} instance
-     */
-    public LogStream print(char c) {
-        if (ps != null) {
-            indent();
-            lineBuffer.append(c);
-            if (c == '\n') {
-                if (lineBuffer.indexOf(LINE_SEPARATOR, lineBuffer.length() - LINE_SEPARATOR.length()) != -1) {
-                    flushLine(false);
-                }
-            }
-        }
-        return this;
-    }
-
-    /**
-     * Writes a character value to this stream followed by a {@linkplain #LINE_SEPARATOR line
-     * separator}.
-     *
-     * @param c the value to be printed
-     * @return this {@link LogStream} instance
-     */
-    public LogStream println(char c) {
-        if (ps != null) {
-            indent();
-            lineBuffer.append(c);
-            flushLine(true);
-        }
-        return this;
-    }
-
-    /**
-     * Prints an int value.
-     *
-     * @param i the value to be printed
-     * @return this {@link LogStream} instance
-     */
-    public LogStream print(int i) {
-        if (ps != null) {
-            indent();
-            lineBuffer.append(i);
-        }
-        return this;
-    }
-
-    /**
-     * Writes an int value to this stream followed by a {@linkplain #LINE_SEPARATOR line separator}.
-     *
-     * @param i the value to be printed
-     * @return this {@link LogStream} instance
-     */
-    public LogStream println(int i) {
-        if (ps != null) {
-            indent();
-            lineBuffer.append(i);
-            return flushLine(true);
-        }
-        return this;
-    }
-
-    /**
-     * Writes a float value to this stream.
-     *
-     * @param f the value to be printed
-     * @return this {@link LogStream} instance
-     */
-    public LogStream print(float f) {
-        if (ps != null) {
-            indent();
-            lineBuffer.append(f);
-        }
-        return this;
-    }
-
-    /**
-     * Writes a float value to this stream followed by a {@linkplain #LINE_SEPARATOR line separator}
-     * .
-     *
-     * @param f the value to be printed
-     * @return this {@link LogStream} instance
-     */
-    public LogStream println(float f) {
-        if (ps != null) {
-            indent();
-            lineBuffer.append(f);
-            return flushLine(true);
-        }
-        return this;
-    }
-
-    /**
-     * Writes a long value to this stream.
-     *
-     * @param l the value to be printed
-     * @return this {@link LogStream} instance
-     */
-    public LogStream print(long l) {
-        if (ps != null) {
-            indent();
-            lineBuffer.append(l);
-        }
-        return this;
-    }
-
-    /**
-     * Writes a long value to this stream followed by a {@linkplain #LINE_SEPARATOR line separator}.
-     *
-     * @param l the value to be printed
-     * @return this {@link LogStream} instance
-     */
-    public LogStream println(long l) {
-        if (ps != null) {
-            indent();
-            lineBuffer.append(l);
-            return flushLine(true);
-        }
-        return this;
-    }
-
-    /**
-     * Writes a double value to this stream.
-     *
-     * @param d the value to be printed
-     * @return this {@link LogStream} instance
-     */
-    public LogStream print(double d) {
-        if (ps != null) {
-            indent();
-            lineBuffer.append(d);
-        }
-        return this;
-    }
-
-    /**
-     * Writes a double value to this stream followed by a {@linkplain #LINE_SEPARATOR line
-     * separator}.
-     *
-     * @param d the value to be printed
-     * @return this {@link LogStream} instance
-     */
-    public LogStream println(double d) {
-        if (ps != null) {
-            indent();
-            lineBuffer.append(d);
-            return flushLine(true);
-        }
-        return this;
-    }
-
-    /**
-     * Writes a {@code String} value to this stream. This method ensures that the
-     * {@linkplain #position() position} of this stream is updated correctly with respect to any
-     * {@linkplain #LINE_SEPARATOR line separators} present in {@code s}.
-     *
-     * @param s the value to be printed
-     * @return this {@link LogStream} instance
-     */
-    public LogStream print(String s) {
-        if (ps != null) {
-            if (s == null) {
-                indent();
-                lineBuffer.append(s);
-                return this;
-            }
-
-            int index = 0;
-            int next = s.indexOf(LINE_SEPARATOR, index);
-            while (index < s.length()) {
-                indent();
-                if (next > index) {
-                    lineBuffer.append(s.substring(index, next));
-                    flushLine(true);
-                    index = next + LINE_SEPARATOR.length();
-                    next = s.indexOf(LINE_SEPARATOR, index);
-                } else {
-                    lineBuffer.append(s.substring(index));
-                    break;
-                }
-            }
-        }
-        return this;
-    }
-
-    /**
-     * Writes a {@code String} value to this stream followed by a {@linkplain #LINE_SEPARATOR line
-     * separator}.
-     *
-     * @param s the value to be printed
-     * @return this {@link LogStream} instance
-     */
-    public LogStream println(String s) {
-        if (ps != null) {
-            print(s);
-            flushLine(true);
-        }
-        return this;
-    }
-
-    /**
-     * Writes a formatted string to this stream.
-     *
-     * @param format a format string as described in {@link String#format(String, Object...)}
-     * @param args the arguments to be formatted
-     * @return this {@link LogStream} instance
-     */
-    public LogStream printf(String format, Object... args) {
-        if (ps != null) {
-            print(String.format(format, args));
-        }
-        return this;
-    }
-
-    /**
-     * Writes a {@linkplain #LINE_SEPARATOR line separator} to this stream.
-     *
-     * @return this {@code LogStream} instance
-     */
-    public LogStream println() {
-        if (ps != null) {
-            indent();
-            flushLine(true);
-        }
-        return this;
-    }
-}
--- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/TTY.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,305 +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.graal.debug;
-
-import java.io.*;
-import java.lang.reflect.*;
-import java.util.*;
-import java.util.regex.*;
-
-/**
- * A collection of static methods for printing debug and informational output to a global
- * {@link LogStream}. The output can be (temporarily) suppressed per thread through use of a
- * {@linkplain Filter filter}.
- */
-public class TTY {
-
-    /**
-     * Support for thread-local suppression of {@link TTY}.
-     */
-    public static class Filter {
-
-        private LogStream previous;
-        private final Thread thread = Thread.currentThread();
-
-        /**
-         * Creates an object that will suppress {@link TTY} for the current thread if the given
-         * filter does not match the given object. To revert the suppression state to how it was
-         * before this call, the {@link #remove()} method must be called on the suppression object.
-         *
-         * @param filter the pattern for matching. If {@code null}, then the match is successful. If
-         *            it starts with "~", then a regular expression
-         *            {@linkplain Pattern#matches(String, CharSequence) match} is performed where
-         *            the regular expression is specified by {@code filter} without the "~" prefix.
-         *            Otherwise, a simple {@linkplain String#contains(CharSequence) substring} match
-         *            is performed where {@code filter} is the substring used.
-         * @param object an object whose {@linkplain Object#toString() string} value is matched
-         *            against {@code filter}
-         */
-        public Filter(String filter, Object object) {
-            boolean suppressed = false;
-            if (filter != null) {
-                String input = object.toString();
-                if (filter.startsWith("~")) {
-                    suppressed = !Pattern.matches(filter.substring(1), input);
-                } else {
-                    suppressed = !input.contains(filter);
-                }
-                if (suppressed) {
-                    previous = out();
-                    out.set(LogStream.SINK);
-                }
-            }
-        }
-
-        /**
-         * Creates an object that will suppress {@link TTY} for the current thread. To revert the
-         * suppression state to how it was before this call, the {@link #remove()} method must be
-         * called on this filter object.
-         */
-        public Filter() {
-            previous = out();
-            out.set(LogStream.SINK);
-        }
-
-        /**
-         * Reverts the suppression state of {@link TTY} to how it was before this object was
-         * constructed.
-         */
-        public void remove() {
-            assert thread == Thread.currentThread();
-            if (previous != null) {
-                out.set(previous);
-            }
-        }
-    }
-
-    public static PrintStream cachedOut;
-
-    public static void initialize(PrintStream ps) {
-        cachedOut = ps;
-    }
-
-    private static LogStream createLog() {
-        if (cachedOut == null) {
-            // In case initialize() was not called.
-            cachedOut = System.out;
-        }
-        return new LogStream(cachedOut);
-    }
-
-    private static final ThreadLocal<LogStream> out = new ThreadLocal<LogStream>() {
-
-        @Override
-        protected LogStream initialValue() {
-            return createLog();
-        }
-    };
-
-    public static boolean isSuppressed() {
-        return out.get() == LogStream.SINK;
-    }
-
-    /**
-     * Gets the thread-local log stream to which the static methods of this class send their output.
-     * This will either be a global log stream or the global {@linkplain LogStream#SINK sink}
-     * depending on whether any suppression {@linkplain Filter filters} are in effect for the
-     * current thread.
-     */
-    public static LogStream out() {
-        return out.get();
-    }
-
-    /**
-     * @see LogStream#print(String)
-     */
-    public static void print(String s) {
-        out().print(s);
-    }
-
-    /**
-     * @see LogStream#print(int)
-     */
-    public static void print(int i) {
-        out().print(i);
-    }
-
-    /**
-     * @see LogStream#print(long)
-     */
-    public static void print(long i) {
-        out().print(i);
-    }
-
-    /**
-     * @see LogStream#print(char)
-     */
-    public static void print(char c) {
-        out().print(c);
-    }
-
-    /**
-     * @see LogStream#print(boolean)
-     */
-    public static void print(boolean b) {
-        out().print(b);
-    }
-
-    /**
-     * @see LogStream#print(double)
-     */
-    public static void print(double d) {
-        out().print(d);
-    }
-
-    /**
-     * @see LogStream#print(float)
-     */
-    public static void print(float f) {
-        out().print(f);
-    }
-
-    /**
-     * @see LogStream#println(String)
-     */
-    public static void println(String s) {
-        out().println(s);
-    }
-
-    /**
-     * @see LogStream#println()
-     */
-    public static void println() {
-        out().println();
-    }
-
-    /**
-     * @see LogStream#println(int)
-     */
-    public static void println(int i) {
-        out().println(i);
-    }
-
-    /**
-     * @see LogStream#println(long)
-     */
-    public static void println(long l) {
-        out().println(l);
-    }
-
-    /**
-     * @see LogStream#println(char)
-     */
-    public static void println(char c) {
-        out().println(c);
-    }
-
-    /**
-     * @see LogStream#println(boolean)
-     */
-    public static void println(boolean b) {
-        out().println(b);
-    }
-
-    /**
-     * @see LogStream#println(double)
-     */
-    public static void println(double d) {
-        out().println(d);
-    }
-
-    /**
-     * @see LogStream#println(float)
-     */
-    public static void println(float f) {
-        out().println(f);
-    }
-
-    public static void print(String format, Object... args) {
-        out().printf(format, args);
-    }
-
-    public static void println(String format, Object... args) {
-        out().printf(format + "%n", args);
-    }
-
-    public static void fillTo(int i) {
-        out().fillTo(i, ' ');
-    }
-
-    public static void printFields(Class<?> javaClass) {
-        final String className = javaClass.getSimpleName();
-        TTY.println(className + " {");
-        for (final Field field : javaClass.getFields()) {
-            printField(field, false);
-        }
-        TTY.println("}");
-    }
-
-    public static void printField(final Field field, boolean tabbed) {
-        final String fieldName = String.format("%35s", field.getName());
-        try {
-            String prefix = tabbed ? "" : "    " + fieldName + " = ";
-            String postfix = tabbed ? "\t" : "\n";
-            if (field.getType() == int.class) {
-                TTY.print(prefix + field.getInt(null) + postfix);
-            } else if (field.getType() == boolean.class) {
-                TTY.print(prefix + field.getBoolean(null) + postfix);
-            } else if (field.getType() == float.class) {
-                TTY.print(prefix + field.getFloat(null) + postfix);
-            } else if (field.getType() == String.class) {
-                TTY.print(prefix + field.get(null) + postfix);
-            } else if (field.getType() == Map.class) {
-                Map<?, ?> m = (Map<?, ?>) field.get(null);
-                TTY.print(prefix + printMap(m) + postfix);
-            } else {
-                TTY.print(prefix + field.get(null) + postfix);
-            }
-        } catch (IllegalAccessException e) {
-            // do nothing.
-        }
-    }
-
-    private static String printMap(Map<?, ?> m) {
-        StringBuilder sb = new StringBuilder();
-
-        List<String> keys = new ArrayList<>();
-        for (Object key : m.keySet()) {
-            keys.add((String) key);
-        }
-        Collections.sort(keys);
-
-        for (String key : keys) {
-            sb.append(key);
-            sb.append("\t");
-            sb.append(m.get(key));
-            sb.append("\n");
-        }
-
-        return sb.toString();
-    }
-
-    public static void flush() {
-        out().flush();
-    }
-}
--- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/TopLevelDebugConfig.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.debug;
-
-/**
- * A marker class for a scoped debug configuration covering a compilation region. Useful for
- * programmatically enabling debug config features.
- *
- */
-public class TopLevelDebugConfig extends DelegatingDebugConfig {
-}
--- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/AccumulatedDebugValue.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-/*
- * Copyright (c) 2015, 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.debug.internal;
-
-public abstract class AccumulatedDebugValue extends DebugValue {
-    protected final DebugValue flat;
-
-    public AccumulatedDebugValue(String name, boolean conditional, DebugValue flat) {
-        super(name + "_Accm", conditional);
-        this.flat = flat;
-    }
-}
--- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/CloseableCounterImpl.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
-/*
- * Copyright (c) 2015, 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.debug.internal;
-
-import com.oracle.graal.debug.*;
-
-/**
- * A helper class for DebugValues that can nest and need to split out accumulated and flat values
- * for some kind of counter-like measurement.
- */
-abstract class CloseableCounterImpl implements DebugCloseable {
-
-    protected final CloseableCounterImpl parent;
-    protected final AccumulatedDebugValue counter;
-    protected final long start;
-    protected long nestedAmountToSubtract;
-
-    CloseableCounterImpl(CloseableCounterImpl parent, AccumulatedDebugValue counter) {
-        this.parent = parent;
-        this.start = getCounterValue();
-        this.counter = counter;
-    }
-
-    @Override
-    public void close() {
-        long end = getCounterValue();
-        long difference = end - start;
-        if (parent != null) {
-            if (!counter.getName().equals(parent.counter.getName())) {
-                parent.nestedAmountToSubtract += difference;
-
-                // Look for our counter in an outer scope and fix up
-                // the adjustment to the flat count
-                CloseableCounterImpl ancestor = parent.parent;
-                while (ancestor != null) {
-                    if (ancestor.counter.getName().equals(counter.getName())) {
-                        ancestor.nestedAmountToSubtract -= difference;
-                        break;
-                    }
-                    ancestor = ancestor.parent;
-                }
-            }
-        }
-        long flatAmount = difference - nestedAmountToSubtract;
-        counter.addToCurrentValue(difference);
-        counter.flat.addToCurrentValue(flatAmount);
-    }
-
-    abstract long getCounterValue();
-}
--- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/DebugHistogramAsciiPrinter.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,103 +0,0 @@
-/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.debug.internal;
-
-import java.io.*;
-import java.util.*;
-
-import com.oracle.graal.debug.*;
-import com.oracle.graal.debug.DebugHistogram.CountedValue;
-import com.oracle.graal.debug.DebugHistogram.Printer;
-
-/**
- * Renders a textual representation of a histogram to a given print stream.
- */
-public class DebugHistogramAsciiPrinter implements Printer {
-
-    public static final int NumberSize = 10;
-    public static final int DefaultNameSize = 50;
-    public static final int DefaultBarSize = 100;
-    public static final int DefaultScale = 1;
-
-    private final PrintStream os;
-    private final int limit;
-    private final int nameSize;
-    private final int barSize;
-    private final int scale;
-
-    public DebugHistogramAsciiPrinter(PrintStream os) {
-        this(os, Integer.MAX_VALUE, DefaultNameSize, DefaultBarSize, DefaultScale);
-    }
-
-    /**
-     * @param os where to print
-     * @param limit limits printing to the {@code limit} most frequent values
-     * @param nameSize the width of the value names column
-     * @param barSize the width of the value frequency column
-     * @param scale a factor by which every result is divided
-     */
-    public DebugHistogramAsciiPrinter(PrintStream os, int limit, int nameSize, int barSize, int scale) {
-        this.os = os;
-        this.limit = limit;
-        this.nameSize = nameSize;
-        this.barSize = barSize;
-        this.scale = scale;
-    }
-
-    public void print(DebugHistogram histogram) {
-        List<CountedValue> list = histogram.getValues();
-        if (list.isEmpty()) {
-            os.printf("%s is empty.%n", histogram.getName());
-            return;
-        }
-
-        // Sum up the total number of elements.
-        long total = list.stream().mapToLong(CountedValue::getCount).sum();
-
-        // Print header.
-        os.printf("%s has %d unique elements and %d total elements:%n", histogram.getName(), list.size(), total / scale);
-
-        long max = list.get(0).getCount() / scale;
-        final int lineSize = nameSize + NumberSize + barSize + 10;
-        printLine(os, '-', lineSize);
-        String formatString = "| %-" + nameSize + "s | %-" + NumberSize + "d | %-" + barSize + "s |\n";
-        for (int i = 0; i < list.size() && i < limit; ++i) {
-            CountedValue cv = list.get(i);
-            long value = cv.getCount() / scale;
-            char[] bar = new char[(int) (((double) value / (double) max) * barSize)];
-            Arrays.fill(bar, '=');
-            String objectString = String.valueOf(cv.getValue());
-            if (objectString.length() > nameSize) {
-                objectString = objectString.substring(0, nameSize - 3) + "...";
-            }
-            os.printf(formatString, objectString, value, new String(bar));
-        }
-        printLine(os, '-', lineSize);
-    }
-
-    private static void printLine(PrintStream printStream, char c, int lineSize) {
-        char[] charArr = new char[lineSize];
-        Arrays.fill(charArr, c);
-        printStream.printf("%s%n", new String(charArr));
-    }
-}
--- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/DebugHistogramImpl.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +0,0 @@
-/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.debug.internal;
-
-import java.util.*;
-
-import com.oracle.graal.debug.*;
-
-public class DebugHistogramImpl implements DebugHistogram {
-
-    private final String name;
-    private HashMap<Object, CountedValue> map = new HashMap<>();
-
-    public DebugHistogramImpl(String name) {
-        this.name = name;
-    }
-
-    public void add(Object value) {
-        CountedValue cv = map.get(value);
-        if (cv == null) {
-            map.put(value, new CountedValue(1, value));
-        } else {
-            cv.inc();
-        }
-    }
-
-    public void add(Object value, long count) {
-        CountedValue cv = map.get(value);
-        if (cv == null) {
-            map.put(value, new CountedValue(count, value));
-        } else {
-            cv.add(count);
-        }
-    }
-
-    @Override
-    public String getName() {
-        return name;
-    }
-
-    public List<CountedValue> getValues() {
-        ArrayList<CountedValue> res = new ArrayList<>(map.values());
-        Collections.sort(res);
-        return res;
-    }
-}
--- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/DebugHistogramRPrinter.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,81 +0,0 @@
-/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.debug.internal;
-
-import java.io.*;
-import java.util.*;
-
-import com.oracle.graal.debug.*;
-import com.oracle.graal.debug.DebugHistogram.CountedValue;
-import com.oracle.graal.debug.DebugHistogram.Printer;
-
-/**
- * Renders a histogram as an R script to a given print stream. The R script emitted for a histogram
- * is a simple set of statements for defining a vector of named objects.
- */
-public class DebugHistogramRPrinter implements Printer {
-
-    private PrintStream os;
-    private int limit;
-
-    public DebugHistogramRPrinter(PrintStream os) {
-        this(os, Integer.MAX_VALUE);
-    }
-
-    /**
-     * @param os where to print
-     * @param limit limits printing to the {@code limit} most frequent values
-     */
-    public DebugHistogramRPrinter(PrintStream os, int limit) {
-        this.os = os;
-        this.limit = limit;
-    }
-
-    public void print(DebugHistogram histogram) {
-        List<CountedValue> list = histogram.getValues();
-        if (list.isEmpty()) {
-            return;
-        }
-
-        String var = histogram.getName().replace('-', '.').replace(' ', '_');
-        os.print(var + " <- c(");
-        for (int i = 0; i < list.size() && i < limit; ++i) {
-            CountedValue cv = list.get(i);
-            if (i != 0) {
-                os.print(", ");
-            }
-            os.print(cv.getCount());
-        }
-        os.println(");");
-
-        os.print("names(" + var + ") <- c(");
-        for (int i = 0; i < list.size() && i < limit; ++i) {
-            CountedValue cv = list.get(i);
-            if (i != 0) {
-                os.print(", ");
-            }
-            os.print("\"" + cv.getValue() + "\"");
-        }
-        os.println(");");
-    }
-}
--- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/DebugScope.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,489 +0,0 @@
-/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.debug.internal;
-
-import java.io.*;
-import java.util.*;
-import java.util.concurrent.*;
-
-import com.oracle.graal.debug.*;
-
-public final class DebugScope implements Debug.Scope {
-
-    private final class IndentImpl implements Indent {
-
-        private static final String INDENTATION_INCREMENT = "  ";
-
-        final String indent;
-        final IndentImpl parentIndent;
-
-        IndentImpl(IndentImpl parentIndent) {
-            this.parentIndent = parentIndent;
-            this.indent = (parentIndent == null ? "" : parentIndent.indent + INDENTATION_INCREMENT);
-        }
-
-        private void printScopeName(StringBuilder str) {
-            if (logScopeName) {
-                if (parentIndent != null) {
-                    parentIndent.printScopeName(str);
-                }
-                str.append(indent).append("[thread:").append(Thread.currentThread().getId()).append("] scope: ").append(getQualifiedName()).append(System.lineSeparator());
-                logScopeName = false;
-            }
-        }
-
-        public void log(int logLevel, String msg, Object... args) {
-            if (isLogEnabled(logLevel)) {
-                StringBuilder str = new StringBuilder();
-                printScopeName(str);
-                str.append(indent);
-                String result = args.length == 0 ? msg : String.format(msg, args);
-                String lineSep = System.lineSeparator();
-                str.append(result.replace(lineSep, lineSep.concat(indent)));
-                str.append(lineSep);
-                output.append(str);
-                lastUsedIndent = this;
-            }
-        }
-
-        IndentImpl indent() {
-            lastUsedIndent = new IndentImpl(this);
-            return lastUsedIndent;
-        }
-
-        @Override
-        public void close() {
-            if (parentIndent != null) {
-                lastUsedIndent = parentIndent;
-            }
-        }
-    }
-
-    private static final ThreadLocal<DebugScope> instanceTL = new ThreadLocal<>();
-    private static final ThreadLocal<DebugScope> lastClosedTL = new ThreadLocal<>();
-    private static final ThreadLocal<DebugConfig> configTL = new ThreadLocal<>();
-    private static final ThreadLocal<Throwable> lastExceptionThrownTL = new ThreadLocal<>();
-
-    private final DebugScope parent;
-    private final DebugConfig parentConfig;
-    private final boolean sandbox;
-    private IndentImpl lastUsedIndent;
-    private boolean logScopeName;
-
-    private final Object[] context;
-
-    private DebugValueMap valueMap;
-
-    private String qualifiedName;
-    private final String unqualifiedName;
-
-    private static final char SCOPE_SEP = '.';
-
-    private boolean meterEnabled;
-    private boolean timeEnabled;
-    private boolean memUseTrackingEnabled;
-    private boolean verifyEnabled;
-
-    private int currentDumpLevel;
-    private int currentLogLevel;
-
-    private PrintStream output;
-
-    public static DebugScope getInstance() {
-        DebugScope result = instanceTL.get();
-        if (result == null) {
-            DebugScope topLevelDebugScope = new DebugScope(Thread.currentThread());
-            instanceTL.set(topLevelDebugScope);
-            return topLevelDebugScope;
-        } else {
-            return result;
-        }
-    }
-
-    public static DebugConfig getConfig() {
-        return configTL.get();
-    }
-
-    static final Object[] EMPTY_CONTEXT = new Object[0];
-
-    private DebugScope(Thread thread) {
-        this(thread.getName(), null, false);
-        computeValueMap(thread.getName());
-        DebugValueMap.registerTopLevel(getValueMap());
-    }
-
-    private DebugScope(String unqualifiedName, DebugScope parent, boolean sandbox, Object... context) {
-        this.parent = parent;
-        this.sandbox = sandbox;
-        this.parentConfig = getConfig();
-        this.context = context;
-        this.unqualifiedName = unqualifiedName;
-        if (parent != null) {
-            logScopeName = !unqualifiedName.equals("");
-        } else {
-            logScopeName = true;
-        }
-
-        // Be pragmatic: provide a default log stream to prevent a crash if the stream is not
-        // set while logging
-        this.output = TTY.cachedOut;
-        assert context != null;
-    }
-
-    private void computeValueMap(String name) {
-        if (parent != null) {
-            for (DebugValueMap child : parent.getValueMap().getChildren()) {
-                if (child.getName().equals(name)) {
-                    this.valueMap = child;
-                    return;
-                }
-            }
-            this.valueMap = new DebugValueMap(name);
-            parent.getValueMap().addChild(this.valueMap);
-        } else {
-            this.valueMap = new DebugValueMap(name);
-        }
-    }
-
-    public void close() {
-        instanceTL.set(parent);
-        configTL.set(parentConfig);
-        lastClosedTL.set(this);
-    }
-
-    public boolean isDumpEnabled(int dumpLevel) {
-        assert dumpLevel > 0;
-        return currentDumpLevel >= dumpLevel;
-    }
-
-    /**
-     * Enable dumping at the new {@code dumpLevel} for the remainder of enclosing scopes. This only
-     * works if a {@link TopLevelDebugConfig} was installed at a higher scope.
-     *
-     * @param dumpLevel
-     */
-    public static void setDumpLevel(int dumpLevel) {
-        TopLevelDebugConfig config = fetchTopLevelDebugConfig("setDebugLevel");
-        if (config != null) {
-            config.override(DelegatingDebugConfig.Level.DUMP, dumpLevel);
-            recursiveUpdateFlags();
-        }
-    }
-
-    /**
-     * Enable logging at the new {@code logLevel} for the remainder of enclosing scopes. This only
-     * works if a {@link TopLevelDebugConfig} was installed at a higher scope.
-     *
-     * @param logLevel
-     */
-    public static void setLogLevel(int logLevel) {
-        TopLevelDebugConfig config = fetchTopLevelDebugConfig("setLogLevel");
-        if (config != null) {
-            config.override(DelegatingDebugConfig.Level.LOG, logLevel);
-            config.delegate(DelegatingDebugConfig.Feature.LOG_METHOD);
-            recursiveUpdateFlags();
-        }
-    }
-
-    private static void recursiveUpdateFlags() {
-        DebugScope c = DebugScope.getInstance();
-        while (c != null) {
-            c.updateFlags();
-            c = c.parent;
-        }
-    }
-
-    private static TopLevelDebugConfig fetchTopLevelDebugConfig(String msg) {
-        DebugConfig config = getConfig();
-        if (config instanceof TopLevelDebugConfig) {
-            return (TopLevelDebugConfig) config;
-        } else {
-            if (config == null) {
-                TTY.println("DebugScope.%s ignored because debugging is disabled", msg);
-            } else {
-                TTY.println("DebugScope.%s ignored because top level delegate config missing", msg);
-            }
-            return null;
-        }
-    }
-
-    public boolean isVerifyEnabled() {
-        return verifyEnabled;
-    }
-
-    public boolean isLogEnabled(int logLevel) {
-        assert logLevel > 0;
-        return currentLogLevel >= logLevel;
-    }
-
-    public boolean isMeterEnabled() {
-        return meterEnabled;
-    }
-
-    public boolean isTimeEnabled() {
-        return timeEnabled;
-    }
-
-    public boolean isMemUseTrackingEnabled() {
-        return memUseTrackingEnabled;
-    }
-
-    public void log(int logLevel, String msg, Object... args) {
-        if (isLogEnabled(logLevel)) {
-            getLastUsedIndent().log(logLevel, msg, args);
-        }
-    }
-
-    public void dump(int dumpLevel, Object object, String formatString, Object... args) {
-        if (isDumpEnabled(dumpLevel)) {
-            DebugConfig config = getConfig();
-            if (config != null) {
-                String message = String.format(formatString, args);
-                for (DebugDumpHandler dumpHandler : config.dumpHandlers()) {
-                    dumpHandler.dump(object, message);
-                }
-            }
-        }
-    }
-
-    /**
-     * This method exists mainly to allow a debugger (e.g., Eclipse) to force dump a graph.
-     */
-    public static void forceDump(Object object, String format, Object... args) {
-        DebugConfig config = getConfig();
-        if (config != null) {
-            String message = String.format(format, args);
-            for (DebugDumpHandler dumpHandler : config.dumpHandlers()) {
-                dumpHandler.dump(object, message);
-            }
-        } else {
-            TTY.println("Forced dump ignored because debugging is disabled - use -G:Dump=xxx option");
-        }
-    }
-
-    /**
-     * @see Debug#verify(Object, String)
-     */
-    public void verify(Object object, String formatString, Object... args) {
-        if (isVerifyEnabled()) {
-            DebugConfig config = getConfig();
-            if (config != null) {
-                String message = String.format(formatString, args);
-                for (DebugVerifyHandler handler : config.verifyHandlers()) {
-                    handler.verify(object, message);
-                }
-            }
-        }
-    }
-
-    /**
-     * Creates and enters a new debug scope which is either a child of the current scope or a
-     * disjoint top level scope.
-     *
-     * @param name the name of the new scope
-     * @param sandboxConfig the configuration to use for a new top level scope, or null if the new
-     *            scope should be a child scope
-     * @param newContextObjects objects to be appended to the debug context
-     * @return the new scope which will be exited when its {@link #close()} method is called
-     */
-    public DebugScope scope(CharSequence name, DebugConfig sandboxConfig, Object... newContextObjects) {
-        DebugScope newScope = null;
-        if (sandboxConfig != null) {
-            newScope = new DebugScope(name.toString(), this, true, newContextObjects);
-            configTL.set(sandboxConfig);
-        } else {
-            newScope = this.createChild(name.toString(), newContextObjects);
-        }
-        instanceTL.set(newScope);
-        newScope.updateFlags();
-        return newScope;
-    }
-
-    public RuntimeException handle(Throwable e) {
-        DebugScope lastClosed = lastClosedTL.get();
-        assert lastClosed.parent == this : "Debug.handle() used with no matching Debug.scope(...) or Debug.sandbox(...)";
-        if (e != lastExceptionThrownTL.get()) {
-            RuntimeException newException = null;
-            instanceTL.set(lastClosed);
-            try (DebugScope s = lastClosed) {
-                newException = s.interceptException(e);
-            }
-            assert instanceTL.get() == this;
-            assert lastClosed == lastClosedTL.get();
-            if (newException == null) {
-                lastExceptionThrownTL.set(e);
-            } else {
-                lastExceptionThrownTL.set(newException);
-                throw newException;
-            }
-        }
-        if (e instanceof Error) {
-            throw (Error) e;
-        }
-        if (e instanceof RuntimeException) {
-            throw (RuntimeException) e;
-        }
-        throw new RuntimeException(e);
-    }
-
-    private void updateFlags() {
-        DebugConfig config = getConfig();
-        if (config == null) {
-            meterEnabled = false;
-            memUseTrackingEnabled = false;
-            timeEnabled = false;
-            verifyEnabled = false;
-
-            currentDumpLevel = 0;
-
-            // Be pragmatic: provide a default log stream to prevent a crash if the stream is not
-            // set while logging
-            output = TTY.cachedOut;
-        } else {
-            meterEnabled = config.isMeterEnabled();
-            memUseTrackingEnabled = config.isMemUseTrackingEnabled();
-            timeEnabled = config.isTimeEnabled();
-            verifyEnabled = config.isVerifyEnabled();
-            output = config.output();
-            currentDumpLevel = config.getDumpLevel();
-            currentLogLevel = config.getLogLevel();
-        }
-    }
-
-    private RuntimeException interceptException(final Throwable e) {
-        final DebugConfig config = getConfig();
-        if (config != null) {
-            try (DebugScope s = scope("InterceptException", null, e)) {
-                return config.interceptException(e);
-            } catch (Throwable t) {
-                return new RuntimeException("Exception while intercepting exception", t);
-            }
-        }
-        return null;
-    }
-
-    private DebugValueMap getValueMap() {
-        if (valueMap == null) {
-            computeValueMap(unqualifiedName);
-        }
-        return valueMap;
-    }
-
-    long getCurrentValue(int index) {
-        return getValueMap().getCurrentValue(index);
-    }
-
-    void setCurrentValue(int index, long l) {
-        getValueMap().setCurrentValue(index, l);
-    }
-
-    private DebugScope createChild(String newName, Object[] newContext) {
-        return new DebugScope(newName, this, false, newContext);
-    }
-
-    public Iterable<Object> getCurrentContext() {
-        final DebugScope scope = this;
-        return new Iterable<Object>() {
-
-            @Override
-            public Iterator<Object> iterator() {
-                return new Iterator<Object>() {
-
-                    DebugScope currentScope = scope;
-                    int objectIndex;
-
-                    @Override
-                    public boolean hasNext() {
-                        selectScope();
-                        return currentScope != null;
-                    }
-
-                    private void selectScope() {
-                        while (currentScope != null && currentScope.context.length <= objectIndex) {
-                            currentScope = currentScope.sandbox ? null : currentScope.parent;
-                            objectIndex = 0;
-                        }
-                    }
-
-                    @Override
-                    public Object next() {
-                        selectScope();
-                        if (currentScope != null) {
-                            return currentScope.context[objectIndex++];
-                        }
-                        throw new IllegalStateException("May only be called if there is a next element.");
-                    }
-
-                    @Override
-                    public void remove() {
-                        throw new UnsupportedOperationException("This iterator is read only.");
-                    }
-                };
-            }
-        };
-    }
-
-    public static <T> T call(Callable<T> callable) {
-        try {
-            return callable.call();
-        } catch (Exception e) {
-            if (e instanceof RuntimeException) {
-                throw (RuntimeException) e;
-            } else {
-                throw new RuntimeException(e);
-            }
-        }
-    }
-
-    public void setConfig(DebugConfig newConfig) {
-        configTL.set(newConfig);
-        updateFlags();
-    }
-
-    public String getQualifiedName() {
-        if (qualifiedName == null) {
-            if (parent == null) {
-                qualifiedName = unqualifiedName;
-            } else {
-                qualifiedName = parent.getQualifiedName() + SCOPE_SEP + unqualifiedName;
-            }
-        }
-        return qualifiedName;
-    }
-
-    public Indent pushIndentLogger() {
-        lastUsedIndent = getLastUsedIndent().indent();
-        return lastUsedIndent;
-    }
-
-    public IndentImpl getLastUsedIndent() {
-        if (lastUsedIndent == null) {
-            if (parent != null) {
-                lastUsedIndent = new IndentImpl(parent.getLastUsedIndent());
-            } else {
-                lastUsedIndent = new IndentImpl(null);
-            }
-        }
-        return lastUsedIndent;
-    }
-}
--- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/DebugValue.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,94 +0,0 @@
-/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.debug.internal;
-
-/**
- * A name and index for a value managed in a thread local value map. All access to the value is made
- * via a {@link DebugValue} instance.
- */
-public abstract class DebugValue implements Comparable<DebugValue> {
-
-    private final String name;
-    private int index;
-    private boolean conditional;
-
-    protected DebugValue(String name, boolean conditional) {
-        this.name = name;
-        this.index = -1;
-        this.conditional = conditional;
-    }
-
-    public long getCurrentValue() {
-        ensureInitialized();
-        return DebugScope.getInstance().getCurrentValue(index);
-    }
-
-    protected void setCurrentValue(long l) {
-        ensureInitialized();
-        DebugScope.getInstance().setCurrentValue(index, l);
-    }
-
-    public void setConditional(boolean flag) {
-        conditional = flag;
-    }
-
-    public boolean isConditional() {
-        return conditional;
-    }
-
-    private void ensureInitialized() {
-        if (index == -1) {
-            index = KeyRegistry.register(this);
-        }
-    }
-
-    protected void addToCurrentValue(long value) {
-        setCurrentValue(getCurrentValue() + value);
-    }
-
-    /**
-     * Gets the globally unique index for the value represented by this object.
-     */
-    public int getIndex() {
-        ensureInitialized();
-        return index;
-    }
-
-    /**
-     * Gets the globally unique name for the value represented by this object.
-     */
-    public String getName() {
-        return name;
-    }
-
-    public int compareTo(DebugValue o) {
-        return name.compareTo(o.name);
-    }
-
-    @Override
-    public String toString() {
-        return name + "@" + index;
-    }
-
-    public abstract String toString(long value);
-}
--- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/DebugValueMap.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,171 +0,0 @@
-/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.debug.internal;
-
-import java.util.*;
-
-/**
- * A node in a tree of {@link DebugValue}s.
- */
-public class DebugValueMap {
-
-    private static final List<DebugValueMap> topLevelMaps = new ArrayList<>();
-
-    private long[] values;
-    private List<DebugValueMap> children;
-    private String name;
-
-    public DebugValueMap(String name) {
-        this.name = name;
-    }
-
-    public void setCurrentValue(int index, long l) {
-        ensureSize(index);
-        values[index] = l;
-    }
-
-    public long getCurrentValue(int index) {
-        ensureSize(index);
-        return values[index];
-    }
-
-    public void clearChildren() {
-        if (children != null) {
-            children.clear();
-        }
-    }
-
-    public void reset() {
-        if (values != null) {
-            Arrays.fill(values, 0L);
-        }
-        if (children != null) {
-            for (DebugValueMap child : children) {
-                child.reset();
-            }
-        }
-    }
-
-    private void ensureSize(int index) {
-        if (values == null) {
-            values = new long[index + 1];
-        }
-        if (values.length <= index) {
-            values = Arrays.copyOf(values, index + 1);
-        }
-    }
-
-    private int capacity() {
-        return (values == null) ? 0 : values.length;
-    }
-
-    public void addChild(DebugValueMap map) {
-        if (children == null) {
-            children = new ArrayList<>(4);
-        }
-        children.add(map);
-    }
-
-    public List<DebugValueMap> getChildren() {
-        if (children == null) {
-            return Collections.emptyList();
-        } else {
-            return Collections.unmodifiableList(children);
-        }
-    }
-
-    public boolean hasChildren() {
-        return children != null && !children.isEmpty();
-    }
-
-    public String getName() {
-        return this.name;
-    }
-
-    @Override
-    public String toString() {
-        return "DebugValueMap<" + getName() + ">";
-    }
-
-    public static synchronized void registerTopLevel(DebugValueMap map) {
-        topLevelMaps.add(map);
-    }
-
-    public static synchronized List<DebugValueMap> getTopLevelMaps() {
-        return topLevelMaps;
-    }
-
-    public void normalize() {
-        if (hasChildren()) {
-            Map<String, DebugValueMap> occurred = new HashMap<>();
-            for (DebugValueMap map : children) {
-                String mapName = map.getName();
-                if (!occurred.containsKey(mapName)) {
-                    occurred.put(mapName, map);
-                    map.normalize();
-                } else {
-                    occurred.get(mapName).mergeWith(map);
-                    occurred.get(mapName).normalize();
-                }
-            }
-
-            if (occurred.values().size() < children.size()) {
-                // At least one duplicate was found.
-                children.clear();
-                for (DebugValueMap map : occurred.values()) {
-                    addChild(map);
-                    map.normalize();
-                }
-            }
-        }
-    }
-
-    private void mergeWith(DebugValueMap map) {
-        if (map.hasChildren()) {
-            if (hasChildren()) {
-                children.addAll(map.children);
-            } else {
-                children = map.children;
-            }
-            map.children = null;
-        }
-
-        int size = Math.max(this.capacity(), map.capacity());
-        ensureSize(size);
-        for (int i = 0; i < size; ++i) {
-            long curValue = getCurrentValue(i);
-            long otherValue = map.getCurrentValue(i);
-            setCurrentValue(i, curValue + otherValue);
-        }
-    }
-
-    public void group() {
-        if (this.hasChildren()) {
-            List<DebugValueMap> oldChildren = new ArrayList<>(this.children);
-            this.children.clear();
-            for (DebugValueMap map : oldChildren) {
-                mergeWith(map);
-            }
-        }
-    }
-}
--- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/KeyRegistry.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.debug.internal;
-
-import java.util.*;
-
-/**
- * Registry for allocating a globally unique integer id to each {@link DebugValue}.
- */
-public class KeyRegistry {
-
-    private static final Map<String, Integer> keyMap = new HashMap<>();
-    private static final List<DebugValue> debugValues = new ArrayList<>();
-
-    /**
-     * Ensures a given debug value is registered.
-     *
-     * @return the globally unique id for {@code value}
-     */
-    public static synchronized int register(DebugValue value) {
-        String name = value.getName();
-        if (!keyMap.containsKey(name)) {
-            keyMap.put(name, debugValues.size());
-            debugValues.add(value);
-        }
-        return keyMap.get(name);
-    }
-
-    /**
-     * Gets a immutable view of the registered debug values.
-     *
-     * @return a list where {@code get(i).getIndex() == i}
-     */
-    public static synchronized List<DebugValue> getDebugValues() {
-        return Collections.unmodifiableList(debugValues);
-    }
-}
--- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/MemUseTrackerImpl.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,98 +0,0 @@
-/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.debug.internal;
-
-import static com.oracle.graal.debug.DebugCloseable.*;
-import static java.lang.Thread.*;
-
-import java.lang.management.*;
-
-import com.oracle.graal.debug.*;
-import com.sun.management.ThreadMXBean;
-
-public final class MemUseTrackerImpl extends AccumulatedDebugValue implements DebugMemUseTracker {
-
-    private static final ThreadMXBean threadMXBean = (ThreadMXBean) ManagementFactory.getThreadMXBean();
-
-    /**
-     * The amount of memory allocated by {@link ThreadMXBean#getThreadAllocatedBytes(long)} itself.
-     */
-    private static final long threadMXBeanOverhead = -getCurrentThreadAllocatedBytes() + getCurrentThreadAllocatedBytes();
-
-    public static long getCurrentThreadAllocatedBytes() {
-        return threadMXBean.getThreadAllocatedBytes(currentThread().getId()) - threadMXBeanOverhead;
-    }
-
-    /**
-     * Records the most recent active tracker.
-     */
-    private static final ThreadLocal<CloseableCounterImpl> currentTracker = new ThreadLocal<>();
-
-    public MemUseTrackerImpl(String name, boolean conditional) {
-        super(name, conditional, new DebugValue(name + "_Flat", conditional) {
-
-            @Override
-            public String toString(long value) {
-                return valueToString(value);
-            }
-        });
-    }
-
-    @Override
-    public DebugCloseable start() {
-        if (!isConditional() || Debug.isMemUseTrackingEnabled()) {
-            MemUseCloseableCounterImpl result = new MemUseCloseableCounterImpl(this);
-            currentTracker.set(result);
-            return result;
-        } else {
-            return VOID_CLOSEABLE;
-        }
-    }
-
-    public static String valueToString(long value) {
-        return String.format("%d bytes", value);
-    }
-
-    @Override
-    public String toString(long value) {
-        return valueToString(value);
-    }
-
-    private static final class MemUseCloseableCounterImpl extends CloseableCounterImpl implements DebugCloseable {
-
-        private MemUseCloseableCounterImpl(AccumulatedDebugValue counter) {
-            super(currentTracker.get(), counter);
-        }
-
-        @Override
-        long getCounterValue() {
-            return getCurrentThreadAllocatedBytes();
-        }
-
-        @Override
-        public void close() {
-            super.close();
-            currentTracker.set(parent);
-        }
-    }
-}
--- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/MetricImpl.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.debug.internal;
-
-import com.oracle.graal.debug.*;
-
-public final class MetricImpl extends DebugValue implements DebugMetric {
-
-    public MetricImpl(String name, boolean conditional) {
-        super(name, conditional);
-        if (isEnabled()) {
-            // Allows for zero-count metrics to be shown
-            getCurrentValue();
-        }
-    }
-
-    public void increment() {
-        add(1);
-    }
-
-    public void add(long value) {
-        if (isEnabled()) {
-            super.addToCurrentValue(value);
-        }
-    }
-
-    @Override
-    public String toString(long value) {
-        return Long.toString(value);
-    }
-}
--- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/TimerImpl.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,136 +0,0 @@
-/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.debug.internal;
-
-import static com.oracle.graal.debug.DebugCloseable.*;
-
-import java.lang.management.*;
-import java.util.concurrent.*;
-
-import com.oracle.graal.debug.*;
-
-public final class TimerImpl extends AccumulatedDebugValue implements DebugTimer {
-
-    private static final ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean();
-
-    /**
-     * Records the most recent active timer.
-     */
-    private static final ThreadLocal<CloseableCounterImpl> currentTimer = new ThreadLocal<>();
-
-    static class FlatTimer extends DebugValue implements DebugTimer {
-        private TimerImpl accm;
-
-        public FlatTimer(String name, boolean conditional) {
-            super(name + "_Flat", conditional);
-        }
-
-        @Override
-        public String toString(long value) {
-            return valueToString(value);
-        }
-
-        public TimeUnit getTimeUnit() {
-            return accm.getTimeUnit();
-        }
-
-        public DebugCloseable start() {
-            return accm.start();
-        }
-    }
-
-    public TimerImpl(String name, boolean conditional) {
-        super(name, conditional, new FlatTimer(name, conditional));
-        ((FlatTimer) flat).accm = this;
-    }
-
-    @Override
-    public DebugCloseable start() {
-        if (!isConditional() || Debug.isTimeEnabled()) {
-            AbstractTimer result;
-            if (threadMXBean.isCurrentThreadCpuTimeSupported()) {
-                result = new CpuTimeTimer(this);
-            } else {
-                result = new SystemNanosTimer(this);
-            }
-            currentTimer.set(result);
-            return result;
-        } else {
-            return VOID_CLOSEABLE;
-        }
-    }
-
-    public static String valueToString(long value) {
-        return String.format("%d.%d ms", value / 1000000, (value / 100000) % 10);
-    }
-
-    public DebugTimer getFlat() {
-        return (FlatTimer) flat;
-    }
-
-    @Override
-    public String toString(long value) {
-        return valueToString(value);
-    }
-
-    public TimeUnit getTimeUnit() {
-        return TimeUnit.NANOSECONDS;
-    }
-
-    private abstract static class AbstractTimer extends CloseableCounterImpl implements DebugCloseable {
-
-        private AbstractTimer(AccumulatedDebugValue counter) {
-            super(currentTimer.get(), counter);
-        }
-
-        @Override
-        public void close() {
-            super.close();
-            currentTimer.set(parent);
-        }
-    }
-
-    private final class SystemNanosTimer extends AbstractTimer {
-
-        public SystemNanosTimer(TimerImpl timer) {
-            super(timer);
-        }
-
-        @Override
-        protected long getCounterValue() {
-            return System.nanoTime();
-        }
-    }
-
-    private final class CpuTimeTimer extends AbstractTimer {
-
-        public CpuTimeTimer(TimerImpl timer) {
-            super(timer);
-        }
-
-        @Override
-        protected long getCounterValue() {
-            return threadMXBean.getCurrentThreadCpuTime();
-        }
-    }
-}
--- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Edges.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Edges.java	Thu May 28 21:11:28 2015 -0700
@@ -22,9 +22,9 @@
  */
 package com.oracle.graal.graph;
 
-import static com.oracle.graal.compiler.common.UnsafeAccess.*;
 import static com.oracle.graal.graph.Graph.*;
 import static com.oracle.graal.graph.Node.*;
+import static com.oracle.jvmci.common.UnsafeAccess.*;
 
 import java.util.*;
 import java.util.function.*;
--- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/GraalGraphInternalError.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,148 +0,0 @@
-/*
- * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.graph;
-
-import com.oracle.graal.compiler.common.*;
-
-/**
- * This error is the graph/node aware extension of GraalInternalError.
- */
-public class GraalGraphInternalError extends GraalInternalError {
-
-    private static final long serialVersionUID = -989290015525497919L;
-    private Node node;
-    private Graph graph;
-
-    /**
-     * This constructor creates a {@link GraalGraphInternalError} with a message assembled via
-     * {@link String#format(String, Object...)}. It always uses the ENGLISH locale in order to
-     * always generate the same output.
-     *
-     * @param msg the message that will be associated with the error, in String.format syntax
-     * @param args parameters to String.format - parameters that implement {@link Iterable} will be
-     *            expanded into a [x, x, ...] representation.
-     */
-    public GraalGraphInternalError(String msg, Object... args) {
-        super(msg, args);
-    }
-
-    /**
-     * This constructor creates a {@link GraalGraphInternalError} for a given causing Throwable
-     * instance.
-     *
-     * @param cause the original exception that contains additional information on this error
-     */
-    public GraalGraphInternalError(Throwable cause) {
-        super(cause);
-    }
-
-    /**
-     * This constructor creates a {@link GraalGraphInternalError} from a given GraalInternalError
-     * instance.
-     *
-     * @param e the original GraalInternalError
-     */
-    protected GraalGraphInternalError(GraalInternalError e) {
-        super(e);
-        if (e instanceof GraalGraphInternalError) {
-            node = ((GraalGraphInternalError) e).node;
-            graph = ((GraalGraphInternalError) e).graph;
-        }
-    }
-
-    /**
-     * Adds a graph to the context of this VerificationError. The first graph added via this method
-     * will be returned by {@link #graph()}.
-     *
-     * @param newGraph the graph which is in a incorrect state, if the verification error was not
-     *            caused by a specific node
-     */
-    GraalGraphInternalError addContext(Graph newGraph) {
-        if (newGraph != this.graph) {
-            addContext("graph", newGraph);
-            if (this.graph == null) {
-                this.graph = newGraph;
-            }
-        }
-        return this;
-    }
-
-    /**
-     * Adds a node to the context of this VerificationError. The first node added via this method
-     * will be returned by {@link #node()}.
-     *
-     * @param newNode the node which is in a incorrect state, if the verification error was caused
-     *            by a node
-     */
-    public GraalGraphInternalError addContext(Node newNode) {
-        if (newNode != this.node) {
-            addContext("node", newNode);
-            if (this.node == null) {
-                this.node = newNode;
-            }
-        }
-        return this;
-    }
-
-    /**
-     * Transform a GraalInternalError into a GraalGraphInternalError and add a graph to the context.
-     *
-     * @param e the previous error
-     * @param newGraph the graph which is in a incorrect state, if the verification error was not
-     *            caused by a specific node
-     */
-    public static GraalGraphInternalError transformAndAddContext(GraalInternalError e, Graph newGraph) {
-        GraalGraphInternalError graphError;
-        if (e instanceof GraalGraphInternalError) {
-            graphError = (GraalGraphInternalError) e;
-        } else {
-            graphError = new GraalGraphInternalError(e);
-        }
-        return graphError.addContext(newGraph);
-    }
-
-    /**
-     * Transform a GraalInternalError into a GraalGraphInternalError and add a node to the context.
-     *
-     * @param e the previous error
-     * @param newNode the node which is in a incorrect state, if the verification error was caused
-     *            by a node
-     */
-    public static GraalGraphInternalError transformAndAddContext(GraalInternalError e, Node newNode) {
-        GraalGraphInternalError graphError;
-        if (e instanceof GraalGraphInternalError) {
-            graphError = (GraalGraphInternalError) e;
-        } else {
-            graphError = new GraalGraphInternalError(e);
-        }
-        return graphError.addContext(newNode);
-    }
-
-    public Node node() {
-        return node;
-    }
-
-    public Graph graph() {
-        return graph;
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/GraalGraphJVMCIError.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,147 @@
+/*
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.graal.graph;
+
+import com.oracle.jvmci.common.*;
+
+/**
+ * This error is the graph/node aware extension of JVMCIError.
+ */
+public class GraalGraphJVMCIError extends JVMCIError {
+
+    private static final long serialVersionUID = -989290015525497919L;
+    private Node node;
+    private Graph graph;
+
+    /**
+     * This constructor creates a {@link GraalGraphJVMCIError} with a message assembled via
+     * {@link String#format(String, Object...)}. It always uses the ENGLISH locale in order to
+     * always generate the same output.
+     *
+     * @param msg the message that will be associated with the error, in String.format syntax
+     * @param args parameters to String.format - parameters that implement {@link Iterable} will be
+     *            expanded into a [x, x, ...] representation.
+     */
+    public GraalGraphJVMCIError(String msg, Object... args) {
+        super(msg, args);
+    }
+
+    /**
+     * This constructor creates a {@link GraalGraphJVMCIError} for a given causing Throwable
+     * instance.
+     *
+     * @param cause the original exception that contains additional information on this error
+     */
+    public GraalGraphJVMCIError(Throwable cause) {
+        super(cause);
+    }
+
+    /**
+     * This constructor creates a {@link GraalGraphJVMCIError} from a given JVMCIError instance.
+     *
+     * @param e the original JVMCIError
+     */
+    protected GraalGraphJVMCIError(JVMCIError e) {
+        super(e);
+        if (e instanceof GraalGraphJVMCIError) {
+            node = ((GraalGraphJVMCIError) e).node;
+            graph = ((GraalGraphJVMCIError) e).graph;
+        }
+    }
+
+    /**
+     * Adds a graph to the context of this VerificationError. The first graph added via this method
+     * will be returned by {@link #graph()}.
+     *
+     * @param newGraph the graph which is in a incorrect state, if the verification error was not
+     *            caused by a specific node
+     */
+    GraalGraphJVMCIError addContext(Graph newGraph) {
+        if (newGraph != this.graph) {
+            addContext("graph", newGraph);
+            if (this.graph == null) {
+                this.graph = newGraph;
+            }
+        }
+        return this;
+    }
+
+    /**
+     * Adds a node to the context of this VerificationError. The first node added via this method
+     * will be returned by {@link #node()}.
+     *
+     * @param newNode the node which is in a incorrect state, if the verification error was caused
+     *            by a node
+     */
+    public GraalGraphJVMCIError addContext(Node newNode) {
+        if (newNode != this.node) {
+            addContext("node", newNode);
+            if (this.node == null) {
+                this.node = newNode;
+            }
+        }
+        return this;
+    }
+
+    /**
+     * Transform a JVMCIError into a GraalGraphInternalError and add a graph to the context.
+     *
+     * @param e the previous error
+     * @param newGraph the graph which is in a incorrect state, if the verification error was not
+     *            caused by a specific node
+     */
+    public static GraalGraphJVMCIError transformAndAddContext(JVMCIError e, Graph newGraph) {
+        GraalGraphJVMCIError graphError;
+        if (e instanceof GraalGraphJVMCIError) {
+            graphError = (GraalGraphJVMCIError) e;
+        } else {
+            graphError = new GraalGraphJVMCIError(e);
+        }
+        return graphError.addContext(newGraph);
+    }
+
+    /**
+     * Transform a JVMCIError into a GraalGraphInternalError and add a node to the context.
+     *
+     * @param e the previous error
+     * @param newNode the node which is in a incorrect state, if the verification error was caused
+     *            by a node
+     */
+    public static GraalGraphJVMCIError transformAndAddContext(JVMCIError e, Node newNode) {
+        GraalGraphJVMCIError graphError;
+        if (e instanceof GraalGraphJVMCIError) {
+            graphError = (GraalGraphJVMCIError) e;
+        } else {
+            graphError = new GraalGraphJVMCIError(e);
+        }
+        return graphError.addContext(newNode);
+    }
+
+    public Node node() {
+        return node;
+    }
+
+    public Graph graph() {
+        return graph;
+    }
+}
--- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Graph.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Graph.java	Thu May 28 21:11:28 2015 -0700
@@ -28,10 +28,11 @@
 import java.util.function.*;
 
 import com.oracle.graal.compiler.common.*;
-import com.oracle.graal.debug.*;
 import com.oracle.graal.graph.Node.ValueNumberable;
 import com.oracle.graal.graph.iterators.*;
-import com.oracle.graal.options.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.options.*;
 
 /**
  * This class is a graph container, it contains the set of nodes that belong to this graph.
@@ -906,12 +907,12 @@
                     try {
                         assert node.verify();
                     } catch (AssertionError t) {
-                        throw new GraalInternalError(t);
+                        throw new JVMCIError(t);
                     } catch (RuntimeException t) {
-                        throw new GraalInternalError(t);
+                        throw new JVMCIError(t);
                     }
-                } catch (GraalInternalError e) {
-                    throw GraalGraphInternalError.transformAndAddContext(e, node).addContext(this);
+                } catch (JVMCIError e) {
+                    throw GraalGraphJVMCIError.transformAndAddContext(e, node).addContext(this);
                 }
             }
         }
--- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Node.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Node.java	Thu May 28 21:11:28 2015 -0700
@@ -32,12 +32,14 @@
 import sun.misc.*;
 
 import com.oracle.graal.compiler.common.*;
-import com.oracle.graal.debug.*;
 import com.oracle.graal.graph.Graph.NodeEvent;
 import com.oracle.graal.graph.Graph.NodeEventListener;
+import com.oracle.graal.graph.Graph.Options;
 import com.oracle.graal.graph.iterators.*;
 import com.oracle.graal.graph.spi.*;
 import com.oracle.graal.nodeinfo.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.debug.*;
 
 /**
  * This class is the base class for all nodes. It represents a node that can be inserted in a
@@ -828,7 +830,7 @@
                 copyOrClearEdgesForClone(newNode, Successors, edgesToCopy);
             }
         } catch (Exception e) {
-            throw new GraalGraphInternalError(e).addContext(this);
+            throw new GraalGraphJVMCIError(e).addContext(this);
         }
         newNode.graph = into;
         newNode.id = INITIAL_ID;
@@ -917,7 +919,7 @@
         }
     }
 
-    protected VerificationError fail(String message, Object... args) throws GraalGraphInternalError {
+    protected VerificationError fail(String message, Object... args) throws GraalGraphJVMCIError {
         throw new VerificationError(message, args).addContext(this);
     }
 
--- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeClass.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeClass.java	Thu May 28 21:11:28 2015 -0700
@@ -23,10 +23,10 @@
 package com.oracle.graal.graph;
 
 import static com.oracle.graal.compiler.common.Fields.*;
-import static com.oracle.graal.compiler.common.GraalInternalError.*;
 import static com.oracle.graal.graph.Edges.*;
 import static com.oracle.graal.graph.InputEdges.*;
 import static com.oracle.graal.graph.Node.*;
+import static com.oracle.jvmci.common.JVMCIError.*;
 
 import java.lang.annotation.*;
 import java.lang.reflect.*;
@@ -34,7 +34,6 @@
 import java.util.concurrent.atomic.*;
 
 import com.oracle.graal.compiler.common.*;
-import com.oracle.graal.debug.*;
 import com.oracle.graal.graph.Edges.Type;
 import com.oracle.graal.graph.Graph.DuplicationReplacement;
 import com.oracle.graal.graph.Node.Input;
@@ -43,6 +42,8 @@
 import com.oracle.graal.graph.spi.*;
 import com.oracle.graal.graph.spi.Canonicalizable.BinaryCommutative;
 import com.oracle.graal.nodeinfo.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.debug.*;
 
 /**
  * Metadata for every {@link Node} type. The metadata includes:
@@ -366,11 +367,11 @@
                     if (INPUT_LIST_CLASS.isAssignableFrom(type)) {
                         // NodeInputList fields should not be final since they are
                         // written (via Unsafe) in clearInputs()
-                        GraalInternalError.guarantee(!Modifier.isFinal(modifiers), "NodeInputList input field %s should not be final", field);
-                        GraalInternalError.guarantee(!Modifier.isPublic(modifiers), "NodeInputList input field %s should not be public", field);
+                        JVMCIError.guarantee(!Modifier.isFinal(modifiers), "NodeInputList input field %s should not be final", field);
+                        JVMCIError.guarantee(!Modifier.isPublic(modifiers), "NodeInputList input field %s should not be public", field);
                     } else {
-                        GraalInternalError.guarantee(NODE_CLASS.isAssignableFrom(type) || type.isInterface(), "invalid input type: %s", type);
-                        GraalInternalError.guarantee(!Modifier.isFinal(modifiers), "Node input field %s should not be final", field);
+                        JVMCIError.guarantee(NODE_CLASS.isAssignableFrom(type) || type.isInterface(), "invalid input type: %s", type);
+                        JVMCIError.guarantee(!Modifier.isFinal(modifiers), "Node input field %s should not be final", field);
                         directInputs++;
                     }
                     InputType inputType;
@@ -385,18 +386,18 @@
                     if (SUCCESSOR_LIST_CLASS.isAssignableFrom(type)) {
                         // NodeSuccessorList fields should not be final since they are
                         // written (via Unsafe) in clearSuccessors()
-                        GraalInternalError.guarantee(!Modifier.isFinal(modifiers), "NodeSuccessorList successor field % should not be final", field);
-                        GraalInternalError.guarantee(!Modifier.isPublic(modifiers), "NodeSuccessorList successor field %s should not be public", field);
+                        JVMCIError.guarantee(!Modifier.isFinal(modifiers), "NodeSuccessorList successor field % should not be final", field);
+                        JVMCIError.guarantee(!Modifier.isPublic(modifiers), "NodeSuccessorList successor field %s should not be public", field);
                     } else {
-                        GraalInternalError.guarantee(NODE_CLASS.isAssignableFrom(type), "invalid successor type: %s", type);
-                        GraalInternalError.guarantee(!Modifier.isFinal(modifiers), "Node successor field %s should not be final", field);
+                        JVMCIError.guarantee(NODE_CLASS.isAssignableFrom(type), "invalid successor type: %s", type);
+                        JVMCIError.guarantee(!Modifier.isFinal(modifiers), "Node successor field %s should not be final", field);
                         directSuccessors++;
                     }
                     successors.add(new EdgeInfo(offset, field.getName(), type, field.getDeclaringClass()));
                 } else {
-                    GraalInternalError.guarantee(!NODE_CLASS.isAssignableFrom(type) || field.getName().equals("Null"), "suspicious node field: %s", field);
-                    GraalInternalError.guarantee(!INPUT_LIST_CLASS.isAssignableFrom(type), "suspicious node input list field: %s", field);
-                    GraalInternalError.guarantee(!SUCCESSOR_LIST_CLASS.isAssignableFrom(type), "suspicious node successor list field: %s", field);
+                    JVMCIError.guarantee(!NODE_CLASS.isAssignableFrom(type) || field.getName().equals("Null"), "suspicious node field: %s", field);
+                    JVMCIError.guarantee(!INPUT_LIST_CLASS.isAssignableFrom(type), "suspicious node input list field: %s", field);
+                    JVMCIError.guarantee(!SUCCESSOR_LIST_CLASS.isAssignableFrom(type), "suspicious node successor list field: %s", field);
                     super.scanField(field, offset);
                 }
             }
--- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeInputList.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeInputList.java	Thu May 28 21:11:28 2015 -0700
@@ -26,7 +26,7 @@
 
 import java.util.*;
 
-import com.oracle.graal.graph.Edges.*;
+import com.oracle.graal.graph.Edges.Type;
 
 public final class NodeInputList<T extends Node> extends NodeList<T> {
 
--- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeSuccessorList.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeSuccessorList.java	Thu May 28 21:11:28 2015 -0700
@@ -26,7 +26,7 @@
 
 import java.util.*;
 
-import com.oracle.graal.graph.Edges.*;
+import com.oracle.graal.graph.Edges.Type;
 
 public final class NodeSuccessorList<T extends Node> extends NodeList<T> {
 
--- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/VerificationError.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/VerificationError.java	Thu May 28 21:11:28 2015 -0700
@@ -26,7 +26,7 @@
  * This error represents a failed verification of a node . It must only be used for conditions that
  * should never occur during normal operation.
  */
-public class VerificationError extends GraalGraphInternalError {
+public class VerificationError extends GraalGraphJVMCIError {
 
     private static final long serialVersionUID = 8459607567446819822L;
 
--- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/iterators/NodePredicate.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/iterators/NodePredicate.java	Thu May 28 21:11:28 2015 -0700
@@ -23,7 +23,9 @@
 package com.oracle.graal.graph.iterators;
 
 import com.oracle.graal.graph.*;
-import com.oracle.graal.graph.iterators.NodePredicates.*;
+import com.oracle.graal.graph.iterators.NodePredicates.AndPredicate;
+import com.oracle.graal.graph.iterators.NodePredicates.NotPredicate;
+import com.oracle.graal.graph.iterators.NodePredicates.OrPredicate;
 
 public interface NodePredicate {
 
--- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/spi/Canonicalizable.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/spi/Canonicalizable.java	Thu May 28 21:11:28 2015 -0700
@@ -22,8 +22,8 @@
  */
 package com.oracle.graal.graph.spi;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.graph.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * Nodes can implement {@link Canonicalizable} or one of the two sub-interfaces {@link Unary} and
--- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/spi/CanonicalizerTool.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/spi/CanonicalizerTool.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,8 @@
  */
 package com.oracle.graal.graph.spi;
 
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.meta.ConstantReflectionProvider;
+import com.oracle.jvmci.meta.MetaAccessProvider;
 import com.oracle.graal.graph.*;
 
 public interface CanonicalizerTool {
--- a/graal/com.oracle.graal.graphbuilderconf/src/com/oracle/graal/graphbuilderconf/ForeignCallPlugin.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.graphbuilderconf/src/com/oracle/graal/graphbuilderconf/ForeignCallPlugin.java	Thu May 28 21:11:28 2015 -0700
@@ -22,9 +22,9 @@
  */
 package com.oracle.graal.graphbuilderconf;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.graphbuilderconf.MethodIdMap.Receiver;
+import com.oracle.jvmci.code.ForeignCallsProvider;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
+import com.oracle.jvmci.meta.ForeignCallDescriptor;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.extended.*;
 
@@ -40,10 +40,10 @@
         this.descriptor = descriptor;
     }
 
-    public boolean execute(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode[] args) {
+    public boolean execute(GraphBuilderContext b, ResolvedJavaMethod targetMethod, InvocationPlugin.Receiver receiver, ValueNode[] args) {
         ForeignCallNode foreignCall = new ForeignCallNode(foreignCalls, descriptor, args);
         foreignCall.setBci(b.bci());
-        b.addPush(foreignCall);
+        b.addPush(targetMethod.getSignature().getReturnKind(), foreignCall);
         return true;
     }
 }
--- a/graal/com.oracle.graal.graphbuilderconf/src/com/oracle/graal/graphbuilderconf/GenericInvocationPlugin.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.graphbuilderconf/src/com/oracle/graal/graphbuilderconf/GenericInvocationPlugin.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,7 @@
  */
 package com.oracle.graal.graphbuilderconf;
 
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
 import com.oracle.graal.nodes.*;
 
 /**
--- a/graal/com.oracle.graal.graphbuilderconf/src/com/oracle/graal/graphbuilderconf/GraphBuilderConfiguration.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.graphbuilderconf/src/com/oracle/graal/graphbuilderconf/GraphBuilderConfiguration.java	Thu May 28 21:11:28 2015 -0700
@@ -22,9 +22,9 @@
  */
 package com.oracle.graal.graphbuilderconf;
 
+import com.oracle.jvmci.meta.ResolvedJavaType;
 import java.util.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.nodes.*;
 
--- a/graal/com.oracle.graal.graphbuilderconf/src/com/oracle/graal/graphbuilderconf/GraphBuilderContext.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.graphbuilderconf/src/com/oracle/graal/graphbuilderconf/GraphBuilderContext.java	Thu May 28 21:11:28 2015 -0700
@@ -22,12 +22,18 @@
  */
 package com.oracle.graal.graphbuilderconf;
 
-import static com.oracle.graal.api.meta.DeoptimizationAction.*;
-import static com.oracle.graal.api.meta.DeoptimizationReason.*;
+import com.oracle.jvmci.code.BailoutException;
+import com.oracle.jvmci.meta.ResolvedJavaType;
+import com.oracle.jvmci.meta.Assumptions;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
+import com.oracle.jvmci.meta.ConstantReflectionProvider;
+import com.oracle.jvmci.meta.Kind;
+import com.oracle.jvmci.meta.MetaAccessProvider;
+import com.oracle.jvmci.meta.JavaType;
+import static com.oracle.jvmci.meta.DeoptimizationAction.*;
+import static com.oracle.jvmci.meta.DeoptimizationReason.*;
 import static com.oracle.graal.compiler.common.type.StampFactory.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.nodes.CallTargetNode.InvokeKind;
 import com.oracle.graal.nodes.*;
@@ -42,8 +48,8 @@
 public interface GraphBuilderContext {
 
     /**
-     * Raw operation for adding a node to the graph when neither {@link #add},
-     * {@link #addPush(ValueNode)} nor {@link #addPush(Kind, ValueNode)} can be used.
+     * Raw operation for adding a node to the graph when neither {@link #add} nor
+     * {@link #addPush(Kind, ValueNode)} can be used.
      *
      * @return either the node added or an equivalent node
      */
@@ -96,26 +102,13 @@
      * is a {@link StateSplit} with a null {@linkplain StateSplit#stateAfter() frame state}, the
      * frame state is initialized.
      *
-     * @param value the value to add to the graph and push to the stack. The {@code value.getKind()}
-     *            kind is used when type checking this operation.
-     * @return a node equivalent to {@code value} in the graph
-     */
-    default <T extends ValueNode> T addPush(T value) {
-        return addPush(value.getKind().getStackKind(), value);
-    }
-
-    /**
-     * Adds a node with a non-void kind to the graph, pushes it to the stack. If the returned node
-     * is a {@link StateSplit} with a null {@linkplain StateSplit#stateAfter() frame state}, the
-     * frame state is initialized.
-     *
      * @param kind the kind to use when type checking this operation
      * @param value the value to add to the graph and push to the stack
      * @return a node equivalent to {@code value} in the graph
      */
     default <T extends ValueNode> T addPush(Kind kind, T value) {
         T equivalentValue = value.graph() != null ? value : append(value);
-        push(kind.getStackKind(), equivalentValue);
+        push(kind, equivalentValue);
         if (equivalentValue instanceof StateSplit) {
             StateSplit stateSplit = (StateSplit) equivalentValue;
             if (stateSplit.stateAfter() == null && stateSplit.hasSideEffect()) {
--- a/graal/com.oracle.graal.graphbuilderconf/src/com/oracle/graal/graphbuilderconf/InlineInvokePlugin.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.graphbuilderconf/src/com/oracle/graal/graphbuilderconf/InlineInvokePlugin.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,8 @@
  */
 package com.oracle.graal.graphbuilderconf;
 
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
+import com.oracle.jvmci.meta.JavaType;
 import com.oracle.graal.nodes.*;
 
 /**
--- a/graal/com.oracle.graal.graphbuilderconf/src/com/oracle/graal/graphbuilderconf/IntrinsicContext.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.graphbuilderconf/src/com/oracle/graal/graphbuilderconf/IntrinsicContext.java	Thu May 28 21:11:28 2015 -0700
@@ -22,10 +22,10 @@
  */
 package com.oracle.graal.graphbuilderconf;
 
-import static com.oracle.graal.api.code.BytecodeFrame.*;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
+import static com.oracle.jvmci.code.BytecodeFrame.*;
 import static com.oracle.graal.graphbuilderconf.IntrinsicContext.CompilationContext.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.nodes.*;
 
 /**
--- a/graal/com.oracle.graal.graphbuilderconf/src/com/oracle/graal/graphbuilderconf/InvocationPlugin.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.graphbuilderconf/src/com/oracle/graal/graphbuilderconf/InvocationPlugin.java	Thu May 28 21:11:28 2015 -0700
@@ -25,10 +25,10 @@
 import java.lang.invoke.*;
 import java.lang.reflect.*;
 
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.common.*;
-import com.oracle.graal.graphbuilderconf.MethodIdMap.Receiver;
 import com.oracle.graal.nodes.*;
+import com.oracle.graal.nodes.type.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * Plugin for handling a specific method invocation.
@@ -36,6 +36,28 @@
 public interface InvocationPlugin extends GraphBuilderPlugin {
 
     /**
+     * The receiver in a non-static method. The class literal for this interface must be used with
+     * {@link MethodIdMap#put(Object, boolean, Class, String, Class...)} to denote the receiver
+     * argument for such a non-static method.
+     */
+    public interface Receiver {
+        /**
+         * Gets the receiver value, null checking it first if necessary.
+         *
+         * @return the receiver value with a {@linkplain StampTool#isPointerNonNull(ValueNode)
+         *         non-null} stamp
+         */
+        ValueNode get();
+
+        /**
+         * Determines if the receiver is constant.
+         */
+        default boolean isConstant() {
+            return false;
+        }
+    }
+
+    /**
      * Determines if this plugin is for a method with a polymorphic signature (e.g.
      * {@link MethodHandle#invokeExact(Object...)}).
      */
@@ -59,49 +81,49 @@
      *            position 0 if {@code targetMethod} is not static
      * @see #execute
      */
-    default boolean applyPolymorphic(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode... argsIncludingReceiver) {
+    default boolean applyPolymorphic(GraphBuilderContext b, ResolvedJavaMethod targetMethod, InvocationPlugin.Receiver receiver, ValueNode... argsIncludingReceiver) {
         return defaultHandler(b, targetMethod, receiver, argsIncludingReceiver);
     }
 
     /**
      * @see #execute
      */
-    default boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver) {
+    default boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, InvocationPlugin.Receiver receiver) {
         return defaultHandler(b, targetMethod, receiver);
     }
 
     /**
      * @see #execute
      */
-    default boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode arg) {
+    default boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, InvocationPlugin.Receiver receiver, ValueNode arg) {
         return defaultHandler(b, targetMethod, receiver, arg);
     }
 
     /**
      * @see #execute
      */
-    default boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode arg1, ValueNode arg2) {
+    default boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, InvocationPlugin.Receiver receiver, ValueNode arg1, ValueNode arg2) {
         return defaultHandler(b, targetMethod, receiver, arg1, arg2);
     }
 
     /**
      * @see #execute
      */
-    default boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode arg1, ValueNode arg2, ValueNode arg3) {
+    default boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, InvocationPlugin.Receiver receiver, ValueNode arg1, ValueNode arg2, ValueNode arg3) {
         return defaultHandler(b, targetMethod, receiver, arg1, arg2, arg3);
     }
 
     /**
      * @see #execute
      */
-    default boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode arg1, ValueNode arg2, ValueNode arg3, ValueNode arg4) {
+    default boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, InvocationPlugin.Receiver receiver, ValueNode arg1, ValueNode arg2, ValueNode arg3, ValueNode arg4) {
         return defaultHandler(b, targetMethod, receiver, arg1, arg2, arg3, arg4);
     }
 
     /**
      * @see #execute
      */
-    default boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode arg1, ValueNode arg2, ValueNode arg3, ValueNode arg4, ValueNode arg5) {
+    default boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, InvocationPlugin.Receiver receiver, ValueNode arg1, ValueNode arg2, ValueNode arg3, ValueNode arg4, ValueNode arg5) {
         return defaultHandler(b, targetMethod, receiver, arg1, arg2, arg3, arg4, arg5);
     }
 
@@ -121,7 +143,7 @@
      *         inlining it or creating an {@link Invoke} node). A plugin that does not handle an
      *         invocation must not modify the graph being constructed.
      */
-    default boolean execute(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode[] argsIncludingReceiver) {
+    default boolean execute(GraphBuilderContext b, ResolvedJavaMethod targetMethod, InvocationPlugin.Receiver receiver, ValueNode[] argsIncludingReceiver) {
         if (isSignaturePolymorphic()) {
             return applyPolymorphic(b, targetMethod, receiver, argsIncludingReceiver);
         } else if (receiver != null) {
@@ -164,8 +186,9 @@
     /**
      * Handles an invocation when a specific {@code apply} method is not available.
      */
-    default boolean defaultHandler(@SuppressWarnings("unused") GraphBuilderContext b, ResolvedJavaMethod targetMethod, @SuppressWarnings("unused") Receiver receiver, ValueNode... args) {
-        throw new GraalInternalError("Invocation plugin for %s does not handle invocations with %d arguments", targetMethod.format("%H.%n(%p)"), args.length);
+    default boolean defaultHandler(@SuppressWarnings("unused") GraphBuilderContext b, ResolvedJavaMethod targetMethod, @SuppressWarnings("unused") InvocationPlugin.Receiver receiver,
+                    ValueNode... args) {
+        throw new JVMCIError("Invocation plugin for %s does not handle invocations with %d arguments", targetMethod.format("%H.%n(%p)"), args.length);
     }
 
     default StackTraceElement getApplySourceLocation(MetaAccessProvider metaAccess) {
@@ -177,6 +200,6 @@
                 return metaAccess.lookupJavaMethod(m).asStackTraceElement(0);
             }
         }
-        throw new GraalInternalError("could not find method named \"apply\" or \"defaultHandler\" in " + c.getName());
+        throw new JVMCIError("could not find method named \"apply\" or \"defaultHandler\" in " + c.getName());
     }
 }
--- a/graal/com.oracle.graal.graphbuilderconf/src/com/oracle/graal/graphbuilderconf/InvocationPlugins.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.graphbuilderconf/src/com/oracle/graal/graphbuilderconf/InvocationPlugins.java	Thu May 28 21:11:28 2015 -0700
@@ -22,16 +22,18 @@
  */
 package com.oracle.graal.graphbuilderconf;
 
+import com.oracle.jvmci.meta.MethodIdHolder;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
+import com.oracle.jvmci.meta.MethodIdMap;
+import com.oracle.jvmci.meta.MetaAccessProvider;
 import static java.lang.String.*;
 
 import java.lang.reflect.*;
 import java.util.*;
 
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.meta.MethodIdMap.MethodKey;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.iterators.*;
-import com.oracle.graal.graphbuilderconf.MethodIdMap.MethodKey;
-import com.oracle.graal.graphbuilderconf.MethodIdMap.Receiver;
 import com.oracle.graal.nodes.*;
 
 /**
@@ -39,7 +41,7 @@
  */
 public class InvocationPlugins {
 
-    public static class InvocationPluginReceiver implements Receiver {
+    public static class InvocationPluginReceiver implements InvocationPlugin.Receiver {
         private final GraphBuilderContext parser;
         private ValueNode[] args;
         private ValueNode value;
@@ -163,7 +165,10 @@
          *
          * @param substituteDeclaringClass the class declaring the substitute method
          * @param name the name of both the original and substitute method
-         * @param argumentTypes the parameter types of the substitute
+         * @param argumentTypes the argument types of the method. Element 0 of this array must be
+         *            the {@link Class} value for {@link InvocationPlugin.Receiver} iff the method
+         *            is non-static. Upon returning, element 0 will have been rewritten to
+         *            {@code declaringClass}
          */
         public void registerMethodSubstitution(Class<?> substituteDeclaringClass, String name, Class<?>... argumentTypes) {
             MethodSubstitutionPlugin plugin = new MethodSubstitutionPlugin(substituteDeclaringClass, name, argumentTypes);
@@ -203,9 +208,18 @@
     /**
      * Registers an invocation plugin for a given method. There must be no plugin currently
      * registered for {@code method}.
+     *
+     * @param argumentTypes the argument types of the method. Element 0 of this array must be the
+     *            {@link Class} value for {@link InvocationPlugin.Receiver} iff the method is
+     *            non-static. Upon returning, element 0 will have been rewritten to
+     *            {@code declaringClass}
      */
     public void register(InvocationPlugin plugin, Class<?> declaringClass, String name, Class<?>... argumentTypes) {
-        MethodKey<InvocationPlugin> methodInfo = plugins.put(plugin, declaringClass, name, argumentTypes);
+        boolean isStatic = argumentTypes.length == 0 || argumentTypes[0] != InvocationPlugin.Receiver.class;
+        if (!isStatic) {
+            argumentTypes[0] = declaringClass;
+        }
+        MethodKey<InvocationPlugin> methodInfo = plugins.put(plugin, isStatic, declaringClass, name, argumentTypes);
         assert Checker.check(this, methodInfo, plugin);
     }
 
@@ -260,7 +274,7 @@
                     Class<?>[] sig = method.getParameterTypes();
                     assert sig[0] == GraphBuilderContext.class;
                     assert sig[1] == ResolvedJavaMethod.class;
-                    assert sig[2] == Receiver.class;
+                    assert sig[2] == InvocationPlugin.Receiver.class;
                     assert Arrays.asList(Arrays.copyOfRange(sig, 3, sig.length)).stream().allMatch(c -> c == ValueNode.class);
                     while (sigs.size() < sig.length - 2) {
                         sigs.add(null);
@@ -287,7 +301,7 @@
                 msplugin.getJavaSubstitute();
                 return true;
             }
-            int arguments = method.isStatic ? method.argumentTypes.length : method.argumentTypes.length - 1;
+            int arguments = method.getDeclaredParameterCount();
             assert arguments < SIGS.length : format("need to extend %s to support method with %d arguments: %s", InvocationPlugin.class.getSimpleName(), arguments, method);
             for (Method m : plugin.getClass().getDeclaredMethods()) {
                 if (m.getName().equals("apply")) {
--- a/graal/com.oracle.graal.graphbuilderconf/src/com/oracle/graal/graphbuilderconf/LoadFieldPlugin.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.graphbuilderconf/src/com/oracle/graal/graphbuilderconf/LoadFieldPlugin.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,10 @@
  */
 package com.oracle.graal.graphbuilderconf;
 
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.meta.ConstantReflectionProvider;
+import com.oracle.jvmci.meta.JavaConstant;
+import com.oracle.jvmci.meta.MetaAccessProvider;
+import com.oracle.jvmci.meta.ResolvedJavaField;
 import com.oracle.graal.nodes.*;
 
 public interface LoadFieldPlugin extends GraphBuilderPlugin {
--- a/graal/com.oracle.graal.graphbuilderconf/src/com/oracle/graal/graphbuilderconf/LoadIndexedPlugin.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.graphbuilderconf/src/com/oracle/graal/graphbuilderconf/LoadIndexedPlugin.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,7 @@
  */
 package com.oracle.graal.graphbuilderconf;
 
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.meta.Kind;
 import com.oracle.graal.nodes.*;
 
 public interface LoadIndexedPlugin extends GraphBuilderPlugin {
--- a/graal/com.oracle.graal.graphbuilderconf/src/com/oracle/graal/graphbuilderconf/LoopExplosionPlugin.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.graphbuilderconf/src/com/oracle/graal/graphbuilderconf/LoopExplosionPlugin.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,7 @@
  */
 package com.oracle.graal.graphbuilderconf;
 
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
 
 public interface LoopExplosionPlugin extends GraphBuilderPlugin {
     boolean shouldExplodeLoops(ResolvedJavaMethod method);
--- a/graal/com.oracle.graal.graphbuilderconf/src/com/oracle/graal/graphbuilderconf/MethodIdHolder.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,96 +0,0 @@
-/*
- * Copyright (c) 2015, 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.graphbuilderconf;
-
-import java.util.*;
-import java.util.function.*;
-
-import com.oracle.graal.api.meta.*;
-
-/**
- * {@link ResolvedJavaMethod}s that can be assigned a globally unique identifier for use as keys in
- * a {@link MethodIdMap}. This should only be used where the cost of a {@link Map} with
- * {@link ResolvedJavaMethod}s as keys is too high.
- */
-public interface MethodIdHolder extends ResolvedJavaMethod {
-    /**
-     * Sets the unique, positive, non-zero identifier for this method.
-     */
-    void setMethodId(int id);
-
-    /**
-     * Gets the identifier set by {@link #setMethodId(int)} or 0 if no identifier was assigned to
-     * this method.
-     */
-    int getMethodId();
-
-    /**
-     * A singleton class for allocating globally unique method identifiers.
-     */
-    static final class MethodIdAllocator {
-
-        /**
-         * Ensures a given method has a unique identifier.
-         */
-        public int assignId(MethodIdHolder holder) {
-            assert Thread.holdsLock(instance) : "must only be called from within MethodIdHolder.allocateIds";
-            int id = holder.getMethodId();
-            if (id == 0) {
-                id = nextId++;
-                holder.setMethodId(id);
-                if (idVerifierMap != null) {
-                    idVerifierMap.put(holder, id);
-                }
-            } else {
-                assert !idVerifierMap.containsKey(holder) || idVerifierMap.get(holder) == id;
-            }
-            return id;
-        }
-
-        private int nextId = 1;
-        private final Map<MethodIdHolder, Integer> idVerifierMap;
-
-        @SuppressWarnings("all")
-        private MethodIdAllocator() {
-            boolean assertionsEnabled = false;
-            assert assertionsEnabled = true;
-            idVerifierMap = assertionsEnabled ? new HashMap<>() : null;
-        }
-
-        /**
-         * Singleton instance.
-         */
-        private static final MethodIdAllocator instance = new MethodIdAllocator();
-    }
-
-    /**
-     * Executes some given code that ensures some set of {@link ResolvedJavaMethod}s have unique ids
-     * {@linkplain MethodIdHolder#setMethodId(int) assigned} to them. The
-     * {@link Consumer#accept(Object)} method of the given object is called under a global lock.
-     */
-    static void assignIds(Consumer<MethodIdAllocator> methodIdConsumer) {
-        synchronized (MethodIdAllocator.instance) {
-            methodIdConsumer.accept(MethodIdAllocator.instance);
-        }
-    }
-}
--- a/graal/com.oracle.graal.graphbuilderconf/src/com/oracle/graal/graphbuilderconf/MethodIdMap.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,257 +0,0 @@
-/*
- * Copyright (c) 2015, 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.graphbuilderconf;
-
-import java.lang.reflect.*;
-import java.util.*;
-import java.util.function.*;
-import java.util.stream.*;
-
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.common.*;
-import com.oracle.graal.graphbuilderconf.MethodIdHolder.MethodIdAllocator;
-import com.oracle.graal.nodes.*;
-import com.oracle.graal.nodes.type.*;
-
-/**
- * A map whose keys are {@link MethodIdHolder}s that doesn't require eager resolution of
- * {@link ResolvedJavaMethod}s and has retrieval as fast as array indexing. The constraints on using
- * such a map are:
- * <ul>
- * <li>at most one value can be added for any key</li>
- * <li>no more entries can be added after the first {@linkplain #get(MethodIdHolder) retrieval}</li>
- * </ul>
- *
- * @param <V> the type of the values in the map
- */
-public class MethodIdMap<V> {
-
-    /**
-     * The receiver in a non-static method. The class literal for this interface must be used with
-     * {@link MethodIdMap#put(Object, Class, String, Class...)} to denote the receiver argument for
-     * such a non-static method.
-     */
-    public interface Receiver {
-        /**
-         * Gets the receiver value, null checking it first if necessary.
-         *
-         * @return the receiver value with a {@linkplain StampTool#isPointerNonNull(ValueNode)
-         *         non-null} stamp
-         */
-        ValueNode get();
-
-        /**
-         * Determines if the receiver is constant.
-         */
-        default boolean isConstant() {
-            return false;
-        }
-    }
-
-    /**
-     * Key for a method.
-     */
-    public static class MethodKey<T> {
-        final boolean isStatic;
-        final Class<?> declaringClass;
-        final String name;
-        final Class<?>[] argumentTypes;
-        final T value;
-        int id;
-
-        MethodKey(T data, Class<?> declaringClass, String name, Class<?>... argumentTypes) {
-            this.value = data;
-            this.isStatic = argumentTypes.length == 0 || argumentTypes[0] != Receiver.class;
-            this.declaringClass = declaringClass;
-            this.name = name;
-            this.argumentTypes = argumentTypes;
-            if (!isStatic) {
-                argumentTypes[0] = declaringClass;
-            }
-            assert resolveJava() != null;
-        }
-
-        @Override
-        public boolean equals(Object obj) {
-            if (obj instanceof MethodKey) {
-                MethodKey<?> that = (MethodKey<?>) obj;
-                boolean res = this.name.equals(that.name) && this.declaringClass.equals(that.declaringClass) && Arrays.equals(this.argumentTypes, that.argumentTypes);
-                assert !res || this.isStatic == that.isStatic;
-                return res;
-            }
-            return false;
-        }
-
-        @Override
-        public int hashCode() {
-            // Replay compilation mandates use of stable hash codes
-            return declaringClass.getName().hashCode() ^ name.hashCode();
-        }
-
-        private MethodIdHolder resolve(MetaAccessProvider metaAccess) {
-            return (MethodIdHolder) metaAccess.lookupJavaMethod(resolveJava());
-        }
-
-        private Executable resolveJava() {
-            try {
-                Executable res;
-                Class<?>[] parameterTypes = isStatic ? argumentTypes : Arrays.copyOfRange(argumentTypes, 1, argumentTypes.length);
-                if (name.equals("<init>")) {
-                    res = declaringClass.getDeclaredConstructor(parameterTypes);
-                } else {
-                    res = declaringClass.getDeclaredMethod(name, parameterTypes);
-                }
-                assert Modifier.isStatic(res.getModifiers()) == isStatic;
-                return res;
-            } catch (NoSuchMethodException | SecurityException e) {
-                throw new GraalInternalError(e);
-            }
-        }
-
-        @Override
-        public String toString() {
-            StringBuilder sb = new StringBuilder(declaringClass.getName()).append('.').append(name).append('(');
-            for (Class<?> p : argumentTypes) {
-                if (sb.charAt(sb.length() - 1) != '(') {
-                    sb.append(", ");
-                }
-                sb.append(p.getSimpleName());
-            }
-            return sb.append(')').toString();
-        }
-    }
-
-    private final MetaAccessProvider metaAccess;
-
-    /**
-     * Initial list of entries.
-     */
-    private final List<MethodKey<V>> registrations;
-
-    /**
-     * Entry array that is initialized upon first call to {@link #get(MethodIdHolder)}.
-     *
-     * Note: this must be volatile since double-checked locking is used to initialize it
-     */
-    private volatile V[] entries;
-
-    /**
-     * The minimum {@linkplain MethodIdHolder#getMethodId() id} for a key in this map.
-     */
-    private int minId = Integer.MAX_VALUE;
-
-    public MethodIdMap(MetaAccessProvider metaAccess) {
-        this.metaAccess = metaAccess;
-        this.registrations = new ArrayList<>(INITIAL_CAPACITY);
-    }
-
-    private static final int INITIAL_CAPACITY = 64;
-
-    /**
-     * Adds an entry to this map for a specified method.
-     *
-     * @param value value to be associated with the specified method
-     * @param declaringClass the class declaring the method
-     * @param name the name of the method
-     * @param argumentTypes the argument types of the method. Element 0 of this array must be the
-     *            {@link Class} value for {@link Receiver} iff the method is non-static.
-     * @return an object representing the method
-     */
-    public MethodKey<V> put(V value, Class<?> declaringClass, String name, Class<?>... argumentTypes) {
-        MethodKey<V> methodKey = new MethodKey<>(value, declaringClass, name, argumentTypes);
-        assert entries == null : "registration is closed";
-        assert !registrations.contains(methodKey) : "a value is already registered for " + methodKey;
-        registrations.add(methodKey);
-        return methodKey;
-    }
-
-    @SuppressWarnings("unchecked")
-    protected V[] allocateEntries(int length) {
-        return (V[]) new Object[length];
-    }
-
-    /**
-     * Determines if a method denoted by a given {@link MethodKey} is in this map.
-     */
-    public boolean containsKey(MethodKey<V> key) {
-        return registrations.contains(key);
-    }
-
-    public V get(MethodIdHolder method) {
-        if (entries == null) {
-            createEntries();
-        }
-
-        int id = method.getMethodId();
-        int index = id - minId;
-        return index >= 0 && index < entries.length ? entries[index] : null;
-    }
-
-    public void createEntries() {
-        // 'assignIds' synchronizes on a global lock which ensures thread safe
-        // allocation of identifiers across all MethodIdHolder objects
-        MethodIdHolder.assignIds(new Consumer<MethodIdAllocator>() {
-
-            public void accept(MethodIdAllocator idAllocator) {
-                if (entries == null) {
-                    if (registrations.isEmpty()) {
-                        entries = allocateEntries(0);
-                    } else {
-                        int max = Integer.MIN_VALUE;
-                        for (MethodKey<V> methodKey : registrations) {
-                            MethodIdHolder m = methodKey.resolve(metaAccess);
-                            int id = idAllocator.assignId(m);
-                            if (id < minId) {
-                                minId = id;
-                            }
-                            if (id > max) {
-                                max = id;
-                            }
-                            methodKey.id = id;
-                        }
-
-                        int length = (max - minId) + 1;
-                        entries = allocateEntries(length);
-                        for (MethodKey<V> m : registrations) {
-                            int index = m.id - minId;
-                            entries[index] = m.value;
-                        }
-                    }
-                }
-            }
-        });
-    }
-
-    @Override
-    public String toString() {
-        return registrations.stream().map(MethodKey::toString).collect(Collectors.joining(", "));
-    }
-
-    public MetaAccessProvider getMetaAccess() {
-        return metaAccess;
-    }
-
-    public int size() {
-        return registrations.size();
-    }
-}
--- a/graal/com.oracle.graal.graphbuilderconf/src/com/oracle/graal/graphbuilderconf/MethodSubstitutionPlugin.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.graphbuilderconf/src/com/oracle/graal/graphbuilderconf/MethodSubstitutionPlugin.java	Thu May 28 21:11:28 2015 -0700
@@ -22,16 +22,16 @@
  */
 package com.oracle.graal.graphbuilderconf;
 
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
+import com.oracle.jvmci.meta.MetaAccessProvider;
 import java.lang.reflect.*;
 import java.util.*;
 import java.util.stream.*;
 
 import sun.misc.*;
 
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.common.*;
-import com.oracle.graal.graphbuilderconf.MethodIdMap.Receiver;
 import com.oracle.graal.nodes.*;
+import com.oracle.jvmci.common.*;
 
 /**
  * An {@link InvocationPlugin} for a method where the implementation of the method is provided by a
@@ -66,13 +66,13 @@
      * @param name the name of the substitute method
      * @param parameters the parameter types of the substitute method. If the original method is not
      *            static, then {@code parameters[0]} must be the {@link Class} value denoting
-     *            {@link Receiver}
+     *            {@link InvocationPlugin.Receiver}
      */
     public MethodSubstitutionPlugin(Class<?> declaringClass, String name, Class<?>... parameters) {
         this.declaringClass = declaringClass;
         this.name = name;
         this.parameters = parameters;
-        this.originalIsStatic = parameters.length == 0 || parameters[0] != Receiver.class;
+        this.originalIsStatic = parameters.length == 0 || parameters[0] != InvocationPlugin.Receiver.class;
     }
 
     /**
@@ -107,14 +107,14 @@
     /**
      * Gets the reflection API version of the substitution method.
      */
-    Method getJavaSubstitute() throws GraalInternalError {
+    Method getJavaSubstitute() throws JVMCIError {
         Method substituteMethod = lookupSubstitute();
         int modifiers = substituteMethod.getModifiers();
         if (Modifier.isAbstract(modifiers) || Modifier.isNative(modifiers)) {
-            throw new GraalInternalError("Substitution method must not be abstract or native: " + substituteMethod);
+            throw new JVMCIError("Substitution method must not be abstract or native: " + substituteMethod);
         }
         if (!Modifier.isStatic(modifiers)) {
-            throw new GraalInternalError("Substitution method must be static: " + substituteMethod);
+            throw new JVMCIError("Substitution method must be static: " + substituteMethod);
         }
         return substituteMethod;
     }
@@ -153,7 +153,7 @@
                 return m;
             }
         }
-        throw new GraalInternalError("No method found specified by %s", this);
+        throw new JVMCIError("No method found specified by %s", this);
     }
 
     /**
@@ -173,12 +173,12 @@
             if (optional) {
                 return null;
             }
-            throw new GraalInternalError("Could not resolve type " + className);
+            throw new JVMCIError("Could not resolve type " + className);
         }
     }
 
     @Override
-    public boolean execute(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode[] argsIncludingReceiver) {
+    public boolean execute(GraphBuilderContext b, ResolvedJavaMethod targetMethod, InvocationPlugin.Receiver receiver, ValueNode[] argsIncludingReceiver) {
         ResolvedJavaMethod subst = getSubstitute(b.getMetaAccess());
         if (receiver != null) {
             receiver.get();
@@ -194,7 +194,7 @@
                 return metaAccess.lookupJavaMethod(m).asStackTraceElement(0);
             }
         }
-        throw new GraalInternalError("could not find method named \"execute\" in " + c.getName());
+        throw new JVMCIError("could not find method named \"execute\" in " + c.getName());
     }
 
     @Override
--- a/graal/com.oracle.graal.graphbuilderconf/src/com/oracle/graal/graphbuilderconf/TypeCheckPlugin.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.graphbuilderconf/src/com/oracle/graal/graphbuilderconf/TypeCheckPlugin.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,8 @@
  */
 package com.oracle.graal.graphbuilderconf;
 
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.meta.ResolvedJavaType;
+import com.oracle.jvmci.meta.JavaTypeProfile;
 import com.oracle.graal.nodes.*;
 
 public interface TypeCheckPlugin extends GraphBuilderPlugin {
--- a/graal/com.oracle.graal.hotspot.amd64.test/src/com/oracle/graal/hotspot/amd64/test/AMD64HotSpotFrameOmissionTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.amd64.test/src/com/oracle/graal/hotspot/amd64/test/AMD64HotSpotFrameOmissionTest.java	Thu May 28 21:11:28 2015 -0700
@@ -22,14 +22,19 @@
  */
 package com.oracle.graal.hotspot.amd64.test;
 
+import com.oracle.jvmci.code.InstalledCode;
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.code.CallingConvention;
+import com.oracle.jvmci.code.RegisterConfig;
+import com.oracle.jvmci.code.TargetDescription;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
+import com.oracle.jvmci.meta.Kind;
 import static com.oracle.graal.amd64.AMD64.*;
 
 import java.util.*;
 
 import org.junit.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.asm.amd64.*;
 import com.oracle.graal.compiler.test.*;
 
--- a/graal/com.oracle.graal.hotspot.amd64.test/src/com/oracle/graal/hotspot/amd64/test/CompressedNullCheckTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.amd64.test/src/com/oracle/graal/hotspot/amd64/test/CompressedNullCheckTest.java	Thu May 28 21:11:28 2015 -0700
@@ -22,17 +22,17 @@
  */
 package com.oracle.graal.hotspot.amd64.test;
 
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
 import org.junit.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.test.*;
 import com.oracle.graal.hotspot.*;
 import com.oracle.graal.hotspot.nodes.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.calc.*;
-import com.oracle.graal.options.*;
-import com.oracle.graal.options.OptionValue.OverrideScope;
+import com.oracle.jvmci.options.*;
+import com.oracle.jvmci.options.OptionValue.OverrideScope;
 
 /**
  * Ensures that frame omission works in cases where it is expected to.
--- a/graal/com.oracle.graal.hotspot.amd64.test/src/com/oracle/graal/hotspot/amd64/test/DataPatchInConstantsTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.amd64.test/src/com/oracle/graal/hotspot/amd64/test/DataPatchInConstantsTest.java	Thu May 28 21:11:28 2015 -0700
@@ -23,13 +23,14 @@
 
 package com.oracle.graal.hotspot.amd64.test;
 
-import static com.oracle.graal.api.code.ValueUtil.*;
+import com.oracle.jvmci.meta.AllocatableValue;
+import com.oracle.jvmci.meta.Constant;
+import static com.oracle.jvmci.code.ValueUtil.*;
 import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*;
 
 import org.junit.*;
 
 import com.oracle.graal.amd64.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.api.replacements.*;
 import com.oracle.graal.asm.amd64.*;
 import com.oracle.graal.graph.*;
@@ -44,6 +45,7 @@
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.hotspot.*;
 
 public class DataPatchInConstantsTest extends HotSpotGraalCompilerTest {
 
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64DeoptimizationStub.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64DeoptimizationStub.java	Thu May 28 21:11:28 2015 -0700
@@ -22,12 +22,15 @@
  */
 package com.oracle.graal.hotspot.amd64;
 
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.code.RegisterConfig;
+import com.oracle.jvmci.code.TargetDescription;
 import static com.oracle.graal.amd64.AMD64.*;
 
-import com.oracle.graal.api.code.*;
 import com.oracle.graal.hotspot.*;
 import com.oracle.graal.hotspot.meta.*;
 import com.oracle.graal.hotspot.stubs.*;
+import com.oracle.jvmci.hotspot.*;
 
 final class AMD64DeoptimizationStub extends DeoptimizationStub {
 
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotBackend.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotBackend.java	Thu May 28 21:11:28 2015 -0700
@@ -22,17 +22,23 @@
  */
 package com.oracle.graal.hotspot.amd64;
 
+import com.oracle.jvmci.code.CompilationResult;
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.code.RegisterConfig;
+import com.oracle.jvmci.code.CallingConvention;
+import com.oracle.jvmci.code.StackSlot;
+import com.oracle.jvmci.code.CalleeSaveLayout;
+import com.oracle.jvmci.meta.JavaType;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
 import static com.oracle.graal.amd64.AMD64.*;
-import static com.oracle.graal.api.code.CallingConvention.Type.*;
-import static com.oracle.graal.api.code.ValueUtil.*;
+import static com.oracle.jvmci.code.CallingConvention.Type.*;
+import static com.oracle.jvmci.code.ValueUtil.*;
 import static com.oracle.graal.compiler.common.GraalOptions.*;
-import static com.oracle.graal.compiler.common.UnsafeAccess.*;
+import static com.oracle.jvmci.common.UnsafeAccess.*;
 
 import java.util.*;
 
 import com.oracle.graal.amd64.*;
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.asm.*;
 import com.oracle.graal.asm.amd64.*;
 import com.oracle.graal.asm.amd64.AMD64Assembler.ConditionFlag;
@@ -49,6 +55,7 @@
 import com.oracle.graal.lir.gen.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.hotspot.*;
 
 /**
  * HotSpot AMD64 specific backend.
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotBackendFactory.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotBackendFactory.java	Thu May 28 21:11:28 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,108 +22,40 @@
  */
 package com.oracle.graal.hotspot.amd64;
 
-import static com.oracle.graal.hotspot.InitTimer.*;
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.code.RegisterConfig;
+import com.oracle.jvmci.code.TargetDescription;
+import com.oracle.jvmci.meta.Value;
+import static com.oracle.jvmci.hotspot.InitTimer.*;
 
 import java.util.*;
 
 import com.oracle.graal.amd64.*;
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.api.replacements.*;
-import com.oracle.graal.api.runtime.*;
 import com.oracle.graal.graphbuilderconf.GraphBuilderConfiguration.Plugins;
 import com.oracle.graal.hotspot.*;
 import com.oracle.graal.hotspot.meta.*;
 import com.oracle.graal.hotspot.word.*;
 import com.oracle.graal.phases.util.*;
 import com.oracle.graal.replacements.amd64.*;
+import com.oracle.jvmci.hotspot.*;
+import com.oracle.jvmci.runtime.*;
 
 @ServiceProvider(HotSpotBackendFactory.class)
 public class AMD64HotSpotBackendFactory implements HotSpotBackendFactory {
 
-    protected Architecture createArchitecture(HotSpotVMConfig config) {
-        return new AMD64(computeFeatures(config), computeFlags(config));
-    }
-
-    protected EnumSet<AMD64.CPUFeature> computeFeatures(HotSpotVMConfig config) {
-        // Configure the feature set using the HotSpot flag settings.
-        EnumSet<AMD64.CPUFeature> features = EnumSet.noneOf(AMD64.CPUFeature.class);
-        assert config.useSSE >= 2 : "minimum config for x64";
-        features.add(AMD64.CPUFeature.SSE);
-        features.add(AMD64.CPUFeature.SSE2);
-        if ((config.x86CPUFeatures & config.cpuSSE3) != 0) {
-            features.add(AMD64.CPUFeature.SSE3);
-        }
-        if ((config.x86CPUFeatures & config.cpuSSSE3) != 0) {
-            features.add(AMD64.CPUFeature.SSSE3);
-        }
-        if ((config.x86CPUFeatures & config.cpuSSE4A) != 0) {
-            features.add(AMD64.CPUFeature.SSE4a);
-        }
-        if ((config.x86CPUFeatures & config.cpuSSE41) != 0) {
-            features.add(AMD64.CPUFeature.SSE4_1);
-        }
-        if ((config.x86CPUFeatures & config.cpuSSE42) != 0) {
-            features.add(AMD64.CPUFeature.SSE4_2);
-        }
-        if ((config.x86CPUFeatures & config.cpuAVX) != 0) {
-            features.add(AMD64.CPUFeature.AVX);
-        }
-        if ((config.x86CPUFeatures & config.cpuAVX2) != 0) {
-            features.add(AMD64.CPUFeature.AVX2);
-        }
-        if ((config.x86CPUFeatures & config.cpuERMS) != 0) {
-            features.add(AMD64.CPUFeature.ERMS);
-        }
-        if ((config.x86CPUFeatures & config.cpuLZCNT) != 0) {
-            features.add(AMD64.CPUFeature.LZCNT);
-        }
-        if ((config.x86CPUFeatures & config.cpuPOPCNT) != 0) {
-            features.add(AMD64.CPUFeature.POPCNT);
-        }
-        if ((config.x86CPUFeatures & config.cpuAES) != 0) {
-            features.add(AMD64.CPUFeature.AES);
-        }
-        if ((config.x86CPUFeatures & config.cpu3DNOWPREFETCH) != 0) {
-            features.add(AMD64.CPUFeature.AMD_3DNOW_PREFETCH);
-        }
-        if ((config.x86CPUFeatures & config.cpuBMI1) != 0) {
-            features.add(AMD64.CPUFeature.BMI1);
-        }
-        return features;
-    }
-
-    protected EnumSet<AMD64.Flag> computeFlags(HotSpotVMConfig config) {
-        EnumSet<AMD64.Flag> flags = EnumSet.noneOf(AMD64.Flag.class);
-        if (config.useCountLeadingZerosInstruction) {
-            flags.add(AMD64.Flag.UseCountLeadingZerosInstruction);
-        }
-        if (config.useCountTrailingZerosInstruction) {
-            flags.add(AMD64.Flag.UseCountTrailingZerosInstruction);
-        }
-        return flags;
-    }
-
-    protected TargetDescription createTarget(HotSpotVMConfig config) {
-        final int stackFrameAlignment = 16;
-        final int implicitNullCheckLimit = 4096;
-        final boolean inlineObjects = true;
-        return new HotSpotTargetDescription(createArchitecture(config), true, stackFrameAlignment, implicitNullCheckLimit, inlineObjects);
-    }
-
     @Override
-    public HotSpotBackend createBackend(HotSpotGraalRuntimeProvider runtime, HotSpotBackend host) {
+    public HotSpotBackend createBackend(HotSpotGraalRuntimeProvider runtime, JVMCIBackend jvmci, HotSpotBackend host) {
         assert host == null;
-        TargetDescription target = createTarget(runtime.getConfig());
 
         HotSpotProviders providers;
         HotSpotRegistersProvider registers;
-        RegisterConfig regConfig;
-        HotSpotCodeCacheProvider codeCache;
-        HotSpotConstantReflectionProvider constantReflection;
+        HotSpotCodeCacheProvider codeCache = (HotSpotCodeCacheProvider) jvmci.getCodeCache();
+        TargetDescription target = codeCache.getTarget();
+        HotSpotConstantReflectionProvider constantReflection = new HotSpotGraalConstantReflectionProvider(runtime.getJVMCIRuntime());
         HotSpotHostForeignCallsProvider foreignCalls;
         Value[] nativeABICallerSaveRegisters;
-        HotSpotMetaAccessProvider metaAccess;
+        HotSpotMetaAccessProvider metaAccess = (HotSpotMetaAccessProvider) jvmci.getMetaAccess();
         HotSpotLoweringProvider lowerer;
         HotSpotSnippetReflectionProvider snippetReflection;
         HotSpotReplacementsImpl replacements;
@@ -135,18 +67,6 @@
             try (InitTimer rt = timer("create HotSpotRegisters provider")) {
                 registers = createRegisters();
             }
-            try (InitTimer rt = timer("create MetaAccess provider")) {
-                metaAccess = createMetaAccess(runtime);
-            }
-            try (InitTimer rt = timer("create RegisterConfig")) {
-                regConfig = createRegisterConfig(runtime, target);
-            }
-            try (InitTimer rt = timer("create CodeCache provider")) {
-                codeCache = createCodeCache(runtime, target, regConfig);
-            }
-            try (InitTimer rt = timer("create ConstantReflection provider")) {
-                constantReflection = createConstantReflection(runtime);
-            }
             try (InitTimer rt = timer("create NativeABICallerSaveRegisters")) {
                 nativeABICallerSaveRegisters = createNativeABICallerSaveRegisters(runtime.getConfig(), codeCache.getRegisterConfig());
             }
@@ -214,22 +134,6 @@
         return new AMD64HotSpotForeignCallsProvider(runtime, metaAccess, codeCache, nativeABICallerSaveRegisters);
     }
 
-    protected HotSpotConstantReflectionProvider createConstantReflection(HotSpotGraalRuntimeProvider runtime) {
-        return new HotSpotConstantReflectionProvider(runtime);
-    }
-
-    protected RegisterConfig createRegisterConfig(HotSpotGraalRuntimeProvider runtime, TargetDescription target) {
-        return new AMD64HotSpotRegisterConfig(target.arch, runtime.getConfig());
-    }
-
-    protected HotSpotCodeCacheProvider createCodeCache(HotSpotGraalRuntimeProvider runtime, TargetDescription target, RegisterConfig regConfig) {
-        return new HotSpotCodeCacheProvider(runtime, runtime.getConfig(), target, regConfig);
-    }
-
-    protected HotSpotMetaAccessProvider createMetaAccess(HotSpotGraalRuntimeProvider runtime) {
-        return new HotSpotMetaAccessProvider(runtime);
-    }
-
     protected HotSpotSuitesProvider createSuites(HotSpotGraalRuntimeProvider runtime, Plugins plugins) {
         return new HotSpotSuitesProvider(runtime, plugins);
     }
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotBinaryConsumer.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotBinaryConsumer.java	Thu May 28 21:11:28 2015 -0700
@@ -22,15 +22,15 @@
  */
 package com.oracle.graal.hotspot.amd64;
 
+import com.oracle.jvmci.meta.AllocatableValue;
 import static com.oracle.graal.asm.amd64.AMD64Assembler.OperandSize.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.asm.amd64.AMD64Assembler.AMD64MIOp;
 import com.oracle.graal.asm.amd64.*;
-import com.oracle.graal.hotspot.meta.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.amd64.*;
 import com.oracle.graal.lir.asm.*;
+import com.oracle.jvmci.hotspot.*;
 
 public class AMD64HotSpotBinaryConsumer {
 
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotBytecodeLIRBuilder.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotBytecodeLIRBuilder.java	Thu May 28 21:11:28 2015 -0700
@@ -22,15 +22,24 @@
  */
 package com.oracle.graal.hotspot.amd64;
 
+import com.oracle.jvmci.code.CallingConvention;
+import com.oracle.jvmci.code.StackSlot;
+import com.oracle.jvmci.code.ValueUtil;
+import com.oracle.jvmci.meta.ResolvedJavaField;
+import com.oracle.jvmci.meta.ResolvedJavaType;
+import com.oracle.jvmci.meta.Value;
+import com.oracle.jvmci.meta.LIRKind;
+import com.oracle.jvmci.meta.JavaConstant;
+import com.oracle.jvmci.meta.Signature;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
+import com.oracle.jvmci.meta.Kind;
 import static com.oracle.graal.amd64.AMD64.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.gen.*;
 import com.oracle.graal.hotspot.amd64.AMD64HotSpotLIRGenerator.SaveRbp;
-import com.oracle.graal.hotspot.meta.*;
 import com.oracle.graal.lir.StandardOp.NoOp;
 import com.oracle.graal.lir.gen.*;
+import com.oracle.jvmci.hotspot.*;
 
 public class AMD64HotSpotBytecodeLIRBuilder extends BytecodeLIRBuilder {
 
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotCRuntimeCallEpilogueOp.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotCRuntimeCallEpilogueOp.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,7 @@
  */
 package com.oracle.graal.hotspot.amd64;
 
-import com.oracle.graal.api.code.*;
+import com.oracle.jvmci.code.Register;
 import com.oracle.graal.asm.amd64.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.amd64.*;
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotCRuntimeCallPrologueOp.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotCRuntimeCallPrologueOp.java	Thu May 28 21:11:28 2015 -0700
@@ -22,9 +22,9 @@
  */
 package com.oracle.graal.hotspot.amd64;
 
+import com.oracle.jvmci.code.Register;
 import static com.oracle.graal.amd64.AMD64.*;
 
-import com.oracle.graal.api.code.*;
 import com.oracle.graal.asm.amd64.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.amd64.*;
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotCardTableAddressOp.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotCardTableAddressOp.java	Thu May 28 21:11:28 2015 -0700
@@ -22,13 +22,16 @@
  */
 package com.oracle.graal.hotspot.amd64;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.code.ValueUtil;
+import com.oracle.jvmci.meta.JavaConstant;
+import com.oracle.jvmci.meta.AllocatableValue;
+import com.oracle.jvmci.meta.Kind;
 import com.oracle.graal.asm.amd64.*;
 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.jvmci.hotspot.*;
 
 public final class AMD64HotSpotCardTableAddressOp extends AMD64LIRInstruction {
     public static final LIRInstructionClass<AMD64HotSpotCardTableAddressOp> TYPE = LIRInstructionClass.create(AMD64HotSpotCardTableAddressOp.class);
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotCardTableShiftOp.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotCardTableShiftOp.java	Thu May 28 21:11:28 2015 -0700
@@ -22,13 +22,16 @@
  */
 package com.oracle.graal.hotspot.amd64;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.code.ValueUtil;
+import com.oracle.jvmci.meta.JavaConstant;
+import com.oracle.jvmci.meta.AllocatableValue;
+import com.oracle.jvmci.meta.Kind;
 import com.oracle.graal.asm.amd64.*;
 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.jvmci.hotspot.*;
 
 public final class AMD64HotSpotCardTableShiftOp extends AMD64LIRInstruction {
     public static final LIRInstructionClass<AMD64HotSpotCardTableShiftOp> TYPE = LIRInstructionClass.create(AMD64HotSpotCardTableShiftOp.class);
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotCounterOp.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotCounterOp.java	Thu May 28 21:11:28 2015 -0700
@@ -22,17 +22,20 @@
  */
 package com.oracle.graal.hotspot.amd64;
 
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.code.TargetDescription;
+import com.oracle.jvmci.code.StackSlotValue;
+import com.oracle.jvmci.meta.Value;
 import static com.oracle.graal.amd64.AMD64.*;
-import static com.oracle.graal.api.code.ValueUtil.*;
-import static com.oracle.graal.compiler.common.GraalInternalError.*;
+import static com.oracle.jvmci.code.ValueUtil.*;
+import static com.oracle.jvmci.common.JVMCIError.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.asm.amd64.*;
 import com.oracle.graal.hotspot.*;
 import com.oracle.graal.hotspot.meta.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.asm.*;
+import com.oracle.jvmci.hotspot.*;
 
 @Opcode("BenchMarkCounter")
 public class AMD64HotSpotCounterOp extends HotSpotCounterOp {
@@ -70,7 +73,7 @@
         }
 
         // address for counters array
-        AMD64Address countersArrayAddr = new AMD64Address(thread, config.graalCountersThreadOffset);
+        AMD64Address countersArrayAddr = new AMD64Address(thread, config.jvmciCountersThreadOffset);
         Register countersArrayReg = scratch;
 
         // backup scratch register
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotEnterUnpackFramesStackFrameOp.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotEnterUnpackFramesStackFrameOp.java	Thu May 28 21:11:28 2015 -0700
@@ -22,12 +22,15 @@
  */
 package com.oracle.graal.hotspot.amd64;
 
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.code.RegisterConfig;
+import com.oracle.jvmci.code.RegisterSaveLayout;
+import com.oracle.jvmci.meta.AllocatableValue;
+import com.oracle.jvmci.meta.Kind;
 import static com.oracle.graal.amd64.AMD64.*;
-import static com.oracle.graal.api.code.ValueUtil.*;
+import static com.oracle.jvmci.code.ValueUtil.*;
 import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.asm.amd64.*;
 import com.oracle.graal.hotspot.*;
 import com.oracle.graal.lir.*;
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotEpilogueOp.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotEpilogueOp.java	Thu May 28 21:11:28 2015 -0700
@@ -22,12 +22,14 @@
  */
 package com.oracle.graal.hotspot.amd64;
 
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.meta.LIRKind;
+import com.oracle.jvmci.meta.AllocatableValue;
+import com.oracle.jvmci.meta.Kind;
 import static com.oracle.graal.amd64.AMD64.*;
-import static com.oracle.graal.api.code.ValueUtil.*;
+import static com.oracle.jvmci.code.ValueUtil.*;
 import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.asm.amd64.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.amd64.*;
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotForeignCallsProvider.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotForeignCallsProvider.java	Thu May 28 21:11:28 2015 -0700
@@ -22,10 +22,18 @@
  */
 package com.oracle.graal.hotspot.amd64;
 
+import com.oracle.jvmci.code.RegisterValue;
+import com.oracle.jvmci.code.TargetDescription;
+import com.oracle.jvmci.code.CallingConvention;
+import com.oracle.jvmci.code.CodeCacheProvider;
+import com.oracle.jvmci.meta.Value;
+import com.oracle.jvmci.meta.LIRKind;
+import com.oracle.jvmci.meta.MetaAccessProvider;
+import com.oracle.jvmci.meta.Kind;
 import static com.oracle.graal.amd64.AMD64.*;
-import static com.oracle.graal.api.code.CallingConvention.Type.*;
-import static com.oracle.graal.api.meta.LocationIdentity.*;
-import static com.oracle.graal.api.meta.Value.*;
+import static com.oracle.jvmci.code.CallingConvention.Type.*;
+import static com.oracle.jvmci.meta.LocationIdentity.*;
+import static com.oracle.jvmci.meta.Value.*;
 import static com.oracle.graal.hotspot.HotSpotBackend.*;
 import static com.oracle.graal.hotspot.HotSpotBackend.Options.*;
 import static com.oracle.graal.hotspot.HotSpotForeignCallLinkage.*;
@@ -34,10 +42,9 @@
 import static com.oracle.graal.hotspot.HotSpotHostBackend.*;
 import static com.oracle.graal.hotspot.replacements.CRC32Substitutions.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.hotspot.*;
 import com.oracle.graal.hotspot.meta.*;
+import com.oracle.jvmci.hotspot.*;
 
 public class AMD64HotSpotForeignCallsProvider extends HotSpotHostForeignCallsProvider {
 
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotJumpToExceptionHandlerInCallerOp.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotJumpToExceptionHandlerInCallerOp.java	Thu May 28 21:11:28 2015 -0700
@@ -22,12 +22,12 @@
  */
 package com.oracle.graal.hotspot.amd64;
 
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.meta.AllocatableValue;
 import static com.oracle.graal.amd64.AMD64.*;
-import static com.oracle.graal.api.code.ValueUtil.*;
+import static com.oracle.jvmci.code.ValueUtil.*;
 import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.asm.amd64.*;
 import com.oracle.graal.asm.amd64.AMD64Assembler.ConditionFlag;
 import com.oracle.graal.lir.*;
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotLIRGenerationResult.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotLIRGenerationResult.java	Thu May 28 21:11:28 2015 -0700
@@ -22,9 +22,9 @@
  */
 package com.oracle.graal.hotspot.amd64;
 
+import com.oracle.jvmci.code.StackSlot;
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
 import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.hotspot.stubs.*;
 import com.oracle.graal.lir.*;
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotLIRGenerator.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotLIRGenerator.java	Thu May 28 21:11:28 2015 -0700
@@ -22,6 +22,23 @@
  */
 package com.oracle.graal.hotspot.amd64;
 
+import com.oracle.jvmci.code.RegisterValue;
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.code.RegisterConfig;
+import com.oracle.jvmci.code.ForeignCallLinkage;
+import com.oracle.jvmci.code.CallingConvention;
+import com.oracle.jvmci.code.VirtualStackSlot;
+import com.oracle.jvmci.code.StackSlotValue;
+import com.oracle.jvmci.code.StackSlot;
+import com.oracle.jvmci.meta.Value;
+import com.oracle.jvmci.meta.LIRKind;
+import com.oracle.jvmci.meta.JavaConstant;
+import com.oracle.jvmci.meta.DeoptimizationAction;
+import com.oracle.jvmci.meta.PlatformKind;
+import com.oracle.jvmci.meta.DeoptimizationReason;
+import com.oracle.jvmci.meta.PrimitiveConstant;
+import com.oracle.jvmci.meta.AllocatableValue;
+import com.oracle.jvmci.meta.Kind;
 import static com.oracle.graal.amd64.AMD64.*;
 import static com.oracle.graal.asm.amd64.AMD64Assembler.AMD64BinaryArithmetic.*;
 import static com.oracle.graal.asm.amd64.AMD64Assembler.AMD64RMOp.*;
@@ -31,16 +48,12 @@
 import java.util.*;
 
 import com.oracle.graal.amd64.*;
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.asm.amd64.AMD64Assembler.AMD64MIOp;
 import com.oracle.graal.asm.amd64.AMD64Assembler.OperandSize;
 import com.oracle.graal.compiler.amd64.*;
 import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.spi.*;
-import com.oracle.graal.debug.*;
 import com.oracle.graal.hotspot.*;
-import com.oracle.graal.hotspot.HotSpotVMConfig.CompressEncoding;
 import com.oracle.graal.hotspot.debug.*;
 import com.oracle.graal.hotspot.meta.*;
 import com.oracle.graal.hotspot.stubs.*;
@@ -53,6 +66,10 @@
 import com.oracle.graal.lir.asm.*;
 import com.oracle.graal.lir.framemap.*;
 import com.oracle.graal.lir.gen.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.hotspot.*;
+import com.oracle.jvmci.hotspot.HotSpotVMConfig.CompressEncoding;
 
 /**
  * LIR generator specialized for AMD64 HotSpot.
@@ -191,7 +208,7 @@
                 return r;
             }
         }
-        throw GraalInternalError.shouldNotReachHere();
+        throw JVMCIError.shouldNotReachHere();
     }
 
     private Register pollOnReturnScratchRegister;
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotLeaveCurrentStackFrameOp.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotLeaveCurrentStackFrameOp.java	Thu May 28 21:11:28 2015 -0700
@@ -22,10 +22,12 @@
  */
 package com.oracle.graal.hotspot.amd64;
 
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.code.RegisterConfig;
+import com.oracle.jvmci.code.RegisterSaveLayout;
+import com.oracle.jvmci.meta.Kind;
 import static com.oracle.graal.amd64.AMD64.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.asm.amd64.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.StandardOp.SaveRegistersOp;
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotLeaveDeoptimizedStackFrameOp.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotLeaveDeoptimizedStackFrameOp.java	Thu May 28 21:11:28 2015 -0700
@@ -22,12 +22,12 @@
  */
 package com.oracle.graal.hotspot.amd64;
 
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.meta.AllocatableValue;
 import static com.oracle.graal.amd64.AMD64.*;
-import static com.oracle.graal.api.code.ValueUtil.*;
+import static com.oracle.jvmci.code.ValueUtil.*;
 import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.asm.amd64.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.asm.*;
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotLeaveUnpackFramesStackFrameOp.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotLeaveUnpackFramesStackFrameOp.java	Thu May 28 21:11:28 2015 -0700
@@ -22,8 +22,10 @@
  */
 package com.oracle.graal.hotspot.amd64;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.code.RegisterConfig;
+import com.oracle.jvmci.code.RegisterSaveLayout;
+import com.oracle.jvmci.meta.Kind;
 import com.oracle.graal.asm.amd64.*;
 import com.oracle.graal.hotspot.*;
 import com.oracle.graal.lir.*;
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotLoweringProvider.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotLoweringProvider.java	Thu May 28 21:11:28 2015 -0700
@@ -22,14 +22,16 @@
  */
 package com.oracle.graal.hotspot.amd64;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.code.TargetDescription;
+import com.oracle.jvmci.code.ForeignCallsProvider;
+import com.oracle.jvmci.meta.MetaAccessProvider;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.hotspot.*;
 import com.oracle.graal.hotspot.meta.*;
 import com.oracle.graal.nodes.calc.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.replacements.amd64.*;
+import com.oracle.jvmci.hotspot.*;
 
 public class AMD64HotSpotLoweringProvider extends DefaultHotSpotLoweringProvider {
 
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotMove.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotMove.java	Thu May 28 21:11:28 2015 -0700
@@ -22,22 +22,26 @@
  */
 package com.oracle.graal.hotspot.amd64;
 
-import static com.oracle.graal.api.code.ValueUtil.*;
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.meta.Value;
+import com.oracle.jvmci.meta.JavaConstant;
+import com.oracle.jvmci.meta.AllocatableValue;
+import com.oracle.jvmci.meta.Kind;
+import static com.oracle.jvmci.code.ValueUtil.*;
 import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.asm.*;
 import com.oracle.graal.asm.amd64.*;
 import com.oracle.graal.asm.amd64.AMD64Assembler.ConditionFlag;
 import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.hotspot.*;
-import com.oracle.graal.hotspot.HotSpotVMConfig.CompressEncoding;
-import com.oracle.graal.hotspot.meta.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.StandardOp.MoveOp;
 import com.oracle.graal.lir.amd64.*;
 import com.oracle.graal.lir.asm.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.hotspot.*;
+import com.oracle.jvmci.hotspot.HotSpotVMConfig.CompressEncoding;
 
 public class AMD64HotSpotMove {
 
@@ -77,7 +81,7 @@
                         if (compressed) {
                             masm.movl((AMD64Address) crb.asAddress(result), 0xDEADDEAD);
                         } else {
-                            throw GraalInternalError.shouldNotReachHere("Cannot store 64-bit constants to memory");
+                            throw JVMCIError.shouldNotReachHere("Cannot store 64-bit constants to memory");
                         }
                     }
                 } else {
@@ -89,7 +93,7 @@
                             masm.movq(asRegister(result), address);
                         }
                     } else {
-                        throw GraalInternalError.shouldNotReachHere("Cannot directly store data patch to memory");
+                        throw JVMCIError.shouldNotReachHere("Cannot directly store data patch to memory");
                     }
                 }
             } else if (input instanceof HotSpotMetaspaceConstant) {
@@ -122,12 +126,12 @@
                     assert isStackSlot(result);
                     if (compressed) {
                         if (isImmutable && generatePIC) {
-                            throw GraalInternalError.shouldNotReachHere("Unsupported operation offset(%rip) -> mem (mem -> mem)");
+                            throw JVMCIError.shouldNotReachHere("Unsupported operation offset(%rip) -> mem (mem -> mem)");
                         } else {
                             masm.movl((AMD64Address) crb.asAddress(result), input.asInt());
                         }
                     } else {
-                        throw GraalInternalError.shouldNotReachHere("Cannot store 64-bit constants to memory");
+                        throw JVMCIError.shouldNotReachHere("Cannot store 64-bit constants to memory");
                     }
                 }
             } else {
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotNodeLIRBuilder.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotNodeLIRBuilder.java	Thu May 28 21:11:28 2015 -0700
@@ -22,26 +22,36 @@
  */
 package com.oracle.graal.hotspot.amd64;
 
+import com.oracle.jvmci.code.RegisterValue;
+import com.oracle.jvmci.code.BytecodeFrame;
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.code.ForeignCallLinkage;
+import com.oracle.jvmci.code.CallingConvention;
+import com.oracle.jvmci.code.StackSlot;
+import com.oracle.jvmci.code.ValueUtil;
+import com.oracle.jvmci.meta.Value;
+import com.oracle.jvmci.meta.LIRKind;
+import com.oracle.jvmci.meta.PlatformKind;
+import com.oracle.jvmci.meta.AllocatableValue;
+import com.oracle.jvmci.meta.Kind;
 import static com.oracle.graal.amd64.AMD64.*;
-import static com.oracle.graal.api.code.ValueUtil.*;
+import static com.oracle.jvmci.code.ValueUtil.*;
 import static com.oracle.graal.asm.amd64.AMD64Assembler.AMD64BinaryArithmetic.*;
 import static com.oracle.graal.hotspot.HotSpotBackend.*;
 
 import com.oracle.graal.amd64.*;
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.asm.*;
-import com.oracle.graal.asm.amd64.AMD64Assembler.*;
+import com.oracle.graal.asm.amd64.AMD64Assembler.AMD64RMOp;
+import com.oracle.graal.asm.amd64.AMD64Assembler.OperandSize;
+import com.oracle.graal.asm.amd64.AMD64Assembler.SSEOp;
 import com.oracle.graal.compiler.amd64.*;
 import com.oracle.graal.compiler.common.calc.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.compiler.gen.*;
 import com.oracle.graal.compiler.match.*;
-import com.oracle.graal.debug.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.hotspot.*;
 import com.oracle.graal.hotspot.amd64.AMD64HotSpotLIRGenerator.SaveRbp;
-import com.oracle.graal.hotspot.meta.*;
 import com.oracle.graal.hotspot.nodes.*;
 import com.oracle.graal.hotspot.nodes.type.*;
 import com.oracle.graal.lir.*;
@@ -54,6 +64,8 @@
 import com.oracle.graal.nodes.calc.*;
 import com.oracle.graal.nodes.extended.*;
 import com.oracle.graal.nodes.memory.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.hotspot.*;
 
 /**
  * LIR generator specialized for AMD64 HotSpot.
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotPatchReturnAddressOp.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotPatchReturnAddressOp.java	Thu May 28 21:11:28 2015 -0700
@@ -22,11 +22,11 @@
  */
 package com.oracle.graal.hotspot.amd64;
 
+import com.oracle.jvmci.meta.AllocatableValue;
 import static com.oracle.graal.amd64.AMD64.*;
-import static com.oracle.graal.api.code.ValueUtil.*;
+import static com.oracle.jvmci.code.ValueUtil.*;
 import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.asm.amd64.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.amd64.*;
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotPushInterpreterFrameOp.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotPushInterpreterFrameOp.java	Thu May 28 21:11:28 2015 -0700
@@ -22,17 +22,17 @@
  */
 package com.oracle.graal.hotspot.amd64;
 
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.meta.AllocatableValue;
 import static com.oracle.graal.amd64.AMD64.*;
-import static com.oracle.graal.api.code.ValueUtil.*;
+import static com.oracle.jvmci.code.ValueUtil.*;
 import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.asm.amd64.*;
-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.jvmci.hotspot.*;
 
 /**
  * Pushes an interpreter frame to the stack.
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotRegisterAllocationConfig.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotRegisterAllocationConfig.java	Thu May 28 21:11:28 2015 -0700
@@ -26,8 +26,8 @@
 
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
 import com.oracle.graal.compiler.common.alloc.*;
+import com.oracle.jvmci.code.*;
 
 class AMD64HotSpotRegisterAllocationConfig extends RegisterAllocationConfig {
     /**
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotRegisterConfig.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotRegisterConfig.java	Thu May 28 21:11:28 2015 -0700
@@ -22,17 +22,29 @@
  */
 package com.oracle.graal.hotspot.amd64;
 
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.code.RegisterConfig;
+import com.oracle.jvmci.code.TargetDescription;
+import com.oracle.jvmci.code.CallingConvention;
+import com.oracle.jvmci.code.StackSlot;
+import com.oracle.jvmci.code.RegisterAttributes;
+import com.oracle.jvmci.code.CalleeSaveLayout;
+import com.oracle.jvmci.code.Architecture;
+import com.oracle.jvmci.meta.JavaType;
+import com.oracle.jvmci.meta.Value;
+import com.oracle.jvmci.meta.PlatformKind;
+import com.oracle.jvmci.meta.AllocatableValue;
+import com.oracle.jvmci.meta.Kind;
 import static com.oracle.graal.amd64.AMD64.*;
 import static com.oracle.graal.compiler.common.GraalOptions.*;
 
 import java.util.*;
 
 import com.oracle.graal.amd64.*;
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.code.CallingConvention.Type;
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.code.CallingConvention.Type;
 import com.oracle.graal.compiler.common.*;
-import com.oracle.graal.hotspot.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.hotspot.*;
 
 public class AMD64HotSpotRegisterConfig implements RegisterConfig {
 
@@ -207,7 +219,7 @@
                     }
                     break;
                 default:
-                    throw GraalInternalError.shouldNotReachHere();
+                    throw JVMCIError.shouldNotReachHere();
             }
 
             if (locations[i] == null) {
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotReturnOp.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotReturnOp.java	Thu May 28 21:11:28 2015 -0700
@@ -22,15 +22,15 @@
  */
 package com.oracle.graal.hotspot.amd64;
 
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.meta.Value;
 import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.asm.amd64.*;
-import com.oracle.graal.hotspot.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.StandardOp.BlockEndOp;
 import com.oracle.graal.lir.asm.*;
+import com.oracle.jvmci.hotspot.*;
 
 /**
  * Returns from a function.
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotSafepointOp.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotSafepointOp.java	Thu May 28 21:11:28 2015 -0700
@@ -22,18 +22,24 @@
  */
 package com.oracle.graal.hotspot.amd64;
 
+import com.oracle.jvmci.code.RegisterValue;
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.code.InfopointReason;
+import com.oracle.jvmci.meta.Value;
+import com.oracle.jvmci.meta.LIRKind;
+import com.oracle.jvmci.meta.JavaConstant;
+import com.oracle.jvmci.meta.AllocatableValue;
+import com.oracle.jvmci.meta.Kind;
 import static com.oracle.graal.amd64.AMD64.*;
 import static com.oracle.graal.asm.NumUtil.*;
 import static com.oracle.graal.compiler.common.GraalOptions.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.asm.amd64.*;
-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.graal.nodes.spi.*;
+import com.oracle.jvmci.hotspot.*;
 
 /**
  * Emits a safepoint poll.
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotUnwindOp.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotUnwindOp.java	Thu May 28 21:11:28 2015 -0700
@@ -22,12 +22,15 @@
  */
 package com.oracle.graal.hotspot.amd64;
 
+import com.oracle.jvmci.code.RegisterValue;
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.code.ForeignCallLinkage;
+import com.oracle.jvmci.code.CallingConvention;
 import static com.oracle.graal.amd64.AMD64.*;
-import static com.oracle.graal.api.code.ValueUtil.*;
+import static com.oracle.jvmci.code.ValueUtil.*;
 import static com.oracle.graal.hotspot.HotSpotBackend.*;
 import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*;
 
-import com.oracle.graal.api.code.*;
 import com.oracle.graal.asm.amd64.*;
 import com.oracle.graal.hotspot.stubs.*;
 import com.oracle.graal.lir.*;
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotspotDirectStaticCallOp.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotspotDirectStaticCallOp.java	Thu May 28 21:11:28 2015 -0700
@@ -22,13 +22,14 @@
  */
 package com.oracle.graal.hotspot.amd64;
 
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.meta.Value;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
 import com.oracle.graal.asm.amd64.*;
-import com.oracle.graal.hotspot.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.amd64.AMD64Call.DirectCallOp;
 import com.oracle.graal.lir.asm.*;
 import com.oracle.graal.nodes.CallTargetNode.InvokeKind;
+import com.oracle.jvmci.hotspot.*;
 
 /**
  * A direct call that complies with the conventions for such calls in HotSpot. It doesn't use an
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotspotDirectVirtualCallOp.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotspotDirectVirtualCallOp.java	Thu May 28 21:11:28 2015 -0700
@@ -22,14 +22,15 @@
  */
 package com.oracle.graal.hotspot.amd64;
 
+import com.oracle.jvmci.meta.Value;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
 import com.oracle.graal.amd64.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.asm.amd64.*;
-import com.oracle.graal.hotspot.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.amd64.AMD64Call.DirectCallOp;
 import com.oracle.graal.lir.asm.*;
 import com.oracle.graal.nodes.CallTargetNode.InvokeKind;
+import com.oracle.jvmci.hotspot.*;
 
 /**
  * A direct call that complies with the conventions for such calls in HotSpot. In particular, for
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64IndirectCallOp.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64IndirectCallOp.java	Thu May 28 21:11:28 2015 -0700
@@ -22,18 +22,19 @@
  */
 package com.oracle.graal.hotspot.amd64;
 
-import static com.oracle.graal.api.code.ValueUtil.*;
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.meta.Value;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
+import static com.oracle.jvmci.code.ValueUtil.*;
 import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*;
 
 import com.oracle.graal.amd64.*;
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.asm.amd64.*;
-import com.oracle.graal.hotspot.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.amd64.*;
 import com.oracle.graal.lir.amd64.AMD64Call.IndirectCallOp;
 import com.oracle.graal.lir.asm.*;
+import com.oracle.jvmci.hotspot.*;
 
 /**
  * A register indirect call that complies with the extra conventions for such calls in HotSpot. In
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64PrefetchOp.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64PrefetchOp.java	Thu May 28 21:11:28 2015 -0700
@@ -26,10 +26,10 @@
 import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*;
 
 import com.oracle.graal.asm.amd64.*;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.amd64.*;
 import com.oracle.graal.lir.asm.*;
+import com.oracle.jvmci.common.*;
 
 public final class AMD64PrefetchOp extends AMD64LIRInstruction {
     public static final LIRInstructionClass<AMD64PrefetchOp> TYPE = LIRInstructionClass.create(AMD64PrefetchOp.class);
@@ -59,7 +59,7 @@
                 masm.prefetchw(address.toAddress());
                 break;
             default:
-                throw GraalInternalError.shouldNotReachHere("unspported prefetch op " + instr);
+                throw JVMCIError.shouldNotReachHere("unspported prefetch op " + instr);
 
         }
     }
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64RawNativeCallNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64RawNativeCallNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,9 +22,13 @@
  */
 package com.oracle.graal.hotspot.amd64;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.code.CallingConvention.Type;
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.code.CallingConvention;
+import com.oracle.jvmci.meta.ResolvedJavaType;
+import com.oracle.jvmci.meta.JavaType;
+import com.oracle.jvmci.meta.Value;
+import com.oracle.jvmci.meta.JavaConstant;
+import com.oracle.jvmci.meta.Kind;
+import com.oracle.jvmci.code.CallingConvention.Type;
 import com.oracle.graal.compiler.amd64.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64TailcallOp.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64TailcallOp.java	Thu May 28 21:11:28 2015 -0700
@@ -22,14 +22,14 @@
  */
 package com.oracle.graal.hotspot.amd64;
 
-import static com.oracle.graal.api.code.ValueUtil.*;
+import static com.oracle.jvmci.code.ValueUtil.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.asm.amd64.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.amd64.*;
 import com.oracle.graal.lir.asm.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * Performs a hard-coded tail call to the specified target, which normally should be an
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64UncommonTrapStub.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64UncommonTrapStub.java	Thu May 28 21:11:28 2015 -0700
@@ -22,12 +22,15 @@
  */
 package com.oracle.graal.hotspot.amd64;
 
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.code.RegisterConfig;
+import com.oracle.jvmci.code.TargetDescription;
 import static com.oracle.graal.amd64.AMD64.*;
 
-import com.oracle.graal.api.code.*;
 import com.oracle.graal.hotspot.*;
 import com.oracle.graal.hotspot.meta.*;
 import com.oracle.graal.hotspot.stubs.*;
+import com.oracle.jvmci.hotspot.*;
 
 final class AMD64UncommonTrapStub extends UncommonTrapStub {
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/jvmci/AMD64HotSpotJVMCIBackendFactory.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,181 @@
+/*
+ * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.graal.hotspot.amd64.jvmci;
+
+import com.oracle.jvmci.code.RegisterConfig;
+import com.oracle.jvmci.code.TargetDescription;
+import com.oracle.jvmci.code.Architecture;
+import com.oracle.jvmci.meta.ConstantReflectionProvider;
+import static com.oracle.jvmci.hotspot.InitTimer.*;
+
+import java.util.*;
+
+import com.oracle.graal.amd64.*;
+import com.oracle.graal.hotspot.*;
+import com.oracle.graal.hotspot.amd64.*;
+import com.oracle.graal.hotspot.meta.*;
+import com.oracle.jvmci.hotspot.*;
+import com.oracle.jvmci.runtime.*;
+
+@ServiceProvider(HotSpotJVMCIBackendFactory.class)
+public class AMD64HotSpotJVMCIBackendFactory implements HotSpotJVMCIBackendFactory {
+
+    protected Architecture createArchitecture(HotSpotVMConfig config) {
+        return new AMD64(computeFeatures(config), computeFlags(config));
+    }
+
+    protected EnumSet<AMD64.CPUFeature> computeFeatures(HotSpotVMConfig config) {
+        // Configure the feature set using the HotSpot flag settings.
+        EnumSet<AMD64.CPUFeature> features = EnumSet.noneOf(AMD64.CPUFeature.class);
+        assert config.useSSE >= 2 : "minimum config for x64";
+        features.add(AMD64.CPUFeature.SSE);
+        features.add(AMD64.CPUFeature.SSE2);
+        if ((config.x86CPUFeatures & config.cpuSSE3) != 0) {
+            features.add(AMD64.CPUFeature.SSE3);
+        }
+        if ((config.x86CPUFeatures & config.cpuSSSE3) != 0) {
+            features.add(AMD64.CPUFeature.SSSE3);
+        }
+        if ((config.x86CPUFeatures & config.cpuSSE4A) != 0) {
+            features.add(AMD64.CPUFeature.SSE4a);
+        }
+        if ((config.x86CPUFeatures & config.cpuSSE41) != 0) {
+            features.add(AMD64.CPUFeature.SSE4_1);
+        }
+        if ((config.x86CPUFeatures & config.cpuSSE42) != 0) {
+            features.add(AMD64.CPUFeature.SSE4_2);
+        }
+        if ((config.x86CPUFeatures & config.cpuAVX) != 0) {
+            features.add(AMD64.CPUFeature.AVX);
+        }
+        if ((config.x86CPUFeatures & config.cpuAVX2) != 0) {
+            features.add(AMD64.CPUFeature.AVX2);
+        }
+        if ((config.x86CPUFeatures & config.cpuERMS) != 0) {
+            features.add(AMD64.CPUFeature.ERMS);
+        }
+        if ((config.x86CPUFeatures & config.cpuLZCNT) != 0) {
+            features.add(AMD64.CPUFeature.LZCNT);
+        }
+        if ((config.x86CPUFeatures & config.cpuPOPCNT) != 0) {
+            features.add(AMD64.CPUFeature.POPCNT);
+        }
+        if ((config.x86CPUFeatures & config.cpuAES) != 0) {
+            features.add(AMD64.CPUFeature.AES);
+        }
+        if ((config.x86CPUFeatures & config.cpu3DNOWPREFETCH) != 0) {
+            features.add(AMD64.CPUFeature.AMD_3DNOW_PREFETCH);
+        }
+        if ((config.x86CPUFeatures & config.cpuBMI1) != 0) {
+            features.add(AMD64.CPUFeature.BMI1);
+        }
+        return features;
+    }
+
+    protected EnumSet<AMD64.Flag> computeFlags(HotSpotVMConfig config) {
+        EnumSet<AMD64.Flag> flags = EnumSet.noneOf(AMD64.Flag.class);
+        if (config.useCountLeadingZerosInstruction) {
+            flags.add(AMD64.Flag.UseCountLeadingZerosInstruction);
+        }
+        if (config.useCountTrailingZerosInstruction) {
+            flags.add(AMD64.Flag.UseCountTrailingZerosInstruction);
+        }
+        return flags;
+    }
+
+    protected TargetDescription createTarget(HotSpotVMConfig config) {
+        final int stackFrameAlignment = 16;
+        final int implicitNullCheckLimit = 4096;
+        final boolean inlineObjects = true;
+        return new HotSpotTargetDescription(createArchitecture(config), true, stackFrameAlignment, implicitNullCheckLimit, inlineObjects);
+    }
+
+    protected AMD64HotSpotBackend createBackend(HotSpotGraalRuntimeProvider runtime, HotSpotProviders providers) {
+        return new AMD64HotSpotBackend(runtime, providers);
+    }
+
+    protected HotSpotConstantReflectionProvider createConstantReflection(HotSpotJVMCIRuntimeProvider runtime) {
+        return new HotSpotConstantReflectionProvider(runtime);
+    }
+
+    protected RegisterConfig createRegisterConfig(HotSpotJVMCIRuntimeProvider runtime, TargetDescription target) {
+        return new AMD64HotSpotRegisterConfig(target.arch, runtime.getConfig());
+    }
+
+    protected HotSpotCodeCacheProvider createCodeCache(HotSpotJVMCIRuntimeProvider runtime, TargetDescription target, RegisterConfig regConfig) {
+        return new HotSpotCodeCacheProvider(runtime, runtime.getConfig(), target, regConfig);
+    }
+
+    protected HotSpotMetaAccessProvider createMetaAccess(HotSpotJVMCIRuntimeProvider runtime) {
+        return new HotSpotMetaAccessProvider(runtime);
+    }
+
+    public String getArchitecture() {
+        return "AMD64";
+    }
+
+    public String getGraalRuntimeName() {
+        return "basic";
+    }
+
+    @Override
+    public String toString() {
+        return getGraalRuntimeName() + ":" + getArchitecture();
+    }
+
+    public JVMCIBackend createJVMCIBackend(HotSpotJVMCIRuntimeProvider runtime, JVMCIBackend host) {
+
+        assert host == null;
+        TargetDescription target = createTarget(runtime.getConfig());
+
+        RegisterConfig regConfig;
+        HotSpotCodeCacheProvider codeCache;
+        ConstantReflectionProvider constantReflection;
+        HotSpotMetaAccessProvider metaAccess;
+        try (InitTimer t = timer("create providers")) {
+            try (InitTimer rt = timer("create MetaAccess provider")) {
+                metaAccess = createMetaAccess(runtime);
+            }
+            try (InitTimer rt = timer("create RegisterConfig")) {
+                regConfig = createRegisterConfig(runtime, target);
+            }
+            try (InitTimer rt = timer("create CodeCache provider")) {
+                codeCache = createCodeCache(runtime, target, regConfig);
+            }
+            try (InitTimer rt = timer("create ConstantReflection provider")) {
+                constantReflection = createConstantReflection(runtime);
+            }
+        }
+        try (InitTimer rt = timer("instantiate backend")) {
+            return createBackend(metaAccess, codeCache, constantReflection);
+        }
+    }
+
+    protected JVMCIBackend createBackend(HotSpotMetaAccessProvider metaAccess, HotSpotCodeCacheProvider codeCache, ConstantReflectionProvider constantReflection) {
+        return new JVMCIBackend(metaAccess, codeCache, constantReflection);
+    }
+
+    public String getJVMCIRuntimeName() {
+        return "basic";
+    }
+}
--- a/graal/com.oracle.graal.hotspot.jfr/src/com/oracle/graal/hotspot/jfr/events/JFREventProvider.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.jfr/src/com/oracle/graal/hotspot/jfr/events/JFREventProvider.java	Thu May 28 21:11:28 2015 -0700
@@ -24,9 +24,9 @@
 
 import java.net.*;
 
-import com.oracle.graal.api.runtime.*;
 import com.oracle.graal.hotspot.events.*;
 import com.oracle.jrockit.jfr.*;
+import com.oracle.jvmci.runtime.*;
 
 /**
  * A JFR implementation for {@link EventProvider}. This implementation is used when Flight Recorder
--- a/graal/com.oracle.graal.hotspot.loader/src/com/oracle/graal/hotspot/loader/Factory.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,87 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.hotspot.loader;
-
-import java.io.*;
-import java.net.*;
-import java.util.*;
-
-/**
- * Utility to create and register a separate class loader for loading Graal classes (i.e., those in
- * found in jars in lib/graal).
- */
-public class Factory {
-
-    /**
-     * Copy of the {@code UseGraalClassLoader} VM option. Set by the VM before the static
-     * initializer is called.
-     */
-    private static boolean useGraalClassLoader;
-
-    /**
-     * Registers the Graal class loader in the VM.
-     */
-    private static native void init(ClassLoader loader);
-
-    static {
-        init(useGraalClassLoader ? newClassLoader() : null);
-    }
-
-    /**
-     * Creates a new class loader for loading graal classes.
-     */
-    private static ClassLoader newClassLoader() {
-        URL[] urls = getGraalJarsUrls();
-        ClassLoader parent = null;
-        return URLClassLoader.newInstance(urls, parent);
-    }
-
-    /**
-     * Gets the URLs for lib/graal/graal*.jar.
-     */
-    private static URL[] getGraalJarsUrls() {
-        File javaHome = new File(System.getProperty("java.home"));
-        File lib = new File(javaHome, "lib");
-        File graal = new File(lib, "graal");
-        if (!graal.exists()) {
-            throw new InternalError(graal + " does not exist");
-        }
-
-        List<URL> urls = new ArrayList<>();
-        for (String fileName : graal.list()) {
-            if (fileName.endsWith(".jar")) {
-                File file = new File(graal, fileName);
-                if (file.isDirectory()) {
-                    continue;
-                }
-                try {
-                    urls.add(file.toURI().toURL());
-                } catch (MalformedURLException e) {
-                    throw new InternalError(e);
-                }
-            }
-        }
-
-        return urls.toArray(new URL[urls.size()]);
-    }
-}
--- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCDeoptimizationStub.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCDeoptimizationStub.java	Thu May 28 21:11:28 2015 -0700
@@ -22,9 +22,11 @@
  */
 package com.oracle.graal.hotspot.sparc;
 
+import com.oracle.jvmci.code.TargetDescription;
+import com.oracle.jvmci.code.RegisterConfig;
+import com.oracle.jvmci.code.Register;
 import static com.oracle.graal.sparc.SPARC.*;
 
-import com.oracle.graal.api.code.*;
 import com.oracle.graal.hotspot.*;
 import com.oracle.graal.hotspot.meta.*;
 import com.oracle.graal.hotspot.stubs.*;
--- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotBackend.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotBackend.java	Thu May 28 21:11:28 2015 -0700
@@ -22,20 +22,25 @@
  */
 package com.oracle.graal.hotspot.sparc;
 
-import static com.oracle.graal.api.code.CallingConvention.Type.*;
-import static com.oracle.graal.api.code.ValueUtil.*;
+import com.oracle.jvmci.code.CompilationResult;
+import com.oracle.jvmci.code.CallingConvention;
+import com.oracle.jvmci.code.StackSlot;
+import com.oracle.jvmci.code.RegisterConfig;
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
+import com.oracle.jvmci.meta.JavaType;
+import static com.oracle.jvmci.code.CallingConvention.Type.*;
+import static com.oracle.jvmci.code.ValueUtil.*;
 import static com.oracle.graal.asm.sparc.SPARCAssembler.Annul.*;
 import static com.oracle.graal.asm.sparc.SPARCAssembler.BranchPredict.*;
 import static com.oracle.graal.asm.sparc.SPARCAssembler.CC.*;
 import static com.oracle.graal.asm.sparc.SPARCAssembler.ConditionFlag.*;
 import static com.oracle.graal.compiler.common.GraalOptions.*;
-import static com.oracle.graal.compiler.common.UnsafeAccess.*;
 import static com.oracle.graal.sparc.SPARC.*;
+import static com.oracle.jvmci.common.UnsafeAccess.*;
 
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.asm.*;
 import com.oracle.graal.asm.sparc.*;
 import com.oracle.graal.asm.sparc.SPARCMacroAssembler.ScratchRegister;
@@ -53,6 +58,7 @@
 import com.oracle.graal.lir.sparc.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.hotspot.*;
 
 /**
  * HotSpot SPARC specific backend.
--- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotBackendFactory.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotBackendFactory.java	Thu May 28 21:11:28 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,11 +22,12 @@
  */
 package com.oracle.graal.hotspot.sparc;
 
+import com.oracle.jvmci.code.TargetDescription;
+import com.oracle.jvmci.code.RegisterConfig;
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.meta.Value;
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.api.runtime.*;
 import com.oracle.graal.graphbuilderconf.GraphBuilderConfiguration.Plugins;
 import com.oracle.graal.hotspot.*;
 import com.oracle.graal.hotspot.meta.*;
@@ -35,31 +36,21 @@
 import com.oracle.graal.phases.util.*;
 import com.oracle.graal.replacements.sparc.*;
 import com.oracle.graal.sparc.*;
-import com.oracle.graal.sparc.SPARC.CPUFeature;
+import com.oracle.jvmci.hotspot.*;
+import com.oracle.jvmci.runtime.*;
 
 @ServiceProvider(HotSpotBackendFactory.class)
 public class SPARCHotSpotBackendFactory implements HotSpotBackendFactory {
 
-    protected Architecture createArchitecture(HotSpotVMConfig config) {
-        return new SPARC(computeFeatures(config));
-    }
-
-    protected TargetDescription createTarget(HotSpotVMConfig config) {
-        final int stackFrameAlignment = 16;
-        final int implicitNullCheckLimit = 4096;
-        final boolean inlineObjects = true;
-        return new HotSpotTargetDescription(createArchitecture(config), true, stackFrameAlignment, implicitNullCheckLimit, inlineObjects);
-    }
-
-    public HotSpotBackend createBackend(HotSpotGraalRuntimeProvider runtime, HotSpotBackend host) {
+    @Override
+    public HotSpotBackend createBackend(HotSpotGraalRuntimeProvider runtime, JVMCIBackend jvmci, HotSpotBackend host) {
         assert host == null;
-        TargetDescription target = createTarget(runtime.getConfig());
 
         HotSpotRegistersProvider registers = createRegisters();
-        HotSpotMetaAccessProvider metaAccess = new HotSpotMetaAccessProvider(runtime);
-        RegisterConfig regConfig = new SPARCHotSpotRegisterConfig(target, runtime.getConfig());
-        HotSpotCodeCacheProvider codeCache = createCodeCache(runtime, target, regConfig);
-        HotSpotConstantReflectionProvider constantReflection = new HotSpotConstantReflectionProvider(runtime);
+        HotSpotMetaAccessProvider metaAccess = (HotSpotMetaAccessProvider) jvmci.getMetaAccess();
+        HotSpotCodeCacheProvider codeCache = (HotSpotCodeCacheProvider) jvmci.getCodeCache();
+        TargetDescription target = codeCache.getTarget();
+        HotSpotConstantReflectionProvider constantReflection = new HotSpotGraalConstantReflectionProvider(runtime.getJVMCIRuntime());
         Value[] nativeABICallerSaveRegisters = createNativeABICallerSaveRegisters(runtime.getConfig(), codeCache.getRegisterConfig());
         HotSpotForeignCallsProvider foreignCalls = new SPARCHotSpotForeignCallsProvider(runtime, metaAccess, codeCache, nativeABICallerSaveRegisters);
         LoweringProvider lowerer = createLowerer(runtime, metaAccess, foreignCalls, registers, target);
@@ -90,10 +81,6 @@
         return new HotSpotSuitesProvider(runtime, plugins);
     }
 
-    protected HotSpotCodeCacheProvider createCodeCache(HotSpotGraalRuntimeProvider runtime, TargetDescription target, RegisterConfig regConfig) {
-        return new HotSpotCodeCacheProvider(runtime, runtime.getConfig(), target, regConfig);
-    }
-
     protected SPARCHotSpotBackend createBackend(HotSpotGraalRuntimeProvider runtime, HotSpotProviders providers) {
         return new SPARCHotSpotBackend(runtime, providers);
     }
@@ -103,23 +90,6 @@
         return new SPARCHotSpotLoweringProvider(runtime, metaAccess, foreignCalls, registers, target);
     }
 
-    protected EnumSet<CPUFeature> computeFeatures(HotSpotVMConfig config) {
-        EnumSet<CPUFeature> features = EnumSet.noneOf(CPUFeature.class);
-        if ((config.sparcFeatures & config.vis1Instructions) != 0) {
-            features.add(CPUFeature.VIS1);
-        }
-        if ((config.sparcFeatures & config.vis2Instructions) != 0) {
-            features.add(CPUFeature.VIS2);
-        }
-        if ((config.sparcFeatures & config.vis3Instructions) != 0) {
-            features.add(CPUFeature.VIS3);
-        }
-        if ((config.sparcFeatures & config.cbcondInstructions) != 0) {
-            features.add(CPUFeature.CBCOND);
-        }
-        return features;
-    }
-
     protected HotSpotRegistersProvider createRegisters() {
         return new HotSpotRegisters(SPARC.g2, SPARC.g6, SPARC.sp);
     }
@@ -138,10 +108,12 @@
         return nativeABICallerSaveRegisters;
     }
 
+    @Override
     public String getArchitecture() {
         return "SPARC";
     }
 
+    @Override
     public String getGraalRuntimeName() {
         return "basic";
     }
--- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotCRuntimeCallEpilogueOp.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotCRuntimeCallEpilogueOp.java	Thu May 28 21:11:28 2015 -0700
@@ -22,11 +22,13 @@
  */
 package com.oracle.graal.hotspot.sparc;
 
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.meta.Kind;
+import com.oracle.jvmci.meta.LIRKind;
+import com.oracle.jvmci.meta.Value;
 import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*;
 import static com.oracle.graal.sparc.SPARC.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.asm.sparc.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.asm.*;
--- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotCRuntimeCallPrologueOp.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotCRuntimeCallPrologueOp.java	Thu May 28 21:11:28 2015 -0700
@@ -22,11 +22,13 @@
  */
 package com.oracle.graal.hotspot.sparc;
 
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.meta.Kind;
+import com.oracle.jvmci.meta.LIRKind;
+import com.oracle.jvmci.meta.Value;
 import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*;
 import static com.oracle.graal.sparc.SPARC.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.asm.sparc.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.asm.*;
--- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotCounterOp.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotCounterOp.java	Thu May 28 21:11:28 2015 -0700
@@ -22,11 +22,12 @@
  */
 package com.oracle.graal.hotspot.sparc;
 
-import static com.oracle.graal.api.code.ValueUtil.*;
+import com.oracle.jvmci.code.TargetDescription;
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.meta.Value;
+import static com.oracle.jvmci.code.ValueUtil.*;
 import static com.oracle.graal.asm.sparc.SPARCAssembler.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.asm.*;
 import com.oracle.graal.asm.sparc.*;
 import com.oracle.graal.asm.sparc.SPARCMacroAssembler.ScratchRegister;
@@ -35,6 +36,7 @@
 import com.oracle.graal.hotspot.meta.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.asm.*;
+import com.oracle.jvmci.hotspot.*;
 
 @Opcode("BenchMarkCounter")
 public class SPARCHotSpotCounterOp extends HotSpotCounterOp {
@@ -58,7 +60,7 @@
         TargetDescription target = crb.target;
 
         // address for counters array
-        SPARCAddress countersArrayAddr = new SPARCAddress(thread, config.graalCountersThreadOffset);
+        SPARCAddress countersArrayAddr = new SPARCAddress(thread, config.jvmciCountersThreadOffset);
         try (ScratchRegister scratch = masm.getScratchRegister()) {
             Register countersArrayReg = scratch.getRegister();
 
--- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotDeoptimizeCallerOp.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotDeoptimizeCallerOp.java	Thu May 28 21:11:28 2015 -0700
@@ -22,9 +22,9 @@
  */
 package com.oracle.graal.hotspot.sparc;
 
+import com.oracle.jvmci.code.Register;
 import static com.oracle.graal.hotspot.HotSpotHostBackend.*;
 
-import com.oracle.graal.api.code.*;
 import com.oracle.graal.asm.sparc.*;
 import com.oracle.graal.asm.sparc.SPARCMacroAssembler.ScratchRegister;
 import com.oracle.graal.lir.*;
--- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotEnterUnpackFramesStackFrameOp.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotEnterUnpackFramesStackFrameOp.java	Thu May 28 21:11:28 2015 -0700
@@ -22,12 +22,12 @@
  */
 package com.oracle.graal.hotspot.sparc;
 
-import static com.oracle.graal.api.code.ValueUtil.*;
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.meta.AllocatableValue;
+import static com.oracle.jvmci.code.ValueUtil.*;
 import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*;
 import static com.oracle.graal.sparc.SPARC.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.asm.sparc.*;
 import com.oracle.graal.hotspot.*;
 import com.oracle.graal.lir.*;
--- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotForeignCallsProvider.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotForeignCallsProvider.java	Thu May 28 21:11:28 2015 -0700
@@ -22,8 +22,16 @@
  */
 package com.oracle.graal.hotspot.sparc;
 
-import static com.oracle.graal.api.meta.LocationIdentity.*;
-import static com.oracle.graal.api.meta.Value.*;
+import com.oracle.jvmci.code.TargetDescription;
+import com.oracle.jvmci.code.CallingConvention;
+import com.oracle.jvmci.code.CodeCacheProvider;
+import com.oracle.jvmci.code.RegisterValue;
+import com.oracle.jvmci.meta.MetaAccessProvider;
+import com.oracle.jvmci.meta.Kind;
+import com.oracle.jvmci.meta.LIRKind;
+import com.oracle.jvmci.meta.Value;
+import static com.oracle.jvmci.meta.LocationIdentity.*;
+import static com.oracle.jvmci.meta.Value.*;
 import static com.oracle.graal.hotspot.HotSpotBackend.*;
 import static com.oracle.graal.hotspot.HotSpotBackend.Options.*;
 import static com.oracle.graal.hotspot.HotSpotForeignCallLinkage.*;
@@ -32,10 +40,9 @@
 import static com.oracle.graal.hotspot.HotSpotHostBackend.*;
 import static com.oracle.graal.sparc.SPARC.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.hotspot.*;
 import com.oracle.graal.hotspot.meta.*;
+import com.oracle.jvmci.hotspot.*;
 
 public class SPARCHotSpotForeignCallsProvider extends HotSpotHostForeignCallsProvider {
 
--- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotJumpToExceptionHandlerInCallerOp.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotJumpToExceptionHandlerInCallerOp.java	Thu May 28 21:11:28 2015 -0700
@@ -22,12 +22,12 @@
  */
 package com.oracle.graal.hotspot.sparc;
 
-import static com.oracle.graal.api.code.ValueUtil.*;
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.meta.AllocatableValue;
+import static com.oracle.jvmci.code.ValueUtil.*;
 import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*;
 import static com.oracle.graal.sparc.SPARC.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.asm.sparc.*;
 import com.oracle.graal.asm.sparc.SPARCAssembler.CC;
 import com.oracle.graal.asm.sparc.SPARCAssembler.ConditionFlag;
--- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotJumpToExceptionHandlerOp.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotJumpToExceptionHandlerOp.java	Thu May 28 21:11:28 2015 -0700
@@ -22,11 +22,11 @@
  */
 package com.oracle.graal.hotspot.sparc;
 
-import static com.oracle.graal.api.code.ValueUtil.*;
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.meta.AllocatableValue;
+import static com.oracle.jvmci.code.ValueUtil.*;
 import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.asm.sparc.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.asm.*;
--- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotLIRGenerationResult.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotLIRGenerationResult.java	Thu May 28 21:11:28 2015 -0700
@@ -22,9 +22,9 @@
  */
 package com.oracle.graal.hotspot.sparc;
 
+import com.oracle.jvmci.code.StackSlot;
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
 import com.oracle.graal.hotspot.stubs.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.StandardOp.SaveRegistersOp;
--- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotLIRGenerator.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotLIRGenerator.java	Thu May 28 21:11:28 2015 -0700
@@ -22,21 +22,32 @@
  */
 package com.oracle.graal.hotspot.sparc;
 
-import static com.oracle.graal.api.code.ValueUtil.*;
+import com.oracle.jvmci.code.ForeignCallLinkage;
+import com.oracle.jvmci.code.CallingConvention;
+import com.oracle.jvmci.code.StackSlotValue;
+import com.oracle.jvmci.code.VirtualStackSlot;
+import com.oracle.jvmci.code.StackSlot;
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.code.RegisterValue;
+import com.oracle.jvmci.meta.JavaConstant;
+import com.oracle.jvmci.meta.DeoptimizationAction;
+import com.oracle.jvmci.meta.Kind;
+import com.oracle.jvmci.meta.DeoptimizationReason;
+import com.oracle.jvmci.meta.PlatformKind;
+import com.oracle.jvmci.meta.LIRKind;
+import com.oracle.jvmci.meta.Value;
+import com.oracle.jvmci.meta.AllocatableValue;
+import static com.oracle.jvmci.code.ValueUtil.*;
 import static com.oracle.graal.hotspot.HotSpotBackend.*;
 import static com.oracle.graal.hotspot.HotSpotGraalRuntime.*;
 import static com.oracle.graal.sparc.SPARC.*;
 
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.calc.*;
 import com.oracle.graal.compiler.common.spi.*;
 import com.oracle.graal.compiler.sparc.*;
 import com.oracle.graal.hotspot.*;
-import com.oracle.graal.hotspot.HotSpotVMConfig.CompressEncoding;
 import com.oracle.graal.hotspot.debug.*;
 import com.oracle.graal.hotspot.meta.*;
 import com.oracle.graal.hotspot.stubs.*;
@@ -50,6 +61,9 @@
 import com.oracle.graal.lir.sparc.SPARCMove.StoreConstantOp;
 import com.oracle.graal.lir.sparc.SPARCMove.StoreOp;
 import com.oracle.graal.sparc.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.hotspot.*;
+import com.oracle.jvmci.hotspot.HotSpotVMConfig.CompressEncoding;
 
 public class SPARCHotSpotLIRGenerator extends SPARCLIRGenerator implements HotSpotLIRGenerator {
 
@@ -158,7 +172,7 @@
     @Override
     public void emitTailcall(Value[] args, Value address) {
         // append(new AMD64TailcallOp(args, address));
-        throw GraalInternalError.unimplemented();
+        throw JVMCIError.unimplemented();
     }
 
     @Override
--- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotLeaveUnpackFramesStackFrameOp.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotLeaveUnpackFramesStackFrameOp.java	Thu May 28 21:11:28 2015 -0700
@@ -22,9 +22,9 @@
  */
 package com.oracle.graal.hotspot.sparc;
 
+import com.oracle.jvmci.code.Register;
 import static com.oracle.graal.sparc.SPARC.*;
 
-import com.oracle.graal.api.code.*;
 import com.oracle.graal.asm.sparc.*;
 import com.oracle.graal.hotspot.*;
 import com.oracle.graal.lir.*;
--- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotLoweringProvider.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotLoweringProvider.java	Thu May 28 21:11:28 2015 -0700
@@ -22,8 +22,9 @@
  */
 package com.oracle.graal.hotspot.sparc;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.code.TargetDescription;
+import com.oracle.jvmci.code.ForeignCallsProvider;
+import com.oracle.jvmci.meta.MetaAccessProvider;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.hotspot.*;
 import com.oracle.graal.hotspot.meta.*;
--- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotMove.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotMove.java	Thu May 28 21:11:28 2015 -0700
@@ -22,11 +22,15 @@
  */
 package com.oracle.graal.hotspot.sparc;
 
-import static com.oracle.graal.api.code.ValueUtil.*;
+import com.oracle.jvmci.code.StackSlot;
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.meta.JavaConstant;
+import com.oracle.jvmci.meta.Kind;
+import com.oracle.jvmci.meta.Value;
+import com.oracle.jvmci.meta.AllocatableValue;
+import static com.oracle.jvmci.code.ValueUtil.*;
 import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.asm.*;
 import com.oracle.graal.asm.sparc.*;
 import com.oracle.graal.asm.sparc.SPARCAssembler.Annul;
@@ -37,13 +41,14 @@
 import com.oracle.graal.asm.sparc.SPARCMacroAssembler.ScratchRegister;
 import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.hotspot.*;
-import com.oracle.graal.hotspot.HotSpotVMConfig.CompressEncoding;
-import com.oracle.graal.hotspot.meta.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.StandardOp.MoveOp;
 import com.oracle.graal.lir.asm.*;
 import com.oracle.graal.lir.sparc.*;
 import com.oracle.graal.sparc.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.hotspot.*;
+import com.oracle.jvmci.hotspot.HotSpotVMConfig.CompressEncoding;
 
 public class SPARCHotSpotMove {
 
@@ -82,7 +87,7 @@
                                 masm.stx(sr1, addr);
                                 break;
                             default:
-                                throw GraalInternalError.shouldNotReachHere();
+                                throw JVMCIError.shouldNotReachHere();
                         }
                     }
                 }
@@ -106,7 +111,7 @@
                         new SPARCMacroAssembler.Setx(0xDEADDEADDEADDEADL, asRegister(dest), true).emit(masm);
                     }
                 } else {
-                    GraalInternalError.unimplemented();
+                    JVMCIError.unimplemented();
                 }
             } else if (constant instanceof HotSpotMetaspaceConstant) {
                 assert constant.getKind() == Kind.Int || constant.getKind() == Kind.Long;
@@ -116,13 +121,13 @@
                 crb.recordInlineDataInCode(constant);
                 if (compressed) {
                     if (isImmutable && generatePIC) {
-                        GraalInternalError.unimplemented();
+                        JVMCIError.unimplemented();
                     } else {
                         new SPARCMacroAssembler.Setx(constant.asInt(), asRegister(dest), true).emit(masm);
                     }
                 } else {
                     if (isImmutable && generatePIC) {
-                        GraalInternalError.unimplemented();
+                        JVMCIError.unimplemented();
                     } else {
                         new SPARCMacroAssembler.Setx(constant.asLong(), asRegister(dest), true).emit(masm);
                     }
--- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotNodeLIRBuilder.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotNodeLIRBuilder.java	Thu May 28 21:11:28 2015 -0700
@@ -22,18 +22,24 @@
  */
 package com.oracle.graal.hotspot.sparc;
 
-import static com.oracle.graal.api.code.ValueUtil.*;
+import com.oracle.jvmci.code.ForeignCallLinkage;
+import com.oracle.jvmci.code.ValueUtil;
+import com.oracle.jvmci.code.CallingConvention;
+import com.oracle.jvmci.code.BytecodeFrame;
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.code.RegisterValue;
+import com.oracle.jvmci.meta.Kind;
+import com.oracle.jvmci.meta.LIRKind;
+import com.oracle.jvmci.meta.Value;
+import com.oracle.jvmci.meta.AllocatableValue;
+import static com.oracle.jvmci.code.ValueUtil.*;
 import static com.oracle.graal.hotspot.HotSpotBackend.*;
 import static com.oracle.graal.sparc.SPARC.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.gen.*;
 import com.oracle.graal.compiler.sparc.*;
-import com.oracle.graal.debug.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.hotspot.*;
-import com.oracle.graal.hotspot.meta.*;
 import com.oracle.graal.hotspot.nodes.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.gen.*;
@@ -41,6 +47,8 @@
 import com.oracle.graal.lir.sparc.SPARCMove.CompareAndSwapOp;
 import com.oracle.graal.nodes.CallTargetNode.InvokeKind;
 import com.oracle.graal.nodes.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.hotspot.*;
 
 public class SPARCHotSpotNodeLIRBuilder extends SPARCNodeLIRBuilder implements HotSpotNodeLIRBuilder {
 
--- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotPatchReturnAddressOp.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotPatchReturnAddressOp.java	Thu May 28 21:11:28 2015 -0700
@@ -22,12 +22,12 @@
  */
 package com.oracle.graal.hotspot.sparc;
 
-import static com.oracle.graal.api.code.ValueUtil.*;
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.meta.AllocatableValue;
+import static com.oracle.jvmci.code.ValueUtil.*;
 import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*;
 import static com.oracle.graal.sparc.SPARC.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.asm.sparc.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.asm.*;
--- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotPushInterpreterFrameOp.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotPushInterpreterFrameOp.java	Thu May 28 21:11:28 2015 -0700
@@ -22,12 +22,12 @@
  */
 package com.oracle.graal.hotspot.sparc;
 
-import static com.oracle.graal.api.code.ValueUtil.*;
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.meta.AllocatableValue;
+import static com.oracle.jvmci.code.ValueUtil.*;
 import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*;
 import static com.oracle.graal.sparc.SPARC.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.asm.sparc.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.asm.*;
--- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotRegisterConfig.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotRegisterConfig.java	Thu May 28 21:11:28 2015 -0700
@@ -22,18 +22,29 @@
  */
 package com.oracle.graal.hotspot.sparc;
 
+import com.oracle.jvmci.code.Architecture;
+import com.oracle.jvmci.code.TargetDescription;
+import com.oracle.jvmci.code.CallingConvention;
+import com.oracle.jvmci.code.CalleeSaveLayout;
+import com.oracle.jvmci.code.RegisterAttributes;
+import com.oracle.jvmci.code.StackSlot;
+import com.oracle.jvmci.code.RegisterConfig;
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.meta.Kind;
+import com.oracle.jvmci.meta.JavaType;
+import com.oracle.jvmci.meta.PlatformKind;
+import com.oracle.jvmci.meta.Value;
+import com.oracle.jvmci.meta.AllocatableValue;
 import static com.oracle.graal.sparc.SPARC.*;
 
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.code.CallingConvention.Type;
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.code.CallingConvention.Type;
 import com.oracle.graal.asm.*;
-import com.oracle.graal.compiler.common.*;
-import com.oracle.graal.hotspot.*;
 import com.oracle.graal.lir.framemap.*;
 import com.oracle.graal.sparc.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.hotspot.*;
 
 public class SPARCHotSpotRegisterConfig implements RegisterConfig {
 
@@ -178,7 +189,7 @@
         if (type == Type.JavaCallee) {
             return callingConvention(cpuCalleeParameterRegisters, returnType, parameterTypes, type, target, stackOnly);
         }
-        throw GraalInternalError.shouldNotReachHere();
+        throw JVMCIError.shouldNotReachHere();
     }
 
     public Register[] getCallingConventionRegisters(Type type, Kind kind) {
@@ -230,7 +241,7 @@
                     }
                     break;
                 default:
-                    throw GraalInternalError.shouldNotReachHere();
+                    throw JVMCIError.shouldNotReachHere();
             }
 
             if (locations[i] == null) {
--- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotReturnOp.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotReturnOp.java	Thu May 28 21:11:28 2015 -0700
@@ -22,15 +22,15 @@
  */
 package com.oracle.graal.hotspot.sparc;
 
+import com.oracle.jvmci.meta.Value;
 import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.asm.sparc.*;
-import com.oracle.graal.hotspot.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.asm.*;
 import com.oracle.graal.lir.sparc.SPARCControlFlow.ReturnOp;
 import com.oracle.graal.sparc.*;
+import com.oracle.jvmci.hotspot.*;
 
 /**
  * Returns from a function.
--- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotSafepointOp.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotSafepointOp.java	Thu May 28 21:11:28 2015 -0700
@@ -22,17 +22,20 @@
  */
 package com.oracle.graal.hotspot.sparc;
 
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.code.InfopointReason;
+import com.oracle.jvmci.code.RegisterValue;
+import com.oracle.jvmci.meta.LIRKind;
+import com.oracle.jvmci.meta.AllocatableValue;
 import static com.oracle.graal.sparc.SPARC.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.asm.sparc.*;
 import com.oracle.graal.asm.sparc.SPARCMacroAssembler.Setx;
-import com.oracle.graal.hotspot.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.asm.*;
 import com.oracle.graal.lir.gen.*;
 import com.oracle.graal.lir.sparc.*;
+import com.oracle.jvmci.hotspot.*;
 
 import edu.umd.cs.findbugs.annotations.*;
 
--- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotUnwindOp.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotSpotUnwindOp.java	Thu May 28 21:11:28 2015 -0700
@@ -22,12 +22,15 @@
  */
 package com.oracle.graal.hotspot.sparc;
 
-import static com.oracle.graal.api.code.ValueUtil.*;
+import com.oracle.jvmci.code.ForeignCallLinkage;
+import com.oracle.jvmci.code.CallingConvention;
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.code.RegisterValue;
+import static com.oracle.jvmci.code.ValueUtil.*;
 import static com.oracle.graal.hotspot.HotSpotBackend.*;
 import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*;
 import static com.oracle.graal.sparc.SPARC.*;
 
-import com.oracle.graal.api.code.*;
 import com.oracle.graal.asm.sparc.*;
 import com.oracle.graal.hotspot.stubs.*;
 import com.oracle.graal.lir.*;
--- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotspotDirectStaticCallOp.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotspotDirectStaticCallOp.java	Thu May 28 21:11:28 2015 -0700
@@ -22,13 +22,14 @@
  */
 package com.oracle.graal.hotspot.sparc;
 
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
+import com.oracle.jvmci.meta.Value;
 import com.oracle.graal.asm.sparc.*;
-import com.oracle.graal.hotspot.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.asm.*;
 import com.oracle.graal.lir.sparc.SPARCCall.DirectCallOp;
 import com.oracle.graal.nodes.CallTargetNode.InvokeKind;
+import com.oracle.jvmci.hotspot.*;
 
 /**
  * A direct call that complies with the conventions for such calls in HotSpot. It doesn't use an
--- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotspotDirectVirtualCallOp.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCHotspotDirectVirtualCallOp.java	Thu May 28 21:11:28 2015 -0700
@@ -22,17 +22,18 @@
  */
 package com.oracle.graal.hotspot.sparc;
 
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
+import com.oracle.jvmci.meta.Value;
 import static com.oracle.graal.sparc.SPARC.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.asm.sparc.*;
 import com.oracle.graal.asm.sparc.SPARCMacroAssembler.Setx;
-import com.oracle.graal.hotspot.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.asm.*;
 import com.oracle.graal.lir.sparc.SPARCCall.DirectCallOp;
 import com.oracle.graal.nodes.CallTargetNode.InvokeKind;
+import com.oracle.jvmci.hotspot.*;
 
 /**
  * A direct call that complies with the conventions for such calls in HotSpot. In particular, for
--- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCIndirectCallOp.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCIndirectCallOp.java	Thu May 28 21:11:28 2015 -0700
@@ -22,18 +22,19 @@
  */
 package com.oracle.graal.hotspot.sparc;
 
-import static com.oracle.graal.api.code.ValueUtil.*;
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
+import com.oracle.jvmci.meta.Value;
+import static com.oracle.jvmci.code.ValueUtil.*;
 import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*;
 import static com.oracle.graal.sparc.SPARC.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.asm.sparc.*;
-import com.oracle.graal.hotspot.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.asm.*;
 import com.oracle.graal.lir.sparc.*;
 import com.oracle.graal.lir.sparc.SPARCCall.IndirectCallOp;
+import com.oracle.jvmci.hotspot.*;
 
 /**
  * A register indirect call that complies with the extra conventions for such calls in HotSpot. In
--- a/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCUncommonTrapStub.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/SPARCUncommonTrapStub.java	Thu May 28 21:11:28 2015 -0700
@@ -22,9 +22,11 @@
  */
 package com.oracle.graal.hotspot.sparc;
 
+import com.oracle.jvmci.code.TargetDescription;
+import com.oracle.jvmci.code.RegisterConfig;
+import com.oracle.jvmci.code.Register;
 import static com.oracle.graal.sparc.SPARC.*;
 
-import com.oracle.graal.api.code.*;
 import com.oracle.graal.hotspot.*;
 import com.oracle.graal.hotspot.meta.*;
 import com.oracle.graal.hotspot.stubs.*;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.hotspot.sparc/src/com/oracle/graal/hotspot/sparc/jvmci/SPARCHotSpotJVMCIBackendFactory.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,112 @@
+/*
+ * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.graal.hotspot.sparc.jvmci;
+
+import com.oracle.jvmci.code.Architecture;
+import com.oracle.jvmci.code.TargetDescription;
+import com.oracle.jvmci.code.RegisterConfig;
+import static com.oracle.jvmci.hotspot.InitTimer.*;
+
+import java.util.*;
+
+import com.oracle.graal.hotspot.*;
+import com.oracle.graal.hotspot.meta.*;
+import com.oracle.graal.hotspot.sparc.*;
+import com.oracle.graal.sparc.*;
+import com.oracle.graal.sparc.SPARC.CPUFeature;
+import com.oracle.jvmci.hotspot.*;
+import com.oracle.jvmci.runtime.*;
+
+@ServiceProvider(HotSpotJVMCIBackendFactory.class)
+public class SPARCHotSpotJVMCIBackendFactory implements HotSpotJVMCIBackendFactory {
+
+    protected Architecture createArchitecture(HotSpotVMConfig config) {
+        return new SPARC(computeFeatures(config));
+    }
+
+    protected TargetDescription createTarget(HotSpotVMConfig config) {
+        final int stackFrameAlignment = 16;
+        final int implicitNullCheckLimit = 4096;
+        final boolean inlineObjects = true;
+        return new HotSpotTargetDescription(createArchitecture(config), true, stackFrameAlignment, implicitNullCheckLimit, inlineObjects);
+    }
+
+    protected HotSpotCodeCacheProvider createCodeCache(HotSpotJVMCIRuntimeProvider runtime, TargetDescription target, RegisterConfig regConfig) {
+        return new HotSpotCodeCacheProvider(runtime, runtime.getConfig(), target, regConfig);
+    }
+
+    protected SPARCHotSpotBackend createBackend(HotSpotGraalRuntimeProvider runtime, HotSpotProviders providers) {
+        return new SPARCHotSpotBackend(runtime, providers);
+    }
+
+    protected EnumSet<CPUFeature> computeFeatures(HotSpotVMConfig config) {
+        EnumSet<CPUFeature> features = EnumSet.noneOf(CPUFeature.class);
+        if ((config.sparcFeatures & config.vis1Instructions) != 0) {
+            features.add(CPUFeature.VIS1);
+        }
+        if ((config.sparcFeatures & config.vis2Instructions) != 0) {
+            features.add(CPUFeature.VIS2);
+        }
+        if ((config.sparcFeatures & config.vis3Instructions) != 0) {
+            features.add(CPUFeature.VIS3);
+        }
+        if ((config.sparcFeatures & config.cbcondInstructions) != 0) {
+            features.add(CPUFeature.CBCOND);
+        }
+        return features;
+    }
+
+    public String getArchitecture() {
+        return "SPARC";
+    }
+
+    public String getGraalRuntimeName() {
+        return "basic";
+    }
+
+    @Override
+    public String toString() {
+        return getGraalRuntimeName() + ":" + getArchitecture();
+    }
+
+    public JVMCIBackend createJVMCIBackend(HotSpotJVMCIRuntimeProvider runtime, JVMCIBackend host) {
+        assert host == null;
+        TargetDescription target = createTarget(runtime.getConfig());
+
+        HotSpotMetaAccessProvider metaAccess = new HotSpotMetaAccessProvider(runtime);
+        RegisterConfig regConfig = new SPARCHotSpotRegisterConfig(target, runtime.getConfig());
+        HotSpotCodeCacheProvider codeCache = createCodeCache(runtime, target, regConfig);
+        HotSpotConstantReflectionProvider constantReflection = new HotSpotConstantReflectionProvider(runtime);
+        try (InitTimer rt = timer("instantiate backend")) {
+            return createBackend(metaAccess, codeCache, constantReflection);
+        }
+    }
+
+    protected JVMCIBackend createBackend(HotSpotMetaAccessProvider metaAccess, HotSpotCodeCacheProvider codeCache, HotSpotConstantReflectionProvider constantReflection) {
+        return new JVMCIBackend(metaAccess, codeCache, constantReflection);
+    }
+
+    public String getJVMCIRuntimeName() {
+        return "basic";
+    }
+}
--- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/AheadOfTimeCompilationTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/AheadOfTimeCompilationTest.java	Thu May 28 21:11:28 2015 -0700
@@ -22,32 +22,32 @@
  */
 package com.oracle.graal.hotspot.test;
 
-import static com.oracle.graal.api.code.CodeUtil.*;
 import static com.oracle.graal.compiler.GraalCompiler.*;
 import static com.oracle.graal.compiler.common.GraalOptions.*;
 import static com.oracle.graal.nodes.ConstantNode.*;
+import static com.oracle.jvmci.code.CodeUtil.*;
 
 import org.junit.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.code.CallingConvention.Type;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.api.runtime.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.compiler.test.*;
 import com.oracle.graal.graph.iterators.*;
-import com.oracle.graal.hotspot.meta.*;
 import com.oracle.graal.hotspot.nodes.type.*;
 import com.oracle.graal.lir.asm.*;
 import com.oracle.graal.lir.phases.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions;
 import com.oracle.graal.nodes.memory.*;
-import com.oracle.graal.options.*;
-import com.oracle.graal.options.OptionValue.OverrideScope;
 import com.oracle.graal.phases.*;
 import com.oracle.graal.phases.tiers.*;
 import com.oracle.graal.runtime.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.code.CallingConvention.Type;
+import com.oracle.jvmci.hotspot.*;
+import com.oracle.jvmci.meta.*;
+import com.oracle.jvmci.options.*;
+import com.oracle.jvmci.options.OptionValue.OverrideScope;
 
 /**
  * use
--- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/ArrayCopyIntrinsificationTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/ArrayCopyIntrinsificationTest.java	Thu May 28 21:11:28 2015 -0700
@@ -22,13 +22,14 @@
  */
 package com.oracle.graal.hotspot.test;
 
+import com.oracle.jvmci.code.InstalledCode;
+import com.oracle.jvmci.meta.JavaMethod;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
 import java.lang.reflect.*;
 import java.util.*;
 
 import org.junit.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.test.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.hotspot.replacements.arraycopy.*;
--- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/ClassSubstitutionsTests.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/ClassSubstitutionsTests.java	Thu May 28 21:11:28 2015 -0700
@@ -26,11 +26,11 @@
 import org.junit.*;
 
 import com.oracle.graal.compiler.test.*;
-import com.oracle.graal.debug.*;
-import com.oracle.graal.debug.Debug.Scope;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.debug.Debug.Scope;
 
 public class ClassSubstitutionsTests extends GraalCompilerTest {
 
--- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/CompressedOopTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/CompressedOopTest.java	Thu May 28 21:11:28 2015 -0700
@@ -23,14 +23,14 @@
 
 package com.oracle.graal.hotspot.test;
 
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
 import java.util.*;
 import java.util.concurrent.atomic.*;
 
 import org.junit.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.test.*;
-import com.oracle.graal.hotspot.meta.*;
+import com.oracle.jvmci.hotspot.*;
 
 /**
  * The following tests perform object/array equality and assignments in various ways. The selected
--- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/DataPatchTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/DataPatchTest.java	Thu May 28 21:11:28 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,13 +28,13 @@
 import com.oracle.graal.api.replacements.*;
 import com.oracle.graal.compiler.test.*;
 import com.oracle.graal.graph.*;
-import com.oracle.graal.hotspot.*;
 import com.oracle.graal.hotspot.nodes.*;
 import com.oracle.graal.hotspot.nodes.CompressionNode.CompressionOp;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.calc.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.hotspot.*;
 
 public class DataPatchTest extends GraalCompilerTest {
 
@@ -70,7 +70,7 @@
         test("narrowOopSnippet");
     }
 
-    private static final HotSpotVMConfig config = HotSpotGraalRuntime.runtime().getConfig();
+    private static final HotSpotVMConfig config = HotSpotJVMCIRuntime.runtime().getConfig();
     private static boolean initReplacements = false;
 
     @Before
--- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/ExplicitExceptionTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/ExplicitExceptionTest.java	Thu May 28 21:11:28 2015 -0700
@@ -22,10 +22,10 @@
  */
 package com.oracle.graal.hotspot.test;
 
+import com.oracle.jvmci.code.InstalledCode;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
 import org.junit.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.test.*;
 import com.oracle.graal.nodes.extended.*;
 
--- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/ForeignCallDeoptimizeTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/ForeignCallDeoptimizeTest.java	Thu May 28 21:11:28 2015 -0700
@@ -22,9 +22,9 @@
  */
 package com.oracle.graal.hotspot.test;
 
+import com.oracle.jvmci.meta.ForeignCallDescriptor;
 import org.junit.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.api.replacements.*;
 import com.oracle.graal.api.runtime.*;
 import com.oracle.graal.compiler.test.*;
--- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/HotSpotCryptoSubstitutionTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/HotSpotCryptoSubstitutionTest.java	Thu May 28 21:11:28 2015 -0700
@@ -22,6 +22,9 @@
  */
 package com.oracle.graal.hotspot.test;
 
+import com.oracle.jvmci.code.CompilationResult;
+import com.oracle.jvmci.code.InstalledCode;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
 import static com.oracle.graal.graphbuilderconf.IntrinsicContext.CompilationContext.*;
 
 import java.io.*;
@@ -32,16 +35,14 @@
 
 import org.junit.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.graphbuilderconf.*;
 import com.oracle.graal.graphbuilderconf.GraphBuilderConfiguration.Plugins;
-import com.oracle.graal.hotspot.*;
 import com.oracle.graal.hotspot.meta.*;
 import com.oracle.graal.java.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions;
 import com.oracle.graal.phases.*;
+import com.oracle.jvmci.hotspot.*;
 
 /**
  * Tests the intrinsification of certain crypto methods.
--- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/HotSpotMonitorValueTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/HotSpotMonitorValueTest.java	Thu May 28 21:11:28 2015 -0700
@@ -22,6 +22,11 @@
  */
 package com.oracle.graal.hotspot.test;
 
+import com.oracle.jvmci.code.StackLockValue;
+import com.oracle.jvmci.code.CompilationResult;
+import com.oracle.jvmci.code.BytecodeFrame;
+import com.oracle.jvmci.code.InstalledCode;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
 import static org.hamcrest.CoreMatchers.*;
 import static org.junit.Assert.*;
 
@@ -29,12 +34,10 @@
 
 import org.junit.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.code.CompilationResult.Call;
-import com.oracle.graal.api.code.CompilationResult.Infopoint;
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.common.*;
+import com.oracle.jvmci.code.CompilationResult.Call;
+import com.oracle.jvmci.code.CompilationResult.Infopoint;
 import com.oracle.graal.compiler.test.*;
+import com.oracle.jvmci.common.*;
 
 public class HotSpotMonitorValueTest extends GraalCompilerTest {
 
@@ -80,7 +83,7 @@
         try {
             return getMetaAccess().lookupJavaMethod(Object.class.getDeclaredMethod("wait", long.class));
         } catch (Exception e) {
-            throw new GraalInternalError("Could not find Object.wait(long): %s", e);
+            throw new JVMCIError("Could not find Object.wait(long): %s", e);
         }
     }
 
--- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/HotSpotNmethodTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/HotSpotNmethodTest.java	Thu May 28 21:11:28 2015 -0700
@@ -22,13 +22,13 @@
  */
 package com.oracle.graal.hotspot.test;
 
+import com.oracle.jvmci.code.InvalidInstalledCodeException;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
 import org.junit.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.test.*;
-import com.oracle.graal.hotspot.meta.*;
 import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions;
+import com.oracle.jvmci.hotspot.*;
 
 public class HotSpotNmethodTest extends GraalCompilerTest {
 
--- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/HotSpotResolvedJavaFieldTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/HotSpotResolvedJavaFieldTest.java	Thu May 28 21:11:28 2015 -0700
@@ -22,14 +22,14 @@
  */
 package com.oracle.graal.hotspot.test;
 
-import static com.oracle.graal.hotspot.meta.HotSpotResolvedObjectTypeImpl.*;
+import static com.oracle.jvmci.hotspot.HotSpotResolvedObjectTypeImpl.*;
 
 import java.lang.reflect.*;
 
 import org.junit.*;
 
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.hotspot.meta.*;
+import com.oracle.jvmci.hotspot.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * Tests {@link HotSpotResolvedJavaField} functionality.
--- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/HotSpotResolvedObjectTypeTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/HotSpotResolvedObjectTypeTest.java	Thu May 28 21:11:28 2015 -0700
@@ -24,7 +24,7 @@
 
 import org.junit.*;
 
-import com.oracle.graal.hotspot.meta.*;
+import com.oracle.jvmci.hotspot.*;
 
 /**
  * Tests {@link HotSpotResolvedJavaMethod} functionality.
--- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/InstalledCodeExecuteHelperTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/InstalledCodeExecuteHelperTest.java	Thu May 28 21:11:28 2015 -0700
@@ -22,16 +22,18 @@
  */
 package com.oracle.graal.hotspot.test;
 
+import com.oracle.jvmci.code.InvalidInstalledCodeException;
+import com.oracle.jvmci.meta.JavaType;
+import com.oracle.jvmci.meta.JavaConstant;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
 import static java.lang.reflect.Modifier.*;
 
 import org.junit.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.test.*;
-import com.oracle.graal.hotspot.meta.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions;
+import com.oracle.jvmci.hotspot.*;
 
 public class InstalledCodeExecuteHelperTest extends GraalCompilerTest {
 
--- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/LoadJavaMirrorWithKlassTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/LoadJavaMirrorWithKlassTest.java	Thu May 28 21:11:28 2015 -0700
@@ -22,17 +22,17 @@
  */
 package com.oracle.graal.hotspot.test;
 
+import com.oracle.jvmci.meta.Kind;
 import java.util.*;
 
 import org.junit.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.test.*;
 import com.oracle.graal.nodes.*;
-import com.oracle.graal.options.*;
-import com.oracle.graal.options.OptionValue.OverrideScope;
 import com.oracle.graal.phases.tiers.*;
+import com.oracle.jvmci.options.*;
+import com.oracle.jvmci.options.OptionValue.OverrideScope;
 
 public class LoadJavaMirrorWithKlassTest extends GraalCompilerTest {
 
--- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/MemoryUsageBenchmark.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/MemoryUsageBenchmark.java	Thu May 28 21:11:28 2015 -0700
@@ -22,20 +22,20 @@
  */
 package com.oracle.graal.hotspot.test;
 
-import static com.oracle.graal.debug.internal.MemUseTrackerImpl.*;
 import static com.oracle.graal.hotspot.CompileTheWorld.*;
 import static com.oracle.graal.hotspot.CompileTheWorld.Options.*;
 import static com.oracle.graal.nodes.StructuredGraph.*;
+import static com.oracle.jvmci.debug.internal.MemUseTrackerImpl.*;
 
 import com.oracle.graal.api.runtime.*;
 import com.oracle.graal.compiler.test.*;
-import com.oracle.graal.debug.*;
-import com.oracle.graal.debug.internal.*;
 import com.oracle.graal.hotspot.*;
 import com.oracle.graal.hotspot.CompileTheWorld.Config;
-import com.oracle.graal.hotspot.meta.*;
 import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions;
 import com.oracle.graal.printer.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.debug.internal.*;
+import com.oracle.jvmci.hotspot.*;
 
 /**
  * Used to benchmark memory usage during Graal compilation.
@@ -43,13 +43,13 @@
  * To benchmark:
  *
  * <pre>
- *     mx vm -XX:-UseGraalClassLoader -cp @com.oracle.graal.hotspot.test com.oracle.graal.hotspot.test.MemoryUsageBenchmark
+ *     mx vm -XX:-UseJVMCIClassLoader -cp @com.oracle.graal.hotspot.test com.oracle.graal.hotspot.test.MemoryUsageBenchmark
  * </pre>
  *
  * Memory analysis for a {@link CompileTheWorld} execution can also be performed. For example:
  *
  * <pre>
- *     mx --vm server vm -XX:-UseGraalClassLoader -G:CompileTheWorldClasspath=$HOME/SPECjvm2008/SPECjvm2008.jar -cp @com.oracle.graal.hotspot.test com.oracle.graal.hotspot.test.MemoryUsageBenchmark
+ *     mx --vm server vm -XX:-UseJVMCIClassLoader -G:CompileTheWorldClasspath=$HOME/SPECjvm2008/SPECjvm2008.jar -cp @com.oracle.graal.hotspot.test com.oracle.graal.hotspot.test.MemoryUsageBenchmark
  * </pre>
  */
 public class MemoryUsageBenchmark extends HotSpotGraalCompilerTest {
--- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/WriteBarrierAdditionTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/WriteBarrierAdditionTest.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,8 @@
  */
 package com.oracle.graal.hotspot.test;
 
-import static com.oracle.graal.compiler.common.UnsafeAccess.*;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
+import static com.oracle.jvmci.common.UnsafeAccess.*;
 
 import java.lang.ref.*;
 
@@ -30,26 +31,25 @@
 
 import sun.misc.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.test.*;
-import com.oracle.graal.debug.*;
-import com.oracle.graal.debug.Debug.Scope;
 import com.oracle.graal.hotspot.*;
-import com.oracle.graal.hotspot.meta.*;
 import com.oracle.graal.hotspot.nodes.*;
 import com.oracle.graal.hotspot.phases.*;
 import com.oracle.graal.hotspot.replacements.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions;
 import com.oracle.graal.nodes.extended.*;
+import com.oracle.graal.nodes.memory.HeapAccess.BarrierType;
 import com.oracle.graal.nodes.memory.*;
-import com.oracle.graal.nodes.memory.HeapAccess.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.phases.*;
 import com.oracle.graal.phases.common.*;
 import com.oracle.graal.phases.common.inlining.*;
 import com.oracle.graal.phases.common.inlining.policy.*;
 import com.oracle.graal.phases.tiers.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.debug.Debug.Scope;
+import com.oracle.jvmci.hotspot.*;
 
 /**
  * The following unit tests assert the presence of write barriers for both Serial and G1 GCs.
--- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/WriteBarrierVerificationTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/WriteBarrierVerificationTest.java	Thu May 28 21:11:28 2015 -0700
@@ -22,15 +22,12 @@
  */
 package com.oracle.graal.hotspot.test;
 
+import com.oracle.jvmci.meta.LocationIdentity;
 import java.util.*;
 
 import org.junit.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.test.*;
-import com.oracle.graal.debug.*;
-import com.oracle.graal.debug.Debug.Scope;
-import com.oracle.graal.debug.internal.*;
 import com.oracle.graal.hotspot.*;
 import com.oracle.graal.hotspot.nodes.*;
 import com.oracle.graal.hotspot.phases.*;
@@ -45,6 +42,10 @@
 import com.oracle.graal.phases.graph.*;
 import com.oracle.graal.phases.graph.ReentrantNodeIterator.NodeIteratorClosure;
 import com.oracle.graal.phases.tiers.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.debug.Debug.Scope;
+import com.oracle.jvmci.debug.internal.*;
+import com.oracle.jvmci.hotspot.*;
 
 /**
  * The following tests validate the write barrier verification phase. For every tested snippet, an
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationStatistics.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationStatistics.java	Thu May 28 21:11:28 2015 -0700
@@ -31,7 +31,7 @@
 import java.util.*;
 import java.util.concurrent.*;
 
-import com.oracle.graal.hotspot.meta.*;
+import com.oracle.jvmci.hotspot.*;
 import com.sun.management.ThreadMXBean;
 
 @SuppressWarnings("unused")
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java	Thu May 28 21:11:28 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,27 +22,20 @@
  */
 package com.oracle.graal.hotspot;
 
-import static com.oracle.graal.api.code.CallingConvention.Type.*;
-import static com.oracle.graal.api.code.CodeUtil.*;
 import static com.oracle.graal.compiler.GraalCompiler.*;
 import static com.oracle.graal.compiler.common.GraalOptions.*;
-import static com.oracle.graal.compiler.common.UnsafeAccess.*;
-import static com.oracle.graal.debug.Debug.*;
 import static com.oracle.graal.hotspot.HotSpotGraalRuntime.*;
 import static com.oracle.graal.hotspot.meta.HotSpotSuitesProvider.*;
 import static com.oracle.graal.nodes.StructuredGraph.*;
+import static com.oracle.jvmci.code.CallingConvention.Type.*;
+import static com.oracle.jvmci.code.CodeUtil.*;
+import static com.oracle.jvmci.common.UnsafeAccess.*;
+import static com.oracle.jvmci.debug.Debug.*;
 
 import java.lang.management.*;
 import java.util.concurrent.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.code.CallingConvention.Type;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.api.runtime.*;
-import com.oracle.graal.debug.*;
-import com.oracle.graal.debug.Debug.Scope;
-import com.oracle.graal.debug.internal.*;
-import com.oracle.graal.hotspot.bridge.*;
 import com.oracle.graal.hotspot.events.*;
 import com.oracle.graal.hotspot.events.EventProvider.CompilationEvent;
 import com.oracle.graal.hotspot.events.EventProvider.CompilerFailureEvent;
@@ -56,6 +49,13 @@
 import com.oracle.graal.phases.OptimisticOptimizations.Optimization;
 import com.oracle.graal.phases.tiers.*;
 import com.oracle.graal.printer.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.code.CallingConvention.Type;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.debug.Debug.Scope;
+import com.oracle.jvmci.debug.internal.*;
+import com.oracle.jvmci.hotspot.*;
+import com.oracle.jvmci.meta.*;
 
 //JaCoCo Exclude
 
@@ -286,7 +286,7 @@
             }
 
             if (graalEnv != 0) {
-                long ctask = unsafe.getAddress(graalEnv + config.graalEnvTaskOffset);
+                long ctask = unsafe.getAddress(graalEnv + config.jvmciEnvTaskOffset);
                 assert ctask != 0L;
                 unsafe.putInt(ctask + config.compileTaskNumInlinedBytecodesOffset, compiledBytecodes);
             }
@@ -309,7 +309,7 @@
         if (config.ciTime || config.ciTimeEach || CompiledBytecodes.isEnabled()) {
             return false;
         }
-        if (graalEnv == 0 || unsafe.getByte(graalEnv + config.graalEnvJvmtiCanHotswapOrPostBreakpointOffset) != 0) {
+        if (graalEnv == 0 || unsafe.getByte(graalEnv + config.jvmciEnvJvmtiCanHotswapOrPostBreakpointOffset) != 0) {
             return false;
         }
         return true;
@@ -343,11 +343,11 @@
      *
      * @param metaspaceMethod
      * @param entryBCI
-     * @param graalEnv address of native GraalEnv object
+     * @param jvmciEnv address of native GraalEnv object
      * @param id CompileTask::_compile_id
      */
     @SuppressWarnings("unused")
-    private static void compileMetaspaceMethod(long metaspaceMethod, int entryBCI, long graalEnv, int id) {
+    private static void compileMetaspaceMethod(long metaspaceMethod, int entryBCI, long jvmciEnv, int id) {
         // Ensure a Graal runtime is initialized prior to Debug being initialized as the former
         // may include processing command line options used by the latter.
         Graal.getRuntime();
@@ -358,7 +358,7 @@
         }
 
         HotSpotResolvedJavaMethod method = HotSpotResolvedJavaMethodImpl.fromMetaspace(metaspaceMethod);
-        compileMethod(method, entryBCI, graalEnv, id);
+        compileMethod(method, entryBCI, jvmciEnv, id);
     }
 
     /**
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompileTheWorld.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompileTheWorld.java	Thu May 28 21:11:28 2015 -0700
@@ -23,9 +23,9 @@
 package com.oracle.graal.hotspot;
 
 import static com.oracle.graal.compiler.common.GraalOptions.*;
-import static com.oracle.graal.debug.internal.MemUseTrackerImpl.*;
 import static com.oracle.graal.hotspot.HotSpotGraalRuntime.*;
 import static com.oracle.graal.nodes.StructuredGraph.*;
+import static com.oracle.jvmci.debug.internal.MemUseTrackerImpl.*;
 
 import java.io.*;
 import java.lang.reflect.*;
@@ -36,18 +36,18 @@
 import java.util.jar.*;
 import java.util.stream.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.bytecode.*;
 import com.oracle.graal.compiler.*;
 import com.oracle.graal.compiler.CompilerThreadFactory.DebugConfigAccess;
-import com.oracle.graal.debug.*;
-import com.oracle.graal.debug.internal.*;
-import com.oracle.graal.hotspot.meta.*;
-import com.oracle.graal.options.*;
-import com.oracle.graal.options.OptionUtils.OptionConsumer;
-import com.oracle.graal.options.OptionValue.OverrideScope;
 import com.oracle.graal.printer.*;
 import com.oracle.graal.replacements.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.debug.internal.*;
+import com.oracle.jvmci.hotspot.*;
+import com.oracle.jvmci.meta.*;
+import com.oracle.jvmci.options.*;
+import com.oracle.jvmci.options.OptionUtils.OptionConsumer;
+import com.oracle.jvmci.options.OptionValue.OverrideScope;
 
 /**
  * This class implements compile-the-world functionality in Graal.
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/DebugValuesPrinter.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/DebugValuesPrinter.java	Thu May 28 21:11:28 2015 -0700
@@ -29,9 +29,9 @@
 import java.util.regex.*;
 import java.util.stream.*;
 
-import com.oracle.graal.compiler.common.*;
-import com.oracle.graal.debug.*;
-import com.oracle.graal.debug.internal.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.debug.internal.*;
 
 /**
  * Facility for printing the {@linkplain KeyRegistry#getDebugValues() values} collected across all
@@ -39,7 +39,7 @@
  */
 public class DebugValuesPrinter {
 
-    public void printDebugValues() throws GraalInternalError {
+    public void printDebugValues() throws JVMCIError {
         TTY.println();
         TTY.println("<DebugValues>");
         List<DebugValueMap> topLevelMaps = DebugValueMap.getTopLevelMaps();
@@ -91,7 +91,7 @@
                         }
                         break;
                     default:
-                        throw new GraalInternalError("Unknown summary type: %s", summary);
+                        throw new JVMCIError("Unknown summary type: %s", summary);
                 }
                 for (DebugValueMap topLevelMap : topLevelMaps) {
                     topLevelMap.reset();
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotBackend.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotBackend.java	Thu May 28 21:11:28 2015 -0700
@@ -26,9 +26,6 @@
 
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.code.stack.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.cfg.*;
 import com.oracle.graal.compiler.target.*;
 import com.oracle.graal.hotspot.meta.*;
@@ -43,9 +40,13 @@
 import com.oracle.graal.lir.asm.*;
 import com.oracle.graal.lir.framemap.*;
 import com.oracle.graal.nodes.*;
-import com.oracle.graal.options.*;
 import com.oracle.graal.phases.tiers.*;
 import com.oracle.graal.word.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.code.stack.*;
+import com.oracle.jvmci.hotspot.*;
+import com.oracle.jvmci.meta.*;
+import com.oracle.jvmci.options.*;
 
 /**
  * HotSpot specific backend.
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotBackendFactory.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotBackendFactory.java	Thu May 28 21:11:28 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,12 +22,12 @@
  */
 package com.oracle.graal.hotspot;
 
-import com.oracle.graal.api.runtime.*;
-import com.oracle.graal.hotspot.HotSpotGraalRuntime.Options;
+import com.oracle.jvmci.hotspot.HotSpotJVMCIRuntime.Options;
+import com.oracle.jvmci.runtime.*;
 
 public interface HotSpotBackendFactory extends Service {
 
-    HotSpotBackend createBackend(HotSpotGraalRuntimeProvider runtime, HotSpotBackend host);
+    HotSpotBackend createBackend(HotSpotGraalRuntimeProvider runtime, JVMCIBackend jvmciBackend, HotSpotBackend host);
 
     /**
      * Gets the CPU architecture of this backend.
@@ -35,7 +35,7 @@
     String getArchitecture();
 
     /**
-     * Gets the name of the {@link Options#GraalRuntime GraalRuntime} in which the backend created
+     * Gets the name of the {@link Options#JVMCIRuntime JVMCIRuntime} in which the backend created
      * by this factory should be used.
      */
     String getGraalRuntimeName();
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotCompiledCode.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,172 +0,0 @@
-/*
- * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.hotspot;
-
-import java.nio.*;
-import java.util.*;
-import java.util.stream.*;
-import java.util.stream.Stream.Builder;
-
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.code.CompilationResult.CodeAnnotation;
-import com.oracle.graal.api.code.CompilationResult.CodeComment;
-import com.oracle.graal.api.code.CompilationResult.DataPatch;
-import com.oracle.graal.api.code.CompilationResult.ExceptionHandler;
-import com.oracle.graal.api.code.CompilationResult.Infopoint;
-import com.oracle.graal.api.code.CompilationResult.JumpTable;
-import com.oracle.graal.api.code.CompilationResult.Mark;
-import com.oracle.graal.api.code.CompilationResult.Site;
-import com.oracle.graal.api.meta.Assumptions.Assumption;
-import com.oracle.graal.api.meta.*;
-
-/**
- * A {@link CompilationResult} with additional HotSpot-specific information required for installing
- * the code in HotSpot's code cache.
- */
-public abstract class HotSpotCompiledCode {
-
-    public final Site[] sites;
-    public final ExceptionHandler[] exceptionHandlers;
-    public final Comment[] comments;
-    public final Assumption[] assumptions;
-
-    public final byte[] targetCode;
-    public final int targetCodeSize;
-
-    public final byte[] dataSection;
-    public final int dataSectionAlignment;
-    public final DataPatch[] dataSectionPatches;
-
-    public final int totalFrameSize;
-    public final int customStackAreaOffset;
-
-    /**
-     * The list of the methods whose bytecodes were used as input to the compilation. If
-     * {@code null}, then the compilation did not record method dependencies. Otherwise, the first
-     * element of this array is the root method of the compilation.
-     */
-    public final ResolvedJavaMethod[] methods;
-
-    public static class Comment {
-
-        public final String text;
-        public final int pcOffset;
-
-        public Comment(int pcOffset, String text) {
-            this.text = text;
-            this.pcOffset = pcOffset;
-        }
-    }
-
-    public HotSpotCompiledCode(CompilationResult compResult) {
-        sites = getSortedSites(compResult);
-        if (compResult.getExceptionHandlers().isEmpty()) {
-            exceptionHandlers = null;
-        } else {
-            exceptionHandlers = compResult.getExceptionHandlers().toArray(new ExceptionHandler[compResult.getExceptionHandlers().size()]);
-        }
-        List<CodeAnnotation> annotations = compResult.getAnnotations();
-        comments = new Comment[annotations.size()];
-        if (!annotations.isEmpty()) {
-            for (int i = 0; i < comments.length; i++) {
-                CodeAnnotation annotation = annotations.get(i);
-                String text;
-                if (annotation instanceof CodeComment) {
-                    CodeComment codeComment = (CodeComment) annotation;
-                    text = codeComment.value;
-                } else if (annotation instanceof JumpTable) {
-                    JumpTable jumpTable = (JumpTable) annotation;
-                    text = "JumpTable [" + jumpTable.low + " .. " + jumpTable.high + "]";
-                } else {
-                    text = annotation.toString();
-                }
-                comments[i] = new Comment(annotation.position, text);
-            }
-        }
-        assumptions = compResult.getAssumptions();
-        assert validateFrames();
-
-        targetCode = compResult.getTargetCode();
-        targetCodeSize = compResult.getTargetCodeSize();
-
-        DataSection data = compResult.getDataSection();
-        data.finalizeLayout();
-        dataSection = new byte[data.getSectionSize()];
-
-        ByteBuffer buffer = ByteBuffer.wrap(dataSection).order(ByteOrder.nativeOrder());
-        Builder<DataPatch> patchBuilder = Stream.builder();
-        data.buildDataSection(buffer, patchBuilder);
-
-        dataSectionAlignment = data.getSectionAlignment();
-        dataSectionPatches = patchBuilder.build().toArray(len -> new DataPatch[len]);
-
-        totalFrameSize = compResult.getTotalFrameSize();
-        customStackAreaOffset = compResult.getCustomStackAreaOffset();
-
-        methods = compResult.getMethods();
-    }
-
-    /**
-     * Ensure that all the frames passed into HotSpot are properly formatted with an empty or
-     * illegal slot following double word slots.
-     */
-    private boolean validateFrames() {
-        for (Site site : sites) {
-            if (site instanceof Infopoint) {
-                Infopoint info = (Infopoint) site;
-                if (info.debugInfo != null) {
-                    BytecodeFrame frame = info.debugInfo.frame();
-                    assert frame == null || frame.validateFormat(false);
-                }
-            }
-        }
-        return true;
-    }
-
-    static class SiteComparator implements Comparator<Site> {
-
-        public int compare(Site s1, Site s2) {
-            if (s1.pcOffset == s2.pcOffset && (s1 instanceof Mark ^ s2 instanceof Mark)) {
-                return s1 instanceof Mark ? -1 : 1;
-            }
-            return s1.pcOffset - s2.pcOffset;
-        }
-    }
-
-    private static Site[] getSortedSites(CompilationResult target) {
-        List<?>[] lists = new List<?>[]{target.getInfopoints(), target.getDataPatches(), target.getMarks()};
-        int count = 0;
-        for (List<?> list : lists) {
-            count += list.size();
-        }
-        Site[] result = new Site[count];
-        int pos = 0;
-        for (List<?> list : lists) {
-            for (Object elem : list) {
-                result[pos++] = (Site) elem;
-            }
-        }
-        Arrays.sort(result, new SiteComparator());
-        return result;
-    }
-}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotCompiledNmethod.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +0,0 @@
-/*
- * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.hotspot;
-
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.hotspot.meta.*;
-
-import edu.umd.cs.findbugs.annotations.*;
-
-/**
- * {@link HotSpotCompiledCode} destined for installation as an nmethod.
- */
-public final class HotSpotCompiledNmethod extends HotSpotCompiledCode {
-
-    public final HotSpotResolvedJavaMethod method;
-    public final int entryBCI;
-    public final int id;
-    public final long graalEnv;
-
-    /**
-     * May be set by VM if code installation fails. It will describe in more detail why installation
-     * failed (e.g., exactly which dependency failed).
-     */
-    @SuppressFBWarnings("UWF_UNWRITTEN_FIELD") private String installationFailureMessage;
-
-    public HotSpotCompiledNmethod(HotSpotResolvedJavaMethod method, CompilationResult compResult) {
-        this(method, compResult, 0L);
-    }
-
-    public HotSpotCompiledNmethod(HotSpotResolvedJavaMethod method, CompilationResult compResult, long graalEnv) {
-        super(compResult);
-        this.method = method;
-        this.entryBCI = compResult.getEntryBCI();
-        this.id = compResult.getId();
-        this.graalEnv = graalEnv;
-    }
-
-    @Override
-    public String toString() {
-        return getClass().getSimpleName() + "[" + id + ":" + method.format("%H.%n(%p)%r@") + entryBCI + "]";
-    }
-
-    public String getInstallationFailureMessage() {
-        return installationFailureMessage;
-    }
-}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotCompiledRuntimeStub.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotCompiledRuntimeStub.java	Thu May 28 21:11:28 2015 -0700
@@ -24,24 +24,20 @@
 
 import static com.oracle.graal.hotspot.HotSpotHostBackend.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.code.CompilationResult.Call;
-import com.oracle.graal.api.code.CompilationResult.ConstantReference;
-import com.oracle.graal.api.code.CompilationResult.DataPatch;
-import com.oracle.graal.api.code.CompilationResult.Infopoint;
-import com.oracle.graal.hotspot.meta.*;
-import com.oracle.graal.hotspot.stubs.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.code.CompilationResult.Call;
+import com.oracle.jvmci.code.CompilationResult.ConstantReference;
+import com.oracle.jvmci.code.CompilationResult.DataPatch;
+import com.oracle.jvmci.code.CompilationResult.Infopoint;
+import com.oracle.jvmci.hotspot.*;
 
 /**
  * {@link HotSpotCompiledCode} destined for installation as a RuntimeStub.
  */
 public final class HotSpotCompiledRuntimeStub extends HotSpotCompiledCode {
 
-    public final String stubName;
-
-    public HotSpotCompiledRuntimeStub(Stub stub, CompilationResult compResult) {
+    public HotSpotCompiledRuntimeStub(CompilationResult compResult) {
         super(compResult);
-        this.stubName = stub.toString();
         assert checkStubInvariants(compResult);
     }
 
@@ -83,6 +79,6 @@
 
     @Override
     public String toString() {
-        return stubName != null ? stubName : super.toString();
+        return name;
     }
 }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotCounterOp.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotCounterOp.java	Thu May 28 21:11:28 2015 -0700
@@ -22,17 +22,21 @@
  */
 package com.oracle.graal.hotspot;
 
-import static com.oracle.graal.api.code.ValueUtil.*;
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.code.TargetDescription;
+import com.oracle.jvmci.meta.JavaConstant;
+import com.oracle.jvmci.meta.Value;
+import com.oracle.jvmci.meta.Kind;
+import static com.oracle.jvmci.code.ValueUtil.*;
 
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.asm.*;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.hotspot.debug.*;
 import com.oracle.graal.hotspot.meta.*;
 import com.oracle.graal.lir.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.hotspot.*;
 
 public abstract class HotSpotCounterOp extends LIRInstruction {
     public static final LIRInstructionClass<HotSpotCounterOp> TYPE = LIRInstructionClass.create(HotSpotCounterOp.class);
@@ -63,7 +67,7 @@
     protected static int getDisplacementForLongIndex(TargetDescription target, long index) {
         long finalDisp = index * target.getSizeInBytes(Kind.Long);
         if (!NumUtil.isInt(finalDisp)) {
-            throw GraalInternalError.unimplemented("cannot deal with indices that big: " + index);
+            throw JVMCIError.unimplemented("cannot deal with indices that big: " + index);
         }
         return (int) finalDisp;
     }
@@ -126,7 +130,7 @@
      * @param increment
      */
     public void patchCounterIncrement(Assembler asm, int[] increment) {
-        throw GraalInternalError.unimplemented();
+        throw JVMCIError.unimplemented();
     }
 
     private static long asLong(JavaConstant value) {
@@ -147,7 +151,7 @@
     protected static int asInt(JavaConstant value) {
         long l = asLong(value);
         if (!NumUtil.isInt(l)) {
-            throw GraalInternalError.shouldNotReachHere("value does not fit into int: " + l);
+            throw JVMCIError.shouldNotReachHere("value does not fit into int: " + l);
         }
         return (int) l;
     }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotDebugInfoBuilder.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotDebugInfoBuilder.java	Thu May 28 21:11:28 2015 -0700
@@ -22,14 +22,16 @@
  */
 package com.oracle.graal.hotspot;
 
-import static com.oracle.graal.api.code.BytecodeFrame.*;
-
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.common.*;
+import com.oracle.jvmci.code.StackSlotValue;
+import com.oracle.jvmci.code.StackLockValue;
+import com.oracle.jvmci.code.BytecodeFrame;
+import com.oracle.jvmci.code.VirtualObject;
+import com.oracle.jvmci.meta.Value;
+import static com.oracle.jvmci.code.BytecodeFrame.*;
 import com.oracle.graal.compiler.gen.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.*;
+import com.oracle.jvmci.common.*;
 
 /**
  * Extends {@link DebugInfoBuilder} to allocate the extra debug information required for locks.
@@ -65,7 +67,7 @@
     protected BytecodeFrame computeFrameForState(FrameState state) {
         if (isPlaceholderBci(state.bci) && state.bci != BytecodeFrame.BEFORE_BCI) {
             // This is really a hard error since an incorrect state could crash hotspot
-            throw GraalInternalError.shouldNotReachHere("Invalid state " + BytecodeFrame.getPlaceholderBciName(state.bci) + " " + state);
+            throw JVMCIError.shouldNotReachHere("Invalid state " + BytecodeFrame.getPlaceholderBciName(state.bci) + " " + state);
         }
         return super.computeFrameForState(state);
     }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotForeignCallLinkage.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotForeignCallLinkage.java	Thu May 28 21:11:28 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,8 +22,12 @@
  */
 package com.oracle.graal.hotspot;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.code.ForeignCallLinkage;
+import com.oracle.jvmci.code.CallingConvention;
+import com.oracle.jvmci.meta.Value;
+import com.oracle.jvmci.meta.LocationIdentity;
+import com.oracle.jvmci.meta.InvokeTarget;
+import com.oracle.jvmci.meta.ForeignCallDescriptor;
 import com.oracle.graal.compiler.target.*;
 import com.oracle.graal.hotspot.stubs.*;
 
@@ -94,7 +98,8 @@
 
     boolean needsJavaFrameAnchor();
 
-    CompilationResult getStubCompilationResult(final Backend backend);
-
-    Stub getStub();
+    /**
+     * Gets the VM symbol associated with the target {@linkplain #getAddress() address} of the call.
+     */
+    String getSymbol();
 }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotForeignCallLinkageImpl.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotForeignCallLinkageImpl.java	Thu May 28 21:11:28 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,33 +22,34 @@
  */
 package com.oracle.graal.hotspot;
 
+import com.oracle.jvmci.code.CodeCacheProvider;
+import com.oracle.jvmci.code.RegisterConfig;
+import com.oracle.jvmci.code.InstalledCode;
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.code.CallingConvention;
+import com.oracle.jvmci.code.TargetDescription;
+import com.oracle.jvmci.meta.JavaType;
+import com.oracle.jvmci.meta.MetaAccessProvider;
+import com.oracle.jvmci.meta.Value;
+import com.oracle.jvmci.meta.LocationIdentity;
+import com.oracle.jvmci.meta.AllocatableValue;
+import com.oracle.jvmci.meta.ForeignCallDescriptor;
 import static com.oracle.graal.hotspot.HotSpotForeignCallLinkage.RegisterEffect.*;
 import static com.oracle.graal.hotspot.HotSpotGraalRuntime.*;
 
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.code.CallingConvention.Type;
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.code.CallingConvention.Type;
 import com.oracle.graal.compiler.target.*;
 import com.oracle.graal.hotspot.meta.*;
 import com.oracle.graal.hotspot.stubs.*;
 import com.oracle.graal.word.*;
+import com.oracle.jvmci.hotspot.*;
 
 /**
  * The details required to link a HotSpot runtime or stub call.
  */
-public class HotSpotForeignCallLinkageImpl implements HotSpotForeignCallLinkage, HotSpotProxified {
-
-    /**
-     * The descriptor of the call.
-     */
-    private final ForeignCallDescriptor descriptor;
-
-    /**
-     * The entry point address of this call's target.
-     */
-    private long address;
+public class HotSpotForeignCallLinkageImpl extends HotSpotForeignCallTarget implements HotSpotForeignCallLinkage, HotSpotProxified {
 
     /**
      * Non-null (eventually) iff this is a call to a compiled {@linkplain Stub stub}.
@@ -134,10 +135,10 @@
 
     public HotSpotForeignCallLinkageImpl(ForeignCallDescriptor descriptor, long address, RegisterEffect effect, Transition transition, CallingConvention outgoingCallingConvention,
                     CallingConvention incomingCallingConvention, boolean reexecutable, LocationIdentity... killedLocations) {
+        super(descriptor, address);
         this.address = address;
         this.effect = effect;
         this.transition = transition;
-        this.descriptor = descriptor;
         this.outgoingCallingConvention = outgoingCallingConvention;
         this.incomingCallingConvention = incomingCallingConvention;
         this.reexecutable = reexecutable;
@@ -243,11 +244,7 @@
         return canDeoptimize() || transition == Transition.LEAF_SP;
     }
 
-    public CompilationResult getStubCompilationResult(final Backend backend) {
-        return stub.getCompilationResult(backend);
-    }
-
-    public Stub getStub() {
-        return stub;
+    public String getSymbol() {
+        return stub == null ? null : stub.toString();
     }
 }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java	Thu May 28 21:11:28 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,36 +24,33 @@
 
 import static com.oracle.graal.compiler.GraalDebugConfig.*;
 import static com.oracle.graal.compiler.common.GraalOptions.*;
-import static com.oracle.graal.compiler.common.UnsafeAccess.*;
-import static com.oracle.graal.hotspot.CompileTheWorld.Options.*;
 import static com.oracle.graal.hotspot.HotSpotGraalRuntime.Options.*;
-import static com.oracle.graal.hotspot.InitTimer.*;
+import static com.oracle.jvmci.common.UnsafeAccess.*;
+import static com.oracle.jvmci.hotspot.InitTimer.*;
 
 import java.lang.reflect.*;
 import java.util.*;
 
-import sun.misc.*;
-
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.code.stack.*;
 import com.oracle.graal.api.collections.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.api.replacements.*;
 import com.oracle.graal.api.runtime.*;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.target.*;
-import com.oracle.graal.debug.*;
 import com.oracle.graal.graph.*;
-import com.oracle.graal.hotspot.CompileTheWorld.Config;
-import com.oracle.graal.hotspot.bridge.*;
 import com.oracle.graal.hotspot.debug.*;
 import com.oracle.graal.hotspot.events.*;
-import com.oracle.graal.hotspot.logging.*;
 import com.oracle.graal.hotspot.meta.*;
-import com.oracle.graal.options.*;
 import com.oracle.graal.printer.*;
 import com.oracle.graal.replacements.*;
 import com.oracle.graal.runtime.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.code.stack.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.hotspot.*;
+import com.oracle.jvmci.hotspot.logging.*;
+import com.oracle.jvmci.meta.*;
+import com.oracle.jvmci.options.*;
+import com.oracle.jvmci.runtime.*;
 
 //JaCoCo Exclude
 
@@ -65,13 +62,15 @@
     private static final HotSpotGraalRuntime instance;
 
     static {
-        try (InitTimer t = timer("HotSpotGraalRuntime.<init>")) {
-            instance = new HotSpotGraalRuntime();
-        }
+        try (InitTimer t0 = timer("HotSpotGraalRuntime.<clinit>")) {
+            try (InitTimer t = timer("HotSpotGraalRuntime.<init>")) {
+                instance = new HotSpotGraalRuntime();
+            }
 
-        try (InitTimer t = timer("HotSpotGraalRuntime.completeInitialization")) {
-            // Why deferred initialization? See comment in completeInitialization().
-            instance.completeInitialization();
+            try (InitTimer t = timer("HotSpotGraalRuntime.completeInitialization")) {
+                // Why deferred initialization? See comment in completeInitialization().
+                instance.completeInitialization();
+            }
         }
     }
 
@@ -83,86 +82,20 @@
         return instance;
     }
 
-    /**
-     * Do deferred initialization.
-     */
-    public void completeInitialization() {
-        TTY.initialize(Options.LogFile.getStream(compilerToVm));
-
-        // Proxies for the VM/Compiler interfaces cannot be initialized
-        // in the constructor as proxy creation causes static
-        // initializers to be executed for all the types involved in the
-        // proxied methods. Some of these static initializers (e.g. in
-        // HotSpotMethodData) rely on the static 'instance' field being set
-        // to retrieve configuration details.
-        CompilerToVM toVM = this.compilerToVm;
-
-        if (CountingProxy.ENABLED) {
-            toVM = CountingProxy.getProxy(CompilerToVM.class, toVM);
-        }
-        if (Logger.ENABLED) {
-            toVM = LoggingProxy.getProxy(CompilerToVM.class, toVM);
-        }
-
-        this.compilerToVm = toVM;
-
-        if (Log.getValue() == null && !areScopedMetricsOrTimersEnabled() && Dump.getValue() == null && Verify.getValue() == null) {
-            if (MethodFilter.getValue() != null) {
-                TTY.println("WARNING: Ignoring MethodFilter option since Log, Meter, Time, TrackMemUse, Dump and Verify options are all null");
-            }
-        }
-
-        if (Debug.isEnabled()) {
-            DebugEnvironment.initialize(TTY.cachedOut);
-
-            String summary = DebugValueSummary.getValue();
-            if (summary != null) {
-                switch (summary) {
-                    case "Name":
-                    case "Partial":
-                    case "Complete":
-                    case "Thread":
-                        break;
-                    default:
-                        throw new GraalInternalError("Unsupported value for DebugSummaryValue: %s", summary);
-                }
-            }
-        }
-
-        if (Debug.areUnconditionalMetricsEnabled() || Debug.areUnconditionalTimersEnabled() || (Debug.isEnabled() && areScopedMetricsOrTimersEnabled())) {
-            // This must be created here to avoid loading the DebugValuesPrinter class
-            // during shutdown() which in turn can cause a deadlock
-            debugValuesPrinter = new DebugValuesPrinter();
-        }
-
-        // Complete initialization of backends
-        try (InitTimer st = timer(hostBackend.getTarget().arch.getName(), ".completeInitialization")) {
-            hostBackend.completeInitialization();
-        }
-        for (HotSpotBackend backend : backends.values()) {
-            if (backend != hostBackend) {
-                try (InitTimer st = timer(backend.getTarget().arch.getName(), ".completeInitialization")) {
-                    backend.completeInitialization();
-                }
-            }
-        }
-
-        BenchmarkCounters.initialize(toVM);
-
-        assert checkArrayIndexScaleInvariants();
-
-        runtimeStartTime = System.nanoTime();
+    @Override
+    public HotSpotJVMCIRuntimeProvider getJVMCIRuntime() {
+        return jvmciRuntime;
     }
 
     private boolean checkArrayIndexScaleInvariants() {
-        assert getArrayIndexScale(Kind.Byte) == 1;
-        assert getArrayIndexScale(Kind.Boolean) == 1;
-        assert getArrayIndexScale(Kind.Char) == 2;
-        assert getArrayIndexScale(Kind.Short) == 2;
-        assert getArrayIndexScale(Kind.Int) == 4;
-        assert getArrayIndexScale(Kind.Long) == 8;
-        assert getArrayIndexScale(Kind.Float) == 4;
-        assert getArrayIndexScale(Kind.Double) == 8;
+        assert getJVMCIRuntime().getArrayIndexScale(Kind.Byte) == 1;
+        assert getJVMCIRuntime().getArrayIndexScale(Kind.Boolean) == 1;
+        assert getJVMCIRuntime().getArrayIndexScale(Kind.Char) == 2;
+        assert getJVMCIRuntime().getArrayIndexScale(Kind.Short) == 2;
+        assert getJVMCIRuntime().getArrayIndexScale(Kind.Int) == 4;
+        assert getJVMCIRuntime().getArrayIndexScale(Kind.Long) == 8;
+        assert getJVMCIRuntime().getArrayIndexScale(Kind.Float) == 4;
+        assert getJVMCIRuntime().getArrayIndexScale(Kind.Double) == 8;
         return true;
     }
 
@@ -171,9 +104,6 @@
         // @formatter:off
         @Option(help = "The runtime configuration to use", type = OptionType.Expert)
         static final OptionValue<String> GraalRuntime = new OptionValue<>("");
-
-        @Option(help = "File to which logging is sent.  A %p in the name will be replaced with a string identifying the process, usually the process id.", type = OptionType.Expert)
-        public static final PrintStreamOption LogFile = new PrintStreamOption();
         // @formatter:on
     }
 
@@ -183,6 +113,8 @@
         HotSpotBackendFactory nonBasic = null;
         int nonBasicCount = 0;
 
+        assert GraalRuntime.getValue().equals(HotSpotJVMCIRuntime.Options.JVMCIRuntime.getValue());
+
         for (HotSpotBackendFactory factory : Services.load(HotSpotBackendFactory.class)) {
             if (factory.getArchitecture().equalsIgnoreCase(architecture)) {
                 if (factory.getGraalRuntimeName().equals(GraalRuntime.getValue())) {
@@ -205,7 +137,7 @@
             if (!GraalRuntime.getValue().equals("")) {
                 // Fail fast if a non-default value for GraalRuntime was specified
                 // and the corresponding factory is not available
-                throw new GraalInternalError("Specified runtime \"%s\" not available for the %s architecture", GraalRuntime.getValue(), architecture);
+                throw new JVMCIError("Specified runtime \"%s\" not available for the %s architecture", GraalRuntime.getValue(), architecture);
             } else if (nonBasicCount == 1) {
                 // If there is exactly one non-basic runtime, select this one.
                 return nonBasic;
@@ -251,9 +183,6 @@
         return unsafe.getInt(object, offset) & 0xFFFFFFFFL;
     }
 
-    protected/* final */CompilerToVM compilerToVm;
-
-    protected final HotSpotVMConfig config;
     private final HotSpotBackend hostBackend;
     private DebugValuesPrinter debugValuesPrinter;
 
@@ -276,13 +205,13 @@
 
     private final Map<Class<? extends Architecture>, HotSpotBackend> backends = new HashMap<>();
 
+    private final HotSpotJVMCIRuntime jvmciRuntime;
+
     private HotSpotGraalRuntime() {
-        CompilerToVM toVM = new CompilerToVMImpl();
-        compilerToVm = toVM;
-        try (InitTimer t = timer("HotSpotVMConfig<init>")) {
-            config = new HotSpotVMConfig(compilerToVm);
-        }
 
+        jvmciRuntime = (HotSpotJVMCIRuntime) JVMCI.getRuntime();
+
+        HotSpotVMConfig config = getConfig();
         CompileTheWorld.Options.overrideWithNativeOptions(config);
 
         // Only set HotSpotPrintInlining if it still has its default value (false).
@@ -301,19 +230,19 @@
             factory = findFactory(hostArchitecture);
         }
         try (InitTimer t = timer("create backend:", hostArchitecture)) {
-            hostBackend = registerBackend(factory.createBackend(this, null));
+            hostBackend = registerBackend(factory.createBackend(this, jvmciRuntime.getHostJVMCIBackend(), null));
         }
 
-        String[] gpuArchitectures = getGPUArchitectureNames(compilerToVm);
+        String[] gpuArchitectures = getGPUArchitectureNames(getCompilerToVM());
         for (String arch : gpuArchitectures) {
             try (InitTimer t = timer("find factory:", arch)) {
                 factory = findFactory(arch);
             }
             if (factory == null) {
-                throw new GraalInternalError("No backend available for specified GPU architecture \"%s\"", arch);
+                throw new JVMCIError("No backend available for specified GPU architecture \"%s\"", arch);
             }
             try (InitTimer t = timer("create backend:", arch)) {
-                registerBackend(factory.createBackend(this, hostBackend));
+                registerBackend(factory.createBackend(this, null, hostBackend));
             }
         }
 
@@ -322,6 +251,59 @@
         }
     }
 
+    /**
+     * Do deferred initialization.
+     */
+    private void completeInitialization() {
+
+        if (Log.getValue() == null && !areScopedMetricsOrTimersEnabled() && Dump.getValue() == null && Verify.getValue() == null) {
+            if (MethodFilter.getValue() != null) {
+                TTY.println("WARNING: Ignoring MethodFilter option since Log, Meter, Time, TrackMemUse, Dump and Verify options are all null");
+            }
+        }
+
+        if (Debug.isEnabled()) {
+            DebugEnvironment.initialize(TTY.cachedOut);
+
+            String summary = DebugValueSummary.getValue();
+            if (summary != null) {
+                switch (summary) {
+                    case "Name":
+                    case "Partial":
+                    case "Complete":
+                    case "Thread":
+                        break;
+                    default:
+                        throw new JVMCIError("Unsupported value for DebugSummaryValue: %s", summary);
+                }
+            }
+        }
+
+        if (Debug.areUnconditionalMetricsEnabled() || Debug.areUnconditionalTimersEnabled() || (Debug.isEnabled() && areScopedMetricsOrTimersEnabled())) {
+            // This must be created here to avoid loading the DebugValuesPrinter class
+            // during shutdown() which in turn can cause a deadlock
+            debugValuesPrinter = new DebugValuesPrinter();
+        }
+
+        // Complete initialization of backends
+        try (InitTimer st = timer(hostBackend.getTarget().arch.getName(), ".completeInitialization")) {
+            hostBackend.completeInitialization();
+        }
+        for (HotSpotBackend backend : backends.values()) {
+            if (backend != hostBackend) {
+                try (InitTimer st = timer(backend.getTarget().arch.getName(), ".completeInitialization")) {
+                    backend.completeInitialization();
+                }
+            }
+        }
+
+        BenchmarkCounters.initialize(getCompilerToVM());
+
+        assert checkArrayIndexScaleInvariants();
+
+        runtimeStartTime = System.nanoTime();
+    }
+
     private HotSpotBackend registerBackend(HotSpotBackend backend) {
         Class<? extends Architecture> arch = backend.getTarget().arch.getClass();
         HotSpotBackend oldValue = backends.put(arch, backend);
@@ -361,37 +343,6 @@
         }
     }
 
-    public HotSpotVMConfig getConfig() {
-        return config;
-    }
-
-    public TargetDescription getTarget() {
-        return hostBackend.getTarget();
-    }
-
-    public CompilerToVM getCompilerToVM() {
-        return compilerToVm;
-    }
-
-    public JavaType lookupType(String name, HotSpotResolvedObjectType accessingType, boolean resolve) {
-        Objects.requireNonNull(accessingType, "cannot resolve type without an accessing class");
-        // If the name represents a primitive type we can short-circuit the lookup.
-        if (name.length() == 1) {
-            Kind kind = Kind.fromPrimitiveOrVoidTypeChar(name.charAt(0));
-            return fromClass(kind.toJavaClass());
-        }
-
-        // Resolve non-primitive types in the VM.
-        HotSpotResolvedObjectTypeImpl hsAccessingType = (HotSpotResolvedObjectTypeImpl) accessingType;
-        final long metaspaceKlass = compilerToVm.lookupType(name, hsAccessingType.mirror(), resolve);
-
-        if (metaspaceKlass == 0L) {
-            assert resolve == false;
-            return HotSpotUnresolvedJavaType.create(this, name);
-        }
-        return HotSpotResolvedObjectTypeImpl.fromMetaspaceKlass(metaspaceKlass);
-    }
-
     public HotSpotProviders getHostProviders() {
         return getHostBackend().getProviders();
     }
@@ -406,7 +357,7 @@
     private final EventProvider eventProvider;
 
     private EventProvider createEventProvider() {
-        if (config.flightRecorder) {
+        if (getConfig().flightRecorder) {
             Iterable<EventProvider> sl = Services.load(EventProvider.class);
             EventProvider singleProvider = null;
             for (EventProvider ep : sl) {
@@ -449,68 +400,19 @@
         return Collections.unmodifiableMap(backends);
     }
 
-    public int getArrayBaseOffset(Kind kind) {
-        switch (kind) {
-            case Boolean:
-                return Unsafe.ARRAY_BOOLEAN_BASE_OFFSET;
-            case Byte:
-                return Unsafe.ARRAY_BYTE_BASE_OFFSET;
-            case Char:
-                return Unsafe.ARRAY_CHAR_BASE_OFFSET;
-            case Short:
-                return Unsafe.ARRAY_SHORT_BASE_OFFSET;
-            case Int:
-                return Unsafe.ARRAY_INT_BASE_OFFSET;
-            case Long:
-                return Unsafe.ARRAY_LONG_BASE_OFFSET;
-            case Float:
-                return Unsafe.ARRAY_FLOAT_BASE_OFFSET;
-            case Double:
-                return Unsafe.ARRAY_DOUBLE_BASE_OFFSET;
-            case Object:
-                return Unsafe.ARRAY_OBJECT_BASE_OFFSET;
-            default:
-                throw GraalInternalError.shouldNotReachHere();
-        }
-    }
-
-    public int getArrayIndexScale(Kind kind) {
-        switch (kind) {
-            case Boolean:
-                return Unsafe.ARRAY_BOOLEAN_INDEX_SCALE;
-            case Byte:
-                return Unsafe.ARRAY_BYTE_INDEX_SCALE;
-            case Char:
-                return Unsafe.ARRAY_CHAR_INDEX_SCALE;
-            case Short:
-                return Unsafe.ARRAY_SHORT_INDEX_SCALE;
-            case Int:
-                return Unsafe.ARRAY_INT_INDEX_SCALE;
-            case Long:
-                return Unsafe.ARRAY_LONG_INDEX_SCALE;
-            case Float:
-                return Unsafe.ARRAY_FLOAT_INDEX_SCALE;
-            case Double:
-                return Unsafe.ARRAY_DOUBLE_INDEX_SCALE;
-            case Object:
-                return Unsafe.ARRAY_OBJECT_INDEX_SCALE;
-            default:
-                throw GraalInternalError.shouldNotReachHere();
-        }
-    }
-
     @Override
     public <T> T iterateFrames(ResolvedJavaMethod[] initialMethods, ResolvedJavaMethod[] matchingMethods, int initialSkip, InspectedFrameVisitor<T> visitor) {
         final long[] initialMetaMethods = toMeta(initialMethods);
         final long[] matchingMetaMethods = toMeta(matchingMethods);
 
-        HotSpotStackFrameReference current = compilerToVm.getNextStackFrame(null, initialMetaMethods, initialSkip);
+        CompilerToVM compilerToVM = getCompilerToVM();
+        HotSpotStackFrameReference current = compilerToVM.getNextStackFrame(null, initialMetaMethods, initialSkip);
         while (current != null) {
             T result = visitor.visitFrame(current);
             if (result != null) {
                 return result;
             }
-            current = compilerToVm.getNextStackFrame(current, matchingMetaMethods, 0);
+            current = compilerToVM.getNextStackFrame(current, matchingMetaMethods, 0);
         }
         return null;
     }
@@ -538,29 +440,7 @@
         CompilationStatistics.clear(phase);
     }
 
-    /**
-     * Called from the VM.
-     */
-    @SuppressWarnings("unused")
-    private void compileTheWorld() throws Throwable {
-        int iterations = CompileTheWorld.Options.CompileTheWorldIterations.getValue();
-        for (int i = 0; i < iterations; i++) {
-            getCompilerToVM().resetCompilationStatistics();
-            TTY.println("CompileTheWorld : iteration " + i);
-            CompileTheWorld ctw = new CompileTheWorld(CompileTheWorldClasspath.getValue(), new Config(CompileTheWorldConfig.getValue()), CompileTheWorldStartAt.getValue(),
-                            CompileTheWorldStopAt.getValue(), CompileTheWorldMethodFilter.getValue(), CompileTheWorldExcludeMethodFilter.getValue(), CompileTheWorldVerbose.getValue());
-            ctw.compile();
-        }
-        System.exit(0);
-    }
-
-    /**
-     * Shuts down the runtime.
-     *
-     * Called from the VM.
-     */
-    @SuppressWarnings("unused")
-    private void shutdown() throws Exception {
+    void shutdown() {
         if (debugValuesPrinter != null) {
             debugValuesPrinter.printDebugValues();
         }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntimeFactory.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.graal.hotspot;
+
+import com.oracle.graal.api.runtime.*;
+import com.oracle.jvmci.runtime.*;
+
+@ServiceProvider(GraalRuntimeFactory.class)
+public class HotSpotGraalRuntimeFactory implements GraalRuntimeFactory {
+
+    @Override
+    public GraalRuntime getRuntime() {
+        return HotSpotGraalRuntime.runtime();
+    }
+}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntimeProvider.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntimeProvider.java	Thu May 28 21:11:28 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,13 +22,13 @@
  */
 package com.oracle.graal.hotspot;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.code.stack.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.api.runtime.*;
-import com.oracle.graal.hotspot.bridge.*;
 import com.oracle.graal.hotspot.meta.*;
 import com.oracle.graal.runtime.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.code.stack.*;
+import com.oracle.jvmci.hotspot.*;
+import com.oracle.jvmci.meta.*;
 
 //JaCoCo Exclude
 
@@ -37,11 +37,19 @@
  */
 public interface HotSpotGraalRuntimeProvider extends GraalRuntime, RuntimeProvider, StackIntrospection {
 
-    HotSpotVMConfig getConfig();
+    HotSpotJVMCIRuntimeProvider getJVMCIRuntime();
+
+    default HotSpotVMConfig getConfig() {
+        return getJVMCIRuntime().getConfig();
+    }
 
-    TargetDescription getTarget();
+    default TargetDescription getTarget() {
+        return getHostBackend().getTarget();
+    }
 
-    CompilerToVM getCompilerToVM();
+    default CompilerToVM getCompilerToVM() {
+        return getJVMCIRuntime().getCompilerToVM();
+    }
 
     /**
      * Converts a name to a Java type. This method attempts to resolve {@code name} to a
@@ -56,7 +64,9 @@
      * @throws LinkageError if {@code resolve == true} and the resolution failed
      * @throws NullPointerException if {@code accessingClass} is {@code null}
      */
-    JavaType lookupType(String name, HotSpotResolvedObjectType accessingType, boolean resolve);
+    default JavaType lookupType(String name, HotSpotResolvedObjectType accessingType, boolean resolve) {
+        return getJVMCIRuntime().lookupType(name, accessingType, resolve);
+    }
 
     HotSpotProviders getHostProviders();
 
@@ -67,20 +77,6 @@
     HotSpotBackend getHostBackend();
 
     /**
-     * The offset from the origin of an array to the first element.
-     *
-     * @return the offset in bytes
-     */
-    int getArrayBaseOffset(Kind kind);
-
-    /**
-     * The scale used for the index when accessing elements of an array of this kind.
-     *
-     * @return the scale in order to convert the index into a byte offset
-     */
-    int getArrayIndexScale(Kind kind);
-
-    /**
      * Gets the Graal mirror for a {@link Class} object.
      *
      * @return the {@link ResolvedJavaType} corresponding to {@code javaClass}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalVMEventListener.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.graal.hotspot;
+
+import static com.oracle.graal.hotspot.CompileTheWorld.Options.*;
+
+import com.oracle.graal.hotspot.CompileTheWorld.Config;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.hotspot.*;
+import com.oracle.jvmci.runtime.*;
+
+@ServiceProvider(HotSpotVMEventListener.class)
+public class HotSpotGraalVMEventListener implements HotSpotVMEventListener {
+
+    @Override
+    public void notifyCompileTheWorld() throws Throwable {
+        CompilerToVM compilerToVM = HotSpotGraalRuntime.runtime().getJVMCIRuntime().getCompilerToVM();
+        int iterations = CompileTheWorld.Options.CompileTheWorldIterations.getValue();
+        for (int i = 0; i < iterations; i++) {
+            compilerToVM.resetCompilationStatistics();
+            TTY.println("CompileTheWorld : iteration " + i);
+            CompileTheWorld ctw = new CompileTheWorld(CompileTheWorldClasspath.getValue(), new Config(CompileTheWorldConfig.getValue()), CompileTheWorldStartAt.getValue(),
+                            CompileTheWorldStopAt.getValue(), CompileTheWorldMethodFilter.getValue(), CompileTheWorldExcludeMethodFilter.getValue(), CompileTheWorldVerbose.getValue());
+            ctw.compile();
+        }
+        System.exit(0);
+    }
+
+    @Override
+    public void notifyShutdown() {
+        HotSpotGraalRuntime.runtime().shutdown();
+    }
+}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotHostBackend.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotHostBackend.java	Thu May 28 21:11:28 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,16 +22,18 @@
  */
 package com.oracle.graal.hotspot;
 
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
+import com.oracle.jvmci.meta.ForeignCallDescriptor;
 import static com.oracle.graal.compiler.common.GraalOptions.*;
-import static com.oracle.graal.hotspot.InitTimer.*;
+import static com.oracle.jvmci.hotspot.InitTimer.*;
 
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.api.runtime.*;
-import com.oracle.graal.debug.*;
-import com.oracle.graal.debug.Debug.Scope;
 import com.oracle.graal.hotspot.meta.*;
 import com.oracle.graal.hotspot.stubs.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.debug.Debug.Scope;
+import com.oracle.jvmci.hotspot.*;
+import com.oracle.jvmci.runtime.*;
 
 /**
  * Common functionality of HotSpot host backends.
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotInstructionProfiling.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotInstructionProfiling.java	Thu May 28 21:11:28 2015 -0700
@@ -22,12 +22,13 @@
  */
 package com.oracle.graal.hotspot;
 
+import com.oracle.jvmci.code.TargetDescription;
+import com.oracle.jvmci.meta.JavaConstant;
+import com.oracle.jvmci.meta.Value;
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.asm.*;
-import com.oracle.graal.asm.Assembler.*;
+import com.oracle.graal.asm.Assembler.InstructionCounter;
 import com.oracle.graal.compiler.common.cfg.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.StandardOp.BlockEndOp;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotLIRGenerator.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotLIRGenerator.java	Thu May 28 21:11:28 2015 -0700
@@ -22,14 +22,16 @@
  */
 package com.oracle.graal.hotspot;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.common.*;
-import com.oracle.graal.hotspot.HotSpotVMConfig.CompressEncoding;
+import com.oracle.jvmci.code.StackSlotValue;
+import com.oracle.jvmci.meta.DeoptimizationReason;
+import com.oracle.jvmci.meta.Value;
+import com.oracle.jvmci.meta.DeoptimizationAction;
 import com.oracle.graal.hotspot.meta.*;
 import com.oracle.graal.hotspot.nodes.*;
 import com.oracle.graal.lir.StandardOp.SaveRegistersOp;
 import com.oracle.graal.lir.gen.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.hotspot.HotSpotVMConfig.CompressEncoding;
 
 /**
  * This interface defines the contract a HotSpot backend LIR generator needs to fulfill in addition
@@ -60,7 +62,7 @@
      * @param saveRegisterOp saved registers
      */
     default void emitLeaveCurrentStackFrame(SaveRegistersOp saveRegisterOp) {
-        throw GraalInternalError.unimplemented();
+        throw JVMCIError.unimplemented();
     }
 
     /**
@@ -70,7 +72,7 @@
      * @param initialInfo
      */
     default void emitLeaveDeoptimizedStackFrame(Value frameSize, Value initialInfo) {
-        throw GraalInternalError.unimplemented();
+        throw JVMCIError.unimplemented();
     }
 
     /**
@@ -82,7 +84,7 @@
      * @param saveRegisterOp
      */
     default void emitEnterUnpackFramesStackFrame(Value framePc, Value senderSp, Value senderFp, SaveRegistersOp saveRegisterOp) {
-        throw GraalInternalError.unimplemented();
+        throw JVMCIError.unimplemented();
     }
 
     /**
@@ -91,7 +93,7 @@
      * @param saveRegisterOp
      */
     default void emitLeaveUnpackFramesStackFrame(SaveRegistersOp saveRegisterOp) {
-        throw GraalInternalError.unimplemented();
+        throw JVMCIError.unimplemented();
     }
 
     /**
@@ -103,7 +105,7 @@
      * @param initialInfo
      */
     default void emitPushInterpreterFrame(Value frameSize, Value framePc, Value senderSp, Value initialInfo) {
-        throw GraalInternalError.unimplemented();
+        throw JVMCIError.unimplemented();
     }
 
     /**
@@ -114,7 +116,7 @@
      * @return a {@code Deoptimization::UnrollBlock} pointer
      */
     default Value emitUncommonTrapCall(Value trapRequest, SaveRegistersOp saveRegisterOp) {
-        throw GraalInternalError.unimplemented();
+        throw JVMCIError.unimplemented();
     }
 
     /**
@@ -124,15 +126,15 @@
      * @return a {@code Deoptimization::UnrollBlock} pointer
      */
     default Value emitDeoptimizationFetchUnrollInfoCall(SaveRegistersOp saveRegisterOp) {
-        throw GraalInternalError.unimplemented();
+        throw JVMCIError.unimplemented();
     }
 
     default Value emitCardTableShift() {
-        throw GraalInternalError.unimplemented();
+        throw JVMCIError.unimplemented();
     }
 
     default Value emitCardTableAddress() {
-        throw GraalInternalError.unimplemented();
+        throw JVMCIError.unimplemented();
     }
 
     /**
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotLockStack.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotLockStack.java	Thu May 28 21:11:28 2015 -0700
@@ -22,10 +22,10 @@
  */
 package com.oracle.graal.hotspot;
 
+import com.oracle.jvmci.code.StackSlotValue;
+import com.oracle.jvmci.meta.LIRKind;
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.lir.framemap.*;
 
 /**
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotOptions.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +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.graal.hotspot;
-
-import static com.oracle.graal.compiler.GraalDebugConfig.*;
-import static com.oracle.graal.options.OptionsLoader.*;
-
-import com.oracle.graal.api.runtime.*;
-import com.oracle.graal.debug.*;
-import com.oracle.graal.options.*;
-
-//JaCoCo Exclude
-
-/**
- * Sets Graal options from the HotSpot command line. Such options are distinguished by the
- * {@link #GRAAL_OPTION_PREFIX} prefix.
- */
-public class HotSpotOptions {
-
-    private static final String GRAAL_OPTION_PREFIX = "-G:";
-
-    static {
-        assert !Debug.Initialization.isDebugInitialized() : "The class " + Debug.class.getName() + " must not be initialized before the Graal runtime has been initialized. " +
-                        "This can be fixed by placing a call to " + Graal.class.getName() + ".runtime() on the path that triggers initialization of " + Debug.class.getName();
-        if (areDebugScopePatternsEnabled()) {
-            System.setProperty(Debug.Initialization.INITIALIZER_PROPERTY_NAME, "true");
-        }
-        if ("".equals(Meter.getValue())) {
-            System.setProperty(Debug.ENABLE_UNSCOPED_METRICS_PROPERTY_NAME, "true");
-        }
-        if ("".equals(Time.getValue())) {
-            System.setProperty(Debug.ENABLE_UNSCOPED_TIMERS_PROPERTY_NAME, "true");
-        }
-        if ("".equals(TrackMemUse.getValue())) {
-            System.setProperty(Debug.ENABLE_UNSCOPED_MEM_USE_TRACKERS_PROPERTY_NAME, "true");
-        }
-    }
-
-    static void printFlags() {
-        OptionUtils.printFlags(options, GRAAL_OPTION_PREFIX);
-    }
-
-    public native Object getOptionValue(String optionName);
-}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotProxified.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.hotspot;
-
-/**
- * Marker interface for classes whose values are proxied during replay compilation capture.
- */
-public interface HotSpotProxified {
-}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotReferenceMap.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,509 +0,0 @@
-/*
- * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.hotspot;
-
-import java.util.*;
-
-import com.oracle.graal.api.code.CodeUtil.RefMapFormatter;
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
-
-public final class HotSpotReferenceMap extends ReferenceMap {
-
-    static final int OOP64 = 0b1010;
-    static final int OOP32 = 0b01;
-    static final int NARROW_LOW = OOP32;
-    static final int NARROW_HIGH = OOP32 << 2;
-    static final int NARROW_BOTH = NARROW_LOW | NARROW_HIGH;
-
-    private enum MapEntry {
-        NoReference(0),
-        WideOop(OOP64),
-        NarrowOopLowerHalf(NARROW_LOW),
-        NarrowOopUpperHalf(NARROW_HIGH),
-        TwoNarrowOops(NARROW_BOTH),
-        Illegal(-1);
-
-        MapEntry(int pattern) {
-            this.pattern = pattern;
-        }
-
-        final int pattern;
-
-        /**
-         * Create enum values from OopMap.
-         * <p>
-         * These bits can have the following values (MSB first):
-         *
-         * <pre>
-         * 0000 - contains no references
-         * 1010 - contains a wide oop
-         * 0001 - contains a narrow oop in the lower half
-         * 0101 - contains a narrow oop in the upper half
-         * 0101 - contains two narrow oops
-         * </pre>
-         *
-         * @see HotSpotReferenceMap#registerRefMap
-         * @see HotSpotReferenceMap#frameRefMap
-         */
-        static MapEntry getFromBits(int idx, HotSpotOopMap set) {
-            int n = set.get(idx);
-            switch (n) {
-                case 0:
-                    return NoReference;
-                case OOP64:
-                    return WideOop;
-                case NARROW_LOW:
-                    return NarrowOopLowerHalf;
-                case NARROW_HIGH:
-                    return NarrowOopUpperHalf;
-                case NARROW_BOTH:
-                    return TwoNarrowOops;
-                default:
-                    return Illegal;
-            }
-        }
-
-        String toBitString() {
-            int bits = toBit(this);
-            if (bits == -1) {
-                return "---";
-            }
-            return String.format("%3s", Integer.toBinaryString(bits)).replace(' ', '0');
-        }
-
-        static int toBit(MapEntry type) {
-            return type.pattern;
-        }
-    }
-
-    /**
-     * A specialized bit set that represents both wide and narrow oops in an efficient manner. The
-     * map consists of 4 bit entries that represent 8 bytes of memory.
-     *
-     */
-    class HotSpotOopMap implements Cloneable {
-
-        /**
-         * Each entry is 4 bits long and covers 8 bytes of memory.
-         */
-        private static final int BITS_PER_ENTRY = 4;
-        private static final int BITS_PER_ELEMENT = 64;
-
-        public HotSpotOopMap(int i) {
-            words = new long[(i * BITS_PER_ENTRY + BITS_PER_ELEMENT) / BITS_PER_ELEMENT];
-        }
-
-        public HotSpotOopMap(HotSpotOopMap other) {
-            words = other.words.clone();
-        }
-
-        private long[] words;
-
-        private int get(int i) {
-            return getEntry(i);
-        }
-
-        public void or(HotSpotOopMap src) {
-            if (words.length < src.words.length) {
-                long[] newWords = new long[src.words.length];
-                System.arraycopy(src.words, 0, newWords, 0, src.words.length);
-                for (int i = 0; i < words.length; i++) {
-                    newWords[i] |= words[i];
-                }
-                words = newWords;
-            } else {
-                for (int i = 0; i < src.words.length; i++) {
-                    words[i] |= src.words[i];
-                }
-            }
-        }
-
-        private void setOop(int regIdx) {
-            setEntry(regIdx, OOP64);
-        }
-
-        public int size() {
-            return words.length * BITS_PER_ELEMENT / BITS_PER_ENTRY;
-        }
-
-        @Override
-        public HotSpotOopMap clone() {
-            return new HotSpotOopMap(this);
-        }
-
-        private void setNarrowOop(int offset) {
-            setNarrowEntry(offset, OOP32);
-        }
-
-        private void setEntry(int regIdx, int value) {
-            assert regIdx % 2 == 0 : "must be alinged";
-            int bitIndex = (regIdx >> 1) * BITS_PER_ENTRY;
-            int wordIndex = bitIndex / BITS_PER_ELEMENT;
-            int shift = bitIndex - wordIndex * BITS_PER_ELEMENT;
-            if (wordIndex >= words.length) {
-                if (value == 0) {
-                    // Nothing to do since bits are clear
-                    return;
-                }
-                words = Arrays.copyOf(words, wordIndex + 1);
-            }
-            assert verifyUpdate(this, this);
-            long orig = words[wordIndex];
-            words[wordIndex] = (orig & (~(0b1111L << shift))) | ((long) value << shift);
-            assert get(regIdx / 2) == value;
-            assert verifyUpdate(this, this);
-        }
-
-        private void setNarrowEntry(int offset, int value) {
-            int regIdx = offset >> 1;
-            boolean low = offset % 2 == 0;
-            int bitIndex = regIdx * BITS_PER_ENTRY;
-            int wordIndex = bitIndex / BITS_PER_ELEMENT;
-            int shift = bitIndex - wordIndex * BITS_PER_ELEMENT;
-            if (wordIndex >= words.length) {
-                if (value == 0) {
-                    // Nothing to do since bits are clear
-                    return;
-                }
-                words = Arrays.copyOf(words, wordIndex + 1);
-            }
-            long originalValue = words[wordIndex];
-            int current = ((int) (originalValue >> shift)) & 0b1111;
-            if (current == OOP64) {
-                current = 0;
-            }
-            long newValue;
-            if (value != 0) {
-                newValue = current | (low ? value : (value << 2));
-            } else {
-                newValue = current & (low ? 0b1100 : 0b0011);
-            }
-            long masked = originalValue & (~(0b1111L << shift));
-            words[wordIndex] = masked | (newValue << shift);
-            assert verifyUpdate(this, this);
-        }
-
-        private int getEntry(int regIdx) {
-            int bitIndex = regIdx * BITS_PER_ENTRY;
-            int wordIndex = bitIndex / BITS_PER_ELEMENT;
-            int shift = bitIndex - wordIndex * BITS_PER_ELEMENT;
-            return ((int) (words[wordIndex] >>> shift)) & 0b1111;
-        }
-
-        @Override
-        public boolean equals(Object other) {
-            if (this == other) {
-                return true;
-            }
-
-            if (other instanceof HotSpotOopMap) {
-                HotSpotOopMap otherMap = (HotSpotOopMap) other;
-                int limit = Math.min(words.length, otherMap.words.length);
-                for (int i = 0; i < limit; i++) {
-                    if (words[i] != otherMap.words[i]) {
-                        return false;
-                    }
-                }
-                for (int i = limit; i < words.length; i++) {
-                    if (words[i] != 0) {
-                        return false;
-                    }
-                }
-                for (int i = limit; i < otherMap.words.length; i++) {
-                    if (otherMap.words[i] != 0) {
-                        return false;
-                    }
-                }
-                return true;
-            }
-            return false;
-        }
-
-        @Override
-        public int hashCode() {
-            long h = 1234;
-            for (int i = words.length; --i >= 0;) {
-                h ^= words[i] * (i + 1);
-            }
-            return (int) ((h >> 32) ^ h);
-        }
-
-        @Override
-        public String toString() {
-            int count = 0;
-            StringBuilder sb = new StringBuilder();
-            sb.append("[");
-            for (int idx = 0; idx < size(); idx++) {
-                MapEntry dstType = MapEntry.getFromBits(idx, this);
-                if (dstType == MapEntry.NoReference) {
-                    continue;
-                }
-                if (count > 0) {
-                    sb.append(", ");
-                }
-                if (dstType == MapEntry.Illegal) {
-                    int value = get(idx);
-                    sb.append("0x");
-                    sb.append(Integer.toHexString(value));
-                } else {
-                    sb.append(idx);
-                    sb.append(':');
-                    sb.append(dstType);
-                }
-                count++;
-            }
-            sb.append("]");
-            return sb.toString();
-        }
-    }
-
-    /**
-     * Contains 3 bits per scalar register, and n*3 bits per n-word vector register (e.g., on a
-     * 64-bit system, a 256-bit vector register requires 12 reference map bits).
-     * <p>
-     * These bits can have the following values (LSB first):
-     *
-     * <pre>
-     * 000 - contains no references
-     * 100 - contains a wide oop
-     * 110 - contains a narrow oop in the lower half
-     * 101 - contains a narrow oop in the upper half
-     * 111 - contains two narrow oops
-     * </pre>
-     */
-    private final HotSpotOopMap registerRefMap;
-
-    /**
-     * Contains 3 bits per stack word.
-     * <p>
-     * These bits can have the following values (LSB first):
-     *
-     * <pre>
-     * 000 - contains no references
-     * 100 - contains a wide oop
-     * 110 - contains a narrow oop in the lower half
-     * 101 - contains a narrow oop in the upper half
-     * 111 - contains two narrow oops
-     * </pre>
-     */
-    private final HotSpotOopMap frameRefMap;
-
-    private final TargetDescription target;
-
-    public HotSpotReferenceMap(int registerCount, int frameSlotCount, TargetDescription target) {
-        if (registerCount > 0) {
-            this.registerRefMap = new HotSpotOopMap(registerCount);
-        } else {
-            this.registerRefMap = null;
-        }
-        this.frameRefMap = new HotSpotOopMap(frameSlotCount);
-        this.target = target;
-    }
-
-    private HotSpotReferenceMap(HotSpotReferenceMap other) {
-        this.registerRefMap = other.registerRefMap.clone();
-        this.frameRefMap = other.frameRefMap.clone();
-        this.target = other.target;
-    }
-
-    @Override
-    public ReferenceMap clone() {
-        return new HotSpotReferenceMap(this);
-    }
-
-    // setters
-    @Override
-    public void setRegister(int idx, LIRKind kind) {
-        set(registerRefMap, idx * 2, kind);
-    }
-
-    @Override
-    public void setStackSlot(int offset, LIRKind kind) {
-        assert offset % bytesPerElement(kind) == 0 : "unaligned value in ReferenceMap";
-        set(frameRefMap, offset / 4, kind);
-    }
-
-    private void set(HotSpotOopMap refMap, int index, LIRKind kind) {
-        if (kind.isDerivedReference()) {
-            throw new InternalError("derived reference cannot be inserted in ReferenceMap");
-        }
-
-        int bytesPerElement = bytesPerElement(kind);
-        int length = kind.getPlatformKind().getVectorLength();
-        if (bytesPerElement == 8) {
-            for (int i = 0; i < length; i++) {
-                if (kind.isReference(i)) {
-                    refMap.setOop(index + i * 2);
-                }
-            }
-        } else if (bytesPerElement == 4) {
-            for (int i = 0; i < length; i++) {
-                if (kind.isReference(i)) {
-                    refMap.setNarrowOop(index + i);
-                }
-            }
-        } else {
-            assert kind.isValue() : "unknown reference kind " + kind;
-        }
-    }
-
-    private int bytesPerElement(LIRKind kind) {
-        PlatformKind platformKind = kind.getPlatformKind();
-        return target.getSizeInBytes(platformKind) / platformKind.getVectorLength();
-    }
-
-    public HotSpotOopMap getFrameMap() {
-        return frameRefMap == null ? null : (HotSpotOopMap) frameRefMap.clone();
-    }
-
-    public HotSpotOopMap getRegisterMap() {
-        return registerRefMap == null ? null : (HotSpotOopMap) registerRefMap.clone();
-    }
-
-    static MapEntry[] entries(HotSpotOopMap fixedMap) {
-        MapEntry[] result = new MapEntry[fixedMap.size()];
-        for (int idx = 0; idx < fixedMap.size(); idx++) {
-            MapEntry dstType = MapEntry.getFromBits(idx, fixedMap);
-            result[idx] = dstType;
-        }
-        return result;
-    }
-
-    private static boolean verifyUpdate(HotSpotOopMap dst, HotSpotOopMap src) {
-        return verifyUpdate(dst, src, true);
-    }
-
-    private static boolean verifyUpdate(HotSpotOopMap dst, HotSpotOopMap src, boolean doAssert) {
-        for (int idx = 0; idx < Math.min(src.size(), dst.size()); idx++) {
-            if (!verifyUpdateEntry(idx, dst, src, doAssert)) {
-                return false;
-            }
-        }
-        return true;
-    }
-
-    private static boolean verifyUpdateEntry(int idx, HotSpotOopMap dst, HotSpotOopMap src, boolean doAssert) {
-        MapEntry dstType = MapEntry.getFromBits(idx, dst);
-        MapEntry srcType = MapEntry.getFromBits(idx, src);
-
-        if (dstType == MapEntry.Illegal || srcType == MapEntry.Illegal) {
-            assert !doAssert : String.format("Illegal RefMap bit pattern: %s (0b%s), %s (0b%s)", dstType, dstType.toBitString(), srcType, srcType.toBitString());
-            return false;
-        }
-        switch (dstType) {
-            case NoReference:
-                return true;
-            case WideOop:
-                switch (srcType) {
-                    case NoReference:
-                    case WideOop:
-                        return true;
-                    default:
-                        assert false : String.format("Illegal RefMap combination: %s (0b%s), %s (0b%s)", dstType, dstType.toBitString(), srcType, srcType.toBitString());
-                        return false;
-                }
-            case TwoNarrowOops:
-            case NarrowOopLowerHalf:
-            case NarrowOopUpperHalf:
-                switch (srcType) {
-                    case TwoNarrowOops:
-                    case NarrowOopLowerHalf:
-                    case NarrowOopUpperHalf:
-                    case NoReference:
-                        return true;
-                    default:
-                        assert false : String.format("Illegal RefMap combination: %s (0b%s), %s (0b%s)", dstType, dstType.toBitString(), srcType, srcType.toBitString());
-                        return false;
-                }
-            default:
-                return false;
-        }
-    }
-
-    @Override
-    public int hashCode() {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj instanceof HotSpotReferenceMap) {
-            HotSpotReferenceMap that = (HotSpotReferenceMap) obj;
-            if (this.frameRefMap.equals(that.frameRefMap) && Objects.equals(this.registerRefMap, that.registerRefMap) && this.target.equals(that.target)) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    @Override
-    public boolean hasRegisterRefMap() {
-        return registerRefMap != null && registerRefMap.size() > 0;
-    }
-
-    @Override
-    public boolean hasFrameRefMap() {
-        return frameRefMap != null && frameRefMap.size() > 0;
-    }
-
-    @Override
-    public void appendRegisterMap(StringBuilder sb, RefMapFormatter formatter) {
-        for (int idx = 0; idx < registerRefMap.size(); idx++) {
-            MapEntry dstType = MapEntry.getFromBits(idx, registerRefMap);
-            if (dstType != MapEntry.NoReference) {
-                sb.append(' ').append(formatter.formatRegister(idx)).append(':').append(dstType);
-            }
-        }
-    }
-
-    @Override
-    public void appendFrameMap(StringBuilder sb, RefMapFormatter formatter) {
-        for (int idx = 0; idx < frameRefMap.size(); idx++) {
-            MapEntry dstType = MapEntry.getFromBits(idx, frameRefMap);
-            if (dstType != MapEntry.NoReference) {
-                sb.append(' ').append(formatter.formatStackSlot(idx)).append(':').append(dstType);
-            }
-        }
-    }
-
-    @Override
-    public String toString() {
-        StringBuilder sb = new StringBuilder();
-        if (registerRefMap != null) {
-            sb.append("Registers = ");
-            sb.append(registerRefMap);
-        }
-        sb.append("Stack = ");
-        sb.append(frameRefMap);
-        return sb.toString();
-    }
-
-    public void verify() {
-        assert verifyUpdate(frameRefMap, frameRefMap);
-        assert registerRefMap == null || verifyUpdate(registerRefMap, registerRefMap);
-    }
-}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotReplacementsImpl.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotReplacementsImpl.java	Thu May 28 21:11:28 2015 -0700
@@ -22,14 +22,15 @@
  */
 package com.oracle.graal.hotspot;
 
+import com.oracle.jvmci.code.TargetDescription;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
 import java.lang.reflect.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.api.replacements.*;
 import com.oracle.graal.hotspot.word.*;
 import com.oracle.graal.phases.util.*;
 import com.oracle.graal.replacements.*;
+import com.oracle.jvmci.hotspot.*;
 
 /**
  * Filters certain method substitutions based on whether there is underlying hardware support for
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotStackFrameReference.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,94 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.hotspot;
-
-import java.util.*;
-
-import com.oracle.graal.api.code.stack.*;
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.hotspot.bridge.*;
-import com.oracle.graal.hotspot.meta.*;
-
-public class HotSpotStackFrameReference implements InspectedFrame {
-
-    private CompilerToVM compilerToVM;
-
-    // information used to find the stack frame
-    private long stackPointer;
-    private int frameNumber;
-
-    // information about the stack frame's contents
-    private int bci;
-    private long metaspaceMethod;
-    private Object[] locals;
-    private boolean[] localIsVirtual;
-
-    public long getStackPointer() {
-        return stackPointer;
-    }
-
-    public int getFrameNumber() {
-        return frameNumber;
-    }
-
-    @Override
-    public Object getLocal(int index) {
-        return locals[index];
-    }
-
-    @Override
-    public boolean isVirtual(int index) {
-        return localIsVirtual == null ? false : localIsVirtual[index];
-    }
-
-    @Override
-    public void materializeVirtualObjects(boolean invalidateCode) {
-        compilerToVM.materializeVirtualObjects(this, invalidateCode);
-    }
-
-    @Override
-    public int getBytecodeIndex() {
-        return bci;
-    }
-
-    @Override
-    public ResolvedJavaMethod getMethod() {
-        return HotSpotResolvedJavaMethodImpl.fromMetaspace(metaspaceMethod);
-    }
-
-    @Override
-    public boolean isMethod(ResolvedJavaMethod method) {
-        return metaspaceMethod == ((HotSpotResolvedJavaMethodImpl) method).getMetaspaceMethod();
-    }
-
-    @Override
-    public boolean hasVirtualObjects() {
-        return localIsVirtual != null;
-    }
-
-    @Override
-    public String toString() {
-        return "HotSpotStackFrameReference [stackPointer=" + stackPointer + ", frameNumber=" + frameNumber + ", bci=" + bci + ", method=" + getMethod() + ", locals=" + Arrays.toString(locals) +
-                        ", localIsVirtual=" + Arrays.toString(localIsVirtual) + "]";
-    }
-}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotTargetDescription.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotTargetDescription.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,10 @@
  */
 package com.oracle.graal.hotspot;
 
-import com.oracle.graal.api.code.*;
+import com.oracle.jvmci.code.TargetDescription;
+import com.oracle.jvmci.code.Architecture;
+import com.oracle.jvmci.code.ReferenceMap;
+import com.oracle.jvmci.hotspot.*;
 
 public class HotSpotTargetDescription extends TargetDescription {
 
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConfig.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1688 +0,0 @@
-/*
- * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.hotspot;
-
-import static com.oracle.graal.compiler.common.UnsafeAccess.*;
-
-import java.lang.reflect.*;
-import java.util.*;
-
-import com.oracle.graal.compiler.common.*;
-import com.oracle.graal.hotspot.bridge.*;
-import com.oracle.graal.hotspot.meta.*;
-import com.oracle.graal.hotspotvmconfig.*;
-
-//JaCoCo Exclude
-
-/**
- * Used to access native configuration details.
- *
- * All non-static, public fields in this class are so that they can be compiled as constants.
- */
-public class HotSpotVMConfig {
-
-    /**
-     * Determines if the current architecture is included in a given architecture set specification.
-     *
-     * @param currentArch
-     * @param archsSpecification specifies a set of architectures. A zero length value implies all
-     *            architectures.
-     */
-    private static boolean isRequired(String currentArch, String[] archsSpecification) {
-        if (archsSpecification.length == 0) {
-            return true;
-        }
-        for (String arch : archsSpecification) {
-            if (arch.equals(currentArch)) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    /**
-     * Maximum allowed size of allocated area for a frame.
-     */
-    public final int maxFrameSize = 16 * 1024;
-
-    @Override
-    public String toString() {
-        return getClass().getSimpleName();
-    }
-
-    HotSpotVMConfig(CompilerToVM compilerToVm) {
-        compilerToVm.initializeConfiguration(this);
-        assert verifyInitialization();
-
-        oopEncoding = new CompressEncoding(narrowOopBase, narrowOopShift, logMinObjAlignment());
-        klassEncoding = new CompressEncoding(narrowKlassBase, narrowKlassShift, logKlassAlignment);
-
-        codeCacheLowBoundary = unsafe.getAddress(codeCacheHeap + codeHeapMemoryOffset + virtualSpaceLowBoundaryOffset);
-        codeCacheHighBoundary = unsafe.getAddress(codeCacheHeap + codeHeapMemoryOffset + virtualSpaceHighBoundaryOffset);
-
-        final long barrierSetAddress = unsafe.getAddress(universeCollectedHeap + collectedHeapBarrierSetOffset);
-        final int kind = unsafe.getInt(barrierSetAddress + barrierSetKindOffset);
-        if ((kind == barrierSetCardTableModRef) || (kind == barrierSetCardTableExtension) || (kind == barrierSetG1SATBCT) || (kind == barrierSetG1SATBCTLogging)) {
-            final long base = unsafe.getAddress(barrierSetAddress + cardTableModRefBSByteMapBaseOffset);
-            assert base != 0 : "unexpected byte_map_base: " + base;
-            cardtableStartAddress = base;
-            cardtableShift = cardTableModRefBSCardShift;
-        } else if ((kind == barrierSetModRef) || (kind == barrierSetOther)) {
-            // No post barriers
-            cardtableStartAddress = 0;
-            cardtableShift = 0;
-        } else {
-            cardtableStartAddress = -1;
-            cardtableShift = -1;
-        }
-
-        inlineCacheMissStub = inlineCacheMissBlob + unsafe.getInt(inlineCacheMissBlob + codeBlobCodeOffsetOffset);
-
-        assert check();
-        assert HotSpotVMConfigVerifier.check();
-    }
-
-    /**
-     * Check that the initialization produces the same result as the values captured through
-     * vmStructs.
-     */
-    private boolean verifyInitialization() {
-        /** These fields are set in {@link CompilerToVM#initializeConfiguration}. */
-        assert gHotSpotVMStructs != 0;
-        assert gHotSpotVMTypes != 0;
-        assert gHotSpotVMIntConstants != 0;
-        assert gHotSpotVMLongConstants != 0;
-
-        // Fill the VM fields hash map.
-        HashMap<String, VMFields.Field> vmFields = new HashMap<>();
-        for (VMFields.Field e : new VMFields(gHotSpotVMStructs)) {
-            vmFields.put(e.getName(), e);
-        }
-
-        // Fill the VM types hash map.
-        HashMap<String, VMTypes.Type> vmTypes = new HashMap<>();
-        for (VMTypes.Type e : new VMTypes(gHotSpotVMTypes)) {
-            vmTypes.put(e.getTypeName(), e);
-        }
-
-        // Fill the VM constants hash map.
-        HashMap<String, AbstractConstant> vmConstants = new HashMap<>();
-        for (AbstractConstant e : new VMIntConstants(gHotSpotVMIntConstants)) {
-            vmConstants.put(e.getName(), e);
-        }
-        for (AbstractConstant e : new VMLongConstants(gHotSpotVMLongConstants)) {
-            vmConstants.put(e.getName(), e);
-        }
-
-        // Fill the flags hash map.
-        HashMap<String, Flags.Flag> flags = new HashMap<>();
-        for (Flags.Flag e : new Flags(vmFields, vmTypes)) {
-            flags.put(e.getName(), e);
-        }
-
-        String currentArch = getHostArchitectureName();
-
-        for (Field f : HotSpotVMConfig.class.getDeclaredFields()) {
-            if (f.isAnnotationPresent(HotSpotVMField.class)) {
-                HotSpotVMField annotation = f.getAnnotation(HotSpotVMField.class);
-                String name = annotation.name();
-                String type = annotation.type();
-                VMFields.Field entry = vmFields.get(name);
-                if (entry == null) {
-                    if (!isRequired(currentArch, annotation.archs())) {
-                        continue;
-                    }
-                    throw new IllegalArgumentException("field not found: " + name);
-                }
-
-                // Make sure the native type is still the type we expect.
-                if (!type.equals("")) {
-                    if (!type.equals(entry.getTypeString())) {
-                        throw new IllegalArgumentException("compiler expects type " + type + " but field " + name + " is of type " + entry.getTypeString());
-                    }
-                }
-
-                switch (annotation.get()) {
-                    case OFFSET:
-                        checkField(f, entry.getOffset());
-                        break;
-                    case ADDRESS:
-                        checkField(f, entry.getAddress());
-                        break;
-                    case VALUE:
-                        checkField(f, entry.getValue());
-                        break;
-                    default:
-                        throw GraalInternalError.shouldNotReachHere("unknown kind " + annotation.get());
-                }
-            } else if (f.isAnnotationPresent(HotSpotVMType.class)) {
-                HotSpotVMType annotation = f.getAnnotation(HotSpotVMType.class);
-                String name = annotation.name();
-                VMTypes.Type entry = vmTypes.get(name);
-                if (entry == null) {
-                    throw new IllegalArgumentException("type not found: " + name);
-                }
-                switch (annotation.get()) {
-                    case SIZE:
-                        checkField(f, entry.getSize());
-                        break;
-                    default:
-                        throw GraalInternalError.shouldNotReachHere("unknown kind " + annotation.get());
-                }
-            } else if (f.isAnnotationPresent(HotSpotVMConstant.class)) {
-                HotSpotVMConstant annotation = f.getAnnotation(HotSpotVMConstant.class);
-                String name = annotation.name();
-                AbstractConstant entry = vmConstants.get(name);
-                if (entry == null) {
-                    if (!isRequired(currentArch, annotation.archs())) {
-                        continue;
-                    }
-                    throw new IllegalArgumentException("constant not found: " + name);
-                }
-                checkField(f, entry.getValue());
-            } else if (f.isAnnotationPresent(HotSpotVMFlag.class)) {
-                HotSpotVMFlag annotation = f.getAnnotation(HotSpotVMFlag.class);
-                String name = annotation.name();
-                Flags.Flag entry = flags.get(name);
-                if (entry == null) {
-                    if (annotation.optional() || !isRequired(currentArch, annotation.archs())) {
-                        continue;
-                    }
-                    throw new IllegalArgumentException("flag not found: " + name);
-
-                }
-                checkField(f, entry.getValue());
-            }
-        }
-        return true;
-    }
-
-    private final CompressEncoding oopEncoding;
-    private final CompressEncoding klassEncoding;
-
-    public CompressEncoding getOopEncoding() {
-        return oopEncoding;
-    }
-
-    public CompressEncoding getKlassEncoding() {
-        return klassEncoding;
-    }
-
-    private void checkField(Field field, Object value) {
-        try {
-            Class<?> fieldType = field.getType();
-            if (fieldType == boolean.class) {
-                if (value instanceof String) {
-                    assert field.getBoolean(this) == Boolean.valueOf((String) value) : field + " " + value + " " + field.getBoolean(this);
-                } else if (value instanceof Boolean) {
-                    assert field.getBoolean(this) == (boolean) value : field + " " + value + " " + field.getBoolean(this);
-                } else if (value instanceof Long) {
-                    assert field.getBoolean(this) == (((long) value) != 0) : field + " " + value + " " + field.getBoolean(this);
-                } else {
-                    GraalInternalError.shouldNotReachHere(value.getClass().getSimpleName());
-                }
-            } else if (fieldType == int.class) {
-                if (value instanceof Integer) {
-                    assert field.getInt(this) == (int) value : field + " " + value + " " + field.getInt(this);
-                } else if (value instanceof Long) {
-                    assert field.getInt(this) == (int) (long) value : field + " " + value + " " + field.getInt(this);
-                } else {
-                    GraalInternalError.shouldNotReachHere(value.getClass().getSimpleName());
-                }
-            } else if (fieldType == long.class) {
-                assert field.getLong(this) == (long) value : field + " " + value + " " + field.getLong(this);
-            } else {
-                GraalInternalError.shouldNotReachHere(field.toString());
-            }
-        } catch (IllegalAccessException e) {
-            throw GraalInternalError.shouldNotReachHere(field.toString() + ": " + e);
-        }
-    }
-
-    /**
-     * Gets the host architecture name for the purpose of finding the corresponding
-     * {@linkplain HotSpotBackendFactory backend}.
-     */
-    public String getHostArchitectureName() {
-        String arch = System.getProperty("os.arch");
-        switch (arch) {
-            case "x86_64":
-                arch = "amd64";
-                break;
-            case "sparcv9":
-                arch = "sparc";
-                break;
-        }
-        return arch;
-    }
-
-    /**
-     * VMStructEntry (see vmStructs.hpp).
-     */
-    @HotSpotVMValue(expression = "gHotSpotVMStructs", get = HotSpotVMValue.Type.ADDRESS) @Stable private long gHotSpotVMStructs;
-    @HotSpotVMValue(expression = "gHotSpotVMStructEntryTypeNameOffset") @Stable private long gHotSpotVMStructEntryTypeNameOffset;
-    @HotSpotVMValue(expression = "gHotSpotVMStructEntryFieldNameOffset") @Stable private long gHotSpotVMStructEntryFieldNameOffset;
-    @HotSpotVMValue(expression = "gHotSpotVMStructEntryTypeStringOffset") @Stable private long gHotSpotVMStructEntryTypeStringOffset;
-    @HotSpotVMValue(expression = "gHotSpotVMStructEntryIsStaticOffset") @Stable private long gHotSpotVMStructEntryIsStaticOffset;
-    @HotSpotVMValue(expression = "gHotSpotVMStructEntryOffsetOffset") @Stable private long gHotSpotVMStructEntryOffsetOffset;
-    @HotSpotVMValue(expression = "gHotSpotVMStructEntryAddressOffset") @Stable private long gHotSpotVMStructEntryAddressOffset;
-    @HotSpotVMValue(expression = "gHotSpotVMStructEntryArrayStride") @Stable private long gHotSpotVMStructEntryArrayStride;
-
-    class VMFields implements Iterable<VMFields.Field> {
-
-        private long address;
-
-        public VMFields(long address) {
-            this.address = address;
-        }
-
-        public Iterator<VMFields.Field> iterator() {
-            return new Iterator<VMFields.Field>() {
-
-                private int index = 0;
-
-                private Field current() {
-                    return new Field(address + gHotSpotVMStructEntryArrayStride * index);
-                }
-
-                /**
-                 * The last entry is identified by a NULL fieldName.
-                 */
-                public boolean hasNext() {
-                    Field entry = current();
-                    return entry.getFieldName() != null;
-                }
-
-                public Field next() {
-                    Field entry = current();
-                    index++;
-                    return entry;
-                }
-
-                @Override
-                public void remove() {
-                    throw GraalInternalError.unimplemented();
-                }
-            };
-        }
-
-        class Field {
-
-            private long entryAddress;
-
-            Field(long address) {
-                this.entryAddress = address;
-            }
-
-            public String getTypeName() {
-                long typeNameAddress = unsafe.getAddress(entryAddress + gHotSpotVMStructEntryTypeNameOffset);
-                return readCString(typeNameAddress);
-            }
-
-            public String getFieldName() {
-                long fieldNameAddress = unsafe.getAddress(entryAddress + gHotSpotVMStructEntryFieldNameOffset);
-                return readCString(fieldNameAddress);
-            }
-
-            public String getTypeString() {
-                long typeStringAddress = unsafe.getAddress(entryAddress + gHotSpotVMStructEntryTypeStringOffset);
-                return readCString(typeStringAddress);
-            }
-
-            public boolean isStatic() {
-                return unsafe.getInt(entryAddress + gHotSpotVMStructEntryIsStaticOffset) != 0;
-            }
-
-            public long getOffset() {
-                return unsafe.getLong(entryAddress + gHotSpotVMStructEntryOffsetOffset);
-            }
-
-            public long getAddress() {
-                return unsafe.getAddress(entryAddress + gHotSpotVMStructEntryAddressOffset);
-            }
-
-            public String getName() {
-                String typeName = getTypeName();
-                String fieldName = getFieldName();
-                return typeName + "::" + fieldName;
-            }
-
-            public long getValue() {
-                String type = getTypeString();
-                switch (type) {
-                    case "int":
-                        return unsafe.getInt(getAddress());
-                    case "address":
-                    case "intptr_t":
-                        return unsafe.getAddress(getAddress());
-                    default:
-                        // All foo* types are addresses.
-                        if (type.endsWith("*")) {
-                            return unsafe.getAddress(getAddress());
-                        }
-                        throw GraalInternalError.shouldNotReachHere(type);
-                }
-            }
-
-            @Override
-            public String toString() {
-                return String.format("Field[typeName=%s, fieldName=%s, typeString=%s, isStatic=%b, offset=%d, address=0x%x]", getTypeName(), getFieldName(), getTypeString(), isStatic(), getOffset(),
-                                getAddress());
-            }
-        }
-    }
-
-    /**
-     * VMTypeEntry (see vmStructs.hpp).
-     */
-    @HotSpotVMValue(expression = "gHotSpotVMTypes", get = HotSpotVMValue.Type.ADDRESS) @Stable private long gHotSpotVMTypes;
-    @HotSpotVMValue(expression = "gHotSpotVMTypeEntryTypeNameOffset") @Stable private long gHotSpotVMTypeEntryTypeNameOffset;
-    @HotSpotVMValue(expression = "gHotSpotVMTypeEntrySuperclassNameOffset") @Stable private long gHotSpotVMTypeEntrySuperclassNameOffset;
-    @HotSpotVMValue(expression = "gHotSpotVMTypeEntryIsOopTypeOffset") @Stable private long gHotSpotVMTypeEntryIsOopTypeOffset;
-    @HotSpotVMValue(expression = "gHotSpotVMTypeEntryIsIntegerTypeOffset") @Stable private long gHotSpotVMTypeEntryIsIntegerTypeOffset;
-    @HotSpotVMValue(expression = "gHotSpotVMTypeEntryIsUnsignedOffset") @Stable private long gHotSpotVMTypeEntryIsUnsignedOffset;
-    @HotSpotVMValue(expression = "gHotSpotVMTypeEntrySizeOffset") @Stable private long gHotSpotVMTypeEntrySizeOffset;
-    @HotSpotVMValue(expression = "gHotSpotVMTypeEntryArrayStride") @Stable private long gHotSpotVMTypeEntryArrayStride;
-
-    class VMTypes implements Iterable<VMTypes.Type> {
-
-        private long address;
-
-        public VMTypes(long address) {
-            this.address = address;
-        }
-
-        public Iterator<VMTypes.Type> iterator() {
-            return new Iterator<VMTypes.Type>() {
-
-                private int index = 0;
-
-                private Type current() {
-                    return new Type(address + gHotSpotVMTypeEntryArrayStride * index);
-                }
-
-                /**
-                 * The last entry is identified by a NULL type name.
-                 */
-                public boolean hasNext() {
-                    Type entry = current();
-                    return entry.getTypeName() != null;
-                }
-
-                public Type next() {
-                    Type entry = current();
-                    index++;
-                    return entry;
-                }
-
-                @Override
-                public void remove() {
-                    throw GraalInternalError.unimplemented();
-                }
-            };
-        }
-
-        class Type {
-
-            private long entryAddress;
-
-            Type(long address) {
-                this.entryAddress = address;
-            }
-
-            public String getTypeName() {
-                long typeNameAddress = unsafe.getAddress(entryAddress + gHotSpotVMTypeEntryTypeNameOffset);
-                return readCString(typeNameAddress);
-            }
-
-            public String getSuperclassName() {
-                long superclassNameAddress = unsafe.getAddress(entryAddress + gHotSpotVMTypeEntrySuperclassNameOffset);
-                return readCString(superclassNameAddress);
-            }
-
-            public boolean isOopType() {
-                return unsafe.getInt(entryAddress + gHotSpotVMTypeEntryIsOopTypeOffset) != 0;
-            }
-
-            public boolean isIntegerType() {
-                return unsafe.getInt(entryAddress + gHotSpotVMTypeEntryIsIntegerTypeOffset) != 0;
-            }
-
-            public boolean isUnsigned() {
-                return unsafe.getInt(entryAddress + gHotSpotVMTypeEntryIsUnsignedOffset) != 0;
-            }
-
-            public long getSize() {
-                return unsafe.getLong(entryAddress + gHotSpotVMTypeEntrySizeOffset);
-            }
-
-            @Override
-            public String toString() {
-                return String.format("Type[typeName=%s, superclassName=%s, isOopType=%b, isIntegerType=%b, isUnsigned=%b, size=%d]", getTypeName(), getSuperclassName(), isOopType(), isIntegerType(),
-                                isUnsigned(), getSize());
-            }
-        }
-    }
-
-    public abstract class AbstractConstant {
-
-        protected long address;
-        protected long nameOffset;
-        protected long valueOffset;
-
-        AbstractConstant(long address, long nameOffset, long valueOffset) {
-            this.address = address;
-            this.nameOffset = nameOffset;
-            this.valueOffset = valueOffset;
-        }
-
-        public String getName() {
-            long nameAddress = unsafe.getAddress(address + nameOffset);
-            return readCString(nameAddress);
-        }
-
-        public abstract long getValue();
-    }
-
-    /**
-     * VMIntConstantEntry (see vmStructs.hpp).
-     */
-    @HotSpotVMValue(expression = "gHotSpotVMIntConstants", get = HotSpotVMValue.Type.ADDRESS) @Stable private long gHotSpotVMIntConstants;
-    @HotSpotVMValue(expression = "gHotSpotVMIntConstantEntryNameOffset") @Stable private long gHotSpotVMIntConstantEntryNameOffset;
-    @HotSpotVMValue(expression = "gHotSpotVMIntConstantEntryValueOffset") @Stable private long gHotSpotVMIntConstantEntryValueOffset;
-    @HotSpotVMValue(expression = "gHotSpotVMIntConstantEntryArrayStride") @Stable private long gHotSpotVMIntConstantEntryArrayStride;
-
-    class VMIntConstants implements Iterable<VMIntConstants.Constant> {
-
-        private long address;
-
-        public VMIntConstants(long address) {
-            this.address = address;
-        }
-
-        public Iterator<VMIntConstants.Constant> iterator() {
-            return new Iterator<VMIntConstants.Constant>() {
-
-                private int index = 0;
-
-                private Constant current() {
-                    return new Constant(address + gHotSpotVMIntConstantEntryArrayStride * index);
-                }
-
-                /**
-                 * The last entry is identified by a NULL name.
-                 */
-                public boolean hasNext() {
-                    Constant entry = current();
-                    return entry.getName() != null;
-                }
-
-                public Constant next() {
-                    Constant entry = current();
-                    index++;
-                    return entry;
-                }
-
-                @Override
-                public void remove() {
-                    throw GraalInternalError.unimplemented();
-                }
-            };
-        }
-
-        class Constant extends AbstractConstant {
-
-            Constant(long address) {
-                super(address, gHotSpotVMIntConstantEntryNameOffset, gHotSpotVMIntConstantEntryValueOffset);
-            }
-
-            @Override
-            public long getValue() {
-                return unsafe.getInt(address + valueOffset);
-            }
-
-            @Override
-            public String toString() {
-                return String.format("IntConstant[name=%s, value=%d (0x%x)]", getName(), getValue(), getValue());
-            }
-        }
-    }
-
-    /**
-     * VMLongConstantEntry (see vmStructs.hpp).
-     */
-    @HotSpotVMValue(expression = "gHotSpotVMLongConstants", get = HotSpotVMValue.Type.ADDRESS) @Stable private long gHotSpotVMLongConstants;
-    @HotSpotVMValue(expression = "gHotSpotVMLongConstantEntryNameOffset") @Stable private long gHotSpotVMLongConstantEntryNameOffset;
-    @HotSpotVMValue(expression = "gHotSpotVMLongConstantEntryValueOffset") @Stable private long gHotSpotVMLongConstantEntryValueOffset;
-    @HotSpotVMValue(expression = "gHotSpotVMLongConstantEntryArrayStride") @Stable private long gHotSpotVMLongConstantEntryArrayStride;
-
-    class VMLongConstants implements Iterable<VMLongConstants.Constant> {
-
-        private long address;
-
-        public VMLongConstants(long address) {
-            this.address = address;
-        }
-
-        public Iterator<VMLongConstants.Constant> iterator() {
-            return new Iterator<VMLongConstants.Constant>() {
-
-                private int index = 0;
-
-                private Constant currentEntry() {
-                    return new Constant(address + gHotSpotVMLongConstantEntryArrayStride * index);
-                }
-
-                /**
-                 * The last entry is identified by a NULL name.
-                 */
-                public boolean hasNext() {
-                    Constant entry = currentEntry();
-                    return entry.getName() != null;
-                }
-
-                public Constant next() {
-                    Constant entry = currentEntry();
-                    index++;
-                    return entry;
-                }
-
-                @Override
-                public void remove() {
-                    throw GraalInternalError.unimplemented();
-                }
-            };
-        }
-
-        class Constant extends AbstractConstant {
-
-            Constant(long address) {
-                super(address, gHotSpotVMLongConstantEntryNameOffset, gHotSpotVMLongConstantEntryValueOffset);
-            }
-
-            @Override
-            public long getValue() {
-                return unsafe.getLong(address + valueOffset);
-            }
-
-            @Override
-            public String toString() {
-                return String.format("LongConstant[name=%s, value=%d (0x%x)]", getName(), getValue(), getValue());
-            }
-        }
-    }
-
-    class Flags implements Iterable<Flags.Flag> {
-
-        private long address;
-        private long entrySize;
-        private long typeOffset;
-        private long nameOffset;
-        private long addrOffset;
-
-        public Flags(HashMap<String, VMFields.Field> vmStructs, HashMap<String, VMTypes.Type> vmTypes) {
-            address = vmStructs.get("Flag::flags").getValue();
-            entrySize = vmTypes.get("Flag").getSize();
-            typeOffset = vmStructs.get("Flag::_type").getOffset();
-            nameOffset = vmStructs.get("Flag::_name").getOffset();
-            addrOffset = vmStructs.get("Flag::_addr").getOffset();
-
-            assert vmTypes.get("bool").getSize() == Byte.BYTES;
-            assert vmTypes.get("intx").getSize() == Long.BYTES;
-            assert vmTypes.get("uintx").getSize() == Long.BYTES;
-        }
-
-        public Iterator<Flags.Flag> iterator() {
-            return new Iterator<Flags.Flag>() {
-
-                private int index = 0;
-
-                private Flag current() {
-                    return new Flag(address + entrySize * index);
-                }
-
-                /**
-                 * The last entry is identified by a NULL name.
-                 */
-                public boolean hasNext() {
-                    Flag entry = current();
-                    return entry.getName() != null;
-                }
-
-                public Flag next() {
-                    Flag entry = current();
-                    index++;
-                    return entry;
-                }
-
-                @Override
-                public void remove() {
-                    throw GraalInternalError.unimplemented();
-                }
-            };
-        }
-
-        class Flag {
-
-            private long entryAddress;
-
-            Flag(long address) {
-                this.entryAddress = address;
-            }
-
-            public String getType() {
-                long typeAddress = unsafe.getAddress(entryAddress + typeOffset);
-                return readCString(typeAddress);
-            }
-
-            public String getName() {
-                long nameAddress = unsafe.getAddress(entryAddress + nameOffset);
-                return readCString(nameAddress);
-            }
-
-            public long getAddr() {
-                return unsafe.getAddress(entryAddress + addrOffset);
-            }
-
-            public Object getValue() {
-                switch (getType()) {
-                    case "bool":
-                        return Boolean.valueOf(unsafe.getByte(getAddr()) != 0);
-                    case "intx":
-                    case "uintx":
-                    case "uint64_t":
-                        return Long.valueOf(unsafe.getLong(getAddr()));
-                    case "double":
-                        return Double.valueOf(unsafe.getDouble(getAddr()));
-                    case "ccstr":
-                    case "ccstrlist":
-                        return readCString(getAddr());
-                    default:
-                        throw GraalInternalError.shouldNotReachHere(getType());
-                }
-            }
-
-            @Override
-            public String toString() {
-                return String.format("Flag[type=%s, name=%s, value=%s]", getType(), getName(), getValue());
-            }
-        }
-    }
-
-    // os information, register layout, code generation, ...
-    @HotSpotVMValue(expression = "DEBUG_ONLY(1) NOT_DEBUG(0)") @Stable public boolean cAssertions;
-    public final boolean windowsOs = System.getProperty("os.name", "").startsWith("Windows");
-
-    @HotSpotVMFlag(name = "CodeEntryAlignment") @Stable public int codeEntryAlignment;
-    @HotSpotVMFlag(name = "VerifyOops") @Stable public boolean verifyOops;
-    @HotSpotVMFlag(name = "CITime") @Stable public boolean ciTime;
-    @HotSpotVMFlag(name = "CITimeEach") @Stable public boolean ciTimeEach;
-    @HotSpotVMFlag(name = "CompileTheWorldStartAt", optional = true) @Stable public int compileTheWorldStartAt;
-    @HotSpotVMFlag(name = "CompileTheWorldStopAt", optional = true) @Stable public int compileTheWorldStopAt;
-    @HotSpotVMFlag(name = "DontCompileHugeMethods") @Stable public boolean dontCompileHugeMethods;
-    @HotSpotVMFlag(name = "HugeMethodLimit") @Stable public int hugeMethodLimit;
-    @HotSpotVMFlag(name = "PrintInlining") @Stable public boolean printInlining;
-    @HotSpotVMFlag(name = "GraalUseFastLocking") @Stable public boolean useFastLocking;
-    @HotSpotVMFlag(name = "ForceUnreachable") @Stable public boolean forceUnreachable;
-
-    @HotSpotVMFlag(name = "UseTLAB") @Stable public boolean useTLAB;
-    @HotSpotVMFlag(name = "UseBiasedLocking") @Stable public boolean useBiasedLocking;
-    @HotSpotVMFlag(name = "UsePopCountInstruction") @Stable public boolean usePopCountInstruction;
-    @HotSpotVMFlag(name = "UseCountLeadingZerosInstruction", archs = {"amd64"}) @Stable public boolean useCountLeadingZerosInstruction;
-    @HotSpotVMFlag(name = "UseCountTrailingZerosInstruction", archs = {"amd64"}) @Stable public boolean useCountTrailingZerosInstruction;
-    @HotSpotVMFlag(name = "UseAESIntrinsics") @Stable public boolean useAESIntrinsics;
-    @HotSpotVMFlag(name = "UseCRC32Intrinsics") @Stable public boolean useCRC32Intrinsics;
-    @HotSpotVMFlag(name = "UseG1GC") @Stable public boolean useG1GC;
-    @HotSpotVMFlag(name = "UseConcMarkSweepGC") @Stable public boolean useCMSGC;
-
-    @HotSpotVMFlag(name = "AllocatePrefetchStyle") @Stable public int allocatePrefetchStyle;
-    @HotSpotVMFlag(name = "AllocatePrefetchInstr") @Stable public int allocatePrefetchInstr;
-    @HotSpotVMFlag(name = "AllocatePrefetchLines") @Stable public int allocatePrefetchLines;
-    @HotSpotVMFlag(name = "AllocateInstancePrefetchLines") @Stable public int allocateInstancePrefetchLines;
-    @HotSpotVMFlag(name = "AllocatePrefetchStepSize") @Stable public int allocatePrefetchStepSize;
-    @HotSpotVMFlag(name = "AllocatePrefetchDistance") @Stable public int allocatePrefetchDistance;
-
-    @HotSpotVMFlag(name = "FlightRecorder", optional = true) @Stable public boolean flightRecorder;
-
-    @HotSpotVMField(name = "Universe::_collectedHeap", type = "CollectedHeap*", get = HotSpotVMField.Type.VALUE) @Stable private long universeCollectedHeap;
-    @HotSpotVMField(name = "CollectedHeap::_total_collections", type = "unsigned int", get = HotSpotVMField.Type.OFFSET) @Stable private int collectedHeapTotalCollectionsOffset;
-
-    public long gcTotalCollectionsAddress() {
-        return universeCollectedHeap + collectedHeapTotalCollectionsOffset;
-    }
-
-    @HotSpotVMFlag(name = "GraalDeferredInitBarriers") @Stable public boolean useDeferredInitBarriers;
-    @HotSpotVMFlag(name = "GraalHProfEnabled") @Stable public boolean useHeapProfiler;
-
-    // Compressed Oops related values.
-    @HotSpotVMFlag(name = "UseCompressedOops") @Stable public boolean useCompressedOops;
-    @HotSpotVMFlag(name = "UseCompressedClassPointers") @Stable public boolean useCompressedClassPointers;
-
-    @HotSpotVMField(name = "Universe::_narrow_oop._base", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long narrowOopBase;
-    @HotSpotVMField(name = "Universe::_narrow_oop._shift", type = "int", get = HotSpotVMField.Type.VALUE) @Stable public int narrowOopShift;
-    @HotSpotVMFlag(name = "ObjectAlignmentInBytes") @Stable public int objectAlignment;
-
-    public int logMinObjAlignment() {
-        return (int) (Math.log(objectAlignment) / Math.log(2));
-    }
-
-    @HotSpotVMField(name = "Universe::_narrow_klass._base", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long narrowKlassBase;
-    @HotSpotVMField(name = "Universe::_narrow_klass._shift", type = "int", get = HotSpotVMField.Type.VALUE) @Stable public int narrowKlassShift;
-    @HotSpotVMConstant(name = "LogKlassAlignmentInBytes") @Stable public int logKlassAlignment;
-
-    // CPU capabilities
-    @HotSpotVMFlag(name = "UseSSE") @Stable public int useSSE;
-    @HotSpotVMFlag(name = "UseAVX", archs = {"amd64"}) @Stable public int useAVX;
-
-    // X86 specific values
-    @HotSpotVMField(name = "VM_Version::_cpuFeatures", type = "int", get = HotSpotVMField.Type.VALUE, archs = {"amd64"}) @Stable public int x86CPUFeatures;
-    @HotSpotVMConstant(name = "VM_Version::CPU_CX8", archs = {"amd64"}) @Stable public int cpuCX8;
-    @HotSpotVMConstant(name = "VM_Version::CPU_CMOV", archs = {"amd64"}) @Stable public int cpuCMOV;
-    @HotSpotVMConstant(name = "VM_Version::CPU_FXSR", archs = {"amd64"}) @Stable public int cpuFXSR;
-    @HotSpotVMConstant(name = "VM_Version::CPU_HT", archs = {"amd64"}) @Stable public int cpuHT;
-    @HotSpotVMConstant(name = "VM_Version::CPU_MMX", archs = {"amd64"}) @Stable public int cpuMMX;
-    @HotSpotVMConstant(name = "VM_Version::CPU_3DNOW_PREFETCH", archs = {"amd64"}) @Stable public int cpu3DNOWPREFETCH;
-    @HotSpotVMConstant(name = "VM_Version::CPU_SSE", archs = {"amd64"}) @Stable public int cpuSSE;
-    @HotSpotVMConstant(name = "VM_Version::CPU_SSE2", archs = {"amd64"}) @Stable public int cpuSSE2;
-    @HotSpotVMConstant(name = "VM_Version::CPU_SSE3", archs = {"amd64"}) @Stable public int cpuSSE3;
-    @HotSpotVMConstant(name = "VM_Version::CPU_SSSE3", archs = {"amd64"}) @Stable public int cpuSSSE3;
-    @HotSpotVMConstant(name = "VM_Version::CPU_SSE4A", archs = {"amd64"}) @Stable public int cpuSSE4A;
-    @HotSpotVMConstant(name = "VM_Version::CPU_SSE4_1", archs = {"amd64"}) @Stable public int cpuSSE41;
-    @HotSpotVMConstant(name = "VM_Version::CPU_SSE4_2", archs = {"amd64"}) @Stable public int cpuSSE42;
-    @HotSpotVMConstant(name = "VM_Version::CPU_POPCNT", archs = {"amd64"}) @Stable public int cpuPOPCNT;
-    @HotSpotVMConstant(name = "VM_Version::CPU_LZCNT", archs = {"amd64"}) @Stable public int cpuLZCNT;
-    @HotSpotVMConstant(name = "VM_Version::CPU_TSC", archs = {"amd64"}) @Stable public int cpuTSC;
-    @HotSpotVMConstant(name = "VM_Version::CPU_TSCINV", archs = {"amd64"}) @Stable public int cpuTSCINV;
-    @HotSpotVMConstant(name = "VM_Version::CPU_AVX", archs = {"amd64"}) @Stable public int cpuAVX;
-    @HotSpotVMConstant(name = "VM_Version::CPU_AVX2", archs = {"amd64"}) @Stable public int cpuAVX2;
-    @HotSpotVMConstant(name = "VM_Version::CPU_AES", archs = {"amd64"}) @Stable public int cpuAES;
-    @HotSpotVMConstant(name = "VM_Version::CPU_ERMS", archs = {"amd64"}) @Stable public int cpuERMS;
-    @HotSpotVMConstant(name = "VM_Version::CPU_CLMUL", archs = {"amd64"}) @Stable public int cpuCLMUL;
-    @HotSpotVMConstant(name = "VM_Version::CPU_BMI1", archs = {"amd64"}) @Stable public int cpuBMI1;
-
-    // SPARC specific values
-    @HotSpotVMField(name = "VM_Version::_features", type = "int", get = HotSpotVMField.Type.VALUE, archs = {"sparc"}) @Stable public int sparcFeatures;
-    @HotSpotVMConstant(name = "VM_Version::vis3_instructions_m", archs = {"sparc"}) @Stable public int vis3Instructions;
-    @HotSpotVMConstant(name = "VM_Version::vis2_instructions_m", archs = {"sparc"}) @Stable public int vis2Instructions;
-    @HotSpotVMConstant(name = "VM_Version::vis1_instructions_m", archs = {"sparc"}) @Stable public int vis1Instructions;
-    @HotSpotVMConstant(name = "VM_Version::cbcond_instructions_m", archs = {"sparc"}) @Stable public int cbcondInstructions;
-
-    // offsets, ...
-    @HotSpotVMFlag(name = "StackShadowPages") @Stable public int stackShadowPages;
-    @HotSpotVMFlag(name = "UseStackBanging") @Stable public boolean useStackBanging;
-    @HotSpotVMConstant(name = "STACK_BIAS") @Stable public int stackBias;
-
-    @HotSpotVMField(name = "oopDesc::_mark", type = "markOop", get = HotSpotVMField.Type.OFFSET) @Stable public int markOffset;
-    @HotSpotVMField(name = "oopDesc::_metadata._klass", type = "Klass*", get = HotSpotVMField.Type.OFFSET) @Stable public int hubOffset;
-
-    @HotSpotVMField(name = "Klass::_prototype_header", type = "markOop", get = HotSpotVMField.Type.OFFSET) @Stable public int prototypeMarkWordOffset;
-    @HotSpotVMField(name = "Klass::_subklass", type = "Klass*", get = HotSpotVMField.Type.OFFSET) @Stable public int subklassOffset;
-    @HotSpotVMField(name = "Klass::_next_sibling", type = "Klass*", get = HotSpotVMField.Type.OFFSET) @Stable public int nextSiblingOffset;
-    @HotSpotVMField(name = "Klass::_super_check_offset", type = "juint", get = HotSpotVMField.Type.OFFSET) @Stable public int superCheckOffsetOffset;
-    @HotSpotVMField(name = "Klass::_secondary_super_cache", type = "Klass*", get = HotSpotVMField.Type.OFFSET) @Stable public int secondarySuperCacheOffset;
-    @HotSpotVMField(name = "Klass::_secondary_supers", type = "Array<Klass*>*", get = HotSpotVMField.Type.OFFSET) @Stable public int secondarySupersOffset;
-
-    /**
-     * The offset of the _java_mirror field (of type {@link Class}) in a Klass.
-     */
-    @HotSpotVMField(name = "Klass::_java_mirror", type = "oop", get = HotSpotVMField.Type.OFFSET) @Stable public int classMirrorOffset;
-
-    @HotSpotVMField(name = "Klass::_super", type = "Klass*", get = HotSpotVMField.Type.OFFSET) @Stable public int klassSuperKlassOffset;
-    @HotSpotVMField(name = "Klass::_modifier_flags", type = "jint", get = HotSpotVMField.Type.OFFSET) @Stable public int klassModifierFlagsOffset;
-    @HotSpotVMField(name = "Klass::_access_flags", type = "AccessFlags", get = HotSpotVMField.Type.OFFSET) @Stable public int klassAccessFlagsOffset;
-    @HotSpotVMField(name = "Klass::_layout_helper", type = "jint", get = HotSpotVMField.Type.OFFSET) @Stable public int klassLayoutHelperOffset;
-
-    @HotSpotVMConstant(name = "Klass::_lh_neutral_value") @Stable public int klassLayoutHelperNeutralValue;
-    @HotSpotVMConstant(name = "Klass::_lh_instance_slow_path_bit") @Stable public int klassLayoutHelperInstanceSlowPathBit;
-    @HotSpotVMConstant(name = "Klass::_lh_log2_element_size_shift") @Stable public int layoutHelperLog2ElementSizeShift;
-    @HotSpotVMConstant(name = "Klass::_lh_log2_element_size_mask") @Stable public int layoutHelperLog2ElementSizeMask;
-    @HotSpotVMConstant(name = "Klass::_lh_element_type_shift") @Stable public int layoutHelperElementTypeShift;
-    @HotSpotVMConstant(name = "Klass::_lh_element_type_mask") @Stable public int layoutHelperElementTypeMask;
-    @HotSpotVMConstant(name = "Klass::_lh_header_size_shift") @Stable public int layoutHelperHeaderSizeShift;
-    @HotSpotVMConstant(name = "Klass::_lh_header_size_mask") @Stable public int layoutHelperHeaderSizeMask;
-    @HotSpotVMConstant(name = "Klass::_lh_array_tag_shift") @Stable public int layoutHelperArrayTagShift;
-    @HotSpotVMConstant(name = "Klass::_lh_array_tag_type_value") @Stable public int layoutHelperArrayTagTypeValue;
-    @HotSpotVMConstant(name = "Klass::_lh_array_tag_obj_value") @Stable public int layoutHelperArrayTagObjectValue;
-
-    /**
-     * This filters out the bit that differentiates a type array from an object array.
-     */
-    public int layoutHelperElementTypePrimitiveInPlace() {
-        return (layoutHelperArrayTagTypeValue & ~layoutHelperArrayTagObjectValue) << layoutHelperArrayTagShift;
-    }
-
-    /**
-     * Bit pattern in the klass layout helper that can be used to identify arrays.
-     */
-    public final int arrayKlassLayoutHelperIdentifier = 0x80000000;
-
-    @HotSpotVMField(name = "ArrayKlass::_component_mirror", type = "oop", get = HotSpotVMField.Type.OFFSET) @Stable public int arrayKlassComponentMirrorOffset;
-
-    @HotSpotVMType(name = "vtableEntry", get = HotSpotVMType.Type.SIZE) @Stable public int vtableEntrySize;
-    @HotSpotVMField(name = "vtableEntry::_method", type = "Method*", get = HotSpotVMField.Type.OFFSET) @Stable public int vtableEntryMethodOffset;
-    @HotSpotVMValue(expression = "InstanceKlass::vtable_start_offset() * HeapWordSize") @Stable public int instanceKlassVtableStartOffset;
-    @HotSpotVMValue(expression = "InstanceKlass::vtable_length_offset() * HeapWordSize") @Stable public int instanceKlassVtableLengthOffset;
-    @HotSpotVMValue(expression = "Universe::base_vtable_size() / vtableEntry::size()") @Stable public int baseVtableLength;
-
-    /**
-     * The offset of the array length word in an array object's header.
-     */
-    @HotSpotVMValue(expression = "arrayOopDesc::length_offset_in_bytes()") @Stable public int arrayLengthOffset;
-
-    @HotSpotVMField(name = "Array<int>::_length", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int arrayU1LengthOffset;
-    @HotSpotVMField(name = "Array<u1>::_data", type = "", get = HotSpotVMField.Type.OFFSET) @Stable public int arrayU1DataOffset;
-    @HotSpotVMField(name = "Array<u2>::_data", type = "", get = HotSpotVMField.Type.OFFSET) @Stable public int arrayU2DataOffset;
-    @HotSpotVMField(name = "Array<Klass*>::_length", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int metaspaceArrayLengthOffset;
-    @HotSpotVMField(name = "Array<Klass*>::_data[0]", type = "Klass*", get = HotSpotVMField.Type.OFFSET) @Stable public int metaspaceArrayBaseOffset;
-
-    @HotSpotVMField(name = "InstanceKlass::_source_file_name_index", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int instanceKlassSourceFileNameIndexOffset;
-    @HotSpotVMField(name = "InstanceKlass::_init_state", type = "u1", get = HotSpotVMField.Type.OFFSET) @Stable public int instanceKlassInitStateOffset;
-    @HotSpotVMField(name = "InstanceKlass::_constants", type = "ConstantPool*", get = HotSpotVMField.Type.OFFSET) @Stable public int instanceKlassConstantsOffset;
-    @HotSpotVMField(name = "InstanceKlass::_fields", type = "Array<u2>*", get = HotSpotVMField.Type.OFFSET) @Stable public int instanceKlassFieldsOffset;
-
-    @HotSpotVMConstant(name = "InstanceKlass::linked") @Stable public int instanceKlassStateLinked;
-    @HotSpotVMConstant(name = "InstanceKlass::fully_initialized") @Stable public int instanceKlassStateFullyInitialized;
-
-    @HotSpotVMField(name = "ObjArrayKlass::_element_klass", type = "Klass*", get = HotSpotVMField.Type.OFFSET) @Stable public int arrayClassElementOffset;
-
-    @HotSpotVMConstant(name = "FieldInfo::access_flags_offset") @Stable public int fieldInfoAccessFlagsOffset;
-    @HotSpotVMConstant(name = "FieldInfo::name_index_offset") @Stable public int fieldInfoNameIndexOffset;
-    @HotSpotVMConstant(name = "FieldInfo::signature_index_offset") @Stable public int fieldInfoSignatureIndexOffset;
-    @HotSpotVMConstant(name = "FieldInfo::initval_index_offset") @Stable public int fieldInfoInitvalIndexOffset;
-    @HotSpotVMConstant(name = "FieldInfo::low_packed_offset") @Stable public int fieldInfoLowPackedOffset;
-    @HotSpotVMConstant(name = "FieldInfo::high_packed_offset") @Stable public int fieldInfoHighPackedOffset;
-    @HotSpotVMConstant(name = "FieldInfo::field_slots") @Stable public int fieldInfoFieldSlots;
-
-    @HotSpotVMConstant(name = "FIELDINFO_TAG_SIZE") @Stable public int fieldInfoTagSize;
-
-    @HotSpotVMConstant(name = "JVM_ACC_FIELD_INTERNAL") @Stable public int jvmAccFieldInternal;
-    @HotSpotVMConstant(name = "JVM_ACC_FIELD_STABLE") @Stable public int jvmAccFieldStable;
-    @HotSpotVMConstant(name = "JVM_ACC_FIELD_HAS_GENERIC_SIGNATURE") @Stable public int jvmAccFieldHasGenericSignature;
-    @HotSpotVMConstant(name = "JVM_ACC_WRITTEN_FLAGS") @Stable public int jvmAccWrittenFlags;
-
-    @HotSpotVMField(name = "Thread::_tlab", type = "ThreadLocalAllocBuffer", get = HotSpotVMField.Type.OFFSET) @Stable public int threadTlabOffset;
-
-    @HotSpotVMField(name = "JavaThread::_anchor", type = "JavaFrameAnchor", get = HotSpotVMField.Type.OFFSET) @Stable public int javaThreadAnchorOffset;
-    @HotSpotVMField(name = "JavaThread::_threadObj", type = "oop", get = HotSpotVMField.Type.OFFSET) @Stable public int threadObjectOffset;
-    @HotSpotVMField(name = "JavaThread::_osthread", type = "OSThread*", get = HotSpotVMField.Type.OFFSET) @Stable public int osThreadOffset;
-    @HotSpotVMField(name = "JavaThread::_dirty_card_queue", type = "DirtyCardQueue", get = HotSpotVMField.Type.OFFSET) @Stable public int javaThreadDirtyCardQueueOffset;
-    @HotSpotVMField(name = "JavaThread::_is_method_handle_return", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int threadIsMethodHandleReturnOffset;
-    @HotSpotVMField(name = "JavaThread::_satb_mark_queue", type = "ObjPtrQueue", get = HotSpotVMField.Type.OFFSET) @Stable public int javaThreadSatbMarkQueueOffset;
-    @HotSpotVMField(name = "JavaThread::_vm_result", type = "oop", get = HotSpotVMField.Type.OFFSET) @Stable public int threadObjectResultOffset;
-    @HotSpotVMValue(expression = "in_bytes(JavaThread::graal_counters_offset())") @Stable public int graalCountersThreadOffset;
-
-    /**
-     * An invalid value for {@link #rtldDefault}.
-     */
-    public static final long INVALID_RTLD_DEFAULT_HANDLE = 0xDEADFACE;
-
-    /**
-     * Address of the library lookup routine. The C signature of this routine is:
-     *
-     * <pre>
-     *     void* (const char *filename, char *ebuf, int ebuflen)
-     * </pre>
-     */
-    @HotSpotVMValue(expression = "os::dll_load", get = HotSpotVMValue.Type.ADDRESS) @Stable public long dllLoad;
-
-    /**
-     * Address of the library lookup routine. The C signature of this routine is:
-     *
-     * <pre>
-     *     void* (void* handle, const char* name)
-     * </pre>
-     */
-    @HotSpotVMValue(expression = "os::dll_lookup", get = HotSpotVMValue.Type.ADDRESS) @Stable public long dllLookup;
-
-    /**
-     * A pseudo-handle which when used as the first argument to {@link #dllLookup} means lookup will
-     * return the first occurrence of the desired symbol using the default library search order. If
-     * this field is {@value #INVALID_RTLD_DEFAULT_HANDLE}, then this capability is not supported on
-     * the current platform.
-     */
-    @HotSpotVMValue(expression = "RTLD_DEFAULT", defines = {"TARGET_OS_FAMILY_bsd", "TARGET_OS_FAMILY_linux"}, get = HotSpotVMValue.Type.ADDRESS) @Stable public long rtldDefault = INVALID_RTLD_DEFAULT_HANDLE;
-
-    /**
-     * This field is used to pass exception objects into and out of the runtime system during
-     * exception handling for compiled code.
-     * <p>
-     * <b>NOTE: This is not the same as {@link #pendingExceptionOffset}.</b>
-     */
-    @HotSpotVMField(name = "JavaThread::_exception_oop", type = "oop", get = HotSpotVMField.Type.OFFSET) @Stable public int threadExceptionOopOffset;
-    @HotSpotVMField(name = "JavaThread::_exception_pc", type = "address", get = HotSpotVMField.Type.OFFSET) @Stable public int threadExceptionPcOffset;
-
-    @HotSpotVMField(name = "JavaFrameAnchor::_last_Java_sp", type = "intptr_t*", get = HotSpotVMField.Type.OFFSET) @Stable private int javaFrameAnchorLastJavaSpOffset;
-    @HotSpotVMField(name = "JavaFrameAnchor::_last_Java_pc", type = "address", get = HotSpotVMField.Type.OFFSET) @Stable private int javaFrameAnchorLastJavaPcOffset;
-    @HotSpotVMField(name = "JavaFrameAnchor::_last_Java_fp", type = "intptr_t*", get = HotSpotVMField.Type.OFFSET, archs = {"amd64"}) @Stable private int javaFrameAnchorLastJavaFpOffset;
-    @HotSpotVMField(name = "JavaFrameAnchor::_flags", type = "int", get = HotSpotVMField.Type.OFFSET, archs = {"sparc"}) @Stable private int javaFrameAnchorFlagsOffset;
-
-    public int threadLastJavaSpOffset() {
-        return javaThreadAnchorOffset + javaFrameAnchorLastJavaSpOffset;
-    }
-
-    public int threadLastJavaPcOffset() {
-        return javaThreadAnchorOffset + javaFrameAnchorLastJavaPcOffset;
-    }
-
-    /**
-     * This value is only valid on AMD64.
-     */
-    public int threadLastJavaFpOffset() {
-        // TODO add an assert for AMD64
-        return javaThreadAnchorOffset + javaFrameAnchorLastJavaFpOffset;
-    }
-
-    /**
-     * This value is only valid on SPARC.
-     */
-    public int threadJavaFrameAnchorFlagsOffset() {
-        // TODO add an assert for SPARC
-        return javaThreadAnchorOffset + javaFrameAnchorFlagsOffset;
-    }
-
-    // These are only valid on AMD64.
-    @HotSpotVMConstant(name = "frame::arg_reg_save_area_bytes", archs = {"amd64"}) @Stable public int runtimeCallStackSize;
-    @HotSpotVMConstant(name = "frame::interpreter_frame_sender_sp_offset", archs = {"amd64"}) @Stable public int frameInterpreterFrameSenderSpOffset;
-    @HotSpotVMConstant(name = "frame::interpreter_frame_last_sp_offset", archs = {"amd64"}) @Stable public int frameInterpreterFrameLastSpOffset;
-
-    @HotSpotVMField(name = "PtrQueue::_active", type = "bool", get = HotSpotVMField.Type.OFFSET) @Stable public int ptrQueueActiveOffset;
-    @HotSpotVMField(name = "PtrQueue::_buf", type = "void**", get = HotSpotVMField.Type.OFFSET) @Stable public int ptrQueueBufferOffset;
-    @HotSpotVMField(name = "PtrQueue::_index", type = "size_t", get = HotSpotVMField.Type.OFFSET) @Stable public int ptrQueueIndexOffset;
-
-    @HotSpotVMField(name = "OSThread::_interrupted", type = "jint", get = HotSpotVMField.Type.OFFSET) @Stable public int osThreadInterruptedOffset;
-
-    @HotSpotVMConstant(name = "markOopDesc::unlocked_value") @Stable public int unlockedMask;
-    @HotSpotVMConstant(name = "markOopDesc::biased_lock_mask_in_place") @Stable public int biasedLockMaskInPlace;
-    @HotSpotVMConstant(name = "markOopDesc::age_mask_in_place") @Stable public int ageMaskInPlace;
-    @HotSpotVMConstant(name = "markOopDesc::epoch_mask_in_place") @Stable public int epochMaskInPlace;
-
-    @HotSpotVMConstant(name = "markOopDesc::hash_shift") @Stable public long markOopDescHashShift;
-    @HotSpotVMConstant(name = "markOopDesc::hash_mask") @Stable public long markOopDescHashMask;
-    @HotSpotVMConstant(name = "markOopDesc::hash_mask_in_place") @Stable public long markOopDescHashMaskInPlace;
-
-    @HotSpotVMConstant(name = "markOopDesc::biased_lock_pattern") @Stable public int biasedLockPattern;
-    @HotSpotVMConstant(name = "markOopDesc::no_hash_in_place") @Stable public int markWordNoHashInPlace;
-    @HotSpotVMConstant(name = "markOopDesc::no_lock_in_place") @Stable public int markWordNoLockInPlace;
-
-    /**
-     * See markOopDesc::prototype().
-     */
-    public long arrayPrototypeMarkWord() {
-        return markWordNoHashInPlace | markWordNoLockInPlace;
-    }
-
-    /**
-     * See markOopDesc::copy_set_hash().
-     */
-    public long tlabIntArrayMarkWord() {
-        long tmp = arrayPrototypeMarkWord() & (~markOopDescHashMaskInPlace);
-        tmp |= ((0x2 & markOopDescHashMask) << markOopDescHashShift);
-        return tmp;
-    }
-
-    /**
-     * Offset of the _pending_exception field in ThreadShadow (defined in exceptions.hpp). This
-     * field is used to propagate exceptions through C/C++ calls.
-     * <p>
-     * <b>NOTE: This is not the same as {@link #threadExceptionOopOffset}.</b>
-     */
-    @HotSpotVMField(name = "ThreadShadow::_pending_exception", type = "oop", get = HotSpotVMField.Type.OFFSET) @Stable public int pendingExceptionOffset;
-    @HotSpotVMField(name = "ThreadShadow::_pending_deoptimization", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int pendingDeoptimizationOffset;
-    @HotSpotVMField(name = "ThreadShadow::_pending_failed_speculation", type = "oop", get = HotSpotVMField.Type.OFFSET) @Stable public int pendingFailedSpeculationOffset;
-    @HotSpotVMField(name = "ThreadShadow::_pending_transfer_to_interpreter", type = "bool", get = HotSpotVMField.Type.OFFSET) @Stable public int pendingTransferToInterpreterOffset;
-
-    /**
-     * Mark word right shift to get identity hash code.
-     */
-    @HotSpotVMConstant(name = "markOopDesc::hash_shift") @Stable public int identityHashCodeShift;
-
-    /**
-     * Identity hash code value when uninitialized.
-     */
-    @HotSpotVMConstant(name = "markOopDesc::no_hash") @Stable public int uninitializedIdentityHashCodeValue;
-
-    @HotSpotVMField(name = "Method::_access_flags", type = "AccessFlags", get = HotSpotVMField.Type.OFFSET) @Stable public int methodAccessFlagsOffset;
-    @HotSpotVMField(name = "Method::_constMethod", type = "ConstMethod*", get = HotSpotVMField.Type.OFFSET) @Stable public int methodConstMethodOffset;
-    @HotSpotVMField(name = "Method::_intrinsic_id", type = "u1", get = HotSpotVMField.Type.OFFSET) @Stable public int methodIntrinsicIdOffset;
-    @HotSpotVMField(name = "Method::_flags", type = "u1", get = HotSpotVMField.Type.OFFSET) @Stable public int methodFlagsOffset;
-    @HotSpotVMField(name = "Method::_vtable_index", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int methodVtableIndexOffset;
-
-    @HotSpotVMConstant(name = "Method::_jfr_towrite") @Stable public int methodFlagsJfrTowrite;
-    @HotSpotVMConstant(name = "Method::_caller_sensitive") @Stable public int methodFlagsCallerSensitive;
-    @HotSpotVMConstant(name = "Method::_force_inline") @Stable public int methodFlagsForceInline;
-    @HotSpotVMConstant(name = "Method::_dont_inline") @Stable public int methodFlagsDontInline;
-    @HotSpotVMConstant(name = "Method::_hidden") @Stable public int methodFlagsHidden;
-    @HotSpotVMConstant(name = "Method::nonvirtual_vtable_index") @Stable public int nonvirtualVtableIndex;
-    @HotSpotVMConstant(name = "Method::invalid_vtable_index") @Stable public int invalidVtableIndex;
-
-    @HotSpotVMConstant(name = "JVM_ACC_MONITOR_MATCH") @Stable public int jvmAccMonitorMatch;
-    @HotSpotVMConstant(name = "JVM_ACC_HAS_MONITOR_BYTECODES") @Stable public int jvmAccHasMonitorBytecodes;
-
-    @HotSpotVMField(name = "GraalEnv::_task", type = "CompileTask*", get = HotSpotVMField.Type.OFFSET) @Stable public int graalEnvTaskOffset;
-    @HotSpotVMField(name = "GraalEnv::_jvmti_can_hotswap_or_post_breakpoint", type = "bool", get = HotSpotVMField.Type.OFFSET) @Stable public int graalEnvJvmtiCanHotswapOrPostBreakpointOffset;
-    @HotSpotVMField(name = "CompileTask::_num_inlined_bytecodes", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int compileTaskNumInlinedBytecodesOffset;
-
-    /**
-     * Value of Method::extra_stack_entries().
-     */
-    @HotSpotVMValue(expression = "Method::extra_stack_entries()") @Stable public int extraStackEntries;
-
-    @HotSpotVMField(name = "ConstMethod::_constants", type = "ConstantPool*", get = HotSpotVMField.Type.OFFSET) @Stable public int constMethodConstantsOffset;
-    @HotSpotVMField(name = "ConstMethod::_flags", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int constMethodFlagsOffset;
-    @HotSpotVMField(name = "ConstMethod::_code_size", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int constMethodCodeSizeOffset;
-    @HotSpotVMField(name = "ConstMethod::_name_index", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int constMethodNameIndexOffset;
-    @HotSpotVMField(name = "ConstMethod::_signature_index", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int constMethodSignatureIndexOffset;
-    @HotSpotVMField(name = "ConstMethod::_max_stack", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int constMethodMaxStackOffset;
-    @HotSpotVMField(name = "ConstMethod::_max_locals", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int methodMaxLocalsOffset;
-
-    @HotSpotVMConstant(name = "ConstMethod::_has_linenumber_table") @Stable public int constMethodHasLineNumberTable;
-    @HotSpotVMConstant(name = "ConstMethod::_has_localvariable_table") @Stable public int constMethodHasLocalVariableTable;
-    @HotSpotVMConstant(name = "ConstMethod::_has_exception_table") @Stable public int constMethodHasExceptionTable;
-
-    @HotSpotVMType(name = "ExceptionTableElement", get = HotSpotVMType.Type.SIZE) @Stable public int exceptionTableElementSize;
-    @HotSpotVMField(name = "ExceptionTableElement::start_pc", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int exceptionTableElementStartPcOffset;
-    @HotSpotVMField(name = "ExceptionTableElement::end_pc", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int exceptionTableElementEndPcOffset;
-    @HotSpotVMField(name = "ExceptionTableElement::handler_pc", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int exceptionTableElementHandlerPcOffset;
-    @HotSpotVMField(name = "ExceptionTableElement::catch_type_index", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int exceptionTableElementCatchTypeIndexOffset;
-
-    @HotSpotVMType(name = "LocalVariableTableElement", get = HotSpotVMType.Type.SIZE) @Stable public int localVariableTableElementSize;
-    @HotSpotVMField(name = "LocalVariableTableElement::start_bci", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int localVariableTableElementStartBciOffset;
-    @HotSpotVMField(name = "LocalVariableTableElement::length", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int localVariableTableElementLengthOffset;
-    @HotSpotVMField(name = "LocalVariableTableElement::name_cp_index", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int localVariableTableElementNameCpIndexOffset;
-    @HotSpotVMField(name = "LocalVariableTableElement::descriptor_cp_index", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int localVariableTableElementDescriptorCpIndexOffset;
-    @HotSpotVMField(name = "LocalVariableTableElement::signature_cp_index", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int localVariableTableElementSignatureCpIndexOffset;
-    @HotSpotVMField(name = "LocalVariableTableElement::slot", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int localVariableTableElementSlotOffset;
-
-    @HotSpotVMType(name = "ConstantPool", get = HotSpotVMType.Type.SIZE) @Stable public int constantPoolSize;
-    @HotSpotVMField(name = "ConstantPool::_tags", type = "Array<u1>*", get = HotSpotVMField.Type.OFFSET) @Stable public int constantPoolTagsOffset;
-    @HotSpotVMField(name = "ConstantPool::_pool_holder", type = "InstanceKlass*", get = HotSpotVMField.Type.OFFSET) @Stable public int constantPoolHolderOffset;
-    @HotSpotVMField(name = "ConstantPool::_length", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int constantPoolLengthOffset;
-
-    @HotSpotVMConstant(name = "ConstantPool::CPCACHE_INDEX_TAG") @Stable public int constantPoolCpCacheIndexTag;
-
-    @HotSpotVMConstant(name = "JVM_CONSTANT_Utf8") @Stable public int jvmConstantUtf8;
-    @HotSpotVMConstant(name = "JVM_CONSTANT_Integer") @Stable public int jvmConstantInteger;
-    @HotSpotVMConstant(name = "JVM_CONSTANT_Long") @Stable public int jvmConstantLong;
-    @HotSpotVMConstant(name = "JVM_CONSTANT_Float") @Stable public int jvmConstantFloat;
-    @HotSpotVMConstant(name = "JVM_CONSTANT_Double") @Stable public int jvmConstantDouble;
-    @HotSpotVMConstant(name = "JVM_CONSTANT_Class") @Stable public int jvmConstantClass;
-    @HotSpotVMConstant(name = "JVM_CONSTANT_UnresolvedClass") @Stable public int jvmConstantUnresolvedClass;
-    @HotSpotVMConstant(name = "JVM_CONSTANT_UnresolvedClassInError") @Stable public int jvmConstantUnresolvedClassInError;
-    @HotSpotVMConstant(name = "JVM_CONSTANT_String") @Stable public int jvmConstantString;
-    @HotSpotVMConstant(name = "JVM_CONSTANT_Fieldref") @Stable public int jvmConstantFieldref;
-    @HotSpotVMConstant(name = "JVM_CONSTANT_Methodref") @Stable public int jvmConstantMethodref;
-    @HotSpotVMConstant(name = "JVM_CONSTANT_InterfaceMethodref") @Stable public int jvmConstantInterfaceMethodref;
-    @HotSpotVMConstant(name = "JVM_CONSTANT_NameAndType") @Stable public int jvmConstantNameAndType;
-    @HotSpotVMConstant(name = "JVM_CONSTANT_MethodHandle") @Stable public int jvmConstantMethodHandle;
-    @HotSpotVMConstant(name = "JVM_CONSTANT_MethodHandleInError") @Stable public int jvmConstantMethodHandleInError;
-    @HotSpotVMConstant(name = "JVM_CONSTANT_MethodType") @Stable public int jvmConstantMethodType;
-    @HotSpotVMConstant(name = "JVM_CONSTANT_MethodTypeInError") @Stable public int jvmConstantMethodTypeInError;
-    @HotSpotVMConstant(name = "JVM_CONSTANT_InvokeDynamic") @Stable public int jvmConstantInvokeDynamic;
-
-    @HotSpotVMConstant(name = "JVM_CONSTANT_ExternalMax") @Stable public int jvmConstantExternalMax;
-    @HotSpotVMConstant(name = "JVM_CONSTANT_InternalMin") @Stable public int jvmConstantInternalMin;
-    @HotSpotVMConstant(name = "JVM_CONSTANT_InternalMax") @Stable public int jvmConstantInternalMax;
-
-    @HotSpotVMConstant(name = "HeapWordSize") @Stable public int heapWordSize;
-
-    @HotSpotVMType(name = "Symbol*", get = HotSpotVMType.Type.SIZE) @Stable public int symbolPointerSize;
-    @HotSpotVMField(name = "Symbol::_length", type = "unsigned short", get = HotSpotVMField.Type.OFFSET) @Stable public int symbolLengthOffset;
-    @HotSpotVMField(name = "Symbol::_body[0]", type = "jbyte", get = HotSpotVMField.Type.OFFSET) @Stable public int symbolBodyOffset;
-
-    @HotSpotVMField(name = "vmSymbols::_symbols[0]", type = "Symbol*", get = HotSpotVMField.Type.ADDRESS) @Stable public long vmSymbolsSymbols;
-    @HotSpotVMConstant(name = "vmSymbols::FIRST_SID") @Stable public int vmSymbolsFirstSID;
-    @HotSpotVMConstant(name = "vmSymbols::SID_LIMIT") @Stable public int vmSymbolsSIDLimit;
-
-    @HotSpotVMConstant(name = "JVM_ACC_HAS_FINALIZER") @Stable public int klassHasFinalizerFlag;
-
-    // Modifier.SYNTHETIC is not public so we get it via vmStructs.
-    @HotSpotVMConstant(name = "JVM_ACC_SYNTHETIC") @Stable public int syntheticFlag;
-
-    /**
-     * @see HotSpotResolvedObjectTypeImpl#createField
-     */
-    @HotSpotVMConstant(name = "JVM_RECOGNIZED_FIELD_MODIFIERS") @Stable public int recognizedFieldModifiers;
-
-    /**
-     * Bit pattern that represents a non-oop. Neither the high bits nor the low bits of this value
-     * are allowed to look like (respectively) the high or low bits of a real oop.
-     */
-    @HotSpotVMField(name = "Universe::_non_oop_bits", type = "intptr_t", get = HotSpotVMField.Type.VALUE) @Stable public long nonOopBits;
-
-    @HotSpotVMField(name = "StubRoutines::_verify_oop_count", type = "jint", get = HotSpotVMField.Type.ADDRESS) @Stable public long verifyOopCounterAddress;
-    @HotSpotVMValue(expression = "Universe::verify_oop_mask()") @Stable public long verifyOopMask;
-    @HotSpotVMValue(expression = "Universe::verify_oop_bits()") @Stable public long verifyOopBits;
-
-    @HotSpotVMField(name = "CollectedHeap::_barrier_set", type = "BarrierSet*", get = HotSpotVMField.Type.OFFSET) @Stable public int collectedHeapBarrierSetOffset;
-
-    @HotSpotVMField(name = "HeapRegion::LogOfHRGrainBytes", type = "int", get = HotSpotVMField.Type.VALUE) @Stable public int logOfHRGrainBytes;
-
-    @HotSpotVMField(name = "BarrierSet::_kind", type = "BarrierSet::Name", get = HotSpotVMField.Type.OFFSET) @Stable private int barrierSetKindOffset;
-    @HotSpotVMConstant(name = "BarrierSet::CardTableModRef") @Stable public int barrierSetCardTableModRef;
-    @HotSpotVMConstant(name = "BarrierSet::CardTableExtension") @Stable public int barrierSetCardTableExtension;
-    @HotSpotVMConstant(name = "BarrierSet::G1SATBCT") @Stable public int barrierSetG1SATBCT;
-    @HotSpotVMConstant(name = "BarrierSet::G1SATBCTLogging") @Stable public int barrierSetG1SATBCTLogging;
-    @HotSpotVMConstant(name = "BarrierSet::ModRef") @Stable public int barrierSetModRef;
-    @HotSpotVMConstant(name = "BarrierSet::Other") @Stable public int barrierSetOther;
-
-    @HotSpotVMField(name = "CardTableModRefBS::byte_map_base", type = "jbyte*", get = HotSpotVMField.Type.OFFSET) @Stable private int cardTableModRefBSByteMapBaseOffset;
-    @HotSpotVMConstant(name = "CardTableModRefBS::card_shift") @Stable public int cardTableModRefBSCardShift;
-
-    @HotSpotVMValue(expression = "(jbyte)CardTableModRefBS::dirty_card_val()") @Stable public byte dirtyCardValue;
-    @HotSpotVMValue(expression = "(jbyte)G1SATBCardTableModRefBS::g1_young_card_val()") @Stable public byte g1YoungCardValue;
-
-    private final long cardtableStartAddress;
-    private final int cardtableShift;
-
-    public long cardtableStartAddress() {
-        if (cardtableStartAddress == -1) {
-            throw GraalInternalError.shouldNotReachHere();
-        }
-        return cardtableStartAddress;
-    }
-
-    public int cardtableShift() {
-        if (cardtableShift == -1) {
-            throw GraalInternalError.shouldNotReachHere();
-        }
-        return cardtableShift;
-    }
-
-    @HotSpotVMField(name = "os::_polling_page", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long safepointPollingAddress;
-
-    // G1 Collector Related Values.
-
-    public int g1CardQueueIndexOffset() {
-        return javaThreadDirtyCardQueueOffset + ptrQueueIndexOffset;
-    }
-
-    public int g1CardQueueBufferOffset() {
-        return javaThreadDirtyCardQueueOffset + ptrQueueBufferOffset;
-    }
-
-    public int g1SATBQueueMarkingOffset() {
-        return javaThreadSatbMarkQueueOffset + ptrQueueActiveOffset;
-    }
-
-    public int g1SATBQueueIndexOffset() {
-        return javaThreadSatbMarkQueueOffset + ptrQueueIndexOffset;
-    }
-
-    public int g1SATBQueueBufferOffset() {
-        return javaThreadSatbMarkQueueOffset + ptrQueueBufferOffset;
-    }
-
-    @HotSpotVMField(name = "java_lang_Class::_klass_offset", type = "int", get = HotSpotVMField.Type.VALUE) @Stable public int klassOffset;
-    @HotSpotVMField(name = "java_lang_Class::_array_klass_offset", type = "int", get = HotSpotVMField.Type.VALUE) @Stable public int arrayKlassOffset;
-
-    @HotSpotVMField(name = "Method::_method_data", type = "MethodData*", get = HotSpotVMField.Type.OFFSET) @Stable public int methodDataOffset;
-    @HotSpotVMField(name = "Method::_from_compiled_entry", type = "address", get = HotSpotVMField.Type.OFFSET) @Stable public int methodCompiledEntryOffset;
-    @HotSpotVMField(name = "Method::_code", type = "nmethod*", get = HotSpotVMField.Type.OFFSET) @Stable public int methodCodeOffset;
-
-    @HotSpotVMField(name = "MethodData::_size", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int methodDataSize;
-    @HotSpotVMField(name = "MethodData::_data_size", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int methodDataDataSize;
-    @HotSpotVMField(name = "MethodData::_data[0]", type = "intptr_t", get = HotSpotVMField.Type.OFFSET) @Stable public int methodDataOopDataOffset;
-    @HotSpotVMField(name = "MethodData::_trap_hist._array[0]", type = "u1", get = HotSpotVMField.Type.OFFSET) @Stable public int methodDataOopTrapHistoryOffset;
-    @HotSpotVMField(name = "MethodData::_graal_node_count", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int methodDataGraalNodeCountOffset;
-
-    @HotSpotVMField(name = "nmethod::_verified_entry_point", type = "address", get = HotSpotVMField.Type.OFFSET) @Stable public int nmethodEntryOffset;
-    @HotSpotVMField(name = "nmethod::_comp_level", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int nmethodCompLevelOffset;
-
-    @HotSpotVMConstant(name = "CompLevel_full_optimization") @Stable public int compilationLevelFullOptimization;
-
-    @HotSpotVMType(name = "BasicLock", get = HotSpotVMType.Type.SIZE) @Stable public int basicLockSize;
-    @HotSpotVMField(name = "BasicLock::_displaced_header", type = "markOop", get = HotSpotVMField.Type.OFFSET) @Stable public int basicLockDisplacedHeaderOffset;
-
-    @HotSpotVMValue(expression = "Universe::heap()->supports_inline_contig_alloc() ? Universe::heap()->end_addr() : (HeapWord**)-1", get = HotSpotVMValue.Type.ADDRESS) @Stable public long heapEndAddress;
-    @HotSpotVMValue(expression = "Universe::heap()->supports_inline_contig_alloc() ? Universe::heap()->top_addr() : (HeapWord**)-1", get = HotSpotVMValue.Type.ADDRESS) @Stable public long heapTopAddress;
-
-    @HotSpotVMField(name = "Thread::_allocated_bytes", type = "jlong", get = HotSpotVMField.Type.OFFSET) @Stable public int threadAllocatedBytesOffset;
-
-    @HotSpotVMFlag(name = "TLABWasteIncrement") @Stable public int tlabRefillWasteIncrement;
-    @HotSpotVMValue(expression = "ThreadLocalAllocBuffer::alignment_reserve()") @Stable public int tlabAlignmentReserve;
-
-    @HotSpotVMField(name = "ThreadLocalAllocBuffer::_start", type = "HeapWord*", get = HotSpotVMField.Type.OFFSET) @Stable private int threadLocalAllocBufferStartOffset;
-    @HotSpotVMField(name = "ThreadLocalAllocBuffer::_end", type = "HeapWord*", get = HotSpotVMField.Type.OFFSET) @Stable private int threadLocalAllocBufferEndOffset;
-    @HotSpotVMField(name = "ThreadLocalAllocBuffer::_top", type = "HeapWord*", get = HotSpotVMField.Type.OFFSET) @Stable private int threadLocalAllocBufferTopOffset;
-    @HotSpotVMField(name = "ThreadLocalAllocBuffer::_pf_top", type = "HeapWord*", get = HotSpotVMField.Type.OFFSET) @Stable private int threadLocalAllocBufferPfTopOffset;
-    @HotSpotVMField(name = "ThreadLocalAllocBuffer::_slow_allocations", type = "unsigned", get = HotSpotVMField.Type.OFFSET) @Stable private int threadLocalAllocBufferSlowAllocationsOffset;
-    @HotSpotVMField(name = "ThreadLocalAllocBuffer::_fast_refill_waste", type = "unsigned", get = HotSpotVMField.Type.OFFSET) @Stable private int threadLocalAllocBufferFastRefillWasteOffset;
-    @HotSpotVMField(name = "ThreadLocalAllocBuffer::_number_of_refills", type = "unsigned", get = HotSpotVMField.Type.OFFSET) @Stable private int threadLocalAllocBufferNumberOfRefillsOffset;
-    @HotSpotVMField(name = "ThreadLocalAllocBuffer::_refill_waste_limit", type = "size_t", get = HotSpotVMField.Type.OFFSET) @Stable private int threadLocalAllocBufferRefillWasteLimitOffset;
-    @HotSpotVMField(name = "ThreadLocalAllocBuffer::_desired_size", type = "size_t", get = HotSpotVMField.Type.OFFSET) @Stable private int threadLocalAllocBufferDesiredSizeOffset;
-
-    public int tlabSlowAllocationsOffset() {
-        return threadTlabOffset + threadLocalAllocBufferSlowAllocationsOffset;
-    }
-
-    public int tlabFastRefillWasteOffset() {
-        return threadTlabOffset + threadLocalAllocBufferFastRefillWasteOffset;
-    }
-
-    public int tlabNumberOfRefillsOffset() {
-        return threadTlabOffset + threadLocalAllocBufferNumberOfRefillsOffset;
-    }
-
-    public int tlabRefillWasteLimitOffset() {
-        return threadTlabOffset + threadLocalAllocBufferRefillWasteLimitOffset;
-    }
-
-    public int threadTlabSizeOffset() {
-        return threadTlabOffset + threadLocalAllocBufferDesiredSizeOffset;
-    }
-
-    public int threadTlabStartOffset() {
-        return threadTlabOffset + threadLocalAllocBufferStartOffset;
-    }
-
-    public int threadTlabEndOffset() {
-        return threadTlabOffset + threadLocalAllocBufferEndOffset;
-    }
-
-    public int threadTlabTopOffset() {
-        return threadTlabOffset + threadLocalAllocBufferTopOffset;
-    }
-
-    public int threadTlabPfTopOffset() {
-        return threadTlabOffset + threadLocalAllocBufferPfTopOffset;
-    }
-
-    @HotSpotVMFlag(name = "TLABStats") @Stable public boolean tlabStats;
-    @HotSpotVMValue(expression = " !CMSIncrementalMode && Universe::heap()->supports_inline_contig_alloc()") @Stable public boolean inlineContiguousAllocationSupported;
-
-    /**
-     * The DataLayout header size is the same as the cell size.
-     */
-    @HotSpotVMConstant(name = "DataLayout::cell_size") @Stable public int dataLayoutHeaderSize;
-    @HotSpotVMField(name = "DataLayout::_header._struct._tag", type = "u1", get = HotSpotVMField.Type.OFFSET) @Stable public int dataLayoutTagOffset;
-    @HotSpotVMField(name = "DataLayout::_header._struct._flags", type = "u1", get = HotSpotVMField.Type.OFFSET) @Stable public int dataLayoutFlagsOffset;
-    @HotSpotVMField(name = "DataLayout::_header._struct._bci", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int dataLayoutBCIOffset;
-    @HotSpotVMField(name = "DataLayout::_cells[0]", type = "intptr_t", get = HotSpotVMField.Type.OFFSET) @Stable public int dataLayoutCellsOffset;
-    @HotSpotVMConstant(name = "DataLayout::cell_size") @Stable public int dataLayoutCellSize;
-
-    @HotSpotVMConstant(name = "DataLayout::no_tag") @Stable public int dataLayoutNoTag;
-    @HotSpotVMConstant(name = "DataLayout::bit_data_tag") @Stable public int dataLayoutBitDataTag;
-    @HotSpotVMConstant(name = "DataLayout::counter_data_tag") @Stable public int dataLayoutCounterDataTag;
-    @HotSpotVMConstant(name = "DataLayout::jump_data_tag") @Stable public int dataLayoutJumpDataTag;
-    @HotSpotVMConstant(name = "DataLayout::receiver_type_data_tag") @Stable public int dataLayoutReceiverTypeDataTag;
-    @HotSpotVMConstant(name = "DataLayout::virtual_call_data_tag") @Stable public int dataLayoutVirtualCallDataTag;
-    @HotSpotVMConstant(name = "DataLayout::ret_data_tag") @Stable public int dataLayoutRetDataTag;
-    @HotSpotVMConstant(name = "DataLayout::branch_data_tag") @Stable public int dataLayoutBranchDataTag;
-    @HotSpotVMConstant(name = "DataLayout::multi_branch_data_tag") @Stable public int dataLayoutMultiBranchDataTag;
-    @HotSpotVMConstant(name = "DataLayout::arg_info_data_tag") @Stable public int dataLayoutArgInfoDataTag;
-    @HotSpotVMConstant(name = "DataLayout::call_type_data_tag") @Stable public int dataLayoutCallTypeDataTag;
-    @HotSpotVMConstant(name = "DataLayout::virtual_call_type_data_tag") @Stable public int dataLayoutVirtualCallTypeDataTag;
-    @HotSpotVMConstant(name = "DataLayout::parameters_type_data_tag") @Stable public int dataLayoutParametersTypeDataTag;
-    @HotSpotVMConstant(name = "DataLayout::speculative_trap_data_tag") @Stable public int dataLayoutSpeculativeTrapDataTag;
-
-    @HotSpotVMFlag(name = "BciProfileWidth") @Stable public int bciProfileWidth;
-    @HotSpotVMFlag(name = "TypeProfileWidth") @Stable public int typeProfileWidth;
-    @HotSpotVMFlag(name = "MethodProfileWidth") @Stable public int methodProfileWidth;
-
-    @HotSpotVMField(name = "CodeBlob::_code_offset", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable private int codeBlobCodeOffsetOffset;
-    @HotSpotVMField(name = "SharedRuntime::_ic_miss_blob", type = "RuntimeStub*", get = HotSpotVMField.Type.VALUE) @Stable private long inlineCacheMissBlob;
-
-    @HotSpotVMValue(expression = "SharedRuntime::deopt_blob()->unpack()", get = HotSpotVMValue.Type.ADDRESS) @Stable public long handleDeoptStub;
-    @HotSpotVMValue(expression = "SharedRuntime::deopt_blob()->uncommon_trap()", get = HotSpotVMValue.Type.ADDRESS) @Stable public long uncommonTrapStub;
-
-    private final long inlineCacheMissStub;
-
-    public long inlineCacheMissStub() {
-        return inlineCacheMissStub;
-    }
-
-    @HotSpotVMField(name = "CodeCache::_heap", type = "CodeHeap*", get = HotSpotVMField.Type.VALUE) @Stable private long codeCacheHeap;
-    @HotSpotVMField(name = "CodeHeap::_memory", type = "VirtualSpace", get = HotSpotVMField.Type.OFFSET) @Stable private int codeHeapMemoryOffset;
-    @HotSpotVMField(name = "VirtualSpace::_low_boundary", type = "char*", get = HotSpotVMField.Type.OFFSET) @Stable private int virtualSpaceLowBoundaryOffset;
-    @HotSpotVMField(name = "VirtualSpace::_high_boundary", type = "char*", get = HotSpotVMField.Type.OFFSET) @Stable private int virtualSpaceHighBoundaryOffset;
-
-    private final long codeCacheLowBoundary;
-    private final long codeCacheHighBoundary;
-
-    /**
-     * @return CodeCache::_heap-&gt;_memory._low_boundary
-     */
-    public long codeCacheLowBoundary() {
-        return codeCacheLowBoundary;
-    }
-
-    /**
-     * @return CodeCache::_heap-&gt;_memory._high_boundary
-     */
-    public long codeCacheHighBoundary() {
-        return codeCacheHighBoundary;
-    }
-
-    @HotSpotVMField(name = "StubRoutines::_aescrypt_encryptBlock", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long aescryptEncryptBlockStub;
-    @HotSpotVMField(name = "StubRoutines::_aescrypt_decryptBlock", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long aescryptDecryptBlockStub;
-    @HotSpotVMField(name = "StubRoutines::_cipherBlockChaining_encryptAESCrypt", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long cipherBlockChainingEncryptAESCryptStub;
-    @HotSpotVMField(name = "StubRoutines::_cipherBlockChaining_decryptAESCrypt", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long cipherBlockChainingDecryptAESCryptStub;
-    @HotSpotVMField(name = "StubRoutines::_updateBytesCRC32", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long updateBytesCRC32Stub;
-    @HotSpotVMField(name = "StubRoutines::_crc_table_adr", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long crcTableAddress;
-
-    @HotSpotVMField(name = "StubRoutines::_jbyte_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jbyteArraycopy;
-    @HotSpotVMField(name = "StubRoutines::_jshort_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jshortArraycopy;
-    @HotSpotVMField(name = "StubRoutines::_jint_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jintArraycopy;
-    @HotSpotVMField(name = "StubRoutines::_jlong_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jlongArraycopy;
-    @HotSpotVMField(name = "StubRoutines::_oop_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long oopArraycopy;
-    @HotSpotVMField(name = "StubRoutines::_oop_arraycopy_uninit", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long oopArraycopyUninit;
-    @HotSpotVMField(name = "StubRoutines::_jbyte_disjoint_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jbyteDisjointArraycopy;
-    @HotSpotVMField(name = "StubRoutines::_jshort_disjoint_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jshortDisjointArraycopy;
-    @HotSpotVMField(name = "StubRoutines::_jint_disjoint_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jintDisjointArraycopy;
-    @HotSpotVMField(name = "StubRoutines::_jlong_disjoint_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jlongDisjointArraycopy;
-    @HotSpotVMField(name = "StubRoutines::_oop_disjoint_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long oopDisjointArraycopy;
-    @HotSpotVMField(name = "StubRoutines::_oop_disjoint_arraycopy_uninit", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long oopDisjointArraycopyUninit;
-    @HotSpotVMField(name = "StubRoutines::_arrayof_jbyte_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jbyteAlignedArraycopy;
-    @HotSpotVMField(name = "StubRoutines::_arrayof_jshort_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jshortAlignedArraycopy;
-    @HotSpotVMField(name = "StubRoutines::_arrayof_jint_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jintAlignedArraycopy;
-    @HotSpotVMField(name = "StubRoutines::_arrayof_jlong_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jlongAlignedArraycopy;
-    @HotSpotVMField(name = "StubRoutines::_arrayof_oop_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long oopAlignedArraycopy;
-    @HotSpotVMField(name = "StubRoutines::_arrayof_oop_arraycopy_uninit", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long oopAlignedArraycopyUninit;
-    @HotSpotVMField(name = "StubRoutines::_arrayof_jbyte_disjoint_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jbyteAlignedDisjointArraycopy;
-    @HotSpotVMField(name = "StubRoutines::_arrayof_jshort_disjoint_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jshortAlignedDisjointArraycopy;
-    @HotSpotVMField(name = "StubRoutines::_arrayof_jint_disjoint_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jintAlignedDisjointArraycopy;
-    @HotSpotVMField(name = "StubRoutines::_arrayof_jlong_disjoint_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jlongAlignedDisjointArraycopy;
-    @HotSpotVMField(name = "StubRoutines::_arrayof_oop_disjoint_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long oopAlignedDisjointArraycopy;
-    @HotSpotVMField(name = "StubRoutines::_arrayof_oop_disjoint_arraycopy_uninit", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long oopAlignedDisjointArraycopyUninit;
-    @HotSpotVMField(name = "StubRoutines::_checkcast_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long checkcastArraycopy;
-    @HotSpotVMField(name = "StubRoutines::_checkcast_arraycopy_uninit", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long checkcastArraycopyUninit;
-    @HotSpotVMField(name = "StubRoutines::_unsafe_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long unsafeArraycopy;
-    @HotSpotVMField(name = "StubRoutines::_generic_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long genericArraycopy;
-
-    @HotSpotVMValue(expression = "GraalRuntime::new_instance", get = HotSpotVMValue.Type.ADDRESS) @Stable public long newInstanceAddress;
-    @HotSpotVMValue(expression = "GraalRuntime::new_array", get = HotSpotVMValue.Type.ADDRESS) @Stable public long newArrayAddress;
-    @HotSpotVMValue(expression = "GraalRuntime::new_multi_array", get = HotSpotVMValue.Type.ADDRESS) @Stable public long newMultiArrayAddress;
-    @HotSpotVMValue(expression = "GraalRuntime::dynamic_new_array", get = HotSpotVMValue.Type.ADDRESS) @Stable public long dynamicNewArrayAddress;
-    @HotSpotVMValue(expression = "GraalRuntime::dynamic_new_instance", get = HotSpotVMValue.Type.ADDRESS) @Stable public long dynamicNewInstanceAddress;
-    @HotSpotVMValue(expression = "GraalRuntime::thread_is_interrupted", get = HotSpotVMValue.Type.ADDRESS) @Stable public long threadIsInterruptedAddress;
-    @HotSpotVMValue(expression = "GraalRuntime::vm_message", signature = "(unsigned char, long, long, long, long)", get = HotSpotVMValue.Type.ADDRESS) @Stable public long vmMessageAddress;
-    @HotSpotVMValue(expression = "GraalRuntime::identity_hash_code", get = HotSpotVMValue.Type.ADDRESS) @Stable public long identityHashCodeAddress;
-    @HotSpotVMValue(expression = "GraalRuntime::exception_handler_for_pc", signature = "(JavaThread*)", get = HotSpotVMValue.Type.ADDRESS) @Stable public long exceptionHandlerForPcAddress;
-    @HotSpotVMValue(expression = "GraalRuntime::monitorenter", get = HotSpotVMValue.Type.ADDRESS) @Stable public long monitorenterAddress;
-    @HotSpotVMValue(expression = "GraalRuntime::monitorexit", get = HotSpotVMValue.Type.ADDRESS) @Stable public long monitorexitAddress;
-    @HotSpotVMValue(expression = "GraalRuntime::create_null_exception", get = HotSpotVMValue.Type.ADDRESS) @Stable public long createNullPointerExceptionAddress;
-    @HotSpotVMValue(expression = "GraalRuntime::create_out_of_bounds_exception", get = HotSpotVMValue.Type.ADDRESS) @Stable public long createOutOfBoundsExceptionAddress;
-    @HotSpotVMValue(expression = "GraalRuntime::log_primitive", get = HotSpotVMValue.Type.ADDRESS) @Stable public long logPrimitiveAddress;
-    @HotSpotVMValue(expression = "GraalRuntime::log_object", get = HotSpotVMValue.Type.ADDRESS) @Stable public long logObjectAddress;
-    @HotSpotVMValue(expression = "GraalRuntime::log_printf", get = HotSpotVMValue.Type.ADDRESS) @Stable public long logPrintfAddress;
-    @HotSpotVMValue(expression = "GraalRuntime::vm_error", get = HotSpotVMValue.Type.ADDRESS) @Stable public long vmErrorAddress;
-    @HotSpotVMValue(expression = "GraalRuntime::load_and_clear_exception", get = HotSpotVMValue.Type.ADDRESS) @Stable public long loadAndClearExceptionAddress;
-    @HotSpotVMValue(expression = "GraalRuntime::write_barrier_pre", get = HotSpotVMValue.Type.ADDRESS) @Stable public long writeBarrierPreAddress;
-    @HotSpotVMValue(expression = "GraalRuntime::write_barrier_post", get = HotSpotVMValue.Type.ADDRESS) @Stable public long writeBarrierPostAddress;
-    @HotSpotVMValue(expression = "GraalRuntime::validate_object", get = HotSpotVMValue.Type.ADDRESS) @Stable public long validateObject;
-
-    @HotSpotVMValue(expression = "GraalRuntime::test_deoptimize_call_int", get = HotSpotVMValue.Type.ADDRESS) @Stable public long testDeoptimizeCallInt;
-
-    @HotSpotVMValue(expression = "SharedRuntime::register_finalizer", get = HotSpotVMValue.Type.ADDRESS) @Stable public long registerFinalizerAddress;
-    @HotSpotVMValue(expression = "SharedRuntime::exception_handler_for_return_address", get = HotSpotVMValue.Type.ADDRESS) @Stable public long exceptionHandlerForReturnAddressAddress;
-    @HotSpotVMValue(expression = "SharedRuntime::OSR_migration_end", get = HotSpotVMValue.Type.ADDRESS) @Stable public long osrMigrationEndAddress;
-
-    @HotSpotVMValue(expression = "os::javaTimeMillis", get = HotSpotVMValue.Type.ADDRESS) @Stable public long javaTimeMillisAddress;
-    @HotSpotVMValue(expression = "os::javaTimeNanos", get = HotSpotVMValue.Type.ADDRESS) @Stable public long javaTimeNanosAddress;
-    @HotSpotVMValue(expression = "SharedRuntime::dsin", get = HotSpotVMValue.Type.ADDRESS) @Stable public long arithmeticSinAddress;
-    @HotSpotVMValue(expression = "SharedRuntime::dcos", get = HotSpotVMValue.Type.ADDRESS) @Stable public long arithmeticCosAddress;
-    @HotSpotVMValue(expression = "SharedRuntime::dtan", get = HotSpotVMValue.Type.ADDRESS) @Stable public long arithmeticTanAddress;
-    @HotSpotVMValue(expression = "SharedRuntime::dexp", get = HotSpotVMValue.Type.ADDRESS) @Stable public long arithmeticExpAddress;
-    @HotSpotVMValue(expression = "SharedRuntime::dlog", get = HotSpotVMValue.Type.ADDRESS) @Stable public long arithmeticLogAddress;
-    @HotSpotVMValue(expression = "SharedRuntime::dlog10", get = HotSpotVMValue.Type.ADDRESS) @Stable public long arithmeticLog10Address;
-    @HotSpotVMValue(expression = "SharedRuntime::dpow", get = HotSpotVMValue.Type.ADDRESS) @Stable public long arithmeticPowAddress;
-
-    @HotSpotVMValue(expression = "(jint) GraalCounterSize") @Stable public int graalCountersSize;
-
-    @HotSpotVMValue(expression = "Deoptimization::fetch_unroll_info", signature = "(JavaThread*)", get = HotSpotVMValue.Type.ADDRESS) @Stable public long deoptimizationFetchUnrollInfo;
-    @HotSpotVMValue(expression = "Deoptimization::uncommon_trap", get = HotSpotVMValue.Type.ADDRESS) @Stable public long deoptimizationUncommonTrap;
-    @HotSpotVMValue(expression = "Deoptimization::unpack_frames", signature = "(JavaThread*, int)", get = HotSpotVMValue.Type.ADDRESS) @Stable public long deoptimizationUnpackFrames;
-
-    @HotSpotVMConstant(name = "Deoptimization::Reason_none") @Stable public int deoptReasonNone;
-    @HotSpotVMConstant(name = "Deoptimization::Reason_null_check") @Stable public int deoptReasonNullCheck;
-    @HotSpotVMConstant(name = "Deoptimization::Reason_range_check") @Stable public int deoptReasonRangeCheck;
-    @HotSpotVMConstant(name = "Deoptimization::Reason_class_check") @Stable public int deoptReasonClassCheck;
-    @HotSpotVMConstant(name = "Deoptimization::Reason_array_check") @Stable public int deoptReasonArrayCheck;
-    @HotSpotVMConstant(name = "Deoptimization::Reason_unreached0") @Stable public int deoptReasonUnreached0;
-    @HotSpotVMConstant(name = "Deoptimization::Reason_type_checked_inlining") @Stable public int deoptReasonTypeCheckInlining;
-    @HotSpotVMConstant(name = "Deoptimization::Reason_optimized_type_check") @Stable public int deoptReasonOptimizedTypeCheck;
-    @HotSpotVMConstant(name = "Deoptimization::Reason_not_compiled_exception_handler") @Stable public int deoptReasonNotCompiledExceptionHandler;
-    @HotSpotVMConstant(name = "Deoptimization::Reason_unresolved") @Stable public int deoptReasonUnresolved;
-    @HotSpotVMConstant(name = "Deoptimization::Reason_jsr_mismatch") @Stable public int deoptReasonJsrMismatch;
-    @HotSpotVMConstant(name = "Deoptimization::Reason_div0_check") @Stable public int deoptReasonDiv0Check;
-    @HotSpotVMConstant(name = "Deoptimization::Reason_constraint") @Stable public int deoptReasonConstraint;
-    @HotSpotVMConstant(name = "Deoptimization::Reason_loop_limit_check") @Stable public int deoptReasonLoopLimitCheck;
-    @HotSpotVMConstant(name = "Deoptimization::Reason_aliasing") @Stable public int deoptReasonAliasing;
-    @HotSpotVMConstant(name = "Deoptimization::Reason_transfer_to_interpreter") @Stable public int deoptReasonTransferToInterpreter;
-    @HotSpotVMConstant(name = "Deoptimization::Reason_LIMIT") @Stable public int deoptReasonOSROffset;
-
-    @HotSpotVMConstant(name = "Deoptimization::Action_none") @Stable public int deoptActionNone;
-    @HotSpotVMConstant(name = "Deoptimization::Action_maybe_recompile") @Stable public int deoptActionMaybeRecompile;
-    @HotSpotVMConstant(name = "Deoptimization::Action_reinterpret") @Stable public int deoptActionReinterpret;
-    @HotSpotVMConstant(name = "Deoptimization::Action_make_not_entrant") @Stable public int deoptActionMakeNotEntrant;
-    @HotSpotVMConstant(name = "Deoptimization::Action_make_not_compilable") @Stable public int deoptActionMakeNotCompilable;
-
-    @HotSpotVMConstant(name = "Deoptimization::_action_bits") @Stable public int deoptimizationActionBits;
-    @HotSpotVMConstant(name = "Deoptimization::_reason_bits") @Stable public int deoptimizationReasonBits;
-    @HotSpotVMConstant(name = "Deoptimization::_debug_id_bits") @Stable public int deoptimizationDebugIdBits;
-    @HotSpotVMConstant(name = "Deoptimization::_action_shift") @Stable public int deoptimizationActionShift;
-    @HotSpotVMConstant(name = "Deoptimization::_reason_shift") @Stable public int deoptimizationReasonShift;
-    @HotSpotVMConstant(name = "Deoptimization::_debug_id_shift") @Stable public int deoptimizationDebugIdShift;
-
-    @HotSpotVMConstant(name = "Deoptimization::Unpack_deopt") @Stable public int deoptimizationUnpackDeopt;
-    @HotSpotVMConstant(name = "Deoptimization::Unpack_exception") @Stable public int deoptimizationUnpackException;
-    @HotSpotVMConstant(name = "Deoptimization::Unpack_uncommon_trap") @Stable public int deoptimizationUnpackUncommonTrap;
-    @HotSpotVMConstant(name = "Deoptimization::Unpack_reexecute") @Stable public int deoptimizationUnpackReexecute;
-
-    @HotSpotVMField(name = "Deoptimization::UnrollBlock::_size_of_deoptimized_frame", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int deoptimizationUnrollBlockSizeOfDeoptimizedFrameOffset;
-    @HotSpotVMField(name = "Deoptimization::UnrollBlock::_caller_adjustment", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int deoptimizationUnrollBlockCallerAdjustmentOffset;
-    @HotSpotVMField(name = "Deoptimization::UnrollBlock::_number_of_frames", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int deoptimizationUnrollBlockNumberOfFramesOffset;
-    @HotSpotVMField(name = "Deoptimization::UnrollBlock::_total_frame_sizes", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int deoptimizationUnrollBlockTotalFrameSizesOffset;
-    @HotSpotVMField(name = "Deoptimization::UnrollBlock::_frame_sizes", type = "intptr_t*", get = HotSpotVMField.Type.OFFSET) @Stable public int deoptimizationUnrollBlockFrameSizesOffset;
-    @HotSpotVMField(name = "Deoptimization::UnrollBlock::_frame_pcs", type = "address*", get = HotSpotVMField.Type.OFFSET) @Stable public int deoptimizationUnrollBlockFramePcsOffset;
-    @HotSpotVMField(name = "Deoptimization::UnrollBlock::_initial_info", type = "intptr_t", get = HotSpotVMField.Type.OFFSET) @Stable public int deoptimizationUnrollBlockInitialInfoOffset;
-
-    @HotSpotVMConstant(name = "vmIntrinsics::_invokeBasic") @Stable public int vmIntrinsicInvokeBasic;
-    @HotSpotVMConstant(name = "vmIntrinsics::_linkToVirtual") @Stable public int vmIntrinsicLinkToVirtual;
-    @HotSpotVMConstant(name = "vmIntrinsics::_linkToStatic") @Stable public int vmIntrinsicLinkToStatic;
-    @HotSpotVMConstant(name = "vmIntrinsics::_linkToSpecial") @Stable public int vmIntrinsicLinkToSpecial;
-    @HotSpotVMConstant(name = "vmIntrinsics::_linkToInterface") @Stable public int vmIntrinsicLinkToInterface;
-
-    @HotSpotVMConstant(name = "GraalEnv::ok") @Stable public int codeInstallResultOk;
-    @HotSpotVMConstant(name = "GraalEnv::dependencies_failed") @Stable public int codeInstallResultDependenciesFailed;
-    @HotSpotVMConstant(name = "GraalEnv::dependencies_invalid") @Stable public int codeInstallResultDependenciesInvalid;
-    @HotSpotVMConstant(name = "GraalEnv::cache_full") @Stable public int codeInstallResultCacheFull;
-    @HotSpotVMConstant(name = "GraalEnv::code_too_large") @Stable public int codeInstallResultCodeTooLarge;
-
-    public String getCodeInstallResultDescription(int codeInstallResult) {
-        if (codeInstallResult == codeInstallResultOk) {
-            return "ok";
-        }
-        if (codeInstallResult == codeInstallResultDependenciesFailed) {
-            return "dependencies failed";
-        }
-        if (codeInstallResult == codeInstallResultDependenciesInvalid) {
-            return "dependencies invalid";
-        }
-        if (codeInstallResult == codeInstallResultCacheFull) {
-            return "code cache is full";
-        }
-        if (codeInstallResult == codeInstallResultCodeTooLarge) {
-            return "code is too large";
-        }
-        assert false : codeInstallResult;
-        return "unknown";
-    }
-
-    @HotSpotVMConstant(name = "CompilerToVM::KLASS_TAG") @Stable public int compilerToVMKlassTag;
-    @HotSpotVMConstant(name = "CompilerToVM::SYMBOL_TAG") @Stable public int compilerToVMSymbolTag;
-
-    // Checkstyle: stop
-    @HotSpotVMConstant(name = "CodeInstaller::VERIFIED_ENTRY") @Stable public int MARKID_VERIFIED_ENTRY;
-    @HotSpotVMConstant(name = "CodeInstaller::UNVERIFIED_ENTRY") @Stable public int MARKID_UNVERIFIED_ENTRY;
-    @HotSpotVMConstant(name = "CodeInstaller::OSR_ENTRY") @Stable public int MARKID_OSR_ENTRY;
-    @HotSpotVMConstant(name = "CodeInstaller::EXCEPTION_HANDLER_ENTRY") @Stable public int MARKID_EXCEPTION_HANDLER_ENTRY;
-    @HotSpotVMConstant(name = "CodeInstaller::DEOPT_HANDLER_ENTRY") @Stable public int MARKID_DEOPT_HANDLER_ENTRY;
-    @HotSpotVMConstant(name = "CodeInstaller::INVOKEINTERFACE") @Stable public int MARKID_INVOKEINTERFACE;
-    @HotSpotVMConstant(name = "CodeInstaller::INVOKEVIRTUAL") @Stable public int MARKID_INVOKEVIRTUAL;
-    @HotSpotVMConstant(name = "CodeInstaller::INVOKESTATIC") @Stable public int MARKID_INVOKESTATIC;
-    @HotSpotVMConstant(name = "CodeInstaller::INVOKESPECIAL") @Stable public int MARKID_INVOKESPECIAL;
-    @HotSpotVMConstant(name = "CodeInstaller::INLINE_INVOKE") @Stable public int MARKID_INLINE_INVOKE;
-    @HotSpotVMConstant(name = "CodeInstaller::POLL_NEAR") @Stable public int MARKID_POLL_NEAR;
-    @HotSpotVMConstant(name = "CodeInstaller::POLL_RETURN_NEAR") @Stable public int MARKID_POLL_RETURN_NEAR;
-    @HotSpotVMConstant(name = "CodeInstaller::POLL_FAR") @Stable public int MARKID_POLL_FAR;
-    @HotSpotVMConstant(name = "CodeInstaller::POLL_RETURN_FAR") @Stable public int MARKID_POLL_RETURN_FAR;
-    @HotSpotVMConstant(name = "CodeInstaller::CARD_TABLE_SHIFT") @Stable public int MARKID_CARD_TABLE_SHIFT;
-    @HotSpotVMConstant(name = "CodeInstaller::CARD_TABLE_ADDRESS") @Stable public int MARKID_CARD_TABLE_ADDRESS;
-    @HotSpotVMConstant(name = "CodeInstaller::INVOKE_INVALID") @Stable public int MARKID_INVOKE_INVALID;
-
-    // Checkstyle: resume
-
-    public boolean check() {
-        for (Field f : getClass().getDeclaredFields()) {
-            int modifiers = f.getModifiers();
-            if (Modifier.isPublic(modifiers) && !Modifier.isStatic(modifiers)) {
-                assert Modifier.isFinal(modifiers) || f.getAnnotation(Stable.class) != null : "field should either be final or @Stable: " + f;
-            }
-        }
-
-        assert codeEntryAlignment > 0 : codeEntryAlignment;
-        assert (layoutHelperArrayTagObjectValue & (1 << (Integer.SIZE - 1))) != 0 : "object array must have first bit set";
-        assert (layoutHelperArrayTagTypeValue & (1 << (Integer.SIZE - 1))) != 0 : "type array must have first bit set";
-
-        return true;
-    }
-
-    /**
-     * A compact representation of the different encoding strategies for Objects and metadata.
-     */
-    public static class CompressEncoding {
-        public final long base;
-        public final int shift;
-        public final int alignment;
-
-        CompressEncoding(long base, int shift, int alignment) {
-            this.base = base;
-            this.shift = shift;
-            this.alignment = alignment;
-        }
-
-        public int compress(long ptr) {
-            if (ptr == 0L) {
-                return 0;
-            } else {
-                return (int) ((ptr - base) >>> shift);
-            }
-        }
-
-        public long uncompress(int ptr) {
-            if (ptr == 0) {
-                return 0L;
-            } else {
-                return ((ptr & 0xFFFFFFFFL) << shift) + base;
-            }
-        }
-
-        @Override
-        public String toString() {
-            return "base: " + base + " shift: " + shift + " alignment: " + alignment;
-        }
-
-        @Override
-        public int hashCode() {
-            final int prime = 31;
-            int result = 1;
-            result = prime * result + alignment;
-            result = prime * result + (int) (base ^ (base >>> 32));
-            result = prime * result + shift;
-            return result;
-        }
-
-        @Override
-        public boolean equals(Object obj) {
-            if (obj instanceof CompressEncoding) {
-                CompressEncoding other = (CompressEncoding) obj;
-                return alignment == other.alignment && base == other.base && shift == other.shift;
-            } else {
-                return false;
-            }
-        }
-    }
-
-    /**
-     * Returns the name of the C/C++ symbol that is associated (via HotSpotVMValue annotation) with
-     * the HotSpotVMConfig object's field containing {@code value}; returns null if no field holds
-     * the provided address.
-     *
-     * @param value value of the field
-     * @return C/C++ symbol name or null
-     */
-    public String getVMValueCSymbol(long value) {
-        for (Field f : HotSpotVMConfig.class.getDeclaredFields()) {
-            if (f.isAnnotationPresent(HotSpotVMValue.class)) {
-                HotSpotVMValue annotation = f.getAnnotation(HotSpotVMValue.class);
-
-                if (annotation.get() == HotSpotVMValue.Type.ADDRESS) {
-                    try {
-                        if (value == f.getLong(this)) {
-                            return (annotation.expression() + annotation.signature());
-                        }
-                    } catch (IllegalArgumentException e1) {
-                        // TODO Auto-generated catch block
-                        e1.printStackTrace();
-                    } catch (IllegalAccessException e1) {
-                        // TODO Auto-generated catch block
-                        e1.printStackTrace();
-                    }
-                }
-            }
-        }
-        return null;
-    }
-
-    /**
-     * Returns the name of the C/C++ symbol that is associated (via HotSpotVMField annotation) with
-     * the HotSpotVMConfig object's field containing {@code value}; returns null if no field holds
-     * the provided address.
-     *
-     * @param value value of the field
-     * @return C/C++ symbol name or null
-     */
-    public String getVMFieldCSymbol(long value) {
-        for (Field f : HotSpotVMConfig.class.getDeclaredFields()) {
-            if (f.isAnnotationPresent(HotSpotVMField.class)) {
-                HotSpotVMField annotation = f.getAnnotation(HotSpotVMField.class);
-
-                if (annotation.get() == HotSpotVMField.Type.VALUE) {
-                    try {
-                        if (value == f.getLong(this)) {
-                            return (annotation.name());
-                        }
-                    } catch (IllegalArgumentException e1) {
-                        // TODO Auto-generated catch block
-                        e1.printStackTrace();
-                    } catch (IllegalAccessException e1) {
-                        // TODO Auto-generated catch block
-                        e1.printStackTrace();
-                    }
-                }
-            }
-        }
-        return null;
-    }
-}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConfigVerifier.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,156 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.hotspot;
-
-import static java.lang.String.*;
-
-import java.io.*;
-import java.lang.reflect.*;
-import java.util.*;
-
-import com.oracle.graal.compiler.common.*;
-
-import jdk.internal.org.objectweb.asm.*;
-import jdk.internal.org.objectweb.asm.Type;
-import sun.misc.*;
-
-/**
- * A {@link ClassVisitor} that verifies {@link HotSpotVMConfig} does not access {@link Unsafe} from
- * any of its non-static, non-constructor methods. This ensures that a deserialized
- * {@link HotSpotVMConfig} object does not perform any unsafe reads on addresses that are only valid
- * in the context in which the object was serialized. Note that this does not catch cases where a
- * client uses an address stored in a {@link HotSpotVMConfig} field.
- */
-final class HotSpotVMConfigVerifier extends ClassVisitor {
-
-    public static boolean check() {
-        Class<?> cls = HotSpotVMConfig.class;
-        String classFilePath = "/" + cls.getName().replace('.', '/') + ".class";
-        try {
-            InputStream classfile = cls.getResourceAsStream(classFilePath);
-            ClassReader cr = new ClassReader(Objects.requireNonNull(classfile, "Could not find class file for " + cls.getName()));
-            ClassVisitor cv = new HotSpotVMConfigVerifier();
-            cr.accept(cv, 0);
-            return true;
-        } catch (IOException e) {
-            throw new GraalInternalError(e);
-        }
-    }
-
-    /**
-     * Source file context for error reporting.
-     */
-    String sourceFile = null;
-
-    /**
-     * Line number for error reporting.
-     */
-    int lineNo = -1;
-
-    private static Class<?> resolve(String name) {
-        try {
-            return Class.forName(name.replace('/', '.'));
-        } catch (ClassNotFoundException e) {
-            throw new InternalError(e);
-        }
-    }
-
-    HotSpotVMConfigVerifier() {
-        super(Opcodes.ASM5);
-    }
-
-    @Override
-    public void visitSource(String source, String debug) {
-        this.sourceFile = source;
-    }
-
-    void verify(boolean condition, String message) {
-        if (!condition) {
-            error(message);
-        }
-    }
-
-    void error(String message) {
-        String errorMessage = format("%s:%d: %s is not allowed in the context of compilation replay. The unsafe access should be moved into the %s constructor and the result cached in a field",
-                        sourceFile, lineNo, message, HotSpotVMConfig.class.getSimpleName());
-        throw new InternalError(errorMessage);
-
-    }
-
-    @Override
-    public MethodVisitor visitMethod(int access, String name, String d, String signature, String[] exceptions) {
-        if (!Modifier.isStatic(access) && Modifier.isPublic(access) && !name.equals("<init>")) {
-            return new MethodVisitor(Opcodes.ASM5) {
-
-                @Override
-                public void visitLineNumber(int line, Label start) {
-                    lineNo = line;
-                }
-
-                private Executable resolveMethod(String owner, String methodName, String methodDesc) {
-                    Class<?> declaringClass = resolve(owner);
-                    while (declaringClass != null) {
-                        if (methodName.equals("<init>")) {
-                            for (Constructor<?> c : declaringClass.getDeclaredConstructors()) {
-                                if (methodDesc.equals(Type.getConstructorDescriptor(c))) {
-                                    return c;
-                                }
-                            }
-                        } else {
-                            Type[] argumentTypes = Type.getArgumentTypes(methodDesc);
-                            for (Method m : declaringClass.getDeclaredMethods()) {
-                                if (m.getName().equals(methodName)) {
-                                    if (Arrays.equals(argumentTypes, Type.getArgumentTypes(m))) {
-                                        if (Type.getReturnType(methodDesc).equals(Type.getReturnType(m))) {
-                                            return m;
-                                        }
-                                    }
-                                }
-                            }
-                        }
-                        declaringClass = declaringClass.getSuperclass();
-                    }
-                    throw new NoSuchMethodError(owner + "." + methodName + methodDesc);
-                }
-
-                /**
-                 * Checks whether a given method is allowed to be called.
-                 */
-                private boolean checkInvokeTarget(Executable method) {
-                    if (method.getDeclaringClass().equals(Unsafe.class)) {
-                        return false;
-                    }
-                    return true;
-                }
-
-                @Override
-                public void visitMethodInsn(int opcode, String owner, String methodName, String methodDesc, boolean itf) {
-                    Executable callee = resolveMethod(owner, methodName, methodDesc);
-                    verify(checkInvokeTarget(callee), "invocation of " + callee);
-                }
-            };
-        } else {
-            return null;
-        }
-    }
-}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVmSymbols.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.hotspot;
-
-import static com.oracle.graal.compiler.common.UnsafeAccess.*;
-import static com.oracle.graal.hotspot.HotSpotGraalRuntime.*;
-import sun.misc.*;
-
-/**
- * Class to access the C++ {@code vmSymbols} table.
- */
-public final class HotSpotVmSymbols {
-
-    /**
-     * Returns the symbol in the {@code vmSymbols} table at position {@code index} as {@link String}
-     * .
-     *
-     * @param index position in the symbol table
-     * @return the symbol at position id
-     */
-    public static String symbolAt(int index) {
-        HotSpotGraalRuntimeProvider runtime = runtime();
-        HotSpotVMConfig config = runtime.getConfig();
-        assert config.vmSymbolsFirstSID <= index && index < config.vmSymbolsSIDLimit : "index " + index + " is out of bounds";
-        assert config.symbolPointerSize == Unsafe.ADDRESS_SIZE : "the following address read is broken";
-        return runtime.getCompilerToVM().getSymbol(unsafe.getAddress(config.vmSymbolsSymbols + index * config.symbolPointerSize));
-    }
-}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/InitTimer.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,82 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.hotspot;
-
-import com.oracle.graal.debug.*;
-
-import edu.umd.cs.findbugs.annotations.*;
-
-/**
- * A facility for timing a step in the runtime initialization sequence. This exists separate from
- * {@link DebugTimer} as it must be independent from all other Graal code so as to not perturb the
- * initialization sequence.
- */
-public final class InitTimer implements AutoCloseable {
-    final String name;
-    final long start;
-
-    private InitTimer(String name) {
-        this.name = name;
-        this.start = System.currentTimeMillis();
-        System.out.println("START: " + SPACES.substring(0, timerDepth * 2) + name);
-        assert Thread.currentThread() == initializingThread : Thread.currentThread() + " != " + initializingThread;
-        timerDepth++;
-    }
-
-    @SuppressFBWarnings(value = "ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD", justification = "only the initializing thread accesses this field")
-    public void close() {
-        final long end = System.currentTimeMillis();
-        timerDepth--;
-        System.out.println(" DONE: " + SPACES.substring(0, timerDepth * 2) + name + " [" + (end - start) + " ms]");
-    }
-
-    public static InitTimer timer(String name) {
-        return ENABLED ? new InitTimer(name) : null;
-    }
-
-    public static InitTimer timer(String name, Object suffix) {
-        return ENABLED ? new InitTimer(name + suffix) : null;
-    }
-
-    /**
-     * Specifies if initialization timing is enabled. This can only be set via a system property as
-     * the timing facility is used to time initialization of {@link HotSpotOptions}.
-     */
-    private static final boolean ENABLED = Boolean.getBoolean("graal.runtime.TimeInit");
-
-    public static int timerDepth = 0;
-    public static final String SPACES = "                                            ";
-
-    /**
-     * Used to assert the invariant that all initialization happens on the same thread.
-     */
-    public static final Thread initializingThread;
-    static {
-        if (ENABLED) {
-            initializingThread = Thread.currentThread();
-            System.out.println("INITIALIZING THREAD: " + initializingThread);
-        } else {
-            initializingThread = null;
-        }
-    }
-}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/PrintStreamOption.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,138 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.hotspot;
-
-import java.io.*;
-import java.lang.management.*;
-
-import com.oracle.graal.hotspot.bridge.*;
-import com.oracle.graal.options.*;
-
-/**
- * An option that encapsulates and configures a print stream.
- */
-public class PrintStreamOption extends OptionValue<String> {
-
-    public PrintStreamOption() {
-        super(null);
-    }
-
-    /**
-     * The print stream to which output will be written.
-     *
-     * Declared {@code volatile} to enable safe use of double-checked locking in
-     * {@link #getStream(CompilerToVM)} and {@link #setValue(Object)}.
-     */
-    private volatile PrintStream ps;
-
-    /**
-     * Replace any instance of %p with a an identifying name. Try to get it from the RuntimeMXBean
-     * name.
-     *
-     * @return the name of the file to log to
-     */
-    private String getFilename() {
-        String name = getValue();
-        if (name.contains("%p")) {
-            String runtimeName = ManagementFactory.getRuntimeMXBean().getName();
-            try {
-                int index = runtimeName.indexOf('@');
-                if (index != -1) {
-                    long pid = Long.parseLong(runtimeName.substring(0, index));
-                    runtimeName = Long.toString(pid);
-                }
-                name = name.replaceAll("%p", runtimeName);
-            } catch (NumberFormatException e) {
-
-            }
-        }
-        return name;
-    }
-
-    /**
-     * Gets the print stream configured by this option. If no file is configured, the print stream
-     * will output to {@link CompilerToVM#writeDebugOutput(byte[], int, int)}.
-     */
-    public PrintStream getStream(final CompilerToVM compilerToVM) {
-        if (ps == null) {
-            if (getValue() != null) {
-                synchronized (this) {
-                    if (ps == null) {
-                        try {
-                            final boolean enableAutoflush = true;
-                            ps = new PrintStream(new FileOutputStream(getFilename()), enableAutoflush);
-                            /* Add the JVM and Java arguments to the log file to help identity it. */
-                            String inputArguments = String.join(" ", ManagementFactory.getRuntimeMXBean().getInputArguments());
-                            ps.println("VM Arguments: " + inputArguments);
-                            String cmd = System.getProperty("sun.java.command");
-                            if (cmd != null) {
-                                ps.println("sun.java.command=" + cmd);
-                            }
-                        } catch (FileNotFoundException e) {
-                            throw new RuntimeException("couldn't open file: " + getValue(), e);
-                        }
-                    }
-                }
-            } else {
-                OutputStream ttyOut = new OutputStream() {
-                    @Override
-                    public void write(byte[] b, int off, int len) throws IOException {
-                        if (b == null) {
-                            throw new NullPointerException();
-                        } else if (off < 0 || off > b.length || len < 0 || (off + len) > b.length || (off + len) < 0) {
-                            throw new IndexOutOfBoundsException();
-                        } else if (len == 0) {
-                            return;
-                        }
-                        compilerToVM.writeDebugOutput(b, off, len);
-                    }
-
-                    @Override
-                    public void write(int b) throws IOException {
-                        write(new byte[]{(byte) b}, 0, 1);
-                    }
-
-                    @Override
-                    public void flush() throws IOException {
-                        compilerToVM.flushDebugOutput();
-                    }
-                };
-                ps = new PrintStream(ttyOut);
-            }
-        }
-        return ps;
-    }
-
-    @Override
-    public void setValue(Object v) {
-        if (ps != null) {
-            synchronized (this) {
-                if (ps != null) {
-                    ps.close();
-                    ps = null;
-                }
-            }
-        }
-        super.setValue(v);
-    }
-}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/Stable.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.oracle.graal.hotspot;
-
-import java.lang.annotation.*;
-
-/**
- * This annotation functions as an alias for the sun.invoke.Stable annotation within Graal code. It
- * is specially recognized during class file parsing in the same way as that annotation.
- */
-
-@Target(ElementType.FIELD)
-@Retention(RetentionPolicy.RUNTIME)
-public @interface Stable {
-}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVM.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,345 +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.graal.hotspot.bridge;
-
-import sun.misc.*;
-
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.hotspot.*;
-import com.oracle.graal.hotspot.meta.*;
-
-import com.oracle.graal.hotspotvmconfig.*;
-
-/**
- * Calls from Java into HotSpot.
- */
-public interface CompilerToVM {
-
-    /**
-     * Copies the original bytecode of a given method into a new byte array and returns it.
-     *
-     * @param metaspaceMethod the metaspace Method object
-     * @return a new byte array containing the original bytecode
-     */
-    byte[] getBytecode(long metaspaceMethod);
-
-    int exceptionTableLength(long metaspaceMethod);
-
-    long exceptionTableStart(long metaspaceMethod);
-
-    /**
-     * Determines if a given metaspace Method object has balanced monitors.
-     *
-     * @param metaspaceMethod the metaspace Method object to query
-     * @return true if the method has balanced monitors
-     */
-    boolean hasBalancedMonitors(long metaspaceMethod);
-
-    /**
-     * Determines if a given metaspace Method can be inlined. A method may not be inlinable for a
-     * number of reasons such as:
-     * <ul>
-     * <li>a CompileOracle directive may prevent inlining or compilation of methods</li>
-     * <li>the method may have a bytecode breakpoint set</li>
-     * <li>the method may have other bytecode features that require special handling by the VM</li>
-     * </ul>
-     *
-     * @param metaspaceMethod the metaspace Method object to query
-     * @return true if the method can be inlined
-     */
-    boolean canInlineMethod(long metaspaceMethod);
-
-    /**
-     * Determines if a given metaspace Method should be inlined at any cost. This could be because:
-     * <ul>
-     * <li>a CompileOracle directive may forces inlining of this methods</li>
-     * <li>an annotation forces inlining of this method</li>
-     * </ul>
-     *
-     * @param metaspaceMethod the metaspace Method object to query
-     * @return true if the method should be inlined
-     */
-    boolean shouldInlineMethod(long metaspaceMethod);
-
-    /**
-     * Used to implement {@link ResolvedJavaType#findUniqueConcreteMethod(ResolvedJavaMethod)}.
-     *
-     * @param metaspaceMethod the metaspace Method on which to based the search
-     * @param actualHolderMetaspaceKlass the best known type of receiver
-     * @return the metaspace Method result or 0 is there is no unique concrete method for
-     *         {@code metaspaceMethod}
-     */
-    long findUniqueConcreteMethod(long actualHolderMetaspaceKlass, long metaspaceMethod);
-
-    /**
-     * Returns the implementor for the given interface class, if there is a single implementor.
-     *
-     * @param metaspaceKlass the metaspace klass to get the implementor for
-     * @return the implementor as metaspace klass pointer if there is a single implementor, null if
-     *         there is no implementor, or the input metaspace klass pointer ({@code metaspaceKlass}
-     *         ) itself if there is more than one implementor.
-     */
-    long getKlassImplementor(long metaspaceKlass);
-
-    /**
-     * Determines if a given metaspace method is ignored by security stack walks.
-     *
-     * @param metaspaceMethod the metaspace Method object
-     * @return true if the method is ignored
-     */
-    boolean methodIsIgnoredBySecurityStackWalk(long metaspaceMethod);
-
-    /**
-     * Converts a name to a metaspace klass.
-     *
-     * @param name a well formed Java type in {@linkplain JavaType#getName() internal} format
-     * @param accessingClass the context of resolution (must not be null)
-     * @param resolve force resolution to a {@link ResolvedJavaType}. If true, this method will
-     *            either return a {@link ResolvedJavaType} or throw an exception
-     * @return a metaspace klass for {@code name}
-     * @throws LinkageError if {@code resolve == true} and the resolution failed
-     */
-    long lookupType(String name, Class<?> accessingClass, boolean resolve);
-
-    Object resolveConstantInPool(long metaspaceConstantPool, int cpi);
-
-    Object resolvePossiblyCachedConstantInPool(long metaspaceConstantPool, int cpi);
-
-    int lookupNameAndTypeRefIndexInPool(long metaspaceConstantPool, int cpi);
-
-    String lookupNameRefInPool(long metaspaceConstantPool, int cpi);
-
-    String lookupSignatureRefInPool(long metaspaceConstantPool, int cpi);
-
-    int lookupKlassRefIndexInPool(long metaspaceConstantPool, int cpi);
-
-    long constantPoolKlassAt(long metaspaceConstantPool, int cpi);
-
-    /**
-     * Looks up a class entry in a constant pool.
-     *
-     * @param metaspaceConstantPool metaspace constant pool pointer
-     * @param cpi constant pool index
-     * @return a metaspace Klass for a resolved method entry, a metaspace Symbol otherwise (with
-     *         tagging)
-     */
-    long lookupKlassInPool(long metaspaceConstantPool, int cpi);
-
-    /**
-     * Looks up a method entry in a constant pool.
-     *
-     * @param metaspaceConstantPool metaspace constant pool pointer
-     * @param cpi constant pool index
-     * @return a metaspace Method for a resolved method entry, 0 otherwise
-     */
-    long lookupMethodInPool(long metaspaceConstantPool, int cpi, byte opcode);
-
-    /**
-     * Looks up a field entry in a constant pool and attempts to resolve it. The values returned in
-     * {@code info} are:
-     *
-     * <pre>
-     *     [(int) flags,   // only valid if field is resolved
-     *      (int) offset]  // only valid if field is resolved
-     * </pre>
-     *
-     * @param metaspaceConstantPool metaspace constant pool pointer
-     * @param cpi constant pool index
-     * @param info an array in which the details of the field are returned
-     * @return true if the field is resolved
-     */
-    long resolveField(long metaspaceConstantPool, int cpi, byte opcode, long[] info);
-
-    int constantPoolRemapInstructionOperandFromCache(long metaspaceConstantPool, int cpi);
-
-    Object lookupAppendixInPool(long metaspaceConstantPool, int cpi);
-
-    /**
-     * Installs the result of a compilation into the code cache.
-     *
-     * @param compiledCode the result of a compilation
-     * @param code the details of the installed CodeBlob are written to this object
-     * @return the outcome of the installation which will be one of
-     *         {@link HotSpotVMConfig#codeInstallResultOk},
-     *         {@link HotSpotVMConfig#codeInstallResultCacheFull},
-     *         {@link HotSpotVMConfig#codeInstallResultCodeTooLarge},
-     *         {@link HotSpotVMConfig#codeInstallResultDependenciesFailed} or
-     *         {@link HotSpotVMConfig#codeInstallResultDependenciesInvalid}.
-     */
-    int installCode(HotSpotCompiledCode compiledCode, InstalledCode code, SpeculationLog speculationLog);
-
-    /**
-     * Notifies the VM of statistics for a completed compilation.
-     *
-     * @param id the identifier of the compilation
-     * @param method the method compiled
-     * @param osr specifies if the compilation was for on-stack-replacement
-     * @param processedBytecodes the number of bytecodes processed during the compilation, including
-     *            the bytecodes of all inlined methods
-     * @param time the amount time spent compiling {@code method}
-     * @param timeUnitsPerSecond the granularity of the units for the {@code time} value
-     * @param installedCode the nmethod installed as a result of the compilation
-     */
-    void notifyCompilationStatistics(int id, HotSpotResolvedJavaMethod method, boolean osr, int processedBytecodes, long time, long timeUnitsPerSecond, InstalledCode installedCode);
-
-    void resetCompilationStatistics();
-
-    void initializeConfiguration(HotSpotVMConfig config);
-
-    long resolveMethod(long metaspaceKlassExactReceiver, long metaspaceMethod, long metaspaceKlassCaller);
-
-    long getClassInitializer(long metaspaceKlass);
-
-    boolean hasFinalizableSubclass(long metaspaceKlass);
-
-    /**
-     * Gets the metaspace Method object corresponding to a given {@link Class} object and slot
-     * number.
-     *
-     * @param holder method holder
-     * @param slot slot number of the method
-     * @return the metaspace Method
-     */
-    long getMetaspaceMethod(Class<?> holder, int slot);
-
-    long getMaxCallTargetOffset(long address);
-
-    String disassembleCodeBlob(long codeBlob);
-
-    StackTraceElement getStackTraceElement(long metaspaceMethod, int bci);
-
-    Object executeCompiledMethod(Object arg1, Object arg2, Object arg3, InstalledCode hotspotInstalledCode) throws InvalidInstalledCodeException;
-
-    Object executeCompiledMethodVarargs(Object[] args, InstalledCode hotspotInstalledCode) throws InvalidInstalledCodeException;
-
-    long[] getLineNumberTable(long metaspaceMethod);
-
-    long getLocalVariableTableStart(long metaspaceMethod);
-
-    int getLocalVariableTableLength(long metaspaceMethod);
-
-    String getFileName(HotSpotResolvedJavaType method);
-
-    Class<?> getJavaMirror(long metaspaceKlass);
-
-    long readUnsafeKlassPointer(Object o);
-
-    /**
-     * Reads an object pointer within a VM data structure. That is, any {@link HotSpotVMField} whose
-     * {@link HotSpotVMField#type() type} is {@code "oop"} (e.g.,
-     * {@code ArrayKlass::_component_mirror}, {@code Klass::_java_mirror},
-     * {@code JavaThread::_threadObj}).
-     *
-     * Note that {@link Unsafe#getObject(Object, long)} cannot be used for this since it does a
-     * {@code narrowOop} read if the VM is using compressed oops whereas oops within VM data
-     * structures are (currently) always uncompressed.
-     *
-     * @param address address of an oop field within a VM data structure
-     */
-    Object readUncompressedOop(long address);
-
-    void doNotInlineOrCompile(long metaspaceMethod);
-
-    /**
-     * Invalidates the profiling information and restarts profiling upon the next invocation.
-     *
-     * @param metaspaceMethod the metaspace Method object
-     */
-    void reprofile(long metaspaceMethod);
-
-    void invalidateInstalledCode(InstalledCode hotspotInstalledCode);
-
-    /**
-     * Collects the current values of all Graal benchmark counters, summed up over all threads.
-     */
-    long[] collectCounters();
-
-    boolean isMature(long metaspaceMethodData);
-
-    /**
-     * Generate a unique id to identify the result of the compile.
-     */
-    int allocateCompileId(long metaspaceMethod, int entryBCI);
-
-    /**
-     * Gets the names of the supported GPU architectures.
-     *
-     * @return a comma separated list of names
-     */
-    String getGPUs();
-
-    /**
-     *
-     * @param metaspaceMethod the method to check
-     * @param entryBCI
-     * @param level the compilation level
-     * @return true if the {@code metaspaceMethod} has code for {@code level}
-     */
-    boolean hasCompiledCodeForOSR(long metaspaceMethod, int entryBCI, int level);
-
-    /**
-     * Fetch the time stamp used for printing inside hotspot. It's relative to VM start to that all
-     * events can be ordered.
-     *
-     * @return milliseconds since VM start
-     */
-    long getTimeStamp();
-
-    /**
-     * Gets the value of a metaspace {@code Symbol} as a String.
-     *
-     * @param metaspaceSymbol
-     */
-    String getSymbol(long metaspaceSymbol);
-
-    /**
-     * Looks for the next Java stack frame with the given method.
-     *
-     * @param frame the starting point of the search, where {@code null} refers to the topmost frame
-     * @param methods the metaspace methods to look for, where {@code null} means that any frame is
-     *            returned
-     * @return the frame, or {@code null} if the end of the stack was reached during the search
-     */
-    HotSpotStackFrameReference getNextStackFrame(HotSpotStackFrameReference frame, long[] methods, int initialSkip);
-
-    /**
-     * Materialized all virtual objects within the given stack frame and update the locals within
-     * the given stackFrame object.
-     *
-     * @param invalidate if {@code true}, the compiled method for the stack frame will be
-     *            invalidated.
-     */
-    void materializeVirtualObjects(HotSpotStackFrameReference stackFrame, boolean invalidate);
-
-    void resolveInvokeDynamic(long metaspaceConstantPool, int index);
-
-    int getVtableIndexForInterface(long metaspaceKlass, long metaspaceMethod);
-
-    boolean shouldDebugNonSafepoints();
-
-    void writeDebugOutput(byte[] bytes, int offset, int length);
-
-    void flushDebugOutput();
-}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVMImpl.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,207 +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.graal.hotspot.bridge;
-
-import static com.oracle.graal.hotspot.InitTimer.*;
-
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.hotspot.*;
-import com.oracle.graal.hotspot.meta.*;
-
-/**
- * Entries into the HotSpot VM from Java code.
- */
-public class CompilerToVMImpl implements CompilerToVM {
-
-    /**
-     * Initializes the native part of the Graal runtime.
-     */
-    private static native void init();
-
-    static {
-        try (InitTimer t = timer("CompilerToVMImpl.init")) {
-            init();
-        }
-    }
-
-    @Override
-    public native int installCode(HotSpotCompiledCode compiledCode, InstalledCode code, SpeculationLog speculationLog);
-
-    @Override
-    public native long getMetaspaceMethod(Class<?> holder, int slot);
-
-    @Override
-    public native byte[] getBytecode(long metaspaceMethod);
-
-    @Override
-    public native int exceptionTableLength(long metaspaceMethod);
-
-    @Override
-    public native long exceptionTableStart(long metaspaceMethod);
-
-    @Override
-    public native boolean hasBalancedMonitors(long metaspaceMethod);
-
-    @Override
-    public native long findUniqueConcreteMethod(long actualHolderMetaspaceKlass, long metaspaceMethod);
-
-    @Override
-    public native long getKlassImplementor(long metaspaceKlass);
-
-    @Override
-    public native long lookupType(String name, Class<?> accessingClass, boolean eagerResolve);
-
-    public native Object resolveConstantInPool(long metaspaceConstantPool, int cpi);
-
-    public native Object resolvePossiblyCachedConstantInPool(long metaspaceConstantPool, int cpi);
-
-    @Override
-    public native int lookupNameAndTypeRefIndexInPool(long metaspaceConstantPool, int cpi);
-
-    @Override
-    public native String lookupNameRefInPool(long metaspaceConstantPool, int cpi);
-
-    @Override
-    public native String lookupSignatureRefInPool(long metaspaceConstantPool, int cpi);
-
-    @Override
-    public native int lookupKlassRefIndexInPool(long metaspaceConstantPool, int cpi);
-
-    public native long constantPoolKlassAt(long metaspaceConstantPool, int cpi);
-
-    @Override
-    public native long lookupKlassInPool(long metaspaceConstantPool, int cpi);
-
-    @Override
-    public native long lookupMethodInPool(long metaspaceConstantPool, int cpi, byte opcode);
-
-    @Override
-    public native long resolveField(long metaspaceConstantPool, int cpi, byte opcode, long[] info);
-
-    public native int constantPoolRemapInstructionOperandFromCache(long metaspaceConstantPool, int cpi);
-
-    @Override
-    public native Object lookupAppendixInPool(long metaspaceConstantPool, int cpi);
-
-    @Override
-    public native void initializeConfiguration(HotSpotVMConfig config);
-
-    @Override
-    public native long resolveMethod(long metaspaceKlassExactReceiver, long metaspaceMethod, long metaspaceKlassCaller);
-
-    @Override
-    public native boolean hasFinalizableSubclass(long metaspaceKlass);
-
-    public native boolean methodIsIgnoredBySecurityStackWalk(long metaspaceMethod);
-
-    @Override
-    public native long getClassInitializer(long metaspaceKlass);
-
-    @Override
-    public native long getMaxCallTargetOffset(long address);
-
-    // The HotSpot disassembler seems not to be thread safe so it's better to synchronize its usage
-    @Override
-    public synchronized native String disassembleCodeBlob(long codeBlob);
-
-    @Override
-    public native StackTraceElement getStackTraceElement(long metaspaceMethod, int bci);
-
-    @Override
-    public native Object executeCompiledMethodVarargs(Object[] args, InstalledCode hotspotInstalledCode);
-
-    @Override
-    public native long[] getLineNumberTable(long metaspaceMethod);
-
-    @Override
-    public native long getLocalVariableTableStart(long metaspaceMethod);
-
-    @Override
-    public native int getLocalVariableTableLength(long metaspaceMethod);
-
-    @Override
-    public native String getFileName(HotSpotResolvedJavaType method);
-
-    @Override
-    public native void reprofile(long metaspaceMethod);
-
-    @Override
-    public native void invalidateInstalledCode(InstalledCode hotspotInstalledCode);
-
-    @Override
-    public native Class<?> getJavaMirror(long metaspaceKlass);
-
-    @Override
-    public native long readUnsafeKlassPointer(Object o);
-
-    @Override
-    public native Object readUncompressedOop(long address);
-
-    @Override
-    public native void doNotInlineOrCompile(long metaspaceMethod);
-
-    @Override
-    public Object executeCompiledMethod(Object arg1, Object arg2, Object arg3, InstalledCode hotspotInstalledCode) throws InvalidInstalledCodeException {
-        return executeCompiledMethodVarargs(new Object[]{arg1, arg2, arg3}, hotspotInstalledCode);
-    }
-
-    public synchronized native void notifyCompilationStatistics(int id, HotSpotResolvedJavaMethod method, boolean osr, int processedBytecodes, long time, long timeUnitsPerSecond,
-                    InstalledCode installedCode);
-
-    public native void resetCompilationStatistics();
-
-    public native long[] collectCounters();
-
-    public native boolean isMature(long method);
-
-    public native int allocateCompileId(long metaspaceMethod, int entryBCI);
-
-    public String getGPUs() {
-        return "";
-    }
-
-    public native boolean canInlineMethod(long metaspaceMethod);
-
-    public native boolean shouldInlineMethod(long metaspaceMethod);
-
-    public native boolean hasCompiledCodeForOSR(long metaspaceMethod, int entryBCI, int level);
-
-    public native HotSpotStackFrameReference getNextStackFrame(HotSpotStackFrameReference frame, long[] methods, int initialSkip);
-
-    public native void materializeVirtualObjects(HotSpotStackFrameReference stackFrame, boolean invalidate);
-
-    public native long getTimeStamp();
-
-    public native String getSymbol(long metaspaceSymbol);
-
-    public native void resolveInvokeDynamic(long metaspaceConstantPool, int index);
-
-    public native int getVtableIndexForInterface(long metaspaceKlass, long metaspaceMethod);
-
-    public native boolean shouldDebugNonSafepoints();
-
-    public native void writeDebugOutput(byte[] bytes, int offset, int length);
-
-    public native void flushDebugOutput();
-}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/debug/BenchmarkCounters.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/debug/BenchmarkCounters.java	Thu May 28 21:11:28 2015 -0700
@@ -28,13 +28,12 @@
 import java.util.concurrent.*;
 import java.util.concurrent.atomic.*;
 
-import com.oracle.graal.compiler.common.*;
-import com.oracle.graal.debug.*;
-import com.oracle.graal.hotspot.*;
-import com.oracle.graal.hotspot.bridge.*;
 import com.oracle.graal.hotspot.replacements.*;
 import com.oracle.graal.nodes.debug.*;
-import com.oracle.graal.options.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.hotspot.*;
+import com.oracle.jvmci.options.*;
 
 import edu.umd.cs.findbugs.annotations.*;
 
@@ -124,9 +123,9 @@
     }
 
     @SuppressFBWarnings(value = "AT_OPERATION_SEQUENCE_ON_CONCURRENT_ABSTRACTION", justification = "concurrent abstraction calls are in synchronized block")
-    private static Counter getCounter(String name, String group, HotSpotVMConfig config) throws GraalInternalError {
+    private static Counter getCounter(String name, String group, HotSpotVMConfig config) throws JVMCIError {
         if (!enabled) {
-            throw new GraalInternalError("cannot access count index when counters are not enabled: " + group + ", " + name);
+            throw new JVMCIError("cannot access count index when counters are not enabled: " + group + ", " + name);
         }
         String nameGroup = name + "#" + group;
         Counter counter = counterMap.get(nameGroup);
@@ -140,9 +139,9 @@
             }
         }
         assert counter.group.equals(group) : "mismatching groups: " + counter.group + " vs. " + group;
-        int countersSize = config.graalCountersSize;
+        int countersSize = config.jvmciCountersSize;
         if (counter.index >= countersSize) {
-            throw new GraalInternalError("too many counters, reduce number of counters or increase -XX:GraalCounterSize=... (current value: " + countersSize + ")");
+            throw new JVMCIError("too many counters, reduce number of counters or increase -XX:GraalCounterSize=... (current value: " + countersSize + ")");
         }
         return counter;
     }
@@ -358,7 +357,7 @@
         if (Options.BenchmarkDynamicCounters.getValue() != null) {
             String[] arguments = Options.BenchmarkDynamicCounters.getValue().split(",");
             if (arguments.length == 0 || (arguments.length % 3) != 0) {
-                throw new GraalInternalError("invalid arguments to BenchmarkDynamicCounters: (err|out),start,end,(err|out),start,end,... (~ matches multiple digits)");
+                throw new JVMCIError("invalid arguments to BenchmarkDynamicCounters: (err|out),start,end,(err|out),start,end,... (~ matches multiple digits)");
             }
             for (int i = 0; i < arguments.length; i += 3) {
                 if (arguments[i].equals("err")) {
@@ -366,7 +365,7 @@
                 } else if (arguments[i].equals("out")) {
                     System.setOut(new PrintStream(new BenchmarkCountersOutputStream(System.out, arguments[i + 1], arguments[i + 2])));
                 } else {
-                    throw new GraalInternalError("invalid arguments to BenchmarkDynamicCounters: err|out");
+                    throw new JVMCIError("invalid arguments to BenchmarkDynamicCounters: err|out");
                 }
             }
             enabled = true;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/events/EmptyEventProvider.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/events/EmptyEventProvider.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,7 @@
  */
 package com.oracle.graal.hotspot.events;
 
-import com.oracle.graal.compiler.common.*;
+import com.oracle.jvmci.common.*;
 
 /**
  * An empty implementation for {@link EventProvider}. This implementation is used when no logging is
@@ -36,7 +36,7 @@
 
     class EmptyCompilationEvent implements CompilationEvent {
         public void commit() {
-            throw GraalInternalError.shouldNotReachHere();
+            throw JVMCIError.shouldNotReachHere();
         }
 
         public boolean shouldWrite() {
@@ -51,31 +51,31 @@
         }
 
         public void setMethod(String method) {
-            throw GraalInternalError.shouldNotReachHere();
+            throw JVMCIError.shouldNotReachHere();
         }
 
         public void setCompileId(int compileId) {
-            throw GraalInternalError.shouldNotReachHere();
+            throw JVMCIError.shouldNotReachHere();
         }
 
         public void setCompileLevel(int compileLevel) {
-            throw GraalInternalError.shouldNotReachHere();
+            throw JVMCIError.shouldNotReachHere();
         }
 
         public void setSucceeded(boolean succeeded) {
-            throw GraalInternalError.shouldNotReachHere();
+            throw JVMCIError.shouldNotReachHere();
         }
 
         public void setIsOsr(boolean isOsr) {
-            throw GraalInternalError.shouldNotReachHere();
+            throw JVMCIError.shouldNotReachHere();
         }
 
         public void setCodeSize(int codeSize) {
-            throw GraalInternalError.shouldNotReachHere();
+            throw JVMCIError.shouldNotReachHere();
         }
 
         public void setInlinedBytes(int inlinedBytes) {
-            throw GraalInternalError.shouldNotReachHere();
+            throw JVMCIError.shouldNotReachHere();
         }
     }
 
@@ -85,7 +85,7 @@
 
     class EmptyCompilerFailureEvent implements CompilerFailureEvent {
         public void commit() {
-            throw GraalInternalError.shouldNotReachHere();
+            throw JVMCIError.shouldNotReachHere();
         }
 
         public boolean shouldWrite() {
@@ -94,11 +94,11 @@
         }
 
         public void setCompileId(int compileId) {
-            throw GraalInternalError.shouldNotReachHere();
+            throw JVMCIError.shouldNotReachHere();
         }
 
         public void setMessage(String message) {
-            throw GraalInternalError.shouldNotReachHere();
+            throw JVMCIError.shouldNotReachHere();
         }
     }
 
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/logging/CountingProxy.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,107 +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.graal.hotspot.logging;
-
-import java.lang.reflect.*;
-import java.util.*;
-import java.util.concurrent.*;
-import java.util.concurrent.atomic.*;
-
-import com.oracle.graal.debug.*;
-
-/**
- * A java.lang.reflect proxy that hierarchically logs all method invocations along with their
- * parameters and return values.
- */
-public class CountingProxy<T> implements InvocationHandler {
-
-    public static final boolean ENABLED = Boolean.valueOf(System.getProperty("graal.countcalls"));
-
-    private T delegate;
-
-    private ConcurrentHashMap<Method, AtomicLong> calls = new ConcurrentHashMap<>();
-
-    public CountingProxy(T delegate) {
-        assert ENABLED;
-        TTY.println("Counting proxy for " + delegate.getClass().getSimpleName() + " created");
-        this.delegate = delegate;
-        proxies.add(this);
-    }
-
-    @Override
-    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
-        int argCount = args == null ? 0 : args.length;
-        if (method.getParameterTypes().length != argCount) {
-            throw new RuntimeException("wrong parameter count");
-        }
-        final Object result;
-        if (!calls.containsKey(method)) {
-            calls.putIfAbsent(method, new AtomicLong(0));
-        }
-        AtomicLong count = calls.get(method);
-        count.incrementAndGet();
-        try {
-            if (args == null) {
-                result = method.invoke(delegate);
-            } else {
-                result = method.invoke(delegate, args);
-            }
-        } catch (InvocationTargetException e) {
-            throw e.getCause();
-        }
-        return result;
-    }
-
-    public static <T> T getProxy(Class<T> interf, T delegate) {
-        Class<?>[] interfaces = ProxyUtil.getAllInterfaces(delegate.getClass());
-        Object obj = Proxy.newProxyInstance(interf.getClassLoader(), interfaces, new CountingProxy<>(delegate));
-        return interf.cast(obj);
-    }
-
-    private static ArrayList<CountingProxy<?>> proxies = new ArrayList<>();
-
-    static {
-        if (ENABLED) {
-            Runtime.getRuntime().addShutdownHook(new Thread() {
-
-                @Override
-                public void run() {
-                    for (CountingProxy<?> proxy : proxies) {
-                        proxy.print();
-                    }
-                }
-            });
-        }
-    }
-
-    protected void print() {
-        long sum = 0;
-        for (Map.Entry<Method, AtomicLong> entry : calls.entrySet()) {
-            Method method = entry.getKey();
-            long count = entry.getValue().get();
-            sum += count;
-            TTY.println(delegate.getClass().getSimpleName() + "." + method.getName() + ": " + count);
-        }
-        TTY.println(delegate.getClass().getSimpleName() + " calls: " + sum);
-    }
-}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/logging/Logger.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,199 +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.graal.hotspot.logging;
-
-import java.io.*;
-import java.lang.reflect.*;
-import java.util.*;
-
-import com.oracle.graal.debug.*;
-import com.oracle.graal.hotspot.bridge.*;
-
-/**
- * Scoped logging class used to display the call hierarchy of {@link CompilerToVM} calls.
- */
-public class Logger {
-
-    public static final boolean ENABLED = Boolean.valueOf(System.getProperty("graal.debug"));
-    private static final int SPACING = 4;
-    private static final ThreadLocal<Logger> loggerTL;
-
-    private Deque<Boolean> openStack = new LinkedList<>();
-    private boolean open = false;
-    private int level = 0;
-
-    private static final PrintStream out;
-
-    static {
-        if (ENABLED) {
-            loggerTL = new ThreadLocal<Logger>() {
-
-                @Override
-                protected Logger initialValue() {
-                    return new Logger();
-                }
-            };
-        } else {
-            loggerTL = null;
-        }
-
-        PrintStream ps = null;
-        String filename = System.getProperty("graal.info_file");
-        if (filename != null && !"".equals(filename)) {
-            try {
-                ps = new PrintStream(new FileOutputStream(filename));
-            } catch (FileNotFoundException e) {
-                e.printStackTrace();
-                ps = null;
-            }
-        }
-        out = ps;
-        if (out != null) {
-            out.println("start: " + new Date());
-        }
-    }
-
-    public static void info(String message) {
-        if (ENABLED) {
-            log(message);
-        } else {
-            TTY.println(message);
-        }
-        if (out != null) {
-            out.println(message);
-            out.flush();
-        }
-    }
-
-    public static void log(String message) {
-        if (ENABLED) {
-            Logger logger = loggerTL.get();
-            for (String line : message.split("\n")) {
-                if (logger.open) {
-                    TTY.println("...");
-                    logger.open = false;
-                }
-                TTY.print(space(logger.level));
-                TTY.println(line);
-            }
-        }
-    }
-
-    public static void startScope(String message) {
-        if (ENABLED) {
-            Logger logger = loggerTL.get();
-            if (logger.open) {
-                TTY.println("...");
-                logger.open = false;
-            }
-            TTY.print(space(logger.level));
-            TTY.print(message);
-            logger.openStack.push(logger.open);
-            logger.open = true;
-            logger.level++;
-        }
-    }
-
-    public static void endScope(String message) {
-        if (ENABLED) {
-            Logger logger = loggerTL.get();
-            logger.level--;
-            if (logger.open) {
-                TTY.println(message);
-            } else {
-                TTY.println(space(logger.level) + "..." + message);
-            }
-            logger.open = logger.openStack.pop();
-        }
-    }
-
-    private static String[] spaces = new String[50];
-
-    private static String space(int count) {
-        assert count >= 0;
-        String result;
-        if (count >= spaces.length || spaces[count] == null) {
-            StringBuilder str = new StringBuilder();
-            for (int i = 0; i < count * SPACING; i++) {
-                str.append(' ');
-            }
-            result = str.toString();
-            if (count < spaces.length) {
-                spaces[count] = result;
-            }
-        } else {
-            result = spaces[count];
-        }
-        return result;
-    }
-
-    public static String pretty(Object value) {
-        if (value == null) {
-            return "null";
-        }
-
-        Class<?> klass = value.getClass();
-        if (value instanceof Void) {
-            return "void";
-        } else if (value instanceof String) {
-            return "\"" + value + "\"";
-        } else if (value instanceof Method) {
-            return "method \"" + ((Method) value).getName() + "\"";
-        } else if (value instanceof Class<?>) {
-            return "class \"" + ((Class<?>) value).getSimpleName() + "\"";
-        } else if (value instanceof Integer) {
-            if ((Integer) value < 10) {
-                return value.toString();
-            }
-            return value + " (0x" + Integer.toHexString((Integer) value) + ")";
-        } else if (value instanceof Long) {
-            if ((Long) value < 10 && (Long) value > -10) {
-                return value + "l";
-            }
-            return value + "l (0x" + Long.toHexString((Long) value) + "l)";
-        } else if (klass.isArray()) {
-            StringBuilder str = new StringBuilder();
-            int dimensions = 0;
-            while (klass.isArray()) {
-                dimensions++;
-                klass = klass.getComponentType();
-            }
-            int length = Array.getLength(value);
-            str.append(klass.getSimpleName()).append('[').append(length).append(']');
-            for (int i = 1; i < dimensions; i++) {
-                str.append("[]");
-            }
-            str.append(" {");
-            for (int i = 0; i < length; i++) {
-                str.append(pretty(Array.get(value, i)));
-                if (i < length - 1) {
-                    str.append(", ");
-                }
-            }
-            str.append('}');
-            return str.toString();
-        }
-
-        return value.toString();
-    }
-}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/logging/LoggingProxy.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +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.graal.hotspot.logging;
-
-import java.lang.reflect.*;
-
-/**
- * A java.lang.reflect proxy that hierarchically logs all method invocations along with their
- * parameters and return values.
- */
-public class LoggingProxy<T> implements InvocationHandler {
-
-    private T delegate;
-
-    public LoggingProxy(T delegate) {
-        this.delegate = delegate;
-    }
-
-    @Override
-    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
-        int argCount = args == null ? 0 : args.length;
-        if (method.getParameterTypes().length != argCount) {
-            throw new RuntimeException("wrong parameter count");
-        }
-        StringBuilder str = new StringBuilder();
-        str.append(method.getReturnType().getSimpleName() + " " + method.getDeclaringClass().getSimpleName() + "." + method.getName() + "(");
-        for (int i = 0; i < argCount; i++) {
-            str.append(i == 0 ? "" : ", ");
-            str.append(Logger.pretty(args[i]));
-        }
-        str.append(")");
-        Logger.startScope(str.toString());
-        final Object result;
-        try {
-            if (args == null) {
-                result = method.invoke(delegate);
-            } else {
-                result = method.invoke(delegate, args);
-            }
-        } catch (InvocationTargetException e) {
-            Logger.endScope(" = Exception " + e.getMessage());
-            throw e.getCause();
-        }
-        Logger.endScope(" = " + Logger.pretty(result));
-        return result;
-    }
-
-    /**
-     * The object returned by this method will implement all interfaces that are implemented by
-     * delegate.
-     */
-    public static <T> T getProxy(Class<T> interf, T delegate) {
-        Class<?>[] interfaces = ProxyUtil.getAllInterfaces(delegate.getClass());
-        Object obj = Proxy.newProxyInstance(interf.getClassLoader(), interfaces, new LoggingProxy<>(delegate));
-        return interf.cast(obj);
-    }
-}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/logging/ProxyUtil.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +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.graal.hotspot.logging;
-
-import java.util.*;
-
-public final class ProxyUtil {
-
-    public static Class<?>[] getAllInterfaces(Class<?> clazz) {
-        HashSet<Class<?>> interfaces = new HashSet<>();
-        getAllInterfaces(clazz, interfaces);
-        return interfaces.toArray(new Class<?>[interfaces.size()]);
-    }
-
-    private static void getAllInterfaces(Class<?> clazz, HashSet<Class<?>> interfaces) {
-        for (Class<?> iface : clazz.getInterfaces()) {
-            if (!interfaces.contains(iface)) {
-                interfaces.add(iface);
-                getAllInterfaces(iface, interfaces);
-            }
-        }
-        if (clazz.getSuperclass() != null) {
-            getAllInterfaces(clazz.getSuperclass(), interfaces);
-        }
-    }
-}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/logging/package-info.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +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.
- */
-/**
- * Logging framework for the HotSpot CRI implementation.
- */
-package com.oracle.graal.hotspot.logging;
-
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/DefaultHotSpotLoweringProvider.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/DefaultHotSpotLoweringProvider.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,18 @@
  */
 package com.oracle.graal.hotspot.meta;
 
-import static com.oracle.graal.api.meta.LocationIdentity.*;
+import com.oracle.jvmci.code.ForeignCallsProvider;
+import com.oracle.jvmci.code.CallingConvention;
+import com.oracle.jvmci.code.TargetDescription;
+import com.oracle.jvmci.meta.ResolvedJavaField;
+import com.oracle.jvmci.meta.JavaType;
+import com.oracle.jvmci.meta.MetaAccessProvider;
+import com.oracle.jvmci.meta.JavaConstant;
+import com.oracle.jvmci.meta.LocationIdentity;
+import com.oracle.jvmci.meta.ResolvedJavaType;
+import com.oracle.jvmci.meta.ForeignCallDescriptor;
+import com.oracle.jvmci.meta.Kind;
+import static com.oracle.jvmci.meta.LocationIdentity.*;
 import static com.oracle.graal.compiler.common.GraalOptions.*;
 import static com.oracle.graal.hotspot.meta.HotSpotForeignCallsProviderImpl.*;
 import static com.oracle.graal.hotspot.replacements.HotSpotReplacementsUtil.*;
@@ -30,9 +41,6 @@
 
 import java.lang.ref.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.hotspot.*;
@@ -46,11 +54,13 @@
 import com.oracle.graal.nodes.extended.*;
 import com.oracle.graal.nodes.java.*;
 import com.oracle.graal.nodes.memory.*;
-import com.oracle.graal.nodes.memory.HeapAccess.*;
+import com.oracle.graal.nodes.memory.HeapAccess.BarrierType;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.type.*;
 import com.oracle.graal.replacements.*;
 import com.oracle.graal.replacements.nodes.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.hotspot.*;
 
 /**
  * HotSpot implementation of {@link LoweringProvider}.
@@ -417,7 +427,7 @@
                 } else if (node.getExceptionClass() == ArrayIndexOutOfBoundsException.class) {
                     exception = Exceptions.cachedArrayIndexOutOfBoundsException;
                 } else {
-                    throw GraalInternalError.shouldNotReachHere();
+                    throw JVMCIError.shouldNotReachHere();
                 }
                 FloatingNode exceptionNode = ConstantNode.forConstant(HotSpotObjectConstantImpl.forObject(exception), metaAccess, graph);
                 graph.replaceFixedWithFloating(node, exceptionNode);
@@ -429,7 +439,7 @@
                 } else if (node.getExceptionClass() == ArrayIndexOutOfBoundsException.class) {
                     descriptor = RuntimeCalls.CREATE_OUT_OF_BOUNDS_EXCEPTION;
                 } else {
-                    throw GraalInternalError.shouldNotReachHere();
+                    throw JVMCIError.shouldNotReachHere();
                 }
 
                 ForeignCallNode foreignCallNode = graph.add(new ForeignCallNode(foreignCalls, descriptor, node.stamp(), node.getArguments()));
@@ -521,7 +531,7 @@
 
     @Override
     protected int arrayBaseOffset(Kind kind) {
-        return runtime.getArrayBaseOffset(kind);
+        return runtime.getJVMCIRuntime().getArrayBaseOffset(kind);
     }
 
     @Override
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotCodeCacheProvider.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,333 +0,0 @@
-/*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.hotspot.meta;
-
-import static com.oracle.graal.hotspot.meta.HotSpotCompressedNullConstant.*;
-
-import java.lang.reflect.*;
-import java.util.*;
-
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.code.CodeUtil.DefaultRefMapFormatter;
-import com.oracle.graal.api.code.CodeUtil.RefMapFormatter;
-import com.oracle.graal.api.code.CompilationResult.Call;
-import com.oracle.graal.api.code.CompilationResult.ConstantReference;
-import com.oracle.graal.api.code.CompilationResult.DataPatch;
-import com.oracle.graal.api.code.CompilationResult.Infopoint;
-import com.oracle.graal.api.code.CompilationResult.Mark;
-import com.oracle.graal.api.code.DataSection.Data;
-import com.oracle.graal.api.code.DataSection.DataBuilder;
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.common.*;
-import com.oracle.graal.debug.*;
-import com.oracle.graal.hotspot.*;
-import com.oracle.graal.hotspot.bridge.*;
-import com.oracle.graal.printer.*;
-
-/**
- * HotSpot implementation of {@link CodeCacheProvider}.
- */
-public class HotSpotCodeCacheProvider implements CodeCacheProvider {
-
-    protected final HotSpotGraalRuntimeProvider runtime;
-    public final HotSpotVMConfig config;
-    protected final TargetDescription target;
-    protected final RegisterConfig regConfig;
-
-    public HotSpotCodeCacheProvider(HotSpotGraalRuntimeProvider runtime, HotSpotVMConfig config, TargetDescription target, RegisterConfig regConfig) {
-        this.runtime = runtime;
-        this.config = config;
-        this.target = target;
-        this.regConfig = regConfig;
-    }
-
-    @Override
-    public String disassemble(CompilationResult compResult, InstalledCode installedCode) {
-        byte[] code = installedCode == null ? Arrays.copyOf(compResult.getTargetCode(), compResult.getTargetCodeSize()) : installedCode.getCode();
-        if (code == null) {
-            // Method was deoptimized/invalidated
-            return "";
-        }
-        long start = installedCode == null ? 0L : installedCode.getStart();
-        HexCodeFile hcf = new HexCodeFile(code, start, target.arch.getName(), target.wordSize * 8);
-        if (compResult != null) {
-            HexCodeFile.addAnnotations(hcf, compResult.getAnnotations());
-            addExceptionHandlersComment(compResult, hcf);
-            Register fp = regConfig.getFrameRegister();
-            RefMapFormatter slotFormatter = new DefaultRefMapFormatter(target.arch, target.wordSize, fp, 0);
-            for (Infopoint infopoint : compResult.getInfopoints()) {
-                if (infopoint instanceof Call) {
-                    Call call = (Call) infopoint;
-                    if (call.debugInfo != null) {
-                        hcf.addComment(call.pcOffset + call.size, CodeUtil.append(new StringBuilder(100), call.debugInfo, slotFormatter).toString());
-                    }
-                    addOperandComment(hcf, call.pcOffset, "{" + getTargetName(call) + "}");
-                } else {
-                    if (infopoint.debugInfo != null) {
-                        hcf.addComment(infopoint.pcOffset, CodeUtil.append(new StringBuilder(100), infopoint.debugInfo, slotFormatter).toString());
-                    }
-                    addOperandComment(hcf, infopoint.pcOffset, "{infopoint: " + infopoint.reason + "}");
-                }
-            }
-            for (DataPatch site : compResult.getDataPatches()) {
-                hcf.addOperandComment(site.pcOffset, "{" + site.reference.toString() + "}");
-            }
-            for (Mark mark : compResult.getMarks()) {
-                hcf.addComment(mark.pcOffset, getMarkIdName((int) mark.id));
-            }
-        }
-        String hcfEmbeddedString = hcf.toEmbeddedString();
-        return HexCodeFileDisTool.tryDisassemble(hcfEmbeddedString);
-    }
-
-    /**
-     * Interface to the tool for disassembling an {@link HexCodeFile#toEmbeddedString() embedded}
-     * {@link HexCodeFile}.
-     */
-    static class HexCodeFileDisTool {
-        static final Method processMethod;
-        static {
-            Method toolMethod = null;
-            try {
-                Class<?> toolClass = Class.forName("com.oracle.max.hcfdis.HexCodeFileDis", true, ClassLoader.getSystemClassLoader());
-                toolMethod = toolClass.getDeclaredMethod("processEmbeddedString", String.class);
-            } catch (Exception e) {
-                // Tool not available on the class path
-            }
-            processMethod = toolMethod;
-        }
-
-        public static String tryDisassemble(String hcfEmbeddedString) {
-            if (processMethod != null) {
-                try {
-                    return (String) processMethod.invoke(null, hcfEmbeddedString);
-                } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
-                    // If the tool is available, for now let's be noisy when it fails
-                    throw new GraalInternalError(e);
-                }
-            }
-            return hcfEmbeddedString;
-        }
-    }
-
-    private String getMarkIdName(int markId) {
-        Field[] fields = runtime.getConfig().getClass().getDeclaredFields();
-        for (Field f : fields) {
-            if (f.getName().startsWith("MARKID_")) {
-                f.setAccessible(true);
-                try {
-                    if (f.getInt(runtime.getConfig()) == markId) {
-                        return f.getName();
-                    }
-                } catch (Exception e) {
-                }
-            }
-        }
-        return String.valueOf(markId);
-    }
-
-    /**
-     * Decodes a call target to a mnemonic if possible.
-     */
-    private String getTargetName(Call call) {
-        Field[] fields = runtime.getConfig().getClass().getDeclaredFields();
-        for (Field f : fields) {
-            if (f.getName().endsWith("Stub")) {
-                f.setAccessible(true);
-                try {
-                    Object address = f.get(runtime.getConfig());
-                    if (address.equals(call.target)) {
-                        return f.getName() + ":0x" + Long.toHexString((Long) address);
-                    }
-                } catch (Exception e) {
-                }
-            }
-        }
-        return String.valueOf(call.target);
-    }
-
-    private static void addExceptionHandlersComment(CompilationResult compResult, HexCodeFile hcf) {
-        if (!compResult.getExceptionHandlers().isEmpty()) {
-            String nl = HexCodeFile.NEW_LINE;
-            StringBuilder buf = new StringBuilder("------ Exception Handlers ------").append(nl);
-            for (CompilationResult.ExceptionHandler e : compResult.getExceptionHandlers()) {
-                buf.append("    ").append(e.pcOffset).append(" -> ").append(e.handlerPos).append(nl);
-                hcf.addComment(e.pcOffset, "[exception -> " + e.handlerPos + "]");
-                hcf.addComment(e.handlerPos, "[exception handler for " + e.pcOffset + "]");
-            }
-            hcf.addComment(0, buf.toString());
-        }
-    }
-
-    private static void addOperandComment(HexCodeFile hcf, int pos, String comment) {
-        String oldValue = hcf.addOperandComment(pos, comment);
-        assert oldValue == null : "multiple comments for operand of instruction at " + pos + ": " + comment + ", " + oldValue;
-    }
-
-    @Override
-    public RegisterConfig getRegisterConfig() {
-        return regConfig;
-    }
-
-    @Override
-    public int getMinimumOutgoingSize() {
-        return runtime.getConfig().runtimeCallStackSize;
-    }
-
-    public InstalledCode logOrDump(InstalledCode installedCode, CompilationResult compResult) {
-        if (Debug.isDumpEnabled()) {
-            Debug.dump(new Object[]{compResult, installedCode}, "After code installation");
-        }
-        if (Debug.isLogEnabled()) {
-            Debug.log("%s", disassemble(installedCode));
-        }
-        return installedCode;
-    }
-
-    public InstalledCode installMethod(HotSpotResolvedJavaMethod method, CompilationResult compResult, long graalEnv, boolean isDefault) {
-        if (compResult.getId() == -1) {
-            compResult.setId(method.allocateCompileId(compResult.getEntryBCI()));
-        }
-        HotSpotInstalledCode installedCode = new HotSpotNmethod(method, compResult.getName(), isDefault);
-        runtime.getCompilerToVM().installCode(new HotSpotCompiledNmethod(method, compResult, graalEnv), installedCode, method.getSpeculationLog());
-        return logOrDump(installedCode, compResult);
-    }
-
-    @Override
-    public InstalledCode addMethod(ResolvedJavaMethod method, CompilationResult compResult, SpeculationLog log, InstalledCode predefinedInstalledCode) {
-        HotSpotResolvedJavaMethod hotspotMethod = (HotSpotResolvedJavaMethod) method;
-        if (compResult.getId() == -1) {
-            compResult.setId(hotspotMethod.allocateCompileId(compResult.getEntryBCI()));
-        }
-        InstalledCode installedCode = predefinedInstalledCode;
-        if (installedCode == null) {
-            HotSpotInstalledCode code = new HotSpotNmethod(hotspotMethod, compResult.getName(), false);
-            installedCode = code;
-        }
-        HotSpotCompiledNmethod compiledCode = new HotSpotCompiledNmethod(hotspotMethod, compResult);
-        int result = runtime.getCompilerToVM().installCode(compiledCode, installedCode, log);
-        if (result != config.codeInstallResultOk) {
-            String msg = compiledCode.getInstallationFailureMessage();
-            String resultDesc = config.getCodeInstallResultDescription(result);
-            if (msg != null) {
-                msg = String.format("Code installation failed: %s%n%s", resultDesc, msg);
-            } else {
-                msg = String.format("Code installation failed: %s", resultDesc);
-            }
-            if (result == config.codeInstallResultDependenciesInvalid) {
-                throw new AssertionError(resultDesc + " " + msg);
-            }
-            throw new BailoutException(result != config.codeInstallResultDependenciesFailed, msg);
-        }
-        return logOrDump(installedCode, compResult);
-    }
-
-    @Override
-    public InstalledCode setDefaultMethod(ResolvedJavaMethod method, CompilationResult compResult) {
-        HotSpotResolvedJavaMethod hotspotMethod = (HotSpotResolvedJavaMethod) method;
-        return installMethod(hotspotMethod, compResult, 0L, true);
-    }
-
-    public HotSpotNmethod addExternalMethod(ResolvedJavaMethod method, CompilationResult compResult) {
-        HotSpotResolvedJavaMethod javaMethod = (HotSpotResolvedJavaMethod) method;
-        if (compResult.getId() == -1) {
-            compResult.setId(javaMethod.allocateCompileId(compResult.getEntryBCI()));
-        }
-        HotSpotNmethod code = new HotSpotNmethod(javaMethod, compResult.getName(), false, true);
-        HotSpotCompiledNmethod compiled = new HotSpotCompiledNmethod(javaMethod, compResult);
-        CompilerToVM vm = runtime.getCompilerToVM();
-        int result = vm.installCode(compiled, code, null);
-        if (result != runtime.getConfig().codeInstallResultOk) {
-            return null;
-        }
-        return code;
-    }
-
-    public boolean needsDataPatch(JavaConstant constant) {
-        return constant instanceof HotSpotMetaspaceConstant;
-    }
-
-    public Data createDataItem(Constant constant) {
-        int size;
-        DataBuilder builder;
-        if (constant instanceof VMConstant) {
-            VMConstant vmConstant = (VMConstant) constant;
-            boolean compressed;
-            long raw;
-            if (constant instanceof HotSpotObjectConstant) {
-                HotSpotObjectConstant c = (HotSpotObjectConstant) vmConstant;
-                compressed = c.isCompressed();
-                raw = 0xDEADDEADDEADDEADL;
-            } else if (constant instanceof HotSpotMetaspaceConstant) {
-                HotSpotMetaspaceConstant meta = (HotSpotMetaspaceConstant) constant;
-                compressed = meta.isCompressed();
-                raw = meta.rawValue();
-            } else {
-                throw GraalInternalError.shouldNotReachHere();
-            }
-
-            size = target.getSizeInBytes(compressed ? Kind.Int : target.wordKind);
-            if (size == 4) {
-                builder = (buffer, patch) -> {
-                    patch.accept(new DataPatch(buffer.position(), new ConstantReference(vmConstant)));
-                    buffer.putInt((int) raw);
-                };
-            } else {
-                assert size == 8;
-                builder = (buffer, patch) -> {
-                    patch.accept(new DataPatch(buffer.position(), new ConstantReference(vmConstant)));
-                    buffer.putLong(raw);
-                };
-            }
-        } else if (JavaConstant.isNull(constant)) {
-            boolean compressed = COMPRESSED_NULL.equals(constant);
-            size = target.getSizeInBytes(compressed ? Kind.Int : target.wordKind);
-            builder = DataBuilder.zero(size);
-        } else if (constant instanceof SerializableConstant) {
-            SerializableConstant s = (SerializableConstant) constant;
-            size = s.getSerializedSize();
-            builder = DataBuilder.serializable(s);
-        } else {
-            throw GraalInternalError.shouldNotReachHere();
-        }
-
-        return new Data(size, size, builder);
-    }
-
-    @Override
-    public TargetDescription getTarget() {
-        return target;
-    }
-
-    public String disassemble(InstalledCode code) {
-        if (code.isValid()) {
-            long codeBlob = code.getAddress();
-            return runtime.getCompilerToVM().disassembleCodeBlob(codeBlob);
-        }
-        return null;
-    }
-
-    public SpeculationLog createSpeculationLog() {
-        return new HotSpotSpeculationLog();
-    }
-}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotCompressedNullConstant.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,102 +0,0 @@
-/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.hotspot.meta;
-
-import com.oracle.graal.api.meta.*;
-
-/**
- * The compressed representation of the {@link JavaConstant#NULL_POINTER null constant}.
- */
-public final class HotSpotCompressedNullConstant extends AbstractValue implements JavaConstant, HotSpotConstant {
-
-    public static final JavaConstant COMPRESSED_NULL = new HotSpotCompressedNullConstant();
-
-    private HotSpotCompressedNullConstant() {
-        super(LIRKind.reference(Kind.Int));
-    }
-
-    @Override
-    public boolean isNull() {
-        return true;
-    }
-
-    @Override
-    public boolean isCompressed() {
-        return true;
-    }
-
-    @Override
-    public boolean isDefaultForKind() {
-        return true;
-    }
-
-    @Override
-    public Object asBoxedPrimitive() {
-        throw new IllegalArgumentException();
-    }
-
-    @Override
-    public int asInt() {
-        throw new IllegalArgumentException();
-    }
-
-    @Override
-    public boolean asBoolean() {
-        throw new IllegalArgumentException();
-    }
-
-    @Override
-    public long asLong() {
-        throw new IllegalArgumentException();
-    }
-
-    @Override
-    public float asFloat() {
-        throw new IllegalArgumentException();
-    }
-
-    @Override
-    public double asDouble() {
-        throw new IllegalArgumentException();
-    }
-
-    @Override
-    public String toString() {
-        return JavaConstant.toString(this);
-    }
-
-    @Override
-    public String toValueString() {
-        return "null";
-    }
-
-    @Override
-    public int hashCode() {
-        return System.identityHashCode(this);
-    }
-
-    @Override
-    public boolean equals(Object o) {
-        return o instanceof HotSpotCompressedNullConstant;
-    }
-}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotConstant.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.hotspot.meta;
-
-import com.oracle.graal.api.meta.*;
-
-/**
- * Marker interface for hotspot specific constants.
- */
-public interface HotSpotConstant extends Constant {
-
-    boolean isCompressed();
-}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotConstantPool.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,618 +0,0 @@
-/*
- * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.hotspot.meta;
-
-import static com.oracle.graal.compiler.common.UnsafeAccess.*;
-import static com.oracle.graal.hotspot.HotSpotGraalRuntime.*;
-
-import java.lang.invoke.*;
-
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.bytecode.*;
-import com.oracle.graal.compiler.common.*;
-import com.oracle.graal.hotspot.*;
-
-/**
- * Implementation of {@link ConstantPool} for HotSpot.
- */
-public class HotSpotConstantPool implements ConstantPool, HotSpotProxified {
-
-    /**
-     * Enum of all {@code JVM_CONSTANT} constants used in the VM. This includes the public and
-     * internal ones.
-     */
-    private enum JVM_CONSTANT {
-        // @formatter:off
-        Utf8(config().jvmConstantUtf8),
-        Integer(config().jvmConstantInteger),
-        Long(config().jvmConstantLong),
-        Float(config().jvmConstantFloat),
-        Double(config().jvmConstantDouble),
-        Class(config().jvmConstantClass),
-        UnresolvedClass(config().jvmConstantUnresolvedClass),
-        UnresolvedClassInError(config().jvmConstantUnresolvedClassInError),
-        String(config().jvmConstantString),
-        Fieldref(config().jvmConstantFieldref),
-        MethodRef(config().jvmConstantMethodref),
-        InterfaceMethodref(config().jvmConstantInterfaceMethodref),
-        NameAndType(config().jvmConstantNameAndType),
-        MethodHandle(config().jvmConstantMethodHandle),
-        MethodHandleInError(config().jvmConstantMethodHandleInError),
-        MethodType(config().jvmConstantMethodType),
-        MethodTypeInError(config().jvmConstantMethodTypeInError),
-        InvokeDynamic(config().jvmConstantInvokeDynamic);
-        // @formatter:on
-
-        private final int tag;
-
-        private static final int ExternalMax = config().jvmConstantExternalMax;
-        private static final int InternalMin = config().jvmConstantInternalMin;
-        private static final int InternalMax = config().jvmConstantInternalMax;
-
-        private JVM_CONSTANT(int tag) {
-            this.tag = tag;
-        }
-
-        private static HotSpotVMConfig config() {
-            return runtime().getConfig();
-        }
-
-        /**
-         * Maps JVM_CONSTANT tags to {@link JVM_CONSTANT} values. Using a separate class for lazy
-         * initialization.
-         */
-        static class TagValueMap {
-            private static final JVM_CONSTANT[] table = new JVM_CONSTANT[ExternalMax + 1 + (InternalMax - InternalMin) + 1];
-            static {
-                assert InternalMin > ExternalMax;
-                for (JVM_CONSTANT e : values()) {
-                    table[indexOf(e.tag)] = e;
-                }
-            }
-
-            private static int indexOf(int tag) {
-                if (tag >= InternalMin) {
-                    return tag - InternalMin + ExternalMax + 1;
-                } else {
-                    assert tag <= ExternalMax;
-                }
-                return tag;
-            }
-
-            static JVM_CONSTANT get(int tag) {
-                JVM_CONSTANT res = table[indexOf(tag)];
-                if (res != null) {
-                    return res;
-                }
-                throw GraalInternalError.shouldNotReachHere("unknown JVM_CONSTANT tag " + tag);
-            }
-        }
-
-        public static JVM_CONSTANT getEnum(int tag) {
-            return TagValueMap.get(tag);
-        }
-    }
-
-    private static class LookupTypeCacheElement {
-        int lastCpi = Integer.MIN_VALUE;
-        JavaType javaType;
-
-        public LookupTypeCacheElement(int lastCpi, JavaType javaType) {
-            super();
-            this.lastCpi = lastCpi;
-            this.javaType = javaType;
-        }
-    }
-
-    /**
-     * Reference to the C++ ConstantPool object.
-     */
-    private final long metaspaceConstantPool;
-    private final Object[] cache;
-    private volatile LookupTypeCacheElement lastLookupType;
-
-    public HotSpotConstantPool(long metaspaceConstantPool) {
-        this.metaspaceConstantPool = metaspaceConstantPool;
-        cache = new Object[length()];
-    }
-
-    /**
-     * Gets the holder for this constant pool as {@link HotSpotResolvedObjectTypeImpl}.
-     *
-     * @return holder for this constant pool
-     */
-    private HotSpotResolvedObjectType getHolder() {
-        final long metaspaceKlass = unsafe.getAddress(metaspaceConstantPool + runtime().getConfig().constantPoolHolderOffset);
-        return HotSpotResolvedObjectTypeImpl.fromMetaspaceKlass(metaspaceKlass);
-    }
-
-    /**
-     * Converts a raw index from the bytecodes to a constant pool index by adding a
-     * {@link HotSpotVMConfig#constantPoolCpCacheIndexTag constant}.
-     *
-     * @param rawIndex index from the bytecode
-     * @param opcode bytecode to convert the index for
-     * @return constant pool index
-     */
-    private static int toConstantPoolIndex(int rawIndex, int opcode) {
-        int index;
-        if (opcode == Bytecodes.INVOKEDYNAMIC) {
-            index = rawIndex;
-            // See: ConstantPool::is_invokedynamic_index
-            assert index < 0 : "not an invokedynamic constant pool index " + index;
-        } else {
-            assert opcode == Bytecodes.GETFIELD || opcode == Bytecodes.PUTFIELD || opcode == Bytecodes.GETSTATIC || opcode == Bytecodes.PUTSTATIC || opcode == Bytecodes.INVOKEINTERFACE ||
-                            opcode == Bytecodes.INVOKEVIRTUAL || opcode == Bytecodes.INVOKESPECIAL || opcode == Bytecodes.INVOKESTATIC : "unexpected invoke opcode " + Bytecodes.nameOf(opcode);
-            index = rawIndex + runtime().getConfig().constantPoolCpCacheIndexTag;
-        }
-        return index;
-    }
-
-    /**
-     * Decode a constant pool cache index to a constant pool index.
-     *
-     * See {@code ConstantPool::decode_cpcache_index}.
-     *
-     * @param index constant pool cache index
-     * @return decoded index
-     */
-    private static int decodeConstantPoolCacheIndex(int index) {
-        if (isInvokedynamicIndex(index)) {
-            return decodeInvokedynamicIndex(index);
-        } else {
-            return index - runtime().getConfig().constantPoolCpCacheIndexTag;
-        }
-    }
-
-    /**
-     * See {@code ConstantPool::is_invokedynamic_index}.
-     */
-    private static boolean isInvokedynamicIndex(int index) {
-        return index < 0;
-    }
-
-    /**
-     * See {@code ConstantPool::decode_invokedynamic_index}.
-     */
-    private static int decodeInvokedynamicIndex(int i) {
-        assert isInvokedynamicIndex(i) : i;
-        return ~i;
-    }
-
-    /**
-     * Gets the constant pool tag at index {@code index}.
-     *
-     * @param index constant pool index
-     * @return constant pool tag
-     */
-    private JVM_CONSTANT getTagAt(int index) {
-        assertBounds(index);
-        HotSpotVMConfig config = runtime().getConfig();
-        final long metaspaceConstantPoolTags = unsafe.getAddress(metaspaceConstantPool + config.constantPoolTagsOffset);
-        final int tag = unsafe.getByteVolatile(null, metaspaceConstantPoolTags + config.arrayU1DataOffset + index);
-        if (tag == 0) {
-            return null;
-        }
-        return JVM_CONSTANT.getEnum(tag);
-    }
-
-    /**
-     * Gets the constant pool entry at index {@code index}.
-     *
-     * @param index constant pool index
-     * @return constant pool entry
-     */
-    private long getEntryAt(int index) {
-        assertBounds(index);
-        return unsafe.getAddress(metaspaceConstantPool + runtime().getConfig().constantPoolSize + index * runtime().getTarget().wordSize);
-    }
-
-    /**
-     * Gets the integer constant pool entry at index {@code index}.
-     *
-     * @param index constant pool index
-     * @return integer constant pool entry at index
-     */
-    private int getIntAt(int index) {
-        assertTag(index, JVM_CONSTANT.Integer);
-        return unsafe.getInt(metaspaceConstantPool + runtime().getConfig().constantPoolSize + index * runtime().getTarget().wordSize);
-    }
-
-    /**
-     * Gets the long constant pool entry at index {@code index}.
-     *
-     * @param index constant pool index
-     * @return long constant pool entry
-     */
-    private long getLongAt(int index) {
-        assertTag(index, JVM_CONSTANT.Long);
-        return unsafe.getLong(metaspaceConstantPool + runtime().getConfig().constantPoolSize + index * runtime().getTarget().wordSize);
-    }
-
-    /**
-     * Gets the float constant pool entry at index {@code index}.
-     *
-     * @param index constant pool index
-     * @return float constant pool entry
-     */
-    private float getFloatAt(int index) {
-        assertTag(index, JVM_CONSTANT.Float);
-        return unsafe.getFloat(metaspaceConstantPool + runtime().getConfig().constantPoolSize + index * runtime().getTarget().wordSize);
-    }
-
-    /**
-     * Gets the double constant pool entry at index {@code index}.
-     *
-     * @param index constant pool index
-     * @return float constant pool entry
-     */
-    private double getDoubleAt(int index) {
-        assertTag(index, JVM_CONSTANT.Double);
-        return unsafe.getDouble(metaspaceConstantPool + runtime().getConfig().constantPoolSize + index * runtime().getTarget().wordSize);
-    }
-
-    /**
-     * Gets the {@code JVM_CONSTANT_NameAndType} constant pool entry at index {@code index}.
-     *
-     * @param index constant pool index
-     * @return {@code JVM_CONSTANT_NameAndType} constant pool entry
-     */
-    private int getNameAndTypeAt(int index) {
-        assertTag(index, JVM_CONSTANT.NameAndType);
-        return unsafe.getInt(metaspaceConstantPool + runtime().getConfig().constantPoolSize + index * runtime().getTarget().wordSize);
-    }
-
-    /**
-     * Gets the {@code JVM_CONSTANT_NameAndType} reference index constant pool entry at index
-     * {@code index}.
-     *
-     * @param index constant pool index
-     * @return {@code JVM_CONSTANT_NameAndType} reference constant pool entry
-     */
-    private int getNameAndTypeRefIndexAt(int index) {
-        return runtime().getCompilerToVM().lookupNameAndTypeRefIndexInPool(metaspaceConstantPool, index);
-    }
-
-    /**
-     * Gets the name of a {@code JVM_CONSTANT_NameAndType} constant pool entry at index
-     * {@code index}.
-     *
-     * @param index constant pool index
-     * @return name as {@link String}
-     */
-    private String getNameRefAt(int index) {
-        return runtime().getCompilerToVM().lookupNameRefInPool(metaspaceConstantPool, index);
-    }
-
-    /**
-     * Gets the name reference index of a {@code JVM_CONSTANT_NameAndType} constant pool entry at
-     * index {@code index}.
-     *
-     * @param index constant pool index
-     * @return name reference index
-     */
-    private int getNameRefIndexAt(int index) {
-        final int refIndex = getNameAndTypeAt(index);
-        // name ref index is in the low 16-bits.
-        return refIndex & 0xFFFF;
-    }
-
-    /**
-     * Gets the signature of a {@code JVM_CONSTANT_NameAndType} constant pool entry at index
-     * {@code index}.
-     *
-     * @param index constant pool index
-     * @return signature as {@link String}
-     */
-    private String getSignatureRefAt(int index) {
-        return runtime().getCompilerToVM().lookupSignatureRefInPool(metaspaceConstantPool, index);
-    }
-
-    /**
-     * Gets the signature reference index of a {@code JVM_CONSTANT_NameAndType} constant pool entry
-     * at index {@code index}.
-     *
-     * @param index constant pool index
-     * @return signature reference index
-     */
-    private int getSignatureRefIndexAt(int index) {
-        final int refIndex = getNameAndTypeAt(index);
-        // signature ref index is in the high 16-bits.
-        return refIndex >>> 16;
-    }
-
-    /**
-     * Gets the klass reference index constant pool entry at index {@code index}.
-     *
-     * @param index constant pool index
-     * @return klass reference index
-     */
-    private int getKlassRefIndexAt(int index) {
-        return runtime().getCompilerToVM().lookupKlassRefIndexInPool(metaspaceConstantPool, index);
-    }
-
-    /**
-     * Gets the uncached klass reference index constant pool entry at index {@code index}. See:
-     * {@code ConstantPool::uncached_klass_ref_index_at}.
-     *
-     * @param index constant pool index
-     * @return klass reference index
-     */
-    private int getUncachedKlassRefIndexAt(int index) {
-        assert getTagAt(index) == JVM_CONSTANT.Fieldref || getTagAt(index) == JVM_CONSTANT.MethodRef || getTagAt(index) == JVM_CONSTANT.InterfaceMethodref;
-        final int refIndex = unsafe.getInt(metaspaceConstantPool + runtime().getConfig().constantPoolSize + index * runtime().getTarget().wordSize);
-        // klass ref index is in the low 16-bits.
-        return refIndex & 0xFFFF;
-    }
-
-    /**
-     * Asserts that the constant pool index {@code index} is in the bounds of the constant pool.
-     *
-     * @param index constant pool index
-     */
-    private void assertBounds(int index) {
-        assert 0 <= index && index < length() : "index " + index + " not between 0 and " + length();
-    }
-
-    /**
-     * Asserts that the constant pool tag at index {@code index} is equal to {@code tag}.
-     *
-     * @param index constant pool index
-     * @param tag expected tag
-     */
-    private void assertTag(int index, JVM_CONSTANT tag) {
-        assert getTagAt(index) == tag : "constant pool tag at index " + index + " is " + getTagAt(index) + " but expected " + tag;
-    }
-
-    @Override
-    public int length() {
-        return unsafe.getInt(metaspaceConstantPool + runtime().getConfig().constantPoolLengthOffset);
-    }
-
-    @Override
-    public Object lookupConstant(int cpi) {
-        assert cpi != 0;
-        final JVM_CONSTANT tag = getTagAt(cpi);
-        switch (tag) {
-            case Integer:
-                return JavaConstant.forInt(getIntAt(cpi));
-            case Long:
-                return JavaConstant.forLong(getLongAt(cpi));
-            case Float:
-                return JavaConstant.forFloat(getFloatAt(cpi));
-            case Double:
-                return JavaConstant.forDouble(getDoubleAt(cpi));
-            case Class:
-            case UnresolvedClass:
-            case UnresolvedClassInError:
-                final int opcode = -1;  // opcode is not used
-                return lookupType(cpi, opcode);
-            case String:
-                Object string = runtime().getCompilerToVM().resolvePossiblyCachedConstantInPool(metaspaceConstantPool, cpi);
-                return HotSpotObjectConstantImpl.forObject(string);
-            case MethodHandle:
-            case MethodHandleInError:
-            case MethodType:
-            case MethodTypeInError:
-                Object obj = runtime().getCompilerToVM().resolveConstantInPool(metaspaceConstantPool, cpi);
-                return HotSpotObjectConstantImpl.forObject(obj);
-            default:
-                throw GraalInternalError.shouldNotReachHere("unknown constant pool tag " + tag);
-        }
-    }
-
-    @Override
-    public String lookupUtf8(int cpi) {
-        assertTag(cpi, JVM_CONSTANT.Utf8);
-        return runtime().getCompilerToVM().getSymbol(getEntryAt(cpi));
-    }
-
-    @Override
-    public Signature lookupSignature(int cpi) {
-        return new HotSpotSignature(runtime(), lookupUtf8(cpi));
-    }
-
-    @Override
-    public JavaConstant lookupAppendix(int cpi, int opcode) {
-        assert Bytecodes.isInvoke(opcode);
-        final int index = toConstantPoolIndex(cpi, opcode);
-        Object result = runtime().getCompilerToVM().lookupAppendixInPool(metaspaceConstantPool, index);
-        if (result == null) {
-            return null;
-        } else {
-            return HotSpotObjectConstantImpl.forObject(result);
-        }
-    }
-
-    /**
-     * Gets a {@link JavaType} corresponding a given metaspace Klass or a metaspace Symbol depending
-     * on the {@link HotSpotVMConfig#compilerToVMKlassTag tag}.
-     *
-     * @param metaspacePointer either a metaspace Klass or a metaspace Symbol
-     */
-    private static JavaType getJavaType(final long metaspacePointer) {
-        HotSpotGraalRuntimeProvider runtime = runtime();
-        HotSpotVMConfig config = runtime.getConfig();
-        if ((metaspacePointer & config.compilerToVMSymbolTag) != 0) {
-            final long metaspaceSymbol = metaspacePointer & ~config.compilerToVMSymbolTag;
-            String name = runtime.getCompilerToVM().getSymbol(metaspaceSymbol);
-            return HotSpotUnresolvedJavaType.create(runtime(), "L" + name + ";");
-        } else {
-            assert (metaspacePointer & config.compilerToVMKlassTag) == 0;
-            return HotSpotResolvedObjectTypeImpl.fromMetaspaceKlass(metaspacePointer);
-        }
-    }
-
-    @Override
-    public JavaMethod lookupMethod(int cpi, int opcode) {
-        if (opcode != Bytecodes.INVOKEDYNAMIC) {
-            Object result = cache[cpi];
-            if (result != null) {
-                return (ResolvedJavaMethod) result;
-            }
-        }
-        final int index = toConstantPoolIndex(cpi, opcode);
-        final long metaspaceMethod = runtime().getCompilerToVM().lookupMethodInPool(metaspaceConstantPool, index, (byte) opcode);
-        if (metaspaceMethod != 0L) {
-            HotSpotResolvedJavaMethod result = HotSpotResolvedJavaMethodImpl.fromMetaspace(metaspaceMethod);
-            if (opcode != Bytecodes.INVOKEDYNAMIC) {
-                cache[cpi] = result;
-            }
-            return result;
-        } else {
-            // Get the method's name and signature.
-            String name = getNameRefAt(index);
-            HotSpotSignature signature = new HotSpotSignature(runtime(), getSignatureRefAt(index));
-            if (opcode == Bytecodes.INVOKEDYNAMIC) {
-                HotSpotResolvedObjectType holder = HotSpotResolvedObjectTypeImpl.fromObjectClass(MethodHandle.class);
-                return new HotSpotMethodUnresolved(name, signature, holder);
-            } else {
-                final int klassIndex = getKlassRefIndexAt(index);
-                final long metaspacePointer = runtime().getCompilerToVM().lookupKlassInPool(metaspaceConstantPool, klassIndex);
-                JavaType holder = getJavaType(metaspacePointer);
-                return new HotSpotMethodUnresolved(name, signature, holder);
-            }
-        }
-    }
-
-    @Override
-    public JavaType lookupType(int cpi, int opcode) {
-        final LookupTypeCacheElement elem = this.lastLookupType;
-        if (elem != null && elem.lastCpi == cpi) {
-            return elem.javaType;
-        } else {
-            final long metaspacePointer = runtime().getCompilerToVM().lookupKlassInPool(metaspaceConstantPool, cpi);
-            JavaType result = getJavaType(metaspacePointer);
-            if (result instanceof ResolvedJavaType) {
-                this.lastLookupType = new LookupTypeCacheElement(cpi, result);
-            }
-            return result;
-        }
-    }
-
-    @Override
-    public JavaField lookupField(int cpi, int opcode) {
-        Object resolvedJavaField = cache[cpi];
-        if (resolvedJavaField != null) {
-            return (ResolvedJavaField) resolvedJavaField;
-        }
-        final int index = toConstantPoolIndex(cpi, opcode);
-        final int nameAndTypeIndex = getNameAndTypeRefIndexAt(index);
-        final int nameIndex = getNameRefIndexAt(nameAndTypeIndex);
-        String name = lookupUtf8(nameIndex);
-        final int typeIndex = getSignatureRefIndexAt(nameAndTypeIndex);
-        String typeName = lookupUtf8(typeIndex);
-        JavaType type = runtime().lookupType(typeName, getHolder(), false);
-
-        final int holderIndex = getKlassRefIndexAt(index);
-        JavaType holder = lookupType(holderIndex, opcode);
-
-        if (holder instanceof HotSpotResolvedObjectTypeImpl) {
-            long[] info = new long[2];
-            long metaspaceKlass;
-            try {
-                metaspaceKlass = runtime().getCompilerToVM().resolveField(metaspaceConstantPool, index, (byte) opcode, info);
-            } catch (Throwable t) {
-                /*
-                 * If there was an exception resolving the field we give up and return an unresolved
-                 * field.
-                 */
-                return new HotSpotUnresolvedField(holder, name, type);
-            }
-            HotSpotResolvedObjectTypeImpl resolvedHolder = HotSpotResolvedObjectTypeImpl.fromMetaspaceKlass(metaspaceKlass);
-            final int flags = (int) info[0];
-            final long offset = info[1];
-            HotSpotResolvedJavaField result = resolvedHolder.createField(name, type, offset, flags);
-            if (type instanceof ResolvedJavaType) {
-                cache[cpi] = result;
-            }
-            return result;
-        } else {
-            return new HotSpotUnresolvedField(holder, name, type);
-        }
-    }
-
-    @Override
-    public void loadReferencedType(int cpi, int opcode) {
-        int index;
-        switch (opcode) {
-            case Bytecodes.CHECKCAST:
-            case Bytecodes.INSTANCEOF:
-            case Bytecodes.NEW:
-            case Bytecodes.ANEWARRAY:
-            case Bytecodes.MULTIANEWARRAY:
-            case Bytecodes.LDC:
-            case Bytecodes.LDC_W:
-            case Bytecodes.LDC2_W:
-                index = cpi;
-                break;
-            case Bytecodes.INVOKEDYNAMIC:
-                // invokedynamic instructions point to a constant pool cache entry.
-                index = decodeConstantPoolCacheIndex(cpi) + runtime().getConfig().constantPoolCpCacheIndexTag;
-                index = runtime().getCompilerToVM().constantPoolRemapInstructionOperandFromCache(metaspaceConstantPool, index);
-                break;
-            default:
-                index = toConstantPoolIndex(cpi, opcode);
-                index = runtime().getCompilerToVM().constantPoolRemapInstructionOperandFromCache(metaspaceConstantPool, index);
-        }
-
-        JVM_CONSTANT tag = getTagAt(index);
-        if (tag == null) {
-            assert getTagAt(index - 1) == JVM_CONSTANT.Double || getTagAt(index - 1) == JVM_CONSTANT.Long;
-            return;
-        }
-        switch (tag) {
-            case Fieldref:
-            case MethodRef:
-            case InterfaceMethodref:
-                index = getUncachedKlassRefIndexAt(index);
-                tag = getTagAt(index);
-                assert tag == JVM_CONSTANT.Class || tag == JVM_CONSTANT.UnresolvedClass || tag == JVM_CONSTANT.UnresolvedClassInError : tag;
-                // fall through
-            case Class:
-            case UnresolvedClass:
-            case UnresolvedClassInError:
-                final long metaspaceKlass = runtime().getCompilerToVM().constantPoolKlassAt(metaspaceConstantPool, index);
-                HotSpotResolvedObjectTypeImpl type = HotSpotResolvedObjectTypeImpl.fromMetaspaceKlass(metaspaceKlass);
-                Class<?> klass = type.mirror();
-                if (!klass.isPrimitive() && !klass.isArray()) {
-                    unsafe.ensureClassInitialized(klass);
-                }
-                break;
-            case InvokeDynamic:
-                if (isInvokedynamicIndex(cpi)) {
-                    runtime().getCompilerToVM().resolveInvokeDynamic(metaspaceConstantPool, cpi);
-                }
-                break;
-            default:
-                // nothing
-                break;
-        }
-    }
-
-    @Override
-    public String toString() {
-        HotSpotResolvedObjectType holder = getHolder();
-        return "HotSpotConstantPool<" + holder.toJavaName() + ">";
-    }
-}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotConstantReflectionProvider.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,442 +0,0 @@
-/*
- * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.hotspot.meta;
-
-import static com.oracle.graal.compiler.common.GraalOptions.*;
-import static com.oracle.graal.hotspot.HotSpotGraalRuntime.*;
-import static com.oracle.graal.hotspot.stubs.SnippetStub.*;
-
-import java.lang.reflect.*;
-import java.util.*;
-
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.common.*;
-import com.oracle.graal.graph.*;
-import com.oracle.graal.hotspot.*;
-import com.oracle.graal.options.*;
-import com.oracle.graal.replacements.*;
-import com.oracle.graal.replacements.SnippetTemplate.Arguments;
-
-/**
- * HotSpot implementation of {@link ConstantReflectionProvider}.
- */
-public class HotSpotConstantReflectionProvider implements ConstantReflectionProvider, HotSpotProxified {
-    private static final String SystemClassName = "Ljava/lang/System;";
-
-    protected final HotSpotGraalRuntimeProvider runtime;
-    protected final HotSpotMethodHandleAccessProvider methodHandleAccess;
-    protected final HotSpotMemoryAccessProviderImpl memoryAccess;
-
-    public HotSpotConstantReflectionProvider(HotSpotGraalRuntimeProvider runtime) {
-        this.runtime = runtime;
-        this.methodHandleAccess = new HotSpotMethodHandleAccessProvider(this);
-        this.memoryAccess = new HotSpotMemoryAccessProviderImpl(runtime);
-    }
-
-    public MethodHandleAccessProvider getMethodHandleAccess() {
-        return methodHandleAccess;
-    }
-
-    @Override
-    public MemoryAccessProvider getMemoryAccessProvider() {
-        return memoryAccess;
-    }
-
-    @Override
-    public Boolean constantEquals(Constant x, Constant y) {
-        if (x == y) {
-            return true;
-        } else if (x instanceof HotSpotObjectConstantImpl) {
-            return y instanceof HotSpotObjectConstantImpl && ((HotSpotObjectConstantImpl) x).object() == ((HotSpotObjectConstantImpl) y).object();
-        } else {
-            return x.equals(y);
-        }
-    }
-
-    @Override
-    public Integer readArrayLength(JavaConstant array) {
-        if (array.getKind() != Kind.Object || array.isNull()) {
-            return null;
-        }
-
-        Object arrayObject = ((HotSpotObjectConstantImpl) array).object();
-        if (!arrayObject.getClass().isArray()) {
-            return null;
-        }
-        return Array.getLength(arrayObject);
-    }
-
-    public JavaConstant readConstantArrayElement(JavaConstant array, int index) {
-        if (array instanceof HotSpotObjectConstantImpl && ((HotSpotObjectConstantImpl) array).getStableDimension() > 0) {
-            JavaConstant element = readArrayElement(array, index);
-            if (element != null && (((HotSpotObjectConstantImpl) array).isDefaultStable() || !element.isDefaultForKind())) {
-                return element;
-            }
-        }
-        return null;
-    }
-
-    /**
-     * Try to convert {@code offset} into an an index into {@code array}.
-     *
-     * @return -1 if the offset isn't within the array or the computed index
-     */
-    private int indexForOffset(JavaConstant array, long offset) {
-        if (array.getKind() != Kind.Object || array.isNull()) {
-            return -1;
-        }
-        Class<?> componentType = ((HotSpotObjectConstantImpl) array).object().getClass().getComponentType();
-        Kind kind = runtime.getHostProviders().getMetaAccess().lookupJavaType(componentType).getKind();
-        int arraybase = runtime.getArrayBaseOffset(kind);
-        int scale = runtime.getArrayIndexScale(kind);
-        if (offset < arraybase) {
-            return -1;
-        }
-        long index = offset - arraybase;
-        if (index % scale != 0) {
-            return -1;
-        }
-        long result = index / scale;
-        if (result >= Integer.MAX_VALUE) {
-            return -1;
-        }
-        return (int) result;
-    }
-
-    public JavaConstant readConstantArrayElementForOffset(JavaConstant array, long offset) {
-        if (array instanceof HotSpotObjectConstantImpl && ((HotSpotObjectConstantImpl) array).getStableDimension() > 0) {
-            return readConstantArrayElement(array, indexForOffset(array, offset));
-        }
-        return null;
-    }
-
-    @Override
-    public JavaConstant readArrayElement(JavaConstant array, int index) {
-        if (array.getKind() != Kind.Object || array.isNull()) {
-            return null;
-        }
-        Object a = ((HotSpotObjectConstantImpl) array).object();
-
-        if (index < 0 || index >= Array.getLength(a)) {
-            return null;
-        }
-
-        if (a instanceof Object[]) {
-            Object element = ((Object[]) a)[index];
-            if (((HotSpotObjectConstantImpl) array).getStableDimension() > 1) {
-                return HotSpotObjectConstantImpl.forStableArray(element, ((HotSpotObjectConstantImpl) array).getStableDimension() - 1, ((HotSpotObjectConstantImpl) array).isDefaultStable());
-            } else {
-                return HotSpotObjectConstantImpl.forObject(element);
-            }
-        } else {
-            return JavaConstant.forBoxedPrimitive(Array.get(a, index));
-        }
-    }
-
-    /**
-     * Check if the constant is a boxed value that is guaranteed to be cached by the platform.
-     * Otherwise the generated code might be the only reference to the boxed value and since object
-     * references from nmethods are weak this can cause GC problems.
-     *
-     * @param source
-     * @return true if the box is cached
-     */
-    private static boolean isBoxCached(JavaConstant source) {
-        switch (source.getKind()) {
-            case Boolean:
-                return true;
-            case Char:
-                return source.asInt() <= 127;
-            case Byte:
-            case Short:
-            case Int:
-                return source.asInt() >= -128 && source.asInt() <= 127;
-            case Long:
-                return source.asLong() >= -128 && source.asLong() <= 127;
-            case Float:
-            case Double:
-                return false;
-            default:
-                throw new IllegalArgumentException("unexpected kind " + source.getKind());
-        }
-    }
-
-    @Override
-    public JavaConstant boxPrimitive(JavaConstant source) {
-        if (!source.getKind().isPrimitive() || !isBoxCached(source)) {
-            return null;
-        }
-        return HotSpotObjectConstantImpl.forObject(source.asBoxedPrimitive());
-    }
-
-    @Override
-    public JavaConstant unboxPrimitive(JavaConstant source) {
-        if (!source.getKind().isObject()) {
-            return null;
-        }
-        if (source.isNull()) {
-            return null;
-        }
-        return JavaConstant.forBoxedPrimitive(((HotSpotObjectConstantImpl) source).object());
-    }
-
-    public JavaConstant forString(String value) {
-        return HotSpotObjectConstantImpl.forObject(value);
-    }
-
-    @Override
-    public ResolvedJavaType asJavaType(Constant constant) {
-        if (constant instanceof HotSpotObjectConstant) {
-            Object obj = ((HotSpotObjectConstantImpl) constant).object();
-            if (obj instanceof Class) {
-                return runtime.getHostProviders().getMetaAccess().lookupJavaType((Class<?>) obj);
-            }
-        }
-        if (constant instanceof HotSpotMetaspaceConstant) {
-            Object obj = HotSpotMetaspaceConstantImpl.getMetaspaceObject(constant);
-            if (obj instanceof HotSpotResolvedObjectTypeImpl) {
-                return (ResolvedJavaType) obj;
-            }
-        }
-        return null;
-    }
-
-    /**
-     * {@inheritDoc}
-     * <p>
-     * The {@code value} field in {@link OptionValue} is considered constant if the type of
-     * {@code receiver} is (assignable to) {@link StableOptionValue}.
-     */
-    public JavaConstant readConstantFieldValue(JavaField field, JavaConstant receiver) {
-        assert !ImmutableCode.getValue() || isCalledForSnippets() || SnippetGraphUnderConstruction.get() != null || HotSpotLoadFieldPlugin.FieldReadEnabledInImmutableCode.get() == Boolean.TRUE : receiver;
-        HotSpotResolvedJavaField hotspotField = (HotSpotResolvedJavaField) field;
-
-        if (hotspotField.isStatic()) {
-            if (hotspotField.isFinal() || hotspotField.isStable()) {
-                ResolvedJavaType holder = hotspotField.getDeclaringClass();
-                if (holder.isInitialized() && !holder.getName().equals(SystemClassName) && isEmbeddable(hotspotField)) {
-                    JavaConstant value = readFieldValue(field, receiver);
-                    if (hotspotField.isFinal() || !value.isDefaultForKind()) {
-                        return value;
-                    }
-                }
-            }
-        } else {
-            /*
-             * for non-static final fields, we must assume that they are only initialized if they
-             * have a non-default value.
-             */
-            Object object = receiver.isNull() ? null : ((HotSpotObjectConstantImpl) receiver).object();
-
-            // Canonicalization may attempt to process an unsafe read before
-            // processing a guard (e.g. a null check or a type check) for this read
-            // so we need to check the object being read
-            if (object != null) {
-                if (hotspotField.isFinal()) {
-                    if (hotspotField.isInObject(object)) {
-                        JavaConstant value = readFieldValue(field, receiver);
-                        if (!value.isDefaultForKind() || assumeNonStaticFinalDefaultFieldsAsFinal(object.getClass())) {
-                            return value;
-                        }
-                    }
-                } else if (hotspotField.isStable()) {
-                    if (hotspotField.isInObject(object)) {
-                        JavaConstant value = readFieldValue(field, receiver);
-                        if (assumeDefaultStableFieldsAsFinal(object.getClass()) || !value.isDefaultForKind()) {
-                            return value;
-                        }
-                    }
-                } else {
-                    Class<?> clazz = object.getClass();
-                    if (StableOptionValue.class.isAssignableFrom(clazz)) {
-                        if (hotspotField.isInObject(object) && hotspotField.getName().equals("value")) {
-                            StableOptionValue<?> option = (StableOptionValue<?>) object;
-                            return HotSpotObjectConstantImpl.forObject(option.getValue());
-                        }
-                    }
-                }
-            }
-        }
-        return null;
-    }
-
-    public JavaConstant readFieldValue(JavaField field, JavaConstant receiver) {
-        HotSpotResolvedJavaField hotspotField = (HotSpotResolvedJavaField) field;
-        if (!hotspotField.isStable()) {
-            return readNonStableFieldValue(field, receiver);
-        } else {
-            return readStableFieldValue(field, receiver, false);
-        }
-    }
-
-    private JavaConstant readNonStableFieldValue(JavaField field, JavaConstant receiver) {
-        HotSpotResolvedJavaField hotspotField = (HotSpotResolvedJavaField) field;
-        if (hotspotField.isStatic()) {
-            HotSpotResolvedJavaType holder = (HotSpotResolvedJavaType) hotspotField.getDeclaringClass();
-            if (holder.isInitialized()) {
-                return memoryAccess.readUnsafeConstant(hotspotField.getKind(), HotSpotObjectConstantImpl.forObject(holder.mirror()), hotspotField.offset());
-            }
-        } else {
-            if (receiver.isNonNull() && hotspotField.isInObject(((HotSpotObjectConstantImpl) receiver).object())) {
-                return memoryAccess.readUnsafeConstant(hotspotField.getKind(), receiver, hotspotField.offset());
-            }
-        }
-        return null;
-    }
-
-    public JavaConstant readStableFieldValue(JavaField field, JavaConstant receiver, boolean isDefaultStable) {
-        JavaConstant fieldValue = readNonStableFieldValue(field, receiver);
-        if (fieldValue.isNonNull()) {
-            JavaType declaredType = field.getType();
-            if (declaredType.getComponentType() != null) {
-                int stableDimension = getArrayDimension(declaredType);
-                return HotSpotObjectConstantImpl.forStableArray(((HotSpotObjectConstantImpl) fieldValue).object(), stableDimension, isDefaultStable);
-            }
-        }
-        return fieldValue;
-    }
-
-    private static int getArrayDimension(JavaType type) {
-        int dimensions = 0;
-        JavaType componentType = type;
-        while ((componentType = componentType.getComponentType()) != null) {
-            dimensions++;
-        }
-        return dimensions;
-    }
-
-    /**
-     * Compares two {@link StackTraceElement}s for equality, ignoring differences in
-     * {@linkplain StackTraceElement#getLineNumber() line number}.
-     */
-    private static boolean equalsIgnoringLine(StackTraceElement left, StackTraceElement right) {
-        return left.getClassName().equals(right.getClassName()) && left.getMethodName().equals(right.getMethodName()) && left.getFileName().equals(right.getFileName());
-    }
-
-    /**
-     * If the compiler is configured for AOT mode,
-     * {@link #readConstantFieldValue(JavaField, JavaConstant)} should be only called for snippets
-     * or replacements.
-     */
-    private static boolean isCalledForSnippets() {
-        MetaAccessProvider metaAccess = runtime().getHostProviders().getMetaAccess();
-        ResolvedJavaMethod makeGraphMethod = null;
-        ResolvedJavaMethod initMethod = null;
-        try {
-            Class<?> rjm = ResolvedJavaMethod.class;
-            makeGraphMethod = metaAccess.lookupJavaMethod(ReplacementsImpl.class.getDeclaredMethod("makeGraph", rjm, Object[].class, rjm));
-            initMethod = metaAccess.lookupJavaMethod(SnippetTemplate.AbstractTemplates.class.getDeclaredMethod("template", Arguments.class));
-        } catch (NoSuchMethodException | SecurityException e) {
-            throw new GraalInternalError(e);
-        }
-        StackTraceElement makeGraphSTE = makeGraphMethod.asStackTraceElement(0);
-        StackTraceElement initSTE = initMethod.asStackTraceElement(0);
-
-        StackTraceElement[] stackTrace = new Exception().getStackTrace();
-        for (StackTraceElement element : stackTrace) {
-            // Ignoring line numbers should not weaken this check too much while at
-            // the same time making it more robust against source code changes
-            if (equalsIgnoringLine(makeGraphSTE, element) || equalsIgnoringLine(initSTE, element)) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    private static boolean assumeNonStaticFinalDefaultFieldsAsFinal(Class<?> clazz) {
-        if (TrustFinalDefaultFields.getValue()) {
-            return true;
-        }
-        return clazz == SnippetCounter.class || clazz == NodeClass.class;
-    }
-
-    /**
-     * Usually {@link Stable} fields are not considered constant if the value is the
-     * {@link JavaConstant#isDefaultForKind default value}. For some special classes we want to
-     * override this behavior.
-     */
-    private static boolean assumeDefaultStableFieldsAsFinal(Class<?> clazz) {
-        // HotSpotVMConfig has a lot of zero-value fields which we know are stable and want to be
-        // considered as constants.
-        if (clazz == HotSpotVMConfig.class) {
-            return true;
-        }
-        return false;
-    }
-
-    /**
-     * in AOT mode, some fields should never be embedded even for snippets/replacements.
-     */
-    private static boolean isEmbeddable(HotSpotResolvedJavaField field) {
-        return Embeddable.test(field);
-    }
-
-    /**
-     * Separate out the static initialization to eliminate cycles between clinit and other locks
-     * that could lead to deadlock. Static code that doesn't call back into type or field machinery
-     * is probably ok but anything else should be made lazy.
-     */
-    static class Embeddable {
-
-        /**
-         * @return Return true if it's ok to embed the value of {@code field}.
-         */
-        public static boolean test(HotSpotResolvedJavaField field) {
-            return !ImmutableCode.getValue() || !fields.contains(field);
-        }
-
-        private static final List<ResolvedJavaField> fields = new ArrayList<>();
-        static {
-            try {
-                MetaAccessProvider metaAccess = runtime().getHostProviders().getMetaAccess();
-                fields.add(metaAccess.lookupJavaField(Boolean.class.getDeclaredField("TRUE")));
-                fields.add(metaAccess.lookupJavaField(Boolean.class.getDeclaredField("FALSE")));
-
-                Class<?> characterCacheClass = Character.class.getDeclaredClasses()[0];
-                assert "java.lang.Character$CharacterCache".equals(characterCacheClass.getName());
-                fields.add(metaAccess.lookupJavaField(characterCacheClass.getDeclaredField("cache")));
-
-                Class<?> byteCacheClass = Byte.class.getDeclaredClasses()[0];
-                assert "java.lang.Byte$ByteCache".equals(byteCacheClass.getName());
-                fields.add(metaAccess.lookupJavaField(byteCacheClass.getDeclaredField("cache")));
-
-                Class<?> shortCacheClass = Short.class.getDeclaredClasses()[0];
-                assert "java.lang.Short$ShortCache".equals(shortCacheClass.getName());
-                fields.add(metaAccess.lookupJavaField(shortCacheClass.getDeclaredField("cache")));
-
-                Class<?> integerCacheClass = Integer.class.getDeclaredClasses()[0];
-                assert "java.lang.Integer$IntegerCache".equals(integerCacheClass.getName());
-                fields.add(metaAccess.lookupJavaField(integerCacheClass.getDeclaredField("cache")));
-
-                Class<?> longCacheClass = Long.class.getDeclaredClasses()[0];
-                assert "java.lang.Long$LongCache".equals(longCacheClass.getName());
-                fields.add(metaAccess.lookupJavaField(longCacheClass.getDeclaredField("cache")));
-
-                fields.add(metaAccess.lookupJavaField(Throwable.class.getDeclaredField("UNASSIGNED_STACK")));
-                fields.add(metaAccess.lookupJavaField(Throwable.class.getDeclaredField("SUPPRESSED_SENTINEL")));
-            } catch (SecurityException | NoSuchFieldException e) {
-                throw new GraalInternalError(e);
-            }
-        }
-    }
-}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotDisassemblerProvider.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotDisassemblerProvider.java	Thu May 28 21:11:28 2015 -0700
@@ -22,8 +22,10 @@
  */
 package com.oracle.graal.hotspot.meta;
 
-import com.oracle.graal.api.code.*;
+import com.oracle.jvmci.code.DisassemblerProvider;
+import com.oracle.jvmci.code.InstalledCode;
 import com.oracle.graal.hotspot.*;
+import com.oracle.jvmci.hotspot.*;
 
 /**
  * HotSpot implementation of {@link DisassemblerProvider}.
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotForeignCallsProvider.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotForeignCallsProvider.java	Thu May 28 21:11:28 2015 -0700
@@ -22,8 +22,8 @@
  */
 package com.oracle.graal.hotspot.meta;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.code.ForeignCallsProvider;
+import com.oracle.jvmci.meta.Value;
 
 /**
  * HotSpot extension of {@link ForeignCallsProvider}.
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotForeignCallsProviderImpl.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotForeignCallsProviderImpl.java	Thu May 28 21:11:28 2015 -0700
@@ -22,14 +22,17 @@
  */
 package com.oracle.graal.hotspot.meta;
 
-import static com.oracle.graal.api.code.CallingConvention.Type.*;
+import com.oracle.jvmci.code.CodeCacheProvider;
+import com.oracle.jvmci.code.CallingConvention;
+import com.oracle.jvmci.meta.MetaAccessProvider;
+import com.oracle.jvmci.meta.LocationIdentity;
+import com.oracle.jvmci.meta.ForeignCallDescriptor;
+import static com.oracle.jvmci.code.CallingConvention.Type.*;
 import static com.oracle.graal.hotspot.HotSpotForeignCallLinkage.RegisterEffect.*;
 import static com.oracle.graal.hotspot.HotSpotForeignCallLinkage.Transition.*;
 
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.hotspot.*;
 import com.oracle.graal.hotspot.HotSpotForeignCallLinkage.RegisterEffect;
 import com.oracle.graal.hotspot.HotSpotForeignCallLinkage.Transition;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotGraalConstantReflectionProvider.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,183 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.graal.hotspot.meta;
+
+import com.oracle.jvmci.meta.ResolvedJavaField;
+import com.oracle.jvmci.meta.MetaAccessProvider;
+import com.oracle.jvmci.meta.JavaConstant;
+import com.oracle.jvmci.meta.JavaField;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
+import static com.oracle.graal.compiler.common.GraalOptions.*;
+import static com.oracle.graal.hotspot.HotSpotGraalRuntime.*;
+import static com.oracle.graal.hotspot.meta.HotSpotGraalConstantReflectionProvider.ImmutableCodeLazy.*;
+import static com.oracle.graal.hotspot.stubs.SnippetStub.*;
+
+import java.util.*;
+
+import com.oracle.graal.graph.*;
+import com.oracle.graal.replacements.*;
+import com.oracle.graal.replacements.SnippetTemplate.Arguments;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.hotspot.*;
+
+/**
+ * Extends {@link HotSpotConstantReflectionProvider} to override the implementation of
+ * {@link #readConstantFieldValue(JavaField, JavaConstant)} with Graal specific semantics.
+ */
+public class HotSpotGraalConstantReflectionProvider extends HotSpotConstantReflectionProvider {
+
+    public HotSpotGraalConstantReflectionProvider(HotSpotJVMCIRuntimeProvider runtime) {
+        super(runtime);
+    }
+
+    @Override
+    public JavaConstant readConstantFieldValue(JavaField field, JavaConstant receiver) {
+        assert !ImmutableCode.getValue() || isCalledForSnippets() || SnippetGraphUnderConstruction.get() != null || FieldReadEnabledInImmutableCode.get() == Boolean.TRUE : receiver;
+        return super.readConstantFieldValue(field, receiver);
+    }
+
+    /**
+     * In AOT mode, some fields should never be embedded even for snippets/replacements.
+     */
+    @Override
+    protected boolean isStaticFieldConstant(HotSpotResolvedJavaField field) {
+        return super.isStaticFieldConstant(field) && (!ImmutableCode.getValue() || ImmutableCodeLazy.isEmbeddable(field));
+
+    }
+
+    @SuppressWarnings("all")
+    private static boolean assertionsEnabled() {
+        boolean enabled = false;
+        assert enabled = true;
+        return enabled;
+    }
+
+    public static final ThreadLocal<Boolean> FieldReadEnabledInImmutableCode = assertionsEnabled() ? new ThreadLocal<>() : null;
+
+    /**
+     * Compares two {@link StackTraceElement}s for equality, ignoring differences in
+     * {@linkplain StackTraceElement#getLineNumber() line number}.
+     */
+    private static boolean equalsIgnoringLine(StackTraceElement left, StackTraceElement right) {
+        return left.getClassName().equals(right.getClassName()) && left.getMethodName().equals(right.getMethodName()) && left.getFileName().equals(right.getFileName());
+    }
+
+    @Override
+    protected boolean isFinalInstanceFieldValueConstant(JavaConstant value, Class<?> receiverClass) {
+        return super.isFinalInstanceFieldValueConstant(value, receiverClass) || receiverClass == SnippetCounter.class || receiverClass == NodeClass.class;
+    }
+
+    /**
+     * {@inheritDoc}
+     *
+     * {@link HotSpotVMConfig} has a lot of zero-value fields which we know are stable and want to
+     * be considered as constants.
+     */
+    @Override
+    protected boolean isStableInstanceFieldValueConstant(JavaConstant value, Class<? extends Object> receiverClass) {
+        return super.isStableInstanceFieldValueConstant(value, receiverClass) || receiverClass == HotSpotVMConfig.class;
+    }
+
+    /**
+     * Separate out the static initialization of
+     * {@linkplain #isEmbeddable(HotSpotResolvedJavaField) embeddable fields} to eliminate cycles
+     * between clinit and other locks that could lead to deadlock. Static code that doesn't call
+     * back into type or field machinery is probably ok but anything else should be made lazy.
+     */
+    static class ImmutableCodeLazy {
+
+        /**
+         * If the compiler is configured for AOT mode,
+         * {@link #readConstantFieldValue(JavaField, JavaConstant)} should be only called for
+         * snippets or replacements.
+         */
+        static boolean isCalledForSnippets() {
+            assert ImmutableCode.getValue();
+            MetaAccessProvider metaAccess = runtime().getHostProviders().getMetaAccess();
+            ResolvedJavaMethod makeGraphMethod = null;
+            ResolvedJavaMethod initMethod = null;
+            try {
+                Class<?> rjm = ResolvedJavaMethod.class;
+                makeGraphMethod = metaAccess.lookupJavaMethod(ReplacementsImpl.class.getDeclaredMethod("makeGraph", rjm, Object[].class, rjm));
+                initMethod = metaAccess.lookupJavaMethod(SnippetTemplate.AbstractTemplates.class.getDeclaredMethod("template", Arguments.class));
+            } catch (NoSuchMethodException | SecurityException e) {
+                throw new JVMCIError(e);
+            }
+            StackTraceElement makeGraphSTE = makeGraphMethod.asStackTraceElement(0);
+            StackTraceElement initSTE = initMethod.asStackTraceElement(0);
+
+            StackTraceElement[] stackTrace = new Exception().getStackTrace();
+            for (StackTraceElement element : stackTrace) {
+                // Ignoring line numbers should not weaken this check too much while at
+                // the same time making it more robust against source code changes
+                if (equalsIgnoringLine(makeGraphSTE, element) || equalsIgnoringLine(initSTE, element)) {
+                    return true;
+                }
+            }
+            return false;
+        }
+
+        /**
+         * Determine if it's ok to embed the value of {@code field}.
+         */
+        static boolean isEmbeddable(HotSpotResolvedJavaField field) {
+            assert ImmutableCode.getValue();
+            return !embeddableFields.contains(field);
+        }
+
+        private static final List<ResolvedJavaField> embeddableFields = new ArrayList<>();
+        static {
+            try {
+                MetaAccessProvider metaAccess = runtime().getHostProviders().getMetaAccess();
+                embeddableFields.add(metaAccess.lookupJavaField(Boolean.class.getDeclaredField("TRUE")));
+                embeddableFields.add(metaAccess.lookupJavaField(Boolean.class.getDeclaredField("FALSE")));
+
+                Class<?> characterCacheClass = Character.class.getDeclaredClasses()[0];
+                assert "java.lang.Character$CharacterCache".equals(characterCacheClass.getName());
+                embeddableFields.add(metaAccess.lookupJavaField(characterCacheClass.getDeclaredField("cache")));
+
+                Class<?> byteCacheClass = Byte.class.getDeclaredClasses()[0];
+                assert "java.lang.Byte$ByteCache".equals(byteCacheClass.getName());
+                embeddableFields.add(metaAccess.lookupJavaField(byteCacheClass.getDeclaredField("cache")));
+
+                Class<?> shortCacheClass = Short.class.getDeclaredClasses()[0];
+                assert "java.lang.Short$ShortCache".equals(shortCacheClass.getName());
+                embeddableFields.add(metaAccess.lookupJavaField(shortCacheClass.getDeclaredField("cache")));
+
+                Class<?> integerCacheClass = Integer.class.getDeclaredClasses()[0];
+                assert "java.lang.Integer$IntegerCache".equals(integerCacheClass.getName());
+                embeddableFields.add(metaAccess.lookupJavaField(integerCacheClass.getDeclaredField("cache")));
+
+                Class<?> longCacheClass = Long.class.getDeclaredClasses()[0];
+                assert "java.lang.Long$LongCache".equals(longCacheClass.getName());
+                embeddableFields.add(metaAccess.lookupJavaField(longCacheClass.getDeclaredField("cache")));
+
+                embeddableFields.add(metaAccess.lookupJavaField(Throwable.class.getDeclaredField("UNASSIGNED_STACK")));
+                embeddableFields.add(metaAccess.lookupJavaField(Throwable.class.getDeclaredField("SUPPRESSED_SENTINEL")));
+            } catch (SecurityException | NoSuchFieldException e) {
+                throw new JVMCIError(e);
+            }
+        }
+    }
+
+}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotGraphBuilderPlugins.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotGraphBuilderPlugins.java	Thu May 28 21:11:28 2015 -0700
@@ -22,6 +22,12 @@
  */
 package com.oracle.graal.hotspot.meta;
 
+import com.oracle.jvmci.code.ForeignCallsProvider;
+import com.oracle.jvmci.meta.MetaAccessProvider;
+import com.oracle.jvmci.meta.JavaConstant;
+import com.oracle.jvmci.meta.ConstantReflectionProvider;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
+import com.oracle.jvmci.meta.Kind;
 import static com.oracle.graal.hotspot.replacements.HotSpotReplacementsUtil.*;
 import static com.oracle.graal.hotspot.replacements.SystemSubstitutions.*;
 
@@ -30,26 +36,24 @@
 
 import sun.reflect.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.api.replacements.*;
 import com.oracle.graal.graphbuilderconf.*;
 import com.oracle.graal.graphbuilderconf.GraphBuilderConfiguration.Plugins;
+import com.oracle.graal.graphbuilderconf.InvocationPlugin.Receiver;
 import com.oracle.graal.graphbuilderconf.InvocationPlugins.Registration;
-import com.oracle.graal.graphbuilderconf.MethodIdMap.Receiver;
-import com.oracle.graal.hotspot.*;
 import com.oracle.graal.hotspot.nodes.*;
 import com.oracle.graal.hotspot.replacements.*;
 import com.oracle.graal.hotspot.replacements.arraycopy.*;
 import com.oracle.graal.hotspot.word.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.extended.*;
-import com.oracle.graal.nodes.memory.HeapAccess.*;
+import com.oracle.graal.nodes.memory.HeapAccess.BarrierType;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.util.*;
-import com.oracle.graal.options.*;
 import com.oracle.graal.replacements.*;
 import com.oracle.graal.word.*;
+import com.oracle.jvmci.hotspot.*;
+import com.oracle.jvmci.options.*;
 
 /**
  * Defines the {@link Plugins} used when running on HotSpot.
@@ -86,7 +90,7 @@
         registerThreadPlugins(invocationPlugins, metaAccess, wordTypes, config);
         registerCallSitePlugins(invocationPlugins);
         registerReflectionPlugins(invocationPlugins);
-        registerStableOptionPlugins(invocationPlugins);
+        registerStableOptionPlugins(invocationPlugins, snippetReflection);
         registerAESPlugins(invocationPlugins, config);
         registerCRC32Plugins(invocationPlugins, config);
         StandardGraphBuilderPlugins.registerInvocationPlugins(metaAccess, invocationPlugins, !config.useHeapProfiler);
@@ -164,7 +168,7 @@
         Registration r = new Registration(plugins, Reflection.class);
         r.register0("getCallerClass", new InvocationPlugin() {
             public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver) {
-                b.addPush(new ReflectionGetCallerClassNode(b.getInvokeKind(), targetMethod, b.bci(), b.getInvokeReturnType()));
+                b.addPush(Kind.Object, new ReflectionGetCallerClassNode(b.getInvokeKind(), targetMethod, b.bci(), b.getInvokeReturnType()));
                 return true;
             }
 
@@ -180,7 +184,7 @@
         r.register0("nanoTime", new ForeignCallPlugin(foreignCalls, JAVA_TIME_NANOS));
         r.register1("identityHashCode", Object.class, new InvocationPlugin() {
             public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode object) {
-                b.addPush(new IdentityHashCodeNode(b.getInvokeKind(), targetMethod, b.bci(), b.getInvokeReturnType(), object));
+                b.addPush(Kind.Int, new IdentityHashCodeNode(b.getInvokeKind(), targetMethod, b.bci(), b.getInvokeReturnType(), object));
                 return true;
             }
 
@@ -216,13 +220,12 @@
         });
     }
 
-    private static void registerStableOptionPlugins(InvocationPlugins plugins) {
+    private static void registerStableOptionPlugins(InvocationPlugins plugins, SnippetReflectionProvider snippetReflection) {
         Registration r = new Registration(plugins, StableOptionValue.class);
         r.register1("getValue", Receiver.class, new InvocationPlugin() {
             public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver) {
                 if (receiver.isConstant()) {
-                    Object object = ((HotSpotObjectConstantImpl) receiver.get().asConstant()).object();
-                    StableOptionValue<?> option = (StableOptionValue<?>) object;
+                    StableOptionValue<?> option = snippetReflection.asObject(StableOptionValue.class, (JavaConstant) receiver.get().asConstant());
                     b.addPush(Kind.Object, ConstantNode.forConstant(HotSpotObjectConstantImpl.forObject(option.getValue()), b.getMetaAccess()));
                     return true;
                 }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotHostForeignCallsProvider.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotHostForeignCallsProvider.java	Thu May 28 21:11:28 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,8 +22,7 @@
  */
 package com.oracle.graal.hotspot.meta;
 
-import static com.oracle.graal.api.code.CallingConvention.Type.*;
-import static com.oracle.graal.api.meta.LocationIdentity.*;
+import static com.oracle.graal.compiler.target.Backend.*;
 import static com.oracle.graal.hotspot.HotSpotBackend.*;
 import static com.oracle.graal.hotspot.HotSpotBackend.Options.*;
 import static com.oracle.graal.hotspot.HotSpotForeignCallLinkage.RegisterEffect.*;
@@ -44,15 +43,18 @@
 import static com.oracle.graal.hotspot.stubs.UnwindExceptionToCallerStub.*;
 import static com.oracle.graal.nodes.java.ForeignCallDescriptors.*;
 import static com.oracle.graal.replacements.Log.*;
+import static com.oracle.jvmci.code.CallingConvention.Type.*;
+import static com.oracle.jvmci.meta.LocationIdentity.*;
 
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.hotspot.*;
 import com.oracle.graal.hotspot.stubs.*;
 import com.oracle.graal.word.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.hotspot.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * HotSpot implementation of {@link ForeignCallsProvider}.
@@ -254,7 +256,7 @@
                 // These stubs do callee saving
                 registerForeignCall(ENCRYPT_BLOCK, c.aescryptEncryptBlockStub, NativeCall, PRESERVES_REGISTERS, LEAF_NOFP, NOT_REEXECUTABLE, NamedLocationIdentity.getArrayLocation(Kind.Byte));
                 registerForeignCall(DECRYPT_BLOCK, c.aescryptDecryptBlockStub, NativeCall, PRESERVES_REGISTERS, LEAF_NOFP, NOT_REEXECUTABLE, NamedLocationIdentity.getArrayLocation(Kind.Byte));
-            } catch (GraalInternalError e) {
+            } catch (JVMCIError e) {
                 if (!(e.getCause() instanceof ClassNotFoundException)) {
                     throw e;
                 }
@@ -263,7 +265,7 @@
                 // These stubs do callee saving
                 registerForeignCall(ENCRYPT, c.cipherBlockChainingEncryptAESCryptStub, NativeCall, PRESERVES_REGISTERS, LEAF_NOFP, NOT_REEXECUTABLE, NamedLocationIdentity.getArrayLocation(Kind.Byte));
                 registerForeignCall(DECRYPT, c.cipherBlockChainingDecryptAESCryptStub, NativeCall, PRESERVES_REGISTERS, LEAF_NOFP, NOT_REEXECUTABLE, NamedLocationIdentity.getArrayLocation(Kind.Byte));
-            } catch (GraalInternalError e) {
+            } catch (JVMCIError e) {
                 if (!(e.getCause() instanceof ClassNotFoundException)) {
                     throw e;
                 }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotInstalledCode.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,97 +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.graal.hotspot.meta;
-
-import static com.oracle.graal.compiler.common.UnsafeAccess.*;
-import sun.misc.*;
-
-import com.oracle.graal.api.code.*;
-
-import edu.umd.cs.findbugs.annotations.*;
-
-/**
- * Implementation of {@link InstalledCode} for HotSpot.
- */
-public abstract class HotSpotInstalledCode extends InstalledCode {
-
-    /**
-     * Total size of the code blob.
-     */
-    @SuppressFBWarnings(value = "UWF_UNWRITTEN_FIELD", justification = "field is set by the native part") private int size;
-
-    /**
-     * Start address of the code.
-     */
-    @SuppressFBWarnings(value = "UWF_UNWRITTEN_FIELD", justification = "field is set by the native part") private long codeStart;
-
-    /**
-     * Size of the code.
-     */
-    @SuppressFBWarnings(value = "UWF_UNWRITTEN_FIELD", justification = "field is set by the native part") private int codeSize;
-
-    public HotSpotInstalledCode(String name) {
-        super(name);
-    }
-
-    /**
-     * @return the total size of this code blob
-     */
-    public int getSize() {
-        return size;
-    }
-
-    /**
-     * @return a copy of this code blob if it is {@linkplain #isValid() valid}, null otherwise.
-     */
-    public byte[] getBlob() {
-        if (!isValid()) {
-            return null;
-        }
-        byte[] blob = new byte[size];
-        unsafe.copyMemory(null, getAddress(), blob, Unsafe.ARRAY_BYTE_BASE_OFFSET, size);
-        return blob;
-    }
-
-    @Override
-    public abstract String toString();
-
-    @Override
-    public long getStart() {
-        return codeStart;
-    }
-
-    @Override
-    public long getCodeSize() {
-        return codeSize;
-    }
-
-    @Override
-    public byte[] getCode() {
-        if (!isValid()) {
-            return null;
-        }
-        byte[] code = new byte[codeSize];
-        unsafe.copyMemory(null, codeStart, code, Unsafe.ARRAY_BYTE_BASE_OFFSET, codeSize);
-        return code;
-    }
-}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotInvocationPlugins.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotInvocationPlugins.java	Thu May 28 21:11:28 2015 -0700
@@ -22,17 +22,19 @@
  */
 package com.oracle.graal.hotspot.meta;
 
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.meta.MetaAccessProvider;
+import com.oracle.jvmci.meta.ResolvedJavaType;
+import com.oracle.jvmci.meta.Kind;
 import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.iterators.*;
 import com.oracle.graal.graphbuilderconf.*;
-import com.oracle.graal.hotspot.*;
 import com.oracle.graal.hotspot.phases.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.type.*;
 import com.oracle.graal.replacements.StandardGraphBuilderPlugins.BoxPlugin;
 import com.oracle.graal.replacements.nodes.*;
+import com.oracle.jvmci.hotspot.*;
 
 /**
  * Extension of {@link InvocationPlugins} that disables plugins based on runtime configuration.
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotJavaType.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +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.graal.hotspot.meta;
-
-import com.oracle.graal.api.meta.*;
-
-/**
- * Common base class for all HotSpot {@link JavaType} implementations.
- */
-public abstract class HotSpotJavaType implements JavaType {
-
-    private final String name;
-
-    public HotSpotJavaType(String name) {
-        this.name = name;
-    }
-
-    @Override
-    public final String getName() {
-        return name;
-    }
-}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotLoadFieldPlugin.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotLoadFieldPlugin.java	Thu May 28 21:11:28 2015 -0700
@@ -22,9 +22,13 @@
  */
 package com.oracle.graal.hotspot.meta;
 
+import com.oracle.jvmci.meta.ResolvedJavaField;
+import com.oracle.jvmci.meta.MetaAccessProvider;
+import com.oracle.jvmci.meta.JavaConstant;
+import com.oracle.jvmci.meta.ConstantReflectionProvider;
 import static com.oracle.graal.compiler.common.GraalOptions.*;
+import static com.oracle.graal.hotspot.meta.HotSpotGraalConstantReflectionProvider.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.graphbuilderconf.*;
 import com.oracle.graal.nodes.*;
 
@@ -37,8 +41,6 @@
         this.constantReflection = constantReflection;
     }
 
-    static final ThreadLocal<Boolean> FieldReadEnabledInImmutableCode = new ThreadLocal<>();
-
     public boolean apply(GraphBuilderContext b, ValueNode receiver, ResolvedJavaField field) {
         if (!ImmutableCode.getValue() || b.parsingIntrinsic()) {
             if (receiver.isConstant()) {
@@ -50,15 +52,16 @@
     }
 
     private boolean tryReadField(GraphBuilderContext b, ResolvedJavaField field, JavaConstant receiver) {
-        if (ImmutableCode.getValue()) {
+        // FieldReadEnabledInImmutableCode is non null only if assertions are enabled
+        if (FieldReadEnabledInImmutableCode != null && ImmutableCode.getValue()) {
             FieldReadEnabledInImmutableCode.set(Boolean.TRUE);
-        }
-        try {
-            return tryConstantFold(b, metaAccess, constantReflection, field, receiver);
-        } finally {
-            if (ImmutableCode.getValue()) {
+            try {
+                return tryConstantFold(b, metaAccess, constantReflection, field, receiver);
+            } finally {
                 FieldReadEnabledInImmutableCode.set(null);
             }
+        } else {
+            return tryConstantFold(b, metaAccess, constantReflection, field, receiver);
         }
     }
 
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotLoadIndexedPlugin.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotLoadIndexedPlugin.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,8 @@
  */
 package com.oracle.graal.hotspot.meta;
 
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.meta.ResolvedJavaType;
+import com.oracle.jvmci.meta.Kind;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graphbuilderconf.*;
 import com.oracle.graal.hotspot.nodes.*;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotLoweringProvider.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotLoweringProvider.java	Thu May 28 21:11:28 2015 -0700
@@ -22,13 +22,13 @@
  */
 package com.oracle.graal.hotspot.meta;
 
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.meta.Kind;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
-import com.oracle.graal.hotspot.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.extended.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.hotspot.*;
 
 /**
  * HotSpot implementation of {@link LoweringProvider}.
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMemoryAccessProvider.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.hotspot.meta;
-
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.hotspot.HotSpotVMConfig.CompressEncoding;
-
-/**
- * HotSpot specific extension of {@link MemoryAccessProvider}.
- */
-public interface HotSpotMemoryAccessProvider extends MemoryAccessProvider {
-
-    JavaConstant readNarrowOopConstant(Constant base, long displacement, CompressEncoding encoding);
-
-    Constant readKlassPointerConstant(Constant base, long displacement);
-
-    Constant readNarrowKlassPointerConstant(Constant base, long displacement, CompressEncoding encoding);
-
-    Constant readMethodPointerConstant(Constant base, long displacement);
-}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMemoryAccessProviderImpl.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,230 +0,0 @@
-/*
- * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.hotspot.meta;
-
-import static com.oracle.graal.compiler.common.UnsafeAccess.*;
-
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.common.*;
-import com.oracle.graal.hotspot.*;
-import com.oracle.graal.hotspot.HotSpotVMConfig.CompressEncoding;
-
-/**
- * HotSpot implementation of {@link MemoryAccessProvider}.
- */
-public class HotSpotMemoryAccessProviderImpl implements HotSpotMemoryAccessProvider, HotSpotProxified {
-
-    protected final HotSpotGraalRuntimeProvider runtime;
-
-    public HotSpotMemoryAccessProviderImpl(HotSpotGraalRuntimeProvider runtime) {
-        this.runtime = runtime;
-    }
-
-    private static Object asObject(Constant base) {
-        if (base instanceof HotSpotObjectConstantImpl) {
-            return ((HotSpotObjectConstantImpl) base).object();
-        } else {
-            return null;
-        }
-    }
-
-    private boolean isValidObjectFieldDisplacement(Constant base, long displacement) {
-        if (base instanceof HotSpotMetaspaceConstant) {
-            Object metaspaceObject = HotSpotMetaspaceConstantImpl.getMetaspaceObject(base);
-            if (metaspaceObject instanceof HotSpotResolvedObjectTypeImpl) {
-                if (displacement == runtime.getConfig().classMirrorOffset) {
-                    // Klass::_java_mirror is valid for all Klass* values
-                    return true;
-                } else if (displacement == runtime.getConfig().arrayKlassComponentMirrorOffset) {
-                    // ArrayKlass::_component_mirror is only valid for all ArrayKlass* values
-                    return ((HotSpotResolvedObjectTypeImpl) metaspaceObject).mirror().isArray();
-                }
-            } else {
-                throw GraalInternalError.shouldNotReachHere();
-            }
-        }
-        return false;
-    }
-
-    private static long asRawPointer(Constant base) {
-        if (base instanceof HotSpotMetaspaceConstant) {
-            return ((HotSpotMetaspaceConstant) base).rawValue();
-        } else if (base instanceof PrimitiveConstant) {
-            PrimitiveConstant prim = (PrimitiveConstant) base;
-            if (prim.getKind().isNumericInteger()) {
-                return prim.asLong();
-            }
-        }
-        throw GraalInternalError.shouldNotReachHere();
-    }
-
-    private static long readRawValue(Constant baseConstant, long displacement, int bits) {
-        Object base = asObject(baseConstant);
-        if (base != null) {
-            switch (bits) {
-                case 8:
-                    return unsafe.getByte(base, displacement);
-                case 16:
-                    return unsafe.getShort(base, displacement);
-                case 32:
-                    return unsafe.getInt(base, displacement);
-                case 64:
-                    return unsafe.getLong(base, displacement);
-                default:
-                    throw GraalInternalError.shouldNotReachHere();
-            }
-        } else {
-            long pointer = asRawPointer(baseConstant);
-            switch (bits) {
-                case 8:
-                    return unsafe.getByte(pointer + displacement);
-                case 16:
-                    return unsafe.getShort(pointer + displacement);
-                case 32:
-                    return unsafe.getInt(pointer + displacement);
-                case 64:
-                    return unsafe.getLong(pointer + displacement);
-                default:
-                    throw GraalInternalError.shouldNotReachHere();
-            }
-        }
-    }
-
-    private boolean verifyReadRawObject(Object expected, Constant base, long displacement, boolean compressed) {
-        if (compressed == runtime.getConfig().useCompressedOops) {
-            Object obj = asObject(base);
-            if (obj != null) {
-                assert expected == unsafe.getObject(obj, displacement) : "readUnsafeOop doesn't agree with unsafe.getObject";
-            }
-        }
-        if (base instanceof HotSpotMetaspaceConstant) {
-            Object metaspaceObject = HotSpotMetaspaceConstantImpl.getMetaspaceObject(base);
-            if (metaspaceObject instanceof HotSpotResolvedObjectTypeImpl) {
-                if (displacement == runtime.getConfig().classMirrorOffset) {
-                    assert expected == ((HotSpotResolvedObjectTypeImpl) metaspaceObject).mirror();
-                } else if (displacement == runtime.getConfig().arrayKlassComponentMirrorOffset) {
-                    assert expected == ((HotSpotResolvedObjectTypeImpl) metaspaceObject).mirror().getComponentType();
-                }
-            }
-        }
-        return true;
-    }
-
-    private Object readRawObject(Constant baseConstant, long initialDisplacement, boolean compressed) {
-        long displacement = initialDisplacement;
-
-        Object ret;
-        Object base = asObject(baseConstant);
-        if (base == null) {
-            assert !compressed;
-            displacement += asRawPointer(baseConstant);
-            ret = runtime.getCompilerToVM().readUncompressedOop(displacement);
-        } else {
-            assert runtime.getConfig().useCompressedOops == compressed;
-            ret = unsafe.getObject(base, displacement);
-        }
-        assert verifyReadRawObject(ret, baseConstant, initialDisplacement, compressed);
-        return ret;
-    }
-
-    @Override
-    public JavaConstant readUnsafeConstant(Kind kind, JavaConstant baseConstant, long displacement) {
-        if (kind == Kind.Object) {
-            Object o = readRawObject(baseConstant, displacement, runtime.getConfig().useCompressedOops);
-            return HotSpotObjectConstantImpl.forObject(o);
-        } else {
-            return readPrimitiveConstant(kind, baseConstant, displacement, kind.getByteCount() * 8);
-        }
-    }
-
-    @Override
-    public JavaConstant readPrimitiveConstant(Kind kind, Constant baseConstant, long initialDisplacement, int bits) {
-        try {
-            long rawValue = readRawValue(baseConstant, initialDisplacement, bits);
-            switch (kind) {
-                case Boolean:
-                    return JavaConstant.forBoolean(rawValue != 0);
-                case Byte:
-                    return JavaConstant.forByte((byte) rawValue);
-                case Char:
-                    return JavaConstant.forChar((char) rawValue);
-                case Short:
-                    return JavaConstant.forShort((short) rawValue);
-                case Int:
-                    return JavaConstant.forInt((int) rawValue);
-                case Long:
-                    return JavaConstant.forLong(rawValue);
-                case Float:
-                    return JavaConstant.forFloat(Float.intBitsToFloat((int) rawValue));
-                case Double:
-                    return JavaConstant.forDouble(Double.longBitsToDouble(rawValue));
-                default:
-                    throw GraalInternalError.shouldNotReachHere("unsupported kind: " + kind);
-            }
-        } catch (NullPointerException e) {
-            return null;
-        }
-    }
-
-    @Override
-    public JavaConstant readObjectConstant(Constant base, long displacement) {
-        if (!isValidObjectFieldDisplacement(base, displacement)) {
-            return null;
-        }
-        return HotSpotObjectConstantImpl.forObject(readRawObject(base, displacement, false));
-    }
-
-    @Override
-    public JavaConstant readNarrowOopConstant(Constant base, long displacement, CompressEncoding encoding) {
-        assert encoding.equals(runtime.getConfig().getOopEncoding()) : "unexpected oop encoding: " + encoding + " != " + runtime.getConfig().getOopEncoding();
-        return HotSpotObjectConstantImpl.forObject(readRawObject(base, displacement, true), true);
-    }
-
-    @Override
-    public Constant readKlassPointerConstant(Constant base, long displacement) {
-        long klass = readRawValue(base, displacement, runtime.getTarget().wordSize * 8);
-        if (klass == 0) {
-            return JavaConstant.NULL_POINTER;
-        }
-        HotSpotResolvedObjectType metaKlass = HotSpotResolvedObjectTypeImpl.fromMetaspaceKlass(klass);
-        return HotSpotMetaspaceConstantImpl.forMetaspaceObject(runtime.getTarget().wordKind, klass, metaKlass, false);
-    }
-
-    @Override
-    public Constant readNarrowKlassPointerConstant(Constant base, long displacement, CompressEncoding encoding) {
-        int compressed = (int) readRawValue(base, displacement, 32);
-        long klass = encoding.uncompress(compressed);
-        if (klass == 0) {
-            return HotSpotCompressedNullConstant.COMPRESSED_NULL;
-        }
-        HotSpotResolvedObjectType metaKlass = HotSpotResolvedObjectTypeImpl.fromMetaspaceKlass(klass);
-        return HotSpotMetaspaceConstantImpl.forMetaspaceObject(Kind.Int, compressed, metaKlass, true);
-    }
-
-    @Override
-    public Constant readMethodPointerConstant(Constant base, long displacement) {
-        long method = readRawValue(base, displacement, runtime.getTarget().wordSize * 8);
-        HotSpotResolvedJavaMethod metaMethod = HotSpotResolvedJavaMethodImpl.fromMetaspace(method);
-        return HotSpotMetaspaceConstantImpl.forMetaspaceObject(runtime.getTarget().wordKind, method, metaMethod, false);
-    }
-}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMetaAccessProvider.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,310 +0,0 @@
-/*
- * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.hotspot.meta;
-
-import static com.oracle.graal.compiler.common.UnsafeAccess.*;
-import static com.oracle.graal.hotspot.HotSpotGraalRuntime.*;
-import static com.oracle.graal.hotspot.meta.HotSpotResolvedJavaType.*;
-import static com.oracle.graal.hotspot.meta.HotSpotResolvedObjectTypeImpl.*;
-
-import java.lang.reflect.*;
-
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.common.*;
-import com.oracle.graal.hotspot.*;
-import com.oracle.graal.hotspot.replacements.*;
-
-/**
- * HotSpot implementation of {@link MetaAccessProvider}.
- */
-public class HotSpotMetaAccessProvider implements MetaAccessProvider, HotSpotProxified {
-
-    protected final HotSpotGraalRuntimeProvider runtime;
-
-    public HotSpotMetaAccessProvider(HotSpotGraalRuntimeProvider runtime) {
-        this.runtime = runtime;
-    }
-
-    public ResolvedJavaType lookupJavaType(Class<?> clazz) {
-        if (clazz == null) {
-            throw new IllegalArgumentException("Class parameter was null");
-        }
-        return runtime.fromClass(clazz);
-    }
-
-    public HotSpotResolvedObjectType lookupJavaType(JavaConstant constant) {
-        if (constant.isNull() || !(constant instanceof HotSpotObjectConstant)) {
-            return null;
-        }
-        return ((HotSpotObjectConstant) constant).getType();
-    }
-
-    public Signature parseMethodDescriptor(String signature) {
-        return new HotSpotSignature(runtime, signature);
-    }
-
-    /**
-     * {@link Field} object of {@link Method#slot}.
-     */
-    @SuppressWarnings("javadoc") private Field reflectionMethodSlot = getReflectionSlotField(Method.class);
-
-    /**
-     * {@link Field} object of {@link Constructor#slot}.
-     */
-    @SuppressWarnings("javadoc") private Field reflectionConstructorSlot = getReflectionSlotField(Constructor.class);
-
-    private static Field getReflectionSlotField(Class<?> reflectionClass) {
-        try {
-            Field field = reflectionClass.getDeclaredField("slot");
-            field.setAccessible(true);
-            return field;
-        } catch (NoSuchFieldException | SecurityException e) {
-            throw new GraalInternalError(e);
-        }
-    }
-
-    public ResolvedJavaMethod lookupJavaMethod(Executable reflectionMethod) {
-        try {
-            Class<?> holder = reflectionMethod.getDeclaringClass();
-            Field slotField = reflectionMethod instanceof Constructor ? reflectionConstructorSlot : reflectionMethodSlot;
-            final int slot = slotField.getInt(reflectionMethod);
-            final long metaspaceMethod = runtime.getCompilerToVM().getMetaspaceMethod(holder, slot);
-            return HotSpotResolvedJavaMethodImpl.fromMetaspace(metaspaceMethod);
-        } catch (IllegalArgumentException | IllegalAccessException e) {
-            throw new GraalInternalError(e);
-        }
-    }
-
-    public ResolvedJavaField lookupJavaField(Field reflectionField) {
-        String name = reflectionField.getName();
-        Class<?> fieldHolder = reflectionField.getDeclaringClass();
-        Class<?> fieldType = reflectionField.getType();
-        // java.lang.reflect.Field's modifiers should be enough here since VM internal modifier bits
-        // are not used (yet).
-        final int modifiers = reflectionField.getModifiers();
-        final long offset = Modifier.isStatic(modifiers) ? unsafe.staticFieldOffset(reflectionField) : unsafe.objectFieldOffset(reflectionField);
-
-        HotSpotResolvedObjectType holder = fromObjectClass(fieldHolder);
-        JavaType type = fromClass(fieldType);
-
-        if (offset != -1) {
-            HotSpotResolvedObjectType resolved = holder;
-            return resolved.createField(name, type, offset, modifiers);
-        } else {
-            throw GraalInternalError.shouldNotReachHere("unresolved field " + reflectionField);
-        }
-    }
-
-    private static int intMaskRight(int n) {
-        assert n <= 32;
-        return n == 32 ? -1 : (1 << n) - 1;
-    }
-
-    @Override
-    public JavaConstant encodeDeoptActionAndReason(DeoptimizationAction action, DeoptimizationReason reason, int debugId) {
-        HotSpotVMConfig config = runtime.getConfig();
-        int actionValue = convertDeoptAction(action);
-        int reasonValue = convertDeoptReason(reason);
-        int debugValue = debugId & intMaskRight(config.deoptimizationDebugIdBits);
-        JavaConstant c = JavaConstant.forInt(~((debugValue << config.deoptimizationDebugIdShift) | (reasonValue << config.deoptimizationReasonShift) | (actionValue << config.deoptimizationActionShift)));
-        assert c.asInt() < 0;
-        return c;
-    }
-
-    public DeoptimizationReason decodeDeoptReason(JavaConstant constant) {
-        HotSpotVMConfig config = runtime.getConfig();
-        int reasonValue = ((~constant.asInt()) >> config.deoptimizationReasonShift) & intMaskRight(config.deoptimizationReasonBits);
-        DeoptimizationReason reason = convertDeoptReason(reasonValue);
-        return reason;
-    }
-
-    public DeoptimizationAction decodeDeoptAction(JavaConstant constant) {
-        HotSpotVMConfig config = runtime.getConfig();
-        int actionValue = ((~constant.asInt()) >> config.deoptimizationActionShift) & intMaskRight(config.deoptimizationActionBits);
-        DeoptimizationAction action = convertDeoptAction(actionValue);
-        return action;
-    }
-
-    public int decodeDebugId(JavaConstant constant) {
-        HotSpotVMConfig config = runtime.getConfig();
-        return ((~constant.asInt()) >> config.deoptimizationDebugIdShift) & intMaskRight(config.deoptimizationDebugIdBits);
-    }
-
-    public int convertDeoptAction(DeoptimizationAction action) {
-        HotSpotVMConfig config = runtime.getConfig();
-        switch (action) {
-            case None:
-                return config.deoptActionNone;
-            case RecompileIfTooManyDeopts:
-                return config.deoptActionMaybeRecompile;
-            case InvalidateReprofile:
-                return config.deoptActionReinterpret;
-            case InvalidateRecompile:
-                return config.deoptActionMakeNotEntrant;
-            case InvalidateStopCompiling:
-                return config.deoptActionMakeNotCompilable;
-            default:
-                throw GraalInternalError.shouldNotReachHere();
-        }
-    }
-
-    public DeoptimizationAction convertDeoptAction(int action) {
-        HotSpotVMConfig config = runtime.getConfig();
-        if (action == config.deoptActionNone) {
-            return DeoptimizationAction.None;
-        }
-        if (action == config.deoptActionMaybeRecompile) {
-            return DeoptimizationAction.RecompileIfTooManyDeopts;
-        }
-        if (action == config.deoptActionReinterpret) {
-            return DeoptimizationAction.InvalidateReprofile;
-        }
-        if (action == config.deoptActionMakeNotEntrant) {
-            return DeoptimizationAction.InvalidateRecompile;
-        }
-        if (action == config.deoptActionMakeNotCompilable) {
-            return DeoptimizationAction.InvalidateStopCompiling;
-        }
-        throw GraalInternalError.shouldNotReachHere();
-    }
-
-    public int convertDeoptReason(DeoptimizationReason reason) {
-        HotSpotVMConfig config = runtime.getConfig();
-        switch (reason) {
-            case None:
-                return config.deoptReasonNone;
-            case NullCheckException:
-                return config.deoptReasonNullCheck;
-            case BoundsCheckException:
-                return config.deoptReasonRangeCheck;
-            case ClassCastException:
-                return config.deoptReasonClassCheck;
-            case ArrayStoreException:
-                return config.deoptReasonArrayCheck;
-            case UnreachedCode:
-                return config.deoptReasonUnreached0;
-            case TypeCheckedInliningViolated:
-                return config.deoptReasonTypeCheckInlining;
-            case OptimizedTypeCheckViolated:
-                return config.deoptReasonOptimizedTypeCheck;
-            case NotCompiledExceptionHandler:
-                return config.deoptReasonNotCompiledExceptionHandler;
-            case Unresolved:
-                return config.deoptReasonUnresolved;
-            case JavaSubroutineMismatch:
-                return config.deoptReasonJsrMismatch;
-            case ArithmeticException:
-                return config.deoptReasonDiv0Check;
-            case RuntimeConstraint:
-                return config.deoptReasonConstraint;
-            case LoopLimitCheck:
-                return config.deoptReasonLoopLimitCheck;
-            case Aliasing:
-                return config.deoptReasonAliasing;
-            case TransferToInterpreter:
-                return config.deoptReasonTransferToInterpreter;
-            default:
-                throw GraalInternalError.shouldNotReachHere();
-        }
-    }
-
-    public DeoptimizationReason convertDeoptReason(int reason) {
-        HotSpotVMConfig config = runtime.getConfig();
-        if (reason == config.deoptReasonNone) {
-            return DeoptimizationReason.None;
-        }
-        if (reason == config.deoptReasonNullCheck) {
-            return DeoptimizationReason.NullCheckException;
-        }
-        if (reason == config.deoptReasonRangeCheck) {
-            return DeoptimizationReason.BoundsCheckException;
-        }
-        if (reason == config.deoptReasonClassCheck) {
-            return DeoptimizationReason.ClassCastException;
-        }
-        if (reason == config.deoptReasonArrayCheck) {
-            return DeoptimizationReason.ArrayStoreException;
-        }
-        if (reason == config.deoptReasonUnreached0) {
-            return DeoptimizationReason.UnreachedCode;
-        }
-        if (reason == config.deoptReasonTypeCheckInlining) {
-            return DeoptimizationReason.TypeCheckedInliningViolated;
-        }
-        if (reason == config.deoptReasonOptimizedTypeCheck) {
-            return DeoptimizationReason.OptimizedTypeCheckViolated;
-        }
-        if (reason == config.deoptReasonNotCompiledExceptionHandler) {
-            return DeoptimizationReason.NotCompiledExceptionHandler;
-        }
-        if (reason == config.deoptReasonUnresolved) {
-            return DeoptimizationReason.Unresolved;
-        }
-        if (reason == config.deoptReasonJsrMismatch) {
-            return DeoptimizationReason.JavaSubroutineMismatch;
-        }
-        if (reason == config.deoptReasonDiv0Check) {
-            return DeoptimizationReason.ArithmeticException;
-        }
-        if (reason == config.deoptReasonConstraint) {
-            return DeoptimizationReason.RuntimeConstraint;
-        }
-        if (reason == config.deoptReasonLoopLimitCheck) {
-            return DeoptimizationReason.LoopLimitCheck;
-        }
-        if (reason == config.deoptReasonAliasing) {
-            return DeoptimizationReason.Aliasing;
-        }
-        if (reason == config.deoptReasonTransferToInterpreter) {
-            return DeoptimizationReason.TransferToInterpreter;
-        }
-        throw GraalInternalError.shouldNotReachHere(Integer.toHexString(reason));
-    }
-
-    @Override
-    public long getMemorySize(JavaConstant constant) {
-        if (constant.getKind() == Kind.Object) {
-            HotSpotResolvedObjectType lookupJavaType = lookupJavaType(constant);
-
-            if (lookupJavaType == null) {
-                return 0;
-            } else {
-                if (lookupJavaType.isArray()) {
-                    // TODO(tw): Add compressed pointer support.
-                    int length = Array.getLength(((HotSpotObjectConstantImpl) constant).object());
-                    ResolvedJavaType elementType = lookupJavaType.getComponentType();
-                    Kind elementKind = elementType.getKind();
-                    final int headerSize = runtime().getArrayBaseOffset(elementKind);
-                    int sizeOfElement = HotSpotGraalRuntime.runtime().getTarget().getSizeInBytes(elementKind);
-                    int alignment = HotSpotGraalRuntime.runtime().getTarget().wordSize;
-                    int log2ElementSize = CodeUtil.log2(sizeOfElement);
-                    return NewObjectSnippets.computeArrayAllocationSize(length, alignment, headerSize, log2ElementSize);
-                }
-                return lookupJavaType.instanceSize();
-            }
-        } else {
-            return constant.getKind().getByteCount();
-        }
-    }
-}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMetaspaceConstant.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.hotspot.meta;
-
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.hotspot.HotSpotVMConfig.CompressEncoding;
-
-public interface HotSpotMetaspaceConstant extends HotSpotConstant, VMConstant {
-
-    Constant compress(CompressEncoding encoding);
-
-    Constant uncompress(CompressEncoding encoding);
-
-    HotSpotResolvedObjectType asResolvedJavaType();
-
-    long rawValue();
-}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMetaspaceConstantImpl.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,93 +0,0 @@
-/*
- * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.hotspot.meta;
-
-import java.util.*;
-
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.hotspot.*;
-import com.oracle.graal.hotspot.HotSpotVMConfig.CompressEncoding;
-
-public final class HotSpotMetaspaceConstantImpl extends PrimitiveConstant implements HotSpotMetaspaceConstant, VMConstant, HotSpotProxified {
-
-    static HotSpotMetaspaceConstantImpl forMetaspaceObject(Kind kind, long primitive, Object metaspaceObject, boolean compressed) {
-        return new HotSpotMetaspaceConstantImpl(kind, primitive, metaspaceObject, compressed);
-    }
-
-    static Object getMetaspaceObject(Constant constant) {
-        return ((HotSpotMetaspaceConstantImpl) constant).metaspaceObject;
-    }
-
-    private final Object metaspaceObject;
-    private final boolean compressed;
-
-    private HotSpotMetaspaceConstantImpl(Kind kind, long primitive, Object metaspaceObject, boolean compressed) {
-        super(kind, primitive);
-        this.metaspaceObject = metaspaceObject;
-        this.compressed = compressed;
-    }
-
-    @Override
-    public int hashCode() {
-        return super.hashCode() ^ System.identityHashCode(metaspaceObject);
-    }
-
-    @Override
-    public boolean equals(Object o) {
-        return o == this || (o instanceof HotSpotMetaspaceConstantImpl && super.equals(o) && Objects.equals(metaspaceObject, ((HotSpotMetaspaceConstantImpl) o).metaspaceObject));
-    }
-
-    @Override
-    public String toString() {
-        return super.toString() + "{" + metaspaceObject + (compressed ? ";compressed}" : "}");
-    }
-
-    public boolean isCompressed() {
-        return compressed;
-    }
-
-    public JavaConstant compress(CompressEncoding encoding) {
-        assert !isCompressed();
-        HotSpotMetaspaceConstantImpl res = HotSpotMetaspaceConstantImpl.forMetaspaceObject(Kind.Int, encoding.compress(asLong()), metaspaceObject, true);
-        assert res.isCompressed();
-        return res;
-    }
-
-    public JavaConstant uncompress(CompressEncoding encoding) {
-        assert isCompressed();
-        HotSpotMetaspaceConstantImpl res = HotSpotMetaspaceConstantImpl.forMetaspaceObject(Kind.Long, encoding.uncompress(asInt()), metaspaceObject, false);
-        assert !res.isCompressed();
-        return res;
-    }
-
-    public HotSpotResolvedObjectType asResolvedJavaType() {
-        if (metaspaceObject instanceof HotSpotResolvedObjectType) {
-            return (HotSpotResolvedObjectType) metaspaceObject;
-        }
-        return null;
-    }
-
-    public long rawValue() {
-        return asLong();
-    }
-}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMethod.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,63 +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.graal.hotspot.meta;
-
-import static com.oracle.graal.debug.Debug.*;
-import static java.util.FormattableFlags.*;
-
-import java.util.*;
-
-import com.oracle.graal.api.meta.*;
-
-public abstract class HotSpotMethod implements JavaMethod, Formattable {
-
-    protected String name;
-
-    /**
-     * Controls whether {@link #toString()} includes the qualified or simple name of the class in
-     * which the method is declared.
-     */
-    public static final boolean FULLY_QUALIFIED_METHOD_NAME = false;
-
-    protected HotSpotMethod(String name) {
-        this.name = name;
-    }
-
-    @Override
-    public final String getName() {
-        return name;
-    }
-
-    @Override
-    public final String toString() {
-        char h = FULLY_QUALIFIED_METHOD_NAME ? 'H' : 'h';
-        String suffix = this instanceof ResolvedJavaMethod ? "" : ", unresolved";
-        String fmt = String.format("HotSpotMethod<%%%c.%%n(%%p)%s>", h, suffix);
-        return format(fmt);
-    }
-
-    public void formatTo(Formatter formatter, int flags, int width, int precision) {
-        String base = (flags & ALTERNATE) == ALTERNATE ? getName() : toString();
-        formatter.format(applyFormattingFlagsAndWidth(base, flags & ~ALTERNATE, width));
-    }
-}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMethodData.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,859 +0,0 @@
-/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.hotspot.meta;
-
-import static com.oracle.graal.compiler.common.UnsafeAccess.*;
-import static com.oracle.graal.hotspot.HotSpotGraalRuntime.*;
-import static java.lang.String.*;
-
-import java.util.*;
-
-import sun.misc.*;
-
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.api.meta.JavaMethodProfile.ProfiledMethod;
-import com.oracle.graal.api.meta.JavaTypeProfile.ProfiledType;
-import com.oracle.graal.hotspot.*;
-import com.oracle.graal.hotspot.meta.HotSpotMethodDataAccessor.Tag;
-
-/**
- * Access to a HotSpot MethodData structure (defined in methodData.hpp).
- */
-public final class HotSpotMethodData {
-
-    private static final HotSpotVMConfig config = runtime().getConfig();
-    private static final HotSpotMethodDataAccessor NO_DATA_NO_EXCEPTION_ACCESSOR = new NoMethodData(TriState.FALSE);
-    private static final HotSpotMethodDataAccessor NO_DATA_EXCEPTION_POSSIBLY_NOT_RECORDED_ACCESSOR = new NoMethodData(TriState.UNKNOWN);
-
-    // sorted by tag
-    // @formatter:off
-    private static final HotSpotMethodDataAccessor[] PROFILE_DATA_ACCESSORS = {
-        null,
-        new BitData(),
-        new CounterData(),
-        new JumpData(),
-        new TypeCheckData(),
-        new VirtualCallData(),
-        new RetData(),
-        new BranchData(),
-        new MultiBranchData(),
-        new ArgInfoData(),
-        null, // call_type_data_tag
-        null, // virtual_call_type_data_tag
-        null, // parameters_type_data_tag
-        null, // speculative_trap_data_tag
-    };
-    // @formatter:on
-
-    /**
-     * Reference to the C++ MethodData object.
-     */
-    private final long metaspaceMethodData;
-
-    public HotSpotMethodData(long metaspaceMethodData) {
-        this.metaspaceMethodData = metaspaceMethodData;
-    }
-
-    /**
-     * @return value of the MethodData::_data_size field
-     */
-    private int normalDataSize() {
-        return unsafe.getInt(metaspaceMethodData + config.methodDataDataSize);
-    }
-
-    /**
-     * Returns the size of the extra data records. This method does the same calculation as
-     * MethodData::extra_data_size().
-     *
-     * @return size of extra data records
-     */
-    private int extraDataSize() {
-        final int extraDataBase = config.methodDataOopDataOffset + normalDataSize();
-        final int extraDataLimit = unsafe.getInt(metaspaceMethodData + config.methodDataSize);
-        return extraDataLimit - extraDataBase;
-    }
-
-    public boolean hasNormalData() {
-        return normalDataSize() > 0;
-    }
-
-    public boolean hasExtraData() {
-        return extraDataSize() > 0;
-    }
-
-    public int getExtraDataBeginOffset() {
-        return normalDataSize();
-    }
-
-    public boolean isWithin(int position) {
-        return position >= 0 && position < normalDataSize() + extraDataSize();
-    }
-
-    public int getDeoptimizationCount(DeoptimizationReason reason) {
-        HotSpotMetaAccessProvider metaAccess = (HotSpotMetaAccessProvider) runtime().getHostProviders().getMetaAccess();
-        int reasonIndex = metaAccess.convertDeoptReason(reason);
-        return unsafe.getByte(metaspaceMethodData + config.methodDataOopTrapHistoryOffset + reasonIndex) & 0xFF;
-    }
-
-    public int getOSRDeoptimizationCount(DeoptimizationReason reason) {
-        HotSpotMetaAccessProvider metaAccess = (HotSpotMetaAccessProvider) runtime().getHostProviders().getMetaAccess();
-        int reasonIndex = metaAccess.convertDeoptReason(reason);
-        return unsafe.getByte(metaspaceMethodData + config.methodDataOopTrapHistoryOffset + config.deoptReasonOSROffset + reasonIndex) & 0xFF;
-    }
-
-    public HotSpotMethodDataAccessor getNormalData(int position) {
-        if (position >= normalDataSize()) {
-            return null;
-        }
-
-        HotSpotMethodDataAccessor result = getData(position);
-        assert result != null : "NO_DATA tag is not allowed";
-        return result;
-    }
-
-    public HotSpotMethodDataAccessor getExtraData(int position) {
-        if (position >= normalDataSize() + extraDataSize()) {
-            return null;
-        }
-        HotSpotMethodDataAccessor data = getData(position);
-        if (data != null) {
-            return data;
-        }
-        return data;
-    }
-
-    public static HotSpotMethodDataAccessor getNoDataAccessor(boolean exceptionPossiblyNotRecorded) {
-        if (exceptionPossiblyNotRecorded) {
-            return NO_DATA_EXCEPTION_POSSIBLY_NOT_RECORDED_ACCESSOR;
-        } else {
-            return NO_DATA_NO_EXCEPTION_ACCESSOR;
-        }
-    }
-
-    private HotSpotMethodDataAccessor getData(int position) {
-        assert position >= 0 : "out of bounds";
-        final Tag tag = AbstractMethodData.readTag(this, position);
-        HotSpotMethodDataAccessor accessor = PROFILE_DATA_ACCESSORS[tag.getValue()];
-        assert accessor == null || accessor.getTag() == tag : "wrong data accessor " + accessor + " for tag " + tag;
-        return accessor;
-    }
-
-    private int readUnsignedByte(int position, int offsetInBytes) {
-        long fullOffsetInBytes = computeFullOffset(position, offsetInBytes);
-        return unsafe.getByte(metaspaceMethodData + fullOffsetInBytes) & 0xFF;
-    }
-
-    private int readUnsignedShort(int position, int offsetInBytes) {
-        long fullOffsetInBytes = computeFullOffset(position, offsetInBytes);
-        return unsafe.getShort(metaspaceMethodData + fullOffsetInBytes) & 0xFFFF;
-    }
-
-    /**
-     * Since the values are stored in cells (platform words) this method uses
-     * {@link Unsafe#getAddress} to read the right value on both little and big endian machines.
-     */
-    private long readUnsignedInt(int position, int offsetInBytes) {
-        long fullOffsetInBytes = computeFullOffset(position, offsetInBytes);
-        return unsafe.getAddress(metaspaceMethodData + fullOffsetInBytes) & 0xFFFFFFFFL;
-    }
-
-    private int readUnsignedIntAsSignedInt(int position, int offsetInBytes) {
-        long value = readUnsignedInt(position, offsetInBytes);
-        return truncateLongToInt(value);
-    }
-
-    /**
-     * Since the values are stored in cells (platform words) this method uses
-     * {@link Unsafe#getAddress} to read the right value on both little and big endian machines.
-     */
-    private int readInt(int position, int offsetInBytes) {
-        long fullOffsetInBytes = computeFullOffset(position, offsetInBytes);
-        return (int) unsafe.getAddress(metaspaceMethodData + fullOffsetInBytes);
-    }
-
-    private long readWord(int position, int offsetInBytes) {
-        long fullOffsetInBytes = computeFullOffset(position, offsetInBytes);
-        return unsafe.getAddress(metaspaceMethodData + fullOffsetInBytes);
-    }
-
-    private static int truncateLongToInt(long value) {
-        return value > Integer.MAX_VALUE ? Integer.MAX_VALUE : (int) value;
-    }
-
-    private static int computeFullOffset(int position, int offsetInBytes) {
-        return config.methodDataOopDataOffset + position + offsetInBytes;
-    }
-
-    private static int cellIndexToOffset(int cells) {
-        return config.dataLayoutHeaderSize + cellsToBytes(cells);
-    }
-
-    private static int cellsToBytes(int cells) {
-        return cells * config.dataLayoutCellSize;
-    }
-
-    /**
-     * Returns whether profiling ran long enough that the profile information is mature. Other
-     * informational data will still be valid even if the profile isn't mature.
-     */
-    public boolean isProfileMature() {
-        return runtime().getCompilerToVM().isMature(metaspaceMethodData);
-    }
-
-    @Override
-    public String toString() {
-        StringBuilder sb = new StringBuilder();
-        String nl = String.format("%n");
-        String nlIndent = String.format("%n%38s", "");
-        if (hasNormalData()) {
-            int pos = 0;
-            HotSpotMethodDataAccessor data;
-            while ((data = getNormalData(pos)) != null) {
-                if (pos != 0) {
-                    sb.append(nl);
-                }
-                int bci = data.getBCI(this, pos);
-                sb.append(String.format("%-6d bci: %-6d%-20s", pos, bci, data.getClass().getSimpleName()));
-                sb.append(data.appendTo(new StringBuilder(), this, pos).toString().replace(nl, nlIndent));
-                pos = pos + data.getSize(this, pos);
-            }
-        }
-
-        if (hasExtraData()) {
-            int pos = getExtraDataBeginOffset();
-            HotSpotMethodDataAccessor data;
-            while ((data = getExtraData(pos)) != null) {
-                if (pos == getExtraDataBeginOffset()) {
-                    sb.append(nl).append("--- Extra data:");
-                }
-                int bci = data.getBCI(this, pos);
-                sb.append(String.format("%n%-6d bci: %-6d%-20s", pos, bci, data.getClass().getSimpleName()));
-                sb.append(data.appendTo(new StringBuilder(), this, pos).toString().replace(nl, nlIndent));
-                pos = pos + data.getSize(this, pos);
-            }
-
-        }
-        return sb.toString();
-    }
-
-    private abstract static class AbstractMethodData implements HotSpotMethodDataAccessor {
-
-        /**
-         * Corresponds to {@code exception_seen_flag}.
-         */
-        private static final int EXCEPTIONS_MASK = 0x2;
-
-        private final Tag tag;
-        private final int staticSize;
-
-        protected AbstractMethodData(Tag tag, int staticSize) {
-            this.tag = tag;
-            this.staticSize = staticSize;
-        }
-
-        public Tag getTag() {
-            return tag;
-        }
-
-        public static Tag readTag(HotSpotMethodData data, int position) {
-            final int tag = data.readUnsignedByte(position, config.dataLayoutTagOffset);
-            return Tag.getEnum(tag);
-        }
-
-        @Override
-        public int getBCI(HotSpotMethodData data, int position) {
-            return data.readUnsignedShort(position, config.dataLayoutBCIOffset);
-        }
-
-        @Override
-        public int getSize(HotSpotMethodData data, int position) {
-            return staticSize + getDynamicSize(data, position);
-        }
-
-        @Override
-        public TriState getExceptionSeen(HotSpotMethodData data, int position) {
-            return TriState.get((getFlags(data, position) & EXCEPTIONS_MASK) != 0);
-        }
-
-        @Override
-        public JavaTypeProfile getTypeProfile(HotSpotMethodData data, int position) {
-            return null;
-        }
-
-        @Override
-        public JavaMethodProfile getMethodProfile(HotSpotMethodData data, int position) {
-            return null;
-        }
-
-        @Override
-        public double getBranchTakenProbability(HotSpotMethodData data, int position) {
-            return -1;
-        }
-
-        @Override
-        public double[] getSwitchProbabilities(HotSpotMethodData data, int position) {
-            return null;
-        }
-
-        @Override
-        public int getExecutionCount(HotSpotMethodData data, int position) {
-            return -1;
-        }
-
-        @Override
-        public TriState getNullSeen(HotSpotMethodData data, int position) {
-            return TriState.UNKNOWN;
-        }
-
-        protected int getFlags(HotSpotMethodData data, int position) {
-            return data.readUnsignedByte(position, config.dataLayoutFlagsOffset);
-        }
-
-        /**
-         * @param data
-         * @param position
-         */
-        protected int getDynamicSize(HotSpotMethodData data, int position) {
-            return 0;
-        }
-
-        public abstract StringBuilder appendTo(StringBuilder sb, HotSpotMethodData data, int pos);
-    }
-
-    private static class NoMethodData extends AbstractMethodData {
-
-        private static final int NO_DATA_SIZE = cellIndexToOffset(0);
-
-        private final TriState exceptionSeen;
-
-        protected NoMethodData(TriState exceptionSeen) {
-            super(Tag.No, NO_DATA_SIZE);
-            this.exceptionSeen = exceptionSeen;
-        }
-
-        @Override
-        public int getBCI(HotSpotMethodData data, int position) {
-            return -1;
-        }
-
-        @Override
-        public TriState getExceptionSeen(HotSpotMethodData data, int position) {
-            return exceptionSeen;
-        }
-
-        @Override
-        public StringBuilder appendTo(StringBuilder sb, HotSpotMethodData data, int pos) {
-            return sb;
-        }
-    }
-
-    private static class BitData extends AbstractMethodData {
-
-        private static final int BIT_DATA_SIZE = cellIndexToOffset(0);
-        private static final int BIT_DATA_NULL_SEEN_FLAG = 0x01;
-
-        private BitData() {
-            super(Tag.BitData, BIT_DATA_SIZE);
-        }
-
-        protected BitData(Tag tag, int staticSize) {
-            super(tag, staticSize);
-        }
-
-        @Override
-        public TriState getNullSeen(HotSpotMethodData data, int position) {
-            return TriState.get((getFlags(data, position) & BIT_DATA_NULL_SEEN_FLAG) != 0);
-        }
-
-        @Override
-        public StringBuilder appendTo(StringBuilder sb, HotSpotMethodData data, int pos) {
-            return sb.append(format("exception_seen(%s)", getExceptionSeen(data, pos)));
-        }
-    }
-
-    private static class CounterData extends BitData {
-
-        private static final int COUNTER_DATA_SIZE = cellIndexToOffset(1);
-        private static final int COUNTER_DATA_COUNT_OFFSET = cellIndexToOffset(0);
-
-        public CounterData() {
-            super(Tag.CounterData, COUNTER_DATA_SIZE);
-        }
-
-        protected CounterData(Tag tag, int staticSize) {
-            super(tag, staticSize);
-        }
-
-        @Override
-        public int getExecutionCount(HotSpotMethodData data, int position) {
-            return getCounterValue(data, position);
-        }
-
-        protected int getCounterValue(HotSpotMethodData data, int position) {
-            return data.readUnsignedIntAsSignedInt(position, COUNTER_DATA_COUNT_OFFSET);
-        }
-
-        @Override
-        public StringBuilder appendTo(StringBuilder sb, HotSpotMethodData data, int pos) {
-            return sb.append(format("count(%d) null_seen(%s) exception_seen(%s)", getCounterValue(data, pos), getNullSeen(data, pos), getExceptionSeen(data, pos)));
-        }
-    }
-
-    private static class JumpData extends AbstractMethodData {
-
-        private static final int JUMP_DATA_SIZE = cellIndexToOffset(2);
-        protected static final int TAKEN_COUNT_OFFSET = cellIndexToOffset(0);
-        protected static final int TAKEN_DISPLACEMENT_OFFSET = cellIndexToOffset(1);
-
-        public JumpData() {
-            super(Tag.JumpData, JUMP_DATA_SIZE);
-        }
-
-        protected JumpData(Tag tag, int staticSize) {
-            super(tag, staticSize);
-        }
-
-        @Override
-        public double getBranchTakenProbability(HotSpotMethodData data, int position) {
-            return getExecutionCount(data, position) != 0 ? 1 : 0;
-        }
-
-        @Override
-        public int getExecutionCount(HotSpotMethodData data, int position) {
-            return data.readUnsignedIntAsSignedInt(position, TAKEN_COUNT_OFFSET);
-        }
-
-        public int getTakenDisplacement(HotSpotMethodData data, int position) {
-            return data.readInt(position, TAKEN_DISPLACEMENT_OFFSET);
-        }
-
-        @Override
-        public StringBuilder appendTo(StringBuilder sb, HotSpotMethodData data, int pos) {
-            return sb.append(format("taken(%d) displacement(%d)", getExecutionCount(data, pos), getTakenDisplacement(data, pos)));
-        }
-    }
-
-    static class RawItemProfile<T> {
-        final int entries;
-        final T[] items;
-        final long[] counts;
-        final long totalCount;
-
-        public RawItemProfile(int entries, T[] items, long[] counts, long totalCount) {
-            this.entries = entries;
-            this.items = items;
-            this.counts = counts;
-            this.totalCount = totalCount;
-        }
-    }
-
-    private abstract static class AbstractTypeData extends CounterData {
-
-        protected static final int TYPE_DATA_ROW_SIZE = cellsToBytes(2);
-
-        protected static final int NONPROFILED_COUNT_OFFSET = cellIndexToOffset(1);
-        protected static final int TYPE_DATA_FIRST_TYPE_OFFSET = cellIndexToOffset(2);
-        protected static final int TYPE_DATA_FIRST_TYPE_COUNT_OFFSET = cellIndexToOffset(3);
-
-        protected AbstractTypeData(Tag tag, int staticSize) {
-            super(tag, staticSize);
-        }
-
-        @Override
-        public JavaTypeProfile getTypeProfile(HotSpotMethodData data, int position) {
-            return createTypeProfile(getNullSeen(data, position), getRawTypeProfile(data, position));
-        }
-
-        private RawItemProfile<ResolvedJavaType> getRawTypeProfile(HotSpotMethodData data, int position) {
-            int typeProfileWidth = config.typeProfileWidth;
-
-            ResolvedJavaType[] types = new ResolvedJavaType[typeProfileWidth];
-            long[] counts = new long[typeProfileWidth];
-            long totalCount = 0;
-            int entries = 0;
-
-            outer: for (int i = 0; i < typeProfileWidth; i++) {
-                long receiverKlass = data.readWord(position, getTypeOffset(i));
-                if (receiverKlass != 0) {
-                    HotSpotResolvedObjectTypeImpl klass = HotSpotResolvedObjectTypeImpl.fromMetaspaceKlass(receiverKlass);
-                    long count = data.readUnsignedInt(position, getTypeCountOffset(i));
-                    /*
-                     * Because of races in the profile collection machinery it's possible for a
-                     * class to appear multiple times so merge them to make the profile look
-                     * rational.
-                     */
-                    for (int j = 0; j < entries; j++) {
-                        if (types[j].equals(klass)) {
-                            totalCount += count;
-                            counts[j] += count;
-                            continue outer;
-                        }
-                    }
-                    types[entries] = klass;
-                    totalCount += count;
-                    counts[entries] = count;
-                    entries++;
-                }
-            }
-
-            totalCount += getTypesNotRecordedExecutionCount(data, position);
-            return new RawItemProfile<>(entries, types, counts, totalCount);
-        }
-
-        protected abstract long getTypesNotRecordedExecutionCount(HotSpotMethodData data, int position);
-
-        private static JavaTypeProfile createTypeProfile(TriState nullSeen, RawItemProfile<ResolvedJavaType> profile) {
-            if (profile.entries <= 0 || profile.totalCount <= 0) {
-                return null;
-            }
-
-            ProfiledType[] ptypes = new ProfiledType[profile.entries];
-            double totalProbability = 0.0;
-            for (int i = 0; i < profile.entries; i++) {
-                double p = profile.counts[i];
-                p = p / profile.totalCount;
-                totalProbability += p;
-                ptypes[i] = new ProfiledType(profile.items[i], p);
-            }
-
-            Arrays.sort(ptypes);
-
-            double notRecordedTypeProbability = profile.entries < config.typeProfileWidth ? 0.0 : Math.min(1.0, Math.max(0.0, 1.0 - totalProbability));
-            assert notRecordedTypeProbability == 0 || profile.entries == config.typeProfileWidth;
-            return new JavaTypeProfile(nullSeen, notRecordedTypeProbability, ptypes);
-        }
-
-        private static int getTypeOffset(int row) {
-            return TYPE_DATA_FIRST_TYPE_OFFSET + row * TYPE_DATA_ROW_SIZE;
-        }
-
-        protected static int getTypeCountOffset(int row) {
-            return TYPE_DATA_FIRST_TYPE_COUNT_OFFSET + row * TYPE_DATA_ROW_SIZE;
-        }
-
-        @Override
-        public StringBuilder appendTo(StringBuilder sb, HotSpotMethodData data, int pos) {
-            RawItemProfile<ResolvedJavaType> profile = getRawTypeProfile(data, pos);
-            TriState nullSeen = getNullSeen(data, pos);
-            TriState exceptionSeen = getExceptionSeen(data, pos);
-            sb.append(format("count(%d) null_seen(%s) exception_seen(%s) nonprofiled_count(%d) entries(%d)", getCounterValue(data, pos), nullSeen, exceptionSeen,
-                            getTypesNotRecordedExecutionCount(data, pos), profile.entries));
-            for (int i = 0; i < profile.entries; i++) {
-                long count = profile.counts[i];
-                sb.append(format("%n  %s (%d, %4.2f)", profile.items[i].toJavaName(), count, (double) count / profile.totalCount));
-            }
-            return sb;
-        }
-    }
-
-    private static class TypeCheckData extends AbstractTypeData {
-
-        private static final int TYPE_CHECK_DATA_SIZE = cellIndexToOffset(2) + TYPE_DATA_ROW_SIZE * config.typeProfileWidth;
-
-        public TypeCheckData() {
-            super(Tag.ReceiverTypeData, TYPE_CHECK_DATA_SIZE);
-        }
-
-        @Override
-        public int getExecutionCount(HotSpotMethodData data, int position) {
-            return -1;
-        }
-
-        @Override
-        protected long getTypesNotRecordedExecutionCount(HotSpotMethodData data, int position) {
-            return data.readUnsignedIntAsSignedInt(position, NONPROFILED_COUNT_OFFSET);
-        }
-    }
-
-    private static class VirtualCallData extends AbstractTypeData {
-
-        private static final int VIRTUAL_CALL_DATA_SIZE = cellIndexToOffset(2) + TYPE_DATA_ROW_SIZE * (config.typeProfileWidth + config.methodProfileWidth);
-        private static final int VIRTUAL_CALL_DATA_FIRST_METHOD_OFFSET = TYPE_DATA_FIRST_TYPE_OFFSET + TYPE_DATA_ROW_SIZE * config.typeProfileWidth;
-        private static final int VIRTUAL_CALL_DATA_FIRST_METHOD_COUNT_OFFSET = TYPE_DATA_FIRST_TYPE_COUNT_OFFSET + TYPE_DATA_ROW_SIZE * config.typeProfileWidth;
-
-        public VirtualCallData() {
-            super(Tag.VirtualCallData, VIRTUAL_CALL_DATA_SIZE);
-        }
-
-        @Override
-        public int getExecutionCount(HotSpotMethodData data, int position) {
-            final int typeProfileWidth = config.typeProfileWidth;
-
-            long total = 0;
-            for (int i = 0; i < typeProfileWidth; i++) {
-                total += data.readUnsignedInt(position, getTypeCountOffset(i));
-            }
-
-            total += getCounterValue(data, position);
-            return truncateLongToInt(total);
-        }
-
-        @Override
-        protected long getTypesNotRecordedExecutionCount(HotSpotMethodData data, int position) {
-            return getCounterValue(data, position);
-        }
-
-        private static long getMethodsNotRecordedExecutionCount(HotSpotMethodData data, int position) {
-            return data.readUnsignedIntAsSignedInt(position, NONPROFILED_COUNT_OFFSET);
-        }
-
-        @Override
-        public JavaMethodProfile getMethodProfile(HotSpotMethodData data, int position) {
-            return createMethodProfile(getRawMethodProfile(data, position));
-        }
-
-        private static RawItemProfile<ResolvedJavaMethod> getRawMethodProfile(HotSpotMethodData data, int position) {
-            int profileWidth = config.methodProfileWidth;
-
-            ResolvedJavaMethod[] methods = new ResolvedJavaMethod[profileWidth];
-            long[] counts = new long[profileWidth];
-            long totalCount = 0;
-            int entries = 0;
-
-            for (int i = 0; i < profileWidth; i++) {
-                long method = data.readWord(position, getMethodOffset(i));
-                if (method != 0) {
-                    methods[entries] = HotSpotResolvedJavaMethodImpl.fromMetaspace(method);
-                    long count = data.readUnsignedInt(position, getMethodCountOffset(i));
-                    totalCount += count;
-                    counts[entries] = count;
-
-                    entries++;
-                }
-            }
-
-            totalCount += getMethodsNotRecordedExecutionCount(data, position);
-            return new RawItemProfile<>(entries, methods, counts, totalCount);
-        }
-
-        private static JavaMethodProfile createMethodProfile(RawItemProfile<ResolvedJavaMethod> profile) {
-            if (profile.entries <= 0 || profile.totalCount <= 0) {
-                return null;
-            }
-
-            ProfiledMethod[] pmethods = new ProfiledMethod[profile.entries];
-            double totalProbability = 0.0;
-            for (int i = 0; i < profile.entries; i++) {
-                double p = profile.counts[i];
-                p = p / profile.totalCount;
-                totalProbability += p;
-                pmethods[i] = new ProfiledMethod(profile.items[i], p);
-            }
-
-            Arrays.sort(pmethods);
-
-            double notRecordedMethodProbability = profile.entries < config.methodProfileWidth ? 0.0 : Math.min(1.0, Math.max(0.0, 1.0 - totalProbability));
-            assert notRecordedMethodProbability == 0 || profile.entries == config.methodProfileWidth;
-            return new JavaMethodProfile(notRecordedMethodProbability, pmethods);
-        }
-
-        private static int getMethodOffset(int row) {
-            return VIRTUAL_CALL_DATA_FIRST_METHOD_OFFSET + row * TYPE_DATA_ROW_SIZE;
-        }
-
-        private static int getMethodCountOffset(int row) {
-            return VIRTUAL_CALL_DATA_FIRST_METHOD_COUNT_OFFSET + row * TYPE_DATA_ROW_SIZE;
-        }
-
-        @Override
-        public StringBuilder appendTo(StringBuilder sb, HotSpotMethodData data, int pos) {
-            RawItemProfile<ResolvedJavaMethod> profile = getRawMethodProfile(data, pos);
-            super.appendTo(sb.append(format("exception_seen(%s) ", getExceptionSeen(data, pos))), data, pos).append(format("%nmethod_entries(%d)", profile.entries));
-            for (int i = 0; i < profile.entries; i++) {
-                long count = profile.counts[i];
-                sb.append(format("%n  %s (%d, %4.2f)", profile.items[i].format("%H.%n(%p)"), count, (double) count / profile.totalCount));
-            }
-            return sb;
-        }
-    }
-
-    private static class RetData extends CounterData {
-
-        private static final int RET_DATA_ROW_SIZE = cellsToBytes(3);
-        private static final int RET_DATA_SIZE = cellIndexToOffset(1) + RET_DATA_ROW_SIZE * config.bciProfileWidth;
-
-        public RetData() {
-            super(Tag.RetData, RET_DATA_SIZE);
-        }
-    }
-
-    private static class BranchData extends JumpData {
-
-        private static final int BRANCH_DATA_SIZE = cellIndexToOffset(3);
-        private static final int NOT_TAKEN_COUNT_OFFSET = cellIndexToOffset(2);
-
-        public BranchData() {
-            super(Tag.BranchData, BRANCH_DATA_SIZE);
-        }
-
-        @Override
-        public double getBranchTakenProbability(HotSpotMethodData data, int position) {
-            long takenCount = data.readUnsignedInt(position, TAKEN_COUNT_OFFSET);
-            long notTakenCount = data.readUnsignedInt(position, NOT_TAKEN_COUNT_OFFSET);
-            long total = takenCount + notTakenCount;
-
-            return total <= 0 ? -1 : takenCount / (double) total;
-        }
-
-        @Override
-        public int getExecutionCount(HotSpotMethodData data, int position) {
-            long count = data.readUnsignedInt(position, TAKEN_COUNT_OFFSET) + data.readUnsignedInt(position, NOT_TAKEN_COUNT_OFFSET);
-            return truncateLongToInt(count);
-        }
-
-        @Override
-        public StringBuilder appendTo(StringBuilder sb, HotSpotMethodData data, int pos) {
-            long taken = data.readUnsignedInt(pos, TAKEN_COUNT_OFFSET);
-            long notTaken = data.readUnsignedInt(pos, NOT_TAKEN_COUNT_OFFSET);
-            double takenProbability = getBranchTakenProbability(data, pos);
-            return sb.append(format("taken(%d, %4.2f) not_taken(%d, %4.2f) displacement(%d)", taken, takenProbability, notTaken, 1.0D - takenProbability, getTakenDisplacement(data, pos)));
-        }
-    }
-
-    private static class ArrayData extends AbstractMethodData {
-
-        private static final int ARRAY_DATA_LENGTH_OFFSET = cellIndexToOffset(0);
-        protected static final int ARRAY_DATA_START_OFFSET = cellIndexToOffset(1);
-
-        public ArrayData(Tag tag, int staticSize) {
-            super(tag, staticSize);
-        }
-
-        @Override
-        protected int getDynamicSize(HotSpotMethodData data, int position) {
-            return cellsToBytes(getLength(data, position));
-        }
-
-        protected static int getLength(HotSpotMethodData data, int position) {
-            return data.readInt(position, ARRAY_DATA_LENGTH_OFFSET);
-        }
-
-        @Override
-        public StringBuilder appendTo(StringBuilder sb, HotSpotMethodData data, int pos) {
-            return sb.append(format("length(%d)", getLength(data, pos)));
-        }
-    }
-
-    private static class MultiBranchData extends ArrayData {
-
-        private static final int MULTI_BRANCH_DATA_SIZE = cellIndexToOffset(1);
-        private static final int MULTI_BRANCH_DATA_ROW_SIZE_IN_CELLS = 2;
-        private static final int MULTI_BRANCH_DATA_ROW_SIZE = cellsToBytes(MULTI_BRANCH_DATA_ROW_SIZE_IN_CELLS);
-        private static final int MULTI_BRANCH_DATA_FIRST_COUNT_OFFSET = ARRAY_DATA_START_OFFSET + cellsToBytes(0);
-        private static final int MULTI_BRANCH_DATA_FIRST_DISPLACEMENT_OFFSET = ARRAY_DATA_START_OFFSET + cellsToBytes(1);
-
-        public MultiBranchData() {
-            super(Tag.MultiBranchData, MULTI_BRANCH_DATA_SIZE);
-        }
-
-        @Override
-        public double[] getSwitchProbabilities(HotSpotMethodData data, int position) {
-            int arrayLength = getLength(data, position);
-            assert arrayLength > 0 : "switch must have at least the default case";
-            assert arrayLength % MULTI_BRANCH_DATA_ROW_SIZE_IN_CELLS == 0 : "array must have full rows";
-
-            int length = arrayLength / MULTI_BRANCH_DATA_ROW_SIZE_IN_CELLS;
-            long totalCount = 0;
-            double[] result = new double[length];
-
-            // default case is first in HotSpot but last for the compiler
-            long count = readCount(data, position, 0);
-            totalCount += count;
-            result[length - 1] = count;
-
-            for (int i = 1; i < length; i++) {
-                count = readCount(data, position, i);
-                totalCount += count;
-                result[i - 1] = count;
-            }
-
-            if (totalCount <= 0) {
-                return null;
-            } else {
-                for (int i = 0; i < length; i++) {
-                    result[i] = result[i] / totalCount;
-                }
-                return result;
-            }
-        }
-
-        private static long readCount(HotSpotMethodData data, int position, int i) {
-            int offset;
-            long count;
-            offset = getCountOffset(i);
-            count = data.readUnsignedInt(position, offset);
-            return count;
-        }
-
-        @Override
-        public int getExecutionCount(HotSpotMethodData data, int position) {
-            int arrayLength = getLength(data, position);
-            assert arrayLength > 0 : "switch must have at least the default case";
-            assert arrayLength % MULTI_BRANCH_DATA_ROW_SIZE_IN_CELLS == 0 : "array must have full rows";
-
-            int length = arrayLength / MULTI_BRANCH_DATA_ROW_SIZE_IN_CELLS;
-            long totalCount = 0;
-            for (int i = 0; i < length; i++) {
-                int offset = getCountOffset(i);
-                totalCount += data.readUnsignedInt(position, offset);
-            }
-
-            return truncateLongToInt(totalCount);
-        }
-
-        private static int getCountOffset(int index) {
-            return MULTI_BRANCH_DATA_FIRST_COUNT_OFFSET + index * MULTI_BRANCH_DATA_ROW_SIZE;
-        }
-
-        private static int getDisplacementOffset(int index) {
-            return MULTI_BRANCH_DATA_FIRST_DISPLACEMENT_OFFSET + index * MULTI_BRANCH_DATA_ROW_SIZE;
-        }
-
-        @Override
-        public StringBuilder appendTo(StringBuilder sb, HotSpotMethodData data, int pos) {
-            int entries = getLength(data, pos) / MULTI_BRANCH_DATA_ROW_SIZE_IN_CELLS;
-            sb.append(format("entries(%d)", entries));
-            for (int i = 0; i < entries; i++) {
-                sb.append(format("%n  %d: count(%d) displacement(%d)", i, data.readUnsignedInt(pos, getCountOffset(i)), data.readUnsignedInt(pos, getDisplacementOffset(i))));
-            }
-            return sb;
-        }
-    }
-
-    private static class ArgInfoData extends ArrayData {
-
-        private static final int ARG_INFO_DATA_SIZE = cellIndexToOffset(1);
-
-        public ArgInfoData() {
-            super(Tag.ArgInfoData, ARG_INFO_DATA_SIZE);
-        }
-    }
-
-    public void setCompiledGraphSize(int nodeCount) {
-        unsafe.putInt(metaspaceMethodData + config.methodDataGraalNodeCountOffset, nodeCount);
-    }
-
-    public int getCompiledGraphSize() {
-        return unsafe.getInt(metaspaceMethodData + config.methodDataGraalNodeCountOffset);
-    }
-}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMethodDataAccessor.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,113 +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.graal.hotspot.meta;
-
-import static com.oracle.graal.hotspot.HotSpotGraalRuntime.*;
-
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.hotspot.*;
-
-/**
- * Interface for accessor objects that encapsulate the logic for accessing the different kinds of
- * data in a HotSpot methodDataOop. This interface is similar to the interface {@link ProfilingInfo}
- * , but most methods require a MethodDataObject and the exact position within the methodData.
- */
-public interface HotSpotMethodDataAccessor {
-
-    /**
-     * {@code DataLayout} tag values.
-     */
-    enum Tag {
-        No(config().dataLayoutNoTag),
-        BitData(config().dataLayoutBitDataTag),
-        CounterData(config().dataLayoutCounterDataTag),
-        JumpData(config().dataLayoutJumpDataTag),
-        ReceiverTypeData(config().dataLayoutReceiverTypeDataTag),
-        VirtualCallData(config().dataLayoutVirtualCallDataTag),
-        RetData(config().dataLayoutRetDataTag),
-        BranchData(config().dataLayoutBranchDataTag),
-        MultiBranchData(config().dataLayoutMultiBranchDataTag),
-        ArgInfoData(config().dataLayoutArgInfoDataTag),
-        CallTypeData(config().dataLayoutCallTypeDataTag),
-        VirtualCallTypeData(config().dataLayoutVirtualCallTypeDataTag),
-        ParametersTypeData(config().dataLayoutParametersTypeDataTag),
-        SpeculativeTrapData(config().dataLayoutSpeculativeTrapDataTag);
-
-        private final int value;
-
-        private Tag(int value) {
-            this.value = value;
-        }
-
-        public int getValue() {
-            return value;
-        }
-
-        private static HotSpotVMConfig config() {
-            return runtime().getConfig();
-        }
-
-        public static Tag getEnum(int value) {
-            Tag result = values()[value];
-            assert value == result.value;
-            return result;
-        }
-    }
-
-    /**
-     * Returns the {@link Tag} stored in the LayoutData header.
-     *
-     * @return tag stored in the LayoutData header
-     */
-    Tag getTag();
-
-    /**
-     * Returns the BCI stored in the LayoutData header.
-     *
-     * @return An integer &ge; 0 and &le; Short.MAX_VALUE, or -1 if not supported.
-     */
-    int getBCI(HotSpotMethodData data, int position);
-
-    /**
-     * Computes the size for the specific data at the given position.
-     *
-     * @return An integer &gt; 0.
-     */
-    int getSize(HotSpotMethodData data, int position);
-
-    JavaTypeProfile getTypeProfile(HotSpotMethodData data, int position);
-
-    JavaMethodProfile getMethodProfile(HotSpotMethodData data, int position);
-
-    double getBranchTakenProbability(HotSpotMethodData data, int position);
-
-    double[] getSwitchProbabilities(HotSpotMethodData data, int position);
-
-    TriState getExceptionSeen(HotSpotMethodData data, int position);
-
-    TriState getNullSeen(HotSpotMethodData data, int position);
-
-    int getExecutionCount(HotSpotMethodData data, int position);
-
-    StringBuilder appendTo(StringBuilder sb, HotSpotMethodData data, int pos);
-}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMethodHandleAccessProvider.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMethodHandleAccessProvider.java	Thu May 28 21:11:28 2015 -0700
@@ -22,13 +22,19 @@
  */
 package com.oracle.graal.hotspot.meta;
 
+import com.oracle.jvmci.meta.ResolvedJavaField;
+import com.oracle.jvmci.meta.JavaConstant;
+import com.oracle.jvmci.meta.ResolvedJavaType;
+import com.oracle.jvmci.meta.ConstantReflectionProvider;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
+import com.oracle.jvmci.meta.MethodHandleAccessProvider;
 import static com.oracle.graal.hotspot.HotSpotGraalRuntime.*;
-import static com.oracle.graal.hotspot.meta.HotSpotResolvedJavaType.*;
-import static com.oracle.graal.hotspot.meta.HotSpotResolvedObjectTypeImpl.*;
+import static com.oracle.jvmci.hotspot.HotSpotResolvedJavaType.*;
+import static com.oracle.jvmci.hotspot.HotSpotResolvedObjectTypeImpl.*;
 
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.hotspot.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.hotspot.*;
 
 public class HotSpotMethodHandleAccessProvider implements MethodHandleAccessProvider, HotSpotProxified {
 
@@ -89,7 +95,7 @@
                 lambdaFormCompileToBytecodeMethod = findMethodInClass("java.lang.invoke.LambdaForm", "compileToBytecode");
                 memberNameVmtargetField = findFieldInClass("java.lang.invoke.MemberName", "vmtarget");
             } catch (Throwable ex) {
-                throw GraalInternalError.shouldNotReachHere();
+                throw JVMCIError.shouldNotReachHere();
             }
         }
     }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMethodUnresolved.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +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.graal.hotspot.meta;
-
-import com.oracle.graal.api.meta.*;
-
-/**
- * Implementation of {@link JavaMethod} for unresolved HotSpot methods.
- */
-public final class HotSpotMethodUnresolved extends HotSpotMethod {
-
-    private final Signature signature;
-    protected JavaType holder;
-
-    public HotSpotMethodUnresolved(String name, Signature signature, JavaType holder) {
-        super(name);
-        this.holder = holder;
-        this.signature = signature;
-    }
-
-    @Override
-    public Signature getSignature() {
-        return signature;
-    }
-
-    @Override
-    public JavaType getDeclaringClass() {
-        return holder;
-    }
-
-    @Override
-    public int hashCode() {
-        return super.hashCode();
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj == null || !(obj instanceof HotSpotMethodUnresolved)) {
-            return false;
-        }
-        HotSpotMethodUnresolved that = (HotSpotMethodUnresolved) obj;
-        return this.name.equals(that.name) && this.signature.equals(that.signature) && this.holder.equals(that.holder);
-    }
-}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotNmethod.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,121 +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.graal.hotspot.meta;
-
-import static com.oracle.graal.hotspot.HotSpotGraalRuntime.*;
-
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
-
-/**
- * Implementation of {@link InstalledCode} for code installed as an nmethod. The nmethod stores a
- * weak reference to an instance of this class. This is necessary to keep the nmethod from being
- * unloaded while the associated {@link HotSpotNmethod} instance is alive.
- * <p>
- * Note that there is no (current) way for the reference from an nmethod to a {@link HotSpotNmethod}
- * instance to be anything but weak. This is due to the fact that HotSpot does not treat nmethods as
- * strong GC roots.
- */
-public class HotSpotNmethod extends HotSpotInstalledCode {
-
-    /**
-     * This (indirect) Method* reference is safe since class redefinition preserves all methods
-     * associated with nmethods in the code cache.
-     */
-    private final HotSpotResolvedJavaMethod method;
-
-    private final boolean isDefault;
-    private final boolean isExternal;
-
-    public HotSpotNmethod(HotSpotResolvedJavaMethod method, String name, boolean isDefault) {
-        this(method, name, isDefault, false);
-    }
-
-    public HotSpotNmethod(HotSpotResolvedJavaMethod method, String name, boolean isDefault, boolean isExternal) {
-        super(name);
-        this.method = method;
-        this.isDefault = isDefault;
-        this.isExternal = isExternal;
-    }
-
-    public boolean isDefault() {
-        return isDefault;
-    }
-
-    public boolean isExternal() {
-        return isExternal;
-    }
-
-    public ResolvedJavaMethod getMethod() {
-        return method;
-    }
-
-    @Override
-    public void invalidate() {
-        runtime().getCompilerToVM().invalidateInstalledCode(this);
-    }
-
-    @Override
-    public String toString() {
-        return String.format("InstalledNmethod[method=%s, codeBlob=0x%x, isDefault=%b, name=%s]", method, getAddress(), isDefault, name);
-    }
-
-    protected boolean checkThreeObjectArgs() {
-        assert method.getSignature().getParameterCount(!method.isStatic()) == 3;
-        assert method.getSignature().getParameterKind(0) == Kind.Object;
-        assert method.getSignature().getParameterKind(1) == Kind.Object;
-        assert !method.isStatic() || method.getSignature().getParameterKind(2) == Kind.Object;
-        return true;
-    }
-
-    private boolean checkArgs(Object... args) {
-        JavaType[] sig = method.toParameterTypes();
-        assert args.length == sig.length : method.format("%H.%n(%p): expected ") + sig.length + " args, got " + args.length;
-        for (int i = 0; i < sig.length; i++) {
-            Object arg = args[i];
-            if (arg == null) {
-                assert sig[i].getKind() == Kind.Object : method.format("%H.%n(%p): expected arg ") + i + " to be Object, not " + sig[i];
-            } else if (sig[i].getKind() != Kind.Object) {
-                assert sig[i].getKind().toBoxedJavaClass() == arg.getClass() : method.format("%H.%n(%p): expected arg ") + i + " to be " + sig[i] + ", not " + arg.getClass();
-            }
-        }
-        return true;
-    }
-
-    @Override
-    public Object executeVarargs(Object... args) throws InvalidInstalledCodeException {
-        assert checkArgs(args);
-        assert !isExternal();
-        return runtime().getCompilerToVM().executeCompiledMethodVarargs(args, this);
-    }
-
-    @Override
-    public long getStart() {
-        return isValid() ? super.getStart() : 0;
-    }
-
-    public JavaConstant asConstant() {
-        return HotSpotObjectConstantImpl.forObject(this);
-    }
-
-}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotObjectConstant.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,113 +0,0 @@
-/*
- * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.hotspot.meta;
-
-import java.lang.invoke.*;
-import java.util.*;
-
-import com.oracle.graal.api.meta.*;
-
-/**
- * Represents a constant non-{@code null} object reference, within the compiler and across the
- * compiler/runtime interface.
- */
-public interface HotSpotObjectConstant extends JavaConstant, HotSpotConstant, VMConstant {
-
-    JavaConstant compress();
-
-    JavaConstant uncompress();
-
-    /**
-     * Gets the resolved Java type of the object represented by this constant.
-     */
-    HotSpotResolvedObjectType getType();
-
-    /**
-     * Gets the result of {@link Class#getClassLoader()} for the {@link Class} object represented by
-     * this constant.
-     *
-     * @return {@code null} if this constant does not represent a {@link Class} object
-     */
-    JavaConstant getClassLoader();
-
-    /**
-     * Gets the {@linkplain System#identityHashCode(Object) identity} has code for the object
-     * represented by this constant.
-     */
-    int getIdentityHashCode();
-
-    /**
-     * Gets the result of {@link Class#getComponentType()} for the {@link Class} object represented
-     * by this constant.
-     *
-     * @return {@code null} if this constant does not represent a {@link Class} object
-     */
-    JavaConstant getComponentType();
-
-    /**
-     * Gets the result of {@link Class#getSuperclass()} for the {@link Class} object represented by
-     * this constant.
-     *
-     * @return {@code null} if this constant does not represent a {@link Class} object
-     */
-    JavaConstant getSuperclass();
-
-    /**
-     * Gets the result of {@link CallSite#getTarget()} for the {@link CallSite} object represented
-     * by this constant.
-     *
-     * @param assumptions used to register an assumption that the {@link CallSite}'s target does not
-     *            change
-     * @return {@code null} if this constant does not represent a {@link CallSite} object
-     */
-    JavaConstant getCallSiteTarget(Assumptions assumptions);
-
-    /**
-     * Determines if this constant represents an {@linkplain String#intern() interned} string.
-     */
-    boolean isInternedString();
-
-    /**
-     * Gets the object represented by this constant represents if it is of a given type.
-     *
-     * @param type the expected type of the object represented by this constant. If the object is
-     *            required to be of this type, then wrap the call to this method in
-     *            {@link Objects#requireNonNull(Object)}.
-     * @return the object value represented by this constant if it is an
-     *         {@link ResolvedJavaType#isInstance(JavaConstant) instance of} {@code type} otherwise
-     *         {@code null}
-     */
-    <T> T asObject(Class<T> type);
-
-    /**
-     * Gets the object represented by this constant represents if it is of a given type.
-     *
-     * @param type the expected type of the object represented by this constant. If the object is
-     *            required to be of this type, then wrap the call to this method in
-     *            {@link Objects#requireNonNull(Object)}.
-     * @return the object value represented by this constant if it is an
-     *         {@link ResolvedJavaType#isInstance(JavaConstant) instance of} {@code type} otherwise
-     *         {@code null}
-     */
-    Object asObject(ResolvedJavaType type);
-}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotObjectConstantImpl.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,291 +0,0 @@
-/*
- * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.hotspot.meta;
-
-import static com.oracle.graal.hotspot.meta.HotSpotResolvedObjectTypeImpl.*;
-
-import java.lang.invoke.*;
-
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.hotspot.*;
-
-import edu.umd.cs.findbugs.annotations.*;
-
-/**
- * Represents a constant non-{@code null} object reference, within the compiler and across the
- * compiler/runtime interface.
- */
-public final class HotSpotObjectConstantImpl extends AbstractValue implements HotSpotObjectConstant, HotSpotProxified {
-
-    static JavaConstant forObject(Object object) {
-        return forObject(object, false);
-    }
-
-    static JavaConstant forObject(Object object, boolean compressed) {
-        if (object == null) {
-            return compressed ? HotSpotCompressedNullConstant.COMPRESSED_NULL : JavaConstant.NULL_POINTER;
-        } else {
-            return new HotSpotObjectConstantImpl(object, compressed);
-        }
-    }
-
-    static JavaConstant forStableArray(Object object, int stableDimension, boolean isDefaultStable) {
-        if (object == null) {
-            return JavaConstant.NULL_POINTER;
-        } else {
-            assert object.getClass().isArray();
-            return new HotSpotObjectConstantImpl(object, false, stableDimension, isDefaultStable);
-        }
-    }
-
-    public static JavaConstant forBoxedValue(Kind kind, Object value) {
-        if (kind == Kind.Object) {
-            return HotSpotObjectConstantImpl.forObject(value);
-        } else {
-            return JavaConstant.forBoxedPrimitive(value);
-        }
-    }
-
-    static Object asBoxedValue(Constant constant) {
-        if (JavaConstant.isNull(constant)) {
-            return null;
-        } else if (constant instanceof HotSpotObjectConstantImpl) {
-            return ((HotSpotObjectConstantImpl) constant).object;
-        } else {
-            return ((JavaConstant) constant).asBoxedPrimitive();
-        }
-    }
-
-    private final Object object;
-    private final boolean compressed;
-    private final byte stableDimension;
-    private final boolean isDefaultStable;
-
-    private HotSpotObjectConstantImpl(Object object, boolean compressed, int stableDimension, boolean isDefaultStable) {
-        super(LIRKind.reference(compressed ? Kind.Int : Kind.Object));
-        this.object = object;
-        this.compressed = compressed;
-        this.stableDimension = (byte) stableDimension;
-        this.isDefaultStable = isDefaultStable;
-        assert object != null;
-        assert stableDimension == 0 || (object != null && object.getClass().isArray());
-        assert stableDimension >= 0 && stableDimension <= 255;
-        assert !isDefaultStable || stableDimension > 0;
-    }
-
-    private HotSpotObjectConstantImpl(Object object, boolean compressed) {
-        this(object, compressed, 0, false);
-    }
-
-    /**
-     * Package-private accessor for the object represented by this constant.
-     */
-    Object object() {
-        return object;
-    }
-
-    /**
-     * Determines if the object represented by this constant is {@link Object#equals(Object) equal}
-     * to a given object.
-     */
-    public boolean isEqualTo(Object obj) {
-        return object.equals(obj);
-    }
-
-    /**
-     * Gets the class of the object represented by this constant.
-     */
-    public Class<?> getObjectClass() {
-        return object.getClass();
-    }
-
-    public boolean isCompressed() {
-        return compressed;
-    }
-
-    public JavaConstant compress() {
-        assert !compressed;
-        return new HotSpotObjectConstantImpl(object, true, stableDimension, isDefaultStable);
-    }
-
-    public JavaConstant uncompress() {
-        assert compressed;
-        return new HotSpotObjectConstantImpl(object, false, stableDimension, isDefaultStable);
-    }
-
-    public HotSpotResolvedObjectType getType() {
-        return fromObjectClass(object.getClass());
-    }
-
-    public JavaConstant getClassLoader() {
-        if (object instanceof Class) {
-            /*
-             * This is an intrinsic for getClassLoader0, which occurs after any security checks. We
-             * can't call that directly so just call getClassLoader.
-             */
-            return HotSpotObjectConstantImpl.forObject(((Class<?>) object).getClassLoader());
-        }
-        return null;
-    }
-
-    public int getIdentityHashCode() {
-        return System.identityHashCode(object);
-    }
-
-    public JavaConstant getComponentType() {
-        if (object instanceof Class) {
-            return HotSpotObjectConstantImpl.forObject(((Class<?>) object).getComponentType());
-        }
-        return null;
-    }
-
-    public JavaConstant getSuperclass() {
-        if (object instanceof Class) {
-            return HotSpotObjectConstantImpl.forObject(((Class<?>) object).getSuperclass());
-        }
-        return null;
-    }
-
-    public JavaConstant getCallSiteTarget(Assumptions assumptions) {
-        if (object instanceof CallSite) {
-            CallSite callSite = (CallSite) object;
-            MethodHandle target = callSite.getTarget();
-            if (!(callSite instanceof ConstantCallSite)) {
-                if (assumptions == null) {
-                    return null;
-                }
-                assumptions.record(new Assumptions.CallSiteTargetValue(callSite, target));
-            }
-            return HotSpotObjectConstantImpl.forObject(target);
-        }
-        return null;
-    }
-
-    @SuppressFBWarnings(value = "ES_COMPARING_STRINGS_WITH_EQ", justification = "reference equality is what we want")
-    public boolean isInternedString() {
-        if (object instanceof String) {
-            String s = (String) object;
-            return s.intern() == s;
-        }
-        return false;
-    }
-
-    public <T> T asObject(Class<T> type) {
-        if (type.isInstance(object)) {
-            return type.cast(object);
-        }
-        return null;
-    }
-
-    public Object asObject(ResolvedJavaType type) {
-        if (type.isInstance(this)) {
-            return object;
-        }
-        return null;
-    }
-
-    @Override
-    public boolean isNull() {
-        return false;
-    }
-
-    @Override
-    public boolean isDefaultForKind() {
-        return false;
-    }
-
-    @Override
-    public Object asBoxedPrimitive() {
-        throw new IllegalArgumentException();
-    }
-
-    @Override
-    public int asInt() {
-        throw new IllegalArgumentException();
-    }
-
-    @Override
-    public boolean asBoolean() {
-        throw new IllegalArgumentException();
-    }
-
-    @Override
-    public long asLong() {
-        throw new IllegalArgumentException();
-    }
-
-    @Override
-    public float asFloat() {
-        throw new IllegalArgumentException();
-    }
-
-    @Override
-    public double asDouble() {
-        throw new IllegalArgumentException();
-    }
-
-    @Override
-    public int hashCode() {
-        return System.identityHashCode(object);
-    }
-
-    @Override
-    public boolean equals(Object o) {
-        if (o == this) {
-            return true;
-        } else if (o instanceof HotSpotObjectConstantImpl) {
-            HotSpotObjectConstantImpl other = (HotSpotObjectConstantImpl) o;
-            return super.equals(o) && object == other.object && compressed == other.compressed && stableDimension == other.stableDimension && isDefaultStable == other.isDefaultStable;
-        }
-        return false;
-    }
-
-    @Override
-    public String toValueString() {
-        if (object instanceof String) {
-            return (String) object;
-        } else {
-            return Kind.Object.format(object);
-        }
-    }
-
-    @Override
-    public String toString() {
-        return (compressed ? "NarrowOop" : getKind().getJavaName()) + "[" + Kind.Object.format(object) + "]";
-    }
-
-    /**
-     * Number of stable dimensions if this constant is a stable array.
-     */
-    public int getStableDimension() {
-        return stableDimension & 0xff;
-    }
-
-    /**
-     * Returns {@code true} if this is a stable array constant and its elements should be considered
-     * as stable regardless of whether they are default values.
-     */
-    public boolean isDefaultStable() {
-        return isDefaultStable;
-    }
-}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotParameterPlugin.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotParameterPlugin.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,7 @@
  */
 package com.oracle.graal.hotspot.meta;
 
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.meta.ResolvedJavaType;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graphbuilderconf.*;
 import com.oracle.graal.nodes.*;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotProfilingInfo.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,225 +0,0 @@
-/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.hotspot.meta;
-
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.debug.*;
-import com.oracle.graal.hotspot.*;
-import com.oracle.graal.nodes.*;
-
-public final class HotSpotProfilingInfo implements ProfilingInfo, HotSpotProxified {
-
-    private static final DebugMetric metricInsufficentSpace = Debug.metric("InsufficientSpaceForProfilingData");
-
-    private final HotSpotMethodData methodData;
-    private final HotSpotResolvedJavaMethod method;
-
-    private boolean isMature;
-    private int position;
-    private int hintPosition;
-    private int hintBCI;
-    private HotSpotMethodDataAccessor dataAccessor;
-
-    private boolean includeNormal;
-    private boolean includeOSR;
-
-    public HotSpotProfilingInfo(HotSpotMethodData methodData, HotSpotResolvedJavaMethod method, boolean includeNormal, boolean includeOSR) {
-        this.methodData = methodData;
-        this.method = method;
-        this.includeNormal = includeNormal;
-        this.includeOSR = includeOSR;
-        this.isMature = methodData.isProfileMature();
-        hintPosition = 0;
-        hintBCI = -1;
-    }
-
-    @Override
-    public int getCodeSize() {
-        return method.getCodeSize();
-    }
-
-    @Override
-    public JavaTypeProfile getTypeProfile(int bci) {
-        if (!isMature) {
-            return null;
-        }
-        findBCI(bci, false);
-        return dataAccessor.getTypeProfile(methodData, position);
-    }
-
-    @Override
-    public JavaMethodProfile getMethodProfile(int bci) {
-        if (!isMature) {
-            return null;
-        }
-        findBCI(bci, false);
-        return dataAccessor.getMethodProfile(methodData, position);
-    }
-
-    @Override
-    public double getBranchTakenProbability(int bci) {
-        if (!isMature) {
-            return -1;
-        }
-        findBCI(bci, false);
-        return dataAccessor.getBranchTakenProbability(methodData, position);
-    }
-
-    @Override
-    public double[] getSwitchProbabilities(int bci) {
-        if (!isMature) {
-            return null;
-        }
-        findBCI(bci, false);
-        return dataAccessor.getSwitchProbabilities(methodData, position);
-    }
-
-    @Override
-    public TriState getExceptionSeen(int bci) {
-        findBCI(bci, true);
-        return dataAccessor.getExceptionSeen(methodData, position);
-    }
-
-    @Override
-    public TriState getNullSeen(int bci) {
-        findBCI(bci, false);
-        return dataAccessor.getNullSeen(methodData, position);
-    }
-
-    @Override
-    public int getExecutionCount(int bci) {
-        if (!isMature) {
-            return -1;
-        }
-        findBCI(bci, false);
-        return dataAccessor.getExecutionCount(methodData, position);
-    }
-
-    @Override
-    public int getDeoptimizationCount(DeoptimizationReason reason) {
-        int count = 0;
-        if (includeNormal) {
-            count += methodData.getDeoptimizationCount(reason);
-        }
-        if (includeOSR) {
-            count += methodData.getOSRDeoptimizationCount(reason);
-        }
-        return count;
-    }
-
-    private void findBCI(int targetBCI, boolean searchExtraData) {
-        assert targetBCI >= 0 : "invalid BCI";
-
-        if (methodData.hasNormalData()) {
-            int currentPosition = targetBCI < hintBCI ? 0 : hintPosition;
-            HotSpotMethodDataAccessor currentAccessor;
-            while ((currentAccessor = methodData.getNormalData(currentPosition)) != null) {
-                int currentBCI = currentAccessor.getBCI(methodData, currentPosition);
-                if (currentBCI == targetBCI) {
-                    normalDataFound(currentAccessor, currentPosition, currentBCI);
-                    return;
-                } else if (currentBCI > targetBCI) {
-                    break;
-                }
-                currentPosition = currentPosition + currentAccessor.getSize(methodData, currentPosition);
-            }
-        }
-
-        boolean exceptionPossiblyNotRecorded = false;
-        if (searchExtraData && methodData.hasExtraData()) {
-            int currentPosition = methodData.getExtraDataBeginOffset();
-            HotSpotMethodDataAccessor currentAccessor;
-            while ((currentAccessor = methodData.getExtraData(currentPosition)) != null) {
-                int currentBCI = currentAccessor.getBCI(methodData, currentPosition);
-                if (currentBCI == targetBCI) {
-                    extraDataFound(currentAccessor, currentPosition);
-                    return;
-                }
-                currentPosition = currentPosition + currentAccessor.getSize(methodData, currentPosition);
-            }
-
-            if (!methodData.isWithin(currentPosition)) {
-                exceptionPossiblyNotRecorded = true;
-                metricInsufficentSpace.increment();
-            }
-        }
-
-        noDataFound(exceptionPossiblyNotRecorded);
-    }
-
-    private void normalDataFound(HotSpotMethodDataAccessor data, int pos, int bci) {
-        setCurrentData(data, pos);
-        this.hintPosition = position;
-        this.hintBCI = bci;
-    }
-
-    private void extraDataFound(HotSpotMethodDataAccessor data, int pos) {
-        setCurrentData(data, pos);
-    }
-
-    private void noDataFound(boolean exceptionPossiblyNotRecorded) {
-        HotSpotMethodDataAccessor accessor = HotSpotMethodData.getNoDataAccessor(exceptionPossiblyNotRecorded);
-        setCurrentData(accessor, -1);
-    }
-
-    private void setCurrentData(HotSpotMethodDataAccessor dataAccessor, int position) {
-        this.dataAccessor = dataAccessor;
-        this.position = position;
-    }
-
-    @Override
-    public boolean isMature() {
-        return isMature;
-    }
-
-    public void ignoreMature() {
-        isMature = true;
-    }
-
-    @Override
-    public String toString() {
-        return "HotSpotProfilingInfo<" + this.toString(null, "; ") + ">";
-    }
-
-    @Override
-    public void setMature() {
-        isMature = true;
-    }
-
-    @Override
-    public boolean setCompilerIRSize(Class<?> irType, int size) {
-        if (irType == StructuredGraph.class) {
-            methodData.setCompiledGraphSize(size);
-            return true;
-        }
-        return false;
-    }
-
-    @Override
-    public int getCompilerIRSize(Class<?> irType) {
-        if (irType == StructuredGraph.class) {
-            return methodData.getCompiledGraphSize();
-        }
-        return -1;
-    }
-}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotProviders.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotProviders.java	Thu May 28 21:11:28 2015 -0700
@@ -22,13 +22,15 @@
  */
 package com.oracle.graal.hotspot.meta;
 
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.meta.MetaAccessProvider;
+import com.oracle.jvmci.meta.ConstantReflectionProvider;
 import com.oracle.graal.api.replacements.*;
-import com.oracle.graal.graphbuilderconf.GraphBuilderConfiguration.*;
+import com.oracle.graal.graphbuilderconf.GraphBuilderConfiguration.Plugins;
 import com.oracle.graal.hotspot.word.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.phases.tiers.*;
 import com.oracle.graal.phases.util.*;
+import com.oracle.jvmci.hotspot.*;
 
 /**
  * Extends {@link Providers} to include a number of extra capabilities used by the HotSpot parts of
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRegisters.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRegisters.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,7 @@
  */
 package com.oracle.graal.hotspot.meta;
 
-import com.oracle.graal.api.code.*;
+import com.oracle.jvmci.code.Register;
 
 public class HotSpotRegisters implements HotSpotRegistersProvider {
 
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRegistersProvider.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRegistersProvider.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,7 @@
  */
 package com.oracle.graal.hotspot.meta;
 
-import com.oracle.graal.api.code.*;
+import com.oracle.jvmci.code.Register;
 
 /**
  * Special registers reserved by HotSpot for frequently used values.
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaField.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.hotspot.meta;
-
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.hotspot.*;
-
-/**
- * Represents a field in a HotSpot type.
- */
-public interface HotSpotResolvedJavaField extends ResolvedJavaField {
-
-    /**
-     * Determines if a given object contains this field.
-     *
-     * @return true iff this is a non-static field and its declaring class is assignable from
-     *         {@code object}'s class
-     */
-    boolean isInObject(Object object);
-
-    int offset();
-
-    /**
-     * Checks if this field has the {@link Stable} annotation.
-     *
-     * @return true if field has {@link Stable} annotation, false otherwise
-     */
-    boolean isStable();
-}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaFieldImpl.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,282 +0,0 @@
-/*
- * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.hotspot.meta;
-
-import static com.oracle.graal.compiler.common.GraalOptions.*;
-import static com.oracle.graal.hotspot.HotSpotGraalRuntime.*;
-import static com.oracle.graal.hotspot.meta.HotSpotResolvedObjectTypeImpl.*;
-
-import java.lang.annotation.*;
-import java.lang.reflect.*;
-
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.common.*;
-import com.oracle.graal.hotspot.*;
-
-/**
- * Represents a field in a HotSpot type.
- */
-public class HotSpotResolvedJavaFieldImpl implements HotSpotResolvedJavaField, HotSpotProxified {
-
-    private final HotSpotResolvedObjectTypeImpl holder;
-    private final String name;
-    private JavaType type;
-    private final int offset;
-
-    /**
-     * This value contains all flags as stored in the VM including internal ones.
-     */
-    private final int modifiers;
-    private final LocationIdentity locationIdentity = new FieldLocationIdentity(this);
-
-    public static class FieldLocationIdentity extends LocationIdentity {
-        HotSpotResolvedJavaField inner;
-
-        public FieldLocationIdentity(HotSpotResolvedJavaFieldImpl inner) {
-            this.inner = inner;
-        }
-
-        @Override
-        public boolean isImmutable() {
-            return false;
-        }
-
-        @Override
-        public boolean equals(Object obj) {
-            if (this == obj) {
-                return true;
-            }
-            if (obj instanceof FieldLocationIdentity) {
-                FieldLocationIdentity fieldLocationIdentity = (FieldLocationIdentity) obj;
-                return inner.equals(fieldLocationIdentity.inner);
-
-            }
-            return false;
-        }
-
-        @Override
-        public int hashCode() {
-            return inner.hashCode();
-        }
-
-        @Override
-        public String toString() {
-            return inner.getName();
-        }
-    }
-
-    public HotSpotResolvedJavaFieldImpl(HotSpotResolvedObjectTypeImpl holder, String name, JavaType type, long offset, int modifiers) {
-        this.holder = holder;
-        this.name = name;
-        this.type = type;
-        assert offset != -1;
-        assert offset == (int) offset : "offset larger than int";
-        this.offset = (int) offset;
-        this.modifiers = modifiers;
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj instanceof HotSpotResolvedJavaField) {
-            HotSpotResolvedJavaFieldImpl that = (HotSpotResolvedJavaFieldImpl) obj;
-            if (that.offset != this.offset || that.isStatic() != this.isStatic()) {
-                return false;
-            } else if (this.holder.equals(that.holder)) {
-                assert this.name.equals(that.name) && this.type.equals(that.type);
-                return true;
-            }
-        }
-        return false;
-    }
-
-    @Override
-    public int hashCode() {
-        return name.hashCode();
-    }
-
-    @Override
-    public int getModifiers() {
-        return modifiers & getReflectionFieldModifiers();
-    }
-
-    @Override
-    public boolean isInternal() {
-        return (modifiers & runtime().getConfig().jvmAccFieldInternal) != 0;
-    }
-
-    /**
-     * Determines if a given object contains this field.
-     *
-     * @return true iff this is a non-static field and its declaring class is assignable from
-     *         {@code object}'s class
-     */
-    public boolean isInObject(Object object) {
-        if (isStatic()) {
-            return false;
-        }
-        return getDeclaringClass().isAssignableFrom(HotSpotResolvedObjectTypeImpl.fromObjectClass(object.getClass()));
-    }
-
-    @Override
-    public HotSpotResolvedObjectTypeImpl getDeclaringClass() {
-        return holder;
-    }
-
-    @Override
-    public String getName() {
-        return name;
-    }
-
-    @Override
-    public JavaType getType() {
-        // Pull field into local variable to prevent a race causing
-        // a ClassCastException below
-        JavaType currentType = type;
-        if (currentType instanceof HotSpotUnresolvedJavaType) {
-            // Don't allow unresolved types to hang around forever
-            HotSpotUnresolvedJavaType unresolvedType = (HotSpotUnresolvedJavaType) currentType;
-            ResolvedJavaType resolved = unresolvedType.reresolve(holder);
-            if (resolved != null) {
-                type = resolved;
-            }
-        }
-        return type;
-    }
-
-    public int offset() {
-        return offset;
-    }
-
-    @Override
-    public String toString() {
-        return format("HotSpotField<%H.%n %t:") + offset + ">";
-    }
-
-    @Override
-    public boolean isSynthetic() {
-        return (runtime().getConfig().syntheticFlag & modifiers) != 0;
-    }
-
-    /**
-     * Checks if this field has the {@link Stable} annotation.
-     *
-     * @return true if field has {@link Stable} annotation, false otherwise
-     */
-    public boolean isStable() {
-        if ((runtime().getConfig().jvmAccFieldStable & modifiers) != 0) {
-            return true;
-        }
-        assert getAnnotation(Stable.class) == null;
-        if (ImplicitStableValues.getValue() && isImplicitStableField()) {
-            return true;
-        }
-        return false;
-    }
-
-    @Override
-    public <T extends Annotation> T getAnnotation(Class<T> annotationClass) {
-        Field javaField = toJava();
-        if (javaField != null) {
-            return javaField.getAnnotation(annotationClass);
-        }
-        return null;
-    }
-
-    private Field toJavaCache;
-
-    private Field toJava() {
-        if (toJavaCache != null) {
-            return toJavaCache;
-        }
-
-        if (isInternal()) {
-            return null;
-        }
-        try {
-            return toJavaCache = holder.mirror().getDeclaredField(name);
-        } catch (NoSuchFieldException | NoClassDefFoundError e) {
-            return null;
-        }
-    }
-
-    private boolean isArray() {
-        JavaType fieldType = getType();
-        return fieldType instanceof ResolvedJavaType && ((ResolvedJavaType) fieldType).isArray();
-    }
-
-    private boolean isImplicitStableField() {
-        if (isSynthetic()) {
-            if (isSyntheticImplicitStableField()) {
-                return true;
-            }
-        } else if (isWellKnownImplicitStableField()) {
-            return true;
-        }
-        return false;
-    }
-
-    private boolean isSyntheticImplicitStableField() {
-        assert this.isSynthetic();
-        if (isStatic() && isArray()) {
-            if (isFinal() && name.equals("$VALUES") || name.equals("ENUM$VALUES")) {
-                // generated int[] field for EnumClass::values()
-                return true;
-            } else if (name.startsWith("$SwitchMap$") || name.startsWith("$SWITCH_TABLE$")) {
-                // javac and ecj generate a static field in an inner class for a switch on an enum
-                // named $SwitchMap$p$k$g$EnumClass and $SWITCH_TABLE$p$k$g$EnumClass, respectively
-                return true;
-            }
-        }
-        return false;
-    }
-
-    private boolean isWellKnownImplicitStableField() {
-        return WellKnownImplicitStableField.test(this);
-    }
-
-    static class WellKnownImplicitStableField {
-        /**
-         * @return {@code true} if the field is a well-known stable field.
-         */
-        public static boolean test(HotSpotResolvedJavaField field) {
-            return field.equals(STRING_VALUE_FIELD);
-        }
-
-        private static final ResolvedJavaField STRING_VALUE_FIELD;
-        static {
-            try {
-                MetaAccessProvider metaAccess = runtime().getHostProviders().getMetaAccess();
-                STRING_VALUE_FIELD = metaAccess.lookupJavaField(String.class.getDeclaredField("value"));
-            } catch (SecurityException | NoSuchFieldException e) {
-                throw new GraalInternalError(e);
-            }
-        }
-    }
-
-    public LocationIdentity getLocationIdentity() {
-        return locationIdentity;
-    }
-}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaMethod.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,121 +0,0 @@
-/*
- * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.hotspot.meta;
-
-import java.lang.reflect.*;
-
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
-
-/**
- * Implementation of {@link JavaMethod} for resolved HotSpot methods.
- */
-public interface HotSpotResolvedJavaMethod extends ResolvedJavaMethod {
-
-    /**
-     * Returns true if this method has a {@code CallerSensitive} annotation.
-     *
-     * @return true if CallerSensitive annotation present, false otherwise
-     */
-    boolean isCallerSensitive();
-
-    HotSpotResolvedObjectType getDeclaringClass();
-
-    /**
-     * Returns true if this method has a {@code ForceInline} annotation.
-     *
-     * @return true if ForceInline annotation present, false otherwise
-     */
-    boolean isForceInline();
-
-    /**
-     * Returns true if this method has a {@code DontInline} annotation.
-     *
-     * @return true if DontInline annotation present, false otherwise
-     */
-    boolean isDontInline();
-
-    /**
-     * Manually adds a DontInline annotation to this method.
-     */
-    void setNotInlineable();
-
-    /**
-     * Returns true if this method is one of the special methods that is ignored by security stack
-     * walks.
-     *
-     * @return true if special method ignored by security stack walks, false otherwise
-     */
-    boolean ignoredBySecurityStackWalk();
-
-    boolean hasBalancedMonitors();
-
-    ResolvedJavaMethod uniqueConcreteMethod(HotSpotResolvedObjectType receiver);
-
-    /**
-     * Returns whether this method has compiled code.
-     *
-     * @return true if this method has compiled code, false otherwise
-     */
-    boolean hasCompiledCode();
-
-    /**
-     * @param level
-     * @return true if the currently installed code was generated at {@code level}.
-     */
-    boolean hasCompiledCodeAtLevel(int level);
-
-    ProfilingInfo getCompilationProfilingInfo(boolean isOSR);
-
-    default boolean isDefault() {
-        if (isConstructor()) {
-            return false;
-        }
-        // Copied from java.lang.Method.isDefault()
-        int mask = Modifier.ABSTRACT | Modifier.PUBLIC | Modifier.STATIC;
-        return ((getModifiers() & mask) == Modifier.PUBLIC) && getDeclaringClass().isInterface();
-    }
-
-    /**
-     * Returns the offset of this method into the v-table. The method must have a v-table entry as
-     * indicated by {@link #isInVirtualMethodTable(ResolvedJavaType)}, otherwise an exception is
-     * thrown.
-     *
-     * @return the offset of this method into the v-table
-     */
-    int vtableEntryOffset(ResolvedJavaType resolved);
-
-    int intrinsicId();
-
-    /**
-     * Allocates a compile id for this method by asking the VM for one.
-     *
-     * @param entryBCI entry bci
-     * @return compile id
-     */
-    int allocateCompileId(int entryBCI);
-
-    boolean hasCodeAtLevel(int entryBCI, int level);
-
-    SpeculationLog getSpeculationLog();
-}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaMethodImpl.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,752 +0,0 @@
-/*
- * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.hotspot.meta;
-
-import static com.oracle.graal.compiler.common.GraalInternalError.*;
-import static com.oracle.graal.compiler.common.GraalOptions.*;
-import static com.oracle.graal.compiler.common.UnsafeAccess.*;
-import static com.oracle.graal.hotspot.HotSpotGraalRuntime.*;
-
-import java.lang.annotation.*;
-import java.lang.reflect.*;
-import java.util.*;
-
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.debug.*;
-import com.oracle.graal.graphbuilderconf.*;
-import com.oracle.graal.hotspot.*;
-import com.oracle.graal.nodes.*;
-
-/**
- * Implementation of {@link JavaMethod} for resolved HotSpot methods.
- */
-public final class HotSpotResolvedJavaMethodImpl extends HotSpotMethod implements HotSpotResolvedJavaMethod, HotSpotProxified, MethodIdHolder {
-
-    /**
-     * Reference to metaspace Method object.
-     */
-    private final long metaspaceMethod;
-
-    private final HotSpotResolvedObjectTypeImpl holder;
-    private final HotSpotConstantPool constantPool;
-    private final HotSpotSignature signature;
-    private HotSpotMethodData methodData;
-    private byte[] code;
-    private Member toJavaCache;
-
-    /**
-     * Gets the holder of a HotSpot metaspace method native object.
-     *
-     * @param metaspaceMethod a metaspace Method object
-     * @return the {@link ResolvedJavaType} corresponding to the holder of the
-     *         {@code metaspaceMethod}
-     */
-    public static HotSpotResolvedObjectTypeImpl getHolder(long metaspaceMethod) {
-        HotSpotVMConfig config = runtime().getConfig();
-        final long metaspaceConstMethod = unsafe.getAddress(metaspaceMethod + config.methodConstMethodOffset);
-        final long metaspaceConstantPool = unsafe.getAddress(metaspaceConstMethod + config.constMethodConstantsOffset);
-        final long metaspaceKlass = unsafe.getAddress(metaspaceConstantPool + config.constantPoolHolderOffset);
-        return HotSpotResolvedObjectTypeImpl.fromMetaspaceKlass(metaspaceKlass);
-    }
-
-    /**
-     * Gets the {@link ResolvedJavaMethod} for a HotSpot metaspace method native object.
-     *
-     * @param metaspaceMethod a metaspace Method object
-     * @return the {@link ResolvedJavaMethod} corresponding to {@code metaspaceMethod}
-     */
-    public static HotSpotResolvedJavaMethod fromMetaspace(long metaspaceMethod) {
-        HotSpotResolvedObjectTypeImpl holder = getHolder(metaspaceMethod);
-        return holder.createMethod(metaspaceMethod);
-    }
-
-    public HotSpotResolvedJavaMethodImpl(HotSpotResolvedObjectTypeImpl holder, long metaspaceMethod) {
-        // It would be too much work to get the method name here so we fill it in later.
-        super(null);
-        this.metaspaceMethod = metaspaceMethod;
-        this.holder = holder;
-
-        HotSpotVMConfig config = runtime().getConfig();
-        final long constMethod = getConstMethod();
-
-        /*
-         * Get the constant pool from the metaspace method. Some methods (e.g. intrinsics for
-         * signature-polymorphic method handle methods) have their own constant pool instead of the
-         * one from their holder.
-         */
-        final long metaspaceConstantPool = unsafe.getAddress(constMethod + config.constMethodConstantsOffset);
-        this.constantPool = new HotSpotConstantPool(metaspaceConstantPool);
-
-        final int nameIndex = unsafe.getChar(constMethod + config.constMethodNameIndexOffset);
-        this.name = constantPool.lookupUtf8(nameIndex);
-
-        final int signatureIndex = unsafe.getChar(constMethod + config.constMethodSignatureIndexOffset);
-        this.signature = (HotSpotSignature) constantPool.lookupSignature(signatureIndex);
-    }
-
-    /**
-     * Returns a pointer to this method's constant method data structure (
-     * {@code Method::_constMethod}).
-     *
-     * @return pointer to this method's ConstMethod
-     */
-    private long getConstMethod() {
-        assert metaspaceMethod != 0;
-        return unsafe.getAddress(metaspaceMethod + runtime().getConfig().methodConstMethodOffset);
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (obj instanceof HotSpotResolvedJavaMethodImpl) {
-            HotSpotResolvedJavaMethodImpl that = (HotSpotResolvedJavaMethodImpl) obj;
-            return that.metaspaceMethod == metaspaceMethod;
-        }
-        return false;
-    }
-
-    @Override
-    public int hashCode() {
-        return (int) metaspaceMethod;
-    }
-
-    /**
-     * Returns this method's flags ({@code Method::_flags}).
-     *
-     * @return flags of this method
-     */
-    private int getFlags() {
-        return unsafe.getByte(metaspaceMethod + runtime().getConfig().methodFlagsOffset);
-    }
-
-    /**
-     * Returns this method's constant method flags ({@code ConstMethod::_flags}).
-     *
-     * @return flags of this method's ConstMethod
-     */
-    private int getConstMethodFlags() {
-        return unsafe.getChar(getConstMethod() + runtime().getConfig().constMethodFlagsOffset);
-    }
-
-    @Override
-    public HotSpotResolvedObjectTypeImpl getDeclaringClass() {
-        return holder;
-    }
-
-    /**
-     * Gets the address of the C++ Method object for this method.
-     */
-    public JavaConstant getMetaspaceMethodConstant() {
-        return HotSpotMetaspaceConstantImpl.forMetaspaceObject(getHostWordKind(), metaspaceMethod, this, false);
-    }
-
-    public long getMetaspaceMethod() {
-        return metaspaceMethod;
-    }
-
-    @Override
-    public JavaConstant getEncoding() {
-        return getMetaspaceMethodConstant();
-    }
-
-    /**
-     * Gets the complete set of modifiers for this method which includes the JVM specification
-     * modifiers as well as the HotSpot internal modifiers.
-     */
-    public int getAllModifiers() {
-        return unsafe.getInt(metaspaceMethod + runtime().getConfig().methodAccessFlagsOffset);
-    }
-
-    @Override
-    public int getModifiers() {
-        return getAllModifiers() & Modifier.methodModifiers();
-    }
-
-    @Override
-    public boolean canBeStaticallyBound() {
-        return (isFinal() || isPrivate() || isStatic() || holder.isFinal()) && isConcrete();
-    }
-
-    @Override
-    public byte[] getCode() {
-        if (getCodeSize() == 0) {
-            return null;
-        }
-        if (code == null && holder.isLinked()) {
-            code = runtime().getCompilerToVM().getBytecode(metaspaceMethod);
-            assert code.length == getCodeSize() : "expected: " + getCodeSize() + ", actual: " + code.length;
-        }
-        return code;
-    }
-
-    @Override
-    public int getCodeSize() {
-        return unsafe.getChar(getConstMethod() + runtime().getConfig().constMethodCodeSizeOffset);
-    }
-
-    @Override
-    public ExceptionHandler[] getExceptionHandlers() {
-        final boolean hasExceptionTable = (getConstMethodFlags() & runtime().getConfig().constMethodHasExceptionTable) != 0;
-        if (!hasExceptionTable) {
-            return new ExceptionHandler[0];
-        }
-
-        HotSpotVMConfig config = runtime().getConfig();
-        final int exceptionTableLength = runtime().getCompilerToVM().exceptionTableLength(metaspaceMethod);
-        ExceptionHandler[] handlers = new ExceptionHandler[exceptionTableLength];
-        long exceptionTableElement = runtime().getCompilerToVM().exceptionTableStart(metaspaceMethod);
-
-        for (int i = 0; i < exceptionTableLength; i++) {
-            final int startPc = unsafe.getChar(exceptionTableElement + config.exceptionTableElementStartPcOffset);
-            final int endPc = unsafe.getChar(exceptionTableElement + config.exceptionTableElementEndPcOffset);
-            final int handlerPc = unsafe.getChar(exceptionTableElement + config.exceptionTableElementHandlerPcOffset);
-            int catchTypeIndex = unsafe.getChar(exceptionTableElement + config.exceptionTableElementCatchTypeIndexOffset);
-
-            JavaType catchType;
-            if (catchTypeIndex == 0) {
-                catchType = null;
-            } else {
-                final int opcode = -1;  // opcode is not used
-                catchType = constantPool.lookupType(catchTypeIndex, opcode);
-
-                // Check for Throwable which catches everything.
-                if (catchType instanceof HotSpotResolvedObjectTypeImpl) {
-                    HotSpotResolvedObjectTypeImpl resolvedType = (HotSpotResolvedObjectTypeImpl) catchType;
-                    if (resolvedType.mirror() == Throwable.class) {
-                        catchTypeIndex = 0;
-                        catchType = null;
-                    }
-                }
-            }
-            handlers[i] = new ExceptionHandler(startPc, endPc, handlerPc, catchTypeIndex, catchType);
-
-            // Go to the next ExceptionTableElement
-            exceptionTableElement += config.exceptionTableElementSize;
-        }
-
-        return handlers;
-    }
-
-    /**
-     * Returns true if this method has a {@code CallerSensitive} annotation.
-     *
-     * @return true if CallerSensitive annotation present, false otherwise
-     */
-    public boolean isCallerSensitive() {
-        return (getFlags() & runtime().getConfig().methodFlagsCallerSensitive) != 0;
-    }
-
-    /**
-     * Returns true if this method has a {@code ForceInline} annotation.
-     *
-     * @return true if ForceInline annotation present, false otherwise
-     */
-    public boolean isForceInline() {
-        return (getFlags() & runtime().getConfig().methodFlagsForceInline) != 0;
-    }
-
-    /**
-     * Returns true if this method has a {@code DontInline} annotation.
-     *
-     * @return true if DontInline annotation present, false otherwise
-     */
-    public boolean isDontInline() {
-        return (getFlags() & runtime().getConfig().methodFlagsDontInline) != 0;
-    }
-
-    /**
-     * Manually adds a DontInline annotation to this method.
-     */
-    public void setNotInlineable() {
-        runtime().getCompilerToVM().doNotInlineOrCompile(metaspaceMethod);
-    }
-
-    /**
-     * Returns true if this method is one of the special methods that is ignored by security stack
-     * walks.
-     *
-     * @return true if special method ignored by security stack walks, false otherwise
-     */
-    public boolean ignoredBySecurityStackWalk() {
-        return runtime().getCompilerToVM().methodIsIgnoredBySecurityStackWalk(metaspaceMethod);
-    }
-
-    public boolean hasBalancedMonitors() {
-        HotSpotVMConfig config = runtime().getConfig();
-        final int modifiers = getAllModifiers();
-
-        // Method has no monitorenter/exit bytecodes.
-        if ((modifiers & config.jvmAccHasMonitorBytecodes) == 0) {
-            return false;
-        }
-
-        // Check to see if a previous compilation computed the monitor-matching analysis.
-        if ((modifiers & config.jvmAccMonitorMatch) != 0) {
-            return true;
-        }
-
-        // This either happens only once if monitors are balanced or very rarely multiple-times.
-        return runtime().getCompilerToVM().hasBalancedMonitors(metaspaceMethod);
-    }
-
-    @Override
-    public boolean isClassInitializer() {
-        return "<clinit>".equals(name) && isStatic();
-    }
-
-    @Override
-    public boolean isConstructor() {
-        return "<init>".equals(name) && !isStatic();
-    }
-
-    @Override
-    public int getMaxLocals() {
-        if (isAbstract() || isNative()) {
-            return 0;
-        }
-        HotSpotVMConfig config = runtime().getConfig();
-        return unsafe.getChar(getConstMethod() + config.methodMaxLocalsOffset);
-    }
-
-    @Override
-    public int getMaxStackSize() {
-        if (isAbstract() || isNative()) {
-            return 0;
-        }
-        HotSpotVMConfig config = runtime().getConfig();
-        return config.extraStackEntries + unsafe.getChar(getConstMethod() + config.constMethodMaxStackOffset);
-    }
-
-    @Override
-    public StackTraceElement asStackTraceElement(int bci) {
-        if (bci < 0 || bci >= getCodeSize()) {
-            // HotSpot code can only construct stack trace elements for valid bcis
-            StackTraceElement ste = runtime().getCompilerToVM().getStackTraceElement(metaspaceMethod, 0);
-            return new StackTraceElement(ste.getClassName(), ste.getMethodName(), ste.getFileName(), -1);
-        }
-        return runtime().getCompilerToVM().getStackTraceElement(metaspaceMethod, bci);
-    }
-
-    public ResolvedJavaMethod uniqueConcreteMethod(HotSpotResolvedObjectType receiver) {
-        if (receiver.isInterface()) {
-            // Cannot trust interfaces. Because of:
-            // interface I { void foo(); }
-            // class A { public void foo() {} }
-            // class B extends A implements I { }
-            // class C extends B { public void foo() { } }
-            // class D extends B { }
-            // Would lead to identify C.foo() as the unique concrete method for I.foo() without
-            // seeing A.foo().
-            return null;
-        }
-        long metaspaceKlass = ((HotSpotResolvedObjectTypeImpl) receiver).getMetaspaceKlass();
-        final long uniqueConcreteMethod = runtime().getCompilerToVM().findUniqueConcreteMethod(metaspaceKlass, metaspaceMethod);
-        if (uniqueConcreteMethod == 0) {
-            return null;
-        }
-        return fromMetaspace(uniqueConcreteMethod);
-    }
-
-    @Override
-    public HotSpotSignature getSignature() {
-        return signature;
-    }
-
-    /**
-     * Gets the value of {@code Method::_code}.
-     *
-     * @return the value of {@code Method::_code}
-     */
-    private long getCompiledCode() {
-        HotSpotVMConfig config = runtime().getConfig();
-        return unsafe.getAddress(metaspaceMethod + config.methodCodeOffset);
-    }
-
-    /**
-     * Returns whether this method has compiled code.
-     *
-     * @return true if this method has compiled code, false otherwise
-     */
-    public boolean hasCompiledCode() {
-        return getCompiledCode() != 0L;
-    }
-
-    /**
-     * @param level
-     * @return true if the currently installed code was generated at {@code level}.
-     */
-    public boolean hasCompiledCodeAtLevel(int level) {
-        long compiledCode = getCompiledCode();
-        if (compiledCode != 0) {
-            return unsafe.getInt(compiledCode + runtime().getConfig().nmethodCompLevelOffset) == level;
-        }
-        return false;
-    }
-
-    private static final String TraceMethodDataFilter = System.getProperty("graal.traceMethodDataFilter");
-
-    @Override
-    public ProfilingInfo getProfilingInfo() {
-        return getProfilingInfo(true, true);
-    }
-
-    public ProfilingInfo getCompilationProfilingInfo(boolean isOSR) {
-        return getProfilingInfo(!isOSR, isOSR);
-    }
-
-    private ProfilingInfo getProfilingInfo(boolean includeNormal, boolean includeOSR) {
-        ProfilingInfo info;
-
-        if (UseProfilingInformation.getValue() && methodData == null) {
-            long metaspaceMethodData = unsafe.getAddress(metaspaceMethod + runtime().getConfig().methodDataOffset);
-            if (metaspaceMethodData != 0) {
-                methodData = new HotSpotMethodData(metaspaceMethodData);
-                if (TraceMethodDataFilter != null && this.format("%H.%n").contains(TraceMethodDataFilter)) {
-                    TTY.println("Raw method data for " + this.format("%H.%n(%p)") + ":");
-                    TTY.println(methodData.toString());
-                }
-            }
-        }
-
-        if (methodData == null || (!methodData.hasNormalData() && !methodData.hasExtraData())) {
-            // Be optimistic and return false for exceptionSeen. A methodDataOop is allocated in
-            // case of a deoptimization.
-            info = DefaultProfilingInfo.get(TriState.FALSE);
-        } else {
-            info = new HotSpotProfilingInfo(methodData, this, includeNormal, includeOSR);
-        }
-        return info;
-    }
-
-    @Override
-    public void reprofile() {
-        runtime().getCompilerToVM().reprofile(metaspaceMethod);
-    }
-
-    @Override
-    public ConstantPool getConstantPool() {
-        return constantPool;
-    }
-
-    @Override
-    public Annotation[][] getParameterAnnotations() {
-        if (isConstructor()) {
-            Constructor<?> javaConstructor = toJavaConstructor();
-            return javaConstructor == null ? null : javaConstructor.getParameterAnnotations();
-        }
-        Method javaMethod = toJava();
-        return javaMethod == null ? null : javaMethod.getParameterAnnotations();
-    }
-
-    @Override
-    public Annotation[] getAnnotations() {
-        if (isConstructor()) {
-            Constructor<?> javaConstructor = toJavaConstructor();
-            return javaConstructor == null ? new Annotation[0] : javaConstructor.getAnnotations();
-        }
-        Method javaMethod = toJava();
-        return javaMethod == null ? new Annotation[0] : javaMethod.getAnnotations();
-    }
-
-    @Override
-    public <T extends Annotation> T getAnnotation(Class<T> annotationClass) {
-        if (isConstructor()) {
-            Constructor<?> javaConstructor = toJavaConstructor();
-            return javaConstructor == null ? null : javaConstructor.getAnnotation(annotationClass);
-        }
-        Method javaMethod = toJava();
-        return javaMethod == null ? null : javaMethod.getAnnotation(annotationClass);
-    }
-
-    @Override
-    public boolean isSynthetic() {
-        int modifiers = getAllModifiers();
-        return (runtime().getConfig().syntheticFlag & modifiers) != 0;
-    }
-
-    public boolean isDefault() {
-        if (isConstructor()) {
-            return false;
-        }
-        // Copied from java.lang.Method.isDefault()
-        int mask = Modifier.ABSTRACT | Modifier.PUBLIC | Modifier.STATIC;
-        return ((getModifiers() & mask) == Modifier.PUBLIC) && getDeclaringClass().isInterface();
-    }
-
-    @Override
-    public Type[] getGenericParameterTypes() {
-        if (isConstructor()) {
-            Constructor<?> javaConstructor = toJavaConstructor();
-            return javaConstructor == null ? null : javaConstructor.getGenericParameterTypes();
-        }
-        Method javaMethod = toJava();
-        return javaMethod == null ? null : javaMethod.getGenericParameterTypes();
-    }
-
-    public Class<?>[] signatureToTypes() {
-        Signature sig = getSignature();
-        int count = sig.getParameterCount(false);
-        Class<?>[] result = new Class<?>[count];
-        for (int i = 0; i < result.length; ++i) {
-            JavaType parameterType = sig.getParameterType(i, holder);
-            HotSpotResolvedJavaType resolvedParameterType = (HotSpotResolvedJavaType) parameterType.resolve(holder);
-            result[i] = resolvedParameterType.mirror();
-        }
-        return result;
-    }
-
-    private Method toJava() {
-        if (toJavaCache != null) {
-            return (Method) toJavaCache;
-        }
-        try {
-            Method result = holder.mirror().getDeclaredMethod(name, signatureToTypes());
-            toJavaCache = result;
-            return result;
-        } catch (NoSuchMethodException | NoClassDefFoundError e) {
-            return null;
-        }
-    }
-
-    private Constructor<?> toJavaConstructor() {
-        if (toJavaCache != null) {
-            return (Constructor<?>) toJavaCache;
-        }
-        try {
-            Constructor<?> result = holder.mirror().getDeclaredConstructor(signatureToTypes());
-            toJavaCache = result;
-            return result;
-        } catch (NoSuchMethodException | NoClassDefFoundError e) {
-            return null;
-        }
-    }
-
-    @Override
-    public boolean canBeInlined() {
-        if (isDontInline()) {
-            return false;
-        }
-        return runtime().getCompilerToVM().canInlineMethod(metaspaceMethod);
-    }
-
-    @Override
-    public boolean shouldBeInlined() {
-        if (isForceInline()) {
-            return true;
-        }
-        return runtime().getCompilerToVM().shouldInlineMethod(metaspaceMethod);
-    }
-
-    @Override
-    public LineNumberTable getLineNumberTable() {
-        final boolean hasLineNumberTable = (getConstMethodFlags() & runtime().getConfig().constMethodHasLineNumberTable) != 0;
-        if (!hasLineNumberTable) {
-            return null;
-        }
-
-        long[] values = runtime().getCompilerToVM().getLineNumberTable(metaspaceMethod);
-        if (values.length == 0) {
-            // Empty table so treat is as non-existent
-            return null;
-        }
-        assert values.length % 2 == 0;
-        int[] bci = new int[values.length / 2];
-        int[] line = new int[values.length / 2];
-
-        for (int i = 0; i < values.length / 2; i++) {
-            bci[i] = (int) values[i * 2];
-            line[i] = (int) values[i * 2 + 1];
-        }
-
-        return new LineNumberTableImpl(line, bci);
-    }
-
-    @Override
-    public LocalVariableTable getLocalVariableTable() {
-        final boolean hasLocalVariableTable = (getConstMethodFlags() & runtime().getConfig().constMethodHasLocalVariableTable) != 0;
-        if (!hasLocalVariableTable) {
-            return null;
-        }
-
-        HotSpotVMConfig config = runtime().getConfig();
-        long localVariableTableElement = runtime().getCompilerToVM().getLocalVariableTableStart(metaspaceMethod);
-        final int localVariableTableLength = runtime().getCompilerToVM().getLocalVariableTableLength(metaspaceMethod);
-        Local[] locals = new Local[localVariableTableLength];
-
-        for (int i = 0; i < localVariableTableLength; i++) {
-            final int startBci = unsafe.getChar(localVariableTableElement + config.localVariableTableElementStartBciOffset);
-            final int endBci = startBci + unsafe.getChar(localVariableTableElement + config.localVariableTableElementLengthOffset);
-            final int nameCpIndex = unsafe.getChar(localVariableTableElement + config.localVariableTableElementNameCpIndexOffset);
-            final int typeCpIndex = unsafe.getChar(localVariableTableElement + config.localVariableTableElementDescriptorCpIndexOffset);
-            final int slot = unsafe.getChar(localVariableTableElement + config.localVariableTableElementSlotOffset);
-
-            String localName = getConstantPool().lookupUtf8(nameCpIndex);
-            String localType = getConstantPool().lookupUtf8(typeCpIndex);
-
-            locals[i] = new LocalImpl(localName, runtime().lookupType(localType, holder, false), startBci, endBci, slot);
-
-            // Go to the next LocalVariableTableElement
-            localVariableTableElement += config.localVariableTableElementSize;
-        }
-
-        return new LocalVariableTableImpl(locals);
-    }
-
-    /**
-     * Returns the offset of this method into the v-table. The method must have a v-table entry as
-     * indicated by {@link #isInVirtualMethodTable(ResolvedJavaType)}, otherwise an exception is
-     * thrown.
-     *
-     * @return the offset of this method into the v-table
-     */
-    public int vtableEntryOffset(ResolvedJavaType resolved) {
-        guarantee(isInVirtualMethodTable(resolved), "%s does not have a vtable entry", this);
-        HotSpotVMConfig config = runtime().getConfig();
-        final int vtableIndex = getVtableIndex((HotSpotResolvedObjectTypeImpl) resolved);
-        return config.instanceKlassVtableStartOffset + vtableIndex * config.vtableEntrySize + config.vtableEntryMethodOffset;
-    }
-
-    @Override
-    public boolean isInVirtualMethodTable(ResolvedJavaType resolved) {
-        if (resolved instanceof HotSpotResolvedObjectTypeImpl) {
-            HotSpotResolvedObjectTypeImpl hotspotResolved = (HotSpotResolvedObjectTypeImpl) resolved;
-            int vtableIndex = getVtableIndex(hotspotResolved);
-            return vtableIndex >= 0 && vtableIndex < hotspotResolved.getVtableLength();
-        }
-        return false;
-    }
-
-    private int getVtableIndex(HotSpotResolvedObjectTypeImpl resolved) {
-        if (!holder.isLinked()) {
-            return runtime().getConfig().invalidVtableIndex;
-        }
-        if (holder.isInterface()) {
-            if (resolved.isInterface()) {
-                return runtime().getConfig().invalidVtableIndex;
-            }
-            return getVtableIndexForInterface(resolved);
-        }
-        return getVtableIndex();
-    }
-
-    /**
-     * Returns this method's virtual table index.
-     *
-     * @return virtual table index
-     */
-    private int getVtableIndex() {
-        assert !holder.isInterface();
-        HotSpotVMConfig config = runtime().getConfig();
-        int result = unsafe.getInt(metaspaceMethod + config.methodVtableIndexOffset);
-        assert result >= config.nonvirtualVtableIndex : "must be linked";
-        return result;
-    }
-
-    private int getVtableIndexForInterface(ResolvedJavaType resolved) {
-        HotSpotResolvedObjectTypeImpl hotspotType = (HotSpotResolvedObjectTypeImpl) resolved;
-        return runtime().getCompilerToVM().getVtableIndexForInterface(hotspotType.getMetaspaceKlass(), getMetaspaceMethod());
-    }
-
-    /**
-     * The {@link SpeculationLog} for methods compiled by Graal hang off this per-declaring-type
-     * {@link ClassValue}. The raw Method* value is safe to use as a key in the map as a) it is
-     * never moves and b) we never read from it.
-     * <p>
-     * One implication is that we will preserve {@link SpeculationLog}s for methods that have been
-     * redefined via class redefinition. It's tempting to periodically flush such logs but we cannot
-     * read the JVM_ACC_IS_OBSOLETE bit (or anything else) via the raw pointer as obsoleted methods
-     * are subject to clean up and deletion (see InstanceKlass::purge_previous_versions_internal).
-     */
-    private static final ClassValue<Map<Long, SpeculationLog>> SpeculationLogs = new ClassValue<Map<Long, SpeculationLog>>() {
-        @Override
-        protected Map<Long, SpeculationLog> computeValue(java.lang.Class<?> type) {
-            return new HashMap<>(4);
-        }
-    };
-
-    public SpeculationLog getSpeculationLog() {
-        Map<Long, SpeculationLog> map = SpeculationLogs.get(holder.mirror());
-        synchronized (map) {
-            SpeculationLog log = map.get(this.metaspaceMethod);
-            if (log == null) {
-                log = new HotSpotSpeculationLog();
-                map.put(metaspaceMethod, log);
-            }
-            return log;
-        }
-    }
-
-    public int intrinsicId() {
-        HotSpotVMConfig config = runtime().getConfig();
-        return unsafe.getByte(metaspaceMethod + config.methodIntrinsicIdOffset) & 0xff;
-    }
-
-    @Override
-    public JavaConstant invoke(JavaConstant receiver, JavaConstant[] arguments) {
-        assert !isConstructor();
-        Method javaMethod = toJava();
-        javaMethod.setAccessible(true);
-
-        Object[] objArguments = new Object[arguments.length];
-        for (int i = 0; i < arguments.length; i++) {
-            objArguments[i] = HotSpotObjectConstantImpl.asBoxedValue(arguments[i]);
-        }
-        Object objReceiver = receiver != null && !receiver.isNull() ? ((HotSpotObjectConstantImpl) receiver).object() : null;
-
-        try {
-            Object objResult = javaMethod.invoke(objReceiver, objArguments);
-            return javaMethod.getReturnType() == void.class ? null : HotSpotObjectConstantImpl.forBoxedValue(getSignature().getReturnKind(), objResult);
-
-        } catch (IllegalAccessException | InvocationTargetException ex) {
-            throw new IllegalArgumentException(ex);
-        }
-    }
-
-    /**
-     * Allocates a compile id for this method by asking the VM for one.
-     *
-     * @param entryBCI entry bci
-     * @return compile id
-     */
-    public int allocateCompileId(int entryBCI) {
-        return runtime().getCompilerToVM().allocateCompileId(metaspaceMethod, entryBCI);
-    }
-
-    public boolean hasCodeAtLevel(int entryBCI, int level) {
-        if (entryBCI == StructuredGraph.INVOCATION_ENTRY_BCI) {
-            return hasCompiledCodeAtLevel(level);
-        }
-        return runtime().getCompilerToVM().hasCompiledCodeForOSR(metaspaceMethod, entryBCI, level);
-    }
-
-    private int methodId;
-
-    public void setMethodId(int id) {
-        assert methodId == 0;
-        methodId = id;
-    }
-
-    public int getMethodId() {
-        return methodId;
-    }
-}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaType.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.hotspot.meta;
-
-import static com.oracle.graal.hotspot.HotSpotGraalRuntime.*;
-
-import com.oracle.graal.api.meta.*;
-
-public abstract class HotSpotResolvedJavaType extends HotSpotJavaType implements ResolvedJavaType {
-
-    /**
-     * Gets the Graal mirror for a {@link Class} object.
-     *
-     * @return the {@link HotSpotResolvedJavaType} corresponding to {@code javaClass}
-     */
-    public static ResolvedJavaType fromClass(Class<?> javaClass) {
-        return runtime().fromClass(javaClass);
-    }
-
-    public HotSpotResolvedJavaType(String name) {
-        super(name);
-    }
-
-    public abstract Class<?> mirror();
-
-    @Override
-    public final boolean equals(Object obj) {
-        if (!(obj instanceof HotSpotResolvedJavaType)) {
-            return false;
-        }
-        HotSpotResolvedJavaType that = (HotSpotResolvedJavaType) obj;
-        return this.mirror().equals(that.mirror());
-    }
-
-    @Override
-    public final int hashCode() {
-        return getName().hashCode();
-    }
-
-}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedObjectType.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,97 +0,0 @@
-/*
- * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.hotspot.meta;
-
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.api.meta.Assumptions.AssumptionResult;
-import com.oracle.graal.hotspot.*;
-
-/**
- * Implementation of {@link JavaType} for resolved non-primitive HotSpot classes.
- */
-public interface HotSpotResolvedObjectType extends ResolvedJavaType {
-
-    HotSpotResolvedObjectType getArrayClass();
-
-    ResolvedJavaType getComponentType();
-
-    AssumptionResult<ResolvedJavaType> findLeafConcreteSubtype();
-
-    HotSpotResolvedObjectType getSuperclass();
-
-    HotSpotResolvedObjectType[] getInterfaces();
-
-    HotSpotResolvedObjectType getSupertype();
-
-    HotSpotResolvedObjectType findLeastCommonAncestor(ResolvedJavaType otherType);
-
-    HotSpotResolvedObjectType asExactType();
-
-    default boolean isPrimitive() {
-        return false;
-    }
-
-    default Kind getKind() {
-        return Kind.Object;
-    }
-
-    ConstantPool constantPool();
-
-    /**
-     * Gets the instance size of this type. If an instance of this type cannot be fast path
-     * allocated, then the returned value is negative (its absolute value gives the size). Must not
-     * be called if this is an array or interface type.
-     */
-    int instanceSize();
-
-    int getVtableLength();
-
-    @Override
-    AssumptionResult<ResolvedJavaMethod> findUniqueConcreteMethod(ResolvedJavaMethod method);
-
-    /**
-     * Performs a fast-path check that this type is resolved in the context of a given accessing
-     * class. A negative result does not mean this type is not resolved with respect to
-     * {@code accessingClass}. That can only be determined by
-     * {@linkplain HotSpotGraalRuntime#lookupType(String, HotSpotResolvedObjectType, boolean)
-     * re-resolving} the type.
-     */
-    boolean isDefinitelyResolvedWithRespectTo(ResolvedJavaType accessingClass);
-
-    /**
-     * Gets the metaspace Klass boxed in a {@link JavaConstant}.
-     */
-    Constant klass();
-
-    boolean isPrimaryType();
-
-    int superCheckOffset();
-
-    long prototypeMarkWord();
-
-    HotSpotResolvedObjectType getEnclosingType();
-
-    ResolvedJavaMethod getClassInitializer();
-
-    ResolvedJavaField createField(String name, JavaType type, long offset, int modifiers);
-}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedObjectTypeImpl.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,899 +0,0 @@
-/*
- * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.hotspot.meta;
-
-import static com.oracle.graal.compiler.common.UnsafeAccess.*;
-import static com.oracle.graal.hotspot.HotSpotGraalRuntime.*;
-import static java.util.Objects.*;
-
-import java.lang.annotation.*;
-import java.lang.reflect.*;
-import java.net.*;
-import java.nio.*;
-import java.util.*;
-
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.api.meta.Assumptions.*;
-import com.oracle.graal.compiler.common.*;
-import com.oracle.graal.hotspot.*;
-
-/**
- * Implementation of {@link JavaType} for resolved non-primitive HotSpot classes.
- */
-public final class HotSpotResolvedObjectTypeImpl extends HotSpotResolvedJavaType implements HotSpotResolvedObjectType, HotSpotProxified {
-
-    /**
-     * The Java class this type represents.
-     */
-    private final Class<?> javaClass;
-
-    private HashMap<Long, HotSpotResolvedJavaField> fieldCache;
-    private HashMap<Long, HotSpotResolvedJavaMethod> methodCache;
-    private HotSpotResolvedJavaField[] instanceFields;
-    private HotSpotResolvedObjectTypeImpl[] interfaces;
-    private ConstantPool constantPool;
-    private HotSpotResolvedObjectType arrayOfType;
-
-    /**
-     * Gets the Graal mirror for a {@link Class} object.
-     *
-     * @return the {@link HotSpotResolvedJavaType} corresponding to {@code javaClass}
-     */
-    public static HotSpotResolvedObjectTypeImpl fromObjectClass(Class<?> javaClass) {
-        return (HotSpotResolvedObjectTypeImpl) runtime().fromClass(javaClass);
-    }
-
-    /**
-     * Gets the Graal mirror from a HotSpot metaspace Klass native object.
-     *
-     * @param metaspaceKlass a metaspace Klass object
-     * @return the {@link ResolvedJavaType} corresponding to {@code metaspaceKlass}
-     */
-    public static HotSpotResolvedObjectTypeImpl fromMetaspaceKlass(long metaspaceKlass) {
-        assert metaspaceKlass != 0;
-        Class<?> javaClass = runtime().getCompilerToVM().getJavaMirror(metaspaceKlass);
-        assert javaClass != null;
-        return fromObjectClass(javaClass);
-    }
-
-    /**
-     * Creates the Graal mirror for a {@link Class} object.
-     *
-     * <p>
-     * <b>NOTE</b>: Creating an instance of this class does not install the mirror for the
-     * {@link Class} type. Use {@link #fromObjectClass(Class)} or {@link #fromMetaspaceKlass(long)}
-     * instead.
-     * </p>
-     *
-     * @param javaClass the Class to create the mirror for
-     */
-    public HotSpotResolvedObjectTypeImpl(Class<?> javaClass) {
-        super(getSignatureName(javaClass));
-        this.javaClass = javaClass;
-        assert getName().charAt(0) != '[' || isArray() : getName();
-    }
-
-    /**
-     * Returns the name of this type as it would appear in a signature.
-     */
-    private static String getSignatureName(Class<?> javaClass) {
-        if (javaClass.isArray()) {
-            return javaClass.getName().replace('.', '/');
-        }
-        return "L" + javaClass.getName().replace('.', '/') + ";";
-    }
-
-    /**
-     * Gets the metaspace Klass for this type.
-     */
-    public long getMetaspaceKlass() {
-        if (HotSpotGraalRuntime.getHostWordKind() == Kind.Long) {
-            return unsafe.getLong(javaClass, (long) runtime().getConfig().klassOffset);
-        }
-        return unsafe.getInt(javaClass, (long) runtime().getConfig().klassOffset) & 0xFFFFFFFFL;
-    }
-
-    @Override
-    public int getModifiers() {
-        return mirror().getModifiers();
-    }
-
-    public int getAccessFlags() {
-        HotSpotVMConfig config = runtime().getConfig();
-        return unsafe.getInt(getMetaspaceKlass() + config.klassAccessFlagsOffset);
-    }
-
-    @Override
-    public HotSpotResolvedObjectType getArrayClass() {
-        if (arrayOfType == null) {
-            arrayOfType = fromObjectClass(Array.newInstance(mirror(), 0).getClass());
-        }
-        return arrayOfType;
-    }
-
-    @Override
-    public ResolvedJavaType getComponentType() {
-        Class<?> javaComponentType = mirror().getComponentType();
-        return javaComponentType == null ? null : fromClass(javaComponentType);
-    }
-
-    @Override
-    public AssumptionResult<ResolvedJavaType> findLeafConcreteSubtype() {
-        HotSpotVMConfig config = runtime().getConfig();
-        if (isArray()) {
-            return getElementalType().isFinal() ? new AssumptionResult<>(this) : null;
-        } else if (isInterface()) {
-            HotSpotResolvedObjectTypeImpl implementor = getSingleImplementor();
-            /*
-             * If the implementor field contains itself that indicates that the interface has more
-             * than one implementors (see: InstanceKlass::add_implementor).
-             */
-            if (implementor == null || implementor.equals(this)) {
-                return null;
-            }
-
-            assert !implementor.isInterface();
-            if (implementor.isAbstract() || !implementor.isLeafClass()) {
-                AssumptionResult<ResolvedJavaType> leafConcreteSubtype = implementor.findLeafConcreteSubtype();
-                if (leafConcreteSubtype != null) {
-                    assert !leafConcreteSubtype.getResult().equals(implementor);
-                    AssumptionResult<ResolvedJavaType> newResult = new AssumptionResult<>(leafConcreteSubtype.getResult(), new ConcreteSubtype(this, implementor));
-                    // Accumulate leaf assumptions and return the combined result.
-                    newResult.add(leafConcreteSubtype);
-                    return newResult;
-                }
-                return null;
-            }
-
-            return new AssumptionResult<>(implementor, new LeafType(implementor), new ConcreteSubtype(this, implementor));
-        } else {
-            HotSpotResolvedObjectTypeImpl type = this;
-            while (type.isAbstract()) {
-                long subklass = type.getSubklass();
-                if (subklass == 0 || unsafe.getAddress(subklass + config.nextSiblingOffset) != 0) {
-                    return null;
-                }
-                type = fromMetaspaceKlass(subklass);
-            }
-            if (type.isAbstract() || type.isInterface() || !type.isLeafClass()) {
-                return null;
-            }
-            if (this.isAbstract()) {
-                return new AssumptionResult<>(type, new LeafType(type), new ConcreteSubtype(this, type));
-            } else {
-                assert this.equals(type);
-                return new AssumptionResult<>(type, new LeafType(type));
-            }
-        }
-    }
-
-    /**
-     * Returns if type {@code type} is a leaf class. This is the case if the
-     * {@code Klass::_subklass} field of the underlying class is zero.
-     *
-     * @return true if the type is a leaf class
-     */
-    private boolean isLeafClass() {
-        return getSubklass() == 0;
-    }
-
-    /**
-     * Returns the {@code Klass::_subklass} field of the underlying metaspace klass for the given
-     * type {@code type}.
-     *
-     * @return value of the subklass field as metaspace klass pointer
-     */
-    private long getSubklass() {
-        return unsafe.getAddress(getMetaspaceKlass() + runtime().getConfig().subklassOffset);
-    }
-
-    @Override
-    public HotSpotResolvedObjectTypeImpl getSuperclass() {
-        Class<?> javaSuperclass = mirror().getSuperclass();
-        return javaSuperclass == null ? null : (HotSpotResolvedObjectTypeImpl) fromObjectClass(javaSuperclass);
-    }
-
-    @Override
-    public HotSpotResolvedObjectTypeImpl[] getInterfaces() {
-        if (interfaces == null) {
-            Class<?>[] javaInterfaces = mirror().getInterfaces();
-            HotSpotResolvedObjectTypeImpl[] result = new HotSpotResolvedObjectTypeImpl[javaInterfaces.length];
-            for (int i = 0; i < javaInterfaces.length; i++) {
-                result[i] = fromObjectClass(javaInterfaces[i]);
-            }
-            interfaces = result;
-        }
-        return interfaces;
-    }
-
-    @Override
-    public HotSpotResolvedObjectTypeImpl getSingleImplementor() {
-        if (!isInterface()) {
-            throw new GraalInternalError("Cannot call getImplementor() on a non-interface type: " + this);
-        }
-        final long implementorMetaspaceKlass = runtime().getCompilerToVM().getKlassImplementor(getMetaspaceKlass());
-
-        // No implementor.
-        if (implementorMetaspaceKlass == 0) {
-            return null;
-        }
-
-        return fromMetaspaceKlass(implementorMetaspaceKlass);
-    }
-
-    public HotSpotResolvedObjectTypeImpl getSupertype() {
-        if (isArray()) {
-            ResolvedJavaType componentType = getComponentType();
-            if (mirror() == Object[].class || componentType.isPrimitive()) {
-                return fromObjectClass(Object.class);
-            }
-            return (HotSpotResolvedObjectTypeImpl) ((HotSpotResolvedObjectTypeImpl) componentType).getSupertype().getArrayClass();
-        }
-        if (isInterface()) {
-            return fromObjectClass(Object.class);
-        }
-        return getSuperclass();
-    }
-
-    @Override
-    public HotSpotResolvedObjectType findLeastCommonAncestor(ResolvedJavaType otherType) {
-        if (otherType.isPrimitive()) {
-            return null;
-        } else {
-            HotSpotResolvedObjectTypeImpl t1 = this;
-            HotSpotResolvedObjectTypeImpl t2 = (HotSpotResolvedObjectTypeImpl) otherType;
-            while (true) {
-                if (t1.isAssignableFrom(t2)) {
-                    return t1;
-                }
-                if (t2.isAssignableFrom(t1)) {
-                    return t2;
-                }
-                t1 = t1.getSupertype();
-                t2 = t2.getSupertype();
-            }
-        }
-    }
-
-    @Override
-    public HotSpotResolvedObjectType asExactType() {
-        if (isArray()) {
-            return getComponentType().asExactType() != null ? this : null;
-        }
-        return isFinal() ? this : null;
-    }
-
-    @Override
-    public JavaConstant getJavaClass() {
-        return HotSpotObjectConstantImpl.forObject(mirror());
-    }
-
-    @Override
-    public JavaConstant getObjectHub() {
-        return klass();
-    }
-
-    @Override
-    public AssumptionResult<Boolean> hasFinalizableSubclass() {
-        assert !isArray();
-        if (!runtime().getCompilerToVM().hasFinalizableSubclass(getMetaspaceKlass())) {
-            return new AssumptionResult<>(false, new NoFinalizableSubclass(this));
-        }
-        return new AssumptionResult<>(true);
-    }
-
-    @Override
-    public boolean hasFinalizer() {
-        HotSpotVMConfig config = runtime().getConfig();
-        return (getAccessFlags() & config.klassHasFinalizerFlag) != 0;
-    }
-
-    @Override
-    public boolean isPrimitive() {
-        return false;
-    }
-
-    @Override
-    public boolean isArray() {
-        return mirror().isArray();
-    }
-
-    @Override
-    public boolean isInitialized() {
-        return isArray() ? true : getInitState() == runtime().getConfig().instanceKlassStateFullyInitialized;
-    }
-
-    @Override
-    public boolean isLinked() {
-        return isArray() ? true : getInitState() >= runtime().getConfig().instanceKlassStateLinked;
-    }
-
-    /**
-     * Returns the value of the state field {@code InstanceKlass::_init_state} of the metaspace
-     * klass.
-     *
-     * @return state field value of this type
-     */
-    private int getInitState() {
-        assert !isArray() : "_init_state only exists in InstanceKlass";
-        return unsafe.getByte(getMetaspaceKlass() + runtime().getConfig().instanceKlassInitStateOffset) & 0xFF;
-    }
-
-    @Override
-    public void initialize() {
-        if (!isInitialized()) {
-            unsafe.ensureClassInitialized(mirror());
-            assert isInitialized();
-        }
-    }
-
-    @Override
-    public boolean isInstance(JavaConstant obj) {
-        if (obj.getKind() == Kind.Object && !obj.isNull()) {
-            return mirror().isInstance(((HotSpotObjectConstantImpl) obj).object());
-        }
-        return false;
-    }
-
-    @Override
-    public boolean isInstanceClass() {
-        return !isArray() && !isInterface();
-    }
-
-    @Override
-    public boolean isInterface() {
-        return mirror().isInterface();
-    }
-
-    @Override
-    public boolean isAssignableFrom(ResolvedJavaType other) {
-        assert other != null;
-        if (other instanceof HotSpotResolvedObjectTypeImpl) {
-            HotSpotResolvedObjectTypeImpl otherType = (HotSpotResolvedObjectTypeImpl) other;
-            return mirror().isAssignableFrom(otherType.mirror());
-        }
-        return false;
-    }
-
-    @Override
-    public boolean isJavaLangObject() {
-        return javaClass.equals(Object.class);
-    }
-
-    @Override
-    public Kind getKind() {
-        return Kind.Object;
-    }
-
-    @Override
-    public ResolvedJavaMethod resolveConcreteMethod(ResolvedJavaMethod method, ResolvedJavaType callerType) {
-        ResolvedJavaMethod resolvedMethod = resolveMethod(method, callerType, true);
-        if (resolvedMethod == null || resolvedMethod.isAbstract()) {
-            return null;
-        }
-        return resolvedMethod;
-    }
-
-    @Override
-    public ResolvedJavaMethod resolveMethod(ResolvedJavaMethod method, ResolvedJavaType callerType, boolean includeAbstract) {
-        if (!includeAbstract) {
-            return resolveConcreteMethod(method, callerType);
-        }
-        assert !callerType.isArray();
-        if (method.isConcrete() && method.getDeclaringClass().equals(this) && method.isPublic()) {
-            return method;
-        }
-        if (!method.getDeclaringClass().isAssignableFrom(this)) {
-            return null;
-        }
-        HotSpotResolvedJavaMethodImpl hotSpotMethod = (HotSpotResolvedJavaMethodImpl) method;
-        HotSpotResolvedObjectTypeImpl hotSpotCallerType = (HotSpotResolvedObjectTypeImpl) callerType;
-        final long resolvedMetaspaceMethod = runtime().getCompilerToVM().resolveMethod(getMetaspaceKlass(), hotSpotMethod.getMetaspaceMethod(), hotSpotCallerType.getMetaspaceKlass());
-        if (resolvedMetaspaceMethod == 0) {
-            return null;
-        }
-        return HotSpotResolvedJavaMethodImpl.fromMetaspace(resolvedMetaspaceMethod);
-    }
-
-    public ConstantPool constantPool() {
-        if (constantPool == null) {
-            final long metaspaceConstantPool = unsafe.getAddress(getMetaspaceKlass() + runtime().getConfig().instanceKlassConstantsOffset);
-            constantPool = new HotSpotConstantPool(metaspaceConstantPool);
-        }
-        return constantPool;
-    }
-
-    /**
-     * Gets the instance size of this type. If an instance of this type cannot be fast path
-     * allocated, then the returned value is negative (its absolute value gives the size). Must not
-     * be called if this is an array or interface type.
-     */
-    public int instanceSize() {
-        assert !isArray();
-        assert !isInterface();
-
-        HotSpotVMConfig config = runtime().getConfig();
-        final int layoutHelper = unsafe.getInt(getMetaspaceKlass() + config.klassLayoutHelperOffset);
-        assert layoutHelper > config.klassLayoutHelperNeutralValue : "must be instance";
-
-        // See: Klass::layout_helper_size_in_bytes
-        int size = layoutHelper & ~config.klassLayoutHelperInstanceSlowPathBit;
-
-        // See: Klass::layout_helper_needs_slow_path
-        boolean needsSlowPath = (layoutHelper & config.klassLayoutHelperInstanceSlowPathBit) != 0;
-
-        return needsSlowPath ? -size : size;
-    }
-
-    public synchronized HotSpotResolvedJavaMethod createMethod(long metaspaceMethod) {
-        HotSpotResolvedJavaMethod method = null;
-        if (methodCache == null) {
-            methodCache = new HashMap<>(8);
-        } else {
-            method = methodCache.get(metaspaceMethod);
-        }
-        if (method == null) {
-            method = new HotSpotResolvedJavaMethodImpl(this, metaspaceMethod);
-            methodCache.put(metaspaceMethod, method);
-        }
-        return method;
-    }
-
-    public int getVtableLength() {
-        HotSpotVMConfig config = runtime().getConfig();
-        if (isInterface() || isArray()) {
-            /* Everything has the core vtable of java.lang.Object */
-            return config.baseVtableLength;
-        }
-        int result = unsafe.getInt(getMetaspaceKlass() + config.instanceKlassVtableLengthOffset) / (config.vtableEntrySize / config.heapWordSize);
-        assert result >= config.baseVtableLength : unsafe.getInt(getMetaspaceKlass() + config.instanceKlassVtableLengthOffset) + " " + config.vtableEntrySize;
-        return result;
-    }
-
-    /**
-     * Gets the mask used to filter out HotSpot internal flags for fields when a {@link Field}
-     * object is created. This is the value of {@code JVM_RECOGNIZED_FIELD_MODIFIERS} in
-     * {@code jvm.h}, <b>not</b> {@link Modifier#fieldModifiers()}.
-     */
-    public static int getReflectionFieldModifiers() {
-        return runtime().getConfig().recognizedFieldModifiers;
-    }
-
-    public synchronized HotSpotResolvedJavaField createField(String fieldName, JavaType type, long offset, int rawFlags) {
-        HotSpotResolvedJavaField result = null;
-
-        final int flags = rawFlags & getReflectionFieldModifiers();
-
-        final long id = offset + ((long) flags << 32);
-
-        // (thomaswue) Must cache the fields, because the local load elimination only works if the
-        // objects from two field lookups are identical.
-        if (fieldCache == null) {
-            fieldCache = new HashMap<>(8);
-        } else {
-            result = fieldCache.get(id);
-        }
-
-        if (result == null) {
-            result = new HotSpotResolvedJavaFieldImpl(this, fieldName, type, offset, rawFlags);
-            fieldCache.put(id, result);
-        } else {
-            assert result.getName().equals(fieldName);
-            // assert result.getType().equals(type);
-            assert result.offset() == offset;
-            assert result.getModifiers() == flags;
-        }
-
-        return result;
-    }
-
-    @Override
-    public AssumptionResult<ResolvedJavaMethod> findUniqueConcreteMethod(ResolvedJavaMethod method) {
-        HotSpotResolvedJavaMethod hmethod = (HotSpotResolvedJavaMethod) method;
-        HotSpotResolvedObjectType declaredHolder = hmethod.getDeclaringClass();
-        /*
-         * Sometimes the receiver type in the graph hasn't stabilized to a subtype of declared
-         * holder, usually because of phis, so make sure that the type is related to the declared
-         * type before using it for lookup. Unlinked types should also be ignored because we can't
-         * resolve the proper method to invoke. Generally unlinked types in invokes should result in
-         * a deopt instead since they can't really be used if they aren't linked yet.
-         */
-        if (!declaredHolder.isAssignableFrom(this) || this.isArray() || this.equals(declaredHolder) || !isLinked() || isInterface()) {
-            ResolvedJavaMethod result = hmethod.uniqueConcreteMethod(declaredHolder);
-            if (result != null) {
-                return new AssumptionResult<>(result, new ConcreteMethod(method, declaredHolder, result));
-            }
-            return null;
-        }
-        /*
-         * The holder may be a subtype of the declaredHolder so make sure to resolve the method to
-         * the correct method for the subtype.
-         */
-        HotSpotResolvedJavaMethod resolvedMethod = (HotSpotResolvedJavaMethod) resolveMethod(hmethod, this, true);
-        if (resolvedMethod == null) {
-            // The type isn't known to implement the method.
-            return null;
-        }
-
-        ResolvedJavaMethod result = resolvedMethod.uniqueConcreteMethod(this);
-        if (result != null) {
-            return new AssumptionResult<>(result, new ConcreteMethod(method, this, result));
-        }
-        return null;
-    }
-
-    /**
-     * This class represents the field information for one field contained in the fields array of an
-     * {@code InstanceKlass}. The implementation is similar to the native {@code FieldInfo} class.
-     */
-    private class FieldInfo {
-        /**
-         * Native pointer into the array of Java shorts.
-         */
-        private final long metaspaceData;
-
-        /**
-         * Creates a field info for the field in the fields array at index {@code index}.
-         *
-         * @param index index to the fields array
-         */
-        public FieldInfo(int index) {
-            HotSpotVMConfig config = runtime().getConfig();
-            // Get Klass::_fields
-            final long metaspaceFields = unsafe.getAddress(getMetaspaceKlass() + config.instanceKlassFieldsOffset);
-            assert config.fieldInfoFieldSlots == 6 : "revisit the field parsing code";
-            metaspaceData = metaspaceFields + config.arrayU2DataOffset + config.fieldInfoFieldSlots * Short.BYTES * index;
-        }
-
-        private int getAccessFlags() {
-            return readFieldSlot(runtime().getConfig().fieldInfoAccessFlagsOffset);
-        }
-
-        private int getNameIndex() {
-            return readFieldSlot(runtime().getConfig().fieldInfoNameIndexOffset);
-        }
-
-        private int getSignatureIndex() {
-            return readFieldSlot(runtime().getConfig().fieldInfoSignatureIndexOffset);
-        }
-
-        public int getOffset() {
-            HotSpotVMConfig config = runtime().getConfig();
-            final int lowPacked = readFieldSlot(config.fieldInfoLowPackedOffset);
-            final int highPacked = readFieldSlot(config.fieldInfoHighPackedOffset);
-            final int offset = ((highPacked << Short.SIZE) | lowPacked) >> config.fieldInfoTagSize;
-            return offset;
-        }
-
-        /**
-         * Helper method to read an entry (slot) from the field array. Currently field info is laid
-         * on top an array of Java shorts.
-         */
-        private int readFieldSlot(int index) {
-            return unsafe.getChar(metaspaceData + Short.BYTES * index);
-        }
-
-        /**
-         * Returns the name of this field as a {@link String}. If the field is an internal field the
-         * name index is pointing into the vmSymbols table.
-         */
-        public String getName() {
-            final int nameIndex = getNameIndex();
-            return isInternal() ? HotSpotVmSymbols.symbolAt(nameIndex) : constantPool().lookupUtf8(nameIndex);
-        }
-
-        /**
-         * Returns the signature of this field as {@link String}. If the field is an internal field
-         * the signature index is pointing into the vmSymbols table.
-         */
-        public String getSignature() {
-            final int signatureIndex = getSignatureIndex();
-            return isInternal() ? HotSpotVmSymbols.symbolAt(signatureIndex) : constantPool().lookupUtf8(signatureIndex);
-        }
-
-        public JavaType getType() {
-            String signature = getSignature();
-            return runtime().lookupType(signature, HotSpotResolvedObjectTypeImpl.this, false);
-        }
-
-        private boolean isInternal() {
-            return (getAccessFlags() & runtime().getConfig().jvmAccFieldInternal) != 0;
-        }
-
-        public boolean isStatic() {
-            return Modifier.isStatic(getAccessFlags());
-        }
-
-        public boolean hasGenericSignature() {
-            return (getAccessFlags() & runtime().getConfig().jvmAccFieldHasGenericSignature) != 0;
-        }
-    }
-
-    private static class OffsetComparator implements java.util.Comparator<HotSpotResolvedJavaField> {
-        @Override
-        public int compare(HotSpotResolvedJavaField o1, HotSpotResolvedJavaField o2) {
-            return o1.offset() - o2.offset();
-        }
-    }
-
-    @Override
-    public ResolvedJavaField[] getInstanceFields(boolean includeSuperclasses) {
-        if (instanceFields == null) {
-            if (isArray() || isInterface()) {
-                instanceFields = new HotSpotResolvedJavaField[0];
-            } else {
-                final int fieldCount = getFieldCount();
-                ArrayList<HotSpotResolvedJavaField> fieldsArray = new ArrayList<>(fieldCount);
-
-                for (int i = 0; i < fieldCount; i++) {
-                    FieldInfo field = new FieldInfo(i);
-
-                    // We are only interested in instance fields.
-                    if (!field.isStatic()) {
-                        HotSpotResolvedJavaField resolvedJavaField = createField(field.getName(), field.getType(), field.getOffset(), field.getAccessFlags());
-                        fieldsArray.add(resolvedJavaField);
-                    }
-                }
-
-                fieldsArray.sort(new OffsetComparator());
-
-                HotSpotResolvedJavaField[] myFields = fieldsArray.toArray(new HotSpotResolvedJavaField[0]);
-
-                if (mirror() != Object.class) {
-                    HotSpotResolvedJavaField[] superFields = (HotSpotResolvedJavaField[]) getSuperclass().getInstanceFields(true);
-                    HotSpotResolvedJavaField[] fields = Arrays.copyOf(superFields, superFields.length + myFields.length);
-                    System.arraycopy(myFields, 0, fields, superFields.length, myFields.length);
-                    instanceFields = fields;
-                } else {
-                    assert myFields.length == 0 : "java.lang.Object has fields!";
-                    instanceFields = myFields;
-                }
-
-            }
-        }
-        if (!includeSuperclasses) {
-            int myFieldsStart = 0;
-            while (myFieldsStart < instanceFields.length && !instanceFields[myFieldsStart].getDeclaringClass().equals(this)) {
-                myFieldsStart++;
-            }
-            if (myFieldsStart == 0) {
-                return instanceFields;
-            }
-            if (myFieldsStart == instanceFields.length) {
-                return new HotSpotResolvedJavaField[0];
-            }
-            return Arrays.copyOfRange(instanceFields, myFieldsStart, instanceFields.length);
-        }
-        return instanceFields;
-    }
-
-    @Override
-    public ResolvedJavaField[] getStaticFields() {
-        if (isArray()) {
-            return new HotSpotResolvedJavaField[0];
-        } else {
-            final int fieldCount = getFieldCount();
-            ArrayList<HotSpotResolvedJavaField> fieldsArray = new ArrayList<>(fieldCount);
-
-            for (int i = 0; i < fieldCount; i++) {
-                FieldInfo field = new FieldInfo(i);
-
-                // We are only interested in static fields.
-                if (field.isStatic()) {
-                    HotSpotResolvedJavaField resolvedJavaField = createField(field.getName(), field.getType(), field.getOffset(), field.getAccessFlags());
-                    fieldsArray.add(resolvedJavaField);
-                }
-            }
-
-            fieldsArray.sort(new OffsetComparator());
-            return fieldsArray.toArray(new HotSpotResolvedJavaField[fieldsArray.size()]);
-        }
-    }
-
-    /**
-     * Returns the actual field count of this class's internal {@code InstanceKlass::_fields} array
-     * by walking the array and discounting the generic signature slots at the end of the array.
-     *
-     * <p>
-     * See {@code FieldStreamBase::init_generic_signature_start_slot}
-     */
-    private int getFieldCount() {
-        HotSpotVMConfig config = runtime().getConfig();
-        final long metaspaceFields = unsafe.getAddress(getMetaspaceKlass() + config.instanceKlassFieldsOffset);
-        int metaspaceFieldsLength = unsafe.getInt(metaspaceFields + config.arrayU1LengthOffset);
-        int fieldCount = 0;
-
-        for (int i = 0, index = 0; i < metaspaceFieldsLength; i += config.fieldInfoFieldSlots, index++) {
-            FieldInfo field = new FieldInfo(index);
-            if (field.hasGenericSignature()) {
-                metaspaceFieldsLength--;
-            }
-            fieldCount++;
-        }
-        return fieldCount;
-    }
-
-    @Override
-    public Class<?> mirror() {
-        return javaClass;
-    }
-
-    @Override
-    public String getSourceFileName() {
-        HotSpotVMConfig config = runtime().getConfig();
-        final int sourceFileNameIndex = unsafe.getChar(getMetaspaceKlass() + config.instanceKlassSourceFileNameIndexOffset);
-        if (sourceFileNameIndex == 0) {
-            return null;
-        }
-        return constantPool().lookupUtf8(sourceFileNameIndex);
-    }
-
-    @Override
-    public <T extends Annotation> T getAnnotation(Class<T> annotationClass) {
-        return mirror().getAnnotation(annotationClass);
-    }
-
-    /**
-     * Performs a fast-path check that this type is resolved in the context of a given accessing
-     * class. A negative result does not mean this type is not resolved with respect to
-     * {@code accessingClass}. That can only be determined by
-     * {@linkplain HotSpotGraalRuntime#lookupType(String, HotSpotResolvedObjectType, boolean)
-     * re-resolving} the type.
-     */
-    public boolean isDefinitelyResolvedWithRespectTo(ResolvedJavaType accessingClass) {
-        assert accessingClass != null;
-        ResolvedJavaType elementType = getElementalType();
-        if (elementType.isPrimitive()) {
-            // Primitive type resolution is context free.
-            return true;
-        }
-        if (elementType.getName().startsWith("Ljava/")) {
-            // Classes in a java.* package can only be defined by the
-            // boot class loader. This is enforced by ClassLoader.preDefineClass()
-            assert mirror().getClassLoader() == null;
-            return true;
-        }
-        ClassLoader thisCl = mirror().getClassLoader();
-        ClassLoader accessingClassCl = ((HotSpotResolvedObjectTypeImpl) accessingClass).mirror().getClassLoader();
-        return thisCl == accessingClassCl;
-    }
-
-    @Override
-    public ResolvedJavaType resolve(ResolvedJavaType accessingClass) {
-        if (isDefinitelyResolvedWithRespectTo(requireNonNull(accessingClass))) {
-            return this;
-        }
-        HotSpotResolvedObjectTypeImpl accessingType = (HotSpotResolvedObjectTypeImpl) accessingClass;
-        return (ResolvedJavaType) runtime().lookupType(getName(), accessingType, true);
-    }
-
-    /**
-     * Gets the metaspace Klass boxed in a {@link JavaConstant}.
-     */
-    public JavaConstant klass() {
-        return HotSpotMetaspaceConstantImpl.forMetaspaceObject(runtime().getTarget().wordKind, getMetaspaceKlass(), this, false);
-    }
-
-    public boolean isPrimaryType() {
-        return runtime().getConfig().secondarySuperCacheOffset != superCheckOffset();
-    }
-
-    public int superCheckOffset() {
-        HotSpotVMConfig config = runtime().getConfig();
-        return unsafe.getInt(getMetaspaceKlass() + config.superCheckOffsetOffset);
-    }
-
-    public long prototypeMarkWord() {
-        HotSpotVMConfig config = runtime().getConfig();
-        if (isArray()) {
-            return config.arrayPrototypeMarkWord();
-        } else {
-            return unsafe.getAddress(getMetaspaceKlass() + config.prototypeMarkWordOffset);
-        }
-    }
-
-    @Override
-    public ResolvedJavaField findInstanceFieldWithOffset(long offset, Kind expectedEntryKind) {
-        ResolvedJavaField[] declaredFields = getInstanceFields(true);
-        for (ResolvedJavaField field : declaredFields) {
-            HotSpotResolvedJavaField resolvedField = (HotSpotResolvedJavaField) field;
-            long resolvedFieldOffset = resolvedField.offset();
-            // @formatter:off
-            if (ByteOrder.nativeOrder() == ByteOrder.BIG_ENDIAN  &&
-                            expectedEntryKind.isPrimitive() &&
-                            !expectedEntryKind.equals(Kind.Void) &&
-                            resolvedField.getKind().isPrimitive()) {
-                resolvedFieldOffset +=
-                                resolvedField.getKind().getByteCount() -
-                                Math.min(resolvedField.getKind().getByteCount(), 4 + expectedEntryKind.getByteCount());
-            }
-            if (resolvedFieldOffset == offset) {
-                return field;
-            }
-            // @formatter:on
-        }
-        return null;
-    }
-
-    @Override
-    public URL getClassFilePath() {
-        Class<?> cls = mirror();
-        return cls.getResource(MetaUtil.getSimpleName(cls, true).replace('.', '$') + ".class");
-    }
-
-    @Override
-    public boolean isLocal() {
-        return mirror().isLocalClass();
-    }
-
-    @Override
-    public boolean isMember() {
-        return mirror().isMemberClass();
-    }
-
-    @Override
-    public HotSpotResolvedObjectTypeImpl getEnclosingType() {
-        final Class<?> encl = mirror().getEnclosingClass();
-        return encl == null ? null : fromObjectClass(encl);
-    }
-
-    @Override
-    public ResolvedJavaMethod[] getDeclaredConstructors() {
-        Constructor<?>[] constructors = mirror().getDeclaredConstructors();
-        ResolvedJavaMethod[] result = new ResolvedJavaMethod[constructors.length];
-        for (int i = 0; i < constructors.length; i++) {
-            result[i] = runtime().getHostProviders().getMetaAccess().lookupJavaMethod(constructors[i]);
-            assert result[i].isConstructor();
-        }
-        return result;
-    }
-
-    @Override
-    public ResolvedJavaMethod[] getDeclaredMethods() {
-        Method[] methods = mirror().getDeclaredMethods();
-        ResolvedJavaMethod[] result = new ResolvedJavaMethod[methods.length];
-        for (int i = 0; i < methods.length; i++) {
-            result[i] = runtime().getHostProviders().getMetaAccess().lookupJavaMethod(methods[i]);
-            assert !result[i].isConstructor();
-        }
-        return result;
-    }
-
-    public ResolvedJavaMethod getClassInitializer() {
-        final long metaspaceMethod = runtime().getCompilerToVM().getClassInitializer(getMetaspaceKlass());
-        if (metaspaceMethod != 0L) {
-            return createMethod(metaspaceMethod);
-        }
-        return null;
-    }
-
-    @Override
-    public String toString() {
-        return "HotSpotType<" + getName() + ", resolved>";
-    }
-
-    @Override
-    public boolean isTrustedInterfaceType() {
-        return TrustedInterface.class.isAssignableFrom(mirror());
-    }
-}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedPrimitiveType.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,281 +0,0 @@
-/*
- * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.hotspot.meta;
-
-import static java.util.Objects.*;
-
-import java.lang.annotation.*;
-import java.lang.reflect.*;
-import java.net.*;
-
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.api.meta.Assumptions.AssumptionResult;
-import com.oracle.graal.compiler.common.*;
-import com.oracle.graal.hotspot.*;
-
-/**
- * Implementation of {@link JavaType} for primitive HotSpot types.
- */
-public final class HotSpotResolvedPrimitiveType extends HotSpotResolvedJavaType implements HotSpotProxified {
-
-    private final Kind kind;
-
-    /**
-     * Creates the Graal mirror for a primitive {@link Kind}.
-     *
-     * <p>
-     * <b>NOTE</b>: Creating an instance of this class does not install the mirror for the
-     * {@link Class} type. Use {@link #fromClass(Class)} instead.
-     * </p>
-     *
-     * @param kind the Kind to create the mirror for
-     */
-    public HotSpotResolvedPrimitiveType(Kind kind) {
-        super(String.valueOf(Character.toUpperCase(kind.getTypeChar())));
-        this.kind = kind;
-        assert mirror().isPrimitive() : mirror() + " not a primitive type";
-    }
-
-    @Override
-    public int getModifiers() {
-        return Modifier.ABSTRACT | Modifier.FINAL | Modifier.PUBLIC;
-    }
-
-    @Override
-    public HotSpotResolvedObjectTypeImpl getArrayClass() {
-        if (kind == Kind.Void) {
-            return null;
-        }
-        Class<?> javaArrayMirror = Array.newInstance(mirror(), 0).getClass();
-        return HotSpotResolvedObjectTypeImpl.fromObjectClass(javaArrayMirror);
-    }
-
-    public ResolvedJavaType getElementalType() {
-        return this;
-    }
-
-    @Override
-    public ResolvedJavaType getComponentType() {
-        return null;
-    }
-
-    @Override
-    public ResolvedJavaType asExactType() {
-        return this;
-    }
-
-    @Override
-    public ResolvedJavaType getSuperclass() {
-        return null;
-    }
-
-    @Override
-    public ResolvedJavaType[] getInterfaces() {
-        return new ResolvedJavaType[0];
-    }
-
-    @Override
-    public ResolvedJavaType getSingleImplementor() {
-        throw new GraalInternalError("Cannot call getImplementor() on a non-interface type: " + this);
-    }
-
-    @Override
-    public ResolvedJavaType findLeastCommonAncestor(ResolvedJavaType otherType) {
-        return null;
-    }
-
-    @Override
-    public JavaConstant getObjectHub() {
-        throw GraalInternalError.unimplemented("HotSpotResolvedPrimitiveType.getObjectHub");
-    }
-
-    @Override
-    public JavaConstant getJavaClass() {
-        throw GraalInternalError.unimplemented("HotSpotResolvedPrimitiveType.getJavaClass");
-    }
-
-    @Override
-    public AssumptionResult<Boolean> hasFinalizableSubclass() {
-        return new AssumptionResult<>(false);
-    }
-
-    @Override
-    public boolean hasFinalizer() {
-        return false;
-    }
-
-    @Override
-    public boolean isArray() {
-        return false;
-    }
-
-    @Override
-    public boolean isPrimitive() {
-        return true;
-    }
-
-    @Override
-    public boolean isInitialized() {
-        return true;
-    }
-
-    public boolean isLinked() {
-        return true;
-    }
-
-    @Override
-    public boolean isInstance(JavaConstant obj) {
-        return false;
-    }
-
-    @Override
-    public boolean isInstanceClass() {
-        return false;
-    }
-
-    @Override
-    public boolean isInterface() {
-        return false;
-    }
-
-    @Override
-    public boolean isAssignableFrom(ResolvedJavaType other) {
-        assert other != null;
-        return other.equals(this);
-    }
-
-    @Override
-    public Kind getKind() {
-        return kind;
-    }
-
-    @Override
-    public boolean isJavaLangObject() {
-        return false;
-    }
-
-    @Override
-    public ResolvedJavaMethod resolveConcreteMethod(ResolvedJavaMethod method, ResolvedJavaType callerType) {
-        return null;
-    }
-
-    @Override
-    public ResolvedJavaMethod resolveMethod(ResolvedJavaMethod method, ResolvedJavaType callerType, boolean includeAbstract) {
-        return null;
-    }
-
-    @Override
-    public String toString() {
-        return "HotSpotResolvedPrimitiveType<" + kind + ">";
-    }
-
-    @Override
-    public AssumptionResult<ResolvedJavaType> findLeafConcreteSubtype() {
-        return new AssumptionResult<>(this);
-    }
-
-    @Override
-    public AssumptionResult<ResolvedJavaMethod> findUniqueConcreteMethod(ResolvedJavaMethod method) {
-        return null;
-    }
-
-    @Override
-    public ResolvedJavaField[] getInstanceFields(boolean includeSuperclasses) {
-        return new ResolvedJavaField[0];
-    }
-
-    @Override
-    public ResolvedJavaField[] getStaticFields() {
-        return new ResolvedJavaField[0];
-    }
-
-    @Override
-    public <T extends Annotation> T getAnnotation(Class<T> annotationClass) {
-        return null;
-    }
-
-    @Override
-    public ResolvedJavaType resolve(ResolvedJavaType accessingClass) {
-        requireNonNull(accessingClass);
-        return this;
-    }
-
-    @Override
-    public void initialize() {
-    }
-
-    @Override
-    public ResolvedJavaField findInstanceFieldWithOffset(long offset, Kind expectedType) {
-        return null;
-    }
-
-    @Override
-    public String getSourceFileName() {
-        throw GraalInternalError.shouldNotReachHere();
-    }
-
-    @Override
-    public Class<?> mirror() {
-        return kind.toJavaClass();
-    }
-
-    @Override
-    public URL getClassFilePath() {
-        return null;
-    }
-
-    @Override
-    public boolean isLocal() {
-        return false;
-    }
-
-    @Override
-    public boolean isMember() {
-        return false;
-    }
-
-    @Override
-    public ResolvedJavaType getEnclosingType() {
-        return null;
-    }
-
-    @Override
-    public ResolvedJavaMethod[] getDeclaredConstructors() {
-        return new ResolvedJavaMethod[0];
-    }
-
-    @Override
-    public ResolvedJavaMethod[] getDeclaredMethods() {
-        return new ResolvedJavaMethod[0];
-    }
-
-    @Override
-    public ResolvedJavaMethod getClassInitializer() {
-        return null;
-    }
-
-    @Override
-    public boolean isTrustedInterfaceType() {
-        return false;
-    }
-}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntimeStub.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntimeStub.java	Thu May 28 21:11:28 2015 -0700
@@ -22,10 +22,10 @@
  */
 package com.oracle.graal.hotspot.meta;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.hotspot.stubs.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.hotspot.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * Implementation of {@link InstalledCode} for code installed as a RuntimeStub.
@@ -59,6 +59,6 @@
 
     @Override
     public Object executeVarargs(Object... args) throws InvalidInstalledCodeException {
-        throw new GraalInternalError("Cannot call stub %s", stub);
+        throw new InternalError("Cannot call stub " + stub);
     }
 }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotSignature.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,213 +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.graal.hotspot.meta;
-
-import java.util.*;
-
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.common.*;
-import com.oracle.graal.hotspot.*;
-
-/**
- * Represents a method signature.
- */
-public class HotSpotSignature implements Signature {
-
-    private final List<String> parameters = new ArrayList<>();
-    private final String returnType;
-    private final String originalString;
-    private ResolvedJavaType[] parameterTypes;
-    private ResolvedJavaType returnTypeCache;
-    private final HotSpotGraalRuntimeProvider runtime;
-
-    public HotSpotSignature(HotSpotGraalRuntimeProvider runtime, String signature) {
-        this.runtime = runtime;
-        assert signature.length() > 0;
-        this.originalString = signature;
-
-        if (signature.charAt(0) == '(') {
-            int cur = 1;
-            while (cur < signature.length() && signature.charAt(cur) != ')') {
-                int nextCur = parseSignature(signature, cur);
-                parameters.add(signature.substring(cur, nextCur));
-                cur = nextCur;
-            }
-
-            cur++;
-            int nextCur = parseSignature(signature, cur);
-            returnType = signature.substring(cur, nextCur);
-            assert nextCur == signature.length();
-        } else {
-            returnType = null;
-        }
-    }
-
-    public HotSpotSignature(HotSpotGraalRuntimeProvider runtime, ResolvedJavaType returnType, ResolvedJavaType... parameterTypes) {
-        this.runtime = runtime;
-        this.parameterTypes = parameterTypes.clone();
-        this.returnTypeCache = returnType;
-        this.returnType = returnType.getName();
-        StringBuilder sb = new StringBuilder("(");
-        for (JavaType type : parameterTypes) {
-            parameters.add(type.getName());
-            sb.append(type.getName());
-        }
-        sb.append(")").append(returnType.getName());
-        this.originalString = sb.toString();
-        assert new HotSpotSignature(runtime, originalString).equals(this);
-    }
-
-    private static int parseSignature(String signature, int start) {
-        int cur = start;
-        char first;
-        do {
-            first = signature.charAt(cur++);
-        } while (first == '[');
-
-        switch (first) {
-            case 'L':
-                while (signature.charAt(cur) != ';') {
-                    cur++;
-                }
-                cur++;
-                break;
-            case 'V':
-            case 'I':
-            case 'B':
-            case 'C':
-            case 'D':
-            case 'F':
-            case 'J':
-            case 'S':
-            case 'Z':
-                break;
-            default:
-                throw new GraalInternalError("Invalid character at index " + cur + " in signature: " + signature);
-        }
-        return cur;
-    }
-
-    @Override
-    public int getParameterCount(boolean withReceiver) {
-        return parameters.size() + (withReceiver ? 1 : 0);
-    }
-
-    @Override
-    public Kind getParameterKind(int index) {
-        return Kind.fromTypeString(parameters.get(index));
-    }
-
-    private static boolean checkValidCache(ResolvedJavaType type, ResolvedJavaType accessingClass) {
-        assert accessingClass != null;
-        if (type == null) {
-            return false;
-        } else if (type instanceof HotSpotResolvedObjectTypeImpl) {
-            return ((HotSpotResolvedObjectTypeImpl) type).isDefinitelyResolvedWithRespectTo(accessingClass);
-        }
-        return true;
-    }
-
-    private static JavaType getUnresolvedOrPrimitiveType(HotSpotGraalRuntimeProvider runtime, String name) {
-        if (name.length() == 1) {
-            Kind kind = Kind.fromPrimitiveOrVoidTypeChar(name.charAt(0));
-            return runtime.getHostProviders().getMetaAccess().lookupJavaType(kind.toJavaClass());
-        }
-        return new HotSpotUnresolvedJavaType(name, runtime);
-    }
-
-    @Override
-    public JavaType getParameterType(int index, ResolvedJavaType accessingClass) {
-        if (accessingClass == null) {
-            // Caller doesn't care about resolution context so return an unresolved
-            // or primitive type (primitive type resolution is context free)
-            return getUnresolvedOrPrimitiveType(runtime, parameters.get(index));
-        }
-        if (parameterTypes == null) {
-            parameterTypes = new ResolvedJavaType[parameters.size()];
-        }
-
-        ResolvedJavaType type = parameterTypes[index];
-        if (!checkValidCache(type, accessingClass)) {
-            JavaType result = runtime.lookupType(parameters.get(index), (HotSpotResolvedObjectType) accessingClass, false);
-            if (result instanceof ResolvedJavaType) {
-                type = (ResolvedJavaType) result;
-                parameterTypes[index] = type;
-            } else {
-                return result;
-            }
-        }
-        return type;
-    }
-
-    @Override
-    public String toMethodDescriptor() {
-        assert originalString.equals(Signature.super.toMethodDescriptor());
-        return originalString;
-    }
-
-    @Override
-    public Kind getReturnKind() {
-        return Kind.fromTypeString(returnType);
-    }
-
-    @Override
-    public JavaType getReturnType(ResolvedJavaType accessingClass) {
-        if (accessingClass == null) {
-            // Caller doesn't care about resolution context so return an unresolved
-            // or primitive type (primitive type resolution is context free)
-            return getUnresolvedOrPrimitiveType(runtime, returnType);
-        }
-        if (!checkValidCache(returnTypeCache, accessingClass)) {
-            JavaType result = runtime.lookupType(returnType, (HotSpotResolvedObjectType) accessingClass, false);
-            if (result instanceof ResolvedJavaType) {
-                returnTypeCache = (ResolvedJavaType) result;
-            } else {
-                return result;
-            }
-        }
-        return returnTypeCache;
-    }
-
-    @Override
-    public String toString() {
-        return "HotSpotSignature<" + originalString + ">";
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (obj instanceof HotSpotSignature) {
-            HotSpotSignature other = (HotSpotSignature) obj;
-            if (other.originalString.equals(originalString)) {
-                assert other.parameters.equals(parameters);
-                assert other.returnType.equals(returnType);
-                return true;
-            }
-        }
-        return false;
-    }
-
-    @Override
-    public int hashCode() {
-        return originalString.hashCode();
-    }
-}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotSnippetReflectionProvider.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotSnippetReflectionProvider.java	Thu May 28 21:11:28 2015 -0700
@@ -22,9 +22,13 @@
  */
 package com.oracle.graal.hotspot.meta;
 
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.meta.MetaAccessProvider;
+import com.oracle.jvmci.meta.JavaConstant;
+import com.oracle.jvmci.meta.ResolvedJavaType;
+import com.oracle.jvmci.meta.Kind;
 import com.oracle.graal.api.replacements.*;
 import com.oracle.graal.hotspot.*;
+import com.oracle.jvmci.hotspot.*;
 
 public class HotSpotSnippetReflectionProvider implements SnippetReflectionProvider {
 
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotSpeculationLog.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.hotspot.meta;
-
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
-
-public class HotSpotSpeculationLog extends SpeculationLog {
-
-    @Override
-    public JavaConstant speculate(Object reason) {
-        addSpeculation(reason);
-        return HotSpotObjectConstantImpl.forObject(reason);
-    }
-}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotSuitesProvider.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotSuitesProvider.java	Thu May 28 21:11:28 2015 -0700
@@ -25,18 +25,19 @@
 import static com.oracle.graal.compiler.common.GraalOptions.*;
 
 import com.oracle.graal.graphbuilderconf.*;
-import com.oracle.graal.graphbuilderconf.GraphBuilderConfiguration.*;
+import com.oracle.graal.graphbuilderconf.GraphBuilderConfiguration.DebugInfoMode;
+import com.oracle.graal.graphbuilderconf.GraphBuilderConfiguration.Plugins;
 import com.oracle.graal.hotspot.*;
-import com.oracle.graal.hotspot.bridge.*;
 import com.oracle.graal.hotspot.phases.*;
 import com.oracle.graal.java.*;
 import com.oracle.graal.lir.phases.*;
 import com.oracle.graal.nodes.*;
-import com.oracle.graal.nodes.StructuredGraph.*;
-import com.oracle.graal.options.*;
-import com.oracle.graal.options.DerivedOptionValue.OptionSupplier;
+import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions;
 import com.oracle.graal.phases.*;
 import com.oracle.graal.phases.tiers.*;
+import com.oracle.jvmci.hotspot.*;
+import com.oracle.jvmci.options.*;
+import com.oracle.jvmci.options.DerivedOptionValue.OptionSupplier;
 
 /**
  * HotSpot implementation of {@link SuitesProvider}.
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotUnresolvedField.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,78 +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.graal.hotspot.meta;
-
-import com.oracle.graal.api.meta.*;
-
-/**
- * A implementation of {@link JavaField} for an unresolved field.
- */
-public class HotSpotUnresolvedField implements JavaField {
-
-    private final String name;
-    private final JavaType holder;
-    private final JavaType type;
-
-    public HotSpotUnresolvedField(JavaType holder, String name, JavaType type) {
-        this.name = name;
-        this.type = type;
-        this.holder = holder;
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    public JavaType getType() {
-        return type;
-    }
-
-    public JavaType getDeclaringClass() {
-        return holder;
-    }
-
-    @Override
-    public int hashCode() {
-        return super.hashCode();
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj == null || !(obj instanceof HotSpotUnresolvedField)) {
-            return false;
-        }
-        HotSpotUnresolvedField that = (HotSpotUnresolvedField) obj;
-        return this.holder.equals(that.holder) && this.name.equals(that.name) && this.type.equals(that.type);
-    }
-
-    /**
-     * Converts this compiler interface field to a string.
-     */
-    @Override
-    public String toString() {
-        return format("HotSpotField<%H.%n %t, unresolved>");
-    }
-}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotUnresolvedJavaType.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,104 +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.graal.hotspot.meta;
-
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.hotspot.*;
-
-/**
- * Implementation of {@link JavaType} for unresolved HotSpot classes.
- */
-public class HotSpotUnresolvedJavaType extends HotSpotJavaType {
-
-    private final HotSpotGraalRuntimeProvider runtime;
-
-    public HotSpotUnresolvedJavaType(String name, HotSpotGraalRuntimeProvider runtime) {
-        super(name);
-        assert name.charAt(0) == '[' || name.charAt(name.length() - 1) == ';' : name;
-        this.runtime = runtime;
-    }
-
-    /**
-     * Creates an unresolved type for a valid {@link JavaType#getName() type name}.
-     */
-    public static HotSpotUnresolvedJavaType create(HotSpotGraalRuntimeProvider runtime, String name) {
-        return new HotSpotUnresolvedJavaType(name, runtime);
-    }
-
-    @Override
-    public JavaType getComponentType() {
-        assert getName().charAt(0) == '[' : "no array class" + getName();
-        return new HotSpotUnresolvedJavaType(getName().substring(1), runtime);
-    }
-
-    @Override
-    public JavaType getArrayClass() {
-        return new HotSpotUnresolvedJavaType('[' + getName(), runtime);
-    }
-
-    @Override
-    public Kind getKind() {
-        return Kind.Object;
-    }
-
-    @Override
-    public int hashCode() {
-        return getName().hashCode();
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj == null || !(obj instanceof HotSpotUnresolvedJavaType)) {
-            return false;
-        }
-        HotSpotUnresolvedJavaType that = (HotSpotUnresolvedJavaType) obj;
-        return this.getName().equals(that.getName());
-    }
-
-    @Override
-    public String toString() {
-        return "HotSpotType<" + getName() + ", unresolved>";
-    }
-
-    @Override
-    public ResolvedJavaType resolve(ResolvedJavaType accessingClass) {
-        return (ResolvedJavaType) runtime.lookupType(getName(), (HotSpotResolvedObjectType) accessingClass, true);
-    }
-
-    /**
-     * Try to find a loaded version of this class.
-     *
-     * @param accessingClass
-     * @return the resolved class or null.
-     */
-    ResolvedJavaType reresolve(HotSpotResolvedObjectType accessingClass) {
-        JavaType type = runtime.lookupType(getName(), accessingClass, false);
-        if (type instanceof ResolvedJavaType) {
-            return (ResolvedJavaType) type;
-        }
-        return null;
-    }
-}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotWordOperationPlugin.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotWordOperationPlugin.java	Thu May 28 21:11:28 2015 -0700
@@ -22,13 +22,13 @@
  */
 package com.oracle.graal.hotspot.meta;
 
-import static com.oracle.graal.api.meta.LocationIdentity.*;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
+import com.oracle.jvmci.meta.Kind;
+import static com.oracle.jvmci.meta.LocationIdentity.*;
 import static com.oracle.graal.hotspot.word.HotSpotOperation.HotspotOpcode.*;
 import static com.oracle.graal.nodes.ConstantNode.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.api.replacements.*;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graphbuilderconf.*;
 import com.oracle.graal.hotspot.nodes.type.*;
@@ -37,10 +37,11 @@
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.calc.*;
 import com.oracle.graal.nodes.extended.*;
+import com.oracle.graal.nodes.memory.HeapAccess.BarrierType;
 import com.oracle.graal.nodes.memory.*;
-import com.oracle.graal.nodes.memory.HeapAccess.*;
 import com.oracle.graal.replacements.*;
 import com.oracle.graal.word.*;
+import com.oracle.jvmci.common.*;
 
 /**
  * Extends {@link WordOperationPlugin} to handle {@linkplain HotSpotOperation HotSpot word
@@ -68,7 +69,6 @@
 
     public void processHotSpotWordOperation(GraphBuilderContext b, ResolvedJavaMethod method, ValueNode[] args, HotSpotOperation operation) {
         Kind returnKind = method.getSignature().getReturnKind();
-        Kind returnStackKind = returnKind.getStackKind();
         switch (operation.opcode()) {
             case POINTER_EQ:
             case POINTER_NE:
@@ -83,7 +83,7 @@
                 PointerEqualsNode comparison = b.add(new PointerEqualsNode(left, right));
                 ValueNode eqValue = b.add(forBoolean(opcode == POINTER_EQ));
                 ValueNode neValue = b.add(forBoolean(opcode == POINTER_NE));
-                b.addPush(returnStackKind, new ConditionalNode(comparison, eqValue, neValue));
+                b.addPush(returnKind, new ConditionalNode(comparison, eqValue, neValue));
                 break;
 
             case IS_NULL:
@@ -92,22 +92,22 @@
                 assert pointer.stamp() instanceof MetaspacePointerStamp;
 
                 IsNullNode isNull = b.add(new IsNullNode(pointer));
-                b.addPush(returnStackKind, new ConditionalNode(isNull, b.add(forBoolean(true)), b.add(forBoolean(false))));
+                b.addPush(returnKind, new ConditionalNode(isNull, b.add(forBoolean(true)), b.add(forBoolean(false))));
                 break;
 
             case FROM_POINTER:
                 assert args.length == 1;
-                b.addPush(returnStackKind, new PointerCastNode(StampFactory.forKind(wordKind), args[0]));
+                b.addPush(returnKind, new PointerCastNode(StampFactory.forKind(wordKind), args[0]));
                 break;
 
             case TO_KLASS_POINTER:
                 assert args.length == 1;
-                b.addPush(returnStackKind, new PointerCastNode(KlassPointerStamp.klass(), args[0]));
+                b.addPush(returnKind, new PointerCastNode(KlassPointerStamp.klass(), args[0]));
                 break;
 
             case TO_METHOD_POINTER:
                 assert args.length == 1;
-                b.addPush(returnStackKind, new PointerCastNode(MethodPointerStamp.method(), args[0]));
+                b.addPush(returnKind, new PointerCastNode(MethodPointerStamp.method(), args[0]));
                 break;
 
             case READ_KLASS_POINTER:
@@ -125,11 +125,11 @@
                  * explicit zero check on its base address.
                  */
                 read.setGuard(AbstractBeginNode.prevBegin(read));
-                b.push(returnStackKind, read);
+                b.push(returnKind, read);
                 break;
 
             default:
-                throw GraalInternalError.shouldNotReachHere("unknown operation: " + operation.opcode());
+                throw JVMCIError.shouldNotReachHere("unknown operation: " + operation.opcode());
         }
     }
 }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/AllocaNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/AllocaNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,10 +22,11 @@
  */
 package com.oracle.graal.hotspot.nodes;
 
+import com.oracle.jvmci.code.VirtualStackSlot;
+import com.oracle.jvmci.meta.Value;
+import com.oracle.jvmci.meta.Kind;
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodeinfo.*;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/BeginLockScopeNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/BeginLockScopeNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,8 +22,9 @@
  */
 package com.oracle.graal.hotspot.nodes;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.code.StackSlotValue;
+import com.oracle.jvmci.meta.Value;
+import com.oracle.jvmci.meta.LocationIdentity;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.hotspot.*;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/CStringNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/CStringNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,8 @@
  */
 package com.oracle.graal.hotspot.nodes;
 
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.meta.LIRKind;
+import com.oracle.jvmci.meta.AllocatableValue;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodeinfo.*;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassCastNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ClassCastNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,11 @@
  */
 package com.oracle.graal.hotspot.nodes;
 
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.meta.JavaType;
+import com.oracle.jvmci.meta.Assumptions;
+import com.oracle.jvmci.meta.ResolvedJavaType;
+import com.oracle.jvmci.meta.ConstantReflectionProvider;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
 import com.oracle.graal.nodeinfo.*;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/CompressionNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/CompressionNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,20 +22,23 @@
  */
 package com.oracle.graal.hotspot.nodes;
 
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.common.*;
+import com.oracle.jvmci.meta.Value;
+import com.oracle.jvmci.meta.JavaConstant;
+import com.oracle.jvmci.meta.ConstantReflectionProvider;
+import com.oracle.jvmci.meta.Constant;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
 import com.oracle.graal.hotspot.*;
-import com.oracle.graal.hotspot.HotSpotVMConfig.CompressEncoding;
-import com.oracle.graal.hotspot.meta.*;
 import com.oracle.graal.hotspot.nodes.type.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.calc.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.type.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.hotspot.*;
+import com.oracle.jvmci.hotspot.HotSpotVMConfig.CompressEncoding;
 
 /**
  * Compress or uncompress an oop or metaspace pointer.
@@ -80,7 +83,7 @@
         } else if (c instanceof HotSpotMetaspaceConstant) {
             return ((HotSpotMetaspaceConstant) c).compress(encoding);
         } else {
-            throw GraalInternalError.shouldNotReachHere("invalid constant input for compress op: " + c);
+            throw JVMCIError.shouldNotReachHere("invalid constant input for compress op: " + c);
         }
     }
 
@@ -92,7 +95,7 @@
         } else if (c instanceof HotSpotMetaspaceConstant) {
             return ((HotSpotMetaspaceConstant) c).uncompress(encoding);
         } else {
-            throw GraalInternalError.shouldNotReachHere("invalid constant input for uncompress op: " + c);
+            throw JVMCIError.shouldNotReachHere("invalid constant input for uncompress op: " + c);
         }
     }
 
@@ -104,7 +107,7 @@
             case Uncompress:
                 return uncompress(c, encoding);
             default:
-                throw GraalInternalError.shouldNotReachHere();
+                throw JVMCIError.shouldNotReachHere();
         }
     }
 
@@ -116,7 +119,7 @@
             case Uncompress:
                 return compress(c, encoding);
             default:
-                throw GraalInternalError.shouldNotReachHere();
+                throw JVMCIError.shouldNotReachHere();
         }
     }
 
@@ -148,7 +151,7 @@
                 }
                 break;
         }
-        throw GraalInternalError.shouldNotReachHere(String.format("Unexpected input stamp %s", input));
+        throw JVMCIError.shouldNotReachHere(String.format("Unexpected input stamp %s", input));
     }
 
     public CompressEncoding getEncoding() {
@@ -188,7 +191,7 @@
                 result = hsGen.emitUncompress(gen.operand(getValue()), encoding, nonNull);
                 break;
             default:
-                throw GraalInternalError.shouldNotReachHere();
+                throw JVMCIError.shouldNotReachHere();
         }
         gen.setResult(this, result);
     }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/CurrentJavaThreadNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/CurrentJavaThreadNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,8 +22,9 @@
  */
 package com.oracle.graal.hotspot.nodes;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.meta.LIRKind;
+import com.oracle.jvmci.meta.Kind;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.hotspot.*;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/CurrentLockNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/CurrentLockNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,8 +22,8 @@
  */
 package com.oracle.graal.hotspot.nodes;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.code.StackSlotValue;
+import com.oracle.jvmci.meta.Value;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.hotspot.*;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/DeoptimizationFetchUnrollInfoCallNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/DeoptimizationFetchUnrollInfoCallNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,10 +22,12 @@
  */
 package com.oracle.graal.hotspot.nodes;
 
+import com.oracle.jvmci.code.ForeignCallsProvider;
+import com.oracle.jvmci.meta.Value;
+import com.oracle.jvmci.meta.LocationIdentity;
+import com.oracle.jvmci.meta.Kind;
 import static com.oracle.graal.hotspot.HotSpotBackend.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.hotspot.*;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/DeoptimizeCallerNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/DeoptimizeCallerNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,8 @@
  */
 package com.oracle.graal.hotspot.nodes;
 
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.meta.DeoptimizationReason;
+import com.oracle.jvmci.meta.DeoptimizationAction;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.hotspot.*;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/DimensionsNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/DimensionsNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,12 +22,12 @@
  */
 package com.oracle.graal.hotspot.nodes;
 
+import com.oracle.jvmci.code.VirtualStackSlot;
+import com.oracle.jvmci.meta.Value;
 import static com.oracle.graal.asm.NumUtil.*;
 
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.lir.gen.*;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/DirectCompareAndSwapNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/DirectCompareAndSwapNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,7 @@
  */
 package com.oracle.graal.hotspot.nodes;
 
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.meta.LocationIdentity;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.hotspot.*;
 import com.oracle.graal.nodeinfo.*;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/EndLockScopeNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/EndLockScopeNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,7 @@
  */
 package com.oracle.graal.hotspot.nodes;
 
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.meta.LocationIdentity;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodeinfo.*;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/EnterUnpackFramesStackFrameNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/EnterUnpackFramesStackFrameNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,7 @@
  */
 package com.oracle.graal.hotspot.nodes;
 
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.meta.Value;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.hotspot.*;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/GetObjectAddressNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/GetObjectAddressNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,9 @@
  */
 package com.oracle.graal.hotspot.nodes;
 
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.meta.LIRKind;
+import com.oracle.jvmci.meta.AllocatableValue;
+import com.oracle.jvmci.meta.Kind;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodeinfo.*;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/HotSpotDirectCallTargetNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/HotSpotDirectCallTargetNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,10 +22,11 @@
  */
 package com.oracle.graal.hotspot.nodes;
 
+import com.oracle.jvmci.meta.JavaType;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
 import java.util.*;
 
-import com.oracle.graal.api.code.CallingConvention.Type;
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.code.CallingConvention.Type;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodeinfo.*;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/HotSpotIndirectCallTargetNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/HotSpotIndirectCallTargetNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,10 +22,11 @@
  */
 package com.oracle.graal.hotspot.nodes;
 
+import com.oracle.jvmci.meta.JavaType;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
 import java.util.*;
 
-import com.oracle.graal.api.code.CallingConvention.Type;
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.code.CallingConvention.Type;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodeinfo.*;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/LeaveDeoptimizedStackFrameNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/LeaveDeoptimizedStackFrameNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,7 @@
  */
 package com.oracle.graal.hotspot.nodes;
 
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.meta.Value;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.hotspot.*;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/LoadIndexedPointerNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/LoadIndexedPointerNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,7 @@
  */
 package com.oracle.graal.hotspot.nodes;
 
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.meta.Kind;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodeinfo.*;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/MonitorCounterNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/MonitorCounterNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,10 +22,10 @@
  */
 package com.oracle.graal.hotspot.nodes;
 
+import com.oracle.jvmci.code.VirtualStackSlot;
+import com.oracle.jvmci.meta.Value;
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodeinfo.*;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/PushInterpreterFrameNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/PushInterpreterFrameNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,7 @@
  */
 package com.oracle.graal.hotspot.nodes;
 
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.meta.Value;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.hotspot.*;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/SaveAllRegistersNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/SaveAllRegistersNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,8 @@
  */
 package com.oracle.graal.hotspot.nodes;
 
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.meta.LocationIdentity;
+import com.oracle.jvmci.meta.Kind;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.hotspot.*;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/StubForeignCallNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/StubForeignCallNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,10 +22,14 @@
  */
 package com.oracle.graal.hotspot.nodes;
 
+import com.oracle.jvmci.code.ForeignCallsProvider;
+import com.oracle.jvmci.code.ForeignCallLinkage;
+import com.oracle.jvmci.meta.Value;
+import com.oracle.jvmci.meta.LocationIdentity;
+import com.oracle.jvmci.meta.ForeignCallDescriptor;
+import com.oracle.jvmci.meta.Kind;
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.hotspot.replacements.*;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/UncommonTrapCallNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/UncommonTrapCallNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,10 +22,12 @@
  */
 package com.oracle.graal.hotspot.nodes;
 
+import com.oracle.jvmci.code.ForeignCallsProvider;
+import com.oracle.jvmci.meta.Value;
+import com.oracle.jvmci.meta.LocationIdentity;
+import com.oracle.jvmci.meta.Kind;
 import static com.oracle.graal.hotspot.HotSpotBackend.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.hotspot.*;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/VMErrorNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/VMErrorNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,11 +22,14 @@
  */
 package com.oracle.graal.hotspot.nodes;
 
+import com.oracle.jvmci.code.ForeignCallLinkage;
+import com.oracle.jvmci.code.CodeUtil;
+import com.oracle.jvmci.meta.MetaUtil;
+import com.oracle.jvmci.meta.Value;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
 import static com.oracle.graal.hotspot.HotSpotBackend.*;
 import static com.oracle.graal.hotspot.nodes.CStringNode.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodeinfo.*;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/type/KlassPointerStamp.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/type/KlassPointerStamp.java	Thu May 28 21:11:28 2015 -0700
@@ -22,13 +22,18 @@
  */
 package com.oracle.graal.hotspot.nodes.type;
 
+import com.oracle.jvmci.meta.MemoryAccessProvider;
+import com.oracle.jvmci.meta.MetaAccessProvider;
+import com.oracle.jvmci.meta.JavaConstant;
+import com.oracle.jvmci.meta.LIRKind;
+import com.oracle.jvmci.meta.Kind;
+import com.oracle.jvmci.meta.Constant;
 import java.util.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.spi.*;
 import com.oracle.graal.compiler.common.type.*;
-import com.oracle.graal.hotspot.HotSpotVMConfig.CompressEncoding;
-import com.oracle.graal.hotspot.meta.*;
+import com.oracle.jvmci.hotspot.*;
+import com.oracle.jvmci.hotspot.HotSpotVMConfig.CompressEncoding;
 
 public final class KlassPointerStamp extends MetaspacePointerStamp {
 
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/type/MetaspacePointerStamp.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/type/MetaspacePointerStamp.java	Thu May 28 21:11:28 2015 -0700
@@ -22,10 +22,12 @@
  */
 package com.oracle.graal.hotspot.nodes.type;
 
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.common.*;
+import com.oracle.jvmci.meta.MetaAccessProvider;
+import com.oracle.jvmci.meta.ResolvedJavaType;
+import com.oracle.jvmci.meta.LIRKind;
 import com.oracle.graal.compiler.common.spi.*;
 import com.oracle.graal.compiler.common.type.*;
+import com.oracle.jvmci.common.*;
 
 public abstract class MetaspacePointerStamp extends AbstractPointerStamp {
 
@@ -51,7 +53,7 @@
 
     @Override
     public ResolvedJavaType javaType(MetaAccessProvider metaAccess) {
-        throw GraalInternalError.shouldNotReachHere("metaspace pointer has no Java type");
+        throw JVMCIError.shouldNotReachHere("metaspace pointer has no Java type");
     }
 
     protected void appendString(StringBuilder str) {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/type/MethodPointerStamp.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/type/MethodPointerStamp.java	Thu May 28 21:11:28 2015 -0700
@@ -22,9 +22,12 @@
  */
 package com.oracle.graal.hotspot.nodes.type;
 
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.meta.MemoryAccessProvider;
+import com.oracle.jvmci.meta.MetaAccessProvider;
+import com.oracle.jvmci.meta.JavaConstant;
+import com.oracle.jvmci.meta.Constant;
 import com.oracle.graal.compiler.common.type.*;
-import com.oracle.graal.hotspot.meta.*;
+import com.oracle.jvmci.hotspot.*;
 
 public final class MethodPointerStamp extends MetaspacePointerStamp {
 
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/type/NarrowOopStamp.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/type/NarrowOopStamp.java	Thu May 28 21:11:28 2015 -0700
@@ -22,11 +22,16 @@
  */
 package com.oracle.graal.hotspot.nodes.type;
 
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.meta.MemoryAccessProvider;
+import com.oracle.jvmci.meta.JavaConstant;
+import com.oracle.jvmci.meta.ResolvedJavaType;
+import com.oracle.jvmci.meta.LIRKind;
+import com.oracle.jvmci.meta.Constant;
+import com.oracle.jvmci.meta.Kind;
 import com.oracle.graal.compiler.common.spi.*;
 import com.oracle.graal.compiler.common.type.*;
-import com.oracle.graal.hotspot.HotSpotVMConfig.CompressEncoding;
-import com.oracle.graal.hotspot.meta.*;
+import com.oracle.jvmci.hotspot.*;
+import com.oracle.jvmci.hotspot.HotSpotVMConfig.CompressEncoding;
 
 public class NarrowOopStamp extends AbstractObjectStamp {
 
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/AheadOfTimeVerificationPhase.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/AheadOfTimeVerificationPhase.java	Thu May 28 21:11:28 2015 -0700
@@ -22,14 +22,14 @@
  */
 package com.oracle.graal.hotspot.phases;
 
+import com.oracle.jvmci.meta.Kind;
 import static com.oracle.graal.nodes.ConstantNode.*;
 
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.hotspot.meta.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.type.*;
 import com.oracle.graal.phases.*;
 import com.oracle.graal.phases.tiers.*;
+import com.oracle.jvmci.hotspot.*;
 
 /**
  * Checks for {@link #isIllegalObjectConstant(ConstantNode) illegal} object constants in a graph
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/LoadJavaMirrorWithKlassPhase.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/LoadJavaMirrorWithKlassPhase.java	Thu May 28 21:11:28 2015 -0700
@@ -22,15 +22,15 @@
  */
 package com.oracle.graal.hotspot.phases;
 
-import static com.oracle.graal.api.meta.LocationIdentity.*;
+import com.oracle.jvmci.meta.MetaAccessProvider;
+import com.oracle.jvmci.meta.JavaConstant;
+import com.oracle.jvmci.meta.ResolvedJavaType;
+import com.oracle.jvmci.meta.ConstantReflectionProvider;
+import static com.oracle.jvmci.meta.LocationIdentity.*;
 import static com.oracle.graal.hotspot.replacements.HotSpotReplacementsUtil.*;
 import static com.oracle.graal.nodes.ConstantNode.*;
 
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.type.*;
-import com.oracle.graal.hotspot.HotSpotVMConfig.CompressEncoding;
-import com.oracle.graal.hotspot.meta.*;
 import com.oracle.graal.hotspot.nodes.*;
 import com.oracle.graal.hotspot.nodes.type.*;
 import com.oracle.graal.nodes.*;
@@ -39,6 +39,9 @@
 import com.oracle.graal.phases.*;
 import com.oracle.graal.phases.common.*;
 import com.oracle.graal.phases.tiers.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.hotspot.*;
+import com.oracle.jvmci.hotspot.HotSpotVMConfig.CompressEncoding;
 
 /**
  * For AOT compilation we aren't allowed to use a {@link Class} reference ({@code javaMirror})
@@ -96,7 +99,7 @@
                         }
                     }
                     if (typeField == null) {
-                        throw new GraalInternalError("Can't find TYPE field in class");
+                        throw new JVMCIError("Can't find TYPE field in class");
                     }
 
                     LocationNode location = graph.unique(new ConstantLocationNode(FINAL_LOCATION, typeField.offset()));
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/OnStackReplacementPhase.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/OnStackReplacementPhase.java	Thu May 28 21:11:28 2015 -0700
@@ -22,11 +22,9 @@
  */
 package com.oracle.graal.hotspot.phases;
 
+import com.oracle.jvmci.code.BailoutException;
 import static com.oracle.graal.phases.common.DeadCodeEliminationPhase.Optionality.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.compiler.common.*;
-import com.oracle.graal.debug.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.iterators.*;
 import com.oracle.graal.loop.*;
@@ -36,6 +34,8 @@
 import com.oracle.graal.nodes.util.*;
 import com.oracle.graal.phases.*;
 import com.oracle.graal.phases.common.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.debug.*;
 
 public class OnStackReplacementPhase extends Phase {
 
@@ -55,7 +55,7 @@
                 throw new BailoutException("No OnStackReplacementNode generated");
             }
             if (osrNodes.count() > 1) {
-                throw new GraalInternalError("Multiple OnStackReplacementNodes generated");
+                throw new JVMCIError("Multiple OnStackReplacementNodes generated");
             }
             if (osr.stateAfter().locksSize() != 0) {
                 throw new BailoutException("OSR with locks not supported");
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/WriteBarrierAdditionPhase.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/WriteBarrierAdditionPhase.java	Thu May 28 21:11:28 2015 -0700
@@ -22,17 +22,17 @@
  */
 package com.oracle.graal.hotspot.phases;
 
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.graph.*;
-import com.oracle.graal.hotspot.*;
 import com.oracle.graal.hotspot.nodes.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.extended.*;
 import com.oracle.graal.nodes.java.*;
 import com.oracle.graal.nodes.memory.*;
-import com.oracle.graal.nodes.memory.HeapAccess.*;
+import com.oracle.graal.nodes.memory.HeapAccess.BarrierType;
 import com.oracle.graal.nodes.type.*;
 import com.oracle.graal.phases.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.hotspot.*;
 
 public class WriteBarrierAdditionPhase extends Phase {
 
@@ -115,7 +115,7 @@
                 }
                 break;
             default:
-                throw new GraalInternalError("unexpected barrier type: " + barrierType);
+                throw new JVMCIError("unexpected barrier type: " + barrierType);
         }
     }
 
@@ -136,7 +136,7 @@
                 }
                 break;
             default:
-                throw new GraalInternalError("unexpected barrier type: " + barrierType);
+                throw new JVMCIError("unexpected barrier type: " + barrierType);
         }
     }
 
@@ -157,7 +157,7 @@
                 }
                 break;
             default:
-                throw new GraalInternalError("unexpected barrier type: " + barrierType);
+                throw new JVMCIError("unexpected barrier type: " + barrierType);
         }
     }
 
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/WriteBarrierVerificationPhase.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/WriteBarrierVerificationPhase.java	Thu May 28 21:11:28 2015 -0700
@@ -27,7 +27,6 @@
 
 import java.util.*;
 
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.hotspot.nodes.*;
 import com.oracle.graal.hotspot.replacements.*;
@@ -38,6 +37,7 @@
 import com.oracle.graal.nodes.memory.HeapAccess.BarrierType;
 import com.oracle.graal.nodes.type.*;
 import com.oracle.graal.phases.*;
+import com.oracle.jvmci.common.*;
 
 /**
  * Verification phase that checks if, for every write, at least one write barrier is present at all
@@ -145,7 +145,7 @@
         } else if (write instanceof LoweredAtomicReadAndWriteNode) {
             return ((LoweredAtomicReadAndWriteNode) write).getNewValue();
         } else {
-            throw GraalInternalError.shouldNotReachHere(String.format("unexpected write node %s", write));
+            throw JVMCIError.shouldNotReachHere(String.format("unexpected write node %s", write));
         }
     }
 
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/AESCryptSubstitutions.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/AESCryptSubstitutions.java	Thu May 28 21:11:28 2015 -0700
@@ -22,19 +22,21 @@
  */
 package com.oracle.graal.hotspot.replacements;
 
+import com.oracle.jvmci.meta.LocationIdentity;
+import com.oracle.jvmci.meta.ForeignCallDescriptor;
+import com.oracle.jvmci.meta.Kind;
 import static com.oracle.graal.hotspot.HotSpotBackend.*;
 import static com.oracle.graal.hotspot.replacements.HotSpotReplacementsUtil.*;
 import static com.oracle.graal.word.Word.*;
 import sun.misc.*;
 
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.graph.Node.ConstantNodeParameter;
 import com.oracle.graal.graph.Node.NodeIntrinsic;
 import com.oracle.graal.hotspot.nodes.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.extended.*;
 import com.oracle.graal.word.*;
+import com.oracle.jvmci.common.*;
 
 // JaCoCo Exclude
 
@@ -54,7 +56,7 @@
             AESCryptClass = Class.forName("com.sun.crypto.provider.AESCrypt", true, cl);
             kOffset = UnsafeAccess.unsafe.objectFieldOffset(AESCryptClass.getDeclaredField("K"));
         } catch (Exception ex) {
-            throw new GraalInternalError(ex);
+            throw new JVMCIError(ex);
         }
     }
 
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/AssertionSnippets.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/AssertionSnippets.java	Thu May 28 21:11:28 2015 -0700
@@ -22,11 +22,11 @@
  */
 package com.oracle.graal.hotspot.replacements;
 
+import com.oracle.jvmci.code.TargetDescription;
+import com.oracle.jvmci.meta.ForeignCallDescriptor;
 import static com.oracle.graal.hotspot.nodes.CStringNode.*;
 import static com.oracle.graal.replacements.SnippetTemplate.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.graph.Node.ConstantNodeParameter;
 import com.oracle.graal.graph.Node.NodeIntrinsic;
 import com.oracle.graal.hotspot.meta.*;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/CRC32Substitutions.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/CRC32Substitutions.java	Thu May 28 21:11:28 2015 -0700
@@ -22,12 +22,13 @@
  */
 package com.oracle.graal.hotspot.replacements;
 
+import com.oracle.jvmci.meta.ForeignCallDescriptor;
+import com.oracle.jvmci.meta.Kind;
 import static com.oracle.graal.hotspot.HotSpotGraalRuntime.*;
 import static com.oracle.graal.hotspot.replacements.HotSpotReplacementsUtil.*;
 
 import java.util.zip.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.api.replacements.*;
 import com.oracle.graal.graph.Node.ConstantNodeParameter;
 import com.oracle.graal.graph.Node.NodeIntrinsic;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/CallSiteTargetNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/CallSiteTargetNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,15 +22,19 @@
  */
 package com.oracle.graal.hotspot.replacements;
 
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.meta.MetaAccessProvider;
+import com.oracle.jvmci.meta.JavaType;
+import com.oracle.jvmci.meta.JavaConstant;
+import com.oracle.jvmci.meta.Assumptions;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
-import com.oracle.graal.hotspot.meta.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.CallTargetNode.InvokeKind;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.replacements.nodes.*;
+import com.oracle.jvmci.hotspot.*;
 
 @NodeInfo
 public final class CallSiteTargetNode extends MacroStateSplitNode implements Canonicalizable, Lowerable {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/CardTableAddressNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/CardTableAddressNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,8 @@
  */
 package com.oracle.graal.hotspot.replacements;
 
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.meta.Value;
+import com.oracle.jvmci.meta.Kind;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.hotspot.*;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/CardTableShiftNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/CardTableShiftNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,7 @@
  */
 package com.oracle.graal.hotspot.replacements;
 
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.meta.Value;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.hotspot.*;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/CheckCastDynamicSnippets.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/CheckCastDynamicSnippets.java	Thu May 28 21:11:28 2015 -0700
@@ -22,17 +22,16 @@
  */
 package com.oracle.graal.hotspot.replacements;
 
-import static com.oracle.graal.api.meta.DeoptimizationAction.*;
-import static com.oracle.graal.api.meta.DeoptimizationReason.*;
+import com.oracle.jvmci.code.TargetDescription;
+import static com.oracle.jvmci.meta.DeoptimizationAction.*;
+import static com.oracle.jvmci.meta.DeoptimizationReason.*;
 import static com.oracle.graal.hotspot.replacements.HotSpotReplacementsUtil.*;
 import static com.oracle.graal.hotspot.replacements.TypeCheckSnippetUtils.*;
 import static com.oracle.graal.nodes.PiNode.*;
 import static com.oracle.graal.nodes.extended.BranchProbabilityNode.*;
 import static com.oracle.graal.replacements.SnippetTemplate.*;
 
-import com.oracle.graal.api.code.*;
 import com.oracle.graal.compiler.common.type.*;
-import com.oracle.graal.debug.*;
 import com.oracle.graal.hotspot.meta.*;
 import com.oracle.graal.hotspot.nodes.*;
 import com.oracle.graal.hotspot.word.*;
@@ -44,6 +43,7 @@
 import com.oracle.graal.replacements.SnippetTemplate.AbstractTemplates;
 import com.oracle.graal.replacements.SnippetTemplate.Arguments;
 import com.oracle.graal.replacements.SnippetTemplate.SnippetInfo;
+import com.oracle.jvmci.debug.*;
 
 /**
  * Snippet used for lowering {@link CheckCastDynamicNode}.
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/CipherBlockChainingSubstitutions.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/CipherBlockChainingSubstitutions.java	Thu May 28 21:11:28 2015 -0700
@@ -22,19 +22,21 @@
  */
 package com.oracle.graal.hotspot.replacements;
 
+import com.oracle.jvmci.meta.LocationIdentity;
+import com.oracle.jvmci.meta.ForeignCallDescriptor;
+import com.oracle.jvmci.meta.Kind;
 import static com.oracle.graal.hotspot.HotSpotBackend.*;
 import static com.oracle.graal.hotspot.replacements.HotSpotReplacementsUtil.*;
 import sun.misc.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.api.replacements.*;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.graph.Node.ConstantNodeParameter;
 import com.oracle.graal.graph.Node.NodeIntrinsic;
 import com.oracle.graal.hotspot.nodes.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.extended.*;
 import com.oracle.graal.word.*;
+import com.oracle.jvmci.common.*;
 
 // JaCoCo Exclude
 
@@ -59,7 +61,7 @@
             cipherBlockChainingClass = Class.forName("com.sun.crypto.provider.CipherBlockChaining", true, cl);
             rOffset = UnsafeAccess.unsafe.objectFieldOffset(cipherBlockChainingClass.getDeclaredField("r"));
         } catch (Exception ex) {
-            throw new GraalInternalError(ex);
+            throw new JVMCIError(ex);
         }
     }
 
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ClassGetHubNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ClassGetHubNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,11 +22,14 @@
  */
 package com.oracle.graal.hotspot.replacements;
 
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.meta.MetaAccessProvider;
+import com.oracle.jvmci.meta.JavaConstant;
+import com.oracle.jvmci.meta.ConstantReflectionProvider;
+import com.oracle.jvmci.meta.ResolvedJavaType;
+import com.oracle.jvmci.meta.Constant;
 import com.oracle.graal.compiler.common.calc.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
-import com.oracle.graal.hotspot.meta.*;
 import com.oracle.graal.hotspot.nodes.type.*;
 import com.oracle.graal.hotspot.word.*;
 import com.oracle.graal.nodeinfo.*;
@@ -35,6 +38,7 @@
 import com.oracle.graal.nodes.extended.*;
 import com.oracle.graal.nodes.memory.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.hotspot.*;
 
 /**
  * Read {@code Class::_klass} to get the hub for a {@link java.lang.Class}. This node mostly exists
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/CompilerToVMImplSubstitutions.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/CompilerToVMImplSubstitutions.java	Thu May 28 21:11:28 2015 -0700
@@ -23,13 +23,13 @@
 package com.oracle.graal.hotspot.replacements;
 
 import com.oracle.graal.api.replacements.*;
-import com.oracle.graal.hotspot.bridge.*;
 import com.oracle.graal.word.*;
+import com.oracle.jvmci.hotspot.*;
 
 /**
  * Substitutions for {@link CompilerToVMImpl} methods.
  */
-@ClassSubstitution(com.oracle.graal.hotspot.bridge.CompilerToVMImpl.class)
+@ClassSubstitution(com.oracle.jvmci.hotspot.CompilerToVMImpl.class)
 public class CompilerToVMImplSubstitutions {
 
     @MethodSubstitution(isStatic = false)
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/HotSpotReplacementsUtil.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/HotSpotReplacementsUtil.java	Thu May 28 21:11:28 2015 -0700
@@ -22,24 +22,29 @@
  */
 package com.oracle.graal.hotspot.replacements;
 
-import static com.oracle.graal.compiler.common.UnsafeAccess.*;
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.code.CodeUtil;
+import com.oracle.jvmci.meta.NamedLocationIdentity;
+import com.oracle.jvmci.meta.LocationIdentity;
+import com.oracle.jvmci.meta.ForeignCallDescriptor;
+import com.oracle.jvmci.meta.Kind;
 import static com.oracle.graal.hotspot.HotSpotGraalRuntime.*;
 import static com.oracle.graal.hotspot.meta.HotSpotForeignCallsProviderImpl.*;
 import static com.oracle.graal.nodes.extended.BranchProbabilityNode.*;
+import static com.oracle.jvmci.common.UnsafeAccess.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.api.replacements.*;
 import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.graph.Node.ConstantNodeParameter;
 import com.oracle.graal.graph.Node.NodeIntrinsic;
-import com.oracle.graal.hotspot.*;
 import com.oracle.graal.hotspot.nodes.*;
 import com.oracle.graal.hotspot.word.*;
 import com.oracle.graal.nodes.extended.*;
 import com.oracle.graal.replacements.*;
 import com.oracle.graal.replacements.nodes.*;
 import com.oracle.graal.word.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.hotspot.*;
 
 //JaCoCo Exclude
 
@@ -429,12 +434,12 @@
 
     @Fold
     public static int arrayBaseOffset(Kind elementKind) {
-        return runtime().getArrayBaseOffset(elementKind);
+        return runtime().getJVMCIRuntime().getArrayBaseOffset(elementKind);
     }
 
     @Fold
     public static int arrayIndexScale(Kind elementKind) {
-        return runtime().getArrayIndexScale(elementKind);
+        return runtime().getJVMCIRuntime().getArrayIndexScale(elementKind);
     }
 
     @Fold
@@ -819,7 +824,7 @@
         try {
             return unsafe.objectFieldOffset(java.lang.ref.Reference.class.getDeclaredField("referent"));
         } catch (Exception e) {
-            throw new GraalInternalError(e);
+            throw new JVMCIError(e);
         }
     }
 
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/HotSpotSubstitutions.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/HotSpotSubstitutions.java	Thu May 28 21:11:28 2015 -0700
@@ -22,16 +22,16 @@
  */
 package com.oracle.graal.hotspot.replacements;
 
+import com.oracle.jvmci.code.TargetDescription;
+import com.oracle.jvmci.meta.MetaAccessProvider;
 import sun.misc.*;
 import sun.reflect.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.api.replacements.*;
-import com.oracle.graal.api.runtime.*;
-import com.oracle.graal.hotspot.bridge.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.replacements.*;
+import com.oracle.jvmci.hotspot.*;
+import com.oracle.jvmci.runtime.*;
 
 @ServiceProvider(ReplacementsProvider.class)
 public class HotSpotSubstitutions implements ReplacementsProvider {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/HubGetClassNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/HubGetClassNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,16 +22,20 @@
  */
 package com.oracle.graal.hotspot.replacements;
 
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.meta.MetaAccessProvider;
+import com.oracle.jvmci.meta.JavaConstant;
+import com.oracle.jvmci.meta.ConstantReflectionProvider;
+import com.oracle.jvmci.meta.ResolvedJavaType;
+import com.oracle.jvmci.meta.Constant;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
-import com.oracle.graal.hotspot.meta.*;
 import com.oracle.graal.hotspot.word.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.calc.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.hotspot.*;
 
 /**
  * Read {@code Klass::_java_mirror} and incorporate non-null type information into stamp. This is
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/IdentityHashCodeNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/IdentityHashCodeNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,15 +22,18 @@
  */
 package com.oracle.graal.hotspot.replacements;
 
+import com.oracle.jvmci.meta.MetaAccessProvider;
+import com.oracle.jvmci.meta.JavaType;
+import com.oracle.jvmci.meta.JavaConstant;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
 import static com.oracle.graal.compiler.common.GraalOptions.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.graph.*;
-import com.oracle.graal.hotspot.meta.*;
 import com.oracle.graal.nodeinfo.*;
+import com.oracle.graal.nodes.CallTargetNode.InvokeKind;
 import com.oracle.graal.nodes.*;
-import com.oracle.graal.nodes.CallTargetNode.InvokeKind;
 import com.oracle.graal.replacements.nodes.*;
+import com.oracle.jvmci.hotspot.*;
 
 @NodeInfo
 public final class IdentityHashCodeNode extends PureFunctionMacroNode {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/InstanceOfSnippets.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/InstanceOfSnippets.java	Thu May 28 21:11:28 2015 -0700
@@ -22,16 +22,20 @@
  */
 package com.oracle.graal.hotspot.replacements;
 
-import static com.oracle.graal.api.meta.DeoptimizationAction.*;
-import static com.oracle.graal.api.meta.DeoptimizationReason.*;
+import com.oracle.jvmci.code.TargetDescription;
+import com.oracle.jvmci.code.TypeCheckHints;
+import com.oracle.jvmci.meta.TriState;
+import com.oracle.jvmci.meta.DeoptimizationReason;
+import com.oracle.jvmci.meta.Assumptions;
+import com.oracle.jvmci.meta.DeoptimizationAction;
+import com.oracle.jvmci.meta.Kind;
+import static com.oracle.jvmci.meta.DeoptimizationAction.*;
+import static com.oracle.jvmci.meta.DeoptimizationReason.*;
 import static com.oracle.graal.hotspot.replacements.HotSpotReplacementsUtil.*;
 import static com.oracle.graal.hotspot.replacements.InstanceOfSnippets.Options.*;
 import static com.oracle.graal.hotspot.replacements.TypeCheckSnippetUtils.*;
 import static com.oracle.graal.nodes.extended.BranchProbabilityNode.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.hotspot.meta.*;
 import com.oracle.graal.hotspot.nodes.*;
@@ -42,13 +46,15 @@
 import com.oracle.graal.nodes.extended.*;
 import com.oracle.graal.nodes.java.*;
 import com.oracle.graal.nodes.spi.*;
-import com.oracle.graal.options.*;
 import com.oracle.graal.replacements.*;
 import com.oracle.graal.replacements.Snippet.ConstantParameter;
 import com.oracle.graal.replacements.Snippet.VarargsParameter;
 import com.oracle.graal.replacements.SnippetTemplate.Arguments;
 import com.oracle.graal.replacements.SnippetTemplate.SnippetInfo;
 import com.oracle.graal.replacements.nodes.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.hotspot.*;
+import com.oracle.jvmci.options.*;
 
 /**
  * Snippets used for implementing the type test of an instanceof instruction. Since instanceof is a
@@ -295,7 +301,7 @@
                 args.add("falseValue", replacer.falseValue);
                 return args;
             } else {
-                throw GraalInternalError.shouldNotReachHere();
+                throw JVMCIError.shouldNotReachHere();
             }
         }
     }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/KlassLayoutHelperNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/KlassLayoutHelperNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,16 +22,17 @@
  */
 package com.oracle.graal.hotspot.replacements;
 
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.meta.ResolvedJavaType;
+import com.oracle.jvmci.meta.Constant;
+import com.oracle.jvmci.meta.Kind;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
-import com.oracle.graal.hotspot.*;
-import com.oracle.graal.hotspot.meta.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.extended.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.hotspot.*;
 
 /**
  * Read {@code Klass::_layout_helper} and incorporate any useful stamp information based on any type
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/LoadExceptionObjectSnippets.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/LoadExceptionObjectSnippets.java	Thu May 28 21:11:28 2015 -0700
@@ -27,7 +27,6 @@
 import static com.oracle.graal.nodes.PiNode.*;
 import static com.oracle.graal.replacements.SnippetTemplate.*;
 
-import com.oracle.graal.api.code.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.hotspot.meta.*;
 import com.oracle.graal.nodes.*;
@@ -41,6 +40,7 @@
 import com.oracle.graal.replacements.SnippetTemplate.SnippetInfo;
 import com.oracle.graal.replacements.nodes.*;
 import com.oracle.graal.word.*;
+import com.oracle.jvmci.code.*;
 
 /**
  * Snippet for loading the exception object at the start of an exception dispatcher.
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/MonitorSnippets.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/MonitorSnippets.java	Thu May 28 21:11:28 2015 -0700
@@ -22,6 +22,17 @@
  */
 package com.oracle.graal.hotspot.replacements;
 
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.code.TargetDescription;
+import com.oracle.jvmci.code.BytecodeFrame;
+import com.oracle.jvmci.meta.NamedLocationIdentity;
+import com.oracle.jvmci.meta.JavaType;
+import com.oracle.jvmci.meta.DeoptimizationReason;
+import com.oracle.jvmci.meta.ResolvedJavaType;
+import com.oracle.jvmci.meta.LocationIdentity;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
+import com.oracle.jvmci.meta.DeoptimizationAction;
+import com.oracle.jvmci.meta.ForeignCallDescriptor;
 import static com.oracle.graal.hotspot.nodes.BeginLockScopeNode.*;
 import static com.oracle.graal.hotspot.nodes.DirectCompareAndSwapNode.*;
 import static com.oracle.graal.hotspot.nodes.EndLockScopeNode.*;
@@ -32,8 +43,6 @@
 
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.api.replacements.*;
 import com.oracle.graal.graph.Node.ConstantNodeParameter;
 import com.oracle.graal.graph.Node.NodeIntrinsic;
@@ -48,7 +57,6 @@
 import com.oracle.graal.nodes.java.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.type.*;
-import com.oracle.graal.options.*;
 import com.oracle.graal.phases.common.inlining.*;
 import com.oracle.graal.replacements.*;
 import com.oracle.graal.replacements.Snippet.ConstantParameter;
@@ -56,6 +64,7 @@
 import com.oracle.graal.replacements.SnippetTemplate.Arguments;
 import com.oracle.graal.replacements.SnippetTemplate.SnippetInfo;
 import com.oracle.graal.word.*;
+import com.oracle.jvmci.options.*;
 
 /**
  * Snippets used for implementing the monitorenter and monitorexit instructions.
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/NewObjectSnippets.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/NewObjectSnippets.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,15 @@
  */
 package com.oracle.graal.hotspot.replacements;
 
-import static com.oracle.graal.api.code.UnsignedMath.*;
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.code.CodeUtil;
+import com.oracle.jvmci.code.TargetDescription;
+import com.oracle.jvmci.meta.NamedLocationIdentity;
+import com.oracle.jvmci.meta.ResolvedJavaType;
+import com.oracle.jvmci.meta.LocationIdentity;
+import com.oracle.jvmci.meta.ForeignCallDescriptor;
+import com.oracle.jvmci.meta.Kind;
+import static com.oracle.jvmci.code.UnsignedMath.*;
 import static com.oracle.graal.compiler.common.GraalOptions.*;
 import static com.oracle.graal.hotspot.nodes.CStringNode.*;
 import static com.oracle.graal.hotspot.replacements.HotSpotReplacementsUtil.*;
@@ -31,13 +39,10 @@
 import static com.oracle.graal.nodes.extended.BranchProbabilityNode.*;
 import static com.oracle.graal.replacements.SnippetTemplate.*;
 import static com.oracle.graal.replacements.nodes.ExplodeLoopNode.*;
+import static com.oracle.jvmci.hotspot.HotSpotMetaAccessProvider.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.api.replacements.*;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.type.*;
-import com.oracle.graal.debug.*;
 import com.oracle.graal.graph.Node.ConstantNodeParameter;
 import com.oracle.graal.graph.Node.NodeIntrinsic;
 import com.oracle.graal.hotspot.*;
@@ -51,7 +56,6 @@
 import com.oracle.graal.nodes.java.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.util.*;
-import com.oracle.graal.options.*;
 import com.oracle.graal.replacements.*;
 import com.oracle.graal.replacements.Snippet.ConstantParameter;
 import com.oracle.graal.replacements.Snippet.VarargsParameter;
@@ -60,6 +64,10 @@
 import com.oracle.graal.replacements.SnippetTemplate.SnippetInfo;
 import com.oracle.graal.replacements.nodes.*;
 import com.oracle.graal.word.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.hotspot.*;
+import com.oracle.jvmci.options.*;
 
 /**
  * Snippets used for implementing NEW, ANEWARRAY and NEWARRAY.
@@ -99,7 +107,7 @@
             case Total:
                 return "bytes";
             default:
-                throw GraalInternalError.shouldNotReachHere();
+                throw JVMCIError.shouldNotReachHere();
         }
     }
 
@@ -260,22 +268,6 @@
     }
 
     /**
-     * Computes the size of the memory chunk allocated for an array. This size accounts for the
-     * array header size, body size and any padding after the last element to satisfy object
-     * alignment requirements.
-     *
-     * @param length the number of elements in the array
-     * @param alignment the object alignment requirement
-     * @param headerSize the size of the array header
-     * @param log2ElementSize log2 of the size of an element in the array
-     */
-    public static int computeArrayAllocationSize(int length, int alignment, int headerSize, int log2ElementSize) {
-        int size = (length << log2ElementSize) + headerSize + (alignment - 1);
-        int mask = ~(alignment - 1);
-        return size & mask;
-    }
-
-    /**
      * Calls the runtime stub for implementing MULTIANEWARRAY.
      */
     @Snippet
@@ -446,7 +438,7 @@
             HotSpotResolvedObjectType arrayType = (HotSpotResolvedObjectType) elementType.getArrayClass();
             Kind elementKind = elementType.getKind();
             ConstantNode hub = ConstantNode.forConstant(KlassPointerStamp.klassNonNull(), arrayType.klass(), providers.getMetaAccess(), graph);
-            final int headerSize = runtime.getArrayBaseOffset(elementKind);
+            final int headerSize = runtime.getJVMCIRuntime().getArrayBaseOffset(elementKind);
             HotSpotLoweringProvider lowerer = (HotSpotLoweringProvider) providers.getLowerer();
             int log2ElementSize = CodeUtil.log2(lowerer.arrayScalingFactor(elementKind));
 
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ObjectCloneNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ObjectCloneNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,11 +22,13 @@
  */
 package com.oracle.graal.hotspot.replacements;
 
+import com.oracle.jvmci.meta.ResolvedJavaField;
+import com.oracle.jvmci.meta.JavaType;
+import com.oracle.jvmci.meta.Assumptions;
+import com.oracle.jvmci.meta.ResolvedJavaType;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
 import java.lang.reflect.*;
 
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.debug.*;
-import com.oracle.graal.debug.Debug.Scope;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.CallTargetNode.InvokeKind;
@@ -36,6 +38,8 @@
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.type.*;
 import com.oracle.graal.replacements.nodes.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.debug.Debug.Scope;
 
 @NodeInfo
 public final class ObjectCloneNode extends BasicObjectCloneNode implements VirtualizableAllocation, ArrayLengthProvider {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ObjectCloneSnippets.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ObjectCloneSnippets.java	Thu May 28 21:11:28 2015 -0700
@@ -22,15 +22,15 @@
  */
 package com.oracle.graal.hotspot.replacements;
 
+import com.oracle.jvmci.meta.Kind;
 import java.lang.reflect.*;
 import java.util.*;
 
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.hotspot.replacements.arraycopy.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.java.*;
 import com.oracle.graal.replacements.*;
+import com.oracle.jvmci.common.*;
 
 public class ObjectCloneSnippets implements Snippets {
 
@@ -52,7 +52,7 @@
         try {
             return ObjectCloneSnippets.class.getDeclaredMethod(name, param);
         } catch (SecurityException | NoSuchMethodException e) {
-            throw new GraalInternalError(e);
+            throw new JVMCIError(e);
         }
     }
 
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ReflectionGetCallerClassNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ReflectionGetCallerClassNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,16 +22,18 @@
  */
 package com.oracle.graal.hotspot.replacements;
 
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.common.*;
+import com.oracle.jvmci.meta.MetaAccessProvider;
+import com.oracle.jvmci.meta.JavaType;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
-import com.oracle.graal.hotspot.meta.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.CallTargetNode.InvokeKind;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.replacements.nodes.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.hotspot.*;
 
 @NodeInfo
 public final class ReflectionGetCallerClassNode extends MacroStateSplitNode implements Canonicalizable, Lowerable {
@@ -82,7 +84,7 @@
             HotSpotResolvedJavaMethod method = (HotSpotResolvedJavaMethod) state.method();
             switch (n) {
                 case 0:
-                    throw GraalInternalError.shouldNotReachHere("current frame state does not include the Reflection.getCallerClass frame");
+                    throw JVMCIError.shouldNotReachHere("current frame state does not include the Reflection.getCallerClass frame");
                 case 1:
                     // Frame 0 and 1 must be caller sensitive (see JVM_GetCallerClass).
                     if (!method.isCallerSensitive()) {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/SystemSubstitutions.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/SystemSubstitutions.java	Thu May 28 21:11:28 2015 -0700
@@ -25,8 +25,8 @@
 import static com.oracle.graal.hotspot.replacements.HotSpotReplacementsUtil.*;
 import static com.oracle.graal.nodes.extended.BranchProbabilityNode.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.api.replacements.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * Substitutions for {@link java.lang.System} methods.
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ThreadSubstitutions.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ThreadSubstitutions.java	Thu May 28 21:11:28 2015 -0700
@@ -22,16 +22,16 @@
  */
 package com.oracle.graal.hotspot.replacements;
 
-import static com.oracle.graal.api.meta.LocationIdentity.*;
 import static com.oracle.graal.hotspot.replacements.HotSpotReplacementsUtil.*;
+import static com.oracle.jvmci.meta.LocationIdentity.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.api.replacements.*;
 import com.oracle.graal.graph.Node.ConstantNodeParameter;
 import com.oracle.graal.graph.Node.NodeIntrinsic;
 import com.oracle.graal.hotspot.nodes.*;
 import com.oracle.graal.nodes.extended.*;
 import com.oracle.graal.word.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * Substitutions for {@link java.lang.Thread} methods.
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/TypeCheckSnippetUtils.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/TypeCheckSnippetUtils.java	Thu May 28 21:11:28 2015 -0700
@@ -22,20 +22,20 @@
  */
 package com.oracle.graal.hotspot.replacements;
 
+import com.oracle.jvmci.code.TypeCheckHints;
+import com.oracle.jvmci.meta.MetaAccessProvider;
 import static com.oracle.graal.compiler.common.GraalOptions.*;
 import static com.oracle.graal.hotspot.replacements.HotSpotReplacementsUtil.*;
 import static com.oracle.graal.nodes.extended.BranchProbabilityNode.*;
 
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.hotspot.meta.*;
 import com.oracle.graal.hotspot.nodes.type.*;
 import com.oracle.graal.hotspot.word.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.replacements.*;
 import com.oracle.graal.word.*;
+import com.oracle.jvmci.hotspot.*;
 
 //JaCoCo Exclude
 
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/UnsafeLoadSnippets.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/UnsafeLoadSnippets.java	Thu May 28 21:11:28 2015 -0700
@@ -22,13 +22,13 @@
  */
 package com.oracle.graal.hotspot.replacements;
 
+import com.oracle.jvmci.code.TargetDescription;
 import static com.oracle.graal.hotspot.replacements.HotSpotReplacementsUtil.*;
 import static com.oracle.graal.replacements.SnippetTemplate.*;
 
-import com.oracle.graal.api.code.*;
 import com.oracle.graal.hotspot.meta.*;
 import com.oracle.graal.nodes.extended.*;
-import com.oracle.graal.nodes.memory.HeapAccess.*;
+import com.oracle.graal.nodes.memory.HeapAccess.BarrierType;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.replacements.*;
 import com.oracle.graal.replacements.SnippetTemplate.AbstractTemplates;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/WriteBarrierSnippets.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/WriteBarrierSnippets.java	Thu May 28 21:11:28 2015 -0700
@@ -22,24 +22,27 @@
  */
 package com.oracle.graal.hotspot.replacements;
 
-import static com.oracle.graal.api.code.MemoryBarriers.*;
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.code.TargetDescription;
+import com.oracle.jvmci.meta.NamedLocationIdentity;
+import com.oracle.jvmci.meta.LocationIdentity;
+import com.oracle.jvmci.meta.ForeignCallDescriptor;
+import com.oracle.jvmci.meta.Kind;
+import static com.oracle.jvmci.code.MemoryBarriers.*;
 import static com.oracle.graal.compiler.common.GraalOptions.*;
 import static com.oracle.graal.hotspot.replacements.HotSpotReplacementsUtil.*;
 import static com.oracle.graal.nodes.extended.BranchProbabilityNode.*;
 import static com.oracle.graal.replacements.SnippetTemplate.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.graph.Node.ConstantNodeParameter;
 import com.oracle.graal.graph.Node.NodeIntrinsic;
-import com.oracle.graal.hotspot.HotSpotVMConfig.CompressEncoding;
 import com.oracle.graal.hotspot.meta.*;
 import com.oracle.graal.hotspot.nodes.*;
 import com.oracle.graal.hotspot.nodes.type.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.extended.*;
-import com.oracle.graal.nodes.memory.HeapAccess.*;
+import com.oracle.graal.nodes.memory.HeapAccess.BarrierType;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.replacements.*;
 import com.oracle.graal.replacements.Snippet.ConstantParameter;
@@ -48,6 +51,7 @@
 import com.oracle.graal.replacements.SnippetTemplate.SnippetInfo;
 import com.oracle.graal.replacements.nodes.*;
 import com.oracle.graal.word.*;
+import com.oracle.jvmci.hotspot.HotSpotVMConfig.CompressEncoding;
 
 public class WriteBarrierSnippets implements Snippets {
 
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/arraycopy/ArrayCopyCallNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/arraycopy/ArrayCopyCallNode.java	Thu May 28 21:11:28 2015 -0700
@@ -23,7 +23,12 @@
 //JaCoCo Exclude
 package com.oracle.graal.hotspot.replacements.arraycopy;
 
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.meta.NamedLocationIdentity;
+import com.oracle.jvmci.meta.JavaConstant;
+import com.oracle.jvmci.meta.PrimitiveConstant;
+import com.oracle.jvmci.meta.LocationIdentity;
+import com.oracle.jvmci.meta.ForeignCallDescriptor;
+import com.oracle.jvmci.meta.Kind;
 import com.oracle.graal.api.runtime.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
@@ -38,6 +43,7 @@
 import com.oracle.graal.nodes.memory.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.runtime.*;
+import com.oracle.jvmci.hotspot.*;
 
 @NodeInfo(allowedUsageTypes = {InputType.Memory})
 public final class ArrayCopyCallNode extends AbstractMemoryCheckpoint implements Lowerable, MemoryCheckpoint.Single, MemoryAccess, Canonicalizable {
@@ -117,7 +123,8 @@
     private ValueNode computeBase(ValueNode base, ValueNode pos) {
         FixedWithNextNode basePtr = graph().add(new GetObjectAddressNode(base));
         graph().addBeforeFixed(this, basePtr);
-        ValueNode loc = graph().unique(new IndexedLocationNode(getLocationIdentity(), runtime.getArrayBaseOffset(elementKind), pos, runtime.getArrayIndexScale(elementKind)));
+        ValueNode loc = graph().unique(
+                        new IndexedLocationNode(getLocationIdentity(), runtime.getJVMCIRuntime().getArrayBaseOffset(elementKind), pos, runtime.getJVMCIRuntime().getArrayIndexScale(elementKind)));
         return graph().unique(new ComputeAddressNode(basePtr, loc, StampFactory.forKind(Kind.Long)));
     }
 
@@ -192,7 +199,8 @@
     }
 
     boolean isHeapWordAligned(JavaConstant value, Kind kind) {
-        return (runtime.getArrayBaseOffset(kind) + (long) value.asInt() * runtime.getArrayIndexScale(kind)) % runtime.getConfig().heapWordSize == 0;
+        HotSpotJVMCIRuntimeProvider jvmciRuntime = runtime.getJVMCIRuntime();
+        return (jvmciRuntime.getArrayBaseOffset(kind) + (long) value.asInt() * jvmciRuntime.getArrayIndexScale(kind)) % runtime.getConfig().heapWordSize == 0;
     }
 
     public void updateAlignedDisjoint() {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/arraycopy/ArrayCopyNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/arraycopy/ArrayCopyNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,9 +22,10 @@
  */
 package com.oracle.graal.hotspot.replacements.arraycopy;
 
-import static com.oracle.graal.api.meta.LocationIdentity.*;
-
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.meta.NamedLocationIdentity;
+import com.oracle.jvmci.meta.LocationIdentity;
+import com.oracle.jvmci.meta.Kind;
+import static com.oracle.jvmci.meta.LocationIdentity.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/arraycopy/ArrayCopySlowPathNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/arraycopy/ArrayCopySlowPathNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,10 +22,12 @@
  */
 package com.oracle.graal.hotspot.replacements.arraycopy;
 
-import static com.oracle.graal.api.meta.LocationIdentity.*;
+import com.oracle.jvmci.code.BytecodeFrame;
+import com.oracle.jvmci.meta.NamedLocationIdentity;
+import com.oracle.jvmci.meta.LocationIdentity;
+import com.oracle.jvmci.meta.Kind;
+import static com.oracle.jvmci.meta.LocationIdentity.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/arraycopy/ArrayCopySnippets.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/arraycopy/ArrayCopySnippets.java	Thu May 28 21:11:28 2015 -0700
@@ -22,6 +22,14 @@
  */
 package com.oracle.graal.hotspot.replacements.arraycopy;
 
+import com.oracle.jvmci.code.TargetDescription;
+import com.oracle.jvmci.meta.NamedLocationIdentity;
+import com.oracle.jvmci.meta.DeoptimizationReason;
+import com.oracle.jvmci.meta.ResolvedJavaType;
+import com.oracle.jvmci.meta.LocationIdentity;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
+import com.oracle.jvmci.meta.DeoptimizationAction;
+import com.oracle.jvmci.meta.Kind;
 import static com.oracle.graal.compiler.common.GraalOptions.*;
 import static com.oracle.graal.hotspot.replacements.HotSpotReplacementsUtil.*;
 import static com.oracle.graal.nodes.GuardingPiNode.*;
@@ -30,12 +38,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.replacements.*;
-import com.oracle.graal.compiler.common.*;
-import com.oracle.graal.debug.*;
-import com.oracle.graal.debug.Debug.Scope;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.hotspot.meta.*;
 import com.oracle.graal.hotspot.nodes.type.*;
@@ -54,6 +57,10 @@
 import com.oracle.graal.replacements.SnippetTemplate.SnippetInfo;
 import com.oracle.graal.replacements.nodes.*;
 import com.oracle.graal.word.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.debug.Debug.Scope;
+import com.oracle.jvmci.hotspot.*;
 
 public class ArrayCopySnippets implements Snippets {
 
@@ -306,13 +313,13 @@
             super(providers, providers.getSnippetReflection(), target);
         }
 
-        private ResolvedJavaMethod originalArraycopy() throws GraalInternalError {
+        private ResolvedJavaMethod originalArraycopy() throws JVMCIError {
             if (originalArraycopy == null) {
                 Method method;
                 try {
                     method = System.class.getDeclaredMethod("arraycopy", Object.class, int.class, Object.class, int.class, int.class);
                 } catch (NoSuchMethodException | SecurityException e) {
-                    throw new GraalInternalError(e);
+                    throw new JVMCIError(e);
                 }
                 originalArraycopy = providers.getMetaAccess().lookupJavaMethod(method);
             }
@@ -515,7 +522,7 @@
                     CallTargetNode call = invoke.callTarget();
 
                     if (!call.targetMethod().equals(originalArraycopy)) {
-                        throw new GraalInternalError("unexpected invoke %s in snippet", call.targetMethod());
+                        throw new JVMCIError("unexpected invoke %s in snippet", call.targetMethod());
                     }
                     // Here we need to fix the bci of the invoke
                     InvokeNode newInvoke = graph.add(new InvokeNode(invoke.callTarget(), arraycopy.getBci()));
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/arraycopy/CheckcastArrayCopyCallNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/arraycopy/CheckcastArrayCopyCallNode.java	Thu May 28 21:11:28 2015 -0700
@@ -23,7 +23,9 @@
 //JaCoCo Exclude
 package com.oracle.graal.hotspot.replacements.arraycopy;
 
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.meta.LocationIdentity;
+import com.oracle.jvmci.meta.ForeignCallDescriptor;
+import com.oracle.jvmci.meta.Kind;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.hotspot.*;
@@ -36,6 +38,7 @@
 import com.oracle.graal.nodes.memory.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.word.*;
+import com.oracle.jvmci.hotspot.*;
 
 @NodeInfo(allowedUsageTypes = {InputType.Memory, InputType.Value})
 public final class CheckcastArrayCopyCallNode extends AbstractMemoryCheckpoint implements Lowerable, MemoryCheckpoint.Single {
@@ -94,7 +97,8 @@
     private ValueNode computeBase(ValueNode base, ValueNode pos) {
         FixedWithNextNode basePtr = graph().add(new GetObjectAddressNode(base));
         graph().addBeforeFixed(this, basePtr);
-        ValueNode loc = graph().unique(new IndexedLocationNode(getLocationIdentity(), runtime.getArrayBaseOffset(Kind.Object), pos, runtime.getArrayIndexScale(Kind.Object)));
+        HotSpotJVMCIRuntimeProvider jvmciRuntime = runtime.getJVMCIRuntime();
+        ValueNode loc = graph().unique(new IndexedLocationNode(getLocationIdentity(), jvmciRuntime.getArrayBaseOffset(Kind.Object), pos, jvmciRuntime.getArrayIndexScale(Kind.Object)));
         return graph().unique(new ComputeAddressNode(basePtr, loc, StampFactory.forKind(Kind.Long)));
     }
 
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/arraycopy/UnsafeArrayCopyNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/arraycopy/UnsafeArrayCopyNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,9 +22,10 @@
  */
 package com.oracle.graal.hotspot.replacements.arraycopy;
 
-import static com.oracle.graal.api.meta.LocationIdentity.*;
-
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.meta.NamedLocationIdentity;
+import com.oracle.jvmci.meta.LocationIdentity;
+import com.oracle.jvmci.meta.Kind;
+import static com.oracle.jvmci.meta.LocationIdentity.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodeinfo.*;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/arraycopy/UnsafeArrayCopySnippets.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/arraycopy/UnsafeArrayCopySnippets.java	Thu May 28 21:11:28 2015 -0700
@@ -22,14 +22,16 @@
  */
 package com.oracle.graal.hotspot.replacements.arraycopy;
 
-import static com.oracle.graal.api.meta.LocationIdentity.*;
+import com.oracle.jvmci.code.TargetDescription;
+import com.oracle.jvmci.meta.NamedLocationIdentity;
+import com.oracle.jvmci.meta.LocationIdentity;
+import com.oracle.jvmci.meta.Kind;
+import static com.oracle.jvmci.meta.LocationIdentity.*;
 import static com.oracle.graal.hotspot.HotSpotGraalRuntime.*;
 import static com.oracle.graal.hotspot.replacements.HotSpotReplacementsUtil.*;
 import static com.oracle.graal.nodes.extended.BranchProbabilityNode.*;
 import static com.oracle.graal.replacements.SnippetTemplate.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.api.replacements.*;
 import com.oracle.graal.asm.*;
 import com.oracle.graal.hotspot.meta.*;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/DeoptimizationStub.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/DeoptimizationStub.java	Thu May 28 21:11:28 2015 -0700
@@ -22,17 +22,17 @@
  */
 package com.oracle.graal.hotspot.stubs;
 
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.code.TargetDescription;
+import com.oracle.jvmci.meta.ForeignCallDescriptor;
 import static com.oracle.graal.hotspot.HotSpotBackend.*;
 import static com.oracle.graal.hotspot.HotSpotBackend.Options.*;
 import static com.oracle.graal.hotspot.nodes.DeoptimizationFetchUnrollInfoCallNode.*;
 import static com.oracle.graal.hotspot.replacements.HotSpotReplacementsUtil.*;
 import static com.oracle.graal.hotspot.stubs.UncommonTrapStub.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.api.replacements.*;
 import com.oracle.graal.asm.*;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.graph.Node.ConstantNodeParameter;
 import com.oracle.graal.graph.Node.NodeIntrinsic;
 import com.oracle.graal.hotspot.*;
@@ -41,6 +41,8 @@
 import com.oracle.graal.replacements.*;
 import com.oracle.graal.replacements.Snippet.ConstantParameter;
 import com.oracle.graal.word.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.hotspot.*;
 
 /**
  * Deoptimization stub.
@@ -102,7 +104,7 @@
             case 1:
                 return providers.getRegisters().getStackPointerRegister();
             default:
-                throw GraalInternalError.shouldNotReachHere("unknown parameter " + name + " at index " + index);
+                throw JVMCIError.shouldNotReachHere("unknown parameter " + name + " at index " + index);
         }
     }
 
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/ExceptionHandlerStub.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/ExceptionHandlerStub.java	Thu May 28 21:11:28 2015 -0700
@@ -22,13 +22,13 @@
  */
 package com.oracle.graal.hotspot.stubs;
 
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.meta.ForeignCallDescriptor;
 import static com.oracle.graal.hotspot.nodes.JumpToExceptionHandlerNode.*;
 import static com.oracle.graal.hotspot.nodes.PatchReturnAddressNode.*;
 import static com.oracle.graal.hotspot.replacements.HotSpotReplacementsUtil.*;
 import static com.oracle.graal.hotspot.stubs.StubUtil.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.api.replacements.*;
 import com.oracle.graal.graph.Node.ConstantNodeParameter;
 import com.oracle.graal.graph.Node.NodeIntrinsic;
@@ -38,6 +38,7 @@
 import com.oracle.graal.replacements.*;
 import com.oracle.graal.replacements.Snippet.ConstantParameter;
 import com.oracle.graal.word.*;
+import com.oracle.jvmci.hotspot.*;
 
 /**
  * Stub called by the {@linkplain HotSpotVMConfig#MARKID_EXCEPTION_HANDLER_ENTRY exception handler
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/ForeignCallStub.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/ForeignCallStub.java	Thu May 28 21:11:28 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,12 +22,19 @@
  */
 package com.oracle.graal.hotspot.stubs;
 
-import static com.oracle.graal.api.code.CallingConvention.Type.*;
+import com.oracle.jvmci.meta.JavaType;
+import com.oracle.jvmci.meta.MetaAccessProvider;
+import com.oracle.jvmci.meta.ResolvedJavaType;
+import com.oracle.jvmci.meta.LocationIdentity;
+import com.oracle.jvmci.meta.JavaMethod;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
+import com.oracle.jvmci.meta.Signature;
+import com.oracle.jvmci.meta.ForeignCallDescriptor;
+import com.oracle.jvmci.meta.Kind;
+import static com.oracle.jvmci.code.CallingConvention.Type.*;
 import static com.oracle.graal.hotspot.HotSpotForeignCallLinkage.RegisterEffect.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
-import com.oracle.graal.debug.*;
 import com.oracle.graal.hotspot.*;
 import com.oracle.graal.hotspot.HotSpotForeignCallLinkage.Transition;
 import com.oracle.graal.hotspot.meta.*;
@@ -38,6 +45,8 @@
 import com.oracle.graal.replacements.*;
 import com.oracle.graal.replacements.nodes.*;
 import com.oracle.graal.word.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.hotspot.*;
 
 /**
  * A {@linkplain #getGraph() generated} stub for a {@link Transition non-leaf} foreign call from
@@ -122,7 +131,7 @@
                 for (int i = 0; i < arguments.length; i++) {
                     parameters[i] = metaAccess.lookupJavaType(arguments[i]);
                 }
-                return new HotSpotSignature(runtime, metaAccess.lookupJavaType(d.getResultType()), parameters);
+                return new HotSpotSignature(runtime.getJVMCIRuntime(), metaAccess.lookupJavaType(d.getResultType()), parameters);
             }
 
             public String getName() {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/NewArrayStub.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/NewArrayStub.java	Thu May 28 21:11:28 2015 -0700
@@ -22,13 +22,14 @@
  */
 package com.oracle.graal.hotspot.stubs;
 
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.meta.ForeignCallDescriptor;
 import static com.oracle.graal.hotspot.replacements.HotSpotReplacementsUtil.*;
 import static com.oracle.graal.hotspot.replacements.NewObjectSnippets.*;
 import static com.oracle.graal.hotspot.stubs.NewInstanceStub.*;
 import static com.oracle.graal.hotspot.stubs.StubUtil.*;
+import static com.oracle.jvmci.hotspot.HotSpotMetaAccessProvider.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.api.replacements.*;
 import com.oracle.graal.graph.Node.ConstantNodeParameter;
 import com.oracle.graal.graph.Node.NodeIntrinsic;
@@ -42,6 +43,7 @@
 import com.oracle.graal.replacements.*;
 import com.oracle.graal.replacements.Snippet.ConstantParameter;
 import com.oracle.graal.word.*;
+import com.oracle.jvmci.hotspot.*;
 
 /**
  * Stub implementing the fast path for TLAB refill during instance class allocation. This stub is
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/NewInstanceStub.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/NewInstanceStub.java	Thu May 28 21:11:28 2015 -0700
@@ -22,13 +22,14 @@
  */
 package com.oracle.graal.hotspot.stubs;
 
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.meta.ForeignCallDescriptor;
+import com.oracle.jvmci.meta.Kind;
 import static com.oracle.graal.hotspot.nodes.DirectCompareAndSwapNode.*;
 import static com.oracle.graal.hotspot.replacements.HotSpotReplacementsUtil.*;
 import static com.oracle.graal.hotspot.stubs.StubUtil.*;
 import static com.oracle.graal.nodes.extended.BranchProbabilityNode.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.api.replacements.*;
 import com.oracle.graal.graph.Node.ConstantNodeParameter;
 import com.oracle.graal.graph.Node.NodeIntrinsic;
@@ -42,6 +43,7 @@
 import com.oracle.graal.replacements.*;
 import com.oracle.graal.replacements.Snippet.ConstantParameter;
 import com.oracle.graal.word.*;
+import com.oracle.jvmci.hotspot.*;
 
 /**
  * Stub implementing the fast path for TLAB refill during instance class allocation. This stub is
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/SnippetStub.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/SnippetStub.java	Thu May 28 21:11:28 2015 -0700
@@ -22,14 +22,14 @@
  */
 package com.oracle.graal.hotspot.stubs;
 
+import com.oracle.jvmci.meta.MetaAccessProvider;
+import com.oracle.jvmci.meta.LocalVariableTable;
+import com.oracle.jvmci.meta.Local;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
 import static com.oracle.graal.graphbuilderconf.IntrinsicContext.CompilationContext.*;
 
 import java.lang.reflect.*;
 
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.common.*;
-import com.oracle.graal.debug.*;
-import com.oracle.graal.debug.Debug.Scope;
 import com.oracle.graal.graphbuilderconf.*;
 import com.oracle.graal.graphbuilderconf.GraphBuilderConfiguration.Plugins;
 import com.oracle.graal.hotspot.*;
@@ -44,6 +44,9 @@
 import com.oracle.graal.phases.tiers.*;
 import com.oracle.graal.replacements.*;
 import com.oracle.graal.replacements.Snippet.ConstantParameter;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.debug.Debug.Scope;
 
 /**
  * Base class for a stub defined by a snippet.
@@ -78,7 +81,14 @@
         this.method = providers.getMetaAccess().lookupJavaMethod(javaMethod);
     }
 
-    public static final ThreadLocal<StructuredGraph> SnippetGraphUnderConstruction = new ThreadLocal<>();
+    @SuppressWarnings("all")
+    private static boolean assertionsEnabled() {
+        boolean enabled = false;
+        assert enabled = true;
+        return enabled;
+    }
+
+    public static final ThreadLocal<StructuredGraph> SnippetGraphUnderConstruction = assertionsEnabled() ? new ThreadLocal<>() : null;
 
     @Override
     protected StructuredGraph getGraph() {
@@ -94,11 +104,17 @@
         final StructuredGraph graph = new StructuredGraph(method, AllowAssumptions.NO);
         graph.disableInlinedMethodRecording();
 
-        assert SnippetGraphUnderConstruction.get() == null;
-        SnippetGraphUnderConstruction.set(graph);
+        if (SnippetGraphUnderConstruction != null) {
+            assert SnippetGraphUnderConstruction.get() == null;
+            SnippetGraphUnderConstruction.set(graph);
+        }
+
         IntrinsicContext initialIntrinsicContext = new IntrinsicContext(method, method, INLINE_AFTER_PARSING);
         new GraphBuilderPhase.Instance(metaAccess, providers.getStampProvider(), providers.getConstantReflection(), config, OptimisticOptimizations.NONE, initialIntrinsicContext).apply(graph);
-        SnippetGraphUnderConstruction.set(null);
+
+        if (SnippetGraphUnderConstruction != null) {
+            SnippetGraphUnderConstruction.set(null);
+        }
 
         graph.setGuardsStage(GuardsStage.FLOATING_GUARDS);
         try (Scope s = Debug.scope("LoweringStub", graph)) {
@@ -134,7 +150,7 @@
     }
 
     protected Object getConstantParameterValue(int index, String name) {
-        throw new GraalInternalError("%s must override getConstantParameterValue() to provide a value for parameter %d%s", getClass().getName(), index, name == null ? "" : " (" + name + ")");
+        throw new JVMCIError("%s must override getConstantParameterValue() to provide a value for parameter %d%s", getClass().getName(), index, name == null ? "" : " (" + name + ")");
     }
 
     @Override
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/Stub.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/Stub.java	Thu May 28 21:11:28 2015 -0700
@@ -22,18 +22,20 @@
  */
 package com.oracle.graal.hotspot.stubs;
 
+import com.oracle.jvmci.code.CodeCacheProvider;
+import com.oracle.jvmci.code.RegisterConfig;
+import com.oracle.jvmci.code.CompilationResult;
+import com.oracle.jvmci.code.InstalledCode;
+import com.oracle.jvmci.code.CallingConvention;
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.code.TargetDescription;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
 import static com.oracle.graal.compiler.GraalCompiler.*;
 import static com.oracle.graal.hotspot.HotSpotGraalRuntime.*;
 
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.target.*;
-import com.oracle.graal.debug.*;
-import com.oracle.graal.debug.Debug.Scope;
-import com.oracle.graal.debug.internal.*;
 import com.oracle.graal.hotspot.*;
 import com.oracle.graal.hotspot.meta.*;
 import com.oracle.graal.hotspot.nodes.*;
@@ -45,6 +47,11 @@
 import com.oracle.graal.phases.*;
 import com.oracle.graal.phases.schedule.*;
 import com.oracle.graal.phases.tiers.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.debug.Debug.Scope;
+import com.oracle.jvmci.debug.internal.*;
+import com.oracle.jvmci.hotspot.*;
 
 //JaCoCo Exclude
 
@@ -191,13 +198,13 @@
                 try (Scope s = Debug.scope("CodeInstall")) {
                     Stub stub = Stub.this;
                     HotSpotRuntimeStub installedCode = new HotSpotRuntimeStub(stub);
-                    HotSpotCompiledCode hsCompResult = new HotSpotCompiledRuntimeStub(stub, compResult);
+                    HotSpotCompiledCode hsCompResult = new HotSpotCompiledRuntimeStub(compResult);
 
                     HotSpotGraalRuntime runtime = runtime();
                     int result = runtime.getCompilerToVM().installCode(hsCompResult, installedCode, null);
                     HotSpotVMConfig config = runtime.getConfig();
                     if (result != config.codeInstallResultOk) {
-                        throw new GraalInternalError("Error installing stub %s: %s", Stub.this, config.getCodeInstallResultDescription(result));
+                        throw new JVMCIError("Error installing stub %s: %s", Stub.this, config.getCodeInstallResultDescription(result));
                     }
                     ((HotSpotCodeCacheProvider) codeCache).logOrDump(installedCode, compResult);
                     code = installedCode;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/StubUtil.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/StubUtil.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,9 @@
  */
 package com.oracle.graal.hotspot.stubs;
 
-import static com.oracle.graal.api.meta.DeoptimizationReason.*;
+import com.oracle.jvmci.meta.DeoptimizationAction;
+import com.oracle.jvmci.meta.ForeignCallDescriptor;
+import static com.oracle.jvmci.meta.DeoptimizationReason.*;
 import static com.oracle.graal.hotspot.HotSpotGraalRuntime.*;
 import static com.oracle.graal.hotspot.nodes.CStringNode.*;
 import static com.oracle.graal.hotspot.replacements.HotSpotReplacementsUtil.*;
@@ -31,7 +33,6 @@
 import java.lang.reflect.*;
 import java.util.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.api.replacements.*;
 import com.oracle.graal.graph.Node.ConstantNodeParameter;
 import com.oracle.graal.graph.Node.NodeIntrinsic;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/UncommonTrapStub.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/UncommonTrapStub.java	Thu May 28 21:11:28 2015 -0700
@@ -22,15 +22,17 @@
  */
 package com.oracle.graal.hotspot.stubs;
 
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.code.TargetDescription;
+import com.oracle.jvmci.meta.NamedLocationIdentity;
+import com.oracle.jvmci.meta.LocationIdentity;
+import com.oracle.jvmci.meta.ForeignCallDescriptor;
 import static com.oracle.graal.hotspot.HotSpotBackend.*;
 import static com.oracle.graal.hotspot.HotSpotBackend.Options.*;
 import static com.oracle.graal.hotspot.replacements.HotSpotReplacementsUtil.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.api.replacements.*;
 import com.oracle.graal.asm.*;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.graph.Node.ConstantNodeParameter;
 import com.oracle.graal.graph.Node.NodeIntrinsic;
 import com.oracle.graal.hotspot.*;
@@ -39,6 +41,7 @@
 import com.oracle.graal.replacements.*;
 import com.oracle.graal.replacements.Snippet.ConstantParameter;
 import com.oracle.graal.word.*;
+import com.oracle.jvmci.common.*;
 
 /**
  * Uncommon trap stub.
@@ -102,7 +105,7 @@
             case 1:
                 return providers.getRegisters().getStackPointerRegister();
             default:
-                throw GraalInternalError.shouldNotReachHere("unknown parameter " + name + " at index " + index);
+                throw JVMCIError.shouldNotReachHere("unknown parameter " + name + " at index " + index);
         }
     }
 
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/UnwindExceptionToCallerStub.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/UnwindExceptionToCallerStub.java	Thu May 28 21:11:28 2015 -0700
@@ -22,13 +22,13 @@
  */
 package com.oracle.graal.hotspot.stubs;
 
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.meta.ForeignCallDescriptor;
 import static com.oracle.graal.hotspot.nodes.JumpToExceptionHandlerInCallerNode.*;
 import static com.oracle.graal.hotspot.replacements.HotSpotReplacementsUtil.*;
 import static com.oracle.graal.hotspot.stubs.ExceptionHandlerStub.*;
 import static com.oracle.graal.hotspot.stubs.StubUtil.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.api.replacements.*;
 import com.oracle.graal.graph.Node.ConstantNodeParameter;
 import com.oracle.graal.graph.Node.NodeIntrinsic;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/word/HotSpotWordTypes.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/word/HotSpotWordTypes.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,10 @@
  */
 package com.oracle.graal.hotspot.word;
 
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.meta.JavaType;
+import com.oracle.jvmci.meta.MetaAccessProvider;
+import com.oracle.jvmci.meta.ResolvedJavaType;
+import com.oracle.jvmci.meta.Kind;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.hotspot.nodes.type.*;
 import com.oracle.graal.word.*;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/word/KlassPointer.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/word/KlassPointer.java	Thu May 28 21:11:28 2015 -0700
@@ -22,9 +22,9 @@
  */
 package com.oracle.graal.hotspot.word;
 
+import com.oracle.jvmci.meta.LocationIdentity;
 import static com.oracle.graal.hotspot.word.HotSpotOperation.HotspotOpcode.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.word.*;
 import com.oracle.graal.word.Word.Opcode;
 import com.oracle.graal.word.Word.Operation;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/word/MetaspacePointer.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/word/MetaspacePointer.java	Thu May 28 21:11:28 2015 -0700
@@ -22,11 +22,11 @@
  */
 package com.oracle.graal.hotspot.word;
 
+import com.oracle.jvmci.meta.LocationIdentity;
 import static com.oracle.graal.hotspot.word.HotSpotOperation.HotspotOpcode.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.nodes.extended.*;
-import com.oracle.graal.nodes.memory.HeapAccess.*;
+import com.oracle.graal.nodes.memory.HeapAccess.BarrierType;
 import com.oracle.graal.word.*;
 import com.oracle.graal.word.Word.Opcode;
 import com.oracle.graal.word.Word.Operation;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/word/PointerCastNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/word/PointerCastNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,7 @@
  */
 package com.oracle.graal.hotspot.word;
 
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.meta.Value;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.hotspot.word.HotSpotOperation.HotspotOpcode;
--- a/graal/com.oracle.graal.hotspotvmconfig.processor/src/META-INF/services/javax.annotation.processing.Processor	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-com.oracle.graal.hotspotvmconfig.processor.HotSpotVMConfigProcessor
--- a/graal/com.oracle.graal.hotspotvmconfig.processor/src/com/oracle/graal/hotspotvmconfig/processor/HotSpotVMConfigProcessor.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,424 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.hotspotvmconfig.processor;
-
-import java.io.*;
-import java.lang.annotation.*;
-import java.util.*;
-import java.util.Map.Entry;
-import java.util.function.*;
-
-import javax.annotation.processing.*;
-import javax.lang.model.*;
-import javax.lang.model.element.*;
-import javax.tools.Diagnostic.Kind;
-import javax.tools.*;
-
-import com.oracle.graal.compiler.common.*;
-import com.oracle.graal.hotspotvmconfig.*;
-
-@SupportedAnnotationTypes({"com.oracle.graal.hotspotvmconfig.HotSpotVMConstant", "com.oracle.graal.hotspotvmconfig.HotSpotVMFlag", "com.oracle.graal.hotspotvmconfig.HotSpotVMField",
-                "com.oracle.graal.hotspotvmconfig.HotSpotVMType", "com.oracle.graal.hotspotvmconfig.HotSpotVMValue"})
-public class HotSpotVMConfigProcessor extends AbstractProcessor {
-
-    public HotSpotVMConfigProcessor() {
-    }
-
-    @Override
-    public SourceVersion getSupportedSourceVersion() {
-        return SourceVersion.latest();
-    }
-
-    /**
-     * Set to true to enable logging to a local file during annotation processing. There's no normal
-     * channel for any debug messages and debugging annotation processors requires some special
-     * setup.
-     */
-    private static final boolean DEBUG = false;
-
-    private PrintWriter log;
-
-    /**
-     * Logging facility for debugging the annotation processor.
-     */
-
-    private PrintWriter getLog() {
-        if (log == null) {
-            try {
-                // Create the log file within the generated source directory so it's easy to find.
-                // /tmp isn't platform independent and java.io.tmpdir can map anywhere, particularly
-                // on the mac.
-                FileObject file = processingEnv.getFiler().createResource(StandardLocation.SOURCE_OUTPUT, "", getClass().getSimpleName() + "log");
-                log = new PrintWriter(new FileWriter(file.toUri().getPath(), true));
-            } catch (IOException e) {
-                // Do nothing
-            }
-        }
-        return log;
-    }
-
-    private void logMessage(String format, Object... args) {
-        if (!DEBUG) {
-            return;
-        }
-        PrintWriter bw = getLog();
-        if (bw != null) {
-            bw.printf(format, args);
-            bw.flush();
-        }
-    }
-
-    private void logException(Throwable t) {
-        if (!DEBUG) {
-            return;
-        }
-        PrintWriter bw = getLog();
-        if (bw != null) {
-            t.printStackTrace(bw);
-            bw.flush();
-        }
-    }
-
-    /**
-     * Bugs in an annotation processor can cause silent failure so try to report any exception
-     * throws as errors.
-     */
-    private void reportExceptionThrow(Element element, Throwable t) {
-        if (element != null) {
-            logMessage("throw for %s:\n", element);
-        }
-        logException(t);
-        errorMessage(element, "Exception throw during processing: %s %s", t, Arrays.toString(Arrays.copyOf(t.getStackTrace(), 4)));
-    }
-
-    //@formatter:off
-    String[] prologue = new String[]{
-        "// The normal wrappers CommandLineFlags::boolAt and CommandLineFlags::intxAt skip constant flags",
-        "static bool boolAt(char* name, bool* value) {",
-        "  Flag* result = Flag::find_flag(name, strlen(name), true, true);",
-        "  if (result == NULL) return false;",
-        "  if (!result->is_bool()) return false;",
-        "  *value = result->get_bool();",
-        "  return true;",
-        "}",
-        "",
-        "static bool intxAt(char* name, intx* value) {",
-        "  Flag* result = Flag::find_flag(name, strlen(name), true, true);",
-        "  if (result == NULL) return false;",
-        "  if (!result->is_intx()) return false;",
-        "  *value = result->get_intx();",
-        "  return true;",
-        "}",
-        "",
-        "#define set_boolean(name, value) vmconfig_oop->bool_field_put(fs.offset(), value)",
-        "#define set_byte(name, value) vmconfig_oop->byte_field_put(fs.offset(), (jbyte)(value))",
-        "#define set_short(name, value) vmconfig_oop->short_field_put(fs.offset(), (jshort)(value))",
-        "#define set_int(name, value) vmconfig_oop->int_field_put(fs.offset(), (int)(value))",
-        "#define set_long(name, value) vmconfig_oop->long_field_put(fs.offset(), value)",
-        "#define set_address(name, value) do { set_long(name, (jlong)(value)); } while (0)",
-        "",
-        "#define set_optional_boolean_flag(varName, flagName) do { bool flagValue; if (boolAt((char*) flagName, &flagValue)) { set_boolean(varName, flagValue); } } while (0)",
-        "#define set_optional_int_flag(varName, flagName) do { intx flagValue; if (intxAt((char*) flagName, &flagValue)) { set_int(varName, flagValue); } } while (0)",
-        "#define set_optional_long_flag(varName, flagName) do { intx flagValue; if (intxAt((char*) flagName, &flagValue)) { set_long(varName, flagValue); } } while (0)",
-        "",
-        "void VMStructs::initHotSpotVMConfig(oop vmconfig_oop) {",
-        "  InstanceKlass* vmconfig_klass = InstanceKlass::cast(vmconfig_oop->klass());",
-        "",
-    };
-    //@formatter:on
-
-    String outputName = "HotSpotVMConfig.inline.hpp";
-    String outputDirectory = "hotspot";
-
-    private void createFiles(Map<String, VMConfigField> annotations, Element element) {
-
-        Filer filer = processingEnv.getFiler();
-        try (PrintWriter out = createSourceFile(outputDirectory, outputName, filer, element)) {
-
-            for (String line : prologue) {
-                out.println(line);
-            }
-
-            Map<String, Integer> expectedValues = new HashMap<>();
-            for (VMConfigField value : annotations.values()) {
-                if (!value.optional) {
-                    String key = value.define != null ? value.define : "";
-                    if (expectedValues.get(key) == null) {
-                        expectedValues.put(key, 1);
-                    } else {
-                        expectedValues.put(key, expectedValues.get(key) + 1);
-                    }
-                }
-            }
-
-            out.printf("  int expected = %s;%n", expectedValues.get(""));
-            for (Entry<String, Integer> entry : expectedValues.entrySet()) {
-                if (entry.getKey().equals("")) {
-                    continue;
-                }
-                out.printf("#if %s%n", entry.getKey());
-                out.printf("  expected += %s;%n", entry.getValue());
-                out.printf("#endif%n");
-            }
-            out.println("  int assigned = 0;");
-            out.println("  for (JavaFieldStream fs(vmconfig_klass); !fs.done(); fs.next()) {");
-
-            Set<String> fieldTypes = new HashSet<>();
-            for (VMConfigField key : annotations.values()) {
-                fieldTypes.add(key.getType());
-            }
-            // For each type of field, generate a switch on the length of the symbol and then do a
-            // direct compare. In general this reduces each operation to 2 tests plus a string
-            // compare. Being more perfect than that is probably not worth it.
-            for (String type : fieldTypes) {
-                String sigtype = type.equals("boolean") ? "bool" : type;
-                out.println("    if (fs.signature() == vmSymbols::" + sigtype + "_signature()) {");
-                Set<Integer> lengths = new HashSet<>();
-                for (Entry<String, VMConfigField> entry : annotations.entrySet()) {
-                    if (entry.getValue().getType().equals(type)) {
-                        lengths.add(entry.getKey().length());
-                    }
-                }
-                out.println("      switch (fs.name()->utf8_length()) {");
-                for (int len : lengths) {
-                    out.println("        case " + len + ":");
-                    for (Entry<String, VMConfigField> entry : annotations.entrySet()) {
-                        if (entry.getValue().getType().equals(type) && entry.getKey().length() == len) {
-                            out.println("          if (fs.name()->equals(\"" + entry.getKey() + "\")) {");
-                            entry.getValue().emit(out);
-                            out.println("            continue;");
-                            out.println("          }");
-                        }
-                    }
-                    out.println("          continue;");
-                }
-                out.println("      } // switch");
-                out.println("      continue;");
-                out.println("    } // if");
-            }
-            out.println("  } // for");
-            out.println("  guarantee(assigned == expected, \"Didn't find all fields during init of HotSpotVMConfig.  Maybe recompile?\");");
-            out.println("}");
-        }
-    }
-
-    protected PrintWriter createSourceFile(String pkg, String relativeName, Filer filer, Element... originatingElements) {
-        try {
-            // Ensure Unix line endings to comply with Graal code style guide checked by Checkstyle
-            FileObject sourceFile = filer.createResource(StandardLocation.SOURCE_OUTPUT, pkg, relativeName, originatingElements);
-            logMessage("%s\n", sourceFile);
-            return new PrintWriter(sourceFile.openWriter()) {
-
-                @Override
-                public void println() {
-                    print("\n");
-                }
-            };
-        } catch (IOException e) {
-            throw new RuntimeException(e);
-        }
-    }
-
-    static class VMConfigField {
-        final String setter;
-        final String define;
-        private boolean optional;
-        final VariableElement field;
-
-        public VMConfigField(VariableElement field, HotSpotVMField value) {
-            this.field = field;
-            define = archDefines(value.archs());
-            String type = field.asType().toString();
-            String name = value.name();
-            int i = name.lastIndexOf("::");
-            switch (value.get()) {
-                case OFFSET:
-                    setter = String.format("set_%s(\"%s\", offset_of(%s, %s));", type, field.getSimpleName(), name.substring(0, i), name.substring(i + 2));
-                    break;
-                case ADDRESS:
-                    setter = String.format("set_address(\"%s\", &%s);", field.getSimpleName(), name);
-                    break;
-                case VALUE:
-                    setter = String.format("set_%s(\"%s\", (%s) (intptr_t) %s);", type, field.getSimpleName(), type, name);
-                    break;
-                default:
-                    throw new GraalInternalError("unexpected type: " + value.get());
-            }
-        }
-
-        public VMConfigField(VariableElement field, HotSpotVMType value) {
-            this.field = field;
-            define = null; // ((HotSpotVMType) annotation).archs();
-            String type = field.asType().toString();
-            setter = String.format("set_%s(\"%s\", sizeof(%s));", type, field.getSimpleName(), value.name());
-        }
-
-        public VMConfigField(VariableElement field, HotSpotVMValue value) {
-            this.field = field;
-            String[] defines = value.defines();
-            int length = defines.length;
-            if (length != 0) {
-                for (int i = 0; i < length; i++) {
-                    defines[i] = "defined(" + defines[i] + ")";
-                }
-                define = String.join(" || ", defines);
-            } else {
-                define = null; // ((HotSpotVMValue) annotation).archs();
-            }
-            String type = field.asType().toString();
-            if (value.get() == HotSpotVMValue.Type.ADDRESS) {
-                setter = String.format("set_address(\"%s\", %s);", field.getSimpleName(), value.expression());
-            } else {
-                setter = String.format("set_%s(\"%s\", %s);", type, field.getSimpleName(), value.expression());
-            }
-        }
-
-        public VMConfigField(VariableElement field, HotSpotVMConstant value) {
-            this.field = field;
-            define = archDefines(value.archs());
-            String type = field.asType().toString();
-            setter = String.format("set_%s(\"%s\", %s);", type, field.getSimpleName(), value.name());
-        }
-
-        public VMConfigField(VariableElement field, HotSpotVMFlag value) {
-            this.field = field;
-            define = archDefines(value.archs());
-            optional = value.optional();
-            String type = field.asType().toString();
-            if (value.optional()) {
-                setter = String.format("set_optional_%s_flag(\"%s\",  \"%s\");", type, field.getSimpleName(), value.name());
-            } else {
-                setter = String.format("set_%s(\"%s\", %s);", type, field.getSimpleName(), value.name());
-            }
-        }
-
-        public String getType() {
-            return field.asType().toString();
-        }
-
-        private static String archDefine(String arch) {
-            switch (arch) {
-                case "amd64":
-                    return "defined(AMD64)";
-                case "sparcv9":
-                    return "(defined(SPARC) && defined(_LP64))";
-                case "sparc":
-                    return "defined(SPARC)";
-                default:
-                    throw new GraalInternalError("unexpected arch: " + arch);
-            }
-        }
-
-        private static String archDefines(String[] archs) {
-            if (archs == null || archs.length == 0) {
-                return null;
-            }
-            if (archs.length == 1) {
-                return archDefine(archs[0]);
-            }
-            String[] defs = new String[archs.length];
-            int i = 0;
-            for (String arch : archs) {
-                defs[i++] = archDefine(arch);
-            }
-            return String.join(" || ", defs);
-        }
-
-        public void emit(PrintWriter out) {
-            if (define != null) {
-                out.printf("#if %s\n", define);
-            }
-            out.printf("            %s%n", setter);
-            if (!optional) {
-                out.printf("            assigned++;%n");
-            }
-            if (define != null) {
-                out.printf("#endif\n");
-            }
-        }
-
-    }
-
-    @SuppressWarnings("unchecked")
-    private <T extends Annotation> void collectAnnotations(RoundEnvironment roundEnv, Map<String, VMConfigField> annotationMap, Class<T> annotationClass,
-                    BiFunction<VariableElement, T, VMConfigField> builder) {
-        for (Element element : roundEnv.getElementsAnnotatedWith(annotationClass)) {
-            Annotation constant = element.getAnnotation(annotationClass);
-            if (element.getKind() != ElementKind.FIELD) {
-                errorMessage(element, "%s annotations may only be on fields", annotationClass.getSimpleName());
-            }
-            if (annotationClass == HotSpotVMValue.class) {
-                HotSpotVMValue value = (HotSpotVMValue) constant;
-                if (value.get() == HotSpotVMValue.Type.ADDRESS && !element.asType().toString().equals("long")) {
-                    errorMessage(element, "HotSpotVMValue with get == ADDRESS must be of type long, but found %s", element.asType());
-                }
-            }
-            if (currentTypeElement == null) {
-                currentTypeElement = element.getEnclosingElement();
-            } else {
-                if (!currentTypeElement.equals(element.getEnclosingElement())) {
-                    errorMessage(element, "Multiple types encountered.  Only HotSpotVMConfig is supported");
-                }
-            }
-            annotationMap.put(element.getSimpleName().toString(), builder.apply((VariableElement) element, (T) constant));
-        }
-    }
-
-    private void errorMessage(Element element, String format, Object... args) {
-        processingEnv.getMessager().printMessage(Kind.ERROR, String.format(format, args), element);
-    }
-
-    Element currentTypeElement = null;
-
-    @Override
-    public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
-        if (roundEnv.processingOver()) {
-            return true;
-        }
-        logMessage("Starting round %s %s\n", roundEnv, annotations);
-        try {
-
-            currentTypeElement = null;
-
-            // First collect all the annotations.
-            Map<String, VMConfigField> annotationMap = new HashMap<>();
-            collectAnnotations(roundEnv, annotationMap, HotSpotVMConstant.class, (e, v) -> new VMConfigField(e, v));
-            collectAnnotations(roundEnv, annotationMap, HotSpotVMFlag.class, (e, v) -> new VMConfigField(e, v));
-            collectAnnotations(roundEnv, annotationMap, HotSpotVMField.class, (e, v) -> new VMConfigField(e, v));
-            collectAnnotations(roundEnv, annotationMap, HotSpotVMType.class, (e, v) -> new VMConfigField(e, v));
-            collectAnnotations(roundEnv, annotationMap, HotSpotVMValue.class, (e, v) -> new VMConfigField(e, v));
-
-            if (annotationMap.isEmpty()) {
-                return true;
-            }
-
-            logMessage("type element %s\n", currentTypeElement);
-            createFiles(annotationMap, currentTypeElement);
-
-        } catch (Throwable t) {
-            reportExceptionThrow(null, t);
-        }
-
-        return true;
-    }
-}
--- a/graal/com.oracle.graal.hotspotvmconfig/src/com/oracle/graal/hotspotvmconfig/HotSpotVMConstant.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.hotspotvmconfig;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Refers to a C++ constant in the VM.
- */
-@Target(ElementType.FIELD)
-@Retention(RetentionPolicy.RUNTIME)
-public @interface HotSpotVMConstant {
-
-    /**
-     * Returns the name of the constant.
-     *
-     * @return name of constant
-     */
-    String name();
-
-    /**
-     * List of architectures where this constant is required. Names are derived from
-     * {@link HotSpotVMConfig#getHostArchitectureName()}. An empty list implies that the constant is
-     * required on all architectures.
-     */
-    @SuppressWarnings("javadoc")
-    String[] archs() default {};
-
-}
--- a/graal/com.oracle.graal.hotspotvmconfig/src/com/oracle/graal/hotspotvmconfig/HotSpotVMField.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,85 +0,0 @@
-/*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.hotspotvmconfig;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Refers to a C++ field in the VM.
- */
-@Target(ElementType.FIELD)
-@Retention(RetentionPolicy.RUNTIME)
-public @interface HotSpotVMField {
-
-    /**
-     * Types of information this annotation can return.
-     */
-    enum Type {
-        /**
-         * Returns the offset of this field within the type. Only valid for instance fields.
-         */
-        OFFSET,
-
-        /**
-         * Returns the absolute address of this field. Only valid for static fields.
-         */
-        ADDRESS,
-
-        /**
-         * Returns the value of this field. Only valid for static fields.
-         */
-        VALUE;
-    }
-
-    /**
-     * Specifies what type of information to return.
-     *
-     * @see Type
-     */
-    Type get();
-
-    /**
-     * Returns the type name containing this field.
-     *
-     * @return name of containing type
-     */
-    String type();
-
-    /**
-     * Returns the name of this field.
-     *
-     * @return name of field
-     */
-    String name();
-
-    /**
-     * List of architectures where this constant is required. Names are derived from
-     * {@link HotSpotVMConfig#getHostArchitectureName()}. An empty list implies that the constant is
-     * required on all architectures.
-     */
-    @SuppressWarnings("javadoc")
-    String[] archs() default {};
-}
--- a/graal/com.oracle.graal.hotspotvmconfig/src/com/oracle/graal/hotspotvmconfig/HotSpotVMFlag.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.hotspotvmconfig;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Refers to a C++ flag in the VM.
- */
-@Target(ElementType.FIELD)
-@Retention(RetentionPolicy.RUNTIME)
-public @interface HotSpotVMFlag {
-
-    /**
-     * Returns the name of this flag.
-     *
-     * @return name of flag.
-     */
-    String name();
-
-    /**
-     * List of architectures where this constant is required. Names are derived from
-     * {@link HotSpotVMConfig#getHostArchitectureName()}. An empty list implies that the constant is
-     * required on all architectures.
-     */
-    @SuppressWarnings("javadoc")
-    String[] archs() default {};
-
-    boolean optional() default false;
-}
--- a/graal/com.oracle.graal.hotspotvmconfig/src/com/oracle/graal/hotspotvmconfig/HotSpotVMType.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-/*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.hotspotvmconfig;
-
-import java.lang.annotation.*;
-
-/**
- * Refers to a C++ type in the VM.
- */
-@Target(ElementType.FIELD)
-@Retention(RetentionPolicy.RUNTIME)
-public @interface HotSpotVMType {
-
-    /**
-     * Types of information this annotation can return.
-     */
-    enum Type {
-        /**
-         * Returns the size of the type (C++ {@code sizeof()}).
-         */
-        SIZE;
-    }
-
-    /**
-     * Specifies what type of information to return.
-     *
-     * @see Type
-     */
-    Type get();
-
-    /**
-     * Returns the name of the type.
-     *
-     * @return name of type
-     */
-    String name();
-}
--- a/graal/com.oracle.graal.hotspotvmconfig/src/com/oracle/graal/hotspotvmconfig/HotSpotVMValue.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.hotspotvmconfig;
-
-import java.lang.annotation.*;
-
-@Target(ElementType.FIELD)
-@Retention(RetentionPolicy.RUNTIME)
-public @interface HotSpotVMValue {
-
-    /**
-     * A C++ expression to be evaluated and assigned to the field.
-     */
-    String expression();
-
-    enum Type {
-        /**
-         * A C++ address which might require extra casts to be safely assigned to a Java field.
-         */
-        ADDRESS,
-
-        /**
-         * A simple value which can be assigned to a regular Java field.
-         */
-        VALUE
-    }
-
-    /**
-     * If {@link #expression} is a C++ function name, {@link #signature} represents the signature of
-     * the function.
-     *
-     */
-    String signature() default "";
-
-    Type get() default Type.VALUE;
-
-    /**
-     * List of preprocessor symbols that should guard initialization of this value.
-     */
-    String[] defines() default {};
-
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.java.test/src/com/oracle/graal/java/test/ConstantTest.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.graal.java.test;
+
+import com.oracle.jvmci.meta.JavaConstant;
+import com.oracle.jvmci.meta.Kind;
+import org.junit.*;
+
+public class ConstantTest extends FieldUniverse {
+
+    @Test
+    public void testNegativeZero() {
+        Assert.assertTrue("Constant for 0.0f must be different from -0.0f", JavaConstant.FLOAT_0 != JavaConstant.forFloat(-0.0F));
+        Assert.assertTrue("Constant for 0.0d must be different from -0.0d", JavaConstant.DOUBLE_0 != JavaConstant.forDouble(-0.0d));
+    }
+
+    @Test
+    public void testNullIsNull() {
+        Assert.assertTrue(JavaConstant.NULL_POINTER.isNull());
+    }
+
+    @Test
+    public void testOne() {
+        for (Kind kind : Kind.values()) {
+            if (kind.isNumericInteger() || kind.isNumericFloat()) {
+                Assert.assertTrue(JavaConstant.one(kind).getKind() == kind);
+            }
+        }
+        Assert.assertEquals(1, JavaConstant.one(Kind.Int).asInt());
+        Assert.assertEquals(1L, JavaConstant.one(Kind.Long).asLong());
+        Assert.assertEquals(1, JavaConstant.one(Kind.Byte).asInt());
+        Assert.assertEquals(1, JavaConstant.one(Kind.Short).asInt());
+        Assert.assertEquals(1, JavaConstant.one(Kind.Char).asInt());
+        Assert.assertTrue(1F == JavaConstant.one(Kind.Float).asFloat());
+        Assert.assertTrue(1D == JavaConstant.one(Kind.Double).asDouble());
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void testIllegalOne() {
+        JavaConstant.one(Kind.Illegal);
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void testVoidOne() {
+        JavaConstant.one(Kind.Void);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.java.test/src/com/oracle/graal/java/test/FieldUniverse.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.graal.java.test;
+
+import com.oracle.jvmci.meta.ResolvedJavaField;
+import java.lang.reflect.*;
+import java.util.*;
+
+/**
+ * Context for field related tests.
+ */
+public class FieldUniverse extends TypeUniverse {
+
+    public final Map<Field, ResolvedJavaField> fields = new HashMap<>();
+
+    public FieldUniverse() {
+        for (Class<?> c : classes) {
+            for (Field f : c.getDeclaredFields()) {
+                ResolvedJavaField field = metaAccess.lookupJavaField(f);
+                fields.put(f, field);
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.java.test/src/com/oracle/graal/java/test/MethodUniverse.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.graal.java.test;
+
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
+import java.lang.reflect.*;
+import java.util.*;
+
+/**
+ * Context for method related tests.
+ */
+public class MethodUniverse extends TypeUniverse {
+
+    public final Map<Method, ResolvedJavaMethod> methods = new HashMap<>();
+    public final Map<Constructor<?>, ResolvedJavaMethod> constructors = new HashMap<>();
+
+    public MethodUniverse() {
+        for (Class<?> c : classes) {
+            for (Method m : c.getDeclaredMethods()) {
+                ResolvedJavaMethod method = metaAccess.lookupJavaMethod(m);
+                methods.put(m, method);
+            }
+            for (Constructor<?> m : c.getDeclaredConstructors()) {
+                constructors.put(m, metaAccess.lookupJavaMethod(m));
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.java.test/src/com/oracle/graal/java/test/NameAndSignature.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,91 @@
+/*
+ * 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.java.test;
+
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
+import com.oracle.jvmci.meta.Signature;
+import com.oracle.jvmci.meta.ResolvedJavaType;
+import com.oracle.jvmci.meta.MetaAccessProvider;
+import java.lang.reflect.*;
+import java.util.*;
+
+import com.oracle.graal.api.runtime.*;
+import com.oracle.graal.runtime.*;
+
+class NameAndSignature {
+
+    public static final MetaAccessProvider metaAccess = Graal.getRequiredCapability(RuntimeProvider.class).getHostBackend().getProviders().getMetaAccess();
+
+    final String name;
+    final Class<?> returnType;
+    final Class<?>[] parameterTypes;
+
+    public NameAndSignature(Method m) {
+        this.name = m.getName();
+        this.returnType = m.getReturnType();
+        this.parameterTypes = m.getParameterTypes();
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (obj instanceof NameAndSignature) {
+            NameAndSignature s = (NameAndSignature) obj;
+            return s.returnType == returnType && name.equals(s.name) && Arrays.equals(s.parameterTypes, parameterTypes);
+        }
+        return false;
+    }
+
+    @Override
+    public int hashCode() {
+        return name.hashCode();
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder(name + "(");
+        String sep = "";
+        for (Class<?> p : parameterTypes) {
+            sb.append(sep);
+            sep = ", ";
+            sb.append(p.getName());
+        }
+        return sb.append(')').append(returnType.getName()).toString();
+    }
+
+    public boolean signatureEquals(ResolvedJavaMethod m) {
+        Signature s = m.getSignature();
+        ResolvedJavaType declaringClass = m.getDeclaringClass();
+        if (!s.getReturnType(declaringClass).resolve(declaringClass).equals(metaAccess.lookupJavaType(returnType))) {
+            return false;
+        }
+        if (s.getParameterCount(false) != parameterTypes.length) {
+            return false;
+        }
+        for (int i = 0; i < parameterTypes.length; i++) {
+            if (!s.getParameterType(i, declaringClass).resolve(declaringClass).equals(metaAccess.lookupJavaType(parameterTypes[i]))) {
+                return false;
+            }
+        }
+        return true;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.java.test/src/com/oracle/graal/java/test/ResolvedJavaTypeResolveConcreteMethodTest.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,175 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.graal.java.test;
+
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
+import com.oracle.jvmci.meta.ResolvedJavaType;
+import com.oracle.jvmci.meta.MetaAccessProvider;
+import static org.junit.Assert.*;
+
+import org.junit.*;
+
+import com.oracle.graal.api.runtime.*;
+import com.oracle.graal.phases.util.*;
+import com.oracle.graal.runtime.*;
+
+public class ResolvedJavaTypeResolveConcreteMethodTest {
+    public final MetaAccessProvider metaAccess;
+
+    public ResolvedJavaTypeResolveConcreteMethodTest() {
+        Providers providers = Graal.getRequiredCapability(RuntimeProvider.class).getHostBackend().getProviders();
+        metaAccess = providers.getMetaAccess();
+    }
+
+    protected abstract static class A {
+        @SuppressWarnings("unused")
+        private void priv() {
+        }
+
+        public void v1() {
+        }
+
+        public void v2() {
+        }
+
+        public abstract void abs();
+    }
+
+    protected static class B extends A implements I {
+        public void i() {
+        }
+
+        @Override
+        public void v2() {
+        }
+
+        @Override
+        public void abs() {
+
+        }
+    }
+
+    protected static class C extends B {
+        public void d() {
+        }
+    }
+
+    protected abstract static class D extends A {
+
+    }
+
+    protected static class E extends D {
+        @Override
+        public void abs() {
+        }
+    }
+
+    protected interface I {
+        void i();
+
+        default void d() {
+        }
+    }
+
+    @Test
+    public void testDefaultMethod() {
+        ResolvedJavaType i = getType(I.class);
+        ResolvedJavaType b = getType(B.class);
+        ResolvedJavaType c = getType(C.class);
+        ResolvedJavaMethod di = getMethod(i, "d");
+        ResolvedJavaMethod dc = getMethod(c, "d");
+
+        assertEquals(di, i.resolveConcreteMethod(di, c));
+        assertEquals(di, b.resolveConcreteMethod(di, c));
+        assertEquals(dc, c.resolveConcreteMethod(di, c));
+    }
+
+    @Test
+    public void testPrivateMethod() {
+        ResolvedJavaType a = getType(A.class);
+        ResolvedJavaType b = getType(B.class);
+        ResolvedJavaType c = getType(C.class);
+        ResolvedJavaMethod priv = getMethod(a, "priv");
+
+        assertNull(a.resolveConcreteMethod(priv, c));
+        assertNull(b.resolveConcreteMethod(priv, c));
+    }
+
+    @Test
+    public void testAbstractMethod() {
+        ResolvedJavaType a = getType(A.class);
+        ResolvedJavaType b = getType(B.class);
+        ResolvedJavaType c = getType(C.class);
+        ResolvedJavaType d = getType(D.class);
+        ResolvedJavaType e = getType(E.class);
+        ResolvedJavaMethod absa = getMethod(a, "abs");
+        ResolvedJavaMethod absb = getMethod(b, "abs");
+        ResolvedJavaMethod abse = getMethod(e, "abs");
+
+        assertNull(a.resolveConcreteMethod(absa, c));
+        assertNull(d.resolveConcreteMethod(absa, c));
+
+        assertEquals(absb, b.resolveConcreteMethod(absa, c));
+        assertEquals(absb, b.resolveConcreteMethod(absb, c));
+        assertEquals(absb, c.resolveConcreteMethod(absa, c));
+        assertEquals(absb, c.resolveConcreteMethod(absb, c));
+        assertEquals(abse, e.resolveConcreteMethod(absa, c));
+        assertNull(e.resolveConcreteMethod(absb, c));
+        assertEquals(abse, e.resolveConcreteMethod(abse, c));
+    }
+
+    @Test
+    public void testVirtualMethod() {
+        ResolvedJavaType a = getType(A.class);
+        ResolvedJavaType b = getType(B.class);
+        ResolvedJavaType c = getType(C.class);
+        ResolvedJavaMethod v1a = getMethod(a, "v1");
+        ResolvedJavaMethod v2a = getMethod(a, "v2");
+        ResolvedJavaMethod v2b = getMethod(b, "v2");
+
+        assertEquals(v1a, a.resolveConcreteMethod(v1a, c));
+        assertEquals(v1a, b.resolveConcreteMethod(v1a, c));
+        assertEquals(v1a, c.resolveConcreteMethod(v1a, c));
+        assertEquals(v2a, a.resolveConcreteMethod(v2a, c));
+        assertEquals(v2b, b.resolveConcreteMethod(v2a, c));
+        assertEquals(v2b, b.resolveConcreteMethod(v2b, c));
+        assertEquals(v2b, c.resolveConcreteMethod(v2a, c));
+        assertEquals(v2b, c.resolveConcreteMethod(v2b, c));
+
+    }
+
+    static ResolvedJavaMethod getMethod(ResolvedJavaType type, String methodName) {
+        for (ResolvedJavaMethod method : type.getDeclaredMethods()) {
+            if (method.getName().equals(methodName)) {
+                return method;
+            }
+        }
+        throw new IllegalArgumentException();
+    }
+
+    protected ResolvedJavaType getType(Class<?> clazz) {
+        ResolvedJavaType type = metaAccess.lookupJavaType(clazz);
+        type.initialize();
+        return type;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.java.test/src/com/oracle/graal/java/test/ResolvedJavaTypeResolveMethodTest.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,175 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.graal.java.test;
+
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
+import com.oracle.jvmci.meta.ResolvedJavaType;
+import com.oracle.jvmci.meta.MetaAccessProvider;
+import static org.junit.Assert.*;
+
+import org.junit.*;
+
+import com.oracle.graal.api.runtime.*;
+import com.oracle.graal.phases.util.*;
+import com.oracle.graal.runtime.*;
+
+public class ResolvedJavaTypeResolveMethodTest {
+    public final MetaAccessProvider metaAccess;
+
+    public ResolvedJavaTypeResolveMethodTest() {
+        Providers providers = Graal.getRequiredCapability(RuntimeProvider.class).getHostBackend().getProviders();
+        metaAccess = providers.getMetaAccess();
+    }
+
+    protected abstract static class A {
+        @SuppressWarnings("unused")
+        private void priv() {
+        }
+
+        public void v1() {
+        }
+
+        public void v2() {
+        }
+
+        public abstract void abs();
+    }
+
+    protected static class B extends A implements I {
+        public void i() {
+        }
+
+        @Override
+        public void v2() {
+        }
+
+        @Override
+        public void abs() {
+
+        }
+    }
+
+    protected static class C extends B {
+        public void d() {
+        }
+    }
+
+    protected abstract static class D extends A {
+
+    }
+
+    protected static class E extends D {
+        @Override
+        public void abs() {
+        }
+    }
+
+    protected interface I {
+        void i();
+
+        default void d() {
+        }
+    }
+
+    @Test
+    public void testDefaultMethod() {
+        ResolvedJavaType i = getType(I.class);
+        ResolvedJavaType b = getType(B.class);
+        ResolvedJavaType c = getType(C.class);
+        ResolvedJavaMethod di = getMethod(i, "d");
+        ResolvedJavaMethod dc = getMethod(c, "d");
+
+        assertEquals(di, i.resolveMethod(di, c, true));
+        assertEquals(di, b.resolveMethod(di, c, true));
+        assertEquals(dc, c.resolveMethod(di, c, true));
+    }
+
+    @Test
+    public void testPrivateMethod() {
+        ResolvedJavaType a = getType(A.class);
+        ResolvedJavaType b = getType(B.class);
+        ResolvedJavaType c = getType(C.class);
+        ResolvedJavaMethod priv = getMethod(a, "priv");
+
+        assertNull(a.resolveMethod(priv, c, true));
+        assertNull(b.resolveMethod(priv, c, true));
+    }
+
+    @Test
+    public void testAbstractMethod() {
+        ResolvedJavaType a = getType(A.class);
+        ResolvedJavaType b = getType(B.class);
+        ResolvedJavaType c = getType(C.class);
+        ResolvedJavaType d = getType(D.class);
+        ResolvedJavaType e = getType(E.class);
+        ResolvedJavaMethod absa = getMethod(a, "abs");
+        ResolvedJavaMethod absb = getMethod(b, "abs");
+        ResolvedJavaMethod abse = getMethod(e, "abs");
+
+        assertEquals(absa, a.resolveMethod(absa, c, true));
+        assertEquals(absa, d.resolveMethod(absa, c, true));
+
+        assertEquals(absb, b.resolveMethod(absa, c, true));
+        assertEquals(absb, b.resolveMethod(absb, c, true));
+        assertEquals(absb, c.resolveMethod(absa, c, true));
+        assertEquals(absb, c.resolveMethod(absb, c, true));
+        assertEquals(abse, e.resolveMethod(absa, c, true));
+        assertNull(e.resolveMethod(absb, c, true));
+        assertEquals(abse, e.resolveMethod(abse, c, true));
+    }
+
+    @Test
+    public void testVirtualMethod() {
+        ResolvedJavaType a = getType(A.class);
+        ResolvedJavaType b = getType(B.class);
+        ResolvedJavaType c = getType(C.class);
+        ResolvedJavaMethod v1a = getMethod(a, "v1");
+        ResolvedJavaMethod v2a = getMethod(a, "v2");
+        ResolvedJavaMethod v2b = getMethod(b, "v2");
+
+        assertEquals(v1a, a.resolveMethod(v1a, c, true));
+        assertEquals(v1a, b.resolveMethod(v1a, c, true));
+        assertEquals(v1a, c.resolveMethod(v1a, c, true));
+        assertEquals(v2a, a.resolveMethod(v2a, c, true));
+        assertEquals(v2b, b.resolveMethod(v2a, c, true));
+        assertEquals(v2b, b.resolveMethod(v2b, c, true));
+        assertEquals(v2b, c.resolveMethod(v2a, c, true));
+        assertEquals(v2b, c.resolveMethod(v2b, c, true));
+
+    }
+
+    static ResolvedJavaMethod getMethod(ResolvedJavaType type, String methodName) {
+        for (ResolvedJavaMethod method : type.getDeclaredMethods()) {
+            if (method.getName().equals(methodName)) {
+                return method;
+            }
+        }
+        throw new IllegalArgumentException();
+    }
+
+    protected ResolvedJavaType getType(Class<?> clazz) {
+        ResolvedJavaType type = metaAccess.lookupJavaType(clazz);
+        type.initialize();
+        return type;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.java.test/src/com/oracle/graal/java/test/TestBytecodeDisassemblerProvider.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,62 @@
+/*
+ * 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.java.test;
+
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
+import com.oracle.jvmci.meta.BytecodeDisassemblerProvider;
+import org.junit.*;
+
+import com.oracle.graal.java.*;
+
+/**
+ * Tests for {@link BytecodeDisassemblerProvider}.
+ */
+public class TestBytecodeDisassemblerProvider extends MethodUniverse {
+
+    public TestBytecodeDisassemblerProvider() {
+    }
+
+    /**
+     * Tests that successive disassembling of the same method produces the same result.
+     */
+    @Test
+    public void disassembleTest() {
+        BytecodeDisassemblerProvider dis = new BytecodeDisassembler();
+        if (dis != null) {
+            int count = 0;
+            for (ResolvedJavaMethod m : methods.values()) {
+                String disasm1 = dis.disassemble(m);
+                String disasm2 = dis.disassemble(m);
+                if (disasm1 == null) {
+                    Assert.assertTrue(disasm2 == null);
+                } else {
+                    Assert.assertTrue(String.valueOf(m), disasm1.length() > 0);
+                    Assert.assertEquals(String.valueOf(m), disasm1, disasm2);
+                }
+                if (count++ > 20) {
+                    break;
+                }
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.java.test/src/com/oracle/graal/java/test/TestConstantReflectionProvider.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,103 @@
+/*
+ * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.graal.java.test;
+
+import static org.junit.Assert.*;
+
+import java.lang.reflect.*;
+
+import org.junit.*;
+
+import com.oracle.jvmci.meta.*;
+
+/**
+ * Tests for {@link ConstantReflectionProvider}. It assumes an implementation of the interface that
+ * actually returns non-null results for access operations that are possible, i.e., the tests will
+ * fail for an implementation that spuriously returns null (which is allowed by the specification).
+ */
+public class TestConstantReflectionProvider extends TypeUniverse {
+
+    @Test
+    public void constantEqualsTest() {
+        for (JavaConstant c1 : constants) {
+            for (JavaConstant c2 : constants) {
+                // test symmetry
+                assertEquals(constantReflection.constantEquals(c1, c2), constantReflection.constantEquals(c2, c1));
+                if (c1.getKind() != Kind.Object && c2.getKind() != Kind.Object) {
+                    assertEquals(c1.equals(c2), constantReflection.constantEquals(c2, c1));
+                }
+            }
+        }
+    }
+
+    @Test
+    public void readArrayLengthTest() {
+        for (JavaConstant c : constants) {
+            Integer actual = constantReflection.readArrayLength(c);
+            if (c.getKind() != Kind.Object || c.isNull() || !snippetReflection.asObject(Object.class, c).getClass().isArray()) {
+                assertNull(actual);
+            } else {
+                assertNotNull(actual);
+                int actualInt = actual;
+                assertEquals(Array.getLength(snippetReflection.asObject(Object.class, c)), actualInt);
+            }
+        }
+    }
+
+    @Test
+    public void boxTest() {
+        for (JavaConstant c : constants) {
+            JavaConstant boxed = constantReflection.boxPrimitive(c);
+            if (c.getKind().isPrimitive()) {
+                assertTrue(boxed.getKind().isObject());
+                assertFalse(boxed.isNull());
+            }
+        }
+
+        assertEquals(Long.valueOf(42), snippetReflection.asObject(Long.class, constantReflection.boxPrimitive(JavaConstant.forLong(42))));
+        assertEquals(Integer.valueOf(66), snippetReflection.asObject(Integer.class, constantReflection.boxPrimitive(JavaConstant.forInt(66))));
+        assertEquals(Byte.valueOf((byte) 123), snippetReflection.asObject(Byte.class, constantReflection.boxPrimitive(JavaConstant.forByte((byte) 123))));
+        assertSame(Boolean.TRUE, snippetReflection.asObject(Boolean.class, constantReflection.boxPrimitive(JavaConstant.forBoolean(true))));
+
+        assertNull(constantReflection.boxPrimitive(JavaConstant.NULL_POINTER));
+        assertNull(constantReflection.boxPrimitive(snippetReflection.forObject("abc")));
+    }
+
+    @Test
+    public void unboxTest() {
+        for (JavaConstant c : constants) {
+            JavaConstant unboxed = c.isNull() ? null : constantReflection.unboxPrimitive(c);
+            if (unboxed != null) {
+                assertFalse(unboxed.getKind().isObject());
+            }
+        }
+
+        assertEquals(JavaConstant.forLong(42), constantReflection.unboxPrimitive(snippetReflection.forObject(Long.valueOf(42))));
+        assertEquals(JavaConstant.forInt(66), constantReflection.unboxPrimitive(snippetReflection.forObject(Integer.valueOf(66))));
+        assertEquals(JavaConstant.forByte((byte) 123), constantReflection.unboxPrimitive(snippetReflection.forObject(Byte.valueOf((byte) 123))));
+        assertSame(JavaConstant.forBoolean(true), constantReflection.unboxPrimitive(snippetReflection.forObject(Boolean.TRUE)));
+
+        assertNull(constantReflection.unboxPrimitive(JavaConstant.NULL_POINTER));
+        assertNull(constantReflection.unboxPrimitive(snippetReflection.forObject("abc")));
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.java.test/src/com/oracle/graal/java/test/TestJavaField.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,76 @@
+/*
+ * 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.java.test;
+
+import static org.junit.Assert.*;
+
+import java.lang.reflect.*;
+import java.util.*;
+
+import org.junit.*;
+
+import com.oracle.jvmci.meta.*;
+
+/**
+ * Tests for {@link JavaField}.
+ */
+public class TestJavaField extends FieldUniverse {
+
+    @Test
+    public void getNameTest() {
+        for (Map.Entry<Field, ResolvedJavaField> e : fields.entrySet()) {
+            String expected = e.getKey().getName();
+            String actual = e.getValue().getName();
+            assertEquals(expected, actual);
+        }
+    }
+
+    @Test
+    public void getTypeTest() {
+        for (Map.Entry<Field, ResolvedJavaField> e : fields.entrySet()) {
+            // Must resolve types first as a resolved types != unresolved types
+            ResolvedJavaField rf = e.getValue();
+            JavaType expected = metaAccess.lookupJavaType(e.getKey().getType()).resolve(rf.getDeclaringClass());
+            JavaType actual = rf.getType().resolve(rf.getDeclaringClass());
+            assertEquals(expected, actual);
+        }
+    }
+
+    @Test
+    public void getKindTest() {
+        for (Map.Entry<Field, ResolvedJavaField> e : fields.entrySet()) {
+            Kind expected = metaAccess.lookupJavaType(e.getKey().getType()).getKind();
+            Kind actual = e.getValue().getKind();
+            assertEquals(expected, actual);
+        }
+    }
+
+    @Test
+    public void getDeclaringClassTest() {
+        for (Map.Entry<Field, ResolvedJavaField> e : fields.entrySet()) {
+            Class<?> expected = e.getKey().getDeclaringClass();
+            ResolvedJavaType actual = e.getValue().getDeclaringClass();
+            assertTrue(actual.equals(metaAccess.lookupJavaType(expected)));
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.java.test/src/com/oracle/graal/java/test/TestJavaMethod.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,63 @@
+/*
+ * 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.java.test;
+
+import static org.junit.Assert.*;
+
+import java.lang.reflect.*;
+import java.util.*;
+
+import org.junit.*;
+
+import com.oracle.jvmci.meta.*;
+
+/**
+ * Tests for {@link JavaMethod}.
+ */
+public class TestJavaMethod extends MethodUniverse {
+
+    @Test
+    public void getNameTest() {
+        for (Map.Entry<Method, ResolvedJavaMethod> e : methods.entrySet()) {
+            String expected = e.getKey().getName();
+            String actual = e.getValue().getName();
+            assertEquals(expected, actual);
+        }
+    }
+
+    @Test
+    public void getDeclaringClassTest() {
+        for (Map.Entry<Method, ResolvedJavaMethod> e : methods.entrySet()) {
+            Class<?> expected = e.getKey().getDeclaringClass();
+            ResolvedJavaType actual = e.getValue().getDeclaringClass();
+            assertTrue(actual.equals(metaAccess.lookupJavaType(expected)));
+        }
+    }
+
+    @Test
+    public void getSignatureTest() {
+        for (Map.Entry<Method, ResolvedJavaMethod> e : methods.entrySet()) {
+            assertTrue(new NameAndSignature(e.getKey()).signatureEquals(e.getValue()));
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.java.test/src/com/oracle/graal/java/test/TestJavaType.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,48 @@
+/*
+ * 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.java.test;
+
+import com.oracle.jvmci.meta.JavaType;
+import com.oracle.jvmci.meta.Kind;
+import static org.junit.Assert.*;
+
+import org.junit.*;
+
+/**
+ * Tests for {@link JavaType}.
+ */
+public class TestJavaType extends TypeUniverse {
+
+    public TestJavaType() {
+    }
+
+    @Test
+    public void getKindTest() {
+        for (Class<?> c : classes) {
+            JavaType type = metaAccess.lookupJavaType(c);
+            Kind expected = Kind.fromJavaClass(c);
+            Kind actual = type.getKind();
+            assertEquals(expected, actual);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.java.test/src/com/oracle/graal/java/test/TestMetaAccessProvider.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.graal.java.test;
+
+import static com.oracle.jvmci.meta.MetaUtil.*;
+import static org.junit.Assert.*;
+
+import java.lang.reflect.*;
+
+import org.junit.*;
+
+import com.oracle.jvmci.meta.*;
+
+/**
+ * Tests for {@link MetaAccessProvider}.
+ */
+public class TestMetaAccessProvider extends TypeUniverse {
+
+    @Test
+    public void lookupJavaTypeTest() {
+        for (Class<?> c : classes) {
+            ResolvedJavaType type = metaAccess.lookupJavaType(c);
+            assertNotNull(type);
+            assertEquals(c.getModifiers(), type.getModifiers());
+            if (!type.isArray()) {
+                assertEquals(type.getName(), toInternalName(c.getName()));
+                assertEquals(type.toJavaName(), c.getName());
+            }
+        }
+    }
+
+    @Test
+    public void lookupJavaMethodTest() {
+        for (Class<?> c : classes) {
+            for (Method reflect : c.getDeclaredMethods()) {
+                ResolvedJavaMethod method = metaAccess.lookupJavaMethod(reflect);
+                assertNotNull(method);
+                int expected = reflect.getModifiers() & Modifier.methodModifiers();
+                int actual = method.getModifiers();
+                assertEquals(String.format("%s: 0x%x != 0x%x", reflect, expected, actual), expected, actual);
+                assertTrue(method.getDeclaringClass().equals(metaAccess.lookupJavaType(reflect.getDeclaringClass())));
+            }
+        }
+    }
+
+    @Test
+    public void lookupJavaFieldTest() {
+        for (Class<?> c : classes) {
+            for (Field reflect : c.getDeclaredFields()) {
+                ResolvedJavaField field = metaAccess.lookupJavaField(reflect);
+                assertNotNull(field);
+                int expected = reflect.getModifiers();
+                int actual = field.getModifiers();
+                assertEquals(String.format("%s: 0x%x != 0x%x", reflect, expected, actual), expected, actual);
+                assertTrue(field.getDeclaringClass().equals(metaAccess.lookupJavaType(reflect.getDeclaringClass())));
+            }
+        }
+    }
+
+    @Test
+    public void lookupJavaTypeConstantTest() {
+        for (JavaConstant c : constants) {
+            if (c.getKind() == Kind.Object && !c.isNull()) {
+                Object o = snippetReflection.asObject(Object.class, c);
+                ResolvedJavaType type = metaAccess.lookupJavaType(c);
+                assertNotNull(type);
+                assertTrue(type.equals(metaAccess.lookupJavaType(o.getClass())));
+            } else {
+                assertEquals(metaAccess.lookupJavaType(c), null);
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.java.test/src/com/oracle/graal/java/test/TestResolvedJavaField.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,137 @@
+/*
+ * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.graal.java.test;
+
+import static org.junit.Assert.*;
+
+import java.lang.annotation.*;
+import java.lang.reflect.*;
+import java.util.*;
+
+import org.junit.*;
+
+import com.oracle.jvmci.meta.*;
+
+/**
+ * Tests for {@link ResolvedJavaField}.
+ */
+public class TestResolvedJavaField extends FieldUniverse {
+
+    public TestResolvedJavaField() {
+    }
+
+    @Test
+    public void getModifiersTest() {
+        for (Map.Entry<Field, ResolvedJavaField> e : fields.entrySet()) {
+            int expected = e.getKey().getModifiers();
+            int actual = e.getValue().getModifiers();
+            assertEquals(expected, actual);
+        }
+    }
+
+    @Test
+    public void isSyntheticTest() {
+        for (Map.Entry<Field, ResolvedJavaField> e : fields.entrySet()) {
+            boolean expected = e.getKey().isSynthetic();
+            boolean actual = e.getValue().isSynthetic();
+            assertEquals(expected, actual);
+        }
+    }
+
+    @Test
+    public void getAnnotationTest() {
+        for (Map.Entry<Field, ResolvedJavaField> e : fields.entrySet()) {
+            for (Annotation expected : e.getKey().getAnnotations()) {
+                if (expected != null) {
+                    Annotation actual = e.getValue().getAnnotation(expected.annotationType());
+                    assertEquals(expected, actual);
+                }
+            }
+        }
+    }
+
+    @Test
+    public void getLocationIdentityTest() {
+        for (Map.Entry<Field, ResolvedJavaField> e : fields.entrySet()) {
+            LocationIdentity identity = e.getValue().getLocationIdentity();
+            assertTrue(identity != null);
+        }
+    }
+
+    @Test
+    public void readConstantValueTest() throws NoSuchFieldException {
+        ResolvedJavaField field = metaAccess.lookupJavaField(getClass().getDeclaredField("stringField"));
+        for (Object receiver : new Object[]{this, null, new String()}) {
+            JavaConstant value = constantReflection.readConstantFieldValue(field, snippetReflection.forObject(receiver));
+            assertNull(value);
+        }
+
+        ResolvedJavaField constField = metaAccess.lookupJavaField(getClass().getDeclaredField("constantStringField"));
+        for (Object receiver : new Object[]{this, null, new String()}) {
+            JavaConstant value = constantReflection.readConstantFieldValue(constField, snippetReflection.forObject(receiver));
+            if (value != null) {
+                Object expected = "constantField";
+                assertTrue(snippetReflection.asObject(Object.class, value) == expected);
+            }
+        }
+    }
+
+    String stringField = "field";
+    final String constantStringField = "constantField";
+
+    private Method findTestMethod(Method apiMethod) {
+        String testName = apiMethod.getName() + "Test";
+        for (Method m : getClass().getDeclaredMethods()) {
+            if (m.getName().equals(testName) && m.getAnnotation(Test.class) != null) {
+                return m;
+            }
+        }
+        return null;
+    }
+
+    // @formatter:off
+    private static final String[] untestedApiMethods = {
+        "getDeclaringClass",
+        "isInternal"
+    };
+    // @formatter:on
+
+    /**
+     * Ensures that any new methods added to {@link ResolvedJavaMethod} either have a test written
+     * for them or are added to {@link #untestedApiMethods}.
+     */
+    @Test
+    public void testCoverage() {
+        Set<String> known = new HashSet<>(Arrays.asList(untestedApiMethods));
+        for (Method m : ResolvedJavaField.class.getDeclaredMethods()) {
+            if (m.isSynthetic()) {
+                continue;
+            }
+            if (findTestMethod(m) == null) {
+                assertTrue("test missing for " + m, known.contains(m.getName()));
+            } else {
+                assertFalse("test should be removed from untestedApiMethods" + m, known.contains(m.getName()));
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.java.test/src/com/oracle/graal/java/test/TestResolvedJavaMethod.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,380 @@
+/*
+ * 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.java.test;
+
+import com.oracle.jvmci.meta.ExceptionHandler;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
+import com.oracle.jvmci.meta.ConstantPool;
+import static org.junit.Assert.*;
+
+import java.lang.annotation.*;
+import java.lang.reflect.*;
+import java.util.*;
+
+import org.junit.*;
+
+/**
+ * Tests for {@link ResolvedJavaMethod}.
+ */
+public class TestResolvedJavaMethod extends MethodUniverse {
+
+    public TestResolvedJavaMethod() {
+    }
+
+    /**
+     * @see ResolvedJavaMethod#getCode()
+     */
+    @Test
+    public void getCodeTest() {
+        for (Map.Entry<Method, ResolvedJavaMethod> e : methods.entrySet()) {
+            ResolvedJavaMethod m = e.getValue();
+            byte[] code = m.getCode();
+            if (code == null) {
+                assertTrue(m.getCodeSize() == 0);
+            } else {
+                if (m.isAbstract()) {
+                    assertTrue(code.length == 0);
+                } else if (!m.isNative()) {
+                    assertTrue(code.length > 0);
+                }
+            }
+        }
+    }
+
+    /**
+     * @see ResolvedJavaMethod#getCodeSize()
+     */
+    @Test
+    public void getCodeSizeTest() {
+        for (Map.Entry<Method, ResolvedJavaMethod> e : methods.entrySet()) {
+            ResolvedJavaMethod m = e.getValue();
+            int codeSize = m.getCodeSize();
+            if (m.isAbstract()) {
+                assertTrue(codeSize == 0);
+            } else if (!m.isNative()) {
+                assertTrue(codeSize > 0);
+            }
+        }
+    }
+
+    @Test
+    public void getModifiersTest() {
+        for (Map.Entry<Method, ResolvedJavaMethod> e : methods.entrySet()) {
+            ResolvedJavaMethod m = e.getValue();
+            int expected = e.getKey().getModifiers() & Modifier.methodModifiers();
+            int actual = m.getModifiers();
+            assertEquals(expected, actual);
+        }
+    }
+
+    /**
+     * @see ResolvedJavaMethod#isClassInitializer()
+     */
+    @Test
+    public void isClassInitializerTest() {
+        for (Map.Entry<Method, ResolvedJavaMethod> e : methods.entrySet()) {
+            // Class initializers are hidden from reflection
+            ResolvedJavaMethod m = e.getValue();
+            assertFalse(m.isClassInitializer());
+        }
+        for (Map.Entry<Constructor<?>, ResolvedJavaMethod> e : constructors.entrySet()) {
+            ResolvedJavaMethod m = e.getValue();
+            assertFalse(m.isClassInitializer());
+        }
+    }
+
+    @Test
+    public void isConstructorTest() {
+        for (Map.Entry<Method, ResolvedJavaMethod> e : methods.entrySet()) {
+            ResolvedJavaMethod m = e.getValue();
+            assertFalse(m.isConstructor());
+        }
+        for (Map.Entry<Constructor<?>, ResolvedJavaMethod> e : constructors.entrySet()) {
+            ResolvedJavaMethod m = e.getValue();
+            assertTrue(m.isConstructor());
+        }
+    }
+
+    @Test
+    public void isSyntheticTest() {
+        for (Map.Entry<Method, ResolvedJavaMethod> e : methods.entrySet()) {
+            ResolvedJavaMethod m = e.getValue();
+            assertEquals(e.getKey().isSynthetic(), m.isSynthetic());
+        }
+        for (Map.Entry<Constructor<?>, ResolvedJavaMethod> e : constructors.entrySet()) {
+            ResolvedJavaMethod m = e.getValue();
+            assertEquals(e.getKey().isSynthetic(), m.isSynthetic());
+        }
+    }
+
+    @Test
+    public void isSynchronizedTest() {
+        for (Map.Entry<Method, ResolvedJavaMethod> e : methods.entrySet()) {
+            ResolvedJavaMethod m = e.getValue();
+            assertEquals(Modifier.isSynchronized(e.getKey().getModifiers()), m.isSynchronized());
+        }
+        for (Map.Entry<Constructor<?>, ResolvedJavaMethod> e : constructors.entrySet()) {
+            ResolvedJavaMethod m = e.getValue();
+            assertEquals(Modifier.isSynchronized(e.getKey().getModifiers()), m.isSynchronized());
+        }
+    }
+
+    @Test
+    public void canBeStaticallyBoundTest() {
+        for (Map.Entry<Method, ResolvedJavaMethod> e : methods.entrySet()) {
+            ResolvedJavaMethod m = e.getValue();
+            assertEquals(m.canBeStaticallyBound(), canBeStaticallyBound(e.getKey()));
+        }
+        for (Map.Entry<Constructor<?>, ResolvedJavaMethod> e : constructors.entrySet()) {
+            ResolvedJavaMethod m = e.getValue();
+            assertEquals(m.canBeStaticallyBound(), canBeStaticallyBound(e.getKey()));
+        }
+    }
+
+    private static boolean canBeStaticallyBound(Member method) {
+        int modifiers = method.getModifiers();
+        return (Modifier.isFinal(modifiers) || Modifier.isPrivate(modifiers) || Modifier.isStatic(modifiers) || Modifier.isFinal(method.getDeclaringClass().getModifiers())) &&
+                        !Modifier.isAbstract(modifiers);
+    }
+
+    private static String methodWithExceptionHandlers(String p1, Object o2) {
+        try {
+            return p1.substring(100) + o2.toString();
+        } catch (IndexOutOfBoundsException e) {
+            e.printStackTrace();
+        } catch (NullPointerException e) {
+            e.printStackTrace();
+        } catch (RuntimeException e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+
+    @Test
+    public void getExceptionHandlersTest() throws NoSuchMethodException {
+        ResolvedJavaMethod method = metaAccess.lookupJavaMethod(getClass().getDeclaredMethod("methodWithExceptionHandlers", String.class, Object.class));
+        ExceptionHandler[] handlers = method.getExceptionHandlers();
+        assertNotNull(handlers);
+        assertEquals(handlers.length, 3);
+        handlers[0].getCatchType().equals(metaAccess.lookupJavaType(IndexOutOfBoundsException.class));
+        handlers[1].getCatchType().equals(metaAccess.lookupJavaType(NullPointerException.class));
+        handlers[2].getCatchType().equals(metaAccess.lookupJavaType(RuntimeException.class));
+    }
+
+    private static String nullPointerExceptionOnFirstLine(Object o, String ignored) {
+        return o.toString() + ignored;
+    }
+
+    @Test
+    public void asStackTraceElementTest() throws NoSuchMethodException {
+        try {
+            nullPointerExceptionOnFirstLine(null, "ignored");
+            Assert.fail("should not reach here");
+        } catch (NullPointerException e) {
+            StackTraceElement expected = e.getStackTrace()[0];
+            ResolvedJavaMethod method = metaAccess.lookupJavaMethod(getClass().getDeclaredMethod("nullPointerExceptionOnFirstLine", Object.class, String.class));
+            StackTraceElement actual = method.asStackTraceElement(0);
+            assertEquals(expected, actual);
+        }
+    }
+
+    @Test
+    public void getConstantPoolTest() {
+        for (Map.Entry<Method, ResolvedJavaMethod> e : methods.entrySet()) {
+            ResolvedJavaMethod m = e.getValue();
+            ConstantPool cp = m.getConstantPool();
+            assertTrue(cp.length() > 0);
+        }
+    }
+
+    @Test(timeout = 1000L)
+    public void getAnnotationTest() throws NoSuchMethodException {
+        ResolvedJavaMethod method = metaAccess.lookupJavaMethod(getClass().getDeclaredMethod("getAnnotationTest"));
+        Test annotation = method.getAnnotation(Test.class);
+        assertNotNull(annotation);
+        assertEquals(1000L, annotation.timeout());
+    }
+
+    @Test(timeout = 1000L)
+    public void getAnnotationsTest() throws NoSuchMethodException {
+        ResolvedJavaMethod method = metaAccess.lookupJavaMethod(getClass().getDeclaredMethod("getAnnotationsTest"));
+        Annotation[] annotations = method.getAnnotations();
+        assertNotNull(annotations);
+        assertEquals(1, annotations.length);
+        assertEquals(1000L, ((Test) annotations[0]).timeout());
+    }
+
+    @Retention(RetentionPolicy.RUNTIME)
+    @Target(ElementType.PARAMETER)
+    @interface NonNull {
+    }
+
+    @Retention(RetentionPolicy.RUNTIME)
+    @Target(ElementType.PARAMETER)
+    @interface Special {
+    }
+
+    private static native void methodWithAnnotatedParameters(@NonNull HashMap<String, String> p1, @Special @NonNull Class<? extends Annotation> p2);
+
+    @Test
+    public void getParameterAnnotationsTest() throws NoSuchMethodException {
+        ResolvedJavaMethod method = metaAccess.lookupJavaMethod(getClass().getDeclaredMethod("methodWithAnnotatedParameters", HashMap.class, Class.class));
+        Annotation[][] annotations = method.getParameterAnnotations();
+        assertEquals(2, annotations.length);
+        assertEquals(1, annotations[0].length);
+        assertEquals(NonNull.class, annotations[0][0].annotationType());
+        assertEquals(2, annotations[1].length);
+        assertEquals(Special.class, annotations[1][0].annotationType());
+        assertEquals(NonNull.class, annotations[1][1].annotationType());
+    }
+
+    @Test
+    public void getGenericParameterTypesTest() throws NoSuchMethodException {
+        ResolvedJavaMethod method = metaAccess.lookupJavaMethod(getClass().getDeclaredMethod("methodWithAnnotatedParameters", HashMap.class, Class.class));
+        Type[] genericParameterTypes = method.getGenericParameterTypes();
+        assertEquals(2, genericParameterTypes.length);
+        assertEquals("java.util.HashMap<java.lang.String, java.lang.String>", genericParameterTypes[0].toString());
+        assertEquals("java.lang.Class<? extends java.lang.annotation.Annotation>", genericParameterTypes[1].toString());
+    }
+
+    @Test
+    public void getMaxLocalsTest() throws NoSuchMethodException {
+        ResolvedJavaMethod method1 = metaAccess.lookupJavaMethod(getClass().getDeclaredMethod("methodWithAnnotatedParameters", HashMap.class, Class.class));
+        ResolvedJavaMethod method2 = metaAccess.lookupJavaMethod(getClass().getDeclaredMethod("nullPointerExceptionOnFirstLine", Object.class, String.class));
+        assertEquals(0, method1.getMaxLocals());
+        assertEquals(2, method2.getMaxLocals());
+
+    }
+
+    @Test
+    public void getMaxStackSizeTest() throws NoSuchMethodException {
+        ResolvedJavaMethod method1 = metaAccess.lookupJavaMethod(getClass().getDeclaredMethod("methodWithAnnotatedParameters", HashMap.class, Class.class));
+        ResolvedJavaMethod method2 = metaAccess.lookupJavaMethod(getClass().getDeclaredMethod("nullPointerExceptionOnFirstLine", Object.class, String.class));
+        assertEquals(0, method1.getMaxStackSize());
+        // some versions of javac produce bytecode with a stacksize of 2 for this method
+        // JSR 292 also sometimes need one more stack slot
+        int method2StackSize = method2.getMaxStackSize();
+        assertTrue(2 <= method2StackSize && method2StackSize <= 4);
+    }
+
+    @Test
+    public void isDefaultTest() {
+        for (Map.Entry<Method, ResolvedJavaMethod> e : methods.entrySet()) {
+            ResolvedJavaMethod m = e.getValue();
+            assertEquals(e.getKey().isDefault(), m.isDefault());
+        }
+        for (Map.Entry<Constructor<?>, ResolvedJavaMethod> e : constructors.entrySet()) {
+            ResolvedJavaMethod m = e.getValue();
+            assertFalse(m.isDefault());
+        }
+    }
+
+    @Test
+    public void hasReceiverTest() {
+        for (Map.Entry<Method, ResolvedJavaMethod> e : methods.entrySet()) {
+            ResolvedJavaMethod m = e.getValue();
+            assertTrue(m.hasReceiver() != Modifier.isStatic(e.getKey().getModifiers()));
+        }
+        for (Map.Entry<Constructor<?>, ResolvedJavaMethod> e : constructors.entrySet()) {
+            ResolvedJavaMethod m = e.getValue();
+            assertTrue(m.hasReceiver());
+        }
+    }
+
+    @Test
+    public void hasBytecodesTest() {
+        for (Map.Entry<Method, ResolvedJavaMethod> e : methods.entrySet()) {
+            ResolvedJavaMethod m = e.getValue();
+            assertTrue(m.hasBytecodes() == (m.isConcrete() && !m.isNative()));
+        }
+        for (Map.Entry<Constructor<?>, ResolvedJavaMethod> e : constructors.entrySet()) {
+            ResolvedJavaMethod m = e.getValue();
+            assertTrue(m.hasBytecodes());
+        }
+    }
+
+    @Test
+    public void isJavaLangObjectInitTest() throws NoSuchMethodException {
+        ResolvedJavaMethod method = metaAccess.lookupJavaMethod(Object.class.getConstructor());
+        assertTrue(method.isJavaLangObjectInit());
+        for (Map.Entry<Method, ResolvedJavaMethod> e : methods.entrySet()) {
+            ResolvedJavaMethod m = e.getValue();
+            assertFalse(m.isJavaLangObjectInit());
+        }
+        for (Map.Entry<Constructor<?>, ResolvedJavaMethod> e : constructors.entrySet()) {
+            ResolvedJavaMethod m = e.getValue();
+            Constructor<?> key = e.getKey();
+            if (key.getDeclaringClass() == Object.class && key.getParameters().length == 0) {
+                assertTrue(m.isJavaLangObjectInit());
+            } else {
+                assertFalse(m.isJavaLangObjectInit());
+            }
+        }
+    }
+
+    private Method findTestMethod(Method apiMethod) {
+        String testName = apiMethod.getName() + "Test";
+        for (Method m : getClass().getDeclaredMethods()) {
+            if (m.getName().equals(testName) && m.getAnnotation(Test.class) != null) {
+                return m;
+            }
+        }
+        return null;
+    }
+
+    // @formatter:off
+    private static final String[] untestedApiMethods = {
+        "invoke",
+        "newInstance",
+        "getDeclaringClass",
+        "getEncoding",
+        "getProfilingInfo",
+        "reprofile",
+        "getCompilerStorage",
+        "canBeInlined",
+        "shouldBeInlined",
+        "getLineNumberTable",
+        "getLocalVariableTable",
+        "isInVirtualMethodTable",
+        "toParameterTypes",
+        "getParameterAnnotation",
+        "$jacocoInit"
+    };
+    // @formatter:on
+
+    /**
+     * Ensures that any new methods added to {@link ResolvedJavaMethod} either have a test written
+     * for them or are added to {@link #untestedApiMethods}.
+     */
+    @Test
+    public void testCoverage() {
+        Set<String> known = new HashSet<>(Arrays.asList(untestedApiMethods));
+        for (Method m : ResolvedJavaMethod.class.getDeclaredMethods()) {
+            if (findTestMethod(m) == null) {
+                assertTrue("test missing for " + m, known.contains(m.getName()));
+            } else {
+                assertFalse("test should be removed from untestedApiMethods" + m, known.contains(m.getName()));
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.java.test/src/com/oracle/graal/java/test/TestResolvedJavaType.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,879 @@
+/*
+ * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.graal.java.test;
+
+import com.oracle.jvmci.meta.JavaConstant;
+import com.oracle.jvmci.meta.Kind;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
+import com.oracle.jvmci.meta.ResolvedJavaField;
+import com.oracle.jvmci.meta.TrustedInterface;
+import com.oracle.jvmci.meta.ResolvedJavaType;
+import static java.lang.reflect.Modifier.*;
+import static org.junit.Assert.*;
+
+import java.lang.annotation.*;
+import java.lang.reflect.*;
+import java.net.*;
+import java.util.*;
+
+import org.junit.*;
+
+import sun.reflect.ConstantPool;
+
+import com.oracle.jvmci.meta.Assumptions.AssumptionResult;
+import com.oracle.jvmci.common.*;
+
+/**
+ * Tests for {@link ResolvedJavaType}.
+ */
+public class TestResolvedJavaType extends TypeUniverse {
+
+    public TestResolvedJavaType() {
+    }
+
+    @Test
+    public void findInstanceFieldWithOffsetTest() {
+        for (Class<?> c : classes) {
+            ResolvedJavaType type = metaAccess.lookupJavaType(c);
+            Set<Field> reflectionFields = getInstanceFields(c, true);
+            for (Field f : reflectionFields) {
+                ResolvedJavaField rf = lookupField(type.getInstanceFields(true), f);
+                assertNotNull(rf);
+                long offset = isStatic(f.getModifiers()) ? unsafe.staticFieldOffset(f) : unsafe.objectFieldOffset(f);
+                ResolvedJavaField result = type.findInstanceFieldWithOffset(offset, rf.getKind());
+                assertNotNull(result);
+                assertTrue(fieldsEqual(f, result));
+            }
+        }
+    }
+
+    @Test
+    public void isInterfaceTest() {
+        for (Class<?> c : classes) {
+            ResolvedJavaType type = metaAccess.lookupJavaType(c);
+            boolean expected = c.isInterface();
+            boolean actual = type.isInterface();
+            assertEquals(expected, actual);
+        }
+    }
+
+    @Test
+    public void isInstanceClassTest() {
+        for (Class<?> c : classes) {
+            ResolvedJavaType type = metaAccess.lookupJavaType(c);
+            boolean expected = !c.isArray() && !c.isPrimitive() && !c.isInterface();
+            boolean actual = type.isInstanceClass();
+            assertEquals(expected, actual);
+        }
+    }
+
+    @Test
+    public void isArrayTest() {
+        for (Class<?> c : classes) {
+            ResolvedJavaType type = metaAccess.lookupJavaType(c);
+            boolean expected = c.isArray();
+            boolean actual = type.isArray();
+            assertEquals(expected, actual);
+        }
+    }
+
+    @Test
+    public void getModifiersTest() {
+        for (Class<?> c : classes) {
+            ResolvedJavaType type = metaAccess.lookupJavaType(c);
+            int expected = c.getModifiers();
+            int actual = type.getModifiers();
+            assertEquals(expected, actual);
+        }
+    }
+
+    @Test
+    public void isAssignableFromTest() {
+        Class<?>[] all = classes.toArray(new Class[classes.size()]);
+        for (int i = 0; i < all.length; i++) {
+            Class<?> c1 = all[i];
+            for (int j = i; j < all.length; j++) {
+                Class<?> c2 = all[j];
+                ResolvedJavaType t1 = metaAccess.lookupJavaType(c1);
+                ResolvedJavaType t2 = metaAccess.lookupJavaType(c2);
+                boolean expected = c1.isAssignableFrom(c2);
+                boolean actual = t1.isAssignableFrom(t2);
+                assertEquals(expected, actual);
+                if (expected && t1 != t2) {
+                    assertFalse(t2.isAssignableFrom(t1));
+                }
+            }
+        }
+    }
+
+    @Test
+    public void isInstanceTest() {
+        for (JavaConstant c : constants) {
+            if (c.getKind() == Kind.Object && !c.isNull()) {
+                Object o = snippetReflection.asObject(Object.class, c);
+                Class<? extends Object> cls = o.getClass();
+                while (cls != null) {
+                    ResolvedJavaType type = metaAccess.lookupJavaType(cls);
+                    boolean expected = cls.isInstance(o);
+                    boolean actual = type.isInstance(c);
+                    assertEquals(expected, actual);
+                    cls = cls.getSuperclass();
+                }
+            }
+        }
+    }
+
+    private static Class<?> asExactClass(Class<?> c) {
+        if (c.isArray()) {
+            if (asExactClass(c.getComponentType()) != null) {
+                return c;
+            }
+        } else {
+            if (c.isPrimitive() || Modifier.isFinal(c.getModifiers())) {
+                return c;
+            }
+        }
+        return null;
+    }
+
+    @Test
+    public void asExactTypeTest() {
+        for (Class<?> c : classes) {
+            ResolvedJavaType type = metaAccess.lookupJavaType(c);
+            ResolvedJavaType exactType = type.asExactType();
+            Class<?> expected = asExactClass(c);
+            if (expected == null) {
+                assertTrue("exact(" + c.getName() + ") != null", exactType == null);
+            } else {
+                assertNotNull(exactType);
+                assertTrue(exactType.equals(metaAccess.lookupJavaType(expected)));
+            }
+        }
+    }
+
+    @Test
+    public void getSuperclassTest() {
+        for (Class<?> c : classes) {
+            ResolvedJavaType type = metaAccess.lookupJavaType(c);
+            Class<?> expected = c.getSuperclass();
+            ResolvedJavaType actual = type.getSuperclass();
+            if (expected == null) {
+                assertTrue(actual == null);
+            } else {
+                assertNotNull(actual);
+                assertTrue(actual.equals(metaAccess.lookupJavaType(expected)));
+            }
+        }
+    }
+
+    @Test
+    public void getInterfacesTest() {
+        for (Class<?> c : classes) {
+            ResolvedJavaType type = metaAccess.lookupJavaType(c);
+            Class<?>[] expected = c.getInterfaces();
+            ResolvedJavaType[] actual = type.getInterfaces();
+            assertEquals(expected.length, actual.length);
+            for (int i = 0; i < expected.length; i++) {
+                assertTrue(actual[i].equals(metaAccess.lookupJavaType(expected[i])));
+            }
+        }
+    }
+
+    public Class<?> getSupertype(Class<?> c) {
+        assert !c.isPrimitive();
+        if (c.isArray()) {
+            Class<?> componentType = c.getComponentType();
+            if (componentType.isPrimitive() || componentType == Object.class) {
+                return Object.class;
+            }
+            return getArrayClass(getSupertype(componentType));
+        }
+        if (c.isInterface()) {
+            return Object.class;
+        }
+        return c.getSuperclass();
+    }
+
+    public Class<?> findLeastCommonAncestor(Class<?> c1Initial, Class<?> c2Initial) {
+        if (c1Initial.isPrimitive() || c2Initial.isPrimitive()) {
+            return null;
+        } else {
+            Class<?> c1 = c1Initial;
+            Class<?> c2 = c2Initial;
+            while (true) {
+                if (c1.isAssignableFrom(c2)) {
+                    return c1;
+                }
+                if (c2.isAssignableFrom(c1)) {
+                    return c2;
+                }
+                c1 = getSupertype(c1);
+                c2 = getSupertype(c2);
+            }
+        }
+    }
+
+    @Test
+    public void findLeastCommonAncestorTest() {
+        Class<?>[] all = classes.toArray(new Class[classes.size()]);
+        for (int i = 0; i < all.length; i++) {
+            Class<?> c1 = all[i];
+            for (int j = i; j < all.length; j++) {
+                Class<?> c2 = all[j];
+                ResolvedJavaType t1 = metaAccess.lookupJavaType(c1);
+                ResolvedJavaType t2 = metaAccess.lookupJavaType(c2);
+                Class<?> expected = findLeastCommonAncestor(c1, c2);
+                ResolvedJavaType actual = t1.findLeastCommonAncestor(t2);
+                if (expected == null) {
+                    assertTrue(actual == null);
+                } else {
+                    assertNotNull(actual);
+                    assertTrue(actual.equals(metaAccess.lookupJavaType(expected)));
+                }
+            }
+        }
+    }
+
+    private static class Base {
+    }
+
+    abstract static class Abstract1 extends Base {
+    }
+
+    interface Interface1 {
+    }
+
+    static class Concrete1 extends Abstract1 {
+    }
+
+    static class Concrete2 extends Abstract1 implements Interface1 {
+    }
+
+    static class Concrete3 extends Concrete2 {
+    }
+
+    static final class Final1 extends Abstract1 {
+    }
+
+    abstract static class Abstract4 extends Concrete3 {
+    }
+
+    void checkConcreteSubtype(ResolvedJavaType type, ResolvedJavaType expected) {
+        AssumptionResult<ResolvedJavaType> leafConcreteSubtype = type.findLeafConcreteSubtype();
+        if (leafConcreteSubtype == null) {
+            // findLeafConcreteSubtype() is conservative
+        } else {
+            if (expected == null) {
+                assertNull(leafConcreteSubtype);
+            } else {
+                assertTrue(leafConcreteSubtype.getResult().equals(expected));
+            }
+        }
+
+        if (!type.isArray()) {
+            ResolvedJavaType arrayType = type.getArrayClass();
+            AssumptionResult<ResolvedJavaType> arraySubtype = arrayType.findLeafConcreteSubtype();
+            if (arraySubtype != null) {
+                assertEquals(arraySubtype.getResult(), arrayType);
+            } else {
+                // findLeafConcreteSubtype() method is conservative
+            }
+        }
+    }
+
+    @Test
+    public void findLeafConcreteSubtypeTest() {
+        ResolvedJavaType base = metaAccess.lookupJavaType(Base.class);
+        checkConcreteSubtype(base, base);
+
+        ResolvedJavaType a1 = metaAccess.lookupJavaType(Abstract1.class);
+        ResolvedJavaType c1 = metaAccess.lookupJavaType(Concrete1.class);
+
+        checkConcreteSubtype(base, null);
+        checkConcreteSubtype(a1, c1);
+        checkConcreteSubtype(c1, c1);
+
+        ResolvedJavaType i1 = metaAccess.lookupJavaType(Interface1.class);
+        ResolvedJavaType c2 = metaAccess.lookupJavaType(Concrete2.class);
+
+        checkConcreteSubtype(base, null);
+        checkConcreteSubtype(a1, null);
+        checkConcreteSubtype(c1, c1);
+        checkConcreteSubtype(i1, c2);
+        checkConcreteSubtype(c2, c2);
+
+        ResolvedJavaType c3 = metaAccess.lookupJavaType(Concrete3.class);
+        checkConcreteSubtype(c2, null);
+        checkConcreteSubtype(c3, c3);
+
+        ResolvedJavaType a4 = metaAccess.lookupJavaType(Abstract4.class);
+        checkConcreteSubtype(c3, null);
+        checkConcreteSubtype(a4, null);
+
+        ResolvedJavaType a1a = metaAccess.lookupJavaType(Abstract1[].class);
+        checkConcreteSubtype(a1a, null);
+        ResolvedJavaType c1a = metaAccess.lookupJavaType(Concrete1[].class);
+        checkConcreteSubtype(c1a, null);
+        ResolvedJavaType f1a = metaAccess.lookupJavaType(Final1[].class);
+        checkConcreteSubtype(f1a, f1a);
+
+        ResolvedJavaType obja = metaAccess.lookupJavaType(Object[].class);
+        checkConcreteSubtype(obja, null);
+
+        ResolvedJavaType inta = metaAccess.lookupJavaType(int[].class);
+        checkConcreteSubtype(inta, inta);
+    }
+
+    interface NoImplementor {
+    }
+
+    interface SingleImplementorInterface {
+    }
+
+    static class SingleConcreteImplementor implements SingleImplementorInterface {
+    }
+
+    interface SingleAbstractImplementorInterface {
+    }
+
+    abstract static class SingleAbstractImplementor implements SingleAbstractImplementorInterface {
+    }
+
+    interface MultiImplementorInterface {
+    }
+
+    static class ConcreteImplementor1 implements MultiImplementorInterface {
+    }
+
+    static class ConcreteImplementor2 implements MultiImplementorInterface {
+    }
+
+    interface MultipleAbstractImplementorInterface {
+    }
+
+    abstract static class MultiAbstractImplementor1 implements MultipleAbstractImplementorInterface {
+    }
+
+    abstract static class MultiAbstractImplementor2 implements MultipleAbstractImplementorInterface {
+    }
+
+    interface SingleAbstractImplementorInterface2 {
+    }
+
+    interface ExtendedSingleImplementorInterface {
+    }
+
+    abstract static class SingleAbstractImplementor2 implements SingleAbstractImplementorInterface2 {
+    }
+
+    static class ConcreteTransitiveImplementor1 extends SingleAbstractImplementor2 implements ExtendedSingleImplementorInterface {
+    }
+
+    static class ConcreteTransitiveImplementor2 extends SingleAbstractImplementor2 implements ExtendedSingleImplementorInterface {
+    }
+
+    @Test
+    public void getSingleImplementorTest() {
+        ResolvedJavaType iNi = metaAccess.lookupJavaType(NoImplementor.class);
+        assertNull(iNi.getSingleImplementor());
+
+        ResolvedJavaType iSi = metaAccess.lookupJavaType(SingleImplementorInterface.class);
+        ResolvedJavaType cSi = metaAccess.lookupJavaType(SingleConcreteImplementor.class);
+        assertEquals(cSi, iSi.getSingleImplementor());
+
+        ResolvedJavaType iSai = metaAccess.lookupJavaType(SingleAbstractImplementorInterface.class);
+        ResolvedJavaType aSai = metaAccess.lookupJavaType(SingleAbstractImplementor.class);
+        assertEquals(aSai, iSai.getSingleImplementor());
+
+        ResolvedJavaType iMi = metaAccess.lookupJavaType(MultiImplementorInterface.class);
+        metaAccess.lookupJavaType(ConcreteImplementor1.class);
+        metaAccess.lookupJavaType(ConcreteImplementor2.class);
+        assertEquals(iMi, iMi.getSingleImplementor());
+
+        ResolvedJavaType iMai = metaAccess.lookupJavaType(MultipleAbstractImplementorInterface.class);
+        metaAccess.lookupJavaType(MultiAbstractImplementor1.class);
+        metaAccess.lookupJavaType(MultiAbstractImplementor2.class);
+        assertEquals(iMai, iMai.getSingleImplementor());
+
+        ResolvedJavaType iSai2 = metaAccess.lookupJavaType(SingleAbstractImplementorInterface2.class);
+        ResolvedJavaType aSai2 = metaAccess.lookupJavaType(SingleAbstractImplementor2.class);
+        metaAccess.lookupJavaType(ConcreteTransitiveImplementor1.class);
+        metaAccess.lookupJavaType(ConcreteTransitiveImplementor2.class);
+        assertEquals(aSai2, iSai2.getSingleImplementor());
+    }
+
+    @Test(expected = JVMCIError.class)
+    public void getSingleImplementorTestClassReceiver() {
+        ResolvedJavaType base = metaAccess.lookupJavaType(Base.class);
+        base.getSingleImplementor();
+    }
+
+    @Test(expected = JVMCIError.class)
+    public void getSingleImplementorTestPrimitiveReceiver() {
+        ResolvedJavaType primitive = metaAccess.lookupJavaType(int.class);
+        primitive.getSingleImplementor();
+    }
+
+    @Test
+    public void getComponentTypeTest() {
+        for (Class<?> c : classes) {
+            ResolvedJavaType type = metaAccess.lookupJavaType(c);
+            Class<?> expected = c.getComponentType();
+            ResolvedJavaType actual = type.getComponentType();
+            if (expected == null) {
+                assertNull(actual);
+            } else {
+                assertTrue(actual.equals(metaAccess.lookupJavaType(expected)));
+            }
+        }
+    }
+
+    @Test
+    public void getArrayClassTest() {
+        for (Class<?> c : classes) {
+            if (c != void.class) {
+                ResolvedJavaType type = metaAccess.lookupJavaType(c);
+                Class<?> expected = getArrayClass(c);
+                ResolvedJavaType actual = type.getArrayClass();
+                assertTrue(actual.equals(metaAccess.lookupJavaType(expected)));
+            }
+        }
+    }
+
+    static class Declarations {
+
+        final Method implementation;
+        final Set<Method> declarations;
+
+        public Declarations(Method impl) {
+            this.implementation = impl;
+            declarations = new HashSet<>();
+        }
+    }
+
+    /**
+     * See <a href="http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-5.html#jvms-5.4.5">Method
+     * overriding</a>.
+     */
+    static boolean isOverriderOf(Method impl, Method m) {
+        if (!isPrivate(m.getModifiers()) && !isFinal(m.getModifiers())) {
+            if (m.getName().equals(impl.getName())) {
+                if (m.getReturnType() == impl.getReturnType()) {
+                    if (Arrays.equals(m.getParameterTypes(), impl.getParameterTypes())) {
+                        if (isPublic(m.getModifiers()) || isProtected(m.getModifiers())) {
+                            // m is public or protected
+                            return isPublic(impl.getModifiers()) || isProtected(impl.getModifiers());
+                        } else {
+                            // m is package-private
+                            return impl.getDeclaringClass().getPackage() == m.getDeclaringClass().getPackage();
+                        }
+                    }
+                }
+            }
+        }
+        return false;
+    }
+
+    static final Map<Class<?>, VTable> vtables = new HashMap<>();
+
+    static class VTable {
+
+        final Map<NameAndSignature, Method> methods = new HashMap<>();
+    }
+
+    static synchronized VTable getVTable(Class<?> c) {
+        VTable vtable = vtables.get(c);
+        if (vtable == null) {
+            vtable = new VTable();
+            if (c != Object.class) {
+                VTable superVtable = getVTable(c.getSuperclass());
+                vtable.methods.putAll(superVtable.methods);
+            }
+            for (Method m : c.getDeclaredMethods()) {
+                if (!isStatic(m.getModifiers()) && !isPrivate(m.getModifiers())) {
+                    if (isAbstract(m.getModifiers())) {
+                        // A subclass makes a concrete method in a superclass abstract
+                        vtable.methods.remove(new NameAndSignature(m));
+                    } else {
+                        vtable.methods.put(new NameAndSignature(m), m);
+                    }
+                }
+            }
+            vtables.put(c, vtable);
+        }
+        return vtable;
+    }
+
+    static Set<Method> findDeclarations(Method impl, Class<?> c) {
+        Set<Method> declarations = new HashSet<>();
+        NameAndSignature implSig = new NameAndSignature(impl);
+        if (c != null) {
+            for (Method m : c.getDeclaredMethods()) {
+                if (new NameAndSignature(m).equals(implSig)) {
+                    declarations.add(m);
+                    break;
+                }
+            }
+            if (!c.isInterface()) {
+                declarations.addAll(findDeclarations(impl, c.getSuperclass()));
+            }
+            for (Class<?> i : c.getInterfaces()) {
+                declarations.addAll(findDeclarations(impl, i));
+            }
+        }
+        return declarations;
+    }
+
+    private static void checkResolveMethod(ResolvedJavaType type, ResolvedJavaType context, ResolvedJavaMethod decl, ResolvedJavaMethod expected) {
+        ResolvedJavaMethod impl = type.resolveConcreteMethod(decl, context);
+        assertEquals(expected, impl);
+    }
+
+    @Test
+    public void resolveMethodTest() {
+        ResolvedJavaType context = metaAccess.lookupJavaType(TestResolvedJavaType.class);
+        for (Class<?> c : classes) {
+            if (c.isInterface() || c.isPrimitive()) {
+                ResolvedJavaType type = metaAccess.lookupJavaType(c);
+                for (Method m : c.getDeclaredMethods()) {
+                    if (JAVA_VERSION <= 1.7D || (!isStatic(m.getModifiers()) && !isPrivate(m.getModifiers()))) {
+                        ResolvedJavaMethod resolved = metaAccess.lookupJavaMethod(m);
+                        ResolvedJavaMethod impl = type.resolveMethod(resolved, context, true);
+                        ResolvedJavaMethod expected = resolved.isDefault() || resolved.isAbstract() ? resolved : null;
+                        assertEquals(m.toString(), expected, impl);
+                    } else {
+                        // As of JDK 8, interfaces can have static and private methods
+                    }
+                }
+            } else {
+                ResolvedJavaType type = metaAccess.lookupJavaType(c);
+                VTable vtable = getVTable(c);
+                for (Method impl : vtable.methods.values()) {
+                    Set<Method> decls = findDeclarations(impl, c);
+                    for (Method decl : decls) {
+                        ResolvedJavaMethod m = metaAccess.lookupJavaMethod(decl);
+                        if (m.isPublic()) {
+                            ResolvedJavaMethod i = metaAccess.lookupJavaMethod(impl);
+                            checkResolveMethod(type, context, m, i);
+                        }
+                    }
+                }
+            }
+        }
+    }
+
+    @Test
+    public void resolveConcreteMethodTest() {
+        ResolvedJavaType context = metaAccess.lookupJavaType(TestResolvedJavaType.class);
+        for (Class<?> c : classes) {
+            if (c.isInterface() || c.isPrimitive()) {
+                ResolvedJavaType type = metaAccess.lookupJavaType(c);
+                for (Method m : c.getDeclaredMethods()) {
+                    if (JAVA_VERSION <= 1.7D || (!isStatic(m.getModifiers()) && !isPrivate(m.getModifiers()))) {
+                        ResolvedJavaMethod resolved = metaAccess.lookupJavaMethod(m);
+                        ResolvedJavaMethod impl = type.resolveConcreteMethod(resolved, context);
+                        ResolvedJavaMethod expected = resolved.isDefault() ? resolved : null;
+                        assertEquals(m.toString(), expected, impl);
+                    } else {
+                        // As of JDK 8, interfaces can have static and private methods
+                    }
+                }
+            } else {
+                ResolvedJavaType type = metaAccess.lookupJavaType(c);
+                VTable vtable = getVTable(c);
+                for (Method impl : vtable.methods.values()) {
+                    Set<Method> decls = findDeclarations(impl, c);
+                    for (Method decl : decls) {
+                        ResolvedJavaMethod m = metaAccess.lookupJavaMethod(decl);
+                        if (m.isPublic()) {
+                            ResolvedJavaMethod i = metaAccess.lookupJavaMethod(impl);
+                            checkResolveMethod(type, context, m, i);
+                        }
+                    }
+                }
+                for (Method m : c.getDeclaredMethods()) {
+                    ResolvedJavaMethod impl = type.resolveConcreteMethod(metaAccess.lookupJavaMethod(m), context);
+                    ResolvedJavaMethod expected = isAbstract(m.getModifiers()) ? null : impl;
+                    assertEquals(type + " " + m.toString(), expected, impl);
+                }
+            }
+        }
+    }
+
+    @Test
+    public void findUniqueConcreteMethodTest() throws NoSuchMethodException {
+        ResolvedJavaMethod thisMethod = metaAccess.lookupJavaMethod(getClass().getDeclaredMethod("findUniqueConcreteMethodTest"));
+        ResolvedJavaMethod ucm = metaAccess.lookupJavaType(getClass()).findUniqueConcreteMethod(thisMethod).getResult();
+        assertEquals(thisMethod, ucm);
+    }
+
+    public static Set<Field> getInstanceFields(Class<?> c, boolean includeSuperclasses) {
+        if (c.isArray() || c.isPrimitive() || c.isInterface()) {
+            return Collections.emptySet();
+        }
+        Set<Field> result = new HashSet<>();
+        for (Field f : c.getDeclaredFields()) {
+            if (!Modifier.isStatic(f.getModifiers())) {
+                result.add(f);
+            }
+        }
+        if (includeSuperclasses && c != Object.class) {
+            result.addAll(getInstanceFields(c.getSuperclass(), true));
+        }
+        return result;
+    }
+
+    public static Set<Field> getStaticFields(Class<?> c) {
+        Set<Field> result = new HashSet<>();
+        for (Field f : c.getDeclaredFields()) {
+            if (Modifier.isStatic(f.getModifiers())) {
+                result.add(f);
+            }
+        }
+        return result;
+    }
+
+    public boolean fieldsEqual(Field f, ResolvedJavaField rjf) {
+        return rjf.getDeclaringClass().equals(metaAccess.lookupJavaType(f.getDeclaringClass())) && rjf.getName().equals(f.getName()) &&
+                        rjf.getType().resolve(rjf.getDeclaringClass()).equals(metaAccess.lookupJavaType(f.getType()));
+    }
+
+    public ResolvedJavaField lookupField(ResolvedJavaField[] fields, Field key) {
+        for (ResolvedJavaField rf : fields) {
+            if (fieldsEqual(key, rf)) {
+                return rf;
+            }
+        }
+        return null;
+    }
+
+    public Field lookupField(Set<Field> fields, ResolvedJavaField key) {
+        for (Field f : fields) {
+            if (fieldsEqual(f, key)) {
+                return f;
+            }
+        }
+        return null;
+    }
+
+    private boolean isHiddenFromReflection(ResolvedJavaField f) {
+        if (f.getDeclaringClass().equals(metaAccess.lookupJavaType(Throwable.class)) && f.getName().equals("backtrace")) {
+            return true;
+        }
+        if (f.getDeclaringClass().equals(metaAccess.lookupJavaType(ConstantPool.class)) && f.getName().equals("constantPoolOop")) {
+            return true;
+        }
+        if (f.getDeclaringClass().equals(metaAccess.lookupJavaType(Class.class)) && f.getName().equals("classLoader")) {
+            return true;
+        }
+        return false;
+    }
+
+    @Test
+    public void getInstanceFieldsTest() {
+        for (Class<?> c : classes) {
+            ResolvedJavaType type = metaAccess.lookupJavaType(c);
+            for (boolean includeSuperclasses : new boolean[]{true, false}) {
+                Set<Field> expected = getInstanceFields(c, includeSuperclasses);
+                ResolvedJavaField[] actual = type.getInstanceFields(includeSuperclasses);
+                for (Field f : expected) {
+                    assertNotNull(lookupField(actual, f));
+                }
+                for (ResolvedJavaField rf : actual) {
+                    if (!isHiddenFromReflection(rf)) {
+                        assertEquals(rf.toString(), lookupField(expected, rf) != null, !rf.isInternal());
+                    }
+                }
+
+                // Test stability of getInstanceFields
+                ResolvedJavaField[] actual2 = type.getInstanceFields(includeSuperclasses);
+                assertArrayEquals(actual, actual2);
+            }
+        }
+    }
+
+    @Test
+    public void getStaticFieldsTest() {
+        for (Class<?> c : classes) {
+            ResolvedJavaType type = metaAccess.lookupJavaType(c);
+            Set<Field> expected = getStaticFields(c);
+            ResolvedJavaField[] actual = type.getStaticFields();
+            for (Field f : expected) {
+                assertNotNull(lookupField(actual, f));
+            }
+            for (ResolvedJavaField rf : actual) {
+                if (!isHiddenFromReflection(rf)) {
+                    assertEquals(lookupField(expected, rf) != null, !rf.isInternal());
+                }
+            }
+
+            // Test stability of getStaticFields
+            ResolvedJavaField[] actual2 = type.getStaticFields();
+            assertArrayEquals(actual, actual2);
+        }
+    }
+
+    @Test
+    public void getDeclaredMethodsTest() {
+        for (Class<?> c : classes) {
+            ResolvedJavaType type = metaAccess.lookupJavaType(c);
+            Method[] raw = c.getDeclaredMethods();
+            Set<ResolvedJavaMethod> expected = new HashSet<>();
+            for (Method m : raw) {
+                ResolvedJavaMethod resolvedMethod = metaAccess.lookupJavaMethod(m);
+                assertNotNull(resolvedMethod);
+                expected.add(resolvedMethod);
+            }
+            Set<ResolvedJavaMethod> actual = new HashSet<>(Arrays.asList(type.getDeclaredMethods()));
+            assertEquals(expected, actual);
+        }
+    }
+
+    static class A {
+        static String name = "foo";
+    }
+
+    static class B extends A {
+    }
+
+    static class C {
+    }
+
+    static class D {
+        void foo() {
+            // use of assertions causes the class to have a <clinit>
+            assert getClass() != null;
+        }
+    }
+
+    @Test
+    public void getClassInitializerTest() {
+        assertNotNull(metaAccess.lookupJavaType(A.class).getClassInitializer());
+        assertNotNull(metaAccess.lookupJavaType(D.class).getClassInitializer());
+        assertNull(metaAccess.lookupJavaType(B.class).getClassInitializer());
+        assertNull(metaAccess.lookupJavaType(C.class).getClassInitializer());
+        assertNull(metaAccess.lookupJavaType(int.class).getClassInitializer());
+        assertNull(metaAccess.lookupJavaType(void.class).getClassInitializer());
+    }
+
+    @Test
+    public void getAnnotationTest() {
+        for (Class<?> c : classes) {
+            ResolvedJavaType type = metaAccess.lookupJavaType(c);
+            for (Annotation a : c.getAnnotations()) {
+                assertEquals(a, type.getAnnotation(a.annotationType()));
+            }
+        }
+    }
+
+    @Test
+    public void memberClassesTest() {
+        for (Class<?> c : classes) {
+            ResolvedJavaType type = metaAccess.lookupJavaType(c);
+            assertEquals(c.isLocalClass(), type.isLocal());
+            assertEquals(c.isMemberClass(), type.isMember());
+            Class<?> enclc = c.getEnclosingClass();
+            ResolvedJavaType enclt = type.getEnclosingType();
+            assertFalse(enclc == null ^ enclt == null);
+            if (enclc != null) {
+                assertEquals(enclt, metaAccess.lookupJavaType(enclc));
+            }
+        }
+    }
+
+    @Test
+    public void classFilePathTest() {
+        for (Class<?> c : classes) {
+            ResolvedJavaType type = metaAccess.lookupJavaType(c);
+            URL path = type.getClassFilePath();
+            if (type.isPrimitive() || type.isArray()) {
+                assertEquals(null, path);
+            } else {
+                assertNotNull(path);
+                String pathString = path.getPath();
+                if (type.isLocal() || type.isMember()) {
+                    assertTrue(pathString.indexOf('$') > 0);
+                }
+            }
+        }
+    }
+
+    @Test
+    public void isTrustedInterfaceTypeTest() {
+        for (Class<?> c : classes) {
+            ResolvedJavaType type = metaAccess.lookupJavaType(c);
+            if (TrustedInterface.class.isAssignableFrom(c)) {
+                assertTrue(type.isTrustedInterfaceType());
+            }
+        }
+    }
+
+    private Method findTestMethod(Method apiMethod) {
+        String testName = apiMethod.getName() + "Test";
+        for (Method m : getClass().getDeclaredMethods()) {
+            if (m.getName().equals(testName) && m.getAnnotation(Test.class) != null) {
+                return m;
+            }
+        }
+        return null;
+    }
+
+    // @formatter:off
+    private static final String[] untestedApiMethods = {
+        "initialize",
+        "isPrimitive",
+        "newArray",
+        "getDeclaredConstructors",
+        "isInitialized",
+        "isLinked",
+        "getJavaClass",
+        "getObjectHub",
+        "hasFinalizableSubclass",
+        "hasFinalizer",
+        "getSourceFileName",
+        "getClassFilePath",
+        "isLocal",
+        "isJavaLangObject",
+        "isMember",
+        "getElementalType",
+        "getEnclosingType",
+        "$jacocoInit"
+    };
+    // @formatter:on
+
+    /**
+     * Ensures that any new methods added to {@link ResolvedJavaMethod} either have a test written
+     * for them or are added to {@link #untestedApiMethods}.
+     */
+    @Test
+    public void testCoverage() {
+        Set<String> known = new HashSet<>(Arrays.asList(untestedApiMethods));
+        for (Method m : ResolvedJavaType.class.getDeclaredMethods()) {
+            if (findTestMethod(m) == null) {
+                assertTrue("test missing for " + m, known.contains(m.getName()));
+            } else {
+                assertFalse("test should be removed from untestedApiMethods" + m, known.contains(m.getName()));
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.java.test/src/com/oracle/graal/java/test/TypeUniverse.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,150 @@
+/*
+ * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.graal.java.test;
+
+import java.io.*;
+import java.lang.reflect.*;
+import java.util.*;
+import java.util.Queue;
+
+import org.junit.*;
+
+import sun.misc.*;
+
+import com.oracle.graal.api.replacements.*;
+import com.oracle.graal.api.runtime.*;
+import com.oracle.graal.phases.util.*;
+import com.oracle.graal.runtime.*;
+import com.oracle.jvmci.meta.*;
+
+/**
+ * Context for type related tests.
+ */
+public class TypeUniverse {
+
+    public final Unsafe unsafe;
+    public static final double JAVA_VERSION = Double.valueOf(System.getProperty("java.specification.version"));
+
+    public final MetaAccessProvider metaAccess;
+    public final ConstantReflectionProvider constantReflection;
+    public final SnippetReflectionProvider snippetReflection;
+    public final Collection<Class<?>> classes = new HashSet<>();
+    public final Map<Class<?>, Class<?>> arrayClasses = new HashMap<>();
+    public final List<JavaConstant> constants = new ArrayList<>();
+
+    public TypeUniverse() {
+        Providers providers = Graal.getRequiredCapability(RuntimeProvider.class).getHostBackend().getProviders();
+        metaAccess = providers.getMetaAccess();
+        constantReflection = providers.getConstantReflection();
+        snippetReflection = Graal.getRequiredCapability(SnippetReflectionProvider.class);
+        Unsafe theUnsafe = null;
+        try {
+            theUnsafe = Unsafe.getUnsafe();
+        } catch (Exception e) {
+            try {
+                Field theUnsafeField = Unsafe.class.getDeclaredField("theUnsafe");
+                theUnsafeField.setAccessible(true);
+                theUnsafe = (Unsafe) theUnsafeField.get(null);
+            } catch (Exception e1) {
+                throw (InternalError) new InternalError("unable to initialize unsafe").initCause(e1);
+            }
+        }
+        unsafe = theUnsafe;
+
+        Class<?>[] initialClasses = {void.class, boolean.class, byte.class, short.class, char.class, int.class, float.class, long.class, double.class, Object.class, Class.class, ClassLoader.class,
+                        String.class, Serializable.class, Cloneable.class, Test.class, TestMetaAccessProvider.class, List.class, Collection.class, Map.class, Queue.class, HashMap.class,
+                        LinkedHashMap.class, IdentityHashMap.class, AbstractCollection.class, AbstractList.class, ArrayList.class, TrustedInterface.class};
+        for (Class<?> c : initialClasses) {
+            addClass(c);
+        }
+        for (Field f : JavaConstant.class.getDeclaredFields()) {
+            int mods = f.getModifiers();
+            if (f.getType() == JavaConstant.class && Modifier.isPublic(mods) && Modifier.isStatic(mods) && Modifier.isFinal(mods)) {
+                try {
+                    JavaConstant c = (JavaConstant) f.get(null);
+                    if (c != null) {
+                        constants.add(c);
+                    }
+                } catch (Exception e) {
+                }
+            }
+        }
+        for (Class<?> c : classes) {
+            if (c != void.class && !c.isArray()) {
+                constants.add(snippetReflection.forObject(Array.newInstance(c, 42)));
+            }
+        }
+        constants.add(snippetReflection.forObject(new ArrayList<>()));
+        constants.add(snippetReflection.forObject(new IdentityHashMap<>()));
+        constants.add(snippetReflection.forObject(new LinkedHashMap<>()));
+        constants.add(snippetReflection.forObject(new TreeMap<>()));
+        constants.add(snippetReflection.forObject(new ArrayDeque<>()));
+        constants.add(snippetReflection.forObject(new LinkedList<>()));
+        constants.add(snippetReflection.forObject("a string"));
+        constants.add(snippetReflection.forObject(42));
+        constants.add(snippetReflection.forObject(String.class));
+        constants.add(snippetReflection.forObject(String[].class));
+    }
+
+    public synchronized Class<?> getArrayClass(Class<?> componentType) {
+        Class<?> arrayClass = arrayClasses.get(componentType);
+        if (arrayClass == null) {
+            arrayClass = Array.newInstance(componentType, 0).getClass();
+            arrayClasses.put(componentType, arrayClass);
+        }
+        return arrayClass;
+    }
+
+    public static int dimensions(Class<?> c) {
+        if (c.getComponentType() != null) {
+            return 1 + dimensions(c.getComponentType());
+        }
+        return 0;
+    }
+
+    private void addClass(Class<?> c) {
+        if (classes.add(c)) {
+            if (c.getSuperclass() != null) {
+                addClass(c.getSuperclass());
+            }
+            for (Class<?> sc : c.getInterfaces()) {
+                addClass(sc);
+            }
+            for (Class<?> dc : c.getDeclaredClasses()) {
+                addClass(dc);
+            }
+            for (Method m : c.getDeclaredMethods()) {
+                addClass(m.getReturnType());
+                for (Class<?> p : m.getParameterTypes()) {
+                    addClass(p);
+                }
+            }
+
+            if (c != void.class && dimensions(c) < 2) {
+                Class<?> arrayClass = Array.newInstance(c, 0).getClass();
+                arrayClasses.put(c, arrayClass);
+                addClass(arrayClass);
+            }
+        }
+    }
+}
--- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/BciBlockMapping.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/BciBlockMapping.java	Thu May 28 21:11:28 2015 -0700
@@ -22,16 +22,18 @@
  */
 package com.oracle.graal.java;
 
+import com.oracle.jvmci.code.BailoutException;
+import com.oracle.jvmci.code.BytecodeFrame;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
+import com.oracle.jvmci.meta.ExceptionHandler;
 import static com.oracle.graal.bytecode.Bytecodes.*;
 import static com.oracle.graal.compiler.common.GraalOptions.*;
 
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.bytecode.*;
 import com.oracle.graal.compiler.common.*;
-import com.oracle.graal.debug.*;
+import com.oracle.jvmci.debug.*;
 
 /**
  * Builds a mapping between bytecodes and basic blocks and builds a conservative control flow graph
--- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/BytecodeDisassembler.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/BytecodeDisassembler.java	Thu May 28 21:11:28 2015 -0700
@@ -22,9 +22,15 @@
  */
 package com.oracle.graal.java;
 
+import com.oracle.jvmci.meta.JavaField;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
+import com.oracle.jvmci.meta.BytecodeDisassemblerProvider;
+import com.oracle.jvmci.meta.JavaConstant;
+import com.oracle.jvmci.meta.JavaType;
+import com.oracle.jvmci.meta.JavaMethod;
+import com.oracle.jvmci.meta.ConstantPool;
 import static com.oracle.graal.bytecode.Bytecodes.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.bytecode.*;
 
 /**
--- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/DefaultSuitesProvider.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/DefaultSuitesProvider.java	Thu May 28 21:11:28 2015 -0700
@@ -23,12 +23,12 @@
 package com.oracle.graal.java;
 
 import com.oracle.graal.graphbuilderconf.*;
-import com.oracle.graal.graphbuilderconf.GraphBuilderConfiguration.*;
+import com.oracle.graal.graphbuilderconf.GraphBuilderConfiguration.Plugins;
 import com.oracle.graal.lir.phases.*;
-import com.oracle.graal.options.*;
-import com.oracle.graal.options.DerivedOptionValue.OptionSupplier;
 import com.oracle.graal.phases.*;
 import com.oracle.graal.phases.tiers.*;
+import com.oracle.jvmci.options.*;
+import com.oracle.jvmci.options.DerivedOptionValue.OptionSupplier;
 
 public class DefaultSuitesProvider implements SuitesProvider {
 
--- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/FrameStateBuilder.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/FrameStateBuilder.java	Thu May 28 21:11:28 2015 -0700
@@ -22,16 +22,14 @@
  */
 package com.oracle.graal.java;
 
+import static com.oracle.graal.bytecode.Bytecodes.*;
 import static com.oracle.graal.graph.iterators.NodePredicates.*;
 import static com.oracle.graal.java.GraphBuilderPhase.Options.*;
+import static com.oracle.jvmci.common.JVMCIError.*;
 
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.type.*;
-import com.oracle.graal.debug.*;
 import com.oracle.graal.graphbuilderconf.IntrinsicContext.SideEffectsState;
 import com.oracle.graal.graphbuilderconf.*;
 import com.oracle.graal.java.BciBlockMapping.BciBlock;
@@ -41,23 +39,26 @@
 import com.oracle.graal.nodes.calc.*;
 import com.oracle.graal.nodes.java.*;
 import com.oracle.graal.nodes.util.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.meta.*;
 
 public final class FrameStateBuilder implements SideEffectsState {
 
-    static final ValueNode[] EMPTY_ARRAY = new ValueNode[0];
-    static final MonitorIdNode[] EMPTY_MONITOR_ARRAY = new MonitorIdNode[0];
+    private static final ValueNode[] EMPTY_ARRAY = new ValueNode[0];
+    private static final MonitorIdNode[] EMPTY_MONITOR_ARRAY = new MonitorIdNode[0];
 
-    protected final BytecodeParser parser;
-    protected final ResolvedJavaMethod method;
-    protected int stackSize;
+    private final BytecodeParser parser;
+    private final ResolvedJavaMethod method;
+    private int stackSize;
     protected final ValueNode[] locals;
     protected final ValueNode[] stack;
-    protected ValueNode[] lockedObjects;
+    private ValueNode[] lockedObjects;
 
     /**
      * @see BytecodeFrame#rethrowException
      */
-    protected boolean rethrowException;
+    private boolean rethrowException;
 
     private MonitorIdNode[] monitorIds;
     private final StructuredGraph graph;
@@ -67,7 +68,7 @@
      * The closest {@link StateSplit#hasSideEffect() side-effect} predecessors. There will be more
      * than one when the current block contains no side-effects but merging predecessor blocks do.
      */
-    protected List<StateSplit> sideEffects;
+    private List<StateSplit> sideEffects;
 
     /**
      * Creates a new frame state builder for the given method and the given target graph.
@@ -179,6 +180,10 @@
         return length == 0 ? EMPTY_ARRAY : new ValueNode[length];
     }
 
+    public ResolvedJavaMethod getMethod() {
+        return method;
+    }
+
     @Override
     public String toString() {
         StringBuilder sb = new StringBuilder();
@@ -208,29 +213,30 @@
         }
 
         // Skip intrinsic frames
-        return create(bci, parser.getNonIntrinsicAncestor(), false, (ValueNode[]) null);
+        return create(bci, parser.getNonIntrinsicAncestor(), false, null, null);
     }
 
     /**
      * @param pushedValues if non-null, values to {@link #push(Kind, ValueNode)} to the stack before
      *            creating the {@link FrameState}
      */
-    public FrameState create(int bci, BytecodeParser parent, boolean duringCall, ValueNode... pushedValues) {
+    public FrameState create(int bci, BytecodeParser parent, boolean duringCall, Kind[] pushedSlotKinds, ValueNode[] pushedValues) {
         if (outerFrameState == null && parent != null) {
             outerFrameState = parent.getFrameStateBuilder().create(parent.bci(), null);
         }
         if (bci == BytecodeFrame.AFTER_EXCEPTION_BCI && parent != null) {
-            FrameState newFrameState = outerFrameState.duplicateModified(outerFrameState.bci, true, Kind.Void, this.peek(0));
+            FrameState newFrameState = outerFrameState.duplicateModified(outerFrameState.bci, true, Kind.Void, new Kind[]{Kind.Object}, new ValueNode[]{stack[0]});
             return newFrameState;
         }
         if (bci == BytecodeFrame.INVALID_FRAMESTATE_BCI) {
-            throw GraalInternalError.shouldNotReachHere();
+            throw shouldNotReachHere();
         }
 
         if (pushedValues != null) {
+            assert pushedSlotKinds.length == pushedValues.length;
             int stackSizeToRestore = stackSize;
-            for (ValueNode arg : pushedValues) {
-                push(arg.getKind(), arg);
+            for (int i = 0; i < pushedValues.length; i++) {
+                push(pushedSlotKinds[i], pushedValues[i]);
             }
             FrameState res = graph.add(new FrameState(outerFrameState, method, bci, locals, stack, stackSize, lockedObjects, Arrays.asList(monitorIds), rethrowException, duringCall));
             stackSize = stackSizeToRestore;
@@ -262,7 +268,7 @@
             return FrameState.toBytecodePosition(outerFrameState);
         }
         if (bci == BytecodeFrame.INVALID_FRAMESTATE_BCI) {
-            throw GraalInternalError.shouldNotReachHere();
+            throw shouldNotReachHere();
         }
         return new BytecodePosition(outer, method, bci);
     }
@@ -279,8 +285,8 @@
             return false;
         }
         for (int i = 0; i < stackSize(); i++) {
-            ValueNode x = stackAt(i);
-            ValueNode y = other.stackAt(i);
+            ValueNode x = stack[i];
+            ValueNode y = other.stack[i];
             if (x != y && (x == null || x.isDeleted() || y == null || y.isDeleted() || x.getKind() != y.getKind())) {
                 return false;
             }
@@ -300,18 +306,10 @@
         assert isCompatibleWith(other);
 
         for (int i = 0; i < localsSize(); i++) {
-            ValueNode curLocal = localAt(i);
-            ValueNode mergedLocal = merge(curLocal, other.localAt(i), block);
-            if (curLocal != mergedLocal) {
-                storeLocal(i, mergedLocal);
-            }
+            locals[i] = merge(locals[i], other.locals[i], block);
         }
         for (int i = 0; i < stackSize(); i++) {
-            ValueNode curStack = stackAt(i);
-            ValueNode mergedStack = merge(curStack, other.stackAt(i), block);
-            if (curStack != mergedStack) {
-                storeStack(i, mergedStack);
-            }
+            stack[i] = merge(stack[i], other.stack[i], block);
         }
         for (int i = 0; i < lockedObjects.length; i++) {
             lockedObjects[i] = merge(lockedObjects[i], other.lockedObjects[i], block);
@@ -381,11 +379,11 @@
         for (int i = 0; i < localsSize(); i++) {
             boolean changedInLoop = liveness.localIsChangedInLoop(loopId, i);
             if (changedInLoop || forcePhis) {
-                storeLocal(i, createLoopPhi(loopBegin, localAt(i), !changedInLoop));
+                locals[i] = createLoopPhi(loopBegin, locals[i], !changedInLoop);
             }
         }
         for (int i = 0; i < stackSize(); i++) {
-            storeStack(i, createLoopPhi(loopBegin, stackAt(i), false));
+            stack[i] = createLoopPhi(loopBegin, stack[i], false);
         }
         for (int i = 0; i < lockedObjects.length; i++) {
             lockedObjects[i] = createLoopPhi(loopBegin, lockedObjects[i], false);
@@ -394,17 +392,17 @@
 
     public void insertLoopProxies(LoopExitNode loopExit, FrameStateBuilder loopEntryState) {
         for (int i = 0; i < localsSize(); i++) {
-            ValueNode value = localAt(i);
+            ValueNode value = locals[i];
             if (value != null && (!loopEntryState.contains(value) || loopExit.loopBegin().isPhiAtMerge(value))) {
                 Debug.log(" inserting proxy for %s", value);
-                storeLocal(i, ProxyNode.forValue(value, loopExit, graph));
+                locals[i] = ProxyNode.forValue(value, loopExit, graph);
             }
         }
         for (int i = 0; i < stackSize(); i++) {
-            ValueNode value = stackAt(i);
+            ValueNode value = stack[i];
             if (value != null && (!loopEntryState.contains(value) || loopExit.loopBegin().isPhiAtMerge(value))) {
                 Debug.log(" inserting proxy for %s", value);
-                storeStack(i, ProxyNode.forValue(value, loopExit, graph));
+                stack[i] = ProxyNode.forValue(value, loopExit, graph);
             }
         }
         for (int i = 0; i < lockedObjects.length; i++) {
@@ -418,17 +416,17 @@
 
     public void insertProxies(AbstractBeginNode begin) {
         for (int i = 0; i < localsSize(); i++) {
-            ValueNode value = localAt(i);
+            ValueNode value = locals[i];
             if (value != null) {
                 Debug.log(" inserting proxy for %s", value);
-                storeLocal(i, ProxyNode.forValue(value, begin, graph));
+                locals[i] = ProxyNode.forValue(value, begin, graph);
             }
         }
         for (int i = 0; i < stackSize(); i++) {
-            ValueNode value = stackAt(i);
+            ValueNode value = stack[i];
             if (value != null) {
                 Debug.log(" inserting proxy for %s", value);
-                storeStack(i, ProxyNode.forValue(value, begin, graph));
+                stack[i] = ProxyNode.forValue(value, begin, graph);
             }
         }
         for (int i = 0; i < lockedObjects.length; i++) {
@@ -494,12 +492,12 @@
 
     public boolean contains(ValueNode value) {
         for (int i = 0; i < localsSize(); i++) {
-            if (localAt(i) == value) {
+            if (locals[i] == value) {
                 return true;
             }
         }
         for (int i = 0; i < stackSize(); i++) {
-            if (stackAt(i) == value) {
+            if (stack[i] == value) {
                 return true;
             }
         }
@@ -568,61 +566,20 @@
     }
 
     /**
-     * Gets the value in the local variables at the specified index, without any sanity checking.
-     *
-     * @param i the index into the locals
-     * @return the instruction that produced the value for the specified local
-     */
-    public ValueNode localAt(int i) {
-        return locals[i];
-    }
-
-    /**
-     * Get the value on the stack at the specified stack index.
-     *
-     * @param i the index into the stack, with {@code 0} being the bottom of the stack
-     * @return the instruction at the specified position in the stack
-     */
-    public ValueNode stackAt(int i) {
-        return stack[i];
-    }
-
-    /**
-     * Gets the value in the lock at the specified index, without any sanity checking.
-     *
-     * @param i the index into the lock
-     * @return the instruction that produced the value for the specified lock
-     */
-    public ValueNode lockAt(int i) {
-        return lockedObjects[i];
-    }
-
-    public void storeLock(int i, ValueNode lock) {
-        lockedObjects[i] = lock;
-    }
-
-    /**
      * Loads the local variable at the specified index, checking that the returned value is non-null
      * and that two-stack values are properly handled.
      *
      * @param i the index of the local variable to load
+     * @param slotKind the kind of the local variable from the point of view of the bytecodes
      * @return the instruction that produced the specified local
      */
-    public ValueNode loadLocal(int i) {
+    public ValueNode loadLocal(int i, Kind slotKind) {
+        assert slotKind.getSlotCount() > 0;
+        assert slotKind.getSlotCount() == 1 || locals[i + 1] == null;
+
         ValueNode x = locals[i];
-        assert assertLoadLocal(i, x);
-        return x;
-    }
-
-    private boolean assertLoadLocal(int i, ValueNode x) {
         assert x != null : i;
-        assert parser.parsingIntrinsic() || (x.getKind().getSlotCount() == 1 || locals[i + 1] == null);
-        assert parser.parsingIntrinsic() || (i == 0 || locals[i - 1] == null || locals[i - 1].getKind().getSlotCount() == 1);
-        return true;
-    }
-
-    public void storeLocal(int i, ValueNode x) {
-        storeLocal(i, x, x == null ? null : x.getKind());
+        return x;
     }
 
     /**
@@ -630,223 +587,69 @@
      * the next local variable index is also overwritten.
      *
      * @param i the index at which to store
+     * @param slotKind the kind of the local variable from the point of view of the bytecodes
      * @param x the instruction which produces the value for the local
      */
-    public void storeLocal(int i, ValueNode x, Kind kind) {
-        assert assertStoreLocal(x);
+    public void storeLocal(int i, Kind slotKind, ValueNode x) {
+        assert slotKind.getSlotCount() > 0;
+
         locals[i] = x;
-        if (x != null) {
-            if (kind.needsTwoSlots() && !parser.parsingIntrinsic()) {
-                // if this is a double word, then kill i+1
-                locals[i + 1] = null;
-            }
-            if (i > 0 && !parser.parsingIntrinsic()) {
-                ValueNode p = locals[i - 1];
-                if (p != null && p.getKind().needsTwoSlots()) {
-                    // if there was a double word at i - 1, then kill it
-                    locals[i - 1] = null;
-                }
-            }
+        if (slotKind.needsTwoSlots()) {
+            locals[i + 1] = null;
         }
     }
 
-    private boolean assertStoreLocal(ValueNode x) {
-        assert x == null || parser.parsingIntrinsic() || (x.getKind() != Kind.Void && x.getKind() != Kind.Illegal) : "unexpected value: " + x;
-        return true;
-    }
-
-    public void storeStack(int i, ValueNode x) {
-        assert assertStoreStack(i, x);
-        stack[i] = x;
-    }
-
-    private boolean assertStoreStack(int i, ValueNode x) {
-        assert x == null || (stack[i] == null || x.getKind() == stack[i].getKind()) : "Method does not handle changes from one-slot to two-slot values or non-alive values";
-        return true;
-    }
-
     /**
      * Pushes an instruction onto the stack with the expected type.
      *
-     * @param kind the type expected for this instruction
+     * @param slotKind the kind of the stack element from the point of view of the bytecodes
      * @param x the instruction to push onto the stack
      */
-    public void push(Kind kind, ValueNode x) {
-        assert assertPush(kind, x);
+    public void push(Kind slotKind, ValueNode x) {
+        assert x != null;
+        assert slotKind.getSlotCount() > 0;
         xpush(x);
-        if (kind.needsTwoSlots()) {
+        if (slotKind.needsTwoSlots()) {
             xpush(null);
         }
     }
 
-    private boolean assertPush(Kind kind, ValueNode x) {
-        assert parser.parsingIntrinsic() || (x.getKind() != Kind.Void && x.getKind() != Kind.Illegal);
-        assert x != null && (parser.parsingIntrinsic() || x.getKind() == kind);
-        return true;
-    }
-
-    /**
-     * Pushes a value onto the stack without checking the type.
-     *
-     * @param x the instruction to push onto the stack
-     */
-    public void xpush(ValueNode x) {
-        assert assertXpush(x);
-        stack[stackSize++] = x;
-    }
-
-    private boolean assertXpush(ValueNode x) {
-        assert parser.parsingIntrinsic() || (x == null || (x.getKind() != Kind.Void && x.getKind() != Kind.Illegal));
-        return true;
-    }
-
-    /**
-     * Pushes a value onto the stack and checks that it is an int.
-     *
-     * @param x the instruction to push onto the stack
-     */
-    public void ipush(ValueNode x) {
-        assert assertInt(x);
-        xpush(x);
-    }
-
-    /**
-     * Pushes a value onto the stack and checks that it is a float.
-     *
-     * @param x the instruction to push onto the stack
-     */
-    public void fpush(ValueNode x) {
-        assert assertFloat(x);
-        xpush(x);
-    }
-
-    /**
-     * Pushes a value onto the stack and checks that it is an object.
-     *
-     * @param x the instruction to push onto the stack
-     */
-    public void apush(ValueNode x) {
-        assert assertObject(x);
-        xpush(x);
-    }
-
-    /**
-     * Pushes a value onto the stack and checks that it is a long.
-     *
-     * @param x the instruction to push onto the stack
-     */
-    public void lpush(ValueNode x) {
-        assert assertLong(x);
-        xpush(x);
-        xpush(null);
-    }
-
-    /**
-     * Pushes a value onto the stack and checks that it is a double.
-     *
-     * @param x the instruction to push onto the stack
-     */
-    public void dpush(ValueNode x) {
-        assert assertDouble(x);
-        xpush(x);
-        xpush(null);
-    }
-
-    public void pushReturn(Kind kind, ValueNode x) {
-        if (kind != Kind.Void) {
-            push(kind.getStackKind(), x);
+    public void pushReturn(Kind slotKind, ValueNode x) {
+        if (slotKind != Kind.Void) {
+            push(slotKind, x);
         }
     }
 
     /**
      * Pops an instruction off the stack with the expected type.
      *
-     * @param kind the expected type
+     * @param slotKind the kind of the stack element from the point of view of the bytecodes
      * @return the instruction on the top of the stack
      */
-    public ValueNode pop(Kind kind) {
-        if (kind.needsTwoSlots()) {
-            xpop();
+    public ValueNode pop(Kind slotKind) {
+        assert slotKind.getSlotCount() > 0;
+        if (slotKind.needsTwoSlots()) {
+            ValueNode s = xpop();
+            assert s == null;
         }
-        assert assertPop(kind);
-        return xpop();
+        ValueNode x = xpop();
+        assert x != null;
+        return x;
     }
 
-    private boolean assertPop(Kind kind) {
-        assert kind != Kind.Void;
-        ValueNode x = xpeek();
-        assert x != null && (parser.parsingIntrinsic() || x.getKind() == kind);
-        return true;
+    private void xpush(ValueNode x) {
+        stack[stackSize++] = x;
     }
 
-    /**
-     * Pops a value off of the stack without checking the type.
-     *
-     * @return x the instruction popped off the stack
-     */
-    public ValueNode xpop() {
+    private ValueNode xpop() {
         return stack[--stackSize];
     }
 
-    public ValueNode xpeek() {
+    private ValueNode xpeek() {
         return stack[stackSize - 1];
     }
 
     /**
-     * Pops a value off of the stack and checks that it is an int.
-     *
-     * @return x the instruction popped off the stack
-     */
-    public ValueNode ipop() {
-        assert assertIntPeek();
-        return xpop();
-    }
-
-    /**
-     * Pops a value off of the stack and checks that it is a float.
-     *
-     * @return x the instruction popped off the stack
-     */
-    public ValueNode fpop() {
-        assert assertFloatPeek();
-        return xpop();
-    }
-
-    /**
-     * Pops a value off of the stack and checks that it is an object.
-     *
-     * @return x the instruction popped off the stack
-     */
-    public ValueNode apop() {
-        assert assertObjectPeek();
-        return xpop();
-    }
-
-    /**
-     * Pops a value off of the stack and checks that it is a long.
-     *
-     * @return x the instruction popped off the stack
-     */
-    public ValueNode lpop() {
-        assert assertHighPeek();
-        xpop();
-        assert assertLongPeek();
-        return xpop();
-    }
-
-    /**
-     * Pops a value off of the stack and checks that it is a double.
-     *
-     * @return x the instruction popped off the stack
-     */
-    public ValueNode dpop() {
-        assert assertHighPeek();
-        xpop();
-        assert assertDoublePeek();
-        return xpop();
-    }
-
-    /**
      * Pop the specified number of slots off of this stack and return them as an array of
      * instructions.
      *
@@ -860,9 +663,6 @@
             if (stack[newStackSize] == null) {
                 /* Two-slot value. */
                 newStackSize--;
-                assert stack[newStackSize].getKind().needsTwoSlots();
-            } else {
-                assert parser.parsingIntrinsic() || (stack[newStackSize].getKind().getSlotCount() == 1);
             }
             result[i] = stack[newStackSize];
         }
@@ -871,80 +671,93 @@
     }
 
     /**
-     * Peeks an element from the operand stack.
-     *
-     * @param argumentNumber The number of the argument, relative from the top of the stack (0 =
-     *            top). Long and double arguments only count as one argument, i.e., null-slots are
-     *            ignored.
-     * @return The peeked argument.
-     */
-    public ValueNode peek(int argumentNumber) {
-        int idx = stackSize() - 1;
-        for (int i = 0; i < argumentNumber; i++) {
-            if (stackAt(idx) == null) {
-                idx--;
-                assert stackAt(idx).getKind().needsTwoSlots();
-            }
-            idx--;
-        }
-        return stackAt(idx);
-    }
-
-    /**
      * Clears all values on this stack.
      */
     public void clearStack() {
         stackSize = 0;
     }
 
-    private boolean assertLongPeek() {
-        return assertLong(xpeek());
-    }
-
-    private static boolean assertLong(ValueNode x) {
-        assert x != null && (x.getKind() == Kind.Long);
-        return true;
-    }
-
-    private boolean assertIntPeek() {
-        return assertInt(xpeek());
-    }
-
-    private static boolean assertInt(ValueNode x) {
-        assert x != null && (x.getKind() == Kind.Int);
-        return true;
-    }
-
-    private boolean assertFloatPeek() {
-        return assertFloat(xpeek());
-    }
-
-    private static boolean assertFloat(ValueNode x) {
-        assert x != null && (x.getKind() == Kind.Float);
-        return true;
-    }
-
-    private boolean assertObjectPeek() {
-        return assertObject(xpeek());
-    }
-
-    private boolean assertObject(ValueNode x) {
-        assert x != null && (parser.parsingIntrinsic() || (x.getKind() == Kind.Object));
-        return true;
-    }
-
-    private boolean assertDoublePeek() {
-        return assertDouble(xpeek());
-    }
-
-    private static boolean assertDouble(ValueNode x) {
-        assert x != null && (x.getKind() == Kind.Double);
-        return true;
-    }
-
-    private boolean assertHighPeek() {
-        assert xpeek() == null;
-        return true;
+    /**
+     * Performs a raw stack operation as defined in the Java bytecode specification.
+     *
+     * @param opcode The Java bytecode.
+     */
+    public void stackOp(int opcode) {
+        switch (opcode) {
+            case POP: {
+                xpop();
+                break;
+            }
+            case POP2: {
+                xpop();
+                xpop();
+                break;
+            }
+            case DUP: {
+                xpush(xpeek());
+                break;
+            }
+            case DUP_X1: {
+                ValueNode w1 = xpop();
+                ValueNode w2 = xpop();
+                xpush(w1);
+                xpush(w2);
+                xpush(w1);
+                break;
+            }
+            case DUP_X2: {
+                ValueNode w1 = xpop();
+                ValueNode w2 = xpop();
+                ValueNode w3 = xpop();
+                xpush(w1);
+                xpush(w3);
+                xpush(w2);
+                xpush(w1);
+                break;
+            }
+            case DUP2: {
+                ValueNode w1 = xpop();
+                ValueNode w2 = xpop();
+                xpush(w2);
+                xpush(w1);
+                xpush(w2);
+                xpush(w1);
+                break;
+            }
+            case DUP2_X1: {
+                ValueNode w1 = xpop();
+                ValueNode w2 = xpop();
+                ValueNode w3 = xpop();
+                xpush(w2);
+                xpush(w1);
+                xpush(w3);
+                xpush(w2);
+                xpush(w1);
+                break;
+            }
+            case DUP2_X2: {
+                ValueNode w1 = xpop();
+                ValueNode w2 = xpop();
+                ValueNode w3 = xpop();
+                ValueNode w4 = xpop();
+                xpush(w2);
+                xpush(w1);
+                xpush(w4);
+                xpush(w3);
+                xpush(w2);
+                xpush(w1);
+                break;
+            }
+            case SWAP: {
+                ValueNode w1 = xpop();
+                ValueNode w2 = xpop();
+                xpush(w1);
+                xpush(w2);
+                break;
+            }
+            default:
+                throw shouldNotReachHere();
+        }
     }
 
     @Override
@@ -1001,19 +814,6 @@
         return false;
     }
 
-    public void replace(ValueNode oldValue, ValueNode newValue) {
-        for (int i = 0; i < locals.length; i++) {
-            if (locals[i] == oldValue) {
-                locals[i] = newValue;
-            }
-        }
-        for (int i = 0; i < stackSize; i++) {
-            if (stack[i] == oldValue) {
-                stack[i] = newValue;
-            }
-        }
-    }
-
     @Override
     public boolean isAfterSideEffect() {
         return sideEffects != null;
@@ -1033,4 +833,16 @@
         }
         sideEffects.add(sideEffect);
     }
+
+    public void traceState() {
+        Debug.log(String.format("|   state [nr locals = %d, stack depth = %d, method = %s]", localsSize(), stackSize(), method));
+        for (int i = 0; i < localsSize(); ++i) {
+            ValueNode value = locals[i];
+            Debug.log(String.format("|   local[%d] = %-8s : %s", i, value == null ? "bogus" : value.getKind().getJavaName(), value));
+        }
+        for (int i = 0; i < stackSize(); ++i) {
+            ValueNode value = stack[i];
+            Debug.log(String.format("|   stack[%d] = %-8s : %s", i, value == null ? "bogus" : value.getKind().getJavaName(), value));
+        }
+    }
 }
--- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java	Thu May 28 21:11:28 2015 -0700
@@ -22,29 +22,25 @@
  */
 package com.oracle.graal.java;
 
-import static com.oracle.graal.api.code.TypeCheckHints.*;
-import static com.oracle.graal.api.meta.DeoptimizationAction.*;
-import static com.oracle.graal.api.meta.DeoptimizationReason.*;
 import static com.oracle.graal.bytecode.Bytecodes.*;
-import static com.oracle.graal.compiler.common.GraalInternalError.*;
 import static com.oracle.graal.compiler.common.GraalOptions.*;
 import static com.oracle.graal.compiler.common.type.StampFactory.*;
 import static com.oracle.graal.graphbuilderconf.IntrinsicContext.CompilationContext.*;
 import static com.oracle.graal.java.GraphBuilderPhase.Options.*;
 import static com.oracle.graal.nodes.StructuredGraph.*;
 import static com.oracle.graal.nodes.type.StampTool.*;
+import static com.oracle.jvmci.code.TypeCheckHints.*;
+import static com.oracle.jvmci.common.JVMCIError.*;
+import static com.oracle.jvmci.meta.DeoptimizationAction.*;
+import static com.oracle.jvmci.meta.DeoptimizationReason.*;
 import static java.lang.String.*;
 
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.bytecode.*;
 import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.calc.*;
 import com.oracle.graal.compiler.common.type.*;
-import com.oracle.graal.debug.*;
-import com.oracle.graal.debug.Debug.Scope;
 import com.oracle.graal.graph.Graph.Mark;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.Node.ValueNumberable;
@@ -64,9 +60,14 @@
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.type.*;
 import com.oracle.graal.nodes.util.*;
-import com.oracle.graal.options.*;
 import com.oracle.graal.phases.*;
 import com.oracle.graal.phases.tiers.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.debug.Debug.Scope;
+import com.oracle.jvmci.meta.*;
+import com.oracle.jvmci.options.*;
 
 /**
  * The {@code GraphBuilder} class parses the bytecode of a method and builds the IR graph.
@@ -234,11 +235,11 @@
          * @param parser the parsing context of the (non-intrinsic) method calling the intrinsic
          * @param args the arguments to the call
          */
-        public IntrinsicScope(BytecodeParser parser, ValueNode[] args) {
+        public IntrinsicScope(BytecodeParser parser, Kind[] argSlotKinds, ValueNode[] args) {
             assert !parser.parsingIntrinsic();
             this.parser = parser;
             mark = parser.getGraph().getMark();
-            stateBefore = parser.frameState.create(parser.bci(), parser.getNonIntrinsicAncestor(), false, args);
+            stateBefore = parser.frameState.create(parser.bci(), parser.getNonIntrinsicAncestor(), false, argSlotKinds, args);
         }
 
         public void close() {
@@ -272,11 +273,13 @@
                                  * Swap the top-of-stack value with the side-effect return value
                                  * using the frame state.
                                  */
-                                ValueNode tos = frameStateBuilder.pop(returnVal.getKind());
+                                Kind returnKind = parser.currentInvokeReturnType.getKind();
+                                ValueNode tos = frameStateBuilder.pop(returnKind);
                                 assert tos.getKind() == returnVal.getKind();
-                                FrameState newFrameState = frameStateBuilder.create(parser.stream.nextBCI(), parser.getNonIntrinsicAncestor(), false, returnVal);
+                                FrameState newFrameState = frameStateBuilder.create(parser.stream.nextBCI(), parser.getNonIntrinsicAncestor(), false, new Kind[]{returnKind},
+                                                new ValueNode[]{returnVal});
                                 frameState.replaceAndDelete(newFrameState);
-                                frameStateBuilder.push(tos.getKind(), tos);
+                                frameStateBuilder.push(returnKind, tos);
                             } else {
                                 if (stateAfterReturn == null) {
                                     if (intrinsic != null) {
@@ -431,7 +434,7 @@
         }
 
         @SuppressWarnings("serial")
-        public class BytecodeParserError extends GraalInternalError {
+        public class BytecodeParserError extends JVMCIError {
 
             public BytecodeParserError(Throwable cause) {
                 super(cause);
@@ -624,9 +627,9 @@
              */
             private FrameState createStateAfterStartOfReplacementGraph() {
                 assert parent == null;
-                assert frameState.method.equals(intrinsicContext.getIntrinsicMethod());
+                assert frameState.getMethod().equals(intrinsicContext.getIntrinsicMethod());
                 assert bci() == 0;
-                assert frameState.stackSize == 0;
+                assert frameState.stackSize() == 0;
                 FrameState stateAfterStart;
                 if (intrinsicContext.isPostParseInlined()) {
                     stateAfterStart = graph.add(new FrameState(BytecodeFrame.BEFORE_BCI));
@@ -898,7 +901,7 @@
             protected void handleUnresolvedCheckCast(JavaType type, ValueNode object) {
                 assert !graphBuilderConfig.eagerResolving();
                 append(new FixedGuardNode(graph.unique(new IsNullNode(object)), Unresolved, InvalidateRecompile));
-                frameState.apush(appendConstant(JavaConstant.NULL_POINTER));
+                frameState.push(Kind.Object, appendConstant(JavaConstant.NULL_POINTER));
             }
 
             /**
@@ -911,7 +914,7 @@
                 DeoptimizeNode deopt = graph.add(new DeoptimizeNode(InvalidateRecompile, Unresolved));
                 append(new IfNode(graph.unique(new IsNullNode(object)), successor, deopt, 1));
                 lastInstr = successor;
-                frameState.ipush(appendConstant(JavaConstant.INT_0));
+                frameState.push(Kind.Int, appendConstant(JavaConstant.INT_0));
             }
 
             /**
@@ -998,12 +1001,12 @@
                 DispatchBeginNode dispatchBegin;
                 if (exceptionObject == null) {
                     dispatchBegin = graph.add(new ExceptionObjectNode(metaAccess));
-                    dispatchState.apush(dispatchBegin);
+                    dispatchState.push(Kind.Object, dispatchBegin);
                     dispatchState.setRethrowException(true);
                     dispatchBegin.setStateAfter(dispatchState.create(bci, dispatchBegin));
                 } else {
                     dispatchBegin = graph.add(new DispatchBeginNode());
-                    dispatchState.apush(exceptionObject);
+                    dispatchState.push(Kind.Object, exceptionObject);
                     dispatchBegin.setStateAfter(dispatchState.create(bci, dispatchBegin));
                     dispatchState.setRethrowException(true);
                 }
@@ -1136,7 +1139,7 @@
             }
 
             protected void genThrow() {
-                ValueNode exception = frameState.apop();
+                ValueNode exception = frameState.pop(Kind.Object);
                 append(new FixedGuardNode(graph.unique(new IsNullNode(exception)), NullCheckException, InvalidateReprofile, true));
                 lastInstr.setNext(handleException(exception, bci()));
             }
@@ -1249,7 +1252,7 @@
                 if (target instanceof ResolvedJavaMethod) {
                     JavaConstant appendix = constantPool.lookupAppendix(stream.readCPI4(), Bytecodes.INVOKEDYNAMIC);
                     if (appendix != null) {
-                        frameState.apush(ConstantNode.forConstant(appendix, metaAccess, graph));
+                        frameState.push(Kind.Object, ConstantNode.forConstant(appendix, metaAccess, graph));
                     }
                     ValueNode[] args = frameState.popArguments(target.getSignature().getParameterCount(false));
                     appendInvoke(InvokeKind.Static, (ResolvedJavaMethod) target, args);
@@ -1270,7 +1273,7 @@
                     boolean hasReceiver = !((ResolvedJavaMethod) target).isStatic();
                     JavaConstant appendix = constantPool.lookupAppendix(stream.readCPI(), Bytecodes.INVOKEVIRTUAL);
                     if (appendix != null) {
-                        frameState.apush(ConstantNode.forConstant(appendix, metaAccess, graph));
+                        frameState.push(Kind.Object, ConstantNode.forConstant(appendix, metaAccess, graph));
                     }
                     ValueNode[] args = frameState.popArguments(target.getSignature().getParameterCount(hasReceiver));
                     if (hasReceiver) {
@@ -1324,7 +1327,7 @@
                 ResolvedJavaMethod targetMethod = initialTargetMethod;
                 InvokeKind invokeKind = initialInvokeKind;
                 if (initialInvokeKind.isIndirect()) {
-                    ResolvedJavaType contextType = this.frameState.method.getDeclaringClass();
+                    ResolvedJavaType contextType = this.frameState.getMethod().getDeclaringClass();
                     ResolvedJavaMethod specialCallTarget = MethodCallTargetNode.findSpecialCallTarget(initialInvokeKind, args[0], initialTargetMethod, contextType);
                     if (specialCallTarget != null) {
                         invokeKind = InvokeKind.Special;
@@ -1427,7 +1430,7 @@
                     this.targetMethod = targetMethod;
                     this.args = args;
                     this.resultType = resultType;
-                    this.beforeStackSize = frameState.stackSize;
+                    this.beforeStackSize = frameState.stackSize();
                     this.needsNullCheck = !targetMethod.isStatic() && args[0].getKind() == Kind.Object && !StampTool.isPointerNonNull(args[0].stamp());
                     this.nodeCount = graph.getNodeCount();
                     this.mark = graph.getMark();
@@ -1440,7 +1443,7 @@
                 boolean check(boolean pluginResult) {
                     if (pluginResult == true) {
                         int expectedStackSize = beforeStackSize + resultType.getSlotCount();
-                        assert expectedStackSize == frameState.stackSize : error("plugin manipulated the stack incorrectly: expected=%d, actual=%d", expectedStackSize, frameState.stackSize);
+                        assert expectedStackSize == frameState.stackSize() : error("plugin manipulated the stack incorrectly: expected=%d, actual=%d", expectedStackSize, frameState.stackSize());
                         NodeIterable<Node> newNodes = graph.getNewNodes(mark);
                         assert !needsNullCheck || isPointerNonNull(args[0].stamp()) : error("plugin needs to null check the receiver of %s: receiver=%s", targetMethod.format("%H.%n(%p)"), args[0]);
                         for (Node n : newNodes) {
@@ -1457,7 +1460,7 @@
                         }
                     } else {
                         assert nodeCount == graph.getNodeCount() : error("plugin that returns false must not create new nodes");
-                        assert beforeStackSize == frameState.stackSize : error("plugin that returns false must modify the stack");
+                        assert beforeStackSize == frameState.stackSize() : error("plugin that returns false must not modify the stack");
                     }
                     return true;
                 }
@@ -1585,7 +1588,8 @@
             }
 
             private void parseAndInlineCallee(ResolvedJavaMethod targetMethod, ValueNode[] args, IntrinsicContext calleeIntrinsicContext) {
-                try (IntrinsicScope s = calleeIntrinsicContext != null && !parsingIntrinsic() ? new IntrinsicScope(this, args) : null) {
+                try (IntrinsicScope s = calleeIntrinsicContext != null && !parsingIntrinsic() ? new IntrinsicScope(this, targetMethod.getSignature().toParameterKinds(!targetMethod.isStatic()), args)
+                                : null) {
 
                     BytecodeParser parser = new BytecodeParser(this, metaAccess, targetMethod, graphBuilderConfig, optimisticOpts, INVOCATION_ENTRY_BCI, calleeIntrinsicContext);
                     FrameStateBuilder startFrameState = new FrameStateBuilder(parser, targetMethod, graph);
@@ -1694,7 +1698,7 @@
 
             private void beforeReturn(ValueNode x, Kind kind) {
                 if (graph.method() != null && graph.method().isJavaLangObjectInit()) {
-                    append(new RegisterFinalizerNode(frameState.localAt(0)));
+                    append(new RegisterFinalizerNode(frameState.loadLocal(0, Kind.Object)));
                 }
                 if (graphBuilderConfig.insertNonSafepointDebugInfo() && !parsingIntrinsic()) {
                     append(createInfoPointNode(InfopointReason.METHOD_END));
@@ -1735,13 +1739,13 @@
                     throw new JsrNotSupportedBailout("unstructured control flow (internal limitation)");
                 }
                 ConstantNode nextBciNode = getJsrConstant(nextBci);
-                frameState.push(Kind.Int, nextBciNode);
+                frameState.push(Kind.Object, nextBciNode);
                 appendGoto(successor);
             }
 
             protected void genRet(int localIndex) {
                 BciBlock successor = currentBlock.getRetSuccessor();
-                ValueNode local = frameState.loadLocal(localIndex);
+                ValueNode local = frameState.loadLocal(localIndex, Kind.Object);
                 JsrScope scope = currentBlock.getJsrScope();
                 int retAddress = scope.nextReturnAddress();
                 ConstantNode returnBciNode = getJsrConstant(retAddress);
@@ -2149,7 +2153,7 @@
                 if (target.isStatic()) {
                     return appendConstant(target.getDeclaringClass().getJavaClass());
                 } else {
-                    return state.loadLocal(0);
+                    return state.loadLocal(0, Kind.Object);
                 }
             }
 
@@ -2190,7 +2194,7 @@
                     frameState.setRethrowException(false);
                     createUnwind();
                 } else {
-                    ValueNode exception = frameState.apop();
+                    ValueNode exception = frameState.pop(Kind.Object);
                     this.unwindValue = exception;
                     this.beforeUnwindNode = this.lastInstr;
                 }
@@ -2218,7 +2222,7 @@
 
             private void createUnwind() {
                 assert frameState.stackSize() == 1 : frameState;
-                ValueNode exception = frameState.apop();
+                ValueNode exception = frameState.pop(Kind.Object);
                 synchronizedEpilogue(BytecodeFrame.AFTER_EXCEPTION_BCI, null, null);
                 append(new UnwindNode(exception));
             }
@@ -2251,7 +2255,7 @@
                     for (ResolvedJavaType skippedType : graphBuilderConfig.getSkippedExceptionTypes()) {
                         if (skippedType.isAssignableFrom(resolvedCatchType)) {
                             BciBlock nextBlock = block.getSuccessorCount() == 1 ? blockMap.getUnwindBlock() : block.getSuccessor(1);
-                            ValueNode exception = frameState.stackAt(0);
+                            ValueNode exception = frameState.stack[0];
                             FixedNode trueSuccessor = graph.add(new DeoptimizeNode(InvalidateReprofile, UnreachedCode));
                             FixedNode nextDispatch = createTarget(nextBlock, frameState);
                             append(new IfNode(graph.unique(new InstanceOfNode((ResolvedJavaType) catchType, exception, null)), trueSuccessor, nextDispatch, 0));
@@ -2262,12 +2266,12 @@
 
                 if (initialized) {
                     BciBlock nextBlock = block.getSuccessorCount() == 1 ? blockMap.getUnwindBlock() : block.getSuccessor(1);
-                    ValueNode exception = frameState.stackAt(0);
+                    ValueNode exception = frameState.stack[0];
                     CheckCastNode checkCast = graph.add(new CheckCastNode((ResolvedJavaType) catchType, exception, null, false));
-                    frameState.apop();
+                    frameState.pop(Kind.Object);
                     frameState.push(Kind.Object, checkCast);
                     FixedNode catchSuccessor = createTarget(block.getSuccessor(0), frameState);
-                    frameState.apop();
+                    frameState.pop(Kind.Object);
                     frameState.push(Kind.Object, exception);
                     FixedNode nextDispatch = createTarget(nextBlock, frameState);
                     checkCast.setNext(catchSuccessor);
@@ -2434,24 +2438,13 @@
 
             private boolean traceState() {
                 if (Debug.isEnabled() && Options.TraceBytecodeParserLevel.getValue() >= TRACELEVEL_STATE && Debug.isLogEnabled()) {
-                    traceStateHelper();
+                    frameState.traceState();
                 }
                 return true;
             }
 
-            private void traceStateHelper() {
-                Debug.log(String.format("|   state [nr locals = %d, stack depth = %d, method = %s]", frameState.localsSize(), frameState.stackSize(), method));
-                for (int i = 0; i < frameState.localsSize(); ++i) {
-                    ValueNode value = frameState.localAt(i);
-                    Debug.log(String.format("|   local[%d] = %-8s : %s", i, value == null ? "bogus" : value.getKind().getJavaName(), value));
-                }
-                for (int i = 0; i < frameState.stackSize(); ++i) {
-                    ValueNode value = frameState.stackAt(i);
-                    Debug.log(String.format("|   stack[%d] = %-8s : %s", i, value == null ? "bogus" : value.getKind().getJavaName(), value));
-                }
-            }
-
             protected void genIf(ValueNode x, Condition cond, ValueNode y) {
+                assert x.getKind().getStackKind() == y.getKind().getStackKind();
                 assert currentBlock.getSuccessorCount() == 2;
                 BciBlock trueBlock = currentBlock.getSuccessor(0);
                 BciBlock falseBlock = currentBlock.getSuccessor(1);
@@ -2627,10 +2620,9 @@
                 return metaAccess;
             }
 
-            public void push(Kind kind, ValueNode value) {
+            public void push(Kind slotKind, ValueNode value) {
                 assert value.isAlive();
-                assert kind == kind.getStackKind();
-                frameState.push(kind, value);
+                frameState.push(slotKind, value);
             }
 
             private int getCurrentDimension() {
@@ -2714,19 +2706,13 @@
             }
 
             public void loadLocal(int index, Kind kind) {
-                frameState.push(kind, frameState.loadLocal(index));
+                ValueNode value = frameState.loadLocal(index, kind);
+                frameState.push(kind, value);
             }
 
             public void storeLocal(Kind kind, int index) {
-                ValueNode value;
-                if (kind == Kind.Object) {
-                    value = frameState.xpop();
-                    // astore and astore_<n> may be used to store a returnAddress (jsr)
-                    assert parsingIntrinsic() || (value.getKind() == Kind.Object || value.getKind() == Kind.Int) : value + ":" + value.getKind();
-                } else {
-                    value = frameState.pop(kind);
-                }
-                frameState.storeLocal(index, value, kind);
+                ValueNode value = frameState.pop(kind);
+                frameState.storeLocal(index, kind, value);
             }
 
             private void genLoadConstant(int cpi, int opcode) {
@@ -2742,17 +2728,17 @@
                     }
                 } else if (con instanceof JavaConstant) {
                     JavaConstant constant = (JavaConstant) con;
-                    frameState.push(constant.getKind().getStackKind(), appendConstant(constant));
+                    frameState.push(constant.getKind(), appendConstant(constant));
                 } else {
                     throw new Error("lookupConstant returned an object of incorrect type");
                 }
             }
 
             private void genLoadIndexed(Kind kind) {
-                ValueNode index = frameState.ipop();
-                ValueNode array = emitExplicitExceptions(frameState.apop(), index);
+                ValueNode index = frameState.pop(Kind.Int);
+                ValueNode array = emitExplicitExceptions(frameState.pop(Kind.Object), index);
                 if (!tryLoadIndexedPlugin(kind, index, array)) {
-                    frameState.push(kind.getStackKind(), append(genLoadIndexed(array, index, kind)));
+                    frameState.push(kind, append(genLoadIndexed(array, index, kind)));
                 }
             }
 
@@ -2769,80 +2755,15 @@
             }
 
             private void genStoreIndexed(Kind kind) {
-                ValueNode value = frameState.pop(kind.getStackKind());
-                ValueNode index = frameState.ipop();
-                ValueNode array = emitExplicitExceptions(frameState.apop(), index);
+                ValueNode value = frameState.pop(kind);
+                ValueNode index = frameState.pop(Kind.Int);
+                ValueNode array = emitExplicitExceptions(frameState.pop(Kind.Object), index);
                 genStoreIndexed(array, index, kind, value);
             }
 
-            private void stackOp(int opcode) {
-                switch (opcode) {
-                    case DUP_X1: {
-                        ValueNode w1 = frameState.xpop();
-                        ValueNode w2 = frameState.xpop();
-                        frameState.xpush(w1);
-                        frameState.xpush(w2);
-                        frameState.xpush(w1);
-                        break;
-                    }
-                    case DUP_X2: {
-                        ValueNode w1 = frameState.xpop();
-                        ValueNode w2 = frameState.xpop();
-                        ValueNode w3 = frameState.xpop();
-                        frameState.xpush(w1);
-                        frameState.xpush(w3);
-                        frameState.xpush(w2);
-                        frameState.xpush(w1);
-                        break;
-                    }
-                    case DUP2: {
-                        ValueNode w1 = frameState.xpop();
-                        ValueNode w2 = frameState.xpop();
-                        frameState.xpush(w2);
-                        frameState.xpush(w1);
-                        frameState.xpush(w2);
-                        frameState.xpush(w1);
-                        break;
-                    }
-                    case DUP2_X1: {
-                        ValueNode w1 = frameState.xpop();
-                        ValueNode w2 = frameState.xpop();
-                        ValueNode w3 = frameState.xpop();
-                        frameState.xpush(w2);
-                        frameState.xpush(w1);
-                        frameState.xpush(w3);
-                        frameState.xpush(w2);
-                        frameState.xpush(w1);
-                        break;
-                    }
-                    case DUP2_X2: {
-                        ValueNode w1 = frameState.xpop();
-                        ValueNode w2 = frameState.xpop();
-                        ValueNode w3 = frameState.xpop();
-                        ValueNode w4 = frameState.xpop();
-                        frameState.xpush(w2);
-                        frameState.xpush(w1);
-                        frameState.xpush(w4);
-                        frameState.xpush(w3);
-                        frameState.xpush(w2);
-                        frameState.xpush(w1);
-                        break;
-                    }
-                    case SWAP: {
-                        ValueNode w1 = frameState.xpop();
-                        ValueNode w2 = frameState.xpop();
-                        frameState.xpush(w1);
-                        frameState.xpush(w2);
-                        break;
-                    }
-                    default:
-                        throw GraalInternalError.shouldNotReachHere();
-                }
-            }
-
-            private void genArithmeticOp(Kind result, int opcode) {
-                ValueNode y = frameState.pop(result);
-                ValueNode x = frameState.pop(result);
+            private void genArithmeticOp(Kind kind, int opcode) {
+                ValueNode y = frameState.pop(kind);
+                ValueNode x = frameState.pop(kind);
                 ValueNode v;
                 switch (opcode) {
                     case IADD:
@@ -2878,14 +2799,14 @@
                         v = genFloatRem(x, y);
                         break;
                     default:
-                        throw new GraalInternalError("should not reach");
+                        throw shouldNotReachHere();
                 }
-                frameState.push(result, append(v));
+                frameState.push(kind, append(v));
             }
 
-            private void genIntegerDivOp(Kind result, int opcode) {
-                ValueNode y = frameState.pop(result);
-                ValueNode x = frameState.pop(result);
+            private void genIntegerDivOp(Kind kind, int opcode) {
+                ValueNode y = frameState.pop(kind);
+                ValueNode x = frameState.pop(kind);
                 ValueNode v;
                 switch (opcode) {
                     case IDIV:
@@ -2897,17 +2818,18 @@
                         v = genIntegerRem(x, y);
                         break;
                     default:
-                        throw new GraalInternalError("should not reach");
+                        throw shouldNotReachHere();
                 }
-                frameState.push(result, append(v));
+                frameState.push(kind, append(v));
             }
 
             private void genNegateOp(Kind kind) {
-                frameState.push(kind, append(genNegateOp(frameState.pop(kind))));
+                ValueNode x = frameState.pop(kind);
+                frameState.push(kind, append(genNegateOp(x)));
             }
 
             private void genShiftOp(Kind kind, int opcode) {
-                ValueNode s = frameState.ipop();
+                ValueNode s = frameState.pop(Kind.Int);
                 ValueNode x = frameState.pop(kind);
                 ValueNode v;
                 switch (opcode) {
@@ -2924,7 +2846,7 @@
                         v = genUnsignedRightShift(x, s);
                         break;
                     default:
-                        throw new GraalInternalError("should not reach");
+                        throw shouldNotReachHere();
                 }
                 frameState.push(kind, append(v));
             }
@@ -2947,7 +2869,7 @@
                         v = genXor(x, y);
                         break;
                     default:
-                        throw new GraalInternalError("should not reach");
+                        throw shouldNotReachHere();
                 }
                 frameState.push(kind, append(v));
             }
@@ -2955,52 +2877,52 @@
             private void genCompareOp(Kind kind, boolean isUnorderedLess) {
                 ValueNode y = frameState.pop(kind);
                 ValueNode x = frameState.pop(kind);
-                frameState.ipush(append(genNormalizeCompare(x, y, isUnorderedLess)));
+                frameState.push(Kind.Int, append(genNormalizeCompare(x, y, isUnorderedLess)));
             }
 
             private void genFloatConvert(FloatConvert op, Kind from, Kind to) {
-                ValueNode input = frameState.pop(from.getStackKind());
-                frameState.push(to.getStackKind(), append(genFloatConvert(op, input)));
+                ValueNode input = frameState.pop(from);
+                frameState.push(to, append(genFloatConvert(op, input)));
             }
 
             private void genSignExtend(Kind from, Kind to) {
-                ValueNode input = frameState.pop(from.getStackKind());
+                ValueNode input = frameState.pop(from);
                 if (from != from.getStackKind()) {
                     input = append(genNarrow(input, from.getBitCount()));
                 }
-                frameState.push(to.getStackKind(), append(genSignExtend(input, to.getBitCount())));
+                frameState.push(to, append(genSignExtend(input, to.getBitCount())));
             }
 
             private void genZeroExtend(Kind from, Kind to) {
-                ValueNode input = frameState.pop(from.getStackKind());
+                ValueNode input = frameState.pop(from);
                 if (from != from.getStackKind()) {
                     input = append(genNarrow(input, from.getBitCount()));
                 }
-                frameState.push(to.getStackKind(), append(genZeroExtend(input, to.getBitCount())));
+                frameState.push(to, append(genZeroExtend(input, to.getBitCount())));
             }
 
             private void genNarrow(Kind from, Kind to) {
-                ValueNode input = frameState.pop(from.getStackKind());
-                frameState.push(to.getStackKind(), append(genNarrow(input, to.getBitCount())));
+                ValueNode input = frameState.pop(from);
+                frameState.push(to, append(genNarrow(input, to.getBitCount())));
             }
 
             private void genIncrement() {
                 int index = getStream().readLocalIndex();
                 int delta = getStream().readIncrement();
-                ValueNode x = frameState.loadLocal(index);
+                ValueNode x = frameState.loadLocal(index, Kind.Int);
                 ValueNode y = appendConstant(JavaConstant.forInt(delta));
-                frameState.storeLocal(index, append(genIntegerAdd(x, y)));
+                frameState.storeLocal(index, Kind.Int, append(genIntegerAdd(x, y)));
             }
 
             private void genIfZero(Condition cond) {
                 ValueNode y = appendConstant(JavaConstant.INT_0);
-                ValueNode x = frameState.ipop();
+                ValueNode x = frameState.pop(Kind.Int);
                 genIf(x, cond, y);
             }
 
             private void genIfNull(Condition cond) {
                 ValueNode y = appendConstant(JavaConstant.NULL_POINTER);
-                ValueNode x = frameState.apop();
+                ValueNode x = frameState.pop(Kind.Object);
                 genIf(x, cond, y);
             }
 
@@ -3062,7 +2984,7 @@
             private void genCheckCast() {
                 int cpi = getStream().readCPI();
                 JavaType type = lookupType(cpi, CHECKCAST);
-                ValueNode object = frameState.apop();
+                ValueNode object = frameState.pop(Kind.Object);
                 if (type instanceof ResolvedJavaType) {
                     ResolvedJavaType resolvedType = (ResolvedJavaType) type;
                     JavaTypeProfile profile = getProfileForTypeCheck(resolvedType);
@@ -3088,7 +3010,7 @@
                         if (checkCastNode == null) {
                             checkCastNode = append(createCheckCast(resolvedType, object, profile, false));
                         }
-                        frameState.apush(checkCastNode);
+                        frameState.push(Kind.Object, checkCastNode);
                     }
                 } else {
                     handleUnresolvedCheckCast(type, object);
@@ -3098,7 +3020,7 @@
             private void genInstanceOf() {
                 int cpi = getStream().readCPI();
                 JavaType type = lookupType(cpi, INSTANCEOF);
-                ValueNode object = frameState.apop();
+                ValueNode object = frameState.pop(Kind.Object);
                 if (type instanceof ResolvedJavaType) {
                     ResolvedJavaType resolvedType = (ResolvedJavaType) type;
                     JavaTypeProfile profile = getProfileForTypeCheck(resolvedType);
@@ -3119,7 +3041,7 @@
                         if (instanceOfNode == null) {
                             instanceOfNode = createInstanceOf(resolvedType, object, profile);
                         }
-                        frameState.ipush(append(genConditional(genUnique(instanceOfNode))));
+                        frameState.push(Kind.Int, append(genConditional(genUnique(instanceOfNode))));
                     }
                 } else {
                     handleUnresolvedInstanceOf(type, object);
@@ -3138,23 +3060,23 @@
                             }
                         }
                     }
-                    frameState.apush(append(createNewInstance((ResolvedJavaType) type, true)));
+                    frameState.push(Kind.Object, append(createNewInstance((ResolvedJavaType) type, true)));
                 } else {
                     handleUnresolvedNewInstance(type);
                 }
             }
 
             private void genNewPrimitiveArray(int typeCode) {
-                Class<?> clazz = arrayTypeCodeToClass(typeCode);
-                ResolvedJavaType elementType = metaAccess.lookupJavaType(clazz);
-                frameState.apush(append(createNewArray(elementType, frameState.ipop(), true)));
+                ResolvedJavaType elementType = metaAccess.lookupJavaType(arrayTypeCodeToClass(typeCode));
+                ValueNode length = frameState.pop(Kind.Int);
+                frameState.push(Kind.Object, append(createNewArray(elementType, length, true)));
             }
 
             private void genNewObjectArray(int cpi) {
                 JavaType type = lookupType(cpi, ANEWARRAY);
-                ValueNode length = frameState.ipop();
+                ValueNode length = frameState.pop(Kind.Int);
                 if (type instanceof ResolvedJavaType) {
-                    frameState.apush(append(createNewArray((ResolvedJavaType) type, length, true)));
+                    frameState.push(Kind.Object, append(createNewArray((ResolvedJavaType) type, length, true)));
                 } else {
                     handleUnresolvedNewObjectArray(type, length);
                 }
@@ -3166,22 +3088,23 @@
                 int rank = getStream().readUByte(bci() + 3);
                 List<ValueNode> dims = new ArrayList<>(Collections.nCopies(rank, null));
                 for (int i = rank - 1; i >= 0; i--) {
-                    dims.set(i, frameState.ipop());
+                    dims.set(i, frameState.pop(Kind.Int));
                 }
                 if (type instanceof ResolvedJavaType) {
-                    frameState.apush(append(createNewMultiArray((ResolvedJavaType) type, dims)));
+                    frameState.push(Kind.Object, append(createNewMultiArray((ResolvedJavaType) type, dims)));
                 } else {
                     handleUnresolvedNewMultiArray(type, dims);
                 }
             }
 
             private void genGetField(JavaField field) {
-                Kind kind = field.getKind();
-                ValueNode receiver = emitExplicitExceptions(frameState.apop(), null);
+                ValueNode receiver = emitExplicitExceptions(frameState.pop(Kind.Object), null);
                 if ((field instanceof ResolvedJavaField) && ((ResolvedJavaField) field).getDeclaringClass().isInitialized()) {
+                    ResolvedJavaField resolvedField = (ResolvedJavaField) field;
+
                     LoadFieldPlugin loadFieldPlugin = this.graphBuilderConfig.getPlugins().getLoadFieldPlugin();
-                    if (loadFieldPlugin == null || !loadFieldPlugin.apply((GraphBuilderContext) this, receiver, (ResolvedJavaField) field)) {
-                        appendOptimizedLoadField(kind, genLoadField(receiver, (ResolvedJavaField) field));
+                    if (loadFieldPlugin == null || !loadFieldPlugin.apply(this, receiver, resolvedField)) {
+                        frameState.push(field.getKind(), append(genLoadField(receiver, resolvedField)));
                     }
                 } else {
                     handleUnresolvedLoadField(field, receiver);
@@ -3212,8 +3135,8 @@
             }
 
             private void genPutField(JavaField field) {
-                ValueNode value = frameState.pop(field.getKind().getStackKind());
-                ValueNode receiver = emitExplicitExceptions(frameState.apop(), null);
+                ValueNode value = frameState.pop(field.getKind());
+                ValueNode receiver = emitExplicitExceptions(frameState.pop(Kind.Object), null);
                 if (field instanceof ResolvedJavaField && ((ResolvedJavaField) field).getDeclaringClass().isInitialized()) {
                     genStoreField(receiver, (ResolvedJavaField) field, value);
                 } else {
@@ -3222,44 +3145,35 @@
             }
 
             private void genGetStatic(JavaField field) {
-                Kind kind = field.getKind();
                 if (field instanceof ResolvedJavaField && ((ResolvedJavaType) field.getDeclaringClass()).isInitialized()) {
                     ResolvedJavaField resolvedField = (ResolvedJavaField) field;
+
                     // Javac does not allow use of "$assertionsDisabled" for a field name but
                     // Eclipse does in which case a suffix is added to the generated field.
                     if ((parsingIntrinsic() || graphBuilderConfig.omitAssertions()) && resolvedField.isSynthetic() && resolvedField.getName().startsWith("$assertionsDisabled")) {
-                        appendOptimizedLoadField(kind, ConstantNode.forBoolean(true));
+                        frameState.push(field.getKind(), ConstantNode.forBoolean(true, graph));
                         return;
                     }
 
                     LoadFieldPlugin loadFieldPlugin = this.graphBuilderConfig.getPlugins().getLoadFieldPlugin();
                     if (loadFieldPlugin == null || !loadFieldPlugin.apply(this, resolvedField)) {
-                        appendOptimizedLoadField(kind, genLoadField(null, resolvedField));
+                        frameState.push(field.getKind(), append(genLoadField(null, resolvedField)));
                     }
                 } else {
                     handleUnresolvedLoadField(field, null);
                 }
             }
 
-            public boolean tryLoadFieldPlugin(JavaField field, LoadFieldPlugin loadFieldPlugin) {
-                return loadFieldPlugin.apply((GraphBuilderContext) this, (ResolvedJavaField) field);
-            }
-
             private void genPutStatic(JavaField field) {
-                ValueNode value = frameState.pop(field.getKind().getStackKind());
+                ValueNode value = frameState.pop(field.getKind());
                 if (field instanceof ResolvedJavaField && ((ResolvedJavaType) field.getDeclaringClass()).isInitialized()) {
-                    genStoreField(null, (ResolvedJavaField) field, value);
+                    ResolvedJavaField resolvedField = (ResolvedJavaField) field;
+                    genStoreField(null, resolvedField, value);
                 } else {
                     handleUnresolvedStoreField(field, value, null);
                 }
             }
 
-            protected void appendOptimizedLoadField(Kind kind, ValueNode load) {
-                // append the load to the instruction
-                ValueNode optimized = append(load);
-                frameState.push(kind.getStackKind(), optimized);
-            }
-
             private double[] switchProbability(int numberOfCases, int bci) {
                 double[] prob = (profilingInfo == null ? null : profilingInfo.getSwitchProbabilities(bci));
                 if (prob != null) {
@@ -3277,7 +3191,7 @@
 
             private void genSwitch(BytecodeSwitch bs) {
                 int bci = bci();
-                ValueNode value = frameState.ipop();
+                ValueNode value = frameState.pop(Kind.Int);
 
                 int nofCases = bs.numberOfCases();
                 double[] keyProbabilities = switchProbability(nofCases + 1, bci);
@@ -3380,23 +3294,23 @@
                 // @formatter:off
                 switch (opcode) {
                     case NOP            : /* nothing to do */ break;
-                    case ACONST_NULL    : frameState.apush(appendConstant(JavaConstant.NULL_POINTER)); break;
+                    case ACONST_NULL    : frameState.push(Kind.Object, appendConstant(JavaConstant.NULL_POINTER)); break;
                     case ICONST_M1      : // fall through
                     case ICONST_0       : // fall through
                     case ICONST_1       : // fall through
                     case ICONST_2       : // fall through
                     case ICONST_3       : // fall through
                     case ICONST_4       : // fall through
-                    case ICONST_5       : frameState.ipush(appendConstant(JavaConstant.forInt(opcode - ICONST_0))); break;
+                    case ICONST_5       : frameState.push(Kind.Int, appendConstant(JavaConstant.forInt(opcode - ICONST_0))); break;
                     case LCONST_0       : // fall through
-                    case LCONST_1       : frameState.lpush(appendConstant(JavaConstant.forLong(opcode - LCONST_0))); break;
+                    case LCONST_1       : frameState.push(Kind.Long, appendConstant(JavaConstant.forLong(opcode - LCONST_0))); break;
                     case FCONST_0       : // fall through
                     case FCONST_1       : // fall through
-                    case FCONST_2       : frameState.fpush(appendConstant(JavaConstant.forFloat(opcode - FCONST_0))); break;
+                    case FCONST_2       : frameState.push(Kind.Float, appendConstant(JavaConstant.forFloat(opcode - FCONST_0))); break;
                     case DCONST_0       : // fall through
-                    case DCONST_1       : frameState.dpush(appendConstant(JavaConstant.forDouble(opcode - DCONST_0))); break;
-                    case BIPUSH         : frameState.ipush(appendConstant(JavaConstant.forInt(stream.readByte()))); break;
-                    case SIPUSH         : frameState.ipush(appendConstant(JavaConstant.forInt(stream.readShort()))); break;
+                    case DCONST_1       : frameState.push(Kind.Double, appendConstant(JavaConstant.forDouble(opcode - DCONST_0))); break;
+                    case BIPUSH         : frameState.push(Kind.Int, appendConstant(JavaConstant.forInt(stream.readByte()))); break;
+                    case SIPUSH         : frameState.push(Kind.Int, appendConstant(JavaConstant.forInt(stream.readShort()))); break;
                     case LDC            : // fall through
                     case LDC_W          : // fall through
                     case LDC2_W         : genLoadConstant(stream.readCPI(), opcode); break;
@@ -3466,15 +3380,15 @@
                     case BASTORE        : genStoreIndexed(Kind.Byte  ); break;
                     case CASTORE        : genStoreIndexed(Kind.Char  ); break;
                     case SASTORE        : genStoreIndexed(Kind.Short ); break;
-                    case POP            : frameState.xpop(); break;
-                    case POP2           : frameState.xpop(); frameState.xpop(); break;
-                    case DUP            : frameState.xpush(frameState.xpeek()); break;
+                    case POP            : // fall through
+                    case POP2           : // fall through
+                    case DUP            : // fall through
                     case DUP_X1         : // fall through
                     case DUP_X2         : // fall through
                     case DUP2           : // fall through
                     case DUP2_X1        : // fall through
                     case DUP2_X2        : // fall through
-                    case SWAP           : stackOp(opcode); break;
+                    case SWAP           : frameState.stackOp(opcode); break;
                     case IADD           : // fall through
                     case ISUB           : // fall through
                     case IMUL           : genArithmeticOp(Kind.Int, opcode); break;
@@ -3551,11 +3465,11 @@
                     case RET            : genRet(stream.readLocalIndex()); break;
                     case TABLESWITCH    : genSwitch(new BytecodeTableSwitch(getStream(), bci())); break;
                     case LOOKUPSWITCH   : genSwitch(new BytecodeLookupSwitch(getStream(), bci())); break;
-                    case IRETURN        : genReturn(frameState.ipop(), Kind.Int); break;
-                    case LRETURN        : genReturn(frameState.lpop(), Kind.Long); break;
-                    case FRETURN        : genReturn(frameState.fpop(), Kind.Float); break;
-                    case DRETURN        : genReturn(frameState.dpop(), Kind.Double); break;
-                    case ARETURN        : genReturn(frameState.apop(), Kind.Object); break;
+                    case IRETURN        : genReturn(frameState.pop(Kind.Int), Kind.Int); break;
+                    case LRETURN        : genReturn(frameState.pop(Kind.Long), Kind.Long); break;
+                    case FRETURN        : genReturn(frameState.pop(Kind.Float), Kind.Float); break;
+                    case DRETURN        : genReturn(frameState.pop(Kind.Double), Kind.Double); break;
+                    case ARETURN        : genReturn(frameState.pop(Kind.Object), Kind.Object); break;
                     case RETURN         : genReturn(null, Kind.Void); break;
                     case GETSTATIC      : cpi = stream.readCPI(); genGetStatic(lookupField(cpi, opcode)); break;
                     case PUTSTATIC      : cpi = stream.readCPI(); genPutStatic(lookupField(cpi, opcode)); break;
@@ -3573,8 +3487,8 @@
                     case ATHROW         : genThrow(); break;
                     case CHECKCAST      : genCheckCast(); break;
                     case INSTANCEOF     : genInstanceOf(); break;
-                    case MONITORENTER   : genMonitorEnter(frameState.apop(), stream.nextBCI()); break;
-                    case MONITOREXIT    : genMonitorExit(frameState.apop(), null, stream.nextBCI()); break;
+                    case MONITORENTER   : genMonitorEnter(frameState.pop(Kind.Object), stream.nextBCI()); break;
+                    case MONITOREXIT    : genMonitorExit(frameState.pop(Kind.Object), null, stream.nextBCI()); break;
                     case MULTIANEWARRAY : genNewMultiArray(stream.readCPI()); break;
                     case IFNULL         : genIfNull(Condition.EQ); break;
                     case IFNONNULL      : genIfNull(Condition.NE); break;
@@ -3590,7 +3504,7 @@
             }
 
             private void genArrayLength() {
-                frameState.ipush(append(genArrayLength(frameState.apop())));
+                frameState.push(Kind.Int, append(genArrayLength(frameState.pop(Kind.Object))));
             }
 
             public ResolvedJavaMethod getMethod() {
--- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/JsrNotSupportedBailout.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/JsrNotSupportedBailout.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,7 @@
  */
 package com.oracle.graal.java;
 
-import com.oracle.graal.api.code.*;
+import com.oracle.jvmci.code.BailoutException;
 
 public class JsrNotSupportedBailout extends BailoutException {
 
--- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/LargeLocalLiveness.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/LargeLocalLiveness.java	Thu May 28 21:11:28 2015 -0700
@@ -24,7 +24,7 @@
 
 import java.util.*;
 
-import com.oracle.graal.java.BciBlockMapping.*;
+import com.oracle.graal.java.BciBlockMapping.BciBlock;
 
 public final class LargeLocalLiveness extends LocalLiveness {
     private BitSet[] localsLiveIn;
--- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/LocalLiveness.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/LocalLiveness.java	Thu May 28 21:11:28 2015 -0700
@@ -25,8 +25,8 @@
 import static com.oracle.graal.bytecode.Bytecodes.*;
 
 import com.oracle.graal.bytecode.*;
-import com.oracle.graal.debug.*;
-import com.oracle.graal.java.BciBlockMapping.*;
+import com.oracle.graal.java.BciBlockMapping.BciBlock;
+import com.oracle.jvmci.debug.*;
 
 /**
  * Encapsulates the liveness calculation, so that subclasses for locals &le; 64 and locals &gt; 64
--- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/SmallLocalLiveness.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/SmallLocalLiveness.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,7 @@
  */
 package com.oracle.graal.java;
 
-import com.oracle.graal.java.BciBlockMapping.*;
+import com.oracle.graal.java.BciBlockMapping.BciBlock;
 
 public final class SmallLocalLiveness extends LocalLiveness {
     /*
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/JTTTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/JTTTest.java	Thu May 28 21:11:28 2015 -0700
@@ -22,14 +22,17 @@
  */
 package com.oracle.graal.jtt;
 
+import com.oracle.jvmci.code.InstalledCode;
+import com.oracle.jvmci.meta.JavaConstant;
+import com.oracle.jvmci.meta.JavaType;
+import com.oracle.jvmci.meta.DeoptimizationReason;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
 import static java.lang.reflect.Modifier.*;
 
 import java.util.*;
 
 import org.junit.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.test.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions;
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/bytecode/BC_instanceof01.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/bytecode/BC_instanceof01.java	Thu May 28 21:11:28 2015 -0700
@@ -26,9 +26,9 @@
 
 import com.oracle.graal.compiler.phases.*;
 import com.oracle.graal.jtt.*;
-import com.oracle.graal.options.*;
-import com.oracle.graal.options.OptionValue.OverrideScope;
 import com.oracle.graal.phases.tiers.*;
+import com.oracle.jvmci.options.*;
+import com.oracle.jvmci.options.OptionValue.OverrideScope;
 
 /**
  * Tests the instanceof works, when casting an array of interface.
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/except/UntrustedInterfaces.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/except/UntrustedInterfaces.java	Thu May 28 21:11:28 2015 -0700
@@ -22,8 +22,9 @@
  */
 package com.oracle.graal.jtt.except;
 
+import jdk.internal.org.objectweb.asm.*;
+
 import org.junit.*;
-import jdk.internal.org.objectweb.asm.*;
 
 import com.oracle.graal.jtt.*;
 
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/hotpath/HP_field01.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/hotpath/HP_field01.java	Thu May 28 21:11:28 2015 -0700
@@ -23,9 +23,9 @@
 // Checkstyle: stop
 package com.oracle.graal.jtt.hotpath;
 
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
 import org.junit.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.jtt.*;
 
 /*
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/hotpath/HP_field03.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/hotpath/HP_field03.java	Thu May 28 21:11:28 2015 -0700
@@ -23,9 +23,9 @@
 // Checkstyle: stop
 package com.oracle.graal.jtt.hotpath;
 
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
 import org.junit.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.jtt.*;
 
 /*
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/jdk/Unsafe_compareAndSwap.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/jdk/Unsafe_compareAndSwap.java	Thu May 28 21:11:28 2015 -0700
@@ -22,11 +22,11 @@
  */
 package com.oracle.graal.jtt.jdk;
 
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
 import org.junit.*;
 
 import sun.misc.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.jtt.*;
 
 public class Unsafe_compareAndSwap extends JTTTest {
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/lang/LambdaEagerTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/lang/LambdaEagerTest.java	Thu May 28 21:11:28 2015 -0700
@@ -22,18 +22,19 @@
  */
 package com.oracle.graal.jtt.lang;
 
+import com.oracle.jvmci.code.InstalledCode;
+import com.oracle.jvmci.meta.DeoptimizationReason;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
 import java.util.*;
 import java.util.function.*;
 
 import org.junit.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.test.*;
 import com.oracle.graal.nodes.*;
-import com.oracle.graal.options.*;
-import com.oracle.graal.options.OptionValue.OverrideScope;
+import com.oracle.jvmci.options.*;
+import com.oracle.jvmci.options.OptionValue.OverrideScope;
 
 public class LambdaEagerTest extends GraalCompilerTest {
 
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/loop/LoopNewInstance.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/loop/LoopNewInstance.java	Thu May 28 21:11:28 2015 -0700
@@ -22,9 +22,9 @@
  */
 package com.oracle.graal.jtt.loop;
 
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
 import org.junit.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.jtt.*;
 
 /*
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/optimize/ConditionalElimination01.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/optimize/ConditionalElimination01.java	Thu May 28 21:11:28 2015 -0700
@@ -22,9 +22,9 @@
  */
 package com.oracle.graal.jtt.optimize;
 
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
 import org.junit.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.jtt.*;
 
 public class ConditionalElimination01 extends JTTTest {
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/optimize/ConditionalElimination02.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/optimize/ConditionalElimination02.java	Thu May 28 21:11:28 2015 -0700
@@ -22,11 +22,11 @@
  */
 package com.oracle.graal.jtt.optimize;
 
+import com.oracle.jvmci.meta.DeoptimizationReason;
 import java.util.*;
 
 import org.junit.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.jtt.*;
 
 public class ConditionalElimination02 extends JTTTest {
--- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64AddressValue.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64AddressValue.java	Thu May 28 21:11:28 2015 -0700
@@ -22,17 +22,21 @@
  */
 package com.oracle.graal.lir.amd64;
 
-import static com.oracle.graal.api.code.ValueUtil.*;
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.code.RegisterValue;
+import com.oracle.jvmci.meta.AllocatableValue;
+import com.oracle.jvmci.meta.LIRKind;
+import com.oracle.jvmci.meta.Value;
+import static com.oracle.jvmci.code.ValueUtil.*;
 import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*;
 
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.asm.amd64.*;
 import com.oracle.graal.asm.amd64.AMD64Address.Scale;
 import com.oracle.graal.lir.*;
-import com.oracle.graal.lir.LIRInstruction.*;
+import com.oracle.graal.lir.LIRInstruction.OperandFlag;
+import com.oracle.graal.lir.LIRInstruction.OperandMode;
 
 public final class AMD64AddressValue extends CompositeValue {
 
--- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Arithmetic.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Arithmetic.java	Thu May 28 21:11:28 2015 -0700
@@ -22,10 +22,12 @@
  */
 package com.oracle.graal.lir.amd64;
 
-import static com.oracle.graal.api.code.ValueUtil.*;
+import com.oracle.jvmci.meta.Kind;
+import com.oracle.jvmci.meta.AllocatableValue;
+import com.oracle.jvmci.meta.LIRKind;
+import static com.oracle.jvmci.code.ValueUtil.*;
 
 import com.oracle.graal.amd64.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.asm.*;
 import com.oracle.graal.asm.amd64.*;
 import com.oracle.graal.asm.amd64.AMD64Assembler.ConditionFlag;
--- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64ArithmeticLIRGenerator.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64ArithmeticLIRGenerator.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,7 @@
  */
 package com.oracle.graal.lir.amd64;
 
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.meta.Value;
 
 /**
  * This interface can be used to generate AMD64 LIR for arithmetic operations.
--- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64ArrayEqualsOp.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64ArrayEqualsOp.java	Thu May 28 21:11:28 2015 -0700
@@ -22,16 +22,19 @@
  */
 package com.oracle.graal.lir.amd64;
 
-import static com.oracle.graal.api.code.ValueUtil.*;
-import static com.oracle.graal.compiler.common.UnsafeAccess.*;
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.code.TargetDescription;
+import com.oracle.jvmci.meta.Kind;
+import com.oracle.jvmci.meta.LIRKind;
+import com.oracle.jvmci.meta.Value;
+import static com.oracle.jvmci.code.ValueUtil.*;
 import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*;
+import static com.oracle.jvmci.common.UnsafeAccess.*;
 
 import java.lang.reflect.*;
 
 import com.oracle.graal.amd64.*;
 import com.oracle.graal.amd64.AMD64.CPUFeature;
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.asm.*;
 import com.oracle.graal.asm.amd64.*;
 import com.oracle.graal.asm.amd64.AMD64Address.Scale;
--- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Binary.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Binary.java	Thu May 28 21:11:28 2015 -0700
@@ -22,11 +22,13 @@
  */
 package com.oracle.graal.lir.amd64;
 
-import static com.oracle.graal.api.code.ValueUtil.*;
+import com.oracle.jvmci.meta.AllocatableValue;
+import com.oracle.jvmci.meta.Value;
+import com.oracle.jvmci.meta.JavaConstant;
+import static com.oracle.jvmci.code.ValueUtil.*;
 import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*;
 
-import com.oracle.graal.api.code.CompilationResult.DataSectionReference;
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.code.CompilationResult.DataSectionReference;
 import com.oracle.graal.asm.*;
 import com.oracle.graal.asm.amd64.*;
 import com.oracle.graal.asm.amd64.AMD64Assembler.AMD64BinaryArithmetic;
--- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64BinaryConsumer.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64BinaryConsumer.java	Thu May 28 21:11:28 2015 -0700
@@ -22,11 +22,13 @@
  */
 package com.oracle.graal.lir.amd64;
 
-import static com.oracle.graal.api.code.ValueUtil.*;
+import com.oracle.jvmci.meta.Constant;
+import com.oracle.jvmci.meta.AllocatableValue;
+import com.oracle.jvmci.meta.Value;
+import static com.oracle.jvmci.code.ValueUtil.*;
 import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*;
 
-import com.oracle.graal.api.code.CompilationResult.DataSectionReference;
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.code.CompilationResult.DataSectionReference;
 import com.oracle.graal.asm.*;
 import com.oracle.graal.asm.amd64.*;
 import com.oracle.graal.asm.amd64.AMD64Assembler.AMD64BinaryArithmetic;
--- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64BreakpointOp.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64BreakpointOp.java	Thu May 28 21:11:28 2015 -0700
@@ -22,9 +22,9 @@
  */
 package com.oracle.graal.lir.amd64;
 
+import com.oracle.jvmci.meta.Value;
 import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.asm.amd64.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.asm.*;
--- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64ByteSwapOp.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64ByteSwapOp.java	Thu May 28 21:11:28 2015 -0700
@@ -22,8 +22,8 @@
  */
 package com.oracle.graal.lir.amd64;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.code.ValueUtil;
+import com.oracle.jvmci.meta.Value;
 import com.oracle.graal.asm.amd64.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.asm.*;
--- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64CCall.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64CCall.java	Thu May 28 21:11:28 2015 -0700
@@ -22,10 +22,11 @@
  */
 package com.oracle.graal.lir.amd64;
 
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.code.ValueUtil;
+import com.oracle.jvmci.meta.Value;
 import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.asm.amd64.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.asm.*;
--- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Call.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Call.java	Thu May 28 21:11:28 2015 -0700
@@ -22,12 +22,20 @@
  */
 package com.oracle.graal.lir.amd64;
 
-import static com.oracle.graal.api.code.ValueUtil.*;
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.code.RegisterValue;
+import com.oracle.jvmci.code.ValueUtil;
+import com.oracle.jvmci.code.ForeignCallLinkage;
+import com.oracle.jvmci.meta.Kind;
+import com.oracle.jvmci.meta.AllocatableValue;
+import com.oracle.jvmci.meta.LIRKind;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
+import com.oracle.jvmci.meta.Value;
+import com.oracle.jvmci.meta.InvokeTarget;
+import static com.oracle.jvmci.code.ValueUtil.*;
 import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*;
 
 import com.oracle.graal.amd64.*;
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.asm.amd64.AMD64Assembler.ConditionFlag;
 import com.oracle.graal.asm.amd64.*;
 import com.oracle.graal.lir.*;
--- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64ClearRegisterOp.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64ClearRegisterOp.java	Thu May 28 21:11:28 2015 -0700
@@ -22,11 +22,11 @@
  */
 package com.oracle.graal.lir.amd64;
 
-import static com.oracle.graal.api.code.ValueUtil.*;
+import com.oracle.jvmci.meta.AllocatableValue;
+import static com.oracle.jvmci.code.ValueUtil.*;
 import static com.oracle.graal.asm.amd64.AMD64Assembler.AMD64BinaryArithmetic.*;
 import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.asm.amd64.AMD64Assembler.AMD64RMOp;
 import com.oracle.graal.asm.amd64.AMD64Assembler.OperandSize;
 import com.oracle.graal.asm.amd64.*;
--- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64ControlFlow.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64ControlFlow.java	Thu May 28 21:11:28 2015 -0700
@@ -22,23 +22,26 @@
  */
 package com.oracle.graal.lir.amd64;
 
-import static com.oracle.graal.api.code.ValueUtil.*;
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.meta.Kind;
+import com.oracle.jvmci.meta.AllocatableValue;
+import com.oracle.jvmci.meta.Value;
+import com.oracle.jvmci.meta.JavaConstant;
+import static com.oracle.jvmci.code.ValueUtil.*;
 import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*;
 
 import com.oracle.graal.amd64.*;
-import com.oracle.graal.api.code.CompilationResult.JumpTable;
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.code.CompilationResult.JumpTable;
 import com.oracle.graal.asm.*;
 import com.oracle.graal.asm.amd64.*;
 import com.oracle.graal.asm.amd64.AMD64Address.Scale;
 import com.oracle.graal.asm.amd64.AMD64Assembler.ConditionFlag;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.calc.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.StandardOp.BlockEndOp;
 import com.oracle.graal.lir.SwitchStrategy.BaseSwitchClosure;
 import com.oracle.graal.lir.asm.*;
+import com.oracle.jvmci.common.*;
 
 public class AMD64ControlFlow {
 
@@ -172,7 +175,7 @@
                             masm.cmpptr(keyRegister, asObjectReg(scratch));
                             break;
                         default:
-                            throw new GraalInternalError("switch only supported for int, long and object");
+                            throw new JVMCIError("switch only supported for int, long and object");
                     }
                     masm.jcc(intCond(condition), target);
                 }
@@ -354,7 +357,7 @@
                     masm.cmovq(cond, asRegister(result), asRegister(other));
                     break;
                 default:
-                    throw GraalInternalError.shouldNotReachHere();
+                    throw JVMCIError.shouldNotReachHere();
             }
         } else {
             AMD64Address addr = (AMD64Address) crb.asAddress(other);
@@ -370,7 +373,7 @@
                     masm.cmovq(cond, asRegister(result), addr);
                     break;
                 default:
-                    throw GraalInternalError.shouldNotReachHere();
+                    throw JVMCIError.shouldNotReachHere();
             }
         }
     }
@@ -398,7 +401,7 @@
             case BT:
                 return ConditionFlag.Below;
             default:
-                throw GraalInternalError.shouldNotReachHere();
+                throw JVMCIError.shouldNotReachHere();
         }
     }
 
@@ -417,7 +420,7 @@
             case GT:
                 return ConditionFlag.Above;
             default:
-                throw GraalInternalError.shouldNotReachHere();
+                throw JVMCIError.shouldNotReachHere();
         }
     }
 
@@ -436,7 +439,7 @@
             case NoOverflow:
                 return true;
             default:
-                throw GraalInternalError.shouldNotReachHere();
+                throw JVMCIError.shouldNotReachHere();
         }
     }
 }
--- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64FrameMap.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64FrameMap.java	Thu May 28 21:11:28 2015 -0700
@@ -22,10 +22,12 @@
  */
 package com.oracle.graal.lir.amd64;
 
-import static com.oracle.graal.api.code.ValueUtil.*;
-
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.code.CodeCacheProvider;
+import com.oracle.jvmci.code.StackSlot;
+import com.oracle.jvmci.code.RegisterConfig;
+import com.oracle.jvmci.meta.Kind;
+import com.oracle.jvmci.meta.LIRKind;
+import static com.oracle.jvmci.code.ValueUtil.*;
 import com.oracle.graal.asm.*;
 import com.oracle.graal.lir.framemap.*;
 
--- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64FrameMapBuilder.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64FrameMapBuilder.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,9 @@
  */
 package com.oracle.graal.lir.amd64;
 
-import com.oracle.graal.api.code.*;
+import com.oracle.jvmci.code.CodeCacheProvider;
+import com.oracle.jvmci.code.StackSlot;
+import com.oracle.jvmci.code.RegisterConfig;
 import com.oracle.graal.lir.framemap.*;
 
 public class AMD64FrameMapBuilder extends FrameMapBuilderImpl {
--- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64MathIntrinsicOp.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64MathIntrinsicOp.java	Thu May 28 21:11:28 2015 -0700
@@ -22,13 +22,13 @@
  */
 package com.oracle.graal.lir.amd64;
 
-import static com.oracle.graal.api.code.ValueUtil.*;
+import com.oracle.jvmci.meta.Value;
+import static com.oracle.jvmci.code.ValueUtil.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.asm.amd64.*;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.asm.*;
+import com.oracle.jvmci.common.*;
 
 // @formatter:off
 public final class AMD64MathIntrinsicOp extends AMD64LIRInstruction {
@@ -57,7 +57,7 @@
             case SIN:   masm.fsin(asDoubleReg(result), asDoubleReg(input)); break;
             case COS:   masm.fcos(asDoubleReg(result), asDoubleReg(input)); break;
             case TAN:   masm.ftan(asDoubleReg(result), asDoubleReg(input)); break;
-            default:    throw GraalInternalError.shouldNotReachHere();
+            default:    throw JVMCIError.shouldNotReachHere();
         }
     }
 }
--- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Move.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Move.java	Thu May 28 21:11:28 2015 -0700
@@ -22,23 +22,27 @@
  */
 package com.oracle.graal.lir.amd64;
 
-import static com.oracle.graal.api.code.ValueUtil.*;
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.code.StackSlotValue;
+import com.oracle.jvmci.meta.Kind;
+import com.oracle.jvmci.meta.AllocatableValue;
+import com.oracle.jvmci.meta.Value;
+import com.oracle.jvmci.meta.JavaConstant;
+import static com.oracle.jvmci.code.ValueUtil.*;
 import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*;
 import static java.lang.Double.*;
 import static java.lang.Float.*;
 
 import com.oracle.graal.amd64.*;
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.asm.*;
 import com.oracle.graal.asm.amd64.*;
 import com.oracle.graal.asm.amd64.AMD64Assembler.AMD64MIOp;
 import com.oracle.graal.asm.amd64.AMD64Assembler.OperandSize;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.StandardOp.MoveOp;
 import com.oracle.graal.lir.StandardOp.NullCheck;
 import com.oracle.graal.lir.asm.*;
+import com.oracle.jvmci.common.*;
 
 public class AMD64Move {
 
@@ -286,7 +290,7 @@
                     masm.cmpxchgq(asRegister(newValue), address.toAddress());
                     break;
                 default:
-                    throw GraalInternalError.shouldNotReachHere();
+                    throw JVMCIError.shouldNotReachHere();
             }
         }
     }
@@ -323,7 +327,7 @@
                     masm.xaddq(address.toAddress(), asRegister(result));
                     break;
                 default:
-                    throw GraalInternalError.shouldNotReachHere();
+                    throw JVMCIError.shouldNotReachHere();
             }
         }
     }
@@ -358,7 +362,7 @@
                     masm.xchgq(asRegister(result), address.toAddress());
                     break;
                 default:
-                    throw GraalInternalError.shouldNotReachHere();
+                    throw JVMCIError.shouldNotReachHere();
             }
         }
     }
@@ -374,13 +378,13 @@
             } else if (isStackSlot(result)) {
                 reg2stack(moveKind, crb, masm, result, input);
             } else {
-                throw GraalInternalError.shouldNotReachHere();
+                throw JVMCIError.shouldNotReachHere();
             }
         } else if (isStackSlot(input)) {
             if (isRegister(result)) {
                 stack2reg(moveKind, crb, masm, result, input);
             } else {
-                throw GraalInternalError.shouldNotReachHere();
+                throw JVMCIError.shouldNotReachHere();
             }
         } else if (isConstant(input)) {
             if (isRegister(result)) {
@@ -388,10 +392,10 @@
             } else if (isStackSlot(result)) {
                 const2stack(crb, masm, result, (JavaConstant) input);
             } else {
-                throw GraalInternalError.shouldNotReachHere();
+                throw JVMCIError.shouldNotReachHere();
             }
         } else {
-            throw GraalInternalError.shouldNotReachHere();
+            throw JVMCIError.shouldNotReachHere();
         }
     }
 
@@ -416,7 +420,7 @@
                 masm.movq(asRegister(result), asRegister(input));
                 break;
             default:
-                throw GraalInternalError.shouldNotReachHere("kind=" + result.getKind());
+                throw JVMCIError.shouldNotReachHere("kind=" + result.getKind());
         }
     }
 
@@ -447,7 +451,7 @@
                 masm.movq(dest, asRegister(input));
                 break;
             default:
-                throw GraalInternalError.shouldNotReachHere();
+                throw JVMCIError.shouldNotReachHere();
         }
     }
 
@@ -482,7 +486,7 @@
                 masm.movq(asRegister(result), src);
                 break;
             default:
-                throw GraalInternalError.shouldNotReachHere();
+                throw JVMCIError.shouldNotReachHere();
         }
     }
 
@@ -559,7 +563,7 @@
                 }
                 break;
             default:
-                throw GraalInternalError.shouldNotReachHere();
+                throw JVMCIError.shouldNotReachHere();
         }
     }
 
@@ -584,11 +588,11 @@
                 if (input.isNull()) {
                     imm = 0;
                 } else {
-                    throw GraalInternalError.shouldNotReachHere("Non-null object constants must be in register");
+                    throw JVMCIError.shouldNotReachHere("Non-null object constants must be in register");
                 }
                 break;
             default:
-                throw GraalInternalError.shouldNotReachHere();
+                throw JVMCIError.shouldNotReachHere();
         }
         switch (result.getKind()) {
             case Byte:
@@ -610,7 +614,7 @@
                 masm.movlong(dest, imm);
                 break;
             default:
-                throw GraalInternalError.shouldNotReachHere("Unknown result Kind: " + result.getKind());
+                throw JVMCIError.shouldNotReachHere("Unknown result Kind: " + result.getKind());
         }
     }
 }
--- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64MulDivOp.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64MulDivOp.java	Thu May 28 21:11:28 2015 -0700
@@ -22,12 +22,14 @@
  */
 package com.oracle.graal.lir.amd64;
 
-import static com.oracle.graal.api.code.ValueUtil.*;
+import com.oracle.jvmci.meta.AllocatableValue;
+import com.oracle.jvmci.meta.LIRKind;
+import com.oracle.jvmci.meta.Value;
+import static com.oracle.jvmci.code.ValueUtil.*;
 import static com.oracle.graal.asm.amd64.AMD64Assembler.AMD64MOp.*;
 import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*;
 
 import com.oracle.graal.amd64.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.asm.amd64.*;
 import com.oracle.graal.asm.amd64.AMD64Assembler.AMD64MOp;
 import com.oracle.graal.asm.amd64.AMD64Assembler.OperandSize;
--- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64RestoreRegistersOp.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64RestoreRegistersOp.java	Thu May 28 21:11:28 2015 -0700
@@ -22,12 +22,16 @@
  */
 package com.oracle.graal.lir.amd64;
 
-import static com.oracle.graal.api.code.ValueUtil.*;
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.code.RegisterValue;
+import com.oracle.jvmci.code.ValueUtil;
+import com.oracle.jvmci.code.StackSlotValue;
+import com.oracle.jvmci.code.StackSlot;
+import static com.oracle.jvmci.code.ValueUtil.*;
 import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*;
 
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
 import com.oracle.graal.asm.amd64.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.asm.*;
--- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64SaveRegistersOp.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64SaveRegistersOp.java	Thu May 28 21:11:28 2015 -0700
@@ -22,12 +22,17 @@
  */
 package com.oracle.graal.lir.amd64;
 
-import static com.oracle.graal.api.code.ValueUtil.*;
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.code.RegisterValue;
+import com.oracle.jvmci.code.ValueUtil;
+import com.oracle.jvmci.code.RegisterSaveLayout;
+import com.oracle.jvmci.code.StackSlotValue;
+import com.oracle.jvmci.code.StackSlot;
+import static com.oracle.jvmci.code.ValueUtil.*;
 import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*;
 
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
 import com.oracle.graal.asm.amd64.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.StandardOp.SaveRegistersOp;
--- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64ShiftOp.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64ShiftOp.java	Thu May 28 21:11:28 2015 -0700
@@ -22,14 +22,14 @@
  */
 package com.oracle.graal.lir.amd64;
 
-import static com.oracle.graal.api.code.ValueUtil.*;
+import com.oracle.jvmci.meta.AllocatableValue;
+import static com.oracle.jvmci.code.ValueUtil.*;
 import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*;
 
 import com.oracle.graal.amd64.*;
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.asm.amd64.*;
 import com.oracle.graal.asm.amd64.AMD64Assembler.AMD64MOp;
 import com.oracle.graal.asm.amd64.AMD64Assembler.OperandSize;
+import com.oracle.graal.asm.amd64.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.asm.*;
 
--- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64SignExtendOp.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64SignExtendOp.java	Thu May 28 21:11:28 2015 -0700
@@ -22,12 +22,13 @@
  */
 package com.oracle.graal.lir.amd64;
 
-import static com.oracle.graal.api.code.ValueUtil.*;
+import com.oracle.jvmci.meta.AllocatableValue;
+import com.oracle.jvmci.meta.LIRKind;
+import static com.oracle.jvmci.code.ValueUtil.*;
 import static com.oracle.graal.asm.amd64.AMD64Assembler.OperandSize.*;
 import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*;
 
 import com.oracle.graal.amd64.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.asm.amd64.AMD64Assembler.OperandSize;
 import com.oracle.graal.asm.amd64.*;
 import com.oracle.graal.lir.*;
--- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Unary.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Unary.java	Thu May 28 21:11:28 2015 -0700
@@ -22,10 +22,11 @@
  */
 package com.oracle.graal.lir.amd64;
 
-import static com.oracle.graal.api.code.ValueUtil.*;
+import com.oracle.jvmci.meta.AllocatableValue;
+import com.oracle.jvmci.meta.Value;
+import static com.oracle.jvmci.code.ValueUtil.*;
 import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.asm.amd64.*;
 import com.oracle.graal.asm.amd64.AMD64Assembler.AMD64MOp;
 import com.oracle.graal.asm.amd64.AMD64Assembler.AMD64MROp;
--- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64ZapRegistersOp.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64ZapRegistersOp.java	Thu May 28 21:11:28 2015 -0700
@@ -22,13 +22,15 @@
  */
 package com.oracle.graal.lir.amd64;
 
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.code.RegisterValue;
+import com.oracle.jvmci.code.RegisterSaveLayout;
+import com.oracle.jvmci.meta.JavaConstant;
 import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*;
 import static com.oracle.graal.lir.amd64.AMD64SaveRegistersOp.*;
 
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.asm.amd64.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.StandardOp.SaveRegistersOp;
--- a/graal/com.oracle.graal.lir.jtt/src/com/oracle/graal/lir/jtt/LIRTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir.jtt/src/com/oracle/graal/lir/jtt/LIRTest.java	Thu May 28 21:11:28 2015 -0700
@@ -22,23 +22,24 @@
  */
 package com.oracle.graal.lir.jtt;
 
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
+import com.oracle.jvmci.meta.Value;
+import com.oracle.jvmci.meta.Kind;
 import java.lang.annotation.*;
 import java.lang.reflect.*;
 import java.util.stream.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.api.replacements.*;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graphbuilderconf.*;
-import com.oracle.graal.graphbuilderconf.MethodIdMap.Receiver;
 import com.oracle.graal.jtt.*;
 import com.oracle.graal.lir.gen.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.calc.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.common.*;
 
 /**
  * Base class for LIR tests.
@@ -76,7 +77,7 @@
         }
 
         private static void defaultHandler(@SuppressWarnings("unused") LIRGeneratorTool gen, Value... args) {
-            throw new GraalInternalError("LIRTestSpecification cannot handle generate() with %d arguments", args.length);
+            throw new JVMCIError("LIRTestSpecification cannot handle generate() with %d arguments", args.length);
         }
 
         void generate(LIRGeneratorTool gen, Value[] values) {
@@ -93,7 +94,7 @@
             } else if (values.length == 5) {
                 generate(gen, values[0], values[1], values[2], values[3], values[4]);
             } else {
-                GraalInternalError.unimplemented();
+                JVMCIError.unimplemented();
             }
 
         }
@@ -214,27 +215,32 @@
 
     private InvocationPlugin floatingLIRNodePlugin = new InvocationPlugin() {
         public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode spec) {
-            b.addPush(new FloatingLIRTestNode(getSnippetReflection(), targetMethod.getSignature().getReturnKind(), spec, new ValueNode[]{}));
+            Kind returnKind = targetMethod.getSignature().getReturnKind();
+            b.addPush(returnKind, new FloatingLIRTestNode(getSnippetReflection(), returnKind, spec, new ValueNode[]{}));
             return true;
         }
 
         public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode spec, ValueNode arg0) {
-            b.addPush(new FloatingLIRTestNode(getSnippetReflection(), targetMethod.getSignature().getReturnKind(), spec, new ValueNode[]{arg0}));
+            Kind returnKind = targetMethod.getSignature().getReturnKind();
+            b.addPush(returnKind, new FloatingLIRTestNode(getSnippetReflection(), returnKind, spec, new ValueNode[]{arg0}));
             return true;
         }
 
         public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode spec, ValueNode arg0, ValueNode arg1) {
-            b.addPush(new FloatingLIRTestNode(getSnippetReflection(), targetMethod.getSignature().getReturnKind(), spec, new ValueNode[]{arg0, arg1}));
+            Kind returnKind = targetMethod.getSignature().getReturnKind();
+            b.addPush(returnKind, new FloatingLIRTestNode(getSnippetReflection(), returnKind, spec, new ValueNode[]{arg0, arg1}));
             return true;
         }
 
         public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode spec, ValueNode arg0, ValueNode arg1, ValueNode arg2) {
-            b.addPush(new FloatingLIRTestNode(getSnippetReflection(), targetMethod.getSignature().getReturnKind(), spec, new ValueNode[]{arg0, arg1, arg2}));
+            Kind returnKind = targetMethod.getSignature().getReturnKind();
+            b.addPush(returnKind, new FloatingLIRTestNode(getSnippetReflection(), returnKind, spec, new ValueNode[]{arg0, arg1, arg2}));
             return true;
         }
 
         public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode spec, ValueNode arg0, ValueNode arg1, ValueNode arg2, ValueNode arg3) {
-            b.addPush(new FloatingLIRTestNode(getSnippetReflection(), targetMethod.getSignature().getReturnKind(), spec, new ValueNode[]{arg0, arg1, arg2, arg3}));
+            Kind returnKind = targetMethod.getSignature().getReturnKind();
+            b.addPush(returnKind, new FloatingLIRTestNode(getSnippetReflection(), returnKind, spec, new ValueNode[]{arg0, arg1, arg2, arg3}));
             return true;
         }
 
--- a/graal/com.oracle.graal.lir.jtt/src/com/oracle/graal/lir/jtt/StackMoveTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir.jtt/src/com/oracle/graal/lir/jtt/StackMoveTest.java	Thu May 28 21:11:28 2015 -0700
@@ -22,10 +22,10 @@
  */
 package com.oracle.graal.lir.jtt;
 
+import com.oracle.jvmci.code.StackSlotValue;
+import com.oracle.jvmci.meta.Value;
 import org.junit.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.lir.framemap.*;
 import com.oracle.graal.lir.gen.*;
 
--- a/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCAddressValue.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCAddressValue.java	Thu May 28 21:11:28 2015 -0700
@@ -22,13 +22,16 @@
  */
 package com.oracle.graal.lir.sparc;
 
-import static com.oracle.graal.api.code.ValueUtil.*;
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.code.RegisterValue;
+import com.oracle.jvmci.meta.LIRKind;
+import com.oracle.jvmci.meta.Value;
+import com.oracle.jvmci.meta.AllocatableValue;
+import static com.oracle.jvmci.code.ValueUtil.*;
 import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*;
 
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.asm.sparc.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.LIRInstruction.OperandFlag;
--- a/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCArithmetic.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCArithmetic.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,13 @@
  */
 package com.oracle.graal.lir.sparc;
 
-import static com.oracle.graal.api.code.ValueUtil.*;
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.meta.LIRKind;
+import com.oracle.jvmci.meta.Kind;
+import com.oracle.jvmci.meta.Value;
+import com.oracle.jvmci.meta.AllocatableValue;
+import com.oracle.jvmci.meta.JavaConstant;
+import static com.oracle.jvmci.code.ValueUtil.*;
 import static com.oracle.graal.asm.sparc.SPARCAssembler.*;
 import static com.oracle.graal.asm.sparc.SPARCAssembler.Annul.*;
 import static com.oracle.graal.asm.sparc.SPARCAssembler.BranchPredict.*;
@@ -33,16 +39,15 @@
 import static com.oracle.graal.sparc.SPARC.*;
 import static com.oracle.graal.sparc.SPARC.CPUFeature.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.asm.*;
 import com.oracle.graal.asm.sparc.*;
-import com.oracle.graal.asm.sparc.SPARCMacroAssembler.*;
-import com.oracle.graal.compiler.common.*;
+import com.oracle.graal.asm.sparc.SPARCMacroAssembler.ScratchRegister;
+import com.oracle.graal.asm.sparc.SPARCMacroAssembler.Setx;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.asm.*;
 import com.oracle.graal.lir.gen.*;
 import com.oracle.graal.sparc.*;
+import com.oracle.jvmci.common.*;
 
 public enum SPARCArithmetic {
     // @formatter:off
@@ -262,7 +267,7 @@
                 masm.mulx(asIntReg(src1), constant, asIntReg(dst));
                 break;
             case IMULCC:
-                throw GraalInternalError.unimplemented();
+                throw JVMCIError.unimplemented();
             case IDIV:
                 masm.sra(asRegister(src1), 0, asRegister(src1));
                 masm.sdivx(asIntReg(src1), constant, asIntReg(dst));
@@ -338,7 +343,7 @@
             case DMUL:
             case DDIV:
             default:
-                throw GraalInternalError.shouldNotReachHere();
+                throw JVMCIError.shouldNotReachHere();
         }
         if (info != null) {
             assert exceptionOffset != -1;
@@ -431,7 +436,7 @@
                 masm.srl(asIntReg(src1), asIntReg(src2), asIntReg(dst));
                 break;
             case IREM:
-                throw GraalInternalError.unimplemented();
+                throw JVMCIError.unimplemented();
             case LADD:
                 delaySlotLir.emitControlTransfer(crb, masm);
                 masm.add(asLongReg(src1), asLongReg(src2), asLongReg(dst));
@@ -453,7 +458,7 @@
                 masm.mulx(asLongReg(src1), asLongReg(src2), asLongReg(dst));
                 break;
             case LMULCC:
-                throw GraalInternalError.unimplemented();
+                throw JVMCIError.unimplemented();
             case LDIV:
                 delaySlotLir.emitControlTransfer(crb, masm);
                 exceptionOffset = masm.position();
@@ -510,7 +515,7 @@
                 masm.fdivs(asFloatReg(src1), asFloatReg(src2), asFloatReg(dst));
                 break;
             case FREM:
-                throw GraalInternalError.unimplemented();
+                throw JVMCIError.unimplemented();
             case DADD:
                 delaySlotLir.emitControlTransfer(crb, masm);
                 masm.faddd(asDoubleReg(src1), asDoubleReg(src2), asDoubleReg(dst));
@@ -529,13 +534,13 @@
                 masm.fdivd(asDoubleReg(src1), asDoubleReg(src2), asDoubleReg(dst));
                 break;
             case DREM:
-                throw GraalInternalError.unimplemented();
+                throw JVMCIError.unimplemented();
             case DAND:
                 delaySlotLir.emitControlTransfer(crb, masm);
                 masm.fandd(asDoubleReg(src1), asDoubleReg(src2), asDoubleReg(dst));
                 break;
             default:
-                throw GraalInternalError.shouldNotReachHere();
+                throw JVMCIError.shouldNotReachHere();
         }
         if (info != null) {
             assert exceptionOffset != -1;
@@ -575,10 +580,10 @@
                     masm.sub(asLongReg(src1), asLongReg(scratch2), asLongReg(dst));
                     break;
                 case IUREM:
-                    GraalInternalError.unimplemented();
+                    JVMCIError.unimplemented();
                     break;
                 default:
-                    throw GraalInternalError.shouldNotReachHere();
+                    throw JVMCIError.shouldNotReachHere();
             }
         } else if (isRegister(src1) && isRegister(src2)) {
             Value srcLeft = src1;
@@ -637,10 +642,10 @@
                     masm.sub(asIntReg(scratch1), asIntReg(dst), asIntReg(dst));
                     break;
                 default:
-                    throw GraalInternalError.shouldNotReachHere();
+                    throw JVMCIError.shouldNotReachHere();
             }
         } else {
-            throw GraalInternalError.shouldNotReachHere();
+            throw JVMCIError.shouldNotReachHere();
         }
         if (info != null) {
             assert exceptionOffset != -1;
@@ -761,7 +766,7 @@
                 masm.fnegd(asDoubleReg(src), asDoubleReg(dst));
                 break;
             default:
-                throw GraalInternalError.shouldNotReachHere("missing: " + opcode);
+                throw JVMCIError.shouldNotReachHere("missing: " + opcode);
         }
         if (info != null) {
             assert exceptionOffset != -1;
@@ -850,7 +855,7 @@
                 assert rk == Kind.Double && xk == Kind.Double && yk == Kind.Double : "opcode=" + opcode + ", result kind=" + rk + ", x kind=" + xk + ", y kind=" + yk;
                 break;
             default:
-                throw GraalInternalError.shouldNotReachHere("missing: " + opcode);
+                throw JVMCIError.shouldNotReachHere("missing: " + opcode);
         }
     }
 
@@ -905,7 +910,7 @@
                     masm.umulxhi(asLongReg(x), asLongReg(y), asLongReg(result));
                     break;
                 default:
-                    throw GraalInternalError.shouldNotReachHere();
+                    throw JVMCIError.shouldNotReachHere();
             }
         }
     }
--- a/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCArrayEqualsOp.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCArrayEqualsOp.java	Thu May 28 21:11:28 2015 -0700
@@ -22,21 +22,23 @@
  */
 package com.oracle.graal.lir.sparc;
 
-import static com.oracle.graal.api.code.ValueUtil.*;
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.meta.LIRKind;
+import com.oracle.jvmci.meta.Value;
+import com.oracle.jvmci.meta.Kind;
+import static com.oracle.jvmci.code.ValueUtil.*;
 import static com.oracle.graal.asm.sparc.SPARCAssembler.Annul.*;
 import static com.oracle.graal.asm.sparc.SPARCAssembler.BranchPredict.*;
 import static com.oracle.graal.asm.sparc.SPARCAssembler.CC.*;
 import static com.oracle.graal.asm.sparc.SPARCAssembler.ConditionFlag.*;
 import static com.oracle.graal.asm.sparc.SPARCAssembler.RCondition.*;
-import static com.oracle.graal.compiler.common.UnsafeAccess.*;
 import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*;
 import static com.oracle.graal.sparc.SPARC.*;
 import static com.oracle.graal.sparc.SPARC.CPUFeature.*;
+import static com.oracle.jvmci.common.UnsafeAccess.*;
 
 import java.lang.reflect.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.asm.*;
 import com.oracle.graal.asm.sparc.*;
 import com.oracle.graal.asm.sparc.SPARCAssembler.CC;
--- a/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCBitManipulationOp.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCBitManipulationOp.java	Thu May 28 21:11:28 2015 -0700
@@ -22,18 +22,21 @@
  */
 package com.oracle.graal.lir.sparc;
 
-import static com.oracle.graal.api.code.ValueUtil.*;
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.meta.LIRKind;
+import com.oracle.jvmci.meta.Kind;
+import com.oracle.jvmci.meta.Value;
+import com.oracle.jvmci.meta.AllocatableValue;
+import static com.oracle.jvmci.code.ValueUtil.*;
 import static com.oracle.graal.asm.sparc.SPARCAssembler.*;
 import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*;
 import static com.oracle.graal.sparc.SPARC.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.asm.sparc.*;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.asm.*;
 import com.oracle.graal.lir.gen.*;
+import com.oracle.jvmci.common.*;
 
 public final class SPARCBitManipulationOp extends SPARCLIRInstruction {
     public static final LIRInstructionClass<SPARCBitManipulationOp> TYPE = LIRInstructionClass.create(SPARCBitManipulationOp.class);
@@ -85,7 +88,7 @@
                         masm.andn(dst, src, dst);
                         masm.popc(dst, dst);
                     } else {
-                        throw GraalInternalError.shouldNotReachHere("missing: " + tkind);
+                        throw JVMCIError.shouldNotReachHere("missing: " + tkind);
                     }
                     break;
                 case IBSR: {
@@ -130,7 +133,7 @@
                     break;
                 }
                 default:
-                    throw GraalInternalError.shouldNotReachHere();
+                    throw JVMCIError.shouldNotReachHere();
 
             }
         } else if (isConstant(input) && isSimm13(crb.asIntConst(input))) {
@@ -142,10 +145,10 @@
                     masm.popc(crb.asIntConst(input), dst);
                     break;
                 default:
-                    throw GraalInternalError.shouldNotReachHere();
+                    throw JVMCIError.shouldNotReachHere();
             }
         } else {
-            throw GraalInternalError.shouldNotReachHere();
+            throw JVMCIError.shouldNotReachHere();
         }
     }
 
--- a/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCBreakpointOp.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCBreakpointOp.java	Thu May 28 21:11:28 2015 -0700
@@ -22,9 +22,9 @@
  */
 package com.oracle.graal.lir.sparc;
 
+import com.oracle.jvmci.meta.Value;
 import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.asm.sparc.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.asm.*;
--- a/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCByteSwapOp.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCByteSwapOp.java	Thu May 28 21:11:28 2015 -0700
@@ -22,17 +22,21 @@
  */
 package com.oracle.graal.lir.sparc;
 
-import static com.oracle.graal.api.code.ValueUtil.*;
+import com.oracle.jvmci.code.ValueUtil;
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.code.StackSlotValue;
+import com.oracle.jvmci.meta.LIRKind;
+import com.oracle.jvmci.meta.Kind;
+import com.oracle.jvmci.meta.Value;
+import static com.oracle.jvmci.code.ValueUtil.*;
 import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.asm.sparc.*;
 import com.oracle.graal.asm.sparc.SPARCAssembler.Asi;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.asm.*;
 import com.oracle.graal.lir.gen.*;
+import com.oracle.jvmci.common.*;
 
 @Opcode("BSWAP")
 public final class SPARCByteSwapOp extends SPARCLIRInstruction implements SPARCTailDelayedLIRInstruction {
@@ -69,7 +73,7 @@
                 masm.ldxa(addr.getBase(), addr.getIndex(), asLongReg(result), Asi.ASI_PRIMARY_LITTLE);
                 break;
             default:
-                throw GraalInternalError.shouldNotReachHere();
+                throw JVMCIError.shouldNotReachHere();
         }
     }
 }
--- a/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCCall.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCCall.java	Thu May 28 21:11:28 2015 -0700
@@ -22,17 +22,20 @@
  */
 package com.oracle.graal.lir.sparc;
 
-import static com.oracle.graal.api.code.ValueUtil.*;
+import com.oracle.jvmci.code.ForeignCallLinkage;
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
+import com.oracle.jvmci.meta.InvokeTarget;
+import com.oracle.jvmci.meta.Value;
+import static com.oracle.jvmci.code.ValueUtil.*;
 import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*;
 import static com.oracle.graal.sparc.SPARC.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.asm.sparc.*;
 import com.oracle.graal.asm.sparc.SPARCMacroAssembler.Sethix;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.asm.*;
+import com.oracle.jvmci.common.*;
 
 public class SPARCCall {
 
@@ -96,7 +99,7 @@
                 } else if (after - before == 8) {
                     // everything is fine;
                 } else {
-                    GraalInternalError.shouldNotReachHere("" + (after - before));
+                    JVMCIError.shouldNotReachHere("" + (after - before));
                 }
                 after = masm.position();
                 crb.recordDirectCall(before, after, callTarget, state);
--- a/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCCompare.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCCompare.java	Thu May 28 21:11:28 2015 -0700
@@ -22,18 +22,20 @@
  */
 package com.oracle.graal.lir.sparc;
 
-import static com.oracle.graal.api.code.ValueUtil.*;
+import com.oracle.jvmci.meta.Kind;
+import com.oracle.jvmci.meta.Value;
+import com.oracle.jvmci.meta.JavaConstant;
+import static com.oracle.jvmci.code.ValueUtil.*;
 import static com.oracle.graal.asm.sparc.SPARCAssembler.*;
 import static com.oracle.graal.asm.sparc.SPARCAssembler.CC.*;
 import static com.oracle.graal.asm.sparc.SPARCAssembler.Opfs.*;
 import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.asm.sparc.*;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.asm.*;
 import com.oracle.graal.lir.sparc.SPARCControlFlow.CompareBranchOp;
+import com.oracle.jvmci.common.*;
 
 public enum SPARCCompare {
     ICMP,
@@ -98,7 +100,7 @@
                     masm.fcmp(Fcc0, Fcmpd, asDoubleReg(x), asDoubleReg(y));
                     break;
                 default:
-                    throw GraalInternalError.shouldNotReachHere();
+                    throw JVMCIError.shouldNotReachHere();
             }
         } else {
             assert isConstant(y);
@@ -116,7 +118,7 @@
                         masm.cmp(asObjectReg(x), 0);
                         break;
                     } else {
-                        throw GraalInternalError.shouldNotReachHere("Only null object constants are allowed in comparisons");
+                        throw JVMCIError.shouldNotReachHere("Only null object constants are allowed in comparisons");
                     }
                 case FCMP:
                     masm.fcmp(Fcc0, Fcmps, asFloatReg(x), asFloatReg(y));
@@ -125,7 +127,7 @@
                     masm.fcmp(Fcc0, Fcmpd, asDoubleReg(x), asDoubleReg(y));
                     break;
                 default:
-                    throw GraalInternalError.shouldNotReachHere();
+                    throw JVMCIError.shouldNotReachHere();
             }
         }
     }
--- a/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCControlFlow.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCControlFlow.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,11 @@
  */
 package com.oracle.graal.lir.sparc;
 
-import static com.oracle.graal.api.code.ValueUtil.*;
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.meta.Kind;
+import com.oracle.jvmci.meta.Value;
+import com.oracle.jvmci.meta.JavaConstant;
+import static com.oracle.jvmci.code.ValueUtil.*;
 import static com.oracle.graal.asm.sparc.SPARCAssembler.*;
 import static com.oracle.graal.asm.sparc.SPARCAssembler.Annul.*;
 import static com.oracle.graal.asm.sparc.SPARCAssembler.BranchPredict.*;
@@ -33,8 +37,6 @@
 
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.asm.*;
 import com.oracle.graal.asm.Assembler.LabelHint;
 import com.oracle.graal.asm.sparc.*;
@@ -43,13 +45,13 @@
 import com.oracle.graal.asm.sparc.SPARCAssembler.ConditionFlag;
 import com.oracle.graal.asm.sparc.SPARCMacroAssembler.ScratchRegister;
 import com.oracle.graal.asm.sparc.SPARCMacroAssembler.Setx;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.calc.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.StandardOp.BlockEndOp;
 import com.oracle.graal.lir.SwitchStrategy.BaseSwitchClosure;
 import com.oracle.graal.lir.asm.*;
 import com.oracle.graal.sparc.SPARC.CPUFeature;
+import com.oracle.jvmci.common.*;
 
 public class SPARCControlFlow {
 
@@ -260,7 +262,7 @@
                     }
                     break;
                 default:
-                    GraalInternalError.shouldNotReachHere();
+                    JVMCIError.shouldNotReachHere();
             }
         }
 
@@ -439,7 +441,7 @@
                             break;
                         }
                         default:
-                            throw new GraalInternalError("switch only supported for int, long and object");
+                            throw new JVMCIError("switch only supported for int, long and object");
                     }
                     ConditionFlag conditionFlag = ConditionFlag.fromCondtition(conditionCode, condition, false);
                     masm.cmp(keyRegister, scratchRegister);
@@ -600,7 +602,7 @@
                 masm.fmovdcc(cond, cc, asDoubleReg(other), asDoubleReg(result));
                 break;
             default:
-                throw GraalInternalError.shouldNotReachHere();
+                throw JVMCIError.shouldNotReachHere();
         }
     }
 }
--- a/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCFrameMap.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCFrameMap.java	Thu May 28 21:11:28 2015 -0700
@@ -22,8 +22,11 @@
  */
 package com.oracle.graal.lir.sparc;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.code.RegisterConfig;
+import com.oracle.jvmci.code.CodeCacheProvider;
+import com.oracle.jvmci.code.StackSlot;
+import com.oracle.jvmci.meta.LIRKind;
+import com.oracle.jvmci.meta.Kind;
 import com.oracle.graal.asm.*;
 import com.oracle.graal.lir.framemap.*;
 import com.oracle.graal.sparc.*;
--- a/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCFrameMapBuilder.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCFrameMapBuilder.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,9 @@
  */
 package com.oracle.graal.lir.sparc;
 
-import com.oracle.graal.api.code.*;
+import com.oracle.jvmci.code.RegisterConfig;
+import com.oracle.jvmci.code.CodeCacheProvider;
+import com.oracle.jvmci.code.StackSlot;
 import com.oracle.graal.lir.framemap.*;
 
 public class SPARCFrameMapBuilder extends FrameMapBuilderImpl {
--- a/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCJumpOp.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCJumpOp.java	Thu May 28 21:11:28 2015 -0700
@@ -24,7 +24,7 @@
 
 import static com.oracle.graal.asm.sparc.SPARCAssembler.Annul.*;
 
-import com.oracle.graal.asm.sparc.SPARCAssembler.*;
+import com.oracle.graal.asm.sparc.SPARCAssembler.ConditionFlag;
 import com.oracle.graal.asm.sparc.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.StandardOp.JumpOp;
--- a/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCMathIntrinsicOp.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCMathIntrinsicOp.java	Thu May 28 21:11:28 2015 -0700
@@ -22,13 +22,14 @@
  */
 package com.oracle.graal.lir.sparc;
 
-import static com.oracle.graal.api.code.ValueUtil.*;
+import com.oracle.jvmci.meta.Kind;
+import com.oracle.jvmci.meta.Value;
+import static com.oracle.jvmci.code.ValueUtil.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.asm.sparc.*;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.asm.*;
+import com.oracle.jvmci.common.*;
 
 public final class SPARCMathIntrinsicOp extends SPARCLIRInstruction implements SPARCTailDelayedLIRInstruction {
     public static final LIRInstructionClass<SPARCMathIntrinsicOp> TYPE = LIRInstructionClass.create(SPARCMathIntrinsicOp.class);
@@ -63,7 +64,7 @@
                         masm.fsqrtd(asDoubleReg(input), asDoubleReg(result));
                         break;
                     default:
-                        GraalInternalError.shouldNotReachHere();
+                        JVMCIError.shouldNotReachHere();
                 }
                 break;
             case ABS:
@@ -75,11 +76,11 @@
                         masm.fabsd(asDoubleReg(input), asDoubleReg(result));
                         break;
                     default:
-                        GraalInternalError.shouldNotReachHere();
+                        JVMCIError.shouldNotReachHere();
                 }
                 break;
             default:
-                throw GraalInternalError.shouldNotReachHere();
+                throw JVMCIError.shouldNotReachHere();
         }
     }
 
--- a/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCMove.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCMove.java	Thu May 28 21:11:28 2015 -0700
@@ -22,18 +22,24 @@
  */
 package com.oracle.graal.lir.sparc;
 
-import static com.oracle.graal.api.code.ValueUtil.*;
-import static com.oracle.graal.api.meta.Kind.*;
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.code.StackSlotValue;
+import com.oracle.jvmci.code.StackSlot;
+import com.oracle.jvmci.meta.LIRKind;
+import com.oracle.jvmci.meta.PlatformKind;
+import com.oracle.jvmci.meta.Kind;
+import com.oracle.jvmci.meta.Value;
+import com.oracle.jvmci.meta.AllocatableValue;
+import com.oracle.jvmci.meta.JavaConstant;
+import static com.oracle.jvmci.code.ValueUtil.*;
+import static com.oracle.jvmci.meta.Kind.*;
 import static com.oracle.graal.asm.sparc.SPARCAssembler.*;
 import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*;
 import static com.oracle.graal.sparc.SPARC.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.asm.sparc.*;
 import com.oracle.graal.asm.sparc.SPARCMacroAssembler.ScratchRegister;
 import com.oracle.graal.asm.sparc.SPARCMacroAssembler.Setx;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.StandardOp.ImplicitNullCheck;
 import com.oracle.graal.lir.StandardOp.MoveOp;
@@ -41,6 +47,7 @@
 import com.oracle.graal.lir.asm.*;
 import com.oracle.graal.sparc.*;
 import com.oracle.graal.sparc.SPARC.CPUFeature;
+import com.oracle.jvmci.common.*;
 
 public class SPARCMove {
 
@@ -160,11 +167,11 @@
                         } else if (resultKindSize == 1) {
                             masm.stb(asIntReg(input), tempAddress);
                         } else {
-                            throw GraalInternalError.shouldNotReachHere();
+                            throw JVMCIError.shouldNotReachHere();
                         }
                         break;
                     default:
-                        GraalInternalError.shouldNotReachHere();
+                        JVMCIError.shouldNotReachHere();
                 }
                 delayedControlTransfer.emitControlTransfer(crb, masm);
                 switch (resultKind) {
@@ -190,7 +197,7 @@
                         masm.lddf(tempAddress, asDoubleReg(result));
                         break;
                     default:
-                        GraalInternalError.shouldNotReachHere();
+                        JVMCIError.shouldNotReachHere();
                         break;
                 }
             }
@@ -230,7 +237,7 @@
                 if (inputKind == Int || inputKind == Short || inputKind == Char || inputKind == Byte) {
                     masm.movwtos(asIntReg(input), asFloatReg(result));
                 } else {
-                    throw GraalInternalError.shouldNotReachHere();
+                    throw JVMCIError.shouldNotReachHere();
                 }
             } else if (resultKind == Double) {
                 if (inputKind == Int || inputKind == Short || inputKind == Char || inputKind == Byte) {
@@ -248,7 +255,7 @@
                 if (resultKind == Long) {
                     masm.movdtox(asDoubleReg(input), asLongReg(result));
                 } else {
-                    throw GraalInternalError.shouldNotReachHere();
+                    throw JVMCIError.shouldNotReachHere();
                 }
             }
         }
@@ -304,7 +311,7 @@
                 case Double:
                     return StackSlot.get(LIRKind.value(Kind.Long), slot.getRawOffset(), slot.getRawAddFrameSize());
                 default:
-                    throw GraalInternalError.shouldNotReachHere();
+                    throw JVMCIError.shouldNotReachHere();
             }
         }
     }
@@ -534,7 +541,7 @@
             super(TYPE, kind, address, state);
             this.input = input;
             if (!input.isDefaultForKind()) {
-                throw GraalInternalError.shouldNotReachHere("Can only store null constants to memory");
+                throw JVMCIError.shouldNotReachHere("Can only store null constants to memory");
             }
         }
 
@@ -565,9 +572,9 @@
                         break;
                     case Float:
                     case Double:
-                        throw GraalInternalError.shouldNotReachHere("Cannot store float constants to memory");
+                        throw JVMCIError.shouldNotReachHere("Cannot store float constants to memory");
                     default:
-                        throw GraalInternalError.shouldNotReachHere();
+                        throw JVMCIError.shouldNotReachHere();
                 }
             }
         }
@@ -581,14 +588,14 @@
                 SPARCAddress resultAddress = (SPARCAddress) crb.asAddress(result);
                 emitStore(input, resultAddress, input.getPlatformKind(), delaySlotLir, null, crb, masm);
             } else {
-                throw GraalInternalError.shouldNotReachHere();
+                throw JVMCIError.shouldNotReachHere();
             }
         } else if (isStackSlot(input)) {
             if (isRegister(result)) {
                 SPARCAddress inputAddress = (SPARCAddress) crb.asAddress(input);
                 emitLoad(inputAddress, result, false, input.getPlatformKind(), delaySlotLir, null, crb, masm);
             } else {
-                throw GraalInternalError.shouldNotReachHere();
+                throw JVMCIError.shouldNotReachHere();
             }
         } else if (isConstant(input)) {
             JavaConstant constant = asConstant(input);
@@ -612,10 +619,10 @@
                     }
                 }
             } else {
-                throw GraalInternalError.shouldNotReachHere("Result is a: " + result);
+                throw JVMCIError.shouldNotReachHere("Result is a: " + result);
             }
         } else {
-            throw GraalInternalError.shouldNotReachHere();
+            throw JVMCIError.shouldNotReachHere();
         }
     }
 
@@ -640,18 +647,18 @@
                 if (result.getPlatformKind() == Kind.Float) {
                     masm.fmovs(src, dst);
                 } else {
-                    throw GraalInternalError.shouldNotReachHere();
+                    throw JVMCIError.shouldNotReachHere();
                 }
                 break;
             case Double:
                 if (result.getPlatformKind() == Kind.Double) {
                     masm.fmovd(src, dst);
                 } else {
-                    throw GraalInternalError.shouldNotReachHere();
+                    throw JVMCIError.shouldNotReachHere();
                 }
                 break;
             default:
-                throw GraalInternalError.shouldNotReachHere("Input is a: " + input.getKind());
+                throw JVMCIError.shouldNotReachHere("Input is a: " + input.getKind());
         }
     }
 
@@ -771,11 +778,11 @@
                         crb.recordInlineDataInCode(input); // relocatable cannot be delayed
                         new Setx(0xDEADDEADDEADDEADL, resultRegister, true).emit(masm);
                     } else {
-                        throw GraalInternalError.unimplemented();
+                        throw JVMCIError.unimplemented();
                     }
                     break;
                 default:
-                    throw GraalInternalError.shouldNotReachHere("missing: " + input.getKind());
+                    throw JVMCIError.shouldNotReachHere("missing: " + input.getKind());
             }
         }
     }
@@ -792,7 +799,7 @@
                 masm.casx(asRegister(address), asRegister(cmpValue), asRegister(newValue));
                 break;
             default:
-                throw GraalInternalError.shouldNotReachHere();
+                throw JVMCIError.shouldNotReachHere();
         }
     }
 
@@ -849,7 +856,7 @@
                     masm.ldx(addr, dst);
                     break;
                 default:
-                    throw GraalInternalError.shouldNotReachHere();
+                    throw JVMCIError.shouldNotReachHere();
             }
         }
     }
@@ -888,7 +895,7 @@
                     masm.stdf(asRegister(input), addr);
                     break;
                 default:
-                    throw GraalInternalError.shouldNotReachHere("missing: " + kind);
+                    throw JVMCIError.shouldNotReachHere("missing: " + kind);
             }
         }
     }
--- a/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCSaveRegistersOp.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCSaveRegistersOp.java	Thu May 28 21:11:28 2015 -0700
@@ -22,12 +22,17 @@
  */
 package com.oracle.graal.lir.sparc;
 
-import static com.oracle.graal.api.code.ValueUtil.*;
+import com.oracle.jvmci.code.ValueUtil;
+import com.oracle.jvmci.code.RegisterSaveLayout;
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.code.StackSlotValue;
+import com.oracle.jvmci.code.StackSlot;
+import com.oracle.jvmci.code.RegisterValue;
+import static com.oracle.jvmci.code.ValueUtil.*;
 import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*;
 
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
 import com.oracle.graal.asm.sparc.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.StandardOp.SaveRegistersOp;
--- a/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCTestOp.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCTestOp.java	Thu May 28 21:11:28 2015 -0700
@@ -22,15 +22,15 @@
  */
 package com.oracle.graal.lir.sparc;
 
-import static com.oracle.graal.api.code.ValueUtil.*;
+import com.oracle.jvmci.meta.Value;
+import static com.oracle.jvmci.code.ValueUtil.*;
 import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*;
 import static com.oracle.graal.sparc.SPARC.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.asm.sparc.*;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.asm.*;
+import com.oracle.jvmci.common.*;
 
 public class SPARCTestOp extends SPARCLIRInstruction {
     public static final LIRInstructionClass<SPARCTestOp> TYPE = LIRInstructionClass.create(SPARCTestOp.class);
@@ -59,7 +59,7 @@
                     masm.andcc(asLongReg(x), asLongReg(y), g0);
                     break;
                 default:
-                    throw GraalInternalError.shouldNotReachHere();
+                    throw JVMCIError.shouldNotReachHere();
             }
         } else if (isConstant(y)) {
             switch (x.getKind()) {
@@ -74,10 +74,10 @@
                     masm.andcc(asLongReg(x), crb.asIntConst(y), g0);
                     break;
                 default:
-                    throw GraalInternalError.shouldNotReachHere();
+                    throw JVMCIError.shouldNotReachHere();
             }
         } else {
-            throw GraalInternalError.shouldNotReachHere();
+            throw JVMCIError.shouldNotReachHere();
         }
     }
 
--- a/graal/com.oracle.graal.lir.test/src/com/oracle/graal/lir/test/CompositeValueReplacementTest1.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir.test/src/com/oracle/graal/lir/test/CompositeValueReplacementTest1.java	Thu May 28 21:11:28 2015 -0700
@@ -22,6 +22,9 @@
  */
 package com.oracle.graal.lir.test;
 
+import com.oracle.jvmci.meta.LIRKind;
+import com.oracle.jvmci.meta.Value;
+import com.oracle.jvmci.meta.AbstractValue;
 import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*;
 import static org.junit.Assert.*;
 
@@ -29,7 +32,6 @@
 
 import org.junit.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.lir.*;
 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/CompositeValue.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/CompositeValue.java	Thu May 28 21:11:28 2015 -0700
@@ -25,10 +25,10 @@
 import java.lang.annotation.*;
 import java.util.*;
 
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.debug.*;
 import com.oracle.graal.lir.LIRInstruction.OperandFlag;
 import com.oracle.graal.lir.LIRInstruction.OperandMode;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * Base class to represent values that need to be stored in more than one register. This is mainly
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/CompositeValueClass.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/CompositeValueClass.java	Thu May 28 21:11:28 2015 -0700
@@ -31,6 +31,7 @@
 import com.oracle.graal.lir.LIRIntrospection.LIRFieldsScanner;
 import com.oracle.graal.lir.LIRIntrospection.OperandModeAnnotation;
 import com.oracle.graal.lir.LIRIntrospection.Values;
+import com.oracle.jvmci.common.*;
 
 /**
  * Lazily associated metadata for every {@link CompositeValue} type. The metadata includes:
@@ -86,7 +87,7 @@
             if (field.isAnnotationPresent(CompositeValue.Component.class)) {
                 result.addAll(Arrays.asList(field.getAnnotation(CompositeValue.Component.class).value()));
             } else {
-                GraalInternalError.shouldNotReachHere();
+                JVMCIError.shouldNotReachHere();
             }
             return result;
         }
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/ControlFlowOptimizer.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/ControlFlowOptimizer.java	Thu May 28 21:11:28 2015 -0700
@@ -26,11 +26,11 @@
 
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
 import com.oracle.graal.compiler.common.cfg.*;
-import com.oracle.graal.debug.*;
 import com.oracle.graal.lir.gen.*;
 import com.oracle.graal.lir.phases.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.debug.*;
 
 /**
  * This class performs basic optimizations on the control flow graph after LIR generation.
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/EdgeMoveOptimizer.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/EdgeMoveOptimizer.java	Thu May 28 21:11:28 2015 -0700
@@ -24,11 +24,11 @@
 
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
 import com.oracle.graal.compiler.common.cfg.*;
 import com.oracle.graal.lir.StandardOp.MoveOp;
 import com.oracle.graal.lir.gen.*;
 import com.oracle.graal.lir.phases.*;
+import com.oracle.jvmci.code.*;
 
 /**
  * This class optimizes moves, particularly those that result from eliminating SSA form.
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/FullInfopointOp.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/FullInfopointOp.java	Thu May 28 21:11:28 2015 -0700
@@ -22,8 +22,8 @@
  */
 package com.oracle.graal.lir;
 
-import com.oracle.graal.api.code.*;
 import com.oracle.graal.lir.asm.*;
+import com.oracle.jvmci.code.*;
 
 /**
  * Emits an infopoint (only mark the position).
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/InstructionValueConsumer.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/InstructionValueConsumer.java	Thu May 28 21:11:28 2015 -0700
@@ -24,9 +24,9 @@
 
 import java.util.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.lir.LIRInstruction.OperandFlag;
 import com.oracle.graal.lir.LIRInstruction.OperandMode;
+import com.oracle.jvmci.meta.*;
 
 /**
  * Functional interface for iterating over a list of values without modifying them. See
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/InstructionValueProcedure.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/InstructionValueProcedure.java	Thu May 28 21:11:28 2015 -0700
@@ -24,9 +24,9 @@
 
 import java.util.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.lir.LIRInstruction.OperandFlag;
 import com.oracle.graal.lir.LIRInstruction.OperandMode;
+import com.oracle.jvmci.meta.*;
 
 /**
  * Functional interface for iterating over a list of values, possibly returning a value to replace
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRFrameState.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRFrameState.java	Thu May 28 21:11:28 2015 -0700
@@ -22,15 +22,15 @@
  */
 package com.oracle.graal.lir;
 
-import static com.oracle.graal.api.code.ValueUtil.*;
+import static com.oracle.jvmci.code.ValueUtil.*;
 
 import java.util.*;
 
-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;
 import com.oracle.graal.lir.framemap.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * This class represents garbage collection and deoptimization information attached to a LIR
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRInstruction.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRInstruction.java	Thu May 28 21:11:28 2015 -0700
@@ -22,16 +22,16 @@
  */
 package com.oracle.graal.lir;
 
+import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*;
+import static com.oracle.graal.lir.LIRInstruction.OperandMode.*;
+
 import java.lang.annotation.*;
 import java.util.*;
 
-import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*;
-import static com.oracle.graal.lir.LIRInstruction.OperandMode.*;
-
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.debug.*;
 import com.oracle.graal.lir.asm.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * The base class for an {@code LIRInstruction}.
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRInstructionClass.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRInstructionClass.java	Thu May 28 21:11:28 2015 -0700
@@ -25,11 +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.compiler.common.*;
 import com.oracle.graal.lir.LIRInstruction.OperandFlag;
 import com.oracle.graal.lir.LIRInstruction.OperandMode;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.meta.*;
 
 public class LIRInstructionClass<T> extends LIRIntrospection<T> {
 
@@ -121,7 +122,7 @@
             } else if (field.isAnnotationPresent(LIRInstruction.Def.class)) {
                 result.addAll(Arrays.asList(field.getAnnotation(LIRInstruction.Def.class).value()));
             } else {
-                GraalInternalError.shouldNotReachHere();
+                JVMCIError.shouldNotReachHere();
             }
             return result;
         }
@@ -197,7 +198,7 @@
             case DEF:
                 return defs;
             default:
-                throw GraalInternalError.shouldNotReachHere("unknown OperandMode: " + mode);
+                throw JVMCIError.shouldNotReachHere("unknown OperandMode: " + mode);
         }
     }
 
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRIntrospection.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRIntrospection.java	Thu May 28 21:11:28 2015 -0700
@@ -29,11 +29,11 @@
 import java.util.*;
 import java.util.Map.Entry;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.lir.LIRInstruction.OperandFlag;
 import com.oracle.graal.lir.LIRInstruction.OperandMode;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.meta.*;
 
 abstract class LIRIntrospection<T> extends FieldIntrospection<T> {
 
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRValueUtil.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRValueUtil.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,7 @@
  */
 package com.oracle.graal.lir;
 
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.meta.*;
 
 public final class LIRValueUtil {
 
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRVerifier.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRVerifier.java	Thu May 28 21:11:28 2015 -0700
@@ -22,20 +22,20 @@
  */
 package com.oracle.graal.lir;
 
-import static com.oracle.graal.api.code.ValueUtil.*;
 import static com.oracle.graal.lir.LIRValueUtil.*;
+import static com.oracle.jvmci.code.ValueUtil.*;
 
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.cfg.*;
-import com.oracle.graal.debug.*;
 import com.oracle.graal.lir.LIRInstruction.OperandFlag;
 import com.oracle.graal.lir.LIRInstruction.OperandMode;
 import com.oracle.graal.lir.framemap.*;
 import com.oracle.graal.lir.ssa.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.meta.*;
 
 public final class LIRVerifier {
 
@@ -169,7 +169,7 @@
                     TTY.println("definition of %s: %s", value, variableDefinitions[variableIdx]);
                 }
                 TTY.println("ERROR: Use of variable %s that is not defined in dominator", value);
-                throw GraalInternalError.shouldNotReachHere();
+                throw JVMCIError.shouldNotReachHere();
             }
 
         } else if (isAllocatableRegister(value)) {
@@ -182,7 +182,7 @@
                 TTY.println("block %s  instruction %s", curBlock, curInstruction);
                 TTY.println("live registers: %s", Arrays.toString(curRegistersLive));
                 TTY.println("ERROR: Use of fixed register %s that is not defined in this block", value);
-                throw GraalInternalError.shouldNotReachHere();
+                throw JVMCIError.shouldNotReachHere();
             }
         }
     }
@@ -199,7 +199,7 @@
                 TTY.println("live variables: %s", curVariablesLive);
                 TTY.println("definition of %s: %s", value, variableDefinitions[variableIdx]);
                 TTY.println("ERROR: Variable %s defined multiple times", value);
-                throw GraalInternalError.shouldNotReachHere();
+                throw JVMCIError.shouldNotReachHere();
             }
             assert curInstruction != null;
             variableDefinitions[variableIdx] = curInstruction;
@@ -213,7 +213,7 @@
             if (curRegistersDefined.get(regNum)) {
                 TTY.println("block %s  instruction %s", curBlock, curInstruction);
                 TTY.println("ERROR: Same register defined twice in the same instruction: %s", value);
-                throw GraalInternalError.shouldNotReachHere();
+                throw JVMCIError.shouldNotReachHere();
             }
             curRegistersDefined.set(regNum);
 
@@ -236,7 +236,7 @@
             (isIllegal(value) && flags.contains(OperandFlag.ILLEGAL))) {
             return;
         }
-        throw new GraalInternalError("Invalid LIR%n  Instruction: %s%n  Mode: %s%n  Flags: %s%n  Unexpected value: %s %s",
+        throw new JVMCIError("Invalid LIR%n  Instruction: %s%n  Mode: %s%n  Flags: %s%n  Unexpected value: %s %s",
                         op, mode, flags, value.getClass().getSimpleName(), value);
     }
     // @formatter:on
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/NullCheckOptimizer.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/NullCheckOptimizer.java	Thu May 28 21:11:28 2015 -0700
@@ -24,12 +24,12 @@
 
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
 import com.oracle.graal.compiler.common.cfg.*;
 import com.oracle.graal.lir.StandardOp.ImplicitNullCheck;
 import com.oracle.graal.lir.StandardOp.NullCheck;
 import com.oracle.graal.lir.gen.*;
 import com.oracle.graal.lir.phases.*;
+import com.oracle.jvmci.code.*;
 
 public final class NullCheckOptimizer extends PostAllocationOptimizationPhase {
 
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/RedundantMoveElimination.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/RedundantMoveElimination.java	Thu May 28 21:11:28 2015 -0700
@@ -22,21 +22,21 @@
  */
 package com.oracle.graal.lir;
 
-import static com.oracle.graal.api.code.ValueUtil.*;
+import static com.oracle.jvmci.code.ValueUtil.*;
 
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.cfg.*;
-import com.oracle.graal.debug.*;
 import com.oracle.graal.lir.LIRInstruction.OperandFlag;
 import com.oracle.graal.lir.LIRInstruction.OperandMode;
 import com.oracle.graal.lir.StandardOp.MoveOp;
 import com.oracle.graal.lir.framemap.*;
 import com.oracle.graal.lir.gen.*;
 import com.oracle.graal.lir.phases.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * Removes move instructions, where the destination value is already in place.
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/SimpleInfopointOp.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/SimpleInfopointOp.java	Thu May 28 21:11:28 2015 -0700
@@ -22,8 +22,8 @@
  */
 package com.oracle.graal.lir;
 
-import com.oracle.graal.api.code.*;
 import com.oracle.graal.lir.asm.*;
+import com.oracle.jvmci.code.*;
 
 @Opcode("SIMPLE_INFOPOINT")
 public final class SimpleInfopointOp extends LIRInstruction {
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/StandardOp.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/StandardOp.java	Thu May 28 21:11:28 2015 -0700
@@ -27,13 +27,13 @@
 
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.asm.*;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.cfg.*;
 import com.oracle.graal.lir.asm.*;
 import com.oracle.graal.lir.framemap.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * A collection of machine-independent LIR operations, as well as interfaces to be implemented for
@@ -258,7 +258,7 @@
         @Override
         public void emitCode(CompilationResultBuilder crb) {
             if (block != null) {
-                throw new GraalInternalError(this + " should have been replaced");
+                throw new JVMCIError(this + " should have been replaced");
             }
         }
     }
@@ -294,7 +294,7 @@
 
         @Override
         public void emitCode(CompilationResultBuilder crb) {
-            throw new GraalInternalError(this + " should have been removed");
+            throw new JVMCIError(this + " should have been removed");
         }
 
         @Override
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/SwitchStrategy.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/SwitchStrategy.java	Thu May 28 21:11:28 2015 -0700
@@ -24,10 +24,10 @@
 
 import java.util.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.asm.*;
 import com.oracle.graal.compiler.common.calc.*;
 import com.oracle.graal.lir.asm.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * This class encapsulates different strategies on how to generate code for switch instructions.
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/ValueConsumer.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/ValueConsumer.java	Thu May 28 21:11:28 2015 -0700
@@ -24,9 +24,9 @@
 
 import java.util.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.lir.LIRInstruction.OperandFlag;
 import com.oracle.graal.lir.LIRInstruction.OperandMode;
+import com.oracle.jvmci.meta.*;
 
 /**
  * Non-modifying version of {@link ValueProcedure}.
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/ValueProcedure.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/ValueProcedure.java	Thu May 28 21:11:28 2015 -0700
@@ -24,9 +24,9 @@
 
 import java.util.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.lir.LIRInstruction.OperandFlag;
 import com.oracle.graal.lir.LIRInstruction.OperandMode;
+import com.oracle.jvmci.meta.*;
 
 /**
  * Similar to {@link InstructionValueProcedure} but without an {@link LIRInstruction} parameter.
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/Variable.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/Variable.java	Thu May 28 21:11:28 2015 -0700
@@ -22,8 +22,8 @@
  */
 package com.oracle.graal.lir;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * Represents a value that is yet to be bound to a machine location (such as a {@link RegisterValue}
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/Interval.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/Interval.java	Thu May 28 21:11:28 2015 -0700
@@ -22,18 +22,18 @@
  */
 package com.oracle.graal.lir.alloc.lsra;
 
-import static com.oracle.graal.api.code.ValueUtil.*;
 import static com.oracle.graal.compiler.common.GraalOptions.*;
 import static com.oracle.graal.lir.LIRValueUtil.*;
+import static com.oracle.jvmci.code.ValueUtil.*;
 
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.util.*;
-import com.oracle.graal.debug.*;
 import com.oracle.graal.lir.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * Represents an interval in the {@linkplain LinearScan linear scan register allocator}.
@@ -95,7 +95,7 @@
                 case Stack:
                     return stack;
             }
-            throw GraalInternalError.shouldNotReachHere();
+            throw JVMCIError.shouldNotReachHere();
         }
 
         /**
@@ -873,7 +873,7 @@
                 Interval lastChild = splitChildren.get(splitChildren.size() - 1);
                 msg.append(" (first = ").append(firstChild).append(", last = ").append(lastChild).append(")");
             }
-            throw new GraalInternalError("Linear Scan Error: %s", msg);
+            throw new JVMCIError("Linear Scan Error: %s", msg);
         }
 
         if (!splitChildren.isEmpty()) {
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/IntervalWalker.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/IntervalWalker.java	Thu May 28 21:11:28 2015 -0700
@@ -22,8 +22,10 @@
  */
 package com.oracle.graal.lir.alloc.lsra;
 
-import com.oracle.graal.debug.*;
-import com.oracle.graal.lir.alloc.lsra.Interval.*;
+import com.oracle.graal.lir.alloc.lsra.Interval.RegisterBinding;
+import com.oracle.graal.lir.alloc.lsra.Interval.RegisterBindingLists;
+import com.oracle.graal.lir.alloc.lsra.Interval.State;
+import com.oracle.jvmci.debug.*;
 
 /**
  */
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LinearScan.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LinearScan.java	Thu May 28 21:11:28 2015 -0700
@@ -22,20 +22,15 @@
  */
 package com.oracle.graal.lir.alloc.lsra;
 
-import static com.oracle.graal.api.code.CodeUtil.*;
-import static com.oracle.graal.api.code.ValueUtil.*;
 import static com.oracle.graal.compiler.common.GraalOptions.*;
 import static com.oracle.graal.lir.LIRValueUtil.*;
+import static com.oracle.jvmci.code.CodeUtil.*;
+import static com.oracle.jvmci.code.ValueUtil.*;
 
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.alloc.*;
 import com.oracle.graal.compiler.common.cfg.*;
-import com.oracle.graal.debug.*;
-import com.oracle.graal.debug.Debug.Scope;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.LIRInstruction.OperandFlag;
 import com.oracle.graal.lir.LIRInstruction.OperandMode;
@@ -44,7 +39,12 @@
 import com.oracle.graal.lir.gen.*;
 import com.oracle.graal.lir.gen.LIRGeneratorTool.SpillMoveFactory;
 import com.oracle.graal.lir.phases.AllocationPhase.AllocationContext;
-import com.oracle.graal.options.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.debug.Debug.Scope;
+import com.oracle.jvmci.meta.*;
+import com.oracle.jvmci.options.*;
 
 /**
  * An implementation of the linear scan register allocator algorithm described in <a
@@ -745,32 +745,32 @@
                 if (i1.operandNumber != i) {
                     Debug.log("Interval %d is on position %d in list", i1.operandNumber, i);
                     Debug.log(i1.logString(this));
-                    throw new GraalInternalError("");
+                    throw new JVMCIError("");
                 }
 
                 if (isVariable(i1.operand) && i1.kind().equals(LIRKind.Illegal)) {
                     Debug.log("Interval %d has no type assigned", i1.operandNumber);
                     Debug.log(i1.logString(this));
-                    throw new GraalInternalError("");
+                    throw new JVMCIError("");
                 }
 
                 if (i1.location() == null) {
                     Debug.log("Interval %d has no register assigned", i1.operandNumber);
                     Debug.log(i1.logString(this));
-                    throw new GraalInternalError("");
+                    throw new JVMCIError("");
                 }
 
                 if (i1.first() == Range.EndMarker) {
                     Debug.log("Interval %d has no Range", i1.operandNumber);
                     Debug.log(i1.logString(this));
-                    throw new GraalInternalError("");
+                    throw new JVMCIError("");
                 }
 
                 for (Range r = i1.first(); r != Range.EndMarker; r = r.next) {
                     if (r.from >= r.to) {
                         Debug.log("Interval %d has zero length range", i1.operandNumber);
                         Debug.log(i1.logString(this));
-                        throw new GraalInternalError("");
+                        throw new JVMCIError("");
                     }
                 }
 
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LinearScanAssignLocationsPhase.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LinearScanAssignLocationsPhase.java	Thu May 28 21:11:28 2015 -0700
@@ -22,23 +22,24 @@
  */
 package com.oracle.graal.lir.alloc.lsra;
 
-import static com.oracle.graal.api.code.ValueUtil.*;
 import static com.oracle.graal.compiler.common.GraalOptions.*;
 import static com.oracle.graal.lir.LIRValueUtil.*;
+import static com.oracle.jvmci.code.ValueUtil.*;
 
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.alloc.*;
 import com.oracle.graal.compiler.common.cfg.*;
-import com.oracle.graal.debug.*;
 import com.oracle.graal.lir.*;
-import com.oracle.graal.lir.LIRInstruction.*;
-import com.oracle.graal.lir.StandardOp.*;
+import com.oracle.graal.lir.LIRInstruction.OperandFlag;
+import com.oracle.graal.lir.LIRInstruction.OperandMode;
+import com.oracle.graal.lir.StandardOp.MoveOp;
 import com.oracle.graal.lir.gen.*;
-import com.oracle.graal.lir.gen.LIRGeneratorTool.*;
+import com.oracle.graal.lir.gen.LIRGeneratorTool.SpillMoveFactory;
 import com.oracle.graal.lir.phases.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * Phase 7: Assign register numbers back to LIR.
@@ -123,7 +124,7 @@
              * is a branch, spill moves are inserted before this branch and so the wrong operand
              * would be returned (spill moves at block boundaries are not considered in the live
              * ranges of intervals).
-             * 
+             *
              * Solution: use the first opId of the branch target block instead.
              */
             final LIRInstruction instr = allocator.ir.getLIRforBlock(block).get(allocator.ir.getLIRforBlock(block).size() - 1);
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LinearScanEliminateSpillMovePhase.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LinearScanEliminateSpillMovePhase.java	Thu May 28 21:11:28 2015 -0700
@@ -22,24 +22,24 @@
  */
 package com.oracle.graal.lir.alloc.lsra;
 
-import static com.oracle.graal.api.code.ValueUtil.*;
 import static com.oracle.graal.compiler.common.GraalOptions.*;
 import static com.oracle.graal.lir.LIRValueUtil.*;
+import static com.oracle.jvmci.code.ValueUtil.*;
 
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.alloc.*;
 import com.oracle.graal.compiler.common.cfg.*;
-import com.oracle.graal.debug.*;
 import com.oracle.graal.lir.*;
-import com.oracle.graal.lir.StandardOp.*;
-import com.oracle.graal.lir.alloc.lsra.Interval.*;
-import com.oracle.graal.lir.alloc.lsra.LinearScan.*;
+import com.oracle.graal.lir.StandardOp.MoveOp;
+import com.oracle.graal.lir.alloc.lsra.Interval.SpillState;
+import com.oracle.graal.lir.alloc.lsra.LinearScan.IntervalPredicate;
 import com.oracle.graal.lir.gen.*;
-import com.oracle.graal.lir.gen.LIRGeneratorTool.*;
+import com.oracle.graal.lir.gen.LIRGeneratorTool.SpillMoveFactory;
 import com.oracle.graal.lir.phases.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.meta.*;
 
 class LinearScanEliminateSpillMovePhase extends AllocationPhase {
 
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LinearScanLifetimeAnalysisPhase.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LinearScanLifetimeAnalysisPhase.java	Thu May 28 21:11:28 2015 -0700
@@ -22,21 +22,25 @@
  */
 package com.oracle.graal.lir.alloc.lsra;
 
-import static com.oracle.graal.api.code.ValueUtil.*;
+import com.oracle.jvmci.code.StackSlot;
+import com.oracle.jvmci.code.TargetDescription;
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.code.BailoutException;
+import com.oracle.jvmci.meta.JavaConstant;
+import com.oracle.jvmci.meta.Kind;
+import com.oracle.jvmci.meta.Value;
+import com.oracle.jvmci.meta.LIRKind;
+import com.oracle.jvmci.meta.AllocatableValue;
+import static com.oracle.jvmci.code.ValueUtil.*;
 import static com.oracle.graal.compiler.common.GraalOptions.*;
 import static com.oracle.graal.lir.LIRValueUtil.*;
 import static com.oracle.graal.lir.debug.LIRGenerationDebugContext.*;
 
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.alloc.*;
 import com.oracle.graal.compiler.common.cfg.*;
 import com.oracle.graal.compiler.common.util.*;
-import com.oracle.graal.debug.*;
-import com.oracle.graal.debug.Debug.Scope;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.LIRInstruction.OperandFlag;
 import com.oracle.graal.lir.LIRInstruction.OperandMode;
@@ -48,6 +52,9 @@
 import com.oracle.graal.lir.gen.*;
 import com.oracle.graal.lir.gen.LIRGeneratorTool.SpillMoveFactory;
 import com.oracle.graal.lir.phases.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.debug.Debug.Scope;
 
 class LinearScanLifetimeAnalysisPhase extends AllocationPhase {
 
@@ -346,7 +353,7 @@
                     reportFailure(numBlocks);
                 }
                 // bailout if this occurs in product mode.
-                throw new GraalInternalError("liveIn set of first block must be empty: " + allocator.getBlockData(startBlock).liveIn);
+                throw new JVMCIError("liveIn set of first block must be empty: " + allocator.getBlockData(startBlock).liveIn);
             }
         }
     }
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LinearScanOptimizeSpillPositionPhase.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LinearScanOptimizeSpillPositionPhase.java	Thu May 28 21:11:28 2015 -0700
@@ -22,22 +22,22 @@
  */
 package com.oracle.graal.lir.alloc.lsra;
 
-import static com.oracle.graal.api.code.ValueUtil.*;
 import static com.oracle.graal.compiler.common.cfg.AbstractControlFlowGraph.*;
+import static com.oracle.jvmci.code.ValueUtil.*;
 
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.alloc.*;
 import com.oracle.graal.compiler.common.cfg.*;
-import com.oracle.graal.debug.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.LIRInstruction.OperandMode;
 import com.oracle.graal.lir.alloc.lsra.Interval.SpillState;
 import com.oracle.graal.lir.gen.*;
 import com.oracle.graal.lir.gen.LIRGeneratorTool.SpillMoveFactory;
 import com.oracle.graal.lir.phases.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.meta.*;
 
 final class LinearScanOptimizeSpillPositionPhase extends AllocationPhase {
 
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LinearScanPhase.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LinearScanPhase.java	Thu May 28 21:11:28 2015 -0700
@@ -22,19 +22,19 @@
  */
 package com.oracle.graal.lir.alloc.lsra;
 
+import com.oracle.jvmci.code.TargetDescription;
 import static com.oracle.graal.compiler.common.GraalOptions.*;
 
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
 import com.oracle.graal.compiler.common.alloc.*;
 import com.oracle.graal.compiler.common.cfg.*;
 import com.oracle.graal.lir.gen.*;
 import com.oracle.graal.lir.gen.LIRGeneratorTool.SpillMoveFactory;
 import com.oracle.graal.lir.phases.*;
 import com.oracle.graal.lir.ssa.*;
-import com.oracle.graal.options.*;
-import com.oracle.graal.options.DerivedOptionValue.OptionSupplier;
+import com.oracle.jvmci.options.*;
+import com.oracle.jvmci.options.DerivedOptionValue.OptionSupplier;
 
 public final class LinearScanPhase extends AllocationPhase {
 
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LinearScanRegisterAllocationPhase.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LinearScanRegisterAllocationPhase.java	Thu May 28 21:11:28 2015 -0700
@@ -24,13 +24,13 @@
 
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
 import com.oracle.graal.compiler.common.alloc.*;
 import com.oracle.graal.compiler.common.cfg.*;
-import com.oracle.graal.debug.*;
 import com.oracle.graal.lir.gen.*;
-import com.oracle.graal.lir.gen.LIRGeneratorTool.*;
+import com.oracle.graal.lir.gen.LIRGeneratorTool.SpillMoveFactory;
 import com.oracle.graal.lir.phases.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.debug.*;
 
 final class LinearScanRegisterAllocationPhase extends AllocationPhase {
 
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LinearScanResolveDataFlowPhase.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LinearScanResolveDataFlowPhase.java	Thu May 28 21:11:28 2015 -0700
@@ -26,14 +26,14 @@
 
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
 import com.oracle.graal.compiler.common.alloc.*;
 import com.oracle.graal.compiler.common.cfg.*;
-import com.oracle.graal.debug.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.gen.*;
 import com.oracle.graal.lir.gen.LIRGeneratorTool.SpillMoveFactory;
 import com.oracle.graal.lir.phases.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.debug.*;
 
 /**
  * Phase 6: resolve data flow
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LinearScanWalker.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LinearScanWalker.java	Thu May 28 21:11:28 2015 -0700
@@ -22,21 +22,24 @@
  */
 package com.oracle.graal.lir.alloc.lsra;
 
-import static com.oracle.graal.api.code.CodeUtil.*;
-import static com.oracle.graal.api.code.ValueUtil.*;
 import static com.oracle.graal.lir.LIRValueUtil.*;
+import static com.oracle.jvmci.code.CodeUtil.*;
+import static com.oracle.jvmci.code.ValueUtil.*;
 
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.common.alloc.RegisterAllocationConfig.*;
+import com.oracle.graal.compiler.common.alloc.RegisterAllocationConfig.AllocatableRegisters;
 import com.oracle.graal.compiler.common.cfg.*;
 import com.oracle.graal.compiler.common.util.*;
-import com.oracle.graal.debug.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.StandardOp.MoveOp;
-import com.oracle.graal.lir.alloc.lsra.Interval.*;
+import com.oracle.graal.lir.alloc.lsra.Interval.RegisterBinding;
+import com.oracle.graal.lir.alloc.lsra.Interval.RegisterPriority;
+import com.oracle.graal.lir.alloc.lsra.Interval.SpillState;
+import com.oracle.graal.lir.alloc.lsra.Interval.State;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  */
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LocationMarker.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/LocationMarker.java	Thu May 28 21:11:28 2015 -0700
@@ -22,15 +22,12 @@
  */
 package com.oracle.graal.lir.alloc.lsra;
 
-import static com.oracle.graal.api.code.ValueUtil.*;
+import static com.oracle.jvmci.code.ValueUtil.*;
 
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.alloc.*;
 import com.oracle.graal.compiler.common.cfg.*;
-import com.oracle.graal.debug.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.LIRInstruction.OperandFlag;
 import com.oracle.graal.lir.LIRInstruction.OperandMode;
@@ -38,7 +35,10 @@
 import com.oracle.graal.lir.gen.*;
 import com.oracle.graal.lir.gen.LIRGeneratorTool.SpillMoveFactory;
 import com.oracle.graal.lir.phases.*;
-import com.oracle.graal.options.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.meta.*;
+import com.oracle.jvmci.options.*;
 
 /**
  * Mark all live references for a frame state. The frame state use this information to build the OOP
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/MoveResolver.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/MoveResolver.java	Thu May 28 21:11:28 2015 -0700
@@ -22,16 +22,18 @@
  */
 package com.oracle.graal.lir.alloc.lsra;
 
-import static com.oracle.graal.api.code.ValueUtil.*;
+import com.oracle.jvmci.code.StackSlotValue;
+import com.oracle.jvmci.meta.Value;
+import com.oracle.jvmci.meta.LIRKind;
+import com.oracle.jvmci.meta.AllocatableValue;
+import static com.oracle.jvmci.code.ValueUtil.*;
 import static java.lang.String.*;
 
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.common.*;
-import com.oracle.graal.debug.*;
 import com.oracle.graal.lir.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.debug.*;
 
 /**
  */
@@ -53,7 +55,7 @@
         if (isRegister(location)) {
             registerBlocked[asRegister(location).number] += direction;
         } else {
-            throw GraalInternalError.shouldNotReachHere("unhandled value " + location);
+            throw JVMCIError.shouldNotReachHere("unhandled value " + location);
         }
     }
 
@@ -61,7 +63,7 @@
         if (isRegister(location)) {
             return registerBlocked[asRegister(location).number];
         }
-        throw GraalInternalError.shouldNotReachHere("unhandled value " + location);
+        throw JVMCIError.shouldNotReachHere("unhandled value " + location);
     }
 
     void setMultipleReadsAllowed() {
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/OptimizingLinearScanWalker.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/OptimizingLinearScanWalker.java	Thu May 28 21:11:28 2015 -0700
@@ -22,15 +22,16 @@
  */
 package com.oracle.graal.lir.alloc.lsra;
 
-import static com.oracle.graal.api.code.ValueUtil.*;
-
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.meta.AllocatableValue;
+import static com.oracle.jvmci.code.ValueUtil.*;
 import com.oracle.graal.compiler.common.cfg.*;
-import com.oracle.graal.debug.*;
-import com.oracle.graal.debug.Debug.Scope;
-import com.oracle.graal.lir.alloc.lsra.Interval.*;
-import com.oracle.graal.options.*;
+import com.oracle.graal.lir.alloc.lsra.Interval.RegisterBinding;
+import com.oracle.graal.lir.alloc.lsra.Interval.RegisterBindingLists;
+import com.oracle.graal.lir.alloc.lsra.Interval.State;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.debug.Debug.Scope;
+import com.oracle.jvmci.options.*;
 
 public class OptimizingLinearScanWalker extends LinearScanWalker {
 
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/OutOfRegistersException.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/OutOfRegistersException.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,7 @@
  */
 package com.oracle.graal.lir.alloc.lsra;
 
-import com.oracle.graal.api.code.*;
+import com.oracle.jvmci.code.BailoutException;
 
 public class OutOfRegistersException extends BailoutException {
 
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/RegisterVerifier.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/RegisterVerifier.java	Thu May 28 21:11:28 2015 -0700
@@ -22,19 +22,19 @@
  */
 package com.oracle.graal.lir.alloc.lsra;
 
-import static com.oracle.graal.api.code.ValueUtil.*;
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.meta.Value;
+import static com.oracle.jvmci.code.ValueUtil.*;
 
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.cfg.*;
 import com.oracle.graal.compiler.common.util.*;
-import com.oracle.graal.debug.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.LIRInstruction.OperandFlag;
 import com.oracle.graal.lir.LIRInstruction.OperandMode;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.debug.*;
 
 /**
  */
@@ -179,7 +179,7 @@
     static boolean checkState(Interval[] inputState, Value reg, Interval interval) {
         if (reg != null && isRegister(reg)) {
             if (inputState[asRegister(reg).number] != interval) {
-                throw new GraalInternalError("!! Error in register allocation: register %s does not contain interval %s but interval %s", reg, interval.operand, inputState[asRegister(reg).number]);
+                throw new JVMCIError("!! Error in register allocation: register %s does not contain interval %s but interval %s", reg, interval.operand, inputState[asRegister(reg).number]);
             }
         }
         return true;
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/SSALinarScanResolveDataFlowPhase.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/SSALinarScanResolveDataFlowPhase.java	Thu May 28 21:11:28 2015 -0700
@@ -22,16 +22,16 @@
  */
 package com.oracle.graal.lir.alloc.lsra;
 
-import static com.oracle.graal.api.code.ValueUtil.*;
+import com.oracle.jvmci.meta.Value;
+import static com.oracle.jvmci.code.ValueUtil.*;
 
 import java.util.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.cfg.*;
-import com.oracle.graal.debug.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.ssa.*;
 import com.oracle.graal.lir.ssa.SSAUtils.PhiValueVisitor;
+import com.oracle.jvmci.debug.*;
 
 class SSALinarScanResolveDataFlowPhase extends LinearScanResolveDataFlowPhase {
 
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/SSALinearScan.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/SSALinearScan.java	Thu May 28 21:11:28 2015 -0700
@@ -22,14 +22,14 @@
  */
 package com.oracle.graal.lir.alloc.lsra;
 
-import com.oracle.graal.api.code.*;
+import com.oracle.jvmci.code.TargetDescription;
 import com.oracle.graal.compiler.common.alloc.*;
 import com.oracle.graal.compiler.common.cfg.*;
-import com.oracle.graal.debug.*;
-import com.oracle.graal.debug.Debug.Scope;
 import com.oracle.graal.lir.gen.*;
 import com.oracle.graal.lir.gen.LIRGeneratorTool.SpillMoveFactory;
 import com.oracle.graal.lir.ssa.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.debug.Debug.Scope;
 
 final class SSALinearScan extends LinearScan {
 
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/SSALinearScanEliminateSpillMovePhase.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/SSALinearScanEliminateSpillMovePhase.java	Thu May 28 21:11:28 2015 -0700
@@ -22,14 +22,14 @@
  */
 package com.oracle.graal.lir.alloc.lsra;
 
-import static com.oracle.graal.api.code.ValueUtil.*;
+import static com.oracle.jvmci.code.ValueUtil.*;
 import static com.oracle.graal.lir.LIRValueUtil.*;
 
 import com.oracle.graal.compiler.common.cfg.*;
-import com.oracle.graal.debug.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.StandardOp.LabelOp;
 import com.oracle.graal.lir.StandardOp.MoveOp;
+import com.oracle.jvmci.debug.*;
 
 public class SSALinearScanEliminateSpillMovePhase extends LinearScanEliminateSpillMovePhase {
 
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/SSALinearScanLifetimeAnalysisPhase.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/SSALinearScanLifetimeAnalysisPhase.java	Thu May 28 21:11:28 2015 -0700
@@ -22,14 +22,16 @@
  */
 package com.oracle.graal.lir.alloc.lsra;
 
+import com.oracle.jvmci.meta.Value;
+import com.oracle.jvmci.meta.AllocatableValue;
 import java.util.*;
 
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.debug.*;
 import com.oracle.graal.lir.*;
-import com.oracle.graal.lir.LIRInstruction.*;
-import com.oracle.graal.lir.StandardOp.*;
+import com.oracle.graal.lir.LIRInstruction.OperandFlag;
+import com.oracle.graal.lir.LIRInstruction.OperandMode;
+import com.oracle.graal.lir.StandardOp.LabelOp;
 import com.oracle.graal.lir.ssa.*;
+import com.oracle.jvmci.debug.*;
 
 public class SSALinearScanLifetimeAnalysisPhase extends LinearScanLifetimeAnalysisPhase {
 
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/SSAMoveResolver.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/alloc/lsra/SSAMoveResolver.java	Thu May 28 21:11:28 2015 -0700
@@ -22,11 +22,12 @@
  */
 package com.oracle.graal.lir.alloc.lsra;
 
-import static com.oracle.graal.api.code.ValueUtil.*;
+import com.oracle.jvmci.meta.Value;
+import com.oracle.jvmci.meta.AllocatableValue;
+import static com.oracle.jvmci.code.ValueUtil.*;
 
 import java.util.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.framemap.*;
 
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/asm/CompilationResultBuilder.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/asm/CompilationResultBuilder.java	Thu May 28 21:11:28 2015 -0700
@@ -22,23 +22,35 @@
  */
 package com.oracle.graal.lir.asm;
 
-import static com.oracle.graal.api.code.ValueUtil.*;
+import com.oracle.jvmci.code.CompilationResult;
+import com.oracle.jvmci.code.StackSlot;
+import com.oracle.jvmci.code.TargetDescription;
+import com.oracle.jvmci.code.DebugInfo;
+import com.oracle.jvmci.code.CodeCacheProvider;
+import com.oracle.jvmci.code.AbstractAddress;
+import com.oracle.jvmci.code.InfopointReason;
+import com.oracle.jvmci.code.ForeignCallsProvider;
+import com.oracle.jvmci.meta.VMConstant;
+import com.oracle.jvmci.meta.Constant;
+import com.oracle.jvmci.meta.Kind;
+import com.oracle.jvmci.meta.JavaConstant;
+import com.oracle.jvmci.meta.Value;
+import com.oracle.jvmci.meta.InvokeTarget;
+import static com.oracle.jvmci.code.ValueUtil.*;
 
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.code.CompilationResult.ConstantReference;
-import com.oracle.graal.api.code.CompilationResult.DataSectionReference;
-import com.oracle.graal.api.code.DataSection.Data;
-import com.oracle.graal.api.code.DataSection.DataBuilder;
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.code.CompilationResult.ConstantReference;
+import com.oracle.jvmci.code.CompilationResult.DataSectionReference;
+import com.oracle.jvmci.code.DataSection.Data;
+import com.oracle.jvmci.code.DataSection.DataBuilder;
 import com.oracle.graal.asm.*;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.cfg.*;
-import com.oracle.graal.debug.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.framemap.*;
-import com.oracle.graal.options.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.options.*;
 
 /**
  * Fills in a {@link CompilationResult} as its code is being assembled.
@@ -214,7 +226,7 @@
         assert !codeCache.needsDataPatch(constant) : constant + " should be in a DataPatch";
         long c = constant.asLong();
         if (!NumUtil.isInt(c)) {
-            throw GraalInternalError.shouldNotReachHere();
+            throw JVMCIError.shouldNotReachHere();
         }
         return (int) c;
     }
@@ -370,7 +382,7 @@
 
             try {
                 emitOp(this, op);
-            } catch (GraalInternalError e) {
+            } catch (JVMCIError e) {
                 throw e.addContext("lir instruction", block + "@" + op.id() + " " + op + "\n" + lir.codeEmittingOrder());
             }
         }
@@ -380,9 +392,9 @@
         try {
             op.emitCode(crb);
         } catch (AssertionError t) {
-            throw new GraalInternalError(t);
+            throw new JVMCIError(t);
         } catch (RuntimeException t) {
-            throw new GraalInternalError(t);
+            throw new JVMCIError(t);
         }
     }
 
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/asm/CompilationResultBuilderFactory.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/asm/CompilationResultBuilderFactory.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,9 @@
  */
 package com.oracle.graal.lir.asm;
 
-import com.oracle.graal.api.code.*;
+import com.oracle.jvmci.code.CompilationResult;
+import com.oracle.jvmci.code.CodeCacheProvider;
+import com.oracle.jvmci.code.ForeignCallsProvider;
 import com.oracle.graal.asm.*;
 import com.oracle.graal.lir.framemap.*;
 
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/constopt/ConstantLoadOptimization.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/constopt/ConstantLoadOptimization.java	Thu May 28 21:11:28 2015 -0700
@@ -22,17 +22,17 @@
  */
 package com.oracle.graal.lir.constopt;
 
-import static com.oracle.graal.api.code.ValueUtil.*;
+import com.oracle.jvmci.code.TargetDescription;
+import com.oracle.jvmci.meta.JavaConstant;
+import com.oracle.jvmci.meta.Value;
+import com.oracle.jvmci.meta.LIRKind;
+import static com.oracle.jvmci.code.ValueUtil.*;
 import static com.oracle.graal.lir.LIRValueUtil.*;
 import static com.oracle.graal.lir.phases.LIRPhase.Options.*;
 
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.cfg.*;
-import com.oracle.graal.debug.*;
-import com.oracle.graal.debug.Debug.Scope;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.LIRInstruction.OperandFlag;
 import com.oracle.graal.lir.LIRInstruction.OperandMode;
@@ -41,7 +41,9 @@
 import com.oracle.graal.lir.constopt.ConstantTree.NodeCost;
 import com.oracle.graal.lir.gen.*;
 import com.oracle.graal.lir.phases.*;
-import com.oracle.graal.options.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.debug.Debug.Scope;
+import com.oracle.jvmci.options.*;
 
 /**
  * This optimization tries to improve the handling of constants by replacing a single definition of
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/constopt/ConstantTreeAnalyzer.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/constopt/ConstantTreeAnalyzer.java	Thu May 28 21:11:28 2015 -0700
@@ -25,10 +25,10 @@
 import java.util.*;
 
 import com.oracle.graal.compiler.common.cfg.*;
-import com.oracle.graal.debug.*;
-import com.oracle.graal.debug.Debug.Scope;
 import com.oracle.graal.lir.constopt.ConstantTree.Flags;
 import com.oracle.graal.lir.constopt.ConstantTree.NodeCost;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.debug.Debug.Scope;
 
 /**
  * Analyzes a {@link ConstantTree} and marks potential materialization positions.
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/constopt/DefUseTree.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/constopt/DefUseTree.java	Thu May 28 21:11:28 2015 -0700
@@ -22,10 +22,11 @@
  */
 package com.oracle.graal.lir.constopt;
 
+import com.oracle.jvmci.meta.Value;
+import com.oracle.jvmci.meta.JavaConstant;
 import java.util.*;
 import java.util.function.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.cfg.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.StandardOp.MoveOp;
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/constopt/UseEntry.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/constopt/UseEntry.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,7 @@
  */
 package com.oracle.graal.lir.constopt;
 
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.meta.Value;
 import com.oracle.graal.compiler.common.cfg.*;
 import com.oracle.graal.lir.*;
 
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/debug/LIRGenerationDebugContext.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/debug/LIRGenerationDebugContext.java	Thu May 28 21:11:28 2015 -0700
@@ -22,9 +22,9 @@
  */
 package com.oracle.graal.lir.debug;
 
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.debug.*;
+import com.oracle.jvmci.meta.Value;
 import com.oracle.graal.lir.*;
+import com.oracle.jvmci.debug.*;
 
 /**
  * Provides information about {@link LIR} generation for debugging purposes.
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/framemap/FrameMap.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/framemap/FrameMap.java	Thu May 28 21:11:28 2015 -0700
@@ -22,13 +22,13 @@
  */
 package com.oracle.graal.lir.framemap;
 
-import static com.oracle.graal.api.code.ValueUtil.*;
+import static com.oracle.jvmci.code.ValueUtil.*;
 
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.asm.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * This class is used to build the stack frame layout for a compiled method. A {@link StackSlot} is
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/framemap/FrameMapBuilder.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/framemap/FrameMapBuilder.java	Thu May 28 21:11:28 2015 -0700
@@ -24,10 +24,10 @@
 
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.lir.gen.*;
 import com.oracle.graal.lir.stackslotalloc.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * A {@link FrameMapBuilder} is used to collect all information necessary to
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/framemap/FrameMapBuilderImpl.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/framemap/FrameMapBuilderImpl.java	Thu May 28 21:11:28 2015 -0700
@@ -22,21 +22,21 @@
  */
 package com.oracle.graal.lir.framemap;
 
-import static com.oracle.graal.api.code.ValueUtil.*;
+import static com.oracle.jvmci.code.ValueUtil.*;
 
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.cfg.*;
-import com.oracle.graal.debug.*;
-import com.oracle.graal.debug.Debug.Scope;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.LIRInstruction.OperandFlag;
 import com.oracle.graal.lir.LIRInstruction.OperandMode;
 import com.oracle.graal.lir.gen.*;
 import com.oracle.graal.lir.stackslotalloc.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.debug.Debug.Scope;
+import com.oracle.jvmci.meta.*;
 
 /**
  * A FrameMapBuilder that records allocation.
@@ -71,7 +71,7 @@
             return null;
         }
         if (outObjectStackSlots != null) {
-            throw GraalInternalError.unimplemented();
+            throw JVMCIError.unimplemented();
         }
         VirtualStackSlotRange slot = new VirtualStackSlotRange(numStackSlots++, slots, objects);
         stackSlots.add(slot);
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/framemap/FrameMapBuilderTool.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/framemap/FrameMapBuilderTool.java	Thu May 28 21:11:28 2015 -0700
@@ -24,7 +24,7 @@
 
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
+import com.oracle.jvmci.code.*;
 
 /**
  * A {@link FrameMapBuilder} that allows access to the underlying {@link FrameMap}.
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/framemap/SimpleVirtualStackSlot.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/framemap/SimpleVirtualStackSlot.java	Thu May 28 21:11:28 2015 -0700
@@ -22,8 +22,8 @@
  */
 package com.oracle.graal.lir.framemap;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * Represents a {@link VirtualStackSlot virtual stack slot} for a specific {@link LIRKind kind}.
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/framemap/VirtualStackSlotRange.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/framemap/VirtualStackSlotRange.java	Thu May 28 21:11:28 2015 -0700
@@ -24,8 +24,8 @@
 
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * Represents a {@link #getSlots() numbered} range of {@link VirtualStackSlot virtual stack slot} of
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/gen/ArithmeticLIRGenerator.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/gen/ArithmeticLIRGenerator.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,8 @@
  */
 package com.oracle.graal.lir.gen;
 
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.meta.Value;
+import com.oracle.jvmci.meta.LIRKind;
 import com.oracle.graal.compiler.common.calc.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.lir.*;
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/gen/BenchmarkCounterFactory.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/gen/BenchmarkCounterFactory.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,7 @@
  */
 package com.oracle.graal.lir.gen;
 
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.meta.Value;
 import com.oracle.graal.lir.*;
 
 public interface BenchmarkCounterFactory {
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/gen/DefaultLIRKindTool.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/gen/DefaultLIRKindTool.java	Thu May 28 21:11:28 2015 -0700
@@ -22,9 +22,11 @@
  */
 package com.oracle.graal.lir.gen;
 
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.common.*;
+import com.oracle.jvmci.meta.PlatformKind;
+import com.oracle.jvmci.meta.Kind;
+import com.oracle.jvmci.meta.LIRKind;
 import com.oracle.graal.compiler.common.spi.*;
+import com.oracle.jvmci.common.*;
 
 /**
  * Default implementation of {@link LIRKindTool}. Returns the normal Java kind for primitive types.
@@ -58,7 +60,7 @@
             case 64:
                 return LIRKind.value(Kind.Double);
             default:
-                throw GraalInternalError.shouldNotReachHere();
+                throw JVMCIError.shouldNotReachHere();
         }
     }
 
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/gen/LIRGenerator.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/gen/LIRGenerator.java	Thu May 28 21:11:28 2015 -0700
@@ -22,24 +22,38 @@
  */
 package com.oracle.graal.lir.gen;
 
-import static com.oracle.graal.api.code.ValueUtil.*;
+import com.oracle.jvmci.code.ForeignCallLinkage;
+import com.oracle.jvmci.code.CallingConvention;
+import com.oracle.jvmci.code.RegisterAttributes;
+import com.oracle.jvmci.code.StackSlot;
+import com.oracle.jvmci.code.TargetDescription;
+import com.oracle.jvmci.code.CodeCacheProvider;
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.code.ForeignCallsProvider;
+import com.oracle.jvmci.meta.PlatformKind;
+import com.oracle.jvmci.meta.Constant;
+import com.oracle.jvmci.meta.Kind;
+import com.oracle.jvmci.meta.JavaConstant;
+import com.oracle.jvmci.meta.Value;
+import com.oracle.jvmci.meta.LIRKind;
+import com.oracle.jvmci.meta.AllocatableValue;
+import com.oracle.jvmci.meta.MetaAccessProvider;
+import static com.oracle.jvmci.code.ValueUtil.*;
 import static com.oracle.graal.lir.LIRValueUtil.*;
 
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.asm.*;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.calc.*;
 import com.oracle.graal.compiler.common.cfg.*;
 import com.oracle.graal.compiler.common.spi.*;
 import com.oracle.graal.compiler.common.type.*;
-import com.oracle.graal.debug.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.StandardOp.BlockEndOp;
 import com.oracle.graal.lir.StandardOp.LabelOp;
-import com.oracle.graal.options.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.options.*;
 
 /**
  * This class traverses the HIR instructions and generates LIR instructions from them.
@@ -279,7 +293,7 @@
             } else if (isStackSlot(value)) {
                 return StackSlot.get(stackKind, asStackSlot(value).getRawOffset(), asStackSlot(value).getRawAddFrameSize());
             } else {
-                throw GraalInternalError.shouldNotReachHere();
+                throw JVMCIError.shouldNotReachHere();
             }
         }
         return value;
@@ -413,10 +427,10 @@
     }
 
     public LIRInstruction createBenchmarkCounter(String name, String group, Value increment) {
-        throw GraalInternalError.unimplemented();
+        throw JVMCIError.unimplemented();
     }
 
     public LIRInstruction createMultiBenchmarkCounter(String[] names, String[] groups, Value[] increments) {
-        throw GraalInternalError.unimplemented();
+        throw JVMCIError.unimplemented();
     }
 }
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/gen/LIRGeneratorTool.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/gen/LIRGeneratorTool.java	Thu May 28 21:11:28 2015 -0700
@@ -22,14 +22,28 @@
  */
 package com.oracle.graal.lir.gen;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.common.*;
+import com.oracle.jvmci.code.CallingConvention;
+import com.oracle.jvmci.code.ForeignCallLinkage;
+import com.oracle.jvmci.code.RegisterAttributes;
+import com.oracle.jvmci.code.TargetDescription;
+import com.oracle.jvmci.code.StackSlotValue;
+import com.oracle.jvmci.code.CodeCacheProvider;
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.code.ForeignCallsProvider;
+import com.oracle.jvmci.meta.PlatformKind;
+import com.oracle.jvmci.meta.Constant;
+import com.oracle.jvmci.meta.Kind;
+import com.oracle.jvmci.meta.JavaConstant;
+import com.oracle.jvmci.meta.Value;
+import com.oracle.jvmci.meta.LIRKind;
+import com.oracle.jvmci.meta.AllocatableValue;
+import com.oracle.jvmci.meta.MetaAccessProvider;
 import com.oracle.graal.compiler.common.calc.*;
 import com.oracle.graal.compiler.common.cfg.*;
 import com.oracle.graal.compiler.common.spi.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.StandardOp.StackMove;
+import com.oracle.jvmci.common.*;
 
 public interface LIRGeneratorTool extends ArithmeticLIRGenerator, BenchmarkCounterFactory {
 
@@ -87,7 +101,7 @@
      * @param delta the value to be added
      */
     default Value emitAtomicReadAndAdd(Value address, Value delta) {
-        throw GraalInternalError.unimplemented();
+        throw JVMCIError.unimplemented();
     }
 
     /**
@@ -97,7 +111,7 @@
      * @param newValue the new value to be written
      */
     default Value emitAtomicReadAndWrite(Value address, Value newValue) {
-        throw GraalInternalError.unimplemented();
+        throw JVMCIError.unimplemented();
     }
 
     void emitDeoptimize(Value actionAndReason, Value failedSpeculation, LIRFrameState state);
@@ -205,12 +219,12 @@
 
     @SuppressWarnings("unused")
     default Value emitCountLeadingZeros(Value value) {
-        throw GraalInternalError.unimplemented();
+        throw JVMCIError.unimplemented();
     }
 
     @SuppressWarnings("unused")
     default Value emitCountTrailingZeros(Value value) {
-        throw GraalInternalError.unimplemented();
+        throw JVMCIError.unimplemented();
     }
 
 }
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/gen/PhiResolver.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/gen/PhiResolver.java	Thu May 28 21:11:28 2015 -0700
@@ -22,17 +22,18 @@
  */
 package com.oracle.graal.lir.gen;
 
-import static com.oracle.graal.api.code.ValueUtil.*;
-import static com.oracle.graal.api.meta.Value.*;
+import com.oracle.jvmci.meta.Value;
+import com.oracle.jvmci.meta.AllocatableValue;
+import static com.oracle.jvmci.code.ValueUtil.*;
+import static com.oracle.jvmci.meta.Value.*;
 import static com.oracle.graal.lir.LIRValueUtil.*;
 
 import java.util.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.cfg.*;
 import com.oracle.graal.lir.*;
-import com.oracle.graal.lir.gen.LIRGeneratorTool.*;
+import com.oracle.graal.lir.gen.LIRGeneratorTool.SpillMoveFactory;
 
 /**
  * Converts phi instructions into moves.
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/phases/AllocationPhase.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/phases/AllocationPhase.java	Thu May 28 21:11:28 2015 -0700
@@ -24,11 +24,11 @@
 
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
 import com.oracle.graal.compiler.common.alloc.*;
 import com.oracle.graal.compiler.common.cfg.*;
 import com.oracle.graal.lir.gen.*;
 import com.oracle.graal.lir.gen.LIRGeneratorTool.SpillMoveFactory;
+import com.oracle.jvmci.code.*;
 
 public abstract class AllocationPhase extends LIRPhase<AllocationPhase.AllocationContext> {
 
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/phases/AllocationStage.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/phases/AllocationStage.java	Thu May 28 21:11:28 2015 -0700
@@ -23,7 +23,7 @@
 package com.oracle.graal.lir.phases;
 
 import com.oracle.graal.lir.alloc.lsra.*;
-import com.oracle.graal.lir.phases.AllocationPhase.*;
+import com.oracle.graal.lir.phases.AllocationPhase.AllocationContext;
 import com.oracle.graal.lir.stackslotalloc.*;
 
 public class AllocationStage extends LIRPhaseSuite<AllocationContext> {
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/phases/EconomyAllocationStage.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/phases/EconomyAllocationStage.java	Thu May 28 21:11:28 2015 -0700
@@ -23,7 +23,7 @@
 package com.oracle.graal.lir.phases;
 
 import com.oracle.graal.lir.alloc.lsra.*;
-import com.oracle.graal.lir.phases.AllocationPhase.*;
+import com.oracle.graal.lir.phases.AllocationPhase.AllocationContext;
 import com.oracle.graal.lir.stackslotalloc.*;
 
 public class EconomyAllocationStage extends LIRPhaseSuite<AllocationContext> {
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/phases/EconomyPostAllocationOptimizationStage.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/phases/EconomyPostAllocationOptimizationStage.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,7 @@
  */
 package com.oracle.graal.lir.phases;
 
-import com.oracle.graal.lir.phases.PostAllocationOptimizationPhase.*;
+import com.oracle.graal.lir.phases.PostAllocationOptimizationPhase.PostAllocationOptimizationContext;
 
 public class EconomyPostAllocationOptimizationStage extends LIRPhaseSuite<PostAllocationOptimizationContext> {
     public EconomyPostAllocationOptimizationStage() {
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/phases/EconomyPreAllocationOptimizationStage.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/phases/EconomyPreAllocationOptimizationStage.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,7 @@
  */
 package com.oracle.graal.lir.phases;
 
-import com.oracle.graal.lir.phases.PreAllocationOptimizationPhase.*;
+import com.oracle.graal.lir.phases.PreAllocationOptimizationPhase.PreAllocationOptimizationContext;
 
 public class EconomyPreAllocationOptimizationStage extends LIRPhaseSuite<PreAllocationOptimizationContext> {
     public EconomyPreAllocationOptimizationStage() {
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/phases/LIRPhase.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/phases/LIRPhase.java	Thu May 28 21:11:28 2015 -0700
@@ -22,16 +22,16 @@
  */
 package com.oracle.graal.lir.phases;
 
+import com.oracle.jvmci.code.TargetDescription;
 import java.util.*;
 import java.util.regex.*;
 
-import com.oracle.graal.api.code.*;
 import com.oracle.graal.compiler.common.cfg.*;
-import com.oracle.graal.debug.*;
-import com.oracle.graal.debug.Debug.Scope;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.gen.*;
-import com.oracle.graal.options.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.debug.Debug.Scope;
+import com.oracle.jvmci.options.*;
 
 /**
  * Base class for all {@link LIR low-level} phases. Subclasses should be stateless. There will be
@@ -84,7 +84,14 @@
         }
     };
 
-    private static final Pattern NAME_PATTERN = Pattern.compile("[A-Z][A-Za-z0-9]+");
+    @SuppressWarnings("all")
+    private static boolean assertionsEnabled() {
+        boolean enabled = false;
+        assert enabled = true;
+        return enabled;
+    }
+
+    private static final Pattern NAME_PATTERN = assertionsEnabled() ? Pattern.compile("[A-Z][A-Za-z0-9]+") : null;
 
     private static boolean checkName(String name) {
         assert name == null || NAME_PATTERN.matcher(name).matches() : "illegal phase name: " + name;
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/phases/LIRPhaseSuite.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/phases/LIRPhaseSuite.java	Thu May 28 21:11:28 2015 -0700
@@ -22,9 +22,9 @@
  */
 package com.oracle.graal.lir.phases;
 
+import com.oracle.jvmci.code.TargetDescription;
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
 import com.oracle.graal.compiler.common.cfg.*;
 import com.oracle.graal.lir.gen.*;
 
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/phases/LIRSuites.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/phases/LIRSuites.java	Thu May 28 21:11:28 2015 -0700
@@ -22,12 +22,12 @@
  */
 package com.oracle.graal.lir.phases;
 
-import com.oracle.graal.api.code.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.gen.*;
-import com.oracle.graal.lir.phases.PreAllocationOptimizationPhase.PreAllocationOptimizationContext;
+import com.oracle.graal.lir.phases.AllocationPhase.AllocationContext;
 import com.oracle.graal.lir.phases.PostAllocationOptimizationPhase.PostAllocationOptimizationContext;
-import com.oracle.graal.lir.phases.AllocationPhase.AllocationContext;
+import com.oracle.graal.lir.phases.PreAllocationOptimizationPhase.PreAllocationOptimizationContext;
+import com.oracle.jvmci.code.*;
 
 public class LIRSuites {
 
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/phases/PostAllocationOptimizationPhase.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/phases/PostAllocationOptimizationPhase.java	Thu May 28 21:11:28 2015 -0700
@@ -22,9 +22,9 @@
  */
 package com.oracle.graal.lir.phases;
 
+import com.oracle.jvmci.code.TargetDescription;
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
 import com.oracle.graal.compiler.common.cfg.*;
 import com.oracle.graal.lir.gen.*;
 
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/phases/PostAllocationOptimizationStage.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/phases/PostAllocationOptimizationStage.java	Thu May 28 21:11:28 2015 -0700
@@ -27,7 +27,7 @@
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.phases.PostAllocationOptimizationPhase.PostAllocationOptimizationContext;
 import com.oracle.graal.lir.profiling.*;
-import com.oracle.graal.options.*;
+import com.oracle.jvmci.options.*;
 
 public class PostAllocationOptimizationStage extends LIRPhaseSuite<PostAllocationOptimizationContext> {
     public static class Options {
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/phases/PreAllocationOptimizationPhase.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/phases/PreAllocationOptimizationPhase.java	Thu May 28 21:11:28 2015 -0700
@@ -22,9 +22,9 @@
  */
 package com.oracle.graal.lir.phases;
 
+import com.oracle.jvmci.code.TargetDescription;
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
 import com.oracle.graal.compiler.common.cfg.*;
 import com.oracle.graal.lir.gen.*;
 
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/profiling/MoveProfiling.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/profiling/MoveProfiling.java	Thu May 28 21:11:28 2015 -0700
@@ -22,13 +22,14 @@
  */
 package com.oracle.graal.lir.profiling;
 
-import static com.oracle.graal.api.code.ValueUtil.*;
+import com.oracle.jvmci.code.TargetDescription;
+import com.oracle.jvmci.meta.JavaConstant;
+import com.oracle.jvmci.meta.Value;
+import com.oracle.jvmci.meta.AllocatableValue;
+import static com.oracle.jvmci.code.ValueUtil.*;
 
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.cfg.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.StandardOp.BlockEndOp;
@@ -36,6 +37,7 @@
 import com.oracle.graal.lir.StandardOp.MoveOp;
 import com.oracle.graal.lir.gen.*;
 import com.oracle.graal.lir.phases.*;
+import com.oracle.jvmci.common.*;
 
 public class MoveProfiling extends PostAllocationOptimizationPhase {
 
@@ -84,7 +86,7 @@
                     return CONST2STACK;
                 }
             }
-            throw GraalInternalError.shouldNotReachHere(String.format("Unrecognized Move: %s dst=%s, src=%s", move, dst, src));
+            throw JVMCIError.shouldNotReachHere(String.format("Unrecognized Move: %s dst=%s, src=%s", move, dst, src));
         }
     }
 
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/ssa/SSADestructionPhase.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/ssa/SSADestructionPhase.java	Thu May 28 21:11:28 2015 -0700
@@ -22,14 +22,14 @@
  */
 package com.oracle.graal.lir.ssa;
 
+import com.oracle.jvmci.code.TargetDescription;
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
 import com.oracle.graal.compiler.common.cfg.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.gen.*;
 import com.oracle.graal.lir.phases.*;
-import com.oracle.graal.options.*;
+import com.oracle.jvmci.options.*;
 
 public final class SSADestructionPhase extends PreAllocationOptimizationPhase {
 
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/ssa/SSAUtils.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/ssa/SSAUtils.java	Thu May 28 21:11:28 2015 -0700
@@ -22,9 +22,9 @@
  */
 package com.oracle.graal.lir.ssa;
 
+import com.oracle.jvmci.meta.Value;
 import java.util.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.cfg.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.LIRInstruction.OperandMode;
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/ssa/SSAVerifier.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/ssa/SSAVerifier.java	Thu May 28 21:11:28 2015 -0700
@@ -23,17 +23,17 @@
 
 package com.oracle.graal.lir.ssa;
 
-import static com.oracle.graal.api.code.ValueUtil.*;
+import com.oracle.jvmci.meta.Value;
+import static com.oracle.jvmci.code.ValueUtil.*;
 
 import java.util.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.cfg.*;
-import com.oracle.graal.debug.*;
-import com.oracle.graal.debug.Debug.Scope;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.LIRInstruction.OperandFlag;
 import com.oracle.graal.lir.LIRInstruction.OperandMode;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.debug.Debug.Scope;
 
 final class SSAVerifier {
     private static class Entry {
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/stackslotalloc/FixPointIntervalBuilder.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/stackslotalloc/FixPointIntervalBuilder.java	Thu May 28 21:11:28 2015 -0700
@@ -22,17 +22,17 @@
  */
 package com.oracle.graal.lir.stackslotalloc;
 
-import static com.oracle.graal.api.code.ValueUtil.*;
+import com.oracle.jvmci.code.VirtualStackSlot;
+import com.oracle.jvmci.meta.Value;
+import static com.oracle.jvmci.code.ValueUtil.*;
 
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.cfg.*;
-import com.oracle.graal.debug.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.LIRInstruction.OperandFlag;
 import com.oracle.graal.lir.LIRInstruction.OperandMode;
+import com.oracle.jvmci.debug.*;
 
 /**
  * Calculates the stack intervals using a worklist-based backwards data-flow analysis.
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/stackslotalloc/LSStackSlotAllocator.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/stackslotalloc/LSStackSlotAllocator.java	Thu May 28 21:11:28 2015 -0700
@@ -22,18 +22,14 @@
  */
 package com.oracle.graal.lir.stackslotalloc;
 
-import static com.oracle.graal.api.code.ValueUtil.*;
 import static com.oracle.graal.lir.phases.LIRPhase.Options.*;
+import static com.oracle.jvmci.code.ValueUtil.*;
 
 import java.util.*;
 import java.util.function.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.alloc.*;
 import com.oracle.graal.compiler.common.cfg.*;
-import com.oracle.graal.debug.*;
-import com.oracle.graal.debug.Debug.Scope;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.LIRInstruction.OperandFlag;
 import com.oracle.graal.lir.LIRInstruction.OperandMode;
@@ -41,7 +37,11 @@
 import com.oracle.graal.lir.gen.*;
 import com.oracle.graal.lir.gen.LIRGeneratorTool.SpillMoveFactory;
 import com.oracle.graal.lir.phases.*;
-import com.oracle.graal.options.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.debug.Debug.Scope;
+import com.oracle.jvmci.meta.*;
+import com.oracle.jvmci.options.*;
 
 /**
  * Linear Scan {@link StackSlotAllocator}.
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/stackslotalloc/SimpleStackSlotAllocator.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/stackslotalloc/SimpleStackSlotAllocator.java	Thu May 28 21:11:28 2015 -0700
@@ -22,21 +22,21 @@
  */
 package com.oracle.graal.lir.stackslotalloc;
 
-import static com.oracle.graal.api.code.ValueUtil.*;
+import static com.oracle.jvmci.code.ValueUtil.*;
 
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.alloc.*;
 import com.oracle.graal.compiler.common.cfg.*;
-import com.oracle.graal.debug.*;
-import com.oracle.graal.debug.Debug.Scope;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.framemap.*;
 import com.oracle.graal.lir.gen.*;
 import com.oracle.graal.lir.gen.LIRGeneratorTool.SpillMoveFactory;
 import com.oracle.graal.lir.phases.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.debug.Debug.Scope;
 
 public class SimpleStackSlotAllocator extends AllocationPhase implements StackSlotAllocator {
 
@@ -59,7 +59,7 @@
                 slot = mapVirtualStackSlotRange(builder, slotRange);
                 virtualFramesize.add(builder.getFrameMap().spillSlotRangeSize(slotRange.getSlots()));
             } else {
-                throw GraalInternalError.shouldNotReachHere("Unknown VirtualStackSlot: " + virtualSlot);
+                throw JVMCIError.shouldNotReachHere("Unknown VirtualStackSlot: " + virtualSlot);
             }
             allocatedSlots.increment();
             mapping[virtualSlot.getId()] = slot;
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/stackslotalloc/StackInterval.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/stackslotalloc/StackInterval.java	Thu May 28 21:11:28 2015 -0700
@@ -22,8 +22,9 @@
  */
 package com.oracle.graal.lir.stackslotalloc;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.code.StackSlot;
+import com.oracle.jvmci.code.VirtualStackSlot;
+import com.oracle.jvmci.meta.LIRKind;
 
 public final class StackInterval {
 
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/stackslotalloc/StackSlotAllocator.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/stackslotalloc/StackSlotAllocator.java	Thu May 28 21:11:28 2015 -0700
@@ -22,10 +22,10 @@
  */
 package com.oracle.graal.lir.stackslotalloc;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.debug.*;
 import com.oracle.graal.lir.framemap.*;
 import com.oracle.graal.lir.gen.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.debug.*;
 
 /**
  * A {@link StackSlotAllocator} is responsible for translating {@link VirtualStackSlot virtual}
--- a/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/BasicInductionVariable.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/BasicInductionVariable.java	Thu May 28 21:11:28 2015 -0700
@@ -24,10 +24,10 @@
 
 import static com.oracle.graal.loop.MathUtil.*;
 
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.calc.*;
+import com.oracle.jvmci.common.*;
 
 public class BasicInductionVariable extends InductionVariable {
 
@@ -94,7 +94,7 @@
         if (op instanceof SubNode) {
             return graph().unique(new NegateNode(rawStride));
         }
-        throw GraalInternalError.shouldNotReachHere();
+        throw JVMCIError.shouldNotReachHere();
     }
 
     @Override
@@ -120,7 +120,7 @@
         if (op instanceof SubNode) {
             return -rawStride.asJavaConstant().asLong();
         }
-        throw GraalInternalError.shouldNotReachHere();
+        throw JVMCIError.shouldNotReachHere();
     }
 
     @Override
--- a/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/CountedLoopInfo.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/CountedLoopInfo.java	Thu May 28 21:11:28 2015 -0700
@@ -22,10 +22,12 @@
  */
 package com.oracle.graal.loop;
 
+import com.oracle.jvmci.code.CodeUtil;
+import com.oracle.jvmci.meta.DeoptimizationReason;
+import com.oracle.jvmci.meta.DeoptimizationAction;
+import com.oracle.jvmci.meta.JavaConstant;
 import static com.oracle.graal.loop.MathUtil.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.loop.InductionVariable.Direction;
 import com.oracle.graal.nodes.*;
--- a/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/DerivedOffsetInductionVariable.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/DerivedOffsetInductionVariable.java	Thu May 28 21:11:28 2015 -0700
@@ -24,10 +24,10 @@
 
 import static com.oracle.graal.loop.MathUtil.*;
 
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.calc.*;
+import com.oracle.jvmci.common.*;
 
 public class DerivedOffsetInductionVariable extends DerivedInductionVariable {
 
@@ -122,7 +122,7 @@
                 return o - b;
             }
         }
-        throw GraalInternalError.shouldNotReachHere();
+        throw JVMCIError.shouldNotReachHere();
     }
 
     private ValueNode op(ValueNode b, ValueNode o) {
@@ -137,7 +137,7 @@
                 return sub(graph(), o, b);
             }
         }
-        throw GraalInternalError.shouldNotReachHere();
+        throw JVMCIError.shouldNotReachHere();
     }
 
     @Override
--- a/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/InductionVariable.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/InductionVariable.java	Thu May 28 21:11:28 2015 -0700
@@ -22,9 +22,9 @@
  */
 package com.oracle.graal.loop;
 
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.nodes.*;
+import com.oracle.jvmci.common.*;
 
 /**
  * This class describes a value node that is an induction variable in a counted loop.
@@ -42,7 +42,7 @@
                 case Down:
                     return Up;
                 default:
-                    throw GraalInternalError.shouldNotReachHere();
+                    throw JVMCIError.shouldNotReachHere();
             }
         }
     }
--- a/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopEx.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopEx.java	Thu May 28 21:11:28 2015 -0700
@@ -26,11 +26,9 @@
 
 import java.util.*;
 
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.calc.*;
 import com.oracle.graal.compiler.common.cfg.*;
 import com.oracle.graal.compiler.common.type.*;
-import com.oracle.graal.debug.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.iterators.*;
 import com.oracle.graal.loop.InductionVariable.Direction;
@@ -39,6 +37,8 @@
 import com.oracle.graal.nodes.cfg.*;
 import com.oracle.graal.nodes.extended.*;
 import com.oracle.graal.nodes.util.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.debug.*;
 
 public class LoopEx {
 
@@ -243,7 +243,7 @@
                     }
                     break;
                 default:
-                    throw GraalInternalError.shouldNotReachHere();
+                    throw JVMCIError.shouldNotReachHere();
             }
             counted = new CountedLoopInfo(this, iv, limit, oneOff, negated ? ifNode.falseSuccessor() : ifNode.trueSuccessor());
             return true;
--- a/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopFragment.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopFragment.java	Thu May 28 21:11:28 2015 -0700
@@ -24,7 +24,6 @@
 
 import java.util.*;
 
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.Graph.DuplicationReplacement;
 import com.oracle.graal.graph.iterators.*;
@@ -33,6 +32,7 @@
 import com.oracle.graal.nodes.java.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.virtual.*;
+import com.oracle.jvmci.common.*;
 
 public abstract class LoopFragment {
 
@@ -363,7 +363,7 @@
                     } else if (vpn instanceof GuardProxyNode) {
                         phi = graph.addWithoutUnique(new GuardPhiNode(merge));
                     } else {
-                        throw GraalInternalError.shouldNotReachHere();
+                        throw JVMCIError.shouldNotReachHere();
                     }
                     phi.addInput(vpn);
                     phi.addInput(newVpn);
--- a/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopFragmentInside.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopFragmentInside.java	Thu May 28 21:11:28 2015 -0700
@@ -25,13 +25,14 @@
 import java.util.*;
 
 import com.oracle.graal.compiler.common.*;
+import com.oracle.graal.graph.Graph.DuplicationReplacement;
 import com.oracle.graal.graph.*;
-import com.oracle.graal.graph.Graph.*;
 import com.oracle.graal.graph.iterators.*;
 import com.oracle.graal.nodes.*;
-import com.oracle.graal.nodes.VirtualState.*;
+import com.oracle.graal.nodes.VirtualState.NodeClosure;
 import com.oracle.graal.nodes.memory.*;
 import com.oracle.graal.nodes.util.*;
+import com.oracle.jvmci.common.*;
 
 public class LoopFragmentInside extends LoopFragment {
 
@@ -194,7 +195,7 @@
         } else if (phi instanceof MemoryPhiNode) {
             ret = new MemoryPhiNode(merge, ((MemoryPhiNode) phi).getLocationIdentity());
         } else {
-            throw GraalInternalError.shouldNotReachHere();
+            throw JVMCIError.shouldNotReachHere();
         }
         return graph.addWithoutUnique(ret);
     }
--- a/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopPolicies.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopPolicies.java	Thu May 28 21:11:28 2015 -0700
@@ -26,13 +26,13 @@
 
 import java.util.*;
 
-import com.oracle.graal.debug.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.VirtualState.VirtualClosure;
 import com.oracle.graal.nodes.cfg.*;
 import com.oracle.graal.nodes.debug.*;
-import com.oracle.graal.options.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.options.*;
 
 public abstract class LoopPolicies {
     @Option(help = "", type = OptionType.Expert) public static final OptionValue<Integer> LoopUnswitchMaxIncrease = new OptionValue<>(500);
--- a/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopTransformations.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopTransformations.java	Thu May 28 21:11:28 2015 -0700
@@ -22,11 +22,11 @@
  */
 package com.oracle.graal.loop;
 
+import com.oracle.jvmci.code.BailoutException;
 import static com.oracle.graal.compiler.common.GraalOptions.*;
 
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
 import com.oracle.graal.graph.Graph.Mark;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodeinfo.*;
--- a/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopsData.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopsData.java	Thu May 28 21:11:28 2015 -0700
@@ -26,11 +26,11 @@
 
 import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.cfg.*;
-import com.oracle.graal.debug.*;
-import com.oracle.graal.debug.Debug.Scope;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.cfg.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.debug.Debug.Scope;
 
 public class LoopsData {
 
--- a/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/phases/LoopFullUnrollPhase.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/phases/LoopFullUnrollPhase.java	Thu May 28 21:11:28 2015 -0700
@@ -22,12 +22,12 @@
  */
 package com.oracle.graal.loop.phases;
 
-import com.oracle.graal.debug.*;
 import com.oracle.graal.loop.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.phases.*;
 import com.oracle.graal.phases.common.*;
 import com.oracle.graal.phases.tiers.*;
+import com.oracle.jvmci.debug.*;
 
 public class LoopFullUnrollPhase extends BasePhase<PhaseContext> {
 
--- a/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/phases/LoopPeelingPhase.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/phases/LoopPeelingPhase.java	Thu May 28 21:11:28 2015 -0700
@@ -22,10 +22,10 @@
  */
 package com.oracle.graal.loop.phases;
 
-import com.oracle.graal.debug.*;
 import com.oracle.graal.loop.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.phases.*;
+import com.oracle.jvmci.debug.*;
 
 public class LoopPeelingPhase extends Phase {
 
--- a/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/phases/LoopUnswitchingPhase.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/phases/LoopUnswitchingPhase.java	Thu May 28 21:11:28 2015 -0700
@@ -24,11 +24,11 @@
 
 import java.util.*;
 
-import com.oracle.graal.debug.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.loop.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.phases.*;
+import com.oracle.jvmci.debug.*;
 
 public class LoopUnswitchingPhase extends Phase {
 
--- a/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/phases/ReassociateInvariantPhase.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/phases/ReassociateInvariantPhase.java	Thu May 28 21:11:28 2015 -0700
@@ -22,11 +22,11 @@
  */
 package com.oracle.graal.loop.phases;
 
-import com.oracle.graal.debug.*;
-import com.oracle.graal.debug.Debug.Scope;
 import com.oracle.graal.loop.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.phases.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.debug.Debug.Scope;
 
 public class ReassociateInvariantPhase extends Phase {
 
--- a/graal/com.oracle.graal.nodes.test/src/com/oracle/graal/nodes/test/AbstractObjectStampTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes.test/src/com/oracle/graal/nodes/test/AbstractObjectStampTest.java	Thu May 28 21:11:28 2015 -0700
@@ -22,9 +22,9 @@
  */
 package com.oracle.graal.nodes.test;
 
+import com.oracle.jvmci.meta.ResolvedJavaType;
 import org.junit.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.compiler.test.*;
 
--- a/graal/com.oracle.graal.nodes.test/src/com/oracle/graal/nodes/test/IntegerStampTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes.test/src/com/oracle/graal/nodes/test/IntegerStampTest.java	Thu May 28 21:11:28 2015 -0700
@@ -22,11 +22,12 @@
  */
 package com.oracle.graal.nodes.test;
 
+import com.oracle.jvmci.meta.Kind;
+import com.oracle.jvmci.meta.JavaConstant;
 import static org.junit.Assert.*;
 
 import org.junit.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.ArithmeticOpTable.IntegerConvertOp;
 import com.oracle.graal.compiler.common.type.ArithmeticOpTable.ShiftOp;
 import com.oracle.graal.compiler.common.type.*;
--- a/graal/com.oracle.graal.nodes.test/src/com/oracle/graal/nodes/test/NegateNodeCanonicalizationTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes.test/src/com/oracle/graal/nodes/test/NegateNodeCanonicalizationTest.java	Thu May 28 21:11:28 2015 -0700
@@ -22,11 +22,11 @@
  */
 package com.oracle.graal.nodes.test;
 
+import com.oracle.jvmci.meta.JavaConstant;
 import static org.junit.Assert.*;
 
 import org.junit.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions;
--- a/graal/com.oracle.graal.nodes.test/src/com/oracle/graal/nodes/test/ObjectStampJoinTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes.test/src/com/oracle/graal/nodes/test/ObjectStampJoinTest.java	Thu May 28 21:11:28 2015 -0700
@@ -22,9 +22,9 @@
  */
 package com.oracle.graal.nodes.test;
 
+import com.oracle.jvmci.meta.Kind;
 import org.junit.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.nodes.type.*;
 
--- a/graal/com.oracle.graal.nodes.test/src/com/oracle/graal/nodes/test/ObjectStampMeetTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes.test/src/com/oracle/graal/nodes/test/ObjectStampMeetTest.java	Thu May 28 21:11:28 2015 -0700
@@ -22,9 +22,10 @@
  */
 package com.oracle.graal.nodes.test;
 
+import com.oracle.jvmci.meta.Kind;
+import com.oracle.jvmci.meta.ResolvedJavaType;
 import org.junit.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 
 public class ObjectStampMeetTest extends AbstractObjectStampTest {
--- a/graal/com.oracle.graal.nodes.test/src/com/oracle/graal/nodes/test/ObjectStampTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes.test/src/com/oracle/graal/nodes/test/ObjectStampTest.java	Thu May 28 21:11:28 2015 -0700
@@ -22,9 +22,9 @@
  */
 package com.oracle.graal.nodes.test;
 
+import com.oracle.jvmci.meta.TrustedInterface;
 import org.junit.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 
 public class ObjectStampTest extends AbstractObjectStampTest {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/AbstractDeoptimizeNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/AbstractDeoptimizeNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,10 +22,10 @@
  */
 package com.oracle.graal.nodes;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodeinfo.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * This node represents an unconditional explicit request for immediate deoptimization.
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/AbstractFixedGuardNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/AbstractFixedGuardNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,13 +22,13 @@
  */
 package com.oracle.graal.nodes;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.extended.*;
 import com.oracle.graal.nodes.util.*;
+import com.oracle.jvmci.meta.*;
 
 @NodeInfo
 public abstract class AbstractFixedGuardNode extends DeoptimizingFixedWithNextNode implements Simplifiable, GuardingNode {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/AbstractMergeNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/AbstractMergeNode.java	Thu May 28 21:11:28 2015 -0700
@@ -26,13 +26,13 @@
 
 import java.util.*;
 
-import com.oracle.graal.debug.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.iterators.*;
 import com.oracle.graal.graph.spi.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.util.*;
+import com.oracle.jvmci.debug.*;
 
 /**
  * Denotes the merging of multiple control-flow paths.
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/BinaryOpLogicNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/BinaryOpLogicNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,12 +22,12 @@
  */
 package com.oracle.graal.nodes;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.meta.*;
 
 @NodeInfo
 public abstract class BinaryOpLogicNode extends LogicNode implements LIRLowerable, Canonicalizable.Binary<ValueNode> {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/BreakpointNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/BreakpointNode.java	Thu May 28 21:11:28 2015 -0700
@@ -38,7 +38,7 @@
  * <pre>
  *     {@literal @}NodeIntrinsic(BreakpointNode.class)
  *     static void breakpoint(Object object, Word mark, Word value) {
- *          throw new GraalInternalError("");
+ *          throw new JVMCIError("");
  *     }
  * </pre>
  *
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/CallTargetNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/CallTargetNode.java	Thu May 28 21:11:28 2015 -0700
@@ -24,11 +24,11 @@
 
 import java.util.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.meta.*;
 
 @NodeInfo(allowedUsageTypes = {InputType.Extension})
 public abstract class CallTargetNode extends ValueNode implements LIRLowerable {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ConstantNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ConstantNode.java	Thu May 28 21:11:28 2015 -0700
@@ -24,15 +24,15 @@
 
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.iterators.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.calc.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * The {@code ConstantNode} represents a {@link Constant constant}.
@@ -391,7 +391,7 @@
             case Long:
                 return ConstantNode.forLong(value, graph);
             default:
-                throw GraalInternalError.shouldNotReachHere("unknown kind " + kind);
+                throw JVMCIError.shouldNotReachHere("unknown kind " + kind);
         }
     }
 
@@ -404,7 +404,7 @@
             case Long:
                 return createPrimitive(JavaConstant.forLong(value));
             default:
-                throw GraalInternalError.shouldNotReachHere("unknown kind " + kind);
+                throw JVMCIError.shouldNotReachHere("unknown kind " + kind);
         }
     }
 
@@ -415,7 +415,7 @@
             case Double:
                 return ConstantNode.forDouble(value, graph);
             default:
-                throw GraalInternalError.shouldNotReachHere("unknown kind " + kind);
+                throw JVMCIError.shouldNotReachHere("unknown kind " + kind);
         }
     }
 
@@ -426,7 +426,7 @@
             case Double:
                 return ConstantNode.forDouble(value);
             default:
-                throw GraalInternalError.shouldNotReachHere("unknown kind " + kind);
+                throw JVMCIError.shouldNotReachHere("unknown kind " + kind);
         }
     }
 
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/DeoptimizeNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/DeoptimizeNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,11 +22,11 @@
  */
 package com.oracle.graal.nodes;
 
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.debug.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.meta.*;
 
 @NodeInfo(shortName = "Deopt", nameTemplate = "Deopt {p#reason/s}")
 public final class DeoptimizeNode extends AbstractDeoptimizeNode implements Lowerable, LIRLowerable {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/DirectCallTargetNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/DirectCallTargetNode.java	Thu May 28 21:11:28 2015 -0700
@@ -24,11 +24,11 @@
 
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodeinfo.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.meta.*;
 
 @NodeInfo
 public class DirectCallTargetNode extends LoweredCallTargetNode {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/DynamicDeoptimizeNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/DynamicDeoptimizeNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,11 +22,11 @@
  */
 package com.oracle.graal.nodes;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.meta.*;
 
 @NodeInfo
 public final class DynamicDeoptimizeNode extends AbstractDeoptimizeNode implements LIRLowerable, Lowerable, Canonicalizable {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/EncodedGraph.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/EncodedGraph.java	Thu May 28 21:11:28 2015 -0700
@@ -24,8 +24,8 @@
 
 import java.util.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.graph.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * A {@link StructuredGraph} encoded in a compact binary representation as a byte[] array. See
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/EntryMarkerNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/EntryMarkerNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,11 +22,11 @@
  */
 package com.oracle.graal.nodes;
 
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.common.*;
 
 /**
  * This node will be inserted at point specified by {@link StructuredGraph#getEntryBCI()}, usually
@@ -47,6 +47,6 @@
 
     @Override
     public void generate(NodeLIRBuilderTool gen) {
-        throw new GraalInternalError("OnStackReplacementNode should not survive");
+        throw new JVMCIError("OnStackReplacementNode should not survive");
     }
 }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FixedGuardNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FixedGuardNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,12 +22,12 @@
  */
 package com.oracle.graal.nodes;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.extended.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.meta.*;
 
 @NodeInfo(nameTemplate = "FixedGuard(!={p#negated}) {p#reason/s}", allowedUsageTypes = {InputType.Guard})
 public final class FixedGuardNode extends AbstractFixedGuardNode implements Lowerable, IterableNodeType {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FrameState.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FrameState.java	Thu May 28 21:11:28 2015 -0700
@@ -22,19 +22,19 @@
  */
 package com.oracle.graal.nodes;
 
-import static com.oracle.graal.api.code.BytecodeFrame.*;
+import static com.oracle.jvmci.code.BytecodeFrame.*;
 
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.bytecode.*;
-import com.oracle.graal.debug.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.iterators.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.java.*;
 import com.oracle.graal.nodes.virtual.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * The {@code FrameState} class encapsulates the frame state (i.e. local variables and operand
@@ -253,11 +253,11 @@
      * the stack.
      */
     public FrameState duplicateModifiedDuringCall(int newBci, Kind popKind) {
-        return duplicateModified(graph(), newBci, rethrowException, true, popKind);
+        return duplicateModified(graph(), newBci, rethrowException, true, popKind, null, null);
     }
 
-    public FrameState duplicateModifiedBeforeCall(int newBci, Kind popKind, ValueNode... pushedValues) {
-        return duplicateModified(graph(), newBci, rethrowException, false, popKind, pushedValues);
+    public FrameState duplicateModifiedBeforeCall(int newBci, Kind popKind, Kind[] pushedSlotKinds, ValueNode[] pushedValues) {
+        return duplicateModified(graph(), newBci, rethrowException, false, popKind, pushedSlotKinds, pushedValues);
     }
 
     /**
@@ -266,17 +266,17 @@
      * {@code pushedValues} will be formatted correctly in slot encoding: a long or double will be
      * followed by a null slot.
      */
-    public FrameState duplicateModified(int newBci, boolean newRethrowException, Kind popKind, ValueNode... pushedValues) {
-        return duplicateModified(graph(), newBci, newRethrowException, duringCall, popKind, pushedValues);
+    public FrameState duplicateModified(int newBci, boolean newRethrowException, Kind popKind, Kind[] pushedSlotKinds, ValueNode[] pushedValues) {
+        return duplicateModified(graph(), newBci, newRethrowException, duringCall, popKind, pushedSlotKinds, pushedValues);
     }
 
     /**
      * Creates a copy of this frame state with the top of stack replaced with with
      * {@code pushedValue} which must be of type {@code popKind}.
      */
-    public FrameState duplicateModified(Kind popKind, ValueNode pushedValue) {
+    public FrameState duplicateModified(Kind popKind, Kind pushedSlotKind, ValueNode pushedValue) {
         assert pushedValue != null && pushedValue.getKind() == popKind;
-        return duplicateModified(graph(), bci, rethrowException, duringCall, popKind, pushedValue);
+        return duplicateModified(graph(), bci, rethrowException, duringCall, popKind, new Kind[]{pushedSlotKind}, new ValueNode[]{pushedValue});
     }
 
     /**
@@ -285,7 +285,7 @@
      * correctly in slot encoding: a long or double will be followed by a null slot. The bci will be
      * changed to newBci.
      */
-    public FrameState duplicateModified(StructuredGraph graph, int newBci, boolean newRethrowException, boolean newDuringCall, Kind popKind, ValueNode... pushedValues) {
+    public FrameState duplicateModified(StructuredGraph graph, int newBci, boolean newRethrowException, boolean newDuringCall, Kind popKind, Kind[] pushedSlotKinds, ValueNode[] pushedValues) {
         ArrayList<ValueNode> copy;
         if (newRethrowException && !rethrowException && popKind == Kind.Void) {
             assert popKind == Kind.Void;
@@ -301,10 +301,13 @@
                 copy.remove(copy.size() - 1);
             }
         }
-        for (ValueNode node : pushedValues) {
-            copy.add(node);
-            if (node.getKind().needsTwoSlots()) {
-                copy.add(null);
+        if (pushedValues != null) {
+            assert pushedSlotKinds.length == pushedValues.length;
+            for (int i = 0; i < pushedValues.length; i++) {
+                copy.add(pushedValues[i]);
+                if (pushedSlotKinds[i].needsTwoSlots()) {
+                    copy.add(null);
+                }
             }
         }
         int newStackSize = copy.size() - localsSize;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FullInfopointNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FullInfopointNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,10 +22,10 @@
  */
 package com.oracle.graal.nodes;
 
-import com.oracle.graal.api.code.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.code.*;
 
 /**
  * Nodes of this type are inserted into the graph to denote points of interest to debugging.
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GraphDecoder.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GraphDecoder.java	Thu May 28 21:11:28 2015 -0700
@@ -22,16 +22,16 @@
  */
 package com.oracle.graal.nodes;
 
-import static com.oracle.graal.compiler.common.GraalInternalError.*;
+import static com.oracle.jvmci.common.JVMCIError.*;
 
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.util.*;
-import com.oracle.graal.debug.*;
 import com.oracle.graal.graph.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * Decoder for {@link EncodedGraph encoded graphs} produced by {@link GraphEncoder}. Support for
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GraphEncoder.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GraphEncoder.java	Thu May 28 21:11:28 2015 -0700
@@ -24,14 +24,14 @@
 
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
 import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.util.*;
-import com.oracle.graal.debug.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.iterators.*;
 import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions;
 import com.oracle.graal.nodes.java.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.debug.*;
 
 /**
  * Encodes a {@link StructuredGraph} to a compact byte[] array. All nodes of the graph and edges
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,12 +22,12 @@
  */
 package com.oracle.graal.nodes;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.extended.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * A guard is a node that deoptimizes based on a conditional expression. Guards are not attached to
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardedValueNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardedValueNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,13 +22,13 @@
  */
 package com.oracle.graal.nodes;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.extended.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * A node that changes the type of its input, usually narrowing it. For example, a GuardedValueNode
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardingPiNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardingPiNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,6 @@
  */
 package com.oracle.graal.nodes;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
@@ -31,6 +30,7 @@
 import com.oracle.graal.nodes.extended.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.type.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * A node that changes the stamp of its input based on some condition being true.
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/IfNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/IfNode.java	Thu May 28 21:11:28 2015 -0700
@@ -24,12 +24,9 @@
 
 import java.util.*;
 
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.api.meta.JavaTypeProfile.ProfiledType;
 import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.calc.*;
 import com.oracle.graal.compiler.common.type.*;
-import com.oracle.graal.debug.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.iterators.*;
 import com.oracle.graal.graph.spi.*;
@@ -38,6 +35,10 @@
 import com.oracle.graal.nodes.java.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.util.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.meta.*;
+import com.oracle.jvmci.meta.JavaTypeProfile.ProfiledType;
 
 /**
  * The {@code IfNode} represents a branch that can go one of two directions depending on the outcome
@@ -1020,7 +1021,7 @@
                         return;
                     }
                 } else {
-                    throw new GraalInternalError("Illegal state");
+                    throw new JVMCIError("Illegal state");
                 }
             } else if (node instanceof AbstractMergeNode && !(node instanceof LoopBeginNode)) {
                 for (AbstractEndNode endNode : ((AbstractMergeNode) node).cfgPredecessors()) {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/IndirectCallTargetNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/IndirectCallTargetNode.java	Thu May 28 21:11:28 2015 -0700
@@ -24,11 +24,11 @@
 
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodeinfo.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.meta.*;
 
 @NodeInfo
 public class IndirectCallTargetNode extends LoweredCallTargetNode {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/InfopointNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/InfopointNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,10 +22,10 @@
  */
 package com.oracle.graal.nodes;
 
-import com.oracle.graal.api.code.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodeinfo.*;
+import com.oracle.jvmci.code.*;
 
 @NodeInfo
 public abstract class InfopointNode extends FixedWithNextNode {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/Invoke.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/Invoke.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,6 @@
  */
 package com.oracle.graal.nodes;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.CallTargetNode.InvokeKind;
@@ -30,6 +29,7 @@
 import com.oracle.graal.nodes.java.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.type.*;
+import com.oracle.jvmci.meta.*;
 
 public interface Invoke extends StateSplit, Lowerable, DeoptimizingNode.DeoptDuring, GuardedNode, UncheckedInterfaceProvider {
 
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/InvokeNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/InvokeNode.java	Thu May 28 21:11:28 2015 -0700
@@ -24,7 +24,6 @@
 
 import java.util.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodeinfo.*;
@@ -33,6 +32,7 @@
 import com.oracle.graal.nodes.memory.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.util.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * The {@code InvokeNode} represents all kinds of method calls.
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/InvokeWithExceptionNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/InvokeWithExceptionNode.java	Thu May 28 21:11:28 2015 -0700
@@ -24,7 +24,6 @@
 
 import java.util.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.extended.*;
@@ -32,6 +31,7 @@
 import com.oracle.graal.nodes.memory.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.util.*;
+import com.oracle.jvmci.meta.*;
 
 @NodeInfo(nameTemplate = "Invoke!#{p#targetMethod/s}", allowedUsageTypes = {InputType.Memory})
 public final class InvokeWithExceptionNode extends ControlSplitNode implements Invoke, MemoryCheckpoint.Single, LIRLowerable {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/KillingBeginNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/KillingBeginNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,10 +22,10 @@
  */
 package com.oracle.graal.nodes;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.memory.*;
+import com.oracle.jvmci.meta.*;
 
 @NodeInfo(allowedUsageTypes = {InputType.Memory})
 public final class KillingBeginNode extends AbstractBeginNode implements MemoryCheckpoint.Single {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/LoweredCallTargetNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/LoweredCallTargetNode.java	Thu May 28 21:11:28 2015 -0700
@@ -24,11 +24,11 @@
 
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodeinfo.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.meta.*;
 
 @NodeInfo
 public abstract class LoweredCallTargetNode extends CallTargetNode {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ParameterNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ParameterNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,11 +22,11 @@
  */
 package com.oracle.graal.nodes;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * The {@code Parameter} instruction is a placeholder for an incoming argument to a function call.
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/PhiNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/PhiNode.java	Thu May 28 21:11:28 2015 -0700
@@ -24,12 +24,12 @@
 
 import java.util.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.calc.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * {@code PhiNode}s represent the merging of edges at a control flow merges (
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/PiNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/PiNode.java	Thu May 28 21:11:28 2015 -0700
@@ -24,7 +24,6 @@
 
 //JaCoCo Exclude
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
@@ -32,6 +31,7 @@
 import com.oracle.graal.nodes.extended.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.type.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * A node that changes the type of its input, usually narrowing it. For example, a {@link PiNode}
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/SimpleInfopointNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/SimpleInfopointNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,11 +22,11 @@
  */
 package com.oracle.graal.nodes;
 
-import com.oracle.graal.api.code.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.code.*;
 
 @NodeInfo
 public final class SimpleInfopointNode extends InfopointNode implements LIRLowerable, IterableNodeType, Simplifiable {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/SimplifyingGraphDecoder.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/SimplifyingGraphDecoder.java	Thu May 28 21:11:28 2015 -0700
@@ -24,13 +24,13 @@
 
 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.spi.*;
 import com.oracle.graal.nodes.extended.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.util.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * Graph decoder that simplifies nodes during decoding. The standard
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/StartNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/StartNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,10 +22,10 @@
  */
 package com.oracle.graal.nodes;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.memory.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * The start node of a graph.
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/StructuredGraph.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/StructuredGraph.java	Thu May 28 21:11:28 2015 -0700
@@ -26,14 +26,14 @@
 import java.util.concurrent.atomic.*;
 import java.util.function.*;
 
-import com.oracle.graal.api.meta.Assumptions.Assumption;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
 import com.oracle.graal.nodes.calc.*;
 import com.oracle.graal.nodes.java.*;
 import com.oracle.graal.nodes.util.*;
+import com.oracle.jvmci.meta.*;
+import com.oracle.jvmci.meta.Assumptions.Assumption;
 
 /**
  * A graph that contains at least one distinguished node : the {@link #start() start} node. This
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/TypeProfileProxyNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/TypeProfileProxyNode.java	Thu May 28 21:11:28 2015 -0700
@@ -24,15 +24,15 @@
 
 import java.util.*;
 
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.api.meta.Assumptions.AssumptionResult;
-import com.oracle.graal.debug.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.calc.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.type.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.meta.Assumptions.AssumptionResult;
+import com.oracle.jvmci.meta.*;
 
 /**
  * A node that attaches a type profile to a proxied input node.
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/UnaryOpLogicNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/UnaryOpLogicNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,12 +22,12 @@
  */
 package com.oracle.graal.nodes;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.meta.*;
 
 @NodeInfo
 public abstract class UnaryOpLogicNode extends LogicNode implements LIRLowerable, Canonicalizable.Unary<ValueNode> {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/UnwindNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/UnwindNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,11 +22,11 @@
  */
 package com.oracle.graal.nodes;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * Unwinds the current frame to an exception handler in the caller frame.
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ValueNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ValueNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,11 +22,11 @@
  */
 package com.oracle.graal.nodes;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.iterators.*;
 import com.oracle.graal.nodeinfo.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * This class represents a value within the graph, including local variables, phis, and all other
@@ -101,7 +101,11 @@
         return this instanceof ConstantNode;
     }
 
-    private static final NodePredicate IS_CONSTANT = node -> node instanceof ConstantNode;
+    private static final NodePredicate IS_CONSTANT = new NodePredicate() {
+        public boolean apply(Node n) {
+            return n instanceof ConstantNode;
+        }
+    };
 
     public static NodePredicate isConstantPredicate() {
         return IS_CONSTANT;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ValueNodeUtil.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ValueNodeUtil.java	Thu May 28 21:11:28 2015 -0700
@@ -24,10 +24,10 @@
 
 import java.util.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.memory.*;
+import com.oracle.jvmci.meta.*;
 
 public class ValueNodeUtil {
 
@@ -86,7 +86,7 @@
 
     /**
      * Converts a given instruction to a value string. The representation of an node as a value is
-     * formed by concatenating the {@linkplain com.oracle.graal.api.meta.Kind#getTypeChar character}
+     * formed by concatenating the {@linkplain com.oracle.jvmci.meta.Kind#getTypeChar character}
      * denoting its {@linkplain ValueNode#getKind kind} and its id. For example, {@code "i13"}.
      *
      * @param value the instruction to convert to a value string. If {@code value == null}, then "-"
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/AddNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/AddNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,6 @@
  */
 package com.oracle.graal.nodes.calc;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.compiler.common.type.ArithmeticOpTable.BinaryOp;
 import com.oracle.graal.compiler.common.type.ArithmeticOpTable.BinaryOp.Add;
@@ -33,6 +32,7 @@
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.meta.*;
 
 @NodeInfo(shortName = "+")
 public class AddNode extends BinaryArithmeticNode<Add> implements NarrowableArithmeticNode, BinaryCommutative<ValueNode> {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/AndNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/AndNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,8 +22,6 @@
  */
 package com.oracle.graal.nodes.calc;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.compiler.common.type.ArithmeticOpTable.BinaryOp;
 import com.oracle.graal.compiler.common.type.ArithmeticOpTable.BinaryOp.And;
@@ -35,6 +33,8 @@
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.util.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.meta.*;
 
 @NodeInfo(shortName = "&")
 public final class AndNode extends BinaryArithmeticNode<And> implements NarrowableArithmeticNode, BinaryCommutative<ValueNode> {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/BinaryArithmeticNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/BinaryArithmeticNode.java	Thu May 28 21:11:28 2015 -0700
@@ -25,16 +25,16 @@
 import java.io.*;
 import java.util.function.*;
 
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.type.*;
-import com.oracle.graal.compiler.common.type.ArithmeticOpTable.*;
+import com.oracle.graal.compiler.common.type.ArithmeticOpTable.BinaryOp;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.iterators.*;
 import com.oracle.graal.graph.spi.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.meta.*;
 
 @NodeInfo
 public abstract class BinaryArithmeticNode<OP> extends BinaryNode implements ArithmeticLIRLowerable, Canonicalizable.Binary<ValueNode> {
@@ -118,7 +118,7 @@
                 case y:
                     return binary.getY();
                 default:
-                    throw GraalInternalError.shouldNotReachHere();
+                    throw JVMCIError.shouldNotReachHere();
             }
         }
 
@@ -129,7 +129,7 @@
                 case y:
                     return binary.getX();
                 default:
-                    throw GraalInternalError.shouldNotReachHere();
+                    throw JVMCIError.shouldNotReachHere();
             }
         }
     }
@@ -240,7 +240,7 @@
         } else if (node instanceof XorNode) {
             return new XorNode(a, new XorNode(m1, m2));
         } else {
-            throw GraalInternalError.shouldNotReachHere();
+            throw JVMCIError.shouldNotReachHere();
         }
     }
 
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/CompareNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/CompareNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,14 +22,14 @@
  */
 package com.oracle.graal.nodes.calc;
 
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.calc.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.meta.*;
 
 /* 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)
@@ -99,7 +99,7 @@
     }
 
     protected ValueNode optimizeNormalizeCmp(Constant constant, NormalizeCompareNode normalizeNode, boolean mirrored) {
-        throw new GraalInternalError("NormalizeCompareNode connected to %s (%s %s %s)", this, constant, normalizeNode, mirrored);
+        throw new JVMCIError("NormalizeCompareNode connected to %s (%s %s %s)", this, constant, normalizeNode, mirrored);
     }
 
     @Override
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ConditionalNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ConditionalNode.java	Thu May 28 21:11:28 2015 -0700
@@ -24,7 +24,6 @@
 
 import static com.oracle.graal.nodes.calc.CompareNode.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.calc.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
@@ -32,6 +31,7 @@
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * The {@code ConditionalNode} class represents a comparison that yields one of two values. Note
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ConvertNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ConvertNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,11 +22,11 @@
  */
 package com.oracle.graal.nodes.calc;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.calc.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * Represents a conversion between primitive types.
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/DivNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/DivNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,17 +22,17 @@
  */
 package com.oracle.graal.nodes.calc;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
-import com.oracle.graal.compiler.common.type.ArithmeticOpTable.*;
-import com.oracle.graal.compiler.common.type.ArithmeticOpTable.BinaryOp.*;
+import com.oracle.graal.compiler.common.type.ArithmeticOpTable.BinaryOp;
+import com.oracle.graal.compiler.common.type.ArithmeticOpTable.BinaryOp.Div;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
 import com.oracle.graal.lir.gen.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.meta.*;
 
 @NodeInfo(shortName = "/")
 public final class DivNode extends BinaryArithmeticNode<Div> {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FloatConvertNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FloatConvertNode.java	Thu May 28 21:11:28 2015 -0700
@@ -24,7 +24,6 @@
 
 import java.util.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.calc.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.compiler.common.type.ArithmeticOpTable.FloatConvertOp;
@@ -34,6 +33,7 @@
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * A {@code FloatConvert} converts between integers and floating point numbers according to Java
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FloatEqualsNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FloatEqualsNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,8 +22,6 @@
  */
 package com.oracle.graal.nodes.calc;
 
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.calc.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
@@ -32,6 +30,8 @@
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.util.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.meta.*;
 
 @NodeInfo(shortName = "==")
 public final class FloatEqualsNode extends CompareNode implements BinaryCommutative<ValueNode> {
@@ -79,7 +79,7 @@
         } else if (newX.stamp() instanceof IntegerStamp && newY.stamp() instanceof IntegerStamp) {
             return new IntegerEqualsNode(newX, newY);
         }
-        throw GraalInternalError.shouldNotReachHere();
+        throw JVMCIError.shouldNotReachHere();
     }
 
     @Override
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FloatLessThanNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FloatLessThanNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,8 +22,6 @@
  */
 package com.oracle.graal.nodes.calc;
 
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.calc.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
@@ -31,6 +29,8 @@
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.util.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.meta.*;
 
 @NodeInfo(shortName = "<")
 public final class FloatLessThanNode extends CompareNode {
@@ -70,7 +70,7 @@
         } else if (newX.stamp() instanceof IntegerStamp && newY.stamp() instanceof IntegerStamp) {
             return new IntegerLessThanNode(newX, newY);
         }
-        throw GraalInternalError.shouldNotReachHere();
+        throw JVMCIError.shouldNotReachHere();
     }
 
     @Override
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerBelowNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerBelowNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,8 +22,6 @@
  */
 package com.oracle.graal.nodes.calc;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.calc.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
@@ -31,6 +29,8 @@
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.util.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.meta.*;
 
 @NodeInfo(shortName = "|<|")
 public final class IntegerBelowNode extends CompareNode {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerConvertNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerConvertNode.java	Thu May 28 21:11:28 2015 -0700
@@ -25,14 +25,14 @@
 import java.io.*;
 import java.util.function.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
-import com.oracle.graal.compiler.common.type.ArithmeticOpTable.*;
+import com.oracle.graal.compiler.common.type.ArithmeticOpTable.IntegerConvertOp;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * An {@code IntegerConvert} converts an integer to an integer of different width.
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerDivNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerDivNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,13 +22,13 @@
  */
 package com.oracle.graal.nodes.calc;
 
-import com.oracle.graal.api.code.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.code.*;
 
 @NodeInfo(shortName = "/")
 public class IntegerDivNode extends FixedBinaryNode implements Lowerable, LIRLowerable {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerEqualsNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerEqualsNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,8 +22,6 @@
  */
 package com.oracle.graal.nodes.calc;
 
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.calc.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
@@ -32,6 +30,8 @@
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.util.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.meta.*;
 
 @NodeInfo(shortName = "==")
 public final class IntegerEqualsNode extends CompareNode implements BinaryCommutative<ValueNode> {
@@ -95,7 +95,7 @@
         } else if (newX.stamp() instanceof AbstractPointerStamp && newY.stamp() instanceof AbstractPointerStamp) {
             return new IntegerEqualsNode(newX, newY);
         }
-        throw GraalInternalError.shouldNotReachHere();
+        throw JVMCIError.shouldNotReachHere();
     }
 
     @Override
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerLessThanNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerLessThanNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,9 +22,6 @@
  */
 package com.oracle.graal.nodes.calc;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.calc.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
@@ -32,6 +29,9 @@
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.util.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.meta.*;
 
 @NodeInfo(shortName = "<")
 public final class IntegerLessThanNode extends CompareNode {
@@ -113,7 +113,7 @@
         } else if (newX.stamp() instanceof IntegerStamp && newY.stamp() instanceof IntegerStamp) {
             return new IntegerLessThanNode(newX, newY);
         }
-        throw GraalInternalError.shouldNotReachHere();
+        throw JVMCIError.shouldNotReachHere();
     }
 
     @Override
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerRemNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerRemNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,13 +22,13 @@
  */
 package com.oracle.graal.nodes.calc;
 
-import com.oracle.graal.api.code.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.code.*;
 
 @NodeInfo(shortName = "%")
 public class IntegerRemNode extends FixedBinaryNode implements Lowerable, LIRLowerable {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerTestNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerTestNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,13 +22,13 @@
  */
 package com.oracle.graal.nodes.calc;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.Canonicalizable.BinaryCommutative;
 import com.oracle.graal.graph.spi.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * This node will perform a "test" operation on its arguments. Its result is equivalent to the
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IsNullNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IsNullNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,6 @@
  */
 package com.oracle.graal.nodes.calc;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
@@ -30,6 +29,7 @@
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.type.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * An IsNullNode will be true if the supplied value is null, and false if it is non-null.
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/LeftShiftNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/LeftShiftNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,6 @@
  */
 package com.oracle.graal.nodes.calc;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.compiler.common.type.ArithmeticOpTable.ShiftOp.Shl;
 import com.oracle.graal.graph.*;
@@ -31,6 +30,7 @@
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.meta.*;
 
 @NodeInfo(shortName = "<<")
 public final class LeftShiftNode extends ShiftNode<Shl> {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/MulNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/MulNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,8 +22,6 @@
  */
 package com.oracle.graal.nodes.calc;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.compiler.common.type.ArithmeticOpTable.BinaryOp;
 import com.oracle.graal.compiler.common.type.ArithmeticOpTable.BinaryOp.Mul;
@@ -34,6 +32,8 @@
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.meta.*;
 
 @NodeInfo(shortName = "*")
 public class MulNode extends BinaryArithmeticNode<Mul> implements NarrowableArithmeticNode, BinaryCommutative<ValueNode> {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/NarrowNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/NarrowNode.java	Thu May 28 21:11:28 2015 -0700
@@ -23,7 +23,7 @@
 package com.oracle.graal.nodes.calc;
 
 import com.oracle.graal.compiler.common.type.*;
-import com.oracle.graal.compiler.common.type.ArithmeticOpTable.*;
+import com.oracle.graal.compiler.common.type.ArithmeticOpTable.IntegerConvertOp;
 import com.oracle.graal.compiler.common.type.ArithmeticOpTable.IntegerConvertOp.Narrow;
 import com.oracle.graal.compiler.common.type.ArithmeticOpTable.IntegerConvertOp.SignExtend;
 import com.oracle.graal.graph.*;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/NormalizeCompareNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/NormalizeCompareNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,6 @@
  */
 package com.oracle.graal.nodes.calc;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.calc.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
@@ -30,6 +29,7 @@
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * Returns -1, 0, or 1 if either x &lt; y, x == y, or x &gt; y. If the comparison is undecided (one
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ObjectEqualsNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ObjectEqualsNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,8 +22,6 @@
  */
 package com.oracle.graal.nodes.calc;
 
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.calc.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
@@ -33,6 +31,8 @@
 import com.oracle.graal.nodes.extended.*;
 import com.oracle.graal.nodes.java.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.meta.*;
 
 @NodeInfo(shortName = "==")
 public final class ObjectEqualsNode extends PointerEqualsNode implements Virtualizable {
@@ -139,6 +139,6 @@
         } else if (newX.stamp() instanceof AbstractPointerStamp && newY.stamp() instanceof AbstractPointerStamp) {
             return new PointerEqualsNode(newX, newY);
         }
-        throw GraalInternalError.shouldNotReachHere();
+        throw JVMCIError.shouldNotReachHere();
     }
 }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/OrNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/OrNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,8 +22,6 @@
  */
 package com.oracle.graal.nodes.calc;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.compiler.common.type.ArithmeticOpTable.BinaryOp;
 import com.oracle.graal.compiler.common.type.ArithmeticOpTable.BinaryOp.Or;
@@ -35,6 +33,8 @@
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.util.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.meta.*;
 
 @NodeInfo(shortName = "|")
 public final class OrNode extends BinaryArithmeticNode<Or> implements BinaryCommutative<ValueNode>, NarrowableArithmeticNode {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/PointerEqualsNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/PointerEqualsNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,6 @@
  */
 package com.oracle.graal.nodes.calc;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.calc.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
@@ -31,6 +30,7 @@
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.util.*;
+import com.oracle.jvmci.meta.*;
 
 @NodeInfo(shortName = "==")
 public class PointerEqualsNode extends CompareNode implements BinaryCommutative<ValueNode> {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ReinterpretNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ReinterpretNode.java	Thu May 28 21:11:28 2015 -0700
@@ -24,7 +24,6 @@
 
 import java.nio.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
@@ -32,6 +31,7 @@
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * The {@code ReinterpretNode} class represents a reinterpreting conversion that changes the stamp
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/RightShiftNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/RightShiftNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,6 @@
  */
 package com.oracle.graal.nodes.calc;
 
-import com.oracle.graal.api.code.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.compiler.common.type.ArithmeticOpTable.ShiftOp.Shr;
 import com.oracle.graal.graph.*;
@@ -31,6 +30,7 @@
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.code.*;
 
 @NodeInfo(shortName = ">>")
 public final class RightShiftNode extends ShiftNode<Shr> {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ShiftNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ShiftNode.java	Thu May 28 21:11:28 2015 -0700
@@ -25,8 +25,6 @@
 import java.io.*;
 import java.util.function.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.compiler.common.type.ArithmeticOpTable.ShiftOp;
 import com.oracle.graal.graph.*;
@@ -34,6 +32,8 @@
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * The {@code ShiftOp} class represents shift operations.
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/SubNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/SubNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,10 +22,9 @@
  */
 package com.oracle.graal.nodes.calc;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.compiler.common.type.ArithmeticOpTable.BinaryOp;
-import com.oracle.graal.compiler.common.type.ArithmeticOpTable.BinaryOp.*;
+import com.oracle.graal.compiler.common.type.ArithmeticOpTable.BinaryOp.Sub;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
 import com.oracle.graal.lir.gen.*;
@@ -33,6 +32,7 @@
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.util.*;
+import com.oracle.jvmci.meta.*;
 
 @NodeInfo(shortName = "-")
 public class SubNode extends BinaryArithmeticNode<Sub> implements NarrowableArithmeticNode {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/UnsignedDivNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/UnsignedDivNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,13 +22,13 @@
  */
 package com.oracle.graal.nodes.calc;
 
-import com.oracle.graal.api.code.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.code.*;
 
 @NodeInfo(shortName = "|/|")
 public class UnsignedDivNode extends FixedBinaryNode implements Lowerable, LIRLowerable {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/UnsignedRemNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/UnsignedRemNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,13 +22,13 @@
  */
 package com.oracle.graal.nodes.calc;
 
-import com.oracle.graal.api.code.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.code.*;
 
 @NodeInfo(shortName = "|%|")
 public class UnsignedRemNode extends FixedBinaryNode implements Lowerable, LIRLowerable {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/UnsignedRightShiftNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/UnsignedRightShiftNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,6 @@
  */
 package com.oracle.graal.nodes.calc;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.compiler.common.type.ArithmeticOpTable.ShiftOp.UShr;
 import com.oracle.graal.graph.*;
@@ -31,6 +30,7 @@
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.meta.*;
 
 @NodeInfo(shortName = ">>>")
 public final class UnsignedRightShiftNode extends ShiftNode<UShr> {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/XorNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/XorNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,8 +22,6 @@
  */
 package com.oracle.graal.nodes.calc;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.compiler.common.type.ArithmeticOpTable.BinaryOp;
 import com.oracle.graal.compiler.common.type.ArithmeticOpTable.BinaryOp.Xor;
@@ -35,6 +33,8 @@
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.util.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.meta.*;
 
 @NodeInfo(shortName = "^")
 public final class XorNode extends BinaryArithmeticNode<Xor> implements BinaryCommutative<ValueNode>, NarrowableArithmeticNode {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ZeroExtendNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ZeroExtendNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,17 +22,18 @@
  */
 package com.oracle.graal.nodes.calc;
 
-import com.oracle.graal.api.code.*;
 import com.oracle.graal.compiler.common.calc.*;
 import com.oracle.graal.compiler.common.type.*;
-import com.oracle.graal.compiler.common.type.ArithmeticOpTable.*;
-import com.oracle.graal.compiler.common.type.ArithmeticOpTable.IntegerConvertOp.*;
+import com.oracle.graal.compiler.common.type.ArithmeticOpTable.IntegerConvertOp;
+import com.oracle.graal.compiler.common.type.ArithmeticOpTable.IntegerConvertOp.Narrow;
+import com.oracle.graal.compiler.common.type.ArithmeticOpTable.IntegerConvertOp.ZeroExtend;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
 import com.oracle.graal.lir.gen.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.code.*;
 
 /**
  * The {@code ZeroExtendNode} converts an integer to a wider integer using zero extension.
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/cfg/Block.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/cfg/Block.java	Thu May 28 21:11:28 2015 -0700
@@ -24,11 +24,11 @@
 
 import java.util.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.cfg.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.memory.*;
+import com.oracle.jvmci.meta.*;
 
 public final class Block extends AbstractBlockBase<Block> {
 
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/cfg/ControlFlowGraph.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/cfg/ControlFlowGraph.java	Thu May 28 21:11:28 2015 -0700
@@ -24,11 +24,11 @@
 
 import java.util.*;
 
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.cfg.*;
-import com.oracle.graal.debug.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.debug.*;
 
 public class ControlFlowGraph implements AbstractControlFlowGraph<Block> {
     /**
@@ -193,7 +193,7 @@
                 stack.remove(stack.size() - 1);
                 postOrder.add(block);
             } else {
-                throw GraalInternalError.shouldNotReachHere();
+                throw JVMCIError.shouldNotReachHere();
             }
         } while (!stack.isEmpty());
 
@@ -348,7 +348,7 @@
                     c = c.parent;
                 }
             } else {
-                GraalInternalError.shouldNotReachHere();
+                JVMCIError.shouldNotReachHere();
             }
             state = nextState;
         }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/cfg/HIRLoop.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/cfg/HIRLoop.java	Thu May 28 21:11:28 2015 -0700
@@ -22,9 +22,9 @@
  */
 package com.oracle.graal.nodes.cfg;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.cfg.*;
 import com.oracle.graal.nodes.*;
+import com.oracle.jvmci.meta.*;
 
 public final class HIRLoop extends Loop<Block> {
 
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/cfg/LocationSet.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/cfg/LocationSet.java	Thu May 28 21:11:28 2015 -0700
@@ -24,7 +24,7 @@
 
 import java.util.*;
 
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.meta.*;
 
 public class LocationSet {
     private LocationIdentity firstLocation;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/debug/DynamicCounterNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/debug/DynamicCounterNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,6 @@
  */
 package com.oracle.graal.nodes.debug;
 
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.lir.*;
@@ -30,6 +29,7 @@
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.common.*;
 
 /**
  * This node can be used to add a counter to the code that will estimate the dynamic number of calls
@@ -109,7 +109,7 @@
         if (counterOp != null) {
             lirGen.append(counterOp);
         } else {
-            throw GraalInternalError.unimplemented("Benchmark counters not enabled or not implemented by the back end.");
+            throw JVMCIError.unimplemented("Benchmark counters not enabled or not implemented by the back end.");
         }
     }
 
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/AddLocationNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/AddLocationNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,6 @@
  */
 package com.oracle.graal.nodes.extended;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
@@ -31,6 +30,7 @@
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.calc.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * Location node that is the sum of two other location nodes. Can represent locations in the form of
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/BoxNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/BoxNode.java	Thu May 28 21:11:28 2015 -0700
@@ -24,7 +24,6 @@
 
 import java.util.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
@@ -35,6 +34,7 @@
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.type.*;
 import com.oracle.graal.nodes.virtual.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * This node represents the boxing of a primitive value. This corresponds to a call to the valueOf
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/BranchProbabilityNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/BranchProbabilityNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,6 @@
  */
 package com.oracle.graal.nodes.extended;
 
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.calc.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
@@ -30,6 +29,7 @@
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.calc.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.common.*;
 
 /**
  * Instances of this node class will look for a preceding if node and put the given probability into
@@ -74,9 +74,9 @@
         if (probability.isConstant()) {
             double probabilityValue = probability.asJavaConstant().asDouble();
             if (probabilityValue < 0.0) {
-                throw new GraalInternalError("A negative probability of " + probabilityValue + " is not allowed!");
+                throw new JVMCIError("A negative probability of " + probabilityValue + " is not allowed!");
             } else if (probabilityValue > 1.0) {
-                throw new GraalInternalError("A probability of more than 1.0 (" + probabilityValue + ") is not allowed!");
+                throw new JVMCIError("A probability of more than 1.0 (" + probabilityValue + ") is not allowed!");
             } else if (Double.isNaN(probabilityValue)) {
                 /*
                  * We allow NaN if the node is in unreachable code that will eventually fall away,
@@ -115,7 +115,7 @@
                 }
             } else {
                 if (!isSubstitutionGraph()) {
-                    throw new GraalInternalError("Wrong usage of branch probability injection!");
+                    throw new JVMCIError("Wrong usage of branch probability injection!");
                 }
             }
         }
@@ -141,6 +141,6 @@
 
     @Override
     public void lower(LoweringTool tool) {
-        throw new GraalInternalError("Branch probability could not be injected, because the probability value did not reduce to a constant value.");
+        throw new JVMCIError("Branch probability could not be injected, because the probability value did not reduce to a constant value.");
     }
 }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/BytecodeExceptionNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/BytecodeExceptionNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,13 +22,13 @@
  */
 package com.oracle.graal.nodes.extended;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.memory.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * A node that represents an exception thrown implicitly by a Java bytecode. It can be lowered to
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ComputeAddressNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ComputeAddressNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,13 +22,13 @@
  */
 package com.oracle.graal.nodes.extended;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.calc.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.meta.*;
 
 @NodeInfo
 public final class ComputeAddressNode extends FloatingNode implements LIRLowerable {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ConstantLocationNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ConstantLocationNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,12 +22,12 @@
  */
 package com.oracle.graal.nodes.extended;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.lir.gen.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * Location node that has a constant displacement. Can represent addresses of the form [base + disp]
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ForeignCallNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ForeignCallNode.java	Thu May 28 21:11:28 2015 -0700
@@ -24,14 +24,14 @@
 
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.memory.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * Node for a {@linkplain ForeignCallDescriptor foreign} call.
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/GetClassNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/GetClassNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,8 +22,6 @@
  */
 package com.oracle.graal.nodes.extended;
 
-import com.oracle.graal.api.meta.Assumptions.AssumptionResult;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
@@ -31,6 +29,8 @@
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.calc.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.meta.Assumptions.AssumptionResult;
+import com.oracle.jvmci.meta.*;
 
 /**
  * Loads an object's class (i.e., this node can be created for {@code object.getClass()}).
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/IndexedLocationNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/IndexedLocationNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,8 +22,6 @@
  */
 package com.oracle.graal.nodes.extended;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
@@ -31,6 +29,8 @@
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * Location node that has a displacement and a scaled index. Can represent locations in the form of
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/IntegerSwitchNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/IntegerSwitchNode.java	Thu May 28 21:11:28 2015 -0700
@@ -24,7 +24,6 @@
 
 import java.util.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
@@ -32,6 +31,7 @@
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.util.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * The {@code IntegerSwitchNode} represents a switch on integer keys, with a sorted array of key
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/JavaReadNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/JavaReadNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,6 @@
  */
 package com.oracle.graal.nodes.extended;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
@@ -30,6 +29,7 @@
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.memory.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * Read a raw memory location according to Java field or array read semantics. It will perform read
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/JavaWriteNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/JavaWriteNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,12 +22,12 @@
  */
 package com.oracle.graal.nodes.extended;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.memory.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * Write a raw memory location according to Java field or array write semantics. It will perform
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/LoadHubNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/LoadHubNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,14 +22,14 @@
  */
 package com.oracle.graal.nodes.extended;
 
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.api.meta.Assumptions.AssumptionResult;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.meta.Assumptions.AssumptionResult;
+import com.oracle.jvmci.meta.*;
 
 /**
  * Loads an object's hub. The object is not null-checked by this operation.
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/LoadMethodNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/LoadMethodNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,8 +22,6 @@
  */
 package com.oracle.graal.nodes.extended;
 
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.api.meta.Assumptions.AssumptionResult;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
@@ -31,6 +29,8 @@
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.type.*;
+import com.oracle.jvmci.meta.*;
+import com.oracle.jvmci.meta.Assumptions.AssumptionResult;
 
 /**
  * Loads a method from the virtual method table of a given hub.
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/LocationNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/LocationNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,14 +22,14 @@
  */
 package com.oracle.graal.nodes.extended;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
+import com.oracle.graal.graph.Node.ValueNumberable;
 import com.oracle.graal.graph.*;
-import com.oracle.graal.graph.Node.ValueNumberable;
 import com.oracle.graal.lir.gen.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.calc.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * A location for a memory access in terms of the kind of value accessed and how to access it. All
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/MembarNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/MembarNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,13 +22,13 @@
  */
 package com.oracle.graal.nodes.extended;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.memory.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * Creates a memory barrier.
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/SwitchNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/SwitchNode.java	Thu May 28 21:11:28 2015 -0700
@@ -24,12 +24,12 @@
 
 import java.util.*;
 
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * The {@code SwitchNode} class is the base of both lookup and table switches.
@@ -155,7 +155,7 @@
      */
     public AbstractBeginNode defaultSuccessor() {
         if (defaultSuccessorIndex() == -1) {
-            throw new GraalInternalError("unexpected");
+            throw new JVMCIError("unexpected");
         }
         return successors.get(defaultSuccessorIndex());
     }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnboxNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnboxNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,6 @@
  */
 package com.oracle.graal.nodes.extended;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
@@ -30,6 +29,7 @@
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.type.*;
+import com.oracle.jvmci.meta.*;
 
 @NodeInfo
 public final class UnboxNode extends FixedWithNextNode implements Virtualizable, Lowerable, Canonicalizable.Unary<ValueNode> {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeAccessNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeAccessNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,13 +22,13 @@
  */
 package com.oracle.graal.nodes.extended;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.type.*;
+import com.oracle.jvmci.meta.*;
 
 @NodeInfo
 public abstract class UnsafeAccessNode extends FixedWithNextNode implements Canonicalizable {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeCastNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeCastNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,6 @@
  */
 package com.oracle.graal.nodes.extended;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
@@ -30,6 +29,7 @@
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.type.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * The {@code UnsafeCastNode} produces the same value as its input, but with a different type. It
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeCopyNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeCopyNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,11 +22,11 @@
  */
 package com.oracle.graal.nodes.extended;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * Copy a value at a location specified as an offset relative to a source object to another location
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeLoadNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeLoadNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,13 +22,13 @@
  */
 package com.oracle.graal.nodes.extended;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.java.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * Load of a value from a location specified as an offset relative to an object. No null check is
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeStoreNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeStoreNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,6 @@
  */
 package com.oracle.graal.nodes.extended;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodeinfo.*;
@@ -30,6 +29,7 @@
 import com.oracle.graal.nodes.java.*;
 import com.oracle.graal.nodes.memory.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * Store of a value at a location specified as an offset relative to an object. No null check is
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AccessFieldNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AccessFieldNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,12 +22,12 @@
  */
 package com.oracle.graal.nodes.java;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * The base class of all instructions that access fields.
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AccessIndexedNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AccessIndexedNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,12 +22,12 @@
  */
 package com.oracle.graal.nodes.java;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * The {@code AccessIndexedNode} class is the base class of instructions that read or write elements
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AccessMonitorNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AccessMonitorNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,12 +22,12 @@
  */
 package com.oracle.graal.nodes.java;
 
-import com.oracle.graal.api.code.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.memory.*;
+import com.oracle.jvmci.code.*;
 
 /**
  * The {@code AccessMonitorNode} is the base class of both monitor acquisition and release.
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/ArrayLengthNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/ArrayLengthNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,6 @@
  */
 package com.oracle.graal.nodes.java;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
@@ -30,6 +29,7 @@
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.util.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * The {@code ArrayLength} instruction gets the length of an array.
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AtomicReadAndAddNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AtomicReadAndAddNode.java	Thu May 28 21:11:28 2015 -0700
@@ -24,7 +24,6 @@
 
 import sun.misc.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodeinfo.*;
@@ -32,6 +31,7 @@
 import com.oracle.graal.nodes.extended.*;
 import com.oracle.graal.nodes.memory.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * Represents an atomic read-and-add operation like {@link Unsafe#getAndAddInt(Object, long, int)}.
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AtomicReadAndWriteNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AtomicReadAndWriteNode.java	Thu May 28 21:11:28 2015 -0700
@@ -24,13 +24,13 @@
 
 import sun.misc.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.memory.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * Represents an atomic read-and-write operation like {@link Unsafe#getAndSetInt(Object, long, int)}
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CheckCastDynamicNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CheckCastDynamicNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,13 +22,13 @@
  */
 package com.oracle.graal.nodes.java;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.type.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * Implements a type check where the type being checked is loaded at runtime. This is used, for
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CheckCastNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CheckCastNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,12 +22,10 @@
  */
 package com.oracle.graal.nodes.java;
 
-import static com.oracle.graal.api.meta.DeoptimizationAction.*;
-import static com.oracle.graal.api.meta.DeoptimizationReason.*;
 import static com.oracle.graal.nodes.extended.BranchProbabilityNode.*;
+import static com.oracle.jvmci.meta.DeoptimizationAction.*;
+import static com.oracle.jvmci.meta.DeoptimizationReason.*;
 
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.api.meta.Assumptions.AssumptionResult;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
@@ -36,6 +34,8 @@
 import com.oracle.graal.nodes.calc.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.type.*;
+import com.oracle.jvmci.meta.*;
+import com.oracle.jvmci.meta.Assumptions.AssumptionResult;
 
 /**
  * Implements a type check against a compile-time known type.
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/ClassIsAssignableFromNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/ClassIsAssignableFromNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,12 +22,12 @@
  */
 package com.oracle.graal.nodes.java;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * The {@code ClassIsAssignableFromNode} represents a type check against {@link Class} instead of
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CompareAndSwapNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CompareAndSwapNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,13 +22,13 @@
  */
 package com.oracle.graal.nodes.java;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.memory.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * Represents an atomic compare-and-swap operation The result is a boolean that contains whether the
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/DynamicNewArrayNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/DynamicNewArrayNode.java	Thu May 28 21:11:28 2015 -0700
@@ -25,12 +25,12 @@
 
 import java.util.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * The {@code DynamicNewArrayNode} is used for allocation of arrays when the type is not a
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/DynamicNewInstanceNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/DynamicNewInstanceNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,12 +22,12 @@
  */
 package com.oracle.graal.nodes.java;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
+import com.oracle.jvmci.meta.*;
 
 @NodeInfo
 public final class DynamicNewInstanceNode extends AbstractNewObjectNode implements Canonicalizable {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/ExceptionObjectNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/ExceptionObjectNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,13 +22,13 @@
  */
 package com.oracle.graal.nodes.java;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.memory.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * The entry to an exception handler with the exception coming from a call (as opposed to a local
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/ForeignCallDescriptors.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/ForeignCallDescriptors.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,7 @@
  */
 package com.oracle.graal.nodes.java;
 
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * The foreign call descriptors used by nodes in this package.
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/InstanceOfDynamicNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/InstanceOfDynamicNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,12 +22,12 @@
  */
 package com.oracle.graal.nodes.java;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * The {@code InstanceOfDynamicNode} represents a type check where the type being checked is not
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/InstanceOfNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/InstanceOfNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,8 +22,6 @@
  */
 package com.oracle.graal.nodes.java;
 
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.api.meta.Assumptions.AssumptionResult;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
@@ -31,6 +29,8 @@
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.calc.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.meta.*;
+import com.oracle.jvmci.meta.Assumptions.AssumptionResult;
 
 /**
  * The {@code InstanceOfNode} represents an instanceof test.
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoadFieldNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoadFieldNode.java	Thu May 28 21:11:28 2015 -0700
@@ -24,7 +24,6 @@
 
 import static com.oracle.graal.graph.iterators.NodePredicates.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
@@ -33,6 +32,7 @@
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.type.*;
 import com.oracle.graal.nodes.virtual.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * The {@code LoadFieldNode} represents a read of a static or instance field.
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoadIndexedNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoadIndexedNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,6 @@
  */
 package com.oracle.graal.nodes.java;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
@@ -30,6 +29,7 @@
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.type.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * The {@code LoadIndexedNode} represents a read from an element of an array.
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoweredAtomicReadAndWriteNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoweredAtomicReadAndWriteNode.java	Thu May 28 21:11:28 2015 -0700
@@ -24,13 +24,13 @@
 
 import sun.misc.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.extended.*;
 import com.oracle.graal.nodes.memory.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * Represents the lowered version of an atomic read-and-write operation like
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoweredCompareAndSwapNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoweredCompareAndSwapNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,6 @@
  */
 package com.oracle.graal.nodes.java;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodeinfo.*;
@@ -30,6 +29,7 @@
 import com.oracle.graal.nodes.extended.*;
 import com.oracle.graal.nodes.memory.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * Represents the lowered version of an atomic compare-and-swap operation{@code CompareAndSwapNode}.
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MethodCallTargetNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MethodCallTargetNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,9 +22,6 @@
  */
 package com.oracle.graal.nodes.java;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.api.meta.Assumptions.AssumptionResult;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
@@ -32,6 +29,9 @@
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.type.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.meta.*;
+import com.oracle.jvmci.meta.Assumptions.AssumptionResult;
 
 @NodeInfo
 public class MethodCallTargetNode extends CallTargetNode implements IterableNodeType, Simplifiable {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MonitorEnterNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MonitorEnterNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,13 +22,13 @@
  */
 package com.oracle.graal.nodes.java;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.extended.*;
 import com.oracle.graal.nodes.memory.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * The {@code MonitorEnterNode} represents the acquisition of a monitor.
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MonitorExitNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MonitorExitNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,8 +22,6 @@
  */
 package com.oracle.graal.nodes.java;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
 import com.oracle.graal.nodeinfo.*;
@@ -31,6 +29,8 @@
 import com.oracle.graal.nodes.extended.*;
 import com.oracle.graal.nodes.memory.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * The {@code MonitorExitNode} represents a monitor release. If it is the release of the monitor of
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewArrayNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewArrayNode.java	Thu May 28 21:11:28 2015 -0700
@@ -24,7 +24,6 @@
 
 import java.util.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodeinfo.*;
@@ -32,6 +31,7 @@
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.type.*;
 import com.oracle.graal.nodes.virtual.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * The {@code NewArrayNode} is used for all array allocations where the element type is know at
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewInstanceNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewInstanceNode.java	Thu May 28 21:11:28 2015 -0700
@@ -25,13 +25,13 @@
 import java.lang.ref.*;
 import java.util.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.virtual.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * The {@code NewInstanceNode} represents the allocation of an instance class object.
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewMultiArrayNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewMultiArrayNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,12 +22,12 @@
  */
 package com.oracle.graal.nodes.java;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * The {@code NewMultiArrayNode} represents an allocation of a multi-dimensional object array.
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/RegisterFinalizerNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/RegisterFinalizerNode.java	Thu May 28 21:11:28 2015 -0700
@@ -24,15 +24,15 @@
 
 import static com.oracle.graal.nodes.java.ForeignCallDescriptors.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.api.meta.Assumptions.AssumptionResult;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.meta.*;
+import com.oracle.jvmci.meta.Assumptions.AssumptionResult;
 
 /**
  * This node is used to perform the finalizer registration at the end of the java.lang.Object
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/StoreFieldNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/StoreFieldNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,13 +22,13 @@
  */
 package com.oracle.graal.nodes.java;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.virtual.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * The {@code StoreFieldNode} represents a write to a static or instance field.
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/StoreIndexedNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/StoreIndexedNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,13 +22,13 @@
  */
 package com.oracle.graal.nodes.java;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.type.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * The {@code StoreIndexedNode} represents a write to an array element.
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/TypeCheckNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/TypeCheckNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,8 +22,6 @@
  */
 package com.oracle.graal.nodes.java;
 
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.api.meta.Assumptions.AssumptionResult;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
@@ -31,6 +29,8 @@
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.calc.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.meta.*;
+import com.oracle.jvmci.meta.Assumptions.AssumptionResult;
 
 /**
  * The {@code TypeCheckNode} represents a test equivalent to (o != null && o.getClass() == type).
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/TypeSwitchNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/TypeSwitchNode.java	Thu May 28 21:11:28 2015 -0700
@@ -24,7 +24,6 @@
 
 import java.util.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
@@ -33,6 +32,7 @@
 import com.oracle.graal.nodes.extended.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.util.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * The {@code TypeSwitchNode} performs a lookup based on the type of the input value. The type
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/memory/AbstractWriteNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/memory/AbstractWriteNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,12 +22,12 @@
  */
 package com.oracle.graal.nodes.memory;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.extended.*;
+import com.oracle.jvmci.meta.*;
 
 @NodeInfo(allowedUsageTypes = {InputType.Memory})
 public abstract class AbstractWriteNode extends FixedAccessNode implements StateSplit, MemoryCheckpoint.Single, MemoryAccess, GuardingNode {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/memory/FloatingAccessNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/memory/FloatingAccessNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,12 +22,12 @@
  */
 package com.oracle.graal.nodes.memory;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.extended.*;
+import com.oracle.jvmci.meta.*;
 
 @NodeInfo
 public abstract class FloatingAccessNode extends FloatingGuardedNode implements Access, MemoryAccess {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/memory/FloatingReadNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/memory/FloatingReadNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,6 @@
  */
 package com.oracle.graal.nodes.memory;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
@@ -30,6 +29,7 @@
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.extended.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * A floating read of a value from memory specified in terms of an object base and an object
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/memory/MemoryAccess.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/memory/MemoryAccess.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,7 @@
  */
 package com.oracle.graal.nodes.memory;
 
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * This interface marks nodes that access some memory location, and that have an edge to the last
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/memory/MemoryCheckpoint.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/memory/MemoryCheckpoint.java	Thu May 28 21:11:28 2015 -0700
@@ -22,9 +22,9 @@
  */
 package com.oracle.graal.nodes.memory;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * This interface marks subclasses of {@link FixedNode} that kill a set of memory locations
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/memory/MemoryMap.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/memory/MemoryMap.java	Thu May 28 21:11:28 2015 -0700
@@ -24,7 +24,7 @@
 
 import java.util.*;
 
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * Maps a {@linkplain LocationIdentity location} to the last node that (potentially) wrote to the
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/memory/MemoryMapNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/memory/MemoryMapNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,11 +22,10 @@
  */
 package com.oracle.graal.nodes.memory;
 
-import static com.oracle.graal.api.meta.LocationIdentity.*;
+import static com.oracle.jvmci.meta.LocationIdentity.*;
 
 import java.util.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
@@ -34,6 +33,7 @@
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.calc.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.meta.*;
 
 @NodeInfo(allowedUsageTypes = {InputType.Extension, InputType.Memory})
 public final class MemoryMapNode extends FloatingNode implements MemoryMap, MemoryNode, LIRLowerable {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/memory/MemoryPhiNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/memory/MemoryPhiNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,11 +22,11 @@
  */
 package com.oracle.graal.nodes.memory;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * Memory {@code PhiNode}s merge memory dependencies at control flow merges.
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/memory/ReadNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/memory/ReadNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,8 +22,6 @@
  */
 package com.oracle.graal.nodes.memory;
 
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
@@ -33,6 +31,8 @@
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.type.*;
 import com.oracle.graal.nodes.util.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * Reads an {@linkplain FixedAccessNode accessed} value.
@@ -163,7 +163,7 @@
 
     @Override
     public void virtualize(VirtualizerTool tool) {
-        throw GraalInternalError.shouldNotReachHere("unexpected ReadNode before PEA");
+        throw JVMCIError.shouldNotReachHere("unexpected ReadNode before PEA");
     }
 
     public boolean canNullCheck() {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/memory/WriteNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/memory/WriteNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,8 +22,6 @@
  */
 package com.oracle.graal.nodes.memory;
 
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
 import com.oracle.graal.nodeinfo.*;
@@ -31,6 +29,8 @@
 import com.oracle.graal.nodes.extended.*;
 import com.oracle.graal.nodes.extended.LocationNode.Location;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * Writes a given {@linkplain #value() value} a {@linkplain FixedAccessNode memory location}.
@@ -71,7 +71,7 @@
 
     @Override
     public void virtualize(VirtualizerTool tool) {
-        throw GraalInternalError.shouldNotReachHere("unexpected WriteNode before PEA");
+        throw JVMCIError.shouldNotReachHere("unexpected WriteNode before PEA");
     }
 
     public boolean canNullCheck() {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/ArithmeticLIRLowerable.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/ArithmeticLIRLowerable.java	Thu May 28 21:11:28 2015 -0700
@@ -22,8 +22,8 @@
  */
 package com.oracle.graal.nodes.spi;
 
-import com.oracle.graal.api.code.*;
 import com.oracle.graal.lir.gen.*;
+import com.oracle.jvmci.code.*;
 
 public interface ArithmeticLIRLowerable extends ArithmeticOperation {
 
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/LoweringProvider.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/LoweringProvider.java	Thu May 28 21:11:28 2015 -0700
@@ -22,10 +22,10 @@
  */
 package com.oracle.graal.nodes.spi;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.extended.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * Provides a capability for replacing a higher node with one or more lower level nodes.
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/LoweringTool.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/LoweringTool.java	Thu May 28 21:11:28 2015 -0700
@@ -22,9 +22,9 @@
  */
 package com.oracle.graal.nodes.spi;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.extended.*;
+import com.oracle.jvmci.meta.*;
 
 public interface LoweringTool {
 
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/MemoryProxy.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/MemoryProxy.java	Thu May 28 21:11:28 2015 -0700
@@ -22,8 +22,8 @@
  */
 package com.oracle.graal.nodes.spi;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.nodes.memory.*;
+import com.oracle.jvmci.meta.*;
 
 public interface MemoryProxy extends Proxy, MemoryNode {
 
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/NodeLIRBuilderTool.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/NodeLIRBuilderTool.java	Thu May 28 21:11:28 2015 -0700
@@ -24,8 +24,6 @@
 
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.cfg.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
@@ -35,6 +33,8 @@
 import com.oracle.graal.nodes.calc.*;
 import com.oracle.graal.nodes.cfg.*;
 import com.oracle.graal.nodes.extended.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.meta.*;
 
 public interface NodeLIRBuilderTool extends NodeMappableLIRBuilder {
 
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/NodeMappableLIRBuilder.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/NodeMappableLIRBuilder.java	Thu May 28 21:11:28 2015 -0700
@@ -23,9 +23,9 @@
 
 package com.oracle.graal.nodes.spi;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.*;
+import com.oracle.jvmci.meta.*;
 
 public interface NodeMappableLIRBuilder {
 
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/Replacements.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/Replacements.java	Thu May 28 21:11:28 2015 -0700
@@ -25,9 +25,9 @@
 import java.lang.reflect.*;
 import java.util.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.api.replacements.*;
 import com.oracle.graal.nodes.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * Interface for managing replacements.
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/ReplacementsProvider.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/ReplacementsProvider.java	Thu May 28 21:11:28 2015 -0700
@@ -22,10 +22,10 @@
  */
 package com.oracle.graal.nodes.spi;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.api.replacements.*;
-import com.oracle.graal.api.runtime.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.meta.*;
+import com.oracle.jvmci.runtime.*;
 
 /**
  * Interface for service providers that register replacements with the compiler.
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/UncheckedInterfaceProvider.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/UncheckedInterfaceProvider.java	Thu May 28 21:11:28 2015 -0700
@@ -22,8 +22,8 @@
  */
 package com.oracle.graal.nodes.spi;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
+import com.oracle.jvmci.meta.*;
 
 public interface UncheckedInterfaceProvider {
     /**
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/VirtualizerTool.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/VirtualizerTool.java	Thu May 28 21:11:28 2015 -0700
@@ -24,12 +24,12 @@
 
 import java.util.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.java.*;
 import com.oracle.graal.nodes.spi.Virtualizable.State;
 import com.oracle.graal.nodes.virtual.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * This tool can be used to query the current state (normal/virtualized/re-materialized) of values
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/StampTool.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/StampTool.java	Thu May 28 21:11:28 2015 -0700
@@ -24,9 +24,9 @@
 
 import java.util.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.nodes.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * Helper class that is used to keep all stamp-related operations in one place.
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/util/GraphUtil.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/util/GraphUtil.java	Thu May 28 21:11:28 2015 -0700
@@ -24,14 +24,14 @@
 
 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.iterators.*;
 import com.oracle.graal.graph.spi.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.java.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.meta.*;
 
 public class GraphUtil {
 
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/EscapeObjectState.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/EscapeObjectState.java	Thu May 28 21:11:28 2015 -0700
@@ -22,8 +22,8 @@
  */
 package com.oracle.graal.nodes.virtual;
 
+import com.oracle.graal.graph.Node.ValueNumberable;
 import com.oracle.graal.graph.*;
-import com.oracle.graal.graph.Node.ValueNumberable;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
 
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/VirtualArrayNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/VirtualArrayNode.java	Thu May 28 21:11:28 2015 -0700
@@ -26,11 +26,11 @@
 
 import sun.misc.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.meta.*;
 
 @NodeInfo(nameTemplate = "VirtualArray {p#componentType/s}[{p#length}]")
 public class VirtualArrayNode extends VirtualObjectNode implements ArrayLengthProvider {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/VirtualBoxingNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/VirtualBoxingNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,11 +22,11 @@
  */
 package com.oracle.graal.nodes.virtual;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.extended.*;
+import com.oracle.jvmci.meta.*;
 
 @NodeInfo
 public final class VirtualBoxingNode extends VirtualInstanceNode {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/VirtualInstanceNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/VirtualInstanceNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,10 +22,10 @@
  */
 package com.oracle.graal.nodes.virtual;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
+import com.oracle.jvmci.meta.*;
 
 @NodeInfo(nameTemplate = "VirtualInstance {p#type/s}")
 public class VirtualInstanceNode extends VirtualObjectNode {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/VirtualObjectNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/VirtualObjectNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,12 +22,12 @@
  */
 package com.oracle.graal.nodes.virtual;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.meta.*;
 
 @NodeInfo
 public abstract class VirtualObjectNode extends ValueNode implements LIRLowerable, IterableNodeType {
--- a/graal/com.oracle.graal.options.processor/src/META-INF/services/javax.annotation.processing.Processor	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-com.oracle.graal.options.processor.OptionProcessor
--- a/graal/com.oracle.graal.options.processor/src/com/oracle/graal/options/processor/GraalJars.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 2015, 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.options.processor;
-
-import java.io.*;
-import java.util.*;
-import java.util.stream.*;
-import java.util.zip.*;
-
-public class GraalJars implements Iterable<ZipEntry> {
-    private final List<ZipFile> jars = new ArrayList<>(2);
-
-    public GraalJars() {
-        String classPath = System.getProperty("java.class.path");
-        for (String e : classPath.split(File.pathSeparator)) {
-            if (e.endsWith(File.separatorChar + "graal.jar") || e.endsWith(File.separatorChar + "graal-truffle.jar")) {
-                try {
-                    jars.add(new ZipFile(e));
-                } catch (IOException ioe) {
-                    throw new InternalError(ioe);
-                }
-            }
-        }
-        if (jars.size() != 2) {
-            throw new InternalError("Could not find graal.jar or graal-truffle.jar on class path: " + classPath);
-        }
-    }
-
-    public Iterator<ZipEntry> iterator() {
-        Stream<ZipEntry> entries = jars.stream().flatMap(ZipFile::stream);
-        return entries.iterator();
-    }
-
-    public InputStream getInputStream(String classFilePath) throws IOException {
-        for (ZipFile jar : jars) {
-            ZipEntry entry = jar.getEntry(classFilePath);
-            if (entry != null) {
-                return jar.getInputStream(entry);
-            }
-        }
-        return null;
-    }
-}
--- a/graal/com.oracle.graal.options.processor/src/com/oracle/graal/options/processor/OptionProcessor.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,378 +0,0 @@
-/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.options.processor;
-
-import java.io.*;
-import java.util.*;
-
-import javax.annotation.processing.*;
-import javax.lang.model.*;
-import javax.lang.model.element.*;
-import javax.lang.model.type.*;
-import javax.lang.model.util.*;
-import javax.tools.Diagnostic.Kind;
-import javax.tools.*;
-
-import com.oracle.graal.options.*;
-
-/**
- * Processes static fields annotated with {@link Option}. An {@link Options} service is generated
- * for each top level class containing at least one such field. These service objects can be
- * retrieved as follows:
- *
- * <pre>
- * ServiceLoader&lt;Options&gt; sl = ServiceLoader.load(Options.class);
- * for (Options opts : sl) {
- *     for (OptionDescriptor desc : sl) {
- *         // use desc
- *     }
- * }
- * </pre>
- */
-@SupportedAnnotationTypes({"com.oracle.graal.options.Option"})
-public class OptionProcessor extends AbstractProcessor {
-
-    @Override
-    public SourceVersion getSupportedSourceVersion() {
-        return SourceVersion.latest();
-    }
-
-    private final Set<Element> processed = new HashSet<>();
-
-    private void processElement(Element element, OptionsInfo info) {
-
-        if (!element.getModifiers().contains(Modifier.STATIC)) {
-            processingEnv.getMessager().printMessage(Kind.ERROR, "Option field must be static", element);
-            return;
-        }
-
-        Option annotation = element.getAnnotation(Option.class);
-        assert annotation != null;
-        assert element instanceof VariableElement;
-        assert element.getKind() == ElementKind.FIELD;
-        VariableElement field = (VariableElement) element;
-        String fieldName = field.getSimpleName().toString();
-
-        Elements elements = processingEnv.getElementUtils();
-        Types types = processingEnv.getTypeUtils();
-
-        TypeMirror fieldType = field.asType();
-        if (fieldType.getKind() != TypeKind.DECLARED) {
-            processingEnv.getMessager().printMessage(Kind.ERROR, "Option field must be of type " + OptionValue.class.getName(), element);
-            return;
-        }
-        DeclaredType declaredFieldType = (DeclaredType) fieldType;
-
-        TypeMirror optionValueType = elements.getTypeElement(OptionValue.class.getName()).asType();
-        if (!types.isSubtype(fieldType, types.erasure(optionValueType))) {
-            String msg = String.format("Option field type %s is not a subclass of %s", fieldType, optionValueType);
-            processingEnv.getMessager().printMessage(Kind.ERROR, msg, element);
-            return;
-        }
-
-        if (!field.getModifiers().contains(Modifier.STATIC)) {
-            processingEnv.getMessager().printMessage(Kind.ERROR, "Option field must be static", element);
-            return;
-        }
-
-        String help = annotation.help();
-        if (help.length() != 0) {
-            char firstChar = help.charAt(0);
-            if (!Character.isUpperCase(firstChar)) {
-                processingEnv.getMessager().printMessage(Kind.ERROR, "Option help text must start with upper case letter", element);
-                return;
-            }
-        }
-
-        String optionName = annotation.name();
-        if (optionName.equals("")) {
-            optionName = fieldName;
-        }
-
-        DeclaredType declaredOptionValueType = declaredFieldType;
-        while (!types.isSameType(types.erasure(declaredOptionValueType), types.erasure(optionValueType))) {
-            List<? extends TypeMirror> directSupertypes = types.directSupertypes(declaredFieldType);
-            assert !directSupertypes.isEmpty();
-            declaredOptionValueType = (DeclaredType) directSupertypes.get(0);
-        }
-
-        assert !declaredOptionValueType.getTypeArguments().isEmpty();
-        String optionType = declaredOptionValueType.getTypeArguments().get(0).toString();
-        if (optionType.startsWith("java.lang.")) {
-            optionType = optionType.substring("java.lang.".length());
-        }
-
-        Element enclosing = element.getEnclosingElement();
-        String declaringClass = "";
-        String separator = "";
-        Set<Element> originatingElementsList = info.originatingElements;
-        originatingElementsList.add(field);
-        while (enclosing != null) {
-            if (enclosing.getKind() == ElementKind.CLASS || enclosing.getKind() == ElementKind.INTERFACE) {
-                if (enclosing.getModifiers().contains(Modifier.PRIVATE)) {
-                    String msg = String.format("Option field cannot be declared in a private %s %s", enclosing.getKind().name().toLowerCase(), enclosing);
-                    processingEnv.getMessager().printMessage(Kind.ERROR, msg, element);
-                    return;
-                }
-                originatingElementsList.add(enclosing);
-                declaringClass = enclosing.getSimpleName() + separator + declaringClass;
-                separator = ".";
-            } else {
-                assert enclosing.getKind() == ElementKind.PACKAGE;
-            }
-            enclosing = enclosing.getEnclosingElement();
-        }
-
-        info.options.add(new OptionInfo(optionName, help, optionType, declaringClass, field));
-    }
-
-    private void createFiles(OptionsInfo info) {
-        String pkg = ((PackageElement) info.topDeclaringType.getEnclosingElement()).getQualifiedName().toString();
-        Name topDeclaringClass = info.topDeclaringType.getSimpleName();
-
-        String optionsClassName = topDeclaringClass + "_" + Options.class.getSimpleName();
-        Element[] originatingElements = info.originatingElements.toArray(new Element[info.originatingElements.size()]);
-
-        Filer filer = processingEnv.getFiler();
-        try (PrintWriter out = createSourceFile(pkg, optionsClassName, filer, originatingElements)) {
-
-            out.println("// CheckStyle: stop header check");
-            out.println("// GENERATED CONTENT - DO NOT EDIT");
-            out.println("// Source: " + topDeclaringClass + ".java");
-            out.println("package " + pkg + ";");
-            out.println("");
-            out.println("import java.util.*;");
-            out.println("import " + Options.class.getPackage().getName() + ".*;");
-            out.println("");
-            out.println("public class " + optionsClassName + " implements " + Options.class.getSimpleName() + " {");
-            out.println("    @Override");
-            String desc = OptionDescriptor.class.getSimpleName();
-            out.println("    public Iterator<" + desc + "> iterator() {");
-            out.println("        // CheckStyle: stop line length check");
-            out.println("        List<" + desc + "> options = Arrays.asList(");
-
-            boolean needPrivateFieldAccessor = false;
-            int i = 0;
-            Collections.sort(info.options);
-            for (OptionInfo option : info.options) {
-                String optionValue;
-                if (option.field.getModifiers().contains(Modifier.PRIVATE)) {
-                    needPrivateFieldAccessor = true;
-                    optionValue = "field(" + option.declaringClass + ".class, \"" + option.field.getSimpleName() + "\")";
-                } else {
-                    optionValue = option.declaringClass + "." + option.field.getSimpleName();
-                }
-                String name = option.name;
-                String type = option.type;
-                String help = option.help;
-                String declaringClass = option.declaringClass;
-                Name fieldName = option.field.getSimpleName();
-                String comma = i == info.options.size() - 1 ? "" : ",";
-                out.printf("            new %s(\"%s\", %s.class, \"%s\", %s.class, \"%s\", %s)%s\n", desc, name, type, help, declaringClass, fieldName, optionValue, comma);
-                i++;
-            }
-            out.println("        );");
-            out.println("        // CheckStyle: resume line length check");
-            out.println("        return options.iterator();");
-            out.println("    }");
-            if (needPrivateFieldAccessor) {
-                out.println("    private static " + OptionValue.class.getSimpleName() + "<?> field(Class<?> declaringClass, String fieldName) {");
-                out.println("        try {");
-                out.println("            java.lang.reflect.Field field = declaringClass.getDeclaredField(fieldName);");
-                out.println("            field.setAccessible(true);");
-                out.println("            return (" + OptionValue.class.getSimpleName() + "<?>) field.get(null);");
-                out.println("        } catch (Exception e) {");
-                out.println("            throw (InternalError) new InternalError().initCause(e);");
-                out.println("        }");
-                out.println("    }");
-            }
-            out.println("}");
-        }
-
-        try {
-            createProviderFile(pkg, optionsClassName, originatingElements);
-            createOptionsFile(info, pkg, topDeclaringClass.toString(), originatingElements);
-        } catch (IOException e) {
-            processingEnv.getMessager().printMessage(Kind.ERROR, e.getMessage(), info.topDeclaringType);
-        }
-    }
-
-    private void createProviderFile(String pkg, String providerClassName, Element... originatingElements) throws IOException {
-        String filename = "META-INF/providers/" + pkg + "." + providerClassName;
-        FileObject file = processingEnv.getFiler().createResource(StandardLocation.CLASS_OUTPUT, "", filename, originatingElements);
-        PrintWriter writer = new PrintWriter(new OutputStreamWriter(file.openOutputStream(), "UTF-8"));
-        writer.println(Options.class.getName());
-        writer.close();
-    }
-
-    private void createOptionsFile(OptionsInfo info, String pkg, String relativeName, Element... originatingElements) throws IOException {
-        String filename = "META-INF/options/" + pkg + "." + relativeName;
-        FileObject file = processingEnv.getFiler().createResource(StandardLocation.CLASS_OUTPUT, "", filename, originatingElements);
-        PrintWriter writer = new PrintWriter(new OutputStreamWriter(file.openOutputStream(), "UTF-8"));
-        Types types = processingEnv.getTypeUtils();
-        for (OptionInfo option : info.options) {
-            String help = option.help;
-            if (help.indexOf('\t') >= 0 || help.indexOf('\r') >= 0 || help.indexOf('\n') >= 0) {
-                processingEnv.getMessager().printMessage(Kind.WARNING, "Option help should not contain '\\t', '\\r' or '\\n'", option.field);
-                help = help.replace('\t', ' ').replace('\n', ' ').replace('\r', ' ');
-            }
-            try {
-                char optionTypeToChar = optionTypeToChar(option);
-                String fqDeclaringClass = className(types.erasure(option.field.getEnclosingElement().asType()));
-                String fqFieldType = className(types.erasure(option.field.asType()));
-                writer.printf("%s\t%s\t%s\t%s\t%s%n", option.name, optionTypeToChar, help, fqDeclaringClass, fqFieldType);
-            } catch (IllegalArgumentException iae) {
-            }
-        }
-        writer.close();
-    }
-
-    private String className(TypeMirror t) {
-        DeclaredType dt = (DeclaredType) t;
-        return processingEnv.getElementUtils().getBinaryName((TypeElement) dt.asElement()).toString();
-    }
-
-    private char optionTypeToChar(OptionInfo option) {
-        switch (option.type) {
-            case "Boolean":
-                return 'z';
-            case "Integer":
-                return 'i';
-            case "Long":
-                return 'j';
-            case "Float":
-                return 'f';
-            case "Double":
-                return 'd';
-            case "String":
-                return 's';
-            default:
-                processingEnv.getMessager().printMessage(Kind.ERROR, "Unsoported option type: " + option.type, option.field);
-                throw new IllegalArgumentException();
-        }
-    }
-
-    protected PrintWriter createSourceFile(String pkg, String relativeName, Filer filer, Element... originatingElements) {
-        try {
-            // Ensure Unix line endings to comply with Graal code style guide checked by Checkstyle
-            JavaFileObject sourceFile = filer.createSourceFile(pkg + "." + relativeName, originatingElements);
-            return new PrintWriter(sourceFile.openWriter()) {
-
-                @Override
-                public void println() {
-                    print("\n");
-                }
-            };
-        } catch (IOException e) {
-            throw new RuntimeException(e);
-        }
-    }
-
-    static class OptionInfo implements Comparable<OptionInfo> {
-
-        final String name;
-        final String help;
-        final String type;
-        final String declaringClass;
-        final VariableElement field;
-
-        public OptionInfo(String name, String help, String type, String declaringClass, VariableElement field) {
-            this.name = name;
-            this.help = help;
-            this.type = type;
-            this.declaringClass = declaringClass;
-            this.field = field;
-        }
-
-        @Override
-        public int compareTo(OptionInfo other) {
-            return name.compareTo(other.name);
-        }
-
-        @Override
-        public String toString() {
-            return declaringClass + "." + field;
-        }
-    }
-
-    static class OptionsInfo {
-
-        final Element topDeclaringType;
-        final List<OptionInfo> options = new ArrayList<>();
-        final Set<Element> originatingElements = new HashSet<>();
-
-        public OptionsInfo(Element topDeclaringType) {
-            this.topDeclaringType = topDeclaringType;
-        }
-    }
-
-    private static Element topDeclaringType(Element element) {
-        Element enclosing = element.getEnclosingElement();
-        if (enclosing == null || enclosing.getKind() == ElementKind.PACKAGE) {
-            assert element.getKind() == ElementKind.CLASS || element.getKind() == ElementKind.INTERFACE;
-            return element;
-        }
-        return topDeclaringType(enclosing);
-    }
-
-    @Override
-    public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
-        if (roundEnv.processingOver()) {
-            return true;
-        }
-
-        Map<Element, OptionsInfo> map = new HashMap<>();
-        for (Element element : roundEnv.getElementsAnnotatedWith(Option.class)) {
-            if (!processed.contains(element)) {
-                processed.add(element);
-                Element topDeclaringType = topDeclaringType(element);
-                OptionsInfo options = map.get(topDeclaringType);
-                if (options == null) {
-                    options = new OptionsInfo(topDeclaringType);
-                    map.put(topDeclaringType, options);
-                }
-                processElement(element, options);
-            }
-        }
-
-        boolean ok = true;
-        Map<String, OptionInfo> uniqueness = new HashMap<>();
-        for (OptionsInfo info : map.values()) {
-            for (OptionInfo option : info.options) {
-                OptionInfo conflict = uniqueness.put(option.name, option);
-                if (conflict != null) {
-                    processingEnv.getMessager().printMessage(Kind.ERROR, "Duplicate option names for " + option + " and " + conflict, option.field);
-                    ok = false;
-                }
-            }
-        }
-
-        if (ok) {
-            for (OptionsInfo info : map.values()) {
-                createFiles(info);
-            }
-        }
-
-        return true;
-    }
-}
--- a/graal/com.oracle.graal.options.processor/src/com/oracle/graal/options/processor/OptionsVerifier.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,184 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.options.processor;
-
-import static java.lang.String.*;
-
-import java.io.*;
-import java.lang.reflect.*;
-import java.util.*;
-
-import jdk.internal.org.objectweb.asm.*;
-import jdk.internal.org.objectweb.asm.Type;
-
-import com.oracle.graal.options.*;
-
-/**
- * A {@link ClassVisitor} that verifies a class declaring one or more {@linkplain OptionValue
- * options} has a class initializer that only initializes the option(s). This sanity check mitigates
- * the possibility of an option value being used before the code that sets the value (e.g., from the
- * command line) has been executed.
- */
-final class OptionsVerifier extends ClassVisitor {
-
-    public static void checkClass(Class<?> cls, OptionDescriptor option, Set<Class<?>> checked, GraalJars graalJars) throws IOException {
-        if (!checked.contains(cls)) {
-            checked.add(cls);
-            Class<?> superclass = cls.getSuperclass();
-            if (superclass != null && !superclass.equals(Object.class)) {
-                checkClass(superclass, option, checked, graalJars);
-            }
-
-            String classFilePath = cls.getName().replace('.', '/') + ".class";
-            ClassReader cr = new ClassReader(Objects.requireNonNull(graalJars.getInputStream(classFilePath), "Could not find class file for " + cls.getName()));
-
-            ClassVisitor cv = new OptionsVerifier(cls, option);
-            cr.accept(cv, 0);
-        }
-    }
-
-    /**
-     * The option field context of the verification.
-     */
-    private final OptionDescriptor option;
-
-    /**
-     * The class in which {@link #option} is declared or a super-class of that class. This is the
-     * class whose {@code <clinit>} method is being verified.
-     */
-    private final Class<?> cls;
-
-    /**
-     * Source file context for error reporting.
-     */
-    String sourceFile = null;
-
-    /**
-     * Line number for error reporting.
-     */
-    int lineNo = -1;
-
-    final Class<?>[] boxingTypes = {Boolean.class, Byte.class, Short.class, Character.class, Integer.class, Float.class, Long.class, Double.class};
-
-    private static Class<?> resolve(String name) {
-        try {
-            return Class.forName(name.replace('/', '.'));
-        } catch (ClassNotFoundException e) {
-            throw new InternalError(e);
-        }
-    }
-
-    OptionsVerifier(Class<?> cls, OptionDescriptor desc) {
-        super(Opcodes.ASM5);
-        this.cls = cls;
-        this.option = desc;
-    }
-
-    @Override
-    public void visitSource(String source, String debug) {
-        this.sourceFile = source;
-    }
-
-    void verify(boolean condition, String message) {
-        if (!condition) {
-            error(message);
-        }
-    }
-
-    void error(String message) {
-        String errorMessage = format("%s:%d: Illegal code in %s.<clinit> which may be executed when %s.%s is initialized:%n%n    %s%n%n" + "The recommended solution is to move " + option.getName() +
-                        " into a separate class (e.g., %s.Options).%n", sourceFile, lineNo, cls.getSimpleName(), option.getDeclaringClass().getSimpleName(), option.getName(), message,
-                        option.getDeclaringClass().getSimpleName());
-        throw new InternalError(errorMessage);
-
-    }
-
-    @Override
-    public MethodVisitor visitMethod(int access, String name, String d, String signature, String[] exceptions) {
-        if (name.equals("<clinit>")) {
-            return new MethodVisitor(Opcodes.ASM5) {
-
-                @Override
-                public void visitLineNumber(int line, Label start) {
-                    lineNo = line;
-                }
-
-                @Override
-                public void visitFieldInsn(int opcode, String owner, String fieldName, String fieldDesc) {
-                    if (opcode == Opcodes.PUTFIELD || opcode == Opcodes.PUTSTATIC) {
-                        verify(resolve(owner).equals(option.getDeclaringClass()), format("store to field %s.%s", resolve(owner).getSimpleName(), fieldName));
-                        verify(opcode != Opcodes.PUTFIELD, format("store to non-static field %s.%s", resolve(owner).getSimpleName(), fieldName));
-                    }
-                }
-
-                private Executable resolveMethod(String owner, String methodName, String methodDesc) {
-                    Class<?> declaringClass = resolve(owner);
-                    if (methodName.equals("<init>")) {
-                        for (Constructor<?> c : declaringClass.getDeclaredConstructors()) {
-                            if (methodDesc.equals(Type.getConstructorDescriptor(c))) {
-                                return c;
-                            }
-                        }
-                    } else {
-                        Type[] argumentTypes = Type.getArgumentTypes(methodDesc);
-                        for (Method m : declaringClass.getDeclaredMethods()) {
-                            if (m.getName().equals(methodName)) {
-                                if (Arrays.equals(argumentTypes, Type.getArgumentTypes(m))) {
-                                    if (Type.getReturnType(methodDesc).equals(Type.getReturnType(m))) {
-                                        return m;
-                                    }
-                                }
-                            }
-                        }
-                    }
-                    throw new NoSuchMethodError(declaringClass + "." + methodName + methodDesc);
-                }
-
-                /**
-                 * Checks whether a given method is allowed to be called.
-                 */
-                private boolean checkInvokeTarget(Executable method) {
-                    Class<?> holder = method.getDeclaringClass();
-                    if (method instanceof Constructor) {
-                        if (OptionValue.class.isAssignableFrom(holder)) {
-                            return true;
-                        }
-                    } else if (Arrays.asList(boxingTypes).contains(holder)) {
-                        return method.getName().equals("valueOf");
-                    } else if (method.getDeclaringClass().equals(Class.class)) {
-                        return method.getName().equals("desiredAssertionStatus");
-                    }
-                    return false;
-                }
-
-                @Override
-                public void visitMethodInsn(int opcode, String owner, String methodName, String methodDesc, boolean itf) {
-                    Executable callee = resolveMethod(owner, methodName, methodDesc);
-                    verify(checkInvokeTarget(callee), "invocation of " + callee);
-                }
-            };
-        } else {
-            return null;
-        }
-    }
-}
--- a/graal/com.oracle.graal.options.test/src/com/oracle/graal/options/test/NestedBooleanOptionValueTest.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,128 +0,0 @@
-/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.options.test;
-
-import static com.oracle.graal.options.test.NestedBooleanOptionValueTest.Options.*;
-import static org.junit.Assert.*;
-
-import org.junit.*;
-
-import com.oracle.graal.options.*;
-import com.oracle.graal.options.OptionValue.OverrideScope;
-
-public class NestedBooleanOptionValueTest {
-
-    public static class Options {
-        public static final OptionValue<Boolean> Master0 = new OptionValue<>(true);
-        public static final OptionValue<Boolean> NestedOption0 = new NestedBooleanOptionValue(Master0, true);
-        public static final OptionValue<Boolean> Master1 = new OptionValue<>(true);
-        public static final OptionValue<Boolean> NestedOption1 = new NestedBooleanOptionValue(Master1, true);
-        public static final OptionValue<Boolean> Master2 = new OptionValue<>(true);
-        public static final OptionValue<Boolean> NestedOption2 = new NestedBooleanOptionValue(Master2, false);
-    }
-
-    static final OptionDescriptor master0 = new OptionDescriptor("Master0", Boolean.class, "", Options.class, "Master0", Master0);
-    static final OptionDescriptor nestedOption0 = new OptionDescriptor("NestedOption0", Boolean.class, "", Options.class, "NestedOption0", NestedOption0);
-    static final OptionDescriptor master1 = new OptionDescriptor("Master1", Boolean.class, "", Options.class, "Master1", Master1);
-    static final OptionDescriptor nestedOption1 = new OptionDescriptor("NestedOption1", Boolean.class, "", Options.class, "NestedOption1", NestedOption1);
-    static final OptionDescriptor master2 = new OptionDescriptor("Master2", Boolean.class, "", Options.class, "Master2", Master2);
-    static final OptionDescriptor nestedOption2 = new OptionDescriptor("NestedOption2", Boolean.class, "", Options.class, "NestedOption2", NestedOption2);
-
-    @Test
-    public void runOverrides() {
-        assertTrue(Master0.getValue());
-        assertTrue(NestedOption0.getValue());
-        try (OverrideScope s1 = OptionValue.override(Master0, false)) {
-            assertFalse(Master0.getValue());
-            assertFalse(NestedOption0.getValue());
-            try (OverrideScope s2 = OptionValue.override(NestedOption0, false)) {
-                assertFalse(NestedOption0.getValue());
-            }
-            try (OverrideScope s2 = OptionValue.override(NestedOption0, true)) {
-                assertTrue(NestedOption0.getValue());
-            }
-        }
-        assertTrue(Master0.getValue());
-        try (OverrideScope s1 = OptionValue.override(NestedOption0, false)) {
-            assertFalse(NestedOption0.getValue());
-        }
-        try (OverrideScope s1 = OptionValue.override(NestedOption0, true)) {
-            assertTrue(NestedOption0.getValue());
-        }
-    }
-
-    @Test
-    public void runDefaultTrue() {
-        Master1.setValue(true);
-        assertTrue(Master1.getValue());
-        assertTrue(NestedOption1.getValue());
-        // nested value unset
-        Master1.setValue(false);
-        assertFalse(Master1.getValue());
-        assertFalse(NestedOption1.getValue());
-        // set false
-        Master1.setValue(false);
-        NestedOption1.setValue(false);
-        assertFalse(Master1.getValue());
-        assertFalse(NestedOption1.getValue());
-        Master1.setValue(true);
-        assertTrue(Master1.getValue());
-        assertFalse(NestedOption1.getValue());
-        // set true
-        Master1.setValue(false);
-        NestedOption1.setValue(true);
-        assertFalse(Master1.getValue());
-        assertTrue(NestedOption1.getValue());
-        Master1.setValue(true);
-        assertTrue(Master1.getValue());
-        assertTrue(NestedOption1.getValue());
-    }
-
-    @Test
-    public void runDefaultFalse() {
-        Master2.setValue(true);
-        assertTrue(Master2.getValue());
-        assertFalse(NestedOption2.getValue());
-        // nested value unset
-        Master2.setValue(false);
-        assertFalse(Master2.getValue());
-        assertFalse(NestedOption2.getValue());
-        // set false
-        Master2.setValue(false);
-        NestedOption2.setValue(false);
-        assertFalse(Master2.getValue());
-        assertFalse(NestedOption2.getValue());
-        Master2.setValue(true);
-        assertTrue(Master2.getValue());
-        assertFalse(NestedOption2.getValue());
-        // set true
-        Master2.setValue(false);
-        NestedOption2.setValue(true);
-        assertFalse(Master2.getValue());
-        assertTrue(NestedOption2.getValue());
-        Master2.setValue(true);
-        assertTrue(Master2.getValue());
-        assertTrue(NestedOption2.getValue());
-    }
-
-}
--- a/graal/com.oracle.graal.options.test/src/com/oracle/graal/options/test/TestOptionValue.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,127 +0,0 @@
-/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.options.test;
-
-import static com.oracle.graal.options.test.TestOptionValue.Options.*;
-import static org.junit.Assert.*;
-
-import java.util.*;
-
-import org.junit.*;
-
-import com.oracle.graal.options.*;
-import com.oracle.graal.options.OptionValue.OverrideScope;
-
-public class TestOptionValue {
-
-    public static class Options {
-        public static final OptionValue<Boolean> Stable = new StableOptionValue<>(true);
-        public static final OptionValue<String> Mutable = new OptionValue<>("original");
-        public static final OptionValue<String> SecondMutable = new OptionValue<>("second");
-    }
-
-    static final OptionDescriptor stable = new OptionDescriptor("Stable", Boolean.class, "", Options.class, "Stable", Stable);
-    static final OptionDescriptor mutable = new OptionDescriptor("Mutable", String.class, "", Options.class, "Mutable", Mutable);
-    static final OptionDescriptor secondMutable = new OptionDescriptor("SecondMutable", String.class, "", Options.class, "SecondMutable", SecondMutable);
-
-    @Test
-    public void testMutable() {
-        assertEquals("original", Mutable.getValue());
-        try (OverrideScope s1 = OptionValue.override(Mutable, "override1")) {
-            assertEquals("override1", Mutable.getValue());
-            try (OverrideScope s2 = OptionValue.override(Mutable, "override2")) {
-                assertEquals("override2", Mutable.getValue());
-            }
-            assertEquals("override1", Mutable.getValue());
-            try (OverrideScope s3 = OptionValue.override(Mutable, "override3")) {
-                assertEquals("override3", Mutable.getValue());
-            }
-            assertEquals("override1", Mutable.getValue());
-        }
-        assertEquals("original", Mutable.getValue());
-        try (OverrideScope s1 = OptionValue.override(Mutable, "original")) {
-            assertEquals("original", Mutable.getValue());
-        }
-    }
-
-    @Test
-    public void testMultiple() {
-        assertEquals("original", Mutable.getValue());
-        assertEquals("second", SecondMutable.getValue());
-        try (OverrideScope s1 = OptionValue.override(Mutable, "override1", SecondMutable, "secondOverride1")) {
-            assertEquals("override1", Mutable.getValue());
-            assertEquals("secondOverride1", SecondMutable.getValue());
-            try (OverrideScope s2 = OptionValue.override(Mutable, "override2", SecondMutable, "secondOverride2")) {
-                assertEquals("override2", Mutable.getValue());
-                assertEquals("secondOverride2", SecondMutable.getValue());
-            }
-            assertEquals("override1", Mutable.getValue());
-            assertEquals("secondOverride1", SecondMutable.getValue());
-            try (OverrideScope s3 = OptionValue.override(Mutable, "override3", SecondMutable, "secondOverride3")) {
-                assertEquals("override3", Mutable.getValue());
-                assertEquals("secondOverride3", SecondMutable.getValue());
-            }
-            assertEquals("override1", Mutable.getValue());
-            assertEquals("secondOverride1", SecondMutable.getValue());
-        }
-        assertEquals("original", Mutable.getValue());
-        assertEquals("second", SecondMutable.getValue());
-        try (OverrideScope s1 = OptionValue.override(Mutable, "original", SecondMutable, "second")) {
-            assertEquals("original", Mutable.getValue());
-            assertEquals("second", SecondMutable.getValue());
-        }
-    }
-
-    @Test
-    public void testStable() {
-        assertTrue(Stable.getValue());
-        try (OverrideScope s = OptionValue.override(Stable, false)) {
-            fail("cannot override stable option");
-        } catch (IllegalArgumentException e) {
-            // expected
-        }
-    }
-
-    @Test
-    public void toStringTest() {
-        assertEquals("com.oracle.graal.options.test.TestOptionValue$Options.Mutable=original", Mutable.toString());
-        try (OverrideScope s1 = OptionValue.override(Mutable, "override1")) {
-            assertEquals("com.oracle.graal.options.test.TestOptionValue$Options.Mutable=override1", Mutable.toString());
-            try (OverrideScope s2 = OptionValue.override(Mutable, "override2")) {
-                assertEquals("com.oracle.graal.options.test.TestOptionValue$Options.Mutable=override2", Mutable.toString());
-            }
-        }
-    }
-
-    @Test
-    public void getValuesTest() {
-        assertEquals(Arrays.asList("original"), Mutable.getValues(null));
-        assertEquals(Arrays.asList(true), Stable.getValues(null));
-        try (OverrideScope s1 = OptionValue.override(Mutable, "override1")) {
-            assertEquals(Arrays.asList("override1", "original"), Mutable.getValues(null));
-            try (OverrideScope s2 = OptionValue.override(Mutable, "override2")) {
-                assertEquals(Arrays.asList("override2", "override1", "original"), Mutable.getValues(null));
-            }
-        }
-    }
-}
--- a/graal/com.oracle.graal.options/src/com/oracle/graal/options/DerivedOptionValue.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.options;
-
-import java.io.*;
-import java.util.function.*;
-
-import com.oracle.graal.options.OptionValue.OverrideScope;
-
-/**
- * A cached value that needs to be recomputed when an option changes.
- */
-public class DerivedOptionValue<T> {
-
-    public interface OptionSupplier<T> extends Supplier<T>, Serializable {
-    }
-
-    private final T initialValue;
-    private final OptionSupplier<T> supplier;
-
-    public DerivedOptionValue(OptionSupplier<T> supplier) {
-        this.supplier = supplier;
-        assert OptionValue.getOverrideScope() == null : "derived option value should be initialized outside any override scope";
-        this.initialValue = createValue();
-    }
-
-    public T getValue() {
-        OverrideScope overrideScope = OptionValue.getOverrideScope();
-        if (overrideScope != null) {
-            return overrideScope.getDerived(this);
-        } else {
-            return initialValue;
-        }
-    }
-
-    T createValue() {
-        return supplier.get();
-    }
-}
--- a/graal/com.oracle.graal.options/src/com/oracle/graal/options/NestedBooleanOptionValue.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 2015, 2015, 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.options;
-
-/**
- * A nested Boolean {@link OptionValue} that can be overridden by a {@link #masterOption master
- * option}.
- * <p>
- * <li>If the option is present on the command line the specified value is used.
- * <li>Otherwise {@link #getValue()} depends on the {@link #masterOption} and evaluates as follows:
- * <ul>
- * <li>If {@link #masterOption} is set, this value equals to {@link #initialValue}.
- * <li>Otherwise, if {@link #masterOption} is {@code false}, this option is {@code false}.
- */
-public class NestedBooleanOptionValue extends OptionValue<Boolean> {
-    private final OptionValue<Boolean> masterOption;
-    private final Boolean initialValue;
-
-    public NestedBooleanOptionValue(OptionValue<Boolean> masterOption, Boolean initialValue) {
-        super(null);
-        this.masterOption = masterOption;
-        this.initialValue = initialValue;
-    }
-
-    public OptionValue<Boolean> getMasterOption() {
-        return masterOption;
-    }
-
-    @Override
-    public Boolean getValue() {
-        Boolean v = super.getValue();
-        if (v == null) {
-            return initialValue && masterOption.getValue();
-        }
-        return v;
-    }
-
-}
--- a/graal/com.oracle.graal.options/src/com/oracle/graal/options/Option.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.options;
-
-import java.lang.annotation.*;
-
-/**
- * Describes the attributes of an option whose {@link OptionValue value} is in a static field
- * annotated by this annotation type.
- *
- * @see OptionDescriptor
- */
-@Retention(RetentionPolicy.CLASS)
-@Target(ElementType.FIELD)
-public @interface Option {
-
-    /**
-     * Gets a help message for the option. New lines can be embedded in the message with
-     * {@code "%n"}.
-     */
-    String help();
-
-    /**
-     * The name of the option. By default, the name of the annotated field should be used.
-     */
-    String name() default "";
-
-    /**
-     * Specifies the type of the option.
-     */
-    OptionType type() default OptionType.Debug;
-}
--- a/graal/com.oracle.graal.options/src/com/oracle/graal/options/OptionDescriptor.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,93 +0,0 @@
-/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.options;
-
-/**
- * Describes the attributes of a static field {@linkplain Option option} and provides access to its
- * {@linkplain OptionValue value}.
- */
-public class OptionDescriptor {
-
-    protected final String name;
-    protected final Class<?> type;
-    protected final String help;
-    protected final OptionValue<?> option;
-    protected final Class<?> declaringClass;
-    protected final String fieldName;
-
-    public OptionDescriptor(String name, Class<?> type, String help, Class<?> declaringClass, String fieldName, OptionValue<?> option) {
-        this.name = name;
-        this.type = type;
-        this.help = help;
-        this.option = option;
-        this.declaringClass = declaringClass;
-        this.fieldName = fieldName;
-        assert !type.isPrimitive() : "must used boxed type instead of " + type;
-        option.setDescriptor(this);
-    }
-
-    /**
-     * Gets the type of values stored in the option. This will be the boxed type for a primitive
-     * option.
-     */
-    public Class<?> getType() {
-        return type;
-    }
-
-    /**
-     * Gets a descriptive help message for the option.
-     */
-    public String getHelp() {
-        return help;
-    }
-
-    /**
-     * Gets the name of the option. It's up to the client of this object how to use the name to get
-     * a user specified value for the option from the environment.
-     */
-    public String getName() {
-        return name;
-    }
-
-    /**
-     * Gets the boxed option value.
-     */
-    public OptionValue<?> getOptionValue() {
-        return option;
-    }
-
-    public Class<?> getDeclaringClass() {
-        return declaringClass;
-    }
-
-    public String getFieldName() {
-        return fieldName;
-    }
-
-    /**
-     * Gets a description of the location where this option is stored.
-     */
-    public String getLocation() {
-        return getDeclaringClass().getName() + "." + getFieldName();
-    }
-}
--- a/graal/com.oracle.graal.options/src/com/oracle/graal/options/OptionType.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.options;
-
-/**
- * Classifies Graal options in several categories depending on who this option is relevant for.
- *
- */
-public enum OptionType {
-    /**
-     * An option common for users to apply.
-     */
-    User,
-
-    /**
-     * An option only relevant in corner cases and for fine-tuning.
-     */
-    Expert,
-
-    /**
-     * An option only relevant when debugging the compiler.
-     */
-    Debug
-}
--- a/graal/com.oracle.graal.options/src/com/oracle/graal/options/OptionUtils.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,182 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.options;
-
-import java.util.*;
-
-public class OptionUtils {
-
-    public interface OptionConsumer {
-        void set(OptionDescriptor desc, Object value);
-    }
-
-    /**
-     * Parses a given option value specification.
-     *
-     * @param option the specification of an option and its value
-     * @param setter the object to notify of the parsed option and value.
-     */
-    public static void parseOption(String option, OptionConsumer setter) {
-        SortedMap<String, OptionDescriptor> options = OptionsLoader.options;
-        Objects.requireNonNull(setter);
-        if (option.length() == 0) {
-            return;
-        }
-
-        Object value = null;
-        String optionName = null;
-        String valueString = null;
-
-        char first = option.charAt(0);
-        if (first == '+' || first == '-') {
-            optionName = option.substring(1);
-            value = (first == '+');
-        } else {
-            int index = option.indexOf('=');
-            if (index == -1) {
-                optionName = option;
-                valueString = null;
-            } else {
-                optionName = option.substring(0, index);
-                valueString = option.substring(index + 1);
-            }
-        }
-
-        OptionDescriptor desc = options.get(optionName);
-        if (desc == null) {
-            throw new IllegalArgumentException("Option '" + optionName + "' not found");
-        }
-
-        Class<?> optionType = desc.getType();
-
-        if (value == null) {
-            if (optionType == Boolean.TYPE || optionType == Boolean.class) {
-                throw new IllegalArgumentException("Boolean option '" + optionName + "' must use +/- prefix");
-            }
-
-            if (valueString == null) {
-                throw new IllegalArgumentException("Missing value for non-boolean option '" + optionName + "' must use " + optionName + "=<value> format");
-            }
-
-            if (optionType == Float.class) {
-                value = Float.parseFloat(valueString);
-            } else if (optionType == Double.class) {
-                value = Double.parseDouble(valueString);
-            } else if (optionType == Integer.class) {
-                value = Integer.valueOf((int) parseLong(valueString));
-            } else if (optionType == Long.class) {
-                value = Long.valueOf(parseLong(valueString));
-            } else if (optionType == String.class) {
-                value = valueString;
-            } else {
-                throw new IllegalArgumentException("Wrong value for option '" + optionName + "'");
-            }
-        } else {
-            if (optionType != Boolean.class) {
-                throw new IllegalArgumentException("Non-boolean option '" + optionName + "' can not use +/- prefix. Use " + optionName + "=<value> format");
-            }
-        }
-
-        setter.set(desc, value);
-    }
-
-    private static long parseLong(String v) {
-        String valueString = v.toLowerCase();
-        long scale = 1;
-        if (valueString.endsWith("k")) {
-            scale = 1024L;
-        } else if (valueString.endsWith("m")) {
-            scale = 1024L * 1024L;
-        } else if (valueString.endsWith("g")) {
-            scale = 1024L * 1024L * 1024L;
-        } else if (valueString.endsWith("t")) {
-            scale = 1024L * 1024L * 1024L * 1024L;
-        }
-
-        if (scale != 1) {
-            /* Remove trailing scale character. */
-            valueString = valueString.substring(0, valueString.length() - 1);
-        }
-
-        return Long.parseLong(valueString) * scale;
-    }
-
-    /**
-     * Wraps some given text to one or more lines of a given maximum width.
-     *
-     * @param text text to wrap
-     * @param width maximum width of an output line, exception for words in {@code text} longer than
-     *            this value
-     * @return {@code text} broken into lines
-     */
-    private static List<String> wrap(String text, int width) {
-        List<String> lines = Collections.singletonList(text);
-        if (text.length() > width) {
-            String[] chunks = text.split("\\s+");
-            lines = new ArrayList<>();
-            StringBuilder line = new StringBuilder();
-            for (String chunk : chunks) {
-                if (line.length() + chunk.length() > width) {
-                    lines.add(line.toString());
-                    line.setLength(0);
-                }
-                if (line.length() != 0) {
-                    line.append(' ');
-                }
-                String[] embeddedLines = chunk.split("%n", -2);
-                if (embeddedLines.length == 1) {
-                    line.append(chunk);
-                } else {
-                    for (int i = 0; i < embeddedLines.length; i++) {
-                        line.append(embeddedLines[i]);
-                        if (i < embeddedLines.length - 1) {
-                            lines.add(line.toString());
-                            line.setLength(0);
-                        }
-                    }
-                }
-            }
-            if (line.length() != 0) {
-                lines.add(line.toString());
-            }
-        }
-        return lines;
-    }
-
-    public static void printFlags(SortedMap<String, OptionDescriptor> options, String prefix) {
-        System.out.println("[List of " + prefix + " options]");
-        SortedMap<String, OptionDescriptor> sortedOptions = options;
-        for (Map.Entry<String, OptionDescriptor> e : sortedOptions.entrySet()) {
-            e.getKey();
-            OptionDescriptor desc = e.getValue();
-            Object value = desc.getOptionValue().getValue();
-            List<String> helpLines = wrap(desc.getHelp(), 70);
-            System.out.println(String.format("%9s %-40s = %-14s %s", desc.getType().getSimpleName(), e.getKey(), value, helpLines.get(0)));
-            for (int i = 1; i < helpLines.size(); i++) {
-                System.out.println(String.format("%67s %s", " ", helpLines.get(i)));
-            }
-        }
-
-        System.exit(0);
-    }
-}
--- a/graal/com.oracle.graal.options/src/com/oracle/graal/options/OptionValue.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,475 +0,0 @@
-/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.options;
-
-import java.io.*;
-import java.util.*;
-import java.util.Map.Entry;
-
-/**
- * An option value.
- */
-public class OptionValue<T> {
-    /**
-     * Temporarily changes the value for an option. The {@linkplain OptionValue#getValue() value} of
-     * {@code option} is set to {@code value} until {@link OverrideScope#close()} is called on the
-     * object returned by this method.
-     * <p>
-     * Since the returned object is {@link AutoCloseable} the try-with-resource construct can be
-     * used:
-     *
-     * <pre>
-     * try (OverrideScope s = OptionValue.override(myOption, myValue) {
-     *     // code that depends on myOption == myValue
-     * }
-     * </pre>
-     */
-    public static OverrideScope override(OptionValue<?> option, Object value) {
-        OverrideScope current = getOverrideScope();
-        if (current == null) {
-            if (!value.equals(option.getValue())) {
-                return new SingleOverrideScope(option, value);
-            }
-            Map<OptionValue<?>, Object> overrides = Collections.emptyMap();
-            return new MultipleOverridesScope(current, overrides);
-        }
-        return new MultipleOverridesScope(current, option, value);
-    }
-
-    /**
-     * Temporarily changes the values for a set of options. The {@linkplain OptionValue#getValue()
-     * value} of each {@code option} in {@code overrides} is set to the corresponding {@code value}
-     * in {@code overrides} until {@link OverrideScope#close()} is called on the object returned by
-     * this method.
-     * <p>
-     * Since the returned object is {@link AutoCloseable} the try-with-resource construct can be
-     * used:
-     *
-     * <pre>
-     * Map&lt;OptionValue, Object&gt; overrides = new HashMap&lt;&gt;();
-     * overrides.put(myOption1, myValue1);
-     * overrides.put(myOption2, myValue2);
-     * try (OverrideScope s = OptionValue.override(overrides) {
-     *     // code that depends on myOption == myValue
-     * }
-     * </pre>
-     */
-    public static OverrideScope override(Map<OptionValue<?>, Object> overrides) {
-        OverrideScope current = getOverrideScope();
-        if (current == null && overrides.size() == 1) {
-            Entry<OptionValue<?>, Object> single = overrides.entrySet().iterator().next();
-            OptionValue<?> option = single.getKey();
-            Object overrideValue = single.getValue();
-            if (!overrideValue.equals(option.getValue())) {
-                return new SingleOverrideScope(option, overrideValue);
-            }
-        }
-        return new MultipleOverridesScope(current, overrides);
-    }
-
-    /**
-     * Temporarily changes the values for a set of options. The {@linkplain OptionValue#getValue()
-     * value} of each {@code option} in {@code overrides} is set to the corresponding {@code value}
-     * in {@code overrides} until {@link OverrideScope#close()} is called on the object returned by
-     * this method.
-     * <p>
-     * Since the returned object is {@link AutoCloseable} the try-with-resource construct can be
-     * used:
-     *
-     * <pre>
-     * try (OverrideScope s = OptionValue.override(myOption1, myValue1, myOption2, myValue2) {
-     *     // code that depends on myOption == myValue
-     * }
-     * </pre>
-     *
-     * @param overrides overrides in the form {@code [option1, override1, option2, override2, ...]}
-     */
-    public static OverrideScope override(Object... overrides) {
-        OverrideScope current = getOverrideScope();
-        if (current == null && overrides.length == 2) {
-            OptionValue<?> option = (OptionValue<?>) overrides[0];
-            Object overrideValue = overrides[1];
-            if (!overrideValue.equals(option.getValue())) {
-                return new SingleOverrideScope(option, overrideValue);
-            }
-        }
-        Map<OptionValue<?>, Object> map = Collections.emptyMap();
-        for (int i = 0; i < overrides.length; i += 2) {
-            OptionValue<?> option = (OptionValue<?>) overrides[i];
-            Object overrideValue = overrides[i + 1];
-            if (!overrideValue.equals(option.getValue())) {
-                if (map.isEmpty()) {
-                    map = new HashMap<>();
-                }
-                map.put(option, overrideValue);
-            }
-        }
-        return new MultipleOverridesScope(current, map);
-    }
-
-    private static final ThreadLocal<OverrideScope> overrideScopeTL = new ThreadLocal<>();
-
-    protected static OverrideScope getOverrideScope() {
-        return overrideScopeTL.get();
-    }
-
-    protected static void setOverrideScope(OverrideScope overrideScope) {
-        overrideScopeTL.set(overrideScope);
-    }
-
-    private T defaultValue;
-
-    /**
-     * The raw option value.
-     */
-    protected T value;
-
-    private OptionDescriptor descriptor;
-
-    private long reads;
-    private OptionValue<?> next;
-    private static OptionValue<?> head;
-
-    private static final boolean ShowReadsHistogram = Boolean.getBoolean("graal.showOptionValueReadsHistogram");
-
-    private static void addToHistogram(OptionValue<?> option) {
-        if (ShowReadsHistogram) {
-            synchronized (OptionValue.class) {
-                option.next = head;
-                head = option;
-            }
-        }
-    }
-
-    @SuppressWarnings("unchecked")
-    public OptionValue(T value) {
-        this.defaultValue = value;
-        this.value = (T) DEFAULT;
-        addToHistogram(this);
-    }
-
-    private static final Object DEFAULT = "DEFAULT";
-    private static final Object UNINITIALIZED = "UNINITIALIZED";
-
-    /**
-     * Creates an uninitialized option value for a subclass that initializes itself
-     * {@link #defaultValue() lazily}.
-     */
-    @SuppressWarnings("unchecked")
-    protected OptionValue() {
-        this.defaultValue = (T) UNINITIALIZED;
-        this.value = (T) DEFAULT;
-        addToHistogram(this);
-    }
-
-    /**
-     * Lazy initialization of default value.
-     */
-    protected T defaultValue() {
-        throw new InternalError("Option without a default value value must override defaultValue()");
-    }
-
-    /**
-     * Sets the descriptor for this option.
-     */
-    public void setDescriptor(OptionDescriptor descriptor) {
-        this.descriptor = descriptor;
-    }
-
-    /**
-     * Returns the descriptor for this option, if it has been set by
-     * {@link #setDescriptor(OptionDescriptor)}.
-     */
-    public OptionDescriptor getDescriptor() {
-        return descriptor;
-    }
-
-    /**
-     * Gets the name of this option. The name for an option value with a null
-     * {@linkplain #setDescriptor(OptionDescriptor) descriptor} is the value of
-     * {@link Object#toString()}.
-     */
-    public String getName() {
-        return descriptor == null ? super.toString() : (descriptor.getDeclaringClass().getName() + "." + descriptor.getName());
-    }
-
-    @Override
-    public String toString() {
-        return getName() + "=" + getValue();
-    }
-
-    /**
-     * The initial value specified in source code. The returned value is not affected by calls to
-     * {@link #setValue(Object)} or registering {@link OverrideScope}s. Therefore, it is also not
-     * affected by options set on the command line.
-     */
-    public T getDefaultValue() {
-        if (defaultValue == UNINITIALIZED) {
-            defaultValue = defaultValue();
-        }
-        return defaultValue;
-    }
-
-    /**
-     * Returns true if the option has the same value that was set in the source code.
-     */
-    public boolean hasDefaultValue() {
-        getValue(); // ensure initialized
-        return value == DEFAULT || Objects.equals(value, getDefaultValue());
-    }
-
-    /**
-     * Gets the value of this option.
-     */
-    public T getValue() {
-        if (ShowReadsHistogram) {
-            reads++;
-        }
-        if (!(this instanceof StableOptionValue)) {
-            OverrideScope overrideScope = getOverrideScope();
-            if (overrideScope != null) {
-                T override = overrideScope.getOverride(this);
-                if (override != null) {
-                    return override;
-                }
-            }
-        }
-        if (value != DEFAULT) {
-            return value;
-        } else {
-            return getDefaultValue();
-        }
-    }
-
-    /**
-     * Gets the values of this option including overridden values.
-     *
-     * @param c the collection to which the values are added. If null, one is allocated.
-     * @return the collection to which the values were added in order from most overridden to
-     *         current value
-     */
-    @SuppressWarnings("unchecked")
-    public Collection<T> getValues(Collection<T> c) {
-        Collection<T> values = c == null ? new ArrayList<>() : c;
-        if (!(this instanceof StableOptionValue)) {
-            OverrideScope overrideScope = getOverrideScope();
-            if (overrideScope != null) {
-                overrideScope.getOverrides(this, (Collection<Object>) values);
-            }
-        }
-        if (value != DEFAULT) {
-            values.add(value);
-        } else {
-            values.add(getDefaultValue());
-        }
-        return values;
-    }
-
-    /**
-     * Sets the value of this option.
-     */
-    @SuppressWarnings("unchecked")
-    public void setValue(Object v) {
-        this.value = (T) v;
-    }
-
-    /**
-     * An object whose {@link #close()} method reverts the option value overriding initiated by
-     * {@link OptionValue#override(OptionValue, Object)} or {@link OptionValue#override(Map)}.
-     */
-    public abstract static class OverrideScope implements AutoCloseable {
-
-        private Map<DerivedOptionValue<?>, Object> derivedCache = null;
-
-        public <T> T getDerived(DerivedOptionValue<T> key) {
-            if (derivedCache == null) {
-                derivedCache = new HashMap<>();
-            }
-            @SuppressWarnings("unchecked")
-            T ret = (T) derivedCache.get(key);
-            if (ret == null) {
-                ret = key.createValue();
-                derivedCache.put(key, ret);
-            }
-            return ret;
-        }
-
-        abstract void addToInherited(Map<OptionValue<?>, Object> inherited);
-
-        abstract <T> T getOverride(OptionValue<T> option);
-
-        abstract void getOverrides(OptionValue<?> option, Collection<Object> c);
-
-        public abstract void close();
-    }
-
-    static class SingleOverrideScope extends OverrideScope {
-
-        private final OptionValue<?> option;
-        private final Object value;
-
-        public SingleOverrideScope(OptionValue<?> option, Object value) {
-            if (option instanceof StableOptionValue) {
-                throw new IllegalArgumentException("Cannot override stable option " + option);
-            }
-            this.option = option;
-            this.value = value;
-            setOverrideScope(this);
-        }
-
-        @Override
-        void addToInherited(Map<OptionValue<?>, Object> inherited) {
-            inherited.put(option, value);
-        }
-
-        @SuppressWarnings("unchecked")
-        @Override
-        <T> T getOverride(OptionValue<T> key) {
-            if (key == this.option) {
-                return (T) value;
-            }
-            return null;
-        }
-
-        @Override
-        void getOverrides(OptionValue<?> key, Collection<Object> c) {
-            if (key == this.option) {
-                c.add(value);
-            }
-        }
-
-        @Override
-        public void close() {
-            setOverrideScope(null);
-        }
-    }
-
-    static class MultipleOverridesScope extends OverrideScope {
-        final OverrideScope parent;
-        final Map<OptionValue<?>, Object> overrides;
-
-        public MultipleOverridesScope(OverrideScope parent, OptionValue<?> option, Object value) {
-            this.parent = parent;
-            this.overrides = new HashMap<>();
-            if (parent != null) {
-                parent.addToInherited(overrides);
-            }
-            if (option instanceof StableOptionValue) {
-                throw new IllegalArgumentException("Cannot override stable option " + option);
-            }
-            if (!value.equals(option.getValue())) {
-                this.overrides.put(option, value);
-            }
-            if (!overrides.isEmpty()) {
-                setOverrideScope(this);
-            }
-        }
-
-        MultipleOverridesScope(OverrideScope parent, Map<OptionValue<?>, Object> overrides) {
-            this.parent = parent;
-            if (overrides.isEmpty() && parent == null) {
-                this.overrides = Collections.emptyMap();
-                return;
-            }
-            this.overrides = new HashMap<>();
-            if (parent != null) {
-                parent.addToInherited(this.overrides);
-            }
-            for (Map.Entry<OptionValue<?>, Object> e : overrides.entrySet()) {
-                OptionValue<?> option = e.getKey();
-                if (option instanceof StableOptionValue) {
-                    throw new IllegalArgumentException("Cannot override stable option " + option);
-                }
-                if (!e.getValue().equals(option.getValue())) {
-                    this.overrides.put(option, e.getValue());
-                }
-            }
-            if (!this.overrides.isEmpty()) {
-                setOverrideScope(this);
-            }
-        }
-
-        @Override
-        void addToInherited(Map<OptionValue<?>, Object> inherited) {
-            if (parent != null) {
-                parent.addToInherited(inherited);
-            }
-            inherited.putAll(overrides);
-        }
-
-        @SuppressWarnings("unchecked")
-        @Override
-        <T> T getOverride(OptionValue<T> option) {
-            return (T) overrides.get(option);
-        }
-
-        @Override
-        void getOverrides(OptionValue<?> option, Collection<Object> c) {
-            Object v = overrides.get(option);
-            if (v != null) {
-                c.add(v);
-            }
-            if (parent != null) {
-                parent.getOverrides(option, c);
-            }
-        }
-
-        @Override
-        public void close() {
-            if (!overrides.isEmpty()) {
-                setOverrideScope(parent);
-            }
-        }
-    }
-
-    static {
-        if (ShowReadsHistogram) {
-            Runtime.getRuntime().addShutdownHook(new Thread() {
-                @Override
-                public void run() {
-                    ArrayList<OptionValue<?>> options = new ArrayList<>();
-                    for (OptionValue<?> option = head; option != null; option = option.next) {
-                        options.add(option);
-                    }
-                    Collections.sort(options, new Comparator<OptionValue<?>>() {
-
-                        public int compare(OptionValue<?> o1, OptionValue<?> o2) {
-                            if (o1.reads < o2.reads) {
-                                return -1;
-                            } else if (o1.reads > o2.reads) {
-                                return 1;
-                            } else {
-                                return o1.getName().compareTo(o2.getName());
-                            }
-                        }
-                    });
-                    PrintStream out = System.out;
-                    out.println("=== OptionValue reads histogram ===");
-                    for (OptionValue<?> option : options) {
-                        out.println(option.reads + "\t" + option);
-                    }
-                }
-            });
-        }
-    }
-}
--- a/graal/com.oracle.graal.options/src/com/oracle/graal/options/Options.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.options;
-
-import java.util.*;
-
-/**
- * A {@linkplain ServiceLoader service} for accessing a set of {@link OptionDescriptor}s.
- */
-public interface Options extends Iterable<OptionDescriptor> {
-}
--- a/graal/com.oracle.graal.options/src/com/oracle/graal/options/OptionsLoader.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.options;
-
-import java.util.*;
-
-import com.oracle.graal.api.runtime.*;
-
-/**
- * Helper class used to load option descriptors. Only to be used in the slow-path.
- */
-public class OptionsLoader {
-    public static final SortedMap<String, OptionDescriptor> options = new TreeMap<>();
-
-    /**
-     * Initializes {@link #options} from {@link Options} services.
-     */
-    static {
-        for (Options opts : Services.load(Options.class)) {
-            for (OptionDescriptor desc : opts) {
-                String name = desc.getName();
-                OptionDescriptor existing = options.put(name, desc);
-                assert existing == null : "Option named \"" + name + "\" has multiple definitions: " + existing.getLocation() + " and " + desc.getLocation();
-            }
-        }
-    }
-}
--- a/graal/com.oracle.graal.options/src/com/oracle/graal/options/StableOptionValue.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,75 +0,0 @@
-/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.options;
-
-/**
- * An option that always returns the same {@linkplain #getValue() value}.
- */
-public class StableOptionValue<T> extends OptionValue<T> {
-
-    /**
-     * Creates a stable option value.
-     */
-    public StableOptionValue(T value) {
-        super(value);
-    }
-
-    /**
-     * Used to assert the invariant for stability. Without using locks, this check is not safe
-     * against races and so it's only an assertion.
-     */
-    private boolean getValueCalled;
-
-    /**
-     * Creates an uninitialized stable option value for a subclass that initializes itself
-     * {@link #defaultValue() lazily}.
-     */
-    public StableOptionValue() {
-    }
-
-    /**
-     * Gets the value of this option.
-     */
-    @Override
-    public final T getValue() {
-        T result = super.getValue();
-        assert initGetValueCalled();
-        return result;
-    }
-
-    private boolean initGetValueCalled() {
-        getValueCalled = true;
-        return true;
-    }
-
-    /**
-     * {@inheritDoc}
-     * <p>
-     * This must only be called if {@link #getValue()} has never been called.
-     */
-    @Override
-    public final void setValue(Object v) {
-        assert !getValueCalled;
-        super.setValue(v);
-    }
-}
--- a/graal/com.oracle.graal.phases.common.test/src/com/oracle/graal/phases/common/test/StampFactoryTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.phases.common.test/src/com/oracle/graal/phases/common/test/StampFactoryTest.java	Thu May 28 21:11:28 2015 -0700
@@ -26,10 +26,10 @@
 
 import org.junit.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.api.runtime.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.runtime.*;
+import com.oracle.jvmci.meta.*;
 
 public class StampFactoryTest {
 
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/CanonicalizerPhase.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/CanonicalizerPhase.java	Thu May 28 21:11:28 2015 -0700
@@ -22,8 +22,9 @@
  */
 package com.oracle.graal.phases.common;
 
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.debug.*;
+import com.oracle.jvmci.meta.ConstantReflectionProvider;
+import com.oracle.jvmci.meta.Constant;
+import com.oracle.jvmci.meta.MetaAccessProvider;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.Graph.Mark;
 import com.oracle.graal.graph.Graph.NodeEventListener;
@@ -36,6 +37,7 @@
 import com.oracle.graal.nodes.util.*;
 import com.oracle.graal.phases.*;
 import com.oracle.graal.phases.tiers.*;
+import com.oracle.jvmci.debug.*;
 
 public class CanonicalizerPhase extends BasePhase<PhaseContext> {
 
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ConditionalEliminationPhase.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ConditionalEliminationPhase.java	Thu May 28 21:11:28 2015 -0700
@@ -22,12 +22,12 @@
  */
 package com.oracle.graal.phases.common;
 
+import com.oracle.jvmci.meta.ResolvedJavaType;
+import com.oracle.jvmci.meta.Kind;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
 import java.util.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
-import com.oracle.graal.debug.*;
-import com.oracle.graal.debug.Debug.Scope;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.CallTargetNode.InvokeKind;
@@ -39,6 +39,8 @@
 import com.oracle.graal.nodes.util.*;
 import com.oracle.graal.phases.*;
 import com.oracle.graal.phases.graph.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.debug.Debug.Scope;
 
 public class ConditionalEliminationPhase extends Phase {
 
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ConvertDeoptimizeToGuardPhase.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ConvertDeoptimizeToGuardPhase.java	Thu May 28 21:11:28 2015 -0700
@@ -22,12 +22,13 @@
  */
 package com.oracle.graal.phases.common;
 
+import com.oracle.jvmci.meta.DeoptimizationReason;
+import com.oracle.jvmci.meta.Constant;
+import com.oracle.jvmci.meta.DeoptimizationAction;
 import static com.oracle.graal.phases.common.DeadCodeEliminationPhase.Optionality.*;
 
 import java.util.*;
 
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.debug.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
 import com.oracle.graal.nodeinfo.*;
@@ -36,6 +37,7 @@
 import com.oracle.graal.nodes.util.*;
 import com.oracle.graal.phases.*;
 import com.oracle.graal.phases.tiers.*;
+import com.oracle.jvmci.debug.*;
 
 /**
  * This phase will find branches which always end with a {@link DeoptimizeNode} and replace their
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/DeadCodeEliminationPhase.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/DeadCodeEliminationPhase.java	Thu May 28 21:11:28 2015 -0700
@@ -26,11 +26,11 @@
 
 import java.util.function.*;
 
-import com.oracle.graal.debug.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.*;
-import com.oracle.graal.options.*;
 import com.oracle.graal.phases.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.options.*;
 
 public class DeadCodeEliminationPhase extends Phase {
 
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/DominatorConditionalEliminationPhase.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/DominatorConditionalEliminationPhase.java	Thu May 28 21:11:28 2015 -0700
@@ -22,16 +22,16 @@
  */
 package com.oracle.graal.phases.common;
 
-import static com.oracle.graal.api.meta.DeoptimizationAction.*;
-import static com.oracle.graal.api.meta.DeoptimizationReason.*;
+import com.oracle.jvmci.meta.JavaConstant;
+import com.oracle.jvmci.meta.TriState;
+import static com.oracle.jvmci.meta.DeoptimizationAction.*;
+import static com.oracle.jvmci.meta.DeoptimizationReason.*;
 
 import java.util.*;
 import java.util.function.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.cfg.*;
 import com.oracle.graal.compiler.common.type.*;
-import com.oracle.graal.debug.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
@@ -42,6 +42,7 @@
 import com.oracle.graal.phases.*;
 import com.oracle.graal.phases.common.LoweringPhase.Frame;
 import com.oracle.graal.phases.schedule.*;
+import com.oracle.jvmci.debug.*;
 
 public class DominatorConditionalEliminationPhase extends Phase {
 
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ExpandLogicPhase.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ExpandLogicPhase.java	Thu May 28 21:11:28 2015 -0700
@@ -22,11 +22,11 @@
  */
 package com.oracle.graal.phases.common;
 
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.calc.*;
 import com.oracle.graal.phases.*;
+import com.oracle.jvmci.common.*;
 
 public class ExpandLogicPhase extends Phase {
 
@@ -48,7 +48,7 @@
             } else if (usage instanceof ConditionalNode) {
                 processConditional(binary.getX(), binary.isXNegated(), binary.getY(), binary.isYNegated(), (ConditionalNode) usage);
             } else {
-                throw GraalInternalError.shouldNotReachHere();
+                throw JVMCIError.shouldNotReachHere();
             }
         }
         binary.safeDelete();
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/FloatingReadPhase.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/FloatingReadPhase.java	Thu May 28 21:11:28 2015 -0700
@@ -22,12 +22,12 @@
  */
 package com.oracle.graal.phases.common;
 
-import static com.oracle.graal.api.meta.LocationIdentity.*;
+import com.oracle.jvmci.meta.LocationIdentity;
+import static com.oracle.jvmci.meta.LocationIdentity.*;
 import static com.oracle.graal.graph.Graph.NodeEvent.*;
 
 import java.util.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.cfg.*;
 import com.oracle.graal.graph.Graph.NodeEventScope;
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/FrameStateAssignmentPhase.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/FrameStateAssignmentPhase.java	Thu May 28 21:11:28 2015 -0700
@@ -24,7 +24,6 @@
 
 import java.util.*;
 
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.iterators.*;
 import com.oracle.graal.nodes.*;
@@ -33,6 +32,7 @@
 import com.oracle.graal.phases.*;
 import com.oracle.graal.phases.graph.*;
 import com.oracle.graal.phases.graph.ReentrantNodeIterator.NodeIteratorClosure;
+import com.oracle.jvmci.common.*;
 
 /**
  * This phase transfers {@link FrameState} nodes from {@link StateSplit} nodes to
@@ -54,7 +54,7 @@
             if (node instanceof DeoptimizingNode.DeoptBefore) {
                 DeoptimizingNode.DeoptBefore deopt = (DeoptimizingNode.DeoptBefore) node;
                 if (deopt.canDeoptimize() && deopt.stateBefore() == null) {
-                    GraalInternalError.guarantee(currentState != null, "no FrameState at DeoptimizingNode %s", deopt);
+                    JVMCIError.guarantee(currentState != null, "no FrameState at DeoptimizingNode %s", deopt);
                     deopt.setStateBefore(currentState);
                 }
             }
@@ -71,7 +71,7 @@
             if (node instanceof DeoptimizingNode.DeoptDuring) {
                 DeoptimizingNode.DeoptDuring deopt = (DeoptimizingNode.DeoptDuring) node;
                 if (deopt.canDeoptimize()) {
-                    GraalInternalError.guarantee(currentState != null, "no FrameState at DeoptimizingNode %s", deopt);
+                    JVMCIError.guarantee(currentState != null, "no FrameState at DeoptimizingNode %s", deopt);
                     deopt.computeStateDuring(currentState);
                 }
             }
@@ -79,7 +79,7 @@
             if (node instanceof DeoptimizingNode.DeoptAfter) {
                 DeoptimizingNode.DeoptAfter deopt = (DeoptimizingNode.DeoptAfter) node;
                 if (deopt.canDeoptimize() && deopt.stateAfter() == null) {
-                    GraalInternalError.guarantee(currentState != null, "no FrameState at DeoptimizingNode %s", deopt);
+                    JVMCIError.guarantee(currentState != null, "no FrameState at DeoptimizingNode %s", deopt);
                     deopt.setStateAfter(currentState);
                 }
             }
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/GuardLoweringPhase.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/GuardLoweringPhase.java	Thu May 28 21:11:28 2015 -0700
@@ -22,14 +22,13 @@
  */
 package com.oracle.graal.phases.common;
 
+import com.oracle.jvmci.meta.JavaConstant;
 import static com.oracle.graal.compiler.common.GraalOptions.*;
 
 import java.util.*;
 import java.util.Map.Entry;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.cfg.*;
-import com.oracle.graal.debug.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.StructuredGraph.GuardsStage;
@@ -43,6 +42,7 @@
 import com.oracle.graal.phases.schedule.*;
 import com.oracle.graal.phases.schedule.SchedulePhase.SchedulingStrategy;
 import com.oracle.graal.phases.tiers.*;
+import com.oracle.jvmci.debug.*;
 
 /**
  * This phase lowers {@link GuardNode GuardNodes} into corresponding control-flow structure and
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/IncrementalCanonicalizerPhase.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/IncrementalCanonicalizerPhase.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,7 @@
  */
 package com.oracle.graal.phases.common;
 
-import com.oracle.graal.graph.Graph.*;
+import com.oracle.graal.graph.Graph.NodeEventScope;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.phases.*;
 import com.oracle.graal.phases.common.util.*;
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/IterativeConditionalEliminationPhase.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/IterativeConditionalEliminationPhase.java	Thu May 28 21:11:28 2015 -0700
@@ -22,11 +22,11 @@
  */
 package com.oracle.graal.phases.common;
 
+import com.oracle.jvmci.code.BailoutException;
 import static com.oracle.graal.graph.Graph.NodeEvent.*;
 
-import com.oracle.graal.api.code.*;
+import com.oracle.graal.graph.Graph.NodeEventScope;
 import com.oracle.graal.graph.*;
-import com.oracle.graal.graph.Graph.*;
 import com.oracle.graal.graph.spi.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.phases.*;
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/LoweringPhase.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/LoweringPhase.java	Thu May 28 21:11:28 2015 -0700
@@ -22,13 +22,16 @@
  */
 package com.oracle.graal.phases.common;
 
+import com.oracle.jvmci.meta.ConstantReflectionProvider;
+import com.oracle.jvmci.meta.DeoptimizationReason;
+import com.oracle.jvmci.meta.JavaConstant;
+import com.oracle.jvmci.meta.DeoptimizationAction;
+import com.oracle.jvmci.meta.MetaAccessProvider;
 import static com.oracle.graal.compiler.common.GraalOptions.*;
 import static com.oracle.graal.phases.common.LoweringPhase.ProcessBlockState.*;
 
 import java.util.*;
 
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.Graph.Mark;
 import com.oracle.graal.graph.*;
@@ -42,6 +45,7 @@
 import com.oracle.graal.phases.*;
 import com.oracle.graal.phases.schedule.*;
 import com.oracle.graal.phases.tiers.*;
+import com.oracle.jvmci.common.*;
 
 /**
  * Processes all {@link Lowerable} nodes to do their lowering.
@@ -452,7 +456,7 @@
                 f = f.parent;
                 nextState = ST_ENTER;
             } else {
-                throw GraalInternalError.shouldNotReachHere();
+                throw JVMCIError.shouldNotReachHere();
             }
             state = nextState;
         }
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/OptimizeGuardAnchorsPhase.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/OptimizeGuardAnchorsPhase.java	Thu May 28 21:11:28 2015 -0700
@@ -24,13 +24,13 @@
 
 import java.util.*;
 
-import com.oracle.graal.debug.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.iterators.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.cfg.*;
 import com.oracle.graal.nodes.extended.*;
 import com.oracle.graal.phases.*;
+import com.oracle.jvmci.debug.*;
 
 public class OptimizeGuardAnchorsPhase extends Phase {
     private static final DebugMetric metricGuardsAnchorOptimized = Debug.metric("GuardsAnchorOptimized");
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/PushThroughPiPhase.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/PushThroughPiPhase.java	Thu May 28 21:11:28 2015 -0700
@@ -22,11 +22,11 @@
  */
 package com.oracle.graal.phases.common;
 
-import com.oracle.graal.debug.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.phases.*;
+import com.oracle.jvmci.debug.*;
 
 public class PushThroughPiPhase extends Phase {
 
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/UseTrappingNullChecksPhase.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/UseTrappingNullChecksPhase.java	Thu May 28 21:11:28 2015 -0700
@@ -22,10 +22,11 @@
  */
 package com.oracle.graal.phases.common;
 
+import com.oracle.jvmci.meta.DeoptimizationReason;
+import com.oracle.jvmci.meta.JavaConstant;
+import com.oracle.jvmci.meta.MetaAccessProvider;
 import java.util.*;
 
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.debug.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
@@ -34,6 +35,7 @@
 import com.oracle.graal.nodes.util.*;
 import com.oracle.graal.phases.*;
 import com.oracle.graal.phases.tiers.*;
+import com.oracle.jvmci.debug.*;
 
 public class UseTrappingNullChecksPhase extends BasePhase<LowTierContext> {
 
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/InliningPhase.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/InliningPhase.java	Thu May 28 21:11:28 2015 -0700
@@ -25,11 +25,11 @@
 import java.util.*;
 
 import com.oracle.graal.nodes.*;
-import com.oracle.graal.options.*;
 import com.oracle.graal.phases.common.*;
 import com.oracle.graal.phases.common.inlining.policy.*;
 import com.oracle.graal.phases.common.inlining.walker.*;
 import com.oracle.graal.phases.tiers.*;
+import com.oracle.jvmci.options.*;
 
 public class InliningPhase extends AbstractInliningPhase {
 
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/InliningUtil.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/InliningUtil.java	Thu May 28 21:11:28 2015 -0700
@@ -22,21 +22,24 @@
  */
 package com.oracle.graal.phases.common.inlining;
 
-import static com.oracle.graal.api.meta.DeoptimizationAction.*;
-import static com.oracle.graal.api.meta.DeoptimizationReason.*;
+import com.oracle.jvmci.code.BytecodeFrame;
+import com.oracle.jvmci.code.BytecodePosition;
+import com.oracle.jvmci.meta.ResolvedJavaType;
+import com.oracle.jvmci.meta.Assumptions;
+import com.oracle.jvmci.meta.Kind;
+import com.oracle.jvmci.meta.DeoptimizationReason;
+import com.oracle.jvmci.meta.DeoptimizationAction;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
+import static com.oracle.jvmci.meta.DeoptimizationAction.*;
+import static com.oracle.jvmci.meta.DeoptimizationReason.*;
 import static com.oracle.graal.compiler.common.GraalOptions.*;
 import static com.oracle.graal.compiler.common.type.StampFactory.*;
 
 import java.lang.reflect.*;
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.api.replacements.*;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.type.*;
-import com.oracle.graal.debug.*;
-import com.oracle.graal.debug.Debug.Scope;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.Graph.DuplicationReplacement;
 import com.oracle.graal.nodeinfo.*;
@@ -49,6 +52,9 @@
 import com.oracle.graal.nodes.type.*;
 import com.oracle.graal.nodes.util.*;
 import com.oracle.graal.phases.common.inlining.info.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.debug.Debug.Scope;
 
 public class InliningUtil {
 
@@ -479,7 +485,7 @@
              * value (top of stack)
              */
             if (frameState.stackSize() > 0 && (alwaysDuplicateStateAfter || stateAfterReturn.stackAt(0) != frameState.stackAt(0))) {
-                stateAfterReturn = stateAtReturn.duplicateModified(invokeReturnKind, frameState.stackAt(0));
+                stateAfterReturn = stateAtReturn.duplicateModified(invokeReturnKind, invokeReturnKind, frameState.stackAt(0));
             }
 
             frameState.replaceAndDelete(stateAfterReturn);
@@ -491,7 +497,7 @@
              */
             FrameState stateAfterException = stateAtExceptionEdge;
             if (frameState.stackSize() > 0 && stateAtExceptionEdge.stackAt(0) != frameState.stackAt(0)) {
-                stateAfterException = stateAtExceptionEdge.duplicateModified(Kind.Object, frameState.stackAt(0));
+                stateAfterException = stateAtExceptionEdge.duplicateModified(Kind.Object, Kind.Object, frameState.stackAt(0));
             }
             frameState.replaceAndDelete(stateAfterException);
             return stateAfterException;
@@ -503,7 +509,8 @@
             assert frameState.outerFrameState() == null;
             NodeInputList<ValueNode> invokeArgsList = invoke.callTarget().arguments();
             ValueNode[] invokeArgs = invokeArgsList.isEmpty() ? NO_ARGS : invokeArgsList.toArray(new ValueNode[invokeArgsList.size()]);
-            FrameState stateBeforeCall = stateAtReturn.duplicateModifiedBeforeCall(invoke.bci(), invokeReturnKind, invokeArgs);
+            ResolvedJavaMethod targetMethod = invoke.callTarget().targetMethod();
+            FrameState stateBeforeCall = stateAtReturn.duplicateModifiedBeforeCall(invoke.bci(), invokeReturnKind, targetMethod.getSignature().toParameterKinds(!targetMethod.isStatic()), invokeArgs);
             frameState.replaceAndDelete(stateBeforeCall);
             return stateBeforeCall;
         } else {
@@ -664,7 +671,7 @@
         return replacements.getSubstitution(target, invokeBci);
     }
 
-    public static FixedWithNextNode inlineMacroNode(Invoke invoke, ResolvedJavaMethod concrete, Class<? extends FixedWithNextNode> macroNodeClass) throws GraalInternalError {
+    public static FixedWithNextNode inlineMacroNode(Invoke invoke, ResolvedJavaMethod concrete, Class<? extends FixedWithNextNode> macroNodeClass) throws JVMCIError {
         StructuredGraph graph = invoke.asNode().graph();
         if (!concrete.equals(((MethodCallTargetNode) invoke.callTarget()).targetMethod())) {
             assert ((MethodCallTargetNode) invoke.callTarget()).invokeKind().hasReceiver();
@@ -685,12 +692,12 @@
         return macroNode;
     }
 
-    private static FixedWithNextNode createMacroNodeInstance(Class<? extends FixedWithNextNode> macroNodeClass, Invoke invoke) throws GraalInternalError {
+    private static FixedWithNextNode createMacroNodeInstance(Class<? extends FixedWithNextNode> macroNodeClass, Invoke invoke) throws JVMCIError {
         try {
             Constructor<?> cons = macroNodeClass.getDeclaredConstructor(Invoke.class);
             return (FixedWithNextNode) cons.newInstance(invoke);
         } catch (ReflectiveOperationException | IllegalArgumentException | SecurityException e) {
-            throw new GraalGraphInternalError(e).addContext(invoke.asNode()).addContext("macroSubstitution", macroNodeClass);
+            throw new GraalGraphJVMCIError(e).addContext(invoke.asNode()).addContext("macroSubstitution", macroNodeClass);
         }
     }
 }
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/info/AbstractInlineInfo.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/info/AbstractInlineInfo.java	Thu May 28 21:11:28 2015 -0700
@@ -22,9 +22,9 @@
  */
 package com.oracle.graal.phases.common.inlining.info;
 
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
 import java.util.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.phases.common.*;
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/info/AssumptionInlineInfo.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/info/AssumptionInlineInfo.java	Thu May 28 21:11:28 2015 -0700
@@ -22,10 +22,10 @@
  */
 package com.oracle.graal.phases.common.inlining.info;
 
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
 import java.util.*;
 
-import com.oracle.graal.api.meta.Assumptions.AssumptionResult;
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.meta.Assumptions.AssumptionResult;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.CallTargetNode.InvokeKind;
 import com.oracle.graal.nodes.*;
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/info/ExactInlineInfo.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/info/ExactInlineInfo.java	Thu May 28 21:11:28 2015 -0700
@@ -22,9 +22,9 @@
  */
 package com.oracle.graal.phases.common.inlining.info;
 
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
 import java.util.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.phases.common.inlining.info.elem.*;
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/info/InlineInfo.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/info/InlineInfo.java	Thu May 28 21:11:28 2015 -0700
@@ -22,9 +22,9 @@
  */
 package com.oracle.graal.phases.common.inlining.info;
 
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
 import java.util.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.phases.common.*;
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/info/MultiTypeGuardInlineInfo.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/info/MultiTypeGuardInlineInfo.java	Thu May 28 21:11:28 2015 -0700
@@ -22,13 +22,18 @@
  */
 package com.oracle.graal.phases.common.inlining.info;
 
+import com.oracle.jvmci.meta.ResolvedJavaType;
+import com.oracle.jvmci.meta.Kind;
+import com.oracle.jvmci.meta.DeoptimizationReason;
+import com.oracle.jvmci.meta.Constant;
+import com.oracle.jvmci.meta.DeoptimizationAction;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
+import com.oracle.jvmci.meta.MetaAccessProvider;
 import java.util.*;
 
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.api.meta.JavaTypeProfile.ProfiledType;
+import com.oracle.jvmci.meta.JavaTypeProfile.ProfiledType;
 import com.oracle.graal.compiler.common.calc.*;
 import com.oracle.graal.compiler.common.type.*;
-import com.oracle.graal.debug.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.CallTargetNode.InvokeKind;
@@ -40,6 +45,7 @@
 import com.oracle.graal.phases.common.inlining.*;
 import com.oracle.graal.phases.common.inlining.info.elem.*;
 import com.oracle.graal.phases.util.*;
+import com.oracle.jvmci.debug.*;
 
 /**
  * Polymorphic inlining of m methods with n type checks (n &ge; m) in case that the profiling
@@ -184,7 +190,7 @@
             FixedNode exceptionSux = exceptionEdge.next();
             graph.addBeforeFixed(exceptionSux, exceptionMerge);
             exceptionObjectPhi = graph.addWithoutUnique(new ValuePhiNode(StampFactory.forKind(Kind.Object), exceptionMerge));
-            exceptionMerge.setStateAfter(exceptionEdge.stateAfter().duplicateModified(invoke.stateAfter().bci, true, Kind.Object, exceptionObjectPhi));
+            exceptionMerge.setStateAfter(exceptionEdge.stateAfter().duplicateModified(invoke.stateAfter().bci, true, Kind.Object, new Kind[]{Kind.Object}, new ValueNode[]{exceptionObjectPhi}));
         }
 
         // create one separate block for each invoked method
@@ -466,7 +472,7 @@
 
             ExceptionObjectNode newExceptionEdge = (ExceptionObjectNode) exceptionEdge.copyWithInputs();
             // set new state (pop old exception object, push new one)
-            newExceptionEdge.setStateAfter(stateAfterException.duplicateModified(Kind.Object, newExceptionEdge));
+            newExceptionEdge.setStateAfter(stateAfterException.duplicateModified(Kind.Object, Kind.Object, newExceptionEdge));
 
             EndNode endNode = graph.add(new EndNode());
             newExceptionEdge.setNext(endNode);
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/info/TypeGuardInlineInfo.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/info/TypeGuardInlineInfo.java	Thu May 28 21:11:28 2015 -0700
@@ -22,9 +22,12 @@
  */
 package com.oracle.graal.phases.common.inlining.info;
 
+import com.oracle.jvmci.meta.ResolvedJavaType;
+import com.oracle.jvmci.meta.DeoptimizationReason;
+import com.oracle.jvmci.meta.DeoptimizationAction;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
 import java.util.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.calc.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.CallTargetNode.InvokeKind;
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/info/elem/Inlineable.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/info/elem/Inlineable.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,7 @@
  */
 package com.oracle.graal.phases.common.inlining.info.elem;
 
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.phases.common.*;
 import com.oracle.graal.phases.tiers.*;
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/info/elem/InlineableGraph.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/info/elem/InlineableGraph.java	Thu May 28 21:11:28 2015 -0700
@@ -22,14 +22,14 @@
  */
 package com.oracle.graal.phases.common.inlining.info.elem;
 
+import com.oracle.jvmci.meta.Constant;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
 import static com.oracle.graal.compiler.common.GraalOptions.*;
 import static com.oracle.graal.phases.common.DeadCodeEliminationPhase.Optionality.*;
 
 import java.util.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
-import com.oracle.graal.debug.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions;
@@ -37,6 +37,7 @@
 import com.oracle.graal.phases.common.inlining.*;
 import com.oracle.graal.phases.graph.*;
 import com.oracle.graal.phases.tiers.*;
+import com.oracle.jvmci.debug.*;
 
 /**
  * <p>
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/policy/AbstractInliningPolicy.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/policy/AbstractInliningPolicy.java	Thu May 28 21:11:28 2015 -0700
@@ -22,18 +22,17 @@
  */
 package com.oracle.graal.phases.common.inlining.policy;
 
-import com.oracle.graal.api.meta.ProfilingInfo;
-import com.oracle.graal.api.meta.ResolvedJavaMethod;
-import com.oracle.graal.nodes.Invoke;
-import com.oracle.graal.nodes.StructuredGraph;
-import com.oracle.graal.nodes.spi.Replacements;
-import com.oracle.graal.phases.common.inlining.InliningUtil;
-import com.oracle.graal.phases.common.inlining.info.InlineInfo;
-import com.oracle.graal.phases.common.inlining.info.elem.Inlineable;
+import com.oracle.jvmci.meta.ProfilingInfo;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
+import static com.oracle.graal.phases.common.inlining.InliningPhase.Options.*;
+
+import java.util.*;
 
-import java.util.Map;
-
-import static com.oracle.graal.phases.common.inlining.InliningPhase.Options.AlwaysInlineIntrinsics;
+import com.oracle.graal.nodes.*;
+import com.oracle.graal.nodes.spi.*;
+import com.oracle.graal.phases.common.inlining.*;
+import com.oracle.graal.phases.common.inlining.info.*;
+import com.oracle.graal.phases.common.inlining.info.elem.*;
 
 public abstract class AbstractInliningPolicy implements InliningPolicy {
     public static final float RelevanceCapForInlining = 1.0f;
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/policy/GreedyInliningPolicy.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/policy/GreedyInliningPolicy.java	Thu May 28 21:11:28 2015 -0700
@@ -22,18 +22,16 @@
  */
 package com.oracle.graal.phases.common.inlining.policy;
 
-import com.oracle.graal.debug.Debug;
-import com.oracle.graal.debug.DebugMetric;
-import com.oracle.graal.nodes.Invoke;
-import com.oracle.graal.nodes.StructuredGraph;
-import com.oracle.graal.nodes.spi.Replacements;
-import com.oracle.graal.phases.common.inlining.InliningUtil;
-import com.oracle.graal.phases.common.inlining.info.InlineInfo;
-import com.oracle.graal.phases.common.inlining.walker.MethodInvocation;
+import static com.oracle.graal.compiler.common.GraalOptions.*;
+
+import java.util.*;
 
-import java.util.Map;
-
-import static com.oracle.graal.compiler.common.GraalOptions.*;
+import com.oracle.graal.nodes.*;
+import com.oracle.graal.nodes.spi.*;
+import com.oracle.graal.phases.common.inlining.*;
+import com.oracle.graal.phases.common.inlining.info.*;
+import com.oracle.graal.phases.common.inlining.walker.*;
+import com.oracle.jvmci.debug.*;
 
 public class GreedyInliningPolicy extends AbstractInliningPolicy {
 
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/policy/InlineEverythingPolicy.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/policy/InlineEverythingPolicy.java	Thu May 28 21:11:28 2015 -0700
@@ -22,12 +22,12 @@
  */
 package com.oracle.graal.phases.common.inlining.policy;
 
-import com.oracle.graal.api.code.BailoutException;
-import com.oracle.graal.nodes.StructuredGraph;
-import com.oracle.graal.nodes.spi.Replacements;
-import com.oracle.graal.phases.common.inlining.walker.MethodInvocation;
+import com.oracle.jvmci.code.BailoutException;
+import static com.oracle.graal.compiler.common.GraalOptions.*;
 
-import static com.oracle.graal.compiler.common.GraalOptions.MaximumDesiredSize;
+import com.oracle.graal.nodes.*;
+import com.oracle.graal.nodes.spi.*;
+import com.oracle.graal.phases.common.inlining.walker.*;
 
 public class InlineEverythingPolicy implements InliningPolicy {
 
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/policy/InlineMethodSubstitutionsPolicy.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/policy/InlineMethodSubstitutionsPolicy.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,7 @@
  */
 package com.oracle.graal.phases.common.inlining.policy;
 
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.java.*;
 import com.oracle.graal.nodes.spi.*;
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/policy/InliningPolicy.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/policy/InliningPolicy.java	Thu May 28 21:11:28 2015 -0700
@@ -22,9 +22,9 @@
  */
 package com.oracle.graal.phases.common.inlining.policy;
 
-import com.oracle.graal.nodes.StructuredGraph;
-import com.oracle.graal.nodes.spi.Replacements;
-import com.oracle.graal.phases.common.inlining.walker.MethodInvocation;
+import com.oracle.graal.nodes.*;
+import com.oracle.graal.nodes.spi.*;
+import com.oracle.graal.phases.common.inlining.walker.*;
 
 public interface InliningPolicy {
 
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/walker/CallsiteHolder.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/walker/CallsiteHolder.java	Thu May 28 21:11:28 2015 -0700
@@ -22,8 +22,8 @@
  */
 package com.oracle.graal.phases.common.inlining.walker;
 
-import com.oracle.graal.api.meta.ResolvedJavaMethod;
-import com.oracle.graal.nodes.StructuredGraph;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
+import com.oracle.graal.nodes.*;
 
 /**
  * Information about a graph that will potentially be inlined. This includes tracking the
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/walker/CallsiteHolderExplorable.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/walker/CallsiteHolderExplorable.java	Thu May 28 21:11:28 2015 -0700
@@ -22,14 +22,14 @@
  */
 package com.oracle.graal.phases.common.inlining.walker;
 
-import com.oracle.graal.api.meta.ResolvedJavaMethod;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
+import java.util.*;
+import java.util.function.*;
+
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.phases.common.inlining.policy.*;
-import com.oracle.graal.phases.graph.FixedNodeProbabilityCache;
-
-import java.util.*;
-import java.util.function.ToDoubleFunction;
+import com.oracle.graal.phases.graph.*;
 
 /**
  * <p>
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/walker/InliningData.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/walker/InliningData.java	Thu May 28 21:11:28 2015 -0700
@@ -22,16 +22,16 @@
  */
 package com.oracle.graal.phases.common.inlining.walker;
 
+import com.oracle.jvmci.code.BailoutException;
+import com.oracle.jvmci.meta.JavaTypeProfile;
+import com.oracle.jvmci.meta.ResolvedJavaType;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
 import static com.oracle.graal.compiler.common.GraalOptions.*;
 
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.api.meta.Assumptions.AssumptionResult;
-import com.oracle.graal.compiler.common.*;
+import com.oracle.jvmci.meta.Assumptions.AssumptionResult;
 import com.oracle.graal.compiler.common.type.*;
-import com.oracle.graal.debug.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.java.*;
@@ -44,6 +44,8 @@
 import com.oracle.graal.phases.common.inlining.policy.*;
 import com.oracle.graal.phases.tiers.*;
 import com.oracle.graal.phases.util.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.debug.*;
 
 /**
  * <p>
@@ -385,8 +387,8 @@
         } catch (BailoutException bailout) {
             throw bailout;
         } catch (AssertionError | RuntimeException e) {
-            throw new GraalInternalError(e).addContext(calleeInfo.toString());
-        } catch (GraalInternalError e) {
+            throw new JVMCIError(e).addContext(calleeInfo.toString());
+        } catch (JVMCIError e) {
             throw e.addContext(calleeInfo.toString());
         } catch (Throwable e) {
             throw Debug.handle(e);
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/walker/InliningIterator.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/walker/InliningIterator.java	Thu May 28 21:11:28 2015 -0700
@@ -22,15 +22,11 @@
  */
 package com.oracle.graal.phases.common.inlining.walker;
 
-import com.oracle.graal.graph.Node;
-import com.oracle.graal.graph.NodeBitMap;
-import com.oracle.graal.nodes.*;
-import com.oracle.graal.nodes.java.MethodCallTargetNode;
+import java.util.*;
 
-import java.util.ArrayDeque;
-import java.util.Deque;
-import java.util.Iterator;
-import java.util.LinkedList;
+import com.oracle.graal.graph.*;
+import com.oracle.graal.nodes.*;
+import com.oracle.graal.nodes.java.*;
 
 /**
  * Given a graph, visit all fixed nodes in dominator-based order, collecting in the process the
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/walker/MethodInvocation.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/walker/MethodInvocation.java	Thu May 28 21:11:28 2015 -0700
@@ -22,9 +22,9 @@
  */
 package com.oracle.graal.phases.common.inlining.walker;
 
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
 import java.util.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.java.*;
 import com.oracle.graal.phases.common.inlining.info.*;
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/util/HashSetNodeEventListener.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/util/HashSetNodeEventListener.java	Thu May 28 21:11:28 2015 -0700
@@ -24,7 +24,8 @@
 
 import java.util.*;
 
-import com.oracle.graal.graph.Graph.*;
+import com.oracle.graal.graph.Graph.NodeEvent;
+import com.oracle.graal.graph.Graph.NodeEventListener;
 import com.oracle.graal.graph.*;
 
 /**
--- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/BasePhase.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/BasePhase.java	Thu May 28 21:11:28 2015 -0700
@@ -24,10 +24,10 @@
 
 import java.util.regex.*;
 
-import com.oracle.graal.debug.*;
-import com.oracle.graal.debug.Debug.Scope;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.debug.Debug.Scope;
 
 /**
  * Base class for all compiler phases. Subclasses should be stateless. There will be one global
@@ -62,7 +62,14 @@
      */
     private final DebugMemUseTracker memUseTracker;
 
-    private static final Pattern NAME_PATTERN = Pattern.compile("[A-Z][A-Za-z0-9]+");
+    @SuppressWarnings("all")
+    private static boolean assertionsEnabled() {
+        boolean enabled = false;
+        assert enabled = true;
+        return enabled;
+    }
+
+    private static final Pattern NAME_PATTERN = assertionsEnabled() ? Pattern.compile("[A-Z][A-Za-z0-9]+") : null;
 
     private static boolean checkName(String name) {
         assert NAME_PATTERN.matcher(name).matches() : "illegal phase name: " + name;
--- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/LazyName.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/LazyName.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,7 @@
  */
 package com.oracle.graal.phases;
 
-import com.oracle.graal.debug.*;
+import com.oracle.jvmci.debug.*;
 
 /**
  * A name whose {@link String} value is computed only when it is needed. This is useful in
--- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/OptimisticOptimizations.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/OptimisticOptimizations.java	Thu May 28 21:11:28 2015 -0700
@@ -22,11 +22,12 @@
  */
 package com.oracle.graal.phases;
 
+import com.oracle.jvmci.meta.DeoptimizationReason;
+import com.oracle.jvmci.meta.ProfilingInfo;
 import java.util.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.*;
-import com.oracle.graal.debug.*;
+import com.oracle.jvmci.debug.*;
 
 public final class OptimisticOptimizations {
 
--- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/graph/FixedNodeProbabilityCache.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/graph/FixedNodeProbabilityCache.java	Thu May 28 21:11:28 2015 -0700
@@ -25,9 +25,9 @@
 import java.util.*;
 import java.util.function.*;
 
-import com.oracle.graal.debug.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.*;
+import com.oracle.jvmci.debug.*;
 
 /**
  * Compute probabilities for fixed nodes on the fly and cache them at {@link AbstractBeginNode}s.
--- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/schedule/MemoryScheduleVerification.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/schedule/MemoryScheduleVerification.java	Thu May 28 21:11:28 2015 -0700
@@ -22,12 +22,12 @@
  */
 package com.oracle.graal.phases.schedule;
 
+import com.oracle.jvmci.meta.LocationIdentity;
 import java.util.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.cfg.*;
-import com.oracle.graal.graph.Node;
+import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.cfg.*;
 import com.oracle.graal.nodes.memory.*;
--- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/schedule/SchedulePhase.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/schedule/SchedulePhase.java	Thu May 28 21:11:28 2015 -0700
@@ -22,19 +22,19 @@
  */
 package com.oracle.graal.phases.schedule;
 
+import com.oracle.jvmci.meta.LocationIdentity;
 import static com.oracle.graal.compiler.common.GraalOptions.*;
 import static com.oracle.graal.compiler.common.cfg.AbstractControlFlowGraph.*;
 
 import java.util.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.cfg.*;
-import com.oracle.graal.debug.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.cfg.*;
 import com.oracle.graal.nodes.memory.*;
 import com.oracle.graal.phases.*;
+import com.oracle.jvmci.debug.*;
 
 import edu.umd.cs.findbugs.annotations.*;
 
--- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/tiers/CompilerConfiguration.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/tiers/CompilerConfiguration.java	Thu May 28 21:11:28 2015 -0700
@@ -22,12 +22,12 @@
  */
 package com.oracle.graal.phases.tiers;
 
-import com.oracle.graal.api.runtime.*;
+import com.oracle.graal.lir.phases.AllocationPhase.AllocationContext;
 import com.oracle.graal.lir.phases.*;
-import com.oracle.graal.lir.phases.PreAllocationOptimizationPhase.*;
-import com.oracle.graal.lir.phases.PostAllocationOptimizationPhase.*;
-import com.oracle.graal.lir.phases.AllocationPhase.*;
+import com.oracle.graal.lir.phases.PostAllocationOptimizationPhase.PostAllocationOptimizationContext;
+import com.oracle.graal.lir.phases.PreAllocationOptimizationPhase.PreAllocationOptimizationContext;
 import com.oracle.graal.phases.*;
+import com.oracle.jvmci.runtime.*;
 
 public interface CompilerConfiguration extends Service {
 
--- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/tiers/LowTierContext.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/tiers/LowTierContext.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,7 @@
  */
 package com.oracle.graal.phases.tiers;
 
-import com.oracle.graal.api.code.*;
+import com.oracle.jvmci.code.TargetDescription;
 import com.oracle.graal.phases.util.*;
 
 public class LowTierContext extends PhaseContext {
--- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/tiers/MidTierContext.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/tiers/MidTierContext.java	Thu May 28 21:11:28 2015 -0700
@@ -22,8 +22,9 @@
  */
 package com.oracle.graal.phases.tiers;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.code.SpeculationLog;
+import com.oracle.jvmci.code.TargetDescription;
+import com.oracle.jvmci.meta.ProfilingInfo;
 import com.oracle.graal.phases.*;
 import com.oracle.graal.phases.util.*;
 
--- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/tiers/PhaseContext.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/tiers/PhaseContext.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,8 @@
  */
 package com.oracle.graal.phases.tiers;
 
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.meta.MetaAccessProvider;
+import com.oracle.jvmci.meta.ConstantReflectionProvider;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.phases.util.*;
 
--- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/tiers/Suites.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/tiers/Suites.java	Thu May 28 21:11:28 2015 -0700
@@ -26,11 +26,11 @@
 
 import java.util.*;
 
-import com.oracle.graal.api.runtime.*;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.lir.phases.*;
-import com.oracle.graal.options.*;
 import com.oracle.graal.phases.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.options.*;
+import com.oracle.jvmci.runtime.*;
 
 public final class Suites {
 
@@ -98,7 +98,7 @@
              */
             defaultConfiguration = basic;
             if (defaultConfiguration == null) {
-                throw new GraalInternalError("unable to find basic compiler configuration");
+                throw new JVMCIError("unable to find basic compiler configuration");
             }
         }
     }
@@ -127,7 +127,7 @@
     public static Suites createSuites(String name) {
         CompilerConfiguration config = configurations.get(name);
         if (config == null) {
-            throw new GraalInternalError("unknown compiler configuration: " + name);
+            throw new JVMCIError("unknown compiler configuration: " + name);
         }
         return new Suites(config);
     }
@@ -145,7 +145,7 @@
     public static LIRSuites createLIRSuites(String name) {
         CompilerConfiguration config = configurations.get(name);
         if (config == null) {
-            throw new GraalInternalError("unknown compiler configuration: " + name);
+            throw new JVMCIError("unknown compiler configuration: " + name);
         }
         return new LIRSuites(config.createPreAllocationOptimizationStage(), config.createAllocationStage(), config.createPostAllocationOptimizationStage());
     }
--- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/util/GraphOrder.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/util/GraphOrder.java	Thu May 28 21:11:28 2015 -0700
@@ -24,7 +24,6 @@
 
 import java.util.*;
 
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.cfg.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.*;
@@ -35,6 +34,7 @@
 import com.oracle.graal.phases.graph.ReentrantBlockIterator.BlockIteratorClosure;
 import com.oracle.graal.phases.schedule.*;
 import com.oracle.graal.phases.schedule.SchedulePhase.SchedulingStrategy;
+import com.oracle.jvmci.common.*;
 
 public final class GraphOrder {
 
@@ -91,7 +91,7 @@
             assert node == null || node.isAlive() : node + " not alive";
             if (node != null && !visited.isMarked(node)) {
                 if (floatingOnly && node instanceof FixedNode) {
-                    throw new GraalInternalError("unexpected reference to fixed node: %s (this indicates an unexpected cycle)", node);
+                    throw new JVMCIError("unexpected reference to fixed node: %s (this indicates an unexpected cycle)", node);
                 }
                 visited.mark(node);
                 FrameState stateAfter = null;
@@ -120,8 +120,8 @@
                     visitForward(nodes, visited, stateAfter, true);
                 }
             }
-        } catch (GraalInternalError e) {
-            throw GraalGraphInternalError.transformAndAddContext(e, node);
+        } catch (JVMCIError e) {
+            throw GraalGraphJVMCIError.transformAndAddContext(e, node);
         }
     }
 
--- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/util/MethodDebugValueName.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/util/MethodDebugValueName.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,7 @@
  */
 package com.oracle.graal.phases.util;
 
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.meta.JavaMethod;
 import com.oracle.graal.phases.*;
 
 /**
--- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/util/Providers.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/util/Providers.java	Thu May 28 21:11:28 2015 -0700
@@ -22,8 +22,10 @@
  */
 package com.oracle.graal.phases.util;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.code.CodeCacheProvider;
+import com.oracle.jvmci.code.ForeignCallsProvider;
+import com.oracle.jvmci.meta.MetaAccessProvider;
+import com.oracle.jvmci.meta.ConstantReflectionProvider;
 import com.oracle.graal.compiler.common.spi.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.phases.tiers.*;
--- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/verify/VerifyDebugUsage.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/verify/VerifyDebugUsage.java	Thu May 28 21:11:28 2015 -0700
@@ -22,12 +22,13 @@
  */
 package com.oracle.graal.phases.verify;
 
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.debug.*;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
+import com.oracle.jvmci.meta.ResolvedJavaType;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.java.*;
 import com.oracle.graal.phases.*;
 import com.oracle.graal.phases.tiers.*;
+import com.oracle.jvmci.debug.*;
 
 /**
  * Verifies that no argument to one of the {@link Debug#log(String)} methods is the result of
--- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/verify/VerifyUsageWithEquals.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/verify/VerifyUsageWithEquals.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,12 @@
  */
 package com.oracle.graal.phases.verify;
 
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
+import com.oracle.jvmci.meta.ResolvedJavaType;
+import com.oracle.jvmci.meta.Signature;
+import com.oracle.jvmci.meta.TrustedInterface;
+import com.oracle.jvmci.meta.MetaAccessProvider;
+import com.oracle.jvmci.meta.Kind;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.calc.*;
--- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/BinaryGraphPrinter.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/BinaryGraphPrinter.java	Thu May 28 21:11:28 2015 -0700
@@ -22,6 +22,10 @@
  */
 package com.oracle.graal.printer;
 
+import com.oracle.jvmci.meta.ResolvedJavaField;
+import com.oracle.jvmci.meta.Signature;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
+import com.oracle.jvmci.meta.JavaType;
 import static com.oracle.graal.compiler.common.GraalOptions.*;
 import static com.oracle.graal.graph.Edges.Type.*;
 
@@ -30,13 +34,13 @@
 import java.nio.channels.*;
 import java.util.*;
 import java.util.Map.Entry;
-import com.oracle.graal.api.meta.*;
+
 import com.oracle.graal.compiler.common.cfg.*;
-import com.oracle.graal.debug.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.cfg.*;
 import com.oracle.graal.phases.schedule.*;
+import com.oracle.jvmci.debug.*;
 
 public class BinaryGraphPrinter implements GraphPrinter {
 
--- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CFGPrinter.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CFGPrinter.java	Thu May 28 21:11:28 2015 -0700
@@ -22,20 +22,24 @@
  */
 package com.oracle.graal.printer;
 
-import static com.oracle.graal.api.code.ValueUtil.*;
+import com.oracle.jvmci.code.DebugInfo;
+import com.oracle.jvmci.code.TargetDescription;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
+import com.oracle.jvmci.meta.MetaUtil;
+import com.oracle.jvmci.meta.Kind;
+import com.oracle.jvmci.meta.Value;
+import static com.oracle.jvmci.code.ValueUtil.*;
 
 import java.io.*;
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.cfg.*;
 import com.oracle.graal.compiler.gen.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.java.*;
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.alloc.lsra.*;
-import com.oracle.graal.lir.alloc.lsra.Interval.*;
+import com.oracle.graal.lir.alloc.lsra.Interval.UsePosList;
 import com.oracle.graal.lir.stackslotalloc.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
--- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CFGPrinterObserver.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CFGPrinterObserver.java	Thu May 28 21:11:28 2015 -0700
@@ -22,15 +22,16 @@
  */
 package com.oracle.graal.printer;
 
+import com.oracle.jvmci.code.CompilationResult;
+import com.oracle.jvmci.code.CodeCacheProvider;
+import com.oracle.jvmci.code.InstalledCode;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
+import com.oracle.jvmci.meta.JavaMethod;
 import java.io.*;
 import java.util.*;
 import java.util.concurrent.atomic.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.gen.*;
-import com.oracle.graal.debug.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.java.*;
 import com.oracle.graal.lir.*;
@@ -39,6 +40,8 @@
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.cfg.*;
 import com.oracle.graal.phases.schedule.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.debug.*;
 
 /**
  * Observes compilation events and uses {@link CFGPrinter} to produce a control flow graph for the
@@ -124,7 +127,7 @@
                 OutputStream out = new BufferedOutputStream(new FileOutputStream(cfgFile));
                 cfgPrinter = new CFGPrinter(out);
             } catch (FileNotFoundException e) {
-                throw new GraalInternalError("Could not open " + cfgFile.getAbsolutePath());
+                throw new JVMCIError("Could not open " + cfgFile.getAbsolutePath());
             }
             TTY.println("CFGPrinter: Output to file %s", cfgFile);
         }
--- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CompilationPrinter.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CompilationPrinter.java	Thu May 28 21:11:28 2015 -0700
@@ -22,13 +22,22 @@
  */
 package com.oracle.graal.printer;
 
+import com.oracle.jvmci.code.Architecture;
+import com.oracle.jvmci.code.VirtualObject;
+import com.oracle.jvmci.code.BytecodePosition;
+import com.oracle.jvmci.code.BytecodeFrame;
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.code.CodeUtil;
+import com.oracle.jvmci.code.RegisterSaveLayout;
+import com.oracle.jvmci.code.ReferenceMap;
+import com.oracle.jvmci.meta.MetaUtil;
+import com.oracle.jvmci.meta.Value;
+import com.oracle.jvmci.meta.JavaMethod;
 import java.io.*;
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.code.CodeUtil.RefMapFormatter;
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.debug.*;
+import com.oracle.jvmci.code.CodeUtil.RefMapFormatter;
+import com.oracle.jvmci.debug.*;
 
 /**
  * Utility for printing compilation related data structures at various compilation phases. The
--- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/DebugEnvironment.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/DebugEnvironment.java	Thu May 28 21:11:28 2015 -0700
@@ -30,7 +30,7 @@
 
 import com.oracle.graal.api.runtime.*;
 import com.oracle.graal.compiler.*;
-import com.oracle.graal.debug.*;
+import com.oracle.jvmci.debug.*;
 
 public class DebugEnvironment {
 
--- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/GraphPrinter.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/GraphPrinter.java	Thu May 28 21:11:28 2015 -0700
@@ -22,9 +22,9 @@
  */
 package com.oracle.graal.printer;
 
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
 import java.io.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.phases.schedule.*;
 
--- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/GraphPrinterDumpHandler.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/GraphPrinterDumpHandler.java	Thu May 28 21:11:28 2015 -0700
@@ -22,6 +22,8 @@
  */
 package com.oracle.graal.printer;
 
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
+import com.oracle.jvmci.meta.JavaMethod;
 import static com.oracle.graal.compiler.GraalDebugConfig.*;
 import static com.oracle.graal.compiler.common.GraalOptions.*;
 
@@ -32,11 +34,10 @@
 import java.text.*;
 import java.util.*;
 
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.debug.*;
-import com.oracle.graal.debug.Debug.Scope;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.phases.schedule.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.debug.Debug.Scope;
 
 /**
  * Observes compilation events and uses {@link IdealGraphPrinter} to generate a graph representation
--- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/HexCodeFile.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,431 +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.graal.printer;
-
-import java.io.*;
-import java.util.*;
-import java.util.regex.*;
-
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.code.CompilationResult.CodeAnnotation;
-import com.oracle.graal.api.code.CompilationResult.CodeComment;
-import com.oracle.graal.api.code.CompilationResult.JumpTable;
-
-/**
- * A HexCodeFile is a textual format for representing a chunk of machine code along with extra
- * information that can be used to enhance a disassembly of the code.
- *
- * A pseudo grammar for a HexCodeFile is given below.
- *
- * <pre>
- *     HexCodeFile ::= Platform Delim HexCode Delim (OptionalSection Delim)*
- *
- *     OptionalSection ::= Comment | OperandComment | JumpTable | LookupTable
- *
- *     Platform ::= "Platform" ISA WordWidth
- *
- *     HexCode ::= "HexCode" StartAddress HexDigits
- *
- *     Comment ::= "Comment" Position String
- *
- *     OperandComment ::= "OperandComment" Position String
- *
- *     JumpTable ::= "JumpTable" Position EntrySize Low High
- *
- *     LookupTable ::= "LookupTable" Position NPairs KeySize OffsetSize
- *
- *     Position, EntrySize, Low, High, NPairs KeySize OffsetSize ::= int
- *
- *     Delim := "&lt;||@"
- * </pre>
- *
- * There must be exactly one HexCode and Platform part in a HexCodeFile. The length of HexDigits
- * must be even as each pair of digits represents a single byte.
- * <p>
- * Below is an example of a valid Code input:
- *
- * <pre>
- *
- *  Platform AMD64 64  &lt;||@
- *  HexCode 0 e8000000009090904883ec084889842410d0ffff48893c24e800000000488b3c24488bf0e8000000004883c408c3  &lt;||@
- *  Comment 24 frame-ref-map: +0 {0}
- *  at java.lang.String.toLowerCase(String.java:2496) [bci: 1]
- *              |0
- *     locals:  |stack:0:a
- *     stack:   |stack:0:a
- *    &lt;||@
- *  OperandComment 24 {java.util.Locale.getDefault()}  &lt;||@
- *  Comment 36 frame-ref-map: +0 {0}
- *  at java.lang.String.toLowerCase(String.java:2496) [bci: 4]
- *              |0
- *     locals:  |stack:0:a
- *    &lt;||@
- *  OperandComment 36 {java.lang.String.toLowerCase(Locale)}  lt;||@
- *
- * </pre>
- */
-public class HexCodeFile {
-
-    public static final String NEW_LINE = CodeUtil.NEW_LINE;
-    public static final String SECTION_DELIM = " <||@";
-    public static final String COLUMN_END = " <|@";
-    public static final Pattern SECTION = Pattern.compile("(\\S+)\\s+(.*)", Pattern.DOTALL);
-    public static final Pattern COMMENT = Pattern.compile("(\\d+)\\s+(.*)", Pattern.DOTALL);
-    public static final Pattern OPERAND_COMMENT = COMMENT;
-    public static final Pattern JUMP_TABLE = Pattern.compile("(\\d+)\\s+(\\d+)\\s+(-{0,1}\\d+)\\s+(-{0,1}\\d+)\\s*");
-    public static final Pattern LOOKUP_TABLE = Pattern.compile("(\\d+)\\s+(\\d+)\\s+(\\d+)\\s+(\\d+)\\s*");
-    public static final Pattern HEX_CODE = Pattern.compile("(\\p{XDigit}+)(?:\\s+(\\p{XDigit}*))?");
-    public static final Pattern PLATFORM = Pattern.compile("(\\S+)\\s+(\\S+)", Pattern.DOTALL);
-
-    /**
-     * Delimiter placed before a HexCodeFile when embedded in a string/stream.
-     */
-    public static final String EMBEDDED_HCF_OPEN = "<<<HexCodeFile";
-
-    /**
-     * Delimiter placed after a HexCodeFile when embedded in a string/stream.
-     */
-    public static final String EMBEDDED_HCF_CLOSE = "HexCodeFile>>>";
-
-    /**
-     * Map from a machine code position to a list of comments for the position.
-     */
-    public final Map<Integer, List<String>> comments = new TreeMap<>();
-
-    /**
-     * Map from a machine code position to a comment for the operands of the instruction at the
-     * position.
-     */
-    public final Map<Integer, String> operandComments = new TreeMap<>();
-
-    public final byte[] code;
-
-    public final ArrayList<JumpTable> jumpTables = new ArrayList<>();
-
-    public final String isa;
-
-    public final int wordWidth;
-
-    public final long startAddress;
-
-    public HexCodeFile(byte[] code, long startAddress, String isa, int wordWidth) {
-        this.code = code;
-        this.startAddress = startAddress;
-        this.isa = isa;
-        this.wordWidth = wordWidth;
-    }
-
-    /**
-     * Parses a string in the format produced by {@link #toString()} to produce a
-     * {@link HexCodeFile} object.
-     */
-    public static HexCodeFile parse(String input, int sourceOffset, String source, String sourceName) {
-        return new Parser(input, sourceOffset, source, sourceName).hcf;
-    }
-
-    /**
-     * Formats this HexCodeFile as a string that can be parsed with
-     * {@link #parse(String, int, String, String)}.
-     */
-    @Override
-    public String toString() {
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        writeTo(baos);
-        return baos.toString();
-    }
-
-    public String toEmbeddedString() {
-        return EMBEDDED_HCF_OPEN + NEW_LINE + toString() + EMBEDDED_HCF_CLOSE;
-    }
-
-    public void writeTo(OutputStream out) {
-        PrintStream ps = out instanceof PrintStream ? (PrintStream) out : new PrintStream(out);
-        ps.printf("Platform %s %d %s%n", isa, wordWidth, SECTION_DELIM);
-        ps.printf("HexCode %x %s %s%n", startAddress, HexCodeFile.hexCodeString(code), SECTION_DELIM);
-
-        for (JumpTable table : jumpTables) {
-            ps.printf("JumpTable %d %d %d %d %s%n", table.position, table.entrySize, table.low, table.high, SECTION_DELIM);
-        }
-
-        for (Map.Entry<Integer, List<String>> e : comments.entrySet()) {
-            int pos = e.getKey();
-            for (String comment : e.getValue()) {
-                ps.printf("Comment %d %s %s%n", pos, comment, SECTION_DELIM);
-            }
-        }
-
-        for (Map.Entry<Integer, String> e : operandComments.entrySet()) {
-            ps.printf("OperandComment %d %s %s%n", e.getKey(), e.getValue(), SECTION_DELIM);
-        }
-        ps.flush();
-    }
-
-    /**
-     * Formats a byte array as a string of hex digits.
-     */
-    public static String hexCodeString(byte[] code) {
-        if (code == null) {
-            return "";
-        } else {
-            StringBuilder sb = new StringBuilder(code.length * 2);
-            for (int b : code) {
-                String hex = Integer.toHexString(b & 0xff);
-                if (hex.length() == 1) {
-                    sb.append('0');
-                }
-                sb.append(hex);
-            }
-            return sb.toString();
-        }
-    }
-
-    /**
-     * Adds a comment to the list of comments for a given position.
-     */
-    public void addComment(int pos, String comment) {
-        List<String> list = comments.get(pos);
-        if (list == null) {
-            list = new ArrayList<>();
-            comments.put(pos, list);
-        }
-        list.add(encodeString(comment));
-    }
-
-    /**
-     * Sets an operand comment for a given position.
-     *
-     * @return the previous operand comment for {@code pos}
-     */
-    public String addOperandComment(int pos, String comment) {
-        return operandComments.put(pos, encodeString(comment));
-    }
-
-    /**
-     * Adds any jump tables, lookup tables or code comments from a list of code annotations.
-     */
-    public static void addAnnotations(HexCodeFile hcf, List<CodeAnnotation> annotations) {
-        if (annotations == null || annotations.isEmpty()) {
-            return;
-        }
-        for (CodeAnnotation a : annotations) {
-            if (a instanceof JumpTable) {
-                JumpTable table = (JumpTable) a;
-                hcf.jumpTables.add(table);
-            } else if (a instanceof CodeComment) {
-                CodeComment comment = (CodeComment) a;
-                hcf.addComment(comment.position, comment.value);
-            }
-        }
-    }
-
-    /**
-     * Modifies a string to mangle any substrings matching {@link #SECTION_DELIM} and
-     * {@link #COLUMN_END}.
-     */
-    public static String encodeString(String input) {
-        int index;
-        String s = input;
-        while ((index = s.indexOf(SECTION_DELIM)) != -1) {
-            s = s.substring(0, index) + " < |@" + s.substring(index + SECTION_DELIM.length());
-        }
-        while ((index = s.indexOf(COLUMN_END)) != -1) {
-            s = s.substring(0, index) + " < @" + s.substring(index + COLUMN_END.length());
-        }
-        return s;
-    }
-
-    /**
-     * Helper class to parse a string in the format produced by {@link HexCodeFile#toString()} and
-     * produce a {@link HexCodeFile} object.
-     */
-    static class Parser {
-
-        final String input;
-        final String inputSource;
-        String isa;
-        int wordWidth;
-        byte[] code;
-        long startAddress;
-        HexCodeFile hcf;
-
-        Parser(String input, int sourceOffset, String source, String sourceName) {
-            this.input = input;
-            this.inputSource = sourceName;
-            parseSections(sourceOffset, source);
-        }
-
-        void makeHCF() {
-            if (hcf == null) {
-                if (isa != null && wordWidth != 0 && code != null) {
-                    hcf = new HexCodeFile(code, startAddress, isa, wordWidth);
-                }
-            }
-        }
-
-        void checkHCF(String section, int offset) {
-            check(hcf != null, offset, section + " section must be after Platform and HexCode section");
-        }
-
-        void check(boolean condition, int offset, String message) {
-            if (!condition) {
-                error(offset, message);
-            }
-        }
-
-        Error error(int offset, String message) {
-            throw new Error(errorMessage(offset, message));
-        }
-
-        void warning(int offset, String message) {
-            PrintStream err = System.err;
-            err.println("Warning: " + errorMessage(offset, message));
-        }
-
-        String errorMessage(int offset, String message) {
-            assert offset < input.length();
-            InputPos inputPos = filePos(offset);
-            int lineEnd = input.indexOf(HexCodeFile.NEW_LINE, offset);
-            int lineStart = offset - inputPos.col;
-            String line = lineEnd == -1 ? input.substring(lineStart) : input.substring(lineStart, lineEnd);
-            return String.format("%s:%d: %s%n%s%n%" + (inputPos.col + 1) + "s", inputSource, inputPos.line, message, line, "^");
-        }
-
-        static class InputPos {
-
-            final int line;
-            final int col;
-
-            public InputPos(int line, int col) {
-                this.line = line;
-                this.col = col;
-            }
-        }
-
-        InputPos filePos(int index) {
-            assert input != null;
-            int lineStart = input.lastIndexOf(HexCodeFile.NEW_LINE, index) + 1;
-
-            String l = input.substring(lineStart, lineStart + 10);
-            PrintStream out = System.out;
-            out.println("YYY" + input.substring(index, index + 10) + "...");
-            out.println("XXX" + l + "...");
-
-            int pos = input.indexOf(HexCodeFile.NEW_LINE, 0);
-            int line = 1;
-            while (pos > 0 && pos < index) {
-                line++;
-                pos = input.indexOf(HexCodeFile.NEW_LINE, pos + 1);
-            }
-            return new InputPos(line, index - lineStart);
-        }
-
-        void parseSections(int offset, String source) {
-            assert input.startsWith(source, offset);
-            int index = 0;
-            int endIndex = source.indexOf(SECTION_DELIM);
-            while (endIndex != -1) {
-                while (source.charAt(index) <= ' ') {
-                    index++;
-                }
-                String section = source.substring(index, endIndex).trim();
-                parseSection(offset + index, section);
-                index = endIndex + SECTION_DELIM.length();
-                endIndex = source.indexOf(SECTION_DELIM, index);
-            }
-        }
-
-        int parseInt(int offset, String value) {
-            try {
-                return Integer.parseInt(value);
-            } catch (NumberFormatException e) {
-                throw error(offset, "Not a valid integer: " + value);
-            }
-        }
-
-        void parseSection(int offset, String section) {
-            if (section.isEmpty()) {
-                return;
-            }
-            assert input.startsWith(section, offset);
-            Matcher m = HexCodeFile.SECTION.matcher(section);
-            check(m.matches(), offset, "Section does not match pattern " + HexCodeFile.SECTION);
-
-            String header = m.group(1);
-            String body = m.group(2);
-            int headerOffset = offset + m.start(1);
-            int bodyOffset = offset + m.start(2);
-
-            if (header.equals("Platform")) {
-                check(isa == null, bodyOffset, "Duplicate Platform section found");
-                m = HexCodeFile.PLATFORM.matcher(body);
-                check(m.matches(), bodyOffset, "Platform does not match pattern " + HexCodeFile.PLATFORM);
-                isa = m.group(1);
-                wordWidth = parseInt(bodyOffset + m.start(2), m.group(2));
-                makeHCF();
-            } else if (header.equals("HexCode")) {
-                check(code == null, bodyOffset, "Duplicate Code section found");
-                m = HexCodeFile.HEX_CODE.matcher(body);
-                check(m.matches(), bodyOffset, "Code does not match pattern " + HexCodeFile.HEX_CODE);
-                String hexAddress = m.group(1);
-                startAddress = Long.valueOf(hexAddress, 16);
-                String hexCode = m.group(2);
-                if (hexCode == null) {
-                    code = new byte[0];
-                } else {
-                    check((hexCode.length() % 2) == 0, bodyOffset, "Hex code length must be even");
-                    code = new byte[hexCode.length() / 2];
-                    for (int i = 0; i < code.length; i++) {
-                        String hexByte = hexCode.substring(i * 2, (i + 1) * 2);
-                        code[i] = (byte) Integer.parseInt(hexByte, 16);
-                    }
-                }
-                makeHCF();
-            } else if (header.equals("Comment")) {
-                checkHCF("Comment", headerOffset);
-                m = HexCodeFile.COMMENT.matcher(body);
-                check(m.matches(), bodyOffset, "Comment does not match pattern " + HexCodeFile.COMMENT);
-                int pos = parseInt(bodyOffset + m.start(1), m.group(1));
-                String comment = m.group(2);
-                hcf.addComment(pos, comment);
-            } else if (header.equals("OperandComment")) {
-                checkHCF("OperandComment", headerOffset);
-                m = HexCodeFile.OPERAND_COMMENT.matcher(body);
-                check(m.matches(), bodyOffset, "OperandComment does not match pattern " + HexCodeFile.OPERAND_COMMENT);
-                int pos = parseInt(bodyOffset + m.start(1), m.group(1));
-                String comment = m.group(2);
-                hcf.addOperandComment(pos, comment);
-            } else if (header.equals("JumpTable")) {
-                checkHCF("JumpTable", headerOffset);
-                m = HexCodeFile.JUMP_TABLE.matcher(body);
-                check(m.matches(), bodyOffset, "JumpTable does not match pattern " + HexCodeFile.JUMP_TABLE);
-                int pos = parseInt(bodyOffset + m.start(1), m.group(1));
-                int entrySize = parseInt(bodyOffset + m.start(2), m.group(2));
-                int low = parseInt(bodyOffset + m.start(3), m.group(3));
-                int high = parseInt(bodyOffset + m.start(4), m.group(4));
-                hcf.jumpTables.add(new JumpTable(pos, low, high, entrySize));
-            } else {
-                error(offset, "Unknown section header: " + header);
-            }
-        }
-    }
-}
--- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/IdealGraphPrinter.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/IdealGraphPrinter.java	Thu May 28 21:11:28 2015 -0700
@@ -22,13 +22,13 @@
  */
 package com.oracle.graal.printer;
 
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
 import static com.oracle.graal.compiler.common.GraalOptions.*;
 
 import java.io.*;
 import java.util.*;
 import java.util.Map.Entry;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.java.*;
 import com.oracle.graal.nodeinfo.*;
--- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/NoDeadCodeVerifyHandler.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/NoDeadCodeVerifyHandler.java	Thu May 28 21:11:28 2015 -0700
@@ -27,12 +27,12 @@
 import java.util.*;
 import java.util.concurrent.*;
 
-import com.oracle.graal.compiler.common.*;
-import com.oracle.graal.debug.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.*;
-import com.oracle.graal.options.*;
 import com.oracle.graal.phases.common.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.options.*;
 
 /**
  * Verifies that graphs have no dead code.
@@ -70,7 +70,7 @@
                 if (discovered.put(message, Boolean.TRUE) == null) {
                     before.removeAll(after);
                     String prefix = message == null ? "" : message + ": ";
-                    GraalInternalError error = new GraalInternalError("%sfound dead nodes in %s: %s", prefix, graph, before);
+                    JVMCIError error = new JVMCIError("%sfound dead nodes in %s: %s", prefix, graph, before);
                     if (NDCV.getValue() == INFO) {
                         System.out.println(error.getMessage());
                     } else if (NDCV.getValue() == VERBOSE) {
--- a/graal/com.oracle.graal.replacements.amd64/src/com/oracle/graal/replacements/amd64/AMD64ConvertSnippets.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.replacements.amd64/src/com/oracle/graal/replacements/amd64/AMD64ConvertSnippets.java	Thu May 28 21:11:28 2015 -0700
@@ -22,12 +22,11 @@
  */
 package com.oracle.graal.replacements.amd64;
 
+import com.oracle.jvmci.code.TargetDescription;
 import static com.oracle.graal.nodes.extended.BranchProbabilityNode.*;
 import static com.oracle.graal.replacements.SnippetTemplate.*;
 
-import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.replacements.*;
-import com.oracle.graal.debug.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.calc.*;
 import com.oracle.graal.nodes.spi.*;
@@ -36,6 +35,7 @@
 import com.oracle.graal.replacements.SnippetTemplate.AbstractTemplates;
 import com.oracle.graal.replacements.SnippetTemplate.Arguments;
 import com.oracle.graal.replacements.SnippetTemplate.SnippetInfo;
+import com.oracle.jvmci.debug.*;
 
 /**
  * Snippets used for conversion operations on AMD64 where the AMD64 instruction used does not match
--- a/graal/com.oracle.graal.replacements.amd64/src/com/oracle/graal/replacements/amd64/AMD64CountLeadingZerosNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.replacements.amd64/src/com/oracle/graal/replacements/amd64/AMD64CountLeadingZerosNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,8 +22,10 @@
  */
 package com.oracle.graal.replacements.amd64;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.code.CodeUtil;
+import com.oracle.jvmci.meta.Kind;
+import com.oracle.jvmci.meta.Value;
+import com.oracle.jvmci.meta.JavaConstant;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
--- a/graal/com.oracle.graal.replacements.amd64/src/com/oracle/graal/replacements/amd64/AMD64CountTrailingZerosNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.replacements.amd64/src/com/oracle/graal/replacements/amd64/AMD64CountTrailingZerosNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,8 +22,10 @@
  */
 package com.oracle.graal.replacements.amd64;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.code.CodeUtil;
+import com.oracle.jvmci.meta.Kind;
+import com.oracle.jvmci.meta.Value;
+import com.oracle.jvmci.meta.JavaConstant;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
--- a/graal/com.oracle.graal.replacements.amd64/src/com/oracle/graal/replacements/amd64/AMD64GraphBuilderPlugins.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.replacements.amd64/src/com/oracle/graal/replacements/amd64/AMD64GraphBuilderPlugins.java	Thu May 28 21:11:28 2015 -0700
@@ -22,17 +22,19 @@
  */
 package com.oracle.graal.replacements.amd64;
 
+import com.oracle.jvmci.code.ForeignCallsProvider;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
+import com.oracle.jvmci.meta.Kind;
+import com.oracle.jvmci.meta.LocationIdentity;
 import static com.oracle.graal.compiler.target.Backend.*;
 import static com.oracle.graal.replacements.amd64.AMD64MathIntrinsicNode.Operation.*;
 import sun.misc.*;
 
 import com.oracle.graal.amd64.*;
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.graphbuilderconf.*;
 import com.oracle.graal.graphbuilderconf.GraphBuilderConfiguration.Plugins;
+import com.oracle.graal.graphbuilderconf.InvocationPlugin.Receiver;
 import com.oracle.graal.graphbuilderconf.InvocationPlugins.Registration;
-import com.oracle.graal.graphbuilderconf.MethodIdMap.Receiver;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.java.*;
 import com.oracle.graal.replacements.*;
@@ -56,9 +58,9 @@
                 public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode value) {
                     ValueNode folded = AMD64CountLeadingZerosNode.tryFold(value);
                     if (folded != null) {
-                        b.addPush(folded);
+                        b.addPush(Kind.Int, folded);
                     } else {
-                        b.addPush(new AMD64CountLeadingZerosNode(value));
+                        b.addPush(Kind.Int, new AMD64CountLeadingZerosNode(value));
                     }
                     return true;
                 }
@@ -71,9 +73,9 @@
                 public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode value) {
                     ValueNode folded = AMD64CountTrailingZerosNode.tryFold(value);
                     if (folded != null) {
-                        b.addPush(folded);
+                        b.addPush(Kind.Int, folded);
                     } else {
-                        b.addPush(new AMD64CountTrailingZerosNode(value));
+                        b.addPush(Kind.Int, new AMD64CountTrailingZerosNode(value));
                     }
                     return true;
                 }
@@ -114,7 +116,7 @@
                 public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver unsafe, ValueNode object, ValueNode offset, ValueNode value) {
                     // Emits a null-check for the otherwise unused receiver
                     unsafe.get();
-                    b.addPush(kind.getStackKind(), new AtomicReadAndWriteNode(object, offset, value, kind, LocationIdentity.any()));
+                    b.addPush(kind, new AtomicReadAndWriteNode(object, offset, value, kind, LocationIdentity.any()));
                     return true;
                 }
             });
@@ -123,7 +125,7 @@
                     public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver unsafe, ValueNode object, ValueNode offset, ValueNode delta) {
                         // Emits a null-check for the otherwise unused receiver
                         unsafe.get();
-                        b.addPush(kind.getStackKind(), new AtomicReadAndAddNode(object, offset, delta, LocationIdentity.any()));
+                        b.addPush(kind, new AtomicReadAndAddNode(object, offset, delta, LocationIdentity.any()));
                         return true;
                     }
                 });
--- a/graal/com.oracle.graal.replacements.amd64/src/com/oracle/graal/replacements/amd64/AMD64MathIntrinsicNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.replacements.amd64/src/com/oracle/graal/replacements/amd64/AMD64MathIntrinsicNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,8 +22,8 @@
  */
 package com.oracle.graal.replacements.amd64;
 
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.common.*;
+import com.oracle.jvmci.meta.Kind;
+import com.oracle.jvmci.meta.Value;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
@@ -33,6 +33,7 @@
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.calc.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.common.*;
 
 @NodeInfo
 public final class AMD64MathIntrinsicNode extends UnaryNode implements ArithmeticLIRLowerable {
@@ -96,7 +97,7 @@
                 result = gen.emitMathTan(input);
                 break;
             default:
-                throw GraalInternalError.shouldNotReachHere();
+                throw JVMCIError.shouldNotReachHere();
         }
         builder.setResult(this, result);
     }
@@ -126,7 +127,7 @@
             case TAN:
                 return Math.tan(value);
             default:
-                throw new GraalInternalError("unknown op %s", op);
+                throw new JVMCIError("unknown op %s", op);
         }
     }
 }
--- a/graal/com.oracle.graal.replacements.amd64/src/com/oracle/graal/replacements/amd64/AMD64MathSubstitutions.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.replacements.amd64/src/com/oracle/graal/replacements/amd64/AMD64MathSubstitutions.java	Thu May 28 21:11:28 2015 -0700
@@ -22,9 +22,9 @@
  */
 package com.oracle.graal.replacements.amd64;
 
+import com.oracle.jvmci.meta.ForeignCallDescriptor;
 import static com.oracle.graal.compiler.target.Backend.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.graph.Node.ConstantNodeParameter;
 import com.oracle.graal.graph.Node.NodeIntrinsic;
 import com.oracle.graal.nodes.extended.*;
--- a/graal/com.oracle.graal.replacements.sparc/src/com/oracle/graal/replacements/sparc/SPARCGraphBuilderPlugins.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.replacements.sparc/src/com/oracle/graal/replacements/sparc/SPARCGraphBuilderPlugins.java	Thu May 28 21:11:28 2015 -0700
@@ -22,12 +22,12 @@
  */
 package com.oracle.graal.replacements.sparc;
 
+import com.oracle.jvmci.code.ForeignCallsProvider;
+import com.oracle.jvmci.meta.Kind;
 import static com.oracle.graal.compiler.target.Backend.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
+import com.oracle.graal.graphbuilderconf.*;
 import com.oracle.graal.graphbuilderconf.GraphBuilderConfiguration.Plugins;
-import com.oracle.graal.graphbuilderconf.*;
 import com.oracle.graal.graphbuilderconf.InvocationPlugins.Registration;
 import com.oracle.graal.replacements.*;
 
--- a/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/BitOpNodesTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/BitOpNodesTest.java	Thu May 28 21:11:28 2015 -0700
@@ -24,7 +24,6 @@
 
 import org.junit.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.compiler.test.*;
 import com.oracle.graal.nodes.*;
@@ -33,6 +32,7 @@
 import com.oracle.graal.phases.common.inlining.*;
 import com.oracle.graal.phases.tiers.*;
 import com.oracle.graal.replacements.nodes.*;
+import com.oracle.jvmci.meta.*;
 
 public class BitOpNodesTest extends GraalCompilerTest {
 
--- a/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/CheckCastTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/CheckCastTest.java	Thu May 28 21:11:28 2015 -0700
@@ -24,9 +24,9 @@
 
 import org.junit.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.java.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * Tests the implementation of checkcast, allowing profiling information to be manually specified.
--- a/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/CompiledExceptionHandlerTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/CompiledExceptionHandlerTest.java	Thu May 28 21:11:28 2015 -0700
@@ -24,12 +24,12 @@
 
 import org.junit.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.test.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions;
 import com.oracle.graal.nodes.java.*;
 import com.oracle.graal.phases.common.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * Tests compilation of a hot exception handler.
--- a/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/DeoptimizeOnExceptionTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/DeoptimizeOnExceptionTest.java	Thu May 28 21:11:28 2015 -0700
@@ -26,9 +26,9 @@
 
 import org.junit.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.test.*;
 import com.oracle.graal.phases.common.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * Tests that deoptimization upon exception handling works.
--- a/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/DynamicNewArrayTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/DynamicNewArrayTest.java	Thu May 28 21:11:28 2015 -0700
@@ -26,8 +26,8 @@
 
 import org.junit.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.test.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * Tests the implementation of Array.createInstance.
--- a/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/EdgesTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/EdgesTest.java	Thu May 28 21:11:28 2015 -0700
@@ -26,7 +26,6 @@
 
 import org.junit.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.test.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodeinfo.*;
@@ -38,6 +37,7 @@
 import com.oracle.graal.phases.common.inlining.*;
 import com.oracle.graal.phases.common.inlining.policy.*;
 import com.oracle.graal.phases.tiers.*;
+import com.oracle.jvmci.meta.*;
 
 public class EdgesTest extends GraalCompilerTest {
 
--- a/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/InstanceOfTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/InstanceOfTest.java	Thu May 28 21:11:28 2015 -0700
@@ -26,16 +26,16 @@
 
 import org.junit.*;
 
-import com.oracle.graal.api.code.CompilationResult.Call;
-import com.oracle.graal.api.code.CompilationResult.Mark;
-import com.oracle.graal.api.code.CompilationResult.Site;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.java.*;
 import com.oracle.graal.phases.common.*;
 import com.oracle.graal.replacements.test.CheckCastTest.Depth12;
 import com.oracle.graal.replacements.test.CheckCastTest.Depth13;
 import com.oracle.graal.replacements.test.CheckCastTest.Depth14;
+import com.oracle.jvmci.code.CompilationResult.Call;
+import com.oracle.jvmci.code.CompilationResult.Mark;
+import com.oracle.jvmci.code.CompilationResult.Site;
+import com.oracle.jvmci.meta.*;
 
 /**
  * Tests the implementation of instanceof, allowing profiling information to be manually specified.
--- a/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/MethodSubstitutionTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/MethodSubstitutionTest.java	Thu May 28 21:11:28 2015 -0700
@@ -24,18 +24,18 @@
 
 import java.lang.reflect.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.api.replacements.*;
 import com.oracle.graal.compiler.test.*;
-import com.oracle.graal.debug.*;
-import com.oracle.graal.debug.Debug.Scope;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions;
 import com.oracle.graal.phases.common.*;
 import com.oracle.graal.phases.common.inlining.*;
 import com.oracle.graal.phases.tiers.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.debug.Debug.Scope;
+import com.oracle.jvmci.meta.*;
 
 /**
  * Tests if {@link MethodSubstitution}s are inlined correctly. Most test cases only assert that
--- a/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/NewMultiArrayTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/NewMultiArrayTest.java	Thu May 28 21:11:28 2015 -0700
@@ -27,11 +27,11 @@
 
 import org.junit.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.test.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.java.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * Tests the lowering of the MULTIANEWARRAY instruction.
--- a/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/ObjectAccessTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/ObjectAccessTest.java	Thu May 28 21:11:28 2015 -0700
@@ -24,8 +24,6 @@
 
 import org.junit.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.test.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions;
@@ -33,6 +31,8 @@
 import com.oracle.graal.nodes.extended.*;
 import com.oracle.graal.replacements.*;
 import com.oracle.graal.word.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * Tests for the {@link Pointer} read and write operations.
--- a/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/PEGraphDecoderTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/PEGraphDecoderTest.java	Thu May 28 21:11:28 2015 -0700
@@ -24,10 +24,8 @@
 
 import org.junit.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.compiler.test.*;
-import com.oracle.graal.debug.*;
 import com.oracle.graal.graphbuilderconf.*;
 import com.oracle.graal.graphbuilderconf.InvocationPlugins.Registration;
 import com.oracle.graal.nodes.*;
@@ -39,6 +37,8 @@
 import com.oracle.graal.phases.common.*;
 import com.oracle.graal.phases.tiers.*;
 import com.oracle.graal.replacements.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.meta.*;
 
 public class PEGraphDecoderTest extends GraalCompilerTest {
 
@@ -98,7 +98,7 @@
         Registration r = new Registration(plugins, PEGraphDecoderTest.class);
         r.register2("readInt", Object.class, long.class, new InvocationPlugin() {
             @Override
-            public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, MethodIdMap.Receiver unused, ValueNode obj, ValueNode offset) {
+            public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver unused, ValueNode obj, ValueNode offset) {
                 LocationNode location = b.add(new ConstantLocationNode(LocationIdentity.any(), offset.asJavaConstant().asLong()));
                 ReadNode read = b.addPush(Kind.Int, new ReadNode(obj, location, StampFactory.forKind(Kind.Int), BarrierType.NONE));
                 read.setGuard(AbstractBeginNode.prevBegin(read));
--- a/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/PointerTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/PointerTest.java	Thu May 28 21:11:28 2015 -0700
@@ -24,8 +24,6 @@
 
 import org.junit.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.test.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions;
@@ -37,6 +35,8 @@
 import com.oracle.graal.replacements.*;
 import com.oracle.graal.word.*;
 import com.oracle.graal.word.nodes.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * Tests for the {@link Pointer} read and write operations.
--- a/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/ReplacementsParseTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/ReplacementsParseTest.java	Thu May 28 21:11:28 2015 -0700
@@ -26,7 +26,6 @@
 
 import org.junit.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.api.replacements.*;
 import com.oracle.graal.api.runtime.*;
 import com.oracle.graal.compiler.test.*;
@@ -35,6 +34,7 @@
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.runtime.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * Tests for expected behavior when parsing snippets and intrinsics.
--- a/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/StandardMethodSubstitutionsTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/StandardMethodSubstitutionsTest.java	Thu May 28 21:11:28 2015 -0700
@@ -26,12 +26,12 @@
 
 import org.junit.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.api.replacements.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.calc.*;
 import com.oracle.graal.replacements.nodes.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * Tests the VM independent {@link MethodSubstitution}s.
--- a/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/StringSubstitutionsTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/StringSubstitutionsTest.java	Thu May 28 21:11:28 2015 -0700
@@ -24,11 +24,11 @@
 
 import org.junit.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.replacements.*;
 import com.oracle.graal.replacements.nodes.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * Tests {@link StringSubstitutions}.
--- a/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/SubstitutionsTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/SubstitutionsTest.java	Thu May 28 21:11:28 2015 -0700
@@ -27,7 +27,6 @@
 
 import org.junit.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.api.replacements.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.compiler.test.*;
@@ -40,6 +39,7 @@
 import com.oracle.graal.nodes.calc.*;
 import com.oracle.graal.nodes.extended.*;
 import com.oracle.graal.nodes.memory.*;
+import com.oracle.jvmci.meta.*;
 
 public class SubstitutionsTest extends GraalCompilerTest {
 
--- a/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/TypeCheckTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/TypeCheckTest.java	Thu May 28 21:11:28 2015 -0700
@@ -22,11 +22,11 @@
  */
 package com.oracle.graal.replacements.test;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.api.meta.JavaTypeProfile.ProfiledType;
 import com.oracle.graal.compiler.test.*;
 import com.oracle.graal.nodes.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.meta.*;
+import com.oracle.jvmci.meta.JavaTypeProfile.ProfiledType;
 
 /**
  * Base class for checkcast and instanceof test classes.
--- a/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/UnsafeSubstitutionsTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/UnsafeSubstitutionsTest.java	Thu May 28 21:11:28 2015 -0700
@@ -22,15 +22,15 @@
  */
 package com.oracle.graal.replacements.test;
 
-import static com.oracle.graal.compiler.common.UnsafeAccess.*;
+import static com.oracle.jvmci.common.UnsafeAccess.*;
 
 import org.junit.*;
 
 import sun.misc.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.replacements.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * Tests the VM independent {@link UnsafeSubstitutions}.
--- a/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/UnsignedMathTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/UnsignedMathTest.java	Thu May 28 21:11:28 2015 -0700
@@ -24,8 +24,8 @@
 
 import org.junit.*;
 
-import com.oracle.graal.api.code.*;
 import com.oracle.graal.compiler.test.*;
+import com.oracle.jvmci.code.*;
 
 /**
  * Tests the substitutions for the {@link UnsignedMath} class.
--- a/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/WordTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/WordTest.java	Thu May 28 21:11:28 2015 -0700
@@ -24,12 +24,12 @@
 
 import org.junit.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.test.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions;
 import com.oracle.graal.replacements.*;
 import com.oracle.graal.word.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * Tests for the {@link Word} type.
--- a/graal/com.oracle.graal.replacements.verifier/src/com/oracle/graal/replacements/verifier/NodeIntrinsicVerifier.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.replacements.verifier/src/com/oracle/graal/replacements/verifier/NodeIntrinsicVerifier.java	Thu May 28 21:11:28 2015 -0700
@@ -54,7 +54,7 @@
     }
 
     private TypeMirror resolvedJavaTypeType() {
-        return env.getElementUtils().getTypeElement("com.oracle.graal.api.meta.ResolvedJavaType").asType();
+        return env.getElementUtils().getTypeElement("com.oracle.jvmci.meta.ResolvedJavaType").asType();
     }
 
     private TypeMirror structuralInputType() {
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/ArraySubstitutions.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/ArraySubstitutions.java	Thu May 28 21:11:28 2015 -0700
@@ -24,9 +24,9 @@
 
 import static com.oracle.graal.nodes.extended.BranchProbabilityNode.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.java.*;
+import com.oracle.jvmci.meta.*;
 
 // JaCoCo Exclude
 
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/BoxingSnippets.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/BoxingSnippets.java	Thu May 28 21:11:28 2015 -0700
@@ -27,11 +27,8 @@
 
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.api.replacements.*;
 import com.oracle.graal.compiler.common.type.*;
-import com.oracle.graal.debug.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.calc.*;
 import com.oracle.graal.nodes.extended.*;
@@ -41,6 +38,9 @@
 import com.oracle.graal.replacements.SnippetTemplate.AbstractTemplates;
 import com.oracle.graal.replacements.SnippetTemplate.Arguments;
 import com.oracle.graal.replacements.SnippetTemplate.SnippetInfo;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.meta.*;
 
 public class BoxingSnippets implements Snippets {
 
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/CachingPEGraphDecoder.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/CachingPEGraphDecoder.java	Thu May 28 21:11:28 2015 -0700
@@ -24,9 +24,6 @@
 
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.debug.*;
 import com.oracle.graal.graphbuilderconf.*;
 import com.oracle.graal.java.*;
 import com.oracle.graal.nodes.*;
@@ -35,6 +32,9 @@
 import com.oracle.graal.phases.common.*;
 import com.oracle.graal.phases.tiers.*;
 import com.oracle.graal.phases.util.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * A graph decoder that provides all necessary encoded graphs on-the-fly (by parsing the methods and
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/ConstantBindingParameterPlugin.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/ConstantBindingParameterPlugin.java	Thu May 28 21:11:28 2015 -0700
@@ -22,12 +22,12 @@
  */
 package com.oracle.graal.replacements;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.api.replacements.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graphbuilderconf.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.calc.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * A {@link ParameterPlugin} that binds constant values to some parameters.
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/DefaultGenericInvocationPlugin.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/DefaultGenericInvocationPlugin.java	Thu May 28 21:11:28 2015 -0700
@@ -22,15 +22,13 @@
  */
 package com.oracle.graal.replacements;
 
-import static com.oracle.graal.api.meta.MetaUtil.*;
 import static com.oracle.graal.replacements.NodeIntrinsificationPhase.*;
+import static com.oracle.jvmci.meta.MetaUtil.*;
 
 import java.util.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.api.replacements.*;
 import com.oracle.graal.compiler.*;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.Node.NodeIntrinsic;
 import com.oracle.graal.graphbuilderconf.*;
@@ -39,6 +37,8 @@
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.extended.*;
 import com.oracle.graal.word.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * An {@link GenericInvocationPlugin} that handles methods annotated by {@link Fold},
@@ -101,8 +101,7 @@
                 if (!COULD_NOT_FOLD.equals(constant)) {
                     if (constant != null) {
                         // Replace the invoke with the result of the call
-                        ConstantNode res = b.add(ConstantNode.forConstant(constant, b.getMetaAccess()));
-                        b.addPush(res.getKind().getStackKind(), res);
+                        b.push(method.getSignature().getReturnKind(), ConstantNode.forConstant(constant, b.getMetaAccess(), b.getGraph()));
                     } else {
                         // This must be a void invoke
                         assert method.getSignature().getReturnKind() == Kind.Void;
@@ -112,7 +111,7 @@
             } else if (MethodsElidedInSnippets != null) {
                 if (MethodFilter.matches(MethodsElidedInSnippets, method)) {
                     if (method.getSignature().getReturnKind() != Kind.Void) {
-                        throw new GraalInternalError("Cannot elide non-void method " + method.format("%H.%n(%p)"));
+                        throw new JVMCIError("Cannot elide non-void method " + method.format("%H.%n(%p)"));
                     }
                     return true;
                 }
@@ -127,7 +126,7 @@
             if (markerType != null) {
                 return markerType.value();
             } else {
-                throw GraalInternalError.shouldNotReachHere(String.format("%s extends StructuralInput, but is not annotated with @MarkerType", type));
+                throw JVMCIError.shouldNotReachHere(String.format("%s extends StructuralInput, but is not annotated with @MarkerType", type));
             }
         } else {
             return InputType.Value;
@@ -168,7 +167,7 @@
 
         if (returnKind != Kind.Void) {
             assert nonValueType || res.getKind().getStackKind() != Kind.Void;
-            res = b.addPush(returnKind.getStackKind(), res);
+            res = b.addPush(returnKind, res);
         } else {
             assert res.getKind().getStackKind() == Kind.Void;
             res = b.add(res);
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/DefaultInlineInvokePlugin.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/DefaultInlineInvokePlugin.java	Thu May 28 21:11:28 2015 -0700
@@ -25,9 +25,9 @@
 import static com.oracle.graal.compiler.common.GraalOptions.*;
 import static com.oracle.graal.java.GraphBuilderPhase.Options.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.graphbuilderconf.*;
 import com.oracle.graal.nodes.*;
+import com.oracle.jvmci.meta.*;
 
 public final class DefaultInlineInvokePlugin implements InlineInvokePlugin {
     private final ReplacementsImpl replacements;
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/DefaultJavaLoweringProvider.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/DefaultJavaLoweringProvider.java	Thu May 28 21:11:28 2015 -0700
@@ -22,19 +22,16 @@
  */
 package com.oracle.graal.replacements;
 
-import static com.oracle.graal.api.code.MemoryBarriers.*;
-import static com.oracle.graal.api.meta.DeoptimizationAction.*;
-import static com.oracle.graal.api.meta.DeoptimizationReason.*;
-import static com.oracle.graal.api.meta.LocationIdentity.*;
 import static com.oracle.graal.nodes.java.ArrayLengthNode.*;
+import static com.oracle.jvmci.code.MemoryBarriers.*;
+import static com.oracle.jvmci.meta.DeoptimizationAction.*;
+import static com.oracle.jvmci.meta.DeoptimizationReason.*;
+import static com.oracle.jvmci.meta.LocationIdentity.*;
 
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.api.replacements.*;
 import com.oracle.graal.asm.*;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.*;
@@ -42,13 +39,16 @@
 import com.oracle.graal.nodes.debug.*;
 import com.oracle.graal.nodes.extended.*;
 import com.oracle.graal.nodes.java.*;
+import com.oracle.graal.nodes.memory.HeapAccess.BarrierType;
 import com.oracle.graal.nodes.memory.*;
-import com.oracle.graal.nodes.memory.HeapAccess.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.type.*;
 import com.oracle.graal.nodes.util.*;
 import com.oracle.graal.nodes.virtual.*;
 import com.oracle.graal.phases.util.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * VM-independent lowerings for standard Java nodes. VM-specific methods are abstract and must be
@@ -106,7 +106,7 @@
         } else if (n instanceof VerifyHeapNode) {
             lowerVerifyHeap((VerifyHeapNode) n);
         } else {
-            throw GraalInternalError.shouldNotReachHere("Node implementing Lowerable not handled: " + n);
+            throw JVMCIError.shouldNotReachHere("Node implementing Lowerable not handled: " + n);
         }
     }
 
@@ -745,7 +745,7 @@
             base = indexedLocation.getDisplacement();
             index = indexedLocation.getIndex();
         } else {
-            throw GraalInternalError.shouldNotReachHere();
+            throw JVMCIError.shouldNotReachHere();
         }
 
         base -= arrayBaseOffset(elementKind);
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/GraphKit.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/GraphKit.java	Thu May 28 21:11:28 2015 -0700
@@ -27,8 +27,6 @@
 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.graphbuilderconf.*;
 import com.oracle.graal.graphbuilderconf.GraphBuilderConfiguration.Plugins;
@@ -45,6 +43,8 @@
 import com.oracle.graal.phases.common.inlining.*;
 import com.oracle.graal.phases.util.*;
 import com.oracle.graal.word.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * A utility for manually creating a graph. This will be expanded as necessary to support all
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/InstanceOfSnippetsTemplates.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/InstanceOfSnippetsTemplates.java	Thu May 28 21:11:28 2015 -0700
@@ -26,7 +26,6 @@
 
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.replacements.*;
 import com.oracle.graal.compiler.common.calc.*;
 import com.oracle.graal.graph.*;
@@ -39,6 +38,7 @@
 import com.oracle.graal.replacements.SnippetTemplate.AbstractTemplates;
 import com.oracle.graal.replacements.SnippetTemplate.Arguments;
 import com.oracle.graal.replacements.SnippetTemplate.UsageReplacer;
+import com.oracle.jvmci.code.*;
 
 /**
  * Helper class for lowering {@link InstanceOfNode}s with snippets. The majority of the complexity
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/IntrinsicGraphBuilder.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/IntrinsicGraphBuilder.java	Thu May 28 21:11:28 2015 -0700
@@ -22,17 +22,17 @@
  */
 package com.oracle.graal.replacements;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graphbuilderconf.*;
-import com.oracle.graal.graphbuilderconf.MethodIdMap.Receiver;
+import com.oracle.graal.graphbuilderconf.InvocationPlugin.Receiver;
 import com.oracle.graal.nodes.CallTargetNode.InvokeKind;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions;
 import com.oracle.graal.nodes.calc.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * Implementation of {@link GraphBuilderContext} used to produce a graph for a method based on an
@@ -133,7 +133,7 @@
     }
 
     public void handleReplacedInvoke(InvokeKind invokeKind, ResolvedJavaMethod targetMethod, ValueNode[] args) {
-        throw GraalInternalError.shouldNotReachHere();
+        throw JVMCIError.shouldNotReachHere();
     }
 
     public StampProvider getStampProvider() {
@@ -187,11 +187,11 @@
     }
 
     public IntrinsicContext getIntrinsic() {
-        throw GraalInternalError.shouldNotReachHere();
+        throw JVMCIError.shouldNotReachHere();
     }
 
     public BailoutException bailout(String string) {
-        throw GraalInternalError.shouldNotReachHere();
+        throw JVMCIError.shouldNotReachHere();
     }
 
     public ValueNode get() {
@@ -209,7 +209,7 @@
     }
 
     public void intrinsify(ResolvedJavaMethod targetMethod, ResolvedJavaMethod substitute, ValueNode[] args) {
-        throw GraalInternalError.shouldNotReachHere();
+        throw JVMCIError.shouldNotReachHere();
     }
 
     @Override
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/Log.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/Log.java	Thu May 28 21:11:28 2015 -0700
@@ -24,10 +24,10 @@
 
 import java.io.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.graph.Node.ConstantNodeParameter;
 import com.oracle.graal.graph.Node.NodeIntrinsic;
 import com.oracle.graal.nodes.extended.*;
+import com.oracle.jvmci.meta.*;
 
 //JaCoCo Exclude
 
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/MethodHandleInvocationPlugin.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/MethodHandleInvocationPlugin.java	Thu May 28 21:11:28 2015 -0700
@@ -22,13 +22,13 @@
  */
 package com.oracle.graal.replacements;
 
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.api.meta.MethodHandleAccessProvider.IntrinsicMethod;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graphbuilderconf.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.CallTargetNode.InvokeKind;
 import com.oracle.graal.replacements.nodes.*;
+import com.oracle.jvmci.meta.*;
+import com.oracle.jvmci.meta.MethodHandleAccessProvider.IntrinsicMethod;
 
 public class MethodHandleInvocationPlugin implements GenericInvocationPlugin {
     private final MethodHandleAccessProvider methodHandleAccess;
@@ -54,7 +54,7 @@
                 if (invokeReturnType.getKind() == Kind.Void) {
                     b.add(methodHandleNode);
                 } else {
-                    b.addPush(methodHandleNode);
+                    b.addPush(invokeReturnType.getKind(), methodHandleNode);
                 }
             } else {
                 CallTargetNode callTarget = invoke.callTarget();
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/NodeIntrinsificationPhase.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/NodeIntrinsificationPhase.java	Thu May 28 21:11:28 2015 -0700
@@ -22,18 +22,13 @@
  */
 package com.oracle.graal.replacements;
 
-import static com.oracle.graal.api.meta.MetaUtil.*;
+import static com.oracle.jvmci.meta.MetaUtil.*;
 
 import java.lang.reflect.*;
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.api.replacements.*;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.type.*;
-import com.oracle.graal.debug.*;
-import com.oracle.graal.debug.internal.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.Node.ConstantNodeParameter;
 import com.oracle.graal.graph.Node.InjectedNodeParameter;
@@ -45,6 +40,11 @@
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.util.*;
 import com.oracle.graal.phases.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.debug.internal.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * Replaces calls to {@link NodeIntrinsic}s with nodes and calls to methods annotated with
@@ -294,12 +294,12 @@
                         break;
                     }
                 } else {
-                    throw new GraalInternalError("Found multiple constructors in %s compatible with signature %s: %s, %s", nodeClass.toJavaName(), sigString(parameterTypes), constructor, c);
+                    throw new JVMCIError("Found multiple constructors in %s compatible with signature %s: %s, %s", nodeClass.toJavaName(), sigString(parameterTypes), constructor, c);
                 }
             }
         }
         if (constructor == null) {
-            throw new GraalInternalError("Could not find constructor in %s compatible with signature %s", nodeClass.toJavaName(), sigString(parameterTypes));
+            throw new JVMCIError("Could not find constructor in %s compatible with signature %s", nodeClass.toJavaName(), sigString(parameterTypes));
         }
 
         try {
@@ -333,7 +333,7 @@
         int count = c.getSignature().getParameterCount(false);
         for (int i = start; i < count; i++) {
             if (c.getParameterAnnotation(InjectedNodeParameter.class, i) != null) {
-                throw new GraalInternalError("Injected parameter %d of type %s must precede all non-injected parameters of %s", i,
+                throw new JVMCIError("Injected parameter %d of type %s must precede all non-injected parameters of %s", i,
                                 c.getSignature().getParameterType(i, c.getDeclaringClass()).toJavaName(false), c.format("%H.%n(%p)"));
             }
         }
@@ -364,7 +364,7 @@
                 } else if (signature[i].isAssignableFrom(metaAccess.lookupJavaType(StampProvider.class))) {
                     injected[injected.length - 1] = stampProvider;
                 } else {
-                    throw new GraalInternalError("Cannot handle injected argument of type %s in %s", signature[i].toJavaName(), c.format("%H.%n(%p)"));
+                    throw new JVMCIError("Cannot handle injected argument of type %s in %s", signature[i].toJavaName(), c.format("%H.%n(%p)"));
                 }
             } else {
                 assert checkNoMoreInjected(c, i);
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/PEGraphDecoder.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/PEGraphDecoder.java	Thu May 28 21:11:28 2015 -0700
@@ -22,15 +22,12 @@
  */
 package com.oracle.graal.replacements;
 
-import static com.oracle.graal.compiler.common.GraalInternalError.*;
 import static com.oracle.graal.java.GraphBuilderPhase.Options.*;
+import static com.oracle.jvmci.common.JVMCIError.*;
 
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
-import com.oracle.graal.debug.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
 import com.oracle.graal.graphbuilderconf.*;
@@ -44,6 +41,9 @@
 import com.oracle.graal.nodes.java.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.phases.common.inlining.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * A graph decoder that performs partial evaluation, i.e., that performs method inlining and
@@ -575,7 +575,7 @@
             }
 
             Kind invokeReturnKind = methodScope.invokeData.invoke.asNode().getKind();
-            FrameState outerState = stateAtReturn.duplicateModified(methodScope.graph, methodScope.invokeData.invoke.bci(), stateAtReturn.rethrowException(), true, invokeReturnKind);
+            FrameState outerState = stateAtReturn.duplicateModified(methodScope.graph, methodScope.invokeData.invoke.bci(), stateAtReturn.rethrowException(), true, invokeReturnKind, null, null);
 
             /*
              * When the encoded graph has methods inlining, we can already have a proper caller
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/ReplacementsImpl.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/ReplacementsImpl.java	Thu May 28 21:11:28 2015 -0700
@@ -22,11 +22,11 @@
  */
 package com.oracle.graal.replacements;
 
-import static com.oracle.graal.api.meta.MetaUtil.*;
 import static com.oracle.graal.compiler.common.GraalOptions.*;
 import static com.oracle.graal.graphbuilderconf.IntrinsicContext.CompilationContext.*;
 import static com.oracle.graal.java.GraphBuilderPhase.Options.*;
 import static com.oracle.graal.phases.common.DeadCodeEliminationPhase.Optionality.*;
+import static com.oracle.jvmci.meta.MetaUtil.*;
 import static java.lang.String.*;
 
 import java.lang.reflect.*;
@@ -36,12 +36,8 @@
 
 import sun.misc.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.api.replacements.*;
 import com.oracle.graal.compiler.common.*;
-import com.oracle.graal.debug.*;
-import com.oracle.graal.debug.Debug.Scope;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.Node.NodeIntrinsic;
 import com.oracle.graal.graphbuilderconf.*;
@@ -52,13 +48,18 @@
 import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions;
 import com.oracle.graal.nodes.java.*;
 import com.oracle.graal.nodes.spi.*;
-import com.oracle.graal.options.*;
-import com.oracle.graal.options.OptionValue.OverrideScope;
 import com.oracle.graal.phases.*;
 import com.oracle.graal.phases.common.*;
 import com.oracle.graal.phases.tiers.*;
 import com.oracle.graal.phases.util.*;
 import com.oracle.graal.word.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.debug.Debug.Scope;
+import com.oracle.jvmci.meta.*;
+import com.oracle.jvmci.options.*;
+import com.oracle.jvmci.options.OptionValue.OverrideScope;
 
 public class ReplacementsImpl implements Replacements, InlineInvokePlugin {
 
@@ -109,7 +110,7 @@
             assert b.getDepth() < MAX_GRAPH_INLINING_DEPTH : "inlining limit exceeded";
 
             if (method.getName().startsWith("$jacoco")) {
-                throw new GraalInternalError("Found call to JaCoCo instrumentation method " + method.format("%H.%n(%p)") + ". Placing \"//JaCoCo Exclude\" anywhere in " +
+                throw new JVMCIError("Found call to JaCoCo instrumentation method " + method.format("%H.%n(%p)") + ". Placing \"//JaCoCo Exclude\" anywhere in " +
                                 b.getMethod().getDeclaringClass().getSourceFileName() + " should fix this.");
             }
 
@@ -153,7 +154,7 @@
 
                     int modifiers = substituteMethod.getModifiers();
                     if (!Modifier.isStatic(modifiers)) {
-                        throw new GraalInternalError("Substitution methods must be static: " + substituteMethod);
+                        throw new JVMCIError("Substitution methods must be static: " + substituteMethod);
                     }
 
                     if (methodSubstitution != null) {
@@ -163,7 +164,7 @@
                         }
 
                         if (Modifier.isAbstract(modifiers) || Modifier.isNative(modifiers)) {
-                            throw new GraalInternalError("Substitution method must not be abstract or native: " + substituteMethod);
+                            throw new JVMCIError("Substitution method must not be abstract or native: " + substituteMethod);
                         }
                         String originalName = originalName(substituteMethod, methodSubstitution.value());
                         JavaSignature originalSignature = originalSignature(substituteMethod, methodSubstitution.signature(), methodSubstitution.isStatic());
@@ -224,7 +225,7 @@
             return null;
         }
 
-        private Executable lookupOriginalMethod(Class<?> originalClass, String name, JavaSignature signature, boolean optional) throws GraalInternalError {
+        private Executable lookupOriginalMethod(Class<?> originalClass, String name, JavaSignature signature, boolean optional) throws JVMCIError {
             try {
                 if (name.equals("<init>")) {
                     assert signature.returnType.equals(void.class) : signature;
@@ -241,7 +242,7 @@
                 if (optional) {
                     return null;
                 }
-                throw new GraalInternalError(e);
+                throw new JVMCIError(e);
             }
         }
     }
@@ -358,7 +359,7 @@
         if (guardClass != SubstitutionGuard.class) {
             Constructor<?>[] constructors = guardClass.getConstructors();
             if (constructors.length != 1) {
-                throw new GraalInternalError("Substitution guard " + guardClass.getSimpleName() + " must have a single public constructor");
+                throw new JVMCIError("Substitution guard " + guardClass.getSimpleName() + " must have a single public constructor");
             }
             Constructor<?> constructor = constructors[0];
             Class<?>[] paramTypes = constructor.getParameterTypes();
@@ -372,13 +373,13 @@
                     } else if (paramTypes[i].isInstance(target.arch)) {
                         args[i] = target.arch;
                     } else {
-                        throw new GraalInternalError("Unsupported type %s in substitution guard constructor: %s", paramTypes[i].getName(), constructor);
+                        throw new JVMCIError("Unsupported type %s in substitution guard constructor: %s", paramTypes[i].getName(), constructor);
                     }
                 }
 
                 return (SubstitutionGuard) constructor.newInstance(args);
             } catch (Exception e) {
-                throw new GraalInternalError(e);
+                throw new JVMCIError(e);
             }
         }
         return null;
@@ -611,7 +612,7 @@
             if (optional) {
                 return null;
             }
-            throw new GraalInternalError("Could not resolve type " + className);
+            throw new JVMCIError("Could not resolve type " + className);
         }
     }
 
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/SnippetCounterNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/SnippetCounterNode.java	Thu May 28 21:11:28 2015 -0700
@@ -23,15 +23,12 @@
 package com.oracle.graal.replacements;
 
 import static com.oracle.graal.compiler.common.GraalOptions.*;
-import static com.oracle.graal.compiler.common.UnsafeAccess.*;
 import static com.oracle.graal.replacements.SnippetTemplate.*;
+import static com.oracle.jvmci.common.UnsafeAccess.*;
 
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.api.replacements.*;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodeinfo.*;
@@ -43,6 +40,9 @@
 import com.oracle.graal.replacements.SnippetTemplate.Arguments;
 import com.oracle.graal.replacements.SnippetTemplate.SnippetInfo;
 import com.oracle.graal.word.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * This node can be used to add a counter to the code that will estimate the dynamic number of calls
@@ -124,7 +124,7 @@
             try {
                 return (int) unsafe.objectFieldOffset(SnippetCounter.class.getDeclaredField("value"));
             } catch (Exception e) {
-                throw new GraalInternalError(e);
+                throw new JVMCIError(e);
             }
         }
 
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/SnippetTemplate.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/SnippetTemplate.java	Thu May 28 21:11:28 2015 -0700
@@ -22,10 +22,10 @@
  */
 package com.oracle.graal.replacements;
 
-import static com.oracle.graal.api.meta.LocationIdentity.*;
-import static com.oracle.graal.debug.Debug.*;
 import static com.oracle.graal.phases.common.DeadCodeEliminationPhase.Optionality.*;
 import static com.oracle.graal.replacements.SnippetTemplate.AbstractTemplates.*;
+import static com.oracle.jvmci.debug.Debug.*;
+import static com.oracle.jvmci.meta.LocationIdentity.*;
 import static java.util.FormattableFlags.*;
 
 import java.io.*;
@@ -36,13 +36,8 @@
 import java.util.function.*;
 import java.util.stream.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.api.replacements.*;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.type.*;
-import com.oracle.graal.debug.*;
-import com.oracle.graal.debug.Debug.Scope;
 import com.oracle.graal.graph.Graph.Mark;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.Node;
@@ -65,6 +60,11 @@
 import com.oracle.graal.replacements.Snippet.VarargsParameter;
 import com.oracle.graal.replacements.nodes.*;
 import com.oracle.graal.word.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.debug.Debug.Scope;
+import com.oracle.jvmci.meta.*;
 
 /**
  * A snippet template is a graph created by parsing a snippet method and then specialized by binding
@@ -657,7 +657,7 @@
                         // The template lowering doesn't really treat this as an array so you can't
                         // store back into the varargs. Allocate your own array if you really need
                         // this and EA should eliminate it.
-                        throw new GraalInternalError("Can't store into VarargsParameter array");
+                        throw new JVMCIError("Can't store into VarargsParameter array");
                     }
                 }
             } else {
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/StandardGraphBuilderPlugins.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/StandardGraphBuilderPlugins.java	Thu May 28 21:11:28 2015 -0700
@@ -22,32 +22,32 @@
  */
 package com.oracle.graal.replacements;
 
-import static com.oracle.graal.api.code.MemoryBarriers.*;
+import static com.oracle.jvmci.code.MemoryBarriers.*;
 
 import java.lang.reflect.*;
 import java.util.*;
 
 import sun.misc.*;
 
-import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.directives.*;
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.calc.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graphbuilderconf.*;
+import com.oracle.graal.graphbuilderconf.InvocationPlugin.Receiver;
 import com.oracle.graal.graphbuilderconf.InvocationPlugins.Registration;
-import com.oracle.graal.graphbuilderconf.MethodIdMap.Receiver;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.calc.*;
 import com.oracle.graal.nodes.debug.*;
 import com.oracle.graal.nodes.extended.*;
 import com.oracle.graal.nodes.java.*;
 import com.oracle.graal.nodes.util.*;
-import com.oracle.graal.options.*;
 import com.oracle.graal.replacements.nodes.*;
 import com.oracle.graal.replacements.nodes.arithmetic.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.meta.*;
+import com.oracle.jvmci.options.*;
 
 /**
  * Provides non-runtime specific {@link InvocationPlugin}s.
@@ -92,7 +92,7 @@
         try {
             STRING_VALUE_FIELD = String.class.getDeclaredField("value");
         } catch (NoSuchFieldException e) {
-            throw new GraalInternalError(e);
+            throw new JVMCIError(e);
         }
     }
 
@@ -104,7 +104,7 @@
         r.register1("getValue", String.class, new InvocationPlugin() {
             public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode value) {
                 ResolvedJavaField field = b.getMetaAccess().lookupJavaField(STRING_VALUE_FIELD);
-                b.addPush(new LoadFieldNode(value, field));
+                b.addPush(Kind.Object, new LoadFieldNode(value, field));
                 return true;
             }
         });
@@ -209,7 +209,7 @@
                 ReverseBytesNode reverse = b.add(new ReverseBytesNode(value));
                 RightShiftNode rightShift = b.add(new RightShiftNode(reverse, b.add(ConstantNode.forInt(16))));
                 ZeroExtendNode charCast = b.add(new ZeroExtendNode(b.add(new NarrowNode(rightShift, 16)), 32));
-                b.push(Kind.Char.getStackKind(), b.recursiveAppend(charCast.canonical(null, value)));
+                b.push(Kind.Char, b.recursiveAppend(charCast.canonical(null, value)));
                 return true;
             }
         });
@@ -223,7 +223,7 @@
                 ReverseBytesNode reverse = b.add(new ReverseBytesNode(value));
                 RightShiftNode rightShift = b.add(new RightShiftNode(reverse, b.add(ConstantNode.forInt(16))));
                 SignExtendNode charCast = b.add(new SignExtendNode(b.add(new NarrowNode(rightShift, 16)), 32));
-                b.push(Kind.Short.getStackKind(), b.recursiveAppend(charCast.canonical(null, value)));
+                b.push(Kind.Short, b.recursiveAppend(charCast.canonical(null, value)));
                 return true;
             }
         });
@@ -267,19 +267,19 @@
             Class<?> type = kind.toJavaClass();
             r.register2("addExact", type, type, new InvocationPlugin() {
                 public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode x, ValueNode y) {
-                    b.addPush(kind.getStackKind(), new IntegerAddExactNode(x, y));
+                    b.addPush(kind, new IntegerAddExactNode(x, y));
                     return true;
                 }
             });
             r.register2("subtractExact", type, type, new InvocationPlugin() {
                 public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode x, ValueNode y) {
-                    b.addPush(kind.getStackKind(), new IntegerSubExactNode(x, y));
+                    b.addPush(kind, new IntegerSubExactNode(x, y));
                     return true;
                 }
             });
             r.register2("multiplyExact", type, type, new InvocationPlugin() {
                 public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode x, ValueNode y) {
-                    b.addPush(kind.getStackKind(), new IntegerMulExactNode(x, y));
+                    b.addPush(kind, new IntegerMulExactNode(x, y));
                     return true;
                 }
             });
@@ -329,7 +329,7 @@
             }
 
             LogicNode compare = CompareNode.createCompareNode(graph, cond, lhs, rhs, b.getConstantReflection());
-            b.addPush(Kind.Boolean.getStackKind(), new ConditionalNode(compare, trueValue, falseValue));
+            b.addPush(Kind.Boolean, new ConditionalNode(compare, trueValue, falseValue));
             return true;
         }
     }
@@ -410,14 +410,14 @@
         r.register2("isInstance", Receiver.class, Object.class, new InvocationPlugin() {
             public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver type, ValueNode object) {
                 LogicNode condition = b.add(InstanceOfDynamicNode.create(b.getConstantReflection(), type.get(), object));
-                b.push(Kind.Boolean.getStackKind(), b.recursiveAppend(new ConditionalNode(condition).canonical(null)));
+                b.push(Kind.Boolean, b.recursiveAppend(new ConditionalNode(condition).canonical(null)));
                 return true;
             }
         });
         r.register2("isAssignableFrom", Receiver.class, Class.class, new InvocationPlugin() {
             public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver type, ValueNode otherType) {
                 ClassIsAssignableFromNode condition = b.recursiveAppend(new ClassIsAssignableFromNode(type.get(), otherType));
-                b.push(Kind.Boolean.getStackKind(), b.recursiveAppend(new ConditionalNode(condition).canonical(null)));
+                b.push(Kind.Boolean, b.recursiveAppend(new ConditionalNode(condition).canonical(null)));
                 return true;
             }
         });
@@ -496,7 +496,7 @@
                 }
             }
             ValueNode valueNode = UnboxNode.create(b.getMetaAccess(), b.getConstantReflection(), receiver.get(), kind);
-            b.addPush(kind.getStackKind(), valueNode);
+            b.addPush(kind, valueNode);
             return true;
         }
 
@@ -519,7 +519,7 @@
         public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver unsafe, ValueNode address) {
             // Emits a null-check for the otherwise unused receiver
             unsafe.get();
-            b.addPush(returnKind.getStackKind(), new DirectReadNode(address, returnKind));
+            b.addPush(returnKind, new DirectReadNode(address, returnKind));
             return true;
         }
 
@@ -529,7 +529,7 @@
             if (isVolatile) {
                 b.add(new MembarNode(JMM_PRE_VOLATILE_READ));
             }
-            b.addPush(returnKind.getStackKind(), new UnsafeLoadNode(object, offset, returnKind, LocationIdentity.any()));
+            b.addPush(returnKind, new UnsafeLoadNode(object, offset, returnKind, LocationIdentity.any()));
             if (isVolatile) {
                 b.add(new MembarNode(JMM_POST_VOLATILE_READ));
             }
@@ -586,7 +586,7 @@
 
         r.register0("inCompiledCode", new InvocationPlugin() {
             public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver) {
-                b.addPush(Kind.Int, ConstantNode.forInt(1));
+                b.addPush(Kind.Boolean, ConstantNode.forBoolean(true));
                 return true;
             }
         });
@@ -600,7 +600,7 @@
 
         r.register2("injectBranchProbability", double.class, boolean.class, new InvocationPlugin() {
             public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode probability, ValueNode condition) {
-                b.addPush(Kind.Int, new BranchProbabilityNode(probability, condition));
+                b.addPush(Kind.Boolean, new BranchProbabilityNode(probability, condition));
                 return true;
             }
         });
@@ -617,10 +617,9 @@
                 Class<?> javaClass = kind == Kind.Object ? Object.class : kind.toJavaClass();
                 r.register1("blackhole", javaClass, blackholePlugin);
 
-                final Kind stackKind = kind.getStackKind();
                 r.register1("opaque", javaClass, new InvocationPlugin() {
                     public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode value) {
-                        b.addPush(stackKind, new OpaqueNode(value));
+                        b.addPush(kind, new OpaqueNode(value));
                         return true;
                     }
                 });
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/UnsafeSubstitutions.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/UnsafeSubstitutions.java	Thu May 28 21:11:28 2015 -0700
@@ -28,10 +28,10 @@
 
 import sun.misc.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.api.replacements.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.java.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * Substitutions for {@link sun.misc.Unsafe} methods.
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/WordOperationPlugin.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/WordOperationPlugin.java	Thu May 28 21:11:28 2015 -0700
@@ -22,14 +22,12 @@
  */
 package com.oracle.graal.replacements;
 
-import static com.oracle.graal.api.meta.LocationIdentity.*;
 import static com.oracle.graal.nodes.ConstantNode.*;
+import static com.oracle.jvmci.meta.LocationIdentity.*;
 
 import java.lang.reflect.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.api.replacements.*;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.calc.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graphbuilderconf.*;
@@ -41,6 +39,8 @@
 import com.oracle.graal.word.Word.Opcode;
 import com.oracle.graal.word.Word.Operation;
 import com.oracle.graal.word.nodes.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * A {@link GenericInvocationPlugin} for calls to {@linkplain Operation word operations}, and a
@@ -98,27 +98,26 @@
         return false;
     }
 
-    protected void processWordOperation(GraphBuilderContext b, ValueNode[] args, ResolvedJavaMethod wordMethod) throws GraalInternalError {
+    protected void processWordOperation(GraphBuilderContext b, ValueNode[] args, ResolvedJavaMethod wordMethod) throws JVMCIError {
         Operation operation = wordMethod.getAnnotation(Word.Operation.class);
         Kind returnKind = wordMethod.getSignature().getReturnKind();
-        Kind returnStackKind = returnKind.getStackKind();
         switch (operation.opcode()) {
             case NODE_CLASS:
                 assert args.length == 2;
                 ValueNode left = args[0];
                 ValueNode right = operation.rightOperandIsInt() ? toUnsigned(b, args[1], Kind.Int) : fromSigned(b, args[1]);
 
-                b.addPush(returnStackKind, createBinaryNodeInstance(operation.node(), left, right));
+                b.addPush(returnKind, createBinaryNodeInstance(operation.node(), left, right));
                 break;
 
             case COMPARISON:
                 assert args.length == 2;
-                b.push(returnStackKind, comparisonOp(b, operation.condition(), args[0], fromSigned(b, args[1])));
+                b.push(returnKind, comparisonOp(b, operation.condition(), args[0], fromSigned(b, args[1])));
                 break;
 
             case NOT:
                 assert args.length == 1;
-                b.addPush(returnStackKind, new XorNode(args[0], b.add(forIntegerKind(wordKind, -1))));
+                b.addPush(returnKind, new XorNode(args[0], b.add(forIntegerKind(wordKind, -1))));
                 break;
 
             case READ_POINTER:
@@ -132,7 +131,7 @@
                 } else {
                     location = makeLocation(b, args[1], args[2]);
                 }
-                b.push(returnStackKind, readOp(b, readKind, args[0], location, operation.opcode()));
+                b.push(returnKind, readOp(b, readKind, args[0], location, operation.opcode()));
                 break;
             }
             case READ_HEAP: {
@@ -140,7 +139,7 @@
                 Kind readKind = wordTypes.asKind(wordMethod.getSignature().getReturnType(wordMethod.getDeclaringClass()));
                 LocationNode location = makeLocation(b, args[1], any());
                 BarrierType barrierType = snippetReflection.asObject(BarrierType.class, args[2].asJavaConstant());
-                b.push(returnStackKind, readOp(b, readKind, args[0], location, barrierType, true));
+                b.push(returnKind, readOp(b, readKind, args[0], location, barrierType, true));
                 break;
             }
             case WRITE_POINTER:
@@ -160,48 +159,48 @@
             }
             case ZERO:
                 assert args.length == 0;
-                b.addPush(returnStackKind, forIntegerKind(wordKind, 0L));
+                b.addPush(returnKind, forIntegerKind(wordKind, 0L));
                 break;
 
             case FROM_UNSIGNED:
                 assert args.length == 1;
-                b.push(returnStackKind, fromUnsigned(b, args[0]));
+                b.push(returnKind, fromUnsigned(b, args[0]));
                 break;
 
             case FROM_SIGNED:
                 assert args.length == 1;
-                b.push(returnStackKind, fromSigned(b, args[0]));
+                b.push(returnKind, fromSigned(b, args[0]));
                 break;
 
             case TO_RAW_VALUE:
                 assert args.length == 1;
-                b.push(returnStackKind, toUnsigned(b, args[0], Kind.Long));
+                b.push(returnKind, toUnsigned(b, args[0], Kind.Long));
                 break;
 
             case FROM_WORDBASE:
                 assert args.length == 1;
-                b.push(returnStackKind, args[0]);
+                b.push(returnKind, args[0]);
                 break;
 
             case FROM_OBJECT:
                 assert args.length == 1;
                 WordCastNode objectToWord = b.add(WordCastNode.objectToWord(args[0], wordKind));
-                b.push(returnStackKind, objectToWord);
+                b.push(returnKind, objectToWord);
                 break;
 
             case FROM_ARRAY:
                 assert args.length == 2;
-                b.addPush(returnStackKind, new ComputeAddressNode(args[0], args[1], StampFactory.forKind(wordKind)));
+                b.addPush(returnKind, new ComputeAddressNode(args[0], args[1], StampFactory.forKind(wordKind)));
                 break;
 
             case TO_OBJECT:
                 assert args.length == 1;
                 WordCastNode wordToObject = b.add(WordCastNode.wordToObject(args[0], wordKind));
-                b.push(returnStackKind, wordToObject);
+                b.push(returnKind, wordToObject);
                 break;
 
             default:
-                throw new GraalInternalError("Unknown opcode: %s", operation.opcode());
+                throw new JVMCIError("Unknown opcode: %s", operation.opcode());
         }
     }
 
@@ -215,7 +214,7 @@
             Constructor<?> cons = nodeClass.getDeclaredConstructor(ValueNode.class, ValueNode.class);
             return (ValueNode) cons.newInstance(left, right);
         } catch (Throwable ex) {
-            throw new GraalInternalError(ex).addContext(nodeClass.getName());
+            throw new JVMCIError(ex).addContext(nodeClass.getName());
         }
     }
 
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/ArrayEqualsNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/ArrayEqualsNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,6 @@
  */
 package com.oracle.graal.replacements.nodes;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
@@ -31,6 +30,7 @@
 import com.oracle.graal.nodes.memory.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.util.*;
+import com.oracle.jvmci.meta.*;
 
 // JaCoCo Exclude
 
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/AssertionNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/AssertionNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,13 +22,13 @@
  */
 package com.oracle.graal.replacements.nodes;
 
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.common.*;
 
 /**
  * Assertion nodes will go away as soon as the value evaluates to true. Compile-time assertions will
@@ -81,10 +81,10 @@
         assert compileTimeAssertion;
         if (value.isConstant()) {
             if (value.asJavaConstant().asInt() == 0) {
-                throw new GraalInternalError("%s: failed compile-time assertion: %s", this, message);
+                throw new JVMCIError("%s: failed compile-time assertion: %s", this, message);
             }
         } else {
-            throw new GraalInternalError("%s: failed compile-time assertion (value %s): %s", this, value, message);
+            throw new JVMCIError("%s: failed compile-time assertion (value %s): %s", this, value, message);
         }
     }
 
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/BasicArrayCopyNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/BasicArrayCopyNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,11 +22,9 @@
  */
 package com.oracle.graal.replacements.nodes;
 
-import static com.oracle.graal.api.meta.LocationIdentity.*;
+import static com.oracle.jvmci.meta.LocationIdentity.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
-import com.oracle.graal.debug.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
@@ -35,6 +33,8 @@
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.type.*;
 import com.oracle.graal.nodes.virtual.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.meta.*;
 
 @NodeInfo
 public class BasicArrayCopyNode extends AbstractMemoryCheckpoint implements Virtualizable, MemoryCheckpoint.Single, MemoryAccess, Lowerable, DeoptimizingNode.DeoptDuring {
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/BasicObjectCloneNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/BasicObjectCloneNode.java	Thu May 28 21:11:28 2015 -0700
@@ -24,17 +24,17 @@
 
 import java.util.*;
 
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.api.meta.Assumptions.AssumptionResult;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodeinfo.*;
+import com.oracle.graal.nodes.CallTargetNode.InvokeKind;
 import com.oracle.graal.nodes.*;
-import com.oracle.graal.nodes.CallTargetNode.InvokeKind;
 import com.oracle.graal.nodes.java.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.util.*;
 import com.oracle.graal.nodes.virtual.*;
+import com.oracle.jvmci.meta.*;
+import com.oracle.jvmci.meta.Assumptions.AssumptionResult;
 
 @NodeInfo
 public abstract class BasicObjectCloneNode extends MacroStateSplitNode implements VirtualizableAllocation, ArrayLengthProvider {
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/BitCountNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/BitCountNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,8 +22,6 @@
  */
 package com.oracle.graal.replacements.nodes;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
@@ -31,6 +29,8 @@
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.calc.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.meta.*;
 
 @NodeInfo
 public final class BitCountNode extends UnaryNode implements LIRLowerable {
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/BitScanForwardNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/BitScanForwardNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,8 +22,6 @@
  */
 package com.oracle.graal.replacements.nodes;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
@@ -31,6 +29,8 @@
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.calc.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * Determines the index of the least significant "1" bit. Note that the result is undefined if the
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/BitScanReverseNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/BitScanReverseNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,8 +22,6 @@
  */
 package com.oracle.graal.replacements.nodes;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
@@ -31,6 +29,8 @@
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.calc.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * Determines the index of the most significant "1" bit. Note that the result is undefined if the
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/DeferredPiNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/DeferredPiNode.java	Thu May 28 21:11:28 2015 -0700
@@ -24,7 +24,6 @@
 
 //JaCoCo Exclude
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
@@ -32,6 +31,7 @@
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.calc.*;
 import com.oracle.graal.replacements.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * A node for use in method substitutions or snippets that changes the type of its input where the
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/DirectObjectStoreNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/DirectObjectStoreNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,6 @@
  */
 package com.oracle.graal.replacements.nodes;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodeinfo.*;
@@ -30,6 +29,7 @@
 import com.oracle.graal.nodes.extended.*;
 import com.oracle.graal.nodes.memory.HeapAccess.BarrierType;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * A special purpose store node that differs from {@link UnsafeStoreNode} in that it is not a
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/DirectReadNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/DirectReadNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,13 +22,13 @@
  */
 package com.oracle.graal.replacements.nodes;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.extended.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * A special purpose store node that differs from {@link UnsafeStoreNode} in that it is not a
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/DirectStoreNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/DirectStoreNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,13 +22,13 @@
  */
 package com.oracle.graal.replacements.nodes;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.extended.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * A special purpose store node that differs from {@link UnsafeStoreNode} in that it is not a
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/MacroNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/MacroNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,14 +22,10 @@
  */
 package com.oracle.graal.replacements.nodes;
 
-import static com.oracle.graal.api.code.BytecodeFrame.*;
+import static com.oracle.jvmci.code.BytecodeFrame.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.api.replacements.*;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.type.*;
-import com.oracle.graal.debug.*;
-import com.oracle.graal.debug.Debug.Scope;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.CallTargetNode.InvokeKind;
@@ -41,6 +37,10 @@
 import com.oracle.graal.phases.common.inlining.*;
 import com.oracle.graal.phases.tiers.*;
 import com.oracle.graal.replacements.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.debug.Debug.Scope;
+import com.oracle.jvmci.meta.*;
 
 /**
  * Macro nodes can be used to temporarily replace an invoke. They can, for example, be used to
@@ -166,7 +166,7 @@
             Debug.dump(graph(), "After inlining replacement %s", replacementGraph);
         } else {
             if (isPlaceholderBci(invoke.bci())) {
-                throw new GraalInternalError("%s: cannot lower to invoke with placeholder BCI: %s", graph(), this);
+                throw new JVMCIError("%s: cannot lower to invoke with placeholder BCI: %s", graph(), this);
             }
 
             if (invoke.stateAfter() == null) {
@@ -176,10 +176,10 @@
                     // no longer needs a MacroNode. For example, Class.getComponentType()
                     // only needs a MacroNode prior to JDK9 as it was given a non-native
                     // implementation in JDK9.
-                    throw new GraalInternalError("%s macro created for call to %s in %s must be lowerable to a snippet or intrinsic graph. "
+                    throw new JVMCIError("%s macro created for call to %s in %s must be lowerable to a snippet or intrinsic graph. "
                                     + "Maybe a macro node is not needed for this method in the current JDK?", getClass().getSimpleName(), targetMethod.format("%h.%n(%p)"), graph());
                 }
-                throw new GraalInternalError("%s: cannot lower to invoke without state: %s", graph(), this);
+                throw new JVMCIError("%s: cannot lower to invoke without state: %s", graph(), this);
             }
             invoke.lower(tool);
         }
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/MacroStateSplitNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/MacroStateSplitNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,15 +22,15 @@
  */
 package com.oracle.graal.replacements.nodes;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodeinfo.*;
+import com.oracle.graal.nodes.CallTargetNode.InvokeKind;
 import com.oracle.graal.nodes.*;
-import com.oracle.graal.nodes.CallTargetNode.*;
 import com.oracle.graal.nodes.java.*;
 import com.oracle.graal.nodes.memory.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * This is an extension of {@link MacroNode} that is a {@link StateSplit} and a
@@ -69,7 +69,7 @@
         for (MethodCallTargetNode call : snippetGraph.getNodes(MethodCallTargetNode.TYPE)) {
             Invoke invoke = call.invoke();
             if (!call.targetMethod().equals(getTargetMethod())) {
-                throw new GraalInternalError("unexpected invoke %s in snippet", getClass().getSimpleName());
+                throw new JVMCIError("unexpected invoke %s in snippet", getClass().getSimpleName());
             }
             assert invoke.stateAfter().bci == BytecodeFrame.AFTER_BCI;
             // Here we need to fix the bci of the invoke
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/MethodHandleNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/MethodHandleNode.java	Thu May 28 21:11:28 2015 -0700
@@ -25,10 +25,6 @@
 import java.lang.invoke.*;
 import java.util.*;
 
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.api.meta.Assumptions.AssumptionResult;
-import com.oracle.graal.api.meta.MethodHandleAccessProvider.IntrinsicMethod;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
@@ -38,6 +34,10 @@
 import com.oracle.graal.nodes.java.*;
 import com.oracle.graal.nodes.type.*;
 import com.oracle.graal.nodes.util.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.meta.*;
+import com.oracle.jvmci.meta.Assumptions.AssumptionResult;
+import com.oracle.jvmci.meta.MethodHandleAccessProvider.IntrinsicMethod;
 
 /**
  * Node for invocation methods defined on the class {@link MethodHandle}.
@@ -77,7 +77,7 @@
             case LINK_TO_INTERFACE:
                 return getLinkToTarget(assumptions, intrinsicMethod, methodHandleAccess, original, bci, returnType, arguments);
             default:
-                throw GraalInternalError.shouldNotReachHere();
+                throw JVMCIError.shouldNotReachHere();
         }
     }
 
@@ -251,7 +251,7 @@
                 targetArguments = Arrays.copyOfRange(arguments, 0, arguments.length - 1);
                 break;
             default:
-                throw GraalInternalError.shouldNotReachHere();
+                throw JVMCIError.shouldNotReachHere();
         }
 
         MethodCallTargetNode callTarget = ResolvedMethodHandleCallTargetNode.create(targetInvokeKind, target, targetArguments, targetReturnType, original, arguments, returnType);
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/PureFunctionMacroNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/PureFunctionMacroNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,12 +22,12 @@
  */
 package com.oracle.graal.replacements.nodes;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
 import com.oracle.graal.nodeinfo.*;
+import com.oracle.graal.nodes.CallTargetNode.InvokeKind;
 import com.oracle.graal.nodes.*;
-import com.oracle.graal.nodes.CallTargetNode.InvokeKind;
+import com.oracle.jvmci.meta.*;
 
 /**
  * This node class can be used to create {@link MacroNode}s for simple pure functions like
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/ReadRegisterNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/ReadRegisterNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,13 +22,13 @@
  */
 package com.oracle.graal.replacements.nodes;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * Access the value of a specific register.
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/ResolvedMethodHandleCallTargetNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/ResolvedMethodHandleCallTargetNode.java	Thu May 28 21:11:28 2015 -0700
@@ -26,13 +26,13 @@
 
 import java.lang.invoke.*;
 
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.java.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * A call target that replaces itself in the graph when being lowered by restoring the original
@@ -88,6 +88,6 @@
 
     @Override
     public void generate(NodeLIRBuilderTool gen) {
-        throw GraalInternalError.shouldNotReachHere("should have replaced itself");
+        throw JVMCIError.shouldNotReachHere("should have replaced itself");
     }
 }
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/ReverseBytesNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/ReverseBytesNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,8 +22,6 @@
  */
 package com.oracle.graal.replacements.nodes;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
@@ -31,6 +29,8 @@
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.calc.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.meta.*;
 
 @NodeInfo
 public final class ReverseBytesNode extends UnaryNode implements LIRLowerable {
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/VirtualizableInvokeMacroNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/VirtualizableInvokeMacroNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,12 +22,12 @@
  */
 package com.oracle.graal.replacements.nodes;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.CallTargetNode.InvokeKind;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * A helper class to allow elimination of byte code instrumentation that could interfere with escape
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/WriteRegisterNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/WriteRegisterNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,13 +22,13 @@
  */
 package com.oracle.graal.replacements.nodes;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * Changes the value of a specific register.
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/arithmetic/IntegerAddExactNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/arithmetic/IntegerAddExactNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,6 @@
  */
 package com.oracle.graal.replacements.nodes.arithmetic;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
@@ -30,6 +29,7 @@
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.calc.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * Node representing an exact integer addition that will throw an {@link ArithmeticException} in
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/arithmetic/IntegerAddExactSplitNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/arithmetic/IntegerAddExactSplitNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,12 +22,12 @@
  */
 package com.oracle.graal.replacements.nodes.arithmetic;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.meta.*;
 
 @NodeInfo
 public final class IntegerAddExactSplitNode extends IntegerExactArithmeticSplitNode {
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/arithmetic/IntegerExactArithmeticSplitNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/arithmetic/IntegerExactArithmeticSplitNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,13 +22,13 @@
  */
 package com.oracle.graal.replacements.nodes.arithmetic;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.calc.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.meta.*;
 
 @NodeInfo
 public abstract class IntegerExactArithmeticSplitNode extends ControlSplitNode implements LIRLowerable {
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/arithmetic/IntegerMulExactNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/arithmetic/IntegerMulExactNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,6 @@
  */
 package com.oracle.graal.replacements.nodes.arithmetic;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
@@ -30,6 +29,7 @@
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.calc.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * Node representing an exact integer multiplication that will throw an {@link ArithmeticException}
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/arithmetic/IntegerMulExactSplitNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/arithmetic/IntegerMulExactSplitNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,12 +22,12 @@
  */
 package com.oracle.graal.replacements.nodes.arithmetic;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.meta.*;
 
 @NodeInfo
 public final class IntegerMulExactSplitNode extends IntegerExactArithmeticSplitNode {
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/arithmetic/IntegerMulHighNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/arithmetic/IntegerMulHighNode.java	Thu May 28 21:11:28 2015 -0700
@@ -24,7 +24,6 @@
 
 import java.util.function.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
@@ -33,6 +32,7 @@
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.calc.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.meta.*;
 
 @NodeInfo(shortName = "*H")
 public final class IntegerMulHighNode extends BinaryNode implements ArithmeticLIRLowerable {
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/arithmetic/IntegerSubExactNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/arithmetic/IntegerSubExactNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,6 @@
  */
 package com.oracle.graal.replacements.nodes.arithmetic;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
@@ -31,6 +30,7 @@
 import com.oracle.graal.nodes.calc.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.util.*;
+import com.oracle.jvmci.meta.*;
 
 /**
  * Node representing an exact integer substraction that will throw an {@link ArithmeticException} in
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/arithmetic/IntegerSubExactSplitNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/arithmetic/IntegerSubExactSplitNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,12 +22,12 @@
  */
 package com.oracle.graal.replacements.nodes.arithmetic;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodeinfo.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.meta.*;
 
 @NodeInfo
 public final class IntegerSubExactSplitNode extends IntegerExactArithmeticSplitNode {
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/arithmetic/UnsignedMulHighNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/arithmetic/UnsignedMulHighNode.java	Thu May 28 21:11:28 2015 -0700
@@ -24,7 +24,6 @@
 
 import java.util.function.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
@@ -33,6 +32,7 @@
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.calc.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.meta.*;
 
 @NodeInfo(shortName = "|*H|")
 public final class UnsignedMulHighNode extends BinaryNode implements ArithmeticLIRLowerable {
--- a/graal/com.oracle.graal.runtime/src/com/oracle/graal/runtime/RuntimeProvider.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.runtime/src/com/oracle/graal/runtime/RuntimeProvider.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,7 @@
  */
 package com.oracle.graal.runtime;
 
-import com.oracle.graal.api.code.*;
+import com.oracle.jvmci.code.Architecture;
 import com.oracle.graal.compiler.target.*;
 
 /**
--- a/graal/com.oracle.graal.service.processor/src/META-INF/services/javax.annotation.processing.Processor	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-com.oracle.graal.service.processor.ServiceProviderProcessor
--- a/graal/com.oracle.graal.service.processor/src/com/oracle/graal/service/processor/ServiceProviderProcessor.java	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,102 +0,0 @@
-/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.graal.service.processor;
-
-import java.io.*;
-import java.util.*;
-
-import javax.annotation.processing.*;
-import javax.lang.model.*;
-import javax.lang.model.element.*;
-import javax.lang.model.type.*;
-import javax.tools.Diagnostic.Kind;
-import javax.tools.*;
-
-import com.oracle.graal.api.runtime.*;
-
-@SupportedAnnotationTypes("com.oracle.graal.api.runtime.ServiceProvider")
-public class ServiceProviderProcessor extends AbstractProcessor {
-
-    private final Set<TypeElement> processed = new HashSet<>();
-
-    @Override
-    public SourceVersion getSupportedSourceVersion() {
-        return SourceVersion.latest();
-    }
-
-    private boolean verifyAnnotation(TypeMirror serviceInterface, TypeElement serviceProvider) {
-        if (!processingEnv.getTypeUtils().isSubtype(serviceProvider.asType(), serviceInterface)) {
-            String msg = String.format("Service provider class %s doesn't implement service interface %s", serviceProvider.getSimpleName(), serviceInterface);
-            processingEnv.getMessager().printMessage(Kind.ERROR, msg, serviceProvider);
-            return false;
-        }
-
-        return true;
-    }
-
-    private void processElement(TypeElement serviceProvider) {
-        if (processed.contains(serviceProvider)) {
-            return;
-        }
-
-        processed.add(serviceProvider);
-        ServiceProvider annotation = serviceProvider.getAnnotation(ServiceProvider.class);
-        if (annotation != null) {
-            try {
-                annotation.value();
-            } catch (MirroredTypeException ex) {
-                TypeMirror serviceInterface = ex.getTypeMirror();
-                if (verifyAnnotation(serviceInterface, serviceProvider)) {
-                    String interfaceName = ex.getTypeMirror().toString();
-                    createProviderFile(serviceProvider, interfaceName);
-                }
-            }
-        }
-    }
-
-    private void createProviderFile(TypeElement serviceProvider, String interfaceName) {
-        String filename = "META-INF/providers/" + serviceProvider.getQualifiedName();
-        try {
-            FileObject file = processingEnv.getFiler().createResource(StandardLocation.CLASS_OUTPUT, "", filename, serviceProvider);
-            PrintWriter writer = new PrintWriter(new OutputStreamWriter(file.openOutputStream(), "UTF-8"));
-            writer.println(interfaceName);
-            writer.close();
-        } catch (IOException e) {
-            processingEnv.getMessager().printMessage(Kind.ERROR, e.getMessage(), serviceProvider);
-        }
-    }
-
-    @Override
-    public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
-        if (roundEnv.processingOver()) {
-            return true;
-        }
-
-        for (Element element : roundEnv.getElementsAnnotatedWith(ServiceProvider.class)) {
-            assert element.getKind().isClass();
-            processElement((TypeElement) element);
-        }
-
-        return true;
-    }
-}
--- a/graal/com.oracle.graal.sparc/src/com/oracle/graal/sparc/SPARC.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.sparc/src/com/oracle/graal/sparc/SPARC.java	Thu May 28 21:11:28 2015 -0700
@@ -22,14 +22,17 @@
  */
 package com.oracle.graal.sparc;
 
-import static com.oracle.graal.api.code.MemoryBarriers.*;
+import com.oracle.jvmci.code.Architecture;
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.code.TargetDescription;
+import com.oracle.jvmci.meta.Kind;
+import com.oracle.jvmci.meta.PlatformKind;
+import static com.oracle.jvmci.code.MemoryBarriers.*;
 
 import java.nio.*;
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.code.Register.RegisterCategory;
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.code.Register.RegisterCategory;
 
 /**
  * Represents the SPARC architecture.
--- a/graal/com.oracle.graal.test/src/com/oracle/graal/test/AnsiTerminalDecorator.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.test/src/com/oracle/graal/test/AnsiTerminalDecorator.java	Thu May 28 21:11:28 2015 -0700
@@ -22,11 +22,11 @@
  */
 package com.oracle.graal.test;
 
+import static com.oracle.jvmci.debug.AnsiColor.*;
+
 import org.junit.runner.*;
 import org.junit.runner.notification.*;
 
-import static com.oracle.graal.debug.AnsiColor.*;
-
 /**
  * Color support for JUnit test output using ANSI escapes codes.
  */
--- a/graal/com.oracle.graal.truffle.hotspot.amd64/src/com/oracle/graal/truffle/hotspot/amd64/AMD64OptimizedCallTargetInstrumentationFactory.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.truffle.hotspot.amd64/src/com/oracle/graal/truffle/hotspot/amd64/AMD64OptimizedCallTargetInstrumentationFactory.java	Thu May 28 21:11:28 2015 -0700
@@ -22,20 +22,25 @@
  */
 package com.oracle.graal.truffle.hotspot.amd64;
 
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.code.InstalledCode;
+import com.oracle.jvmci.code.ForeignCallsProvider;
+import com.oracle.jvmci.code.CodeCacheProvider;
+import com.oracle.jvmci.code.CompilationResult;
+import com.oracle.jvmci.meta.Kind;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
 import com.oracle.graal.amd64.*;
-import com.oracle.graal.api.code.CallingConvention.Type;
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.api.runtime.*;
+import com.oracle.jvmci.code.CallingConvention.Type;
 import com.oracle.graal.asm.*;
 import com.oracle.graal.asm.amd64.*;
 import com.oracle.graal.asm.amd64.AMD64Assembler.ConditionFlag;
-import com.oracle.graal.hotspot.*;
 import com.oracle.graal.hotspot.meta.*;
 import com.oracle.graal.lir.asm.*;
 import com.oracle.graal.lir.framemap.*;
 import com.oracle.graal.truffle.*;
 import com.oracle.graal.truffle.hotspot.*;
+import com.oracle.jvmci.hotspot.*;
+import com.oracle.jvmci.runtime.*;
 
 @ServiceProvider(OptimizedCallTargetInstrumentationFactory.class)
 public class AMD64OptimizedCallTargetInstrumentationFactory implements OptimizedCallTargetInstrumentationFactory {
--- a/graal/com.oracle.graal.truffle.hotspot.amd64/src/com/oracle/graal/truffle/hotspot/amd64/AMD64RawNativeCallNodeFactory.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.truffle.hotspot.amd64/src/com/oracle/graal/truffle/hotspot/amd64/AMD64RawNativeCallNodeFactory.java	Thu May 28 21:11:28 2015 -0700
@@ -22,11 +22,12 @@
  */
 package com.oracle.graal.truffle.hotspot.amd64;
 
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.api.runtime.*;
+import com.oracle.jvmci.meta.Kind;
+import com.oracle.jvmci.meta.JavaConstant;
 import com.oracle.graal.hotspot.amd64.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.truffle.hotspot.nfi.*;
+import com.oracle.jvmci.runtime.*;
 
 @ServiceProvider(RawNativeCallNodeFactory.class)
 public class AMD64RawNativeCallNodeFactory implements RawNativeCallNodeFactory {
--- a/graal/com.oracle.graal.truffle.hotspot.sparc/src/com/oracle/graal/truffle/hotspot/sparc/SPARCOptimizedCallTargetInstumentationFactory.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.truffle.hotspot.sparc/src/com/oracle/graal/truffle/hotspot/sparc/SPARCOptimizedCallTargetInstumentationFactory.java	Thu May 28 21:11:28 2015 -0700
@@ -22,26 +22,30 @@
  */
 package com.oracle.graal.truffle.hotspot.sparc;
 
-import static com.oracle.graal.api.code.CallingConvention.Type.*;
-import static com.oracle.graal.api.meta.Kind.*;
+import com.oracle.jvmci.code.Register;
+import com.oracle.jvmci.code.InstalledCode;
+import com.oracle.jvmci.code.CompilationResult;
+import com.oracle.jvmci.code.ForeignCallsProvider;
+import com.oracle.jvmci.code.CodeCacheProvider;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
+import static com.oracle.jvmci.code.CallingConvention.Type.*;
+import static com.oracle.jvmci.meta.Kind.*;
 import static com.oracle.graal.asm.sparc.SPARCAssembler.Annul.*;
 import static com.oracle.graal.asm.sparc.SPARCAssembler.BranchPredict.*;
 import static com.oracle.graal.asm.sparc.SPARCAssembler.CC.*;
 import static com.oracle.graal.asm.sparc.SPARCAssembler.ConditionFlag.*;
 import static com.oracle.graal.sparc.SPARC.CPUFeature.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.api.runtime.*;
 import com.oracle.graal.asm.*;
 import com.oracle.graal.asm.sparc.*;
 import com.oracle.graal.asm.sparc.SPARCMacroAssembler.ScratchRegister;
-import com.oracle.graal.hotspot.*;
 import com.oracle.graal.hotspot.meta.*;
 import com.oracle.graal.lir.asm.*;
 import com.oracle.graal.lir.framemap.*;
 import com.oracle.graal.truffle.*;
 import com.oracle.graal.truffle.hotspot.*;
+import com.oracle.jvmci.hotspot.*;
+import com.oracle.jvmci.runtime.*;
 
 @ServiceProvider(OptimizedCallTargetInstrumentationFactory.class)
 public class SPARCOptimizedCallTargetInstumentationFactory implements OptimizedCallTargetInstrumentationFactory {
--- a/graal/com.oracle.graal.truffle.hotspot/src/com/oracle/graal/truffle/hotspot/HotSpotTruffleRuntime.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.truffle.hotspot/src/com/oracle/graal/truffle/hotspot/HotSpotTruffleRuntime.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,14 @@
  */
 package com.oracle.graal.truffle.hotspot;
 
-import static com.oracle.graal.api.code.CodeUtil.*;
+import com.oracle.jvmci.code.CodeCacheProvider;
+import com.oracle.jvmci.code.CompilationResult;
+import com.oracle.jvmci.code.CallingConvention;
+import com.oracle.jvmci.code.BailoutException;
+import com.oracle.jvmci.meta.ResolvedJavaType;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
+import com.oracle.jvmci.meta.MetaAccessProvider;
+import static com.oracle.jvmci.code.CodeUtil.*;
 import static com.oracle.graal.compiler.GraalCompiler.*;
 import static com.oracle.graal.graph.util.CollectionsAccess.*;
 import static com.oracle.graal.hotspot.meta.HotSpotSuitesProvider.*;
@@ -32,15 +39,10 @@
 import java.util.concurrent.*;
 import java.util.stream.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.code.CallingConvention.Type;
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.code.CallingConvention.Type;
 import com.oracle.graal.api.runtime.*;
 import com.oracle.graal.compiler.*;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.target.*;
-import com.oracle.graal.debug.*;
-import com.oracle.graal.debug.Debug.Scope;
 import com.oracle.graal.graphbuilderconf.*;
 import com.oracle.graal.graphbuilderconf.GraphBuilderConfiguration.Plugins;
 import com.oracle.graal.hotspot.*;
@@ -58,6 +60,11 @@
 import com.oracle.graal.runtime.*;
 import com.oracle.graal.truffle.*;
 import com.oracle.graal.truffle.hotspot.nfi.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.debug.Debug.Scope;
+import com.oracle.jvmci.hotspot.*;
+import com.oracle.jvmci.runtime.*;
 import com.oracle.nfi.api.*;
 import com.oracle.truffle.api.*;
 import com.oracle.truffle.api.nodes.*;
@@ -332,7 +339,7 @@
         try {
             return UnsafeAccess.unsafe.objectFieldOffset(Thread.class.getDeclaredField("eetop"));
         } catch (Exception e) {
-            throw new GraalInternalError(e);
+            throw new JVMCIError(e);
         }
     }
 
--- a/graal/com.oracle.graal.truffle.hotspot/src/com/oracle/graal/truffle/hotspot/OptimizedCallTargetInstrumentation.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.truffle.hotspot/src/com/oracle/graal/truffle/hotspot/OptimizedCallTargetInstrumentation.java	Thu May 28 21:11:28 2015 -0700
@@ -22,17 +22,20 @@
  */
 package com.oracle.graal.truffle.hotspot;
 
+import com.oracle.jvmci.code.CodeCacheProvider;
+import com.oracle.jvmci.code.CompilationResult;
+import com.oracle.jvmci.code.ForeignCallsProvider;
 import java.lang.reflect.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.code.CompilationResult.Mark;
+import com.oracle.jvmci.code.CompilationResult.Mark;
 import com.oracle.graal.asm.*;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.hotspot.*;
 import com.oracle.graal.hotspot.meta.*;
 import com.oracle.graal.lir.asm.*;
 import com.oracle.graal.lir.framemap.*;
 import com.oracle.graal.truffle.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.hotspot.*;
 
 /**
  * Mechanism for injecting special code into {@link OptimizedCallTarget#call(Object[])} .
@@ -61,7 +64,7 @@
             Field field = declaringClass.getDeclaredField(name);
             return (int) UnsafeAccess.unsafe.objectFieldOffset(field);
         } catch (NoSuchFieldException | SecurityException e) {
-            throw GraalInternalError.shouldNotReachHere();
+            throw JVMCIError.shouldNotReachHere();
         }
     }
 
--- a/graal/com.oracle.graal.truffle.hotspot/src/com/oracle/graal/truffle/hotspot/nfi/HotSpotNativeFunctionHandle.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.truffle.hotspot/src/com/oracle/graal/truffle/hotspot/nfi/HotSpotNativeFunctionHandle.java	Thu May 28 21:11:28 2015 -0700
@@ -22,13 +22,14 @@
  */
 package com.oracle.graal.truffle.hotspot.nfi;
 
+import com.oracle.jvmci.code.InvalidInstalledCodeException;
+import com.oracle.jvmci.code.InstalledCode;
+import com.oracle.jvmci.meta.Kind;
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.common.*;
-import com.oracle.graal.debug.*;
-import com.oracle.graal.debug.Debug.Scope;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.debug.Debug.Scope;
 import com.oracle.nfi.api.*;
 
 public class HotSpotNativeFunctionHandle implements NativeFunctionHandle {
@@ -68,7 +69,7 @@
             traceResult(res);
             return res;
         } catch (InvalidInstalledCodeException e) {
-            throw GraalInternalError.shouldNotReachHere("Execution of GNFI Callstub failed: " + name);
+            throw JVMCIError.shouldNotReachHere("Execution of GNFI Callstub failed: " + name);
         }
     }
 
--- a/graal/com.oracle.graal.truffle.hotspot/src/com/oracle/graal/truffle/hotspot/nfi/HotSpotNativeFunctionInterface.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.truffle.hotspot/src/com/oracle/graal/truffle/hotspot/nfi/HotSpotNativeFunctionInterface.java	Thu May 28 21:11:28 2015 -0700
@@ -22,24 +22,27 @@
  */
 package com.oracle.graal.truffle.hotspot.nfi;
 
-import static com.oracle.graal.api.code.CodeUtil.*;
-import static com.oracle.graal.compiler.common.UnsafeAccess.*;
+import com.oracle.jvmci.code.CompilationResult;
+import com.oracle.jvmci.code.CallingConvention;
+import com.oracle.jvmci.code.InstalledCode;
+import com.oracle.jvmci.meta.TriState;
+import com.oracle.jvmci.meta.DefaultProfilingInfo;
+import static com.oracle.jvmci.code.CodeUtil.*;
 import static com.oracle.graal.truffle.hotspot.nfi.NativeCallStubGraphBuilder.*;
+import static com.oracle.jvmci.common.UnsafeAccess.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.code.CallingConvention.Type;
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.code.CallingConvention.Type;
 import com.oracle.graal.compiler.*;
 import com.oracle.graal.compiler.target.*;
-import com.oracle.graal.debug.*;
-import com.oracle.graal.debug.Debug.Scope;
-import com.oracle.graal.hotspot.*;
 import com.oracle.graal.hotspot.meta.*;
 import com.oracle.graal.lir.asm.*;
 import com.oracle.graal.lir.phases.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.phases.*;
 import com.oracle.graal.phases.tiers.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.debug.Debug.Scope;
+import com.oracle.jvmci.hotspot.*;
 import com.oracle.nfi.api.*;
 
 public class HotSpotNativeFunctionInterface implements NativeFunctionInterface {
--- a/graal/com.oracle.graal.truffle.hotspot/src/com/oracle/graal/truffle/hotspot/nfi/NativeCallStubGraphBuilder.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.truffle.hotspot/src/com/oracle/graal/truffle/hotspot/nfi/NativeCallStubGraphBuilder.java	Thu May 28 21:11:28 2015 -0700
@@ -22,12 +22,17 @@
  */
 package com.oracle.graal.truffle.hotspot.nfi;
 
+import com.oracle.jvmci.meta.ResolvedJavaType;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
+import com.oracle.jvmci.meta.ResolvedJavaField;
+import com.oracle.jvmci.meta.NamedLocationIdentity;
+import com.oracle.jvmci.meta.LocationIdentity;
+import com.oracle.jvmci.meta.Kind;
+import com.oracle.jvmci.meta.JavaConstant;
 import static com.oracle.graal.hotspot.HotSpotGraalRuntime.*;
 
 import java.util.*;
 
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.hotspot.meta.*;
 import com.oracle.graal.nodes.*;
@@ -35,6 +40,8 @@
 import com.oracle.graal.nodes.extended.*;
 import com.oracle.graal.nodes.java.*;
 import com.oracle.graal.nodes.virtual.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.hotspot.*;
 
 /**
  * Utility creating a graph for a stub used to call a native function.
@@ -92,7 +99,7 @@
             callNode.setNext(returnNode);
             return g;
         } catch (NoSuchMethodException e) {
-            throw GraalInternalError.shouldNotReachHere("Call Stub method not found");
+            throw JVMCIError.shouldNotReachHere("Call Stub method not found");
         }
     }
 
@@ -115,9 +122,10 @@
                 // array value
                 Kind arrayElementKind = getElementKind(type);
                 LocationIdentity locationIdentity = NamedLocationIdentity.getArrayLocation(arrayElementKind);
-                int displacement = runtime().getArrayBaseOffset(arrayElementKind);
+                HotSpotJVMCIRuntimeProvider jvmciRuntime = runtime().getJVMCIRuntime();
+                int displacement = jvmciRuntime.getArrayBaseOffset(arrayElementKind);
                 ConstantNode index = ConstantNode.forInt(0, g);
-                int indexScaling = runtime().getArrayIndexScale(arrayElementKind);
+                int indexScaling = jvmciRuntime.getArrayIndexScale(arrayElementKind);
                 IndexedLocationNode locationNode = g.unique(new IndexedLocationNode(locationIdentity, displacement, index, indexScaling));
                 Stamp wordStamp = StampFactory.forKind(providers.getWordTypes().getWordKind());
                 ComputeAddressNode arrayAddress = g.unique(new ComputeAddressNode(boxedElement, locationNode, wordStamp));
@@ -131,7 +139,7 @@
                     last = loadFieldNode;
                     args.add(loadFieldNode);
                 } catch (NoSuchFieldException e) {
-                    throw new GraalInternalError(e);
+                    throw new JVMCIError(e);
                 }
             }
         }
@@ -173,6 +181,6 @@
 
     @SuppressWarnings("unused")
     public static Object libCall(Object argLoc, Object unused1, Object unused2) {
-        throw GraalInternalError.shouldNotReachHere("GNFI libCall method must not be called");
+        throw JVMCIError.shouldNotReachHere("GNFI libCall method must not be called");
     }
 }
--- a/graal/com.oracle.graal.truffle.hotspot/src/com/oracle/graal/truffle/hotspot/nfi/RawNativeCallNodeFactory.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.truffle.hotspot/src/com/oracle/graal/truffle/hotspot/nfi/RawNativeCallNodeFactory.java	Thu May 28 21:11:28 2015 -0700
@@ -22,9 +22,10 @@
  */
 package com.oracle.graal.truffle.hotspot.nfi;
 
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.api.runtime.*;
+import com.oracle.jvmci.meta.Kind;
+import com.oracle.jvmci.meta.JavaConstant;
 import com.oracle.graal.nodes.*;
+import com.oracle.jvmci.runtime.*;
 
 /**
  * Factory for creating a node that makes a direct call to a native function pointer.
--- a/graal/com.oracle.graal.truffle.test/src/com/oracle/graal/truffle/test/CompilerAssertsTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.truffle.test/src/com/oracle/graal/truffle/test/CompilerAssertsTest.java	Thu May 28 21:11:28 2015 -0700
@@ -22,9 +22,9 @@
  */
 package com.oracle.graal.truffle.test;
 
+import com.oracle.jvmci.code.BailoutException;
 import org.junit.*;
 
-import com.oracle.graal.api.code.*;
 import com.oracle.graal.truffle.test.nodes.*;
 import com.oracle.truffle.api.*;
 import com.oracle.truffle.api.frame.*;
--- a/graal/com.oracle.graal.truffle.test/src/com/oracle/graal/truffle/test/ConditionAnchoringTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.truffle.test/src/com/oracle/graal/truffle/test/ConditionAnchoringTest.java	Thu May 28 21:11:28 2015 -0700
@@ -22,6 +22,12 @@
  */
 package com.oracle.graal.truffle.test;
 
+import com.oracle.jvmci.meta.ConstantReflectionProvider;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
+import com.oracle.jvmci.meta.JavaConstant;
+import com.oracle.jvmci.meta.MetaAccessProvider;
+import com.oracle.jvmci.meta.JavaType;
+import com.oracle.jvmci.meta.ResolvedJavaField;
 import static com.oracle.graal.graph.test.matchers.NodeIterableCount.*;
 import static com.oracle.graal.graph.test.matchers.NodeIterableIsEmpty.*;
 import static org.hamcrest.core.IsInstanceOf.*;
@@ -31,7 +37,6 @@
 
 import sun.misc.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.test.*;
 import com.oracle.graal.graph.iterators.*;
 import com.oracle.graal.graphbuilderconf.*;
@@ -53,7 +58,7 @@
     private static final Object location = new Object();
 
     static {
-        Unsafe unsafe = com.oracle.graal.compiler.common.UnsafeAccess.unsafe;
+        Unsafe unsafe = com.oracle.jvmci.common.UnsafeAccess.unsafe;
         access = Truffle.getRuntime().getCapability(UnsafeAccessFactory.class).createUnsafeAccess(unsafe);
         long fieldOffset = 0;
         try {
--- a/graal/com.oracle.graal.truffle.test/src/com/oracle/graal/truffle/test/PartialEvaluationTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.truffle.test/src/com/oracle/graal/truffle/test/PartialEvaluationTest.java	Thu May 28 21:11:28 2015 -0700
@@ -25,8 +25,6 @@
 import org.junit.*;
 
 import com.oracle.graal.compiler.test.*;
-import com.oracle.graal.debug.*;
-import com.oracle.graal.debug.Debug.Scope;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions;
 import com.oracle.graal.nodes.java.*;
@@ -34,6 +32,8 @@
 import com.oracle.graal.phases.tiers.*;
 import com.oracle.graal.printer.*;
 import com.oracle.graal.truffle.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.debug.Debug.Scope;
 import com.oracle.truffle.api.*;
 import com.oracle.truffle.api.nodes.*;
 
--- a/graal/com.oracle.graal.truffle.test/src/com/oracle/graal/truffle/test/SimplePartialEvaluationTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.truffle.test/src/com/oracle/graal/truffle/test/SimplePartialEvaluationTest.java	Thu May 28 21:11:28 2015 -0700
@@ -22,9 +22,9 @@
  */
 package com.oracle.graal.truffle.test;
 
+import com.oracle.jvmci.code.SourceStackTrace;
 import org.junit.*;
 
-import com.oracle.graal.api.code.*;
 import com.oracle.graal.truffle.test.nodes.*;
 import com.oracle.truffle.api.frame.*;
 
--- a/graal/com.oracle.graal.truffle.test/src/com/oracle/graal/truffle/test/builtins/SLDeoptimizeWhenCompiledBuiltin.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.truffle.test/src/com/oracle/graal/truffle/test/builtins/SLDeoptimizeWhenCompiledBuiltin.java	Thu May 28 21:11:28 2015 -0700
@@ -23,7 +23,7 @@
 package com.oracle.graal.truffle.test.builtins;
 
 import com.oracle.truffle.api.*;
-import com.oracle.truffle.api.CompilerDirectives.*;
+import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
 import com.oracle.truffle.api.dsl.*;
 import com.oracle.truffle.api.nodes.*;
 import com.oracle.truffle.sl.runtime.*;
--- a/graal/com.oracle.graal.truffle.test/src/com/oracle/graal/truffle/test/builtins/SLGetOptionBuiltin.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.truffle.test/src/com/oracle/graal/truffle/test/builtins/SLGetOptionBuiltin.java	Thu May 28 21:11:28 2015 -0700
@@ -22,8 +22,8 @@
  */
 package com.oracle.graal.truffle.test.builtins;
 
-import com.oracle.graal.options.*;
 import com.oracle.graal.truffle.*;
+import com.oracle.jvmci.options.*;
 import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
 import com.oracle.truffle.api.dsl.*;
 import com.oracle.truffle.api.nodes.*;
--- a/graal/com.oracle.graal.truffle.test/src/com/oracle/graal/truffle/test/builtins/SLSetOptionBuiltin.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.truffle.test/src/com/oracle/graal/truffle/test/builtins/SLSetOptionBuiltin.java	Thu May 28 21:11:28 2015 -0700
@@ -22,8 +22,8 @@
  */
 package com.oracle.graal.truffle.test.builtins;
 
-import com.oracle.graal.options.*;
 import com.oracle.graal.truffle.*;
+import com.oracle.jvmci.options.*;
 import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
 import com.oracle.truffle.api.dsl.*;
 import com.oracle.truffle.api.nodes.*;
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/DefaultLoopNodeFactory.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/DefaultLoopNodeFactory.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,7 @@
  */
 package com.oracle.graal.truffle;
 
-import com.oracle.graal.api.runtime.*;
+import com.oracle.jvmci.runtime.*;
 import com.oracle.truffle.api.nodes.*;
 
 @ServiceProvider(LoopNodeFactory.class)
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/GraalFrameInstance.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/GraalFrameInstance.java	Thu May 28 21:11:28 2015 -0700
@@ -22,10 +22,10 @@
  */
 package com.oracle.graal.truffle;
 
+import com.oracle.jvmci.code.stack.InspectedFrame;
 import java.lang.reflect.*;
 
-import com.oracle.graal.api.code.stack.*;
-import com.oracle.graal.compiler.common.*;
+import com.oracle.jvmci.common.*;
 import com.oracle.truffle.api.*;
 import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
 import com.oracle.truffle.api.frame.*;
@@ -73,7 +73,7 @@
                 }
                 return (Frame) stackFrame.getLocal(getFrameIndex());
             default:
-                throw GraalInternalError.unimplemented();
+                throw JVMCIError.unimplemented();
         }
     }
 
@@ -96,7 +96,7 @@
             try {
                 METHOD = OptimizedDirectCallNode.class.getDeclaredMethod("callProxy", MaterializedFrameNotify.class, CallTarget.class, VirtualFrame.class, Object[].class, boolean.class);
             } catch (NoSuchMethodException | SecurityException e) {
-                throw new GraalInternalError(e);
+                throw new JVMCIError(e);
             }
         }
         private static final int NOTIFY_INDEX = 0;
@@ -141,7 +141,7 @@
             try {
                 METHOD = OptimizedCallTarget.class.getDeclaredMethod("callProxy", VirtualFrame.class);
             } catch (NoSuchMethodException | SecurityException e) {
-                throw new GraalInternalError(e);
+                throw new JVMCIError(e);
             }
         }
         private static final int NOTIFY_INDEX = -1;
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/GraalTruffleCompilationListener.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/GraalTruffleCompilationListener.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,7 @@
  */
 package com.oracle.graal.truffle;
 
-import com.oracle.graal.api.code.*;
+import com.oracle.jvmci.code.CompilationResult;
 import com.oracle.graal.nodes.*;
 import com.oracle.truffle.api.nodes.*;
 
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/GraalTruffleRuntime.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/GraalTruffleRuntime.java	Thu May 28 21:11:28 2015 -0700
@@ -22,20 +22,23 @@
  */
 package com.oracle.graal.truffle;
 
+import com.oracle.jvmci.code.stack.InspectedFrameVisitor;
+import com.oracle.jvmci.code.stack.InspectedFrame;
+import com.oracle.jvmci.code.stack.StackIntrospection;
+import com.oracle.jvmci.code.CompilationResult;
+import com.oracle.jvmci.meta.MetaAccessProvider;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
 import static com.oracle.graal.truffle.TruffleCompilerOptions.*;
 
 import java.util.*;
 import java.util.concurrent.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.code.stack.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.api.runtime.*;
-import com.oracle.graal.debug.*;
-import com.oracle.graal.debug.Debug.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.truffle.debug.*;
 import com.oracle.graal.truffle.unsafe.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.debug.Debug.Scope;
 import com.oracle.truffle.api.*;
 import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
 import com.oracle.truffle.api.frame.*;
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/OptimizedAssumption.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/OptimizedAssumption.java	Thu May 28 21:11:28 2015 -0700
@@ -22,16 +22,16 @@
  */
 package com.oracle.graal.truffle;
 
+import com.oracle.jvmci.code.InstalledCode;
 import static com.oracle.graal.truffle.TruffleCompilerOptions.*;
 
 import java.lang.ref.*;
 import java.util.*;
 import java.util.stream.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.debug.*;
+import com.oracle.jvmci.debug.*;
 import com.oracle.truffle.api.*;
-import com.oracle.truffle.api.CompilerDirectives.*;
+import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
 import com.oracle.truffle.api.impl.*;
 import com.oracle.truffle.api.nodes.*;
 
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/OptimizedCallTarget.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/OptimizedCallTarget.java	Thu May 28 21:11:28 2015 -0700
@@ -22,6 +22,9 @@
  */
 package com.oracle.graal.truffle;
 
+import com.oracle.jvmci.code.InstalledCode;
+import com.oracle.jvmci.code.SpeculationLog;
+import com.oracle.jvmci.code.BailoutException;
 import static com.oracle.graal.truffle.TruffleCompilerOptions.*;
 
 import java.io.*;
@@ -30,10 +33,9 @@
 import java.util.concurrent.atomic.*;
 import java.util.stream.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.compiler.common.*;
-import com.oracle.graal.debug.*;
 import com.oracle.graal.truffle.debug.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.debug.*;
 import com.oracle.truffle.api.*;
 import com.oracle.truffle.api.CompilerDirectives.CompilationFinal;
 import com.oracle.truffle.api.frame.*;
@@ -517,7 +519,7 @@
         try {
             return OptimizedCallTarget.class.getDeclaredMethod("callDirect", Object[].class);
         } catch (NoSuchMethodException | SecurityException e) {
-            throw new GraalInternalError(e);
+            throw new JVMCIError(e);
         }
     }
 
@@ -525,7 +527,7 @@
         try {
             return OptimizedCallTarget.class.getDeclaredMethod("callInlined", Object[].class);
         } catch (NoSuchMethodException | SecurityException e) {
-            throw new GraalInternalError(e);
+            throw new JVMCIError(e);
         }
     }
 
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/OptimizedCallTargetInstrumentationFactory.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/OptimizedCallTargetInstrumentationFactory.java	Thu May 28 21:11:28 2015 -0700
@@ -22,9 +22,9 @@
  */
 package com.oracle.graal.truffle;
 
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.api.runtime.*;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
 import com.oracle.graal.lir.asm.*;
+import com.oracle.jvmci.runtime.*;
 
 /**
  * A service for creating a specialized {@link CompilationResultBuilder} used to inject code into
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/PartialEvaluator.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/PartialEvaluator.java	Thu May 28 21:11:28 2015 -0700
@@ -22,6 +22,13 @@
  */
 package com.oracle.graal.truffle;
 
+import com.oracle.jvmci.code.Architecture;
+import com.oracle.jvmci.meta.JavaType;
+import com.oracle.jvmci.meta.JavaConstant;
+import com.oracle.jvmci.meta.ResolvedJavaField;
+import com.oracle.jvmci.meta.ResolvedJavaType;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
+import com.oracle.jvmci.meta.Kind;
 import static com.oracle.graal.compiler.common.GraalOptions.*;
 import static com.oracle.graal.java.GraphBuilderPhase.Options.*;
 import static com.oracle.graal.truffle.TruffleCompilerOptions.*;
@@ -29,13 +36,8 @@
 import java.lang.invoke.*;
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.api.replacements.*;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.type.*;
-import com.oracle.graal.debug.*;
-import com.oracle.graal.debug.Debug.Scope;
 import com.oracle.graal.graphbuilderconf.*;
 import com.oracle.graal.graphbuilderconf.GraphBuilderConfiguration.Plugins;
 import com.oracle.graal.java.*;
@@ -44,7 +46,6 @@
 import com.oracle.graal.nodes.calc.*;
 import com.oracle.graal.nodes.java.*;
 import com.oracle.graal.nodes.virtual.*;
-import com.oracle.graal.options.*;
 import com.oracle.graal.phases.*;
 import com.oracle.graal.phases.common.*;
 import com.oracle.graal.phases.common.inlining.*;
@@ -59,6 +60,10 @@
 import com.oracle.graal.truffle.phases.*;
 import com.oracle.graal.truffle.substitutions.*;
 import com.oracle.graal.virtual.phases.ea.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.debug.Debug.Scope;
+import com.oracle.jvmci.options.*;
 import com.oracle.truffle.api.*;
 import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
 import com.oracle.truffle.api.nodes.*;
@@ -191,7 +196,7 @@
                 if (original.equals(callSiteProxyMethod)) {
                     ValueNode arg1 = arguments[0];
                     if (!arg1.isConstant()) {
-                        GraalInternalError.shouldNotReachHere("The direct call node does not resolve to a constant!");
+                        JVMCIError.shouldNotReachHere("The direct call node does not resolve to a constant!");
                     }
 
                     Object callNode = snippetReflection.asObject(Object.class, (JavaConstant) arg1.asConstant());
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/ReadOnlyFrame.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/ReadOnlyFrame.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,7 @@
  */
 package com.oracle.graal.truffle;
 
-import com.oracle.graal.compiler.common.*;
+import com.oracle.jvmci.common.*;
 import com.oracle.truffle.api.frame.*;
 
 class ReadOnlyFrame implements Frame {
@@ -45,7 +45,7 @@
     }
 
     public void setObject(FrameSlot slot, Object value) {
-        throw GraalInternalError.shouldNotReachHere();
+        throw JVMCIError.shouldNotReachHere();
     }
 
     public byte getByte(FrameSlot slot) throws FrameSlotTypeException {
@@ -53,7 +53,7 @@
     }
 
     public void setByte(FrameSlot slot, byte value) {
-        throw GraalInternalError.shouldNotReachHere();
+        throw JVMCIError.shouldNotReachHere();
     }
 
     public boolean getBoolean(FrameSlot slot) throws FrameSlotTypeException {
@@ -61,7 +61,7 @@
     }
 
     public void setBoolean(FrameSlot slot, boolean value) {
-        throw GraalInternalError.shouldNotReachHere();
+        throw JVMCIError.shouldNotReachHere();
     }
 
     public int getInt(FrameSlot slot) throws FrameSlotTypeException {
@@ -69,7 +69,7 @@
     }
 
     public void setInt(FrameSlot slot, int value) {
-        throw GraalInternalError.shouldNotReachHere();
+        throw JVMCIError.shouldNotReachHere();
     }
 
     public long getLong(FrameSlot slot) throws FrameSlotTypeException {
@@ -77,7 +77,7 @@
     }
 
     public void setLong(FrameSlot slot, long value) {
-        throw GraalInternalError.shouldNotReachHere();
+        throw JVMCIError.shouldNotReachHere();
     }
 
     public float getFloat(FrameSlot slot) throws FrameSlotTypeException {
@@ -85,7 +85,7 @@
     }
 
     public void setFloat(FrameSlot slot, float value) {
-        throw GraalInternalError.shouldNotReachHere();
+        throw JVMCIError.shouldNotReachHere();
     }
 
     public double getDouble(FrameSlot slot) throws FrameSlotTypeException {
@@ -93,7 +93,7 @@
     }
 
     public void setDouble(FrameSlot slot, double value) {
-        throw GraalInternalError.shouldNotReachHere();
+        throw JVMCIError.shouldNotReachHere();
     }
 
     public Object getValue(FrameSlot slot) {
@@ -101,7 +101,7 @@
     }
 
     public MaterializedFrame materialize() {
-        throw GraalInternalError.shouldNotReachHere();
+        throw JVMCIError.shouldNotReachHere();
     }
 
     public boolean isObject(FrameSlot slot) {
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCompiler.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCompiler.java	Thu May 28 21:11:28 2015 -0700
@@ -22,18 +22,22 @@
  */
 package com.oracle.graal.truffle;
 
-import static com.oracle.graal.api.code.CodeUtil.*;
+import com.oracle.jvmci.code.CallingConvention;
+import com.oracle.jvmci.code.CodeCacheProvider;
+import com.oracle.jvmci.code.InstalledCode;
+import com.oracle.jvmci.code.SpeculationLog;
+import com.oracle.jvmci.code.CompilationResult;
+import com.oracle.jvmci.meta.MetaAccessProvider;
+import com.oracle.jvmci.meta.ResolvedJavaType;
+import com.oracle.jvmci.meta.ConstantReflectionProvider;
+import static com.oracle.jvmci.code.CodeUtil.*;
 import static com.oracle.graal.compiler.GraalCompiler.*;
 
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.code.CallingConvention.Type;
-import com.oracle.graal.api.meta.Assumptions.Assumption;
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.code.CallingConvention.Type;
+import com.oracle.jvmci.meta.Assumptions.Assumption;
 import com.oracle.graal.compiler.target.*;
-import com.oracle.graal.debug.*;
-import com.oracle.graal.debug.Debug.Scope;
 import com.oracle.graal.graphbuilderconf.*;
 import com.oracle.graal.graphbuilderconf.GraphBuilderConfiguration.Plugins;
 import com.oracle.graal.lir.asm.*;
@@ -45,6 +49,8 @@
 import com.oracle.graal.phases.util.*;
 import com.oracle.graal.printer.*;
 import com.oracle.graal.truffle.nodes.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.debug.Debug.Scope;
 import com.oracle.truffle.api.*;
 import com.oracle.truffle.api.nodes.*;
 
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCompilerOptions.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCompilerOptions.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,7 @@
  */
 package com.oracle.graal.truffle;
 
-import com.oracle.graal.options.*;
+import com.oracle.jvmci.options.*;
 
 /**
  * Options for the Truffle compiler.
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleConstantReflectionProvider.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleConstantReflectionProvider.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,17 @@
  */
 package com.oracle.graal.truffle;
 
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.meta.JavaType;
+import com.oracle.jvmci.meta.MemoryAccessProvider;
+import com.oracle.jvmci.meta.ResolvedJavaField;
+import com.oracle.jvmci.meta.JavaConstant;
+import com.oracle.jvmci.meta.JavaField;
+import com.oracle.jvmci.meta.MetaAccessProvider;
+import com.oracle.jvmci.meta.ResolvedJavaType;
+import com.oracle.jvmci.meta.Constant;
+import com.oracle.jvmci.meta.ConstantReflectionProvider;
+import com.oracle.jvmci.meta.MethodHandleAccessProvider;
+import com.oracle.jvmci.meta.Kind;
 import com.oracle.truffle.api.CompilerDirectives.CompilationFinal;
 import com.oracle.truffle.api.nodes.Node.Child;
 import com.oracle.truffle.api.nodes.Node.Children;
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleDebugJavaMethod.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleDebugJavaMethod.java	Thu May 28 21:11:28 2015 -0700
@@ -22,8 +22,12 @@
  */
 package com.oracle.graal.truffle;
 
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.debug.*;
+import com.oracle.jvmci.meta.JavaMethod;
+import com.oracle.jvmci.meta.JavaType;
+import com.oracle.jvmci.meta.Signature;
+import com.oracle.jvmci.meta.ResolvedJavaType;
+import com.oracle.jvmci.meta.Kind;
+import com.oracle.jvmci.debug.*;
 import com.oracle.truffle.api.*;
 
 /**
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleExpansionLogger.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleExpansionLogger.java	Thu May 28 21:11:28 2015 -0700
@@ -22,11 +22,12 @@
  */
 package com.oracle.graal.truffle;
 
+import com.oracle.jvmci.meta.ResolvedJavaType;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
 import java.io.*;
 import java.util.*;
 import java.util.Map.Entry;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.java.*;
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleTreeDumpHandler.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleTreeDumpHandler.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,7 @@
  */
 package com.oracle.graal.truffle;
 
-import com.oracle.graal.debug.*;
+import com.oracle.jvmci.debug.*;
 import com.oracle.truffle.api.*;
 import com.oracle.truffle.api.nodes.*;
 
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/debug/AbstractDebugCompilationListener.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/debug/AbstractDebugCompilationListener.java	Thu May 28 21:11:28 2015 -0700
@@ -22,13 +22,13 @@
  */
 package com.oracle.graal.truffle.debug;
 
+import com.oracle.jvmci.code.CompilationResult;
 import java.io.*;
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.debug.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.truffle.*;
+import com.oracle.jvmci.debug.*;
 
 public abstract class AbstractDebugCompilationListener implements GraalTruffleCompilationListener {
 
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/debug/CompilationStatisticsListener.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/debug/CompilationStatisticsListener.java	Thu May 28 21:11:28 2015 -0700
@@ -22,6 +22,7 @@
  */
 package com.oracle.graal.truffle.debug;
 
+import com.oracle.jvmci.code.CompilationResult;
 import static java.util.function.Function.*;
 import static java.util.stream.Collectors.*;
 
@@ -30,7 +31,6 @@
 import java.util.function.*;
 import java.util.stream.*;
 
-import com.oracle.graal.api.code.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.truffle.*;
 import com.oracle.graal.truffle.TruffleInlining.CallTreeNodeVisitor;
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/debug/HistogramInlineInvokePlugin.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/debug/HistogramInlineInvokePlugin.java	Thu May 28 21:11:28 2015 -0700
@@ -22,10 +22,11 @@
  */
 package com.oracle.graal.truffle.debug;
 
+import com.oracle.jvmci.meta.JavaType;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
 import java.io.*;
 import java.util.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graphbuilderconf.*;
 import com.oracle.graal.nodes.*;
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/debug/TraceCompilationASTListener.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/debug/TraceCompilationASTListener.java	Thu May 28 21:11:28 2015 -0700
@@ -22,12 +22,12 @@
  */
 package com.oracle.graal.truffle.debug;
 
+import com.oracle.jvmci.code.CompilationResult;
 import static com.oracle.graal.truffle.TruffleCompilerOptions.*;
 
 import java.io.*;
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.truffle.*;
 import com.oracle.graal.truffle.TruffleInlining.CallTreeNodeVisitor;
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/debug/TraceCompilationCallTreeListener.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/debug/TraceCompilationCallTreeListener.java	Thu May 28 21:11:28 2015 -0700
@@ -22,14 +22,14 @@
  */
 package com.oracle.graal.truffle.debug;
 
+import com.oracle.jvmci.code.CompilationResult;
 import static com.oracle.graal.truffle.TruffleCompilerOptions.*;
 
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.truffle.*;
-import com.oracle.graal.truffle.TruffleInlining.*;
+import com.oracle.graal.truffle.TruffleInlining.CallTreeNodeVisitor;
 import com.oracle.truffle.api.nodes.*;
 
 public final class TraceCompilationCallTreeListener extends AbstractDebugCompilationListener {
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/debug/TraceCompilationFailureListener.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/debug/TraceCompilationFailureListener.java	Thu May 28 21:11:28 2015 -0700
@@ -22,9 +22,9 @@
  */
 package com.oracle.graal.truffle.debug;
 
+import com.oracle.jvmci.code.BailoutException;
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
 import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.truffle.*;
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/debug/TraceCompilationListener.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/debug/TraceCompilationListener.java	Thu May 28 21:11:28 2015 -0700
@@ -22,11 +22,11 @@
  */
 package com.oracle.graal.truffle.debug;
 
+import com.oracle.jvmci.code.CompilationResult;
 import static com.oracle.graal.truffle.TruffleCompilerOptions.*;
 
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.truffle.*;
 import com.oracle.truffle.api.source.*;
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/debug/TraceCompilationPolymorphismListener.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/debug/TraceCompilationPolymorphismListener.java	Thu May 28 21:11:28 2015 -0700
@@ -22,11 +22,11 @@
  */
 package com.oracle.graal.truffle.debug;
 
+import com.oracle.jvmci.code.CompilationResult;
 import static com.oracle.graal.truffle.TruffleCompilerOptions.*;
 
 import java.util.*;
 
-import com.oracle.graal.api.code.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.truffle.*;
 import com.oracle.truffle.api.nodes.*;
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/debug/TraceSplittingListener.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/debug/TraceSplittingListener.java	Thu May 28 21:11:28 2015 -0700
@@ -28,7 +28,7 @@
 
 import com.oracle.graal.truffle.*;
 import com.oracle.truffle.api.nodes.*;
-import com.oracle.truffle.api.nodes.NodeUtil.*;
+import com.oracle.truffle.api.nodes.NodeUtil.NodeCountFilter;
 
 public final class TraceSplittingListener extends AbstractDebugCompilationListener {
 
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/AssumptionValidAssumption.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/AssumptionValidAssumption.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,7 @@
  */
 package com.oracle.graal.truffle.nodes;
 
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.meta.Assumptions;
 import com.oracle.graal.truffle.*;
 
 public final class AssumptionValidAssumption extends Assumptions.Assumption {
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/IsCompilationConstantNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/IsCompilationConstantNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,7 @@
  */
 package com.oracle.graal.truffle.nodes;
 
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.meta.Kind;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/ObjectLocationIdentity.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/ObjectLocationIdentity.java	Thu May 28 21:11:28 2015 -0700
@@ -22,10 +22,11 @@
  */
 package com.oracle.graal.truffle.nodes;
 
+import com.oracle.jvmci.meta.JavaConstant;
+import com.oracle.jvmci.meta.Kind;
+import com.oracle.jvmci.meta.LocationIdentity;
 import java.util.*;
 
-import com.oracle.graal.api.meta.*;
-
 /**
  * A {@link LocationIdentity} wrapping an object.
  */
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/frame/NewFrameNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/frame/NewFrameNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,12 +22,13 @@
  */
 package com.oracle.graal.truffle.nodes.frame;
 
+import com.oracle.jvmci.meta.ResolvedJavaField;
+import com.oracle.jvmci.meta.ResolvedJavaType;
+import com.oracle.jvmci.meta.Kind;
 import java.util.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.api.replacements.*;
 import com.oracle.graal.api.runtime.*;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
@@ -39,6 +40,7 @@
 import com.oracle.graal.nodes.virtual.*;
 import com.oracle.graal.truffle.*;
 import com.oracle.graal.truffle.nodes.*;
+import com.oracle.jvmci.common.*;
 import com.oracle.truffle.api.frame.*;
 
 /**
@@ -134,7 +136,7 @@
             escapeReason = "Must not let virtual frame object escape at node " + fixed + ".";
         }
 
-        Throwable exception = new GraalInternalError(escapeReason +
+        Throwable exception = new JVMCIError(escapeReason +
                         " Insert a call to VirtualFrame.materialize() to convert the instance to a materialized frame object (source position of following stack trace is approximate)");
         throw GraphUtil.approxSourceException(fixed, exception);
     }
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/substitutions/TruffleGraphBuilderPlugins.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/substitutions/TruffleGraphBuilderPlugins.java	Thu May 28 21:11:28 2015 -0700
@@ -22,18 +22,27 @@
  */
 package com.oracle.graal.truffle.substitutions;
 
+import com.oracle.jvmci.meta.JavaConstant;
+import com.oracle.jvmci.meta.MetaAccessProvider;
+import com.oracle.jvmci.meta.ResolvedJavaType;
+import com.oracle.jvmci.meta.DeoptimizationAction;
+import com.oracle.jvmci.meta.DeoptimizationReason;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
+import com.oracle.jvmci.meta.ConstantReflectionProvider;
+import com.oracle.jvmci.meta.Constant;
+import com.oracle.jvmci.meta.LocationIdentity;
+import com.oracle.jvmci.meta.Kind;
 import static java.lang.Character.*;
 
 import java.util.concurrent.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.api.replacements.*;
 import com.oracle.graal.compiler.common.calc.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graphbuilderconf.*;
+import com.oracle.graal.graphbuilderconf.InvocationPlugin.Receiver;
 import com.oracle.graal.graphbuilderconf.InvocationPlugins.Registration;
-import com.oracle.graal.graphbuilderconf.MethodIdMap.Receiver;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.calc.*;
 import com.oracle.graal.nodes.extended.*;
@@ -76,14 +85,14 @@
                     OptimizedAssumption assumption = snippetReflection.asObject(OptimizedAssumption.class, (JavaConstant) constant);
                     if (assumption.isValid()) {
                         if (targetMethod.getName().equals("isValid")) {
-                            b.addPush(ConstantNode.forBoolean(true));
+                            b.addPush(Kind.Boolean, ConstantNode.forBoolean(true));
                         } else {
                             assert targetMethod.getName().equals("check") : targetMethod;
                         }
                         b.getAssumptions().record(new AssumptionValidAssumption(assumption));
                     } else {
                         if (targetMethod.getName().equals("isValid")) {
-                            b.addPush(ConstantNode.forBoolean(false));
+                            b.addPush(Kind.Boolean, ConstantNode.forBoolean(false));
                         } else {
                             assert targetMethod.getName().equals("check") : targetMethod;
                             b.add(new DeoptimizeNode(DeoptimizationAction.InvalidateRecompile, DeoptimizationReason.None));
@@ -107,31 +116,31 @@
             Class<?> type = kind.toJavaClass();
             r.register2("addExact", type, type, new InvocationPlugin() {
                 public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode x, ValueNode y) {
-                    b.addPush(kind.getStackKind(), new IntegerAddExactNode(x, y));
+                    b.addPush(kind, new IntegerAddExactNode(x, y));
                     return true;
                 }
             });
             r.register2("subtractExact", type, type, new InvocationPlugin() {
                 public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode x, ValueNode y) {
-                    b.addPush(kind.getStackKind(), new IntegerSubExactNode(x, y));
+                    b.addPush(kind, new IntegerSubExactNode(x, y));
                     return true;
                 }
             });
             r.register2("multiplyExact", type, type, new InvocationPlugin() {
                 public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode x, ValueNode y) {
-                    b.addPush(kind.getStackKind(), new IntegerMulExactNode(x, y));
+                    b.addPush(kind, new IntegerMulExactNode(x, y));
                     return true;
                 }
             });
             r.register2("multiplyHigh", type, type, new InvocationPlugin() {
                 public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode x, ValueNode y) {
-                    b.addPush(kind.getStackKind(), new IntegerMulHighNode(x, y));
+                    b.addPush(kind, new IntegerMulHighNode(x, y));
                     return true;
                 }
             });
             r.register2("multiplyHighUnsigned", type, type, new InvocationPlugin() {
                 public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode x, ValueNode y) {
-                    b.addPush(kind.getStackKind(), new UnsignedMulHighNode(x, y));
+                    b.addPush(kind, new UnsignedMulHighNode(x, y));
                     return true;
                 }
             });
@@ -142,13 +151,13 @@
         Registration r = new Registration(plugins, CompilerDirectives.class);
         r.register0("inInterpreter", new InvocationPlugin() {
             public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver) {
-                b.addPush(Kind.Boolean.getStackKind(), ConstantNode.forBoolean(false));
+                b.addPush(Kind.Boolean, ConstantNode.forBoolean(false));
                 return true;
             }
         });
         r.register0("inCompiledCode", new InvocationPlugin() {
             public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver) {
-                b.addPush(Kind.Boolean.getStackKind(), ConstantNode.forBoolean(true));
+                b.addPush(Kind.Boolean, ConstantNode.forBoolean(true));
                 return true;
             }
         });
@@ -176,7 +185,7 @@
         });
         r.register2("injectBranchProbability", double.class, boolean.class, new InvocationPlugin() {
             public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode probability, ValueNode condition) {
-                b.addPush(Kind.Boolean.getStackKind(), new BranchProbabilityNode(probability, condition));
+                b.addPush(Kind.Boolean, new BranchProbabilityNode(probability, condition));
                 return true;
             }
         });
@@ -191,9 +200,9 @@
         r.register1("isCompilationConstant", Object.class, new InvocationPlugin() {
             public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode value) {
                 if ((value instanceof BoxNode ? ((BoxNode) value).getValue() : value).isConstant()) {
-                    b.addPush(Kind.Boolean.getStackKind(), ConstantNode.forBoolean(true));
+                    b.addPush(Kind.Boolean, ConstantNode.forBoolean(true));
                 } else {
-                    b.addPush(Kind.Boolean.getStackKind(), new IsCompilationConstantNode(value));
+                    b.addPush(Kind.Boolean, new IsCompilationConstantNode(value));
                 }
                 return true;
             }
@@ -366,7 +375,7 @@
                     locationIdentity = ObjectLocationIdentity.create(location.asJavaConstant());
                 }
                 LogicNode compare = b.add(CompareNode.createCompareNode(Condition.EQ, condition, ConstantNode.forBoolean(true, object.graph()), b.getConstantReflection()));
-                b.addPush(returnKind.getStackKind(), b.add(new UnsafeLoadNode(object, offset, returnKind, locationIdentity, compare)));
+                b.addPush(returnKind, b.add(new UnsafeLoadNode(object, offset, returnKind, locationIdentity, compare)));
                 return true;
             }
             // TODO: should we throw b.bailout() here?
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/unsafe/UnsafeAccessImpl.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/unsafe/UnsafeAccessImpl.java	Thu May 28 21:11:28 2015 -0700
@@ -26,7 +26,6 @@
 
 import sun.misc.*;
 
-import com.oracle.truffle.api.*;
 import com.oracle.truffle.api.unsafe.*;
 
 @SuppressWarnings("unused")
--- a/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/EffectList.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/EffectList.java	Thu May 28 21:11:28 2015 -0700
@@ -25,10 +25,10 @@
 import java.lang.reflect.*;
 import java.util.*;
 
-import com.oracle.graal.compiler.common.*;
-import com.oracle.graal.debug.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.debug.*;
 
 /**
  * An {@link EffectList} can be used to maintain a list of {@link Effect}s and backtrack to a
@@ -171,7 +171,7 @@
                 } catch (Throwable t) {
                     StringBuilder str = new StringBuilder();
                     toString(str, i);
-                    throw new GraalInternalError(t).addContext("effect", str);
+                    throw new JVMCIError(t).addContext("effect", str);
                 }
                 if (effect.isVisible() && Debug.isLogEnabled()) {
                     StringBuilder str = new StringBuilder();
--- a/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/EffectsClosure.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/EffectsClosure.java	Thu May 28 21:11:28 2015 -0700
@@ -27,7 +27,6 @@
 import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.cfg.*;
 import com.oracle.graal.compiler.common.type.*;
-import com.oracle.graal.debug.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.iterators.*;
 import com.oracle.graal.nodes.*;
@@ -39,6 +38,8 @@
 import com.oracle.graal.phases.graph.ReentrantBlockIterator.BlockIteratorClosure;
 import com.oracle.graal.phases.graph.ReentrantBlockIterator.LoopInfo;
 import com.oracle.graal.phases.schedule.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.debug.*;
 
 public abstract class EffectsClosure<BlockT extends EffectsBlockState<BlockT>> extends EffectsPhase.Closure<BlockT> {
 
@@ -243,7 +244,7 @@
                 }
             }
         }
-        throw new GraalInternalError("too many iterations at %s", loop);
+        throw new JVMCIError("too many iterations at %s", loop);
     }
 
     @SuppressWarnings("unused")
--- a/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/EffectsPhase.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/EffectsPhase.java	Thu May 28 21:11:28 2015 -0700
@@ -22,13 +22,11 @@
  */
 package com.oracle.graal.virtual.phases.ea;
 
-import static com.oracle.graal.debug.Debug.*;
 import static com.oracle.graal.phases.common.DeadCodeEliminationPhase.Optionality.*;
+import static com.oracle.jvmci.debug.Debug.*;
 
 import java.util.*;
 
-import com.oracle.graal.debug.*;
-import com.oracle.graal.debug.Debug.Scope;
 import com.oracle.graal.graph.Graph.NodeEventScope;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
@@ -40,6 +38,8 @@
 import com.oracle.graal.phases.graph.*;
 import com.oracle.graal.phases.schedule.*;
 import com.oracle.graal.phases.tiers.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.debug.Debug.Scope;
 
 public abstract class EffectsPhase<PhaseContextT extends PhaseContext> extends BasePhase<PhaseContextT> {
 
--- a/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/ObjectState.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/ObjectState.java	Thu May 28 21:11:28 2015 -0700
@@ -24,13 +24,13 @@
 
 import java.util.*;
 
-import com.oracle.graal.debug.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.java.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.spi.Virtualizable.EscapeState;
 import com.oracle.graal.nodes.virtual.*;
 import com.oracle.graal.virtual.nodes.*;
+import com.oracle.jvmci.debug.*;
 
 /**
  * This class describes the state of a virtual object while iterating over the graph. It describes
--- a/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/PEReadEliminationBlockState.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/PEReadEliminationBlockState.java	Thu May 28 21:11:28 2015 -0700
@@ -22,9 +22,9 @@
  */
 package com.oracle.graal.virtual.phases.ea;
 
+import com.oracle.jvmci.meta.LocationIdentity;
 import java.util.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.virtual.*;
--- a/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/PEReadEliminationClosure.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/PEReadEliminationClosure.java	Thu May 28 21:11:28 2015 -0700
@@ -22,11 +22,17 @@
  */
 package com.oracle.graal.virtual.phases.ea;
 
-import static com.oracle.graal.api.meta.LocationIdentity.*;
+import com.oracle.jvmci.meta.ConstantReflectionProvider;
+import com.oracle.jvmci.meta.MetaAccessProvider;
+import com.oracle.jvmci.meta.ResolvedJavaType;
+import com.oracle.jvmci.meta.Kind;
+import com.oracle.jvmci.meta.LocationIdentity;
+import com.oracle.jvmci.meta.NamedLocationIdentity;
+import com.oracle.jvmci.meta.JavaConstant;
+import static com.oracle.jvmci.meta.LocationIdentity.*;
 
 import java.util.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.cfg.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.*;
--- a/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/PartialEscapeClosure.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/PartialEscapeClosure.java	Thu May 28 21:11:28 2015 -0700
@@ -22,14 +22,16 @@
  */
 package com.oracle.graal.virtual.phases.ea;
 
+import com.oracle.jvmci.meta.ConstantReflectionProvider;
+import com.oracle.jvmci.meta.MetaAccessProvider;
+import com.oracle.jvmci.meta.Kind;
+import com.oracle.jvmci.meta.JavaConstant;
 import java.util.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.cfg.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.compiler.common.util.*;
-import com.oracle.graal.debug.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
 import com.oracle.graal.nodes.*;
@@ -39,6 +41,7 @@
 import com.oracle.graal.nodes.spi.Virtualizable.EscapeState;
 import com.oracle.graal.nodes.virtual.*;
 import com.oracle.graal.phases.schedule.*;
+import com.oracle.jvmci.debug.*;
 
 public abstract class PartialEscapeClosure<BlockT extends PartialEscapeBlockState<BlockT>> extends EffectsClosure<BlockT> {
 
--- a/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/PartialEscapePhase.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/PartialEscapePhase.java	Thu May 28 21:11:28 2015 -0700
@@ -31,11 +31,11 @@
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.cfg.*;
 import com.oracle.graal.nodes.spi.*;
-import com.oracle.graal.options.*;
 import com.oracle.graal.phases.*;
 import com.oracle.graal.phases.common.*;
 import com.oracle.graal.phases.schedule.*;
 import com.oracle.graal.phases.tiers.*;
+import com.oracle.jvmci.options.*;
 
 public class PartialEscapePhase extends EffectsPhase<PhaseContext> {
 
--- a/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/ReadEliminationBlockState.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/ReadEliminationBlockState.java	Thu May 28 21:11:28 2015 -0700
@@ -22,9 +22,9 @@
  */
 package com.oracle.graal.virtual.phases.ea;
 
+import com.oracle.jvmci.meta.LocationIdentity;
 import java.util.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.extended.*;
--- a/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/ReadEliminationClosure.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/ReadEliminationClosure.java	Thu May 28 21:11:28 2015 -0700
@@ -22,11 +22,12 @@
  */
 package com.oracle.graal.virtual.phases.ea;
 
-import static com.oracle.graal.api.meta.LocationIdentity.*;
+import com.oracle.jvmci.meta.Kind;
+import com.oracle.jvmci.meta.LocationIdentity;
+import static com.oracle.jvmci.meta.LocationIdentity.*;
 
 import java.util.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
--- a/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/VirtualUtil.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/VirtualUtil.java	Thu May 28 21:11:28 2015 -0700
@@ -22,20 +22,20 @@
  */
 package com.oracle.graal.virtual.phases.ea;
 
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
 import static com.oracle.graal.compiler.common.GraalOptions.*;
 
 import java.util.*;
 
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.common.*;
-import com.oracle.graal.debug.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.debug.*;
 
 public final class VirtualUtil {
 
     private VirtualUtil() {
-        GraalInternalError.shouldNotReachHere();
+        JVMCIError.shouldNotReachHere();
     }
 
     public static boolean assertNonReachable(StructuredGraph graph, List<Node> obsoleteNodes) {
--- a/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/VirtualizerToolImpl.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/VirtualizerToolImpl.java	Thu May 28 21:11:28 2015 -0700
@@ -22,11 +22,13 @@
  */
 package com.oracle.graal.virtual.phases.ea;
 
+import com.oracle.jvmci.meta.ConstantReflectionProvider;
+import com.oracle.jvmci.meta.MetaAccessProvider;
+import com.oracle.jvmci.meta.Kind;
 import static com.oracle.graal.compiler.common.GraalOptions.*;
 
 import java.util.*;
 
-import com.oracle.graal.api.meta.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
 import com.oracle.graal.nodes.*;
--- a/graal/com.oracle.graal.word/src/com/oracle/graal/word/BarrieredAccess.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.word/src/com/oracle/graal/word/BarrieredAccess.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,7 @@
  */
 package com.oracle.graal.word;
 
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.meta.LocationIdentity;
 import com.oracle.graal.nodes.extended.*;
 import com.oracle.graal.word.Word.Opcode;
 import com.oracle.graal.word.Word.Operation;
--- a/graal/com.oracle.graal.word/src/com/oracle/graal/word/ObjectAccess.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.word/src/com/oracle/graal/word/ObjectAccess.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,7 @@
  */
 package com.oracle.graal.word;
 
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.meta.LocationIdentity;
 import com.oracle.graal.nodes.extended.*;
 import com.oracle.graal.word.Word.Opcode;
 import com.oracle.graal.word.Word.Operation;
--- a/graal/com.oracle.graal.word/src/com/oracle/graal/word/Pointer.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.word/src/com/oracle/graal/word/Pointer.java	Thu May 28 21:11:28 2015 -0700
@@ -22,9 +22,9 @@
  */
 package com.oracle.graal.word;
 
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.meta.LocationIdentity;
 import com.oracle.graal.nodes.extended.*;
-import com.oracle.graal.nodes.memory.HeapAccess.*;
+import com.oracle.graal.nodes.memory.HeapAccess.BarrierType;
 
 /**
  * Lowest-level memory access of native C memory. These methods access the raw memory without any
--- a/graal/com.oracle.graal.word/src/com/oracle/graal/word/Word.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.word/src/com/oracle/graal/word/Word.java	Thu May 28 21:11:28 2015 -0700
@@ -22,17 +22,17 @@
  */
 package com.oracle.graal.word;
 
-import static com.oracle.graal.compiler.common.UnsafeAccess.*;
+import com.oracle.jvmci.code.UnsignedMath;
+import com.oracle.jvmci.meta.LocationIdentity;
+import static com.oracle.jvmci.common.UnsafeAccess.*;
 
 import java.lang.annotation.*;
 
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.calc.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.calc.*;
-import com.oracle.graal.nodes.memory.HeapAccess.*;
+import com.oracle.graal.nodes.memory.HeapAccess.BarrierType;
+import com.oracle.jvmci.common.*;
 
 public abstract class Word implements Signed, Unsigned, Pointer {
 
@@ -1087,17 +1087,17 @@
 
     @Override
     public final boolean equals(Object obj) {
-        throw GraalInternalError.shouldNotReachHere("equals must not be called on words");
+        throw JVMCIError.shouldNotReachHere("equals must not be called on words");
     }
 
     @Override
     public final int hashCode() {
-        throw GraalInternalError.shouldNotReachHere("hashCode must not be called on words");
+        throw JVMCIError.shouldNotReachHere("hashCode must not be called on words");
     }
 
     @Override
     public String toString() {
-        throw GraalInternalError.shouldNotReachHere("toString must not be called on words");
+        throw JVMCIError.shouldNotReachHere("toString must not be called on words");
     }
 }
 
--- a/graal/com.oracle.graal.word/src/com/oracle/graal/word/WordBase.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.word/src/com/oracle/graal/word/WordBase.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,7 @@
  */
 package com.oracle.graal.word;
 
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.meta.TrustedInterface;
 
 public interface WordBase extends TrustedInterface {
 
--- a/graal/com.oracle.graal.word/src/com/oracle/graal/word/WordTypes.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.word/src/com/oracle/graal/word/WordTypes.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,11 @@
  */
 package com.oracle.graal.word;
 
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.meta.MetaAccessProvider;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
+import com.oracle.jvmci.meta.JavaType;
+import com.oracle.jvmci.meta.Kind;
+import com.oracle.jvmci.meta.ResolvedJavaType;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.type.*;
--- a/graal/com.oracle.graal.word/src/com/oracle/graal/word/nodes/SnippetLocationNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.word/src/com/oracle/graal/word/nodes/SnippetLocationNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,11 +22,10 @@
  */
 package com.oracle.graal.word.nodes;
 
-import static com.oracle.graal.api.meta.LocationIdentity.*;
-
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.meta.Value;
+import com.oracle.jvmci.meta.LocationIdentity;
+import static com.oracle.jvmci.meta.LocationIdentity.*;
 import com.oracle.graal.api.replacements.*;
-import com.oracle.graal.compiler.common.*;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
@@ -35,6 +34,7 @@
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.extended.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.jvmci.common.*;
 
 /**
  * Location node that can be used inside a snippet without having the elements (including the
@@ -97,12 +97,12 @@
 
     @Override
     public Value generateAddress(NodeMappableLIRBuilder builder, LIRGeneratorTool gen, Value base) {
-        throw new GraalInternalError("locationIdentity must be a constant so that this node can be canonicalized: " + locationIdentity);
+        throw new JVMCIError("locationIdentity must be a constant so that this node can be canonicalized: " + locationIdentity);
     }
 
     @Override
     public IntegerStamp getDisplacementStamp() {
-        throw GraalInternalError.shouldNotReachHere();
+        throw JVMCIError.shouldNotReachHere();
     }
 
     @NodeIntrinsic
--- a/graal/com.oracle.graal.word/src/com/oracle/graal/word/nodes/WordCastNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.graal.word/src/com/oracle/graal/word/nodes/WordCastNode.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,11 @@
  */
 package com.oracle.graal.word.nodes;
 
-import com.oracle.graal.api.meta.*;
+import com.oracle.jvmci.meta.AllocatableValue;
+import com.oracle.jvmci.meta.LIRKind;
+import com.oracle.jvmci.meta.Value;
+import com.oracle.jvmci.meta.JavaConstant;
+import com.oracle.jvmci.meta.Kind;
 import com.oracle.graal.compiler.common.type.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.spi.*;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.code/overview.html	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,37 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+<!--
+
+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.  Oracle designates this
+particular file as subject to the "Classpath" exception as provided
+by Oracle in the LICENSE file that accompanied this code.
+
+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.
+-->
+
+</head>
+<body>
+
+The <code>com.oracle.jvmci.code</code> project provides an API to the runtime's native code cache.
+It allows installation and execution of native code.
+
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/AbstractAddress.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.code;
+
+/**
+ * Abstract base class that represents a platform specific address.
+ */
+public abstract class AbstractAddress {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/Architecture.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,250 @@
+/*
+ * 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.jvmci.code;
+
+import com.oracle.jvmci.meta.Kind;
+import com.oracle.jvmci.meta.PlatformKind;
+import java.nio.*;
+import java.util.*;
+
+import com.oracle.jvmci.code.Register.RegisterCategory;
+
+/**
+ * Represents a CPU architecture, including information such as its endianness, CPU registers, word
+ * width, etc.
+ */
+public abstract class Architecture {
+
+    /**
+     * The number of entries required in a {@link ReferenceMap} covering all the registers that may
+     * store references. The index of a register in the reference map is given by
+     * {@link Register#getReferenceMapIndex()}.
+     */
+    private final int registerReferenceMapSize;
+
+    /**
+     * Represents the natural size of words (typically registers and pointers) of this architecture,
+     * in bytes.
+     */
+    private final int wordSize;
+
+    /**
+     * The name of this architecture (e.g. "AMD64", "SPARCv9").
+     */
+    private final String name;
+
+    /**
+     * Array of all available registers on this architecture. The index of each register in this
+     * array is equal to its {@linkplain Register#number number}.
+     */
+    private final Register[] registers;
+
+    /**
+     * The byte ordering can be either little or big endian.
+     */
+    private final ByteOrder byteOrder;
+
+    /**
+     * Whether the architecture supports unaligned memory accesses.
+     */
+    private final boolean unalignedMemoryAccess;
+
+    /**
+     * Mask of the barrier constants denoting the barriers that are not required to be explicitly
+     * inserted under this architecture.
+     */
+    private final int implicitMemoryBarriers;
+
+    /**
+     * Offset in bytes from the beginning of a call instruction to the displacement.
+     */
+    private 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).
+     */
+    private final int returnAddressSize;
+
+    protected Architecture(String name, int wordSize, ByteOrder byteOrder, boolean unalignedMemoryAccess, Register[] registers, int implicitMemoryBarriers, int nativeCallDisplacementOffset,
+                    int registerReferenceMapSize, int returnAddressSize) {
+        this.name = name;
+        this.registers = registers;
+        this.wordSize = wordSize;
+        this.byteOrder = byteOrder;
+        this.unalignedMemoryAccess = unalignedMemoryAccess;
+        this.implicitMemoryBarriers = implicitMemoryBarriers;
+        this.machineCodeCallDisplacementOffset = nativeCallDisplacementOffset;
+        this.registerReferenceMapSize = registerReferenceMapSize;
+        this.returnAddressSize = returnAddressSize;
+    }
+
+    /**
+     * Converts this architecture to a string.
+     *
+     * @return the string representation of this architecture
+     */
+    @Override
+    public final String toString() {
+        return getName().toLowerCase();
+    }
+
+    public int getRegisterReferenceMapSize() {
+        return registerReferenceMapSize;
+    }
+
+    /**
+     * Gets the natural size of words (typically registers and pointers) of this architecture, in
+     * bytes.
+     */
+    public int getWordSize() {
+        return wordSize;
+    }
+
+    /**
+     * Gets the name of this architecture.
+     */
+    public String getName() {
+        return name;
+    }
+
+    /**
+     * Gets an array of all available registers on this architecture. The index of each register in
+     * this array is equal to its {@linkplain Register#number number}.
+     */
+    public Register[] getRegisters() {
+        return registers.clone();
+    }
+
+    public ByteOrder getByteOrder() {
+        return byteOrder;
+    }
+
+    /**
+     * @return true if the architecture supports unaligned memory accesses.
+     */
+    public boolean supportsUnalignedMemoryAccess() {
+        return unalignedMemoryAccess;
+    }
+
+    /**
+     * Gets 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.
+     */
+    public int getReturnAddressSize() {
+        return returnAddressSize;
+    }
+
+    /**
+     * Gets the offset in bytes from the beginning of a call instruction to the displacement.
+     */
+    public int getMachineCodeCallDisplacementOffset() {
+        return machineCodeCallDisplacementOffset;
+    }
+
+    /**
+     * Determines the barriers in a given barrier mask that are explicitly required on this
+     * architecture.
+     *
+     * @param barriers a mask of the barrier constants
+     * @return the value of {@code barriers} minus the barriers unnecessary on this architecture
+     */
+    public final int requiredBarriers(int barriers) {
+        return barriers & ~implicitMemoryBarriers;
+    }
+
+    /**
+     * 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 getSizeInBytes(PlatformKind kind) {
+        switch ((Kind) 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;
+            default:
+                return 0;
+        }
+    }
+
+    /**
+     * Determine whether a kind can be stored in a register of a given category.
+     *
+     * @param category the category of the register
+     * @param kind the kind that should be stored in the register
+     */
+    public abstract boolean canStoreValue(RegisterCategory category, PlatformKind kind);
+
+    /**
+     * Return the largest kind that can be stored in a register of a given category.
+     *
+     * @param category the category of the register
+     * @return the largest kind that can be stored in a register {@code category}
+     */
+    public abstract PlatformKind getLargestStorableKind(RegisterCategory category);
+
+    @Override
+    public final boolean equals(Object obj) {
+        if (obj == this) {
+            return true;
+        }
+        if (obj instanceof Architecture) {
+            Architecture that = (Architecture) obj;
+            if (this.name.equals(that.name)) {
+                assert this.byteOrder.equals(that.byteOrder);
+                assert this.implicitMemoryBarriers == that.implicitMemoryBarriers;
+                assert this.machineCodeCallDisplacementOffset == that.machineCodeCallDisplacementOffset;
+                assert this.registerReferenceMapSize == that.registerReferenceMapSize;
+                assert Arrays.equals(this.registers, that.registers);
+                assert this.returnAddressSize == that.returnAddressSize;
+                assert this.unalignedMemoryAccess == that.unalignedMemoryAccess;
+                assert this.wordSize == that.wordSize;
+                return true;
+            }
+        }
+        return false;
+    }
+
+    @Override
+    public final int hashCode() {
+        return name.hashCode();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/ArithmeticOperation.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.code;
+
+/**
+ * An {@code ArithmeticOperation} is an operation that does primitive value arithmetic without side
+ * effect.
+ */
+public interface ArithmeticOperation {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/BailoutException.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,76 @@
+/*
+ * 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.jvmci.code;
+
+import java.util.*;
+
+/**
+ * Exception 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 BailoutException extends RuntimeException {
+
+    public static final long serialVersionUID = 8974598793458772L;
+    private final boolean permanent;
+
+    /**
+     * Creates a new {@link BailoutException}.
+     *
+     *
+     * @param args parameters to the formatter
+     */
+    public BailoutException(String format, Object... args) {
+        super(String.format(Locale.ENGLISH, format, args));
+        this.permanent = true;
+    }
+
+    /**
+     * Creates a new {@link BailoutException}.
+     *
+     *
+     * @param args parameters to the formatter
+     */
+    public BailoutException(Throwable cause, String format, Object... args) {
+        super(String.format(Locale.ENGLISH, format, args), cause);
+        this.permanent = true;
+    }
+
+    /**
+     * Creates a new {@link BailoutException}.
+     *
+     * @param permanent specifies whether this exception will occur again if compilation is retried
+     * @param args parameters to the formatter
+     */
+    public BailoutException(boolean permanent, String format, Object... args) {
+        super(String.format(Locale.ENGLISH, format, args));
+        this.permanent = permanent;
+    }
+
+    /**
+     * @return whether this exception will occur again if compilation is retried
+     */
+    public boolean isPermanent() {
+        return permanent;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/BytecodeFrame.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,272 @@
+/*
+ * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.code;
+
+import com.oracle.jvmci.meta.Kind;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
+import com.oracle.jvmci.meta.Value;
+import java.util.*;
+
+/**
+ * Represents the Java bytecode frame state(s) at a given position including {@link Value locations}
+ * where to find the local variables, operand stack values and locked objects of the bytecode
+ * frame(s).
+ */
+public class BytecodeFrame extends BytecodePosition {
+
+    /**
+     * An array of values representing how to reconstruct the state of the Java frame. This is array
+     * is partitioned as follows:
+     * <p>
+     * <table summary="" 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 Value[] 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;
+
+    /**
+     * True if this is a position inside an exception handler before the exception object has been
+     * consumed. In this case, {@link #numStack} {@code == 1} and {@link #getStackValue(int)
+     * getStackValue(0)} is the location of the exception object. If deoptimization happens at this
+     * position, the interpreter will rethrow the exception instead of executing the bytecode
+     * instruction at this position.
+     */
+    public final boolean rethrowException;
+
+    public final boolean duringCall;
+
+    /**
+     * This BCI should be used for frame states that are built for code with no meaningful BCI.
+     */
+    public static final int UNKNOWN_BCI = -5;
+
+    /**
+     * The BCI for exception unwind. This is synthetic code and has no representation in bytecode.
+     * In contrast with {@link #AFTER_EXCEPTION_BCI}, at this point, if the method is synchronized,
+     * the monitor is still held.
+     */
+    public static final int UNWIND_BCI = -1;
+
+    /**
+     * The BCI for the state before starting to execute a method. Note that if the method is
+     * synchronized, the monitor is not yet held.
+     */
+    public static final int BEFORE_BCI = -2;
+
+    /**
+     * The BCI for the state after finishing the execution of a method and returning normally. Note
+     * that if the method was synchronized the monitor is already released.
+     */
+    public static final int AFTER_BCI = -3;
+
+    /**
+     * The BCI for exception unwind. This is synthetic code and has no representation in bytecode.
+     * In contrast with {@link #UNWIND_BCI}, at this point, if the method is synchronized, the
+     * monitor is already released.
+     */
+    public static final int AFTER_EXCEPTION_BCI = -4;
+
+    /**
+     * This BCI should be used for states that cannot be the target of a deoptimization, like
+     * snippet frame states.
+     */
+    public static final int INVALID_FRAMESTATE_BCI = -6;
+
+    /**
+     * Determines if a given BCI matches one of the placeholder BCI constants defined in this class.
+     */
+    public static boolean isPlaceholderBci(int bci) {
+        return bci < 0;
+    }
+
+    /**
+     * Gets the name of a given placeholder BCI.
+     */
+    public static String getPlaceholderBciName(int bci) {
+        assert isPlaceholderBci(bci);
+        if (bci == BytecodeFrame.AFTER_BCI) {
+            return "AFTER_BCI";
+        } else if (bci == BytecodeFrame.AFTER_EXCEPTION_BCI) {
+            return "AFTER_EXCEPTION_BCI";
+        } else if (bci == BytecodeFrame.INVALID_FRAMESTATE_BCI) {
+            return "INVALID_FRAMESTATE_BCI";
+        } else if (bci == BytecodeFrame.BEFORE_BCI) {
+            return "BEFORE_BCI";
+        } else if (bci == BytecodeFrame.UNKNOWN_BCI) {
+            return "UNKNOWN_BCI";
+        } else {
+            assert bci == BytecodeFrame.UNWIND_BCI;
+            return "UNWIND_BCI";
+        }
+    }
+
+    /**
+     * 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 BytecodeFrame(BytecodeFrame caller, ResolvedJavaMethod method, int bci, boolean rethrowException, boolean duringCall, Value[] values, int numLocals, int numStack, int numLocks) {
+        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;
+        assert !rethrowException || numStack == 1 : "must have exception on top of the stack";
+    }
+
+    /**
+     * Ensure that the frame state is formatted as expected by the JVM, with null or Illegal in the
+     * slot following a double word item. This should really be checked in FrameState itself but
+     * because of Word type rewriting and alternative backends that can't be done.
+     */
+    public boolean validateFormat(boolean derivedOk) {
+        if (caller() != null) {
+            caller().validateFormat(derivedOk);
+        }
+        for (int i = 0; i < numLocals + numStack; i++) {
+            if (values[i] != null) {
+                Kind kind = values[i].getKind();
+                if (kind.needsTwoSlots()) {
+                    assert values.length > i + 1 : String.format("missing second word %s", this);
+                    assert values[i + 1] == null || values[i + 1].getKind() == Kind.Illegal : this;
+                }
+                assert derivedOk || ValueUtil.isIllegal(values[i]) || !values[i].getLIRKind().isDerivedReference() : "Unexpected derived value: " + values[i];
+            }
+        }
+        return true;
+    }
+
+    /**
+     * 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 Value 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 Value 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 Value getLockValue(int i) {
+        return values[i + numLocals + numStack];
+    }
+
+    /**
+     * Gets the caller of this frame.
+     *
+     * @return {@code null} if this frame has no caller
+     */
+    public BytecodeFrame caller() {
+        return (BytecodeFrame) getCaller();
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj instanceof BytecodeFrame && super.equals(obj)) {
+            BytecodeFrame that = (BytecodeFrame) obj;
+            // @formatter:off
+            if (this.duringCall == that.duringCall &&
+                this.rethrowException == that.rethrowException &&
+                this.numLocals == that.numLocals &&
+                this.numLocks == that.numLocks &&
+                this.numStack == that.numStack &&
+                Arrays.equals(this.values, that.values)) {
+                return true;
+            }
+            // @formatter:off
+            return true;
+        }
+        return false;
+    }
+
+    @Override
+    public String toString() {
+        return CodeUtil.append(new StringBuilder(100), this).toString();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/BytecodePosition.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,119 @@
+/*
+ * 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.jvmci.code;
+
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
+import java.util.*;
+
+/**
+ * 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 BytecodeFrame frames} for deoptimization.
+ */
+public class BytecodePosition {
+
+    private final BytecodePosition caller;
+    private final ResolvedJavaMethod method;
+    private 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 BytecodePosition(BytecodePosition caller, ResolvedJavaMethod 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 CodeUtil.append(new StringBuilder(100), this).toString();
+    }
+
+    /**
+     * Deep equality test.
+     */
+    @Override
+    public boolean equals(Object obj) {
+        if (obj == this) {
+            return true;
+        }
+        if (obj != null && getClass() == obj.getClass()) {
+            BytecodePosition that = (BytecodePosition) obj;
+            if (this.bci == that.bci && Objects.equals(this.getMethod(), that.getMethod()) && Objects.equals(this.caller, that.caller)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    @Override
+    public int hashCode() {
+        return getBCI();
+    }
+
+    /**
+     * @return 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 int getBCI() {
+        return bci;
+    }
+
+    /**
+     * @return The runtime interface method for this position.
+     */
+    public ResolvedJavaMethod getMethod() {
+        return method;
+    }
+
+    /**
+     * The position where this position has been called, {@code null} if none.
+     */
+    public BytecodePosition getCaller() {
+        return caller;
+    }
+
+    /**
+     * Adds a caller to the current position returning the new position.
+     */
+    public BytecodePosition addCaller(BytecodePosition link) {
+        if (getCaller() == null) {
+            return new BytecodePosition(link, getMethod(), getBCI());
+        } else {
+            return new BytecodePosition(getCaller().addCaller(link), getMethod(), getBCI());
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/CalleeSaveLayout.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,181 @@
+/*
+ * 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.jvmci.code;
+
+import com.oracle.jvmci.meta.PlatformKind;
+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 CalleeSaveLayout {
+
+    /**
+     * The size (in bytes) of the CSA.
+     */
+    public final int size;
+
+    /**
+     * The size (in bytes) of an {@linkplain #registerAt(int) indexable} slot in the CSA.
+     */
+    public final int slotSize;
+
+    /**
+     * Map from {@linkplain Register#number register numbers} to slot indexes in the CSA.
+     */
+    private final int[] regNumToIndex;
+
+    private final Register[] indexToReg;
+
+    /**
+     * The list of registers {@linkplain #contains(int) contained} by this CSA.
+     */
+    public final Register[] 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 #registerAt(int) indexable} slot in the
+     *            CSA
+     * @param registers the registers that can be saved in the CSA
+     */
+    public CalleeSaveLayout(TargetDescription target, int frameOffsetToCSA, int size, int slotSize, Register... registers) {
+        this.frameOffsetToCSA = frameOffsetToCSA;
+        assert slotSize == 0 || CodeUtil.isPowerOf2(slotSize);
+        this.slotSize = slotSize;
+        int maxRegNum = -1;
+        int maxOffset = 0;
+        this.registers = registers;
+        int offset = 0;
+        for (Register reg : registers) {
+            assert offset % slotSize == 0;
+            assert reg.number >= 0;
+            if (reg.number > maxRegNum) {
+                maxRegNum = reg.number;
+            }
+            if (offset > maxOffset) {
+                maxOffset = offset;
+            }
+            PlatformKind kind = target.arch.getLargestStorableKind(reg.getRegisterCategory());
+            offset += target.getSizeInBytes(kind);
+        }
+        if (size == -1) {
+            this.size = offset;
+        } else {
+            assert offset <= size;
+            this.size = size;
+        }
+
+        this.regNumToIndex = new int[maxRegNum + 1];
+        this.indexToReg = offset == 0 ? new Register[0] : new Register[offset / slotSize];
+        Arrays.fill(regNumToIndex, -1);
+        offset = 0;
+        for (Register reg : registers) {
+            int index = offset / slotSize;
+            regNumToIndex[reg.number] = index;
+            indexToReg[index] = reg;
+            PlatformKind kind = target.arch.getLargestStorableKind(reg.getRegisterCategory());
+            offset += target.getSizeInBytes(kind);
+        }
+    }
+
+    /**
+     * 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(Register 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 Register registerAt(int index) {
+        if (index < 0 || index >= indexToReg.length) {
+            return null;
+        }
+        return indexToReg[index];
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder("[");
+        for (Register 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.jvmci.code/src/com/oracle/jvmci/code/CallingConvention.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,158 @@
+/*
+ * 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.jvmci.code;
+
+import com.oracle.jvmci.meta.Value;
+import com.oracle.jvmci.meta.AllocatableValue;
+import static com.oracle.jvmci.code.ValueUtil.*;
+
+/**
+ * A calling convention describes the locations in which the arguments for a call are placed and the
+ * location in which the return value is placed if the call is not void.
+ */
+public class CallingConvention {
+
+    /**
+     * Constants denoting the type of a call for which a calling convention is 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 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.
+     */
+    private final int stackSize;
+
+    private final AllocatableValue returnLocation;
+
+    /**
+     * The ordered locations in which the arguments are placed.
+     */
+    private final AllocatableValue[] argumentLocations;
+
+    /**
+     * Creates a description of the registers and stack locations used by a call.
+     *
+     * @param stackSize amount of stack space (in bytes) required for the stack-based arguments of
+     *            the call
+     * @param returnLocation the location for the return value or {@link Value#ILLEGAL} if a void
+     *            call
+     * @param argumentLocations the ordered locations in which the arguments are placed
+     */
+    public CallingConvention(int stackSize, AllocatableValue returnLocation, AllocatableValue... argumentLocations) {
+        assert argumentLocations != null;
+        assert returnLocation != null;
+        this.argumentLocations = argumentLocations;
+        this.stackSize = stackSize;
+        this.returnLocation = returnLocation;
+        assert verify();
+    }
+
+    /**
+     * Gets the location for the return value or {@link Value#ILLEGAL} if a void call.
+     */
+    public AllocatableValue getReturn() {
+        return returnLocation;
+    }
+
+    /**
+     * Gets the location for the {@code index}'th argument.
+     */
+    public AllocatableValue getArgument(int index) {
+        return argumentLocations[index];
+    }
+
+    /**
+     * Gets the amount of stack space (in bytes) required for the stack-based arguments of the call.
+     */
+    public int getStackSize() {
+        return stackSize;
+    }
+
+    /**
+     * Gets the number of locations required for the arguments.
+     */
+    public int getArgumentCount() {
+        return argumentLocations.length;
+    }
+
+    /**
+     * Gets the locations required for the arguments.
+     */
+    public AllocatableValue[] getArguments() {
+        if (argumentLocations.length == 0) {
+            return argumentLocations;
+        }
+        return argumentLocations.clone();
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        sb.append("CallingConvention[");
+        String sep = "";
+        for (Value op : argumentLocations) {
+            sb.append(sep).append(op);
+            sep = ", ";
+        }
+        if (!returnLocation.equals(Value.ILLEGAL)) {
+            sb.append(" -> ").append(returnLocation);
+        }
+        sb.append("]");
+        return sb.toString();
+    }
+
+    private boolean verify() {
+        for (int i = 0; i < argumentLocations.length; i++) {
+            Value location = argumentLocations[i];
+            assert isStackSlot(location) || isAllocatableValue(location);
+        }
+        return true;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/CodeCacheProvider.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,103 @@
+/*
+ * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.code;
+
+import com.oracle.jvmci.meta.Constant;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
+import com.oracle.jvmci.meta.JavaConstant;
+import com.oracle.jvmci.code.CompilationResult.DataPatch;
+import com.oracle.jvmci.code.DataSection.Data;
+
+/**
+ * Access to code cache related details and requirements.
+ */
+public interface CodeCacheProvider {
+
+    /**
+     * Adds the given compilation result 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 compResult the compilation result to be added
+     * @param speculationLog the speculation log to be used
+     * @return a reference to the compiled and ready-to-run code or throws a
+     *         {@link BailoutException} if the code installation failed
+     */
+    InstalledCode addMethod(ResolvedJavaMethod method, CompilationResult compResult, SpeculationLog speculationLog, InstalledCode predefinedInstalledCode);
+
+    /**
+     * Sets the given compilation result as the default implementation of the given method.
+     *
+     * @param method a method to which the executable code is begin added
+     * @param compResult the compilation result to be added
+     * @return a reference to the compiled and ready-to-run code or null if the code installation
+     *         failed
+     */
+    InstalledCode setDefaultMethod(ResolvedJavaMethod method, CompilationResult compResult);
+
+    /**
+     * Returns a disassembly of some compiled code.
+     *
+     * @param compResult some compiled code
+     * @param installedCode the result of installing the code in {@code compResult} or null if the
+     *            code has not yet been installed
+     *
+     * @return a disassembly. This will be of length 0 if the runtime does not support
+     *         disassembling.
+     */
+    String disassemble(CompilationResult compResult, InstalledCode installedCode);
+
+    /**
+     * Gets the register configuration to use when compiling a given method.
+     */
+    RegisterConfig getRegisterConfig();
+
+    /**
+     * 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();
+
+    /**
+     * Determines if a {@link DataPatch} should be created for a given primitive constant that is
+     * part of a {@link CompilationResult}. A data patch is always created for an object constant.
+     */
+    boolean needsDataPatch(JavaConstant constant);
+
+    /**
+     * Create a {@link Data} item for a {@link Constant}, that can be used in a {@link DataPatch}.
+     */
+    Data createDataItem(Constant constant);
+
+    /**
+     * Gets a description of the target architecture.
+     */
+    TargetDescription getTarget();
+
+    /**
+     * Create a new speculation log for the target runtime.
+     */
+    SpeculationLog createSpeculationLog();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/CodeUtil.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,481 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.code;
+
+import com.oracle.jvmci.meta.Signature;
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
+import com.oracle.jvmci.meta.JavaType;
+import com.oracle.jvmci.meta.MetaUtil;
+import java.util.*;
+
+/**
+ * Miscellaneous collection of utility methods used by {@code com.oracle.jvmci.code} and its
+ * clients.
+ */
+public class CodeUtil {
+
+    public static final String NEW_LINE = String.format("%n");
+
+    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;
+        return (Integer.SIZE - 1) - 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;
+        return (Long.SIZE - 1) - Long.numberOfLeadingZeros(val);
+    }
+
+    /**
+     * Narrow an integer value to a given bit width, and return the result as a signed long.
+     *
+     * @param value the value
+     * @param resultBits the result bit width
+     * @return {@code value} interpreted as {@code resultBits} bit number, encoded as signed long
+     */
+    public static long narrow(long value, int resultBits) {
+        long ret = value & mask(resultBits);
+        return signExtend(ret, resultBits);
+    }
+
+    /**
+     * Sign extend an integer.
+     *
+     * @param value the input value
+     * @param inputBits the bit width of the input value
+     * @return a signed long with the same value as the signed {@code inputBits}-bit number
+     *         {@code value}
+     */
+    public static long signExtend(long value, int inputBits) {
+        if (inputBits < 64) {
+            if ((value >>> (inputBits - 1) & 1) == 1) {
+                return value | (-1L << inputBits);
+            } else {
+                return value & ~(-1L << inputBits);
+            }
+        } else {
+            return value;
+        }
+    }
+
+    /**
+     * Zero extend an integer.
+     *
+     * @param value the input value
+     * @param inputBits the bit width of the input value
+     * @return an unsigned long with the same value as the unsigned {@code inputBits}-bit number
+     *         {@code value}
+     */
+    public static long zeroExtend(long value, int inputBits) {
+        if (inputBits < 64) {
+            return value & ~(-1L << inputBits);
+        } else {
+            return value;
+        }
+    }
+
+    /**
+     * Convert an integer to long.
+     *
+     * @param value the input value
+     * @param inputBits the bit width of the input value
+     * @param unsigned whether the values should be interpreted as signed or unsigned
+     * @return a long with the same value as the {@code inputBits}-bit number {@code value}
+     */
+    public static long convert(long value, int inputBits, boolean unsigned) {
+        if (unsigned) {
+            return zeroExtend(value, inputBits);
+        } else {
+            return signExtend(value, inputBits);
+        }
+    }
+
+    /**
+     * Get a bitmask with the low {@code bits} bit set and the high {@code 64 - bits} bit clear.
+     */
+    public static long mask(int bits) {
+        assert 0 <= bits && bits <= 64;
+        if (bits == 64) {
+            return 0xffffffffffffffffL;
+        } else {
+            return (1L << bits) - 1;
+        }
+    }
+
+    /**
+     * Get the minimum value representable in a {@code bits} bit signed integer.
+     */
+    public static long minValue(int bits) {
+        assert 0 < bits && bits <= 64;
+        return -1L << (bits - 1);
+    }
+
+    /**
+     * Get the maximum value representable in a {@code bits} bit signed integer.
+     */
+    public static long maxValue(int bits) {
+        assert 0 < bits && bits <= 64;
+        return mask(bits - 1);
+    }
+
+    /**
+     * 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(BytecodeFrame 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 CodeUtil.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();
+    }
+
+    /**
+     * 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, BytecodePosition pos) {
+        MetaUtil.appendLocation(sb.append("at "), pos.getMethod(), pos.getBCI());
+        if (pos.getCaller() != null) {
+            sb.append(NEW_LINE);
+            append(sb, pos.getCaller());
+        }
+        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, BytecodeFrame frame) {
+        MetaUtil.appendLocation(sb.append("at "), frame.getMethod(), frame.getBCI());
+        assert sb.charAt(sb.length() - 1) == ']';
+        sb.deleteCharAt(sb.length() - 1);
+        sb.append(", duringCall: ").append(frame.duringCall).append(", rethrow: ").append(frame.rethrowException).append(']');
+        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.getCaller() != null) {
+            sb.append(NEW_LINE);
+            append(sb, frame.getCaller());
+        }
+        return sb;
+    }
+
+    public interface RefMapFormatter {
+
+        String formatStackSlot(int frameRefMapIndex);
+
+        String formatRegister(int regRefMapIndex);
+    }
+
+    /**
+     * Formats a location in a register reference map.
+     */
+    public static class DefaultRegFormatter implements RefMapFormatter {
+
+        private final Register[] registers;
+
+        public DefaultRegFormatter(Architecture arch) {
+            registers = new Register[arch.getRegisterReferenceMapSize()];
+            for (Register r : arch.getRegisters()) {
+                if (r.getReferenceMapIndex() >= 0) {
+                    registers[r.getReferenceMapIndex()] = r;
+                }
+            }
+        }
+
+        public String formatStackSlot(int frameRefMapIndex) {
+            return null;
+        }
+
+        public String formatRegister(int regRefMapIndex) {
+            int i = regRefMapIndex;
+            int idx = 0;
+            while (registers[i] == null) {
+                i--;
+                idx++;
+            }
+            if (idx == 0) {
+                return registers[i].toString();
+            } else {
+                return String.format("%s+%d", registers[i].toString(), idx);
+            }
+        }
+    }
+
+    /**
+     * Formats a location present in a register or frame reference map.
+     */
+    public static class DefaultRefMapFormatter extends DefaultRegFormatter {
+
+        /**
+         * The size of a stack slot.
+         */
+        public final int slotSize;
+
+        /**
+         * The register used as the frame pointer.
+         */
+        public final Register fp;
+
+        /**
+         * 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 DefaultRefMapFormatter(Architecture arch, int slotSize, Register fp, int refMapToFPOffset) {
+            super(arch);
+            this.slotSize = slotSize;
+            this.fp = fp;
+            this.refMapToFPOffset = refMapToFPOffset;
+        }
+
+        @Override
+        public String formatStackSlot(int frameRefMapIndex) {
+            int refMapOffset = frameRefMapIndex * slotSize;
+            int fpOffset = refMapOffset + refMapToFPOffset;
+            if (fpOffset >= 0) {
+                return fp + "+" + fpOffset;
+            }
+            return fp.name + fpOffset;
+        }
+    }
+
+    public static class NumberedRefMapFormatter implements RefMapFormatter {
+
+        public String formatStackSlot(int frameRefMapIndex) {
+            return "s" + frameRefMapIndex;
+        }
+
+        public String formatRegister(int regRefMapIndex) {
+            return "r" + regRefMapIndex;
+        }
+    }
+
+    /**
+     * 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, DebugInfo info, RefMapFormatter formatterArg) {
+        RefMapFormatter formatter = formatterArg;
+        if (formatter == null) {
+            formatter = new NumberedRefMapFormatter();
+        }
+        String nl = NEW_LINE;
+        ReferenceMap refMap = info.getReferenceMap();
+        if (refMap != null && refMap.hasRegisterRefMap()) {
+            sb.append("  reg-ref-map:");
+            refMap.appendRegisterMap(sb, formatter);
+            sb.append(nl);
+        }
+        if (refMap != null && refMap.hasFrameRefMap()) {
+            sb.append("frame-ref-map:");
+            refMap.appendFrameMap(sb, formatter);
+            sb.append(nl);
+        }
+        RegisterSaveLayout calleeSaveInfo = info.getCalleeSaveInfo();
+        if (calleeSaveInfo != null) {
+            sb.append("callee-save-info:").append(nl);
+            Map<Integer, Register> map = calleeSaveInfo.slotsToRegisters(true);
+            for (Map.Entry<Integer, Register> e : map.entrySet()) {
+                sb.append("    ").append(e.getValue()).append(" -> ").append(formatter.formatStackSlot(e.getKey())).append(nl);
+            }
+        }
+        BytecodeFrame frame = info.frame();
+        if (frame != null) {
+            append(sb, frame);
+        } else if (info.getBytecodePosition() != null) {
+            append(sb, info.getBytecodePosition());
+        }
+        return sb;
+    }
+
+    /**
+     * Create a calling convention from a {@link ResolvedJavaMethod}.
+     */
+    public static CallingConvention getCallingConvention(CodeCacheProvider codeCache, CallingConvention.Type type, ResolvedJavaMethod method, boolean stackOnly) {
+        Signature sig = method.getSignature();
+        JavaType retType = sig.getReturnType(null);
+        int sigCount = sig.getParameterCount(false);
+        JavaType[] argTypes;
+        int argIndex = 0;
+        if (!method.isStatic()) {
+            argTypes = new JavaType[sigCount + 1];
+            argTypes[argIndex++] = method.getDeclaringClass();
+        } else {
+            argTypes = new JavaType[sigCount];
+        }
+        for (int i = 0; i < sigCount; i++) {
+            argTypes[argIndex++] = sig.getParameterType(i, null);
+        }
+
+        RegisterConfig registerConfig = codeCache.getRegisterConfig();
+        return registerConfig.getCallingConvention(type, retType, argTypes, codeCache.getTarget(), stackOnly);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/CompilationResult.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,949 @@
+/*
+ * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.code;
+
+import static com.oracle.jvmci.meta.MetaUtil.*;
+import static java.util.Collections.*;
+
+import java.util.*;
+
+import com.oracle.jvmci.code.CodeUtil.RefMapFormatter;
+import com.oracle.jvmci.meta.Assumptions.Assumption;
+import com.oracle.jvmci.meta.*;
+
+/**
+ * Represents the output from compiling a method, including the compiled machine code, associated
+ * data and references, relocation information, deoptimization information, etc.
+ */
+public class CompilationResult {
+
+    /**
+     * Represents a code position with associated additional information.
+     */
+    public abstract static class Site {
+
+        /**
+         * The position (or offset) of this site with respect to the start of the target method.
+         */
+        public final int pcOffset;
+
+        public Site(int pos) {
+            this.pcOffset = pos;
+        }
+
+        @Override
+        public final int hashCode() {
+            throw new UnsupportedOperationException("hashCode");
+        }
+
+        @Override
+        public String toString() {
+            return identityHashCodeString(this);
+        }
+
+        @Override
+        public abstract boolean equals(Object obj);
+    }
+
+    /**
+     * Represents an infopoint with associated debug info. Note that safepoints are also infopoints.
+     */
+    public static class Infopoint extends Site implements Comparable<Infopoint> {
+
+        public final DebugInfo debugInfo;
+
+        public final InfopointReason reason;
+
+        public Infopoint(int pcOffset, DebugInfo debugInfo, InfopointReason reason) {
+            super(pcOffset);
+            this.debugInfo = debugInfo;
+            this.reason = reason;
+        }
+
+        @Override
+        public String toString() {
+            StringBuilder sb = new StringBuilder();
+            sb.append(pcOffset);
+            sb.append("[<infopoint>]");
+            appendDebugInfo(sb, debugInfo);
+            return sb.toString();
+        }
+
+        @Override
+        public int compareTo(Infopoint o) {
+            if (pcOffset < o.pcOffset) {
+                return -1;
+            } else if (pcOffset > o.pcOffset) {
+                return 1;
+            }
+            return this.reason.compareTo(o.reason);
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            if (this == obj) {
+                return true;
+            }
+            if (obj != null && obj.getClass() == getClass()) {
+                Infopoint that = (Infopoint) obj;
+                if (this.pcOffset == that.pcOffset && Objects.equals(this.debugInfo, that.debugInfo) && Objects.equals(this.reason, that.reason)) {
+                    return true;
+                }
+            }
+            return false;
+        }
+    }
+
+    /**
+     * Represents a call in the code.
+     */
+    public static final class Call extends Infopoint {
+
+        /**
+         * The target of the call.
+         */
+        public final InvokeTarget target;
+
+        /**
+         * The size of the call instruction.
+         */
+        public final int size;
+
+        /**
+         * Specifies if this call is direct or indirect. A direct call has an immediate operand
+         * encoding the absolute or relative (to the call itself) address of the target. An indirect
+         * call has a register or memory operand specifying the target address of the call.
+         */
+        public final boolean direct;
+
+        public Call(InvokeTarget target, int pcOffset, int size, boolean direct, DebugInfo debugInfo) {
+            super(pcOffset, debugInfo, InfopointReason.CALL);
+            this.size = size;
+            this.target = target;
+            this.direct = direct;
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            if (this == obj) {
+                return true;
+            }
+            if (obj instanceof Call && super.equals(obj)) {
+                Call that = (Call) obj;
+                if (this.size == that.size && this.direct == that.direct && Objects.equals(this.target, that.target)) {
+                    return true;
+                }
+            }
+            return false;
+        }
+
+        @Override
+        public String toString() {
+            StringBuilder sb = new StringBuilder();
+            sb.append(pcOffset);
+            sb.append('[');
+            sb.append(target);
+            sb.append(']');
+
+            if (debugInfo != null) {
+                appendDebugInfo(sb, debugInfo);
+            }
+
+            return sb.toString();
+        }
+    }
+
+    /**
+     * Represents some external data that is referenced by the code.
+     */
+    public abstract static class Reference {
+
+        @Override
+        public abstract int hashCode();
+
+        @Override
+        public abstract boolean equals(Object obj);
+    }
+
+    public static final class ConstantReference extends Reference {
+
+        private final VMConstant constant;
+
+        public ConstantReference(VMConstant constant) {
+            this.constant = constant;
+        }
+
+        public VMConstant getConstant() {
+            return constant;
+        }
+
+        @Override
+        public String toString() {
+            return constant.toString();
+        }
+
+        @Override
+        public int hashCode() {
+            return constant.hashCode();
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            if (this == obj) {
+                return true;
+            }
+            if (obj instanceof ConstantReference) {
+                ConstantReference that = (ConstantReference) obj;
+                return Objects.equals(this.constant, that.constant);
+            }
+            return false;
+        }
+    }
+
+    public static final class DataSectionReference extends Reference {
+
+        private boolean initialized;
+        private int offset;
+
+        public DataSectionReference() {
+            // will be set after the data section layout is fixed
+            offset = 0xDEADDEAD;
+        }
+
+        public int getOffset() {
+            assert initialized;
+
+            return offset;
+        }
+
+        public void setOffset(int offset) {
+            assert !initialized;
+            initialized = true;
+
+            this.offset = offset;
+        }
+
+        @Override
+        public int hashCode() {
+            return offset;
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            if (this == obj) {
+                return true;
+            }
+            if (obj instanceof DataSectionReference) {
+                DataSectionReference that = (DataSectionReference) obj;
+                return this.offset == that.offset;
+            }
+            return false;
+        }
+    }
+
+    /**
+     * Represents a code site that references some data. The associated data can be either a
+     * {@link DataSectionReference reference} to the data section, or it may be an inlined
+     * {@link JavaConstant} that needs to be patched.
+     */
+    public static final class DataPatch extends Site {
+
+        public Reference reference;
+
+        public DataPatch(int pcOffset, Reference reference) {
+            super(pcOffset);
+            this.reference = reference;
+        }
+
+        @Override
+        public String toString() {
+            return String.format("%d[<data patch referring to %s>]", pcOffset, reference.toString());
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            if (this == obj) {
+                return true;
+            }
+            if (obj instanceof DataPatch) {
+                DataPatch that = (DataPatch) obj;
+                if (this.pcOffset == that.pcOffset && Objects.equals(this.reference, that.reference)) {
+                    return true;
+                }
+            }
+            return false;
+        }
+    }
+
+    /**
+     * Provides extra information about instructions or data at specific positions in
+     * {@link CompilationResult#getTargetCode()}. This is optional information that can be used to
+     * enhance a disassembly of the code.
+     */
+    public abstract static class CodeAnnotation {
+
+        public final int position;
+
+        public CodeAnnotation(int position) {
+            this.position = position;
+        }
+
+        @Override
+        public final int hashCode() {
+            throw new UnsupportedOperationException("hashCode");
+        }
+
+        @Override
+        public String toString() {
+            return identityHashCodeString(this);
+        }
+
+        @Override
+        public abstract boolean equals(Object obj);
+    }
+
+    /**
+     * A string comment about one or more instructions at a specific position in the code.
+     */
+    public static final class CodeComment extends CodeAnnotation {
+
+        public final String value;
+
+        public CodeComment(int position, String comment) {
+            super(position);
+            this.value = comment;
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            if (this == obj) {
+                return true;
+            }
+            if (obj instanceof CodeComment) {
+                CodeComment that = (CodeComment) obj;
+                if (this.position == that.position && this.value.equals(that.value)) {
+                    return true;
+                }
+            }
+            return false;
+        }
+
+        @Override
+        public String toString() {
+            return getClass().getSimpleName() + "@" + position + ": " + value;
+        }
+    }
+
+    /**
+     * Describes a table of signed offsets embedded in the code. The offsets are relative to the
+     * starting address of the table. This type of table maybe generated when translating a
+     * multi-way branch based on a key value from a dense value set (e.g. the {@code tableswitch}
+     * JVM instruction).
+     *
+     * The table is indexed by the contiguous range of integers from {@link #low} to {@link #high}
+     * inclusive.
+     */
+    public static final class JumpTable extends CodeAnnotation {
+
+        /**
+         * The low value in the key range (inclusive).
+         */
+        public final int low;
+
+        /**
+         * The high value in the key range (inclusive).
+         */
+        public final int high;
+
+        /**
+         * The size (in bytes) of each table entry.
+         */
+        public final int entrySize;
+
+        public JumpTable(int position, int low, int high, int entrySize) {
+            super(position);
+            this.low = low;
+            this.high = high;
+            this.entrySize = entrySize;
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            if (this == obj) {
+                return true;
+            }
+            if (obj instanceof JumpTable) {
+                JumpTable that = (JumpTable) obj;
+                if (this.position == that.position && this.entrySize == that.entrySize && this.low == that.low && this.high == that.high) {
+                    return true;
+                }
+            }
+            return false;
+        }
+
+        @Override
+        public String toString() {
+            return getClass().getSimpleName() + "@" + position + ": [" + low + " .. " + high + "]";
+        }
+    }
+
+    /**
+     * Represents exception handler information for a specific code position. It includes the catch
+     * code position as well as the caught exception type.
+     */
+    public static final class ExceptionHandler extends Site {
+
+        public final int handlerPos;
+
+        ExceptionHandler(int pcOffset, int handlerPos) {
+            super(pcOffset);
+            this.handlerPos = handlerPos;
+        }
+
+        @Override
+        public String toString() {
+            return String.format("%d[<exception edge to %d>]", pcOffset, handlerPos);
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            if (this == obj) {
+                return true;
+            }
+            if (obj instanceof ExceptionHandler) {
+                ExceptionHandler that = (ExceptionHandler) obj;
+                if (this.pcOffset == that.pcOffset && this.handlerPos == that.handlerPos) {
+                    return true;
+                }
+            }
+            return false;
+        }
+    }
+
+    /**
+     * Represents a mark in the machine code that can be used by the runtime for its own purposes. A
+     * mark can reference other marks.
+     */
+    public static final class Mark extends Site {
+
+        public final Object id;
+
+        public Mark(int pcOffset, Object id) {
+            super(pcOffset);
+            this.id = id;
+        }
+
+        @Override
+        public String toString() {
+            if (id == null) {
+                return String.format("%d[<mar>]", pcOffset);
+            } else if (id instanceof Integer) {
+                return String.format("%d[<mark with id %s>]", pcOffset, Integer.toHexString((Integer) id));
+            } else {
+                return String.format("%d[<mark with id %s>]", pcOffset, id.toString());
+            }
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            if (this == obj) {
+                return true;
+            }
+            if (obj instanceof Mark) {
+                Mark that = (Mark) obj;
+                if (this.pcOffset == that.pcOffset && Objects.equals(this.id, that.id)) {
+                    return true;
+                }
+            }
+            return false;
+        }
+    }
+
+    private int id = -1;
+    private int entryBCI = -1;
+
+    private final DataSection dataSection = new DataSection();
+
+    private final List<Infopoint> infopoints = new ArrayList<>();
+    private final List<DataPatch> dataPatches = new ArrayList<>();
+    private final List<ExceptionHandler> exceptionHandlers = new ArrayList<>();
+    private final List<Mark> marks = new ArrayList<>();
+
+    private int totalFrameSize = -1;
+    private int customStackAreaOffset = -1;
+
+    private final String name;
+
+    /**
+     * The buffer containing the emitted machine code.
+     */
+    private byte[] targetCode;
+
+    /**
+     * The leading number of bytes in {@link #targetCode} containing the emitted machine code.
+     */
+    private int targetCodeSize;
+
+    private ArrayList<CodeAnnotation> annotations;
+
+    private Assumption[] assumptions;
+
+    /**
+     * The list of the methods whose bytecodes were used as input to the compilation. If
+     * {@code null}, then the compilation did not record method dependencies. Otherwise, the first
+     * element of this array is the root method of the compilation.
+     */
+    private ResolvedJavaMethod[] methods;
+
+    public CompilationResult() {
+        this(null);
+    }
+
+    public CompilationResult(String name) {
+        this.name = name;
+    }
+
+    @Override
+    public int hashCode() {
+        // CompilationResult instances should not be used as hash map keys
+        throw new UnsupportedOperationException("hashCode");
+    }
+
+    @Override
+    public String toString() {
+        if (methods != null) {
+            return getClass().getName() + "[" + methods[0].format("%H.%n(%p)%r") + "]";
+        }
+        return identityHashCodeString(this);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj != null && obj.getClass() == getClass()) {
+            CompilationResult that = (CompilationResult) obj;
+            // @formatter:off
+            if (this.entryBCI == that.entryBCI &&
+                this.id == that.id &&
+                this.customStackAreaOffset == that.customStackAreaOffset &&
+                this.totalFrameSize == that.totalFrameSize &&
+                this.targetCodeSize == that.targetCodeSize &&
+                Objects.equals(this.name, that.name) &&
+                Objects.equals(this.annotations, that.annotations) &&
+                Objects.equals(this.dataSection, that.dataSection) &&
+                Objects.equals(this.exceptionHandlers, that.exceptionHandlers) &&
+                Objects.equals(this.dataPatches, that.dataPatches) &&
+                Objects.equals(this.infopoints, that.infopoints) &&
+                Objects.equals(this.marks,  that.marks) &&
+                Arrays.equals(this.assumptions, that.assumptions) &&
+                Arrays.equals(targetCode, that.targetCode)) {
+                return true;
+            }
+            // @formatter:on
+        }
+        return false;
+    }
+
+    /**
+     * @return the compile id
+     */
+    public int getId() {
+        return id;
+    }
+
+    /**
+     * @param id the compile id to set
+     */
+    public void setId(int id) {
+        this.id = id;
+    }
+
+    /**
+     * @return the entryBCI
+     */
+    public int getEntryBCI() {
+        return entryBCI;
+    }
+
+    /**
+     * @param entryBCI the entryBCI to set
+     */
+    public void setEntryBCI(int entryBCI) {
+        this.entryBCI = entryBCI;
+    }
+
+    /**
+     * Sets the assumptions made during compilation.
+     */
+    public void setAssumptions(Assumption[] assumptions) {
+        this.assumptions = assumptions;
+    }
+
+    /**
+     * Gets the assumptions made during compilation.
+     */
+    public Assumption[] getAssumptions() {
+        return assumptions;
+    }
+
+    /**
+     * Sets the methods whose bytecodes were used as input to the compilation.
+     *
+     * @param rootMethod the root method of the compilation
+     * @param inlinedMethods the methods inlined during compilation
+     */
+    public void setMethods(ResolvedJavaMethod rootMethod, Collection<ResolvedJavaMethod> inlinedMethods) {
+        assert rootMethod != null;
+        assert inlinedMethods != null;
+        if (inlinedMethods.contains(rootMethod)) {
+            methods = inlinedMethods.toArray(new ResolvedJavaMethod[inlinedMethods.size()]);
+            for (int i = 0; i < methods.length; i++) {
+                if (methods[i].equals(rootMethod)) {
+                    if (i != 0) {
+                        ResolvedJavaMethod tmp = methods[0];
+                        methods[0] = methods[i];
+                        methods[i] = tmp;
+                    }
+                    break;
+                }
+            }
+        } else {
+            methods = new ResolvedJavaMethod[1 + inlinedMethods.size()];
+            methods[0] = rootMethod;
+            int i = 1;
+            for (ResolvedJavaMethod m : inlinedMethods) {
+                methods[i++] = m;
+            }
+        }
+    }
+
+    /**
+     * Gets the methods whose bytecodes were used as input to the compilation.
+     *
+     * @return {@code null} if the compilation did not record method dependencies otherwise the
+     *         methods whose bytecodes were used as input to the compilation with the first element
+     *         being the root method of the compilation
+     */
+    public ResolvedJavaMethod[] getMethods() {
+        return methods;
+    }
+
+    public DataSection getDataSection() {
+        return dataSection;
+    }
+
+    /**
+     * The total frame size of the method in bytes. This includes the return address pushed onto the
+     * stack, if any.
+     *
+     * @return the frame size
+     */
+    public int getTotalFrameSize() {
+        assert totalFrameSize != -1 : "frame size not yet initialized!";
+        return totalFrameSize;
+    }
+
+    /**
+     * Sets the total frame size in bytes. This includes the return address pushed onto the stack,
+     * if any.
+     *
+     * @param size the size of the frame in bytes
+     */
+    public void setTotalFrameSize(int size) {
+        totalFrameSize = size;
+    }
+
+    /**
+     * Sets the machine that has been generated by the compiler.
+     *
+     * @param code the machine code generated
+     * @param size the size of the machine code
+     */
+    public void setTargetCode(byte[] code, int size) {
+        targetCode = code;
+        targetCodeSize = size;
+    }
+
+    /**
+     * Records a data patch in the code section. The data patch can refer to something in the
+     * {@link DataSectionReference data section} or directly to an {@link ConstantReference inlined
+     * constant}.
+     *
+     * @param codePos The position in the code that needs to be patched.
+     * @param ref The reference that should be inserted in the code.
+     */
+    public void recordDataPatch(int codePos, Reference ref) {
+        assert codePos >= 0 && ref != null;
+        dataPatches.add(new DataPatch(codePos, ref));
+    }
+
+    /**
+     * Records a call in the code array.
+     *
+     * @param codePos the position of the call in the code array
+     * @param size the size of the call instruction
+     * @param target the being called
+     * @param debugInfo the debug info for the call
+     * @param direct specifies if this is a {@linkplain Call#direct direct} call
+     */
+    public void recordCall(int codePos, int size, InvokeTarget target, DebugInfo debugInfo, boolean direct) {
+        final Call call = new Call(target, codePos, size, direct, debugInfo);
+        addInfopoint(call);
+    }
+
+    /**
+     * Records an exception handler for this method.
+     *
+     * @param codePos the position in the code that is covered by the handler
+     * @param handlerPos the position of the handler
+     */
+    public void recordExceptionHandler(int codePos, int handlerPos) {
+        assert validateExceptionHandlerAdd(codePos, handlerPos) : String.format("Duplicate exception handler for pc 0x%x handlerPos 0x%x", codePos, handlerPos);
+        exceptionHandlers.add(new ExceptionHandler(codePos, handlerPos));
+    }
+
+    /**
+     * Validate if the exception handler for codePos already exists and handlerPos is different.
+     *
+     * @param codePos
+     * @param handlerPos
+     * @return true if the validation is successful
+     */
+    private boolean validateExceptionHandlerAdd(int codePos, int handlerPos) {
+        ExceptionHandler exHandler = getExceptionHandlerForCodePos(codePos);
+        return exHandler == null || exHandler.handlerPos == handlerPos;
+    }
+
+    /**
+     * Returns the first ExceptionHandler which matches codePos.
+     *
+     * @param codePos position to search for
+     * @return first matching ExceptionHandler
+     */
+    private ExceptionHandler getExceptionHandlerForCodePos(int codePos) {
+        for (ExceptionHandler h : exceptionHandlers) {
+            if (h.pcOffset == codePos) {
+                return h;
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Records an infopoint in the code array.
+     *
+     * @param codePos the position of the infopoint in the code array
+     * @param debugInfo the debug info for the infopoint
+     */
+    public void recordInfopoint(int codePos, DebugInfo debugInfo, InfopointReason reason) {
+        addInfopoint(new Infopoint(codePos, debugInfo, reason));
+    }
+
+    /**
+     * Records a custom infopoint in the code section.
+     *
+     * Compiler implementations can use this method to record non-standard infopoints, which are not
+     * handled by the dedicated methods like {@link #recordCall}.
+     *
+     * @param infopoint the infopoint to record, usually a derived class from {@link Infopoint}
+     */
+    public void addInfopoint(Infopoint infopoint) {
+        // The infopoints list must always be sorted
+        if (!infopoints.isEmpty()) {
+            Infopoint previousInfopoint = infopoints.get(infopoints.size() - 1);
+            if (previousInfopoint.pcOffset > infopoint.pcOffset) {
+                // This re-sorting should be very rare
+                Collections.sort(infopoints);
+                previousInfopoint = infopoints.get(infopoints.size() - 1);
+            }
+            if (previousInfopoint.pcOffset == infopoint.pcOffset) {
+                if (infopoint.reason.canBeOmitted()) {
+                    return;
+                }
+                if (previousInfopoint.reason.canBeOmitted()) {
+                    Infopoint removed = infopoints.remove(infopoints.size() - 1);
+                    assert removed == previousInfopoint;
+                } else {
+                    throw new RuntimeException("Infopoints that can not be omited should have distinct PCs");
+                }
+            }
+        }
+        infopoints.add(infopoint);
+    }
+
+    /**
+     * Records an instruction mark within this method.
+     *
+     * @param codePos the position in the code that is covered by the handler
+     * @param markId the identifier for this mark
+     */
+    public Mark recordMark(int codePos, Object markId) {
+        Mark mark = new Mark(codePos, markId);
+        marks.add(mark);
+        return mark;
+    }
+
+    /**
+     * Offset in bytes for the custom stack area (relative to sp).
+     *
+     * @return the offset in bytes
+     */
+    public int getCustomStackAreaOffset() {
+        return customStackAreaOffset;
+    }
+
+    /**
+     * @see #getCustomStackAreaOffset()
+     * @param offset
+     */
+    public void setCustomStackAreaOffset(int offset) {
+        customStackAreaOffset = offset;
+    }
+
+    /**
+     * @return the machine code generated for this method
+     */
+    public byte[] getTargetCode() {
+        return targetCode;
+    }
+
+    /**
+     * @return the size of the machine code generated for this method
+     */
+    public int getTargetCodeSize() {
+        return targetCodeSize;
+    }
+
+    /**
+     * @return the code annotations or {@code null} if there are none
+     */
+    public List<CodeAnnotation> getAnnotations() {
+        if (annotations == null) {
+            return Collections.emptyList();
+        }
+        return annotations;
+    }
+
+    public void addAnnotation(CodeAnnotation annotation) {
+        assert annotation != null;
+        if (annotations == null) {
+            annotations = new ArrayList<>();
+        }
+        annotations.add(annotation);
+    }
+
+    private static void appendDebugInfo(StringBuilder sb, DebugInfo info) {
+        if (info != null) {
+            ReferenceMap refMap = info.getReferenceMap();
+            if (refMap != null) {
+                RefMapFormatter formatter = new CodeUtil.NumberedRefMapFormatter();
+                if (refMap.hasFrameRefMap()) {
+                    sb.append(" stackMap[");
+                    refMap.appendFrameMap(sb, formatter);
+                    sb.append(']');
+                }
+                if (refMap.hasRegisterRefMap()) {
+                    sb.append(" registerMap[");
+                    refMap.appendRegisterMap(sb, formatter);
+                    sb.append(']');
+                }
+            }
+            RegisterSaveLayout calleeSaveInfo = info.getCalleeSaveInfo();
+            if (calleeSaveInfo != null) {
+                sb.append(" callee-save-info[");
+                String sep = "";
+                for (Map.Entry<Register, Integer> e : calleeSaveInfo.registersToSlots(true).entrySet()) {
+                    sb.append(sep).append(e.getKey()).append("->").append(e.getValue());
+                    sep = ", ";
+                }
+                sb.append(']');
+            }
+            BytecodePosition codePos = info.getBytecodePosition();
+            if (codePos != null) {
+                MetaUtil.appendLocation(sb.append(" "), codePos.getMethod(), codePos.getBCI());
+                if (info.hasFrame()) {
+                    sb.append(" #locals=").append(info.frame().numLocals).append(" #expr=").append(info.frame().numStack);
+                    if (info.frame().numLocks > 0) {
+                        sb.append(" #locks=").append(info.frame().numLocks);
+                    }
+                }
+            }
+        }
+    }
+
+    /**
+     * @return the list of infopoints, sorted by {@link Site#pcOffset}
+     */
+    public List<Infopoint> getInfopoints() {
+        if (infopoints.isEmpty()) {
+            return emptyList();
+        }
+        return unmodifiableList(infopoints);
+    }
+
+    /**
+     * @return the list of data references
+     */
+    public List<DataPatch> getDataPatches() {
+        if (dataPatches.isEmpty()) {
+            return emptyList();
+        }
+        return unmodifiableList(dataPatches);
+    }
+
+    /**
+     * @return the list of exception handlers
+     */
+    public List<ExceptionHandler> getExceptionHandlers() {
+        if (exceptionHandlers.isEmpty()) {
+            return emptyList();
+        }
+        return unmodifiableList(exceptionHandlers);
+    }
+
+    /**
+     * @return the list of marks
+     */
+    public List<Mark> getMarks() {
+        if (marks.isEmpty()) {
+            return emptyList();
+        }
+        return unmodifiableList(marks);
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void reset() {
+        infopoints.clear();
+        dataPatches.clear();
+        exceptionHandlers.clear();
+        marks.clear();
+        if (annotations != null) {
+            annotations.clear();
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/DataSection.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,278 @@
+/*
+ * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.code;
+
+import com.oracle.jvmci.meta.SerializableConstant;
+import static com.oracle.jvmci.meta.MetaUtil.*;
+
+import java.nio.*;
+import java.util.*;
+import java.util.function.*;
+
+import com.oracle.jvmci.code.CompilationResult.DataPatch;
+import com.oracle.jvmci.code.CompilationResult.DataSectionReference;
+import com.oracle.jvmci.code.DataSection.Data;
+
+public final class DataSection implements Iterable<Data> {
+
+    @FunctionalInterface
+    public interface DataBuilder {
+
+        void emit(ByteBuffer buffer, Consumer<DataPatch> patch);
+
+        static DataBuilder raw(byte[] data) {
+            return (buffer, patch) -> buffer.put(data);
+        }
+
+        static DataBuilder serializable(SerializableConstant c) {
+            return (buffer, patch) -> c.serialize(buffer);
+        }
+
+        static DataBuilder zero(int size) {
+            switch (size) {
+                case 1:
+                    return (buffer, patch) -> buffer.put((byte) 0);
+                case 2:
+                    return (buffer, patch) -> buffer.putShort((short) 0);
+                case 4:
+                    return (buffer, patch) -> buffer.putInt(0);
+                case 8:
+                    return (buffer, patch) -> buffer.putLong(0L);
+                default:
+                    return (buffer, patch) -> {
+                        int rest = size;
+                        while (rest > 8) {
+                            buffer.putLong(0L);
+                            rest -= 8;
+                        }
+                        while (rest > 0) {
+                            buffer.put((byte) 0);
+                            rest--;
+                        }
+                    };
+            }
+        }
+    }
+
+    public static final class Data {
+
+        private int alignment;
+        private final int size;
+        private final DataBuilder builder;
+
+        private DataSectionReference ref;
+
+        public Data(int alignment, int size, DataBuilder builder) {
+            this.alignment = alignment;
+            this.size = size;
+            this.builder = builder;
+
+            // initialized in DataSection.insertData(Data)
+            ref = null;
+        }
+
+        public void updateAlignment(int newAlignment) {
+            if (newAlignment == alignment) {
+                return;
+            }
+            alignment = lcm(alignment, newAlignment);
+        }
+
+        public int getAlignment() {
+            return alignment;
+        }
+
+        public int getSize() {
+            return size;
+        }
+
+        public DataBuilder getBuilder() {
+            return builder;
+        }
+
+        @Override
+        public int hashCode() {
+            // Data instances should not be used as hash map keys
+            throw new UnsupportedOperationException("hashCode");
+        }
+
+        @Override
+        public String toString() {
+            return identityHashCodeString(this);
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            assert ref != null;
+            if (obj == this) {
+                return true;
+            }
+            if (obj instanceof Data) {
+                Data that = (Data) obj;
+                if (this.alignment == that.alignment && this.size == that.size && this.ref.equals(that.ref)) {
+                    return true;
+                }
+            }
+            return false;
+        }
+    }
+
+    private final ArrayList<Data> dataItems = new ArrayList<>();
+
+    private boolean finalLayout;
+    private int sectionAlignment;
+    private int sectionSize;
+
+    @Override
+    public int hashCode() {
+        // DataSection instances should not be used as hash map keys
+        throw new UnsupportedOperationException("hashCode");
+    }
+
+    @Override
+    public String toString() {
+        return identityHashCodeString(this);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj instanceof DataSection) {
+            DataSection that = (DataSection) obj;
+            if (this.finalLayout == that.finalLayout && this.sectionAlignment == that.sectionAlignment && this.sectionSize == that.sectionSize && Objects.equals(this.dataItems, that.dataItems)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * Insert a {@link Data} item into the data section. If the item is already in the data section,
+     * the same {@link DataSectionReference} is returned.
+     *
+     * @param data the {@link Data} item to be inserted
+     * @return a unique {@link DataSectionReference} identifying the {@link Data} item
+     */
+    public DataSectionReference insertData(Data data) {
+        assert !finalLayout;
+        if (data.ref == null) {
+            data.ref = new DataSectionReference();
+            dataItems.add(data);
+        }
+        return data.ref;
+    }
+
+    /**
+     * Compute the layout of the data section. This can be called only once, and after it has been
+     * called, the data section can no longer be modified.
+     */
+    public void finalizeLayout() {
+        assert !finalLayout;
+        finalLayout = true;
+
+        // simple heuristic: put items with larger alignment requirement first
+        dataItems.sort((a, b) -> a.alignment - b.alignment);
+
+        int position = 0;
+        for (Data d : dataItems) {
+            sectionAlignment = lcm(sectionAlignment, d.alignment);
+            position = align(position, d.alignment);
+
+            d.ref.setOffset(position);
+            position += d.size;
+        }
+
+        sectionSize = position;
+    }
+
+    /**
+     * Get the size of the data section. Can only be called after {@link #finalizeLayout}.
+     */
+    public int getSectionSize() {
+        assert finalLayout;
+        return sectionSize;
+    }
+
+    /**
+     * Get the minimum alignment requirement of the data section. Can only be called after
+     * {@link #finalizeLayout}.
+     */
+    public int getSectionAlignment() {
+        assert finalLayout;
+        return sectionAlignment;
+    }
+
+    /**
+     * Build the data section. Can only be called after {@link #finalizeLayout}.
+     *
+     * @param buffer The {@link ByteBuffer} where the data section should be built. The buffer must
+     *            hold at least {@link #getSectionSize()} bytes.
+     * @param patch A {@link Consumer} to receive {@link DataPatch data patches} for relocations in
+     *            the data section.
+     */
+    public void buildDataSection(ByteBuffer buffer, Consumer<DataPatch> patch) {
+        assert finalLayout;
+        for (Data d : dataItems) {
+            buffer.position(d.ref.getOffset());
+            d.builder.emit(buffer, patch);
+        }
+    }
+
+    public Data findData(DataSectionReference ref) {
+        for (Data d : dataItems) {
+            if (d.ref == ref) {
+                return d;
+            }
+        }
+        return null;
+    }
+
+    public Iterator<Data> iterator() {
+        return dataItems.iterator();
+    }
+
+    private static int lcm(int x, int y) {
+        if (x == 0) {
+            return y;
+        } else if (y == 0) {
+            return x;
+        }
+
+        int a = Math.max(x, y);
+        int b = Math.min(x, y);
+        while (b > 0) {
+            int tmp = a % b;
+            a = b;
+            b = tmp;
+        }
+
+        int gcd = a;
+        return x * y / gcd;
+    }
+
+    private static int align(int position, int alignment) {
+        return ((position + alignment - 1) / alignment) * alignment;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/DebugInfo.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,136 @@
+/*
+ * 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.jvmci.code;
+
+import com.oracle.jvmci.meta.Value;
+import java.util.*;
+
+/**
+ * Represents the debugging information for a particular point of execution. This information
+ * includes:
+ * <ul>
+ * <li>a {@linkplain #getBytecodePosition() bytecode position}</li>
+ * <li>a reference map for registers and stack slots in the current frame</li>
+ * <li>a map from bytecode locals and operand stack slots to their values or locations from which
+ * their values can be read</li>
+ * <li>a map from the registers (in the caller's frame) to the slots where they are saved in the
+ * current frame</li>
+ * </ul>
+ */
+public final class DebugInfo {
+
+    private final BytecodePosition bytecodePosition;
+    private final ReferenceMap referenceMap;
+    @SuppressWarnings("unused") private final Value[] virtualObjectMapping;
+    private RegisterSaveLayout calleeSaveInfo;
+
+    /**
+     * Creates a new {@link DebugInfo} from the given values.
+     *
+     * @param codePos the {@linkplain BytecodePosition code position} or {@linkplain BytecodeFrame
+     *            frame} info
+     * @param referenceMap the reference map
+     * @param virtualObjectMapping the mapping of {@link VirtualObject}s to their real values
+     */
+    public DebugInfo(BytecodePosition codePos, ReferenceMap referenceMap, Value[] virtualObjectMapping) {
+        this.bytecodePosition = codePos;
+        this.referenceMap = referenceMap;
+        this.virtualObjectMapping = virtualObjectMapping;
+    }
+
+    public DebugInfo(BytecodePosition codePos) {
+        this(codePos, null, null);
+    }
+
+    /**
+     * @return {@code true} if this debug information has a frame
+     */
+    public boolean hasFrame() {
+        return getBytecodePosition() instanceof BytecodeFrame;
+    }
+
+    /**
+     * Gets the deoptimization information for each inlined frame (if available).
+     *
+     * @return {@code null} if no frame de-opt info is {@linkplain #hasFrame() available}
+     */
+    public BytecodeFrame frame() {
+        if (hasFrame()) {
+            return (BytecodeFrame) getBytecodePosition();
+        }
+        return null;
+    }
+
+    @Override
+    public String toString() {
+        return CodeUtil.append(new StringBuilder(100), this, null).toString();
+    }
+
+    /**
+     * @return The code position (including all inlined methods) of this debug info. If this is a
+     *         {@link BytecodeFrame} instance, then it is also the deoptimization information for
+     *         each inlined frame.
+     */
+    public BytecodePosition getBytecodePosition() {
+        return bytecodePosition;
+    }
+
+    public ReferenceMap getReferenceMap() {
+        return referenceMap;
+    }
+
+    /**
+     * Sets the map from the registers (in the caller's frame) to the slots where they are saved in
+     * the current frame.
+     */
+    public void setCalleeSaveInfo(RegisterSaveLayout calleeSaveInfo) {
+        this.calleeSaveInfo = calleeSaveInfo;
+    }
+
+    /**
+     * Gets the map from the registers (in the caller's frame) to the slots where they are saved in
+     * the current frame. If no such information is available, {@code null} is returned.
+     */
+    public RegisterSaveLayout getCalleeSaveInfo() {
+        return calleeSaveInfo;
+    }
+
+    @Override
+    public int hashCode() {
+        throw new UnsupportedOperationException("hashCode");
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj instanceof DebugInfo) {
+            DebugInfo that = (DebugInfo) obj;
+            if (Objects.equals(this.bytecodePosition, that.bytecodePosition) && Objects.equals(this.calleeSaveInfo, that.calleeSaveInfo) && Objects.equals(this.referenceMap, that.referenceMap)) {
+                return true;
+            }
+        }
+        return false;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/DisassemblerProvider.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.code;
+
+/**
+ * Interface providing capability for disassembling machine code.
+ */
+public interface DisassemblerProvider {
+
+    /**
+     * Gets a textual disassembly of some given installed code.
+     *
+     * @return a non-zero length string containing a disassembly of {@code code} or null if
+     *         {@code code} is {@link InstalledCode#isValid() invalid} or it could not be
+     *         disassembled for some other reason
+     */
+    String disassemble(InstalledCode code);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/ForeignCallLinkage.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,74 @@
+/*
+ * 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.jvmci.code;
+
+import com.oracle.jvmci.meta.InvokeTarget;
+import com.oracle.jvmci.meta.Value;
+import com.oracle.jvmci.meta.ForeignCallDescriptor;
+
+/**
+ * The runtime specific details of a {@linkplain ForeignCallDescriptor foreign} call.
+ */
+public interface ForeignCallLinkage extends InvokeTarget {
+
+    /**
+     * Gets the details of where parameters are passed and value(s) are returned from the caller's
+     * perspective.
+     */
+    CallingConvention getOutgoingCallingConvention();
+
+    /**
+     * Gets the details of where parameters are passed and value(s) are returned from the callee's
+     * perspective.
+     */
+    CallingConvention getIncomingCallingConvention();
+
+    /**
+     * Returns the maximum absolute offset of PC relative call to this stub from any position in the
+     * code cache or -1 when not applicable. Intended for determining the required size of
+     * address/offset fields.
+     */
+    long getMaxCallTargetOffset();
+
+    ForeignCallDescriptor getDescriptor();
+
+    /**
+     * Gets the values used/killed by this foreign call.
+     */
+    Value[] getTemporaries();
+
+    /**
+     * Determines if the foreign call target destroys all registers.
+     *
+     * @return {@code true} if the register allocator must save all live registers around a call to
+     *         this target
+     */
+    boolean destroysRegisters();
+
+    /**
+     * Determines if this is call to a function that does not deoptimize, and therefore also does
+     * not lock, GC or throw exceptions. That is, the thread's execution state during the call is
+     * never inspected by another thread.
+     */
+    boolean canDeoptimize();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/ForeignCallsProvider.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.code;
+
+import com.oracle.jvmci.meta.LocationIdentity;
+import com.oracle.jvmci.meta.ForeignCallDescriptor;
+
+/**
+ * Details about a set of supported {@link ForeignCallDescriptor foreign calls}.
+ */
+public interface ForeignCallsProvider {
+
+    /**
+     * Determines if a given foreign call is side-effect free. Deoptimization cannot return
+     * execution to a point before a foreign call that has a side effect.
+     */
+    boolean isReexecutable(ForeignCallDescriptor descriptor);
+
+    /**
+     * Gets the set of memory locations killed by a given foreign call. Returning the special value
+     * {@link LocationIdentity#any()} denotes that the call kills all memory locations. Returning
+     * any empty array denotes that the call does not kill any memory locations.
+     */
+    LocationIdentity[] getKilledLocations(ForeignCallDescriptor descriptor);
+
+    /**
+     * Determines if deoptimization can occur during a given foreign call.
+     */
+    boolean canDeoptimize(ForeignCallDescriptor descriptor);
+
+    /**
+     * Gets the linkage for a foreign call.
+     */
+    ForeignCallLinkage lookupForeignCall(ForeignCallDescriptor descriptor);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/InfopointReason.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.code;
+
+/**
+ * A reason for infopoint insertion.
+ */
+public enum InfopointReason {
+    UNKNOWN(false),
+    SAFEPOINT(false),
+    CALL(false),
+    IMPLICIT_EXCEPTION(false),
+    METHOD_START(true),
+    METHOD_END(true),
+    LINE_NUMBER(true);
+
+    private InfopointReason(boolean canBeOmitted) {
+        this.canBeOmitted = canBeOmitted;
+    }
+
+    private final boolean canBeOmitted;
+
+    public boolean canBeOmitted() {
+        return canBeOmitted;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/InstalledCode.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,121 @@
+/*
+ * 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.jvmci.code;
+
+/**
+ * Represents a compiled instance of a method. It may have been invalidated or removed in the
+ * meantime.
+ */
+public class InstalledCode {
+
+    /**
+     * Raw address of this code blob.
+     */
+    private long address;
+
+    /**
+     * Counts how often the address field was reassigned.
+     */
+    private long version;
+
+    protected final String name;
+
+    public InstalledCode(String name) {
+        this.name = name;
+    }
+
+    public final void setAddress(long address) {
+        this.address = address;
+        version++;
+    }
+
+    /**
+     * @return the address of this code blob
+     */
+    public final long getAddress() {
+        return address;
+    }
+
+    /**
+     * @return the address of this code blob
+     */
+    public final long getVersion() {
+        return version;
+    }
+
+    /**
+     * Returns the name of this code blob.
+     */
+    public String getName() {
+        return name;
+    }
+
+    /**
+     * Returns the start address of this installed code if it is {@linkplain #isValid() valid}, 0
+     * otherwise.
+     */
+    public long getStart() {
+        return 0;
+    }
+
+    /**
+     * Returns the number of instruction bytes for this code.
+     */
+    public long getCodeSize() {
+        return 0;
+    }
+
+    /**
+     * Returns a copy of this installed code if it is {@linkplain #isValid() valid}, null otherwise.
+     */
+    public byte[] getCode() {
+        return null;
+    }
+
+    /**
+     * @return true if the code represented by this object is still valid, false otherwise (may
+     *         happen due to deopt, etc.)
+     */
+    public boolean isValid() {
+        return address != 0;
+    }
+
+    /**
+     * Invalidates this installed code such that any subsequent invocation will throw an
+     * {@link InvalidInstalledCodeException}.
+     */
+    public void invalidate() {
+        throw new UnsupportedOperationException();
+    }
+
+    /**
+     * Executes the installed code with a variable number of arguments.
+     *
+     * @param args the array of object arguments
+     * @return the value returned by the executed code
+     */
+    @SuppressWarnings("unused")
+    public Object executeVarargs(Object... args) throws InvalidInstalledCodeException {
+        throw new UnsupportedOperationException();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/InvalidInstalledCodeException.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.code;
+
+/**
+ * Exception thrown by the runtime in case an invalidated machine code is called.
+ */
+public final class InvalidInstalledCodeException extends Exception {
+
+    private static final long serialVersionUID = -3540232440794244844L;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/MemoryBarriers.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,121 @@
+/*
+ * Copyright (c) 2011, 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.jvmci.code;
+
+/**
+ * Constants and intrinsic definition for memory barriers.
+ *
+ * The documentation for each constant is taken from Doug Lea's <a
+ * href="http://gee.cs.oswego.edu/dl/jmm/cookbook.html">The JSR-133 Cookbook for Compiler
+ * Writers</a>.
+ * <p>
+ * The {@code JMM_*} constants capture the memory barriers necessary to implement the Java Memory
+ * Model with respect to volatile field accesses. Their values are explained by this comment from
+ * templateTable_i486.cpp in the HotSpot source code:
+ *
+ * <pre>
+ * Volatile variables demand their effects be made known to all CPU's in
+ * order.  Store buffers on most chips allow reads &amp; writes to reorder; the
+ * JMM's ReadAfterWrite.java test fails in -Xint mode without some kind of
+ * memory barrier (i.e., it's not sufficient that the interpreter does not
+ * reorder volatile references, the hardware also must not reorder them).
+ *
+ * According to the new Java Memory Model (JMM):
+ * (1) All volatiles are serialized wrt to each other.
+ * ALSO reads &amp; writes act as acquire &amp; release, so:
+ * (2) A read cannot let unrelated NON-volatile memory refs that happen after
+ * the read float up to before the read.  It's OK for non-volatile memory refs
+ * that happen before the volatile read to float down below it.
+ * (3) Similarly, a volatile write cannot let unrelated NON-volatile memory refs
+ * that happen BEFORE the write float down to after the write.  It's OK for
+ * non-volatile memory refs that happen after the volatile write to float up
+ * before it.
+ *
+ * We only put in barriers around volatile refs (they are expensive), not
+ * _between_ memory refs (which would require us to track the flavor of the
+ * previous memory refs).  Requirements (2) and (3) require some barriers
+ * before volatile stores and after volatile loads.  These nearly cover
+ * requirement (1) but miss the volatile-store-volatile-load case.  This final
+ * case is placed after volatile-stores although it could just as well go
+ * before volatile-loads.
+ * </pre>
+ */
+public class MemoryBarriers {
+
+    /**
+     * The sequence {@code Load1; LoadLoad; Load2} ensures that {@code Load1}'s data are loaded
+     * before data accessed by {@code Load2} and all subsequent load instructions are loaded. In
+     * general, explicit {@code LoadLoad} barriers are needed on processors that perform speculative
+     * loads and/or out-of-order processing in which waiting load instructions can bypass waiting
+     * stores. On processors that guarantee to always preserve load ordering, these barriers amount
+     * to no-ops.
+     */
+    public static final int LOAD_LOAD = 0x0001;
+
+    /**
+     * The sequence {@code Load1; LoadStore; Store2} ensures that {@code Load1}'s data are loaded
+     * before all data associated with {@code Store2} and subsequent store instructions are flushed.
+     * {@code LoadStore} barriers are needed only on those out-of-order processors in which waiting
+     * store instructions can bypass loads.
+     */
+    public static final int LOAD_STORE = 0x0002;
+
+    /**
+     * The sequence {@code Store1; StoreLoad; Load2} ensures that {@code Store1}'s data are made
+     * visible to other processors (i.e., flushed to main memory) before data accessed by
+     * {@code Load2} and all subsequent load instructions are loaded. {@code StoreLoad} barriers
+     * protect against a subsequent load incorrectly using {@code Store1}'s data value rather than
+     * that from a more recent store to the same location performed by a different processor.
+     * Because of this, on the processors discussed below, a {@code StoreLoad} is strictly necessary
+     * only for separating stores from subsequent loads of the same location(s) as were stored
+     * before the barrier. {@code StoreLoad} barriers are needed on nearly all recent
+     * multiprocessors, and are usually the most expensive kind. Part of the reason they are
+     * expensive is that they must disable mechanisms that ordinarily bypass cache to satisfy loads
+     * from write-buffers. This might be implemented by letting the buffer fully flush, among other
+     * possible stalls.
+     */
+    public static final int STORE_LOAD = 0x0004;
+
+    /**
+     * The sequence {@code Store1; StoreStore; Store2} ensures that {@code Store1}'s data are
+     * visible to other processors (i.e., flushed to memory) before the data associated with
+     * {@code Store2} and all subsequent store instructions. In general, {@code StoreStore} barriers
+     * are needed on processors that do not otherwise guarantee strict ordering of flushes from
+     * write buffers and/or caches to other processors or main memory.
+     */
+    public static final int STORE_STORE = 0x0008;
+
+    public static final int JMM_PRE_VOLATILE_WRITE = LOAD_STORE | STORE_STORE;
+    public static final int JMM_POST_VOLATILE_WRITE = STORE_LOAD | STORE_STORE;
+    public static final int JMM_PRE_VOLATILE_READ = 0;
+    public static final int JMM_POST_VOLATILE_READ = LOAD_LOAD | LOAD_STORE;
+
+    public static String barriersString(int barriers) {
+        StringBuilder sb = new StringBuilder();
+        sb.append((barriers & LOAD_LOAD) != 0 ? "LOAD_LOAD " : "");
+        sb.append((barriers & LOAD_STORE) != 0 ? "LOAD_STORE " : "");
+        sb.append((barriers & STORE_LOAD) != 0 ? "STORE_LOAD " : "");
+        sb.append((barriers & STORE_STORE) != 0 ? "STORE_STORE " : "");
+        return sb.toString().trim();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/ReferenceMap.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2009, 2015, 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.jvmci.code;
+
+import com.oracle.jvmci.meta.LIRKind;
+import com.oracle.jvmci.code.CodeUtil.RefMapFormatter;
+
+public abstract class ReferenceMap implements Cloneable {
+
+    public abstract void setRegister(int idx, LIRKind kind);
+
+    public abstract void setStackSlot(int offset, LIRKind kind);
+
+    public abstract boolean hasRegisterRefMap();
+
+    public abstract boolean hasFrameRefMap();
+
+    public abstract void appendRegisterMap(StringBuilder sb, RefMapFormatter formatterArg);
+
+    public abstract void appendFrameMap(StringBuilder sb, RefMapFormatter formatterArg);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/Register.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,241 @@
+/*
+ * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.code;
+
+import com.oracle.jvmci.meta.*;
+
+/**
+ * Represents a target machine register.
+ */
+public final class Register implements Comparable<Register> {
+
+    public static final RegisterCategory SPECIAL = new RegisterCategory("SPECIAL");
+
+    /**
+     * Invalid register.
+     */
+    public static final Register None = new Register(-1, -1, "noreg", SPECIAL);
+
+    /**
+     * Frame pointer of the current method. All spill slots and outgoing stack-based arguments are
+     * addressed relative to this register.
+     */
+    public static final Register Frame = new Register(-2, -2, "framereg", SPECIAL);
+
+    public static final Register CallerFrame = new Register(-3, -3, "callerframereg", SPECIAL);
+
+    /**
+     * The identifier for this register that is unique across all the registers in a
+     * {@link Architecture}. 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 assembler calls this method to get the register's encoding.
+     */
+    public int encoding() {
+        return encoding;
+    }
+
+    /**
+     * A platform specific register category that describes which values can be stored in a
+     * register.
+     */
+    private final RegisterCategory registerCategory;
+
+    /**
+     * A platform specific register type that describes which values can be stored in a register.
+     */
+    public static class RegisterCategory {
+
+        private final String name;
+
+        private final int referenceMapOffset;
+        private final int referenceMapShift;
+
+        public RegisterCategory(String name) {
+            this(name, 0, 0);
+        }
+
+        public RegisterCategory(String name, int referenceMapOffset) {
+            this(name, referenceMapOffset, 0);
+        }
+
+        public RegisterCategory(String name, int referenceMapOffset, int referenceMapShift) {
+            this.name = name;
+            this.referenceMapOffset = referenceMapOffset;
+            this.referenceMapShift = referenceMapShift;
+        }
+
+        @Override
+        public String toString() {
+            return name;
+        }
+
+        @Override
+        public int hashCode() {
+            return 23 + name.hashCode();
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            if (obj instanceof RegisterCategory) {
+                RegisterCategory that = (RegisterCategory) obj;
+                return this.referenceMapOffset == that.referenceMapOffset && this.referenceMapShift == that.referenceMapShift && this.name.equals(that.name);
+            }
+            return false;
+        }
+    }
+
+    /**
+     * Creates a {@link Register} instance.
+     *
+     * @param number unique identifier for the register
+     * @param encoding the target machine encoding for the register
+     * @param name the mnemonic name for the register
+     * @param registerCategory the register category
+     */
+    public Register(int number, int encoding, String name, RegisterCategory registerCategory) {
+        this.number = number;
+        this.name = name;
+        this.registerCategory = registerCategory;
+        this.encoding = encoding;
+    }
+
+    public RegisterCategory getRegisterCategory() {
+        return registerCategory;
+    }
+
+    /**
+     * Get the start index of this register in the {@link ReferenceMap}.
+     */
+    public int getReferenceMapIndex() {
+        return (encoding << registerCategory.referenceMapShift) + registerCategory.referenceMapOffset;
+    }
+
+    /**
+     * Gets this register as a {@linkplain RegisterValue value} with a specified kind.
+     *
+     * @param kind the specified kind
+     * @return the {@link RegisterValue}
+     */
+    public RegisterValue asValue(LIRKind kind) {
+        return new RegisterValue(kind, this);
+    }
+
+    /**
+     * Gets this register as a {@linkplain RegisterValue value} with no particular kind.
+     *
+     * @return a {@link RegisterValue} with {@link Kind#Illegal} kind.
+     */
+    public RegisterValue asValue() {
+        return asValue(LIRKind.Illegal);
+    }
+
+    /**
+     * Determines if this is a valid register.
+     *
+     * @return {@code true} iff this register is valid
+     */
+    public boolean isValid() {
+        return number >= 0;
+    }
+
+    /**
+     * 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(Register[] registers) {
+        int max = Integer.MIN_VALUE;
+        for (Register 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(Register[] registers) {
+        int max = Integer.MIN_VALUE;
+        for (Register r : registers) {
+            if (r.encoding > max) {
+                max = r.encoding;
+            }
+        }
+        return max;
+    }
+
+    @Override
+    public String toString() {
+        return name;
+    }
+
+    @Override
+    public int compareTo(Register o) {
+        if (number < o.number) {
+            return -1;
+        }
+        if (number > o.number) {
+            return 1;
+        }
+        return 0;
+    }
+
+    @Override
+    public int hashCode() {
+        return 17 + name.hashCode();
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (obj instanceof Register) {
+            Register other = (Register) obj;
+            if (number == other.number) {
+                assert name.equals(other.name);
+                assert encoding == other.encoding;
+                assert registerCategory.equals(other.registerCategory);
+                return true;
+            }
+        }
+        return false;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/RegisterAttributes.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,99 @@
+/*
+ * 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.jvmci.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 RegisterConfig} in use during a compilation will
+ * determine which registers are callee saved.
+ */
+public class RegisterAttributes {
+
+    private final boolean callerSave;
+    private final boolean calleeSave;
+    private final boolean allocatable;
+
+    public RegisterAttributes(boolean isCallerSave, boolean isCalleeSave, boolean isAllocatable) {
+        this.callerSave = isCallerSave;
+        this.calleeSave = isCalleeSave;
+        this.allocatable = isAllocatable;
+    }
+
+    public static final RegisterAttributes NONE = new RegisterAttributes(false, false, false);
+
+    /**
+     * Creates a map from register {@linkplain Register#number numbers} to register
+     * {@linkplain RegisterAttributes 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 RegisterAttributes[] createMap(RegisterConfig registerConfig, Register[] registers) {
+        RegisterAttributes[] map = new RegisterAttributes[registers.length];
+        for (Register reg : registers) {
+            if (reg != null) {
+                CalleeSaveLayout csl = registerConfig.getCalleeSaveLayout();
+                RegisterAttributes attr = new RegisterAttributes(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;
+    }
+
+    /**
+     * @return Denotes a register that is available for use by a register allocator.
+     */
+    public boolean isAllocatable() {
+        return allocatable;
+    }
+
+    /**
+     * @return Denotes a register whose value preservation (if required) across a call is the
+     *         responsibility of the callee.
+     */
+    public boolean isCalleeSave() {
+        return calleeSave;
+    }
+
+    /**
+     * @return Denotes a register whose value preservation (if required) across a call is the
+     *         responsibility of the caller.
+     */
+    public boolean isCallerSave() {
+        return callerSave;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/RegisterConfig.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,124 @@
+/*
+ * 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.jvmci.code;
+
+import com.oracle.jvmci.meta.Kind;
+import com.oracle.jvmci.meta.JavaType;
+import com.oracle.jvmci.meta.PlatformKind;
+import com.oracle.jvmci.code.CallingConvention.Type;
+
+/**
+ * A register configuration binds roles and {@linkplain RegisterAttributes attributes} to physical
+ * registers.
+ */
+public interface RegisterConfig {
+
+    /**
+     * Gets the register to be used for returning a value of a given kind.
+     */
+    Register getReturnRegister(Kind kind);
+
+    /**
+     * Gets the maximum allowed size of the frame.
+     */
+    default int getMaximumFrameSize() {
+        return Integer.MAX_VALUE;
+    }
+
+    /**
+     * Gets the register to which {@link Register#Frame} and {@link Register#CallerFrame} are bound.
+     */
+    Register getFrameRegister();
+
+    /**
+     * Gets the calling convention describing how arguments are passed.
+     *
+     * @param type the type of calling convention being requested
+     * @param returnType the return type (can be null for methods returning {@code void})
+     * @param parameterTypes the types of the arguments of the call
+     * @param target the target platform
+     * @param stackOnly ignore registers
+     */
+    CallingConvention getCallingConvention(Type type, JavaType returnType, JavaType[] parameterTypes, TargetDescription 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 kind specifies what kind of registers is being requested
+     * @return the ordered set of registers that may be used to pass parameters in a call conforming
+     *         to {@code type}
+     */
+    Register[] getCallingConventionRegisters(Type type, Kind kind);
+
+    /**
+     * Gets the set of all registers that might be used by the register allocator.
+     *
+     * To get the set of registers the register allocator is allowed to use see
+     * {@link RegisterAllocationConfig#getAllocatableRegisters()}
+     */
+    @SuppressWarnings("javadoc")
+    Register[] getAllocatableRegisters();
+
+    /**
+     * Filters a set of registers and returns only those that can be used by the register allocator
+     * for a value of a particular kind.
+     */
+    Register[] filterAllocatableRegisters(PlatformKind kind, Register[] registers);
+
+    /**
+     * Gets the registers whose values must be preserved by a method across any call it makes.
+     */
+    Register[] getCallerSaveRegisters();
+
+    /**
+     * Gets the layout of the callee save area of this register configuration.
+     *
+     * @return {@code null} if there is no callee save area
+     */
+    CalleeSaveLayout getCalleeSaveLayout();
+
+    /**
+     * Gets a map from register {@linkplain Register#number numbers} to register
+     * {@linkplain RegisterAttributes attributes} for this register configuration.
+     *
+     * @return an array where an element at index i holds the attributes of the register whose
+     *         number is i
+     */
+    RegisterAttributes[] 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}
+     */
+    Register getRegisterForRole(int id);
+
+    /**
+     * Determines if all {@link #getAllocatableRegisters() allocatable} registers are
+     * {@link #getCallerSaveRegisters() caller saved}.
+     */
+    boolean areAllAllocatableRegistersCallerSaved();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/RegisterSaveLayout.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,127 @@
+/*
+ * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.code;
+
+import java.util.*;
+
+/**
+ * A map from registers to frame slots. This can be used to describe where callee saved registers
+ * are saved in a callee's frame.
+ */
+public final class RegisterSaveLayout {
+
+    /**
+     * Keys.
+     */
+    private final Register[] registers;
+
+    /**
+     * Slot indexes relative to stack pointer.
+     */
+    private final int[] slots;
+
+    /**
+     * Creates a map from registers to frame slots.
+     *
+     * @param registers the keys in the map
+     * @param slots frame slot index for each register in {@code registers}
+     */
+    public RegisterSaveLayout(Register[] registers, int[] slots) {
+        assert registers.length == slots.length;
+        this.registers = registers;
+        this.slots = slots;
+        assert registersToSlots(false).size() == registers.length : "non-unique registers";
+        assert new HashSet<>(registersToSlots(false).values()).size() == slots.length : "non-unqiue slots";
+    }
+
+    /**
+     * Gets the frame slot index for a given register.
+     *
+     * @param register register to get the frame slot index for
+     * @return frame slot index
+     */
+    public int registerToSlot(Register register) {
+        for (int i = 0; i < registers.length; i++) {
+            if (register.equals(registers[i])) {
+                return slots[i];
+            }
+        }
+        throw new IllegalArgumentException(register + " not saved by this layout: " + this);
+    }
+
+    /**
+     * Gets this layout information as a {@link Map} from registers to slots.
+     */
+    public Map<Register, Integer> registersToSlots(boolean sorted) {
+        Map<Register, Integer> result;
+        if (sorted) {
+            result = new TreeMap<>();
+        } else {
+            result = new HashMap<>();
+        }
+        for (int i = 0; i < registers.length; i++) {
+            result.put(registers[i], slots[i]);
+        }
+        return result;
+    }
+
+    /**
+     * Gets this layout information as a {@link Map} from slots to registers.
+     */
+    public Map<Integer, Register> slotsToRegisters(boolean sorted) {
+        Map<Integer, Register> result;
+        if (sorted) {
+            result = new TreeMap<>();
+        } else {
+            result = new HashMap<>();
+        }
+        for (int i = 0; i < registers.length; i++) {
+            result.put(slots[i], registers[i]);
+        }
+        return result;
+    }
+
+    @Override
+    public int hashCode() {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj instanceof RegisterSaveLayout) {
+            RegisterSaveLayout that = (RegisterSaveLayout) obj;
+            if (Arrays.equals(registers, that.registers) && Arrays.equals(slots, that.slots)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    @Override
+    public String toString() {
+        return registersToSlots(true).toString();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/RegisterValue.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.code;
+
+import com.oracle.jvmci.meta.*;
+
+/**
+ * Denotes a register that stores a value of a fixed kind. There is exactly one (canonical) instance
+ * of {@link RegisterValue} for each ({@link Register}, {@link Kind}) pair. Use
+ * {@link Register#asValue(LIRKind)} to retrieve the canonical {@link RegisterValue} instance for a
+ * given (register,kind) pair.
+ */
+public final class RegisterValue extends AllocatableValue {
+
+    private final Register reg;
+
+    /**
+     * Should only be called from {@link Register#Register} to ensure canonicalization.
+     */
+    protected RegisterValue(LIRKind kind, Register register) {
+        super(kind);
+        this.reg = register;
+    }
+
+    @Override
+    public String toString() {
+        return getRegister().name + getKindSuffix();
+    }
+
+    /**
+     * @return the register that contains the value
+     */
+    public Register getRegister() {
+        return reg;
+    }
+
+    @Override
+    public int hashCode() {
+        return 29 * super.hashCode() + reg.hashCode();
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (obj instanceof RegisterValue) {
+            RegisterValue other = (RegisterValue) obj;
+            return super.equals(obj) && reg.equals(other.reg);
+        }
+        return false;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/SourceStackTrace.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2015, 2015, 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.jvmci.code;
+
+/**
+ * Class representing a exception with a stack trace of the currently processed position in the
+ * compiled Java program instead of the stack trace of the compiler. The exception of the compiler
+ * is saved as the cause of this exception.
+ */
+public abstract class SourceStackTrace extends BailoutException {
+    private static final long serialVersionUID = 2144811793442316776L;
+
+    public static SourceStackTrace create(Throwable cause, String format, StackTraceElement[] elements) {
+        return new SourceStackTrace(cause, format) {
+
+            private static final long serialVersionUID = 6279381376051787907L;
+
+            @Override
+            public final synchronized Throwable fillInStackTrace() {
+                assert elements != null;
+                setStackTrace(elements);
+                return this;
+            }
+        };
+    }
+
+    private SourceStackTrace(Throwable cause, String format) {
+        super(cause, format);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/SpeculationLog.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.code;
+
+import com.oracle.jvmci.meta.JavaConstant;
+import java.util.*;
+import java.util.concurrent.*;
+
+/**
+ * Manages a list of unique deoptimization reasons.
+ *
+ */
+public abstract class SpeculationLog {
+    private volatile Object lastFailed;
+    private volatile Collection<Object> speculations;
+    private Set<Object> failedSpeculations;
+
+    public synchronized void collectFailedSpeculations() {
+        if (lastFailed != null) {
+            if (failedSpeculations == null) {
+                failedSpeculations = new HashSet<>(2);
+            }
+            failedSpeculations.add(lastFailed);
+            lastFailed = null;
+            speculations = null;
+        }
+    }
+
+    public boolean maySpeculate(Object reason) {
+        if (failedSpeculations != null && failedSpeculations.contains(reason)) {
+            return false;
+        }
+        return true;
+    }
+
+    protected void addSpeculation(Object reason) {
+        assert maySpeculate(reason);
+        if (speculations == null) {
+            synchronized (this) {
+                if (speculations == null) {
+                    speculations = new ConcurrentLinkedQueue<>();
+                }
+            }
+        }
+        speculations.add(reason);
+    }
+
+    public abstract JavaConstant speculate(Object reason);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/StackLockValue.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2011, 2015, 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.jvmci.code;
+
+import com.oracle.jvmci.meta.JavaValue;
+import com.oracle.jvmci.meta.AbstractValue;
+import com.oracle.jvmci.meta.Value;
+import com.oracle.jvmci.meta.LIRKind;
+import static com.oracle.jvmci.code.ValueUtil.*;
+
+/**
+ * Represents lock information in the debug information.
+ */
+public final class StackLockValue extends AbstractValue implements JavaValue {
+
+    private Value owner;
+    private StackSlotValue slot;
+    private final boolean eliminated;
+
+    public StackLockValue(Value object, StackSlotValue slot, boolean eliminated) {
+        super(LIRKind.Illegal);
+        this.owner = object;
+        this.slot = slot;
+        this.eliminated = eliminated;
+    }
+
+    public Value getOwner() {
+        return owner;
+    }
+
+    public void setOwner(Value newOwner) {
+        this.owner = newOwner;
+    }
+
+    public Value getSlot() {
+        return slot;
+    }
+
+    public boolean isEliminated() {
+        return eliminated;
+    }
+
+    @Override
+    public String toString() {
+        return "monitor[" + owner + (slot != null ? ", " + slot : "") + (eliminated ? ", eliminated" : "") + "]";
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 43;
+        int result = super.hashCode();
+        result = prime * result + (eliminated ? 1231 : 1237);
+        result = prime * result + owner.hashCode();
+        result = prime * result + slot.hashCode();
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (obj instanceof StackLockValue) {
+            StackLockValue other = (StackLockValue) obj;
+            return super.equals(obj) && eliminated == other.eliminated && owner.equals(other.owner) && slot.equals(other.slot);
+        }
+        return false;
+    }
+
+    public void setSlot(StackSlotValue stackSlot) {
+        assert slot == null || (isVirtualStackSlot(slot) && (slot.equals(stackSlot) || isStackSlot(stackSlot))) : String.format("Can not set slot for %s to %s", this, stackSlot);
+        slot = stackSlot;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/StackSlot.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,134 @@
+/*
+ * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.code;
+
+import com.oracle.jvmci.meta.LIRKind;
+
+/**
+ * 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 #isInCallerFrame() caller's frame}.
+ */
+public final class StackSlot extends StackSlotValue {
+
+    private final int offset;
+    private final boolean addFrameSize;
+
+    /**
+     * Gets a {@link StackSlot} 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 addFrameSize Specifies if the offset is relative to the stack pointer, or the
+     *            beginning of the frame (stack pointer + total frame size).
+     */
+    public static StackSlot get(LIRKind kind, int offset, boolean addFrameSize) {
+        assert addFrameSize || offset >= 0;
+        return new StackSlot(kind, offset, addFrameSize);
+    }
+
+    /**
+     * Private constructor to enforce use of {@link #get(LIRKind, int, boolean)} so that a cache can
+     * be used.
+     */
+    private StackSlot(LIRKind 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 getOffset(int totalFrameSize) {
+        assert totalFrameSize > 0 || !addFrameSize;
+        int result = offset + (addFrameSize ? totalFrameSize : 0);
+        assert result >= 0;
+        return result;
+    }
+
+    public boolean isInCallerFrame() {
+        return addFrameSize && offset >= 0;
+    }
+
+    public int getRawOffset() {
+        return offset;
+    }
+
+    public boolean getRawAddFrameSize() {
+        return addFrameSize;
+    }
+
+    @Override
+    public String toString() {
+        if (!addFrameSize) {
+            return "out:" + offset + getKindSuffix();
+        } else if (offset >= 0) {
+            return "in:" + offset + getKindSuffix();
+        } else {
+            return "stack:" + (-offset) + getKindSuffix();
+        }
+    }
+
+    /**
+     * Gets this stack slot used to pass an argument from the perspective of a caller.
+     */
+    public StackSlot asOutArg() {
+        assert offset >= 0;
+        if (addFrameSize) {
+            return get(getLIRKind(), offset, false);
+        }
+        return this;
+    }
+
+    /**
+     * Gets this stack slot used to pass an argument from the perspective of a callee.
+     */
+    public StackSlot asInArg() {
+        assert offset >= 0;
+        if (!addFrameSize) {
+            return get(getLIRKind(), offset, true);
+        }
+        return this;
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 37;
+        int result = super.hashCode();
+        result = prime * result + (addFrameSize ? 1231 : 1237);
+        result = prime * result + offset;
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (obj instanceof StackSlot) {
+            StackSlot other = (StackSlot) obj;
+            return super.equals(obj) && addFrameSize == other.addFrameSize && offset == other.offset;
+        }
+        return false;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/StackSlotValue.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.code;
+
+import com.oracle.jvmci.meta.AllocatableValue;
+import com.oracle.jvmci.meta.LIRKind;
+
+/**
+ * Common base class for {@linkplain StackSlot real} and {@linkplain VirtualStackSlot virtual} stack
+ * slots.
+ */
+public abstract class StackSlotValue extends AllocatableValue {
+
+    public StackSlotValue(LIRKind lirKind) {
+        super(lirKind);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/TargetDescription.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,143 @@
+/*
+ * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.code;
+
+import com.oracle.jvmci.meta.Kind;
+import com.oracle.jvmci.meta.PlatformKind;
+import com.oracle.jvmci.meta.LIRKind;
+import static com.oracle.jvmci.meta.MetaUtil.*;
+
+/**
+ * Represents the target machine for a compiler, including the CPU architecture, the size of
+ * pointers and references, alignment of stacks, caches, etc.
+ */
+public abstract class TargetDescription {
+
+    public final Architecture arch;
+
+    /**
+     * 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 kind to be used for representing raw pointers and CPU registers.
+     */
+    public final Kind 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;
+
+    /**
+     * Maximum constant displacement at which a memory access can no longer be an implicit null
+     * check.
+     */
+    public final int implicitNullCheckLimit;
+
+    public TargetDescription(Architecture arch, boolean isMP, int stackAlignment, int implicitNullCheckLimit, boolean inlineObjects) {
+        this.arch = arch;
+        this.isMP = isMP;
+        this.wordSize = arch.getWordSize();
+        this.wordKind = Kind.fromWordSize(wordSize);
+        this.stackAlignment = stackAlignment;
+        this.implicitNullCheckLimit = implicitNullCheckLimit;
+        this.inlineObjects = inlineObjects;
+    }
+
+    @Override
+    public final int hashCode() {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public final boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj instanceof TargetDescription) {
+            TargetDescription that = (TargetDescription) obj;
+            // @formatter:off
+            if (this.implicitNullCheckLimit == that.implicitNullCheckLimit &&
+                this.inlineObjects == that.inlineObjects &&
+                this.isMP == that.isMP &&
+                this.stackAlignment == that.stackAlignment &&
+                this.wordKind.equals(that.wordKind) &&
+                this.wordSize == that.wordSize &&
+                this.arch.equals(that.arch)) {
+                return true;
+            }
+            // @formatter:on
+        }
+        return false;
+    }
+
+    @Override
+    public String toString() {
+        return identityHashCodeString(this);
+    }
+
+    public int getSizeInBytes(PlatformKind kind) {
+        return arch.getSizeInBytes(kind);
+    }
+
+    public LIRKind getLIRKind(Kind javaKind) {
+        switch (javaKind) {
+            case Boolean:
+            case Byte:
+            case Short:
+            case Char:
+            case Int:
+            case Long:
+            case Float:
+            case Double:
+                return LIRKind.value(javaKind);
+            case Object:
+                return LIRKind.reference(javaKind);
+            default:
+                return LIRKind.Illegal;
+        }
+    }
+
+    public abstract ReferenceMap createReferenceMap(boolean hasRegisters, int stackSlotCount);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/TypeCheckHints.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,160 @@
+/*
+ * 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.jvmci.code;
+
+import com.oracle.jvmci.meta.JavaTypeProfile;
+import com.oracle.jvmci.meta.ResolvedJavaType;
+import com.oracle.jvmci.meta.Assumptions;
+import java.util.*;
+
+import com.oracle.jvmci.meta.Assumptions.AssumptionResult;
+import com.oracle.jvmci.meta.JavaTypeProfile.ProfiledType;
+
+/**
+ * Utility for deriving hint types for a type check instruction (e.g. checkcast or instanceof) based
+ * on the target type of the check and any profiling information available for the instruction.
+ */
+public class TypeCheckHints {
+
+    /**
+     * A receiver type profiled in a type check instruction.
+     */
+    public static class Hint {
+
+        /**
+         * A type seen while profiling a type check instruction.
+         */
+        public final ResolvedJavaType type;
+
+        /**
+         * Specifies if {@link #type} is a sub-type of the checked type.
+         */
+        public final boolean positive;
+
+        Hint(ResolvedJavaType type, boolean positive) {
+            this.type = type;
+            this.positive = positive;
+        }
+    }
+
+    private static final Hint[] NO_HINTS = {};
+
+    /**
+     * If non-null, then this is the only type that could pass the type check because the target of
+     * the type check is a final class or has been speculated to be a final class and this value is
+     * the only concrete subclass of the target type.
+     */
+    public final ResolvedJavaType exact;
+
+    /**
+     * The most likely types that the type check instruction will see.
+     */
+    public final Hint[] hints;
+
+    /**
+     * The profile from which this information was derived.
+     */
+    public final JavaTypeProfile profile;
+
+    /**
+     * The total probability that the type check will hit one of the types in {@link #hints}.
+     */
+    public final double hintHitProbability;
+
+    /**
+     * Derives hint information for use when generating the code for a type check instruction.
+     *
+     * @param targetType the target type of the type check
+     * @param profile the profiling information available for the instruction (if any)
+     * @param assumptions the object in which speculations are recorded. This is null if
+     *            speculations are not supported.
+     * @param minHintHitProbability if the probability that the type check will hit one of the
+     *            profiled types (up to {@code maxHints}) is below this value, then {@link #hints}
+     *            will be null
+     * @param maxHints the maximum length of {@link #hints}
+     */
+    public TypeCheckHints(ResolvedJavaType targetType, JavaTypeProfile profile, Assumptions assumptions, double minHintHitProbability, int maxHints) {
+        this.profile = profile;
+        if (targetType != null && !canHaveSubtype(targetType)) {
+            exact = targetType;
+        } else {
+            if (assumptions != null) {
+                AssumptionResult<ResolvedJavaType> leafConcreteSubtype = targetType == null ? null : targetType.findLeafConcreteSubtype();
+                if (leafConcreteSubtype != null) {
+                    assumptions.record(leafConcreteSubtype);
+                    exact = leafConcreteSubtype.getResult();
+                } else {
+                    exact = null;
+                }
+            } else {
+                exact = null;
+            }
+        }
+        Double[] hitProbability = {null};
+        this.hints = makeHints(targetType, profile, minHintHitProbability, maxHints, hitProbability);
+        this.hintHitProbability = hitProbability[0];
+    }
+
+    private static Hint[] makeHints(ResolvedJavaType targetType, JavaTypeProfile profile, double minHintHitProbability, int maxHints, Double[] hitProbability) {
+        double hitProb = 0.0d;
+        Hint[] hintsBuf = NO_HINTS;
+        if (profile != null) {
+            double notRecordedTypes = profile.getNotRecordedProbability();
+            ProfiledType[] ptypes = profile.getTypes();
+            if (notRecordedTypes < (1D - minHintHitProbability) && ptypes != null && ptypes.length > 0) {
+                hintsBuf = new Hint[ptypes.length];
+                int hintCount = 0;
+                for (ProfiledType ptype : ptypes) {
+                    if (targetType != null) {
+                        ResolvedJavaType hintType = ptype.getType();
+                        hintsBuf[hintCount++] = new Hint(hintType, targetType.isAssignableFrom(hintType));
+                        hitProb += ptype.getProbability();
+                    }
+                    if (hintCount == maxHints) {
+                        break;
+                    }
+                }
+                if (hitProb >= minHintHitProbability) {
+                    if (hintsBuf.length != hintCount || hintCount > maxHints) {
+                        hintsBuf = Arrays.copyOf(hintsBuf, Math.min(maxHints, hintCount));
+                    }
+                } else {
+                    hintsBuf = NO_HINTS;
+                    hitProb = 0.0d;
+                }
+            }
+        }
+        hitProbability[0] = hitProb;
+        return hintsBuf;
+    }
+
+    /**
+     * Determines if a given type can have subtypes other than itself. This analysis is purely
+     * static; no assumptions are made.
+     *
+     * @return true if {@code type} can have subtypes
+     */
+    public static boolean canHaveSubtype(ResolvedJavaType type) {
+        return !type.getElementalType().isFinal();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/UnsignedMath.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,124 @@
+/*
+ * Copyright (c) 2011, 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.jvmci.code;
+
+import java.math.*;
+
+//JaCoCo Exclude
+
+/**
+ * Utilities for unsigned comparisons. All methods have correct, but slow, standard Java
+ * implementations so that they can be used with compilers not supporting the intrinsics.
+ */
+public class UnsignedMath {
+
+    private static final long MASK = 0xffffffffL;
+
+    /**
+     * Unsigned comparison aboveThan for two numbers.
+     */
+    public static boolean aboveThan(int a, int b) {
+        return (a & MASK) > (b & MASK);
+    }
+
+    /**
+     * Unsigned comparison aboveOrEqual for two numbers.
+     */
+    public static boolean aboveOrEqual(int a, int b) {
+        return (a & MASK) >= (b & MASK);
+    }
+
+    /**
+     * Unsigned comparison belowThan for two numbers.
+     */
+    public static boolean belowThan(int a, int b) {
+        return (a & MASK) < (b & MASK);
+    }
+
+    /**
+     * Unsigned comparison belowOrEqual for two numbers.
+     */
+    public static boolean belowOrEqual(int a, int b) {
+        return (a & MASK) <= (b & MASK);
+    }
+
+    /**
+     * Unsigned comparison aboveThan for two numbers.
+     */
+    public static boolean aboveThan(long a, long b) {
+        return (a > b) ^ ((a < 0) != (b < 0));
+    }
+
+    /**
+     * Unsigned comparison aboveOrEqual for two numbers.
+     */
+    public static boolean aboveOrEqual(long a, long b) {
+        return (a >= b) ^ ((a < 0) != (b < 0));
+    }
+
+    /**
+     * Unsigned comparison belowThan for two numbers.
+     */
+    public static boolean belowThan(long a, long b) {
+        return (a < b) ^ ((a < 0) != (b < 0));
+    }
+
+    /**
+     * Unsigned comparison belowOrEqual for two numbers.
+     */
+    public static boolean belowOrEqual(long a, long b) {
+        return (a <= b) ^ ((a < 0) != (b < 0));
+    }
+
+    /**
+     * Unsigned division for two numbers.
+     */
+    public static int divide(int a, int b) {
+        return (int) ((a & MASK) / (b & MASK));
+    }
+
+    /**
+     * Unsigned remainder for two numbers.
+     */
+    public static int remainder(int a, int b) {
+        return (int) ((a & MASK) % (b & MASK));
+    }
+
+    /**
+     * Unsigned division for two numbers.
+     */
+    public static long divide(long a, long b) {
+        return bi(a).divide(bi(b)).longValue();
+    }
+
+    /**
+     * Unsigned remainder for two numbers.
+     */
+    public static long remainder(long a, long b) {
+        return bi(a).remainder(bi(b)).longValue();
+    }
+
+    private static BigInteger bi(long unsigned) {
+        return unsigned >= 0 ? BigInteger.valueOf(unsigned) : BigInteger.valueOf(unsigned & 0x7fffffffffffffffL).setBit(63);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/ValueUtil.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,189 @@
+/*
+ * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.code;
+
+import com.oracle.jvmci.meta.Kind;
+import com.oracle.jvmci.meta.Value;
+import com.oracle.jvmci.meta.AllocatableValue;
+import com.oracle.jvmci.meta.JavaConstant;
+import java.util.*;
+
+/**
+ * Utility class for working with the {@link Value} class and its subclasses.
+ */
+public final class ValueUtil {
+
+    public static boolean isIllegal(Value value) {
+        assert value != null;
+        return Value.ILLEGAL.equals(value);
+    }
+
+    public static boolean isLegal(Value value) {
+        return !isIllegal(value);
+    }
+
+    public static boolean isVirtualObject(Value value) {
+        assert value != null;
+        return value instanceof VirtualObject;
+    }
+
+    public static VirtualObject asVirtualObject(Value value) {
+        assert value != null;
+        return (VirtualObject) value;
+    }
+
+    public static boolean isConstant(Value value) {
+        assert value != null;
+        return value instanceof JavaConstant;
+    }
+
+    public static JavaConstant asConstant(Value value) {
+        assert value != null;
+        return (JavaConstant) value;
+    }
+
+    public static boolean isAllocatableValue(Value value) {
+        assert value != null;
+        return value instanceof AllocatableValue;
+    }
+
+    public static AllocatableValue asAllocatableValue(Value value) {
+        assert value != null;
+        return (AllocatableValue) value;
+    }
+
+    public static boolean isStackSlot(Value value) {
+        assert value != null;
+        return value instanceof StackSlot;
+    }
+
+    public static StackSlot asStackSlot(Value value) {
+        assert value != null;
+        return (StackSlot) value;
+    }
+
+    public static boolean isStackSlotValue(Value value) {
+        assert value != null;
+        return value instanceof StackSlotValue;
+    }
+
+    public static StackSlotValue asStackSlotValue(Value value) {
+        assert value != null;
+        return (StackSlotValue) value;
+    }
+
+    public static boolean isVirtualStackSlot(Value value) {
+        assert value != null;
+        return value instanceof VirtualStackSlot;
+    }
+
+    public static VirtualStackSlot asVirtualStackSlot(Value value) {
+        assert value != null;
+        return (VirtualStackSlot) value;
+    }
+
+    public static boolean isRegister(Value value) {
+        assert value != null;
+        return value instanceof RegisterValue;
+    }
+
+    public static Register asRegister(Value value) {
+        assert value != null;
+        return ((RegisterValue) value).getRegister();
+    }
+
+    public static Register asIntReg(Value value) {
+        if (value.getKind().getStackKind() != Kind.Int) {
+            throw new InternalError("needed Int got: " + value.getKind());
+        } else {
+            return asRegister(value);
+        }
+    }
+
+    public static Register asLongReg(Value value) {
+        if (value.getKind() != Kind.Long) {
+            throw new InternalError("needed Long got: " + value.getKind());
+        } else {
+            return asRegister(value);
+        }
+    }
+
+    public static Register asObjectReg(Value value) {
+        assert value.getKind() == Kind.Object : value.getKind();
+        return asRegister(value);
+    }
+
+    public static Register asFloatReg(Value value) {
+        assert value.getKind() == Kind.Float : value.getKind();
+        return asRegister(value);
+    }
+
+    public static Register asDoubleReg(Value value) {
+        assert value.getKind() == Kind.Double : value.getKind();
+        return asRegister(value);
+    }
+
+    public static boolean sameRegister(Value v1, Value v2) {
+        return isRegister(v1) && isRegister(v2) && asRegister(v1).equals(asRegister(v2));
+    }
+
+    public static boolean sameRegister(Value v1, Value v2, Value v3) {
+        return sameRegister(v1, v2) && sameRegister(v1, v3);
+    }
+
+    /**
+     * Checks if all the provided values are different physical registers. The parameters can be
+     * either {@link Register registers}, {@link Value values} or arrays of them. All values that
+     * are not {@link RegisterValue registers} are ignored.
+     */
+    public static boolean differentRegisters(Object... values) {
+        List<Register> registers = collectRegisters(values, new ArrayList<Register>());
+        for (int i = 1; i < registers.size(); i++) {
+            Register r1 = registers.get(i);
+            for (int j = 0; j < i; j++) {
+                Register r2 = registers.get(j);
+                if (r1.equals(r2)) {
+                    return false;
+                }
+            }
+        }
+        return true;
+    }
+
+    private static List<Register> collectRegisters(Object[] values, List<Register> registers) {
+        for (Object o : values) {
+            if (o instanceof Register) {
+                registers.add((Register) o);
+            } else if (o instanceof Value) {
+                if (isRegister((Value) o)) {
+                    registers.add(asRegister((Value) o));
+                }
+            } else if (o instanceof Object[]) {
+                collectRegisters((Object[]) o, registers);
+            } else {
+                throw new IllegalArgumentException("Not a Register or Value: " + o);
+            }
+        }
+        return registers;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/VirtualObject.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,218 @@
+/*
+ * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.code;
+
+import com.oracle.jvmci.meta.ResolvedJavaField;
+import com.oracle.jvmci.meta.JavaValue;
+import com.oracle.jvmci.meta.Kind;
+import com.oracle.jvmci.meta.AbstractValue;
+import com.oracle.jvmci.meta.Value;
+import com.oracle.jvmci.meta.ResolvedJavaType;
+import com.oracle.jvmci.meta.LIRKind;
+import java.util.*;
+
+/**
+ * An instance of this class represents an object whose allocation was removed by escape analysis.
+ * The information stored in the {@link VirtualObject} is used during deoptimization to recreate the
+ * object.
+ */
+public final class VirtualObject extends AbstractValue implements JavaValue {
+
+    private final ResolvedJavaType type;
+    private Value[] values;
+    private final int id;
+
+    /**
+     * Creates a new {@link VirtualObject} for the given type, with the given fields. If
+     * {@code type} is an instance class then {@code values} provides the values for the fields
+     * returned by {@link ResolvedJavaType#getInstanceFields(boolean) getInstanceFields(true)}. If
+     * {@code 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 {@link VirtualObject} instance.
+     */
+    public static VirtualObject get(ResolvedJavaType type, Value[] values, int id) {
+        return new VirtualObject(type, values, id);
+    }
+
+    private VirtualObject(ResolvedJavaType type, Value[] values, int id) {
+        super(LIRKind.reference(Kind.Object));
+        this.type = type;
+        this.values = values;
+        this.id = id;
+    }
+
+    private static StringBuilder appendValue(StringBuilder buf, Value value, Set<VirtualObject> visited) {
+        if (value instanceof VirtualObject) {
+            VirtualObject vo = (VirtualObject) value;
+            buf.append("vobject:").append(vo.type.toJavaName(false)).append(':').append(vo.id);
+            if (!visited.contains(vo)) {
+                visited.add(vo);
+                buf.append('{');
+                if (vo.values == null) {
+                    buf.append("<uninitialized>");
+                } else {
+                    if (vo.type.isArray()) {
+                        for (int i = 0; i < vo.values.length; i++) {
+                            if (i != 0) {
+                                buf.append(',');
+                            }
+                            buf.append(i).append('=');
+                            appendValue(buf, vo.values[i], visited);
+                        }
+                    } else {
+                        ResolvedJavaField[] fields = vo.type.getInstanceFields(true);
+                        assert fields.length == vo.values.length : vo.type + ", fields=" + Arrays.toString(fields) + ", values=" + Arrays.toString(vo.values);
+                        for (int i = 0; i < vo.values.length; i++) {
+                            if (i != 0) {
+                                buf.append(',');
+                            }
+                            buf.append(fields[i].getName()).append('=');
+                            appendValue(buf, vo.values[i], visited);
+                        }
+                    }
+                }
+                buf.append('}');
+            }
+        } else {
+            buf.append(value);
+        }
+        return buf;
+    }
+
+    @Override
+    public String toString() {
+        Set<VirtualObject> visited = Collections.newSetFromMap(new IdentityHashMap<VirtualObject, Boolean>());
+        return appendValue(new StringBuilder(), this, visited).toString();
+    }
+
+    /**
+     * Returns the type of the object whose allocation was removed during compilation. This can be
+     * either an instance of an array type.
+     */
+    public ResolvedJavaType getType() {
+        return type;
+    }
+
+    /**
+     * Returns an array containing all the values to be stored into the object when it is recreated.
+     */
+    public Value[] getValues() {
+        return values;
+    }
+
+    /**
+     * Returns the unique id that identifies the object within the debug information for one
+     * position in the compiled code.
+     */
+    public int getId() {
+        return id;
+    }
+
+    private static boolean checkValues(ResolvedJavaType type, Value[] values) {
+        if (values != null) {
+            if (!type.isArray()) {
+                ResolvedJavaField[] fields = type.getInstanceFields(true);
+                int fieldIndex = 0;
+                for (int i = 0; i < values.length; i++) {
+                    ResolvedJavaField field = fields[fieldIndex++];
+                    Kind valKind = values[i].getKind().getStackKind();
+                    if (field.getKind() == Kind.Object) {
+                        assert values[i].getLIRKind().isReference(0) : field + ": " + valKind + " != " + field.getKind();
+                    } else {
+                        if ((valKind == Kind.Double || valKind == Kind.Long) && field.getKind() == Kind.Int) {
+                            assert fields[fieldIndex].getKind() == Kind.Int;
+                            fieldIndex++;
+                        } else {
+                            assert valKind == field.getKind().getStackKind() : field + ": " + valKind + " != " + field.getKind();
+                        }
+                    }
+                }
+                assert fields.length == fieldIndex : type + ": fields=" + Arrays.toString(fields) + ", field values=" + Arrays.toString(values);
+            } else {
+                Kind componentKind = type.getComponentType().getKind().getStackKind();
+                if (componentKind == Kind.Object) {
+                    for (int i = 0; i < values.length; i++) {
+                        assert values[i].getLIRKind().isReference(0) : values[i].getKind() + " != " + componentKind;
+                    }
+                } else {
+                    for (int i = 0; i < values.length; i++) {
+                        assert values[i].getKind() == componentKind || componentKind.getBitCount() >= values[i].getKind().getBitCount() ||
+                                        (componentKind == Kind.Int && values[i].getKind().getBitCount() >= Kind.Int.getBitCount()) : values[i].getKind() + " != " + componentKind;
+                    }
+                }
+            }
+        }
+        return true;
+    }
+
+    /**
+     * 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(Value[] values) {
+        assert checkValues(type, values);
+        this.values = values;
+    }
+
+    @Override
+    public int hashCode() {
+        return getLIRKind().hashCode() + type.hashCode();
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (o == this) {
+            return true;
+        }
+        if (o instanceof VirtualObject) {
+            VirtualObject l = (VirtualObject) o;
+            if (!l.type.equals(type) || l.values.length != values.length) {
+                return false;
+            }
+            for (int i = 0; i < values.length; i++) {
+                /*
+                 * Virtual objects can form cycles. Calling equals() could therefore lead to
+                 * infinite recursion.
+                 */
+                if (!same(values[i], l.values[i])) {
+                    return false;
+                }
+            }
+            return true;
+        }
+        return false;
+    }
+
+    private static boolean same(Object o1, Object o2) {
+        return o1 == o2;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/VirtualStackSlot.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.code;
+
+import com.oracle.jvmci.meta.LIRKind;
+
+/**
+ * {@link VirtualStackSlot}s are stack slots that are not yet fixed to specific frame offset. They
+ * are replaced by real {@link StackSlot}s with a fixed position in the frame before code emission.
+ */
+public abstract class VirtualStackSlot extends StackSlotValue {
+
+    private final int id;
+
+    public VirtualStackSlot(int id, LIRKind lirKind) {
+        super(lirKind);
+        this.id = id;
+    }
+
+    public int getId() {
+        return id;
+    }
+
+    @Override
+    public String toString() {
+        return "vstack:" + id + getKindSuffix();
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = super.hashCode();
+        result = prime * result + id;
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (!super.equals(obj)) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        VirtualStackSlot other = (VirtualStackSlot) obj;
+        if (id != other.id) {
+            return false;
+        }
+        return true;
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/package-info.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,30 @@
+/*
+ * 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 that defines the interface between a Java application that wants to install code and the runtime.
+ * The runtime provides in implementation of the {@link com.oracle.jvmci.code.CodeCacheProvider} interface.
+ * The method {@link com.oracle.jvmci.code.CodeCacheProvider#addMethod(com.oracle.jvmci.meta.ResolvedJavaMethod, CompilationResult, SpeculationLog, InstalledCode)}
+ * can be used to install code for a given method.
+ */
+package com.oracle.jvmci.code;
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/stack/InspectedFrame.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.code.stack;
+
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
+
+public interface InspectedFrame {
+
+    /**
+     * Returns the value of the local at the given index. Currently only works for object values.
+     * This value is a copy iff {@link #isVirtual(int)} is true.
+     */
+    Object getLocal(int index);
+
+    /**
+     * Returns whether the local at the given index is a virtual object, and therefore the object
+     * returned by {@link #getLocal(int)} is a copy.
+     */
+    boolean isVirtual(int index);
+
+    /**
+     * Returns true if the stack frame is a compiled stack frame and there are virtual objects
+     * anywhere in the current state of the compiled method. This can return true even if
+     * {@link #isVirtual(int)} return false for all locals.
+     */
+    boolean hasVirtualObjects();
+
+    /**
+     * This method will materialize all virtual objects, deoptimize the stack frame and make sure
+     * that subsequent execution of the deoptimized frame uses the materialized values.
+     */
+    void materializeVirtualObjects(boolean invalidateCode);
+
+    /**
+     * @return the current bytecode index
+     */
+    int getBytecodeIndex();
+
+    /**
+     * @return the current method
+     */
+    ResolvedJavaMethod getMethod();
+
+    /**
+     * Checks if the current method is equal to the given method. This is semantically equivalent to
+     * {@code method.equals(getMethod())}, but can be implemented more efficiently.
+     */
+    boolean isMethod(ResolvedJavaMethod method);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/stack/InspectedFrameVisitor.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.code.stack;
+
+/**
+ * Callback interface for {@link StackIntrospection#iterateFrames}. Implementations of
+ * {@link #visitFrame} return null to indicate that frame iteration should continue and the next
+ * caller frame should be visited; and return any non-null value to indicate that frame iteration
+ * should stop.
+ */
+public interface InspectedFrameVisitor<T> {
+
+    T visitFrame(InspectedFrame frame);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/stack/StackIntrospection.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.code.stack;
+
+import com.oracle.jvmci.meta.ResolvedJavaMethod;
+
+public interface StackIntrospection {
+
+    /**
+     * Accesses the current stack, providing {@link InspectedFrame}s to the visitor that can be used
+     * to inspect the stack frames' contents. Iteration continues as long as
+     * {@link InspectedFrameVisitor#visitFrame}, which is invoked for every {@link InspectedFrame},
+     * returns null. Any non-null result of the visitor indicates that frame iteration should stop.
+     *
+     * @param initialMethods if this is non-{@code null}, then the stack trace will start at these
+     *            methods
+     * @param matchingMethods if this is non-{@code null}, then only matching stack frames are
+     *            returned
+     * @param initialSkip the number of matching methods to skip (including the initial method)
+     * @param visitor the visitor that is called for every matching method
+     * @return the last result returned by the visitor (which is non-null to indicate that iteration
+     *         should stop), or null if the whole stack was iterated.
+     */
+    <T> T iterateFrames(ResolvedJavaMethod[] initialMethods, ResolvedJavaMethod[] matchingMethods, int initialSkip, InspectedFrameVisitor<T> visitor);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.common/src/com/oracle/jvmci/common/JVMCIError.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,139 @@
+/*
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.common;
+
+import java.util.*;
+
+/**
+ * Indicates a condition in JVMCI related code that should never occur during normal operation.
+ */
+public class JVMCIError extends Error {
+
+    private static final long serialVersionUID = 531632331813456233L;
+    private final ArrayList<String> context = new ArrayList<>();
+
+    public static RuntimeException unimplemented() {
+        throw new JVMCIError("unimplemented");
+    }
+
+    public static RuntimeException unimplemented(String msg) {
+        throw new JVMCIError("unimplemented: %s", msg);
+    }
+
+    public static RuntimeException shouldNotReachHere() {
+        throw new JVMCIError("should not reach here");
+    }
+
+    public static RuntimeException shouldNotReachHere(String msg) {
+        throw new JVMCIError("should not reach here: %s", msg);
+    }
+
+    public static RuntimeException shouldNotReachHere(Throwable cause) {
+        throw new JVMCIError(cause);
+    }
+
+    /**
+     * Checks a given condition and throws a {@link JVMCIError} if it is false. Guarantees are
+     * stronger than assertions in that they are always checked. Error messages for guarantee
+     * violations should clearly indicate the nature of the problem as well as a suggested solution
+     * if possible.
+     *
+     * @param condition the condition to check
+     * @param msg the message that will be associated with the error, in
+     *            {@link String#format(String, Object...)} syntax
+     * @param args arguments to the format string
+     */
+    public static void guarantee(boolean condition, String msg, Object... args) {
+        if (!condition) {
+            throw new JVMCIError("failed guarantee: " + msg, args);
+        }
+    }
+
+    /**
+     * This constructor creates a {@link JVMCIError} with a message assembled via
+     * {@link String#format(String, Object...)}. It always uses the ENGLISH locale in order to
+     * always generate the same output.
+     *
+     * @param msg the message that will be associated with the error, in String.format syntax
+     * @param args parameters to String.format - parameters that implement {@link Iterable} will be
+     *            expanded into a [x, x, ...] representation.
+     */
+    public JVMCIError(String msg, Object... args) {
+        super(format(msg, args));
+    }
+
+    /**
+     * This constructor creates a {@link JVMCIError} for a given causing Throwable instance.
+     *
+     * @param cause the original exception that contains additional information on this error
+     */
+    public JVMCIError(Throwable cause) {
+        super(cause);
+    }
+
+    /**
+     * This constructor creates a {@link JVMCIError} and adds all the
+     * {@linkplain #addContext(String) context} of another {@link JVMCIError}.
+     *
+     * @param e the original {@link JVMCIError}
+     */
+    public JVMCIError(JVMCIError e) {
+        super(e);
+        context.addAll(e.context);
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder str = new StringBuilder();
+        str.append(super.toString());
+        for (String s : context) {
+            str.append("\n\tat ").append(s);
+        }
+        return str.toString();
+    }
+
+    private static String format(String msg, Object... args) {
+        if (args != null) {
+            // expand Iterable parameters into a list representation
+            for (int i = 0; i < args.length; i++) {
+                if (args[i] instanceof Iterable<?>) {
+                    ArrayList<Object> list = new ArrayList<>();
+                    for (Object o : (Iterable<?>) args[i]) {
+                        list.add(o);
+                    }
+                    args[i] = list.toString();
+                }
+            }
+        }
+        return String.format(Locale.ENGLISH, msg, args);
+    }
+
+    public JVMCIError addContext(String newContext) {
+        this.context.add(newContext);
+        return this;
+    }
+
+    public JVMCIError addContext(String name, Object obj) {
+        return addContext(format("%s: %s", name, obj));
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.common/src/com/oracle/jvmci/common/UnsafeAccess.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,95 @@
+/*
+ * 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.jvmci.common;
+
+import java.lang.reflect.*;
+
+import sun.misc.*;
+
+public class UnsafeAccess {
+
+    /**
+     * An instance of {@link Unsafe} for use within Graal.
+     */
+    public static final Unsafe unsafe;
+
+    static {
+        try {
+            Field theUnsafeInstance = Unsafe.class.getDeclaredField("theUnsafe");
+            theUnsafeInstance.setAccessible(true);
+            unsafe = (Unsafe) theUnsafeInstance.get(Unsafe.class);
+        } catch (Exception e) {
+            throw new RuntimeException("exception while trying to get Unsafe", e);
+        }
+    }
+
+    /**
+     * Copies the contents of a {@link String} to a native memory buffer as a {@code '\0'}
+     * terminated C string. The native memory buffer is allocated via
+     * {@link Unsafe#allocateMemory(long)}. The caller is responsible for releasing the buffer when
+     * it is no longer needed via {@link Unsafe#freeMemory(long)}.
+     *
+     * @return the native memory pointer of the C string created from {@code s}
+     */
+    public static long createCString(String s) {
+        return writeCString(s, unsafe.allocateMemory(s.length() + 1));
+    }
+
+    /**
+     * Reads a {@code '\0'} terminated C string from native memory and converts it to a
+     * {@link String}.
+     *
+     * @return a Java string
+     */
+    public static String readCString(long address) {
+        if (address == 0) {
+            return null;
+        }
+        StringBuilder sb = new StringBuilder();
+        for (int i = 0;; i++) {
+            char c = (char) unsafe.getByte(address + i);
+            if (c == 0) {
+                break;
+            }
+            sb.append(c);
+        }
+        return sb.toString();
+    }
+
+    /**
+     * Writes the contents of a {@link String} to a native memory buffer as a {@code '\0'}
+     * terminated C string. The caller is responsible for ensuring the buffer is at least
+     * {@code s.length() + 1} bytes long. The caller is also responsible for releasing the buffer
+     * when it is no longer.
+     *
+     * @return the value of {@code buf}
+     */
+    public static long writeCString(String s, long buf) {
+        int size = s.length();
+        for (int i = 0; i < size; i++) {
+            unsafe.putByte(buf + i, (byte) s.charAt(i));
+        }
+        unsafe.putByte(buf + size, (byte) '\0');
+        return buf;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.debug.test/src/com/oracle/jvmci/debug/test/DebugHistogramTest.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,123 @@
+/*
+ * Copyright (c) 2013, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.debug.test;
+
+import java.io.*;
+
+import org.junit.*;
+
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.debug.internal.*;
+
+public class DebugHistogramTest {
+
+    @Test
+    public void testEmptyHistogram() {
+        DebugHistogram histogram = Debug.createHistogram("TestHistogram");
+        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+
+        new DebugHistogramAsciiPrinter(new PrintStream(outputStream)).print(histogram);
+        String line = outputStream.toString().split("\r?\n")[0];
+        Assert.assertEquals("TestHistogram is empty.", line);
+
+        outputStream.reset();
+        new DebugHistogramRPrinter(new PrintStream(outputStream)).print(histogram);
+        Assert.assertEquals("", outputStream.toString());
+    }
+
+    @Test
+    public void testSingleEntryHistogram() {
+        DebugHistogram histogram = Debug.createHistogram("TestHistogram");
+        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+        histogram.add(new Integer(1));
+        histogram.add(new Integer(1));
+        new DebugHistogramAsciiPrinter(new PrintStream(outputStream)).print(histogram);
+        String[] lines = outputStream.toString().split("\r?\n");
+        // @formatter:off
+        String[] expected = {
+            "TestHistogram has 1 unique elements and 2 total elements:",
+            "--------------------------------------------------------------------------------------------------------------------------------------------------------------------------",
+            "| 1                                                  | 2          | ==================================================================================================== |",
+            "--------------------------------------------------------------------------------------------------------------------------------------------------------------------------"
+        };
+        // @formatter:on
+        Assert.assertArrayEquals(expected, lines);
+
+        outputStream.reset();
+        new DebugHistogramRPrinter(new PrintStream(outputStream)).print(histogram);
+        lines = outputStream.toString().split("\r?\n");
+        // @formatter:off
+        expected = new String[] {
+            "TestHistogram <- c(2);",
+            "names(TestHistogram) <- c(\"1\");"
+        };
+        // @formatter:on
+        Assert.assertArrayEquals(expected, lines);
+    }
+
+    @Test
+    public void testMultipleEntryHistogram() {
+        DebugHistogram histogram = Debug.createHistogram("TestHistogram");
+        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+        histogram.add(new Integer(1));
+        histogram.add(new Integer(2));
+        histogram.add(new Integer(2));
+        new DebugHistogramAsciiPrinter(new PrintStream(outputStream)).print(histogram);
+        String[] lines = outputStream.toString().split("\r?\n");
+        // @formatter:off
+        String[] expected = new String[] {
+            "TestHistogram has 2 unique elements and 3 total elements:",
+            "--------------------------------------------------------------------------------------------------------------------------------------------------------------------------",
+            "| 2                                                  | 2          | ==================================================================================================== |",
+            "| 1                                                  | 1          | ==================================================                                                   |",
+            "--------------------------------------------------------------------------------------------------------------------------------------------------------------------------"
+        };
+        // @formatter:on
+        Assert.assertArrayEquals(expected, lines);
+
+        outputStream.reset();
+        new DebugHistogramRPrinter(new PrintStream(outputStream)).print(histogram);
+        lines = outputStream.toString().split("\r?\n");
+        // @formatter:off
+        expected = new String[] {
+            "TestHistogram <- c(2, 1);",
+            "names(TestHistogram) <- c(\"2\", \"1\");"
+        };
+        // @formatter:on
+        Assert.assertArrayEquals(expected, lines);
+    }
+
+    @Test
+    public void testTooLongValueString() {
+        DebugHistogram histogram = Debug.createHistogram("TestHistogram");
+        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+        histogram.add("MyCustomValue");
+        new DebugHistogramAsciiPrinter(new PrintStream(outputStream), Integer.MAX_VALUE, 10, 10, 1).print(histogram);
+        String[] lines = outputStream.toString().split("\r?\n");
+        Assert.assertEquals(4, lines.length);
+        Assert.assertEquals("TestHistogram has 1 unique elements and 1 total elements:", lines[0]);
+        Assert.assertEquals("----------------------------------------", lines[1]);
+        Assert.assertEquals("| MyCusto... | 1          | ========== |", lines[2]);
+        Assert.assertEquals("----------------------------------------", lines[3]);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.debug.test/src/com/oracle/jvmci/debug/test/DebugTimerTest.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,137 @@
+/*
+ * Copyright (c) 2013, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.debug.test;
+
+import static org.junit.Assert.*;
+
+import java.lang.management.*;
+
+import org.junit.*;
+
+import com.oracle.jvmci.debug.*;
+
+public class DebugTimerTest {
+
+    private static final ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean();
+
+    /**
+     * Actively spins the current thread for at least a given number of milliseconds in such a way
+     * that timers for the current thread keep ticking over.
+     *
+     * @return the number of milliseconds actually spent spinning which is guaranteed to be >=
+     *         {@code ms}
+     */
+    private static long spin(long ms) {
+        long start = threadMXBean.getCurrentThreadCpuTime();
+        do {
+            long durationMS = (threadMXBean.getCurrentThreadCpuTime() - start) / 1000;
+            if (durationMS >= ms) {
+                return durationMS;
+            }
+        } while (true);
+    }
+
+    @Test
+    public void test1() {
+        DebugConfig debugConfig = Debug.fixedConfig(0, 0, false, false, true, false, null, null, System.out);
+        try (DebugConfigScope dcs = new DebugConfigScope(debugConfig); Debug.Scope s = Debug.scope("DebugTimerTest")) {
+
+            DebugTimer timerA = Debug.timer("TimerA");
+            DebugTimer timerB = Debug.timer("TimerB");
+
+            long spinA;
+            long spinB;
+
+            try (DebugCloseable a1 = timerA.start()) {
+                spinA = spin(50);
+                try (DebugCloseable b1 = timerB.start()) {
+                    spinB = spin(50);
+                }
+            }
+
+            Assert.assertTrue(timerB.getCurrentValue() < timerA.getCurrentValue());
+            if (timerA.getFlat() != null && timerB.getFlat() != null) {
+                assertTrue(spinB >= spinA || timerB.getFlat().getCurrentValue() < timerA.getFlat().getCurrentValue());
+                assertEquals(timerA.getFlat().getCurrentValue(), timerA.getCurrentValue() - timerB.getFlat().getCurrentValue(), 10D);
+            }
+        }
+    }
+
+    @Test
+    public void test2() {
+        DebugConfig debugConfig = Debug.fixedConfig(0, 0, false, false, true, false, null, null, System.out);
+        try (DebugConfigScope dcs = new DebugConfigScope(debugConfig); Debug.Scope s = Debug.scope("DebugTimerTest")) {
+            DebugTimer timerC = Debug.timer("TimerC");
+            try (DebugCloseable c1 = timerC.start()) {
+                spin(50);
+                try (DebugCloseable c2 = timerC.start()) {
+                    spin(50);
+                    try (DebugCloseable c3 = timerC.start()) {
+                        spin(50);
+                        try (DebugCloseable c4 = timerC.start()) {
+                            spin(50);
+                            try (DebugCloseable c5 = timerC.start()) {
+                                spin(50);
+                            }
+                        }
+                    }
+                }
+            }
+            if (timerC.getFlat() != null) {
+                assertEquals(timerC.getFlat().getCurrentValue(), timerC.getCurrentValue());
+            }
+        }
+    }
+
+    @Test
+    public void test3() {
+        DebugConfig debugConfig = Debug.fixedConfig(0, 0, false, false, true, false, null, null, System.out);
+        try (DebugConfigScope dcs = new DebugConfigScope(debugConfig); Debug.Scope s = Debug.scope("DebugTimerTest")) {
+
+            DebugTimer timerD = Debug.timer("TimerD");
+            DebugTimer timerE = Debug.timer("TimerE");
+
+            long spinD1;
+            long spinE;
+
+            try (DebugCloseable d1 = timerD.start()) {
+                spinD1 = spin(50);
+                try (DebugCloseable e1 = timerE.start()) {
+                    spinE = spin(50);
+                    try (DebugCloseable d2 = timerD.start()) {
+                        spin(50);
+                        try (DebugCloseable d3 = timerD.start()) {
+                            spin(50);
+                        }
+                    }
+                }
+            }
+
+            Assert.assertTrue(timerE.getCurrentValue() < timerD.getCurrentValue());
+            if (timerD.getFlat() != null && timerE.getFlat() != null) {
+                assertTrue(spinE >= spinD1 || timerE.getFlat().getCurrentValue() < timerD.getFlat().getCurrentValue());
+                assertEquals(timerD.getFlat().getCurrentValue(), timerD.getCurrentValue() - timerE.getFlat().getCurrentValue(), 10D);
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.debug/overview.html	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,36 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+<!--
+
+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.  Oracle designates this
+particular file as subject to the "Classpath" exception as provided
+by Oracle in the LICENSE file that accompanied this code.
+
+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.
+-->
+
+</head>
+<body>
+
+Documentation for the <code>com.oracle.jvmci.debug</code> project.
+
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/AnsiColor.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.debug;
+
+/**
+ * Ansi terminal color escape codes.
+ */
+public final class AnsiColor {
+    /** Foreground black. */
+    public static final String BLACK = "\u001b[30m";
+    /** Foreground red. */
+    public static final String RED = "\u001b[31m";
+    /** Foreground green. */
+    public static final String GREEN = "\u001b[32m";
+    /** Foreground yellow. */
+    public static final String YELLOW = "\u001b[33m";
+    /** Foreground blue. */
+    public static final String BLUE = "\u001b[34m";
+    /** Foreground magenta. */
+    public static final String MAGENTA = "\u001b[35m";
+    /** Foreground cyan. */
+    public static final String CYAN = "\u001b[36m";
+    /** Foreground white. */
+    public static final String WHITE = "\u001b[37m";
+
+    /** Foreground bold black. */
+    public static final String BOLD_BLACK = "\u001b[30;1m";
+    /** Foreground bold red. */
+    public static final String BOLD_RED = "\u001b[31;1m";
+    /** Foreground bold green. */
+    public static final String BOLD_GREEN = "\u001b[32;1m";
+    /** Foreground bold yellow. */
+    public static final String BOLD_YELLOW = "\u001b[33;1m";
+    /** Foreground bold blue. */
+    public static final String BOLD_BLUE = "\u001b[34;1m";
+    /** Foreground bold magenta. */
+    public static final String BOLD_MAGENTA = "\u001b[35;1m";
+    /** Foreground bold cyan. */
+    public static final String BOLD_CYAN = "\u001b[36;1m";
+    /** Foreground bold white. */
+    public static final String BOLD_WHITE = "\u001b[37;1m";
+
+    /** Background black. */
+    public static final String BG_BLACK = "\u001b[40m";
+    /** Background red. */
+    public static final String BG_RED = "\u001b[41m";
+    /** Background green. */
+    public static final String BG_GREEN = "\u001b[42m";
+    /** Background yellow. */
+    public static final String BG_YELLOW = "\u001b[43m";
+    /** Background blue. */
+    public static final String BG_BLUE = "\u001b[44m";
+    /** Background magenta. */
+    public static final String BG_MAGENTA = "\u001b[45m";
+    /** Background cyan. */
+    public static final String BG_CYAN = "\u001b[46m";
+    /** Background white. */
+    public static final String BG_WHITE = "\u001b[47m";
+
+    /** Reset. */
+    public static final String RESET = "\u001b[0m";
+    /** Underline. */
+    public static final String UNDERLINED = "\u001b[4m";
+
+    /** Prevent instantiation. */
+    private AnsiColor() {
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/Debug.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,1544 @@
+/*
+ * 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.jvmci.debug;
+
+import static com.oracle.jvmci.debug.Debug.Initialization.*;
+import static com.oracle.jvmci.debug.DelegatingDebugConfig.Feature.*;
+import static java.util.FormattableFlags.*;
+
+import java.io.*;
+import java.util.*;
+import java.util.concurrent.*;
+
+import com.oracle.jvmci.debug.DelegatingDebugConfig.Level;
+import com.oracle.jvmci.debug.internal.*;
+
+/**
+ * Scope based debugging facility. This facility is {@link #isEnabled()} if assertions are enabled
+ * for the {@link Debug} class or the {@value Initialization#INITIALIZER_PROPERTY_NAME} system
+ * property is {@code "true"} when {@link Debug} is initialized.
+ */
+public class Debug {
+
+    /**
+     * Class to assist with initialization of {@link Debug}.
+     */
+    public static class Initialization {
+
+        public static final String INITIALIZER_PROPERTY_NAME = "jvmci.debug.enable";
+
+        private static boolean initialized;
+
+        /**
+         * Determines if {@link Debug} has been initialized.
+         */
+        public static boolean isDebugInitialized() {
+            return initialized;
+        }
+
+    }
+
+    @SuppressWarnings("all")
+    private static boolean initialize() {
+        boolean assertionsEnabled = false;
+        assert assertionsEnabled = true;
+        Initialization.initialized = true;
+        return assertionsEnabled || Boolean.getBoolean(INITIALIZER_PROPERTY_NAME);
+    }
+
+    private static final boolean ENABLED = initialize();
+
+    public static boolean isEnabled() {
+        return ENABLED;
+    }
+
+    public static boolean isDumpEnabledForMethod() {
+        if (!ENABLED) {
+            return false;
+        }
+        DebugConfig config = DebugScope.getConfig();
+        if (config == null) {
+            return false;
+        }
+        return config.isDumpEnabledForMethod();
+    }
+
+    public static final int DEFAULT_LOG_LEVEL = 2;
+
+    public static boolean isDumpEnabled() {
+        return isDumpEnabled(DEFAULT_LOG_LEVEL);
+    }
+
+    public static boolean isDumpEnabled(int dumpLevel) {
+        return ENABLED && DebugScope.getInstance().isDumpEnabled(dumpLevel);
+    }
+
+    /**
+     * Determines if verification is enabled in the current method, regardless of the
+     * {@linkplain Debug#currentScope() current debug scope}.
+     *
+     * @see Debug#verify(Object, String)
+     */
+    public static boolean isVerifyEnabledForMethod() {
+        if (!ENABLED) {
+            return false;
+        }
+        DebugConfig config = DebugScope.getConfig();
+        if (config == null) {
+            return false;
+        }
+        return config.isVerifyEnabledForMethod();
+    }
+
+    /**
+     * Determines if verification is enabled in the {@linkplain Debug#currentScope() current debug
+     * scope}.
+     *
+     * @see Debug#verify(Object, String)
+     */
+    public static boolean isVerifyEnabled() {
+        return ENABLED && DebugScope.getInstance().isVerifyEnabled();
+    }
+
+    public static boolean isMeterEnabled() {
+        return ENABLED && DebugScope.getInstance().isMeterEnabled();
+    }
+
+    public static boolean isTimeEnabled() {
+        return ENABLED && DebugScope.getInstance().isTimeEnabled();
+    }
+
+    public static boolean isMemUseTrackingEnabled() {
+        return ENABLED && DebugScope.getInstance().isMemUseTrackingEnabled();
+    }
+
+    public static boolean isLogEnabledForMethod() {
+        if (!ENABLED) {
+            return false;
+        }
+        DebugConfig config = DebugScope.getConfig();
+        if (config == null) {
+            return false;
+        }
+        return config.isLogEnabledForMethod();
+    }
+
+    public static boolean isLogEnabled() {
+        return isLogEnabled(DEFAULT_LOG_LEVEL);
+    }
+
+    public static boolean isLogEnabled(int logLevel) {
+        return ENABLED && DebugScope.getInstance().isLogEnabled(logLevel);
+    }
+
+    @SuppressWarnings("unused")
+    public static Runnable decorateDebugRoot(Runnable runnable, String name, DebugConfig config) {
+        return runnable;
+    }
+
+    @SuppressWarnings("unused")
+    public static <T> Callable<T> decorateDebugRoot(Callable<T> callable, String name, DebugConfig config) {
+        return callable;
+    }
+
+    @SuppressWarnings("unused")
+    public static Runnable decorateScope(Runnable runnable, String name, Object... context) {
+        return runnable;
+    }
+
+    @SuppressWarnings("unused")
+    public static <T> Callable<T> decorateScope(Callable<T> callable, String name, Object... context) {
+        return callable;
+    }
+
+    /**
+     * Gets a string composed of the names in the current nesting of debug
+     * {@linkplain #scope(Object) scopes} separated by {@code '.'}.
+     */
+    public static String currentScope() {
+        if (ENABLED) {
+            return DebugScope.getInstance().getQualifiedName();
+        } else {
+            return "";
+        }
+    }
+
+    /**
+     * Represents a debug scope entered by {@link Debug#scope(Object)} or
+     * {@link Debug#sandbox(CharSequence, DebugConfig, Object...)}. Leaving the scope is achieved
+     * via {@link #close()}.
+     */
+    public interface Scope extends AutoCloseable {
+        void close();
+    }
+
+    /**
+     * Creates and enters a new debug scope which will be a child of the current debug scope.
+     * <p>
+     * It is recommended to use the try-with-resource statement for managing entering and leaving
+     * debug scopes. For example:
+     *
+     * <pre>
+     * try (Scope s = Debug.scope(&quot;InliningGraph&quot;, inlineeGraph)) {
+     *     ...
+     * } catch (Throwable e) {
+     *     throw Debug.handle(e);
+     * }
+     * </pre>
+     *
+     * The {@code name} argument is subject to the following type based conversion before having
+     * {@link Object#toString()} called on it:
+     *
+     * <pre>
+     *     Type          | Conversion
+     * ------------------+-----------------
+     *  java.lang.Class  | arg.getSimpleName()
+     *                   |
+     * </pre>
+     *
+     * @param name the name of the new scope
+     * @param contextObjects an array of object to be appended to the {@linkplain #context()
+     *            current} debug context
+     * @throws Throwable used to enforce a catch block.
+     * @return the scope entered by this method which will be exited when its {@link Scope#close()}
+     *         method is called
+     */
+    public static Scope scope(Object name, Object[] contextObjects) throws Throwable {
+        if (ENABLED) {
+            return DebugScope.getInstance().scope(convertFormatArg(name).toString(), null, contextObjects);
+        } else {
+            return null;
+        }
+    }
+
+    /**
+     * Similar to {@link #scope(Object, Object[])} but without context objects. Therefore the catch
+     * block can be omitted.
+     *
+     * @see #scope(Object, Object[])
+     */
+    public static Scope scope(Object name) {
+        if (ENABLED) {
+            return DebugScope.getInstance().scope(convertFormatArg(name).toString(), null);
+        } else {
+            return null;
+        }
+    }
+
+    /**
+     * @see #scope(Object, Object[])
+     * @param context an object to be appended to the {@linkplain #context() current} debug context
+     */
+    public static Scope scope(Object name, Object context) throws Throwable {
+        if (ENABLED) {
+            return DebugScope.getInstance().scope(convertFormatArg(name).toString(), null, context);
+        } else {
+            return null;
+        }
+    }
+
+    /**
+     * @see #scope(Object, Object[])
+     * @param context1 first object to be appended to the {@linkplain #context() current} debug
+     *            context
+     * @param context2 second object to be appended to the {@linkplain #context() current} debug
+     *            context
+     */
+    public static Scope scope(Object name, Object context1, Object context2) throws Throwable {
+        if (ENABLED) {
+            return DebugScope.getInstance().scope(convertFormatArg(name).toString(), null, context1, context2);
+        } else {
+            return null;
+        }
+    }
+
+    /**
+     * @see #scope(Object, Object[])
+     * @param context1 first object to be appended to the {@linkplain #context() current} debug
+     *            context
+     * @param context2 second object to be appended to the {@linkplain #context() current} debug
+     *            context
+     * @param context3 third object to be appended to the {@linkplain #context() current} debug
+     *            context
+     */
+    public static Scope scope(Object name, Object context1, Object context2, Object context3) throws Throwable {
+        if (ENABLED) {
+            return DebugScope.getInstance().scope(convertFormatArg(name).toString(), null, context1, context2, context3);
+        } else {
+            return null;
+        }
+    }
+
+    /**
+     * Creates and enters a new debug scope which will be disjoint from the current debug scope.
+     * <p>
+     * It is recommended to use the try-with-resource statement for managing entering and leaving
+     * debug scopes. For example:
+     *
+     * <pre>
+     * try (Scope s = Debug.sandbox(&quot;CompilingStub&quot;, null, stubGraph)) {
+     *     ...
+     * } catch (Throwable e) {
+     *     throw Debug.handle(e);
+     * }
+     * </pre>
+     *
+     * @param name the name of the new scope
+     * @param config the debug configuration to use for the new scope
+     * @param context objects to be appended to the {@linkplain #context() current} debug context
+     * @return the scope entered by this method which will be exited when its {@link Scope#close()}
+     *         method is called
+     */
+    public static Scope sandbox(CharSequence name, DebugConfig config, Object... context) throws Throwable {
+        if (ENABLED) {
+            DebugConfig sandboxConfig = config == null ? silentConfig() : config;
+            return DebugScope.getInstance().scope(name, sandboxConfig, context);
+        } else {
+            return null;
+        }
+    }
+
+    public static Scope forceLog() throws Throwable {
+        ArrayList<Object> context = new ArrayList<>();
+        for (Object obj : context()) {
+            context.add(obj);
+        }
+        return Debug.sandbox("forceLog", new DelegatingDebugConfig().override(Level.LOG, Integer.MAX_VALUE).enable(LOG_METHOD), context.toArray());
+    }
+
+    /**
+     * Opens a scope in which exception {@linkplain DebugConfig#interceptException(Throwable)
+     * interception} is disabled. It is recommended to use the try-with-resource statement for
+     * managing entering and leaving such scopes:
+     *
+     * <pre>
+     * try (DebugConfigScope s = Debug.disableIntercept()) {
+     *     ...
+     * }
+     * </pre>
+     *
+     * This is particularly useful to suppress extraneous output in JUnit tests that are expected to
+     * throw an exception.
+     */
+    public static DebugConfigScope disableIntercept() {
+        return Debug.setConfig(new DelegatingDebugConfig().disable(INTERCEPT));
+    }
+
+    /**
+     * Handles an exception in the context of the debug scope just exited. The just exited scope
+     * must have the current scope as its parent which will be the case if the try-with-resource
+     * pattern recommended by {@link #scope(Object)} and
+     * {@link #sandbox(CharSequence, DebugConfig, Object...)} is used
+     *
+     * @see #scope(Object, Object[])
+     * @see #sandbox(CharSequence, DebugConfig, Object...)
+     */
+    public static RuntimeException handle(Throwable exception) {
+        if (ENABLED) {
+            return DebugScope.getInstance().handle(exception);
+        } else {
+            if (exception instanceof Error) {
+                throw (Error) exception;
+            }
+            if (exception instanceof RuntimeException) {
+                throw (RuntimeException) exception;
+            }
+            throw new RuntimeException(exception);
+        }
+    }
+
+    public static void log(String msg) {
+        log(DEFAULT_LOG_LEVEL, msg);
+    }
+
+    /**
+     * Prints a message to the current debug scope's logging stream if logging is enabled.
+     *
+     * @param msg the message to log
+     */
+    public static void log(int logLevel, String msg) {
+        if (ENABLED) {
+            DebugScope.getInstance().log(logLevel, msg);
+        }
+    }
+
+    public static void log(String format, Object arg) {
+        log(DEFAULT_LOG_LEVEL, format, arg);
+    }
+
+    /**
+     * Prints a message to the current debug scope's logging stream if logging is enabled.
+     *
+     * @param format a format string
+     * @param arg the argument referenced by the format specifiers in {@code format}
+     */
+    public static void log(int logLevel, String format, Object arg) {
+        if (ENABLED) {
+            DebugScope.getInstance().log(logLevel, format, arg);
+        }
+    }
+
+    public static void log(String format, int arg) {
+        log(DEFAULT_LOG_LEVEL, format, arg);
+    }
+
+    /**
+     * Prints a message to the current debug scope's logging stream if logging is enabled.
+     *
+     * @param format a format string
+     * @param arg the argument referenced by the format specifiers in {@code format}
+     */
+    public static void log(int logLevel, String format, int arg) {
+        if (ENABLED) {
+            DebugScope.getInstance().log(logLevel, format, arg);
+        }
+    }
+
+    public static void log(String format, Object arg1, Object arg2) {
+        log(DEFAULT_LOG_LEVEL, format, arg1, arg2);
+    }
+
+    /**
+     * @see #log(int, String, Object)
+     */
+    public static void log(int logLevel, String format, Object arg1, Object arg2) {
+        if (ENABLED) {
+            DebugScope.getInstance().log(logLevel, format, arg1, arg2);
+        }
+    }
+
+    public static void log(String format, int arg1, Object arg2) {
+        log(DEFAULT_LOG_LEVEL, format, arg1, arg2);
+    }
+
+    /**
+     * @see #log(int, String, Object)
+     */
+    public static void log(int logLevel, String format, int arg1, Object arg2) {
+        if (ENABLED) {
+            DebugScope.getInstance().log(logLevel, format, arg1, arg2);
+        }
+    }
+
+    public static void log(String format, Object arg1, int arg2) {
+        log(DEFAULT_LOG_LEVEL, format, arg1, arg2);
+    }
+
+    /**
+     * @see #log(int, String, Object)
+     */
+    public static void log(int logLevel, String format, Object arg1, int arg2) {
+        if (ENABLED) {
+            DebugScope.getInstance().log(logLevel, format, arg1, arg2);
+        }
+    }
+
+    public static void log(String format, int arg1, int arg2) {
+        log(DEFAULT_LOG_LEVEL, format, arg1, arg2);
+    }
+
+    /**
+     * @see #log(int, String, Object)
+     */
+    public static void log(int logLevel, String format, int arg1, int arg2) {
+        if (ENABLED) {
+            DebugScope.getInstance().log(logLevel, format, arg1, arg2);
+        }
+    }
+
+    public static void log(String format, Object arg1, Object arg2, Object arg3) {
+        log(DEFAULT_LOG_LEVEL, format, arg1, arg2, arg3);
+    }
+
+    /**
+     * @see #log(int, String, Object)
+     */
+    public static void log(int logLevel, String format, Object arg1, Object arg2, Object arg3) {
+        if (ENABLED) {
+            DebugScope.getInstance().log(logLevel, format, arg1, arg2, arg3);
+        }
+    }
+
+    public static void log(String format, int arg1, int arg2, int arg3) {
+        log(DEFAULT_LOG_LEVEL, format, arg1, arg2, arg3);
+    }
+
+    /**
+     * @see #log(int, String, Object)
+     */
+    public static void log(int logLevel, String format, int arg1, int arg2, int arg3) {
+        if (ENABLED) {
+            DebugScope.getInstance().log(logLevel, format, arg1, arg2, arg3);
+        }
+    }
+
+    public static void log(String format, Object arg1, Object arg2, Object arg3, Object arg4) {
+        log(DEFAULT_LOG_LEVEL, format, arg1, arg2, arg3, arg4);
+    }
+
+    /**
+     * @see #log(int, String, Object)
+     */
+    public static void log(int logLevel, String format, Object arg1, Object arg2, Object arg3, Object arg4) {
+        if (ENABLED) {
+            DebugScope.getInstance().log(logLevel, format, arg1, arg2, arg3, arg4);
+        }
+    }
+
+    public static void log(String format, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5) {
+        log(DEFAULT_LOG_LEVEL, format, arg1, arg2, arg3, arg4, arg5);
+    }
+
+    /**
+     * @see #log(int, String, Object)
+     */
+    public static void log(int logLevel, String format, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5) {
+        if (ENABLED) {
+            DebugScope.getInstance().log(logLevel, format, arg1, arg2, arg3, arg4, arg5);
+        }
+    }
+
+    public static void log(String format, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6) {
+        log(DEFAULT_LOG_LEVEL, format, arg1, arg2, arg3, arg4, arg5, arg6);
+    }
+
+    /**
+     * @see #log(int, String, Object)
+     */
+    public static void log(int logLevel, String format, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6) {
+        if (ENABLED) {
+            DebugScope.getInstance().log(logLevel, format, arg1, arg2, arg3, arg4, arg5, arg6);
+        }
+    }
+
+    public static void log(String format, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7) {
+        log(DEFAULT_LOG_LEVEL, format, arg1, arg2, arg3, arg4, arg5, arg6, arg7);
+    }
+
+    public static void log(String format, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7, Object arg8) {
+        log(DEFAULT_LOG_LEVEL, format, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);
+    }
+
+    /**
+     * @see #log(int, String, Object)
+     */
+    public static void log(int logLevel, String format, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7) {
+        if (ENABLED) {
+            DebugScope.getInstance().log(logLevel, format, arg1, arg2, arg3, arg4, arg5, arg6, arg7);
+        }
+    }
+
+    public static void log(int logLevel, String format, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7, Object arg8) {
+        if (ENABLED) {
+            DebugScope.getInstance().log(logLevel, format, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);
+        }
+    }
+
+    public static void logv(String format, Object... args) {
+        logv(DEFAULT_LOG_LEVEL, format, args);
+    }
+
+    /**
+     * Prints a message to the current debug scope's logging stream. This method must only be called
+     * if debugging is {@linkplain Debug#isEnabled() enabled} as it incurs allocation at the call
+     * site. If possible, call one of the other {@code log()} methods in this class that take a
+     * fixed number of parameters.
+     *
+     * @param format a format string
+     * @param args the arguments referenced by the format specifiers in {@code format}
+     */
+    public static void logv(int logLevel, String format, Object... args) {
+        if (!ENABLED) {
+            throw new InternalError("Use of Debug.logv() must be guarded by a test of Debug.isEnabled()");
+        }
+        DebugScope.getInstance().log(logLevel, format, args);
+    }
+
+    /**
+     * This override exists to catch cases when {@link #log(String, Object)} is called with one
+     * argument bound to a varargs method parameter. It will bind to this method instead of the
+     * single arg variant and produce a deprecation warning instead of silently wrapping the
+     * Object[] inside of another Object[].
+     */
+    @Deprecated
+    public static void log(String format, Object[] args) {
+        assert false : "shouldn't use this";
+        log(DEFAULT_LOG_LEVEL, format, args);
+    }
+
+    /**
+     * This override exists to catch cases when {@link #log(int, String, Object)} is called with one
+     * argument bound to a varargs method parameter. It will bind to this method instead of the
+     * single arg variant and produce a deprecation warning instead of silently wrapping the
+     * Object[] inside of another Object[].
+     */
+    @Deprecated
+    public static void log(int logLevel, String format, Object[] args) {
+        assert false : "shouldn't use this";
+        logv(logLevel, format, args);
+    }
+
+    public static void dump(Object object, String msg) {
+        dump(DEFAULT_LOG_LEVEL, object, msg);
+    }
+
+    public static void dump(int dumpLevel, Object object, String msg) {
+        if (ENABLED && DebugScope.getInstance().isDumpEnabled(dumpLevel)) {
+            DebugScope.getInstance().dump(dumpLevel, object, msg);
+        }
+    }
+
+    public static void dump(Object object, String format, Object arg) {
+        dump(DEFAULT_LOG_LEVEL, object, format, arg);
+    }
+
+    public static void dump(int dumpLevel, Object object, String format, Object arg) {
+        if (ENABLED && DebugScope.getInstance().isDumpEnabled(dumpLevel)) {
+            DebugScope.getInstance().dump(dumpLevel, object, format, arg);
+        }
+    }
+
+    public static void dump(Object object, String format, Object arg1, Object arg2) {
+        dump(DEFAULT_LOG_LEVEL, object, format, arg1, arg2);
+    }
+
+    public static void dump(int dumpLevel, Object object, String format, Object arg1, Object arg2) {
+        if (ENABLED && DebugScope.getInstance().isDumpEnabled(dumpLevel)) {
+            DebugScope.getInstance().dump(dumpLevel, object, format, arg1, arg2);
+        }
+    }
+
+    public static void dump(Object object, String format, Object arg1, Object arg2, Object arg3) {
+        dump(DEFAULT_LOG_LEVEL, object, format, arg1, arg2, arg3);
+    }
+
+    public static void dump(int dumpLevel, Object object, String format, Object arg1, Object arg2, Object arg3) {
+        if (ENABLED && DebugScope.getInstance().isDumpEnabled(dumpLevel)) {
+            DebugScope.getInstance().dump(dumpLevel, object, format, arg1, arg2, arg3);
+        }
+    }
+
+    /**
+     * This override exists to catch cases when {@link #dump(Object, String, Object)} is called with
+     * one argument bound to a varargs method parameter. It will bind to this method instead of the
+     * single arg variant and produce a deprecation warning instead of silently wrapping the
+     * Object[] inside of another Object[].
+     */
+    @Deprecated
+    public static void dump(Object object, String format, Object[] args) {
+        assert false : "shouldn't use this";
+        dump(DEFAULT_LOG_LEVEL, object, format, args);
+    }
+
+    /**
+     * This override exists to catch cases when {@link #dump(int, Object, String, Object)} is called
+     * with one argument bound to a varargs method parameter. It will bind to this method instead of
+     * the single arg variant and produce a deprecation warning instead of silently wrapping the
+     * Object[] inside of another Object[].
+     */
+    @Deprecated
+    public static void dump(int dumpLevel, Object object, String format, Object[] args) {
+        assert false : "shouldn't use this";
+        if (ENABLED && DebugScope.getInstance().isDumpEnabled(dumpLevel)) {
+            DebugScope.getInstance().dump(dumpLevel, object, format, args);
+        }
+    }
+
+    /**
+     * Calls all {@link DebugVerifyHandler}s in the current {@linkplain DebugScope#getConfig()
+     * config} to perform verification on a given object.
+     *
+     * @param object object to verify
+     * @param message description of verification context
+     *
+     * @see DebugVerifyHandler#verify(Object, String)
+     */
+    public static void verify(Object object, String message) {
+        if (ENABLED && DebugScope.getInstance().isVerifyEnabled()) {
+            DebugScope.getInstance().verify(object, message);
+        }
+    }
+
+    /**
+     * Calls all {@link DebugVerifyHandler}s in the current {@linkplain DebugScope#getConfig()
+     * config} to perform verification on a given object.
+     *
+     * @param object object to verify
+     * @param format a format string for the description of the verification context
+     * @param arg the argument referenced by the format specifiers in {@code format}
+     *
+     * @see DebugVerifyHandler#verify(Object, String)
+     */
+    public static void verify(Object object, String format, Object arg) {
+        if (ENABLED && DebugScope.getInstance().isVerifyEnabled()) {
+            DebugScope.getInstance().verify(object, format, arg);
+        }
+    }
+
+    /**
+     * This override exists to catch cases when {@link #verify(Object, String, Object)} is called
+     * with one argument bound to a varargs method parameter. It will bind to this method instead of
+     * the single arg variant and produce a deprecation warning instead of silently wrapping the
+     * Object[] inside of another Object[].
+     */
+    @Deprecated
+    public static void verify(Object object, String format, Object[] args) {
+        assert false : "shouldn't use this";
+        if (ENABLED && DebugScope.getInstance().isVerifyEnabled()) {
+            DebugScope.getInstance().verify(object, format, args);
+        }
+    }
+
+    /**
+     * Opens a new indentation level (by adding some spaces) based on the current indentation level.
+     * This should be used in a {@linkplain Indent try-with-resources} pattern.
+     *
+     * @return an object that reverts to the current indentation level when
+     *         {@linkplain Indent#close() closed} or null if debugging is disabled
+     * @see #logAndIndent(int, String)
+     * @see #logAndIndent(int, String, Object)
+     */
+    public static Indent indent() {
+        if (ENABLED) {
+            DebugScope scope = DebugScope.getInstance();
+            return scope.pushIndentLogger();
+        }
+        return null;
+    }
+
+    public static Indent logAndIndent(String msg) {
+        return logAndIndent(DEFAULT_LOG_LEVEL, msg);
+    }
+
+    /**
+     * A convenience function which combines {@link #log(String)} and {@link #indent()}.
+     *
+     * @param msg the message to log
+     * @return an object that reverts to the current indentation level when
+     *         {@linkplain Indent#close() closed} or null if debugging is disabled
+     */
+    public static Indent logAndIndent(int logLevel, String msg) {
+        if (ENABLED && Debug.isLogEnabled(logLevel)) {
+            return logvAndIndentInternal(logLevel, msg);
+        }
+        return null;
+    }
+
+    public static Indent logAndIndent(String format, Object arg) {
+        return logAndIndent(DEFAULT_LOG_LEVEL, format, arg);
+    }
+
+    /**
+     * A convenience function which combines {@link #log(String, Object)} and {@link #indent()}.
+     *
+     * @param format a format string
+     * @param arg the argument referenced by the format specifiers in {@code format}
+     * @return an object that reverts to the current indentation level when
+     *         {@linkplain Indent#close() closed} or null if debugging is disabled
+     */
+    public static Indent logAndIndent(int logLevel, String format, Object arg) {
+        if (ENABLED && Debug.isLogEnabled(logLevel)) {
+            return logvAndIndentInternal(logLevel, format, arg);
+        }
+        return null;
+    }
+
+    public static Indent logAndIndent(String format, int arg) {
+        return logAndIndent(DEFAULT_LOG_LEVEL, format, arg);
+    }
+
+    /**
+     * A convenience function which combines {@link #log(String, Object)} and {@link #indent()}.
+     *
+     * @param format a format string
+     * @param arg the argument referenced by the format specifiers in {@code format}
+     * @return an object that reverts to the current indentation level when
+     *         {@linkplain Indent#close() closed} or null if debugging is disabled
+     */
+    public static Indent logAndIndent(int logLevel, String format, int arg) {
+        if (ENABLED && Debug.isLogEnabled(logLevel)) {
+            return logvAndIndentInternal(logLevel, format, arg);
+        }
+        return null;
+    }
+
+    public static Indent logAndIndent(String format, int arg1, Object arg2) {
+        return logAndIndent(DEFAULT_LOG_LEVEL, format, arg1, arg2);
+    }
+
+    /**
+     * @see #logAndIndent(int, String, Object)
+     */
+    public static Indent logAndIndent(int logLevel, String format, int arg1, Object arg2) {
+        if (ENABLED && Debug.isLogEnabled(logLevel)) {
+            return logvAndIndentInternal(logLevel, format, arg1, arg2);
+        }
+        return null;
+    }
+
+    public static Indent logAndIndent(String format, Object arg1, int arg2) {
+        return logAndIndent(DEFAULT_LOG_LEVEL, format, arg1, arg2);
+    }
+
+    /**
+     * @see #logAndIndent(int, String, Object)
+     */
+    public static Indent logAndIndent(int logLevel, String format, Object arg1, int arg2) {
+        if (ENABLED && Debug.isLogEnabled(logLevel)) {
+            return logvAndIndentInternal(logLevel, format, arg1, arg2);
+        }
+        return null;
+    }
+
+    public static Indent logAndIndent(String format, int arg1, int arg2) {
+        return logAndIndent(DEFAULT_LOG_LEVEL, format, arg1, arg2);
+    }
+
+    /**
+     * @see #logAndIndent(int, String, Object)
+     */
+    public static Indent logAndIndent(int logLevel, String format, int arg1, int arg2) {
+        if (ENABLED && Debug.isLogEnabled(logLevel)) {
+            return logvAndIndentInternal(logLevel, format, arg1, arg2);
+        }
+        return null;
+    }
+
+    public static Indent logAndIndent(String format, Object arg1, Object arg2) {
+        return logAndIndent(DEFAULT_LOG_LEVEL, format, arg1, arg2);
+    }
+
+    /**
+     * @see #logAndIndent(int, String, Object)
+     */
+    public static Indent logAndIndent(int logLevel, String format, Object arg1, Object arg2) {
+        if (ENABLED && Debug.isLogEnabled(logLevel)) {
+            return logvAndIndentInternal(logLevel, format, arg1, arg2);
+        }
+        return null;
+    }
+
+    public static Indent logAndIndent(String format, Object arg1, Object arg2, Object arg3) {
+        return logAndIndent(DEFAULT_LOG_LEVEL, format, arg1, arg2, arg3);
+    }
+
+    /**
+     * @see #logAndIndent(int, String, Object)
+     */
+    public static Indent logAndIndent(int logLevel, String format, Object arg1, Object arg2, Object arg3) {
+        if (ENABLED && Debug.isLogEnabled(logLevel)) {
+            return logvAndIndentInternal(logLevel, format, arg1, arg2, arg3);
+        }
+        return null;
+    }
+
+    public static Indent logAndIndent(String format, int arg1, int arg2, int arg3) {
+        return logAndIndent(DEFAULT_LOG_LEVEL, format, arg1, arg2, arg3);
+    }
+
+    /**
+     * @see #logAndIndent(int, String, Object)
+     */
+    public static Indent logAndIndent(int logLevel, String format, int arg1, int arg2, int arg3) {
+        if (ENABLED && Debug.isLogEnabled(logLevel)) {
+            return logvAndIndentInternal(logLevel, format, arg1, arg2, arg3);
+        }
+        return null;
+    }
+
+    public static Indent logAndIndent(String format, Object arg1, int arg2, int arg3) {
+        return logAndIndent(DEFAULT_LOG_LEVEL, format, arg1, arg2, arg3);
+    }
+
+    /**
+     * @see #logAndIndent(int, String, Object)
+     */
+    public static Indent logAndIndent(int logLevel, String format, Object arg1, int arg2, int arg3) {
+        if (ENABLED && Debug.isLogEnabled(logLevel)) {
+            return logvAndIndentInternal(logLevel, format, arg1, arg2, arg3);
+        }
+        return null;
+    }
+
+    public static Indent logAndIndent(String format, Object arg1, Object arg2, Object arg3, Object arg4) {
+        return logAndIndent(DEFAULT_LOG_LEVEL, format, arg1, arg2, arg3, arg4);
+    }
+
+    /**
+     * @see #logAndIndent(int, String, Object)
+     */
+    public static Indent logAndIndent(int logLevel, String format, Object arg1, Object arg2, Object arg3, Object arg4) {
+        if (ENABLED && Debug.isLogEnabled(logLevel)) {
+            return logvAndIndentInternal(logLevel, format, arg1, arg2, arg3, arg4);
+        }
+        return null;
+    }
+
+    public static Indent logAndIndent(String format, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5) {
+        return logAndIndent(DEFAULT_LOG_LEVEL, format, arg1, arg2, arg3, arg4, arg5);
+    }
+
+    /**
+     * @see #logAndIndent(int, String, Object)
+     */
+    public static Indent logAndIndent(int logLevel, String format, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5) {
+        if (ENABLED && Debug.isLogEnabled(logLevel)) {
+            return logvAndIndentInternal(logLevel, format, arg1, arg2, arg3, arg4, arg5);
+        }
+        return null;
+    }
+
+    public static Indent logAndIndent(String format, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6) {
+        return logAndIndent(DEFAULT_LOG_LEVEL, format, arg1, arg2, arg3, arg4, arg5, arg6);
+    }
+
+    /**
+     * @see #logAndIndent(int, String, Object)
+     */
+    public static Indent logAndIndent(int logLevel, String format, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6) {
+        if (ENABLED && Debug.isLogEnabled(logLevel)) {
+            return logvAndIndentInternal(logLevel, format, arg1, arg2, arg3, arg4, arg5, arg6);
+        }
+        return null;
+    }
+
+    /**
+     * A convenience function which combines {@link #logv(int, String, Object...)} and
+     * {@link #indent()}.
+     *
+     * @param format a format string
+     * @param args the arguments referenced by the format specifiers in {@code format}
+     * @return an object that reverts to the current indentation level when
+     *         {@linkplain Indent#close() closed} or null if debugging is disabled
+     */
+    public static Indent logvAndIndent(int logLevel, String format, Object... args) {
+        if (ENABLED) {
+            if (Debug.isLogEnabled(logLevel)) {
+                return logvAndIndentInternal(logLevel, format, args);
+            }
+            return null;
+        }
+        throw new InternalError("Use of Debug.logvAndIndent() must be guarded by a test of Debug.isEnabled()");
+    }
+
+    private static Indent logvAndIndentInternal(int logLevel, String format, Object... args) {
+        assert ENABLED && Debug.isLogEnabled(logLevel) : "must have checked Debug.isLogEnabled()";
+        DebugScope scope = DebugScope.getInstance();
+        scope.log(logLevel, format, args);
+        return scope.pushIndentLogger();
+    }
+
+    /**
+     * This override exists to catch cases when {@link #logAndIndent(String, Object)} is called with
+     * one argument bound to a varargs method parameter. It will bind to this method instead of the
+     * single arg variant and produce a deprecation warning instead of silently wrapping the
+     * Object[] inside of another Object[].
+     */
+    @Deprecated
+    public static void logAndIndent(String format, Object[] args) {
+        assert false : "shouldn't use this";
+        logAndIndent(DEFAULT_LOG_LEVEL, format, args);
+    }
+
+    /**
+     * This override exists to catch cases when {@link #logAndIndent(int, String, Object)} is called
+     * with one argument bound to a varargs method parameter. It will bind to this method instead of
+     * the single arg variant and produce a deprecation warning instead of silently wrapping the
+     * Object[] inside of another Object[].
+     */
+    @Deprecated
+    public static void logAndIndent(int logLevel, String format, Object[] args) {
+        assert false : "shouldn't use this";
+        logvAndIndent(logLevel, format, args);
+    }
+
+    public static Iterable<Object> context() {
+        if (ENABLED) {
+            return DebugScope.getInstance().getCurrentContext();
+        } else {
+            return Collections.emptyList();
+        }
+    }
+
+    @SuppressWarnings("unchecked")
+    public static <T> List<T> contextSnapshot(Class<T> clazz) {
+        if (ENABLED) {
+            List<T> result = new ArrayList<>();
+            for (Object o : context()) {
+                if (clazz.isInstance(o)) {
+                    result.add((T) o);
+                }
+            }
+            return result;
+        } else {
+            return Collections.emptyList();
+        }
+    }
+
+    /**
+     * Searches the current debug scope, bottom up, for a context object that is an instance of a
+     * given type. The first such object found is returned.
+     */
+    @SuppressWarnings("unchecked")
+    public static <T> T contextLookup(Class<T> clazz) {
+        if (ENABLED) {
+            for (Object o : context()) {
+                if (clazz.isInstance(o)) {
+                    return ((T) o);
+                }
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Creates a {@linkplain DebugMemUseTracker memory use tracker} that is enabled iff debugging is
+     * {@linkplain #isEnabled() enabled}.
+     * <p>
+     * A disabled tracker has virtually no overhead.
+     */
+    public static DebugMemUseTracker memUseTracker(CharSequence name) {
+        if (!isUnconditionalMemUseTrackingEnabled && !ENABLED) {
+            return VOID_MEM_USE_TRACKER;
+        }
+        return createMemUseTracker("%s", name, null);
+    }
+
+    /**
+     * Creates a debug memory use tracker. Invoking this method is equivalent to:
+     *
+     * <pre>
+     * Debug.memUseTracker(format, arg, null)
+     * </pre>
+     *
+     * except that the string formatting only happens if metering is enabled.
+     *
+     * @see #metric(String, Object, Object)
+     */
+    public static DebugMemUseTracker memUseTracker(String format, Object arg) {
+        if (!isUnconditionalMemUseTrackingEnabled && !ENABLED) {
+            return VOID_MEM_USE_TRACKER;
+        }
+        return createMemUseTracker(format, arg, null);
+    }
+
+    /**
+     * Creates a debug memory use tracker. Invoking this method is equivalent to:
+     *
+     * <pre>
+     * Debug.memUseTracker(String.format(format, arg1, arg2))
+     * </pre>
+     *
+     * except that the string formatting only happens if memory use tracking is enabled. In
+     * addition, each argument is subject to the following type based conversion before being passed
+     * as an argument to {@link String#format(String, Object...)}:
+     *
+     * <pre>
+     *     Type          | Conversion
+     * ------------------+-----------------
+     *  java.lang.Class  | arg.getSimpleName()
+     *                   |
+     * </pre>
+     *
+     * @see #memUseTracker(CharSequence)
+     */
+    public static DebugMemUseTracker memUseTracker(String format, Object arg1, Object arg2) {
+        if (!isUnconditionalMemUseTrackingEnabled && !ENABLED) {
+            return VOID_MEM_USE_TRACKER;
+        }
+        return createMemUseTracker(format, arg1, arg2);
+    }
+
+    private static DebugMemUseTracker createMemUseTracker(String format, Object arg1, Object arg2) {
+        String name = formatDebugName(format, arg1, arg2);
+        return new MemUseTrackerImpl(name, !isUnconditionalMemUseTrackingEnabled);
+    }
+
+    /**
+     * Creates a {@linkplain DebugMetric metric} that is enabled iff debugging is
+     * {@linkplain #isEnabled() enabled} or the system property whose name is formed by adding to
+     * {@value #ENABLE_METRIC_PROPERTY_NAME_PREFIX} to {@code name} is
+     * {@linkplain Boolean#getBoolean(String) true}. If the latter condition is true, then the
+     * returned metric is {@linkplain DebugMetric#isConditional() unconditional} otherwise it is
+     * conditional.
+     * <p>
+     * A disabled metric has virtually no overhead.
+     */
+    public static DebugMetric metric(CharSequence name) {
+        if (!areUnconditionalMetricsEnabled() && !ENABLED) {
+            return VOID_METRIC;
+        }
+        return createMetric("%s", name, null);
+    }
+
+    public static String applyFormattingFlagsAndWidth(String s, int flags, int width) {
+        if (flags == 0 && width < 0) {
+            return s;
+        }
+        StringBuilder sb = new StringBuilder(s);
+
+        // apply width and justification
+        int len = sb.length();
+        if (len < width) {
+            for (int i = 0; i < width - len; i++) {
+                if ((flags & LEFT_JUSTIFY) == LEFT_JUSTIFY) {
+                    sb.append(' ');
+                } else {
+                    sb.insert(0, ' ');
+                }
+            }
+        }
+
+        String res = sb.toString();
+        if ((flags & UPPERCASE) == UPPERCASE) {
+            res = res.toUpperCase();
+        }
+        return res;
+    }
+
+    /**
+     * Creates a debug metric. Invoking this method is equivalent to:
+     *
+     * <pre>
+     * Debug.metric(format, arg, null)
+     * </pre>
+     *
+     * except that the string formatting only happens if metering is enabled.
+     *
+     * @see #metric(String, Object, Object)
+     */
+    public static DebugMetric metric(String format, Object arg) {
+        if (!areUnconditionalMetricsEnabled() && !ENABLED) {
+            return VOID_METRIC;
+        }
+        return createMetric(format, arg, null);
+    }
+
+    /**
+     * Creates a debug metric. Invoking this method is equivalent to:
+     *
+     * <pre>
+     * Debug.metric(String.format(format, arg1, arg2))
+     * </pre>
+     *
+     * except that the string formatting only happens if metering is enabled. In addition, each
+     * argument is subject to the following type based conversion before being passed as an argument
+     * to {@link String#format(String, Object...)}:
+     *
+     * <pre>
+     *     Type          | Conversion
+     * ------------------+-----------------
+     *  java.lang.Class  | arg.getSimpleName()
+     *                   |
+     * </pre>
+     *
+     * @see #metric(CharSequence)
+     */
+    public static DebugMetric metric(String format, Object arg1, Object arg2) {
+        if (!areUnconditionalMetricsEnabled() && !ENABLED) {
+            return VOID_METRIC;
+        }
+        return createMetric(format, arg1, arg2);
+    }
+
+    private static DebugMetric createMetric(String format, Object arg1, Object arg2) {
+        String name = formatDebugName(format, arg1, arg2);
+        boolean conditional = enabledMetrics == null || !findMatch(enabledMetrics, enabledMetricsSubstrings, name);
+        if (!ENABLED && conditional) {
+            return VOID_METRIC;
+        }
+        return new MetricImpl(name, conditional);
+    }
+
+    /**
+     * Changes the debug configuration for the current thread.
+     *
+     * @param config new configuration to use for the current thread
+     * @return an object that when {@linkplain DebugConfigScope#close() closed} will restore the
+     *         debug configuration for the current thread to what it was before this method was
+     *         called
+     */
+    public static DebugConfigScope setConfig(DebugConfig config) {
+        if (ENABLED) {
+            return new DebugConfigScope(config);
+        } else {
+            return null;
+        }
+    }
+
+    /**
+     * Creates an object for counting value frequencies.
+     */
+    public static DebugHistogram createHistogram(String name) {
+        return new DebugHistogramImpl(name);
+    }
+
+    public static DebugConfig silentConfig() {
+        return fixedConfig(0, 0, false, false, false, false, Collections.<DebugDumpHandler> emptyList(), Collections.<DebugVerifyHandler> emptyList(), null);
+    }
+
+    public static DebugConfig fixedConfig(final int logLevel, final int dumpLevel, final boolean isMeterEnabled, final boolean isMemUseTrackingEnabled, final boolean isTimerEnabled,
+                    final boolean isVerifyEnabled, final Collection<DebugDumpHandler> dumpHandlers, final Collection<DebugVerifyHandler> verifyHandlers, final PrintStream output) {
+        return new DebugConfig() {
+
+            @Override
+            public int getLogLevel() {
+                return logLevel;
+            }
+
+            public boolean isLogEnabledForMethod() {
+                return logLevel > 0;
+            }
+
+            @Override
+            public boolean isMeterEnabled() {
+                return isMeterEnabled;
+            }
+
+            @Override
+            public boolean isMemUseTrackingEnabled() {
+                return isMemUseTrackingEnabled;
+            }
+
+            @Override
+            public int getDumpLevel() {
+                return dumpLevel;
+            }
+
+            public boolean isDumpEnabledForMethod() {
+                return dumpLevel > 0;
+            }
+
+            @Override
+            public boolean isVerifyEnabled() {
+                return isVerifyEnabled;
+            }
+
+            public boolean isVerifyEnabledForMethod() {
+                return isVerifyEnabled;
+            }
+
+            @Override
+            public boolean isTimeEnabled() {
+                return isTimerEnabled;
+            }
+
+            @Override
+            public RuntimeException interceptException(Throwable e) {
+                return null;
+            }
+
+            @Override
+            public Collection<DebugDumpHandler> dumpHandlers() {
+                return dumpHandlers;
+            }
+
+            @Override
+            public Collection<DebugVerifyHandler> verifyHandlers() {
+                return verifyHandlers;
+            }
+
+            @Override
+            public PrintStream output() {
+                return output;
+            }
+
+            @Override
+            public void addToContext(Object o) {
+            }
+
+            @Override
+            public void removeFromContext(Object o) {
+            }
+        };
+    }
+
+    private static final DebugMetric VOID_METRIC = new DebugMetric() {
+
+        public void increment() {
+        }
+
+        public void add(long value) {
+        }
+
+        public void setConditional(boolean flag) {
+            throw new InternalError("Cannot make void metric conditional");
+        }
+
+        public boolean isConditional() {
+            return false;
+        }
+
+        public long getCurrentValue() {
+            return 0L;
+        }
+    };
+
+    private static final DebugMemUseTracker VOID_MEM_USE_TRACKER = new DebugMemUseTracker() {
+
+        public DebugCloseable start() {
+            return DebugCloseable.VOID_CLOSEABLE;
+        }
+
+        public long getCurrentValue() {
+            return 0;
+        }
+    };
+
+    public static final String ENABLE_UNSCOPED_TIMERS_PROPERTY_NAME = "jvmci.debug.unscopedTimers";
+    public static final String ENABLE_UNSCOPED_METRICS_PROPERTY_NAME = "jvmci.debug.unscopedMetrics";
+    public static final String ENABLE_UNSCOPED_MEM_USE_TRACKERS_PROPERTY_NAME = "jvmci.debug.unscopedMemUseTrackers";
+
+    /**
+     * @see #timer(CharSequence)
+     */
+    public static final String ENABLE_TIMER_PROPERTY_NAME_PREFIX = "jvmci.debug.timer.";
+
+    /**
+     * @see #metric(CharSequence)
+     */
+    public static final String ENABLE_METRIC_PROPERTY_NAME_PREFIX = "jvmci.debug.metric.";
+
+    /**
+     * Set of unconditionally enabled metrics. Possible values and their meanings:
+     * <ul>
+     * <li>{@code null}: no unconditionally enabled metrics</li>
+     * <li>{@code isEmpty()}: all metrics are unconditionally enabled</li>
+     * <li>{@code !isEmpty()}: use {@link #findMatch(Set, Set, String)} on this set and
+     * {@link #enabledMetricsSubstrings} to determine which metrics are unconditionally enabled</li>
+     * </ul>
+     */
+    private static final Set<String> enabledMetrics;
+
+    /**
+     * Set of unconditionally enabled timers. Same interpretation of values as for
+     * {@link #enabledMetrics}.
+     */
+    private static final Set<String> enabledTimers;
+
+    private static final Set<String> enabledMetricsSubstrings = new HashSet<>();
+    private static final Set<String> enabledTimersSubstrings = new HashSet<>();
+
+    /**
+     * Specifies if all mem use trackers are unconditionally enabled.
+     */
+    private static final boolean isUnconditionalMemUseTrackingEnabled;
+
+    static {
+        Set<String> metrics = new HashSet<>();
+        Set<String> timers = new HashSet<>();
+        parseMetricAndTimerSystemProperties(metrics, timers, enabledMetricsSubstrings, enabledTimersSubstrings);
+        metrics = metrics.isEmpty() && enabledMetricsSubstrings.isEmpty() ? null : metrics;
+        timers = timers.isEmpty() && enabledTimersSubstrings.isEmpty() ? null : timers;
+        if (metrics == null && Boolean.getBoolean(ENABLE_UNSCOPED_METRICS_PROPERTY_NAME)) {
+            metrics = Collections.emptySet();
+        }
+        if (timers == null && Boolean.getBoolean(ENABLE_UNSCOPED_TIMERS_PROPERTY_NAME)) {
+            timers = Collections.emptySet();
+        }
+        enabledMetrics = metrics;
+        enabledTimers = timers;
+        isUnconditionalMemUseTrackingEnabled = Boolean.getBoolean(ENABLE_UNSCOPED_MEM_USE_TRACKERS_PROPERTY_NAME);
+    }
+
+    private static boolean findMatch(Set<String> haystack, Set<String> haystackSubstrings, String needle) {
+        if (haystack.isEmpty()) {
+            // Empty haystack means match all
+            return true;
+        }
+        if (haystack.contains(needle)) {
+            return true;
+        }
+        if (!haystackSubstrings.isEmpty()) {
+            for (String h : haystackSubstrings) {
+                if (needle.startsWith(h)) {
+                    return true;
+                }
+            }
+        }
+        return false;
+    }
+
+    public static boolean areUnconditionalTimersEnabled() {
+        return enabledTimers != null;
+    }
+
+    public static boolean areUnconditionalMetricsEnabled() {
+        return enabledMetrics != null;
+    }
+
+    protected static void parseMetricAndTimerSystemProperties(Set<String> metrics, Set<String> timers, Set<String> metricsSubstrings, Set<String> timersSubstrings) {
+        do {
+            try {
+                for (Map.Entry<Object, Object> e : System.getProperties().entrySet()) {
+                    String name = e.getKey().toString();
+                    if (name.startsWith(ENABLE_METRIC_PROPERTY_NAME_PREFIX) && Boolean.parseBoolean(e.getValue().toString())) {
+                        if (name.endsWith("*")) {
+                            metricsSubstrings.add(name.substring(ENABLE_METRIC_PROPERTY_NAME_PREFIX.length(), name.length() - 1));
+                        } else {
+                            metrics.add(name.substring(ENABLE_METRIC_PROPERTY_NAME_PREFIX.length()));
+                        }
+                    }
+                    if (name.startsWith(ENABLE_TIMER_PROPERTY_NAME_PREFIX) && Boolean.parseBoolean(e.getValue().toString())) {
+                        if (name.endsWith("*")) {
+                            timersSubstrings.add(name.substring(ENABLE_TIMER_PROPERTY_NAME_PREFIX.length(), name.length() - 1));
+                        } else {
+                            timers.add(name.substring(ENABLE_TIMER_PROPERTY_NAME_PREFIX.length()));
+                        }
+                    }
+                }
+                return;
+            } catch (ConcurrentModificationException e) {
+                // Iterating over the system properties may race with another thread that is
+                // updating the system properties. Simply try again in this case.
+            }
+        } while (true);
+    }
+
+    /**
+     * Creates a {@linkplain DebugTimer timer} that is enabled iff debugging is
+     * {@linkplain #isEnabled() enabled} or the system property whose name is formed by adding to
+     * {@value #ENABLE_TIMER_PROPERTY_NAME_PREFIX} to {@code name} is
+     * {@linkplain Boolean#getBoolean(String) true}. If the latter condition is true, then the
+     * returned timer is {@linkplain DebugMetric#isConditional() unconditional} otherwise it is
+     * conditional.
+     * <p>
+     * A disabled timer has virtually no overhead.
+     */
+    public static DebugTimer timer(CharSequence name) {
+        if (!areUnconditionalTimersEnabled() && !ENABLED) {
+            return VOID_TIMER;
+        }
+        return createTimer("%s", name, null);
+    }
+
+    /**
+     * Creates a debug timer. Invoking this method is equivalent to:
+     *
+     * <pre>
+     * Debug.timer(format, arg, null)
+     * </pre>
+     *
+     * except that the string formatting only happens if timing is enabled.
+     *
+     * @see #timer(String, Object, Object)
+     */
+    public static DebugTimer timer(String format, Object arg) {
+        if (!areUnconditionalTimersEnabled() && !ENABLED) {
+            return VOID_TIMER;
+        }
+        return createTimer(format, arg, null);
+    }
+
+    /**
+     * Creates a debug timer. Invoking this method is equivalent to:
+     *
+     * <pre>
+     * Debug.timer(String.format(format, arg1, arg2))
+     * </pre>
+     *
+     * except that the string formatting only happens if timing is enabled. In addition, each
+     * argument is subject to the following type based conversion before being passed as an argument
+     * to {@link String#format(String, Object...)}:
+     *
+     * <pre>
+     *     Type          | Conversion
+     * ------------------+-----------------
+     *  java.lang.Class  | arg.getSimpleName()
+     *                   |
+     * </pre>
+     *
+     * @see #timer(CharSequence)
+     */
+    public static DebugTimer timer(String format, Object arg1, Object arg2) {
+        if (!areUnconditionalTimersEnabled() && !ENABLED) {
+            return VOID_TIMER;
+        }
+        return createTimer(format, arg1, arg2);
+    }
+
+    /**
+     * There are paths where construction of formatted class names are common and the code below is
+     * surprisingly expensive, so compute it once and cache it.
+     */
+    private static final ClassValue<String> formattedClassName = new ClassValue<String>() {
+        @Override
+        protected String computeValue(Class<?> c) {
+            final String simpleName = c.getSimpleName();
+            Class<?> enclosingClass = c.getEnclosingClass();
+            if (enclosingClass != null) {
+                String prefix = "";
+                while (enclosingClass != null) {
+                    prefix = enclosingClass.getSimpleName() + "_" + prefix;
+                    enclosingClass = enclosingClass.getEnclosingClass();
+                }
+                return prefix + simpleName;
+            } else {
+                return simpleName;
+            }
+        }
+    };
+
+    public static Object convertFormatArg(Object arg) {
+        if (arg instanceof Class) {
+            return formattedClassName.get((Class<?>) arg);
+        }
+        return arg;
+    }
+
+    private static String formatDebugName(String format, Object arg1, Object arg2) {
+        return String.format(format, convertFormatArg(arg1), convertFormatArg(arg2));
+    }
+
+    private static DebugTimer createTimer(String format, Object arg1, Object arg2) {
+        String name = formatDebugName(format, arg1, arg2);
+        boolean conditional = enabledTimers == null || !findMatch(enabledTimers, enabledTimersSubstrings, name);
+        if (!ENABLED && conditional) {
+            return VOID_TIMER;
+        }
+        return new TimerImpl(name, conditional);
+    }
+
+    private static final DebugTimer VOID_TIMER = new DebugTimer() {
+
+        public DebugCloseable start() {
+            return DebugCloseable.VOID_CLOSEABLE;
+        }
+
+        public void setConditional(boolean flag) {
+            throw new InternalError("Cannot make void timer conditional");
+        }
+
+        public boolean isConditional() {
+            return false;
+        }
+
+        public long getCurrentValue() {
+            return 0L;
+        }
+
+        public TimeUnit getTimeUnit() {
+            return null;
+        }
+    };
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/DebugCloseable.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2012, 2015, 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.jvmci.debug;
+
+/**
+ * An object returned by {@link DebugTimer#start()} that when closed, stops the associated timer and
+ * adds the elapsed time since {@code start()} to the total for the timer.
+ */
+public interface DebugCloseable extends AutoCloseable {
+
+    DebugCloseable VOID_CLOSEABLE = new DebugCloseable() {
+
+        @Override
+        public void close() {
+        }
+    };
+
+    void close();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/DebugConfig.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,116 @@
+/*
+ * 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.jvmci.debug;
+
+import java.io.*;
+import java.util.*;
+
+public interface DebugConfig {
+
+    /**
+     * Determines the current log level in the {@linkplain Debug#currentScope() current debug scope}
+     * .
+     */
+    int getLogLevel();
+
+    /**
+     * Determines the current dump level in the {@linkplain Debug#currentScope() current debug
+     * scope}.
+     */
+    int getDumpLevel();
+
+    /**
+     * Determines if logging can be enabled in the current method, regardless of the
+     * {@linkplain Debug#currentScope() current debug scope}.
+     */
+    boolean isLogEnabledForMethod();
+
+    /**
+     * Determines if metering is enabled in the {@linkplain Debug#currentScope() current debug
+     * scope}.
+     *
+     * @see Debug#metric(CharSequence)
+     */
+    boolean isMeterEnabled();
+
+    /**
+     * Determines if memory use tracking is enabled in the {@linkplain Debug#currentScope() current
+     * debug scope}.
+     *
+     * @see Debug#memUseTracker(CharSequence)
+     */
+    boolean isMemUseTrackingEnabled();
+
+    /**
+     * Determines if dumping can be enabled in the current method, regardless of the
+     * {@linkplain Debug#currentScope() current debug scope}.
+     */
+    boolean isDumpEnabledForMethod();
+
+    /**
+     * @see Debug#isVerifyEnabled()
+     */
+    boolean isVerifyEnabled();
+
+    /**
+     * @see Debug#isVerifyEnabledForMethod()
+     */
+    boolean isVerifyEnabledForMethod();
+
+    /**
+     * Adds an object the context used by this configuration to do filtering.
+     */
+    void addToContext(Object o);
+
+    /**
+     * Removes an object the context used by this configuration to do filtering.
+     *
+     * This should only removes extra context added by {@link #addToContext(Object)}.
+     */
+    void removeFromContext(Object o);
+
+    /**
+     * @see Debug#timer(CharSequence)
+     */
+    boolean isTimeEnabled();
+
+    /**
+     * Handles notification of an exception occurring within a debug scope.
+     *
+     * @return the exception object that is to be propagated to parent scope. A value of
+     *         {@code null} indicates that {@code e} is to be propagated.
+     */
+    RuntimeException interceptException(Throwable e);
+
+    /**
+     * Gets the modifiable collection of dump handlers registered with this configuration.
+     */
+    Collection<DebugDumpHandler> dumpHandlers();
+
+    PrintStream output();
+
+    /**
+     * Gets the modifiable collection of verify handlers registered with this configuration.
+     */
+    Collection<DebugVerifyHandler> verifyHandlers();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/DebugConfigScope.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,55 @@
+/*
+ * 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.jvmci.debug;
+
+import com.oracle.jvmci.debug.internal.*;
+
+/**
+ * A utility for scoping a change to the current debug
+ * {@linkplain DebugScope#setConfig(DebugConfig) configuration}. For example:
+ *
+ * <pre>
+ *     DebugConfig config = ...;
+ *     try (DebugConfigScope s = new DebugConfigScope(config)) {
+ *         // ...
+ *     }
+ * </pre>
+ */
+public class DebugConfigScope implements AutoCloseable {
+
+    private final DebugConfig current;
+
+    /**
+     * Sets the current debug {@linkplain DebugScope#setConfig(DebugConfig) configuration} to a
+     * given value and creates an object that when {@linkplain #close() closed} resets the
+     * configuration to the {@linkplain DebugScope#getConfig() current} configuration.
+     */
+    public DebugConfigScope(DebugConfig config) {
+        this.current = DebugScope.getConfig();
+        DebugScope.getInstance().setConfig(config);
+    }
+
+    public void close() {
+        DebugScope.getInstance().setConfig(current);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/DebugDumpHandler.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,38 @@
+/*
+ * 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.jvmci.debug;
+
+import java.io.*;
+
+public interface DebugDumpHandler extends Closeable {
+
+    void dump(Object object, String message);
+
+    /**
+     * Flushes and releases resources managed by this dump handler. A subsequent call to
+     * {@link #dump(Object, String)} will create and open new resources. That is, this method can be
+     * used to reset the handler.
+     */
+    @Override
+    void close();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/DebugDumpScope.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,49 @@
+/*
+ * 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.jvmci.debug;
+
+public class DebugDumpScope {
+
+    public final String name;
+
+    /**
+     * Specifies if this scope decorates an inner scope. A hierarchical or tree representation of
+     * nested scopes may choose to represent a decorator scope at the same level as the scope it
+     * decorates.
+     */
+    public final boolean decorator;
+
+    public DebugDumpScope(String name) {
+        this(name, false);
+    }
+
+    public DebugDumpScope(String name, boolean decorator) {
+        this.name = name;
+        this.decorator = decorator;
+    }
+
+    @Override
+    public String toString() {
+        return "DebugDumpScope[" + name + "]";
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/DebugHistogram.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,102 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.debug;
+
+import java.util.*;
+
+/**
+ * Facility for recording value frequencies.
+ */
+public interface DebugHistogram {
+
+    /**
+     * Gets the name specified when this objected was {@linkplain Debug#createHistogram(String)
+     * created}.
+     */
+    String getName();
+
+    /**
+     * Increments the count for a given value.
+     */
+    void add(Object value);
+
+    void add(Object value, long count);
+
+    /**
+     * A value and a frequency. The ordering imposed by {@link #compareTo(CountedValue)} places
+     * values with higher frequencies first.
+     */
+    public class CountedValue implements Comparable<CountedValue> {
+
+        private long count;
+        private final Object value;
+
+        public CountedValue(long count, Object value) {
+            this.count = count;
+            this.value = value;
+        }
+
+        public int compareTo(CountedValue o) {
+            if (count < o.count) {
+                return 1;
+            } else if (count > o.count) {
+                return -1;
+            }
+            return 0;
+        }
+
+        @Override
+        public String toString() {
+            return count + " -> " + value;
+        }
+
+        public void inc() {
+            count++;
+        }
+
+        public void add(long n) {
+            count += n;
+        }
+
+        public long getCount() {
+            return count;
+        }
+
+        public Object getValue() {
+            return value;
+        }
+    }
+
+    /**
+     * Gets a list of the counted values, sorted in descending order of frequency.
+     */
+    List<CountedValue> getValues();
+
+    /**
+     * Interface for a service that can render a visualization of a histogram.
+     */
+    public interface Printer {
+
+        void print(DebugHistogram histogram);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/DebugMemUseTracker.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,52 @@
+/*
+ * 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.jvmci.debug;
+
+import com.sun.management.*;
+
+/**
+ * Tracks memory usage within a scope using {@link ThreadMXBean}. This facility should be employed
+ * using the try-with-resources pattern:
+ *
+ * <pre>
+ * try (DebugMemUseTracker.Closeable a = memUseTracker.start()) {
+ *     // the code to measure
+ * }
+ * </pre>
+ */
+public interface DebugMemUseTracker {
+
+    /**
+     * Creates a point from which memory usage will be recorded if memory use tracking is
+     * {@linkplain Debug#isMemUseTrackingEnabled() enabled}.
+     *
+     * @return an object that must be closed once the activity has completed to add the memory used
+     *         since this call to the total for this tracker
+     */
+    DebugCloseable start();
+
+    /**
+     * Gets the current value of this tracker.
+     */
+    long getCurrentValue();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/DebugMetric.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,65 @@
+/*
+ * 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.jvmci.debug;
+
+/**
+ * A counter for some value of interest.
+ */
+public interface DebugMetric {
+
+    /**
+     * Adds 1 to this counter if metering is {@link Debug#isMeterEnabled() enabled} or this is an
+     * {@linkplain #isConditional() unconditional} metric.
+     */
+    void increment();
+
+    /**
+     * Adds {@code value} to this counter if metering is {@link Debug#isMeterEnabled() enabled} or
+     * this is an {@linkplain #isConditional() unconditional} metric.
+     */
+    void add(long value);
+
+    /**
+     * Sets a flag determining if this counter is only enabled if metering is
+     * {@link Debug#isMeterEnabled() enabled}.
+     */
+    void setConditional(boolean flag);
+
+    /**
+     * Determines if this counter is only enabled if metering is {@link Debug#isMeterEnabled()
+     * enabled}.
+     */
+    boolean isConditional();
+
+    /**
+     * Gets the current value of this metric.
+     */
+    long getCurrentValue();
+
+    /**
+     * Determines if this counter is enabled (either conditionally or unconditionally).
+     */
+    default boolean isEnabled() {
+        return !isConditional() || Debug.isMeterEnabled();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/DebugTimer.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,78 @@
+/*
+ * 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.jvmci.debug;
+
+import java.util.concurrent.*;
+
+/**
+ * A timer for some activity of interest. A timer should be deployed using the try-with-resources
+ * pattern:
+ *
+ * <pre>
+ * try (TimerCloseable a = timer.start()) {
+ *     // the code to time
+ * }
+ * </pre>
+ */
+public interface DebugTimer {
+
+    /**
+     * Starts this timer if timing is {@linkplain Debug#isTimeEnabled() enabled} or this is an
+     * {@linkplain #isConditional() unconditional} timer.
+     *
+     * @return an object that must be closed once the activity has completed to add the elapsed time
+     *         since this call to the total for this timer
+     */
+    DebugCloseable start();
+
+    /**
+     * Sets a flag determining if this timer is only enabled if timing is
+     * {@link Debug#isTimeEnabled() enabled}.
+     */
+    void setConditional(boolean flag);
+
+    /**
+     * Determines if this timer is only enabled if timing is {@link Debug#isTimeEnabled() enabled}.
+     */
+    boolean isConditional();
+
+    /**
+     * Gets the current value of this timer.
+     */
+    long getCurrentValue();
+
+    /**
+     * Gets the time unit of this timer.
+     */
+    TimeUnit getTimeUnit();
+
+    /**
+     * Gets the timer recording the amount time spent within a timed scope minus the time spent in
+     * any nested timed scopes.
+     *
+     * @return null if this timer does not support flat timing
+     */
+    default DebugTimer getFlat() {
+        return null;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/DebugVerifyHandler.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,37 @@
+/*
+ * 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.jvmci.debug;
+
+/**
+ * Performs some kind of verification on an object.
+ */
+public interface DebugVerifyHandler {
+
+    /**
+     * Verifies that a given object satisfies some invariants.
+     *
+     * @param object object to verify
+     * @param message description of verification context
+     */
+    void verify(Object object, String message);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/DelegatingDebugConfig.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,238 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.debug;
+
+import java.io.*;
+import java.util.*;
+
+import com.oracle.jvmci.debug.internal.*;
+
+public class DelegatingDebugConfig implements DebugConfig {
+
+    protected final DebugConfig delegate;
+
+    /**
+     * The features of a {@link DelegatingDebugConfig} that can be force
+     * {@linkplain DelegatingDebugConfig#enable(Feature) enabled}/
+     * {@linkplain DelegatingDebugConfig#disable(Feature) disabled} or
+     * {@linkplain DelegatingDebugConfig#delegate(Feature) delegated}.
+     */
+    public enum Feature {
+        /**
+         * @see Debug#isLogEnabledForMethod()
+         */
+        LOG_METHOD,
+        /**
+         * @see Debug#isDumpEnabledForMethod()
+         */
+        DUMP_METHOD,
+        /**
+         * @see Debug#isVerifyEnabled()
+         */
+        VERIFY,
+        /**
+         * @see Debug#isVerifyEnabledForMethod()
+         */
+        VERIFY_METHOD,
+        /**
+         * @see Debug#isMeterEnabled()
+         */
+        METER,
+        /**
+         * @see Debug#isMemUseTrackingEnabled()
+         */
+        TRACK_MEM_USE,
+        /**
+         * @see Debug#isTimeEnabled()
+         */
+        TIME,
+        /**
+         * @see DebugConfig#interceptException(Throwable)
+         */
+        INTERCEPT
+    }
+
+    private final Map<Feature, Boolean> featureState = new EnumMap<>(Feature.class);
+
+    /**
+     * The debug levels of a {@link DelegatingDebugConfig} than can be
+     * {@linkplain DelegatingDebugConfig#override(Level, int) overridden} or
+     * {@linkplain DelegatingDebugConfig#delegate(Level) delegated}.
+     */
+    public enum Level {
+        LOG,
+        DUMP
+    }
+
+    private final Map<Level, Integer> levelState = new EnumMap<>(Level.class);
+
+    /**
+     * Creates a config that delegates to the {@link DebugScope#getConfig() current config}.
+     */
+    public DelegatingDebugConfig() {
+        this(DebugScope.getConfig());
+    }
+
+    /**
+     * Creates a config that delegates to a given config.
+     */
+    public DelegatingDebugConfig(DebugConfig delegate) {
+        this.delegate = delegate;
+    }
+
+    public DelegatingDebugConfig enable(Feature feature) {
+        featureState.put(feature, Boolean.TRUE);
+        return this;
+    }
+
+    public DelegatingDebugConfig disable(Feature feature) {
+        featureState.put(feature, Boolean.FALSE);
+        return this;
+    }
+
+    public DelegatingDebugConfig override(Level level, int newLevel) {
+        levelState.put(level, newLevel);
+        return this;
+    }
+
+    public DelegatingDebugConfig delegate(Feature feature) {
+        featureState.put(feature, null);
+        return this;
+    }
+
+    public DelegatingDebugConfig delegate(Level level) {
+        levelState.put(level, null);
+        return this;
+    }
+
+    @Override
+    public int getLogLevel() {
+        Integer ls = levelState.get(Level.LOG);
+        if (ls == null) {
+            return delegate.getLogLevel();
+        }
+        return ls.intValue();
+    }
+
+    public boolean isLogEnabledForMethod() {
+        Boolean fs = featureState.get(Feature.LOG_METHOD);
+        if (fs == null) {
+            return delegate.isLogEnabledForMethod();
+        }
+        return fs.booleanValue();
+    }
+
+    @Override
+    public boolean isMeterEnabled() {
+        Boolean fs = featureState.get(Feature.METER);
+        if (fs == null) {
+            return delegate.isMeterEnabled();
+        }
+        return fs.booleanValue();
+    }
+
+    public boolean isMemUseTrackingEnabled() {
+        Boolean fs = featureState.get(Feature.TRACK_MEM_USE);
+        if (fs == null) {
+            return delegate.isMemUseTrackingEnabled();
+        }
+        return fs.booleanValue();
+    }
+
+    @Override
+    public int getDumpLevel() {
+        Integer ls = levelState.get(Level.DUMP);
+        if (ls == null) {
+            return delegate.getDumpLevel();
+        }
+        return ls.intValue();
+    }
+
+    public boolean isDumpEnabledForMethod() {
+        Boolean fs = featureState.get(Feature.DUMP_METHOD);
+        if (fs == null) {
+            return delegate.isDumpEnabledForMethod();
+        }
+        return fs.booleanValue();
+    }
+
+    @Override
+    public boolean isVerifyEnabled() {
+        Boolean fs = featureState.get(Feature.VERIFY);
+        if (fs == null) {
+            return delegate.isVerifyEnabled();
+        }
+        return fs.booleanValue();
+    }
+
+    public boolean isVerifyEnabledForMethod() {
+        Boolean fs = featureState.get(Feature.VERIFY_METHOD);
+        if (fs == null) {
+            return delegate.isVerifyEnabledForMethod();
+        }
+        return fs.booleanValue();
+    }
+
+    @Override
+    public boolean isTimeEnabled() {
+        Boolean fs = featureState.get(Feature.TIME);
+        if (fs == null) {
+            return delegate.isTimeEnabled();
+        }
+        return fs.booleanValue();
+    }
+
+    @Override
+    public RuntimeException interceptException(Throwable e) {
+        Boolean fs = featureState.get(Feature.INTERCEPT);
+        if (fs == null || fs) {
+            return delegate.interceptException(e);
+        }
+        return null;
+    }
+
+    @Override
+    public Collection<DebugDumpHandler> dumpHandlers() {
+        return delegate.dumpHandlers();
+    }
+
+    @Override
+    public Collection<DebugVerifyHandler> verifyHandlers() {
+        return delegate.verifyHandlers();
+    }
+
+    @Override
+    public PrintStream output() {
+        return delegate.output();
+    }
+
+    @Override
+    public void addToContext(Object o) {
+        delegate.addToContext(o);
+    }
+
+    @Override
+    public void removeFromContext(Object o) {
+        delegate.removeFromContext(o);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/Fingerprint.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,145 @@
+/*
+ * Copyright (c) 2015, 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.jvmci.debug;
+
+import java.util.*;
+import java.util.stream.*;
+
+/**
+ * Facility for fingerprinting execution.
+ */
+public class Fingerprint implements AutoCloseable {
+
+    public static final String ENABLED_PROPERTY_NAME = "jvmci.fingerprint";
+
+    /**
+     * Determines whether fingerprinting is enabled. This is set by the
+     * {@value #ENABLED_PROPERTY_NAME} system property when this class is initialized.
+     */
+    public static final boolean ENABLED = Boolean.getBoolean(ENABLED_PROPERTY_NAME);
+
+    private static final ThreadLocal<Fingerprint> current = ENABLED ? new ThreadLocal<>() : null;
+
+    private final List<String> events;
+    private int index;
+
+    /**
+     * Creates an object to record a fingerprint.
+     */
+    public Fingerprint() {
+        events = new ArrayList<>();
+        index = -1;
+    }
+
+    /**
+     * Creates an object to verify execution matches a given fingerprint.
+     *
+     * @param toVerifyAgainst the fingerprint events to verify against
+     */
+    public Fingerprint(List<String> toVerifyAgainst) {
+        this.events = toVerifyAgainst;
+        index = 0;
+    }
+
+    /**
+     * Creates an object to verify execution matches a given fingerprint.
+     *
+     * @param toVerifyAgainst the fingerprint to verify against
+     */
+    public Fingerprint(Fingerprint toVerifyAgainst) {
+        this(toVerifyAgainst.events);
+    }
+
+    public Collection<String> getEvents() {
+        return Collections.unmodifiableCollection(events);
+    }
+
+    /**
+     * Starts fingerprint recording or verification for the current thread. At most one fingerprint
+     * object can be active for any thread.
+     */
+    public Fingerprint open() {
+        if (ENABLED) {
+            assert current.get() == null;
+            current.set(this);
+            return this;
+        }
+        return null;
+    }
+
+    /**
+     * Finishes fingerprint recording or verification for the current thread.
+     */
+    public void close() {
+        if (ENABLED) {
+            assert current.get() == this;
+            current.set(null);
+        }
+    }
+
+    private static final int BREAKPOINT_EVENT = Integer.getInteger(ENABLED_PROPERTY_NAME + ".breakpointEvent", -1);
+
+    /**
+     * Submits an execution event for the purpose of recording or verifying a fingerprint. This must
+     * only be called if {@link #ENABLED} is {@code true}.
+     */
+    public static void submit(String format, Object... args) {
+        assert ENABLED : "fingerprinting must be enabled (-D" + ENABLED_PROPERTY_NAME + "=true)";
+        Fingerprint fingerprint = current.get();
+        if (fingerprint != null) {
+            int eventId = fingerprint.nextEventId();
+            if (eventId == BREAKPOINT_EVENT) {
+                // Set IDE breakpoint on the following line and set the relevant
+                // system property to debug a fingerprint verification error.
+                System.console();
+            }
+            fingerprint.event(String.format(eventId + ": " + format, args));
+        }
+    }
+
+    private int nextEventId() {
+        return index == -1 ? events.size() : index;
+    }
+
+    private static final int MAX_EVENT_TAIL_IN_ERROR_MESSAGE = Integer.getInteger("jvmci.fingerprint.errorEventTailLength", 50);
+
+    private String tail() {
+        int start = Math.max(index - MAX_EVENT_TAIL_IN_ERROR_MESSAGE, 0);
+        return events.subList(start, index).stream().collect(Collectors.joining(String.format("%n")));
+    }
+
+    private void event(String entry) {
+        if (index == -1) {
+            events.add(entry);
+        } else {
+            if (index > events.size()) {
+                throw new InternalError(String.format("%s%nOriginal fingerprint limit reached", tail()));
+            }
+            String l = events.get(index);
+            if (!l.equals(entry)) {
+                throw new InternalError(String.format("%s%nFingerprint differs at event %d%nexpected: %s%n  actual: %s", tail(), index, l, entry));
+            }
+            index++;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/Indent.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.debug;
+
+/**
+ * Object used to close a debug {@link Debug#indent() indentation} scope.
+ * <p>
+ * Example usage:
+ *
+ * <pre>
+ *
+ *      try (Indent i1 = Debug.logAndIndent("header message")) {
+ *          ...
+ *          Debug.log("message");
+ *          ...
+ *          try (Indent i2 = Debug.logAndIndent(sub-header message")) {
+ *              ...
+ *              Debug.log("inner message");
+ *              ...
+ *          }
+ *      }
+ *
+ * </pre>
+ */
+public interface Indent extends AutoCloseable {
+
+    /**
+     * Closes the current indentation scope.
+     */
+    void close();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/LogStream.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,477 @@
+/*
+ * 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.jvmci.debug;
+
+import java.io.*;
+
+/**
+ * A utility for printing compiler debug and informational output to an output stream.
+ *
+ * A {@link LogStream} instance maintains an internal buffer that is flushed to the underlying
+ * output stream every time one of the {@code println} methods is invoked, or a newline character (
+ * {@code '\n'}) is written.
+ *
+ * All of the {@code print} and {@code println} methods return the {code LogStream} instance on
+ * which they were invoked. This allows chaining of these calls to mitigate use of String
+ * concatenation by the caller.
+ *
+ * A {@code LogStream} maintains a current {@linkplain #indentationLevel() indentation} level. Each
+ * line of output written to this stream has {@code n} spaces prefixed to it where {@code n} is the
+ * value that would be returned by {@link #indentationLevel()} when the first character of a new
+ * line is written.
+ *
+ * A {@code LogStream} maintains a current {@linkplain #position() position} for the current line
+ * being written. This position can be advanced to a specified position by
+ * {@linkplain #fillTo(int, char) filling} this stream with a given character.
+ */
+public class LogStream {
+
+    /**
+     * Null output stream that simply swallows any output sent to it.
+     */
+    public static final LogStream SINK = new LogStream();
+
+    private static final PrintStream SINK_PS = new PrintStream(new OutputStream() {
+
+        @Override
+        public void write(int b) throws IOException {
+        }
+    });
+
+    private LogStream() {
+        this.ps = null;
+        this.lineBuffer = null;
+    }
+
+    /**
+     * The output stream to which this log stream writes.
+     */
+    private final PrintStream ps;
+
+    private final StringBuilder lineBuffer;
+    private int indentationLevel;
+    private char indentation = ' ';
+    private boolean indentationDisabled;
+
+    public final PrintStream out() {
+        if (ps == null) {
+            return SINK_PS;
+        }
+        return ps;
+    }
+
+    /**
+     * The system dependent line separator.
+     */
+    public static final String LINE_SEPARATOR = System.getProperty("line.separator");
+
+    /**
+     * Creates a new log stream.
+     *
+     * @param os the underlying output stream to which prints are sent
+     */
+    public LogStream(OutputStream os) {
+        ps = os instanceof PrintStream ? (PrintStream) os : new PrintStream(os);
+        lineBuffer = new StringBuilder(100);
+    }
+
+    /**
+     * Creates a new log stream that shares the same {@linkplain #ps output stream} as a given
+     * {@link LogStream}.
+     *
+     * @param log a LogStream whose output stream is shared with this one
+     */
+    public LogStream(LogStream log) {
+        ps = log.ps;
+        lineBuffer = new StringBuilder(100);
+    }
+
+    /**
+     * Prepends {@link #indentation} to the current output line until its write position is equal to
+     * the current {@linkplain #indentationLevel()} level.
+     */
+    private void indent() {
+        if (ps != null) {
+            if (!indentationDisabled && indentationLevel != 0) {
+                while (lineBuffer.length() < indentationLevel) {
+                    lineBuffer.append(indentation);
+                }
+            }
+        }
+    }
+
+    private LogStream flushLine(boolean withNewline) {
+        if (ps != null) {
+            if (withNewline) {
+                lineBuffer.append(LINE_SEPARATOR);
+            }
+            ps.print(lineBuffer.toString());
+            ps.flush();
+            lineBuffer.setLength(0);
+        }
+        return this;
+    }
+
+    /**
+     * Flushes the stream. This is done by terminating the current line if it is not at position 0
+     * and then flushing the underlying output stream.
+     */
+    public void flush() {
+        if (ps != null) {
+            if (lineBuffer.length() != 0) {
+                flushLine(false);
+            }
+            ps.flush();
+        }
+    }
+
+    /**
+     * Gets the current column position of this log stream.
+     *
+     * @return the current column position of this log stream
+     */
+    public int position() {
+        return lineBuffer == null ? 0 : lineBuffer.length();
+
+    }
+
+    /**
+     * Gets the current indentation level for this log stream.
+     *
+     * @return the current indentation level for this log stream.
+     */
+    public int indentationLevel() {
+        return indentationLevel;
+    }
+
+    /**
+     * Adjusts the current indentation level of this log stream.
+     *
+     * @param delta
+     */
+    public void adjustIndentation(int delta) {
+        if (delta < 0) {
+            indentationLevel = Math.max(0, indentationLevel + delta);
+        } else {
+            indentationLevel += delta;
+        }
+    }
+
+    /**
+     * Gets the current indentation character of this log stream.
+     */
+    public char indentation() {
+        return indentation;
+    }
+
+    public void disableIndentation() {
+        indentationDisabled = true;
+    }
+
+    public void enableIndentation() {
+        indentationDisabled = false;
+    }
+
+    /**
+     * Sets the character used for indentation.
+     */
+    public void setIndentation(char c) {
+        indentation = c;
+    }
+
+    /**
+     * Advances this stream's {@linkplain #position() position} to a given position by repeatedly
+     * appending a given character as necessary.
+     *
+     * @param position the position to which this stream's position will be advanced
+     * @param filler the character used to pad the stream
+     */
+    public LogStream fillTo(int position, char filler) {
+        if (ps != null) {
+            indent();
+            while (lineBuffer.length() < position) {
+                lineBuffer.append(filler);
+            }
+        }
+        return this;
+    }
+
+    /**
+     * Writes a boolean value to this stream as {@code "true"} or {@code "false"}.
+     *
+     * @param b the value to be printed
+     * @return this {@link LogStream} instance
+     */
+    public LogStream print(boolean b) {
+        if (ps != null) {
+            indent();
+            lineBuffer.append(b);
+        }
+        return this;
+    }
+
+    /**
+     * Writes a boolean value to this stream followed by a {@linkplain #LINE_SEPARATOR line
+     * separator}.
+     *
+     * @param b the value to be printed
+     * @return this {@link LogStream} instance
+     */
+    public LogStream println(boolean b) {
+        if (ps != null) {
+            indent();
+            lineBuffer.append(b);
+            return flushLine(true);
+        }
+        return this;
+    }
+
+    /**
+     * Writes a character value to this stream.
+     *
+     * @param c the value to be printed
+     * @return this {@link LogStream} instance
+     */
+    public LogStream print(char c) {
+        if (ps != null) {
+            indent();
+            lineBuffer.append(c);
+            if (c == '\n') {
+                if (lineBuffer.indexOf(LINE_SEPARATOR, lineBuffer.length() - LINE_SEPARATOR.length()) != -1) {
+                    flushLine(false);
+                }
+            }
+        }
+        return this;
+    }
+
+    /**
+     * Writes a character value to this stream followed by a {@linkplain #LINE_SEPARATOR line
+     * separator}.
+     *
+     * @param c the value to be printed
+     * @return this {@link LogStream} instance
+     */
+    public LogStream println(char c) {
+        if (ps != null) {
+            indent();
+            lineBuffer.append(c);
+            flushLine(true);
+        }
+        return this;
+    }
+
+    /**
+     * Prints an int value.
+     *
+     * @param i the value to be printed
+     * @return this {@link LogStream} instance
+     */
+    public LogStream print(int i) {
+        if (ps != null) {
+            indent();
+            lineBuffer.append(i);
+        }
+        return this;
+    }
+
+    /**
+     * Writes an int value to this stream followed by a {@linkplain #LINE_SEPARATOR line separator}.
+     *
+     * @param i the value to be printed
+     * @return this {@link LogStream} instance
+     */
+    public LogStream println(int i) {
+        if (ps != null) {
+            indent();
+            lineBuffer.append(i);
+            return flushLine(true);
+        }
+        return this;
+    }
+
+    /**
+     * Writes a float value to this stream.
+     *
+     * @param f the value to be printed
+     * @return this {@link LogStream} instance
+     */
+    public LogStream print(float f) {
+        if (ps != null) {
+            indent();
+            lineBuffer.append(f);
+        }
+        return this;
+    }
+
+    /**
+     * Writes a float value to this stream followed by a {@linkplain #LINE_SEPARATOR line separator}
+     * .
+     *
+     * @param f the value to be printed
+     * @return this {@link LogStream} instance
+     */
+    public LogStream println(float f) {
+        if (ps != null) {
+            indent();
+            lineBuffer.append(f);
+            return flushLine(true);
+        }
+        return this;
+    }
+
+    /**
+     * Writes a long value to this stream.
+     *
+     * @param l the value to be printed
+     * @return this {@link LogStream} instance
+     */
+    public LogStream print(long l) {
+        if (ps != null) {
+            indent();
+            lineBuffer.append(l);
+        }
+        return this;
+    }
+
+    /**
+     * Writes a long value to this stream followed by a {@linkplain #LINE_SEPARATOR line separator}.
+     *
+     * @param l the value to be printed
+     * @return this {@link LogStream} instance
+     */
+    public LogStream println(long l) {
+        if (ps != null) {
+            indent();
+            lineBuffer.append(l);
+            return flushLine(true);
+        }
+        return this;
+    }
+
+    /**
+     * Writes a double value to this stream.
+     *
+     * @param d the value to be printed
+     * @return this {@link LogStream} instance
+     */
+    public LogStream print(double d) {
+        if (ps != null) {
+            indent();
+            lineBuffer.append(d);
+        }
+        return this;
+    }
+
+    /**
+     * Writes a double value to this stream followed by a {@linkplain #LINE_SEPARATOR line
+     * separator}.
+     *
+     * @param d the value to be printed
+     * @return this {@link LogStream} instance
+     */
+    public LogStream println(double d) {
+        if (ps != null) {
+            indent();
+            lineBuffer.append(d);
+            return flushLine(true);
+        }
+        return this;
+    }
+
+    /**
+     * Writes a {@code String} value to this stream. This method ensures that the
+     * {@linkplain #position() position} of this stream is updated correctly with respect to any
+     * {@linkplain #LINE_SEPARATOR line separators} present in {@code s}.
+     *
+     * @param s the value to be printed
+     * @return this {@link LogStream} instance
+     */
+    public LogStream print(String s) {
+        if (ps != null) {
+            if (s == null) {
+                indent();
+                lineBuffer.append(s);
+                return this;
+            }
+
+            int index = 0;
+            int next = s.indexOf(LINE_SEPARATOR, index);
+            while (index < s.length()) {
+                indent();
+                if (next > index) {
+                    lineBuffer.append(s.substring(index, next));
+                    flushLine(true);
+                    index = next + LINE_SEPARATOR.length();
+                    next = s.indexOf(LINE_SEPARATOR, index);
+                } else {
+                    lineBuffer.append(s.substring(index));
+                    break;
+                }
+            }
+        }
+        return this;
+    }
+
+    /**
+     * Writes a {@code String} value to this stream followed by a {@linkplain #LINE_SEPARATOR line
+     * separator}.
+     *
+     * @param s the value to be printed
+     * @return this {@link LogStream} instance
+     */
+    public LogStream println(String s) {
+        if (ps != null) {
+            print(s);
+            flushLine(true);
+        }
+        return this;
+    }
+
+    /**
+     * Writes a formatted string to this stream.
+     *
+     * @param format a format string as described in {@link String#format(String, Object...)}
+     * @param args the arguments to be formatted
+     * @return this {@link LogStream} instance
+     */
+    public LogStream printf(String format, Object... args) {
+        if (ps != null) {
+            print(String.format(format, args));
+        }
+        return this;
+    }
+
+    /**
+     * Writes a {@linkplain #LINE_SEPARATOR line separator} to this stream.
+     *
+     * @return this {@code LogStream} instance
+     */
+    public LogStream println() {
+        if (ps != null) {
+            indent();
+            flushLine(true);
+        }
+        return this;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/TTY.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,305 @@
+/*
+ * 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.jvmci.debug;
+
+import java.io.*;
+import java.lang.reflect.*;
+import java.util.*;
+import java.util.regex.*;
+
+/**
+ * A collection of static methods for printing debug and informational output to a global
+ * {@link LogStream}. The output can be (temporarily) suppressed per thread through use of a
+ * {@linkplain Filter filter}.
+ */
+public class TTY {
+
+    /**
+     * Support for thread-local suppression of {@link TTY}.
+     */
+    public static class Filter {
+
+        private LogStream previous;
+        private final Thread thread = Thread.currentThread();
+
+        /**
+         * Creates an object that will suppress {@link TTY} for the current thread if the given
+         * filter does not match the given object. To revert the suppression state to how it was
+         * before this call, the {@link #remove()} method must be called on the suppression object.
+         *
+         * @param filter the pattern for matching. If {@code null}, then the match is successful. If
+         *            it starts with "~", then a regular expression
+         *            {@linkplain Pattern#matches(String, CharSequence) match} is performed where
+         *            the regular expression is specified by {@code filter} without the "~" prefix.
+         *            Otherwise, a simple {@linkplain String#contains(CharSequence) substring} match
+         *            is performed where {@code filter} is the substring used.
+         * @param object an object whose {@linkplain Object#toString() string} value is matched
+         *            against {@code filter}
+         */
+        public Filter(String filter, Object object) {
+            boolean suppressed = false;
+            if (filter != null) {
+                String input = object.toString();
+                if (filter.startsWith("~")) {
+                    suppressed = !Pattern.matches(filter.substring(1), input);
+                } else {
+                    suppressed = !input.contains(filter);
+                }
+                if (suppressed) {
+                    previous = out();
+                    out.set(LogStream.SINK);
+                }
+            }
+        }
+
+        /**
+         * Creates an object that will suppress {@link TTY} for the current thread. To revert the
+         * suppression state to how it was before this call, the {@link #remove()} method must be
+         * called on this filter object.
+         */
+        public Filter() {
+            previous = out();
+            out.set(LogStream.SINK);
+        }
+
+        /**
+         * Reverts the suppression state of {@link TTY} to how it was before this object was
+         * constructed.
+         */
+        public void remove() {
+            assert thread == Thread.currentThread();
+            if (previous != null) {
+                out.set(previous);
+            }
+        }
+    }
+
+    public static PrintStream cachedOut;
+
+    public static void initialize(PrintStream ps) {
+        cachedOut = ps;
+    }
+
+    private static LogStream createLog() {
+        if (cachedOut == null) {
+            // In case initialize() was not called.
+            cachedOut = System.out;
+        }
+        return new LogStream(cachedOut);
+    }
+
+    private static final ThreadLocal<LogStream> out = new ThreadLocal<LogStream>() {
+
+        @Override
+        protected LogStream initialValue() {
+            return createLog();
+        }
+    };
+
+    public static boolean isSuppressed() {
+        return out.get() == LogStream.SINK;
+    }
+
+    /**
+     * Gets the thread-local log stream to which the static methods of this class send their output.
+     * This will either be a global log stream or the global {@linkplain LogStream#SINK sink}
+     * depending on whether any suppression {@linkplain Filter filters} are in effect for the
+     * current thread.
+     */
+    public static LogStream out() {
+        return out.get();
+    }
+
+    /**
+     * @see LogStream#print(String)
+     */
+    public static void print(String s) {
+        out().print(s);
+    }
+
+    /**
+     * @see LogStream#print(int)
+     */
+    public static void print(int i) {
+        out().print(i);
+    }
+
+    /**
+     * @see LogStream#print(long)
+     */
+    public static void print(long i) {
+        out().print(i);
+    }
+
+    /**
+     * @see LogStream#print(char)
+     */
+    public static void print(char c) {
+        out().print(c);
+    }
+
+    /**
+     * @see LogStream#print(boolean)
+     */
+    public static void print(boolean b) {
+        out().print(b);
+    }
+
+    /**
+     * @see LogStream#print(double)
+     */
+    public static void print(double d) {
+        out().print(d);
+    }
+
+    /**
+     * @see LogStream#print(float)
+     */
+    public static void print(float f) {
+        out().print(f);
+    }
+
+    /**
+     * @see LogStream#println(String)
+     */
+    public static void println(String s) {
+        out().println(s);
+    }
+
+    /**
+     * @see LogStream#println()
+     */
+    public static void println() {
+        out().println();
+    }
+
+    /**
+     * @see LogStream#println(int)
+     */
+    public static void println(int i) {
+        out().println(i);
+    }
+
+    /**
+     * @see LogStream#println(long)
+     */
+    public static void println(long l) {
+        out().println(l);
+    }
+
+    /**
+     * @see LogStream#println(char)
+     */
+    public static void println(char c) {
+        out().println(c);
+    }
+
+    /**
+     * @see LogStream#println(boolean)
+     */
+    public static void println(boolean b) {
+        out().println(b);
+    }
+
+    /**
+     * @see LogStream#println(double)
+     */
+    public static void println(double d) {
+        out().println(d);
+    }
+
+    /**
+     * @see LogStream#println(float)
+     */
+    public static void println(float f) {
+        out().println(f);
+    }
+
+    public static void print(String format, Object... args) {
+        out().printf(format, args);
+    }
+
+    public static void println(String format, Object... args) {
+        out().printf(format + "%n", args);
+    }
+
+    public static void fillTo(int i) {
+        out().fillTo(i, ' ');
+    }
+
+    public static void printFields(Class<?> javaClass) {
+        final String className = javaClass.getSimpleName();
+        TTY.println(className + " {");
+        for (final Field field : javaClass.getFields()) {
+            printField(field, false);
+        }
+        TTY.println("}");
+    }
+
+    public static void printField(final Field field, boolean tabbed) {
+        final String fieldName = String.format("%35s", field.getName());
+        try {
+            String prefix = tabbed ? "" : "    " + fieldName + " = ";
+            String postfix = tabbed ? "\t" : "\n";
+            if (field.getType() == int.class) {
+                TTY.print(prefix + field.getInt(null) + postfix);
+            } else if (field.getType() == boolean.class) {
+                TTY.print(prefix + field.getBoolean(null) + postfix);
+            } else if (field.getType() == float.class) {
+                TTY.print(prefix + field.getFloat(null) + postfix);
+            } else if (field.getType() == String.class) {
+                TTY.print(prefix + field.get(null) + postfix);
+            } else if (field.getType() == Map.class) {
+                Map<?, ?> m = (Map<?, ?>) field.get(null);
+                TTY.print(prefix + printMap(m) + postfix);
+            } else {
+                TTY.print(prefix + field.get(null) + postfix);
+            }
+        } catch (IllegalAccessException e) {
+            // do nothing.
+        }
+    }
+
+    private static String printMap(Map<?, ?> m) {
+        StringBuilder sb = new StringBuilder();
+
+        List<String> keys = new ArrayList<>();
+        for (Object key : m.keySet()) {
+            keys.add((String) key);
+        }
+        Collections.sort(keys);
+
+        for (String key : keys) {
+            sb.append(key);
+            sb.append("\t");
+            sb.append(m.get(key));
+            sb.append("\n");
+        }
+
+        return sb.toString();
+    }
+
+    public static void flush() {
+        out().flush();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/TopLevelDebugConfig.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.debug;
+
+/**
+ * A marker class for a scoped debug configuration covering a compilation region. Useful for
+ * programmatically enabling debug config features.
+ *
+ */
+public class TopLevelDebugConfig extends DelegatingDebugConfig {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/internal/AccumulatedDebugValue.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2015, 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.jvmci.debug.internal;
+
+public abstract class AccumulatedDebugValue extends DebugValue {
+    protected final DebugValue flat;
+
+    public AccumulatedDebugValue(String name, boolean conditional, DebugValue flat) {
+        super(name + "_Accm", conditional);
+        this.flat = flat;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/internal/CloseableCounterImpl.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2015, 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.jvmci.debug.internal;
+
+import com.oracle.jvmci.debug.*;
+
+/**
+ * A helper class for DebugValues that can nest and need to split out accumulated and flat values
+ * for some kind of counter-like measurement.
+ */
+abstract class CloseableCounterImpl implements DebugCloseable {
+
+    protected final CloseableCounterImpl parent;
+    protected final AccumulatedDebugValue counter;
+    protected final long start;
+    protected long nestedAmountToSubtract;
+
+    CloseableCounterImpl(CloseableCounterImpl parent, AccumulatedDebugValue counter) {
+        this.parent = parent;
+        this.start = getCounterValue();
+        this.counter = counter;
+    }
+
+    @Override
+    public void close() {
+        long end = getCounterValue();
+        long difference = end - start;
+        if (parent != null) {
+            if (!counter.getName().equals(parent.counter.getName())) {
+                parent.nestedAmountToSubtract += difference;
+
+                // Look for our counter in an outer scope and fix up
+                // the adjustment to the flat count
+                CloseableCounterImpl ancestor = parent.parent;
+                while (ancestor != null) {
+                    if (ancestor.counter.getName().equals(counter.getName())) {
+                        ancestor.nestedAmountToSubtract -= difference;
+                        break;
+                    }
+                    ancestor = ancestor.parent;
+                }
+            }
+        }
+        long flatAmount = difference - nestedAmountToSubtract;
+        counter.addToCurrentValue(difference);
+        counter.flat.addToCurrentValue(flatAmount);
+    }
+
+    abstract long getCounterValue();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/internal/DebugHistogramAsciiPrinter.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,103 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.debug.internal;
+
+import java.io.*;
+import java.util.*;
+
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.debug.DebugHistogram.CountedValue;
+import com.oracle.jvmci.debug.DebugHistogram.Printer;
+
+/**
+ * Renders a textual representation of a histogram to a given print stream.
+ */
+public class DebugHistogramAsciiPrinter implements Printer {
+
+    public static final int NumberSize = 10;
+    public static final int DefaultNameSize = 50;
+    public static final int DefaultBarSize = 100;
+    public static final int DefaultScale = 1;
+
+    private final PrintStream os;
+    private final int limit;
+    private final int nameSize;
+    private final int barSize;
+    private final int scale;
+
+    public DebugHistogramAsciiPrinter(PrintStream os) {
+        this(os, Integer.MAX_VALUE, DefaultNameSize, DefaultBarSize, DefaultScale);
+    }
+
+    /**
+     * @param os where to print
+     * @param limit limits printing to the {@code limit} most frequent values
+     * @param nameSize the width of the value names column
+     * @param barSize the width of the value frequency column
+     * @param scale a factor by which every result is divided
+     */
+    public DebugHistogramAsciiPrinter(PrintStream os, int limit, int nameSize, int barSize, int scale) {
+        this.os = os;
+        this.limit = limit;
+        this.nameSize = nameSize;
+        this.barSize = barSize;
+        this.scale = scale;
+    }
+
+    public void print(DebugHistogram histogram) {
+        List<CountedValue> list = histogram.getValues();
+        if (list.isEmpty()) {
+            os.printf("%s is empty.%n", histogram.getName());
+            return;
+        }
+
+        // Sum up the total number of elements.
+        long total = list.stream().mapToLong(CountedValue::getCount).sum();
+
+        // Print header.
+        os.printf("%s has %d unique elements and %d total elements:%n", histogram.getName(), list.size(), total / scale);
+
+        long max = list.get(0).getCount() / scale;
+        final int lineSize = nameSize + NumberSize + barSize + 10;
+        printLine(os, '-', lineSize);
+        String formatString = "| %-" + nameSize + "s | %-" + NumberSize + "d | %-" + barSize + "s |\n";
+        for (int i = 0; i < list.size() && i < limit; ++i) {
+            CountedValue cv = list.get(i);
+            long value = cv.getCount() / scale;
+            char[] bar = new char[(int) (((double) value / (double) max) * barSize)];
+            Arrays.fill(bar, '=');
+            String objectString = String.valueOf(cv.getValue());
+            if (objectString.length() > nameSize) {
+                objectString = objectString.substring(0, nameSize - 3) + "...";
+            }
+            os.printf(formatString, objectString, value, new String(bar));
+        }
+        printLine(os, '-', lineSize);
+    }
+
+    private static void printLine(PrintStream printStream, char c, int lineSize) {
+        char[] charArr = new char[lineSize];
+        Arrays.fill(charArr, c);
+        printStream.printf("%s%n", new String(charArr));
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/internal/DebugHistogramImpl.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.debug.internal;
+
+import java.util.*;
+
+import com.oracle.jvmci.debug.*;
+
+public class DebugHistogramImpl implements DebugHistogram {
+
+    private final String name;
+    private HashMap<Object, CountedValue> map = new HashMap<>();
+
+    public DebugHistogramImpl(String name) {
+        this.name = name;
+    }
+
+    public void add(Object value) {
+        CountedValue cv = map.get(value);
+        if (cv == null) {
+            map.put(value, new CountedValue(1, value));
+        } else {
+            cv.inc();
+        }
+    }
+
+    public void add(Object value, long count) {
+        CountedValue cv = map.get(value);
+        if (cv == null) {
+            map.put(value, new CountedValue(count, value));
+        } else {
+            cv.add(count);
+        }
+    }
+
+    @Override
+    public String getName() {
+        return name;
+    }
+
+    public List<CountedValue> getValues() {
+        ArrayList<CountedValue> res = new ArrayList<>(map.values());
+        Collections.sort(res);
+        return res;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/internal/DebugHistogramRPrinter.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.debug.internal;
+
+import java.io.*;
+import java.util.*;
+
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.debug.DebugHistogram.CountedValue;
+import com.oracle.jvmci.debug.DebugHistogram.Printer;
+
+/**
+ * Renders a histogram as an R script to a given print stream. The R script emitted for a histogram
+ * is a simple set of statements for defining a vector of named objects.
+ */
+public class DebugHistogramRPrinter implements Printer {
+
+    private PrintStream os;
+    private int limit;
+
+    public DebugHistogramRPrinter(PrintStream os) {
+        this(os, Integer.MAX_VALUE);
+    }
+
+    /**
+     * @param os where to print
+     * @param limit limits printing to the {@code limit} most frequent values
+     */
+    public DebugHistogramRPrinter(PrintStream os, int limit) {
+        this.os = os;
+        this.limit = limit;
+    }
+
+    public void print(DebugHistogram histogram) {
+        List<CountedValue> list = histogram.getValues();
+        if (list.isEmpty()) {
+            return;
+        }
+
+        String var = histogram.getName().replace('-', '.').replace(' ', '_');
+        os.print(var + " <- c(");
+        for (int i = 0; i < list.size() && i < limit; ++i) {
+            CountedValue cv = list.get(i);
+            if (i != 0) {
+                os.print(", ");
+            }
+            os.print(cv.getCount());
+        }
+        os.println(");");
+
+        os.print("names(" + var + ") <- c(");
+        for (int i = 0; i < list.size() && i < limit; ++i) {
+            CountedValue cv = list.get(i);
+            if (i != 0) {
+                os.print(", ");
+            }
+            os.print("\"" + cv.getValue() + "\"");
+        }
+        os.println(");");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/internal/DebugScope.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,489 @@
+/*
+ * 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.jvmci.debug.internal;
+
+import java.io.*;
+import java.util.*;
+import java.util.concurrent.*;
+
+import com.oracle.jvmci.debug.*;
+
+public final class DebugScope implements Debug.Scope {
+
+    private final class IndentImpl implements Indent {
+
+        private static final String INDENTATION_INCREMENT = "  ";
+
+        final String indent;
+        final IndentImpl parentIndent;
+
+        IndentImpl(IndentImpl parentIndent) {
+            this.parentIndent = parentIndent;
+            this.indent = (parentIndent == null ? "" : parentIndent.indent + INDENTATION_INCREMENT);
+        }
+
+        private void printScopeName(StringBuilder str) {
+            if (logScopeName) {
+                if (parentIndent != null) {
+                    parentIndent.printScopeName(str);
+                }
+                str.append(indent).append("[thread:").append(Thread.currentThread().getId()).append("] scope: ").append(getQualifiedName()).append(System.lineSeparator());
+                logScopeName = false;
+            }
+        }
+
+        public void log(int logLevel, String msg, Object... args) {
+            if (isLogEnabled(logLevel)) {
+                StringBuilder str = new StringBuilder();
+                printScopeName(str);
+                str.append(indent);
+                String result = args.length == 0 ? msg : String.format(msg, args);
+                String lineSep = System.lineSeparator();
+                str.append(result.replace(lineSep, lineSep.concat(indent)));
+                str.append(lineSep);
+                output.append(str);
+                lastUsedIndent = this;
+            }
+        }
+
+        IndentImpl indent() {
+            lastUsedIndent = new IndentImpl(this);
+            return lastUsedIndent;
+        }
+
+        @Override
+        public void close() {
+            if (parentIndent != null) {
+                lastUsedIndent = parentIndent;
+            }
+        }
+    }
+
+    private static final ThreadLocal<DebugScope> instanceTL = new ThreadLocal<>();
+    private static final ThreadLocal<DebugScope> lastClosedTL = new ThreadLocal<>();
+    private static final ThreadLocal<DebugConfig> configTL = new ThreadLocal<>();
+    private static final ThreadLocal<Throwable> lastExceptionThrownTL = new ThreadLocal<>();
+
+    private final DebugScope parent;
+    private final DebugConfig parentConfig;
+    private final boolean sandbox;
+    private IndentImpl lastUsedIndent;
+    private boolean logScopeName;
+
+    private final Object[] context;
+
+    private DebugValueMap valueMap;
+
+    private String qualifiedName;
+    private final String unqualifiedName;
+
+    private static final char SCOPE_SEP = '.';
+
+    private boolean meterEnabled;
+    private boolean timeEnabled;
+    private boolean memUseTrackingEnabled;
+    private boolean verifyEnabled;
+
+    private int currentDumpLevel;
+    private int currentLogLevel;
+
+    private PrintStream output;
+
+    public static DebugScope getInstance() {
+        DebugScope result = instanceTL.get();
+        if (result == null) {
+            DebugScope topLevelDebugScope = new DebugScope(Thread.currentThread());
+            instanceTL.set(topLevelDebugScope);
+            return topLevelDebugScope;
+        } else {
+            return result;
+        }
+    }
+
+    public static DebugConfig getConfig() {
+        return configTL.get();
+    }
+
+    static final Object[] EMPTY_CONTEXT = new Object[0];
+
+    private DebugScope(Thread thread) {
+        this(thread.getName(), null, false);
+        computeValueMap(thread.getName());
+        DebugValueMap.registerTopLevel(getValueMap());
+    }
+
+    private DebugScope(String unqualifiedName, DebugScope parent, boolean sandbox, Object... context) {
+        this.parent = parent;
+        this.sandbox = sandbox;
+        this.parentConfig = getConfig();
+        this.context = context;
+        this.unqualifiedName = unqualifiedName;
+        if (parent != null) {
+            logScopeName = !unqualifiedName.equals("");
+        } else {
+            logScopeName = true;
+        }
+
+        // Be pragmatic: provide a default log stream to prevent a crash if the stream is not
+        // set while logging
+        this.output = TTY.cachedOut;
+        assert context != null;
+    }
+
+    private void computeValueMap(String name) {
+        if (parent != null) {
+            for (DebugValueMap child : parent.getValueMap().getChildren()) {
+                if (child.getName().equals(name)) {
+                    this.valueMap = child;
+                    return;
+                }
+            }
+            this.valueMap = new DebugValueMap(name);
+            parent.getValueMap().addChild(this.valueMap);
+        } else {
+            this.valueMap = new DebugValueMap(name);
+        }
+    }
+
+    public void close() {
+        instanceTL.set(parent);
+        configTL.set(parentConfig);
+        lastClosedTL.set(this);
+    }
+
+    public boolean isDumpEnabled(int dumpLevel) {
+        assert dumpLevel > 0;
+        return currentDumpLevel >= dumpLevel;
+    }
+
+    /**
+     * Enable dumping at the new {@code dumpLevel} for the remainder of enclosing scopes. This only
+     * works if a {@link TopLevelDebugConfig} was installed at a higher scope.
+     *
+     * @param dumpLevel
+     */
+    public static void setDumpLevel(int dumpLevel) {
+        TopLevelDebugConfig config = fetchTopLevelDebugConfig("setDebugLevel");
+        if (config != null) {
+            config.override(DelegatingDebugConfig.Level.DUMP, dumpLevel);
+            recursiveUpdateFlags();
+        }
+    }
+
+    /**
+     * Enable logging at the new {@code logLevel} for the remainder of enclosing scopes. This only
+     * works if a {@link TopLevelDebugConfig} was installed at a higher scope.
+     *
+     * @param logLevel
+     */
+    public static void setLogLevel(int logLevel) {
+        TopLevelDebugConfig config = fetchTopLevelDebugConfig("setLogLevel");
+        if (config != null) {
+            config.override(DelegatingDebugConfig.Level.LOG, logLevel);
+            config.delegate(DelegatingDebugConfig.Feature.LOG_METHOD);
+            recursiveUpdateFlags();
+        }
+    }
+
+    private static void recursiveUpdateFlags() {
+        DebugScope c = DebugScope.getInstance();
+        while (c != null) {
+            c.updateFlags();
+            c = c.parent;
+        }
+    }
+
+    private static TopLevelDebugConfig fetchTopLevelDebugConfig(String msg) {
+        DebugConfig config = getConfig();
+        if (config instanceof TopLevelDebugConfig) {
+            return (TopLevelDebugConfig) config;
+        } else {
+            if (config == null) {
+                TTY.println("DebugScope.%s ignored because debugging is disabled", msg);
+            } else {
+                TTY.println("DebugScope.%s ignored because top level delegate config missing", msg);
+            }
+            return null;
+        }
+    }
+
+    public boolean isVerifyEnabled() {
+        return verifyEnabled;
+    }
+
+    public boolean isLogEnabled(int logLevel) {
+        assert logLevel > 0;
+        return currentLogLevel >= logLevel;
+    }
+
+    public boolean isMeterEnabled() {
+        return meterEnabled;
+    }
+
+    public boolean isTimeEnabled() {
+        return timeEnabled;
+    }
+
+    public boolean isMemUseTrackingEnabled() {
+        return memUseTrackingEnabled;
+    }
+
+    public void log(int logLevel, String msg, Object... args) {
+        if (isLogEnabled(logLevel)) {
+            getLastUsedIndent().log(logLevel, msg, args);
+        }
+    }
+
+    public void dump(int dumpLevel, Object object, String formatString, Object... args) {
+        if (isDumpEnabled(dumpLevel)) {
+            DebugConfig config = getConfig();
+            if (config != null) {
+                String message = String.format(formatString, args);
+                for (DebugDumpHandler dumpHandler : config.dumpHandlers()) {
+                    dumpHandler.dump(object, message);
+                }
+            }
+        }
+    }
+
+    /**
+     * This method exists mainly to allow a debugger (e.g., Eclipse) to force dump a graph.
+     */
+    public static void forceDump(Object object, String format, Object... args) {
+        DebugConfig config = getConfig();
+        if (config != null) {
+            String message = String.format(format, args);
+            for (DebugDumpHandler dumpHandler : config.dumpHandlers()) {
+                dumpHandler.dump(object, message);
+            }
+        } else {
+            TTY.println("Forced dump ignored because debugging is disabled - use -G:Dump=xxx option");
+        }
+    }
+
+    /**
+     * @see Debug#verify(Object, String)
+     */
+    public void verify(Object object, String formatString, Object... args) {
+        if (isVerifyEnabled()) {
+            DebugConfig config = getConfig();
+            if (config != null) {
+                String message = String.format(formatString, args);
+                for (DebugVerifyHandler handler : config.verifyHandlers()) {
+                    handler.verify(object, message);
+                }
+            }
+        }
+    }
+
+    /**
+     * Creates and enters a new debug scope which is either a child of the current scope or a
+     * disjoint top level scope.
+     *
+     * @param name the name of the new scope
+     * @param sandboxConfig the configuration to use for a new top level scope, or null if the new
+     *            scope should be a child scope
+     * @param newContextObjects objects to be appended to the debug context
+     * @return the new scope which will be exited when its {@link #close()} method is called
+     */
+    public DebugScope scope(CharSequence name, DebugConfig sandboxConfig, Object... newContextObjects) {
+        DebugScope newScope = null;
+        if (sandboxConfig != null) {
+            newScope = new DebugScope(name.toString(), this, true, newContextObjects);
+            configTL.set(sandboxConfig);
+        } else {
+            newScope = this.createChild(name.toString(), newContextObjects);
+        }
+        instanceTL.set(newScope);
+        newScope.updateFlags();
+        return newScope;
+    }
+
+    public RuntimeException handle(Throwable e) {
+        DebugScope lastClosed = lastClosedTL.get();
+        assert lastClosed.parent == this : "Debug.handle() used with no matching Debug.scope(...) or Debug.sandbox(...)";
+        if (e != lastExceptionThrownTL.get()) {
+            RuntimeException newException = null;
+            instanceTL.set(lastClosed);
+            try (DebugScope s = lastClosed) {
+                newException = s.interceptException(e);
+            }
+            assert instanceTL.get() == this;
+            assert lastClosed == lastClosedTL.get();
+            if (newException == null) {
+                lastExceptionThrownTL.set(e);
+            } else {
+                lastExceptionThrownTL.set(newException);
+                throw newException;
+            }
+        }
+        if (e instanceof Error) {
+            throw (Error) e;
+        }
+        if (e instanceof RuntimeException) {
+            throw (RuntimeException) e;
+        }
+        throw new RuntimeException(e);
+    }
+
+    private void updateFlags() {
+        DebugConfig config = getConfig();
+        if (config == null) {
+            meterEnabled = false;
+            memUseTrackingEnabled = false;
+            timeEnabled = false;
+            verifyEnabled = false;
+
+            currentDumpLevel = 0;
+
+            // Be pragmatic: provide a default log stream to prevent a crash if the stream is not
+            // set while logging
+            output = TTY.cachedOut;
+        } else {
+            meterEnabled = config.isMeterEnabled();
+            memUseTrackingEnabled = config.isMemUseTrackingEnabled();
+            timeEnabled = config.isTimeEnabled();
+            verifyEnabled = config.isVerifyEnabled();
+            output = config.output();
+            currentDumpLevel = config.getDumpLevel();
+            currentLogLevel = config.getLogLevel();
+        }
+    }
+
+    private RuntimeException interceptException(final Throwable e) {
+        final DebugConfig config = getConfig();
+        if (config != null) {
+            try (DebugScope s = scope("InterceptException", null, e)) {
+                return config.interceptException(e);
+            } catch (Throwable t) {
+                return new RuntimeException("Exception while intercepting exception", t);
+            }
+        }
+        return null;
+    }
+
+    private DebugValueMap getValueMap() {
+        if (valueMap == null) {
+            computeValueMap(unqualifiedName);
+        }
+        return valueMap;
+    }
+
+    long getCurrentValue(int index) {
+        return getValueMap().getCurrentValue(index);
+    }
+
+    void setCurrentValue(int index, long l) {
+        getValueMap().setCurrentValue(index, l);
+    }
+
+    private DebugScope createChild(String newName, Object[] newContext) {
+        return new DebugScope(newName, this, false, newContext);
+    }
+
+    public Iterable<Object> getCurrentContext() {
+        final DebugScope scope = this;
+        return new Iterable<Object>() {
+
+            @Override
+            public Iterator<Object> iterator() {
+                return new Iterator<Object>() {
+
+                    DebugScope currentScope = scope;
+                    int objectIndex;
+
+                    @Override
+                    public boolean hasNext() {
+                        selectScope();
+                        return currentScope != null;
+                    }
+
+                    private void selectScope() {
+                        while (currentScope != null && currentScope.context.length <= objectIndex) {
+                            currentScope = currentScope.sandbox ? null : currentScope.parent;
+                            objectIndex = 0;
+                        }
+                    }
+
+                    @Override
+                    public Object next() {
+                        selectScope();
+                        if (currentScope != null) {
+                            return currentScope.context[objectIndex++];
+                        }
+                        throw new IllegalStateException("May only be called if there is a next element.");
+                    }
+
+                    @Override
+                    public void remove() {
+                        throw new UnsupportedOperationException("This iterator is read only.");
+                    }
+                };
+            }
+        };
+    }
+
+    public static <T> T call(Callable<T> callable) {
+        try {
+            return callable.call();
+        } catch (Exception e) {
+            if (e instanceof RuntimeException) {
+                throw (RuntimeException) e;
+            } else {
+                throw new RuntimeException(e);
+            }
+        }
+    }
+
+    public void setConfig(DebugConfig newConfig) {
+        configTL.set(newConfig);
+        updateFlags();
+    }
+
+    public String getQualifiedName() {
+        if (qualifiedName == null) {
+            if (parent == null) {
+                qualifiedName = unqualifiedName;
+            } else {
+                qualifiedName = parent.getQualifiedName() + SCOPE_SEP + unqualifiedName;
+            }
+        }
+        return qualifiedName;
+    }
+
+    public Indent pushIndentLogger() {
+        lastUsedIndent = getLastUsedIndent().indent();
+        return lastUsedIndent;
+    }
+
+    public IndentImpl getLastUsedIndent() {
+        if (lastUsedIndent == null) {
+            if (parent != null) {
+                lastUsedIndent = new IndentImpl(parent.getLastUsedIndent());
+            } else {
+                lastUsedIndent = new IndentImpl(null);
+            }
+        }
+        return lastUsedIndent;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/internal/DebugValue.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,94 @@
+/*
+ * 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.jvmci.debug.internal;
+
+/**
+ * A name and index for a value managed in a thread local value map. All access to the value is made
+ * via a {@link DebugValue} instance.
+ */
+public abstract class DebugValue implements Comparable<DebugValue> {
+
+    private final String name;
+    private int index;
+    private boolean conditional;
+
+    protected DebugValue(String name, boolean conditional) {
+        this.name = name;
+        this.index = -1;
+        this.conditional = conditional;
+    }
+
+    public long getCurrentValue() {
+        ensureInitialized();
+        return DebugScope.getInstance().getCurrentValue(index);
+    }
+
+    protected void setCurrentValue(long l) {
+        ensureInitialized();
+        DebugScope.getInstance().setCurrentValue(index, l);
+    }
+
+    public void setConditional(boolean flag) {
+        conditional = flag;
+    }
+
+    public boolean isConditional() {
+        return conditional;
+    }
+
+    private void ensureInitialized() {
+        if (index == -1) {
+            index = KeyRegistry.register(this);
+        }
+    }
+
+    protected void addToCurrentValue(long value) {
+        setCurrentValue(getCurrentValue() + value);
+    }
+
+    /**
+     * Gets the globally unique index for the value represented by this object.
+     */
+    public int getIndex() {
+        ensureInitialized();
+        return index;
+    }
+
+    /**
+     * Gets the globally unique name for the value represented by this object.
+     */
+    public String getName() {
+        return name;
+    }
+
+    public int compareTo(DebugValue o) {
+        return name.compareTo(o.name);
+    }
+
+    @Override
+    public String toString() {
+        return name + "@" + index;
+    }
+
+    public abstract String toString(long value);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/internal/DebugValueMap.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,171 @@
+/*
+ * 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.jvmci.debug.internal;
+
+import java.util.*;
+
+/**
+ * A node in a tree of {@link DebugValue}s.
+ */
+public class DebugValueMap {
+
+    private static final List<DebugValueMap> topLevelMaps = new ArrayList<>();
+
+    private long[] values;
+    private List<DebugValueMap> children;
+    private String name;
+
+    public DebugValueMap(String name) {
+        this.name = name;
+    }
+
+    public void setCurrentValue(int index, long l) {
+        ensureSize(index);
+        values[index] = l;
+    }
+
+    public long getCurrentValue(int index) {
+        ensureSize(index);
+        return values[index];
+    }
+
+    public void clearChildren() {
+        if (children != null) {
+            children.clear();
+        }
+    }
+
+    public void reset() {
+        if (values != null) {
+            Arrays.fill(values, 0L);
+        }
+        if (children != null) {
+            for (DebugValueMap child : children) {
+                child.reset();
+            }
+        }
+    }
+
+    private void ensureSize(int index) {
+        if (values == null) {
+            values = new long[index + 1];
+        }
+        if (values.length <= index) {
+            values = Arrays.copyOf(values, index + 1);
+        }
+    }
+
+    private int capacity() {
+        return (values == null) ? 0 : values.length;
+    }
+
+    public void addChild(DebugValueMap map) {
+        if (children == null) {
+            children = new ArrayList<>(4);
+        }
+        children.add(map);
+    }
+
+    public List<DebugValueMap> getChildren() {
+        if (children == null) {
+            return Collections.emptyList();
+        } else {
+            return Collections.unmodifiableList(children);
+        }
+    }
+
+    public boolean hasChildren() {
+        return children != null && !children.isEmpty();
+    }
+
+    public String getName() {
+        return this.name;
+    }
+
+    @Override
+    public String toString() {
+        return "DebugValueMap<" + getName() + ">";
+    }
+
+    public static synchronized void registerTopLevel(DebugValueMap map) {
+        topLevelMaps.add(map);
+    }
+
+    public static synchronized List<DebugValueMap> getTopLevelMaps() {
+        return topLevelMaps;
+    }
+
+    public void normalize() {
+        if (hasChildren()) {
+            Map<String, DebugValueMap> occurred = new HashMap<>();
+            for (DebugValueMap map : children) {
+                String mapName = map.getName();
+                if (!occurred.containsKey(mapName)) {
+                    occurred.put(mapName, map);
+                    map.normalize();
+                } else {
+                    occurred.get(mapName).mergeWith(map);
+                    occurred.get(mapName).normalize();
+                }
+            }
+
+            if (occurred.values().size() < children.size()) {
+                // At least one duplicate was found.
+                children.clear();
+                for (DebugValueMap map : occurred.values()) {
+                    addChild(map);
+                    map.normalize();
+                }
+            }
+        }
+    }
+
+    private void mergeWith(DebugValueMap map) {
+        if (map.hasChildren()) {
+            if (hasChildren()) {
+                children.addAll(map.children);
+            } else {
+                children = map.children;
+            }
+            map.children = null;
+        }
+
+        int size = Math.max(this.capacity(), map.capacity());
+        ensureSize(size);
+        for (int i = 0; i < size; ++i) {
+            long curValue = getCurrentValue(i);
+            long otherValue = map.getCurrentValue(i);
+            setCurrentValue(i, curValue + otherValue);
+        }
+    }
+
+    public void group() {
+        if (this.hasChildren()) {
+            List<DebugValueMap> oldChildren = new ArrayList<>(this.children);
+            this.children.clear();
+            for (DebugValueMap map : oldChildren) {
+                mergeWith(map);
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/internal/KeyRegistry.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,57 @@
+/*
+ * 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.jvmci.debug.internal;
+
+import java.util.*;
+
+/**
+ * Registry for allocating a globally unique integer id to each {@link DebugValue}.
+ */
+public class KeyRegistry {
+
+    private static final Map<String, Integer> keyMap = new HashMap<>();
+    private static final List<DebugValue> debugValues = new ArrayList<>();
+
+    /**
+     * Ensures a given debug value is registered.
+     *
+     * @return the globally unique id for {@code value}
+     */
+    public static synchronized int register(DebugValue value) {
+        String name = value.getName();
+        if (!keyMap.containsKey(name)) {
+            keyMap.put(name, debugValues.size());
+            debugValues.add(value);
+        }
+        return keyMap.get(name);
+    }
+
+    /**
+     * Gets a immutable view of the registered debug values.
+     *
+     * @return a list where {@code get(i).getIndex() == i}
+     */
+    public static synchronized List<DebugValue> getDebugValues() {
+        return Collections.unmodifiableList(debugValues);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/internal/MemUseTrackerImpl.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,98 @@
+/*
+ * 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.jvmci.debug.internal;
+
+import static com.oracle.jvmci.debug.DebugCloseable.*;
+import static java.lang.Thread.*;
+
+import java.lang.management.*;
+
+import com.oracle.jvmci.debug.*;
+import com.sun.management.ThreadMXBean;
+
+public final class MemUseTrackerImpl extends AccumulatedDebugValue implements DebugMemUseTracker {
+
+    private static final ThreadMXBean threadMXBean = (ThreadMXBean) ManagementFactory.getThreadMXBean();
+
+    /**
+     * The amount of memory allocated by {@link ThreadMXBean#getThreadAllocatedBytes(long)} itself.
+     */
+    private static final long threadMXBeanOverhead = -getCurrentThreadAllocatedBytes() + getCurrentThreadAllocatedBytes();
+
+    public static long getCurrentThreadAllocatedBytes() {
+        return threadMXBean.getThreadAllocatedBytes(currentThread().getId()) - threadMXBeanOverhead;
+    }
+
+    /**
+     * Records the most recent active tracker.
+     */
+    private static final ThreadLocal<CloseableCounterImpl> currentTracker = new ThreadLocal<>();
+
+    public MemUseTrackerImpl(String name, boolean conditional) {
+        super(name, conditional, new DebugValue(name + "_Flat", conditional) {
+
+            @Override
+            public String toString(long value) {
+                return valueToString(value);
+            }
+        });
+    }
+
+    @Override
+    public DebugCloseable start() {
+        if (!isConditional() || Debug.isMemUseTrackingEnabled()) {
+            MemUseCloseableCounterImpl result = new MemUseCloseableCounterImpl(this);
+            currentTracker.set(result);
+            return result;
+        } else {
+            return VOID_CLOSEABLE;
+        }
+    }
+
+    public static String valueToString(long value) {
+        return String.format("%d bytes", value);
+    }
+
+    @Override
+    public String toString(long value) {
+        return valueToString(value);
+    }
+
+    private static final class MemUseCloseableCounterImpl extends CloseableCounterImpl implements DebugCloseable {
+
+        private MemUseCloseableCounterImpl(AccumulatedDebugValue counter) {
+            super(currentTracker.get(), counter);
+        }
+
+        @Override
+        long getCounterValue() {
+            return getCurrentThreadAllocatedBytes();
+        }
+
+        @Override
+        public void close() {
+            super.close();
+            currentTracker.set(parent);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/internal/MetricImpl.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,51 @@
+/*
+ * 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.jvmci.debug.internal;
+
+import com.oracle.jvmci.debug.*;
+
+public final class MetricImpl extends DebugValue implements DebugMetric {
+
+    public MetricImpl(String name, boolean conditional) {
+        super(name, conditional);
+        if (isEnabled()) {
+            // Allows for zero-count metrics to be shown
+            getCurrentValue();
+        }
+    }
+
+    public void increment() {
+        add(1);
+    }
+
+    public void add(long value) {
+        if (isEnabled()) {
+            super.addToCurrentValue(value);
+        }
+    }
+
+    @Override
+    public String toString(long value) {
+        return Long.toString(value);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/internal/TimerImpl.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,136 @@
+/*
+ * 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.jvmci.debug.internal;
+
+import static com.oracle.jvmci.debug.DebugCloseable.*;
+
+import java.lang.management.*;
+import java.util.concurrent.*;
+
+import com.oracle.jvmci.debug.*;
+
+public final class TimerImpl extends AccumulatedDebugValue implements DebugTimer {
+
+    private static final ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean();
+
+    /**
+     * Records the most recent active timer.
+     */
+    private static final ThreadLocal<CloseableCounterImpl> currentTimer = new ThreadLocal<>();
+
+    static class FlatTimer extends DebugValue implements DebugTimer {
+        private TimerImpl accm;
+
+        public FlatTimer(String name, boolean conditional) {
+            super(name + "_Flat", conditional);
+        }
+
+        @Override
+        public String toString(long value) {
+            return valueToString(value);
+        }
+
+        public TimeUnit getTimeUnit() {
+            return accm.getTimeUnit();
+        }
+
+        public DebugCloseable start() {
+            return accm.start();
+        }
+    }
+
+    public TimerImpl(String name, boolean conditional) {
+        super(name, conditional, new FlatTimer(name, conditional));
+        ((FlatTimer) flat).accm = this;
+    }
+
+    @Override
+    public DebugCloseable start() {
+        if (!isConditional() || Debug.isTimeEnabled()) {
+            AbstractTimer result;
+            if (threadMXBean.isCurrentThreadCpuTimeSupported()) {
+                result = new CpuTimeTimer(this);
+            } else {
+                result = new SystemNanosTimer(this);
+            }
+            currentTimer.set(result);
+            return result;
+        } else {
+            return VOID_CLOSEABLE;
+        }
+    }
+
+    public static String valueToString(long value) {
+        return String.format("%d.%d ms", value / 1000000, (value / 100000) % 10);
+    }
+
+    public DebugTimer getFlat() {
+        return (FlatTimer) flat;
+    }
+
+    @Override
+    public String toString(long value) {
+        return valueToString(value);
+    }
+
+    public TimeUnit getTimeUnit() {
+        return TimeUnit.NANOSECONDS;
+    }
+
+    private abstract static class AbstractTimer extends CloseableCounterImpl implements DebugCloseable {
+
+        private AbstractTimer(AccumulatedDebugValue counter) {
+            super(currentTimer.get(), counter);
+        }
+
+        @Override
+        public void close() {
+            super.close();
+            currentTimer.set(parent);
+        }
+    }
+
+    private final class SystemNanosTimer extends AbstractTimer {
+
+        public SystemNanosTimer(TimerImpl timer) {
+            super(timer);
+        }
+
+        @Override
+        protected long getCounterValue() {
+            return System.nanoTime();
+        }
+    }
+
+    private final class CpuTimeTimer extends AbstractTimer {
+
+        public CpuTimeTimer(TimerImpl timer) {
+            super(timer);
+        }
+
+        @Override
+        protected long getCounterValue() {
+            return threadMXBean.getCurrentThreadCpuTime();
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.hotspot.loader/src/com/oracle/jvmci/hotspot/loader/Factory.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.hotspot.loader;
+
+import java.io.*;
+import java.net.*;
+import java.util.*;
+
+/**
+ * Utility to create and register a separate class loader for loading JVMCI classes (i.e., those in
+ * found in lib/jvmci/*.jar).
+ */
+public class Factory {
+
+    /**
+     * Copy of the {@code UseJVMCIClassLoader} VM option. Set by the VM before the static
+     * initializer is called.
+     */
+    private static boolean useJVMCIClassLoader;
+
+    /**
+     * Registers the JVMCI class loader in the VM.
+     */
+    private static native void init(ClassLoader loader);
+
+    static {
+        init(useJVMCIClassLoader ? newClassLoader() : null);
+    }
+
+    /**
+     * Creates a new class loader for loading JVMCI classes.
+     */
+    private static ClassLoader newClassLoader() {
+        URL[] urls = getJVMCIJarsUrls();
+        ClassLoader parent = null;
+        return URLClassLoader.newInstance(urls, parent);
+    }
+
+    /**
+     * Gets the URLs for lib/jvmci/*.jar.
+     */
+    private static URL[] getJVMCIJarsUrls() {
+        File javaHome = new File(System.getProperty("java.home"));
+        File lib = new File(javaHome, "lib");
+        File jvmci = new File(lib, "jvmci");
+        if (!jvmci.exists()) {
+            throw new InternalError(jvmci + " does not exist");
+        }
+
+        List<URL> urls = new ArrayList<>();
+        for (String fileName : jvmci.list()) {
+            if (fileName.endsWith(".jar")) {
+                File file = new File(jvmci, fileName);
+                if (file.isDirectory()) {
+                    continue;
+                }
+                try {
+                    urls.add(file.toURI().toURL());
+                } catch (MalformedURLException e) {
+                    throw new InternalError(e);
+                }
+            }
+        }
+
+        return urls.toArray(new URL[urls.size()]);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/CompilerToVM.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,342 @@
+/*
+ * 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.jvmci.hotspot;
+
+import sun.misc.*;
+
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.hotspotvmconfig.*;
+import com.oracle.jvmci.meta.*;
+
+/**
+ * Calls from Java into HotSpot.
+ */
+public interface CompilerToVM {
+
+    /**
+     * Copies the original bytecode of a given method into a new byte array and returns it.
+     *
+     * @param metaspaceMethod the metaspace Method object
+     * @return a new byte array containing the original bytecode
+     */
+    byte[] getBytecode(long metaspaceMethod);
+
+    int exceptionTableLength(long metaspaceMethod);
+
+    long exceptionTableStart(long metaspaceMethod);
+
+    /**
+     * Determines if a given metaspace Method object has balanced monitors.
+     *
+     * @param metaspaceMethod the metaspace Method object to query
+     * @return true if the method has balanced monitors
+     */
+    boolean hasBalancedMonitors(long metaspaceMethod);
+
+    /**
+     * Determines if a given metaspace Method can be inlined. A method may not be inlinable for a
+     * number of reasons such as:
+     * <ul>
+     * <li>a CompileOracle directive may prevent inlining or compilation of methods</li>
+     * <li>the method may have a bytecode breakpoint set</li>
+     * <li>the method may have other bytecode features that require special handling by the VM</li>
+     * </ul>
+     *
+     * @param metaspaceMethod the metaspace Method object to query
+     * @return true if the method can be inlined
+     */
+    boolean canInlineMethod(long metaspaceMethod);
+
+    /**
+     * Determines if a given metaspace Method should be inlined at any cost. This could be because:
+     * <ul>
+     * <li>a CompileOracle directive may forces inlining of this methods</li>
+     * <li>an annotation forces inlining of this method</li>
+     * </ul>
+     *
+     * @param metaspaceMethod the metaspace Method object to query
+     * @return true if the method should be inlined
+     */
+    boolean shouldInlineMethod(long metaspaceMethod);
+
+    /**
+     * Used to implement {@link ResolvedJavaType#findUniqueConcreteMethod(ResolvedJavaMethod)}.
+     *
+     * @param metaspaceMethod the metaspace Method on which to based the search
+     * @param actualHolderMetaspaceKlass the best known type of receiver
+     * @return the metaspace Method result or 0 is there is no unique concrete method for
+     *         {@code metaspaceMethod}
+     */
+    long findUniqueConcreteMethod(long actualHolderMetaspaceKlass, long metaspaceMethod);
+
+    /**
+     * Returns the implementor for the given interface class, if there is a single implementor.
+     *
+     * @param metaspaceKlass the metaspace klass to get the implementor for
+     * @return the implementor as metaspace klass pointer if there is a single implementor, null if
+     *         there is no implementor, or the input metaspace klass pointer ({@code metaspaceKlass}
+     *         ) itself if there is more than one implementor.
+     */
+    long getKlassImplementor(long metaspaceKlass);
+
+    /**
+     * Determines if a given metaspace method is ignored by security stack walks.
+     *
+     * @param metaspaceMethod the metaspace Method object
+     * @return true if the method is ignored
+     */
+    boolean methodIsIgnoredBySecurityStackWalk(long metaspaceMethod);
+
+    /**
+     * Converts a name to a metaspace klass.
+     *
+     * @param name a well formed Java type in {@linkplain JavaType#getName() internal} format
+     * @param accessingClass the context of resolution (must not be null)
+     * @param resolve force resolution to a {@link ResolvedJavaType}. If true, this method will
+     *            either return a {@link ResolvedJavaType} or throw an exception
+     * @return a metaspace klass for {@code name}
+     * @throws LinkageError if {@code resolve == true} and the resolution failed
+     */
+    long lookupType(String name, Class<?> accessingClass, boolean resolve);
+
+    Object resolveConstantInPool(long metaspaceConstantPool, int cpi);
+
+    Object resolvePossiblyCachedConstantInPool(long metaspaceConstantPool, int cpi);
+
+    int lookupNameAndTypeRefIndexInPool(long metaspaceConstantPool, int cpi);
+
+    String lookupNameRefInPool(long metaspaceConstantPool, int cpi);
+
+    String lookupSignatureRefInPool(long metaspaceConstantPool, int cpi);
+
+    int lookupKlassRefIndexInPool(long metaspaceConstantPool, int cpi);
+
+    long constantPoolKlassAt(long metaspaceConstantPool, int cpi);
+
+    /**
+     * Looks up a class entry in a constant pool.
+     *
+     * @param metaspaceConstantPool metaspace constant pool pointer
+     * @param cpi constant pool index
+     * @return a metaspace Klass for a resolved method entry, a metaspace Symbol otherwise (with
+     *         tagging)
+     */
+    long lookupKlassInPool(long metaspaceConstantPool, int cpi);
+
+    /**
+     * Looks up a method entry in a constant pool.
+     *
+     * @param metaspaceConstantPool metaspace constant pool pointer
+     * @param cpi constant pool index
+     * @return a metaspace Method for a resolved method entry, 0 otherwise
+     */
+    long lookupMethodInPool(long metaspaceConstantPool, int cpi, byte opcode);
+
+    /**
+     * Looks up a field entry in a constant pool and attempts to resolve it. The values returned in
+     * {@code info} are:
+     *
+     * <pre>
+     *     [(int) flags,   // only valid if field is resolved
+     *      (int) offset]  // only valid if field is resolved
+     * </pre>
+     *
+     * @param metaspaceConstantPool metaspace constant pool pointer
+     * @param cpi constant pool index
+     * @param info an array in which the details of the field are returned
+     * @return true if the field is resolved
+     */
+    long resolveField(long metaspaceConstantPool, int cpi, byte opcode, long[] info);
+
+    int constantPoolRemapInstructionOperandFromCache(long metaspaceConstantPool, int cpi);
+
+    Object lookupAppendixInPool(long metaspaceConstantPool, int cpi);
+
+    /**
+     * Installs the result of a compilation into the code cache.
+     *
+     * @param compiledCode the result of a compilation
+     * @param code the details of the installed CodeBlob are written to this object
+     * @return the outcome of the installation which will be one of
+     *         {@link HotSpotVMConfig#codeInstallResultOk},
+     *         {@link HotSpotVMConfig#codeInstallResultCacheFull},
+     *         {@link HotSpotVMConfig#codeInstallResultCodeTooLarge},
+     *         {@link HotSpotVMConfig#codeInstallResultDependenciesFailed} or
+     *         {@link HotSpotVMConfig#codeInstallResultDependenciesInvalid}.
+     */
+    int installCode(HotSpotCompiledCode compiledCode, InstalledCode code, SpeculationLog speculationLog);
+
+    /**
+     * Notifies the VM of statistics for a completed compilation.
+     *
+     * @param id the identifier of the compilation
+     * @param method the method compiled
+     * @param osr specifies if the compilation was for on-stack-replacement
+     * @param processedBytecodes the number of bytecodes processed during the compilation, including
+     *            the bytecodes of all inlined methods
+     * @param time the amount time spent compiling {@code method}
+     * @param timeUnitsPerSecond the granularity of the units for the {@code time} value
+     * @param installedCode the nmethod installed as a result of the compilation
+     */
+    void notifyCompilationStatistics(int id, HotSpotResolvedJavaMethod method, boolean osr, int processedBytecodes, long time, long timeUnitsPerSecond, InstalledCode installedCode);
+
+    void resetCompilationStatistics();
+
+    void initializeConfiguration(HotSpotVMConfig config);
+
+    long resolveMethod(long metaspaceKlassExactReceiver, long metaspaceMethod, long metaspaceKlassCaller);
+
+    long getClassInitializer(long metaspaceKlass);
+
+    boolean hasFinalizableSubclass(long metaspaceKlass);
+
+    /**
+     * Gets the metaspace Method object corresponding to a given {@link Class} object and slot
+     * number.
+     *
+     * @param holder method holder
+     * @param slot slot number of the method
+     * @return the metaspace Method
+     */
+    long getMetaspaceMethod(Class<?> holder, int slot);
+
+    long getMaxCallTargetOffset(long address);
+
+    String disassembleCodeBlob(long codeBlob);
+
+    StackTraceElement getStackTraceElement(long metaspaceMethod, int bci);
+
+    Object executeCompiledMethod(Object arg1, Object arg2, Object arg3, InstalledCode hotspotInstalledCode) throws InvalidInstalledCodeException;
+
+    Object executeCompiledMethodVarargs(Object[] args, InstalledCode hotspotInstalledCode) throws InvalidInstalledCodeException;
+
+    long[] getLineNumberTable(long metaspaceMethod);
+
+    long getLocalVariableTableStart(long metaspaceMethod);
+
+    int getLocalVariableTableLength(long metaspaceMethod);
+
+    String getFileName(HotSpotResolvedJavaType method);
+
+    Class<?> getJavaMirror(long metaspaceKlass);
+
+    long readUnsafeKlassPointer(Object o);
+
+    /**
+     * Reads an object pointer within a VM data structure. That is, any {@link HotSpotVMField} whose
+     * {@link HotSpotVMField#type() type} is {@code "oop"} (e.g.,
+     * {@code ArrayKlass::_component_mirror}, {@code Klass::_java_mirror},
+     * {@code JavaThread::_threadObj}).
+     *
+     * Note that {@link Unsafe#getObject(Object, long)} cannot be used for this since it does a
+     * {@code narrowOop} read if the VM is using compressed oops whereas oops within VM data
+     * structures are (currently) always uncompressed.
+     *
+     * @param address address of an oop field within a VM data structure
+     */
+    Object readUncompressedOop(long address);
+
+    void doNotInlineOrCompile(long metaspaceMethod);
+
+    /**
+     * Invalidates the profiling information and restarts profiling upon the next invocation.
+     *
+     * @param metaspaceMethod the metaspace Method object
+     */
+    void reprofile(long metaspaceMethod);
+
+    void invalidateInstalledCode(InstalledCode hotspotInstalledCode);
+
+    /**
+     * Collects the current values of all JVMCI benchmark counters, summed up over all threads.
+     */
+    long[] collectCounters();
+
+    boolean isMature(long metaspaceMethodData);
+
+    /**
+     * Generate a unique id to identify the result of the compile.
+     */
+    int allocateCompileId(long metaspaceMethod, int entryBCI);
+
+    /**
+     * Gets the names of the supported GPU architectures.
+     *
+     * @return a comma separated list of names
+     */
+    String getGPUs();
+
+    /**
+     *
+     * @param metaspaceMethod the method to check
+     * @param entryBCI
+     * @param level the compilation level
+     * @return true if the {@code metaspaceMethod} has code for {@code level}
+     */
+    boolean hasCompiledCodeForOSR(long metaspaceMethod, int entryBCI, int level);
+
+    /**
+     * Fetch the time stamp used for printing inside hotspot. It's relative to VM start to that all
+     * events can be ordered.
+     *
+     * @return milliseconds since VM start
+     */
+    long getTimeStamp();
+
+    /**
+     * Gets the value of a metaspace {@code Symbol} as a String.
+     *
+     * @param metaspaceSymbol
+     */
+    String getSymbol(long metaspaceSymbol);
+
+    /**
+     * Looks for the next Java stack frame with the given method.
+     *
+     * @param frame the starting point of the search, where {@code null} refers to the topmost frame
+     * @param methods the metaspace methods to look for, where {@code null} means that any frame is
+     *            returned
+     * @return the frame, or {@code null} if the end of the stack was reached during the search
+     */
+    HotSpotStackFrameReference getNextStackFrame(HotSpotStackFrameReference frame, long[] methods, int initialSkip);
+
+    /**
+     * Materialized all virtual objects within the given stack frame and update the locals within
+     * the given stackFrame object.
+     *
+     * @param invalidate if {@code true}, the compiled method for the stack frame will be
+     *            invalidated.
+     */
+    void materializeVirtualObjects(HotSpotStackFrameReference stackFrame, boolean invalidate);
+
+    void resolveInvokeDynamic(long metaspaceConstantPool, int index);
+
+    int getVtableIndexForInterface(long metaspaceKlass, long metaspaceMethod);
+
+    boolean shouldDebugNonSafepoints();
+
+    void writeDebugOutput(byte[] bytes, int offset, int length);
+
+    void flushDebugOutput();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/CompilerToVMImpl.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,205 @@
+/*
+ * Copyright (c) 2011, 2015, 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.jvmci.hotspot;
+
+import static com.oracle.jvmci.hotspot.InitTimer.*;
+
+import com.oracle.jvmci.code.*;
+
+/**
+ * Entries into the HotSpot VM from Java code.
+ */
+public class CompilerToVMImpl implements CompilerToVM {
+
+    /**
+     * Initializes the native part of the JVMCI runtime.
+     */
+    private static native void init();
+
+    static {
+        try (InitTimer t = timer("CompilerToVMImpl.init")) {
+            init();
+        }
+    }
+
+    @Override
+    public native int installCode(HotSpotCompiledCode compiledCode, InstalledCode code, SpeculationLog speculationLog);
+
+    @Override
+    public native long getMetaspaceMethod(Class<?> holder, int slot);
+
+    @Override
+    public native byte[] getBytecode(long metaspaceMethod);
+
+    @Override
+    public native int exceptionTableLength(long metaspaceMethod);
+
+    @Override
+    public native long exceptionTableStart(long metaspaceMethod);
+
+    @Override
+    public native boolean hasBalancedMonitors(long metaspaceMethod);
+
+    @Override
+    public native long findUniqueConcreteMethod(long actualHolderMetaspaceKlass, long metaspaceMethod);
+
+    @Override
+    public native long getKlassImplementor(long metaspaceKlass);
+
+    @Override
+    public native long lookupType(String name, Class<?> accessingClass, boolean eagerResolve);
+
+    public native Object resolveConstantInPool(long metaspaceConstantPool, int cpi);
+
+    public native Object resolvePossiblyCachedConstantInPool(long metaspaceConstantPool, int cpi);
+
+    @Override
+    public native int lookupNameAndTypeRefIndexInPool(long metaspaceConstantPool, int cpi);
+
+    @Override
+    public native String lookupNameRefInPool(long metaspaceConstantPool, int cpi);
+
+    @Override
+    public native String lookupSignatureRefInPool(long metaspaceConstantPool, int cpi);
+
+    @Override
+    public native int lookupKlassRefIndexInPool(long metaspaceConstantPool, int cpi);
+
+    public native long constantPoolKlassAt(long metaspaceConstantPool, int cpi);
+
+    @Override
+    public native long lookupKlassInPool(long metaspaceConstantPool, int cpi);
+
+    @Override
+    public native long lookupMethodInPool(long metaspaceConstantPool, int cpi, byte opcode);
+
+    @Override
+    public native long resolveField(long metaspaceConstantPool, int cpi, byte opcode, long[] info);
+
+    public native int constantPoolRemapInstructionOperandFromCache(long metaspaceConstantPool, int cpi);
+
+    @Override
+    public native Object lookupAppendixInPool(long metaspaceConstantPool, int cpi);
+
+    @Override
+    public native void initializeConfiguration(HotSpotVMConfig config);
+
+    @Override
+    public native long resolveMethod(long metaspaceKlassExactReceiver, long metaspaceMethod, long metaspaceKlassCaller);
+
+    @Override
+    public native boolean hasFinalizableSubclass(long metaspaceKlass);
+
+    public native boolean methodIsIgnoredBySecurityStackWalk(long metaspaceMethod);
+
+    @Override
+    public native long getClassInitializer(long metaspaceKlass);
+
+    @Override
+    public native long getMaxCallTargetOffset(long address);
+
+    // The HotSpot disassembler seems not to be thread safe so it's better to synchronize its usage
+    @Override
+    public synchronized native String disassembleCodeBlob(long codeBlob);
+
+    @Override
+    public native StackTraceElement getStackTraceElement(long metaspaceMethod, int bci);
+
+    @Override
+    public native Object executeCompiledMethodVarargs(Object[] args, InstalledCode hotspotInstalledCode);
+
+    @Override
+    public native long[] getLineNumberTable(long metaspaceMethod);
+
+    @Override
+    public native long getLocalVariableTableStart(long metaspaceMethod);
+
+    @Override
+    public native int getLocalVariableTableLength(long metaspaceMethod);
+
+    @Override
+    public native String getFileName(HotSpotResolvedJavaType method);
+
+    @Override
+    public native void reprofile(long metaspaceMethod);
+
+    @Override
+    public native void invalidateInstalledCode(InstalledCode hotspotInstalledCode);
+
+    @Override
+    public native Class<?> getJavaMirror(long metaspaceKlass);
+
+    @Override
+    public native long readUnsafeKlassPointer(Object o);
+
+    @Override
+    public native Object readUncompressedOop(long address);
+
+    @Override
+    public native void doNotInlineOrCompile(long metaspaceMethod);
+
+    @Override
+    public Object executeCompiledMethod(Object arg1, Object arg2, Object arg3, InstalledCode hotspotInstalledCode) throws InvalidInstalledCodeException {
+        return executeCompiledMethodVarargs(new Object[]{arg1, arg2, arg3}, hotspotInstalledCode);
+    }
+
+    public synchronized native void notifyCompilationStatistics(int id, HotSpotResolvedJavaMethod method, boolean osr, int processedBytecodes, long time, long timeUnitsPerSecond,
+                    InstalledCode installedCode);
+
+    public native void resetCompilationStatistics();
+
+    public native long[] collectCounters();
+
+    public native boolean isMature(long method);
+
+    public native int allocateCompileId(long metaspaceMethod, int entryBCI);
+
+    public String getGPUs() {
+        return "";
+    }
+
+    public native boolean canInlineMethod(long metaspaceMethod);
+
+    public native boolean shouldInlineMethod(long metaspaceMethod);
+
+    public native boolean hasCompiledCodeForOSR(long metaspaceMethod, int entryBCI, int level);
+
+    public native HotSpotStackFrameReference getNextStackFrame(HotSpotStackFrameReference frame, long[] methods, int initialSkip);
+
+    public native void materializeVirtualObjects(HotSpotStackFrameReference stackFrame, boolean invalidate);
+
+    public native long getTimeStamp();
+
+    public native String getSymbol(long metaspaceSymbol);
+
+    public native void resolveInvokeDynamic(long metaspaceConstantPool, int index);
+
+    public native int getVtableIndexForInterface(long metaspaceKlass, long metaspaceMethod);
+
+    public native boolean shouldDebugNonSafepoints();
+
+    public native void writeDebugOutput(byte[] bytes, int offset, int length);
+
+    public native void flushDebugOutput();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HexCodeFile.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,431 @@
+/*
+ * 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.jvmci.hotspot;
+
+import java.io.*;
+import java.util.*;
+import java.util.regex.*;
+
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.code.CompilationResult.CodeAnnotation;
+import com.oracle.jvmci.code.CompilationResult.CodeComment;
+import com.oracle.jvmci.code.CompilationResult.JumpTable;
+
+/**
+ * A HexCodeFile is a textual format for representing a chunk of machine code along with extra
+ * information that can be used to enhance a disassembly of the code.
+ *
+ * A pseudo grammar for a HexCodeFile is given below.
+ *
+ * <pre>
+ *     HexCodeFile ::= Platform Delim HexCode Delim (OptionalSection Delim)*
+ *
+ *     OptionalSection ::= Comment | OperandComment | JumpTable | LookupTable
+ *
+ *     Platform ::= "Platform" ISA WordWidth
+ *
+ *     HexCode ::= "HexCode" StartAddress HexDigits
+ *
+ *     Comment ::= "Comment" Position String
+ *
+ *     OperandComment ::= "OperandComment" Position String
+ *
+ *     JumpTable ::= "JumpTable" Position EntrySize Low High
+ *
+ *     LookupTable ::= "LookupTable" Position NPairs KeySize OffsetSize
+ *
+ *     Position, EntrySize, Low, High, NPairs KeySize OffsetSize ::= int
+ *
+ *     Delim := "&lt;||@"
+ * </pre>
+ *
+ * There must be exactly one HexCode and Platform part in a HexCodeFile. The length of HexDigits
+ * must be even as each pair of digits represents a single byte.
+ * <p>
+ * Below is an example of a valid Code input:
+ *
+ * <pre>
+ *
+ *  Platform AMD64 64  &lt;||@
+ *  HexCode 0 e8000000009090904883ec084889842410d0ffff48893c24e800000000488b3c24488bf0e8000000004883c408c3  &lt;||@
+ *  Comment 24 frame-ref-map: +0 {0}
+ *  at java.lang.String.toLowerCase(String.java:2496) [bci: 1]
+ *              |0
+ *     locals:  |stack:0:a
+ *     stack:   |stack:0:a
+ *    &lt;||@
+ *  OperandComment 24 {java.util.Locale.getDefault()}  &lt;||@
+ *  Comment 36 frame-ref-map: +0 {0}
+ *  at java.lang.String.toLowerCase(String.java:2496) [bci: 4]
+ *              |0
+ *     locals:  |stack:0:a
+ *    &lt;||@
+ *  OperandComment 36 {java.lang.String.toLowerCase(Locale)}  lt;||@
+ *
+ * </pre>
+ */
+public class HexCodeFile {
+
+    public static final String NEW_LINE = CodeUtil.NEW_LINE;
+    public static final String SECTION_DELIM = " <||@";
+    public static final String COLUMN_END = " <|@";
+    public static final Pattern SECTION = Pattern.compile("(\\S+)\\s+(.*)", Pattern.DOTALL);
+    public static final Pattern COMMENT = Pattern.compile("(\\d+)\\s+(.*)", Pattern.DOTALL);
+    public static final Pattern OPERAND_COMMENT = COMMENT;
+    public static final Pattern JUMP_TABLE = Pattern.compile("(\\d+)\\s+(\\d+)\\s+(-{0,1}\\d+)\\s+(-{0,1}\\d+)\\s*");
+    public static final Pattern LOOKUP_TABLE = Pattern.compile("(\\d+)\\s+(\\d+)\\s+(\\d+)\\s+(\\d+)\\s*");
+    public static final Pattern HEX_CODE = Pattern.compile("(\\p{XDigit}+)(?:\\s+(\\p{XDigit}*))?");
+    public static final Pattern PLATFORM = Pattern.compile("(\\S+)\\s+(\\S+)", Pattern.DOTALL);
+
+    /**
+     * Delimiter placed before a HexCodeFile when embedded in a string/stream.
+     */
+    public static final String EMBEDDED_HCF_OPEN = "<<<HexCodeFile";
+
+    /**
+     * Delimiter placed after a HexCodeFile when embedded in a string/stream.
+     */
+    public static final String EMBEDDED_HCF_CLOSE = "HexCodeFile>>>";
+
+    /**
+     * Map from a machine code position to a list of comments for the position.
+     */
+    public final Map<Integer, List<String>> comments = new TreeMap<>();
+
+    /**
+     * Map from a machine code position to a comment for the operands of the instruction at the
+     * position.
+     */
+    public final Map<Integer, String> operandComments = new TreeMap<>();
+
+    public final byte[] code;
+
+    public final ArrayList<JumpTable> jumpTables = new ArrayList<>();
+
+    public final String isa;
+
+    public final int wordWidth;
+
+    public final long startAddress;
+
+    public HexCodeFile(byte[] code, long startAddress, String isa, int wordWidth) {
+        this.code = code;
+        this.startAddress = startAddress;
+        this.isa = isa;
+        this.wordWidth = wordWidth;
+    }
+
+    /**
+     * Parses a string in the format produced by {@link #toString()} to produce a
+     * {@link HexCodeFile} object.
+     */
+    public static HexCodeFile parse(String input, int sourceOffset, String source, String sourceName) {
+        return new Parser(input, sourceOffset, source, sourceName).hcf;
+    }
+
+    /**
+     * Formats this HexCodeFile as a string that can be parsed with
+     * {@link #parse(String, int, String, String)}.
+     */
+    @Override
+    public String toString() {
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        writeTo(baos);
+        return baos.toString();
+    }
+
+    public String toEmbeddedString() {
+        return EMBEDDED_HCF_OPEN + NEW_LINE + toString() + EMBEDDED_HCF_CLOSE;
+    }
+
+    public void writeTo(OutputStream out) {
+        PrintStream ps = out instanceof PrintStream ? (PrintStream) out : new PrintStream(out);
+        ps.printf("Platform %s %d %s%n", isa, wordWidth, SECTION_DELIM);
+        ps.printf("HexCode %x %s %s%n", startAddress, HexCodeFile.hexCodeString(code), SECTION_DELIM);
+
+        for (JumpTable table : jumpTables) {
+            ps.printf("JumpTable %d %d %d %d %s%n", table.position, table.entrySize, table.low, table.high, SECTION_DELIM);
+        }
+
+        for (Map.Entry<Integer, List<String>> e : comments.entrySet()) {
+            int pos = e.getKey();
+            for (String comment : e.getValue()) {
+                ps.printf("Comment %d %s %s%n", pos, comment, SECTION_DELIM);
+            }
+        }
+
+        for (Map.Entry<Integer, String> e : operandComments.entrySet()) {
+            ps.printf("OperandComment %d %s %s%n", e.getKey(), e.getValue(), SECTION_DELIM);
+        }
+        ps.flush();
+    }
+
+    /**
+     * Formats a byte array as a string of hex digits.
+     */
+    public static String hexCodeString(byte[] code) {
+        if (code == null) {
+            return "";
+        } else {
+            StringBuilder sb = new StringBuilder(code.length * 2);
+            for (int b : code) {
+                String hex = Integer.toHexString(b & 0xff);
+                if (hex.length() == 1) {
+                    sb.append('0');
+                }
+                sb.append(hex);
+            }
+            return sb.toString();
+        }
+    }
+
+    /**
+     * Adds a comment to the list of comments for a given position.
+     */
+    public void addComment(int pos, String comment) {
+        List<String> list = comments.get(pos);
+        if (list == null) {
+            list = new ArrayList<>();
+            comments.put(pos, list);
+        }
+        list.add(encodeString(comment));
+    }
+
+    /**
+     * Sets an operand comment for a given position.
+     *
+     * @return the previous operand comment for {@code pos}
+     */
+    public String addOperandComment(int pos, String comment) {
+        return operandComments.put(pos, encodeString(comment));
+    }
+
+    /**
+     * Adds any jump tables, lookup tables or code comments from a list of code annotations.
+     */
+    public static void addAnnotations(HexCodeFile hcf, List<CodeAnnotation> annotations) {
+        if (annotations == null || annotations.isEmpty()) {
+            return;
+        }
+        for (CodeAnnotation a : annotations) {
+            if (a instanceof JumpTable) {
+                JumpTable table = (JumpTable) a;
+                hcf.jumpTables.add(table);
+            } else if (a instanceof CodeComment) {
+                CodeComment comment = (CodeComment) a;
+                hcf.addComment(comment.position, comment.value);
+            }
+        }
+    }
+
+    /**
+     * Modifies a string to mangle any substrings matching {@link #SECTION_DELIM} and
+     * {@link #COLUMN_END}.
+     */
+    public static String encodeString(String input) {
+        int index;
+        String s = input;
+        while ((index = s.indexOf(SECTION_DELIM)) != -1) {
+            s = s.substring(0, index) + " < |@" + s.substring(index + SECTION_DELIM.length());
+        }
+        while ((index = s.indexOf(COLUMN_END)) != -1) {
+            s = s.substring(0, index) + " < @" + s.substring(index + COLUMN_END.length());
+        }
+        return s;
+    }
+
+    /**
+     * Helper class to parse a string in the format produced by {@link HexCodeFile#toString()} and
+     * produce a {@link HexCodeFile} object.
+     */
+    static class Parser {
+
+        final String input;
+        final String inputSource;
+        String isa;
+        int wordWidth;
+        byte[] code;
+        long startAddress;
+        HexCodeFile hcf;
+
+        Parser(String input, int sourceOffset, String source, String sourceName) {
+            this.input = input;
+            this.inputSource = sourceName;
+            parseSections(sourceOffset, source);
+        }
+
+        void makeHCF() {
+            if (hcf == null) {
+                if (isa != null && wordWidth != 0 && code != null) {
+                    hcf = new HexCodeFile(code, startAddress, isa, wordWidth);
+                }
+            }
+        }
+
+        void checkHCF(String section, int offset) {
+            check(hcf != null, offset, section + " section must be after Platform and HexCode section");
+        }
+
+        void check(boolean condition, int offset, String message) {
+            if (!condition) {
+                error(offset, message);
+            }
+        }
+
+        Error error(int offset, String message) {
+            throw new Error(errorMessage(offset, message));
+        }
+
+        void warning(int offset, String message) {
+            PrintStream err = System.err;
+            err.println("Warning: " + errorMessage(offset, message));
+        }
+
+        String errorMessage(int offset, String message) {
+            assert offset < input.length();
+            InputPos inputPos = filePos(offset);
+            int lineEnd = input.indexOf(HexCodeFile.NEW_LINE, offset);
+            int lineStart = offset - inputPos.col;
+            String line = lineEnd == -1 ? input.substring(lineStart) : input.substring(lineStart, lineEnd);
+            return String.format("%s:%d: %s%n%s%n%" + (inputPos.col + 1) + "s", inputSource, inputPos.line, message, line, "^");
+        }
+
+        static class InputPos {
+
+            final int line;
+            final int col;
+
+            public InputPos(int line, int col) {
+                this.line = line;
+                this.col = col;
+            }
+        }
+
+        InputPos filePos(int index) {
+            assert input != null;
+            int lineStart = input.lastIndexOf(HexCodeFile.NEW_LINE, index) + 1;
+
+            String l = input.substring(lineStart, lineStart + 10);
+            PrintStream out = System.out;
+            out.println("YYY" + input.substring(index, index + 10) + "...");
+            out.println("XXX" + l + "...");
+
+            int pos = input.indexOf(HexCodeFile.NEW_LINE, 0);
+            int line = 1;
+            while (pos > 0 && pos < index) {
+                line++;
+                pos = input.indexOf(HexCodeFile.NEW_LINE, pos + 1);
+            }
+            return new InputPos(line, index - lineStart);
+        }
+
+        void parseSections(int offset, String source) {
+            assert input.startsWith(source, offset);
+            int index = 0;
+            int endIndex = source.indexOf(SECTION_DELIM);
+            while (endIndex != -1) {
+                while (source.charAt(index) <= ' ') {
+                    index++;
+                }
+                String section = source.substring(index, endIndex).trim();
+                parseSection(offset + index, section);
+                index = endIndex + SECTION_DELIM.length();
+                endIndex = source.indexOf(SECTION_DELIM, index);
+            }
+        }
+
+        int parseInt(int offset, String value) {
+            try {
+                return Integer.parseInt(value);
+            } catch (NumberFormatException e) {
+                throw error(offset, "Not a valid integer: " + value);
+            }
+        }
+
+        void parseSection(int offset, String section) {
+            if (section.isEmpty()) {
+                return;
+            }
+            assert input.startsWith(section, offset);
+            Matcher m = HexCodeFile.SECTION.matcher(section);
+            check(m.matches(), offset, "Section does not match pattern " + HexCodeFile.SECTION);
+
+            String header = m.group(1);
+            String body = m.group(2);
+            int headerOffset = offset + m.start(1);
+            int bodyOffset = offset + m.start(2);
+
+            if (header.equals("Platform")) {
+                check(isa == null, bodyOffset, "Duplicate Platform section found");
+                m = HexCodeFile.PLATFORM.matcher(body);
+                check(m.matches(), bodyOffset, "Platform does not match pattern " + HexCodeFile.PLATFORM);
+                isa = m.group(1);
+                wordWidth = parseInt(bodyOffset + m.start(2), m.group(2));
+                makeHCF();
+            } else if (header.equals("HexCode")) {
+                check(code == null, bodyOffset, "Duplicate Code section found");
+                m = HexCodeFile.HEX_CODE.matcher(body);
+                check(m.matches(), bodyOffset, "Code does not match pattern " + HexCodeFile.HEX_CODE);
+                String hexAddress = m.group(1);
+                startAddress = Long.valueOf(hexAddress, 16);
+                String hexCode = m.group(2);
+                if (hexCode == null) {
+                    code = new byte[0];
+                } else {
+                    check((hexCode.length() % 2) == 0, bodyOffset, "Hex code length must be even");
+                    code = new byte[hexCode.length() / 2];
+                    for (int i = 0; i < code.length; i++) {
+                        String hexByte = hexCode.substring(i * 2, (i + 1) * 2);
+                        code[i] = (byte) Integer.parseInt(hexByte, 16);
+                    }
+                }
+                makeHCF();
+            } else if (header.equals("Comment")) {
+                checkHCF("Comment", headerOffset);
+                m = HexCodeFile.COMMENT.matcher(body);
+                check(m.matches(), bodyOffset, "Comment does not match pattern " + HexCodeFile.COMMENT);
+                int pos = parseInt(bodyOffset + m.start(1), m.group(1));
+                String comment = m.group(2);
+                hcf.addComment(pos, comment);
+            } else if (header.equals("OperandComment")) {
+                checkHCF("OperandComment", headerOffset);
+                m = HexCodeFile.OPERAND_COMMENT.matcher(body);
+                check(m.matches(), bodyOffset, "OperandComment does not match pattern " + HexCodeFile.OPERAND_COMMENT);
+                int pos = parseInt(bodyOffset + m.start(1), m.group(1));
+                String comment = m.group(2);
+                hcf.addOperandComment(pos, comment);
+            } else if (header.equals("JumpTable")) {
+                checkHCF("JumpTable", headerOffset);
+                m = HexCodeFile.JUMP_TABLE.matcher(body);
+                check(m.matches(), bodyOffset, "JumpTable does not match pattern " + HexCodeFile.JUMP_TABLE);
+                int pos = parseInt(bodyOffset + m.start(1), m.group(1));
+                int entrySize = parseInt(bodyOffset + m.start(2), m.group(2));
+                int low = parseInt(bodyOffset + m.start(3), m.group(3));
+                int high = parseInt(bodyOffset + m.start(4), m.group(4));
+                hcf.jumpTables.add(new JumpTable(pos, low, high, entrySize));
+            } else {
+                error(offset, "Unknown section header: " + header);
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotCodeCacheProvider.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,330 @@
+/*
+ * Copyright (c) 2013, 2015, 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.jvmci.hotspot;
+
+import static com.oracle.jvmci.hotspot.HotSpotCompressedNullConstant.*;
+
+import java.lang.reflect.*;
+import java.util.*;
+
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.code.CodeUtil.DefaultRefMapFormatter;
+import com.oracle.jvmci.code.CodeUtil.RefMapFormatter;
+import com.oracle.jvmci.code.CompilationResult.Call;
+import com.oracle.jvmci.code.CompilationResult.ConstantReference;
+import com.oracle.jvmci.code.CompilationResult.DataPatch;
+import com.oracle.jvmci.code.CompilationResult.Infopoint;
+import com.oracle.jvmci.code.CompilationResult.Mark;
+import com.oracle.jvmci.code.DataSection.Data;
+import com.oracle.jvmci.code.DataSection.DataBuilder;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.meta.*;
+
+/**
+ * HotSpot implementation of {@link CodeCacheProvider}.
+ */
+public class HotSpotCodeCacheProvider implements CodeCacheProvider {
+
+    protected final HotSpotJVMCIRuntimeProvider runtime;
+    public final HotSpotVMConfig config;
+    protected final TargetDescription target;
+    protected final RegisterConfig regConfig;
+
+    public HotSpotCodeCacheProvider(HotSpotJVMCIRuntimeProvider runtime, HotSpotVMConfig config, TargetDescription target, RegisterConfig regConfig) {
+        this.runtime = runtime;
+        this.config = config;
+        this.target = target;
+        this.regConfig = regConfig;
+    }
+
+    @Override
+    public String disassemble(CompilationResult compResult, InstalledCode installedCode) {
+        byte[] code = installedCode == null ? Arrays.copyOf(compResult.getTargetCode(), compResult.getTargetCodeSize()) : installedCode.getCode();
+        if (code == null) {
+            // Method was deoptimized/invalidated
+            return "";
+        }
+        long start = installedCode == null ? 0L : installedCode.getStart();
+        HexCodeFile hcf = new HexCodeFile(code, start, target.arch.getName(), target.wordSize * 8);
+        if (compResult != null) {
+            HexCodeFile.addAnnotations(hcf, compResult.getAnnotations());
+            addExceptionHandlersComment(compResult, hcf);
+            Register fp = regConfig.getFrameRegister();
+            RefMapFormatter slotFormatter = new DefaultRefMapFormatter(target.arch, target.wordSize, fp, 0);
+            for (Infopoint infopoint : compResult.getInfopoints()) {
+                if (infopoint instanceof Call) {
+                    Call call = (Call) infopoint;
+                    if (call.debugInfo != null) {
+                        hcf.addComment(call.pcOffset + call.size, CodeUtil.append(new StringBuilder(100), call.debugInfo, slotFormatter).toString());
+                    }
+                    addOperandComment(hcf, call.pcOffset, "{" + getTargetName(call) + "}");
+                } else {
+                    if (infopoint.debugInfo != null) {
+                        hcf.addComment(infopoint.pcOffset, CodeUtil.append(new StringBuilder(100), infopoint.debugInfo, slotFormatter).toString());
+                    }
+                    addOperandComment(hcf, infopoint.pcOffset, "{infopoint: " + infopoint.reason + "}");
+                }
+            }
+            for (DataPatch site : compResult.getDataPatches()) {
+                hcf.addOperandComment(site.pcOffset, "{" + site.reference.toString() + "}");
+            }
+            for (Mark mark : compResult.getMarks()) {
+                hcf.addComment(mark.pcOffset, getMarkIdName((int) mark.id));
+            }
+        }
+        String hcfEmbeddedString = hcf.toEmbeddedString();
+        return HexCodeFileDisTool.tryDisassemble(hcfEmbeddedString);
+    }
+
+    /**
+     * Interface to the tool for disassembling an {@link HexCodeFile#toEmbeddedString() embedded}
+     * {@link HexCodeFile}.
+     */
+    static class HexCodeFileDisTool {
+        static final Method processMethod;
+        static {
+            Method toolMethod = null;
+            try {
+                Class<?> toolClass = Class.forName("com.oracle.max.hcfdis.HexCodeFileDis", true, ClassLoader.getSystemClassLoader());
+                toolMethod = toolClass.getDeclaredMethod("processEmbeddedString", String.class);
+            } catch (Exception e) {
+                // Tool not available on the class path
+            }
+            processMethod = toolMethod;
+        }
+
+        public static String tryDisassemble(String hcfEmbeddedString) {
+            if (processMethod != null) {
+                try {
+                    return (String) processMethod.invoke(null, hcfEmbeddedString);
+                } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
+                    // If the tool is available, for now let's be noisy when it fails
+                    throw new JVMCIError(e);
+                }
+            }
+            return hcfEmbeddedString;
+        }
+    }
+
+    private String getMarkIdName(int markId) {
+        Field[] fields = runtime.getConfig().getClass().getDeclaredFields();
+        for (Field f : fields) {
+            if (f.getName().startsWith("MARKID_")) {
+                f.setAccessible(true);
+                try {
+                    if (f.getInt(runtime.getConfig()) == markId) {
+                        return f.getName();
+                    }
+                } catch (Exception e) {
+                }
+            }
+        }
+        return String.valueOf(markId);
+    }
+
+    /**
+     * Decodes a call target to a mnemonic if possible.
+     */
+    private String getTargetName(Call call) {
+        Field[] fields = runtime.getConfig().getClass().getDeclaredFields();
+        for (Field f : fields) {
+            if (f.getName().endsWith("Stub")) {
+                f.setAccessible(true);
+                try {
+                    Object address = f.get(runtime.getConfig());
+                    if (address.equals(call.target)) {
+                        return f.getName() + ":0x" + Long.toHexString((Long) address);
+                    }
+                } catch (Exception e) {
+                }
+            }
+        }
+        return String.valueOf(call.target);
+    }
+
+    private static void addExceptionHandlersComment(CompilationResult compResult, HexCodeFile hcf) {
+        if (!compResult.getExceptionHandlers().isEmpty()) {
+            String nl = HexCodeFile.NEW_LINE;
+            StringBuilder buf = new StringBuilder("------ Exception Handlers ------").append(nl);
+            for (CompilationResult.ExceptionHandler e : compResult.getExceptionHandlers()) {
+                buf.append("    ").append(e.pcOffset).append(" -> ").append(e.handlerPos).append(nl);
+                hcf.addComment(e.pcOffset, "[exception -> " + e.handlerPos + "]");
+                hcf.addComment(e.handlerPos, "[exception handler for " + e.pcOffset + "]");
+            }
+            hcf.addComment(0, buf.toString());
+        }
+    }
+
+    private static void addOperandComment(HexCodeFile hcf, int pos, String comment) {
+        String oldValue = hcf.addOperandComment(pos, comment);
+        assert oldValue == null : "multiple comments for operand of instruction at " + pos + ": " + comment + ", " + oldValue;
+    }
+
+    @Override
+    public RegisterConfig getRegisterConfig() {
+        return regConfig;
+    }
+
+    @Override
+    public int getMinimumOutgoingSize() {
+        return runtime.getConfig().runtimeCallStackSize;
+    }
+
+    public InstalledCode logOrDump(InstalledCode installedCode, CompilationResult compResult) {
+        if (Debug.isDumpEnabled()) {
+            Debug.dump(new Object[]{compResult, installedCode}, "After code installation");
+        }
+        if (Debug.isLogEnabled()) {
+            Debug.log("%s", disassemble(installedCode));
+        }
+        return installedCode;
+    }
+
+    public InstalledCode installMethod(HotSpotResolvedJavaMethod method, CompilationResult compResult, long jvmciEnv, boolean isDefault) {
+        if (compResult.getId() == -1) {
+            compResult.setId(method.allocateCompileId(compResult.getEntryBCI()));
+        }
+        HotSpotInstalledCode installedCode = new HotSpotNmethod(method, compResult.getName(), isDefault);
+        runtime.getCompilerToVM().installCode(new HotSpotCompiledNmethod(method, compResult, jvmciEnv), installedCode, method.getSpeculationLog());
+        return logOrDump(installedCode, compResult);
+    }
+
+    @Override
+    public InstalledCode addMethod(ResolvedJavaMethod method, CompilationResult compResult, SpeculationLog log, InstalledCode predefinedInstalledCode) {
+        HotSpotResolvedJavaMethod hotspotMethod = (HotSpotResolvedJavaMethod) method;
+        if (compResult.getId() == -1) {
+            compResult.setId(hotspotMethod.allocateCompileId(compResult.getEntryBCI()));
+        }
+        InstalledCode installedCode = predefinedInstalledCode;
+        if (installedCode == null) {
+            HotSpotInstalledCode code = new HotSpotNmethod(hotspotMethod, compResult.getName(), false);
+            installedCode = code;
+        }
+        HotSpotCompiledNmethod compiledCode = new HotSpotCompiledNmethod(hotspotMethod, compResult);
+        int result = runtime.getCompilerToVM().installCode(compiledCode, installedCode, log);
+        if (result != config.codeInstallResultOk) {
+            String msg = compiledCode.getInstallationFailureMessage();
+            String resultDesc = config.getCodeInstallResultDescription(result);
+            if (msg != null) {
+                msg = String.format("Code installation failed: %s%n%s", resultDesc, msg);
+            } else {
+                msg = String.format("Code installation failed: %s", resultDesc);
+            }
+            if (result == config.codeInstallResultDependenciesInvalid) {
+                throw new AssertionError(resultDesc + " " + msg);
+            }
+            throw new BailoutException(result != config.codeInstallResultDependenciesFailed, msg);
+        }
+        return logOrDump(installedCode, compResult);
+    }
+
+    @Override
+    public InstalledCode setDefaultMethod(ResolvedJavaMethod method, CompilationResult compResult) {
+        HotSpotResolvedJavaMethod hotspotMethod = (HotSpotResolvedJavaMethod) method;
+        return installMethod(hotspotMethod, compResult, 0L, true);
+    }
+
+    public HotSpotNmethod addExternalMethod(ResolvedJavaMethod method, CompilationResult compResult) {
+        HotSpotResolvedJavaMethod javaMethod = (HotSpotResolvedJavaMethod) method;
+        if (compResult.getId() == -1) {
+            compResult.setId(javaMethod.allocateCompileId(compResult.getEntryBCI()));
+        }
+        HotSpotNmethod code = new HotSpotNmethod(javaMethod, compResult.getName(), false, true);
+        HotSpotCompiledNmethod compiled = new HotSpotCompiledNmethod(javaMethod, compResult);
+        CompilerToVM vm = runtime.getCompilerToVM();
+        int result = vm.installCode(compiled, code, null);
+        if (result != runtime.getConfig().codeInstallResultOk) {
+            return null;
+        }
+        return code;
+    }
+
+    public boolean needsDataPatch(JavaConstant constant) {
+        return constant instanceof HotSpotMetaspaceConstant;
+    }
+
+    public Data createDataItem(Constant constant) {
+        int size;
+        DataBuilder builder;
+        if (constant instanceof VMConstant) {
+            VMConstant vmConstant = (VMConstant) constant;
+            boolean compressed;
+            long raw;
+            if (constant instanceof HotSpotObjectConstant) {
+                HotSpotObjectConstant c = (HotSpotObjectConstant) vmConstant;
+                compressed = c.isCompressed();
+                raw = 0xDEADDEADDEADDEADL;
+            } else if (constant instanceof HotSpotMetaspaceConstant) {
+                HotSpotMetaspaceConstant meta = (HotSpotMetaspaceConstant) constant;
+                compressed = meta.isCompressed();
+                raw = meta.rawValue();
+            } else {
+                throw new JVMCIError(String.valueOf(constant));
+            }
+
+            size = target.getSizeInBytes(compressed ? Kind.Int : target.wordKind);
+            if (size == 4) {
+                builder = (buffer, patch) -> {
+                    patch.accept(new DataPatch(buffer.position(), new ConstantReference(vmConstant)));
+                    buffer.putInt((int) raw);
+                };
+            } else {
+                assert size == 8;
+                builder = (buffer, patch) -> {
+                    patch.accept(new DataPatch(buffer.position(), new ConstantReference(vmConstant)));
+                    buffer.putLong(raw);
+                };
+            }
+        } else if (JavaConstant.isNull(constant)) {
+            boolean compressed = COMPRESSED_NULL.equals(constant);
+            size = target.getSizeInBytes(compressed ? Kind.Int : target.wordKind);
+            builder = DataBuilder.zero(size);
+        } else if (constant instanceof SerializableConstant) {
+            SerializableConstant s = (SerializableConstant) constant;
+            size = s.getSerializedSize();
+            builder = DataBuilder.serializable(s);
+        } else {
+            throw new JVMCIError(String.valueOf(constant));
+        }
+
+        return new Data(size, size, builder);
+    }
+
+    @Override
+    public TargetDescription getTarget() {
+        return target;
+    }
+
+    public String disassemble(InstalledCode code) {
+        if (code.isValid()) {
+            long codeBlob = code.getAddress();
+            return runtime.getCompilerToVM().disassembleCodeBlob(codeBlob);
+        }
+        return null;
+    }
+
+    public SpeculationLog createSpeculationLog() {
+        return new HotSpotSpeculationLog();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotCompiledCode.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,174 @@
+/*
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.hotspot;
+
+import java.nio.*;
+import java.util.*;
+import java.util.stream.*;
+import java.util.stream.Stream.Builder;
+
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.code.CompilationResult.CodeAnnotation;
+import com.oracle.jvmci.code.CompilationResult.CodeComment;
+import com.oracle.jvmci.code.CompilationResult.DataPatch;
+import com.oracle.jvmci.code.CompilationResult.ExceptionHandler;
+import com.oracle.jvmci.code.CompilationResult.Infopoint;
+import com.oracle.jvmci.code.CompilationResult.JumpTable;
+import com.oracle.jvmci.code.CompilationResult.Mark;
+import com.oracle.jvmci.code.CompilationResult.Site;
+import com.oracle.jvmci.meta.Assumptions.Assumption;
+import com.oracle.jvmci.meta.*;
+
+/**
+ * A {@link CompilationResult} with additional HotSpot-specific information required for installing
+ * the code in HotSpot's code cache.
+ */
+public abstract class HotSpotCompiledCode {
+
+    public final String name;
+    public final Site[] sites;
+    public final ExceptionHandler[] exceptionHandlers;
+    public final Comment[] comments;
+    public final Assumption[] assumptions;
+
+    public final byte[] targetCode;
+    public final int targetCodeSize;
+
+    public final byte[] dataSection;
+    public final int dataSectionAlignment;
+    public final DataPatch[] dataSectionPatches;
+
+    public final int totalFrameSize;
+    public final int customStackAreaOffset;
+
+    /**
+     * The list of the methods whose bytecodes were used as input to the compilation. If
+     * {@code null}, then the compilation did not record method dependencies. Otherwise, the first
+     * element of this array is the root method of the compilation.
+     */
+    public final ResolvedJavaMethod[] methods;
+
+    public static class Comment {
+
+        public final String text;
+        public final int pcOffset;
+
+        public Comment(int pcOffset, String text) {
+            this.text = text;
+            this.pcOffset = pcOffset;
+        }
+    }
+
+    public HotSpotCompiledCode(CompilationResult compResult) {
+        name = compResult.getName();
+        sites = getSortedSites(compResult);
+        if (compResult.getExceptionHandlers().isEmpty()) {
+            exceptionHandlers = null;
+        } else {
+            exceptionHandlers = compResult.getExceptionHandlers().toArray(new ExceptionHandler[compResult.getExceptionHandlers().size()]);
+        }
+        List<CodeAnnotation> annotations = compResult.getAnnotations();
+        comments = new Comment[annotations.size()];
+        if (!annotations.isEmpty()) {
+            for (int i = 0; i < comments.length; i++) {
+                CodeAnnotation annotation = annotations.get(i);
+                String text;
+                if (annotation instanceof CodeComment) {
+                    CodeComment codeComment = (CodeComment) annotation;
+                    text = codeComment.value;
+                } else if (annotation instanceof JumpTable) {
+                    JumpTable jumpTable = (JumpTable) annotation;
+                    text = "JumpTable [" + jumpTable.low + " .. " + jumpTable.high + "]";
+                } else {
+                    text = annotation.toString();
+                }
+                comments[i] = new Comment(annotation.position, text);
+            }
+        }
+        assumptions = compResult.getAssumptions();
+        assert validateFrames();
+
+        targetCode = compResult.getTargetCode();
+        targetCodeSize = compResult.getTargetCodeSize();
+
+        DataSection data = compResult.getDataSection();
+        data.finalizeLayout();
+        dataSection = new byte[data.getSectionSize()];
+
+        ByteBuffer buffer = ByteBuffer.wrap(dataSection).order(ByteOrder.nativeOrder());
+        Builder<DataPatch> patchBuilder = Stream.builder();
+        data.buildDataSection(buffer, patchBuilder);
+
+        dataSectionAlignment = data.getSectionAlignment();
+        dataSectionPatches = patchBuilder.build().toArray(len -> new DataPatch[len]);
+
+        totalFrameSize = compResult.getTotalFrameSize();
+        customStackAreaOffset = compResult.getCustomStackAreaOffset();
+
+        methods = compResult.getMethods();
+    }
+
+    /**
+     * Ensure that all the frames passed into HotSpot are properly formatted with an empty or
+     * illegal slot following double word slots.
+     */
+    private boolean validateFrames() {
+        for (Site site : sites) {
+            if (site instanceof Infopoint) {
+                Infopoint info = (Infopoint) site;
+                if (info.debugInfo != null) {
+                    BytecodeFrame frame = info.debugInfo.frame();
+                    assert frame == null || frame.validateFormat(false);
+                }
+            }
+        }
+        return true;
+    }
+
+    static class SiteComparator implements Comparator<Site> {
+
+        public int compare(Site s1, Site s2) {
+            if (s1.pcOffset == s2.pcOffset && (s1 instanceof Mark ^ s2 instanceof Mark)) {
+                return s1 instanceof Mark ? -1 : 1;
+            }
+            return s1.pcOffset - s2.pcOffset;
+        }
+    }
+
+    private static Site[] getSortedSites(CompilationResult target) {
+        List<?>[] lists = new List<?>[]{target.getInfopoints(), target.getDataPatches(), target.getMarks()};
+        int count = 0;
+        for (List<?> list : lists) {
+            count += list.size();
+        }
+        Site[] result = new Site[count];
+        int pos = 0;
+        for (List<?> list : lists) {
+            for (Object elem : list) {
+                result[pos++] = (Site) elem;
+            }
+        }
+        Arrays.sort(result, new SiteComparator());
+        return result;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotCompiledNmethod.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.hotspot;
+
+import com.oracle.jvmci.code.*;
+
+import edu.umd.cs.findbugs.annotations.*;
+
+/**
+ * {@link HotSpotCompiledCode} destined for installation as an nmethod.
+ */
+public final class HotSpotCompiledNmethod extends HotSpotCompiledCode {
+
+    public final HotSpotResolvedJavaMethod method;
+    public final int entryBCI;
+    public final int id;
+    public final long jvmciEnv;
+
+    /**
+     * May be set by VM if code installation fails. It will describe in more detail why installation
+     * failed (e.g., exactly which dependency failed).
+     */
+    @SuppressFBWarnings("UWF_UNWRITTEN_FIELD") private String installationFailureMessage;
+
+    public HotSpotCompiledNmethod(HotSpotResolvedJavaMethod method, CompilationResult compResult) {
+        this(method, compResult, 0L);
+    }
+
+    public HotSpotCompiledNmethod(HotSpotResolvedJavaMethod method, CompilationResult compResult, long jvmciEnv) {
+        super(compResult);
+        this.method = method;
+        this.entryBCI = compResult.getEntryBCI();
+        this.id = compResult.getId();
+        this.jvmciEnv = jvmciEnv;
+    }
+
+    @Override
+    public String toString() {
+        return getClass().getSimpleName() + "[" + id + ":" + method.format("%H.%n(%p)%r@") + entryBCI + "]";
+    }
+
+    public String getInstallationFailureMessage() {
+        return installationFailureMessage;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotCompressedNullConstant.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,102 @@
+/*
+ * Copyright (c) 2014, 2015, 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.jvmci.hotspot;
+
+import com.oracle.jvmci.meta.*;
+
+/**
+ * The compressed representation of the {@link JavaConstant#NULL_POINTER null constant}.
+ */
+public final class HotSpotCompressedNullConstant extends AbstractValue implements JavaConstant, HotSpotConstant {
+
+    public static final JavaConstant COMPRESSED_NULL = new HotSpotCompressedNullConstant();
+
+    private HotSpotCompressedNullConstant() {
+        super(LIRKind.reference(Kind.Int));
+    }
+
+    @Override
+    public boolean isNull() {
+        return true;
+    }
+
+    @Override
+    public boolean isCompressed() {
+        return true;
+    }
+
+    @Override
+    public boolean isDefaultForKind() {
+        return true;
+    }
+
+    @Override
+    public Object asBoxedPrimitive() {
+        throw new IllegalArgumentException();
+    }
+
+    @Override
+    public int asInt() {
+        throw new IllegalArgumentException();
+    }
+
+    @Override
+    public boolean asBoolean() {
+        throw new IllegalArgumentException();
+    }
+
+    @Override
+    public long asLong() {
+        throw new IllegalArgumentException();
+    }
+
+    @Override
+    public float asFloat() {
+        throw new IllegalArgumentException();
+    }
+
+    @Override
+    public double asDouble() {
+        throw new IllegalArgumentException();
+    }
+
+    @Override
+    public String toString() {
+        return JavaConstant.toString(this);
+    }
+
+    @Override
+    public String toValueString() {
+        return "null";
+    }
+
+    @Override
+    public int hashCode() {
+        return System.identityHashCode(this);
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        return o instanceof HotSpotCompressedNullConstant;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotConstant.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2014, 2015, 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.jvmci.hotspot;
+
+import com.oracle.jvmci.meta.*;
+
+/**
+ * Marker interface for hotspot specific constants.
+ */
+public interface HotSpotConstant extends Constant {
+
+    boolean isCompressed();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotConstantPool.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,653 @@
+/*
+ * Copyright (c) 2011, 2015, 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.jvmci.hotspot;
+
+import static com.oracle.jvmci.common.UnsafeAccess.*;
+import static com.oracle.jvmci.hotspot.HotSpotJVMCIRuntime.*;
+
+import java.lang.invoke.*;
+
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.meta.*;
+
+/**
+ * Implementation of {@link ConstantPool} for HotSpot.
+ */
+public class HotSpotConstantPool implements ConstantPool, HotSpotProxified {
+
+    /**
+     * Subset of JVM bytecode opcodes used by {@link HotSpotConstantPool}.
+     */
+    static class Bytecodes {
+        public static final int LDC = 18; // 0x12
+        public static final int LDC_W = 19; // 0x13
+        public static final int LDC2_W = 20; // 0x14
+        public static final int GETSTATIC = 178; // 0xB2
+        public static final int PUTSTATIC = 179; // 0xB3
+        public static final int GETFIELD = 180; // 0xB4
+        public static final int PUTFIELD = 181; // 0xB5
+        public static final int INVOKEVIRTUAL = 182; // 0xB6
+        public static final int INVOKESPECIAL = 183; // 0xB7
+        public static final int INVOKESTATIC = 184; // 0xB8
+        public static final int INVOKEINTERFACE = 185; // 0xB9
+        public static final int INVOKEDYNAMIC = 186; // 0xBA
+        public static final int NEW = 187; // 0xBB
+        public static final int NEWARRAY = 188; // 0xBC
+        public static final int ANEWARRAY = 189; // 0xBD
+        public static final int CHECKCAST = 192; // 0xC0
+        public static final int INSTANCEOF = 193; // 0xC1
+        public static final int MULTIANEWARRAY = 197; // 0xC5
+
+        static boolean isInvoke(int opcode) {
+            switch (opcode) {
+                case INVOKEVIRTUAL:
+                case INVOKESPECIAL:
+                case INVOKESTATIC:
+                case INVOKEINTERFACE:
+                case INVOKEDYNAMIC:
+                    return true;
+                default:
+                    return false;
+            }
+        }
+    }
+
+    /**
+     * Enum of all {@code JVM_CONSTANT} constants used in the VM. This includes the public and
+     * internal ones.
+     */
+    private enum JVM_CONSTANT {
+        // @formatter:off
+        Utf8(config().jvmConstantUtf8),
+        Integer(config().jvmConstantInteger),
+        Long(config().jvmConstantLong),
+        Float(config().jvmConstantFloat),
+        Double(config().jvmConstantDouble),
+        Class(config().jvmConstantClass),
+        UnresolvedClass(config().jvmConstantUnresolvedClass),
+        UnresolvedClassInError(config().jvmConstantUnresolvedClassInError),
+        String(config().jvmConstantString),
+        Fieldref(config().jvmConstantFieldref),
+        MethodRef(config().jvmConstantMethodref),
+        InterfaceMethodref(config().jvmConstantInterfaceMethodref),
+        NameAndType(config().jvmConstantNameAndType),
+        MethodHandle(config().jvmConstantMethodHandle),
+        MethodHandleInError(config().jvmConstantMethodHandleInError),
+        MethodType(config().jvmConstantMethodType),
+        MethodTypeInError(config().jvmConstantMethodTypeInError),
+        InvokeDynamic(config().jvmConstantInvokeDynamic);
+        // @formatter:on
+
+        private final int tag;
+
+        private static final int ExternalMax = config().jvmConstantExternalMax;
+        private static final int InternalMin = config().jvmConstantInternalMin;
+        private static final int InternalMax = config().jvmConstantInternalMax;
+
+        private JVM_CONSTANT(int tag) {
+            this.tag = tag;
+        }
+
+        private static HotSpotVMConfig config() {
+            return runtime().getConfig();
+        }
+
+        /**
+         * Maps JVM_CONSTANT tags to {@link JVM_CONSTANT} values. Using a separate class for lazy
+         * initialization.
+         */
+        static class TagValueMap {
+            private static final JVM_CONSTANT[] table = new JVM_CONSTANT[ExternalMax + 1 + (InternalMax - InternalMin) + 1];
+            static {
+                assert InternalMin > ExternalMax;
+                for (JVM_CONSTANT e : values()) {
+                    table[indexOf(e.tag)] = e;
+                }
+            }
+
+            private static int indexOf(int tag) {
+                if (tag >= InternalMin) {
+                    return tag - InternalMin + ExternalMax + 1;
+                } else {
+                    assert tag <= ExternalMax;
+                }
+                return tag;
+            }
+
+            static JVM_CONSTANT get(int tag) {
+                JVM_CONSTANT res = table[indexOf(tag)];
+                if (res != null) {
+                    return res;
+                }
+                throw new JVMCIError("Unknown JVM_CONSTANT tag %s", tag);
+            }
+        }
+
+        public static JVM_CONSTANT getEnum(int tag) {
+            return TagValueMap.get(tag);
+        }
+    }
+
+    private static class LookupTypeCacheElement {
+        int lastCpi = Integer.MIN_VALUE;
+        JavaType javaType;
+
+        public LookupTypeCacheElement(int lastCpi, JavaType javaType) {
+            super();
+            this.lastCpi = lastCpi;
+            this.javaType = javaType;
+        }
+    }
+
+    /**
+     * Reference to the C++ ConstantPool object.
+     */
+    private final long metaspaceConstantPool;
+    private final Object[] cache;
+    private volatile LookupTypeCacheElement lastLookupType;
+
+    public HotSpotConstantPool(long metaspaceConstantPool) {
+        this.metaspaceConstantPool = metaspaceConstantPool;
+        cache = new Object[length()];
+    }
+
+    /**
+     * Gets the holder for this constant pool as {@link HotSpotResolvedObjectTypeImpl}.
+     *
+     * @return holder for this constant pool
+     */
+    private HotSpotResolvedObjectType getHolder() {
+        final long metaspaceKlass = unsafe.getAddress(metaspaceConstantPool + runtime().getConfig().constantPoolHolderOffset);
+        return HotSpotResolvedObjectTypeImpl.fromMetaspaceKlass(metaspaceKlass);
+    }
+
+    /**
+     * Converts a raw index from the bytecodes to a constant pool index by adding a
+     * {@link HotSpotVMConfig#constantPoolCpCacheIndexTag constant}.
+     *
+     * @param rawIndex index from the bytecode
+     * @param opcode bytecode to convert the index for
+     * @return constant pool index
+     */
+    private static int toConstantPoolIndex(int rawIndex, int opcode) {
+        int index;
+        if (opcode == Bytecodes.INVOKEDYNAMIC) {
+            index = rawIndex;
+            // See: ConstantPool::is_invokedynamic_index
+            assert index < 0 : "not an invokedynamic constant pool index " + index;
+        } else {
+            assert opcode == Bytecodes.GETFIELD || opcode == Bytecodes.PUTFIELD || opcode == Bytecodes.GETSTATIC || opcode == Bytecodes.PUTSTATIC || opcode == Bytecodes.INVOKEINTERFACE ||
+                            opcode == Bytecodes.INVOKEVIRTUAL || opcode == Bytecodes.INVOKESPECIAL || opcode == Bytecodes.INVOKESTATIC : "unexpected invoke opcode " + opcode;
+            index = rawIndex + runtime().getConfig().constantPoolCpCacheIndexTag;
+        }
+        return index;
+    }
+
+    /**
+     * Decode a constant pool cache index to a constant pool index.
+     *
+     * See {@code ConstantPool::decode_cpcache_index}.
+     *
+     * @param index constant pool cache index
+     * @return decoded index
+     */
+    private static int decodeConstantPoolCacheIndex(int index) {
+        if (isInvokedynamicIndex(index)) {
+            return decodeInvokedynamicIndex(index);
+        } else {
+            return index - runtime().getConfig().constantPoolCpCacheIndexTag;
+        }
+    }
+
+    /**
+     * See {@code ConstantPool::is_invokedynamic_index}.
+     */
+    private static boolean isInvokedynamicIndex(int index) {
+        return index < 0;
+    }
+
+    /**
+     * See {@code ConstantPool::decode_invokedynamic_index}.
+     */
+    private static int decodeInvokedynamicIndex(int i) {
+        assert isInvokedynamicIndex(i) : i;
+        return ~i;
+    }
+
+    /**
+     * Gets the constant pool tag at index {@code index}.
+     *
+     * @param index constant pool index
+     * @return constant pool tag
+     */
+    private JVM_CONSTANT getTagAt(int index) {
+        assertBounds(index);
+        HotSpotVMConfig config = runtime().getConfig();
+        final long metaspaceConstantPoolTags = unsafe.getAddress(metaspaceConstantPool + config.constantPoolTagsOffset);
+        final int tag = unsafe.getByteVolatile(null, metaspaceConstantPoolTags + config.arrayU1DataOffset + index);
+        if (tag == 0) {
+            return null;
+        }
+        return JVM_CONSTANT.getEnum(tag);
+    }
+
+    /**
+     * Gets the constant pool entry at index {@code index}.
+     *
+     * @param index constant pool index
+     * @return constant pool entry
+     */
+    private long getEntryAt(int index) {
+        assertBounds(index);
+        return unsafe.getAddress(metaspaceConstantPool + runtime().getConfig().constantPoolSize + index * runtime().getHostJVMCIBackend().getTarget().wordSize);
+    }
+
+    /**
+     * Gets the integer constant pool entry at index {@code index}.
+     *
+     * @param index constant pool index
+     * @return integer constant pool entry at index
+     */
+    private int getIntAt(int index) {
+        assertTag(index, JVM_CONSTANT.Integer);
+        return unsafe.getInt(metaspaceConstantPool + runtime().getConfig().constantPoolSize + index * runtime().getHostJVMCIBackend().getTarget().wordSize);
+    }
+
+    /**
+     * Gets the long constant pool entry at index {@code index}.
+     *
+     * @param index constant pool index
+     * @return long constant pool entry
+     */
+    private long getLongAt(int index) {
+        assertTag(index, JVM_CONSTANT.Long);
+        return unsafe.getLong(metaspaceConstantPool + runtime().getConfig().constantPoolSize + index * runtime().getHostJVMCIBackend().getTarget().wordSize);
+    }
+
+    /**
+     * Gets the float constant pool entry at index {@code index}.
+     *
+     * @param index constant pool index
+     * @return float constant pool entry
+     */
+    private float getFloatAt(int index) {
+        assertTag(index, JVM_CONSTANT.Float);
+        return unsafe.getFloat(metaspaceConstantPool + runtime().getConfig().constantPoolSize + index * runtime().getHostJVMCIBackend().getTarget().wordSize);
+    }
+
+    /**
+     * Gets the double constant pool entry at index {@code index}.
+     *
+     * @param index constant pool index
+     * @return float constant pool entry
+     */
+    private double getDoubleAt(int index) {
+        assertTag(index, JVM_CONSTANT.Double);
+        return unsafe.getDouble(metaspaceConstantPool + runtime().getConfig().constantPoolSize + index * runtime().getHostJVMCIBackend().getTarget().wordSize);
+    }
+
+    /**
+     * Gets the {@code JVM_CONSTANT_NameAndType} constant pool entry at index {@code index}.
+     *
+     * @param index constant pool index
+     * @return {@code JVM_CONSTANT_NameAndType} constant pool entry
+     */
+    private int getNameAndTypeAt(int index) {
+        assertTag(index, JVM_CONSTANT.NameAndType);
+        return unsafe.getInt(metaspaceConstantPool + runtime().getConfig().constantPoolSize + index * runtime().getHostJVMCIBackend().getTarget().wordSize);
+    }
+
+    /**
+     * Gets the {@code JVM_CONSTANT_NameAndType} reference index constant pool entry at index
+     * {@code index}.
+     *
+     * @param index constant pool index
+     * @return {@code JVM_CONSTANT_NameAndType} reference constant pool entry
+     */
+    private int getNameAndTypeRefIndexAt(int index) {
+        return runtime().getCompilerToVM().lookupNameAndTypeRefIndexInPool(metaspaceConstantPool, index);
+    }
+
+    /**
+     * Gets the name of a {@code JVM_CONSTANT_NameAndType} constant pool entry at index
+     * {@code index}.
+     *
+     * @param index constant pool index
+     * @return name as {@link String}
+     */
+    private String getNameRefAt(int index) {
+        return runtime().getCompilerToVM().lookupNameRefInPool(metaspaceConstantPool, index);
+    }
+
+    /**
+     * Gets the name reference index of a {@code JVM_CONSTANT_NameAndType} constant pool entry at
+     * index {@code index}.
+     *
+     * @param index constant pool index
+     * @return name reference index
+     */
+    private int getNameRefIndexAt(int index) {
+        final int refIndex = getNameAndTypeAt(index);
+        // name ref index is in the low 16-bits.
+        return refIndex & 0xFFFF;
+    }
+
+    /**
+     * Gets the signature of a {@code JVM_CONSTANT_NameAndType} constant pool entry at index
+     * {@code index}.
+     *
+     * @param index constant pool index
+     * @return signature as {@link String}
+     */
+    private String getSignatureRefAt(int index) {
+        return runtime().getCompilerToVM().lookupSignatureRefInPool(metaspaceConstantPool, index);
+    }
+
+    /**
+     * Gets the signature reference index of a {@code JVM_CONSTANT_NameAndType} constant pool entry
+     * at index {@code index}.
+     *
+     * @param index constant pool index
+     * @return signature reference index
+     */
+    private int getSignatureRefIndexAt(int index) {
+        final int refIndex = getNameAndTypeAt(index);
+        // signature ref index is in the high 16-bits.
+        return refIndex >>> 16;
+    }
+
+    /**
+     * Gets the klass reference index constant pool entry at index {@code index}.
+     *
+     * @param index constant pool index
+     * @return klass reference index
+     */
+    private int getKlassRefIndexAt(int index) {
+        return runtime().getCompilerToVM().lookupKlassRefIndexInPool(metaspaceConstantPool, index);
+    }
+
+    /**
+     * Gets the uncached klass reference index constant pool entry at index {@code index}. See:
+     * {@code ConstantPool::uncached_klass_ref_index_at}.
+     *
+     * @param index constant pool index
+     * @return klass reference index
+     */
+    private int getUncachedKlassRefIndexAt(int index) {
+        assert getTagAt(index) == JVM_CONSTANT.Fieldref || getTagAt(index) == JVM_CONSTANT.MethodRef || getTagAt(index) == JVM_CONSTANT.InterfaceMethodref;
+        final int refIndex = unsafe.getInt(metaspaceConstantPool + runtime().getConfig().constantPoolSize + index * runtime().getHostJVMCIBackend().getTarget().wordSize);
+        // klass ref index is in the low 16-bits.
+        return refIndex & 0xFFFF;
+    }
+
+    /**
+     * Asserts that the constant pool index {@code index} is in the bounds of the constant pool.
+     *
+     * @param index constant pool index
+     */
+    private void assertBounds(int index) {
+        assert 0 <= index && index < length() : "index " + index + " not between 0 and " + length();
+    }
+
+    /**
+     * Asserts that the constant pool tag at index {@code index} is equal to {@code tag}.
+     *
+     * @param index constant pool index
+     * @param tag expected tag
+     */
+    private void assertTag(int index, JVM_CONSTANT tag) {
+        assert getTagAt(index) == tag : "constant pool tag at index " + index + " is " + getTagAt(index) + " but expected " + tag;
+    }
+
+    @Override
+    public int length() {
+        return unsafe.getInt(metaspaceConstantPool + runtime().getConfig().constantPoolLengthOffset);
+    }
+
+    @Override
+    public Object lookupConstant(int cpi) {
+        assert cpi != 0;
+        final JVM_CONSTANT tag = getTagAt(cpi);
+        switch (tag) {
+            case Integer:
+                return JavaConstant.forInt(getIntAt(cpi));
+            case Long:
+                return JavaConstant.forLong(getLongAt(cpi));
+            case Float:
+                return JavaConstant.forFloat(getFloatAt(cpi));
+            case Double:
+                return JavaConstant.forDouble(getDoubleAt(cpi));
+            case Class:
+            case UnresolvedClass:
+            case UnresolvedClassInError:
+                final int opcode = -1;  // opcode is not used
+                return lookupType(cpi, opcode);
+            case String:
+                Object string = runtime().getCompilerToVM().resolvePossiblyCachedConstantInPool(metaspaceConstantPool, cpi);
+                return HotSpotObjectConstantImpl.forObject(string);
+            case MethodHandle:
+            case MethodHandleInError:
+            case MethodType:
+            case MethodTypeInError:
+                Object obj = runtime().getCompilerToVM().resolveConstantInPool(metaspaceConstantPool, cpi);
+                return HotSpotObjectConstantImpl.forObject(obj);
+            default:
+                throw new JVMCIError("Unknown constant pool tag %s", tag);
+        }
+    }
+
+    @Override
+    public String lookupUtf8(int cpi) {
+        assertTag(cpi, JVM_CONSTANT.Utf8);
+        return runtime().getCompilerToVM().getSymbol(getEntryAt(cpi));
+    }
+
+    @Override
+    public Signature lookupSignature(int cpi) {
+        return new HotSpotSignature(runtime(), lookupUtf8(cpi));
+    }
+
+    @Override
+    public JavaConstant lookupAppendix(int cpi, int opcode) {
+        assert Bytecodes.isInvoke(opcode);
+        final int index = toConstantPoolIndex(cpi, opcode);
+        Object result = runtime().getCompilerToVM().lookupAppendixInPool(metaspaceConstantPool, index);
+        if (result == null) {
+            return null;
+        } else {
+            return HotSpotObjectConstantImpl.forObject(result);
+        }
+    }
+
+    /**
+     * Gets a {@link JavaType} corresponding a given metaspace Klass or a metaspace Symbol depending
+     * on the {@link HotSpotVMConfig#compilerToVMKlassTag tag}.
+     *
+     * @param metaspacePointer either a metaspace Klass or a metaspace Symbol
+     */
+    private static JavaType getJavaType(final long metaspacePointer) {
+        HotSpotJVMCIRuntime runtime = runtime();
+        HotSpotVMConfig config = runtime.getConfig();
+        if ((metaspacePointer & config.compilerToVMSymbolTag) != 0) {
+            final long metaspaceSymbol = metaspacePointer & ~config.compilerToVMSymbolTag;
+            String name = runtime.getCompilerToVM().getSymbol(metaspaceSymbol);
+            return HotSpotUnresolvedJavaType.create(runtime(), "L" + name + ";");
+        } else {
+            assert (metaspacePointer & config.compilerToVMKlassTag) == 0;
+            return HotSpotResolvedObjectTypeImpl.fromMetaspaceKlass(metaspacePointer);
+        }
+    }
+
+    @Override
+    public JavaMethod lookupMethod(int cpi, int opcode) {
+        if (opcode != Bytecodes.INVOKEDYNAMIC) {
+            Object result = cache[cpi];
+            if (result != null) {
+                return (ResolvedJavaMethod) result;
+            }
+        }
+        final int index = toConstantPoolIndex(cpi, opcode);
+        final long metaspaceMethod = runtime().getCompilerToVM().lookupMethodInPool(metaspaceConstantPool, index, (byte) opcode);
+        if (metaspaceMethod != 0L) {
+            HotSpotResolvedJavaMethod result = HotSpotResolvedJavaMethodImpl.fromMetaspace(metaspaceMethod);
+            if (opcode != Bytecodes.INVOKEDYNAMIC) {
+                cache[cpi] = result;
+            }
+            return result;
+        } else {
+            // Get the method's name and signature.
+            String name = getNameRefAt(index);
+            HotSpotSignature signature = new HotSpotSignature(runtime(), getSignatureRefAt(index));
+            if (opcode == Bytecodes.INVOKEDYNAMIC) {
+                HotSpotResolvedObjectType holder = HotSpotResolvedObjectTypeImpl.fromObjectClass(MethodHandle.class);
+                return new HotSpotMethodUnresolved(name, signature, holder);
+            } else {
+                final int klassIndex = getKlassRefIndexAt(index);
+                final long metaspacePointer = runtime().getCompilerToVM().lookupKlassInPool(metaspaceConstantPool, klassIndex);
+                JavaType holder = getJavaType(metaspacePointer);
+                return new HotSpotMethodUnresolved(name, signature, holder);
+            }
+        }
+    }
+
+    @Override
+    public JavaType lookupType(int cpi, int opcode) {
+        final LookupTypeCacheElement elem = this.lastLookupType;
+        if (elem != null && elem.lastCpi == cpi) {
+            return elem.javaType;
+        } else {
+            final long metaspacePointer = runtime().getCompilerToVM().lookupKlassInPool(metaspaceConstantPool, cpi);
+            JavaType result = getJavaType(metaspacePointer);
+            if (result instanceof ResolvedJavaType) {
+                this.lastLookupType = new LookupTypeCacheElement(cpi, result);
+            }
+            return result;
+        }
+    }
+
+    @Override
+    public JavaField lookupField(int cpi, int opcode) {
+        Object resolvedJavaField = cache[cpi];
+        if (resolvedJavaField != null) {
+            return (ResolvedJavaField) resolvedJavaField;
+        }
+        final int index = toConstantPoolIndex(cpi, opcode);
+        final int nameAndTypeIndex = getNameAndTypeRefIndexAt(index);
+        final int nameIndex = getNameRefIndexAt(nameAndTypeIndex);
+        String name = lookupUtf8(nameIndex);
+        final int typeIndex = getSignatureRefIndexAt(nameAndTypeIndex);
+        String typeName = lookupUtf8(typeIndex);
+        JavaType type = runtime().lookupType(typeName, getHolder(), false);
+
+        final int holderIndex = getKlassRefIndexAt(index);
+        JavaType holder = lookupType(holderIndex, opcode);
+
+        if (holder instanceof HotSpotResolvedObjectTypeImpl) {
+            long[] info = new long[2];
+            long metaspaceKlass;
+            try {
+                metaspaceKlass = runtime().getCompilerToVM().resolveField(metaspaceConstantPool, index, (byte) opcode, info);
+            } catch (Throwable t) {
+                /*
+                 * If there was an exception resolving the field we give up and return an unresolved
+                 * field.
+                 */
+                return new HotSpotUnresolvedField(holder, name, type);
+            }
+            HotSpotResolvedObjectTypeImpl resolvedHolder = HotSpotResolvedObjectTypeImpl.fromMetaspaceKlass(metaspaceKlass);
+            final int flags = (int) info[0];
+            final long offset = info[1];
+            HotSpotResolvedJavaField result = resolvedHolder.createField(name, type, offset, flags);
+            if (type instanceof ResolvedJavaType) {
+                cache[cpi] = result;
+            }
+            return result;
+        } else {
+            return new HotSpotUnresolvedField(holder, name, type);
+        }
+    }
+
+    @Override
+    public void loadReferencedType(int cpi, int opcode) {
+        int index;
+        switch (opcode) {
+            case Bytecodes.CHECKCAST:
+            case Bytecodes.INSTANCEOF:
+            case Bytecodes.NEW:
+            case Bytecodes.ANEWARRAY:
+            case Bytecodes.MULTIANEWARRAY:
+            case Bytecodes.LDC:
+            case Bytecodes.LDC_W:
+            case Bytecodes.LDC2_W:
+                index = cpi;
+                break;
+            case Bytecodes.INVOKEDYNAMIC:
+                // invokedynamic instructions point to a constant pool cache entry.
+                index = decodeConstantPoolCacheIndex(cpi) + runtime().getConfig().constantPoolCpCacheIndexTag;
+                index = runtime().getCompilerToVM().constantPoolRemapInstructionOperandFromCache(metaspaceConstantPool, index);
+                break;
+            default:
+                index = toConstantPoolIndex(cpi, opcode);
+                index = runtime().getCompilerToVM().constantPoolRemapInstructionOperandFromCache(metaspaceConstantPool, index);
+        }
+
+        JVM_CONSTANT tag = getTagAt(index);
+        if (tag == null) {
+            assert getTagAt(index - 1) == JVM_CONSTANT.Double || getTagAt(index - 1) == JVM_CONSTANT.Long;
+            return;
+        }
+        switch (tag) {
+            case Fieldref:
+            case MethodRef:
+            case InterfaceMethodref:
+                index = getUncachedKlassRefIndexAt(index);
+                tag = getTagAt(index);
+                assert tag == JVM_CONSTANT.Class || tag == JVM_CONSTANT.UnresolvedClass || tag == JVM_CONSTANT.UnresolvedClassInError : tag;
+                // fall through
+            case Class:
+            case UnresolvedClass:
+            case UnresolvedClassInError:
+                final long metaspaceKlass = runtime().getCompilerToVM().constantPoolKlassAt(metaspaceConstantPool, index);
+                HotSpotResolvedObjectTypeImpl type = HotSpotResolvedObjectTypeImpl.fromMetaspaceKlass(metaspaceKlass);
+                Class<?> klass = type.mirror();
+                if (!klass.isPrimitive() && !klass.isArray()) {
+                    unsafe.ensureClassInitialized(klass);
+                }
+                break;
+            case InvokeDynamic:
+                if (isInvokedynamicIndex(cpi)) {
+                    runtime().getCompilerToVM().resolveInvokeDynamic(metaspaceConstantPool, cpi);
+                }
+                break;
+            default:
+                // nothing
+                break;
+        }
+    }
+
+    @Override
+    public String toString() {
+        HotSpotResolvedObjectType holder = getHolder();
+        return "HotSpotConstantPool<" + holder.toJavaName() + ">";
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotConstantReflectionProvider.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,364 @@
+/*
+ * Copyright (c) 2011, 2015, 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.jvmci.hotspot;
+
+import static com.oracle.jvmci.hotspot.HotSpotConstantReflectionProvider.Options.*;
+
+import java.lang.reflect.*;
+
+import com.oracle.jvmci.meta.*;
+import com.oracle.jvmci.options.*;
+
+/**
+ * HotSpot implementation of {@link ConstantReflectionProvider}.
+ */
+public class HotSpotConstantReflectionProvider implements ConstantReflectionProvider, HotSpotProxified {
+
+    static class Options {
+        //@formatter:off
+        @Option(help = "Constant fold final fields with default values.", type = OptionType.Debug)
+        public static final OptionValue<Boolean> TrustFinalDefaultFields = new OptionValue<>(true);
+        //@formatter:on
+    }
+
+    protected final HotSpotJVMCIRuntimeProvider runtime;
+    protected final HotSpotMethodHandleAccessProvider methodHandleAccess;
+    protected final HotSpotMemoryAccessProviderImpl memoryAccess;
+
+    public HotSpotConstantReflectionProvider(HotSpotJVMCIRuntimeProvider runtime) {
+        this.runtime = runtime;
+        this.methodHandleAccess = new HotSpotMethodHandleAccessProvider(this);
+        this.memoryAccess = new HotSpotMemoryAccessProviderImpl(runtime);
+    }
+
+    public MethodHandleAccessProvider getMethodHandleAccess() {
+        return methodHandleAccess;
+    }
+
+    @Override
+    public MemoryAccessProvider getMemoryAccessProvider() {
+        return memoryAccess;
+    }
+
+    @Override
+    public Boolean constantEquals(Constant x, Constant y) {
+        if (x == y) {
+            return true;
+        } else if (x instanceof HotSpotObjectConstantImpl) {
+            return y instanceof HotSpotObjectConstantImpl && ((HotSpotObjectConstantImpl) x).object() == ((HotSpotObjectConstantImpl) y).object();
+        } else {
+            return x.equals(y);
+        }
+    }
+
+    @Override
+    public Integer readArrayLength(JavaConstant array) {
+        if (array.getKind() != Kind.Object || array.isNull()) {
+            return null;
+        }
+
+        Object arrayObject = ((HotSpotObjectConstantImpl) array).object();
+        if (!arrayObject.getClass().isArray()) {
+            return null;
+        }
+        return Array.getLength(arrayObject);
+    }
+
+    public JavaConstant readConstantArrayElement(JavaConstant array, int index) {
+        if (array instanceof HotSpotObjectConstantImpl && ((HotSpotObjectConstantImpl) array).getStableDimension() > 0) {
+            JavaConstant element = readArrayElement(array, index);
+            if (element != null && (((HotSpotObjectConstantImpl) array).isDefaultStable() || !element.isDefaultForKind())) {
+                return element;
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Try to convert {@code offset} into an an index into {@code array}.
+     *
+     * @return -1 if the offset isn't within the array or the computed index
+     */
+    private int indexForOffset(JavaConstant array, long offset) {
+        if (array.getKind() != Kind.Object || array.isNull()) {
+            return -1;
+        }
+        Class<?> componentType = ((HotSpotObjectConstantImpl) array).object().getClass().getComponentType();
+        Kind kind = runtime.getHostJVMCIBackend().getMetaAccess().lookupJavaType(componentType).getKind();
+        int arraybase = runtime.getArrayBaseOffset(kind);
+        int scale = runtime.getArrayIndexScale(kind);
+        if (offset < arraybase) {
+            return -1;
+        }
+        long index = offset - arraybase;
+        if (index % scale != 0) {
+            return -1;
+        }
+        long result = index / scale;
+        if (result >= Integer.MAX_VALUE) {
+            return -1;
+        }
+        return (int) result;
+    }
+
+    public JavaConstant readConstantArrayElementForOffset(JavaConstant array, long offset) {
+        if (array instanceof HotSpotObjectConstantImpl && ((HotSpotObjectConstantImpl) array).getStableDimension() > 0) {
+            return readConstantArrayElement(array, indexForOffset(array, offset));
+        }
+        return null;
+    }
+
+    @Override
+    public JavaConstant readArrayElement(JavaConstant array, int index) {
+        if (array.getKind() != Kind.Object || array.isNull()) {
+            return null;
+        }
+        Object a = ((HotSpotObjectConstantImpl) array).object();
+
+        if (index < 0 || index >= Array.getLength(a)) {
+            return null;
+        }
+
+        if (a instanceof Object[]) {
+            Object element = ((Object[]) a)[index];
+            if (((HotSpotObjectConstantImpl) array).getStableDimension() > 1) {
+                return HotSpotObjectConstantImpl.forStableArray(element, ((HotSpotObjectConstantImpl) array).getStableDimension() - 1, ((HotSpotObjectConstantImpl) array).isDefaultStable());
+            } else {
+                return HotSpotObjectConstantImpl.forObject(element);
+            }
+        } else {
+            return JavaConstant.forBoxedPrimitive(Array.get(a, index));
+        }
+    }
+
+    /**
+     * Check if the constant is a boxed value that is guaranteed to be cached by the platform.
+     * Otherwise the generated code might be the only reference to the boxed value and since object
+     * references from nmethods are weak this can cause GC problems.
+     *
+     * @param source
+     * @return true if the box is cached
+     */
+    private static boolean isBoxCached(JavaConstant source) {
+        switch (source.getKind()) {
+            case Boolean:
+                return true;
+            case Char:
+                return source.asInt() <= 127;
+            case Byte:
+            case Short:
+            case Int:
+                return source.asInt() >= -128 && source.asInt() <= 127;
+            case Long:
+                return source.asLong() >= -128 && source.asLong() <= 127;
+            case Float:
+            case Double:
+                return false;
+            default:
+                throw new IllegalArgumentException("unexpected kind " + source.getKind());
+        }
+    }
+
+    @Override
+    public JavaConstant boxPrimitive(JavaConstant source) {
+        if (!source.getKind().isPrimitive() || !isBoxCached(source)) {
+            return null;
+        }
+        return HotSpotObjectConstantImpl.forObject(source.asBoxedPrimitive());
+    }
+
+    @Override
+    public JavaConstant unboxPrimitive(JavaConstant source) {
+        if (!source.getKind().isObject()) {
+            return null;
+        }
+        if (source.isNull()) {
+            return null;
+        }
+        return JavaConstant.forBoxedPrimitive(((HotSpotObjectConstantImpl) source).object());
+    }
+
+    public JavaConstant forString(String value) {
+        return HotSpotObjectConstantImpl.forObject(value);
+    }
+
+    @Override
+    public ResolvedJavaType asJavaType(Constant constant) {
+        if (constant instanceof HotSpotObjectConstant) {
+            Object obj = ((HotSpotObjectConstantImpl) constant).object();
+            if (obj instanceof Class) {
+                return runtime.getHostJVMCIBackend().getMetaAccess().lookupJavaType((Class<?>) obj);
+            }
+        }
+        if (constant instanceof HotSpotMetaspaceConstant) {
+            Object obj = HotSpotMetaspaceConstantImpl.getMetaspaceObject(constant);
+            if (obj instanceof HotSpotResolvedObjectTypeImpl) {
+                return (ResolvedJavaType) obj;
+            }
+        }
+        return null;
+    }
+
+    private static final String SystemClassName = "Ljava/lang/System;";
+
+    /**
+     * Determines if a static field is constant for the purpose of
+     * {@link #readConstantFieldValue(JavaField, JavaConstant)}.
+     */
+    protected boolean isStaticFieldConstant(HotSpotResolvedJavaField staticField) {
+        if (staticField.isFinal() || staticField.isStable()) {
+            ResolvedJavaType holder = staticField.getDeclaringClass();
+            if (holder.isInitialized() && !holder.getName().equals(SystemClassName)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * Determines if a value read from a {@code final} instance field is considered constant. The
+     * implementation in {@link HotSpotConstantReflectionProvider} returns true if {@code value} is
+     * not the {@link JavaConstant#isDefaultForKind default value} for its kind or if
+     * {@link Options#TrustFinalDefaultFields} is true.
+     *
+     * @param value a value read from a {@code final} instance field
+     * @param receiverClass the {@link Object#getClass() class} of object from which the
+     *            {@code value} was read
+     */
+    protected boolean isFinalInstanceFieldValueConstant(JavaConstant value, Class<?> receiverClass) {
+        return !value.isDefaultForKind() || TrustFinalDefaultFields.getValue();
+    }
+
+    /**
+     * Determines if a value read from a {@link Stable} instance field is considered constant. The
+     * implementation in {@link HotSpotConstantReflectionProvider} returns true if {@code value} is
+     * not the {@link JavaConstant#isDefaultForKind default value} for its kind.
+     *
+     * @param value a value read from a {@link Stable} field
+     * @param receiverClass the {@link Object#getClass() class} of object from which the
+     *            {@code value} was read
+     */
+    protected boolean isStableInstanceFieldValueConstant(JavaConstant value, Class<?> receiverClass) {
+        return !value.isDefaultForKind();
+    }
+
+    /**
+     * {@inheritDoc}
+     * <p>
+     * The {@code value} field in {@link OptionValue} is considered constant if the type of
+     * {@code receiver} is (assignable to) {@link StableOptionValue}.
+     */
+    public JavaConstant readConstantFieldValue(JavaField field, JavaConstant receiver) {
+        HotSpotResolvedJavaField hotspotField = (HotSpotResolvedJavaField) field;
+
+        if (hotspotField.isStatic()) {
+            if (isStaticFieldConstant(hotspotField)) {
+                JavaConstant value = readFieldValue(field, receiver);
+                if (hotspotField.isFinal() || !value.isDefaultForKind()) {
+                    return value;
+                }
+            }
+        } else {
+            /*
+             * for non-static final fields, we must assume that they are only initialized if they
+             * have a non-default value.
+             */
+            Object object = receiver.isNull() ? null : ((HotSpotObjectConstantImpl) receiver).object();
+
+            // Canonicalization may attempt to process an unsafe read before
+            // processing a guard (e.g. a null check or a type check) for this read
+            // so we need to check the object being read
+            if (object != null) {
+                if (hotspotField.isFinal()) {
+                    if (hotspotField.isInObject(object)) {
+                        JavaConstant value = readFieldValue(field, receiver);
+                        if (isFinalInstanceFieldValueConstant(value, object.getClass())) {
+                            return value;
+                        }
+                    }
+                } else if (hotspotField.isStable()) {
+                    if (hotspotField.isInObject(object)) {
+                        JavaConstant value = readFieldValue(field, receiver);
+                        if (isStableInstanceFieldValueConstant(value, object.getClass())) {
+                            return value;
+                        }
+                    }
+                } else {
+                    Class<?> clazz = object.getClass();
+                    if (StableOptionValue.class.isAssignableFrom(clazz)) {
+                        if (hotspotField.isInObject(object) && hotspotField.getName().equals("value")) {
+                            StableOptionValue<?> option = (StableOptionValue<?>) object;
+                            return HotSpotObjectConstantImpl.forObject(option.getValue());
+                        }
+                    }
+                }
+            }
+        }
+        return null;
+    }
+
+    public JavaConstant readFieldValue(JavaField field, JavaConstant receiver) {
+        HotSpotResolvedJavaField hotspotField = (HotSpotResolvedJavaField) field;
+        if (!hotspotField.isStable()) {
+            return readNonStableFieldValue(field, receiver);
+        } else {
+            return readStableFieldValue(field, receiver, false);
+        }
+    }
+
+    private JavaConstant readNonStableFieldValue(JavaField field, JavaConstant receiver) {
+        HotSpotResolvedJavaField hotspotField = (HotSpotResolvedJavaField) field;
+        if (hotspotField.isStatic()) {
+            HotSpotResolvedJavaType holder = (HotSpotResolvedJavaType) hotspotField.getDeclaringClass();
+            if (holder.isInitialized()) {
+                return memoryAccess.readUnsafeConstant(hotspotField.getKind(), HotSpotObjectConstantImpl.forObject(holder.mirror()), hotspotField.offset());
+            }
+        } else {
+            if (receiver.isNonNull() && hotspotField.isInObject(((HotSpotObjectConstantImpl) receiver).object())) {
+                return memoryAccess.readUnsafeConstant(hotspotField.getKind(), receiver, hotspotField.offset());
+            }
+        }
+        return null;
+    }
+
+    public JavaConstant readStableFieldValue(JavaField field, JavaConstant receiver, boolean isDefaultStable) {
+        JavaConstant fieldValue = readNonStableFieldValue(field, receiver);
+        if (fieldValue.isNonNull()) {
+            JavaType declaredType = field.getType();
+            if (declaredType.getComponentType() != null) {
+                int stableDimension = getArrayDimension(declaredType);
+                return HotSpotObjectConstantImpl.forStableArray(((HotSpotObjectConstantImpl) fieldValue).object(), stableDimension, isDefaultStable);
+            }
+        }
+        return fieldValue;
+    }
+
+    private static int getArrayDimension(JavaType type) {
+        int dimensions = 0;
+        JavaType componentType = type;
+        while ((componentType = componentType.getComponentType()) != null) {
+            dimensions++;
+        }
+        return dimensions;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotForeignCallTarget.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2015, 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.jvmci.hotspot;
+
+import com.oracle.jvmci.meta.*;
+
+public class HotSpotForeignCallTarget {
+    /**
+     * The descriptor of the call.
+     */
+    protected final ForeignCallDescriptor descriptor;
+
+    /**
+     * The entry point address of this call's target.
+     */
+    protected long address;
+
+    public HotSpotForeignCallTarget(ForeignCallDescriptor descriptor, long address) {
+        this.descriptor = descriptor;
+        this.address = address;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotInstalledCode.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,97 @@
+/*
+ * 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.jvmci.hotspot;
+
+import static com.oracle.jvmci.common.UnsafeAccess.*;
+import sun.misc.*;
+
+import com.oracle.jvmci.code.*;
+
+import edu.umd.cs.findbugs.annotations.*;
+
+/**
+ * Implementation of {@link InstalledCode} for HotSpot.
+ */
+public abstract class HotSpotInstalledCode extends InstalledCode {
+
+    /**
+     * Total size of the code blob.
+     */
+    @SuppressFBWarnings(value = "UWF_UNWRITTEN_FIELD", justification = "field is set by the native part") private int size;
+
+    /**
+     * Start address of the code.
+     */
+    @SuppressFBWarnings(value = "UWF_UNWRITTEN_FIELD", justification = "field is set by the native part") private long codeStart;
+
+    /**
+     * Size of the code.
+     */
+    @SuppressFBWarnings(value = "UWF_UNWRITTEN_FIELD", justification = "field is set by the native part") private int codeSize;
+
+    public HotSpotInstalledCode(String name) {
+        super(name);
+    }
+
+    /**
+     * @return the total size of this code blob
+     */
+    public int getSize() {
+        return size;
+    }
+
+    /**
+     * @return a copy of this code blob if it is {@linkplain #isValid() valid}, null otherwise.
+     */
+    public byte[] getBlob() {
+        if (!isValid()) {
+            return null;
+        }
+        byte[] blob = new byte[size];
+        unsafe.copyMemory(null, getAddress(), blob, Unsafe.ARRAY_BYTE_BASE_OFFSET, size);
+        return blob;
+    }
+
+    @Override
+    public abstract String toString();
+
+    @Override
+    public long getStart() {
+        return codeStart;
+    }
+
+    @Override
+    public long getCodeSize() {
+        return codeSize;
+    }
+
+    @Override
+    public byte[] getCode() {
+        if (!isValid()) {
+            return null;
+        }
+        byte[] code = new byte[codeSize];
+        unsafe.copyMemory(null, codeStart, code, Unsafe.ARRAY_BYTE_BASE_OFFSET, codeSize);
+        return code;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotJVMCIBackendFactory.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2015, 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.jvmci.hotspot;
+
+import com.oracle.jvmci.runtime.*;
+
+public interface HotSpotJVMCIBackendFactory extends Service {
+
+    JVMCIBackend createJVMCIBackend(HotSpotJVMCIRuntimeProvider runtime, JVMCIBackend host);
+
+    /**
+     * Gets the CPU architecture of this backend.
+     */
+    String getArchitecture();
+
+    String getJVMCIRuntimeName();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotJVMCIRuntime.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,308 @@
+/*
+ * Copyright (c) 2015, 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.jvmci.hotspot;
+
+import static com.oracle.jvmci.common.UnsafeAccess.*;
+import static com.oracle.jvmci.hotspot.InitTimer.*;
+
+import java.lang.reflect.*;
+import java.util.*;
+
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.hotspot.logging.*;
+import com.oracle.jvmci.meta.*;
+import com.oracle.jvmci.options.*;
+import com.oracle.jvmci.runtime.*;
+
+//JaCoCo Exclude
+
+public final class HotSpotJVMCIRuntime implements HotSpotJVMCIRuntimeProvider, HotSpotProxified {
+
+    private static final HotSpotJVMCIRuntime instance;
+
+    static {
+        try (InitTimer t0 = timer("HotSpotJVMCIRuntime.<clinit>")) {
+            try (InitTimer t = timer("HotSpotJVMCIRuntime.<init>")) {
+                instance = new HotSpotJVMCIRuntime();
+            }
+
+            try (InitTimer t = timer("HotSpotJVMCIRuntime.completeInitialization")) {
+                // Why deferred initialization? See comment in completeInitialization().
+                instance.completeInitialization();
+            }
+        }
+    }
+
+    /**
+     * Gets the singleton {@link HotSpotJVMCIRuntime} object.
+     */
+    public static HotSpotJVMCIRuntime runtime() {
+        assert instance != null;
+        return instance;
+    }
+
+    /**
+     * Do deferred initialization.
+     */
+    public void completeInitialization() {
+        TTY.initialize(Options.LogFile.getStream(compilerToVm));
+
+        // Proxies for the VM/Compiler interfaces cannot be initialized
+        // in the constructor as proxy creation causes static
+        // initializers to be executed for all the types involved in the
+        // proxied methods. Some of these static initializers (e.g. in
+        // HotSpotMethodData) rely on the static 'instance' field being set
+        // to retrieve configuration details.
+        CompilerToVM toVM = this.compilerToVm;
+
+        if (CountingProxy.ENABLED) {
+            toVM = CountingProxy.getProxy(CompilerToVM.class, toVM);
+        }
+        if (Logger.ENABLED) {
+            toVM = LoggingProxy.getProxy(CompilerToVM.class, toVM);
+        }
+
+        this.compilerToVm = toVM;
+    }
+
+    public static class Options {
+
+        // @formatter:off
+        @Option(help = "The JVMCI runtime configuration to use", type = OptionType.Expert)
+        public static final OptionValue<String> JVMCIRuntime = new OptionValue<>("");
+
+        @Option(help = "File to which logging is sent.  A %p in the name will be replaced with a string identifying the process, usually the process id.", type = OptionType.Expert)
+        public static final PrintStreamOption LogFile = new PrintStreamOption();
+        // @formatter:on
+    }
+
+    public static HotSpotJVMCIBackendFactory findFactory(String architecture) {
+        HotSpotJVMCIBackendFactory basic = null;
+        HotSpotJVMCIBackendFactory selected = null;
+        HotSpotJVMCIBackendFactory nonBasic = null;
+        int nonBasicCount = 0;
+
+        for (HotSpotJVMCIBackendFactory factory : Services.load(HotSpotJVMCIBackendFactory.class)) {
+            if (factory.getArchitecture().equalsIgnoreCase(architecture)) {
+                if (factory.getJVMCIRuntimeName().equals(Options.JVMCIRuntime.getValue())) {
+                    assert selected == null || checkFactoryOverriding(selected, factory);
+                    selected = factory;
+                }
+                if (factory.getJVMCIRuntimeName().equals("basic")) {
+                    assert basic == null || checkFactoryOverriding(basic, factory);
+                    basic = factory;
+                } else {
+                    nonBasic = factory;
+                    nonBasicCount++;
+                }
+            }
+        }
+
+        if (selected != null) {
+            return selected;
+        } else {
+            if (!Options.JVMCIRuntime.getValue().equals("")) {
+                // Fail fast if a non-default value for JVMCIRuntime was specified
+                // and the corresponding factory is not available
+                throw new JVMCIError("Specified runtime \"%s\" not available for the %s architecture", Options.JVMCIRuntime.getValue(), architecture);
+            } else if (nonBasicCount == 1) {
+                // If there is exactly one non-basic runtime, select this one.
+                return nonBasic;
+            } else {
+                return basic;
+            }
+        }
+    }
+
+    /**
+     * Checks that a factory overriding is valid. A factory B can only override/replace a factory A
+     * if the B.getClass() is a subclass of A.getClass(). This models the assumption that B is
+     * extends the behavior of A and has therefore understood the behavior expected of A.
+     *
+     * @param baseFactory
+     * @param overridingFactory
+     */
+    private static boolean checkFactoryOverriding(HotSpotJVMCIBackendFactory baseFactory, HotSpotJVMCIBackendFactory overridingFactory) {
+        return baseFactory.getClass().isAssignableFrom(overridingFactory.getClass());
+    }
+
+    /**
+     * Gets the kind of a word value on the {@linkplain #getHostJVMCIBackend() host} backend.
+     */
+    public static Kind getHostWordKind() {
+        return instance.getHostJVMCIBackend().getCodeCache().getTarget().wordKind;
+    }
+
+    /**
+     * Reads a klass pointer from a constant object.
+     */
+    public static long unsafeReadKlassPointer(Object object) {
+        return instance.getCompilerToVM().readUnsafeKlassPointer(object);
+    }
+
+    /**
+     * Reads a word value from a given object.
+     */
+    public static long unsafeReadWord(Object object, long offset) {
+        if (getHostWordKind() == Kind.Long) {
+            return unsafe.getLong(object, offset);
+        }
+        return unsafe.getInt(object, offset) & 0xFFFFFFFFL;
+    }
+
+    protected/* final */CompilerToVM compilerToVm;
+
+    protected final HotSpotVMConfig config;
+    private final JVMCIBackend hostBackend;
+
+    /**
+     * JVMCI mirrors are stored as a {@link ClassValue} associated with the {@link Class} of the
+     * type. This data structure stores both {@link HotSpotResolvedObjectType} and
+     * {@link HotSpotResolvedPrimitiveType} types.
+     */
+    private final ClassValue<ResolvedJavaType> jvmciMirrors = new ClassValue<ResolvedJavaType>() {
+        @Override
+        protected ResolvedJavaType computeValue(Class<?> javaClass) {
+            if (javaClass.isPrimitive()) {
+                Kind kind = Kind.fromJavaClass(javaClass);
+                return new HotSpotResolvedPrimitiveType(kind);
+            } else {
+                return new HotSpotResolvedObjectTypeImpl(javaClass);
+            }
+        }
+    };
+
+    private final Map<Class<? extends Architecture>, JVMCIBackend> backends = new HashMap<>();
+
+    private HotSpotJVMCIRuntime() {
+        CompilerToVM toVM = new CompilerToVMImpl();
+        compilerToVm = toVM;
+        try (InitTimer t = timer("HotSpotVMConfig<init>")) {
+            config = new HotSpotVMConfig(compilerToVm);
+        }
+
+        if (Boolean.valueOf(System.getProperty("jvmci.printconfig"))) {
+            printConfig(config);
+        }
+
+        String hostArchitecture = config.getHostArchitectureName();
+
+        HotSpotJVMCIBackendFactory factory;
+        try (InitTimer t = timer("find factory:", hostArchitecture)) {
+            factory = findFactory(hostArchitecture);
+        }
+        try (InitTimer t = timer("create JVMCI backend:", hostArchitecture)) {
+            hostBackend = registerBackend(factory.createJVMCIBackend(this, null));
+        }
+    }
+
+    private JVMCIBackend registerBackend(JVMCIBackend backend) {
+        Class<? extends Architecture> arch = backend.getCodeCache().getTarget().arch.getClass();
+        JVMCIBackend oldValue = backends.put(arch, backend);
+        assert oldValue == null : "cannot overwrite existing backend for architecture " + arch.getSimpleName();
+        return backend;
+    }
+
+    public ResolvedJavaType fromClass(Class<?> javaClass) {
+        return jvmciMirrors.get(javaClass);
+    }
+
+    private static void printConfig(HotSpotVMConfig config) {
+        Field[] fields = config.getClass().getDeclaredFields();
+        Map<String, Field> sortedFields = new TreeMap<>();
+        for (Field f : fields) {
+            f.setAccessible(true);
+            sortedFields.put(f.getName(), f);
+        }
+        for (Field f : sortedFields.values()) {
+            try {
+                Logger.info(String.format("%9s %-40s = %s", f.getType().getSimpleName(), f.getName(), Logger.pretty(f.get(config))));
+            } catch (Exception e) {
+            }
+        }
+    }
+
+    public HotSpotVMConfig getConfig() {
+        return config;
+    }
+
+    public CompilerToVM getCompilerToVM() {
+        return compilerToVm;
+    }
+
+    public JavaType lookupType(String name, HotSpotResolvedObjectType accessingType, boolean resolve) {
+        Objects.requireNonNull(accessingType, "cannot resolve type without an accessing class");
+        // If the name represents a primitive type we can short-circuit the lookup.
+        if (name.length() == 1) {
+            Kind kind = Kind.fromPrimitiveOrVoidTypeChar(name.charAt(0));
+            return fromClass(kind.toJavaClass());
+        }
+
+        // Resolve non-primitive types in the VM.
+        HotSpotResolvedObjectTypeImpl hsAccessingType = (HotSpotResolvedObjectTypeImpl) accessingType;
+        final long metaspaceKlass = compilerToVm.lookupType(name, hsAccessingType.mirror(), resolve);
+
+        if (metaspaceKlass == 0L) {
+            assert resolve == false;
+            return HotSpotUnresolvedJavaType.create(this, name);
+        }
+        return HotSpotResolvedObjectTypeImpl.fromMetaspaceKlass(metaspaceKlass);
+    }
+
+    public JVMCIBackend getHostJVMCIBackend() {
+        return hostBackend;
+    }
+
+    public <T extends Architecture> JVMCIBackend getJVMCIBackend(Class<T> arch) {
+        assert arch != Architecture.class;
+        return backends.get(arch);
+    }
+
+    public Map<Class<? extends Architecture>, JVMCIBackend> getBackends() {
+        return Collections.unmodifiableMap(backends);
+    }
+
+    /**
+     * Called from the VM.
+     */
+    @SuppressWarnings({"unused", "static-method"})
+    private void compileTheWorld() throws Throwable {
+        for (HotSpotVMEventListener l : Services.load(HotSpotVMEventListener.class)) {
+            l.notifyCompileTheWorld();
+        }
+    }
+
+    /**
+     * Shuts down the runtime.
+     *
+     * Called from the VM.
+     */
+    @SuppressWarnings({"unused", "static-method"})
+    private void shutdown() throws Exception {
+        for (HotSpotVMEventListener l : Services.load(HotSpotVMEventListener.class)) {
+            l.notifyShutdown();
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotJVMCIRuntimeProvider.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,123 @@
+/*
+ * Copyright (c) 2015, 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.jvmci.hotspot;
+
+import sun.misc.*;
+
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.meta.*;
+import com.oracle.jvmci.runtime.*;
+
+//JaCoCo Exclude
+
+/**
+ * Configuration information for the HotSpot JVMCI runtime.
+ */
+public interface HotSpotJVMCIRuntimeProvider extends JVMCIRuntime {
+
+    HotSpotVMConfig getConfig();
+
+    CompilerToVM getCompilerToVM();
+
+    /**
+     * Converts a name to a Java type. This method attempts to resolve {@code name} to a
+     * {@link ResolvedJavaType}.
+     *
+     * @param name a well formed Java type in {@linkplain JavaType#getName() internal} format
+     * @param accessingType the context of resolution which must be non-null
+     * @param resolve specifies whether resolution failure results in an unresolved type being
+     *            return or a {@link LinkageError} being thrown
+     * @return a Java type for {@code name} which is guaranteed to be of type
+     *         {@link ResolvedJavaType} if {@code resolve == true}
+     * @throws LinkageError if {@code resolve == true} and the resolution failed
+     * @throws NullPointerException if {@code accessingClass} is {@code null}
+     */
+    JavaType lookupType(String name, HotSpotResolvedObjectType accessingType, boolean resolve);
+
+    /**
+     * Gets the JVMCI mirror for a {@link Class} object.
+     *
+     * @return the {@link ResolvedJavaType} corresponding to {@code javaClass}
+     */
+    ResolvedJavaType fromClass(Class<?> clazz);
+
+    /**
+     * The offset from the origin of an array to the first element.
+     *
+     * @return the offset in bytes
+     */
+    default int getArrayBaseOffset(Kind kind) {
+        switch (kind) {
+            case Boolean:
+                return Unsafe.ARRAY_BOOLEAN_BASE_OFFSET;
+            case Byte:
+                return Unsafe.ARRAY_BYTE_BASE_OFFSET;
+            case Char:
+                return Unsafe.ARRAY_CHAR_BASE_OFFSET;
+            case Short:
+                return Unsafe.ARRAY_SHORT_BASE_OFFSET;
+            case Int:
+                return Unsafe.ARRAY_INT_BASE_OFFSET;
+            case Long:
+                return Unsafe.ARRAY_LONG_BASE_OFFSET;
+            case Float:
+                return Unsafe.ARRAY_FLOAT_BASE_OFFSET;
+            case Double:
+                return Unsafe.ARRAY_DOUBLE_BASE_OFFSET;
+            case Object:
+                return Unsafe.ARRAY_OBJECT_BASE_OFFSET;
+            default:
+                throw new JVMCIError("%s", kind);
+        }
+    }
+
+    /**
+     * The scale used for the index when accessing elements of an array of this kind.
+     *
+     * @return the scale in order to convert the index into a byte offset
+     */
+    default int getArrayIndexScale(Kind kind) {
+        switch (kind) {
+            case Boolean:
+                return Unsafe.ARRAY_BOOLEAN_INDEX_SCALE;
+            case Byte:
+                return Unsafe.ARRAY_BYTE_INDEX_SCALE;
+            case Char:
+                return Unsafe.ARRAY_CHAR_INDEX_SCALE;
+            case Short:
+                return Unsafe.ARRAY_SHORT_INDEX_SCALE;
+            case Int:
+                return Unsafe.ARRAY_INT_INDEX_SCALE;
+            case Long:
+                return Unsafe.ARRAY_LONG_INDEX_SCALE;
+            case Float:
+                return Unsafe.ARRAY_FLOAT_INDEX_SCALE;
+            case Double:
+                return Unsafe.ARRAY_DOUBLE_INDEX_SCALE;
+            case Object:
+                return Unsafe.ARRAY_OBJECT_INDEX_SCALE;
+            default:
+                throw new JVMCIError("%s", kind);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotJavaType.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,42 @@
+/*
+ * 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.jvmci.hotspot;
+
+import com.oracle.jvmci.meta.*;
+
+/**
+ * Common base class for all HotSpot {@link JavaType} implementations.
+ */
+public abstract class HotSpotJavaType implements JavaType {
+
+    private final String name;
+
+    public HotSpotJavaType(String name) {
+        this.name = name;
+    }
+
+    @Override
+    public final String getName() {
+        return name;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotMemoryAccessProvider.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.hotspot;
+
+import com.oracle.jvmci.hotspot.HotSpotVMConfig.CompressEncoding;
+import com.oracle.jvmci.meta.*;
+
+/**
+ * HotSpot specific extension of {@link MemoryAccessProvider}.
+ */
+public interface HotSpotMemoryAccessProvider extends MemoryAccessProvider {
+
+    JavaConstant readNarrowOopConstant(Constant base, long displacement, CompressEncoding encoding);
+
+    Constant readKlassPointerConstant(Constant base, long displacement);
+
+    Constant readNarrowKlassPointerConstant(Constant base, long displacement, CompressEncoding encoding);
+
+    Constant readMethodPointerConstant(Constant base, long displacement);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotMemoryAccessProviderImpl.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,232 @@
+/*
+ * Copyright (c) 2011, 2015, 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.jvmci.hotspot;
+
+import static com.oracle.jvmci.common.UnsafeAccess.*;
+
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.hotspot.HotSpotVMConfig.CompressEncoding;
+import com.oracle.jvmci.meta.*;
+
+/**
+ * HotSpot implementation of {@link MemoryAccessProvider}.
+ */
+public class HotSpotMemoryAccessProviderImpl implements HotSpotMemoryAccessProvider, HotSpotProxified {
+
+    protected final HotSpotJVMCIRuntimeProvider runtime;
+
+    public HotSpotMemoryAccessProviderImpl(HotSpotJVMCIRuntimeProvider runtime) {
+        this.runtime = runtime;
+    }
+
+    private static Object asObject(Constant base) {
+        if (base instanceof HotSpotObjectConstantImpl) {
+            return ((HotSpotObjectConstantImpl) base).object();
+        } else {
+            return null;
+        }
+    }
+
+    private boolean isValidObjectFieldDisplacement(Constant base, long displacement) {
+        if (base instanceof HotSpotMetaspaceConstant) {
+            Object metaspaceObject = HotSpotMetaspaceConstantImpl.getMetaspaceObject(base);
+            if (metaspaceObject instanceof HotSpotResolvedObjectTypeImpl) {
+                if (displacement == runtime.getConfig().classMirrorOffset) {
+                    // Klass::_java_mirror is valid for all Klass* values
+                    return true;
+                } else if (displacement == runtime.getConfig().arrayKlassComponentMirrorOffset) {
+                    // ArrayKlass::_component_mirror is only valid for all ArrayKlass* values
+                    return ((HotSpotResolvedObjectTypeImpl) metaspaceObject).mirror().isArray();
+                }
+            } else {
+                throw new JVMCIError("%s", metaspaceObject);
+            }
+        }
+        return false;
+    }
+
+    private static long asRawPointer(Constant base) {
+        if (base instanceof HotSpotMetaspaceConstant) {
+            return ((HotSpotMetaspaceConstant) base).rawValue();
+        } else if (base instanceof PrimitiveConstant) {
+            PrimitiveConstant prim = (PrimitiveConstant) base;
+            if (prim.getKind().isNumericInteger()) {
+                return prim.asLong();
+            }
+        }
+        throw new JVMCIError("%s", base);
+    }
+
+    private static long readRawValue(Constant baseConstant, long displacement, int bits) {
+        Object base = asObject(baseConstant);
+        if (base != null) {
+            switch (bits) {
+                case 8:
+                    return unsafe.getByte(base, displacement);
+                case 16:
+                    return unsafe.getShort(base, displacement);
+                case 32:
+                    return unsafe.getInt(base, displacement);
+                case 64:
+                    return unsafe.getLong(base, displacement);
+                default:
+                    throw new JVMCIError("%d", bits);
+            }
+        } else {
+            long pointer = asRawPointer(baseConstant);
+            switch (bits) {
+                case 8:
+                    return unsafe.getByte(pointer + displacement);
+                case 16:
+                    return unsafe.getShort(pointer + displacement);
+                case 32:
+                    return unsafe.getInt(pointer + displacement);
+                case 64:
+                    return unsafe.getLong(pointer + displacement);
+                default:
+                    throw new JVMCIError("%d", bits);
+            }
+        }
+    }
+
+    private boolean verifyReadRawObject(Object expected, Constant base, long displacement, boolean compressed) {
+        if (compressed == runtime.getConfig().useCompressedOops) {
+            Object obj = asObject(base);
+            if (obj != null) {
+                assert expected == unsafe.getObject(obj, displacement) : "readUnsafeOop doesn't agree with unsafe.getObject";
+            }
+        }
+        if (base instanceof HotSpotMetaspaceConstant) {
+            Object metaspaceObject = HotSpotMetaspaceConstantImpl.getMetaspaceObject(base);
+            if (metaspaceObject instanceof HotSpotResolvedObjectTypeImpl) {
+                if (displacement == runtime.getConfig().classMirrorOffset) {
+                    assert expected == ((HotSpotResolvedObjectTypeImpl) metaspaceObject).mirror();
+                } else if (displacement == runtime.getConfig().arrayKlassComponentMirrorOffset) {
+                    assert expected == ((HotSpotResolvedObjectTypeImpl) metaspaceObject).mirror().getComponentType();
+                }
+            }
+        }
+        return true;
+    }
+
+    private Object readRawObject(Constant baseConstant, long initialDisplacement, boolean compressed) {
+        long displacement = initialDisplacement;
+
+        Object ret;
+        Object base = asObject(baseConstant);
+        if (base == null) {
+            assert !compressed;
+            displacement += asRawPointer(baseConstant);
+            ret = runtime.getCompilerToVM().readUncompressedOop(displacement);
+        } else {
+            assert runtime.getConfig().useCompressedOops == compressed;
+            ret = unsafe.getObject(base, displacement);
+        }
+        assert verifyReadRawObject(ret, baseConstant, initialDisplacement, compressed);
+        return ret;
+    }
+
+    @Override
+    public JavaConstant readUnsafeConstant(Kind kind, JavaConstant baseConstant, long displacement) {
+        if (kind == Kind.Object) {
+            Object o = readRawObject(baseConstant, displacement, runtime.getConfig().useCompressedOops);
+            return HotSpotObjectConstantImpl.forObject(o);
+        } else {
+            return readPrimitiveConstant(kind, baseConstant, displacement, kind.getByteCount() * 8);
+        }
+    }
+
+    @Override
+    public JavaConstant readPrimitiveConstant(Kind kind, Constant baseConstant, long initialDisplacement, int bits) {
+        try {
+            long rawValue = readRawValue(baseConstant, initialDisplacement, bits);
+            switch (kind) {
+                case Boolean:
+                    return JavaConstant.forBoolean(rawValue != 0);
+                case Byte:
+                    return JavaConstant.forByte((byte) rawValue);
+                case Char:
+                    return JavaConstant.forChar((char) rawValue);
+                case Short:
+                    return JavaConstant.forShort((short) rawValue);
+                case Int:
+                    return JavaConstant.forInt((int) rawValue);
+                case Long:
+                    return JavaConstant.forLong(rawValue);
+                case Float:
+                    return JavaConstant.forFloat(Float.intBitsToFloat((int) rawValue));
+                case Double:
+                    return JavaConstant.forDouble(Double.longBitsToDouble(rawValue));
+                default:
+                    throw new JVMCIError("Unsupported kind: %s", kind);
+            }
+        } catch (NullPointerException e) {
+            return null;
+        }
+    }
+
+    @Override
+    public JavaConstant readObjectConstant(Constant base, long displacement) {
+        if (!isValidObjectFieldDisplacement(base, displacement)) {
+            return null;
+        }
+        return HotSpotObjectConstantImpl.forObject(readRawObject(base, displacement, false));
+    }
+
+    @Override
+    public JavaConstant readNarrowOopConstant(Constant base, long displacement, CompressEncoding encoding) {
+        assert encoding.equals(runtime.getConfig().getOopEncoding()) : "unexpected oop encoding: " + encoding + " != " + runtime.getConfig().getOopEncoding();
+        return HotSpotObjectConstantImpl.forObject(readRawObject(base, displacement, true), true);
+    }
+
+    @Override
+    public Constant readKlassPointerConstant(Constant base, long displacement) {
+        TargetDescription target = runtime.getHostJVMCIBackend().getCodeCache().getTarget();
+        long klass = readRawValue(base, displacement, target.wordSize * 8);
+        if (klass == 0) {
+            return JavaConstant.NULL_POINTER;
+        }
+        HotSpotResolvedObjectType metaKlass = HotSpotResolvedObjectTypeImpl.fromMetaspaceKlass(klass);
+        return HotSpotMetaspaceConstantImpl.forMetaspaceObject(target.wordKind, klass, metaKlass, false);
+    }
+
+    @Override
+    public Constant readNarrowKlassPointerConstant(Constant base, long displacement, CompressEncoding encoding) {
+        int compressed = (int) readRawValue(base, displacement, 32);
+        long klass = encoding.uncompress(compressed);
+        if (klass == 0) {
+            return HotSpotCompressedNullConstant.COMPRESSED_NULL;
+        }
+        HotSpotResolvedObjectType metaKlass = HotSpotResolvedObjectTypeImpl.fromMetaspaceKlass(klass);
+        return HotSpotMetaspaceConstantImpl.forMetaspaceObject(Kind.Int, compressed, metaKlass, true);
+    }
+
+    @Override
+    public Constant readMethodPointerConstant(Constant base, long displacement) {
+        TargetDescription target = runtime.getHostJVMCIBackend().getCodeCache().getTarget();
+        long method = readRawValue(base, displacement, target.wordSize * 8);
+        HotSpotResolvedJavaMethod metaMethod = HotSpotResolvedJavaMethodImpl.fromMetaspace(method);
+        return HotSpotMetaspaceConstantImpl.forMetaspaceObject(target.wordKind, method, metaMethod, false);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotMetaAccessProvider.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,324 @@
+/*
+ * Copyright (c) 2011, 2015, 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.jvmci.hotspot;
+
+import static com.oracle.jvmci.common.UnsafeAccess.*;
+import static com.oracle.jvmci.hotspot.HotSpotResolvedJavaType.*;
+import static com.oracle.jvmci.hotspot.HotSpotResolvedObjectTypeImpl.*;
+
+import java.lang.reflect.*;
+
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.meta.*;
+
+/**
+ * HotSpot implementation of {@link MetaAccessProvider}.
+ */
+public class HotSpotMetaAccessProvider implements MetaAccessProvider, HotSpotProxified {
+
+    protected final HotSpotJVMCIRuntimeProvider runtime;
+
+    public HotSpotMetaAccessProvider(HotSpotJVMCIRuntimeProvider runtime) {
+        this.runtime = runtime;
+    }
+
+    public ResolvedJavaType lookupJavaType(Class<?> clazz) {
+        if (clazz == null) {
+            throw new IllegalArgumentException("Class parameter was null");
+        }
+        return runtime.fromClass(clazz);
+    }
+
+    public HotSpotResolvedObjectType lookupJavaType(JavaConstant constant) {
+        if (constant.isNull() || !(constant instanceof HotSpotObjectConstant)) {
+            return null;
+        }
+        return ((HotSpotObjectConstant) constant).getType();
+    }
+
+    public Signature parseMethodDescriptor(String signature) {
+        return new HotSpotSignature(runtime, signature);
+    }
+
+    /**
+     * {@link Field} object of {@link Method#slot}.
+     */
+    @SuppressWarnings("javadoc") private Field reflectionMethodSlot = getReflectionSlotField(Method.class);
+
+    /**
+     * {@link Field} object of {@link Constructor#slot}.
+     */
+    @SuppressWarnings("javadoc") private Field reflectionConstructorSlot = getReflectionSlotField(Constructor.class);
+
+    private static Field getReflectionSlotField(Class<?> reflectionClass) {
+        try {
+            Field field = reflectionClass.getDeclaredField("slot");
+            field.setAccessible(true);
+            return field;
+        } catch (NoSuchFieldException | SecurityException e) {
+            throw new JVMCIError(e);
+        }
+    }
+
+    public ResolvedJavaMethod lookupJavaMethod(Executable reflectionMethod) {
+        try {
+            Class<?> holder = reflectionMethod.getDeclaringClass();
+            Field slotField = reflectionMethod instanceof Constructor ? reflectionConstructorSlot : reflectionMethodSlot;
+            final int slot = slotField.getInt(reflectionMethod);
+            final long metaspaceMethod = runtime.getCompilerToVM().getMetaspaceMethod(holder, slot);
+            return HotSpotResolvedJavaMethodImpl.fromMetaspace(metaspaceMethod);
+        } catch (IllegalArgumentException | IllegalAccessException e) {
+            throw new JVMCIError(e);
+        }
+    }
+
+    public ResolvedJavaField lookupJavaField(Field reflectionField) {
+        String name = reflectionField.getName();
+        Class<?> fieldHolder = reflectionField.getDeclaringClass();
+        Class<?> fieldType = reflectionField.getType();
+        // java.lang.reflect.Field's modifiers should be enough here since VM internal modifier bits
+        // are not used (yet).
+        final int modifiers = reflectionField.getModifiers();
+        final long offset = Modifier.isStatic(modifiers) ? unsafe.staticFieldOffset(reflectionField) : unsafe.objectFieldOffset(reflectionField);
+
+        HotSpotResolvedObjectType holder = fromObjectClass(fieldHolder);
+        JavaType type = fromClass(fieldType);
+
+        if (offset != -1) {
+            HotSpotResolvedObjectType resolved = holder;
+            return resolved.createField(name, type, offset, modifiers);
+        } else {
+            throw new JVMCIError("unresolved field %s", reflectionField);
+        }
+    }
+
+    private static int intMaskRight(int n) {
+        assert n <= 32;
+        return n == 32 ? -1 : (1 << n) - 1;
+    }
+
+    @Override
+    public JavaConstant encodeDeoptActionAndReason(DeoptimizationAction action, DeoptimizationReason reason, int debugId) {
+        HotSpotVMConfig config = runtime.getConfig();
+        int actionValue = convertDeoptAction(action);
+        int reasonValue = convertDeoptReason(reason);
+        int debugValue = debugId & intMaskRight(config.deoptimizationDebugIdBits);
+        JavaConstant c = JavaConstant.forInt(~((debugValue << config.deoptimizationDebugIdShift) | (reasonValue << config.deoptimizationReasonShift) | (actionValue << config.deoptimizationActionShift)));
+        assert c.asInt() < 0;
+        return c;
+    }
+
+    public DeoptimizationReason decodeDeoptReason(JavaConstant constant) {
+        HotSpotVMConfig config = runtime.getConfig();
+        int reasonValue = ((~constant.asInt()) >> config.deoptimizationReasonShift) & intMaskRight(config.deoptimizationReasonBits);
+        DeoptimizationReason reason = convertDeoptReason(reasonValue);
+        return reason;
+    }
+
+    public DeoptimizationAction decodeDeoptAction(JavaConstant constant) {
+        HotSpotVMConfig config = runtime.getConfig();
+        int actionValue = ((~constant.asInt()) >> config.deoptimizationActionShift) & intMaskRight(config.deoptimizationActionBits);
+        DeoptimizationAction action = convertDeoptAction(actionValue);
+        return action;
+    }
+
+    public int decodeDebugId(JavaConstant constant) {
+        HotSpotVMConfig config = runtime.getConfig();
+        return ((~constant.asInt()) >> config.deoptimizationDebugIdShift) & intMaskRight(config.deoptimizationDebugIdBits);
+    }
+
+    public int convertDeoptAction(DeoptimizationAction action) {
+        HotSpotVMConfig config = runtime.getConfig();
+        switch (action) {
+            case None:
+                return config.deoptActionNone;
+            case RecompileIfTooManyDeopts:
+                return config.deoptActionMaybeRecompile;
+            case InvalidateReprofile:
+                return config.deoptActionReinterpret;
+            case InvalidateRecompile:
+                return config.deoptActionMakeNotEntrant;
+            case InvalidateStopCompiling:
+                return config.deoptActionMakeNotCompilable;
+            default:
+                throw new JVMCIError("%s", action);
+        }
+    }
+
+    public DeoptimizationAction convertDeoptAction(int action) {
+        HotSpotVMConfig config = runtime.getConfig();
+        if (action == config.deoptActionNone) {
+            return DeoptimizationAction.None;
+        }
+        if (action == config.deoptActionMaybeRecompile) {
+            return DeoptimizationAction.RecompileIfTooManyDeopts;
+        }
+        if (action == config.deoptActionReinterpret) {
+            return DeoptimizationAction.InvalidateReprofile;
+        }
+        if (action == config.deoptActionMakeNotEntrant) {
+            return DeoptimizationAction.InvalidateRecompile;
+        }
+        if (action == config.deoptActionMakeNotCompilable) {
+            return DeoptimizationAction.InvalidateStopCompiling;
+        }
+        throw new JVMCIError("%d", action);
+    }
+
+    public int convertDeoptReason(DeoptimizationReason reason) {
+        HotSpotVMConfig config = runtime.getConfig();
+        switch (reason) {
+            case None:
+                return config.deoptReasonNone;
+            case NullCheckException:
+                return config.deoptReasonNullCheck;
+            case BoundsCheckException:
+                return config.deoptReasonRangeCheck;
+            case ClassCastException:
+                return config.deoptReasonClassCheck;
+            case ArrayStoreException:
+                return config.deoptReasonArrayCheck;
+            case UnreachedCode:
+                return config.deoptReasonUnreached0;
+            case TypeCheckedInliningViolated:
+                return config.deoptReasonTypeCheckInlining;
+            case OptimizedTypeCheckViolated:
+                return config.deoptReasonOptimizedTypeCheck;
+            case NotCompiledExceptionHandler:
+                return config.deoptReasonNotCompiledExceptionHandler;
+            case Unresolved:
+                return config.deoptReasonUnresolved;
+            case JavaSubroutineMismatch:
+                return config.deoptReasonJsrMismatch;
+            case ArithmeticException:
+                return config.deoptReasonDiv0Check;
+            case RuntimeConstraint:
+                return config.deoptReasonConstraint;
+            case LoopLimitCheck:
+                return config.deoptReasonLoopLimitCheck;
+            case Aliasing:
+                return config.deoptReasonAliasing;
+            case TransferToInterpreter:
+                return config.deoptReasonTransferToInterpreter;
+            default:
+                throw new JVMCIError("%s", reason);
+        }
+    }
+
+    public DeoptimizationReason convertDeoptReason(int reason) {
+        HotSpotVMConfig config = runtime.getConfig();
+        if (reason == config.deoptReasonNone) {
+            return DeoptimizationReason.None;
+        }
+        if (reason == config.deoptReasonNullCheck) {
+            return DeoptimizationReason.NullCheckException;
+        }
+        if (reason == config.deoptReasonRangeCheck) {
+            return DeoptimizationReason.BoundsCheckException;
+        }
+        if (reason == config.deoptReasonClassCheck) {
+            return DeoptimizationReason.ClassCastException;
+        }
+        if (reason == config.deoptReasonArrayCheck) {
+            return DeoptimizationReason.ArrayStoreException;
+        }
+        if (reason == config.deoptReasonUnreached0) {
+            return DeoptimizationReason.UnreachedCode;
+        }
+        if (reason == config.deoptReasonTypeCheckInlining) {
+            return DeoptimizationReason.TypeCheckedInliningViolated;
+        }
+        if (reason == config.deoptReasonOptimizedTypeCheck) {
+            return DeoptimizationReason.OptimizedTypeCheckViolated;
+        }
+        if (reason == config.deoptReasonNotCompiledExceptionHandler) {
+            return DeoptimizationReason.NotCompiledExceptionHandler;
+        }
+        if (reason == config.deoptReasonUnresolved) {
+            return DeoptimizationReason.Unresolved;
+        }
+        if (reason == config.deoptReasonJsrMismatch) {
+            return DeoptimizationReason.JavaSubroutineMismatch;
+        }
+        if (reason == config.deoptReasonDiv0Check) {
+            return DeoptimizationReason.ArithmeticException;
+        }
+        if (reason == config.deoptReasonConstraint) {
+            return DeoptimizationReason.RuntimeConstraint;
+        }
+        if (reason == config.deoptReasonLoopLimitCheck) {
+            return DeoptimizationReason.LoopLimitCheck;
+        }
+        if (reason == config.deoptReasonAliasing) {
+            return DeoptimizationReason.Aliasing;
+        }
+        if (reason == config.deoptReasonTransferToInterpreter) {
+            return DeoptimizationReason.TransferToInterpreter;
+        }
+        throw new JVMCIError("%x", reason);
+    }
+
+    @Override
+    public long getMemorySize(JavaConstant constant) {
+        if (constant.getKind() == Kind.Object) {
+            HotSpotResolvedObjectType lookupJavaType = lookupJavaType(constant);
+
+            if (lookupJavaType == null) {
+                return 0;
+            } else {
+                if (lookupJavaType.isArray()) {
+                    // TODO(tw): Add compressed pointer support.
+                    int length = Array.getLength(((HotSpotObjectConstantImpl) constant).object());
+                    ResolvedJavaType elementType = lookupJavaType.getComponentType();
+                    Kind elementKind = elementType.getKind();
+                    final int headerSize = runtime.getArrayBaseOffset(elementKind);
+                    TargetDescription target = runtime.getHostJVMCIBackend().getTarget();
+                    int sizeOfElement = target.getSizeInBytes(elementKind);
+                    int alignment = target.wordSize;
+                    int log2ElementSize = CodeUtil.log2(sizeOfElement);
+                    return computeArrayAllocationSize(length, alignment, headerSize, log2ElementSize);
+                }
+                return lookupJavaType.instanceSize();
+            }
+        } else {
+            return constant.getKind().getByteCount();
+        }
+    }
+
+    /**
+     * Computes the size of the memory chunk allocated for an array. This size accounts for the
+     * array header size, body size and any padding after the last element to satisfy object
+     * alignment requirements.
+     *
+     * @param length the number of elements in the array
+     * @param alignment the object alignment requirement
+     * @param headerSize the size of the array header
+     * @param log2ElementSize log2 of the size of an element in the array
+     */
+    public static int computeArrayAllocationSize(int length, int alignment, int headerSize, int log2ElementSize) {
+        int size = (length << log2ElementSize) + headerSize + (alignment - 1);
+        int mask = ~(alignment - 1);
+        return size & mask;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotMetaspaceConstant.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2014, 2015, 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.jvmci.hotspot;
+
+import com.oracle.jvmci.hotspot.HotSpotVMConfig.CompressEncoding;
+import com.oracle.jvmci.meta.*;
+
+public interface HotSpotMetaspaceConstant extends HotSpotConstant, VMConstant {
+
+    Constant compress(CompressEncoding encoding);
+
+    Constant uncompress(CompressEncoding encoding);
+
+    HotSpotResolvedObjectType asResolvedJavaType();
+
+    long rawValue();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotMetaspaceConstantImpl.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.hotspot;
+
+import java.util.*;
+
+import com.oracle.jvmci.hotspot.HotSpotVMConfig.CompressEncoding;
+import com.oracle.jvmci.meta.*;
+
+public final class HotSpotMetaspaceConstantImpl extends PrimitiveConstant implements HotSpotMetaspaceConstant, VMConstant, HotSpotProxified {
+
+    static HotSpotMetaspaceConstantImpl forMetaspaceObject(Kind kind, long primitive, Object metaspaceObject, boolean compressed) {
+        return new HotSpotMetaspaceConstantImpl(kind, primitive, metaspaceObject, compressed);
+    }
+
+    static Object getMetaspaceObject(Constant constant) {
+        return ((HotSpotMetaspaceConstantImpl) constant).metaspaceObject;
+    }
+
+    private final Object metaspaceObject;
+    private final boolean compressed;
+
+    private HotSpotMetaspaceConstantImpl(Kind kind, long primitive, Object metaspaceObject, boolean compressed) {
+        super(kind, primitive);
+        this.metaspaceObject = metaspaceObject;
+        this.compressed = compressed;
+    }
+
+    @Override
+    public int hashCode() {
+        return super.hashCode() ^ System.identityHashCode(metaspaceObject);
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        return o == this || (o instanceof HotSpotMetaspaceConstantImpl && super.equals(o) && Objects.equals(metaspaceObject, ((HotSpotMetaspaceConstantImpl) o).metaspaceObject));
+    }
+
+    @Override
+    public String toString() {
+        return super.toString() + "{" + metaspaceObject + (compressed ? ";compressed}" : "}");
+    }
+
+    public boolean isCompressed() {
+        return compressed;
+    }
+
+    public JavaConstant compress(CompressEncoding encoding) {
+        assert !isCompressed();
+        HotSpotMetaspaceConstantImpl res = HotSpotMetaspaceConstantImpl.forMetaspaceObject(Kind.Int, encoding.compress(asLong()), metaspaceObject, true);
+        assert res.isCompressed();
+        return res;
+    }
+
+    public JavaConstant uncompress(CompressEncoding encoding) {
+        assert isCompressed();
+        HotSpotMetaspaceConstantImpl res = HotSpotMetaspaceConstantImpl.forMetaspaceObject(Kind.Long, encoding.uncompress(asInt()), metaspaceObject, false);
+        assert !res.isCompressed();
+        return res;
+    }
+
+    public HotSpotResolvedObjectType asResolvedJavaType() {
+        if (metaspaceObject instanceof HotSpotResolvedObjectType) {
+            return (HotSpotResolvedObjectType) metaspaceObject;
+        }
+        return null;
+    }
+
+    public long rawValue() {
+        return asLong();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotMethod.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,63 @@
+/*
+ * 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.jvmci.hotspot;
+
+import static com.oracle.jvmci.debug.Debug.*;
+import static java.util.FormattableFlags.*;
+
+import java.util.*;
+
+import com.oracle.jvmci.meta.*;
+
+public abstract class HotSpotMethod implements JavaMethod, Formattable {
+
+    protected String name;
+
+    /**
+     * Controls whether {@link #toString()} includes the qualified or simple name of the class in
+     * which the method is declared.
+     */
+    public static final boolean FULLY_QUALIFIED_METHOD_NAME = false;
+
+    protected HotSpotMethod(String name) {
+        this.name = name;
+    }
+
+    @Override
+    public final String getName() {
+        return name;
+    }
+
+    @Override
+    public final String toString() {
+        char h = FULLY_QUALIFIED_METHOD_NAME ? 'H' : 'h';
+        String suffix = this instanceof ResolvedJavaMethod ? "" : ", unresolved";
+        String fmt = String.format("HotSpotMethod<%%%c.%%n(%%p)%s>", h, suffix);
+        return format(fmt);
+    }
+
+    public void formatTo(Formatter formatter, int flags, int width, int precision) {
+        String base = (flags & ALTERNATE) == ALTERNATE ? getName() : toString();
+        formatter.format(applyFormattingFlagsAndWidth(base, flags & ~ALTERNATE, width));
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotMethodData.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,858 @@
+/*
+ * 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.jvmci.hotspot;
+
+import static com.oracle.jvmci.common.UnsafeAccess.*;
+import static com.oracle.jvmci.hotspot.HotSpotJVMCIRuntime.*;
+import static java.lang.String.*;
+
+import java.util.*;
+
+import sun.misc.*;
+
+import com.oracle.jvmci.hotspot.HotSpotMethodDataAccessor.Tag;
+import com.oracle.jvmci.meta.*;
+import com.oracle.jvmci.meta.JavaMethodProfile.ProfiledMethod;
+import com.oracle.jvmci.meta.JavaTypeProfile.ProfiledType;
+
+/**
+ * Access to a HotSpot MethodData structure (defined in methodData.hpp).
+ */
+public final class HotSpotMethodData {
+
+    private static final HotSpotVMConfig config = runtime().getConfig();
+    private static final HotSpotMethodDataAccessor NO_DATA_NO_EXCEPTION_ACCESSOR = new NoMethodData(TriState.FALSE);
+    private static final HotSpotMethodDataAccessor NO_DATA_EXCEPTION_POSSIBLY_NOT_RECORDED_ACCESSOR = new NoMethodData(TriState.UNKNOWN);
+
+    // sorted by tag
+    // @formatter:off
+    private static final HotSpotMethodDataAccessor[] PROFILE_DATA_ACCESSORS = {
+        null,
+        new BitData(),
+        new CounterData(),
+        new JumpData(),
+        new TypeCheckData(),
+        new VirtualCallData(),
+        new RetData(),
+        new BranchData(),
+        new MultiBranchData(),
+        new ArgInfoData(),
+        null, // call_type_data_tag
+        null, // virtual_call_type_data_tag
+        null, // parameters_type_data_tag
+        null, // speculative_trap_data_tag
+    };
+    // @formatter:on
+
+    /**
+     * Reference to the C++ MethodData object.
+     */
+    private final long metaspaceMethodData;
+
+    public HotSpotMethodData(long metaspaceMethodData) {
+        this.metaspaceMethodData = metaspaceMethodData;
+    }
+
+    /**
+     * @return value of the MethodData::_data_size field
+     */
+    private int normalDataSize() {
+        return unsafe.getInt(metaspaceMethodData + config.methodDataDataSize);
+    }
+
+    /**
+     * Returns the size of the extra data records. This method does the same calculation as
+     * MethodData::extra_data_size().
+     *
+     * @return size of extra data records
+     */
+    private int extraDataSize() {
+        final int extraDataBase = config.methodDataOopDataOffset + normalDataSize();
+        final int extraDataLimit = unsafe.getInt(metaspaceMethodData + config.methodDataSize);
+        return extraDataLimit - extraDataBase;
+    }
+
+    public boolean hasNormalData() {
+        return normalDataSize() > 0;
+    }
+
+    public boolean hasExtraData() {
+        return extraDataSize() > 0;
+    }
+
+    public int getExtraDataBeginOffset() {
+        return normalDataSize();
+    }
+
+    public boolean isWithin(int position) {
+        return position >= 0 && position < normalDataSize() + extraDataSize();
+    }
+
+    public int getDeoptimizationCount(DeoptimizationReason reason) {
+        HotSpotMetaAccessProvider metaAccess = (HotSpotMetaAccessProvider) runtime().getHostJVMCIBackend().getMetaAccess();
+        int reasonIndex = metaAccess.convertDeoptReason(reason);
+        return unsafe.getByte(metaspaceMethodData + config.methodDataOopTrapHistoryOffset + reasonIndex) & 0xFF;
+    }
+
+    public int getOSRDeoptimizationCount(DeoptimizationReason reason) {
+        HotSpotMetaAccessProvider metaAccess = (HotSpotMetaAccessProvider) runtime().getHostJVMCIBackend().getMetaAccess();
+        int reasonIndex = metaAccess.convertDeoptReason(reason);
+        return unsafe.getByte(metaspaceMethodData + config.methodDataOopTrapHistoryOffset + config.deoptReasonOSROffset + reasonIndex) & 0xFF;
+    }
+
+    public HotSpotMethodDataAccessor getNormalData(int position) {
+        if (position >= normalDataSize()) {
+            return null;
+        }
+
+        HotSpotMethodDataAccessor result = getData(position);
+        assert result != null : "NO_DATA tag is not allowed";
+        return result;
+    }
+
+    public HotSpotMethodDataAccessor getExtraData(int position) {
+        if (position >= normalDataSize() + extraDataSize()) {
+            return null;
+        }
+        HotSpotMethodDataAccessor data = getData(position);
+        if (data != null) {
+            return data;
+        }
+        return data;
+    }
+
+    public static HotSpotMethodDataAccessor getNoDataAccessor(boolean exceptionPossiblyNotRecorded) {
+        if (exceptionPossiblyNotRecorded) {
+            return NO_DATA_EXCEPTION_POSSIBLY_NOT_RECORDED_ACCESSOR;
+        } else {
+            return NO_DATA_NO_EXCEPTION_ACCESSOR;
+        }
+    }
+
+    private HotSpotMethodDataAccessor getData(int position) {
+        assert position >= 0 : "out of bounds";
+        final Tag tag = AbstractMethodData.readTag(this, position);
+        HotSpotMethodDataAccessor accessor = PROFILE_DATA_ACCESSORS[tag.getValue()];
+        assert accessor == null || accessor.getTag() == tag : "wrong data accessor " + accessor + " for tag " + tag;
+        return accessor;
+    }
+
+    private int readUnsignedByte(int position, int offsetInBytes) {
+        long fullOffsetInBytes = computeFullOffset(position, offsetInBytes);
+        return unsafe.getByte(metaspaceMethodData + fullOffsetInBytes) & 0xFF;
+    }
+
+    private int readUnsignedShort(int position, int offsetInBytes) {
+        long fullOffsetInBytes = computeFullOffset(position, offsetInBytes);
+        return unsafe.getShort(metaspaceMethodData + fullOffsetInBytes) & 0xFFFF;
+    }
+
+    /**
+     * Since the values are stored in cells (platform words) this method uses
+     * {@link Unsafe#getAddress} to read the right value on both little and big endian machines.
+     */
+    private long readUnsignedInt(int position, int offsetInBytes) {
+        long fullOffsetInBytes = computeFullOffset(position, offsetInBytes);
+        return unsafe.getAddress(metaspaceMethodData + fullOffsetInBytes) & 0xFFFFFFFFL;
+    }
+
+    private int readUnsignedIntAsSignedInt(int position, int offsetInBytes) {
+        long value = readUnsignedInt(position, offsetInBytes);
+        return truncateLongToInt(value);
+    }
+
+    /**
+     * Since the values are stored in cells (platform words) this method uses
+     * {@link Unsafe#getAddress} to read the right value on both little and big endian machines.
+     */
+    private int readInt(int position, int offsetInBytes) {
+        long fullOffsetInBytes = computeFullOffset(position, offsetInBytes);
+        return (int) unsafe.getAddress(metaspaceMethodData + fullOffsetInBytes);
+    }
+
+    private long readWord(int position, int offsetInBytes) {
+        long fullOffsetInBytes = computeFullOffset(position, offsetInBytes);
+        return unsafe.getAddress(metaspaceMethodData + fullOffsetInBytes);
+    }
+
+    private static int truncateLongToInt(long value) {
+        return value > Integer.MAX_VALUE ? Integer.MAX_VALUE : (int) value;
+    }
+
+    private static int computeFullOffset(int position, int offsetInBytes) {
+        return config.methodDataOopDataOffset + position + offsetInBytes;
+    }
+
+    private static int cellIndexToOffset(int cells) {
+        return config.dataLayoutHeaderSize + cellsToBytes(cells);
+    }
+
+    private static int cellsToBytes(int cells) {
+        return cells * config.dataLayoutCellSize;
+    }
+
+    /**
+     * Returns whether profiling ran long enough that the profile information is mature. Other
+     * informational data will still be valid even if the profile isn't mature.
+     */
+    public boolean isProfileMature() {
+        return runtime().getCompilerToVM().isMature(metaspaceMethodData);
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        String nl = String.format("%n");
+        String nlIndent = String.format("%n%38s", "");
+        if (hasNormalData()) {
+            int pos = 0;
+            HotSpotMethodDataAccessor data;
+            while ((data = getNormalData(pos)) != null) {
+                if (pos != 0) {
+                    sb.append(nl);
+                }
+                int bci = data.getBCI(this, pos);
+                sb.append(String.format("%-6d bci: %-6d%-20s", pos, bci, data.getClass().getSimpleName()));
+                sb.append(data.appendTo(new StringBuilder(), this, pos).toString().replace(nl, nlIndent));
+                pos = pos + data.getSize(this, pos);
+            }
+        }
+
+        if (hasExtraData()) {
+            int pos = getExtraDataBeginOffset();
+            HotSpotMethodDataAccessor data;
+            while ((data = getExtraData(pos)) != null) {
+                if (pos == getExtraDataBeginOffset()) {
+                    sb.append(nl).append("--- Extra data:");
+                }
+                int bci = data.getBCI(this, pos);
+                sb.append(String.format("%n%-6d bci: %-6d%-20s", pos, bci, data.getClass().getSimpleName()));
+                sb.append(data.appendTo(new StringBuilder(), this, pos).toString().replace(nl, nlIndent));
+                pos = pos + data.getSize(this, pos);
+            }
+
+        }
+        return sb.toString();
+    }
+
+    private abstract static class AbstractMethodData implements HotSpotMethodDataAccessor {
+
+        /**
+         * Corresponds to {@code exception_seen_flag}.
+         */
+        private static final int EXCEPTIONS_MASK = 0x2;
+
+        private final Tag tag;
+        private final int staticSize;
+
+        protected AbstractMethodData(Tag tag, int staticSize) {
+            this.tag = tag;
+            this.staticSize = staticSize;
+        }
+
+        public Tag getTag() {
+            return tag;
+        }
+
+        public static Tag readTag(HotSpotMethodData data, int position) {
+            final int tag = data.readUnsignedByte(position, config.dataLayoutTagOffset);
+            return Tag.getEnum(tag);
+        }
+
+        @Override
+        public int getBCI(HotSpotMethodData data, int position) {
+            return data.readUnsignedShort(position, config.dataLayoutBCIOffset);
+        }
+
+        @Override
+        public int getSize(HotSpotMethodData data, int position) {
+            return staticSize + getDynamicSize(data, position);
+        }
+
+        @Override
+        public TriState getExceptionSeen(HotSpotMethodData data, int position) {
+            return TriState.get((getFlags(data, position) & EXCEPTIONS_MASK) != 0);
+        }
+
+        @Override
+        public JavaTypeProfile getTypeProfile(HotSpotMethodData data, int position) {
+            return null;
+        }
+
+        @Override
+        public JavaMethodProfile getMethodProfile(HotSpotMethodData data, int position) {
+            return null;
+        }
+
+        @Override
+        public double getBranchTakenProbability(HotSpotMethodData data, int position) {
+            return -1;
+        }
+
+        @Override
+        public double[] getSwitchProbabilities(HotSpotMethodData data, int position) {
+            return null;
+        }
+
+        @Override
+        public int getExecutionCount(HotSpotMethodData data, int position) {
+            return -1;
+        }
+
+        @Override
+        public TriState getNullSeen(HotSpotMethodData data, int position) {
+            return TriState.UNKNOWN;
+        }
+
+        protected int getFlags(HotSpotMethodData data, int position) {
+            return data.readUnsignedByte(position, config.dataLayoutFlagsOffset);
+        }
+
+        /**
+         * @param data
+         * @param position
+         */
+        protected int getDynamicSize(HotSpotMethodData data, int position) {
+            return 0;
+        }
+
+        public abstract StringBuilder appendTo(StringBuilder sb, HotSpotMethodData data, int pos);
+    }
+
+    private static class NoMethodData extends AbstractMethodData {
+
+        private static final int NO_DATA_SIZE = cellIndexToOffset(0);
+
+        private final TriState exceptionSeen;
+
+        protected NoMethodData(TriState exceptionSeen) {
+            super(Tag.No, NO_DATA_SIZE);
+            this.exceptionSeen = exceptionSeen;
+        }
+
+        @Override
+        public int getBCI(HotSpotMethodData data, int position) {
+            return -1;
+        }
+
+        @Override
+        public TriState getExceptionSeen(HotSpotMethodData data, int position) {
+            return exceptionSeen;
+        }
+
+        @Override
+        public StringBuilder appendTo(StringBuilder sb, HotSpotMethodData data, int pos) {
+            return sb;
+        }
+    }
+
+    private static class BitData extends AbstractMethodData {
+
+        private static final int BIT_DATA_SIZE = cellIndexToOffset(0);
+        private static final int BIT_DATA_NULL_SEEN_FLAG = 0x01;
+
+        private BitData() {
+            super(Tag.BitData, BIT_DATA_SIZE);
+        }
+
+        protected BitData(Tag tag, int staticSize) {
+            super(tag, staticSize);
+        }
+
+        @Override
+        public TriState getNullSeen(HotSpotMethodData data, int position) {
+            return TriState.get((getFlags(data, position) & BIT_DATA_NULL_SEEN_FLAG) != 0);
+        }
+
+        @Override
+        public StringBuilder appendTo(StringBuilder sb, HotSpotMethodData data, int pos) {
+            return sb.append(format("exception_seen(%s)", getExceptionSeen(data, pos)));
+        }
+    }
+
+    private static class CounterData extends BitData {
+
+        private static final int COUNTER_DATA_SIZE = cellIndexToOffset(1);
+        private static final int COUNTER_DATA_COUNT_OFFSET = cellIndexToOffset(0);
+
+        public CounterData() {
+            super(Tag.CounterData, COUNTER_DATA_SIZE);
+        }
+
+        protected CounterData(Tag tag, int staticSize) {
+            super(tag, staticSize);
+        }
+
+        @Override
+        public int getExecutionCount(HotSpotMethodData data, int position) {
+            return getCounterValue(data, position);
+        }
+
+        protected int getCounterValue(HotSpotMethodData data, int position) {
+            return data.readUnsignedIntAsSignedInt(position, COUNTER_DATA_COUNT_OFFSET);
+        }
+
+        @Override
+        public StringBuilder appendTo(StringBuilder sb, HotSpotMethodData data, int pos) {
+            return sb.append(format("count(%d) null_seen(%s) exception_seen(%s)", getCounterValue(data, pos), getNullSeen(data, pos), getExceptionSeen(data, pos)));
+        }
+    }
+
+    private static class JumpData extends AbstractMethodData {
+
+        private static final int JUMP_DATA_SIZE = cellIndexToOffset(2);
+        protected static final int TAKEN_COUNT_OFFSET = cellIndexToOffset(0);
+        protected static final int TAKEN_DISPLACEMENT_OFFSET = cellIndexToOffset(1);
+
+        public JumpData() {
+            super(Tag.JumpData, JUMP_DATA_SIZE);
+        }
+
+        protected JumpData(Tag tag, int staticSize) {
+            super(tag, staticSize);
+        }
+
+        @Override
+        public double getBranchTakenProbability(HotSpotMethodData data, int position) {
+            return getExecutionCount(data, position) != 0 ? 1 : 0;
+        }
+
+        @Override
+        public int getExecutionCount(HotSpotMethodData data, int position) {
+            return data.readUnsignedIntAsSignedInt(position, TAKEN_COUNT_OFFSET);
+        }
+
+        public int getTakenDisplacement(HotSpotMethodData data, int position) {
+            return data.readInt(position, TAKEN_DISPLACEMENT_OFFSET);
+        }
+
+        @Override
+        public StringBuilder appendTo(StringBuilder sb, HotSpotMethodData data, int pos) {
+            return sb.append(format("taken(%d) displacement(%d)", getExecutionCount(data, pos), getTakenDisplacement(data, pos)));
+        }
+    }
+
+    static class RawItemProfile<T> {
+        final int entries;
+        final T[] items;
+        final long[] counts;
+        final long totalCount;
+
+        public RawItemProfile(int entries, T[] items, long[] counts, long totalCount) {
+            this.entries = entries;
+            this.items = items;
+            this.counts = counts;
+            this.totalCount = totalCount;
+        }
+    }
+
+    private abstract static class AbstractTypeData extends CounterData {
+
+        protected static final int TYPE_DATA_ROW_SIZE = cellsToBytes(2);
+
+        protected static final int NONPROFILED_COUNT_OFFSET = cellIndexToOffset(1);
+        protected static final int TYPE_DATA_FIRST_TYPE_OFFSET = cellIndexToOffset(2);
+        protected static final int TYPE_DATA_FIRST_TYPE_COUNT_OFFSET = cellIndexToOffset(3);
+
+        protected AbstractTypeData(Tag tag, int staticSize) {
+            super(tag, staticSize);
+        }
+
+        @Override
+        public JavaTypeProfile getTypeProfile(HotSpotMethodData data, int position) {
+            return createTypeProfile(getNullSeen(data, position), getRawTypeProfile(data, position));
+        }
+
+        private RawItemProfile<ResolvedJavaType> getRawTypeProfile(HotSpotMethodData data, int position) {
+            int typeProfileWidth = config.typeProfileWidth;
+
+            ResolvedJavaType[] types = new ResolvedJavaType[typeProfileWidth];
+            long[] counts = new long[typeProfileWidth];
+            long totalCount = 0;
+            int entries = 0;
+
+            outer: for (int i = 0; i < typeProfileWidth; i++) {
+                long receiverKlass = data.readWord(position, getTypeOffset(i));
+                if (receiverKlass != 0) {
+                    HotSpotResolvedObjectTypeImpl klass = HotSpotResolvedObjectTypeImpl.fromMetaspaceKlass(receiverKlass);
+                    long count = data.readUnsignedInt(position, getTypeCountOffset(i));
+                    /*
+                     * Because of races in the profile collection machinery it's possible for a
+                     * class to appear multiple times so merge them to make the profile look
+                     * rational.
+                     */
+                    for (int j = 0; j < entries; j++) {
+                        if (types[j].equals(klass)) {
+                            totalCount += count;
+                            counts[j] += count;
+                            continue outer;
+                        }
+                    }
+                    types[entries] = klass;
+                    totalCount += count;
+                    counts[entries] = count;
+                    entries++;
+                }
+            }
+
+            totalCount += getTypesNotRecordedExecutionCount(data, position);
+            return new RawItemProfile<>(entries, types, counts, totalCount);
+        }
+
+        protected abstract long getTypesNotRecordedExecutionCount(HotSpotMethodData data, int position);
+
+        private static JavaTypeProfile createTypeProfile(TriState nullSeen, RawItemProfile<ResolvedJavaType> profile) {
+            if (profile.entries <= 0 || profile.totalCount <= 0) {
+                return null;
+            }
+
+            ProfiledType[] ptypes = new ProfiledType[profile.entries];
+            double totalProbability = 0.0;
+            for (int i = 0; i < profile.entries; i++) {
+                double p = profile.counts[i];
+                p = p / profile.totalCount;
+                totalProbability += p;
+                ptypes[i] = new ProfiledType(profile.items[i], p);
+            }
+
+            Arrays.sort(ptypes);
+
+            double notRecordedTypeProbability = profile.entries < config.typeProfileWidth ? 0.0 : Math.min(1.0, Math.max(0.0, 1.0 - totalProbability));
+            assert notRecordedTypeProbability == 0 || profile.entries == config.typeProfileWidth;
+            return new JavaTypeProfile(nullSeen, notRecordedTypeProbability, ptypes);
+        }
+
+        private static int getTypeOffset(int row) {
+            return TYPE_DATA_FIRST_TYPE_OFFSET + row * TYPE_DATA_ROW_SIZE;
+        }
+
+        protected static int getTypeCountOffset(int row) {
+            return TYPE_DATA_FIRST_TYPE_COUNT_OFFSET + row * TYPE_DATA_ROW_SIZE;
+        }
+
+        @Override
+        public StringBuilder appendTo(StringBuilder sb, HotSpotMethodData data, int pos) {
+            RawItemProfile<ResolvedJavaType> profile = getRawTypeProfile(data, pos);
+            TriState nullSeen = getNullSeen(data, pos);
+            TriState exceptionSeen = getExceptionSeen(data, pos);
+            sb.append(format("count(%d) null_seen(%s) exception_seen(%s) nonprofiled_count(%d) entries(%d)", getCounterValue(data, pos), nullSeen, exceptionSeen,
+                            getTypesNotRecordedExecutionCount(data, pos), profile.entries));
+            for (int i = 0; i < profile.entries; i++) {
+                long count = profile.counts[i];
+                sb.append(format("%n  %s (%d, %4.2f)", profile.items[i].toJavaName(), count, (double) count / profile.totalCount));
+            }
+            return sb;
+        }
+    }
+
+    private static class TypeCheckData extends AbstractTypeData {
+
+        private static final int TYPE_CHECK_DATA_SIZE = cellIndexToOffset(2) + TYPE_DATA_ROW_SIZE * config.typeProfileWidth;
+
+        public TypeCheckData() {
+            super(Tag.ReceiverTypeData, TYPE_CHECK_DATA_SIZE);
+        }
+
+        @Override
+        public int getExecutionCount(HotSpotMethodData data, int position) {
+            return -1;
+        }
+
+        @Override
+        protected long getTypesNotRecordedExecutionCount(HotSpotMethodData data, int position) {
+            return data.readUnsignedIntAsSignedInt(position, NONPROFILED_COUNT_OFFSET);
+        }
+    }
+
+    private static class VirtualCallData extends AbstractTypeData {
+
+        private static final int VIRTUAL_CALL_DATA_SIZE = cellIndexToOffset(2) + TYPE_DATA_ROW_SIZE * (config.typeProfileWidth + config.methodProfileWidth);
+        private static final int VIRTUAL_CALL_DATA_FIRST_METHOD_OFFSET = TYPE_DATA_FIRST_TYPE_OFFSET + TYPE_DATA_ROW_SIZE * config.typeProfileWidth;
+        private static final int VIRTUAL_CALL_DATA_FIRST_METHOD_COUNT_OFFSET = TYPE_DATA_FIRST_TYPE_COUNT_OFFSET + TYPE_DATA_ROW_SIZE * config.typeProfileWidth;
+
+        public VirtualCallData() {
+            super(Tag.VirtualCallData, VIRTUAL_CALL_DATA_SIZE);
+        }
+
+        @Override
+        public int getExecutionCount(HotSpotMethodData data, int position) {
+            final int typeProfileWidth = config.typeProfileWidth;
+
+            long total = 0;
+            for (int i = 0; i < typeProfileWidth; i++) {
+                total += data.readUnsignedInt(position, getTypeCountOffset(i));
+            }
+
+            total += getCounterValue(data, position);
+            return truncateLongToInt(total);
+        }
+
+        @Override
+        protected long getTypesNotRecordedExecutionCount(HotSpotMethodData data, int position) {
+            return getCounterValue(data, position);
+        }
+
+        private static long getMethodsNotRecordedExecutionCount(HotSpotMethodData data, int position) {
+            return data.readUnsignedIntAsSignedInt(position, NONPROFILED_COUNT_OFFSET);
+        }
+
+        @Override
+        public JavaMethodProfile getMethodProfile(HotSpotMethodData data, int position) {
+            return createMethodProfile(getRawMethodProfile(data, position));
+        }
+
+        private static RawItemProfile<ResolvedJavaMethod> getRawMethodProfile(HotSpotMethodData data, int position) {
+            int profileWidth = config.methodProfileWidth;
+
+            ResolvedJavaMethod[] methods = new ResolvedJavaMethod[profileWidth];
+            long[] counts = new long[profileWidth];
+            long totalCount = 0;
+            int entries = 0;
+
+            for (int i = 0; i < profileWidth; i++) {
+                long method = data.readWord(position, getMethodOffset(i));
+                if (method != 0) {
+                    methods[entries] = HotSpotResolvedJavaMethodImpl.fromMetaspace(method);
+                    long count = data.readUnsignedInt(position, getMethodCountOffset(i));
+                    totalCount += count;
+                    counts[entries] = count;
+
+                    entries++;
+                }
+            }
+
+            totalCount += getMethodsNotRecordedExecutionCount(data, position);
+            return new RawItemProfile<>(entries, methods, counts, totalCount);
+        }
+
+        private static JavaMethodProfile createMethodProfile(RawItemProfile<ResolvedJavaMethod> profile) {
+            if (profile.entries <= 0 || profile.totalCount <= 0) {
+                return null;
+            }
+
+            ProfiledMethod[] pmethods = new ProfiledMethod[profile.entries];
+            double totalProbability = 0.0;
+            for (int i = 0; i < profile.entries; i++) {
+                double p = profile.counts[i];
+                p = p / profile.totalCount;
+                totalProbability += p;
+                pmethods[i] = new ProfiledMethod(profile.items[i], p);
+            }
+
+            Arrays.sort(pmethods);
+
+            double notRecordedMethodProbability = profile.entries < config.methodProfileWidth ? 0.0 : Math.min(1.0, Math.max(0.0, 1.0 - totalProbability));
+            assert notRecordedMethodProbability == 0 || profile.entries == config.methodProfileWidth;
+            return new JavaMethodProfile(notRecordedMethodProbability, pmethods);
+        }
+
+        private static int getMethodOffset(int row) {
+            return VIRTUAL_CALL_DATA_FIRST_METHOD_OFFSET + row * TYPE_DATA_ROW_SIZE;
+        }
+
+        private static int getMethodCountOffset(int row) {
+            return VIRTUAL_CALL_DATA_FIRST_METHOD_COUNT_OFFSET + row * TYPE_DATA_ROW_SIZE;
+        }
+
+        @Override
+        public StringBuilder appendTo(StringBuilder sb, HotSpotMethodData data, int pos) {
+            RawItemProfile<ResolvedJavaMethod> profile = getRawMethodProfile(data, pos);
+            super.appendTo(sb.append(format("exception_seen(%s) ", getExceptionSeen(data, pos))), data, pos).append(format("%nmethod_entries(%d)", profile.entries));
+            for (int i = 0; i < profile.entries; i++) {
+                long count = profile.counts[i];
+                sb.append(format("%n  %s (%d, %4.2f)", profile.items[i].format("%H.%n(%p)"), count, (double) count / profile.totalCount));
+            }
+            return sb;
+        }
+    }
+
+    private static class RetData extends CounterData {
+
+        private static final int RET_DATA_ROW_SIZE = cellsToBytes(3);
+        private static final int RET_DATA_SIZE = cellIndexToOffset(1) + RET_DATA_ROW_SIZE * config.bciProfileWidth;
+
+        public RetData() {
+            super(Tag.RetData, RET_DATA_SIZE);
+        }
+    }
+
+    private static class BranchData extends JumpData {
+
+        private static final int BRANCH_DATA_SIZE = cellIndexToOffset(3);
+        private static final int NOT_TAKEN_COUNT_OFFSET = cellIndexToOffset(2);
+
+        public BranchData() {
+            super(Tag.BranchData, BRANCH_DATA_SIZE);
+        }
+
+        @Override
+        public double getBranchTakenProbability(HotSpotMethodData data, int position) {
+            long takenCount = data.readUnsignedInt(position, TAKEN_COUNT_OFFSET);
+            long notTakenCount = data.readUnsignedInt(position, NOT_TAKEN_COUNT_OFFSET);
+            long total = takenCount + notTakenCount;
+
+            return total <= 0 ? -1 : takenCount / (double) total;
+        }
+
+        @Override
+        public int getExecutionCount(HotSpotMethodData data, int position) {
+            long count = data.readUnsignedInt(position, TAKEN_COUNT_OFFSET) + data.readUnsignedInt(position, NOT_TAKEN_COUNT_OFFSET);
+            return truncateLongToInt(count);
+        }
+
+        @Override
+        public StringBuilder appendTo(StringBuilder sb, HotSpotMethodData data, int pos) {
+            long taken = data.readUnsignedInt(pos, TAKEN_COUNT_OFFSET);
+            long notTaken = data.readUnsignedInt(pos, NOT_TAKEN_COUNT_OFFSET);
+            double takenProbability = getBranchTakenProbability(data, pos);
+            return sb.append(format("taken(%d, %4.2f) not_taken(%d, %4.2f) displacement(%d)", taken, takenProbability, notTaken, 1.0D - takenProbability, getTakenDisplacement(data, pos)));
+        }
+    }
+
+    private static class ArrayData extends AbstractMethodData {
+
+        private static final int ARRAY_DATA_LENGTH_OFFSET = cellIndexToOffset(0);
+        protected static final int ARRAY_DATA_START_OFFSET = cellIndexToOffset(1);
+
+        public ArrayData(Tag tag, int staticSize) {
+            super(tag, staticSize);
+        }
+
+        @Override
+        protected int getDynamicSize(HotSpotMethodData data, int position) {
+            return cellsToBytes(getLength(data, position));
+        }
+
+        protected static int getLength(HotSpotMethodData data, int position) {
+            return data.readInt(position, ARRAY_DATA_LENGTH_OFFSET);
+        }
+
+        @Override
+        public StringBuilder appendTo(StringBuilder sb, HotSpotMethodData data, int pos) {
+            return sb.append(format("length(%d)", getLength(data, pos)));
+        }
+    }
+
+    private static class MultiBranchData extends ArrayData {
+
+        private static final int MULTI_BRANCH_DATA_SIZE = cellIndexToOffset(1);
+        private static final int MULTI_BRANCH_DATA_ROW_SIZE_IN_CELLS = 2;
+        private static final int MULTI_BRANCH_DATA_ROW_SIZE = cellsToBytes(MULTI_BRANCH_DATA_ROW_SIZE_IN_CELLS);
+        private static final int MULTI_BRANCH_DATA_FIRST_COUNT_OFFSET = ARRAY_DATA_START_OFFSET + cellsToBytes(0);
+        private static final int MULTI_BRANCH_DATA_FIRST_DISPLACEMENT_OFFSET = ARRAY_DATA_START_OFFSET + cellsToBytes(1);
+
+        public MultiBranchData() {
+            super(Tag.MultiBranchData, MULTI_BRANCH_DATA_SIZE);
+        }
+
+        @Override
+        public double[] getSwitchProbabilities(HotSpotMethodData data, int position) {
+            int arrayLength = getLength(data, position);
+            assert arrayLength > 0 : "switch must have at least the default case";
+            assert arrayLength % MULTI_BRANCH_DATA_ROW_SIZE_IN_CELLS == 0 : "array must have full rows";
+
+            int length = arrayLength / MULTI_BRANCH_DATA_ROW_SIZE_IN_CELLS;
+            long totalCount = 0;
+            double[] result = new double[length];
+
+            // default case is first in HotSpot but last for the compiler
+            long count = readCount(data, position, 0);
+            totalCount += count;
+            result[length - 1] = count;
+
+            for (int i = 1; i < length; i++) {
+                count = readCount(data, position, i);
+                totalCount += count;
+                result[i - 1] = count;
+            }
+
+            if (totalCount <= 0) {
+                return null;
+            } else {
+                for (int i = 0; i < length; i++) {
+                    result[i] = result[i] / totalCount;
+                }
+                return result;
+            }
+        }
+
+        private static long readCount(HotSpotMethodData data, int position, int i) {
+            int offset;
+            long count;
+            offset = getCountOffset(i);
+            count = data.readUnsignedInt(position, offset);
+            return count;
+        }
+
+        @Override
+        public int getExecutionCount(HotSpotMethodData data, int position) {
+            int arrayLength = getLength(data, position);
+            assert arrayLength > 0 : "switch must have at least the default case";
+            assert arrayLength % MULTI_BRANCH_DATA_ROW_SIZE_IN_CELLS == 0 : "array must have full rows";
+
+            int length = arrayLength / MULTI_BRANCH_DATA_ROW_SIZE_IN_CELLS;
+            long totalCount = 0;
+            for (int i = 0; i < length; i++) {
+                int offset = getCountOffset(i);
+                totalCount += data.readUnsignedInt(position, offset);
+            }
+
+            return truncateLongToInt(totalCount);
+        }
+
+        private static int getCountOffset(int index) {
+            return MULTI_BRANCH_DATA_FIRST_COUNT_OFFSET + index * MULTI_BRANCH_DATA_ROW_SIZE;
+        }
+
+        private static int getDisplacementOffset(int index) {
+            return MULTI_BRANCH_DATA_FIRST_DISPLACEMENT_OFFSET + index * MULTI_BRANCH_DATA_ROW_SIZE;
+        }
+
+        @Override
+        public StringBuilder appendTo(StringBuilder sb, HotSpotMethodData data, int pos) {
+            int entries = getLength(data, pos) / MULTI_BRANCH_DATA_ROW_SIZE_IN_CELLS;
+            sb.append(format("entries(%d)", entries));
+            for (int i = 0; i < entries; i++) {
+                sb.append(format("%n  %d: count(%d) displacement(%d)", i, data.readUnsignedInt(pos, getCountOffset(i)), data.readUnsignedInt(pos, getDisplacementOffset(i))));
+            }
+            return sb;
+        }
+    }
+
+    private static class ArgInfoData extends ArrayData {
+
+        private static final int ARG_INFO_DATA_SIZE = cellIndexToOffset(1);
+
+        public ArgInfoData() {
+            super(Tag.ArgInfoData, ARG_INFO_DATA_SIZE);
+        }
+    }
+
+    public void setCompiledIRSize(int size) {
+        unsafe.putInt(metaspaceMethodData + config.methodDataIRSizeOffset, size);
+    }
+
+    public int getCompiledIRSize() {
+        return unsafe.getInt(metaspaceMethodData + config.methodDataIRSizeOffset);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotMethodDataAccessor.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,112 @@
+/*
+ * 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.jvmci.hotspot;
+
+import static com.oracle.jvmci.hotspot.HotSpotJVMCIRuntime.*;
+
+import com.oracle.jvmci.meta.*;
+
+/**
+ * Interface for accessor objects that encapsulate the logic for accessing the different kinds of
+ * data in a HotSpot methodDataOop. This interface is similar to the interface {@link ProfilingInfo}
+ * , but most methods require a MethodDataObject and the exact position within the methodData.
+ */
+public interface HotSpotMethodDataAccessor {
+
+    /**
+     * {@code DataLayout} tag values.
+     */
+    enum Tag {
+        No(config().dataLayoutNoTag),
+        BitData(config().dataLayoutBitDataTag),
+        CounterData(config().dataLayoutCounterDataTag),
+        JumpData(config().dataLayoutJumpDataTag),
+        ReceiverTypeData(config().dataLayoutReceiverTypeDataTag),
+        VirtualCallData(config().dataLayoutVirtualCallDataTag),
+        RetData(config().dataLayoutRetDataTag),
+        BranchData(config().dataLayoutBranchDataTag),
+        MultiBranchData(config().dataLayoutMultiBranchDataTag),
+        ArgInfoData(config().dataLayoutArgInfoDataTag),
+        CallTypeData(config().dataLayoutCallTypeDataTag),
+        VirtualCallTypeData(config().dataLayoutVirtualCallTypeDataTag),
+        ParametersTypeData(config().dataLayoutParametersTypeDataTag),
+        SpeculativeTrapData(config().dataLayoutSpeculativeTrapDataTag);
+
+        private final int value;
+
+        private Tag(int value) {
+            this.value = value;
+        }
+
+        public int getValue() {
+            return value;
+        }
+
+        private static HotSpotVMConfig config() {
+            return runtime().getConfig();
+        }
+
+        public static Tag getEnum(int value) {
+            Tag result = values()[value];
+            assert value == result.value;
+            return result;
+        }
+    }
+
+    /**
+     * Returns the {@link Tag} stored in the LayoutData header.
+     *
+     * @return tag stored in the LayoutData header
+     */
+    Tag getTag();
+
+    /**
+     * Returns the BCI stored in the LayoutData header.
+     *
+     * @return An integer &ge; 0 and &le; Short.MAX_VALUE, or -1 if not supported.
+     */
+    int getBCI(HotSpotMethodData data, int position);
+
+    /**
+     * Computes the size for the specific data at the given position.
+     *
+     * @return An integer &gt; 0.
+     */
+    int getSize(HotSpotMethodData data, int position);
+
+    JavaTypeProfile getTypeProfile(HotSpotMethodData data, int position);
+
+    JavaMethodProfile getMethodProfile(HotSpotMethodData data, int position);
+
+    double getBranchTakenProbability(HotSpotMethodData data, int position);
+
+    double[] getSwitchProbabilities(HotSpotMethodData data, int position);
+
+    TriState getExceptionSeen(HotSpotMethodData data, int position);
+
+    TriState getNullSeen(HotSpotMethodData data, int position);
+
+    int getExecutionCount(HotSpotMethodData data, int position);
+
+    StringBuilder appendTo(StringBuilder sb, HotSpotMethodData data, int pos);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotMethodHandleAccessProvider.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,162 @@
+/*
+ * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.hotspot;
+
+import static com.oracle.jvmci.hotspot.HotSpotJVMCIRuntime.*;
+import static com.oracle.jvmci.hotspot.HotSpotResolvedJavaType.*;
+import static com.oracle.jvmci.hotspot.HotSpotResolvedObjectTypeImpl.*;
+
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.meta.*;
+
+public class HotSpotMethodHandleAccessProvider implements MethodHandleAccessProvider, HotSpotProxified {
+
+    private final ConstantReflectionProvider constantReflection;
+
+    public HotSpotMethodHandleAccessProvider(ConstantReflectionProvider constantReflection) {
+        this.constantReflection = constantReflection;
+    }
+
+    /**
+     * Lazy initialization to break class initialization cycle. Field and method lookup is only
+     * possible after the {@link HotSpotJVMCIRuntime} is fully initialized.
+     */
+    static class LazyInitialization {
+        static final ResolvedJavaField methodHandleFormField;
+        static final ResolvedJavaField lambdaFormVmentryField;
+        static final ResolvedJavaMethod lambdaFormCompileToBytecodeMethod;
+        static final ResolvedJavaField memberNameVmtargetField;
+
+        /**
+         * Search for an instance field with the given name in a class.
+         *
+         * @param className name of the class to search in
+         * @param fieldName name of the field to be searched
+         * @return resolved java field
+         * @throws ClassNotFoundException
+         */
+        private static ResolvedJavaField findFieldInClass(String className, String fieldName) throws ClassNotFoundException {
+            Class<?> clazz = Class.forName(className);
+            ResolvedJavaType type = fromClass(clazz);
+            ResolvedJavaField[] fields = type.getInstanceFields(false);
+            for (ResolvedJavaField field : fields) {
+                if (field.getName().equals(fieldName)) {
+                    return field;
+                }
+            }
+            return null;
+        }
+
+        private static ResolvedJavaMethod findMethodInClass(String className, String methodName) throws ClassNotFoundException {
+            Class<?> clazz = Class.forName(className);
+            HotSpotResolvedObjectTypeImpl type = fromObjectClass(clazz);
+            ResolvedJavaMethod result = null;
+            for (ResolvedJavaMethod method : type.getDeclaredMethods()) {
+                if (method.getName().equals(methodName)) {
+                    assert result == null : "more than one method found: " + className + "." + methodName;
+                    result = method;
+                }
+            }
+            assert result != null : "method not found: " + className + "." + methodName;
+            return result;
+        }
+
+        static {
+            try {
+                methodHandleFormField = findFieldInClass("java.lang.invoke.MethodHandle", "form");
+                lambdaFormVmentryField = findFieldInClass("java.lang.invoke.LambdaForm", "vmentry");
+                lambdaFormCompileToBytecodeMethod = findMethodInClass("java.lang.invoke.LambdaForm", "compileToBytecode");
+                memberNameVmtargetField = findFieldInClass("java.lang.invoke.MemberName", "vmtarget");
+            } catch (Throwable ex) {
+                throw new JVMCIError(ex);
+            }
+        }
+    }
+
+    @Override
+    public IntrinsicMethod lookupMethodHandleIntrinsic(ResolvedJavaMethod method) {
+        int intrinsicId = ((HotSpotResolvedJavaMethodImpl) method).intrinsicId();
+        if (intrinsicId != 0) {
+            return getMethodHandleIntrinsic(intrinsicId);
+        }
+        return null;
+    }
+
+    public static IntrinsicMethod getMethodHandleIntrinsic(int intrinsicId) {
+        HotSpotVMConfig config = runtime().getConfig();
+        if (intrinsicId == config.vmIntrinsicInvokeBasic) {
+            return IntrinsicMethod.INVOKE_BASIC;
+        } else if (intrinsicId == config.vmIntrinsicLinkToInterface) {
+            return IntrinsicMethod.LINK_TO_INTERFACE;
+        } else if (intrinsicId == config.vmIntrinsicLinkToSpecial) {
+            return IntrinsicMethod.LINK_TO_SPECIAL;
+        } else if (intrinsicId == config.vmIntrinsicLinkToStatic) {
+            return IntrinsicMethod.LINK_TO_STATIC;
+        } else if (intrinsicId == config.vmIntrinsicLinkToVirtual) {
+            return IntrinsicMethod.LINK_TO_VIRTUAL;
+        }
+        return null;
+    }
+
+    @Override
+    public ResolvedJavaMethod resolveInvokeBasicTarget(JavaConstant methodHandle, boolean forceBytecodeGeneration) {
+        if (methodHandle.isNull()) {
+            return null;
+        }
+
+        /* Load non-public field: LambdaForm MethodHandle.form */
+        JavaConstant lambdaForm = constantReflection.readFieldValue(LazyInitialization.methodHandleFormField, methodHandle);
+        if (lambdaForm.isNull()) {
+            return null;
+        }
+
+        JavaConstant memberName;
+        if (forceBytecodeGeneration) {
+            /* Invoke non-public method: MemberName LambdaForm.compileToBytecode() */
+            memberName = LazyInitialization.lambdaFormCompileToBytecodeMethod.invoke(lambdaForm, new JavaConstant[0]);
+        } else {
+            /* Load non-public field: MemberName LambdaForm.vmentry */
+            memberName = constantReflection.readFieldValue(LazyInitialization.lambdaFormVmentryField, lambdaForm);
+        }
+        return getTargetMethod(memberName);
+    }
+
+    @Override
+    public ResolvedJavaMethod resolveLinkToTarget(JavaConstant memberName) {
+        return getTargetMethod(memberName);
+    }
+
+    /**
+     * Returns the {@link ResolvedJavaMethod} for the vmtarget of a java.lang.invoke.MemberName.
+     */
+    private ResolvedJavaMethod getTargetMethod(JavaConstant memberName) {
+        if (memberName.isNull()) {
+            return null;
+        }
+
+        /* Load injected field: JVM_Method* MemberName.vmtarget */
+        JavaConstant vmtarget = constantReflection.readFieldValue(LazyInitialization.memberNameVmtargetField, memberName);
+        /* Create a method from the vmtarget method pointer. */
+        return HotSpotResolvedJavaMethodImpl.fromMetaspace(vmtarget.asLong());
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotMethodUnresolved.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2011, 2015, 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.jvmci.hotspot;
+
+import com.oracle.jvmci.meta.*;
+
+/**
+ * Implementation of {@link JavaMethod} for unresolved HotSpot methods.
+ */
+public final class HotSpotMethodUnresolved extends HotSpotMethod {
+
+    private final Signature signature;
+    protected JavaType holder;
+
+    public HotSpotMethodUnresolved(String name, Signature signature, JavaType holder) {
+        super(name);
+        this.holder = holder;
+        this.signature = signature;
+    }
+
+    @Override
+    public Signature getSignature() {
+        return signature;
+    }
+
+    @Override
+    public JavaType getDeclaringClass() {
+        return holder;
+    }
+
+    @Override
+    public int hashCode() {
+        return super.hashCode();
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null || !(obj instanceof HotSpotMethodUnresolved)) {
+            return false;
+        }
+        HotSpotMethodUnresolved that = (HotSpotMethodUnresolved) obj;
+        return this.name.equals(that.name) && this.signature.equals(that.signature) && this.holder.equals(that.holder);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotNmethod.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,116 @@
+/*
+ * 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.jvmci.hotspot;
+
+import static com.oracle.jvmci.hotspot.HotSpotJVMCIRuntime.*;
+
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.meta.*;
+
+/**
+ * Implementation of {@link InstalledCode} for code installed as an nmethod. The nmethod stores a
+ * weak reference to an instance of this class. This is necessary to keep the nmethod from being
+ * unloaded while the associated {@link HotSpotNmethod} instance is alive.
+ * <p>
+ * Note that there is no (current) way for the reference from an nmethod to a {@link HotSpotNmethod}
+ * instance to be anything but weak. This is due to the fact that HotSpot does not treat nmethods as
+ * strong GC roots.
+ */
+public class HotSpotNmethod extends HotSpotInstalledCode {
+
+    /**
+     * This (indirect) Method* reference is safe since class redefinition preserves all methods
+     * associated with nmethods in the code cache.
+     */
+    private final HotSpotResolvedJavaMethod method;
+
+    private final boolean isDefault;
+    private final boolean isExternal;
+
+    public HotSpotNmethod(HotSpotResolvedJavaMethod method, String name, boolean isDefault) {
+        this(method, name, isDefault, false);
+    }
+
+    public HotSpotNmethod(HotSpotResolvedJavaMethod method, String name, boolean isDefault, boolean isExternal) {
+        super(name);
+        this.method = method;
+        this.isDefault = isDefault;
+        this.isExternal = isExternal;
+    }
+
+    public boolean isDefault() {
+        return isDefault;
+    }
+
+    public boolean isExternal() {
+        return isExternal;
+    }
+
+    public ResolvedJavaMethod getMethod() {
+        return method;
+    }
+
+    @Override
+    public void invalidate() {
+        runtime().getCompilerToVM().invalidateInstalledCode(this);
+    }
+
+    @Override
+    public String toString() {
+        return String.format("InstalledNmethod[method=%s, codeBlob=0x%x, isDefault=%b, name=%s]", method, getAddress(), isDefault, name);
+    }
+
+    protected boolean checkThreeObjectArgs() {
+        assert method.getSignature().getParameterCount(!method.isStatic()) == 3;
+        assert method.getSignature().getParameterKind(0) == Kind.Object;
+        assert method.getSignature().getParameterKind(1) == Kind.Object;
+        assert !method.isStatic() || method.getSignature().getParameterKind(2) == Kind.Object;
+        return true;
+    }
+
+    private boolean checkArgs(Object... args) {
+        JavaType[] sig = method.toParameterTypes();
+        assert args.length == sig.length : method.format("%H.%n(%p): expected ") + sig.length + " args, got " + args.length;
+        for (int i = 0; i < sig.length; i++) {
+            Object arg = args[i];
+            if (arg == null) {
+                assert sig[i].getKind() == Kind.Object : method.format("%H.%n(%p): expected arg ") + i + " to be Object, not " + sig[i];
+            } else if (sig[i].getKind() != Kind.Object) {
+                assert sig[i].getKind().toBoxedJavaClass() == arg.getClass() : method.format("%H.%n(%p): expected arg ") + i + " to be " + sig[i] + ", not " + arg.getClass();
+            }
+        }
+        return true;
+    }
+
+    @Override
+    public Object executeVarargs(Object... args) throws InvalidInstalledCodeException {
+        assert checkArgs(args);
+        assert !isExternal();
+        return runtime().getCompilerToVM().executeCompiledMethodVarargs(args, this);
+    }
+
+    @Override
+    public long getStart() {
+        return isValid() ? super.getStart() : 0;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotObjectConstant.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2009, 2015, 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.jvmci.hotspot;
+
+import java.lang.invoke.*;
+import java.util.*;
+
+import com.oracle.jvmci.meta.*;
+
+/**
+ * Represents a constant non-{@code null} object reference, within the compiler and across the
+ * compiler/runtime interface.
+ */
+public interface HotSpotObjectConstant extends JavaConstant, HotSpotConstant, VMConstant {
+
+    JavaConstant compress();
+
+    JavaConstant uncompress();
+
+    /**
+     * Gets the resolved Java type of the object represented by this constant.
+     */
+    HotSpotResolvedObjectType getType();
+
+    /**
+     * Gets the result of {@link Class#getClassLoader()} for the {@link Class} object represented by
+     * this constant.
+     *
+     * @return {@code null} if this constant does not represent a {@link Class} object
+     */
+    JavaConstant getClassLoader();
+
+    /**
+     * Gets the {@linkplain System#identityHashCode(Object) identity} has code for the object
+     * represented by this constant.
+     */
+    int getIdentityHashCode();
+
+    /**
+     * Gets the result of {@link Class#getComponentType()} for the {@link Class} object represented
+     * by this constant.
+     *
+     * @return {@code null} if this constant does not represent a {@link Class} object
+     */
+    JavaConstant getComponentType();
+
+    /**
+     * Gets the result of {@link Class#getSuperclass()} for the {@link Class} object represented by
+     * this constant.
+     *
+     * @return {@code null} if this constant does not represent a {@link Class} object
+     */
+    JavaConstant getSuperclass();
+
+    /**
+     * Gets the result of {@link CallSite#getTarget()} for the {@link CallSite} object represented
+     * by this constant.
+     *
+     * @param assumptions used to register an assumption that the {@link CallSite}'s target does not
+     *            change
+     * @return {@code null} if this constant does not represent a {@link CallSite} object
+     */
+    JavaConstant getCallSiteTarget(Assumptions assumptions);
+
+    /**
+     * Determines if this constant represents an {@linkplain String#intern() interned} string.
+     */
+    boolean isInternedString();
+
+    /**
+     * Gets the object represented by this constant represents if it is of a given type.
+     *
+     * @param type the expected type of the object represented by this constant. If the object is
+     *            required to be of this type, then wrap the call to this method in
+     *            {@link Objects#requireNonNull(Object)}.
+     * @return the object value represented by this constant if it is an
+     *         {@link ResolvedJavaType#isInstance(JavaConstant) instance of} {@code type} otherwise
+     *         {@code null}
+     */
+    <T> T asObject(Class<T> type);
+
+    /**
+     * Gets the object represented by this constant represents if it is of a given type.
+     *
+     * @param type the expected type of the object represented by this constant. If the object is
+     *            required to be of this type, then wrap the call to this method in
+     *            {@link Objects#requireNonNull(Object)}.
+     * @return the object value represented by this constant if it is an
+     *         {@link ResolvedJavaType#isInstance(JavaConstant) instance of} {@code type} otherwise
+     *         {@code null}
+     */
+    Object asObject(ResolvedJavaType type);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotObjectConstantImpl.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,290 @@
+/*
+ * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.hotspot;
+
+import static com.oracle.jvmci.hotspot.HotSpotResolvedObjectTypeImpl.*;
+
+import java.lang.invoke.*;
+
+import com.oracle.jvmci.meta.*;
+
+import edu.umd.cs.findbugs.annotations.*;
+
+/**
+ * Represents a constant non-{@code null} object reference, within the compiler and across the
+ * compiler/runtime interface.
+ */
+public final class HotSpotObjectConstantImpl extends AbstractValue implements HotSpotObjectConstant, HotSpotProxified {
+
+    public static JavaConstant forObject(Object object) {
+        return forObject(object, false);
+    }
+
+    static JavaConstant forObject(Object object, boolean compressed) {
+        if (object == null) {
+            return compressed ? HotSpotCompressedNullConstant.COMPRESSED_NULL : JavaConstant.NULL_POINTER;
+        } else {
+            return new HotSpotObjectConstantImpl(object, compressed);
+        }
+    }
+
+    static JavaConstant forStableArray(Object object, int stableDimension, boolean isDefaultStable) {
+        if (object == null) {
+            return JavaConstant.NULL_POINTER;
+        } else {
+            assert object.getClass().isArray();
+            return new HotSpotObjectConstantImpl(object, false, stableDimension, isDefaultStable);
+        }
+    }
+
+    public static JavaConstant forBoxedValue(Kind kind, Object value) {
+        if (kind == Kind.Object) {
+            return HotSpotObjectConstantImpl.forObject(value);
+        } else {
+            return JavaConstant.forBoxedPrimitive(value);
+        }
+    }
+
+    static Object asBoxedValue(Constant constant) {
+        if (JavaConstant.isNull(constant)) {
+            return null;
+        } else if (constant instanceof HotSpotObjectConstantImpl) {
+            return ((HotSpotObjectConstantImpl) constant).object;
+        } else {
+            return ((JavaConstant) constant).asBoxedPrimitive();
+        }
+    }
+
+    private final Object object;
+    private final boolean compressed;
+    private final byte stableDimension;
+    private final boolean isDefaultStable;
+
+    private HotSpotObjectConstantImpl(Object object, boolean compressed, int stableDimension, boolean isDefaultStable) {
+        super(LIRKind.reference(compressed ? Kind.Int : Kind.Object));
+        this.object = object;
+        this.compressed = compressed;
+        this.stableDimension = (byte) stableDimension;
+        this.isDefaultStable = isDefaultStable;
+        assert object != null;
+        assert stableDimension == 0 || (object != null && object.getClass().isArray());
+        assert stableDimension >= 0 && stableDimension <= 255;
+        assert !isDefaultStable || stableDimension > 0;
+    }
+
+    private HotSpotObjectConstantImpl(Object object, boolean compressed) {
+        this(object, compressed, 0, false);
+    }
+
+    /**
+     * Package-private accessor for the object represented by this constant.
+     */
+    Object object() {
+        return object;
+    }
+
+    /**
+     * Determines if the object represented by this constant is {@link Object#equals(Object) equal}
+     * to a given object.
+     */
+    public boolean isEqualTo(Object obj) {
+        return object.equals(obj);
+    }
+
+    /**
+     * Gets the class of the object represented by this constant.
+     */
+    public Class<?> getObjectClass() {
+        return object.getClass();
+    }
+
+    public boolean isCompressed() {
+        return compressed;
+    }
+
+    public JavaConstant compress() {
+        assert !compressed;
+        return new HotSpotObjectConstantImpl(object, true, stableDimension, isDefaultStable);
+    }
+
+    public JavaConstant uncompress() {
+        assert compressed;
+        return new HotSpotObjectConstantImpl(object, false, stableDimension, isDefaultStable);
+    }
+
+    public HotSpotResolvedObjectType getType() {
+        return fromObjectClass(object.getClass());
+    }
+
+    public JavaConstant getClassLoader() {
+        if (object instanceof Class) {
+            /*
+             * This is an intrinsic for getClassLoader0, which occurs after any security checks. We
+             * can't call that directly so just call getClassLoader.
+             */
+            return HotSpotObjectConstantImpl.forObject(((Class<?>) object).getClassLoader());
+        }
+        return null;
+    }
+
+    public int getIdentityHashCode() {
+        return System.identityHashCode(object);
+    }
+
+    public JavaConstant getComponentType() {
+        if (object instanceof Class) {
+            return HotSpotObjectConstantImpl.forObject(((Class<?>) object).getComponentType());
+        }
+        return null;
+    }
+
+    public JavaConstant getSuperclass() {
+        if (object instanceof Class) {
+            return HotSpotObjectConstantImpl.forObject(((Class<?>) object).getSuperclass());
+        }
+        return null;
+    }
+
+    public JavaConstant getCallSiteTarget(Assumptions assumptions) {
+        if (object instanceof CallSite) {
+            CallSite callSite = (CallSite) object;
+            MethodHandle target = callSite.getTarget();
+            if (!(callSite instanceof ConstantCallSite)) {
+                if (assumptions == null) {
+                    return null;
+                }
+                assumptions.record(new Assumptions.CallSiteTargetValue(callSite, target));
+            }
+            return HotSpotObjectConstantImpl.forObject(target);
+        }
+        return null;
+    }
+
+    @SuppressFBWarnings(value = "ES_COMPARING_STRINGS_WITH_EQ", justification = "reference equality is what we want")
+    public boolean isInternedString() {
+        if (object instanceof String) {
+            String s = (String) object;
+            return s.intern() == s;
+        }
+        return false;
+    }
+
+    public <T> T asObject(Class<T> type) {
+        if (type.isInstance(object)) {
+            return type.cast(object);
+        }
+        return null;
+    }
+
+    public Object asObject(ResolvedJavaType type) {
+        if (type.isInstance(this)) {
+            return object;
+        }
+        return null;
+    }
+
+    @Override
+    public boolean isNull() {
+        return false;
+    }
+
+    @Override
+    public boolean isDefaultForKind() {
+        return false;
+    }
+
+    @Override
+    public Object asBoxedPrimitive() {
+        throw new IllegalArgumentException();
+    }
+
+    @Override
+    public int asInt() {
+        throw new IllegalArgumentException();
+    }
+
+    @Override
+    public boolean asBoolean() {
+        throw new IllegalArgumentException();
+    }
+
+    @Override
+    public long asLong() {
+        throw new IllegalArgumentException();
+    }
+
+    @Override
+    public float asFloat() {
+        throw new IllegalArgumentException();
+    }
+
+    @Override
+    public double asDouble() {
+        throw new IllegalArgumentException();
+    }
+
+    @Override
+    public int hashCode() {
+        return System.identityHashCode(object);
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (o == this) {
+            return true;
+        } else if (o instanceof HotSpotObjectConstantImpl) {
+            HotSpotObjectConstantImpl other = (HotSpotObjectConstantImpl) o;
+            return super.equals(o) && object == other.object && compressed == other.compressed && stableDimension == other.stableDimension && isDefaultStable == other.isDefaultStable;
+        }
+        return false;
+    }
+
+    @Override
+    public String toValueString() {
+        if (object instanceof String) {
+            return (String) object;
+        } else {
+            return Kind.Object.format(object);
+        }
+    }
+
+    @Override
+    public String toString() {
+        return (compressed ? "NarrowOop" : getKind().getJavaName()) + "[" + Kind.Object.format(object) + "]";
+    }
+
+    /**
+     * Number of stable dimensions if this constant is a stable array.
+     */
+    public int getStableDimension() {
+        return stableDimension & 0xff;
+    }
+
+    /**
+     * Returns {@code true} if this is a stable array constant and its elements should be considered
+     * as stable regardless of whether they are default values.
+     */
+    public boolean isDefaultStable() {
+        return isDefaultStable;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotOptions.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,64 @@
+/*
+ * 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.jvmci.hotspot;
+
+import java.util.*;
+
+import com.oracle.jvmci.options.*;
+import com.oracle.jvmci.runtime.*;
+
+//JaCoCo Exclude
+
+/**
+ * Sets JVMCI options from the HotSpot command line. Such options are distinguished by the
+ * {@link #JVMCI_OPTION_PREFIX} prefix.
+ */
+public class HotSpotOptions {
+
+    private static final String JVMCI_OPTION_PREFIX = "-G:";
+
+    /**
+     * Called from VM.
+     */
+    static void printFlags() {
+        SortedMap<String, OptionDescriptor> options = new TreeMap<>();
+        for (Options opts : Services.load(Options.class)) {
+            for (OptionDescriptor desc : opts) {
+                if (isHotSpotOption(desc)) {
+                    String name = desc.getName();
+                    OptionDescriptor existing = options.put(name, desc);
+                    assert existing == null : "Option named \"" + name + "\" has multiple definitions: " + existing.getLocation() + " and " + desc.getLocation();
+                }
+            }
+        }
+
+        OptionUtils.printFlags(options, JVMCI_OPTION_PREFIX);
+    }
+
+    /**
+     * Determines if a given option is a HotSpot command line option.
+     */
+    private static boolean isHotSpotOption(OptionDescriptor desc) {
+        return desc.getDeclaringClass().getName().startsWith("com.oracle.graal");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotProfilingInfo.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,237 @@
+/*
+ * 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.jvmci.hotspot;
+
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.meta.*;
+
+public final class HotSpotProfilingInfo implements ProfilingInfo, HotSpotProxified {
+
+    private static final DebugMetric metricInsufficentSpace = Debug.metric("InsufficientSpaceForProfilingData");
+
+    private final HotSpotMethodData methodData;
+    private final HotSpotResolvedJavaMethod method;
+
+    private boolean isMature;
+    private int position;
+    private int hintPosition;
+    private int hintBCI;
+    private HotSpotMethodDataAccessor dataAccessor;
+
+    private boolean includeNormal;
+    private boolean includeOSR;
+
+    public HotSpotProfilingInfo(HotSpotMethodData methodData, HotSpotResolvedJavaMethod method, boolean includeNormal, boolean includeOSR) {
+        this.methodData = methodData;
+        this.method = method;
+        this.includeNormal = includeNormal;
+        this.includeOSR = includeOSR;
+        this.isMature = methodData.isProfileMature();
+        hintPosition = 0;
+        hintBCI = -1;
+    }
+
+    @Override
+    public int getCodeSize() {
+        return method.getCodeSize();
+    }
+
+    @Override
+    public JavaTypeProfile getTypeProfile(int bci) {
+        if (!isMature) {
+            return null;
+        }
+        findBCI(bci, false);
+        return dataAccessor.getTypeProfile(methodData, position);
+    }
+
+    @Override
+    public JavaMethodProfile getMethodProfile(int bci) {
+        if (!isMature) {
+            return null;
+        }
+        findBCI(bci, false);
+        return dataAccessor.getMethodProfile(methodData, position);
+    }
+
+    @Override
+    public double getBranchTakenProbability(int bci) {
+        if (!isMature) {
+            return -1;
+        }
+        findBCI(bci, false);
+        return dataAccessor.getBranchTakenProbability(methodData, position);
+    }
+
+    @Override
+    public double[] getSwitchProbabilities(int bci) {
+        if (!isMature) {
+            return null;
+        }
+        findBCI(bci, false);
+        return dataAccessor.getSwitchProbabilities(methodData, position);
+    }
+
+    @Override
+    public TriState getExceptionSeen(int bci) {
+        findBCI(bci, true);
+        return dataAccessor.getExceptionSeen(methodData, position);
+    }
+
+    @Override
+    public TriState getNullSeen(int bci) {
+        findBCI(bci, false);
+        return dataAccessor.getNullSeen(methodData, position);
+    }
+
+    @Override
+    public int getExecutionCount(int bci) {
+        if (!isMature) {
+            return -1;
+        }
+        findBCI(bci, false);
+        return dataAccessor.getExecutionCount(methodData, position);
+    }
+
+    @Override
+    public int getDeoptimizationCount(DeoptimizationReason reason) {
+        int count = 0;
+        if (includeNormal) {
+            count += methodData.getDeoptimizationCount(reason);
+        }
+        if (includeOSR) {
+            count += methodData.getOSRDeoptimizationCount(reason);
+        }
+        return count;
+    }
+
+    private void findBCI(int targetBCI, boolean searchExtraData) {
+        assert targetBCI >= 0 : "invalid BCI";
+
+        if (methodData.hasNormalData()) {
+            int currentPosition = targetBCI < hintBCI ? 0 : hintPosition;
+            HotSpotMethodDataAccessor currentAccessor;
+            while ((currentAccessor = methodData.getNormalData(currentPosition)) != null) {
+                int currentBCI = currentAccessor.getBCI(methodData, currentPosition);
+                if (currentBCI == targetBCI) {
+                    normalDataFound(currentAccessor, currentPosition, currentBCI);
+                    return;
+                } else if (currentBCI > targetBCI) {
+                    break;
+                }
+                currentPosition = currentPosition + currentAccessor.getSize(methodData, currentPosition);
+            }
+        }
+
+        boolean exceptionPossiblyNotRecorded = false;
+        if (searchExtraData && methodData.hasExtraData()) {
+            int currentPosition = methodData.getExtraDataBeginOffset();
+            HotSpotMethodDataAccessor currentAccessor;
+            while ((currentAccessor = methodData.getExtraData(currentPosition)) != null) {
+                int currentBCI = currentAccessor.getBCI(methodData, currentPosition);
+                if (currentBCI == targetBCI) {
+                    extraDataFound(currentAccessor, currentPosition);
+                    return;
+                }
+                currentPosition = currentPosition + currentAccessor.getSize(methodData, currentPosition);
+            }
+
+            if (!methodData.isWithin(currentPosition)) {
+                exceptionPossiblyNotRecorded = true;
+                metricInsufficentSpace.increment();
+            }
+        }
+
+        noDataFound(exceptionPossiblyNotRecorded);
+    }
+
+    private void normalDataFound(HotSpotMethodDataAccessor data, int pos, int bci) {
+        setCurrentData(data, pos);
+        this.hintPosition = position;
+        this.hintBCI = bci;
+    }
+
+    private void extraDataFound(HotSpotMethodDataAccessor data, int pos) {
+        setCurrentData(data, pos);
+    }
+
+    private void noDataFound(boolean exceptionPossiblyNotRecorded) {
+        HotSpotMethodDataAccessor accessor = HotSpotMethodData.getNoDataAccessor(exceptionPossiblyNotRecorded);
+        setCurrentData(accessor, -1);
+    }
+
+    private void setCurrentData(HotSpotMethodDataAccessor dataAccessor, int position) {
+        this.dataAccessor = dataAccessor;
+        this.position = position;
+    }
+
+    @Override
+    public boolean isMature() {
+        return isMature;
+    }
+
+    public void ignoreMature() {
+        isMature = true;
+    }
+
+    @Override
+    public String toString() {
+        return "HotSpotProfilingInfo<" + this.toString(null, "; ") + ">";
+    }
+
+    @Override
+    public void setMature() {
+        isMature = true;
+    }
+
+    /**
+     * {@code MethodData::_jvmci_ir_size} (currently) supports at most one JVMCI compiler IR type
+     * which will be determined by the first JVMCI compiler that calls
+     * {@link #setCompilerIRSize(Class, int)}.
+     */
+    private static volatile Class<?> supportedCompilerIRType;
+
+    @Override
+    public boolean setCompilerIRSize(Class<?> irType, int size) {
+        if (supportedCompilerIRType == null) {
+            synchronized (HotSpotProfilingInfo.class) {
+                if (supportedCompilerIRType == null) {
+                    supportedCompilerIRType = irType;
+                }
+            }
+        }
+        if (supportedCompilerIRType != irType) {
+            return false;
+        }
+        methodData.setCompiledIRSize(size);
+        return true;
+    }
+
+    @Override
+    public int getCompilerIRSize(Class<?> irType) {
+        if (irType == supportedCompilerIRType) {
+            return methodData.getCompiledIRSize();
+        }
+        return -1;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotProxified.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.hotspot;
+
+/**
+ * Marker interface for classes whose values are proxied during replay compilation capture.
+ */
+public interface HotSpotProxified {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotReferenceMap.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,510 @@
+/*
+ * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.hotspot;
+
+import java.util.*;
+
+import com.oracle.jvmci.code.CodeUtil.RefMapFormatter;
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.meta.*;
+
+public final class HotSpotReferenceMap extends ReferenceMap {
+
+    static final int OOP64 = 0b1010;
+    static final int OOP32 = 0b01;
+    static final int NARROW_LOW = OOP32;
+    static final int NARROW_HIGH = OOP32 << 2;
+    static final int NARROW_BOTH = NARROW_LOW | NARROW_HIGH;
+
+    private enum MapEntry {
+        NoReference(0),
+        WideOop(OOP64),
+        NarrowOopLowerHalf(NARROW_LOW),
+        NarrowOopUpperHalf(NARROW_HIGH),
+        TwoNarrowOops(NARROW_BOTH),
+        Illegal(-1);
+
+        MapEntry(int pattern) {
+            this.pattern = pattern;
+        }
+
+        final int pattern;
+
+        /**
+         * Create enum values from OopMap.
+         * <p>
+         * These bits can have the following values (MSB first):
+         *
+         * <pre>
+         * 0000 - contains no references
+         * 1010 - contains a wide oop
+         * 0001 - contains a narrow oop in the lower half
+         * 0101 - contains a narrow oop in the upper half
+         * 0101 - contains two narrow oops
+         * </pre>
+         *
+         * @see HotSpotReferenceMap#registerRefMap
+         * @see HotSpotReferenceMap#frameRefMap
+         */
+        static MapEntry getFromBits(int idx, HotSpotOopMap set) {
+            int n = set.get(idx);
+            switch (n) {
+                case 0:
+                    return NoReference;
+                case OOP64:
+                    return WideOop;
+                case NARROW_LOW:
+                    return NarrowOopLowerHalf;
+                case NARROW_HIGH:
+                    return NarrowOopUpperHalf;
+                case NARROW_BOTH:
+                    return TwoNarrowOops;
+                default:
+                    return Illegal;
+            }
+        }
+
+        String toBitString() {
+            int bits = toBit(this);
+            if (bits == -1) {
+                return "---";
+            }
+            return String.format("%3s", Integer.toBinaryString(bits)).replace(' ', '0');
+        }
+
+        static int toBit(MapEntry type) {
+            return type.pattern;
+        }
+    }
+
+    /**
+     * A specialized bit set that represents both wide and narrow oops in an efficient manner. The
+     * map consists of 4 bit entries that represent 8 bytes of memory.
+     *
+     */
+    class HotSpotOopMap implements Cloneable {
+
+        /**
+         * Each entry is 4 bits long and covers 8 bytes of memory.
+         */
+        private static final int BITS_PER_ENTRY = 4;
+        private static final int BITS_PER_ELEMENT = 64;
+
+        public HotSpotOopMap(int i) {
+            words = new long[(i * BITS_PER_ENTRY + BITS_PER_ELEMENT) / BITS_PER_ELEMENT];
+        }
+
+        public HotSpotOopMap(HotSpotOopMap other) {
+            words = other.words.clone();
+        }
+
+        private long[] words;
+
+        private int get(int i) {
+            return getEntry(i);
+        }
+
+        public void or(HotSpotOopMap src) {
+            if (words.length < src.words.length) {
+                long[] newWords = new long[src.words.length];
+                System.arraycopy(src.words, 0, newWords, 0, src.words.length);
+                for (int i = 0; i < words.length; i++) {
+                    newWords[i] |= words[i];
+                }
+                words = newWords;
+            } else {
+                for (int i = 0; i < src.words.length; i++) {
+                    words[i] |= src.words[i];
+                }
+            }
+        }
+
+        private void setOop(int regIdx) {
+            setEntry(regIdx, OOP64);
+        }
+
+        public int size() {
+            return words.length * BITS_PER_ELEMENT / BITS_PER_ENTRY;
+        }
+
+        @Override
+        public HotSpotOopMap clone() {
+            return new HotSpotOopMap(this);
+        }
+
+        private void setNarrowOop(int offset) {
+            setNarrowEntry(offset, OOP32);
+        }
+
+        private void setEntry(int regIdx, int value) {
+            assert regIdx % 2 == 0 : "must be alinged";
+            int bitIndex = (regIdx >> 1) * BITS_PER_ENTRY;
+            int wordIndex = bitIndex / BITS_PER_ELEMENT;
+            int shift = bitIndex - wordIndex * BITS_PER_ELEMENT;
+            if (wordIndex >= words.length) {
+                if (value == 0) {
+                    // Nothing to do since bits are clear
+                    return;
+                }
+                words = Arrays.copyOf(words, wordIndex + 1);
+            }
+            assert verifyUpdate(this, this);
+            long orig = words[wordIndex];
+            words[wordIndex] = (orig & (~(0b1111L << shift))) | ((long) value << shift);
+            assert get(regIdx / 2) == value;
+            assert verifyUpdate(this, this);
+        }
+
+        private void setNarrowEntry(int offset, int value) {
+            int regIdx = offset >> 1;
+            boolean low = offset % 2 == 0;
+            int bitIndex = regIdx * BITS_PER_ENTRY;
+            int wordIndex = bitIndex / BITS_PER_ELEMENT;
+            int shift = bitIndex - wordIndex * BITS_PER_ELEMENT;
+            if (wordIndex >= words.length) {
+                if (value == 0) {
+                    // Nothing to do since bits are clear
+                    return;
+                }
+                words = Arrays.copyOf(words, wordIndex + 1);
+            }
+            long originalValue = words[wordIndex];
+            int current = ((int) (originalValue >> shift)) & 0b1111;
+            if (current == OOP64) {
+                current = 0;
+            }
+            long newValue;
+            if (value != 0) {
+                newValue = current | (low ? value : (value << 2));
+            } else {
+                newValue = current & (low ? 0b1100 : 0b0011);
+            }
+            long masked = originalValue & (~(0b1111L << shift));
+            words[wordIndex] = masked | (newValue << shift);
+            assert verifyUpdate(this, this);
+        }
+
+        private int getEntry(int regIdx) {
+            int bitIndex = regIdx * BITS_PER_ENTRY;
+            int wordIndex = bitIndex / BITS_PER_ELEMENT;
+            int shift = bitIndex - wordIndex * BITS_PER_ELEMENT;
+            return ((int) (words[wordIndex] >>> shift)) & 0b1111;
+        }
+
+        @Override
+        public boolean equals(Object other) {
+            if (this == other) {
+                return true;
+            }
+
+            if (other instanceof HotSpotOopMap) {
+                HotSpotOopMap otherMap = (HotSpotOopMap) other;
+                int limit = Math.min(words.length, otherMap.words.length);
+                for (int i = 0; i < limit; i++) {
+                    if (words[i] != otherMap.words[i]) {
+                        return false;
+                    }
+                }
+                for (int i = limit; i < words.length; i++) {
+                    if (words[i] != 0) {
+                        return false;
+                    }
+                }
+                for (int i = limit; i < otherMap.words.length; i++) {
+                    if (otherMap.words[i] != 0) {
+                        return false;
+                    }
+                }
+                return true;
+            }
+            return false;
+        }
+
+        @Override
+        public int hashCode() {
+            long h = 1234;
+            for (int i = words.length; --i >= 0;) {
+                h ^= words[i] * (i + 1);
+            }
+            return (int) ((h >> 32) ^ h);
+        }
+
+        @Override
+        public String toString() {
+            int count = 0;
+            StringBuilder sb = new StringBuilder();
+            sb.append("[");
+            for (int idx = 0; idx < size(); idx++) {
+                MapEntry dstType = MapEntry.getFromBits(idx, this);
+                if (dstType == MapEntry.NoReference) {
+                    continue;
+                }
+                if (count > 0) {
+                    sb.append(", ");
+                }
+                if (dstType == MapEntry.Illegal) {
+                    int value = get(idx);
+                    sb.append("0x");
+                    sb.append(Integer.toHexString(value));
+                } else {
+                    sb.append(idx);
+                    sb.append(':');
+                    sb.append(dstType);
+                }
+                count++;
+            }
+            sb.append("]");
+            return sb.toString();
+        }
+    }
+
+    /**
+     * Contains 3 bits per scalar register, and n*3 bits per n-word vector register (e.g., on a
+     * 64-bit system, a 256-bit vector register requires 12 reference map bits).
+     * <p>
+     * These bits can have the following values (LSB first):
+     *
+     * <pre>
+     * 000 - contains no references
+     * 100 - contains a wide oop
+     * 110 - contains a narrow oop in the lower half
+     * 101 - contains a narrow oop in the upper half
+     * 111 - contains two narrow oops
+     * </pre>
+     */
+    private final HotSpotOopMap registerRefMap;
+
+    /**
+     * Contains 3 bits per stack word.
+     * <p>
+     * These bits can have the following values (LSB first):
+     *
+     * <pre>
+     * 000 - contains no references
+     * 100 - contains a wide oop
+     * 110 - contains a narrow oop in the lower half
+     * 101 - contains a narrow oop in the upper half
+     * 111 - contains two narrow oops
+     * </pre>
+     */
+    private final HotSpotOopMap frameRefMap;
+
+    private final TargetDescription target;
+
+    public HotSpotReferenceMap(int registerCount, int frameSlotCount, TargetDescription target) {
+        if (registerCount > 0) {
+            this.registerRefMap = new HotSpotOopMap(registerCount);
+        } else {
+            this.registerRefMap = null;
+        }
+        this.frameRefMap = new HotSpotOopMap(frameSlotCount);
+        this.target = target;
+    }
+
+    private HotSpotReferenceMap(HotSpotReferenceMap other) {
+        this.registerRefMap = other.registerRefMap.clone();
+        this.frameRefMap = other.frameRefMap.clone();
+        this.target = other.target;
+    }
+
+    @Override
+    public ReferenceMap clone() {
+        return new HotSpotReferenceMap(this);
+    }
+
+    // setters
+    @Override
+    public void setRegister(int idx, LIRKind kind) {
+        set(registerRefMap, idx * 2, kind);
+    }
+
+    @Override
+    public void setStackSlot(int offset, LIRKind kind) {
+        assert offset % bytesPerElement(kind) == 0 : "unaligned value in ReferenceMap";
+        set(frameRefMap, offset / 4, kind);
+    }
+
+    private void set(HotSpotOopMap refMap, int index, LIRKind kind) {
+        if (kind.isDerivedReference()) {
+            throw new JVMCIError("derived reference cannot be inserted in ReferenceMap");
+        }
+
+        int bytesPerElement = bytesPerElement(kind);
+        int length = kind.getPlatformKind().getVectorLength();
+        if (bytesPerElement == 8) {
+            for (int i = 0; i < length; i++) {
+                if (kind.isReference(i)) {
+                    refMap.setOop(index + i * 2);
+                }
+            }
+        } else if (bytesPerElement == 4) {
+            for (int i = 0; i < length; i++) {
+                if (kind.isReference(i)) {
+                    refMap.setNarrowOop(index + i);
+                }
+            }
+        } else {
+            assert kind.isValue() : "unknown reference kind " + kind;
+        }
+    }
+
+    private int bytesPerElement(LIRKind kind) {
+        PlatformKind platformKind = kind.getPlatformKind();
+        return target.getSizeInBytes(platformKind) / platformKind.getVectorLength();
+    }
+
+    public HotSpotOopMap getFrameMap() {
+        return frameRefMap == null ? null : (HotSpotOopMap) frameRefMap.clone();
+    }
+
+    public HotSpotOopMap getRegisterMap() {
+        return registerRefMap == null ? null : (HotSpotOopMap) registerRefMap.clone();
+    }
+
+    static MapEntry[] entries(HotSpotOopMap fixedMap) {
+        MapEntry[] result = new MapEntry[fixedMap.size()];
+        for (int idx = 0; idx < fixedMap.size(); idx++) {
+            MapEntry dstType = MapEntry.getFromBits(idx, fixedMap);
+            result[idx] = dstType;
+        }
+        return result;
+    }
+
+    private static boolean verifyUpdate(HotSpotOopMap dst, HotSpotOopMap src) {
+        return verifyUpdate(dst, src, true);
+    }
+
+    private static boolean verifyUpdate(HotSpotOopMap dst, HotSpotOopMap src, boolean doAssert) {
+        for (int idx = 0; idx < Math.min(src.size(), dst.size()); idx++) {
+            if (!verifyUpdateEntry(idx, dst, src, doAssert)) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    private static boolean verifyUpdateEntry(int idx, HotSpotOopMap dst, HotSpotOopMap src, boolean doAssert) {
+        MapEntry dstType = MapEntry.getFromBits(idx, dst);
+        MapEntry srcType = MapEntry.getFromBits(idx, src);
+
+        if (dstType == MapEntry.Illegal || srcType == MapEntry.Illegal) {
+            assert !doAssert : String.format("Illegal RefMap bit pattern: %s (0b%s), %s (0b%s)", dstType, dstType.toBitString(), srcType, srcType.toBitString());
+            return false;
+        }
+        switch (dstType) {
+            case NoReference:
+                return true;
+            case WideOop:
+                switch (srcType) {
+                    case NoReference:
+                    case WideOop:
+                        return true;
+                    default:
+                        assert false : String.format("Illegal RefMap combination: %s (0b%s), %s (0b%s)", dstType, dstType.toBitString(), srcType, srcType.toBitString());
+                        return false;
+                }
+            case TwoNarrowOops:
+            case NarrowOopLowerHalf:
+            case NarrowOopUpperHalf:
+                switch (srcType) {
+                    case TwoNarrowOops:
+                    case NarrowOopLowerHalf:
+                    case NarrowOopUpperHalf:
+                    case NoReference:
+                        return true;
+                    default:
+                        assert false : String.format("Illegal RefMap combination: %s (0b%s), %s (0b%s)", dstType, dstType.toBitString(), srcType, srcType.toBitString());
+                        return false;
+                }
+            default:
+                return false;
+        }
+    }
+
+    @Override
+    public int hashCode() {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj instanceof HotSpotReferenceMap) {
+            HotSpotReferenceMap that = (HotSpotReferenceMap) obj;
+            if (this.frameRefMap.equals(that.frameRefMap) && Objects.equals(this.registerRefMap, that.registerRefMap) && this.target.equals(that.target)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    @Override
+    public boolean hasRegisterRefMap() {
+        return registerRefMap != null && registerRefMap.size() > 0;
+    }
+
+    @Override
+    public boolean hasFrameRefMap() {
+        return frameRefMap != null && frameRefMap.size() > 0;
+    }
+
+    @Override
+    public void appendRegisterMap(StringBuilder sb, RefMapFormatter formatter) {
+        for (int idx = 0; idx < registerRefMap.size(); idx++) {
+            MapEntry dstType = MapEntry.getFromBits(idx, registerRefMap);
+            if (dstType != MapEntry.NoReference) {
+                sb.append(' ').append(formatter.formatRegister(idx)).append(':').append(dstType);
+            }
+        }
+    }
+
+    @Override
+    public void appendFrameMap(StringBuilder sb, RefMapFormatter formatter) {
+        for (int idx = 0; idx < frameRefMap.size(); idx++) {
+            MapEntry dstType = MapEntry.getFromBits(idx, frameRefMap);
+            if (dstType != MapEntry.NoReference) {
+                sb.append(' ').append(formatter.formatStackSlot(idx)).append(':').append(dstType);
+            }
+        }
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        if (registerRefMap != null) {
+            sb.append("Registers = ");
+            sb.append(registerRefMap);
+        }
+        sb.append("Stack = ");
+        sb.append(frameRefMap);
+        return sb.toString();
+    }
+
+    public void verify() {
+        assert verifyUpdate(frameRefMap, frameRefMap);
+        assert registerRefMap == null || verifyUpdate(registerRefMap, registerRefMap);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotResolvedJavaField.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.hotspot;
+
+import com.oracle.jvmci.meta.*;
+
+/**
+ * Represents a field in a HotSpot type.
+ */
+public interface HotSpotResolvedJavaField extends ResolvedJavaField {
+
+    /**
+     * Determines if a given object contains this field.
+     *
+     * @return true iff this is a non-static field and its declaring class is assignable from
+     *         {@code object}'s class
+     */
+    boolean isInObject(Object object);
+
+    int offset();
+
+    /**
+     * Checks if this field has the {@link Stable} annotation.
+     *
+     * @return true if field has {@link Stable} annotation, false otherwise
+     */
+    boolean isStable();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotResolvedJavaFieldImpl.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,289 @@
+/*
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.hotspot;
+
+import static com.oracle.jvmci.hotspot.HotSpotJVMCIRuntime.*;
+import static com.oracle.jvmci.hotspot.HotSpotResolvedJavaFieldImpl.Options.*;
+import static com.oracle.jvmci.hotspot.HotSpotResolvedObjectTypeImpl.*;
+
+import java.lang.annotation.*;
+import java.lang.reflect.*;
+
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.meta.*;
+import com.oracle.jvmci.options.*;
+
+/**
+ * Represents a field in a HotSpot type.
+ */
+public class HotSpotResolvedJavaFieldImpl implements HotSpotResolvedJavaField, HotSpotProxified {
+
+    static class Options {
+        //@formatter:off
+        @Option(help = "Mark well-known stable fields as such.", type = OptionType.Debug)
+        public static final OptionValue<Boolean> ImplicitStableValues = new OptionValue<>(true);
+        //@formatter:on
+    }
+
+    private final HotSpotResolvedObjectTypeImpl holder;
+    private final String name;
+    private JavaType type;
+    private final int offset;
+
+    /**
+     * This value contains all flags as stored in the VM including internal ones.
+     */
+    private final int modifiers;
+    private final LocationIdentity locationIdentity = new FieldLocationIdentity(this);
+
+    public static class FieldLocationIdentity extends LocationIdentity {
+        HotSpotResolvedJavaField inner;
+
+        public FieldLocationIdentity(HotSpotResolvedJavaFieldImpl inner) {
+            this.inner = inner;
+        }
+
+        @Override
+        public boolean isImmutable() {
+            return false;
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            if (this == obj) {
+                return true;
+            }
+            if (obj instanceof FieldLocationIdentity) {
+                FieldLocationIdentity fieldLocationIdentity = (FieldLocationIdentity) obj;
+                return inner.equals(fieldLocationIdentity.inner);
+
+            }
+            return false;
+        }
+
+        @Override
+        public int hashCode() {
+            return inner.hashCode();
+        }
+
+        @Override
+        public String toString() {
+            return inner.getName();
+        }
+    }
+
+    public HotSpotResolvedJavaFieldImpl(HotSpotResolvedObjectTypeImpl holder, String name, JavaType type, long offset, int modifiers) {
+        this.holder = holder;
+        this.name = name;
+        this.type = type;
+        assert offset != -1;
+        assert offset == (int) offset : "offset larger than int";
+        this.offset = (int) offset;
+        this.modifiers = modifiers;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj instanceof HotSpotResolvedJavaField) {
+            HotSpotResolvedJavaFieldImpl that = (HotSpotResolvedJavaFieldImpl) obj;
+            if (that.offset != this.offset || that.isStatic() != this.isStatic()) {
+                return false;
+            } else if (this.holder.equals(that.holder)) {
+                assert this.name.equals(that.name) && this.type.equals(that.type);
+                return true;
+            }
+        }
+        return false;
+    }
+
+    @Override
+    public int hashCode() {
+        return name.hashCode();
+    }
+
+    @Override
+    public int getModifiers() {
+        return modifiers & getReflectionFieldModifiers();
+    }
+
+    @Override
+    public boolean isInternal() {
+        return (modifiers & runtime().getConfig().jvmAccFieldInternal) != 0;
+    }
+
+    /**
+     * Determines if a given object contains this field.
+     *
+     * @return true iff this is a non-static field and its declaring class is assignable from
+     *         {@code object}'s class
+     */
+    public boolean isInObject(Object object) {
+        if (isStatic()) {
+            return false;
+        }
+        return getDeclaringClass().isAssignableFrom(HotSpotResolvedObjectTypeImpl.fromObjectClass(object.getClass()));
+    }
+
+    @Override
+    public HotSpotResolvedObjectTypeImpl getDeclaringClass() {
+        return holder;
+    }
+
+    @Override
+    public String getName() {
+        return name;
+    }
+
+    @Override
+    public JavaType getType() {
+        // Pull field into local variable to prevent a race causing
+        // a ClassCastException below
+        JavaType currentType = type;
+        if (currentType instanceof HotSpotUnresolvedJavaType) {
+            // Don't allow unresolved types to hang around forever
+            HotSpotUnresolvedJavaType unresolvedType = (HotSpotUnresolvedJavaType) currentType;
+            ResolvedJavaType resolved = unresolvedType.reresolve(holder);
+            if (resolved != null) {
+                type = resolved;
+            }
+        }
+        return type;
+    }
+
+    public int offset() {
+        return offset;
+    }
+
+    @Override
+    public String toString() {
+        return format("HotSpotField<%H.%n %t:") + offset + ">";
+    }
+
+    @Override
+    public boolean isSynthetic() {
+        return (runtime().getConfig().syntheticFlag & modifiers) != 0;
+    }
+
+    /**
+     * Checks if this field has the {@link Stable} annotation.
+     *
+     * @return true if field has {@link Stable} annotation, false otherwise
+     */
+    public boolean isStable() {
+        if ((runtime().getConfig().jvmAccFieldStable & modifiers) != 0) {
+            return true;
+        }
+        assert getAnnotation(Stable.class) == null;
+        if (ImplicitStableValues.getValue() && isImplicitStableField()) {
+            return true;
+        }
+        return false;
+    }
+
+    @Override
+    public <T extends Annotation> T getAnnotation(Class<T> annotationClass) {
+        Field javaField = toJava();
+        if (javaField != null) {
+            return javaField.getAnnotation(annotationClass);
+        }
+        return null;
+    }
+
+    private Field toJavaCache;
+
+    private Field toJava() {
+        if (toJavaCache != null) {
+            return toJavaCache;
+        }
+
+        if (isInternal()) {
+            return null;
+        }
+        try {
+            return toJavaCache = holder.mirror().getDeclaredField(name);
+        } catch (NoSuchFieldException | NoClassDefFoundError e) {
+            return null;
+        }
+    }
+
+    private boolean isArray() {
+        JavaType fieldType = getType();
+        return fieldType instanceof ResolvedJavaType && ((ResolvedJavaType) fieldType).isArray();
+    }
+
+    private boolean isImplicitStableField() {
+        if (isSynthetic()) {
+            if (isSyntheticImplicitStableField()) {
+                return true;
+            }
+        } else if (isWellKnownImplicitStableField()) {
+            return true;
+        }
+        return false;
+    }
+
+    private boolean isSyntheticImplicitStableField() {
+        assert this.isSynthetic();
+        if (isStatic() && isArray()) {
+            if (isFinal() && name.equals("$VALUES") || name.equals("ENUM$VALUES")) {
+                // generated int[] field for EnumClass::values()
+                return true;
+            } else if (name.startsWith("$SwitchMap$") || name.startsWith("$SWITCH_TABLE$")) {
+                // javac and ecj generate a static field in an inner class for a switch on an enum
+                // named $SwitchMap$p$k$g$EnumClass and $SWITCH_TABLE$p$k$g$EnumClass, respectively
+                return true;
+            }
+        }
+        return false;
+    }
+
+    private boolean isWellKnownImplicitStableField() {
+        return WellKnownImplicitStableField.test(this);
+    }
+
+    static class WellKnownImplicitStableField {
+        /**
+         * @return {@code true} if the field is a well-known stable field.
+         */
+        public static boolean test(HotSpotResolvedJavaField field) {
+            return field.equals(STRING_VALUE_FIELD);
+        }
+
+        private static final ResolvedJavaField STRING_VALUE_FIELD;
+        static {
+            try {
+                MetaAccessProvider metaAccess = runtime().getHostJVMCIBackend().getMetaAccess();
+                STRING_VALUE_FIELD = metaAccess.lookupJavaField(String.class.getDeclaredField("value"));
+            } catch (SecurityException | NoSuchFieldException e) {
+                throw new JVMCIError(e);
+            }
+        }
+    }
+
+    public LocationIdentity getLocationIdentity() {
+        return locationIdentity;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotResolvedJavaMethod.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,121 @@
+/*
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.hotspot;
+
+import java.lang.reflect.*;
+
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.meta.*;
+
+/**
+ * Implementation of {@link JavaMethod} for resolved HotSpot methods.
+ */
+public interface HotSpotResolvedJavaMethod extends ResolvedJavaMethod {
+
+    /**
+     * Returns true if this method has a {@code CallerSensitive} annotation.
+     *
+     * @return true if CallerSensitive annotation present, false otherwise
+     */
+    boolean isCallerSensitive();
+
+    HotSpotResolvedObjectType getDeclaringClass();
+
+    /**
+     * Returns true if this method has a {@code ForceInline} annotation.
+     *
+     * @return true if ForceInline annotation present, false otherwise
+     */
+    boolean isForceInline();
+
+    /**
+     * Returns true if this method has a {@code DontInline} annotation.
+     *
+     * @return true if DontInline annotation present, false otherwise
+     */
+    boolean isDontInline();
+
+    /**
+     * Manually adds a DontInline annotation to this method.
+     */
+    void setNotInlineable();
+
+    /**
+     * Returns true if this method is one of the special methods that is ignored by security stack
+     * walks.
+     *
+     * @return true if special method ignored by security stack walks, false otherwise
+     */
+    boolean ignoredBySecurityStackWalk();
+
+    boolean hasBalancedMonitors();
+
+    ResolvedJavaMethod uniqueConcreteMethod(HotSpotResolvedObjectType receiver);
+
+    /**
+     * Returns whether this method has compiled code.
+     *
+     * @return true if this method has compiled code, false otherwise
+     */
+    boolean hasCompiledCode();
+
+    /**
+     * @param level
+     * @return true if the currently installed code was generated at {@code level}.
+     */
+    boolean hasCompiledCodeAtLevel(int level);
+
+    ProfilingInfo getCompilationProfilingInfo(boolean isOSR);
+
+    default boolean isDefault() {
+        if (isConstructor()) {
+            return false;
+        }
+        // Copied from java.lang.Method.isDefault()
+        int mask = Modifier.ABSTRACT | Modifier.PUBLIC | Modifier.STATIC;
+        return ((getModifiers() & mask) == Modifier.PUBLIC) && getDeclaringClass().isInterface();
+    }
+
+    /**
+     * Returns the offset of this method into the v-table. The method must have a v-table entry as
+     * indicated by {@link #isInVirtualMethodTable(ResolvedJavaType)}, otherwise an exception is
+     * thrown.
+     *
+     * @return the offset of this method into the v-table
+     */
+    int vtableEntryOffset(ResolvedJavaType resolved);
+
+    int intrinsicId();
+
+    /**
+     * Allocates a compile id for this method by asking the VM for one.
+     *
+     * @param entryBCI entry bci
+     * @return compile id
+     */
+    int allocateCompileId(int entryBCI);
+
+    boolean hasCodeAtLevel(int entryBCI, int level);
+
+    SpeculationLog getSpeculationLog();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotResolvedJavaMethodImpl.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,759 @@
+/*
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.hotspot;
+
+import static com.oracle.jvmci.common.UnsafeAccess.*;
+import static com.oracle.jvmci.hotspot.HotSpotJVMCIRuntime.*;
+import static com.oracle.jvmci.hotspot.HotSpotResolvedJavaMethodImpl.Options.*;
+
+import java.lang.annotation.*;
+import java.lang.reflect.*;
+import java.util.*;
+
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.meta.*;
+import com.oracle.jvmci.options.*;
+
+/**
+ * Implementation of {@link JavaMethod} for resolved HotSpot methods.
+ */
+public final class HotSpotResolvedJavaMethodImpl extends HotSpotMethod implements HotSpotResolvedJavaMethod, HotSpotProxified, MethodIdHolder {
+
+    static class Options {
+        // @formatter:off
+        @Option(help = "", type = OptionType.Debug)
+        public static final OptionValue<Boolean> UseProfilingInformation = new OptionValue<>(true);
+        // @formatter:on
+    }
+
+    /**
+     * Reference to metaspace Method object.
+     */
+    private final long metaspaceMethod;
+
+    private final HotSpotResolvedObjectTypeImpl holder;
+    private final HotSpotConstantPool constantPool;
+    private final HotSpotSignature signature;
+    private HotSpotMethodData methodData;
+    private byte[] code;
+    private Member toJavaCache;
+
+    /**
+     * Gets the holder of a HotSpot metaspace method native object.
+     *
+     * @param metaspaceMethod a metaspace Method object
+     * @return the {@link ResolvedJavaType} corresponding to the holder of the
+     *         {@code metaspaceMethod}
+     */
+    public static HotSpotResolvedObjectTypeImpl getHolder(long metaspaceMethod) {
+        HotSpotVMConfig config = runtime().getConfig();
+        final long metaspaceConstMethod = unsafe.getAddress(metaspaceMethod + config.methodConstMethodOffset);
+        final long metaspaceConstantPool = unsafe.getAddress(metaspaceConstMethod + config.constMethodConstantsOffset);
+        final long metaspaceKlass = unsafe.getAddress(metaspaceConstantPool + config.constantPoolHolderOffset);
+        return HotSpotResolvedObjectTypeImpl.fromMetaspaceKlass(metaspaceKlass);
+    }
+
+    /**
+     * Gets the {@link ResolvedJavaMethod} for a HotSpot metaspace method native object.
+     *
+     * @param metaspaceMethod a metaspace Method object
+     * @return the {@link ResolvedJavaMethod} corresponding to {@code metaspaceMethod}
+     */
+    public static HotSpotResolvedJavaMethod fromMetaspace(long metaspaceMethod) {
+        HotSpotResolvedObjectTypeImpl holder = getHolder(metaspaceMethod);
+        return holder.createMethod(metaspaceMethod);
+    }
+
+    public HotSpotResolvedJavaMethodImpl(HotSpotResolvedObjectTypeImpl holder, long metaspaceMethod) {
+        // It would be too much work to get the method name here so we fill it in later.
+        super(null);
+        this.metaspaceMethod = metaspaceMethod;
+        this.holder = holder;
+
+        HotSpotVMConfig config = runtime().getConfig();
+        final long constMethod = getConstMethod();
+
+        /*
+         * Get the constant pool from the metaspace method. Some methods (e.g. intrinsics for
+         * signature-polymorphic method handle methods) have their own constant pool instead of the
+         * one from their holder.
+         */
+        final long metaspaceConstantPool = unsafe.getAddress(constMethod + config.constMethodConstantsOffset);
+        this.constantPool = new HotSpotConstantPool(metaspaceConstantPool);
+
+        final int nameIndex = unsafe.getChar(constMethod + config.constMethodNameIndexOffset);
+        this.name = constantPool.lookupUtf8(nameIndex);
+
+        final int signatureIndex = unsafe.getChar(constMethod + config.constMethodSignatureIndexOffset);
+        this.signature = (HotSpotSignature) constantPool.lookupSignature(signatureIndex);
+    }
+
+    /**
+     * Returns a pointer to this method's constant method data structure (
+     * {@code Method::_constMethod}).
+     *
+     * @return pointer to this method's ConstMethod
+     */
+    private long getConstMethod() {
+        assert metaspaceMethod != 0;
+        return unsafe.getAddress(metaspaceMethod + runtime().getConfig().methodConstMethodOffset);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (obj instanceof HotSpotResolvedJavaMethodImpl) {
+            HotSpotResolvedJavaMethodImpl that = (HotSpotResolvedJavaMethodImpl) obj;
+            return that.metaspaceMethod == metaspaceMethod;
+        }
+        return false;
+    }
+
+    @Override
+    public int hashCode() {
+        return (int) metaspaceMethod;
+    }
+
+    /**
+     * Returns this method's flags ({@code Method::_flags}).
+     *
+     * @return flags of this method
+     */
+    private int getFlags() {
+        return unsafe.getByte(metaspaceMethod + runtime().getConfig().methodFlagsOffset);
+    }
+
+    /**
+     * Returns this method's constant method flags ({@code ConstMethod::_flags}).
+     *
+     * @return flags of this method's ConstMethod
+     */
+    private int getConstMethodFlags() {
+        return unsafe.getChar(getConstMethod() + runtime().getConfig().constMethodFlagsOffset);
+    }
+
+    @Override
+    public HotSpotResolvedObjectTypeImpl getDeclaringClass() {
+        return holder;
+    }
+
+    /**
+     * Gets the address of the C++ Method object for this method.
+     */
+    public JavaConstant getMetaspaceMethodConstant() {
+        return HotSpotMetaspaceConstantImpl.forMetaspaceObject(getHostWordKind(), metaspaceMethod, this, false);
+    }
+
+    public long getMetaspaceMethod() {
+        return metaspaceMethod;
+    }
+
+    @Override
+    public JavaConstant getEncoding() {
+        return getMetaspaceMethodConstant();
+    }
+
+    /**
+     * Gets the complete set of modifiers for this method which includes the JVM specification
+     * modifiers as well as the HotSpot internal modifiers.
+     */
+    public int getAllModifiers() {
+        return unsafe.getInt(metaspaceMethod + runtime().getConfig().methodAccessFlagsOffset);
+    }
+
+    @Override
+    public int getModifiers() {
+        return getAllModifiers() & Modifier.methodModifiers();
+    }
+
+    @Override
+    public boolean canBeStaticallyBound() {
+        return (isFinal() || isPrivate() || isStatic() || holder.isFinal()) && isConcrete();
+    }
+
+    @Override
+    public byte[] getCode() {
+        if (getCodeSize() == 0) {
+            return null;
+        }
+        if (code == null && holder.isLinked()) {
+            code = runtime().getCompilerToVM().getBytecode(metaspaceMethod);
+            assert code.length == getCodeSize() : "expected: " + getCodeSize() + ", actual: " + code.length;
+        }
+        return code;
+    }
+
+    @Override
+    public int getCodeSize() {
+        return unsafe.getChar(getConstMethod() + runtime().getConfig().constMethodCodeSizeOffset);
+    }
+
+    @Override
+    public ExceptionHandler[] getExceptionHandlers() {
+        final boolean hasExceptionTable = (getConstMethodFlags() & runtime().getConfig().constMethodHasExceptionTable) != 0;
+        if (!hasExceptionTable) {
+            return new ExceptionHandler[0];
+        }
+
+        HotSpotVMConfig config = runtime().getConfig();
+        final int exceptionTableLength = runtime().getCompilerToVM().exceptionTableLength(metaspaceMethod);
+        ExceptionHandler[] handlers = new ExceptionHandler[exceptionTableLength];
+        long exceptionTableElement = runtime().getCompilerToVM().exceptionTableStart(metaspaceMethod);
+
+        for (int i = 0; i < exceptionTableLength; i++) {
+            final int startPc = unsafe.getChar(exceptionTableElement + config.exceptionTableElementStartPcOffset);
+            final int endPc = unsafe.getChar(exceptionTableElement + config.exceptionTableElementEndPcOffset);
+            final int handlerPc = unsafe.getChar(exceptionTableElement + config.exceptionTableElementHandlerPcOffset);
+            int catchTypeIndex = unsafe.getChar(exceptionTableElement + config.exceptionTableElementCatchTypeIndexOffset);
+
+            JavaType catchType;
+            if (catchTypeIndex == 0) {
+                catchType = null;
+            } else {
+                final int opcode = -1;  // opcode is not used
+                catchType = constantPool.lookupType(catchTypeIndex, opcode);
+
+                // Check for Throwable which catches everything.
+                if (catchType instanceof HotSpotResolvedObjectTypeImpl) {
+                    HotSpotResolvedObjectTypeImpl resolvedType = (HotSpotResolvedObjectTypeImpl) catchType;
+                    if (resolvedType.mirror() == Throwable.class) {
+                        catchTypeIndex = 0;
+                        catchType = null;
+                    }
+                }
+            }
+            handlers[i] = new ExceptionHandler(startPc, endPc, handlerPc, catchTypeIndex, catchType);
+
+            // Go to the next ExceptionTableElement
+            exceptionTableElement += config.exceptionTableElementSize;
+        }
+
+        return handlers;
+    }
+
+    /**
+     * Returns true if this method has a {@code CallerSensitive} annotation.
+     *
+     * @return true if CallerSensitive annotation present, false otherwise
+     */
+    public boolean isCallerSensitive() {
+        return (getFlags() & runtime().getConfig().methodFlagsCallerSensitive) != 0;
+    }
+
+    /**
+     * Returns true if this method has a {@code ForceInline} annotation.
+     *
+     * @return true if ForceInline annotation present, false otherwise
+     */
+    public boolean isForceInline() {
+        return (getFlags() & runtime().getConfig().methodFlagsForceInline) != 0;
+    }
+
+    /**
+     * Returns true if this method has a {@code DontInline} annotation.
+     *
+     * @return true if DontInline annotation present, false otherwise
+     */
+    public boolean isDontInline() {
+        return (getFlags() & runtime().getConfig().methodFlagsDontInline) != 0;
+    }
+
+    /**
+     * Manually adds a DontInline annotation to this method.
+     */
+    public void setNotInlineable() {
+        runtime().getCompilerToVM().doNotInlineOrCompile(metaspaceMethod);
+    }
+
+    /**
+     * Returns true if this method is one of the special methods that is ignored by security stack
+     * walks.
+     *
+     * @return true if special method ignored by security stack walks, false otherwise
+     */
+    public boolean ignoredBySecurityStackWalk() {
+        return runtime().getCompilerToVM().methodIsIgnoredBySecurityStackWalk(metaspaceMethod);
+    }
+
+    public boolean hasBalancedMonitors() {
+        HotSpotVMConfig config = runtime().getConfig();
+        final int modifiers = getAllModifiers();
+
+        // Method has no monitorenter/exit bytecodes.
+        if ((modifiers & config.jvmAccHasMonitorBytecodes) == 0) {
+            return false;
+        }
+
+        // Check to see if a previous compilation computed the monitor-matching analysis.
+        if ((modifiers & config.jvmAccMonitorMatch) != 0) {
+            return true;
+        }
+
+        // This either happens only once if monitors are balanced or very rarely multiple-times.
+        return runtime().getCompilerToVM().hasBalancedMonitors(metaspaceMethod);
+    }
+
+    @Override
+    public boolean isClassInitializer() {
+        return "<clinit>".equals(name) && isStatic();
+    }
+
+    @Override
+    public boolean isConstructor() {
+        return "<init>".equals(name) && !isStatic();
+    }
+
+    @Override
+    public int getMaxLocals() {
+        if (isAbstract() || isNative()) {
+            return 0;
+        }
+        HotSpotVMConfig config = runtime().getConfig();
+        return unsafe.getChar(getConstMethod() + config.methodMaxLocalsOffset);
+    }
+
+    @Override
+    public int getMaxStackSize() {
+        if (isAbstract() || isNative()) {
+            return 0;
+        }
+        HotSpotVMConfig config = runtime().getConfig();
+        return config.extraStackEntries + unsafe.getChar(getConstMethod() + config.constMethodMaxStackOffset);
+    }
+
+    @Override
+    public StackTraceElement asStackTraceElement(int bci) {
+        if (bci < 0 || bci >= getCodeSize()) {
+            // HotSpot code can only construct stack trace elements for valid bcis
+            StackTraceElement ste = runtime().getCompilerToVM().getStackTraceElement(metaspaceMethod, 0);
+            return new StackTraceElement(ste.getClassName(), ste.getMethodName(), ste.getFileName(), -1);
+        }
+        return runtime().getCompilerToVM().getStackTraceElement(metaspaceMethod, bci);
+    }
+
+    public ResolvedJavaMethod uniqueConcreteMethod(HotSpotResolvedObjectType receiver) {
+        if (receiver.isInterface()) {
+            // Cannot trust interfaces. Because of:
+            // interface I { void foo(); }
+            // class A { public void foo() {} }
+            // class B extends A implements I { }
+            // class C extends B { public void foo() { } }
+            // class D extends B { }
+            // Would lead to identify C.foo() as the unique concrete method for I.foo() without
+            // seeing A.foo().
+            return null;
+        }
+        long metaspaceKlass = ((HotSpotResolvedObjectTypeImpl) receiver).getMetaspaceKlass();
+        final long uniqueConcreteMethod = runtime().getCompilerToVM().findUniqueConcreteMethod(metaspaceKlass, metaspaceMethod);
+        if (uniqueConcreteMethod == 0) {
+            return null;
+        }
+        return fromMetaspace(uniqueConcreteMethod);
+    }
+
+    @Override
+    public HotSpotSignature getSignature() {
+        return signature;
+    }
+
+    /**
+     * Gets the value of {@code Method::_code}.
+     *
+     * @return the value of {@code Method::_code}
+     */
+    private long getCompiledCode() {
+        HotSpotVMConfig config = runtime().getConfig();
+        return unsafe.getAddress(metaspaceMethod + config.methodCodeOffset);
+    }
+
+    /**
+     * Returns whether this method has compiled code.
+     *
+     * @return true if this method has compiled code, false otherwise
+     */
+    public boolean hasCompiledCode() {
+        return getCompiledCode() != 0L;
+    }
+
+    /**
+     * @param level
+     * @return true if the currently installed code was generated at {@code level}.
+     */
+    public boolean hasCompiledCodeAtLevel(int level) {
+        long compiledCode = getCompiledCode();
+        if (compiledCode != 0) {
+            return unsafe.getInt(compiledCode + runtime().getConfig().nmethodCompLevelOffset) == level;
+        }
+        return false;
+    }
+
+    private static final String TraceMethodDataFilter = System.getProperty("graal.traceMethodDataFilter");
+
+    @Override
+    public ProfilingInfo getProfilingInfo() {
+        return getProfilingInfo(true, true);
+    }
+
+    public ProfilingInfo getCompilationProfilingInfo(boolean isOSR) {
+        return getProfilingInfo(!isOSR, isOSR);
+    }
+
+    private ProfilingInfo getProfilingInfo(boolean includeNormal, boolean includeOSR) {
+        ProfilingInfo info;
+
+        if (UseProfilingInformation.getValue() && methodData == null) {
+            long metaspaceMethodData = unsafe.getAddress(metaspaceMethod + runtime().getConfig().methodDataOffset);
+            if (metaspaceMethodData != 0) {
+                methodData = new HotSpotMethodData(metaspaceMethodData);
+                if (TraceMethodDataFilter != null && this.format("%H.%n").contains(TraceMethodDataFilter)) {
+                    TTY.println("Raw method data for " + this.format("%H.%n(%p)") + ":");
+                    TTY.println(methodData.toString());
+                }
+            }
+        }
+
+        if (methodData == null || (!methodData.hasNormalData() && !methodData.hasExtraData())) {
+            // Be optimistic and return false for exceptionSeen. A methodDataOop is allocated in
+            // case of a deoptimization.
+            info = DefaultProfilingInfo.get(TriState.FALSE);
+        } else {
+            info = new HotSpotProfilingInfo(methodData, this, includeNormal, includeOSR);
+        }
+        return info;
+    }
+
+    @Override
+    public void reprofile() {
+        runtime().getCompilerToVM().reprofile(metaspaceMethod);
+    }
+
+    @Override
+    public ConstantPool getConstantPool() {
+        return constantPool;
+    }
+
+    @Override
+    public Annotation[][] getParameterAnnotations() {
+        if (isConstructor()) {
+            Constructor<?> javaConstructor = toJavaConstructor();
+            return javaConstructor == null ? null : javaConstructor.getParameterAnnotations();
+        }
+        Method javaMethod = toJava();
+        return javaMethod == null ? null : javaMethod.getParameterAnnotations();
+    }
+
+    @Override
+    public Annotation[] getAnnotations() {
+        if (isConstructor()) {
+            Constructor<?> javaConstructor = toJavaConstructor();
+            return javaConstructor == null ? new Annotation[0] : javaConstructor.getAnnotations();
+        }
+        Method javaMethod = toJava();
+        return javaMethod == null ? new Annotation[0] : javaMethod.getAnnotations();
+    }
+
+    @Override
+    public <T extends Annotation> T getAnnotation(Class<T> annotationClass) {
+        if (isConstructor()) {
+            Constructor<?> javaConstructor = toJavaConstructor();
+            return javaConstructor == null ? null : javaConstructor.getAnnotation(annotationClass);
+        }
+        Method javaMethod = toJava();
+        return javaMethod == null ? null : javaMethod.getAnnotation(annotationClass);
+    }
+
+    @Override
+    public boolean isSynthetic() {
+        int modifiers = getAllModifiers();
+        return (runtime().getConfig().syntheticFlag & modifiers) != 0;
+    }
+
+    public boolean isDefault() {
+        if (isConstructor()) {
+            return false;
+        }
+        // Copied from java.lang.Method.isDefault()
+        int mask = Modifier.ABSTRACT | Modifier.PUBLIC | Modifier.STATIC;
+        return ((getModifiers() & mask) == Modifier.PUBLIC) && getDeclaringClass().isInterface();
+    }
+
+    @Override
+    public Type[] getGenericParameterTypes() {
+        if (isConstructor()) {
+            Constructor<?> javaConstructor = toJavaConstructor();
+            return javaConstructor == null ? null : javaConstructor.getGenericParameterTypes();
+        }
+        Method javaMethod = toJava();
+        return javaMethod == null ? null : javaMethod.getGenericParameterTypes();
+    }
+
+    public Class<?>[] signatureToTypes() {
+        Signature sig = getSignature();
+        int count = sig.getParameterCount(false);
+        Class<?>[] result = new Class<?>[count];
+        for (int i = 0; i < result.length; ++i) {
+            JavaType parameterType = sig.getParameterType(i, holder);
+            HotSpotResolvedJavaType resolvedParameterType = (HotSpotResolvedJavaType) parameterType.resolve(holder);
+            result[i] = resolvedParameterType.mirror();
+        }
+        return result;
+    }
+
+    private Method toJava() {
+        if (toJavaCache != null) {
+            return (Method) toJavaCache;
+        }
+        try {
+            Method result = holder.mirror().getDeclaredMethod(name, signatureToTypes());
+            toJavaCache = result;
+            return result;
+        } catch (NoSuchMethodException | NoClassDefFoundError e) {
+            return null;
+        }
+    }
+
+    private Constructor<?> toJavaConstructor() {
+        if (toJavaCache != null) {
+            return (Constructor<?>) toJavaCache;
+        }
+        try {
+            Constructor<?> result = holder.mirror().getDeclaredConstructor(signatureToTypes());
+            toJavaCache = result;
+            return result;
+        } catch (NoSuchMethodException | NoClassDefFoundError e) {
+            return null;
+        }
+    }
+
+    @Override
+    public boolean canBeInlined() {
+        if (isDontInline()) {
+            return false;
+        }
+        return runtime().getCompilerToVM().canInlineMethod(metaspaceMethod);
+    }
+
+    @Override
+    public boolean shouldBeInlined() {
+        if (isForceInline()) {
+            return true;
+        }
+        return runtime().getCompilerToVM().shouldInlineMethod(metaspaceMethod);
+    }
+
+    @Override
+    public LineNumberTable getLineNumberTable() {
+        final boolean hasLineNumberTable = (getConstMethodFlags() & runtime().getConfig().constMethodHasLineNumberTable) != 0;
+        if (!hasLineNumberTable) {
+            return null;
+        }
+
+        long[] values = runtime().getCompilerToVM().getLineNumberTable(metaspaceMethod);
+        if (values.length == 0) {
+            // Empty table so treat is as non-existent
+            return null;
+        }
+        assert values.length % 2 == 0;
+        int[] bci = new int[values.length / 2];
+        int[] line = new int[values.length / 2];
+
+        for (int i = 0; i < values.length / 2; i++) {
+            bci[i] = (int) values[i * 2];
+            line[i] = (int) values[i * 2 + 1];
+        }
+
+        return new LineNumberTableImpl(line, bci);
+    }
+
+    @Override
+    public LocalVariableTable getLocalVariableTable() {
+        final boolean hasLocalVariableTable = (getConstMethodFlags() & runtime().getConfig().constMethodHasLocalVariableTable) != 0;
+        if (!hasLocalVariableTable) {
+            return null;
+        }
+
+        HotSpotVMConfig config = runtime().getConfig();
+        long localVariableTableElement = runtime().getCompilerToVM().getLocalVariableTableStart(metaspaceMethod);
+        final int localVariableTableLength = runtime().getCompilerToVM().getLocalVariableTableLength(metaspaceMethod);
+        Local[] locals = new Local[localVariableTableLength];
+
+        for (int i = 0; i < localVariableTableLength; i++) {
+            final int startBci = unsafe.getChar(localVariableTableElement + config.localVariableTableElementStartBciOffset);
+            final int endBci = startBci + unsafe.getChar(localVariableTableElement + config.localVariableTableElementLengthOffset);
+            final int nameCpIndex = unsafe.getChar(localVariableTableElement + config.localVariableTableElementNameCpIndexOffset);
+            final int typeCpIndex = unsafe.getChar(localVariableTableElement + config.localVariableTableElementDescriptorCpIndexOffset);
+            final int slot = unsafe.getChar(localVariableTableElement + config.localVariableTableElementSlotOffset);
+
+            String localName = getConstantPool().lookupUtf8(nameCpIndex);
+            String localType = getConstantPool().lookupUtf8(typeCpIndex);
+
+            locals[i] = new LocalImpl(localName, runtime().lookupType(localType, holder, false), startBci, endBci, slot);
+
+            // Go to the next LocalVariableTableElement
+            localVariableTableElement += config.localVariableTableElementSize;
+        }
+
+        return new LocalVariableTableImpl(locals);
+    }
+
+    /**
+     * Returns the offset of this method into the v-table. The method must have a v-table entry as
+     * indicated by {@link #isInVirtualMethodTable(ResolvedJavaType)}, otherwise an exception is
+     * thrown.
+     *
+     * @return the offset of this method into the v-table
+     */
+    public int vtableEntryOffset(ResolvedJavaType resolved) {
+        if (!isInVirtualMethodTable(resolved)) {
+            throw new JVMCIError("%s does not have a vtable entry", this);
+        }
+        HotSpotVMConfig config = runtime().getConfig();
+        final int vtableIndex = getVtableIndex((HotSpotResolvedObjectTypeImpl) resolved);
+        return config.instanceKlassVtableStartOffset + vtableIndex * config.vtableEntrySize + config.vtableEntryMethodOffset;
+    }
+
+    @Override
+    public boolean isInVirtualMethodTable(ResolvedJavaType resolved) {
+        if (resolved instanceof HotSpotResolvedObjectTypeImpl) {
+            HotSpotResolvedObjectTypeImpl hotspotResolved = (HotSpotResolvedObjectTypeImpl) resolved;
+            int vtableIndex = getVtableIndex(hotspotResolved);
+            return vtableIndex >= 0 && vtableIndex < hotspotResolved.getVtableLength();
+        }
+        return false;
+    }
+
+    private int getVtableIndex(HotSpotResolvedObjectTypeImpl resolved) {
+        if (!holder.isLinked()) {
+            return runtime().getConfig().invalidVtableIndex;
+        }
+        if (holder.isInterface()) {
+            if (resolved.isInterface()) {
+                return runtime().getConfig().invalidVtableIndex;
+            }
+            return getVtableIndexForInterface(resolved);
+        }
+        return getVtableIndex();
+    }
+
+    /**
+     * Returns this method's virtual table index.
+     *
+     * @return virtual table index
+     */
+    private int getVtableIndex() {
+        assert !holder.isInterface();
+        HotSpotVMConfig config = runtime().getConfig();
+        int result = unsafe.getInt(metaspaceMethod + config.methodVtableIndexOffset);
+        assert result >= config.nonvirtualVtableIndex : "must be linked";
+        return result;
+    }
+
+    private int getVtableIndexForInterface(ResolvedJavaType resolved) {
+        HotSpotResolvedObjectTypeImpl hotspotType = (HotSpotResolvedObjectTypeImpl) resolved;
+        return runtime().getCompilerToVM().getVtableIndexForInterface(hotspotType.getMetaspaceKlass(), getMetaspaceMethod());
+    }
+
+    /**
+     * The {@link SpeculationLog} for methods compiled by Graal hang off this per-declaring-type
+     * {@link ClassValue}. The raw Method* value is safe to use as a key in the map as a) it is
+     * never moves and b) we never read from it.
+     * <p>
+     * One implication is that we will preserve {@link SpeculationLog}s for methods that have been
+     * redefined via class redefinition. It's tempting to periodically flush such logs but we cannot
+     * read the JVM_ACC_IS_OBSOLETE bit (or anything else) via the raw pointer as obsoleted methods
+     * are subject to clean up and deletion (see InstanceKlass::purge_previous_versions_internal).
+     */
+    private static final ClassValue<Map<Long, SpeculationLog>> SpeculationLogs = new ClassValue<Map<Long, SpeculationLog>>() {
+        @Override
+        protected Map<Long, SpeculationLog> computeValue(java.lang.Class<?> type) {
+            return new HashMap<>(4);
+        }
+    };
+
+    public SpeculationLog getSpeculationLog() {
+        Map<Long, SpeculationLog> map = SpeculationLogs.get(holder.mirror());
+        synchronized (map) {
+            SpeculationLog log = map.get(this.metaspaceMethod);
+            if (log == null) {
+                log = new HotSpotSpeculationLog();
+                map.put(metaspaceMethod, log);
+            }
+            return log;
+        }
+    }
+
+    public int intrinsicId() {
+        HotSpotVMConfig config = runtime().getConfig();
+        return unsafe.getByte(metaspaceMethod + config.methodIntrinsicIdOffset) & 0xff;
+    }
+
+    @Override
+    public JavaConstant invoke(JavaConstant receiver, JavaConstant[] arguments) {
+        assert !isConstructor();
+        Method javaMethod = toJava();
+        javaMethod.setAccessible(true);
+
+        Object[] objArguments = new Object[arguments.length];
+        for (int i = 0; i < arguments.length; i++) {
+            objArguments[i] = HotSpotObjectConstantImpl.asBoxedValue(arguments[i]);
+        }
+        Object objReceiver = receiver != null && !receiver.isNull() ? ((HotSpotObjectConstantImpl) receiver).object() : null;
+
+        try {
+            Object objResult = javaMethod.invoke(objReceiver, objArguments);
+            return javaMethod.getReturnType() == void.class ? null : HotSpotObjectConstantImpl.forBoxedValue(getSignature().getReturnKind(), objResult);
+
+        } catch (IllegalAccessException | InvocationTargetException ex) {
+            throw new IllegalArgumentException(ex);
+        }
+    }
+
+    /**
+     * Allocates a compile id for this method by asking the VM for one.
+     *
+     * @param entryBCI entry bci
+     * @return compile id
+     */
+    public int allocateCompileId(int entryBCI) {
+        return runtime().getCompilerToVM().allocateCompileId(metaspaceMethod, entryBCI);
+    }
+
+    public boolean hasCodeAtLevel(int entryBCI, int level) {
+        if (entryBCI == runtime().getConfig().invocationEntryBci) {
+            return hasCompiledCodeAtLevel(level);
+        }
+        return runtime().getCompilerToVM().hasCompiledCodeForOSR(metaspaceMethod, entryBCI, level);
+    }
+
+    private int methodId;
+
+    public void setMethodId(int id) {
+        assert methodId == 0;
+        methodId = id;
+    }
+
+    public int getMethodId() {
+        return methodId;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotResolvedJavaType.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.hotspot;
+
+import static com.oracle.jvmci.hotspot.HotSpotJVMCIRuntime.*;
+
+import com.oracle.jvmci.meta.*;
+
+public abstract class HotSpotResolvedJavaType extends HotSpotJavaType implements ResolvedJavaType {
+
+    /**
+     * Gets the Graal mirror for a {@link Class} object.
+     *
+     * @return the {@link HotSpotResolvedJavaType} corresponding to {@code javaClass}
+     */
+    public static ResolvedJavaType fromClass(Class<?> javaClass) {
+        return runtime().fromClass(javaClass);
+    }
+
+    public HotSpotResolvedJavaType(String name) {
+        super(name);
+    }
+
+    public abstract Class<?> mirror();
+
+    @Override
+    public final boolean equals(Object obj) {
+        if (!(obj instanceof HotSpotResolvedJavaType)) {
+            return false;
+        }
+        HotSpotResolvedJavaType that = (HotSpotResolvedJavaType) obj;
+        return this.mirror().equals(that.mirror());
+    }
+
+    @Override
+    public final int hashCode() {
+        return getName().hashCode();
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotResolvedObjectType.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2011, 2015, 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.jvmci.hotspot;
+
+import com.oracle.jvmci.meta.Assumptions.AssumptionResult;
+import com.oracle.jvmci.meta.*;
+
+/**
+ * Implementation of {@link JavaType} for resolved non-primitive HotSpot classes.
+ */
+public interface HotSpotResolvedObjectType extends ResolvedJavaType {
+
+    HotSpotResolvedObjectType getArrayClass();
+
+    ResolvedJavaType getComponentType();
+
+    AssumptionResult<ResolvedJavaType> findLeafConcreteSubtype();
+
+    HotSpotResolvedObjectType getSuperclass();
+
+    HotSpotResolvedObjectType[] getInterfaces();
+
+    HotSpotResolvedObjectType getSupertype();
+
+    HotSpotResolvedObjectType findLeastCommonAncestor(ResolvedJavaType otherType);
+
+    HotSpotResolvedObjectType asExactType();
+
+    default boolean isPrimitive() {
+        return false;
+    }
+
+    default Kind getKind() {
+        return Kind.Object;
+    }
+
+    ConstantPool constantPool();
+
+    /**
+     * Gets the instance size of this type. If an instance of this type cannot be fast path
+     * allocated, then the returned value is negative (its absolute value gives the size). Must not
+     * be called if this is an array or interface type.
+     */
+    int instanceSize();
+
+    int getVtableLength();
+
+    @Override
+    AssumptionResult<ResolvedJavaMethod> findUniqueConcreteMethod(ResolvedJavaMethod method);
+
+    /**
+     * Performs a fast-path check that this type is resolved in the context of a given accessing
+     * class. A negative result does not mean this type is not resolved with respect to
+     * {@code accessingClass}. That can only be determined by
+     * {@linkplain HotSpotJVMCIRuntime#lookupType(String, HotSpotResolvedObjectType, boolean)
+     * re-resolving} the type.
+     */
+    boolean isDefinitelyResolvedWithRespectTo(ResolvedJavaType accessingClass);
+
+    /**
+     * Gets the metaspace Klass boxed in a {@link JavaConstant}.
+     */
+    Constant klass();
+
+    boolean isPrimaryType();
+
+    int superCheckOffset();
+
+    long prototypeMarkWord();
+
+    HotSpotResolvedObjectType getEnclosingType();
+
+    ResolvedJavaMethod getClassInitializer();
+
+    ResolvedJavaField createField(String name, JavaType type, long offset, int modifiers);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotResolvedObjectTypeImpl.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,902 @@
+/*
+ * Copyright (c) 2011, 2015, 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.jvmci.hotspot;
+
+import static com.oracle.jvmci.common.UnsafeAccess.*;
+import static com.oracle.jvmci.hotspot.HotSpotJVMCIRuntime.*;
+import static java.util.Objects.*;
+
+import java.lang.annotation.*;
+import java.lang.reflect.*;
+import java.net.*;
+import java.nio.*;
+import java.util.*;
+
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.meta.Assumptions.AssumptionResult;
+import com.oracle.jvmci.meta.Assumptions.ConcreteMethod;
+import com.oracle.jvmci.meta.Assumptions.ConcreteSubtype;
+import com.oracle.jvmci.meta.Assumptions.LeafType;
+import com.oracle.jvmci.meta.Assumptions.NoFinalizableSubclass;
+import com.oracle.jvmci.meta.*;
+
+/**
+ * Implementation of {@link JavaType} for resolved non-primitive HotSpot classes.
+ */
+public final class HotSpotResolvedObjectTypeImpl extends HotSpotResolvedJavaType implements HotSpotResolvedObjectType, HotSpotProxified {
+
+    /**
+     * The Java class this type represents.
+     */
+    private final Class<?> javaClass;
+
+    private HashMap<Long, HotSpotResolvedJavaField> fieldCache;
+    private HashMap<Long, HotSpotResolvedJavaMethod> methodCache;
+    private HotSpotResolvedJavaField[] instanceFields;
+    private HotSpotResolvedObjectTypeImpl[] interfaces;
+    private ConstantPool constantPool;
+    private HotSpotResolvedObjectType arrayOfType;
+
+    /**
+     * Gets the Graal mirror for a {@link Class} object.
+     *
+     * @return the {@link HotSpotResolvedJavaType} corresponding to {@code javaClass}
+     */
+    public static HotSpotResolvedObjectTypeImpl fromObjectClass(Class<?> javaClass) {
+        return (HotSpotResolvedObjectTypeImpl) runtime().fromClass(javaClass);
+    }
+
+    /**
+     * Gets the Graal mirror from a HotSpot metaspace Klass native object.
+     *
+     * @param metaspaceKlass a metaspace Klass object
+     * @return the {@link ResolvedJavaType} corresponding to {@code metaspaceKlass}
+     */
+    public static HotSpotResolvedObjectTypeImpl fromMetaspaceKlass(long metaspaceKlass) {
+        assert metaspaceKlass != 0;
+        Class<?> javaClass = runtime().getCompilerToVM().getJavaMirror(metaspaceKlass);
+        assert javaClass != null;
+        return fromObjectClass(javaClass);
+    }
+
+    /**
+     * Creates the Graal mirror for a {@link Class} object.
+     *
+     * <p>
+     * <b>NOTE</b>: Creating an instance of this class does not install the mirror for the
+     * {@link Class} type. Use {@link #fromObjectClass(Class)} or {@link #fromMetaspaceKlass(long)}
+     * instead.
+     * </p>
+     *
+     * @param javaClass the Class to create the mirror for
+     */
+    public HotSpotResolvedObjectTypeImpl(Class<?> javaClass) {
+        super(getSignatureName(javaClass));
+        this.javaClass = javaClass;
+        assert getName().charAt(0) != '[' || isArray() : getName();
+    }
+
+    /**
+     * Returns the name of this type as it would appear in a signature.
+     */
+    private static String getSignatureName(Class<?> javaClass) {
+        if (javaClass.isArray()) {
+            return javaClass.getName().replace('.', '/');
+        }
+        return "L" + javaClass.getName().replace('.', '/') + ";";
+    }
+
+    /**
+     * Gets the metaspace Klass for this type.
+     */
+    public long getMetaspaceKlass() {
+        if (HotSpotJVMCIRuntime.getHostWordKind() == Kind.Long) {
+            return unsafe.getLong(javaClass, (long) runtime().getConfig().klassOffset);
+        }
+        return unsafe.getInt(javaClass, (long) runtime().getConfig().klassOffset) & 0xFFFFFFFFL;
+    }
+
+    @Override
+    public int getModifiers() {
+        return mirror().getModifiers();
+    }
+
+    public int getAccessFlags() {
+        HotSpotVMConfig config = runtime().getConfig();
+        return unsafe.getInt(getMetaspaceKlass() + config.klassAccessFlagsOffset);
+    }
+
+    @Override
+    public HotSpotResolvedObjectType getArrayClass() {
+        if (arrayOfType == null) {
+            arrayOfType = fromObjectClass(Array.newInstance(mirror(), 0).getClass());
+        }
+        return arrayOfType;
+    }
+
+    @Override
+    public ResolvedJavaType getComponentType() {
+        Class<?> javaComponentType = mirror().getComponentType();
+        return javaComponentType == null ? null : fromClass(javaComponentType);
+    }
+
+    @Override
+    public AssumptionResult<ResolvedJavaType> findLeafConcreteSubtype() {
+        HotSpotVMConfig config = runtime().getConfig();
+        if (isArray()) {
+            return getElementalType().isFinal() ? new AssumptionResult<>(this) : null;
+        } else if (isInterface()) {
+            HotSpotResolvedObjectTypeImpl implementor = getSingleImplementor();
+            /*
+             * If the implementor field contains itself that indicates that the interface has more
+             * than one implementors (see: InstanceKlass::add_implementor).
+             */
+            if (implementor == null || implementor.equals(this)) {
+                return null;
+            }
+
+            assert !implementor.isInterface();
+            if (implementor.isAbstract() || !implementor.isLeafClass()) {
+                AssumptionResult<ResolvedJavaType> leafConcreteSubtype = implementor.findLeafConcreteSubtype();
+                if (leafConcreteSubtype != null) {
+                    assert !leafConcreteSubtype.getResult().equals(implementor);
+                    AssumptionResult<ResolvedJavaType> newResult = new AssumptionResult<>(leafConcreteSubtype.getResult(), new ConcreteSubtype(this, implementor));
+                    // Accumulate leaf assumptions and return the combined result.
+                    newResult.add(leafConcreteSubtype);
+                    return newResult;
+                }
+                return null;
+            }
+
+            return new AssumptionResult<>(implementor, new LeafType(implementor), new ConcreteSubtype(this, implementor));
+        } else {
+            HotSpotResolvedObjectTypeImpl type = this;
+            while (type.isAbstract()) {
+                long subklass = type.getSubklass();
+                if (subklass == 0 || unsafe.getAddress(subklass + config.nextSiblingOffset) != 0) {
+                    return null;
+                }
+                type = fromMetaspaceKlass(subklass);
+            }
+            if (type.isAbstract() || type.isInterface() || !type.isLeafClass()) {
+                return null;
+            }
+            if (this.isAbstract()) {
+                return new AssumptionResult<>(type, new LeafType(type), new ConcreteSubtype(this, type));
+            } else {
+                assert this.equals(type);
+                return new AssumptionResult<>(type, new LeafType(type));
+            }
+        }
+    }
+
+    /**
+     * Returns if type {@code type} is a leaf class. This is the case if the
+     * {@code Klass::_subklass} field of the underlying class is zero.
+     *
+     * @return true if the type is a leaf class
+     */
+    private boolean isLeafClass() {
+        return getSubklass() == 0;
+    }
+
+    /**
+     * Returns the {@code Klass::_subklass} field of the underlying metaspace klass for the given
+     * type {@code type}.
+     *
+     * @return value of the subklass field as metaspace klass pointer
+     */
+    private long getSubklass() {
+        return unsafe.getAddress(getMetaspaceKlass() + runtime().getConfig().subklassOffset);
+    }
+
+    @Override
+    public HotSpotResolvedObjectTypeImpl getSuperclass() {
+        Class<?> javaSuperclass = mirror().getSuperclass();
+        return javaSuperclass == null ? null : (HotSpotResolvedObjectTypeImpl) fromObjectClass(javaSuperclass);
+    }
+
+    @Override
+    public HotSpotResolvedObjectTypeImpl[] getInterfaces() {
+        if (interfaces == null) {
+            Class<?>[] javaInterfaces = mirror().getInterfaces();
+            HotSpotResolvedObjectTypeImpl[] result = new HotSpotResolvedObjectTypeImpl[javaInterfaces.length];
+            for (int i = 0; i < javaInterfaces.length; i++) {
+                result[i] = fromObjectClass(javaInterfaces[i]);
+            }
+            interfaces = result;
+        }
+        return interfaces;
+    }
+
+    @Override
+    public HotSpotResolvedObjectTypeImpl getSingleImplementor() {
+        if (!isInterface()) {
+            throw new JVMCIError("Cannot call getSingleImplementor() on a non-interface type: %s", this);
+        }
+        final long implementorMetaspaceKlass = runtime().getCompilerToVM().getKlassImplementor(getMetaspaceKlass());
+
+        // No implementor.
+        if (implementorMetaspaceKlass == 0) {
+            return null;
+        }
+
+        return fromMetaspaceKlass(implementorMetaspaceKlass);
+    }
+
+    public HotSpotResolvedObjectTypeImpl getSupertype() {
+        if (isArray()) {
+            ResolvedJavaType componentType = getComponentType();
+            if (mirror() == Object[].class || componentType.isPrimitive()) {
+                return fromObjectClass(Object.class);
+            }
+            return (HotSpotResolvedObjectTypeImpl) ((HotSpotResolvedObjectTypeImpl) componentType).getSupertype().getArrayClass();
+        }
+        if (isInterface()) {
+            return fromObjectClass(Object.class);
+        }
+        return getSuperclass();
+    }
+
+    @Override
+    public HotSpotResolvedObjectType findLeastCommonAncestor(ResolvedJavaType otherType) {
+        if (otherType.isPrimitive()) {
+            return null;
+        } else {
+            HotSpotResolvedObjectTypeImpl t1 = this;
+            HotSpotResolvedObjectTypeImpl t2 = (HotSpotResolvedObjectTypeImpl) otherType;
+            while (true) {
+                if (t1.isAssignableFrom(t2)) {
+                    return t1;
+                }
+                if (t2.isAssignableFrom(t1)) {
+                    return t2;
+                }
+                t1 = t1.getSupertype();
+                t2 = t2.getSupertype();
+            }
+        }
+    }
+
+    @Override
+    public HotSpotResolvedObjectType asExactType() {
+        if (isArray()) {
+            return getComponentType().asExactType() != null ? this : null;
+        }
+        return isFinal() ? this : null;
+    }
+
+    @Override
+    public JavaConstant getJavaClass() {
+        return HotSpotObjectConstantImpl.forObject(mirror());
+    }
+
+    @Override
+    public JavaConstant getObjectHub() {
+        return klass();
+    }
+
+    @Override
+    public AssumptionResult<Boolean> hasFinalizableSubclass() {
+        assert !isArray();
+        if (!runtime().getCompilerToVM().hasFinalizableSubclass(getMetaspaceKlass())) {
+            return new AssumptionResult<>(false, new NoFinalizableSubclass(this));
+        }
+        return new AssumptionResult<>(true);
+    }
+
+    @Override
+    public boolean hasFinalizer() {
+        HotSpotVMConfig config = runtime().getConfig();
+        return (getAccessFlags() & config.klassHasFinalizerFlag) != 0;
+    }
+
+    @Override
+    public boolean isPrimitive() {
+        return false;
+    }
+
+    @Override
+    public boolean isArray() {
+        return mirror().isArray();
+    }
+
+    @Override
+    public boolean isInitialized() {
+        return isArray() ? true : getInitState() == runtime().getConfig().instanceKlassStateFullyInitialized;
+    }
+
+    @Override
+    public boolean isLinked() {
+        return isArray() ? true : getInitState() >= runtime().getConfig().instanceKlassStateLinked;
+    }
+
+    /**
+     * Returns the value of the state field {@code InstanceKlass::_init_state} of the metaspace
+     * klass.
+     *
+     * @return state field value of this type
+     */
+    private int getInitState() {
+        assert !isArray() : "_init_state only exists in InstanceKlass";
+        return unsafe.getByte(getMetaspaceKlass() + runtime().getConfig().instanceKlassInitStateOffset) & 0xFF;
+    }
+
+    @Override
+    public void initialize() {
+        if (!isInitialized()) {
+            unsafe.ensureClassInitialized(mirror());
+            assert isInitialized();
+        }
+    }
+
+    @Override
+    public boolean isInstance(JavaConstant obj) {
+        if (obj.getKind() == Kind.Object && !obj.isNull()) {
+            return mirror().isInstance(((HotSpotObjectConstantImpl) obj).object());
+        }
+        return false;
+    }
+
+    @Override
+    public boolean isInstanceClass() {
+        return !isArray() && !isInterface();
+    }
+
+    @Override
+    public boolean isInterface() {
+        return mirror().isInterface();
+    }
+
+    @Override
+    public boolean isAssignableFrom(ResolvedJavaType other) {
+        assert other != null;
+        if (other instanceof HotSpotResolvedObjectTypeImpl) {
+            HotSpotResolvedObjectTypeImpl otherType = (HotSpotResolvedObjectTypeImpl) other;
+            return mirror().isAssignableFrom(otherType.mirror());
+        }
+        return false;
+    }
+
+    @Override
+    public boolean isJavaLangObject() {
+        return javaClass.equals(Object.class);
+    }
+
+    @Override
+    public Kind getKind() {
+        return Kind.Object;
+    }
+
+    @Override
+    public ResolvedJavaMethod resolveConcreteMethod(ResolvedJavaMethod method, ResolvedJavaType callerType) {
+        ResolvedJavaMethod resolvedMethod = resolveMethod(method, callerType, true);
+        if (resolvedMethod == null || resolvedMethod.isAbstract()) {
+            return null;
+        }
+        return resolvedMethod;
+    }
+
+    @Override
+    public ResolvedJavaMethod resolveMethod(ResolvedJavaMethod method, ResolvedJavaType callerType, boolean includeAbstract) {
+        if (!includeAbstract) {
+            return resolveConcreteMethod(method, callerType);
+        }
+        assert !callerType.isArray();
+        if (method.isConcrete() && method.getDeclaringClass().equals(this) && method.isPublic()) {
+            return method;
+        }
+        if (!method.getDeclaringClass().isAssignableFrom(this)) {
+            return null;
+        }
+        HotSpotResolvedJavaMethodImpl hotSpotMethod = (HotSpotResolvedJavaMethodImpl) method;
+        HotSpotResolvedObjectTypeImpl hotSpotCallerType = (HotSpotResolvedObjectTypeImpl) callerType;
+        final long resolvedMetaspaceMethod = runtime().getCompilerToVM().resolveMethod(getMetaspaceKlass(), hotSpotMethod.getMetaspaceMethod(), hotSpotCallerType.getMetaspaceKlass());
+        if (resolvedMetaspaceMethod == 0) {
+            return null;
+        }
+        return HotSpotResolvedJavaMethodImpl.fromMetaspace(resolvedMetaspaceMethod);
+    }
+
+    public ConstantPool constantPool() {
+        if (constantPool == null) {
+            final long metaspaceConstantPool = unsafe.getAddress(getMetaspaceKlass() + runtime().getConfig().instanceKlassConstantsOffset);
+            constantPool = new HotSpotConstantPool(metaspaceConstantPool);
+        }
+        return constantPool;
+    }
+
+    /**
+     * Gets the instance size of this type. If an instance of this type cannot be fast path
+     * allocated, then the returned value is negative (its absolute value gives the size). Must not
+     * be called if this is an array or interface type.
+     */
+    public int instanceSize() {
+        assert !isArray();
+        assert !isInterface();
+
+        HotSpotVMConfig config = runtime().getConfig();
+        final int layoutHelper = unsafe.getInt(getMetaspaceKlass() + config.klassLayoutHelperOffset);
+        assert layoutHelper > config.klassLayoutHelperNeutralValue : "must be instance";
+
+        // See: Klass::layout_helper_size_in_bytes
+        int size = layoutHelper & ~config.klassLayoutHelperInstanceSlowPathBit;
+
+        // See: Klass::layout_helper_needs_slow_path
+        boolean needsSlowPath = (layoutHelper & config.klassLayoutHelperInstanceSlowPathBit) != 0;
+
+        return needsSlowPath ? -size : size;
+    }
+
+    public synchronized HotSpotResolvedJavaMethod createMethod(long metaspaceMethod) {
+        HotSpotResolvedJavaMethod method = null;
+        if (methodCache == null) {
+            methodCache = new HashMap<>(8);
+        } else {
+            method = methodCache.get(metaspaceMethod);
+        }
+        if (method == null) {
+            method = new HotSpotResolvedJavaMethodImpl(this, metaspaceMethod);
+            methodCache.put(metaspaceMethod, method);
+        }
+        return method;
+    }
+
+    public int getVtableLength() {
+        HotSpotVMConfig config = runtime().getConfig();
+        if (isInterface() || isArray()) {
+            /* Everything has the core vtable of java.lang.Object */
+            return config.baseVtableLength;
+        }
+        int result = unsafe.getInt(getMetaspaceKlass() + config.instanceKlassVtableLengthOffset) / (config.vtableEntrySize / config.heapWordSize);
+        assert result >= config.baseVtableLength : unsafe.getInt(getMetaspaceKlass() + config.instanceKlassVtableLengthOffset) + " " + config.vtableEntrySize;
+        return result;
+    }
+
+    /**
+     * Gets the mask used to filter out HotSpot internal flags for fields when a {@link Field}
+     * object is created. This is the value of {@code JVM_RECOGNIZED_FIELD_MODIFIERS} in
+     * {@code jvm.h}, <b>not</b> {@link Modifier#fieldModifiers()}.
+     */
+    public static int getReflectionFieldModifiers() {
+        return runtime().getConfig().recognizedFieldModifiers;
+    }
+
+    public synchronized HotSpotResolvedJavaField createField(String fieldName, JavaType type, long offset, int rawFlags) {
+        HotSpotResolvedJavaField result = null;
+
+        final int flags = rawFlags & getReflectionFieldModifiers();
+
+        final long id = offset + ((long) flags << 32);
+
+        // (thomaswue) Must cache the fields, because the local load elimination only works if the
+        // objects from two field lookups are identical.
+        if (fieldCache == null) {
+            fieldCache = new HashMap<>(8);
+        } else {
+            result = fieldCache.get(id);
+        }
+
+        if (result == null) {
+            result = new HotSpotResolvedJavaFieldImpl(this, fieldName, type, offset, rawFlags);
+            fieldCache.put(id, result);
+        } else {
+            assert result.getName().equals(fieldName);
+            // assert result.getType().equals(type);
+            assert result.offset() == offset;
+            assert result.getModifiers() == flags;
+        }
+
+        return result;
+    }
+
+    @Override
+    public AssumptionResult<ResolvedJavaMethod> findUniqueConcreteMethod(ResolvedJavaMethod method) {
+        HotSpotResolvedJavaMethod hmethod = (HotSpotResolvedJavaMethod) method;
+        HotSpotResolvedObjectType declaredHolder = hmethod.getDeclaringClass();
+        /*
+         * Sometimes the receiver type in the graph hasn't stabilized to a subtype of declared
+         * holder, usually because of phis, so make sure that the type is related to the declared
+         * type before using it for lookup. Unlinked types should also be ignored because we can't
+         * resolve the proper method to invoke. Generally unlinked types in invokes should result in
+         * a deopt instead since they can't really be used if they aren't linked yet.
+         */
+        if (!declaredHolder.isAssignableFrom(this) || this.isArray() || this.equals(declaredHolder) || !isLinked() || isInterface()) {
+            ResolvedJavaMethod result = hmethod.uniqueConcreteMethod(declaredHolder);
+            if (result != null) {
+                return new AssumptionResult<>(result, new ConcreteMethod(method, declaredHolder, result));
+            }
+            return null;
+        }
+        /*
+         * The holder may be a subtype of the declaredHolder so make sure to resolve the method to
+         * the correct method for the subtype.
+         */
+        HotSpotResolvedJavaMethod resolvedMethod = (HotSpotResolvedJavaMethod) resolveMethod(hmethod, this, true);
+        if (resolvedMethod == null) {
+            // The type isn't known to implement the method.
+            return null;
+        }
+
+        ResolvedJavaMethod result = resolvedMethod.uniqueConcreteMethod(this);
+        if (result != null) {
+            return new AssumptionResult<>(result, new ConcreteMethod(method, this, result));
+        }
+        return null;
+    }
+
+    /**
+     * This class represents the field information for one field contained in the fields array of an
+     * {@code InstanceKlass}. The implementation is similar to the native {@code FieldInfo} class.
+     */
+    private class FieldInfo {
+        /**
+         * Native pointer into the array of Java shorts.
+         */
+        private final long metaspaceData;
+
+        /**
+         * Creates a field info for the field in the fields array at index {@code index}.
+         *
+         * @param index index to the fields array
+         */
+        public FieldInfo(int index) {
+            HotSpotVMConfig config = runtime().getConfig();
+            // Get Klass::_fields
+            final long metaspaceFields = unsafe.getAddress(getMetaspaceKlass() + config.instanceKlassFieldsOffset);
+            assert config.fieldInfoFieldSlots == 6 : "revisit the field parsing code";
+            metaspaceData = metaspaceFields + config.arrayU2DataOffset + config.fieldInfoFieldSlots * Short.BYTES * index;
+        }
+
+        private int getAccessFlags() {
+            return readFieldSlot(runtime().getConfig().fieldInfoAccessFlagsOffset);
+        }
+
+        private int getNameIndex() {
+            return readFieldSlot(runtime().getConfig().fieldInfoNameIndexOffset);
+        }
+
+        private int getSignatureIndex() {
+            return readFieldSlot(runtime().getConfig().fieldInfoSignatureIndexOffset);
+        }
+
+        public int getOffset() {
+            HotSpotVMConfig config = runtime().getConfig();
+            final int lowPacked = readFieldSlot(config.fieldInfoLowPackedOffset);
+            final int highPacked = readFieldSlot(config.fieldInfoHighPackedOffset);
+            final int offset = ((highPacked << Short.SIZE) | lowPacked) >> config.fieldInfoTagSize;
+            return offset;
+        }
+
+        /**
+         * Helper method to read an entry (slot) from the field array. Currently field info is laid
+         * on top an array of Java shorts.
+         */
+        private int readFieldSlot(int index) {
+            return unsafe.getChar(metaspaceData + Short.BYTES * index);
+        }
+
+        /**
+         * Returns the name of this field as a {@link String}. If the field is an internal field the
+         * name index is pointing into the vmSymbols table.
+         */
+        public String getName() {
+            final int nameIndex = getNameIndex();
+            return isInternal() ? HotSpotVmSymbols.symbolAt(nameIndex) : constantPool().lookupUtf8(nameIndex);
+        }
+
+        /**
+         * Returns the signature of this field as {@link String}. If the field is an internal field
+         * the signature index is pointing into the vmSymbols table.
+         */
+        public String getSignature() {
+            final int signatureIndex = getSignatureIndex();
+            return isInternal() ? HotSpotVmSymbols.symbolAt(signatureIndex) : constantPool().lookupUtf8(signatureIndex);
+        }
+
+        public JavaType getType() {
+            String signature = getSignature();
+            return runtime().lookupType(signature, HotSpotResolvedObjectTypeImpl.this, false);
+        }
+
+        private boolean isInternal() {
+            return (getAccessFlags() & runtime().getConfig().jvmAccFieldInternal) != 0;
+        }
+
+        public boolean isStatic() {
+            return Modifier.isStatic(getAccessFlags());
+        }
+
+        public boolean hasGenericSignature() {
+            return (getAccessFlags() & runtime().getConfig().jvmAccFieldHasGenericSignature) != 0;
+        }
+    }
+
+    private static class OffsetComparator implements java.util.Comparator<HotSpotResolvedJavaField> {
+        @Override
+        public int compare(HotSpotResolvedJavaField o1, HotSpotResolvedJavaField o2) {
+            return o1.offset() - o2.offset();
+        }
+    }
+
+    @Override
+    public ResolvedJavaField[] getInstanceFields(boolean includeSuperclasses) {
+        if (instanceFields == null) {
+            if (isArray() || isInterface()) {
+                instanceFields = new HotSpotResolvedJavaField[0];
+            } else {
+                final int fieldCount = getFieldCount();
+                ArrayList<HotSpotResolvedJavaField> fieldsArray = new ArrayList<>(fieldCount);
+
+                for (int i = 0; i < fieldCount; i++) {
+                    FieldInfo field = new FieldInfo(i);
+
+                    // We are only interested in instance fields.
+                    if (!field.isStatic()) {
+                        HotSpotResolvedJavaField resolvedJavaField = createField(field.getName(), field.getType(), field.getOffset(), field.getAccessFlags());
+                        fieldsArray.add(resolvedJavaField);
+                    }
+                }
+
+                fieldsArray.sort(new OffsetComparator());
+
+                HotSpotResolvedJavaField[] myFields = fieldsArray.toArray(new HotSpotResolvedJavaField[0]);
+
+                if (mirror() != Object.class) {
+                    HotSpotResolvedJavaField[] superFields = (HotSpotResolvedJavaField[]) getSuperclass().getInstanceFields(true);
+                    HotSpotResolvedJavaField[] fields = Arrays.copyOf(superFields, superFields.length + myFields.length);
+                    System.arraycopy(myFields, 0, fields, superFields.length, myFields.length);
+                    instanceFields = fields;
+                } else {
+                    assert myFields.length == 0 : "java.lang.Object has fields!";
+                    instanceFields = myFields;
+                }
+
+            }
+        }
+        if (!includeSuperclasses) {
+            int myFieldsStart = 0;
+            while (myFieldsStart < instanceFields.length && !instanceFields[myFieldsStart].getDeclaringClass().equals(this)) {
+                myFieldsStart++;
+            }
+            if (myFieldsStart == 0) {
+                return instanceFields;
+            }
+            if (myFieldsStart == instanceFields.length) {
+                return new HotSpotResolvedJavaField[0];
+            }
+            return Arrays.copyOfRange(instanceFields, myFieldsStart, instanceFields.length);
+        }
+        return instanceFields;
+    }
+
+    @Override
+    public ResolvedJavaField[] getStaticFields() {
+        if (isArray()) {
+            return new HotSpotResolvedJavaField[0];
+        } else {
+            final int fieldCount = getFieldCount();
+            ArrayList<HotSpotResolvedJavaField> fieldsArray = new ArrayList<>(fieldCount);
+
+            for (int i = 0; i < fieldCount; i++) {
+                FieldInfo field = new FieldInfo(i);
+
+                // We are only interested in static fields.
+                if (field.isStatic()) {
+                    HotSpotResolvedJavaField resolvedJavaField = createField(field.getName(), field.getType(), field.getOffset(), field.getAccessFlags());
+                    fieldsArray.add(resolvedJavaField);
+                }
+            }
+
+            fieldsArray.sort(new OffsetComparator());
+            return fieldsArray.toArray(new HotSpotResolvedJavaField[fieldsArray.size()]);
+        }
+    }
+
+    /**
+     * Returns the actual field count of this class's internal {@code InstanceKlass::_fields} array
+     * by walking the array and discounting the generic signature slots at the end of the array.
+     *
+     * <p>
+     * See {@code FieldStreamBase::init_generic_signature_start_slot}
+     */
+    private int getFieldCount() {
+        HotSpotVMConfig config = runtime().getConfig();
+        final long metaspaceFields = unsafe.getAddress(getMetaspaceKlass() + config.instanceKlassFieldsOffset);
+        int metaspaceFieldsLength = unsafe.getInt(metaspaceFields + config.arrayU1LengthOffset);
+        int fieldCount = 0;
+
+        for (int i = 0, index = 0; i < metaspaceFieldsLength; i += config.fieldInfoFieldSlots, index++) {
+            FieldInfo field = new FieldInfo(index);
+            if (field.hasGenericSignature()) {
+                metaspaceFieldsLength--;
+            }
+            fieldCount++;
+        }
+        return fieldCount;
+    }
+
+    @Override
+    public Class<?> mirror() {
+        return javaClass;
+    }
+
+    @Override
+    public String getSourceFileName() {
+        HotSpotVMConfig config = runtime().getConfig();
+        final int sourceFileNameIndex = unsafe.getChar(getMetaspaceKlass() + config.instanceKlassSourceFileNameIndexOffset);
+        if (sourceFileNameIndex == 0) {
+            return null;
+        }
+        return constantPool().lookupUtf8(sourceFileNameIndex);
+    }
+
+    @Override
+    public <T extends Annotation> T getAnnotation(Class<T> annotationClass) {
+        return mirror().getAnnotation(annotationClass);
+    }
+
+    /**
+     * Performs a fast-path check that this type is resolved in the context of a given accessing
+     * class. A negative result does not mean this type is not resolved with respect to
+     * {@code accessingClass}. That can only be determined by
+     * {@linkplain HotSpotJVMCIRuntime#lookupType(String, HotSpotResolvedObjectType, boolean)
+     * re-resolving} the type.
+     */
+    public boolean isDefinitelyResolvedWithRespectTo(ResolvedJavaType accessingClass) {
+        assert accessingClass != null;
+        ResolvedJavaType elementType = getElementalType();
+        if (elementType.isPrimitive()) {
+            // Primitive type resolution is context free.
+            return true;
+        }
+        if (elementType.getName().startsWith("Ljava/")) {
+            // Classes in a java.* package can only be defined by the
+            // boot class loader. This is enforced by ClassLoader.preDefineClass()
+            assert mirror().getClassLoader() == null;
+            return true;
+        }
+        ClassLoader thisCl = mirror().getClassLoader();
+        ClassLoader accessingClassCl = ((HotSpotResolvedObjectTypeImpl) accessingClass).mirror().getClassLoader();
+        return thisCl == accessingClassCl;
+    }
+
+    @Override
+    public ResolvedJavaType resolve(ResolvedJavaType accessingClass) {
+        if (isDefinitelyResolvedWithRespectTo(requireNonNull(accessingClass))) {
+            return this;
+        }
+        HotSpotResolvedObjectTypeImpl accessingType = (HotSpotResolvedObjectTypeImpl) accessingClass;
+        return (ResolvedJavaType) runtime().lookupType(getName(), accessingType, true);
+    }
+
+    /**
+     * Gets the metaspace Klass boxed in a {@link JavaConstant}.
+     */
+    public JavaConstant klass() {
+        return HotSpotMetaspaceConstantImpl.forMetaspaceObject(runtime().getHostJVMCIBackend().getTarget().wordKind, getMetaspaceKlass(), this, false);
+    }
+
+    public boolean isPrimaryType() {
+        return runtime().getConfig().secondarySuperCacheOffset != superCheckOffset();
+    }
+
+    public int superCheckOffset() {
+        HotSpotVMConfig config = runtime().getConfig();
+        return unsafe.getInt(getMetaspaceKlass() + config.superCheckOffsetOffset);
+    }
+
+    public long prototypeMarkWord() {
+        HotSpotVMConfig config = runtime().getConfig();
+        if (isArray()) {
+            return config.arrayPrototypeMarkWord();
+        } else {
+            return unsafe.getAddress(getMetaspaceKlass() + config.prototypeMarkWordOffset);
+        }
+    }
+
+    @Override
+    public ResolvedJavaField findInstanceFieldWithOffset(long offset, Kind expectedEntryKind) {
+        ResolvedJavaField[] declaredFields = getInstanceFields(true);
+        for (ResolvedJavaField field : declaredFields) {
+            HotSpotResolvedJavaField resolvedField = (HotSpotResolvedJavaField) field;
+            long resolvedFieldOffset = resolvedField.offset();
+            // @formatter:off
+            if (ByteOrder.nativeOrder() == ByteOrder.BIG_ENDIAN  &&
+                            expectedEntryKind.isPrimitive() &&
+                            !expectedEntryKind.equals(Kind.Void) &&
+                            resolvedField.getKind().isPrimitive()) {
+                resolvedFieldOffset +=
+                                resolvedField.getKind().getByteCount() -
+                                Math.min(resolvedField.getKind().getByteCount(), 4 + expectedEntryKind.getByteCount());
+            }
+            if (resolvedFieldOffset == offset) {
+                return field;
+            }
+            // @formatter:on
+        }
+        return null;
+    }
+
+    @Override
+    public URL getClassFilePath() {
+        Class<?> cls = mirror();
+        return cls.getResource(MetaUtil.getSimpleName(cls, true).replace('.', '$') + ".class");
+    }
+
+    @Override
+    public boolean isLocal() {
+        return mirror().isLocalClass();
+    }
+
+    @Override
+    public boolean isMember() {
+        return mirror().isMemberClass();
+    }
+
+    @Override
+    public HotSpotResolvedObjectTypeImpl getEnclosingType() {
+        final Class<?> encl = mirror().getEnclosingClass();
+        return encl == null ? null : fromObjectClass(encl);
+    }
+
+    @Override
+    public ResolvedJavaMethod[] getDeclaredConstructors() {
+        Constructor<?>[] constructors = mirror().getDeclaredConstructors();
+        ResolvedJavaMethod[] result = new ResolvedJavaMethod[constructors.length];
+        for (int i = 0; i < constructors.length; i++) {
+            result[i] = runtime().getHostJVMCIBackend().getMetaAccess().lookupJavaMethod(constructors[i]);
+            assert result[i].isConstructor();
+        }
+        return result;
+    }
+
+    @Override
+    public ResolvedJavaMethod[] getDeclaredMethods() {
+        Method[] methods = mirror().getDeclaredMethods();
+        ResolvedJavaMethod[] result = new ResolvedJavaMethod[methods.length];
+        for (int i = 0; i < methods.length; i++) {
+            result[i] = runtime().getHostJVMCIBackend().getMetaAccess().lookupJavaMethod(methods[i]);
+            assert !result[i].isConstructor();
+        }
+        return result;
+    }
+
+    public ResolvedJavaMethod getClassInitializer() {
+        final long metaspaceMethod = runtime().getCompilerToVM().getClassInitializer(getMetaspaceKlass());
+        if (metaspaceMethod != 0L) {
+            return createMethod(metaspaceMethod);
+        }
+        return null;
+    }
+
+    @Override
+    public String toString() {
+        return "HotSpotType<" + getName() + ", resolved>";
+    }
+
+    @Override
+    public boolean isTrustedInterfaceType() {
+        return TrustedInterface.class.isAssignableFrom(mirror());
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotResolvedPrimitiveType.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,280 @@
+/*
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.hotspot;
+
+import static java.util.Objects.*;
+
+import java.lang.annotation.*;
+import java.lang.reflect.*;
+import java.net.*;
+
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.meta.Assumptions.AssumptionResult;
+import com.oracle.jvmci.meta.*;
+
+/**
+ * Implementation of {@link JavaType} for primitive HotSpot types.
+ */
+public final class HotSpotResolvedPrimitiveType extends HotSpotResolvedJavaType implements HotSpotProxified {
+
+    private final Kind kind;
+
+    /**
+     * Creates the Graal mirror for a primitive {@link Kind}.
+     *
+     * <p>
+     * <b>NOTE</b>: Creating an instance of this class does not install the mirror for the
+     * {@link Class} type. Use {@link #fromClass(Class)} instead.
+     * </p>
+     *
+     * @param kind the Kind to create the mirror for
+     */
+    public HotSpotResolvedPrimitiveType(Kind kind) {
+        super(String.valueOf(Character.toUpperCase(kind.getTypeChar())));
+        this.kind = kind;
+        assert mirror().isPrimitive() : mirror() + " not a primitive type";
+    }
+
+    @Override
+    public int getModifiers() {
+        return Modifier.ABSTRACT | Modifier.FINAL | Modifier.PUBLIC;
+    }
+
+    @Override
+    public HotSpotResolvedObjectTypeImpl getArrayClass() {
+        if (kind == Kind.Void) {
+            return null;
+        }
+        Class<?> javaArrayMirror = Array.newInstance(mirror(), 0).getClass();
+        return HotSpotResolvedObjectTypeImpl.fromObjectClass(javaArrayMirror);
+    }
+
+    public ResolvedJavaType getElementalType() {
+        return this;
+    }
+
+    @Override
+    public ResolvedJavaType getComponentType() {
+        return null;
+    }
+
+    @Override
+    public ResolvedJavaType asExactType() {
+        return this;
+    }
+
+    @Override
+    public ResolvedJavaType getSuperclass() {
+        return null;
+    }
+
+    @Override
+    public ResolvedJavaType[] getInterfaces() {
+        return new ResolvedJavaType[0];
+    }
+
+    @Override
+    public ResolvedJavaType getSingleImplementor() {
+        throw new JVMCIError("Cannot call getSingleImplementor() on a non-interface type: %s", this);
+    }
+
+    @Override
+    public ResolvedJavaType findLeastCommonAncestor(ResolvedJavaType otherType) {
+        return null;
+    }
+
+    @Override
+    public JavaConstant getObjectHub() {
+        throw JVMCIError.unimplemented();
+    }
+
+    @Override
+    public JavaConstant getJavaClass() {
+        throw JVMCIError.unimplemented();
+    }
+
+    @Override
+    public AssumptionResult<Boolean> hasFinalizableSubclass() {
+        return new AssumptionResult<>(false);
+    }
+
+    @Override
+    public boolean hasFinalizer() {
+        return false;
+    }
+
+    @Override
+    public boolean isArray() {
+        return false;
+    }
+
+    @Override
+    public boolean isPrimitive() {
+        return true;
+    }
+
+    @Override
+    public boolean isInitialized() {
+        return true;
+    }
+
+    public boolean isLinked() {
+        return true;
+    }
+
+    @Override
+    public boolean isInstance(JavaConstant obj) {
+        return false;
+    }
+
+    @Override
+    public boolean isInstanceClass() {
+        return false;
+    }
+
+    @Override
+    public boolean isInterface() {
+        return false;
+    }
+
+    @Override
+    public boolean isAssignableFrom(ResolvedJavaType other) {
+        assert other != null;
+        return other.equals(this);
+    }
+
+    @Override
+    public Kind getKind() {
+        return kind;
+    }
+
+    @Override
+    public boolean isJavaLangObject() {
+        return false;
+    }
+
+    @Override
+    public ResolvedJavaMethod resolveConcreteMethod(ResolvedJavaMethod method, ResolvedJavaType callerType) {
+        return null;
+    }
+
+    @Override
+    public ResolvedJavaMethod resolveMethod(ResolvedJavaMethod method, ResolvedJavaType callerType, boolean includeAbstract) {
+        return null;
+    }
+
+    @Override
+    public String toString() {
+        return "HotSpotResolvedPrimitiveType<" + kind + ">";
+    }
+
+    @Override
+    public AssumptionResult<ResolvedJavaType> findLeafConcreteSubtype() {
+        return new AssumptionResult<>(this);
+    }
+
+    @Override
+    public AssumptionResult<ResolvedJavaMethod> findUniqueConcreteMethod(ResolvedJavaMethod method) {
+        return null;
+    }
+
+    @Override
+    public ResolvedJavaField[] getInstanceFields(boolean includeSuperclasses) {
+        return new ResolvedJavaField[0];
+    }
+
+    @Override
+    public ResolvedJavaField[] getStaticFields() {
+        return new ResolvedJavaField[0];
+    }
+
+    @Override
+    public <T extends Annotation> T getAnnotation(Class<T> annotationClass) {
+        return null;
+    }
+
+    @Override
+    public ResolvedJavaType resolve(ResolvedJavaType accessingClass) {
+        requireNonNull(accessingClass);
+        return this;
+    }
+
+    @Override
+    public void initialize() {
+    }
+
+    @Override
+    public ResolvedJavaField findInstanceFieldWithOffset(long offset, Kind expectedType) {
+        return null;
+    }
+
+    @Override
+    public String getSourceFileName() {
+        throw JVMCIError.unimplemented();
+    }
+
+    @Override
+    public Class<?> mirror() {
+        return kind.toJavaClass();
+    }
+
+    @Override
+    public URL getClassFilePath() {
+        return null;
+    }
+
+    @Override
+    public boolean isLocal() {
+        return false;
+    }
+
+    @Override
+    public boolean isMember() {
+        return false;
+    }
+
+    @Override
+    public ResolvedJavaType getEnclosingType() {
+        return null;
+    }
+
+    @Override
+    public ResolvedJavaMethod[] getDeclaredConstructors() {
+        return new ResolvedJavaMethod[0];
+    }
+
+    @Override
+    public ResolvedJavaMethod[] getDeclaredMethods() {
+        return new ResolvedJavaMethod[0];
+    }
+
+    @Override
+    public ResolvedJavaMethod getClassInitializer() {
+        return null;
+    }
+
+    @Override
+    public boolean isTrustedInterfaceType() {
+        return false;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotSignature.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,212 @@
+/*
+ * Copyright (c) 2011, 2015, 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.jvmci.hotspot;
+
+import java.util.*;
+
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.meta.*;
+
+/**
+ * Represents a method signature.
+ */
+public class HotSpotSignature implements Signature {
+
+    private final List<String> parameters = new ArrayList<>();
+    private final String returnType;
+    private final String originalString;
+    private ResolvedJavaType[] parameterTypes;
+    private ResolvedJavaType returnTypeCache;
+    private final HotSpotJVMCIRuntimeProvider runtime;
+
+    public HotSpotSignature(HotSpotJVMCIRuntimeProvider runtime, String signature) {
+        this.runtime = runtime;
+        assert signature.length() > 0;
+        this.originalString = signature;
+
+        if (signature.charAt(0) == '(') {
+            int cur = 1;
+            while (cur < signature.length() && signature.charAt(cur) != ')') {
+                int nextCur = parseSignature(signature, cur);
+                parameters.add(signature.substring(cur, nextCur));
+                cur = nextCur;
+            }
+
+            cur++;
+            int nextCur = parseSignature(signature, cur);
+            returnType = signature.substring(cur, nextCur);
+            assert nextCur == signature.length();
+        } else {
+            returnType = null;
+        }
+    }
+
+    public HotSpotSignature(HotSpotJVMCIRuntimeProvider runtime, ResolvedJavaType returnType, ResolvedJavaType... parameterTypes) {
+        this.runtime = runtime;
+        this.parameterTypes = parameterTypes.clone();
+        this.returnTypeCache = returnType;
+        this.returnType = returnType.getName();
+        StringBuilder sb = new StringBuilder("(");
+        for (JavaType type : parameterTypes) {
+            parameters.add(type.getName());
+            sb.append(type.getName());
+        }
+        sb.append(")").append(returnType.getName());
+        this.originalString = sb.toString();
+        assert new HotSpotSignature(runtime, originalString).equals(this);
+    }
+
+    private static int parseSignature(String signature, int start) {
+        int cur = start;
+        char first;
+        do {
+            first = signature.charAt(cur++);
+        } while (first == '[');
+
+        switch (first) {
+            case 'L':
+                while (signature.charAt(cur) != ';') {
+                    cur++;
+                }
+                cur++;
+                break;
+            case 'V':
+            case 'I':
+            case 'B':
+            case 'C':
+            case 'D':
+            case 'F':
+            case 'J':
+            case 'S':
+            case 'Z':
+                break;
+            default:
+                throw new JVMCIError("Invalid character at index %d in signature: %s", cur, signature);
+        }
+        return cur;
+    }
+
+    @Override
+    public int getParameterCount(boolean withReceiver) {
+        return parameters.size() + (withReceiver ? 1 : 0);
+    }
+
+    @Override
+    public Kind getParameterKind(int index) {
+        return Kind.fromTypeString(parameters.get(index));
+    }
+
+    private static boolean checkValidCache(ResolvedJavaType type, ResolvedJavaType accessingClass) {
+        assert accessingClass != null;
+        if (type == null) {
+            return false;
+        } else if (type instanceof HotSpotResolvedObjectTypeImpl) {
+            return ((HotSpotResolvedObjectTypeImpl) type).isDefinitelyResolvedWithRespectTo(accessingClass);
+        }
+        return true;
+    }
+
+    private static JavaType getUnresolvedOrPrimitiveType(HotSpotJVMCIRuntimeProvider runtime, String name) {
+        if (name.length() == 1) {
+            Kind kind = Kind.fromPrimitiveOrVoidTypeChar(name.charAt(0));
+            return runtime.getHostJVMCIBackend().getMetaAccess().lookupJavaType(kind.toJavaClass());
+        }
+        return new HotSpotUnresolvedJavaType(name, runtime);
+    }
+
+    @Override
+    public JavaType getParameterType(int index, ResolvedJavaType accessingClass) {
+        if (accessingClass == null) {
+            // Caller doesn't care about resolution context so return an unresolved
+            // or primitive type (primitive type resolution is context free)
+            return getUnresolvedOrPrimitiveType(runtime, parameters.get(index));
+        }
+        if (parameterTypes == null) {
+            parameterTypes = new ResolvedJavaType[parameters.size()];
+        }
+
+        ResolvedJavaType type = parameterTypes[index];
+        if (!checkValidCache(type, accessingClass)) {
+            JavaType result = runtime.lookupType(parameters.get(index), (HotSpotResolvedObjectType) accessingClass, false);
+            if (result instanceof ResolvedJavaType) {
+                type = (ResolvedJavaType) result;
+                parameterTypes[index] = type;
+            } else {
+                return result;
+            }
+        }
+        return type;
+    }
+
+    @Override
+    public String toMethodDescriptor() {
+        assert originalString.equals(Signature.super.toMethodDescriptor());
+        return originalString;
+    }
+
+    @Override
+    public Kind getReturnKind() {
+        return Kind.fromTypeString(returnType);
+    }
+
+    @Override
+    public JavaType getReturnType(ResolvedJavaType accessingClass) {
+        if (accessingClass == null) {
+            // Caller doesn't care about resolution context so return an unresolved
+            // or primitive type (primitive type resolution is context free)
+            return getUnresolvedOrPrimitiveType(runtime, returnType);
+        }
+        if (!checkValidCache(returnTypeCache, accessingClass)) {
+            JavaType result = runtime.lookupType(returnType, (HotSpotResolvedObjectType) accessingClass, false);
+            if (result instanceof ResolvedJavaType) {
+                returnTypeCache = (ResolvedJavaType) result;
+            } else {
+                return result;
+            }
+        }
+        return returnTypeCache;
+    }
+
+    @Override
+    public String toString() {
+        return "HotSpotSignature<" + originalString + ">";
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (obj instanceof HotSpotSignature) {
+            HotSpotSignature other = (HotSpotSignature) obj;
+            if (other.originalString.equals(originalString)) {
+                assert other.parameters.equals(parameters);
+                assert other.returnType.equals(returnType);
+                return true;
+            }
+        }
+        return false;
+    }
+
+    @Override
+    public int hashCode() {
+        return originalString.hashCode();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotSpeculationLog.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.hotspot;
+
+import com.oracle.jvmci.code.*;
+import com.oracle.jvmci.meta.*;
+
+public class HotSpotSpeculationLog extends SpeculationLog {
+
+    @Override
+    public JavaConstant speculate(Object reason) {
+        addSpeculation(reason);
+        return HotSpotObjectConstantImpl.forObject(reason);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotStackFrameReference.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.hotspot;
+
+import java.util.*;
+
+import com.oracle.jvmci.code.stack.*;
+import com.oracle.jvmci.meta.*;
+
+public class HotSpotStackFrameReference implements InspectedFrame {
+
+    private CompilerToVM compilerToVM;
+
+    // information used to find the stack frame
+    private long stackPointer;
+    private int frameNumber;
+
+    // information about the stack frame's contents
+    private int bci;
+    private long metaspaceMethod;
+    private Object[] locals;
+    private boolean[] localIsVirtual;
+
+    public long getStackPointer() {
+        return stackPointer;
+    }
+
+    public int getFrameNumber() {
+        return frameNumber;
+    }
+
+    @Override
+    public Object getLocal(int index) {
+        return locals[index];
+    }
+
+    @Override
+    public boolean isVirtual(int index) {
+        return localIsVirtual == null ? false : localIsVirtual[index];
+    }
+
+    @Override
+    public void materializeVirtualObjects(boolean invalidateCode) {
+        compilerToVM.materializeVirtualObjects(this, invalidateCode);
+    }
+
+    @Override
+    public int getBytecodeIndex() {
+        return bci;
+    }
+
+    @Override
+    public ResolvedJavaMethod getMethod() {
+        return HotSpotResolvedJavaMethodImpl.fromMetaspace(metaspaceMethod);
+    }
+
+    @Override
+    public boolean isMethod(ResolvedJavaMethod method) {
+        return metaspaceMethod == ((HotSpotResolvedJavaMethodImpl) method).getMetaspaceMethod();
+    }
+
+    @Override
+    public boolean hasVirtualObjects() {
+        return localIsVirtual != null;
+    }
+
+    @Override
+    public String toString() {
+        return "HotSpotStackFrameReference [stackPointer=" + stackPointer + ", frameNumber=" + frameNumber + ", bci=" + bci + ", method=" + getMethod() + ", locals=" + Arrays.toString(locals) +
+                        ", localIsVirtual=" + Arrays.toString(localIsVirtual) + "]";
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotUnresolvedField.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,78 @@
+/*
+ * 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.jvmci.hotspot;
+
+import com.oracle.jvmci.meta.*;
+
+/**
+ * A implementation of {@link JavaField} for an unresolved field.
+ */
+public class HotSpotUnresolvedField implements JavaField {
+
+    private final String name;
+    private final JavaType holder;
+    private final JavaType type;
+
+    public HotSpotUnresolvedField(JavaType holder, String name, JavaType type) {
+        this.name = name;
+        this.type = type;
+        this.holder = holder;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public JavaType getType() {
+        return type;
+    }
+
+    public JavaType getDeclaringClass() {
+        return holder;
+    }
+
+    @Override
+    public int hashCode() {
+        return super.hashCode();
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null || !(obj instanceof HotSpotUnresolvedField)) {
+            return false;
+        }
+        HotSpotUnresolvedField that = (HotSpotUnresolvedField) obj;
+        return this.holder.equals(that.holder) && this.name.equals(that.name) && this.type.equals(that.type);
+    }
+
+    /**
+     * Converts this compiler interface field to a string.
+     */
+    @Override
+    public String toString() {
+        return format("HotSpotField<%H.%n %t, unresolved>");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotUnresolvedJavaType.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,103 @@
+/*
+ * Copyright (c) 2011, 2015, 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.jvmci.hotspot;
+
+import com.oracle.jvmci.meta.*;
+
+/**
+ * Implementation of {@link JavaType} for unresolved HotSpot classes.
+ */
+public class HotSpotUnresolvedJavaType extends HotSpotJavaType {
+
+    private final HotSpotJVMCIRuntimeProvider runtime;
+
+    public HotSpotUnresolvedJavaType(String name, HotSpotJVMCIRuntimeProvider runtime) {
+        super(name);
+        assert name.charAt(0) == '[' || name.charAt(name.length() - 1) == ';' : name;
+        this.runtime = runtime;
+    }
+
+    /**
+     * Creates an unresolved type for a valid {@link JavaType#getName() type name}.
+     */
+    public static HotSpotUnresolvedJavaType create(HotSpotJVMCIRuntimeProvider runtime, String name) {
+        return new HotSpotUnresolvedJavaType(name, runtime);
+    }
+
+    @Override
+    public JavaType getComponentType() {
+        assert getName().charAt(0) == '[' : "no array class" + getName();
+        return new HotSpotUnresolvedJavaType(getName().substring(1), runtime);
+    }
+
+    @Override
+    public JavaType getArrayClass() {
+        return new HotSpotUnresolvedJavaType('[' + getName(), runtime);
+    }
+
+    @Override
+    public Kind getKind() {
+        return Kind.Object;
+    }
+
+    @Override
+    public int hashCode() {
+        return getName().hashCode();
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null || !(obj instanceof HotSpotUnresolvedJavaType)) {
+            return false;
+        }
+        HotSpotUnresolvedJavaType that = (HotSpotUnresolvedJavaType) obj;
+        return this.getName().equals(that.getName());
+    }
+
+    @Override
+    public String toString() {
+        return "HotSpotType<" + getName() + ", unresolved>";
+    }
+
+    @Override
+    public ResolvedJavaType resolve(ResolvedJavaType accessingClass) {
+        return (ResolvedJavaType) runtime.lookupType(getName(), (HotSpotResolvedObjectType) accessingClass, true);
+    }
+
+    /**
+     * Try to find a loaded version of this class.
+     *
+     * @param accessingClass
+     * @return the resolved class or null.
+     */
+    ResolvedJavaType reresolve(HotSpotResolvedObjectType accessingClass) {
+        JavaType type = runtime.lookupType(getName(), accessingClass, false);
+        if (type instanceof ResolvedJavaType) {
+            return (ResolvedJavaType) type;
+        }
+        return null;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotVMConfig.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,1663 @@
+/*
+ * Copyright (c) 2011, 2015, 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.jvmci.hotspot;
+
+import static com.oracle.jvmci.common.UnsafeAccess.*;
+
+import java.lang.reflect.*;
+import java.util.*;
+
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.hotspotvmconfig.*;
+
+//JaCoCo Exclude
+
+/**
+ * Used to access native configuration details.
+ *
+ * All non-static, public fields in this class are so that they can be compiled as constants.
+ */
+public class HotSpotVMConfig {
+
+    /**
+     * Determines if the current architecture is included in a given architecture set specification.
+     *
+     * @param currentArch
+     * @param archsSpecification specifies a set of architectures. A zero length value implies all
+     *            architectures.
+     */
+    private static boolean isRequired(String currentArch, String[] archsSpecification) {
+        if (archsSpecification.length == 0) {
+            return true;
+        }
+        for (String arch : archsSpecification) {
+            if (arch.equals(currentArch)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * Maximum allowed size of allocated area for a frame.
+     */
+    public final int maxFrameSize = 16 * 1024;
+
+    @Override
+    public String toString() {
+        return getClass().getSimpleName();
+    }
+
+    public HotSpotVMConfig(CompilerToVM compilerToVm) {
+        compilerToVm.initializeConfiguration(this);
+        assert verifyInitialization();
+
+        oopEncoding = new CompressEncoding(narrowOopBase, narrowOopShift, logMinObjAlignment());
+        klassEncoding = new CompressEncoding(narrowKlassBase, narrowKlassShift, logKlassAlignment);
+
+        codeCacheLowBoundary = unsafe.getAddress(codeCacheHeap + codeHeapMemoryOffset + virtualSpaceLowBoundaryOffset);
+        codeCacheHighBoundary = unsafe.getAddress(codeCacheHeap + codeHeapMemoryOffset + virtualSpaceHighBoundaryOffset);
+
+        final long barrierSetAddress = unsafe.getAddress(universeCollectedHeap + collectedHeapBarrierSetOffset);
+        final int kind = unsafe.getInt(barrierSetAddress + barrierSetKindOffset);
+        if ((kind == barrierSetCardTableModRef) || (kind == barrierSetCardTableExtension) || (kind == barrierSetG1SATBCT) || (kind == barrierSetG1SATBCTLogging)) {
+            final long base = unsafe.getAddress(barrierSetAddress + cardTableModRefBSByteMapBaseOffset);
+            assert base != 0 : "unexpected byte_map_base: " + base;
+            cardtableStartAddress = base;
+            cardtableShift = cardTableModRefBSCardShift;
+        } else if ((kind == barrierSetModRef) || (kind == barrierSetOther)) {
+            // No post barriers
+            cardtableStartAddress = 0;
+            cardtableShift = 0;
+        } else {
+            cardtableStartAddress = -1;
+            cardtableShift = -1;
+        }
+
+        inlineCacheMissStub = inlineCacheMissBlob + unsafe.getInt(inlineCacheMissBlob + codeBlobCodeOffsetOffset);
+
+        assert check();
+        assert HotSpotVMConfigVerifier.check();
+    }
+
+    /**
+     * Check that the initialization produces the same result as the values captured through
+     * vmStructs.
+     */
+    private boolean verifyInitialization() {
+        /** These fields are set in {@link CompilerToVM#initializeConfiguration}. */
+        assert gHotSpotVMStructs != 0;
+        assert gHotSpotVMTypes != 0;
+        assert gHotSpotVMIntConstants != 0;
+        assert gHotSpotVMLongConstants != 0;
+
+        // Fill the VM fields hash map.
+        HashMap<String, VMFields.Field> vmFields = new HashMap<>();
+        for (VMFields.Field e : new VMFields(gHotSpotVMStructs)) {
+            vmFields.put(e.getName(), e);
+        }
+
+        // Fill the VM types hash map.
+        HashMap<String, VMTypes.Type> vmTypes = new HashMap<>();
+        for (VMTypes.Type e : new VMTypes(gHotSpotVMTypes)) {
+            vmTypes.put(e.getTypeName(), e);
+        }
+
+        // Fill the VM constants hash map.
+        HashMap<String, AbstractConstant> vmConstants = new HashMap<>();
+        for (AbstractConstant e : new VMIntConstants(gHotSpotVMIntConstants)) {
+            vmConstants.put(e.getName(), e);
+        }
+        for (AbstractConstant e : new VMLongConstants(gHotSpotVMLongConstants)) {
+            vmConstants.put(e.getName(), e);
+        }
+
+        // Fill the flags hash map.
+        HashMap<String, Flags.Flag> flags = new HashMap<>();
+        for (Flags.Flag e : new Flags(vmFields, vmTypes)) {
+            flags.put(e.getName(), e);
+        }
+
+        String currentArch = getHostArchitectureName();
+
+        for (Field f : HotSpotVMConfig.class.getDeclaredFields()) {
+            if (f.isAnnotationPresent(HotSpotVMField.class)) {
+                HotSpotVMField annotation = f.getAnnotation(HotSpotVMField.class);
+                String name = annotation.name();
+                String type = annotation.type();
+                VMFields.Field entry = vmFields.get(name);
+                if (entry == null) {
+                    if (!isRequired(currentArch, annotation.archs())) {
+                        continue;
+                    }
+                    throw new IllegalArgumentException("field not found: " + name);
+                }
+
+                // Make sure the native type is still the type we expect.
+                if (!type.equals("")) {
+                    if (!type.equals(entry.getTypeString())) {
+                        throw new IllegalArgumentException("compiler expects type " + type + " but field " + name + " is of type " + entry.getTypeString());
+                    }
+                }
+
+                switch (annotation.get()) {
+                    case OFFSET:
+                        checkField(f, entry.getOffset());
+                        break;
+                    case ADDRESS:
+                        checkField(f, entry.getAddress());
+                        break;
+                    case VALUE:
+                        checkField(f, entry.getValue());
+                        break;
+                    default:
+                        throw new JVMCIError("unknown kind %s", annotation.get());
+                }
+            } else if (f.isAnnotationPresent(HotSpotVMType.class)) {
+                HotSpotVMType annotation = f.getAnnotation(HotSpotVMType.class);
+                String name = annotation.name();
+                VMTypes.Type entry = vmTypes.get(name);
+                if (entry == null) {
+                    throw new IllegalArgumentException("type not found: " + name);
+                }
+                switch (annotation.get()) {
+                    case SIZE:
+                        checkField(f, entry.getSize());
+                        break;
+                    default:
+                        throw new JVMCIError("unknown kind %s", annotation.get());
+                }
+            } else if (f.isAnnotationPresent(HotSpotVMConstant.class)) {
+                HotSpotVMConstant annotation = f.getAnnotation(HotSpotVMConstant.class);
+                String name = annotation.name();
+                AbstractConstant entry = vmConstants.get(name);
+                if (entry == null) {
+                    if (!isRequired(currentArch, annotation.archs())) {
+                        continue;
+                    }
+                    throw new IllegalArgumentException("constant not found: " + name);
+                }
+                checkField(f, entry.getValue());
+            } else if (f.isAnnotationPresent(HotSpotVMFlag.class)) {
+                HotSpotVMFlag annotation = f.getAnnotation(HotSpotVMFlag.class);
+                String name = annotation.name();
+                Flags.Flag entry = flags.get(name);
+                if (entry == null) {
+                    if (annotation.optional() || !isRequired(currentArch, annotation.archs())) {
+                        continue;
+                    }
+                    throw new IllegalArgumentException("flag not found: " + name);
+
+                }
+                checkField(f, entry.getValue());
+            }
+        }
+        return true;
+    }
+
+    private final CompressEncoding oopEncoding;
+    private final CompressEncoding klassEncoding;
+
+    public CompressEncoding getOopEncoding() {
+        return oopEncoding;
+    }
+
+    public CompressEncoding getKlassEncoding() {
+        return klassEncoding;
+    }
+
+    private void checkField(Field field, Object value) {
+        try {
+            Class<?> fieldType = field.getType();
+            if (fieldType == boolean.class) {
+                if (value instanceof String) {
+                    assert field.getBoolean(this) == Boolean.valueOf((String) value) : field + " " + value + " " + field.getBoolean(this);
+                } else if (value instanceof Boolean) {
+                    assert field.getBoolean(this) == (boolean) value : field + " " + value + " " + field.getBoolean(this);
+                } else if (value instanceof Long) {
+                    assert field.getBoolean(this) == (((long) value) != 0) : field + " " + value + " " + field.getBoolean(this);
+                } else {
+                    throw new JVMCIError(value.getClass().getSimpleName());
+                }
+            } else if (fieldType == int.class) {
+                if (value instanceof Integer) {
+                    assert field.getInt(this) == (int) value : field + " " + value + " " + field.getInt(this);
+                } else if (value instanceof Long) {
+                    assert field.getInt(this) == (int) (long) value : field + " " + value + " " + field.getInt(this);
+                } else {
+                    throw new JVMCIError(value.getClass().getSimpleName());
+                }
+            } else if (fieldType == long.class) {
+                assert field.getLong(this) == (long) value : field + " " + value + " " + field.getLong(this);
+            } else {
+                throw new JVMCIError(field.toString());
+            }
+        } catch (IllegalAccessException e) {
+            throw new JVMCIError("%s: %s", field, e);
+        }
+    }
+
+    /**
+     * Gets the host architecture name for the purpose of finding the corresponding
+     * {@linkplain HotSpotJVMCIBackendFactory backend}.
+     */
+    public String getHostArchitectureName() {
+        String arch = System.getProperty("os.arch");
+        switch (arch) {
+            case "x86_64":
+                arch = "amd64";
+                break;
+            case "sparcv9":
+                arch = "sparc";
+                break;
+        }
+        return arch;
+    }
+
+    /**
+     * VMStructEntry (see vmStructs.hpp).
+     */
+    @HotSpotVMValue(expression = "gHotSpotVMStructs", get = HotSpotVMValue.Type.ADDRESS) @Stable private long gHotSpotVMStructs;
+    @HotSpotVMValue(expression = "gHotSpotVMStructEntryTypeNameOffset") @Stable private long gHotSpotVMStructEntryTypeNameOffset;
+    @HotSpotVMValue(expression = "gHotSpotVMStructEntryFieldNameOffset") @Stable private long gHotSpotVMStructEntryFieldNameOffset;
+    @HotSpotVMValue(expression = "gHotSpotVMStructEntryTypeStringOffset") @Stable private long gHotSpotVMStructEntryTypeStringOffset;
+    @HotSpotVMValue(expression = "gHotSpotVMStructEntryIsStaticOffset") @Stable private long gHotSpotVMStructEntryIsStaticOffset;
+    @HotSpotVMValue(expression = "gHotSpotVMStructEntryOffsetOffset") @Stable private long gHotSpotVMStructEntryOffsetOffset;
+    @HotSpotVMValue(expression = "gHotSpotVMStructEntryAddressOffset") @Stable private long gHotSpotVMStructEntryAddressOffset;
+    @HotSpotVMValue(expression = "gHotSpotVMStructEntryArrayStride") @Stable private long gHotSpotVMStructEntryArrayStride;
+
+    class VMFields implements Iterable<VMFields.Field> {
+
+        private long address;
+
+        public VMFields(long address) {
+            this.address = address;
+        }
+
+        public Iterator<VMFields.Field> iterator() {
+            return new Iterator<VMFields.Field>() {
+
+                private int index = 0;
+
+                private Field current() {
+                    return new Field(address + gHotSpotVMStructEntryArrayStride * index);
+                }
+
+                /**
+                 * The last entry is identified by a NULL fieldName.
+                 */
+                public boolean hasNext() {
+                    Field entry = current();
+                    return entry.getFieldName() != null;
+                }
+
+                public Field next() {
+                    Field entry = current();
+                    index++;
+                    return entry;
+                }
+            };
+        }
+
+        class Field {
+
+            private long entryAddress;
+
+            Field(long address) {
+                this.entryAddress = address;
+            }
+
+            public String getTypeName() {
+                long typeNameAddress = unsafe.getAddress(entryAddress + gHotSpotVMStructEntryTypeNameOffset);
+                return readCString(typeNameAddress);
+            }
+
+            public String getFieldName() {
+                long fieldNameAddress = unsafe.getAddress(entryAddress + gHotSpotVMStructEntryFieldNameOffset);
+                return readCString(fieldNameAddress);
+            }
+
+            public String getTypeString() {
+                long typeStringAddress = unsafe.getAddress(entryAddress + gHotSpotVMStructEntryTypeStringOffset);
+                return readCString(typeStringAddress);
+            }
+
+            public boolean isStatic() {
+                return unsafe.getInt(entryAddress + gHotSpotVMStructEntryIsStaticOffset) != 0;
+            }
+
+            public long getOffset() {
+                return unsafe.getLong(entryAddress + gHotSpotVMStructEntryOffsetOffset);
+            }
+
+            public long getAddress() {
+                return unsafe.getAddress(entryAddress + gHotSpotVMStructEntryAddressOffset);
+            }
+
+            public String getName() {
+                String typeName = getTypeName();
+                String fieldName = getFieldName();
+                return typeName + "::" + fieldName;
+            }
+
+            public long getValue() {
+                String type = getTypeString();
+                switch (type) {
+                    case "int":
+                        return unsafe.getInt(getAddress());
+                    case "address":
+                    case "intptr_t":
+                        return unsafe.getAddress(getAddress());
+                    default:
+                        // All foo* types are addresses.
+                        if (type.endsWith("*")) {
+                            return unsafe.getAddress(getAddress());
+                        }
+                        throw new JVMCIError(type);
+                }
+            }
+
+            @Override
+            public String toString() {
+                return String.format("Field[typeName=%s, fieldName=%s, typeString=%s, isStatic=%b, offset=%d, address=0x%x]", getTypeName(), getFieldName(), getTypeString(), isStatic(), getOffset(),
+                                getAddress());
+            }
+        }
+    }
+
+    /**
+     * VMTypeEntry (see vmStructs.hpp).
+     */
+    @HotSpotVMValue(expression = "gHotSpotVMTypes", get = HotSpotVMValue.Type.ADDRESS) @Stable private long gHotSpotVMTypes;
+    @HotSpotVMValue(expression = "gHotSpotVMTypeEntryTypeNameOffset") @Stable private long gHotSpotVMTypeEntryTypeNameOffset;
+    @HotSpotVMValue(expression = "gHotSpotVMTypeEntrySuperclassNameOffset") @Stable private long gHotSpotVMTypeEntrySuperclassNameOffset;
+    @HotSpotVMValue(expression = "gHotSpotVMTypeEntryIsOopTypeOffset") @Stable private long gHotSpotVMTypeEntryIsOopTypeOffset;
+    @HotSpotVMValue(expression = "gHotSpotVMTypeEntryIsIntegerTypeOffset") @Stable private long gHotSpotVMTypeEntryIsIntegerTypeOffset;
+    @HotSpotVMValue(expression = "gHotSpotVMTypeEntryIsUnsignedOffset") @Stable private long gHotSpotVMTypeEntryIsUnsignedOffset;
+    @HotSpotVMValue(expression = "gHotSpotVMTypeEntrySizeOffset") @Stable private long gHotSpotVMTypeEntrySizeOffset;
+    @HotSpotVMValue(expression = "gHotSpotVMTypeEntryArrayStride") @Stable private long gHotSpotVMTypeEntryArrayStride;
+
+    class VMTypes implements Iterable<VMTypes.Type> {
+
+        private long address;
+
+        public VMTypes(long address) {
+            this.address = address;
+        }
+
+        public Iterator<VMTypes.Type> iterator() {
+            return new Iterator<VMTypes.Type>() {
+
+                private int index = 0;
+
+                private Type current() {
+                    return new Type(address + gHotSpotVMTypeEntryArrayStride * index);
+                }
+
+                /**
+                 * The last entry is identified by a NULL type name.
+                 */
+                public boolean hasNext() {
+                    Type entry = current();
+                    return entry.getTypeName() != null;
+                }
+
+                public Type next() {
+                    Type entry = current();
+                    index++;
+                    return entry;
+                }
+            };
+        }
+
+        class Type {
+
+            private long entryAddress;
+
+            Type(long address) {
+                this.entryAddress = address;
+            }
+
+            public String getTypeName() {
+                long typeNameAddress = unsafe.getAddress(entryAddress + gHotSpotVMTypeEntryTypeNameOffset);
+                return readCString(typeNameAddress);
+            }
+
+            public String getSuperclassName() {
+                long superclassNameAddress = unsafe.getAddress(entryAddress + gHotSpotVMTypeEntrySuperclassNameOffset);
+                return readCString(superclassNameAddress);
+            }
+
+            public boolean isOopType() {
+                return unsafe.getInt(entryAddress + gHotSpotVMTypeEntryIsOopTypeOffset) != 0;
+            }
+
+            public boolean isIntegerType() {
+                return unsafe.getInt(entryAddress + gHotSpotVMTypeEntryIsIntegerTypeOffset) != 0;
+            }
+
+            public boolean isUnsigned() {
+                return unsafe.getInt(entryAddress + gHotSpotVMTypeEntryIsUnsignedOffset) != 0;
+            }
+
+            public long getSize() {
+                return unsafe.getLong(entryAddress + gHotSpotVMTypeEntrySizeOffset);
+            }
+
+            @Override
+            public String toString() {
+                return String.format("Type[typeName=%s, superclassName=%s, isOopType=%b, isIntegerType=%b, isUnsigned=%b, size=%d]", getTypeName(), getSuperclassName(), isOopType(), isIntegerType(),
+                                isUnsigned(), getSize());
+            }
+        }
+    }
+
+    public abstract class AbstractConstant {
+
+        protected long address;
+        protected long nameOffset;
+        protected long valueOffset;
+
+        AbstractConstant(long address, long nameOffset, long valueOffset) {
+            this.address = address;
+            this.nameOffset = nameOffset;
+            this.valueOffset = valueOffset;
+        }
+
+        public String getName() {
+            long nameAddress = unsafe.getAddress(address + nameOffset);
+            return readCString(nameAddress);
+        }
+
+        public abstract long getValue();
+    }
+
+    /**
+     * VMIntConstantEntry (see vmStructs.hpp).
+     */
+    @HotSpotVMValue(expression = "gHotSpotVMIntConstants", get = HotSpotVMValue.Type.ADDRESS) @Stable private long gHotSpotVMIntConstants;
+    @HotSpotVMValue(expression = "gHotSpotVMIntConstantEntryNameOffset") @Stable private long gHotSpotVMIntConstantEntryNameOffset;
+    @HotSpotVMValue(expression = "gHotSpotVMIntConstantEntryValueOffset") @Stable private long gHotSpotVMIntConstantEntryValueOffset;
+    @HotSpotVMValue(expression = "gHotSpotVMIntConstantEntryArrayStride") @Stable private long gHotSpotVMIntConstantEntryArrayStride;
+
+    class VMIntConstants implements Iterable<VMIntConstants.Constant> {
+
+        private long address;
+
+        public VMIntConstants(long address) {
+            this.address = address;
+        }
+
+        public Iterator<VMIntConstants.Constant> iterator() {
+            return new Iterator<VMIntConstants.Constant>() {
+
+                private int index = 0;
+
+                private Constant current() {
+                    return new Constant(address + gHotSpotVMIntConstantEntryArrayStride * index);
+                }
+
+                /**
+                 * The last entry is identified by a NULL name.
+                 */
+                public boolean hasNext() {
+                    Constant entry = current();
+                    return entry.getName() != null;
+                }
+
+                public Constant next() {
+                    Constant entry = current();
+                    index++;
+                    return entry;
+                }
+            };
+        }
+
+        class Constant extends AbstractConstant {
+
+            Constant(long address) {
+                super(address, gHotSpotVMIntConstantEntryNameOffset, gHotSpotVMIntConstantEntryValueOffset);
+            }
+
+            @Override
+            public long getValue() {
+                return unsafe.getInt(address + valueOffset);
+            }
+
+            @Override
+            public String toString() {
+                return String.format("IntConstant[name=%s, value=%d (0x%x)]", getName(), getValue(), getValue());
+            }
+        }
+    }
+
+    /**
+     * VMLongConstantEntry (see vmStructs.hpp).
+     */
+    @HotSpotVMValue(expression = "gHotSpotVMLongConstants", get = HotSpotVMValue.Type.ADDRESS) @Stable private long gHotSpotVMLongConstants;
+    @HotSpotVMValue(expression = "gHotSpotVMLongConstantEntryNameOffset") @Stable private long gHotSpotVMLongConstantEntryNameOffset;
+    @HotSpotVMValue(expression = "gHotSpotVMLongConstantEntryValueOffset") @Stable private long gHotSpotVMLongConstantEntryValueOffset;
+    @HotSpotVMValue(expression = "gHotSpotVMLongConstantEntryArrayStride") @Stable private long gHotSpotVMLongConstantEntryArrayStride;
+
+    class VMLongConstants implements Iterable<VMLongConstants.Constant> {
+
+        private long address;
+
+        public VMLongConstants(long address) {
+            this.address = address;
+        }
+
+        public Iterator<VMLongConstants.Constant> iterator() {
+            return new Iterator<VMLongConstants.Constant>() {
+
+                private int index = 0;
+
+                private Constant currentEntry() {
+                    return new Constant(address + gHotSpotVMLongConstantEntryArrayStride * index);
+                }
+
+                /**
+                 * The last entry is identified by a NULL name.
+                 */
+                public boolean hasNext() {
+                    Constant entry = currentEntry();
+                    return entry.getName() != null;
+                }
+
+                public Constant next() {
+                    Constant entry = currentEntry();
+                    index++;
+                    return entry;
+                }
+            };
+        }
+
+        class Constant extends AbstractConstant {
+
+            Constant(long address) {
+                super(address, gHotSpotVMLongConstantEntryNameOffset, gHotSpotVMLongConstantEntryValueOffset);
+            }
+
+            @Override
+            public long getValue() {
+                return unsafe.getLong(address + valueOffset);
+            }
+
+            @Override
+            public String toString() {
+                return String.format("LongConstant[name=%s, value=%d (0x%x)]", getName(), getValue(), getValue());
+            }
+        }
+    }
+
+    class Flags implements Iterable<Flags.Flag> {
+
+        private long address;
+        private long entrySize;
+        private long typeOffset;
+        private long nameOffset;
+        private long addrOffset;
+
+        public Flags(HashMap<String, VMFields.Field> vmStructs, HashMap<String, VMTypes.Type> vmTypes) {
+            address = vmStructs.get("Flag::flags").getValue();
+            entrySize = vmTypes.get("Flag").getSize();
+            typeOffset = vmStructs.get("Flag::_type").getOffset();
+            nameOffset = vmStructs.get("Flag::_name").getOffset();
+            addrOffset = vmStructs.get("Flag::_addr").getOffset();
+
+            assert vmTypes.get("bool").getSize() == Byte.BYTES;
+            assert vmTypes.get("intx").getSize() == Long.BYTES;
+            assert vmTypes.get("uintx").getSize() == Long.BYTES;
+        }
+
+        public Iterator<Flags.Flag> iterator() {
+            return new Iterator<Flags.Flag>() {
+
+                private int index = 0;
+
+                private Flag current() {
+                    return new Flag(address + entrySize * index);
+                }
+
+                /**
+                 * The last entry is identified by a NULL name.
+                 */
+                public boolean hasNext() {
+                    Flag entry = current();
+                    return entry.getName() != null;
+                }
+
+                public Flag next() {
+                    Flag entry = current();
+                    index++;
+                    return entry;
+                }
+            };
+        }
+
+        class Flag {
+
+            private long entryAddress;
+
+            Flag(long address) {
+                this.entryAddress = address;
+            }
+
+            public String getType() {
+                long typeAddress = unsafe.getAddress(entryAddress + typeOffset);
+                return readCString(typeAddress);
+            }
+
+            public String getName() {
+                long nameAddress = unsafe.getAddress(entryAddress + nameOffset);
+                return readCString(nameAddress);
+            }
+
+            public long getAddr() {
+                return unsafe.getAddress(entryAddress + addrOffset);
+            }
+
+            public Object getValue() {
+                switch (getType()) {
+                    case "bool":
+                        return Boolean.valueOf(unsafe.getByte(getAddr()) != 0);
+                    case "intx":
+                    case "uintx":
+                    case "uint64_t":
+                        return Long.valueOf(unsafe.getLong(getAddr()));
+                    case "double":
+                        return Double.valueOf(unsafe.getDouble(getAddr()));
+                    case "ccstr":
+                    case "ccstrlist":
+                        return readCString(getAddr());
+                    default:
+                        throw new JVMCIError(getType());
+                }
+            }
+
+            @Override
+            public String toString() {
+                return String.format("Flag[type=%s, name=%s, value=%s]", getType(), getName(), getValue());
+            }
+        }
+    }
+
+    // os information, register layout, code generation, ...
+    @HotSpotVMValue(expression = "DEBUG_ONLY(1) NOT_DEBUG(0)") @Stable public boolean cAssertions;
+    public final boolean windowsOs = System.getProperty("os.name", "").startsWith("Windows");
+
+    @HotSpotVMFlag(name = "CodeEntryAlignment") @Stable public int codeEntryAlignment;
+    @HotSpotVMFlag(name = "VerifyOops") @Stable public boolean verifyOops;
+    @HotSpotVMFlag(name = "CITime") @Stable public boolean ciTime;
+    @HotSpotVMFlag(name = "CITimeEach") @Stable public boolean ciTimeEach;
+    @HotSpotVMFlag(name = "CompileTheWorldStartAt", optional = true) @Stable public int compileTheWorldStartAt;
+    @HotSpotVMFlag(name = "CompileTheWorldStopAt", optional = true) @Stable public int compileTheWorldStopAt;
+    @HotSpotVMFlag(name = "DontCompileHugeMethods") @Stable public boolean dontCompileHugeMethods;
+    @HotSpotVMFlag(name = "HugeMethodLimit") @Stable public int hugeMethodLimit;
+    @HotSpotVMFlag(name = "PrintInlining") @Stable public boolean printInlining;
+    @HotSpotVMFlag(name = "JVMCIUseFastLocking") @Stable public boolean useFastLocking;
+    @HotSpotVMFlag(name = "ForceUnreachable") @Stable public boolean forceUnreachable;
+
+    @HotSpotVMFlag(name = "UseTLAB") @Stable public boolean useTLAB;
+    @HotSpotVMFlag(name = "UseBiasedLocking") @Stable public boolean useBiasedLocking;
+    @HotSpotVMFlag(name = "UsePopCountInstruction") @Stable public boolean usePopCountInstruction;
+    @HotSpotVMFlag(name = "UseCountLeadingZerosInstruction", archs = {"amd64"}) @Stable public boolean useCountLeadingZerosInstruction;
+    @HotSpotVMFlag(name = "UseCountTrailingZerosInstruction", archs = {"amd64"}) @Stable public boolean useCountTrailingZerosInstruction;
+    @HotSpotVMFlag(name = "UseAESIntrinsics") @Stable public boolean useAESIntrinsics;
+    @HotSpotVMFlag(name = "UseCRC32Intrinsics") @Stable public boolean useCRC32Intrinsics;
+    @HotSpotVMFlag(name = "UseG1GC") @Stable public boolean useG1GC;
+    @HotSpotVMFlag(name = "UseConcMarkSweepGC") @Stable public boolean useCMSGC;
+
+    @HotSpotVMFlag(name = "AllocatePrefetchStyle") @Stable public int allocatePrefetchStyle;
+    @HotSpotVMFlag(name = "AllocatePrefetchInstr") @Stable public int allocatePrefetchInstr;
+    @HotSpotVMFlag(name = "AllocatePrefetchLines") @Stable public int allocatePrefetchLines;
+    @HotSpotVMFlag(name = "AllocateInstancePrefetchLines") @Stable public int allocateInstancePrefetchLines;
+    @HotSpotVMFlag(name = "AllocatePrefetchStepSize") @Stable public int allocatePrefetchStepSize;
+    @HotSpotVMFlag(name = "AllocatePrefetchDistance") @Stable public int allocatePrefetchDistance;
+
+    @HotSpotVMFlag(name = "FlightRecorder", optional = true) @Stable public boolean flightRecorder;
+
+    @HotSpotVMField(name = "Universe::_collectedHeap", type = "CollectedHeap*", get = HotSpotVMField.Type.VALUE) @Stable private long universeCollectedHeap;
+    @HotSpotVMField(name = "CollectedHeap::_total_collections", type = "unsigned int", get = HotSpotVMField.Type.OFFSET) @Stable private int collectedHeapTotalCollectionsOffset;
+
+    public long gcTotalCollectionsAddress() {
+        return universeCollectedHeap + collectedHeapTotalCollectionsOffset;
+    }
+
+    @HotSpotVMFlag(name = "JVMCIDeferredInitBarriers") @Stable public boolean useDeferredInitBarriers;
+    @HotSpotVMFlag(name = "JVMCIHProfEnabled") @Stable public boolean useHeapProfiler;
+
+    // Compressed Oops related values.
+    @HotSpotVMFlag(name = "UseCompressedOops") @Stable public boolean useCompressedOops;
+    @HotSpotVMFlag(name = "UseCompressedClassPointers") @Stable public boolean useCompressedClassPointers;
+
+    @HotSpotVMField(name = "Universe::_narrow_oop._base", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long narrowOopBase;
+    @HotSpotVMField(name = "Universe::_narrow_oop._shift", type = "int", get = HotSpotVMField.Type.VALUE) @Stable public int narrowOopShift;
+    @HotSpotVMFlag(name = "ObjectAlignmentInBytes") @Stable public int objectAlignment;
+
+    public int logMinObjAlignment() {
+        return (int) (Math.log(objectAlignment) / Math.log(2));
+    }
+
+    @HotSpotVMField(name = "Universe::_narrow_klass._base", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long narrowKlassBase;
+    @HotSpotVMField(name = "Universe::_narrow_klass._shift", type = "int", get = HotSpotVMField.Type.VALUE) @Stable public int narrowKlassShift;
+    @HotSpotVMConstant(name = "LogKlassAlignmentInBytes") @Stable public int logKlassAlignment;
+
+    // CPU capabilities
+    @HotSpotVMFlag(name = "UseSSE") @Stable public int useSSE;
+    @HotSpotVMFlag(name = "UseAVX", archs = {"amd64"}) @Stable public int useAVX;
+
+    // X86 specific values
+    @HotSpotVMField(name = "VM_Version::_cpuFeatures", type = "int", get = HotSpotVMField.Type.VALUE, archs = {"amd64"}) @Stable public int x86CPUFeatures;
+    @HotSpotVMConstant(name = "VM_Version::CPU_CX8", archs = {"amd64"}) @Stable public int cpuCX8;
+    @HotSpotVMConstant(name = "VM_Version::CPU_CMOV", archs = {"amd64"}) @Stable public int cpuCMOV;
+    @HotSpotVMConstant(name = "VM_Version::CPU_FXSR", archs = {"amd64"}) @Stable public int cpuFXSR;
+    @HotSpotVMConstant(name = "VM_Version::CPU_HT", archs = {"amd64"}) @Stable public int cpuHT;
+    @HotSpotVMConstant(name = "VM_Version::CPU_MMX", archs = {"amd64"}) @Stable public int cpuMMX;
+    @HotSpotVMConstant(name = "VM_Version::CPU_3DNOW_PREFETCH", archs = {"amd64"}) @Stable public int cpu3DNOWPREFETCH;
+    @HotSpotVMConstant(name = "VM_Version::CPU_SSE", archs = {"amd64"}) @Stable public int cpuSSE;
+    @HotSpotVMConstant(name = "VM_Version::CPU_SSE2", archs = {"amd64"}) @Stable public int cpuSSE2;
+    @HotSpotVMConstant(name = "VM_Version::CPU_SSE3", archs = {"amd64"}) @Stable public int cpuSSE3;
+    @HotSpotVMConstant(name = "VM_Version::CPU_SSSE3", archs = {"amd64"}) @Stable public int cpuSSSE3;
+    @HotSpotVMConstant(name = "VM_Version::CPU_SSE4A", archs = {"amd64"}) @Stable public int cpuSSE4A;
+    @HotSpotVMConstant(name = "VM_Version::CPU_SSE4_1", archs = {"amd64"}) @Stable public int cpuSSE41;
+    @HotSpotVMConstant(name = "VM_Version::CPU_SSE4_2", archs = {"amd64"}) @Stable public int cpuSSE42;
+    @HotSpotVMConstant(name = "VM_Version::CPU_POPCNT", archs = {"amd64"}) @Stable public int cpuPOPCNT;
+    @HotSpotVMConstant(name = "VM_Version::CPU_LZCNT", archs = {"amd64"}) @Stable public int cpuLZCNT;
+    @HotSpotVMConstant(name = "VM_Version::CPU_TSC", archs = {"amd64"}) @Stable public int cpuTSC;
+    @HotSpotVMConstant(name = "VM_Version::CPU_TSCINV", archs = {"amd64"}) @Stable public int cpuTSCINV;
+    @HotSpotVMConstant(name = "VM_Version::CPU_AVX", archs = {"amd64"}) @Stable public int cpuAVX;
+    @HotSpotVMConstant(name = "VM_Version::CPU_AVX2", archs = {"amd64"}) @Stable public int cpuAVX2;
+    @HotSpotVMConstant(name = "VM_Version::CPU_AES", archs = {"amd64"}) @Stable public int cpuAES;
+    @HotSpotVMConstant(name = "VM_Version::CPU_ERMS", archs = {"amd64"}) @Stable public int cpuERMS;
+    @HotSpotVMConstant(name = "VM_Version::CPU_CLMUL", archs = {"amd64"}) @Stable public int cpuCLMUL;
+    @HotSpotVMConstant(name = "VM_Version::CPU_BMI1", archs = {"amd64"}) @Stable public int cpuBMI1;
+
+    // SPARC specific values
+    @HotSpotVMField(name = "VM_Version::_features", type = "int", get = HotSpotVMField.Type.VALUE, archs = {"sparc"}) @Stable public int sparcFeatures;
+    @HotSpotVMConstant(name = "VM_Version::vis3_instructions_m", archs = {"sparc"}) @Stable public int vis3Instructions;
+    @HotSpotVMConstant(name = "VM_Version::vis2_instructions_m", archs = {"sparc"}) @Stable public int vis2Instructions;
+    @HotSpotVMConstant(name = "VM_Version::vis1_instructions_m", archs = {"sparc"}) @Stable public int vis1Instructions;
+    @HotSpotVMConstant(name = "VM_Version::cbcond_instructions_m", archs = {"sparc"}) @Stable public int cbcondInstructions;
+
+    // offsets, ...
+    @HotSpotVMFlag(name = "StackShadowPages") @Stable public int stackShadowPages;
+    @HotSpotVMFlag(name = "UseStackBanging") @Stable public boolean useStackBanging;
+    @HotSpotVMConstant(name = "STACK_BIAS") @Stable public int stackBias;
+
+    @HotSpotVMField(name = "oopDesc::_mark", type = "markOop", get = HotSpotVMField.Type.OFFSET) @Stable public int markOffset;
+    @HotSpotVMField(name = "oopDesc::_metadata._klass", type = "Klass*", get = HotSpotVMField.Type.OFFSET) @Stable public int hubOffset;
+
+    @HotSpotVMField(name = "Klass::_prototype_header", type = "markOop", get = HotSpotVMField.Type.OFFSET) @Stable public int prototypeMarkWordOffset;
+    @HotSpotVMField(name = "Klass::_subklass", type = "Klass*", get = HotSpotVMField.Type.OFFSET) @Stable public int subklassOffset;
+    @HotSpotVMField(name = "Klass::_next_sibling", type = "Klass*", get = HotSpotVMField.Type.OFFSET) @Stable public int nextSiblingOffset;
+    @HotSpotVMField(name = "Klass::_super_check_offset", type = "juint", get = HotSpotVMField.Type.OFFSET) @Stable public int superCheckOffsetOffset;
+    @HotSpotVMField(name = "Klass::_secondary_super_cache", type = "Klass*", get = HotSpotVMField.Type.OFFSET) @Stable public int secondarySuperCacheOffset;
+    @HotSpotVMField(name = "Klass::_secondary_supers", type = "Array<Klass*>*", get = HotSpotVMField.Type.OFFSET) @Stable public int secondarySupersOffset;
+
+    /**
+     * The offset of the _java_mirror field (of type {@link Class}) in a Klass.
+     */
+    @HotSpotVMField(name = "Klass::_java_mirror", type = "oop", get = HotSpotVMField.Type.OFFSET) @Stable public int classMirrorOffset;
+
+    @HotSpotVMField(name = "Klass::_super", type = "Klass*", get = HotSpotVMField.Type.OFFSET) @Stable public int klassSuperKlassOffset;
+    @HotSpotVMField(name = "Klass::_modifier_flags", type = "jint", get = HotSpotVMField.Type.OFFSET) @Stable public int klassModifierFlagsOffset;
+    @HotSpotVMField(name = "Klass::_access_flags", type = "AccessFlags", get = HotSpotVMField.Type.OFFSET) @Stable public int klassAccessFlagsOffset;
+    @HotSpotVMField(name = "Klass::_layout_helper", type = "jint", get = HotSpotVMField.Type.OFFSET) @Stable public int klassLayoutHelperOffset;
+
+    @HotSpotVMConstant(name = "Klass::_lh_neutral_value") @Stable public int klassLayoutHelperNeutralValue;
+    @HotSpotVMConstant(name = "Klass::_lh_instance_slow_path_bit") @Stable public int klassLayoutHelperInstanceSlowPathBit;
+    @HotSpotVMConstant(name = "Klass::_lh_log2_element_size_shift") @Stable public int layoutHelperLog2ElementSizeShift;
+    @HotSpotVMConstant(name = "Klass::_lh_log2_element_size_mask") @Stable public int layoutHelperLog2ElementSizeMask;
+    @HotSpotVMConstant(name = "Klass::_lh_element_type_shift") @Stable public int layoutHelperElementTypeShift;
+    @HotSpotVMConstant(name = "Klass::_lh_element_type_mask") @Stable public int layoutHelperElementTypeMask;
+    @HotSpotVMConstant(name = "Klass::_lh_header_size_shift") @Stable public int layoutHelperHeaderSizeShift;
+    @HotSpotVMConstant(name = "Klass::_lh_header_size_mask") @Stable public int layoutHelperHeaderSizeMask;
+    @HotSpotVMConstant(name = "Klass::_lh_array_tag_shift") @Stable public int layoutHelperArrayTagShift;
+    @HotSpotVMConstant(name = "Klass::_lh_array_tag_type_value") @Stable public int layoutHelperArrayTagTypeValue;
+    @HotSpotVMConstant(name = "Klass::_lh_array_tag_obj_value") @Stable public int layoutHelperArrayTagObjectValue;
+
+    /**
+     * This filters out the bit that differentiates a type array from an object array.
+     */
+    public int layoutHelperElementTypePrimitiveInPlace() {
+        return (layoutHelperArrayTagTypeValue & ~layoutHelperArrayTagObjectValue) << layoutHelperArrayTagShift;
+    }
+
+    /**
+     * Bit pattern in the klass layout helper that can be used to identify arrays.
+     */
+    public final int arrayKlassLayoutHelperIdentifier = 0x80000000;
+
+    @HotSpotVMField(name = "ArrayKlass::_component_mirror", type = "oop", get = HotSpotVMField.Type.OFFSET) @Stable public int arrayKlassComponentMirrorOffset;
+
+    @HotSpotVMType(name = "vtableEntry", get = HotSpotVMType.Type.SIZE) @Stable public int vtableEntrySize;
+    @HotSpotVMField(name = "vtableEntry::_method", type = "Method*", get = HotSpotVMField.Type.OFFSET) @Stable public int vtableEntryMethodOffset;
+    @HotSpotVMValue(expression = "InstanceKlass::vtable_start_offset() * HeapWordSize") @Stable public int instanceKlassVtableStartOffset;
+    @HotSpotVMValue(expression = "InstanceKlass::vtable_length_offset() * HeapWordSize") @Stable public int instanceKlassVtableLengthOffset;
+    @HotSpotVMValue(expression = "Universe::base_vtable_size() / vtableEntry::size()") @Stable public int baseVtableLength;
+
+    /**
+     * The offset of the array length word in an array object's header.
+     */
+    @HotSpotVMValue(expression = "arrayOopDesc::length_offset_in_bytes()") @Stable public int arrayLengthOffset;
+
+    @HotSpotVMField(name = "Array<int>::_length", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int arrayU1LengthOffset;
+    @HotSpotVMField(name = "Array<u1>::_data", type = "", get = HotSpotVMField.Type.OFFSET) @Stable public int arrayU1DataOffset;
+    @HotSpotVMField(name = "Array<u2>::_data", type = "", get = HotSpotVMField.Type.OFFSET) @Stable public int arrayU2DataOffset;
+    @HotSpotVMField(name = "Array<Klass*>::_length", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int metaspaceArrayLengthOffset;
+    @HotSpotVMField(name = "Array<Klass*>::_data[0]", type = "Klass*", get = HotSpotVMField.Type.OFFSET) @Stable public int metaspaceArrayBaseOffset;
+
+    @HotSpotVMField(name = "InstanceKlass::_source_file_name_index", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int instanceKlassSourceFileNameIndexOffset;
+    @HotSpotVMField(name = "InstanceKlass::_init_state", type = "u1", get = HotSpotVMField.Type.OFFSET) @Stable public int instanceKlassInitStateOffset;
+    @HotSpotVMField(name = "InstanceKlass::_constants", type = "ConstantPool*", get = HotSpotVMField.Type.OFFSET) @Stable public int instanceKlassConstantsOffset;
+    @HotSpotVMField(name = "InstanceKlass::_fields", type = "Array<u2>*", get = HotSpotVMField.Type.OFFSET) @Stable public int instanceKlassFieldsOffset;
+
+    @HotSpotVMConstant(name = "InstanceKlass::linked") @Stable public int instanceKlassStateLinked;
+    @HotSpotVMConstant(name = "InstanceKlass::fully_initialized") @Stable public int instanceKlassStateFullyInitialized;
+
+    @HotSpotVMField(name = "ObjArrayKlass::_element_klass", type = "Klass*", get = HotSpotVMField.Type.OFFSET) @Stable public int arrayClassElementOffset;
+
+    @HotSpotVMConstant(name = "FieldInfo::access_flags_offset") @Stable public int fieldInfoAccessFlagsOffset;
+    @HotSpotVMConstant(name = "FieldInfo::name_index_offset") @Stable public int fieldInfoNameIndexOffset;
+    @HotSpotVMConstant(name = "FieldInfo::signature_index_offset") @Stable public int fieldInfoSignatureIndexOffset;
+    @HotSpotVMConstant(name = "FieldInfo::initval_index_offset") @Stable public int fieldInfoInitvalIndexOffset;
+    @HotSpotVMConstant(name = "FieldInfo::low_packed_offset") @Stable public int fieldInfoLowPackedOffset;
+    @HotSpotVMConstant(name = "FieldInfo::high_packed_offset") @Stable public int fieldInfoHighPackedOffset;
+    @HotSpotVMConstant(name = "FieldInfo::field_slots") @Stable public int fieldInfoFieldSlots;
+
+    @HotSpotVMConstant(name = "FIELDINFO_TAG_SIZE") @Stable public int fieldInfoTagSize;
+
+    @HotSpotVMConstant(name = "JVM_ACC_FIELD_INTERNAL") @Stable public int jvmAccFieldInternal;
+    @HotSpotVMConstant(name = "JVM_ACC_FIELD_STABLE") @Stable public int jvmAccFieldStable;
+    @HotSpotVMConstant(name = "JVM_ACC_FIELD_HAS_GENERIC_SIGNATURE") @Stable public int jvmAccFieldHasGenericSignature;
+    @HotSpotVMConstant(name = "JVM_ACC_WRITTEN_FLAGS") @Stable public int jvmAccWrittenFlags;
+
+    @HotSpotVMField(name = "Thread::_tlab", type = "ThreadLocalAllocBuffer", get = HotSpotVMField.Type.OFFSET) @Stable public int threadTlabOffset;
+
+    @HotSpotVMField(name = "JavaThread::_anchor", type = "JavaFrameAnchor", get = HotSpotVMField.Type.OFFSET) @Stable public int javaThreadAnchorOffset;
+    @HotSpotVMField(name = "JavaThread::_threadObj", type = "oop", get = HotSpotVMField.Type.OFFSET) @Stable public int threadObjectOffset;
+    @HotSpotVMField(name = "JavaThread::_osthread", type = "OSThread*", get = HotSpotVMField.Type.OFFSET) @Stable public int osThreadOffset;
+    @HotSpotVMField(name = "JavaThread::_dirty_card_queue", type = "DirtyCardQueue", get = HotSpotVMField.Type.OFFSET) @Stable public int javaThreadDirtyCardQueueOffset;
+    @HotSpotVMField(name = "JavaThread::_is_method_handle_return", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int threadIsMethodHandleReturnOffset;
+    @HotSpotVMField(name = "JavaThread::_satb_mark_queue", type = "ObjPtrQueue", get = HotSpotVMField.Type.OFFSET) @Stable public int javaThreadSatbMarkQueueOffset;
+    @HotSpotVMField(name = "JavaThread::_vm_result", type = "oop", get = HotSpotVMField.Type.OFFSET) @Stable public int threadObjectResultOffset;
+    @HotSpotVMValue(expression = "in_bytes(JavaThread::jvmci_counters_offset())") @Stable public int jvmciCountersThreadOffset;
+
+    /**
+     * An invalid value for {@link #rtldDefault}.
+     */
+    public static final long INVALID_RTLD_DEFAULT_HANDLE = 0xDEADFACE;
+
+    /**
+     * Address of the library lookup routine. The C signature of this routine is:
+     *
+     * <pre>
+     *     void* (const char *filename, char *ebuf, int ebuflen)
+     * </pre>
+     */
+    @HotSpotVMValue(expression = "os::dll_load", get = HotSpotVMValue.Type.ADDRESS) @Stable public long dllLoad;
+
+    /**
+     * Address of the library lookup routine. The C signature of this routine is:
+     *
+     * <pre>
+     *     void* (void* handle, const char* name)
+     * </pre>
+     */
+    @HotSpotVMValue(expression = "os::dll_lookup", get = HotSpotVMValue.Type.ADDRESS) @Stable public long dllLookup;
+
+    /**
+     * A pseudo-handle which when used as the first argument to {@link #dllLookup} means lookup will
+     * return the first occurrence of the desired symbol using the default library search order. If
+     * this field is {@value #INVALID_RTLD_DEFAULT_HANDLE}, then this capability is not supported on
+     * the current platform.
+     */
+    @HotSpotVMValue(expression = "RTLD_DEFAULT", defines = {"TARGET_OS_FAMILY_bsd", "TARGET_OS_FAMILY_linux"}, get = HotSpotVMValue.Type.ADDRESS) @Stable public long rtldDefault = INVALID_RTLD_DEFAULT_HANDLE;
+
+    /**
+     * This field is used to pass exception objects into and out of the runtime system during
+     * exception handling for compiled code.
+     * <p>
+     * <b>NOTE: This is not the same as {@link #pendingExceptionOffset}.</b>
+     */
+    @HotSpotVMField(name = "JavaThread::_exception_oop", type = "oop", get = HotSpotVMField.Type.OFFSET) @Stable public int threadExceptionOopOffset;
+    @HotSpotVMField(name = "JavaThread::_exception_pc", type = "address", get = HotSpotVMField.Type.OFFSET) @Stable public int threadExceptionPcOffset;
+
+    @HotSpotVMField(name = "JavaFrameAnchor::_last_Java_sp", type = "intptr_t*", get = HotSpotVMField.Type.OFFSET) @Stable private int javaFrameAnchorLastJavaSpOffset;
+    @HotSpotVMField(name = "JavaFrameAnchor::_last_Java_pc", type = "address", get = HotSpotVMField.Type.OFFSET) @Stable private int javaFrameAnchorLastJavaPcOffset;
+    @HotSpotVMField(name = "JavaFrameAnchor::_last_Java_fp", type = "intptr_t*", get = HotSpotVMField.Type.OFFSET, archs = {"amd64"}) @Stable private int javaFrameAnchorLastJavaFpOffset;
+    @HotSpotVMField(name = "JavaFrameAnchor::_flags", type = "int", get = HotSpotVMField.Type.OFFSET, archs = {"sparc"}) @Stable private int javaFrameAnchorFlagsOffset;
+
+    public int threadLastJavaSpOffset() {
+        return javaThreadAnchorOffset + javaFrameAnchorLastJavaSpOffset;
+    }
+
+    public int threadLastJavaPcOffset() {
+        return javaThreadAnchorOffset + javaFrameAnchorLastJavaPcOffset;
+    }
+
+    /**
+     * This value is only valid on AMD64.
+     */
+    public int threadLastJavaFpOffset() {
+        // TODO add an assert for AMD64
+        return javaThreadAnchorOffset + javaFrameAnchorLastJavaFpOffset;
+    }
+
+    /**
+     * This value is only valid on SPARC.
+     */
+    public int threadJavaFrameAnchorFlagsOffset() {
+        // TODO add an assert for SPARC
+        return javaThreadAnchorOffset + javaFrameAnchorFlagsOffset;
+    }
+
+    // These are only valid on AMD64.
+    @HotSpotVMConstant(name = "frame::arg_reg_save_area_bytes", archs = {"amd64"}) @Stable public int runtimeCallStackSize;
+    @HotSpotVMConstant(name = "frame::interpreter_frame_sender_sp_offset", archs = {"amd64"}) @Stable public int frameInterpreterFrameSenderSpOffset;
+    @HotSpotVMConstant(name = "frame::interpreter_frame_last_sp_offset", archs = {"amd64"}) @Stable public int frameInterpreterFrameLastSpOffset;
+
+    @HotSpotVMField(name = "PtrQueue::_active", type = "bool", get = HotSpotVMField.Type.OFFSET) @Stable public int ptrQueueActiveOffset;
+    @HotSpotVMField(name = "PtrQueue::_buf", type = "void**", get = HotSpotVMField.Type.OFFSET) @Stable public int ptrQueueBufferOffset;
+    @HotSpotVMField(name = "PtrQueue::_index", type = "size_t", get = HotSpotVMField.Type.OFFSET) @Stable public int ptrQueueIndexOffset;
+
+    @HotSpotVMField(name = "OSThread::_interrupted", type = "jint", get = HotSpotVMField.Type.OFFSET) @Stable public int osThreadInterruptedOffset;
+
+    @HotSpotVMConstant(name = "markOopDesc::unlocked_value") @Stable public int unlockedMask;
+    @HotSpotVMConstant(name = "markOopDesc::biased_lock_mask_in_place") @Stable public int biasedLockMaskInPlace;
+    @HotSpotVMConstant(name = "markOopDesc::age_mask_in_place") @Stable public int ageMaskInPlace;
+    @HotSpotVMConstant(name = "markOopDesc::epoch_mask_in_place") @Stable public int epochMaskInPlace;
+
+    @HotSpotVMConstant(name = "markOopDesc::hash_shift") @Stable public long markOopDescHashShift;
+    @HotSpotVMConstant(name = "markOopDesc::hash_mask") @Stable public long markOopDescHashMask;
+    @HotSpotVMConstant(name = "markOopDesc::hash_mask_in_place") @Stable public long markOopDescHashMaskInPlace;
+
+    @HotSpotVMConstant(name = "markOopDesc::biased_lock_pattern") @Stable public int biasedLockPattern;
+    @HotSpotVMConstant(name = "markOopDesc::no_hash_in_place") @Stable public int markWordNoHashInPlace;
+    @HotSpotVMConstant(name = "markOopDesc::no_lock_in_place") @Stable public int markWordNoLockInPlace;
+
+    /**
+     * See markOopDesc::prototype().
+     */
+    public long arrayPrototypeMarkWord() {
+        return markWordNoHashInPlace | markWordNoLockInPlace;
+    }
+
+    /**
+     * See markOopDesc::copy_set_hash().
+     */
+    public long tlabIntArrayMarkWord() {
+        long tmp = arrayPrototypeMarkWord() & (~markOopDescHashMaskInPlace);
+        tmp |= ((0x2 & markOopDescHashMask) << markOopDescHashShift);
+        return tmp;
+    }
+
+    /**
+     * Offset of the _pending_exception field in ThreadShadow (defined in exceptions.hpp). This
+     * field is used to propagate exceptions through C/C++ calls.
+     * <p>
+     * <b>NOTE: This is not the same as {@link #threadExceptionOopOffset}.</b>
+     */
+    @HotSpotVMField(name = "ThreadShadow::_pending_exception", type = "oop", get = HotSpotVMField.Type.OFFSET) @Stable public int pendingExceptionOffset;
+    @HotSpotVMField(name = "ThreadShadow::_pending_deoptimization", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int pendingDeoptimizationOffset;
+    @HotSpotVMField(name = "ThreadShadow::_pending_failed_speculation", type = "oop", get = HotSpotVMField.Type.OFFSET) @Stable public int pendingFailedSpeculationOffset;
+    @HotSpotVMField(name = "ThreadShadow::_pending_transfer_to_interpreter", type = "bool", get = HotSpotVMField.Type.OFFSET) @Stable public int pendingTransferToInterpreterOffset;
+
+    /**
+     * Mark word right shift to get identity hash code.
+     */
+    @HotSpotVMConstant(name = "markOopDesc::hash_shift") @Stable public int identityHashCodeShift;
+
+    /**
+     * Identity hash code value when uninitialized.
+     */
+    @HotSpotVMConstant(name = "markOopDesc::no_hash") @Stable public int uninitializedIdentityHashCodeValue;
+
+    @HotSpotVMField(name = "Method::_access_flags", type = "AccessFlags", get = HotSpotVMField.Type.OFFSET) @Stable public int methodAccessFlagsOffset;
+    @HotSpotVMField(name = "Method::_constMethod", type = "ConstMethod*", get = HotSpotVMField.Type.OFFSET) @Stable public int methodConstMethodOffset;
+    @HotSpotVMField(name = "Method::_intrinsic_id", type = "u1", get = HotSpotVMField.Type.OFFSET) @Stable public int methodIntrinsicIdOffset;
+    @HotSpotVMField(name = "Method::_flags", type = "u1", get = HotSpotVMField.Type.OFFSET) @Stable public int methodFlagsOffset;
+    @HotSpotVMField(name = "Method::_vtable_index", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int methodVtableIndexOffset;
+
+    @HotSpotVMConstant(name = "Method::_jfr_towrite") @Stable public int methodFlagsJfrTowrite;
+    @HotSpotVMConstant(name = "Method::_caller_sensitive") @Stable public int methodFlagsCallerSensitive;
+    @HotSpotVMConstant(name = "Method::_force_inline") @Stable public int methodFlagsForceInline;
+    @HotSpotVMConstant(name = "Method::_dont_inline") @Stable public int methodFlagsDontInline;
+    @HotSpotVMConstant(name = "Method::_hidden") @Stable public int methodFlagsHidden;
+    @HotSpotVMConstant(name = "Method::nonvirtual_vtable_index") @Stable public int nonvirtualVtableIndex;
+    @HotSpotVMConstant(name = "Method::invalid_vtable_index") @Stable public int invalidVtableIndex;
+
+    @HotSpotVMConstant(name = "InvocationEntryBci") @Stable public int invocationEntryBci;
+
+    @HotSpotVMConstant(name = "JVM_ACC_MONITOR_MATCH") @Stable public int jvmAccMonitorMatch;
+    @HotSpotVMConstant(name = "JVM_ACC_HAS_MONITOR_BYTECODES") @Stable public int jvmAccHasMonitorBytecodes;
+
+    @HotSpotVMField(name = "JVMCIEnv::_task", type = "CompileTask*", get = HotSpotVMField.Type.OFFSET) @Stable public int jvmciEnvTaskOffset;
+    @HotSpotVMField(name = "JVMCIEnv::_jvmti_can_hotswap_or_post_breakpoint", type = "bool", get = HotSpotVMField.Type.OFFSET) @Stable public int jvmciEnvJvmtiCanHotswapOrPostBreakpointOffset;
+    @HotSpotVMField(name = "CompileTask::_num_inlined_bytecodes", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int compileTaskNumInlinedBytecodesOffset;
+
+    /**
+     * Value of Method::extra_stack_entries().
+     */
+    @HotSpotVMValue(expression = "Method::extra_stack_entries()") @Stable public int extraStackEntries;
+
+    @HotSpotVMField(name = "ConstMethod::_constants", type = "ConstantPool*", get = HotSpotVMField.Type.OFFSET) @Stable public int constMethodConstantsOffset;
+    @HotSpotVMField(name = "ConstMethod::_flags", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int constMethodFlagsOffset;
+    @HotSpotVMField(name = "ConstMethod::_code_size", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int constMethodCodeSizeOffset;
+    @HotSpotVMField(name = "ConstMethod::_name_index", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int constMethodNameIndexOffset;
+    @HotSpotVMField(name = "ConstMethod::_signature_index", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int constMethodSignatureIndexOffset;
+    @HotSpotVMField(name = "ConstMethod::_max_stack", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int constMethodMaxStackOffset;
+    @HotSpotVMField(name = "ConstMethod::_max_locals", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int methodMaxLocalsOffset;
+
+    @HotSpotVMConstant(name = "ConstMethod::_has_linenumber_table") @Stable public int constMethodHasLineNumberTable;
+    @HotSpotVMConstant(name = "ConstMethod::_has_localvariable_table") @Stable public int constMethodHasLocalVariableTable;
+    @HotSpotVMConstant(name = "ConstMethod::_has_exception_table") @Stable public int constMethodHasExceptionTable;
+
+    @HotSpotVMType(name = "ExceptionTableElement", get = HotSpotVMType.Type.SIZE) @Stable public int exceptionTableElementSize;
+    @HotSpotVMField(name = "ExceptionTableElement::start_pc", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int exceptionTableElementStartPcOffset;
+    @HotSpotVMField(name = "ExceptionTableElement::end_pc", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int exceptionTableElementEndPcOffset;
+    @HotSpotVMField(name = "ExceptionTableElement::handler_pc", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int exceptionTableElementHandlerPcOffset;
+    @HotSpotVMField(name = "ExceptionTableElement::catch_type_index", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int exceptionTableElementCatchTypeIndexOffset;
+
+    @HotSpotVMType(name = "LocalVariableTableElement", get = HotSpotVMType.Type.SIZE) @Stable public int localVariableTableElementSize;
+    @HotSpotVMField(name = "LocalVariableTableElement::start_bci", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int localVariableTableElementStartBciOffset;
+    @HotSpotVMField(name = "LocalVariableTableElement::length", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int localVariableTableElementLengthOffset;
+    @HotSpotVMField(name = "LocalVariableTableElement::name_cp_index", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int localVariableTableElementNameCpIndexOffset;
+    @HotSpotVMField(name = "LocalVariableTableElement::descriptor_cp_index", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int localVariableTableElementDescriptorCpIndexOffset;
+    @HotSpotVMField(name = "LocalVariableTableElement::signature_cp_index", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int localVariableTableElementSignatureCpIndexOffset;
+    @HotSpotVMField(name = "LocalVariableTableElement::slot", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int localVariableTableElementSlotOffset;
+
+    @HotSpotVMType(name = "ConstantPool", get = HotSpotVMType.Type.SIZE) @Stable public int constantPoolSize;
+    @HotSpotVMField(name = "ConstantPool::_tags", type = "Array<u1>*", get = HotSpotVMField.Type.OFFSET) @Stable public int constantPoolTagsOffset;
+    @HotSpotVMField(name = "ConstantPool::_pool_holder", type = "InstanceKlass*", get = HotSpotVMField.Type.OFFSET) @Stable public int constantPoolHolderOffset;
+    @HotSpotVMField(name = "ConstantPool::_length", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int constantPoolLengthOffset;
+
+    @HotSpotVMConstant(name = "ConstantPool::CPCACHE_INDEX_TAG") @Stable public int constantPoolCpCacheIndexTag;
+
+    @HotSpotVMConstant(name = "JVM_CONSTANT_Utf8") @Stable public int jvmConstantUtf8;
+    @HotSpotVMConstant(name = "JVM_CONSTANT_Integer") @Stable public int jvmConstantInteger;
+    @HotSpotVMConstant(name = "JVM_CONSTANT_Long") @Stable public int jvmConstantLong;
+    @HotSpotVMConstant(name = "JVM_CONSTANT_Float") @Stable public int jvmConstantFloat;
+    @HotSpotVMConstant(name = "JVM_CONSTANT_Double") @Stable public int jvmConstantDouble;
+    @HotSpotVMConstant(name = "JVM_CONSTANT_Class") @Stable public int jvmConstantClass;
+    @HotSpotVMConstant(name = "JVM_CONSTANT_UnresolvedClass") @Stable public int jvmConstantUnresolvedClass;
+    @HotSpotVMConstant(name = "JVM_CONSTANT_UnresolvedClassInError") @Stable public int jvmConstantUnresolvedClassInError;
+    @HotSpotVMConstant(name = "JVM_CONSTANT_String") @Stable public int jvmConstantString;
+    @HotSpotVMConstant(name = "JVM_CONSTANT_Fieldref") @Stable public int jvmConstantFieldref;
+    @HotSpotVMConstant(name = "JVM_CONSTANT_Methodref") @Stable public int jvmConstantMethodref;
+    @HotSpotVMConstant(name = "JVM_CONSTANT_InterfaceMethodref") @Stable public int jvmConstantInterfaceMethodref;
+    @HotSpotVMConstant(name = "JVM_CONSTANT_NameAndType") @Stable public int jvmConstantNameAndType;
+    @HotSpotVMConstant(name = "JVM_CONSTANT_MethodHandle") @Stable public int jvmConstantMethodHandle;
+    @HotSpotVMConstant(name = "JVM_CONSTANT_MethodHandleInError") @Stable public int jvmConstantMethodHandleInError;
+    @HotSpotVMConstant(name = "JVM_CONSTANT_MethodType") @Stable public int jvmConstantMethodType;
+    @HotSpotVMConstant(name = "JVM_CONSTANT_MethodTypeInError") @Stable public int jvmConstantMethodTypeInError;
+    @HotSpotVMConstant(name = "JVM_CONSTANT_InvokeDynamic") @Stable public int jvmConstantInvokeDynamic;
+
+    @HotSpotVMConstant(name = "JVM_CONSTANT_ExternalMax") @Stable public int jvmConstantExternalMax;
+    @HotSpotVMConstant(name = "JVM_CONSTANT_InternalMin") @Stable public int jvmConstantInternalMin;
+    @HotSpotVMConstant(name = "JVM_CONSTANT_InternalMax") @Stable public int jvmConstantInternalMax;
+
+    @HotSpotVMConstant(name = "HeapWordSize") @Stable public int heapWordSize;
+
+    @HotSpotVMType(name = "Symbol*", get = HotSpotVMType.Type.SIZE) @Stable public int symbolPointerSize;
+    @HotSpotVMField(name = "Symbol::_length", type = "unsigned short", get = HotSpotVMField.Type.OFFSET) @Stable public int symbolLengthOffset;
+    @HotSpotVMField(name = "Symbol::_body[0]", type = "jbyte", get = HotSpotVMField.Type.OFFSET) @Stable public int symbolBodyOffset;
+
+    @HotSpotVMField(name = "vmSymbols::_symbols[0]", type = "Symbol*", get = HotSpotVMField.Type.ADDRESS) @Stable public long vmSymbolsSymbols;
+    @HotSpotVMConstant(name = "vmSymbols::FIRST_SID") @Stable public int vmSymbolsFirstSID;
+    @HotSpotVMConstant(name = "vmSymbols::SID_LIMIT") @Stable public int vmSymbolsSIDLimit;
+
+    @HotSpotVMConstant(name = "JVM_ACC_HAS_FINALIZER") @Stable public int klassHasFinalizerFlag;
+
+    // Modifier.SYNTHETIC is not public so we get it via vmStructs.
+    @HotSpotVMConstant(name = "JVM_ACC_SYNTHETIC") @Stable public int syntheticFlag;
+
+    /**
+     * @see HotSpotResolvedObjectTypeImpl#createField
+     */
+    @HotSpotVMConstant(name = "JVM_RECOGNIZED_FIELD_MODIFIERS") @Stable public int recognizedFieldModifiers;
+
+    /**
+     * Bit pattern that represents a non-oop. Neither the high bits nor the low bits of this value
+     * are allowed to look like (respectively) the high or low bits of a real oop.
+     */
+    @HotSpotVMField(name = "Universe::_non_oop_bits", type = "intptr_t", get = HotSpotVMField.Type.VALUE) @Stable public long nonOopBits;
+
+    @HotSpotVMField(name = "StubRoutines::_verify_oop_count", type = "jint", get = HotSpotVMField.Type.ADDRESS) @Stable public long verifyOopCounterAddress;
+    @HotSpotVMValue(expression = "Universe::verify_oop_mask()") @Stable public long verifyOopMask;
+    @HotSpotVMValue(expression = "Universe::verify_oop_bits()") @Stable public long verifyOopBits;
+
+    @HotSpotVMField(name = "CollectedHeap::_barrier_set", type = "BarrierSet*", get = HotSpotVMField.Type.OFFSET) @Stable public int collectedHeapBarrierSetOffset;
+
+    @HotSpotVMField(name = "HeapRegion::LogOfHRGrainBytes", type = "int", get = HotSpotVMField.Type.VALUE) @Stable public int logOfHRGrainBytes;
+
+    @HotSpotVMField(name = "BarrierSet::_kind", type = "BarrierSet::Name", get = HotSpotVMField.Type.OFFSET) @Stable private int barrierSetKindOffset;
+    @HotSpotVMConstant(name = "BarrierSet::CardTableModRef") @Stable public int barrierSetCardTableModRef;
+    @HotSpotVMConstant(name = "BarrierSet::CardTableExtension") @Stable public int barrierSetCardTableExtension;
+    @HotSpotVMConstant(name = "BarrierSet::G1SATBCT") @Stable public int barrierSetG1SATBCT;
+    @HotSpotVMConstant(name = "BarrierSet::G1SATBCTLogging") @Stable public int barrierSetG1SATBCTLogging;
+    @HotSpotVMConstant(name = "BarrierSet::ModRef") @Stable public int barrierSetModRef;
+    @HotSpotVMConstant(name = "BarrierSet::Other") @Stable public int barrierSetOther;
+
+    @HotSpotVMField(name = "CardTableModRefBS::byte_map_base", type = "jbyte*", get = HotSpotVMField.Type.OFFSET) @Stable private int cardTableModRefBSByteMapBaseOffset;
+    @HotSpotVMConstant(name = "CardTableModRefBS::card_shift") @Stable public int cardTableModRefBSCardShift;
+
+    @HotSpotVMValue(expression = "(jbyte)CardTableModRefBS::dirty_card_val()") @Stable public byte dirtyCardValue;
+    @HotSpotVMValue(expression = "(jbyte)G1SATBCardTableModRefBS::g1_young_card_val()") @Stable public byte g1YoungCardValue;
+
+    private final long cardtableStartAddress;
+    private final int cardtableShift;
+
+    public long cardtableStartAddress() {
+        if (cardtableStartAddress == -1) {
+            throw JVMCIError.shouldNotReachHere();
+        }
+        return cardtableStartAddress;
+    }
+
+    public int cardtableShift() {
+        if (cardtableShift == -1) {
+            throw JVMCIError.shouldNotReachHere();
+        }
+        return cardtableShift;
+    }
+
+    @HotSpotVMField(name = "os::_polling_page", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long safepointPollingAddress;
+
+    // G1 Collector Related Values.
+
+    public int g1CardQueueIndexOffset() {
+        return javaThreadDirtyCardQueueOffset + ptrQueueIndexOffset;
+    }
+
+    public int g1CardQueueBufferOffset() {
+        return javaThreadDirtyCardQueueOffset + ptrQueueBufferOffset;
+    }
+
+    public int g1SATBQueueMarkingOffset() {
+        return javaThreadSatbMarkQueueOffset + ptrQueueActiveOffset;
+    }
+
+    public int g1SATBQueueIndexOffset() {
+        return javaThreadSatbMarkQueueOffset + ptrQueueIndexOffset;
+    }
+
+    public int g1SATBQueueBufferOffset() {
+        return javaThreadSatbMarkQueueOffset + ptrQueueBufferOffset;
+    }
+
+    @HotSpotVMField(name = "java_lang_Class::_klass_offset", type = "int", get = HotSpotVMField.Type.VALUE) @Stable public int klassOffset;
+    @HotSpotVMField(name = "java_lang_Class::_array_klass_offset", type = "int", get = HotSpotVMField.Type.VALUE) @Stable public int arrayKlassOffset;
+
+    @HotSpotVMField(name = "Method::_method_data", type = "MethodData*", get = HotSpotVMField.Type.OFFSET) @Stable public int methodDataOffset;
+    @HotSpotVMField(name = "Method::_from_compiled_entry", type = "address", get = HotSpotVMField.Type.OFFSET) @Stable public int methodCompiledEntryOffset;
+    @HotSpotVMField(name = "Method::_code", type = "nmethod*", get = HotSpotVMField.Type.OFFSET) @Stable public int methodCodeOffset;
+
+    @HotSpotVMField(name = "MethodData::_size", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int methodDataSize;
+    @HotSpotVMField(name = "MethodData::_data_size", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int methodDataDataSize;
+    @HotSpotVMField(name = "MethodData::_data[0]", type = "intptr_t", get = HotSpotVMField.Type.OFFSET) @Stable public int methodDataOopDataOffset;
+    @HotSpotVMField(name = "MethodData::_trap_hist._array[0]", type = "u1", get = HotSpotVMField.Type.OFFSET) @Stable public int methodDataOopTrapHistoryOffset;
+    @HotSpotVMField(name = "MethodData::_jvmci_ir_size", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int methodDataIRSizeOffset;
+
+    @HotSpotVMField(name = "nmethod::_verified_entry_point", type = "address", get = HotSpotVMField.Type.OFFSET) @Stable public int nmethodEntryOffset;
+    @HotSpotVMField(name = "nmethod::_comp_level", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int nmethodCompLevelOffset;
+
+    @HotSpotVMConstant(name = "CompLevel_full_optimization") @Stable public int compilationLevelFullOptimization;
+
+    @HotSpotVMType(name = "BasicLock", get = HotSpotVMType.Type.SIZE) @Stable public int basicLockSize;
+    @HotSpotVMField(name = "BasicLock::_displaced_header", type = "markOop", get = HotSpotVMField.Type.OFFSET) @Stable public int basicLockDisplacedHeaderOffset;
+
+    @HotSpotVMValue(expression = "Universe::heap()->supports_inline_contig_alloc() ? Universe::heap()->end_addr() : (HeapWord**)-1", get = HotSpotVMValue.Type.ADDRESS) @Stable public long heapEndAddress;
+    @HotSpotVMValue(expression = "Universe::heap()->supports_inline_contig_alloc() ? Universe::heap()->top_addr() : (HeapWord**)-1", get = HotSpotVMValue.Type.ADDRESS) @Stable public long heapTopAddress;
+
+    @HotSpotVMField(name = "Thread::_allocated_bytes", type = "jlong", get = HotSpotVMField.Type.OFFSET) @Stable public int threadAllocatedBytesOffset;
+
+    @HotSpotVMFlag(name = "TLABWasteIncrement") @Stable public int tlabRefillWasteIncrement;
+    @HotSpotVMValue(expression = "ThreadLocalAllocBuffer::alignment_reserve()") @Stable public int tlabAlignmentReserve;
+
+    @HotSpotVMField(name = "ThreadLocalAllocBuffer::_start", type = "HeapWord*", get = HotSpotVMField.Type.OFFSET) @Stable private int threadLocalAllocBufferStartOffset;
+    @HotSpotVMField(name = "ThreadLocalAllocBuffer::_end", type = "HeapWord*", get = HotSpotVMField.Type.OFFSET) @Stable private int threadLocalAllocBufferEndOffset;
+    @HotSpotVMField(name = "ThreadLocalAllocBuffer::_top", type = "HeapWord*", get = HotSpotVMField.Type.OFFSET) @Stable private int threadLocalAllocBufferTopOffset;
+    @HotSpotVMField(name = "ThreadLocalAllocBuffer::_pf_top", type = "HeapWord*", get = HotSpotVMField.Type.OFFSET) @Stable private int threadLocalAllocBufferPfTopOffset;
+    @HotSpotVMField(name = "ThreadLocalAllocBuffer::_slow_allocations", type = "unsigned", get = HotSpotVMField.Type.OFFSET) @Stable private int threadLocalAllocBufferSlowAllocationsOffset;
+    @HotSpotVMField(name = "ThreadLocalAllocBuffer::_fast_refill_waste", type = "unsigned", get = HotSpotVMField.Type.OFFSET) @Stable private int threadLocalAllocBufferFastRefillWasteOffset;
+    @HotSpotVMField(name = "ThreadLocalAllocBuffer::_number_of_refills", type = "unsigned", get = HotSpotVMField.Type.OFFSET) @Stable private int threadLocalAllocBufferNumberOfRefillsOffset;
+    @HotSpotVMField(name = "ThreadLocalAllocBuffer::_refill_waste_limit", type = "size_t", get = HotSpotVMField.Type.OFFSET) @Stable private int threadLocalAllocBufferRefillWasteLimitOffset;
+    @HotSpotVMField(name = "ThreadLocalAllocBuffer::_desired_size", type = "size_t", get = HotSpotVMField.Type.OFFSET) @Stable private int threadLocalAllocBufferDesiredSizeOffset;
+
+    public int tlabSlowAllocationsOffset() {
+        return threadTlabOffset + threadLocalAllocBufferSlowAllocationsOffset;
+    }
+
+    public int tlabFastRefillWasteOffset() {
+        return threadTlabOffset + threadLocalAllocBufferFastRefillWasteOffset;
+    }
+
+    public int tlabNumberOfRefillsOffset() {
+        return threadTlabOffset + threadLocalAllocBufferNumberOfRefillsOffset;
+    }
+
+    public int tlabRefillWasteLimitOffset() {
+        return threadTlabOffset + threadLocalAllocBufferRefillWasteLimitOffset;
+    }
+
+    public int threadTlabSizeOffset() {
+        return threadTlabOffset + threadLocalAllocBufferDesiredSizeOffset;
+    }
+
+    public int threadTlabStartOffset() {
+        return threadTlabOffset + threadLocalAllocBufferStartOffset;
+    }
+
+    public int threadTlabEndOffset() {
+        return threadTlabOffset + threadLocalAllocBufferEndOffset;
+    }
+
+    public int threadTlabTopOffset() {
+        return threadTlabOffset + threadLocalAllocBufferTopOffset;
+    }
+
+    public int threadTlabPfTopOffset() {
+        return threadTlabOffset + threadLocalAllocBufferPfTopOffset;
+    }
+
+    @HotSpotVMFlag(name = "TLABStats") @Stable public boolean tlabStats;
+    @HotSpotVMValue(expression = " !CMSIncrementalMode && Universe::heap()->supports_inline_contig_alloc()") @Stable public boolean inlineContiguousAllocationSupported;
+
+    /**
+     * The DataLayout header size is the same as the cell size.
+     */
+    @HotSpotVMConstant(name = "DataLayout::cell_size") @Stable public int dataLayoutHeaderSize;
+    @HotSpotVMField(name = "DataLayout::_header._struct._tag", type = "u1", get = HotSpotVMField.Type.OFFSET) @Stable public int dataLayoutTagOffset;
+    @HotSpotVMField(name = "DataLayout::_header._struct._flags", type = "u1", get = HotSpotVMField.Type.OFFSET) @Stable public int dataLayoutFlagsOffset;
+    @HotSpotVMField(name = "DataLayout::_header._struct._bci", type = "u2", get = HotSpotVMField.Type.OFFSET) @Stable public int dataLayoutBCIOffset;
+    @HotSpotVMField(name = "DataLayout::_cells[0]", type = "intptr_t", get = HotSpotVMField.Type.OFFSET) @Stable public int dataLayoutCellsOffset;
+    @HotSpotVMConstant(name = "DataLayout::cell_size") @Stable public int dataLayoutCellSize;
+
+    @HotSpotVMConstant(name = "DataLayout::no_tag") @Stable public int dataLayoutNoTag;
+    @HotSpotVMConstant(name = "DataLayout::bit_data_tag") @Stable public int dataLayoutBitDataTag;
+    @HotSpotVMConstant(name = "DataLayout::counter_data_tag") @Stable public int dataLayoutCounterDataTag;
+    @HotSpotVMConstant(name = "DataLayout::jump_data_tag") @Stable public int dataLayoutJumpDataTag;
+    @HotSpotVMConstant(name = "DataLayout::receiver_type_data_tag") @Stable public int dataLayoutReceiverTypeDataTag;
+    @HotSpotVMConstant(name = "DataLayout::virtual_call_data_tag") @Stable public int dataLayoutVirtualCallDataTag;
+    @HotSpotVMConstant(name = "DataLayout::ret_data_tag") @Stable public int dataLayoutRetDataTag;
+    @HotSpotVMConstant(name = "DataLayout::branch_data_tag") @Stable public int dataLayoutBranchDataTag;
+    @HotSpotVMConstant(name = "DataLayout::multi_branch_data_tag") @Stable public int dataLayoutMultiBranchDataTag;
+    @HotSpotVMConstant(name = "DataLayout::arg_info_data_tag") @Stable public int dataLayoutArgInfoDataTag;
+    @HotSpotVMConstant(name = "DataLayout::call_type_data_tag") @Stable public int dataLayoutCallTypeDataTag;
+    @HotSpotVMConstant(name = "DataLayout::virtual_call_type_data_tag") @Stable public int dataLayoutVirtualCallTypeDataTag;
+    @HotSpotVMConstant(name = "DataLayout::parameters_type_data_tag") @Stable public int dataLayoutParametersTypeDataTag;
+    @HotSpotVMConstant(name = "DataLayout::speculative_trap_data_tag") @Stable public int dataLayoutSpeculativeTrapDataTag;
+
+    @HotSpotVMFlag(name = "BciProfileWidth") @Stable public int bciProfileWidth;
+    @HotSpotVMFlag(name = "TypeProfileWidth") @Stable public int typeProfileWidth;
+    @HotSpotVMFlag(name = "MethodProfileWidth") @Stable public int methodProfileWidth;
+
+    @HotSpotVMField(name = "CodeBlob::_code_offset", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable private int codeBlobCodeOffsetOffset;
+    @HotSpotVMField(name = "SharedRuntime::_ic_miss_blob", type = "RuntimeStub*", get = HotSpotVMField.Type.VALUE) @Stable private long inlineCacheMissBlob;
+
+    @HotSpotVMValue(expression = "SharedRuntime::deopt_blob()->unpack()", get = HotSpotVMValue.Type.ADDRESS) @Stable public long handleDeoptStub;
+    @HotSpotVMValue(expression = "SharedRuntime::deopt_blob()->uncommon_trap()", get = HotSpotVMValue.Type.ADDRESS) @Stable public long uncommonTrapStub;
+
+    private final long inlineCacheMissStub;
+
+    public long inlineCacheMissStub() {
+        return inlineCacheMissStub;
+    }
+
+    @HotSpotVMField(name = "CodeCache::_heap", type = "CodeHeap*", get = HotSpotVMField.Type.VALUE) @Stable private long codeCacheHeap;
+    @HotSpotVMField(name = "CodeHeap::_memory", type = "VirtualSpace", get = HotSpotVMField.Type.OFFSET) @Stable private int codeHeapMemoryOffset;
+    @HotSpotVMField(name = "VirtualSpace::_low_boundary", type = "char*", get = HotSpotVMField.Type.OFFSET) @Stable private int virtualSpaceLowBoundaryOffset;
+    @HotSpotVMField(name = "VirtualSpace::_high_boundary", type = "char*", get = HotSpotVMField.Type.OFFSET) @Stable private int virtualSpaceHighBoundaryOffset;
+
+    private final long codeCacheLowBoundary;
+    private final long codeCacheHighBoundary;
+
+    /**
+     * @return CodeCache::_heap-&gt;_memory._low_boundary
+     */
+    public long codeCacheLowBoundary() {
+        return codeCacheLowBoundary;
+    }
+
+    /**
+     * @return CodeCache::_heap-&gt;_memory._high_boundary
+     */
+    public long codeCacheHighBoundary() {
+        return codeCacheHighBoundary;
+    }
+
+    @HotSpotVMField(name = "StubRoutines::_aescrypt_encryptBlock", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long aescryptEncryptBlockStub;
+    @HotSpotVMField(name = "StubRoutines::_aescrypt_decryptBlock", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long aescryptDecryptBlockStub;
+    @HotSpotVMField(name = "StubRoutines::_cipherBlockChaining_encryptAESCrypt", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long cipherBlockChainingEncryptAESCryptStub;
+    @HotSpotVMField(name = "StubRoutines::_cipherBlockChaining_decryptAESCrypt", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long cipherBlockChainingDecryptAESCryptStub;
+    @HotSpotVMField(name = "StubRoutines::_updateBytesCRC32", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long updateBytesCRC32Stub;
+    @HotSpotVMField(name = "StubRoutines::_crc_table_adr", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long crcTableAddress;
+
+    @HotSpotVMField(name = "StubRoutines::_jbyte_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jbyteArraycopy;
+    @HotSpotVMField(name = "StubRoutines::_jshort_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jshortArraycopy;
+    @HotSpotVMField(name = "StubRoutines::_jint_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jintArraycopy;
+    @HotSpotVMField(name = "StubRoutines::_jlong_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jlongArraycopy;
+    @HotSpotVMField(name = "StubRoutines::_oop_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long oopArraycopy;
+    @HotSpotVMField(name = "StubRoutines::_oop_arraycopy_uninit", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long oopArraycopyUninit;
+    @HotSpotVMField(name = "StubRoutines::_jbyte_disjoint_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jbyteDisjointArraycopy;
+    @HotSpotVMField(name = "StubRoutines::_jshort_disjoint_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jshortDisjointArraycopy;
+    @HotSpotVMField(name = "StubRoutines::_jint_disjoint_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jintDisjointArraycopy;
+    @HotSpotVMField(name = "StubRoutines::_jlong_disjoint_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jlongDisjointArraycopy;
+    @HotSpotVMField(name = "StubRoutines::_oop_disjoint_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long oopDisjointArraycopy;
+    @HotSpotVMField(name = "StubRoutines::_oop_disjoint_arraycopy_uninit", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long oopDisjointArraycopyUninit;
+    @HotSpotVMField(name = "StubRoutines::_arrayof_jbyte_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jbyteAlignedArraycopy;
+    @HotSpotVMField(name = "StubRoutines::_arrayof_jshort_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jshortAlignedArraycopy;
+    @HotSpotVMField(name = "StubRoutines::_arrayof_jint_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jintAlignedArraycopy;
+    @HotSpotVMField(name = "StubRoutines::_arrayof_jlong_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jlongAlignedArraycopy;
+    @HotSpotVMField(name = "StubRoutines::_arrayof_oop_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long oopAlignedArraycopy;
+    @HotSpotVMField(name = "StubRoutines::_arrayof_oop_arraycopy_uninit", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long oopAlignedArraycopyUninit;
+    @HotSpotVMField(name = "StubRoutines::_arrayof_jbyte_disjoint_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jbyteAlignedDisjointArraycopy;
+    @HotSpotVMField(name = "StubRoutines::_arrayof_jshort_disjoint_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jshortAlignedDisjointArraycopy;
+    @HotSpotVMField(name = "StubRoutines::_arrayof_jint_disjoint_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jintAlignedDisjointArraycopy;
+    @HotSpotVMField(name = "StubRoutines::_arrayof_jlong_disjoint_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long jlongAlignedDisjointArraycopy;
+    @HotSpotVMField(name = "StubRoutines::_arrayof_oop_disjoint_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long oopAlignedDisjointArraycopy;
+    @HotSpotVMField(name = "StubRoutines::_arrayof_oop_disjoint_arraycopy_uninit", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long oopAlignedDisjointArraycopyUninit;
+    @HotSpotVMField(name = "StubRoutines::_checkcast_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long checkcastArraycopy;
+    @HotSpotVMField(name = "StubRoutines::_checkcast_arraycopy_uninit", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long checkcastArraycopyUninit;
+    @HotSpotVMField(name = "StubRoutines::_unsafe_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long unsafeArraycopy;
+    @HotSpotVMField(name = "StubRoutines::_generic_arraycopy", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long genericArraycopy;
+
+    @HotSpotVMValue(expression = "JVMCIRuntime::new_instance", get = HotSpotVMValue.Type.ADDRESS) @Stable public long newInstanceAddress;
+    @HotSpotVMValue(expression = "JVMCIRuntime::new_array", get = HotSpotVMValue.Type.ADDRESS) @Stable public long newArrayAddress;
+    @HotSpotVMValue(expression = "JVMCIRuntime::new_multi_array", get = HotSpotVMValue.Type.ADDRESS) @Stable public long newMultiArrayAddress;
+    @HotSpotVMValue(expression = "JVMCIRuntime::dynamic_new_array", get = HotSpotVMValue.Type.ADDRESS) @Stable public long dynamicNewArrayAddress;
+    @HotSpotVMValue(expression = "JVMCIRuntime::dynamic_new_instance", get = HotSpotVMValue.Type.ADDRESS) @Stable public long dynamicNewInstanceAddress;
+    @HotSpotVMValue(expression = "JVMCIRuntime::thread_is_interrupted", get = HotSpotVMValue.Type.ADDRESS) @Stable public long threadIsInterruptedAddress;
+    @HotSpotVMValue(expression = "JVMCIRuntime::vm_message", signature = "(unsigned char, long, long, long, long)", get = HotSpotVMValue.Type.ADDRESS) @Stable public long vmMessageAddress;
+    @HotSpotVMValue(expression = "JVMCIRuntime::identity_hash_code", get = HotSpotVMValue.Type.ADDRESS) @Stable public long identityHashCodeAddress;
+    @HotSpotVMValue(expression = "JVMCIRuntime::exception_handler_for_pc", signature = "(JavaThread*)", get = HotSpotVMValue.Type.ADDRESS) @Stable public long exceptionHandlerForPcAddress;
+    @HotSpotVMValue(expression = "JVMCIRuntime::monitorenter", get = HotSpotVMValue.Type.ADDRESS) @Stable public long monitorenterAddress;
+    @HotSpotVMValue(expression = "JVMCIRuntime::monitorexit", get = HotSpotVMValue.Type.ADDRESS) @Stable public long monitorexitAddress;
+    @HotSpotVMValue(expression = "JVMCIRuntime::create_null_exception", get = HotSpotVMValue.Type.ADDRESS) @Stable public long createNullPointerExceptionAddress;
+    @HotSpotVMValue(expression = "JVMCIRuntime::create_out_of_bounds_exception", get = HotSpotVMValue.Type.ADDRESS) @Stable public long createOutOfBoundsExceptionAddress;
+    @HotSpotVMValue(expression = "JVMCIRuntime::log_primitive", get = HotSpotVMValue.Type.ADDRESS) @Stable public long logPrimitiveAddress;
+    @HotSpotVMValue(expression = "JVMCIRuntime::log_object", get = HotSpotVMValue.Type.ADDRESS) @Stable public long logObjectAddress;
+    @HotSpotVMValue(expression = "JVMCIRuntime::log_printf", get = HotSpotVMValue.Type.ADDRESS) @Stable public long logPrintfAddress;
+    @HotSpotVMValue(expression = "JVMCIRuntime::vm_error", get = HotSpotVMValue.Type.ADDRESS) @Stable public long vmErrorAddress;
+    @HotSpotVMValue(expression = "JVMCIRuntime::load_and_clear_exception", get = HotSpotVMValue.Type.ADDRESS) @Stable public long loadAndClearExceptionAddress;
+    @HotSpotVMValue(expression = "JVMCIRuntime::write_barrier_pre", get = HotSpotVMValue.Type.ADDRESS) @Stable public long writeBarrierPreAddress;
+    @HotSpotVMValue(expression = "JVMCIRuntime::write_barrier_post", get = HotSpotVMValue.Type.ADDRESS) @Stable public long writeBarrierPostAddress;
+    @HotSpotVMValue(expression = "JVMCIRuntime::validate_object", get = HotSpotVMValue.Type.ADDRESS) @Stable public long validateObject;
+
+    @HotSpotVMValue(expression = "JVMCIRuntime::test_deoptimize_call_int", get = HotSpotVMValue.Type.ADDRESS) @Stable public long testDeoptimizeCallInt;
+
+    @HotSpotVMValue(expression = "SharedRuntime::register_finalizer", get = HotSpotVMValue.Type.ADDRESS) @Stable public long registerFinalizerAddress;
+    @HotSpotVMValue(expression = "SharedRuntime::exception_handler_for_return_address", get = HotSpotVMValue.Type.ADDRESS) @Stable public long exceptionHandlerForReturnAddressAddress;
+    @HotSpotVMValue(expression = "SharedRuntime::OSR_migration_end", get = HotSpotVMValue.Type.ADDRESS) @Stable public long osrMigrationEndAddress;
+
+    @HotSpotVMValue(expression = "os::javaTimeMillis", get = HotSpotVMValue.Type.ADDRESS) @Stable public long javaTimeMillisAddress;
+    @HotSpotVMValue(expression = "os::javaTimeNanos", get = HotSpotVMValue.Type.ADDRESS) @Stable public long javaTimeNanosAddress;
+    @HotSpotVMValue(expression = "SharedRuntime::dsin", get = HotSpotVMValue.Type.ADDRESS) @Stable public long arithmeticSinAddress;
+    @HotSpotVMValue(expression = "SharedRuntime::dcos", get = HotSpotVMValue.Type.ADDRESS) @Stable public long arithmeticCosAddress;
+    @HotSpotVMValue(expression = "SharedRuntime::dtan", get = HotSpotVMValue.Type.ADDRESS) @Stable public long arithmeticTanAddress;
+    @HotSpotVMValue(expression = "SharedRuntime::dexp", get = HotSpotVMValue.Type.ADDRESS) @Stable public long arithmeticExpAddress;
+    @HotSpotVMValue(expression = "SharedRuntime::dlog", get = HotSpotVMValue.Type.ADDRESS) @Stable public long arithmeticLogAddress;
+    @HotSpotVMValue(expression = "SharedRuntime::dlog10", get = HotSpotVMValue.Type.ADDRESS) @Stable public long arithmeticLog10Address;
+    @HotSpotVMValue(expression = "SharedRuntime::dpow", get = HotSpotVMValue.Type.ADDRESS) @Stable public long arithmeticPowAddress;
+
+    @HotSpotVMValue(expression = "(jint) JVMCICounterSize") @Stable public int jvmciCountersSize;
+
+    @HotSpotVMValue(expression = "Deoptimization::fetch_unroll_info", signature = "(JavaThread*)", get = HotSpotVMValue.Type.ADDRESS) @Stable public long deoptimizationFetchUnrollInfo;
+    @HotSpotVMValue(expression = "Deoptimization::uncommon_trap", get = HotSpotVMValue.Type.ADDRESS) @Stable public long deoptimizationUncommonTrap;
+    @HotSpotVMValue(expression = "Deoptimization::unpack_frames", signature = "(JavaThread*, int)", get = HotSpotVMValue.Type.ADDRESS) @Stable public long deoptimizationUnpackFrames;
+
+    @HotSpotVMConstant(name = "Deoptimization::Reason_none") @Stable public int deoptReasonNone;
+    @HotSpotVMConstant(name = "Deoptimization::Reason_null_check") @Stable public int deoptReasonNullCheck;
+    @HotSpotVMConstant(name = "Deoptimization::Reason_range_check") @Stable public int deoptReasonRangeCheck;
+    @HotSpotVMConstant(name = "Deoptimization::Reason_class_check") @Stable public int deoptReasonClassCheck;
+    @HotSpotVMConstant(name = "Deoptimization::Reason_array_check") @Stable public int deoptReasonArrayCheck;
+    @HotSpotVMConstant(name = "Deoptimization::Reason_unreached0") @Stable public int deoptReasonUnreached0;
+    @HotSpotVMConstant(name = "Deoptimization::Reason_type_checked_inlining") @Stable public int deoptReasonTypeCheckInlining;
+    @HotSpotVMConstant(name = "Deoptimization::Reason_optimized_type_check") @Stable public int deoptReasonOptimizedTypeCheck;
+    @HotSpotVMConstant(name = "Deoptimization::Reason_not_compiled_exception_handler") @Stable public int deoptReasonNotCompiledExceptionHandler;
+    @HotSpotVMConstant(name = "Deoptimization::Reason_unresolved") @Stable public int deoptReasonUnresolved;
+    @HotSpotVMConstant(name = "Deoptimization::Reason_jsr_mismatch") @Stable public int deoptReasonJsrMismatch;
+    @HotSpotVMConstant(name = "Deoptimization::Reason_div0_check") @Stable public int deoptReasonDiv0Check;
+    @HotSpotVMConstant(name = "Deoptimization::Reason_constraint") @Stable public int deoptReasonConstraint;
+    @HotSpotVMConstant(name = "Deoptimization::Reason_loop_limit_check") @Stable public int deoptReasonLoopLimitCheck;
+    @HotSpotVMConstant(name = "Deoptimization::Reason_aliasing") @Stable public int deoptReasonAliasing;
+    @HotSpotVMConstant(name = "Deoptimization::Reason_transfer_to_interpreter") @Stable public int deoptReasonTransferToInterpreter;
+    @HotSpotVMConstant(name = "Deoptimization::Reason_LIMIT") @Stable public int deoptReasonOSROffset;
+
+    @HotSpotVMConstant(name = "Deoptimization::Action_none") @Stable public int deoptActionNone;
+    @HotSpotVMConstant(name = "Deoptimization::Action_maybe_recompile") @Stable public int deoptActionMaybeRecompile;
+    @HotSpotVMConstant(name = "Deoptimization::Action_reinterpret") @Stable public int deoptActionReinterpret;
+    @HotSpotVMConstant(name = "Deoptimization::Action_make_not_entrant") @Stable public int deoptActionMakeNotEntrant;
+    @HotSpotVMConstant(name = "Deoptimization::Action_make_not_compilable") @Stable public int deoptActionMakeNotCompilable;
+
+    @HotSpotVMConstant(name = "Deoptimization::_action_bits") @Stable public int deoptimizationActionBits;
+    @HotSpotVMConstant(name = "Deoptimization::_reason_bits") @Stable public int deoptimizationReasonBits;
+    @HotSpotVMConstant(name = "Deoptimization::_debug_id_bits") @Stable public int deoptimizationDebugIdBits;
+    @HotSpotVMConstant(name = "Deoptimization::_action_shift") @Stable public int deoptimizationActionShift;
+    @HotSpotVMConstant(name = "Deoptimization::_reason_shift") @Stable public int deoptimizationReasonShift;
+    @HotSpotVMConstant(name = "Deoptimization::_debug_id_shift") @Stable public int deoptimizationDebugIdShift;
+
+    @HotSpotVMConstant(name = "Deoptimization::Unpack_deopt") @Stable public int deoptimizationUnpackDeopt;
+    @HotSpotVMConstant(name = "Deoptimization::Unpack_exception") @Stable public int deoptimizationUnpackException;
+    @HotSpotVMConstant(name = "Deoptimization::Unpack_uncommon_trap") @Stable public int deoptimizationUnpackUncommonTrap;
+    @HotSpotVMConstant(name = "Deoptimization::Unpack_reexecute") @Stable public int deoptimizationUnpackReexecute;
+
+    @HotSpotVMField(name = "Deoptimization::UnrollBlock::_size_of_deoptimized_frame", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int deoptimizationUnrollBlockSizeOfDeoptimizedFrameOffset;
+    @HotSpotVMField(name = "Deoptimization::UnrollBlock::_caller_adjustment", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int deoptimizationUnrollBlockCallerAdjustmentOffset;
+    @HotSpotVMField(name = "Deoptimization::UnrollBlock::_number_of_frames", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int deoptimizationUnrollBlockNumberOfFramesOffset;
+    @HotSpotVMField(name = "Deoptimization::UnrollBlock::_total_frame_sizes", type = "int", get = HotSpotVMField.Type.OFFSET) @Stable public int deoptimizationUnrollBlockTotalFrameSizesOffset;
+    @HotSpotVMField(name = "Deoptimization::UnrollBlock::_frame_sizes", type = "intptr_t*", get = HotSpotVMField.Type.OFFSET) @Stable public int deoptimizationUnrollBlockFrameSizesOffset;
+    @HotSpotVMField(name = "Deoptimization::UnrollBlock::_frame_pcs", type = "address*", get = HotSpotVMField.Type.OFFSET) @Stable public int deoptimizationUnrollBlockFramePcsOffset;
+    @HotSpotVMField(name = "Deoptimization::UnrollBlock::_initial_info", type = "intptr_t", get = HotSpotVMField.Type.OFFSET) @Stable public int deoptimizationUnrollBlockInitialInfoOffset;
+
+    @HotSpotVMConstant(name = "vmIntrinsics::_invokeBasic") @Stable public int vmIntrinsicInvokeBasic;
+    @HotSpotVMConstant(name = "vmIntrinsics::_linkToVirtual") @Stable public int vmIntrinsicLinkToVirtual;
+    @HotSpotVMConstant(name = "vmIntrinsics::_linkToStatic") @Stable public int vmIntrinsicLinkToStatic;
+    @HotSpotVMConstant(name = "vmIntrinsics::_linkToSpecial") @Stable public int vmIntrinsicLinkToSpecial;
+    @HotSpotVMConstant(name = "vmIntrinsics::_linkToInterface") @Stable public int vmIntrinsicLinkToInterface;
+
+    @HotSpotVMConstant(name = "JVMCIEnv::ok") @Stable public int codeInstallResultOk;
+    @HotSpotVMConstant(name = "JVMCIEnv::dependencies_failed") @Stable public int codeInstallResultDependenciesFailed;
+    @HotSpotVMConstant(name = "JVMCIEnv::dependencies_invalid") @Stable public int codeInstallResultDependenciesInvalid;
+    @HotSpotVMConstant(name = "JVMCIEnv::cache_full") @Stable public int codeInstallResultCacheFull;
+    @HotSpotVMConstant(name = "JVMCIEnv::code_too_large") @Stable public int codeInstallResultCodeTooLarge;
+
+    public String getCodeInstallResultDescription(int codeInstallResult) {
+        if (codeInstallResult == codeInstallResultOk) {
+            return "ok";
+        }
+        if (codeInstallResult == codeInstallResultDependenciesFailed) {
+            return "dependencies failed";
+        }
+        if (codeInstallResult == codeInstallResultDependenciesInvalid) {
+            return "dependencies invalid";
+        }
+        if (codeInstallResult == codeInstallResultCacheFull) {
+            return "code cache is full";
+        }
+        if (codeInstallResult == codeInstallResultCodeTooLarge) {
+            return "code is too large";
+        }
+        assert false : codeInstallResult;
+        return "unknown";
+    }
+
+    @HotSpotVMConstant(name = "CompilerToVM::KLASS_TAG") @Stable public int compilerToVMKlassTag;
+    @HotSpotVMConstant(name = "CompilerToVM::SYMBOL_TAG") @Stable public int compilerToVMSymbolTag;
+
+    // Checkstyle: stop
+    @HotSpotVMConstant(name = "CodeInstaller::VERIFIED_ENTRY") @Stable public int MARKID_VERIFIED_ENTRY;
+    @HotSpotVMConstant(name = "CodeInstaller::UNVERIFIED_ENTRY") @Stable public int MARKID_UNVERIFIED_ENTRY;
+    @HotSpotVMConstant(name = "CodeInstaller::OSR_ENTRY") @Stable public int MARKID_OSR_ENTRY;
+    @HotSpotVMConstant(name = "CodeInstaller::EXCEPTION_HANDLER_ENTRY") @Stable public int MARKID_EXCEPTION_HANDLER_ENTRY;
+    @HotSpotVMConstant(name = "CodeInstaller::DEOPT_HANDLER_ENTRY") @Stable public int MARKID_DEOPT_HANDLER_ENTRY;
+    @HotSpotVMConstant(name = "CodeInstaller::INVOKEINTERFACE") @Stable public int MARKID_INVOKEINTERFACE;
+    @HotSpotVMConstant(name = "CodeInstaller::INVOKEVIRTUAL") @Stable public int MARKID_INVOKEVIRTUAL;
+    @HotSpotVMConstant(name = "CodeInstaller::INVOKESTATIC") @Stable public int MARKID_INVOKESTATIC;
+    @HotSpotVMConstant(name = "CodeInstaller::INVOKESPECIAL") @Stable public int MARKID_INVOKESPECIAL;
+    @HotSpotVMConstant(name = "CodeInstaller::INLINE_INVOKE") @Stable public int MARKID_INLINE_INVOKE;
+    @HotSpotVMConstant(name = "CodeInstaller::POLL_NEAR") @Stable public int MARKID_POLL_NEAR;
+    @HotSpotVMConstant(name = "CodeInstaller::POLL_RETURN_NEAR") @Stable public int MARKID_POLL_RETURN_NEAR;
+    @HotSpotVMConstant(name = "CodeInstaller::POLL_FAR") @Stable public int MARKID_POLL_FAR;
+    @HotSpotVMConstant(name = "CodeInstaller::POLL_RETURN_FAR") @Stable public int MARKID_POLL_RETURN_FAR;
+    @HotSpotVMConstant(name = "CodeInstaller::CARD_TABLE_SHIFT") @Stable public int MARKID_CARD_TABLE_SHIFT;
+    @HotSpotVMConstant(name = "CodeInstaller::CARD_TABLE_ADDRESS") @Stable public int MARKID_CARD_TABLE_ADDRESS;
+    @HotSpotVMConstant(name = "CodeInstaller::INVOKE_INVALID") @Stable public int MARKID_INVOKE_INVALID;
+
+    // Checkstyle: resume
+
+    public boolean check() {
+        for (Field f : getClass().getDeclaredFields()) {
+            int modifiers = f.getModifiers();
+            if (Modifier.isPublic(modifiers) && !Modifier.isStatic(modifiers)) {
+                assert Modifier.isFinal(modifiers) || f.getAnnotation(Stable.class) != null : "field should either be final or @Stable: " + f;
+            }
+        }
+
+        assert codeEntryAlignment > 0 : codeEntryAlignment;
+        assert (layoutHelperArrayTagObjectValue & (1 << (Integer.SIZE - 1))) != 0 : "object array must have first bit set";
+        assert (layoutHelperArrayTagTypeValue & (1 << (Integer.SIZE - 1))) != 0 : "type array must have first bit set";
+
+        return true;
+    }
+
+    /**
+     * A compact representation of the different encoding strategies for Objects and metadata.
+     */
+    public static class CompressEncoding {
+        public final long base;
+        public final int shift;
+        public final int alignment;
+
+        CompressEncoding(long base, int shift, int alignment) {
+            this.base = base;
+            this.shift = shift;
+            this.alignment = alignment;
+        }
+
+        public int compress(long ptr) {
+            if (ptr == 0L) {
+                return 0;
+            } else {
+                return (int) ((ptr - base) >>> shift);
+            }
+        }
+
+        public long uncompress(int ptr) {
+            if (ptr == 0) {
+                return 0L;
+            } else {
+                return ((ptr & 0xFFFFFFFFL) << shift) + base;
+            }
+        }
+
+        @Override
+        public String toString() {
+            return "base: " + base + " shift: " + shift + " alignment: " + alignment;
+        }
+
+        @Override
+        public int hashCode() {
+            final int prime = 31;
+            int result = 1;
+            result = prime * result + alignment;
+            result = prime * result + (int) (base ^ (base >>> 32));
+            result = prime * result + shift;
+            return result;
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            if (obj instanceof CompressEncoding) {
+                CompressEncoding other = (CompressEncoding) obj;
+                return alignment == other.alignment && base == other.base && shift == other.shift;
+            } else {
+                return false;
+            }
+        }
+    }
+
+    /**
+     * Returns the name of the C/C++ symbol that is associated (via HotSpotVMValue annotation) with
+     * the HotSpotVMConfig object's field containing {@code value}; returns null if no field holds
+     * the provided address.
+     *
+     * @param value value of the field
+     * @return C/C++ symbol name or null
+     */
+    public String getVMValueCSymbol(long value) {
+        for (Field f : HotSpotVMConfig.class.getDeclaredFields()) {
+            if (f.isAnnotationPresent(HotSpotVMValue.class)) {
+                HotSpotVMValue annotation = f.getAnnotation(HotSpotVMValue.class);
+
+                if (annotation.get() == HotSpotVMValue.Type.ADDRESS) {
+                    try {
+                        if (value == f.getLong(this)) {
+                            return (annotation.expression() + annotation.signature());
+                        }
+                    } catch (IllegalArgumentException e1) {
+                        // TODO Auto-generated catch block
+                        e1.printStackTrace();
+                    } catch (IllegalAccessException e1) {
+                        // TODO Auto-generated catch block
+                        e1.printStackTrace();
+                    }
+                }
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Returns the name of the C/C++ symbol that is associated (via HotSpotVMField annotation) with
+     * the HotSpotVMConfig object's field containing {@code value}; returns null if no field holds
+     * the provided address.
+     *
+     * @param value value of the field
+     * @return C/C++ symbol name or null
+     */
+    public String getVMFieldCSymbol(long value) {
+        for (Field f : HotSpotVMConfig.class.getDeclaredFields()) {
+            if (f.isAnnotationPresent(HotSpotVMField.class)) {
+                HotSpotVMField annotation = f.getAnnotation(HotSpotVMField.class);
+
+                if (annotation.get() == HotSpotVMField.Type.VALUE) {
+                    try {
+                        if (value == f.getLong(this)) {
+                            return (annotation.name());
+                        }
+                    } catch (IllegalArgumentException e1) {
+                        // TODO Auto-generated catch block
+                        e1.printStackTrace();
+                    } catch (IllegalAccessException e1) {
+                        // TODO Auto-generated catch block
+                        e1.printStackTrace();
+                    }
+                }
+            }
+        }
+        return null;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotVMConfigVerifier.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,156 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.hotspot;
+
+import static java.lang.String.*;
+
+import java.io.*;
+import java.lang.reflect.*;
+import java.util.*;
+
+import jdk.internal.org.objectweb.asm.*;
+import jdk.internal.org.objectweb.asm.Type;
+import sun.misc.*;
+
+import com.oracle.jvmci.common.*;
+
+/**
+ * A {@link ClassVisitor} that verifies {@link HotSpotVMConfig} does not access {@link Unsafe} from
+ * any of its non-static, non-constructor methods. This ensures that a deserialized
+ * {@link HotSpotVMConfig} object does not perform any unsafe reads on addresses that are only valid
+ * in the context in which the object was serialized. Note that this does not catch cases where a
+ * client uses an address stored in a {@link HotSpotVMConfig} field.
+ */
+final class HotSpotVMConfigVerifier extends ClassVisitor {
+
+    public static boolean check() {
+        Class<?> cls = HotSpotVMConfig.class;
+        String classFilePath = "/" + cls.getName().replace('.', '/') + ".class";
+        try {
+            InputStream classfile = cls.getResourceAsStream(classFilePath);
+            ClassReader cr = new ClassReader(Objects.requireNonNull(classfile, "Could not find class file for " + cls.getName()));
+            ClassVisitor cv = new HotSpotVMConfigVerifier();
+            cr.accept(cv, 0);
+            return true;
+        } catch (IOException e) {
+            throw new JVMCIError(e);
+        }
+    }
+
+    /**
+     * Source file context for error reporting.
+     */
+    String sourceFile = null;
+
+    /**
+     * Line number for error reporting.
+     */
+    int lineNo = -1;
+
+    private static Class<?> resolve(String name) {
+        try {
+            return Class.forName(name.replace('/', '.'));
+        } catch (ClassNotFoundException e) {
+            throw new JVMCIError(e);
+        }
+    }
+
+    HotSpotVMConfigVerifier() {
+        super(Opcodes.ASM5);
+    }
+
+    @Override
+    public void visitSource(String source, String debug) {
+        this.sourceFile = source;
+    }
+
+    void verify(boolean condition, String message) {
+        if (!condition) {
+            error(message);
+        }
+    }
+
+    void error(String message) {
+        String errorMessage = format("%s:%d: %s is not allowed in the context of compilation replay. The unsafe access should be moved into the %s constructor and the result cached in a field",
+                        sourceFile, lineNo, message, HotSpotVMConfig.class.getSimpleName());
+        throw new JVMCIError(errorMessage);
+
+    }
+
+    @Override
+    public MethodVisitor visitMethod(int access, String name, String d, String signature, String[] exceptions) {
+        if (!Modifier.isStatic(access) && Modifier.isPublic(access) && !name.equals("<init>")) {
+            return new MethodVisitor(Opcodes.ASM5) {
+
+                @Override
+                public void visitLineNumber(int line, Label start) {
+                    lineNo = line;
+                }
+
+                private Executable resolveMethod(String owner, String methodName, String methodDesc) {
+                    Class<?> declaringClass = resolve(owner);
+                    while (declaringClass != null) {
+                        if (methodName.equals("<init>")) {
+                            for (Constructor<?> c : declaringClass.getDeclaredConstructors()) {
+                                if (methodDesc.equals(Type.getConstructorDescriptor(c))) {
+                                    return c;
+                                }
+                            }
+                        } else {
+                            Type[] argumentTypes = Type.getArgumentTypes(methodDesc);
+                            for (Method m : declaringClass.getDeclaredMethods()) {
+                                if (m.getName().equals(methodName)) {
+                                    if (Arrays.equals(argumentTypes, Type.getArgumentTypes(m))) {
+                                        if (Type.getReturnType(methodDesc).equals(Type.getReturnType(m))) {
+                                            return m;
+                                        }
+                                    }
+                                }
+                            }
+                        }
+                        declaringClass = declaringClass.getSuperclass();
+                    }
+                    throw new NoSuchMethodError(owner + "." + methodName + methodDesc);
+                }
+
+                /**
+                 * Checks whether a given method is allowed to be called.
+                 */
+                private boolean checkInvokeTarget(Executable method) {
+                    if (method.getDeclaringClass().equals(Unsafe.class)) {
+                        return false;
+                    }
+                    return true;
+                }
+
+                @Override
+                public void visitMethodInsn(int opcode, String owner, String methodName, String methodDesc, boolean itf) {
+                    Executable callee = resolveMethod(owner, methodName, methodDesc);
+                    verify(checkInvokeTarget(callee), "invocation of " + callee);
+                }
+            };
+        } else {
+            return null;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotVMEventListener.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2015, 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.jvmci.hotspot;
+
+import com.oracle.jvmci.runtime.*;
+
+public interface HotSpotVMEventListener extends Service {
+
+    /**
+     * Notifies this client that HotSpot is running in CompileTheWorld mode and the JVMCI compiler
+     * should now perform its version of CompileTheWorld.
+     */
+    void notifyCompileTheWorld() throws Throwable;
+
+    /**
+     * Notifies this client that the VM is shutting down.
+     */
+    void notifyShutdown();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotVmSymbols.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.hotspot;
+
+import static com.oracle.jvmci.common.UnsafeAccess.*;
+import static com.oracle.jvmci.hotspot.HotSpotJVMCIRuntime.*;
+import sun.misc.*;
+
+/**
+ * Class to access the C++ {@code vmSymbols} table.
+ */
+public final class HotSpotVmSymbols {
+
+    /**
+     * Returns the symbol in the {@code vmSymbols} table at position {@code index} as {@link String}
+     * .
+     *
+     * @param index position in the symbol table
+     * @return the symbol at position id
+     */
+    public static String symbolAt(int index) {
+        HotSpotJVMCIRuntimeProvider runtime = runtime();
+        HotSpotVMConfig config = runtime.getConfig();
+        assert config.vmSymbolsFirstSID <= index && index < config.vmSymbolsSIDLimit : "index " + index + " is out of bounds";
+        assert config.symbolPointerSize == Unsafe.ADDRESS_SIZE : "the following address read is broken";
+        return runtime.getCompilerToVM().getSymbol(unsafe.getAddress(config.vmSymbolsSymbols + index * config.symbolPointerSize));
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/InitTimer.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2014, 2015, 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.jvmci.hotspot;
+
+import com.oracle.jvmci.debug.*;
+
+import edu.umd.cs.findbugs.annotations.*;
+
+/**
+ * A facility for timing a step in the runtime initialization sequence. This exists separate from
+ * {@link DebugTimer} as it must be independent from all other JVMCI code so as to not perturb the
+ * initialization sequence.
+ */
+public final class InitTimer implements AutoCloseable {
+    final String name;
+    final long start;
+
+    private InitTimer(String name) {
+        this.name = name;
+        this.start = System.currentTimeMillis();
+        System.out.println("START: " + SPACES.substring(0, timerDepth * 2) + name);
+        assert Thread.currentThread() == initializingThread : Thread.currentThread() + " != " + initializingThread;
+        timerDepth++;
+    }
+
+    @SuppressFBWarnings(value = "ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD", justification = "only the initializing thread accesses this field")
+    public void close() {
+        final long end = System.currentTimeMillis();
+        timerDepth--;
+        System.out.println(" DONE: " + SPACES.substring(0, timerDepth * 2) + name + " [" + (end - start) + " ms]");
+    }
+
+    public static InitTimer timer(String name) {
+        return ENABLED ? new InitTimer(name) : null;
+    }
+
+    public static InitTimer timer(String name, Object suffix) {
+        return ENABLED ? new InitTimer(name + suffix) : null;
+    }
+
+    /**
+     * Specifies if initialization timing is enabled. This can only be set via a system property as
+     * the timing facility is used to time initialization of {@link HotSpotOptions}.
+     */
+    private static final boolean ENABLED = Boolean.getBoolean("jvmci.runtime.TimeInit");
+
+    public static int timerDepth = 0;
+    public static final String SPACES = "                                            ";
+
+    /**
+     * Used to assert the invariant that all initialization happens on the same thread.
+     */
+    public static final Thread initializingThread;
+    static {
+        if (ENABLED) {
+            initializingThread = Thread.currentThread();
+            System.out.println("INITIALIZING THREAD: " + initializingThread);
+        } else {
+            initializingThread = null;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/PrintStreamOption.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,137 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.hotspot;
+
+import java.io.*;
+import java.lang.management.*;
+
+import com.oracle.jvmci.options.*;
+
+/**
+ * An option that encapsulates and configures a print stream.
+ */
+public class PrintStreamOption extends OptionValue<String> {
+
+    public PrintStreamOption() {
+        super(null);
+    }
+
+    /**
+     * The print stream to which output will be written.
+     *
+     * Declared {@code volatile} to enable safe use of double-checked locking in
+     * {@link #getStream(CompilerToVM)} and {@link #setValue(Object)}.
+     */
+    private volatile PrintStream ps;
+
+    /**
+     * Replace any instance of %p with a an identifying name. Try to get it from the RuntimeMXBean
+     * name.
+     *
+     * @return the name of the file to log to
+     */
+    private String getFilename() {
+        String name = getValue();
+        if (name.contains("%p")) {
+            String runtimeName = ManagementFactory.getRuntimeMXBean().getName();
+            try {
+                int index = runtimeName.indexOf('@');
+                if (index != -1) {
+                    long pid = Long.parseLong(runtimeName.substring(0, index));
+                    runtimeName = Long.toString(pid);
+                }
+                name = name.replaceAll("%p", runtimeName);
+            } catch (NumberFormatException e) {
+
+            }
+        }
+        return name;
+    }
+
+    /**
+     * Gets the print stream configured by this option. If no file is configured, the print stream
+     * will output to {@link CompilerToVM#writeDebugOutput(byte[], int, int)}.
+     */
+    public PrintStream getStream(final CompilerToVM compilerToVM) {
+        if (ps == null) {
+            if (getValue() != null) {
+                synchronized (this) {
+                    if (ps == null) {
+                        try {
+                            final boolean enableAutoflush = true;
+                            ps = new PrintStream(new FileOutputStream(getFilename()), enableAutoflush);
+                            /* Add the JVM and Java arguments to the log file to help identity it. */
+                            String inputArguments = String.join(" ", ManagementFactory.getRuntimeMXBean().getInputArguments());
+                            ps.println("VM Arguments: " + inputArguments);
+                            String cmd = System.getProperty("sun.java.command");
+                            if (cmd != null) {
+                                ps.println("sun.java.command=" + cmd);
+                            }
+                        } catch (FileNotFoundException e) {
+                            throw new RuntimeException("couldn't open file: " + getValue(), e);
+                        }
+                    }
+                }
+            } else {
+                OutputStream ttyOut = new OutputStream() {
+                    @Override
+                    public void write(byte[] b, int off, int len) throws IOException {
+                        if (b == null) {
+                            throw new NullPointerException();
+                        } else if (off < 0 || off > b.length || len < 0 || (off + len) > b.length || (off + len) < 0) {
+                            throw new IndexOutOfBoundsException();
+                        } else if (len == 0) {
+                            return;
+                        }
+                        compilerToVM.writeDebugOutput(b, off, len);
+                    }
+
+                    @Override
+                    public void write(int b) throws IOException {
+                        write(new byte[]{(byte) b}, 0, 1);
+                    }
+
+                    @Override
+                    public void flush() throws IOException {
+                        compilerToVM.flushDebugOutput();
+                    }
+                };
+                ps = new PrintStream(ttyOut);
+            }
+        }
+        return ps;
+    }
+
+    @Override
+    public void setValue(Object v) {
+        if (ps != null) {
+            synchronized (this) {
+                if (ps != null) {
+                    ps.close();
+                    ps = null;
+                }
+            }
+        }
+        super.setValue(v);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/Stable.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.oracle.jvmci.hotspot;
+
+import java.lang.annotation.*;
+
+/**
+ * This annotation functions as an alias for the sun.invoke.Stable annotation within JVMCI code. It
+ * is specially recognized during class file parsing in the same way as that annotation.
+ */
+@Target(ElementType.FIELD)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Stable {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/logging/CountingProxy.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,107 @@
+/*
+ * Copyright (c) 2011, 2015, 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.jvmci.hotspot.logging;
+
+import java.lang.reflect.*;
+import java.util.*;
+import java.util.concurrent.*;
+import java.util.concurrent.atomic.*;
+
+import com.oracle.jvmci.debug.*;
+
+/**
+ * A java.lang.reflect proxy that hierarchically logs all method invocations along with their
+ * parameters and return values.
+ */
+public class CountingProxy<T> implements InvocationHandler {
+
+    public static final boolean ENABLED = Boolean.valueOf(System.getProperty("jvmci.countcalls"));
+
+    private T delegate;
+
+    private ConcurrentHashMap<Method, AtomicLong> calls = new ConcurrentHashMap<>();
+
+    public CountingProxy(T delegate) {
+        assert ENABLED;
+        TTY.println("Counting proxy for " + delegate.getClass().getSimpleName() + " created");
+        this.delegate = delegate;
+        proxies.add(this);
+    }
+
+    @Override
+    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
+        int argCount = args == null ? 0 : args.length;
+        if (method.getParameterTypes().length != argCount) {
+            throw new RuntimeException("wrong parameter count");
+        }
+        final Object result;
+        if (!calls.containsKey(method)) {
+            calls.putIfAbsent(method, new AtomicLong(0));
+        }
+        AtomicLong count = calls.get(method);
+        count.incrementAndGet();
+        try {
+            if (args == null) {
+                result = method.invoke(delegate);
+            } else {
+                result = method.invoke(delegate, args);
+            }
+        } catch (InvocationTargetException e) {
+            throw e.getCause();
+        }
+        return result;
+    }
+
+    public static <T> T getProxy(Class<T> interf, T delegate) {
+        Class<?>[] interfaces = ProxyUtil.getAllInterfaces(delegate.getClass());
+        Object obj = Proxy.newProxyInstance(interf.getClassLoader(), interfaces, new CountingProxy<>(delegate));
+        return interf.cast(obj);
+    }
+
+    private static ArrayList<CountingProxy<?>> proxies = new ArrayList<>();
+
+    static {
+        if (ENABLED) {
+            Runtime.getRuntime().addShutdownHook(new Thread() {
+
+                @Override
+                public void run() {
+                    for (CountingProxy<?> proxy : proxies) {
+                        proxy.print();
+                    }
+                }
+            });
+        }
+    }
+
+    protected void print() {
+        long sum = 0;
+        for (Map.Entry<Method, AtomicLong> entry : calls.entrySet()) {
+            Method method = entry.getKey();
+            long count = entry.getValue().get();
+            sum += count;
+            TTY.println(delegate.getClass().getSimpleName() + "." + method.getName() + ": " + count);
+        }
+        TTY.println(delegate.getClass().getSimpleName() + " calls: " + sum);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/logging/Logger.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,199 @@
+/*
+ * Copyright (c) 2011, 2015, 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.jvmci.hotspot.logging;
+
+import java.io.*;
+import java.lang.reflect.*;
+import java.util.*;
+
+import com.oracle.jvmci.debug.*;
+import com.oracle.jvmci.hotspot.*;
+
+/**
+ * Scoped logging class used to display the call hierarchy of {@link CompilerToVM} calls.
+ */
+public class Logger {
+
+    public static final boolean ENABLED = Boolean.valueOf(System.getProperty("jvmci.debug"));
+    private static final int SPACING = 4;
+    private static final ThreadLocal<Logger> loggerTL;
+
+    private Deque<Boolean> openStack = new LinkedList<>();
+    private boolean open = false;
+    private int level = 0;
+
+    private static final PrintStream out;
+
+    static {
+        if (ENABLED) {
+            loggerTL = new ThreadLocal<Logger>() {
+
+                @Override
+                protected Logger initialValue() {
+                    return new Logger();
+                }
+            };
+        } else {
+            loggerTL = null;
+        }
+
+        PrintStream ps = null;
+        String filename = System.getProperty("jvmci.info_file");
+        if (filename != null && !"".equals(filename)) {
+            try {
+                ps = new PrintStream(new FileOutputStream(filename));
+            } catch (FileNotFoundException e) {
+                e.printStackTrace();
+                ps = null;
+            }
+        }
+        out = ps;
+        if (out != null) {
+            out.println("start: " + new Date());
+        }
+    }
+
+    public static void info(String message) {
+        if (ENABLED) {
+            log(message);
+        } else {
+            TTY.println(message);
+        }
+        if (out != null) {
+            out.println(message);
+            out.flush();
+        }
+    }
+
+    public static void log(String message) {
+        if (ENABLED) {
+            Logger logger = loggerTL.get();
+            for (String line : message.split("\n")) {
+                if (logger.open) {
+                    TTY.println("...");
+                    logger.open = false;
+                }
+                TTY.print(space(logger.level));
+                TTY.println(line);
+            }
+        }
+    }
+
+    public static void startScope(String message) {
+        if (ENABLED) {
+            Logger logger = loggerTL.get();
+            if (logger.open) {
+                TTY.println("...");
+                logger.open = false;
+            }
+            TTY.print(space(logger.level));
+            TTY.print(message);
+            logger.openStack.push(logger.open);
+            logger.open = true;
+            logger.level++;
+        }
+    }
+
+    public static void endScope(String message) {
+        if (ENABLED) {
+            Logger logger = loggerTL.get();
+            logger.level--;
+            if (logger.open) {
+                TTY.println(message);
+            } else {
+                TTY.println(space(logger.level) + "..." + message);
+            }
+            logger.open = logger.openStack.pop();
+        }
+    }
+
+    private static String[] spaces = new String[50];
+
+    private static String space(int count) {
+        assert count >= 0;
+        String result;
+        if (count >= spaces.length || spaces[count] == null) {
+            StringBuilder str = new StringBuilder();
+            for (int i = 0; i < count * SPACING; i++) {
+                str.append(' ');
+            }
+            result = str.toString();
+            if (count < spaces.length) {
+                spaces[count] = result;
+            }
+        } else {
+            result = spaces[count];
+        }
+        return result;
+    }
+
+    public static String pretty(Object value) {
+        if (value == null) {
+            return "null";
+        }
+
+        Class<?> klass = value.getClass();
+        if (value instanceof Void) {
+            return "void";
+        } else if (value instanceof String) {
+            return "\"" + value + "\"";
+        } else if (value instanceof Method) {
+            return "method \"" + ((Method) value).getName() + "\"";
+        } else if (value instanceof Class<?>) {
+            return "class \"" + ((Class<?>) value).getSimpleName() + "\"";
+        } else if (value instanceof Integer) {
+            if ((Integer) value < 10) {
+                return value.toString();
+            }
+            return value + " (0x" + Integer.toHexString((Integer) value) + ")";
+        } else if (value instanceof Long) {
+            if ((Long) value < 10 && (Long) value > -10) {
+                return value + "l";
+            }
+            return value + "l (0x" + Long.toHexString((Long) value) + "l)";
+        } else if (klass.isArray()) {
+            StringBuilder str = new StringBuilder();
+            int dimensions = 0;
+            while (klass.isArray()) {
+                dimensions++;
+                klass = klass.getComponentType();
+            }
+            int length = Array.getLength(value);
+            str.append(klass.getSimpleName()).append('[').append(length).append(']');
+            for (int i = 1; i < dimensions; i++) {
+                str.append("[]");
+            }
+            str.append(" {");
+            for (int i = 0; i < length; i++) {
+                str.append(pretty(Array.get(value, i)));
+                if (i < length - 1) {
+                    str.append(", ");
+                }
+            }
+            str.append('}');
+            return str.toString();
+        }
+
+        return value.toString();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/logging/LoggingProxy.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2011, 2015, 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.jvmci.hotspot.logging;
+
+import java.lang.reflect.*;
+
+/**
+ * A java.lang.reflect proxy that hierarchically logs all method invocations along with their
+ * parameters and return values.
+ */
+public class LoggingProxy<T> implements InvocationHandler {
+
+    private T delegate;
+
+    public LoggingProxy(T delegate) {
+        this.delegate = delegate;
+    }
+
+    @Override
+    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
+        int argCount = args == null ? 0 : args.length;
+        if (method.getParameterTypes().length != argCount) {
+            throw new RuntimeException("wrong parameter count");
+        }
+        StringBuilder str = new StringBuilder();
+        str.append(method.getReturnType().getSimpleName() + " " + method.getDeclaringClass().getSimpleName() + "." + method.getName() + "(");
+        for (int i = 0; i < argCount; i++) {
+            str.append(i == 0 ? "" : ", ");
+            str.append(Logger.pretty(args[i]));
+        }
+        str.append(")");
+        Logger.startScope(str.toString());
+        final Object result;
+        try {
+            if (args == null) {
+                result = method.invoke(delegate);
+            } else {
+                result = method.invoke(delegate, args);
+            }
+        } catch (InvocationTargetException e) {
+            Logger.endScope(" = Exception " + e.getMessage());
+            throw e.getCause();
+        }
+        Logger.endScope(" = " + Logger.pretty(result));
+        return result;
+    }
+
+    /**
+     * The object returned by this method will implement all interfaces that are implemented by
+     * delegate.
+     */
+    public static <T> T getProxy(Class<T> interf, T delegate) {
+        Class<?>[] interfaces = ProxyUtil.getAllInterfaces(delegate.getClass());
+        Object obj = Proxy.newProxyInstance(interf.getClassLoader(), interfaces, new LoggingProxy<>(delegate));
+        return interf.cast(obj);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/logging/ProxyUtil.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2011, 2015, 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.jvmci.hotspot.logging;
+
+import java.util.*;
+
+public final class ProxyUtil {
+
+    public static Class<?>[] getAllInterfaces(Class<?> clazz) {
+        HashSet<Class<?>> interfaces = new HashSet<>();
+        getAllInterfaces(clazz, interfaces);
+        return interfaces.toArray(new Class<?>[interfaces.size()]);
+    }
+
+    private static void getAllInterfaces(Class<?> clazz, HashSet<Class<?>> interfaces) {
+        for (Class<?> iface : clazz.getInterfaces()) {
+            if (!interfaces.contains(iface)) {
+                interfaces.add(iface);
+                getAllInterfaces(iface, interfaces);
+            }
+        }
+        if (clazz.getSuperclass() != null) {
+            getAllInterfaces(clazz.getSuperclass(), interfaces);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/logging/package-info.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2011, 2015, 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.
+ */
+/**
+ * Logging framework for the HotSpot CRI implementation.
+ */
+package com.oracle.jvmci.hotspot.logging;
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.hotspotvmconfig.processor/src/META-INF/services/javax.annotation.processing.Processor	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,1 @@
+com.oracle.jvmci.hotspotvmconfig.processor.HotSpotVMConfigProcessor
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.hotspotvmconfig.processor/src/com/oracle/jvmci/hotspotvmconfig/processor/HotSpotVMConfigProcessor.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,430 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.hotspotvmconfig.processor;
+
+import java.io.*;
+import java.lang.annotation.*;
+import java.util.*;
+import java.util.Map.Entry;
+import java.util.function.*;
+
+import javax.annotation.processing.*;
+import javax.lang.model.*;
+import javax.lang.model.element.*;
+import javax.tools.Diagnostic.Kind;
+import javax.tools.*;
+
+import com.oracle.jvmci.common.*;
+import com.oracle.jvmci.hotspotvmconfig.*;
+
+@SupportedAnnotationTypes({
+    // @formatter:off
+    "com.oracle.jvmci.hotspotvmconfig.HotSpotVMConstant",
+    "com.oracle.jvmci.hotspotvmconfig.HotSpotVMFlag",
+    "com.oracle.jvmci.hotspotvmconfig.HotSpotVMField",
+    "com.oracle.jvmci.hotspotvmconfig.HotSpotVMType",
+    "com.oracle.jvmci.hotspotvmconfig.HotSpotVMValue"})
+    // @formatter:on
+public class HotSpotVMConfigProcessor extends AbstractProcessor {
+
+    public HotSpotVMConfigProcessor() {
+    }
+
+    @Override
+    public SourceVersion getSupportedSourceVersion() {
+        return SourceVersion.latest();
+    }
+
+    /**
+     * Set to true to enable logging to a local file during annotation processing. There's no normal
+     * channel for any debug messages and debugging annotation processors requires some special
+     * setup.
+     */
+    private static final boolean DEBUG = false;
+
+    private PrintWriter log;
+
+    /**
+     * Logging facility for debugging the annotation processor.
+     */
+
+    private PrintWriter getLog() {
+        if (log == null) {
+            try {
+                // Create the log file within the generated source directory so it's easy to find.
+                // /tmp isn't platform independent and java.io.tmpdir can map anywhere, particularly
+                // on the mac.
+                FileObject file = processingEnv.getFiler().createResource(StandardLocation.SOURCE_OUTPUT, "", getClass().getSimpleName() + "log");
+                log = new PrintWriter(new FileWriter(file.toUri().getPath(), true));
+            } catch (IOException e) {
+                // Do nothing
+            }
+        }
+        return log;
+    }
+
+    private void logMessage(String format, Object... args) {
+        if (!DEBUG) {
+            return;
+        }
+        PrintWriter bw = getLog();
+        if (bw != null) {
+            bw.printf(format, args);
+            bw.flush();
+        }
+    }
+
+    private void logException(Throwable t) {
+        if (!DEBUG) {
+            return;
+        }
+        PrintWriter bw = getLog();
+        if (bw != null) {
+            t.printStackTrace(bw);
+            bw.flush();
+        }
+    }
+
+    /**
+     * Bugs in an annotation processor can cause silent failure so try to report any exception
+     * throws as errors.
+     */
+    private void reportExceptionThrow(Element element, Throwable t) {
+        if (element != null) {
+            logMessage("throw for %s:\n", element);
+        }
+        logException(t);
+        errorMessage(element, "Exception throw during processing: %s %s", t, Arrays.toString(Arrays.copyOf(t.getStackTrace(), 4)));
+    }
+
+    //@formatter:off
+    String[] prologue = new String[]{
+        "// The normal wrappers CommandLineFlags::boolAt and CommandLineFlags::intxAt skip constant flags",
+        "static bool boolAt(char* name, bool* value) {",
+        "  Flag* result = Flag::find_flag(name, strlen(name), true, true);",
+        "  if (result == NULL) return false;",
+        "  if (!result->is_bool()) return false;",
+        "  *value = result->get_bool();",
+        "  return true;",
+        "}",
+        "",
+        "static bool intxAt(char* name, intx* value) {",
+        "  Flag* result = Flag::find_flag(name, strlen(name), true, true);",
+        "  if (result == NULL) return false;",
+        "  if (!result->is_intx()) return false;",
+        "  *value = result->get_intx();",
+        "  return true;",
+        "}",
+        "",
+        "#define set_boolean(name, value) vmconfig_oop->bool_field_put(fs.offset(), value)",
+        "#define set_byte(name, value) vmconfig_oop->byte_field_put(fs.offset(), (jbyte)(value))",
+        "#define set_short(name, value) vmconfig_oop->short_field_put(fs.offset(), (jshort)(value))",
+        "#define set_int(name, value) vmconfig_oop->int_field_put(fs.offset(), (int)(value))",
+        "#define set_long(name, value) vmconfig_oop->long_field_put(fs.offset(), value)",
+        "#define set_address(name, value) do { set_long(name, (jlong)(value)); } while (0)",
+        "",
+        "#define set_optional_boolean_flag(varName, flagName) do { bool flagValue; if (boolAt((char*) flagName, &flagValue)) { set_boolean(varName, flagValue); } } while (0)",
+        "#define set_optional_int_flag(varName, flagName) do { intx flagValue; if (intxAt((char*) flagName, &flagValue)) { set_int(varName, flagValue); } } while (0)",
+        "#define set_optional_long_flag(varName, flagName) do { intx flagValue; if (intxAt((char*) flagName, &flagValue)) { set_long(varName, flagValue); } } while (0)",
+        "",
+        "void VMStructs::initHotSpotVMConfig(oop vmconfig_oop) {",
+        "  InstanceKlass* vmconfig_klass = InstanceKlass::cast(vmconfig_oop->klass());",
+        "",
+    };
+    //@formatter:on
+
+    String outputName = "HotSpotVMConfig.inline.hpp";
+    String outputDirectory = "hotspot";
+
+    private void createFiles(Map<String, VMConfigField> annotations, Element element) {
+
+        Filer filer = processingEnv.getFiler();
+        try (PrintWriter out = createSourceFile(outputDirectory, outputName, filer, element)) {
+
+            for (String line : prologue) {
+                out.println(line);
+            }
+
+            Map<String, Integer> expectedValues = new HashMap<>();
+            for (VMConfigField value : annotations.values()) {
+                if (!value.optional) {
+                    String key = value.define != null ? value.define : "";
+                    if (expectedValues.get(key) == null) {
+                        expectedValues.put(key, 1);
+                    } else {
+                        expectedValues.put(key, expectedValues.get(key) + 1);
+                    }
+                }
+            }
+
+            out.printf("  int expected = %s;%n", expectedValues.get(""));
+            for (Entry<String, Integer> entry : expectedValues.entrySet()) {
+                if (entry.getKey().equals("")) {
+                    continue;
+                }
+                out.printf("#if %s%n", entry.getKey());
+                out.printf("  expected += %s;%n", entry.getValue());
+                out.printf("#endif%n");
+            }
+            out.println("  int assigned = 0;");
+            out.println("  for (JavaFieldStream fs(vmconfig_klass); !fs.done(); fs.next()) {");
+
+            Set<String> fieldTypes = new HashSet<>();
+            for (VMConfigField key : annotations.values()) {
+                fieldTypes.add(key.getType());
+            }
+            // For each type of field, generate a switch on the length of the symbol and then do a
+            // direct compare. In general this reduces each operation to 2 tests plus a string
+            // compare. Being more perfect than that is probably not worth it.
+            for (String type : fieldTypes) {
+                String sigtype = type.equals("boolean") ? "bool" : type;
+                out.println("    if (fs.signature() == vmSymbols::" + sigtype + "_signature()) {");
+                Set<Integer> lengths = new HashSet<>();
+                for (Entry<String, VMConfigField> entry : annotations.entrySet()) {
+                    if (entry.getValue().getType().equals(type)) {
+                        lengths.add(entry.getKey().length());
+                    }
+                }
+                out.println("      switch (fs.name()->utf8_length()) {");
+                for (int len : lengths) {
+                    out.println("        case " + len + ":");
+                    for (Entry<String, VMConfigField> entry : annotations.entrySet()) {
+                        if (entry.getValue().getType().equals(type) && entry.getKey().length() == len) {
+                            out.println("          if (fs.name()->equals(\"" + entry.getKey() + "\")) {");
+                            entry.getValue().emit(out);
+                            out.println("            continue;");
+                            out.println("          }");
+                        }
+                    }
+                    out.println("          continue;");
+                }
+                out.println("      } // switch");
+                out.println("      continue;");
+                out.println("    } // if");
+            }
+            out.println("  } // for");
+            out.println("  guarantee(assigned == expected, \"Didn't find all fields during init of HotSpotVMConfig.  Maybe recompile?\");");
+            out.println("}");
+        }
+    }
+
+    protected PrintWriter createSourceFile(String pkg, String relativeName, Filer filer, Element... originatingElements) {
+        try {
+            // Ensure Unix line endings to comply with code style guide checked by Checkstyle
+            FileObject sourceFile = filer.createResource(StandardLocation.SOURCE_OUTPUT, pkg, relativeName, originatingElements);
+            logMessage("%s\n", sourceFile);
+            return new PrintWriter(sourceFile.openWriter()) {
+
+                @Override
+                public void println() {
+                    print("\n");
+                }
+            };
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    static class VMConfigField {
+        final String setter;
+        final String define;
+        private boolean optional;
+        final VariableElement field;
+
+        public VMConfigField(VariableElement field, HotSpotVMField value) {
+            this.field = field;
+            define = archDefines(value.archs());
+            String type = field.asType().toString();
+            String name = value.name();
+            int i = name.lastIndexOf("::");
+            switch (value.get()) {
+                case OFFSET:
+                    setter = String.format("set_%s(\"%s\", offset_of(%s, %s));", type, field.getSimpleName(), name.substring(0, i), name.substring(i + 2));
+                    break;
+                case ADDRESS:
+                    setter = String.format("set_address(\"%s\", &%s);", field.getSimpleName(), name);
+                    break;
+                case VALUE:
+                    setter = String.format("set_%s(\"%s\", (%s) (intptr_t) %s);", type, field.getSimpleName(), type, name);
+                    break;
+                default:
+                    throw new JVMCIError("unexpected type: " + value.get());
+            }
+        }
+
+        public VMConfigField(VariableElement field, HotSpotVMType value) {
+            this.field = field;
+            define = null; // ((HotSpotVMType) annotation).archs();
+            String type = field.asType().toString();
+            setter = String.format("set_%s(\"%s\", sizeof(%s));", type, field.getSimpleName(), value.name());
+        }
+
+        public VMConfigField(VariableElement field, HotSpotVMValue value) {
+            this.field = field;
+            String[] defines = value.defines();
+            int length = defines.length;
+            if (length != 0) {
+                for (int i = 0; i < length; i++) {
+                    defines[i] = "defined(" + defines[i] + ")";
+                }
+                define = String.join(" || ", defines);
+            } else {
+                define = null; // ((HotSpotVMValue) annotation).archs();
+            }
+            String type = field.asType().toString();
+            if (value.get() == HotSpotVMValue.Type.ADDRESS) {
+                setter = String.format("set_address(\"%s\", %s);", field.getSimpleName(), value.expression());
+            } else {
+                setter = String.format("set_%s(\"%s\", %s);", type, field.getSimpleName(), value.expression());
+            }
+        }
+
+        public VMConfigField(VariableElement field, HotSpotVMConstant value) {
+            this.field = field;
+            define = archDefines(value.archs());
+            String type = field.asType().toString();
+            setter = String.format("set_%s(\"%s\", %s);", type, field.getSimpleName(), value.name());
+        }
+
+        public VMConfigField(VariableElement field, HotSpotVMFlag value) {
+            this.field = field;
+            define = archDefines(value.archs());
+            optional = value.optional();
+            String type = field.asType().toString();
+            if (value.optional()) {
+                setter = String.format("set_optional_%s_flag(\"%s\",  \"%s\");", type, field.getSimpleName(), value.name());
+            } else {
+                setter = String.format("set_%s(\"%s\", %s);", type, field.getSimpleName(), value.name());
+            }
+        }
+
+        public String getType() {
+            return field.asType().toString();
+        }
+
+        private static String archDefine(String arch) {
+            switch (arch) {
+                case "amd64":
+                    return "defined(AMD64)";
+                case "sparcv9":
+                    return "(defined(SPARC) && defined(_LP64))";
+                case "sparc":
+                    return "defined(SPARC)";
+                default:
+                    throw new JVMCIError("unexpected arch: " + arch);
+            }
+        }
+
+        private static String archDefines(String[] archs) {
+            if (archs == null || archs.length == 0) {
+                return null;
+            }
+            if (archs.length == 1) {
+                return archDefine(archs[0]);
+            }
+            String[] defs = new String[archs.length];
+            int i = 0;
+            for (String arch : archs) {
+                defs[i++] = archDefine(arch);
+            }
+            return String.join(" || ", defs);
+        }
+
+        public void emit(PrintWriter out) {
+            if (define != null) {
+                out.printf("#if %s\n", define);
+            }
+            out.printf("            %s%n", setter);
+            if (!optional) {
+                out.printf("            assigned++;%n");
+            }
+            if (define != null) {
+                out.printf("#endif\n");
+            }
+        }
+
+    }
+
+    @SuppressWarnings("unchecked")
+    private <T extends Annotation> void collectAnnotations(RoundEnvironment roundEnv, Map<String, VMConfigField> annotationMap, Class<T> annotationClass,
+                    BiFunction<VariableElement, T, VMConfigField> builder) {
+        for (Element element : roundEnv.getElementsAnnotatedWith(annotationClass)) {
+            Annotation constant = element.getAnnotation(annotationClass);
+            if (element.getKind() != ElementKind.FIELD) {
+                errorMessage(element, "%s annotations may only be on fields", annotationClass.getSimpleName());
+            }
+            if (annotationClass == HotSpotVMValue.class) {
+                HotSpotVMValue value = (HotSpotVMValue) constant;
+                if (value.get() == HotSpotVMValue.Type.ADDRESS && !element.asType().toString().equals("long")) {
+                    errorMessage(element, "HotSpotVMValue with get == ADDRESS must be of type long, but found %s", element.asType());
+                }
+            }
+            if (currentTypeElement == null) {
+                currentTypeElement = element.getEnclosingElement();
+            } else {
+                if (!currentTypeElement.equals(element.getEnclosingElement())) {
+                    errorMessage(element, "Multiple types encountered.  Only HotSpotVMConfig is supported");
+                }
+            }
+            annotationMap.put(element.getSimpleName().toString(), builder.apply((VariableElement) element, (T) constant));
+        }
+    }
+
+    private void errorMessage(Element element, String format, Object... args) {
+        processingEnv.getMessager().printMessage(Kind.ERROR, String.format(format, args), element);
+    }
+
+    Element currentTypeElement = null;
+
+    @Override
+    public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
+        if (roundEnv.processingOver()) {
+            return true;
+        }
+        logMessage("Starting round %s %s\n", roundEnv, annotations);
+        try {
+
+            currentTypeElement = null;
+
+            // First collect all the annotations.
+            Map<String, VMConfigField> annotationMap = new HashMap<>();
+            collectAnnotations(roundEnv, annotationMap, HotSpotVMConstant.class, (e, v) -> new VMConfigField(e, v));
+            collectAnnotations(roundEnv, annotationMap, HotSpotVMFlag.class, (e, v) -> new VMConfigField(e, v));
+            collectAnnotations(roundEnv, annotationMap, HotSpotVMField.class, (e, v) -> new VMConfigField(e, v));
+            collectAnnotations(roundEnv, annotationMap, HotSpotVMType.class, (e, v) -> new VMConfigField(e, v));
+            collectAnnotations(roundEnv, annotationMap, HotSpotVMValue.class, (e, v) -> new VMConfigField(e, v));
+
+            if (annotationMap.isEmpty()) {
+                return true;
+            }
+
+            logMessage("type element %s\n", currentTypeElement);
+            createFiles(annotationMap, currentTypeElement);
+
+        } catch (Throwable t) {
+            reportExceptionThrow(null, t);
+        }
+
+        return true;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.hotspotvmconfig/src/com/oracle/jvmci/hotspotvmconfig/HotSpotVMConstant.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.hotspotvmconfig;
+
+import java.lang.annotation.*;
+
+/**
+ * Refers to a C++ constant in the VM.
+ */
+@Target(ElementType.FIELD)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface HotSpotVMConstant {
+
+    /**
+     * Returns the name of the constant.
+     *
+     * @return name of constant
+     */
+    String name();
+
+    /**
+     * List of architectures where this constant is required. Names are derived from
+     * {@link HotSpotVMConfig#getHostArchitectureName()}. An empty list implies that the constant is
+     * required on all architectures.
+     */
+    @SuppressWarnings("javadoc")
+    String[] archs() default {};
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.hotspotvmconfig/src/com/oracle/jvmci/hotspotvmconfig/HotSpotVMField.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.hotspotvmconfig;
+
+import java.lang.annotation.*;
+
+/**
+ * Refers to a C++ field in the VM.
+ */
+@Target(ElementType.FIELD)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface HotSpotVMField {
+
+    /**
+     * Types of information this annotation can return.
+     */
+    enum Type {
+        /**
+         * Returns the offset of this field within the type. Only valid for instance fields.
+         */
+        OFFSET,
+
+        /**
+         * Returns the absolute address of this field. Only valid for static fields.
+         */
+        ADDRESS,
+
+        /**
+         * Returns the value of this field. Only valid for static fields.
+         */
+        VALUE;
+    }
+
+    /**
+     * Specifies what type of information to return.
+     *
+     * @see Type
+     */
+    Type get();
+
+    /**
+     * Returns the type name containing this field.
+     *
+     * @return name of containing type
+     */
+    String type();
+
+    /**
+     * Returns the name of this field.
+     *
+     * @return name of field
+     */
+    String name();
+
+    /**
+     * List of architectures where this constant is required. Names are derived from
+     * {@link HotSpotVMConfig#getHostArchitectureName()}. An empty list implies that the constant is
+     * required on all architectures.
+     */
+    @SuppressWarnings("javadoc")
+    String[] archs() default {};
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.hotspotvmconfig/src/com/oracle/jvmci/hotspotvmconfig/HotSpotVMFlag.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.hotspotvmconfig;
+
+import java.lang.annotation.*;
+
+/**
+ * Refers to a C++ flag in the VM.
+ */
+@Target(ElementType.FIELD)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface HotSpotVMFlag {
+
+    /**
+     * Returns the name of this flag.
+     *
+     * @return name of flag.
+     */
+    String name();
+
+    /**
+     * List of architectures where this constant is required. Names are derived from
+     * {@link HotSpotVMConfig#getHostArchitectureName()}. An empty list implies that the constant is
+     * required on all architectures.
+     */
+    @SuppressWarnings("javadoc")
+    String[] archs() default {};
+
+    boolean optional() default false;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.hotspotvmconfig/src/com/oracle/jvmci/hotspotvmconfig/HotSpotVMType.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.hotspotvmconfig;
+
+import java.lang.annotation.*;
+
+/**
+ * Refers to a C++ type in the VM.
+ */
+@Target(ElementType.FIELD)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface HotSpotVMType {
+
+    /**
+     * Types of information this annotation can return.
+     */
+    enum Type {
+        /**
+         * Returns the size of the type (C++ {@code sizeof()}).
+         */
+        SIZE;
+    }
+
+    /**
+     * Specifies what type of information to return.
+     *
+     * @see Type
+     */
+    Type get();
+
+    /**
+     * Returns the name of the type.
+     *
+     * @return name of type
+     */
+    String name();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.hotspotvmconfig/src/com/oracle/jvmci/hotspotvmconfig/HotSpotVMValue.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.hotspotvmconfig;
+
+import java.lang.annotation.*;
+
+@Target(ElementType.FIELD)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface HotSpotVMValue {
+
+    /**
+     * A C++ expression to be evaluated and assigned to the field.
+     */
+    String expression();
+
+    enum Type {
+        /**
+         * A C++ address which might require extra casts to be safely assigned to a Java field.
+         */
+        ADDRESS,
+
+        /**
+         * A simple value which can be assigned to a regular Java field.
+         */
+        VALUE
+    }
+
+    /**
+     * If {@link #expression} is a C++ function name, {@link #signature} represents the signature of
+     * the function.
+     *
+     */
+    String signature() default "";
+
+    Type get() default Type.VALUE;
+
+    /**
+     * List of preprocessor symbols that should guard initialization of this value.
+     */
+    String[] defines() default {};
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.meta/overview.html	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,38 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+<!--
+
+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.  Oracle designates this
+particular file as subject to the "Classpath" exception as provided
+by Oracle in the LICENSE file that accompanied this code.
+
+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.
+-->
+
+</head>
+<body>
+
+The <code>com.oracle.jvmci.meta</code> project provides an API to the runtime data structures
+for various Java elements. Unlike standard Java reflection, it can model elements that are not yet loaded.
+It can also expose profiling information collected by the runtime system.
+
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/AbstractJavaProfile.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,158 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.meta;
+
+/**
+ * This object holds probability information for a set of items that were profiled at a specific
+ * BCI. The precision of the supplied values may vary, but a runtime that provides this information
+ * should be aware that it will be used to guide performance-critical decisions like speculative
+ * inlining, etc.
+ *
+ * @param <T> a subclass of AbstractProfiledItem
+ * @param <U> the class of the items that are profiled at the specific BCI and for which
+ *            probabilities are stored. E.g., a ResolvedJavaType or a ResolvedJavaMethod.
+ */
+public abstract class AbstractJavaProfile<T extends AbstractProfiledItem<U>, U> {
+
+    private final double notRecordedProbability;
+    private final T[] pitems;
+
+    public AbstractJavaProfile(double notRecordedProbability, T[] pitems) {
+        this.pitems = pitems;
+        assert !Double.isNaN(notRecordedProbability);
+        this.notRecordedProbability = notRecordedProbability;
+        assert isSorted();
+        assert totalProbablility() >= 0 && totalProbablility() <= 1.0001 : totalProbablility() + " " + this;
+    }
+
+    private double totalProbablility() {
+        double total = notRecordedProbability;
+        for (T item : pitems) {
+            total += item.probability;
+        }
+        return total;
+    }
+
+    /**
+     * Determines if an array of profiled items are sorted in descending order of their
+     * probabilities.
+     */
+    private boolean isSorted() {
+        for (int i = 1; i < pitems.length; i++) {
+            if (pitems[i - 1].getProbability() < pitems[i].getProbability()) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    /**
+     * Returns the estimated probability of all types that could not be recorded due to profiling
+     * limitations.
+     *
+     * @return double value &ge; 0.0 and &le; 1.0
+     */
+    public double getNotRecordedProbability() {
+        return notRecordedProbability;
+    }
+
+    protected T[] getItems() {
+        return pitems;
+    }
+
+    /**
+     * Searches for an entry of a given resolved Java type.
+     *
+     * @param type the type for which an entry should be searched
+     * @return the entry or null if no entry for this type can be found
+     */
+    public T findEntry(ResolvedJavaType type) {
+        if (pitems != null) {
+            for (T pt : pitems) {
+                if (pt.getItem().equals(type)) {
+                    return pt;
+                }
+            }
+        }
+        return null;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder builder = new StringBuilder();
+        builder.append(this.getClass().getName());
+        builder.append("[");
+        if (pitems != null) {
+            for (T pt : pitems) {
+                builder.append(pt.toString());
+                builder.append(", ");
+            }
+        }
+        builder.append(this.notRecordedProbability);
+        builder.append("]");
+        return builder.toString();
+    }
+
+    public boolean isIncluded(U item) {
+        if (this.getNotRecordedProbability() > 0.0) {
+            return true;
+        } else {
+            for (int i = 0; i < getItems().length; i++) {
+                T pitem = getItems()[i];
+                U curType = pitem.getItem();
+                if (curType == item) {
+                    return true;
+                }
+            }
+        }
+        return false;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (obj == this) {
+            return true;
+        }
+        if (!(obj instanceof AbstractJavaProfile)) {
+            return false;
+        }
+        AbstractJavaProfile<?, ?> that = (AbstractJavaProfile<?, ?>) obj;
+        if (that.notRecordedProbability != notRecordedProbability) {
+            return false;
+        }
+        if (that.pitems.length != pitems.length) {
+            return false;
+        }
+        for (int i = 0; i < pitems.length; ++i) {
+            if (!pitems[i].equals(that.pitems[i])) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    @Override
+    public int hashCode() {
+        return (int) Double.doubleToLongBits(notRecordedProbability) + pitems.length * 13;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/AbstractProfiledItem.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.meta;
+
+/**
+ * A profiled type that has a probability. Profiled types are naturally sorted in descending order
+ * of their probabilities.
+ */
+public abstract class AbstractProfiledItem<T> implements Comparable<AbstractProfiledItem<?>> {
+
+    protected final T item;
+    protected final double probability;
+
+    public AbstractProfiledItem(T item, double probability) {
+        assert item != null;
+        assert probability >= 0.0D && probability <= 1.0D;
+        this.item = item;
+        this.probability = probability;
+    }
+
+    protected T getItem() {
+        return item;
+    }
+
+    /**
+     * Returns the estimated probability of {@link #getItem()}.
+     *
+     * @return double value &ge; 0.0 and &le; 1.0
+     */
+    public double getProbability() {
+        return probability;
+    }
+
+    @Override
+    public int compareTo(AbstractProfiledItem<?> o) {
+        if (getProbability() > o.getProbability()) {
+            return -1;
+        } else if (getProbability() < o.getProbability()) {
+            return 1;
+        }
+        return 0;
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        long temp;
+        temp = Double.doubleToLongBits(probability);
+        result = prime * result + (int) (temp ^ (temp >>> 32));
+        result = prime * result + item.hashCode();
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        AbstractProfiledItem<?> other = (AbstractProfiledItem<?>) obj;
+        if (Double.doubleToLongBits(probability) != Double.doubleToLongBits(other.probability)) {
+            return false;
+        }
+        return item.equals(other.item);
+    }
+
+    @Override
+    public abstract String toString();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/AbstractValue.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.meta;
+
+/**
+ * Abstract base class for values.
+ */
+public abstract class AbstractValue implements Value, KindProvider {
+
+    public static final AllocatableValue ILLEGAL = Value.ILLEGAL;
+
+    private final Kind kind;
+    private final LIRKind lirKind;
+
+    /**
+     * Initializes a new value of the specified kind.
+     *
+     * @param lirKind the kind
+     */
+    protected AbstractValue(LIRKind lirKind) {
+        this.lirKind = lirKind;
+        if (getPlatformKind() instanceof Kind) {
+            this.kind = (Kind) getPlatformKind();
+        } else {
+            this.kind = Kind.Illegal;
+        }
+    }
+
+    /**
+     * Returns a String representation of the kind, which should be the end of all
+     * {@link #toString()} implementation of subclasses.
+     */
+    protected final String getKindSuffix() {
+        return "|" + getKind().getTypeChar();
+    }
+
+    /**
+     * Returns the kind of this value.
+     */
+    public final Kind getKind() {
+        return kind;
+    }
+
+    public final LIRKind getLIRKind() {
+        return lirKind;
+    }
+
+    /**
+     * Returns the platform specific kind used to store this value.
+     */
+    public final PlatformKind getPlatformKind() {
+        return lirKind.getPlatformKind();
+    }
+
+    @Override
+    public int hashCode() {
+        return 41 + lirKind.hashCode();
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (obj instanceof AbstractValue) {
+            AbstractValue that = (AbstractValue) obj;
+            return kind.equals(that.kind) && lirKind.equals(that.lirKind);
+        }
+        return false;
+    }
+
+    /**
+     * Checks if this value is identical to {@code other}.
+     *
+     * Warning: Use with caution! Usually equivalence {@link #equals(Object)} is sufficient and
+     * should be used.
+     */
+    @ExcludeFromIdentityComparisonVerification
+    public final boolean identityEquals(AbstractValue other) {
+        return this == other;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/AllocatableValue.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.meta;
+
+/**
+ * Common base class for values that are stored in some location that's managed by the register
+ * allocator (e.g. register, stack slot).
+ */
+public abstract class AllocatableValue extends AbstractValue implements JavaValue, KindProvider {
+
+    public static final AllocatableValue[] NONE = {};
+
+    public AllocatableValue(LIRKind lirKind) {
+        super(lirKind);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/Assumptions.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,380 @@
+/*
+ * 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.jvmci.meta;
+
+import java.lang.invoke.*;
+import java.util.*;
+
+/**
+ * Class for recording assumptions made during compilation.
+ */
+public final class Assumptions implements Iterable<Assumptions.Assumption> {
+
+    /**
+     * Abstract base class for assumptions. An assumption assumes a property of the runtime that may
+     * be invalidated by subsequent execution (e.g., that a class has no subclasses implementing
+     * {@link NoFinalizableSubclass Object.finalize()}).
+     */
+    public abstract static class Assumption {
+    }
+
+    /**
+     * A class for providing information that is only valid in association with a set of
+     * {@link Assumption}s.
+     *
+     * @param <T>
+     */
+    public static class AssumptionResult<T> {
+        Assumption[] assumptions;
+        final T result;
+
+        private static final Assumption[] EMPTY = new Assumption[0];
+
+        public AssumptionResult(T result, Assumption... assumptions) {
+            this.result = result;
+            this.assumptions = assumptions;
+        }
+
+        public AssumptionResult(T result) {
+            this(result, EMPTY);
+        }
+
+        public T getResult() {
+            return result;
+        }
+
+        public boolean isAssumptionFree() {
+            return assumptions.length == 0;
+        }
+
+        public void add(AssumptionResult<T> other) {
+            Assumption[] newAssumptions = Arrays.copyOf(this.assumptions, this.assumptions.length + other.assumptions.length);
+            System.arraycopy(other.assumptions, 0, newAssumptions, this.assumptions.length, other.assumptions.length);
+            this.assumptions = newAssumptions;
+        }
+    }
+
+    /**
+     * An assumption that a given class has no subclasses implementing {@link Object#finalize()}).
+     */
+    public static final class NoFinalizableSubclass extends Assumption {
+
+        private ResolvedJavaType receiverType;
+
+        public NoFinalizableSubclass(ResolvedJavaType receiverType) {
+            this.receiverType = receiverType;
+        }
+
+        @Override
+        public int hashCode() {
+            return 31 + receiverType.hashCode();
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            if (obj instanceof NoFinalizableSubclass) {
+                NoFinalizableSubclass other = (NoFinalizableSubclass) obj;
+                return other.receiverType.equals(receiverType);
+            }
+            return false;
+        }
+
+        @Override
+        public String toString() {
+            return "NoFinalizableSubclass[receiverType=" + receiverType.toJavaName() + "]";
+        }
+
+    }
+
+    /**
+     * An assumption that a given abstract or interface type has one direct concrete subtype. There
+     * is no requirement that the subtype is a leaf type.
+     */
+    public static final class ConcreteSubtype extends Assumption {
+
+        /**
+         * Type the assumption is made about.
+         */
+        public final ResolvedJavaType context;
+
+        /**
+         * Assumed concrete sub-type of the context type.
+         */
+        public final ResolvedJavaType subtype;
+
+        public ConcreteSubtype(ResolvedJavaType context, ResolvedJavaType subtype) {
+            this.context = context;
+            this.subtype = subtype;
+            assert context.isAbstract();
+            assert subtype.isConcrete() || context.isInterface() : subtype.toString() + " : " + context.toString();
+            assert !subtype.isArray() || subtype.getElementalType().isFinal() : subtype.toString() + " : " + context.toString();
+        }
+
+        @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.equals(context) && other.subtype.equals(subtype);
+            }
+            return false;
+        }
+
+        @Override
+        public String toString() {
+            return "ConcreteSubtype[context=" + context.toJavaName() + ", subtype=" + subtype.toJavaName() + "]";
+        }
+    }
+
+    /**
+     * An assumption that a given type has no subtypes.
+     */
+    public static final class LeafType extends Assumption {
+
+        /**
+         * Type the assumption is made about.
+         */
+        public final ResolvedJavaType context;
+
+        public LeafType(ResolvedJavaType context) {
+            this.context = context;
+        }
+
+        @Override
+        public int hashCode() {
+            final int prime = 31;
+            int result = 1;
+            result = prime * result + context.hashCode();
+            return result;
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            if (obj instanceof LeafType) {
+                LeafType other = (LeafType) obj;
+                return other.context.equals(context);
+            }
+            return false;
+        }
+
+        @Override
+        public String toString() {
+            return "LeafSubtype[context=" + context.toJavaName() + "]";
+        }
+    }
+
+    /**
+     * An assumption that a given virtual method has a given unique implementation.
+     */
+    public static final class ConcreteMethod extends Assumption {
+
+        /**
+         * A virtual (or interface) method whose unique implementation for the receiver type in
+         * {@link #context} is {@link #impl}.
+         */
+        public final ResolvedJavaMethod method;
+
+        /**
+         * A receiver type.
+         */
+        public final ResolvedJavaType context;
+
+        /**
+         * The unique implementation of {@link #method} for {@link #context}.
+         */
+        public final ResolvedJavaMethod impl;
+
+        public ConcreteMethod(ResolvedJavaMethod method, ResolvedJavaType context, ResolvedJavaMethod 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.equals(method) && other.context.equals(context) && other.impl.equals(impl);
+            }
+            return false;
+        }
+
+        @Override
+        public String toString() {
+            return "ConcreteMethod[method=" + method.format("%H.%n(%p)%r") + ", context=" + context.toJavaName() + ", impl=" + impl.format("%H.%n(%p)%r") + "]";
+        }
+    }
+
+    /**
+     * An assumption that a given call site's method handle did not change.
+     */
+    public static final class CallSiteTargetValue extends Assumption {
+
+        public final CallSite callSite;
+        public final MethodHandle methodHandle;
+
+        public CallSiteTargetValue(CallSite callSite, MethodHandle methodHandle) {
+            this.callSite = callSite;
+            this.methodHandle = methodHandle;
+        }
+
+        @Override
+        public int hashCode() {
+            final int prime = 31;
+            int result = 1;
+            result = prime * result + callSite.hashCode();
+            result = prime * result + methodHandle.hashCode();
+            return result;
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            if (obj instanceof CallSiteTargetValue) {
+                CallSiteTargetValue other = (CallSiteTargetValue) obj;
+                return callSite.equals(other.callSite) && methodHandle.equals(other.methodHandle);
+            }
+            return false;
+        }
+
+        @Override
+        public String toString() {
+            return "CallSiteTargetValue[callSite=" + callSite + ", methodHandle=" + methodHandle + "]";
+        }
+    }
+
+    private final Set<Assumption> assumptions = new HashSet<>();
+
+    /**
+     * 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 assumptions.isEmpty();
+    }
+
+    @Override
+    public int hashCode() {
+        throw new UnsupportedOperationException("hashCode");
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj instanceof Assumptions) {
+            Assumptions that = (Assumptions) obj;
+            if (!this.assumptions.equals(that.assumptions)) {
+                return false;
+            }
+            return true;
+        }
+        return false;
+    }
+
+    @Override
+    public Iterator<Assumption> iterator() {
+        return assumptions.iterator();
+    }
+
+    /**
+     * Records an assumption that the specified type has no finalizable subclasses.
+     *
+     * @param receiverType the type that is assumed to have no finalizable subclasses
+     */
+    public void recordNoFinalizableSubclassAssumption(ResolvedJavaType receiverType) {
+        record(new NoFinalizableSubclass(receiverType));
+    }
+
+    /**
+     * 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(ResolvedJavaType context, ResolvedJavaType 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(ResolvedJavaMethod method, ResolvedJavaType context, ResolvedJavaMethod impl) {
+        record(new ConcreteMethod(method, context, impl));
+    }
+
+    public void record(AssumptionResult<?> result) {
+        for (Assumption assumption : result.assumptions) {
+            record(assumption);
+        }
+    }
+
+    public void record(Assumption assumption) {
+        assumptions.add(assumption);
+    }
+
+    /**
+     * Gets a copy of the assumptions recorded in this object as an array.
+     */
+    public Assumption[] toArray() {
+        return assumptions.toArray(new Assumption[assumptions.size()]);
+    }
+
+    /**
+     * Copies assumptions recorded by another {@link Assumptions} object into this object.
+     */
+    public void record(Assumptions other) {
+        assert other != this;
+        assumptions.addAll(other.assumptions);
+    }
+
+    @Override
+    public String toString() {
+        return "Assumptions[" + assumptions + "]";
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/BytecodeDisassemblerProvider.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.meta;
+
+/**
+ * Interface for disassembling bytecode.
+ */
+public interface BytecodeDisassemblerProvider {
+
+    /**
+     * Gets a textual disassembly of the bytecode for a given method. In the absence of bytecode
+     * rewriting, disassembling a method will produce the same result.
+     *
+     * @return a non-zero length string containing a disassembly of {@code method}'s bytecode or
+     *         null if {@code method} has no bytecode (i.e., {@code method.getCodeSize() == 0})
+     */
+    String disassemble(ResolvedJavaMethod method);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/Constant.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.meta;
+
+/**
+ * Represents a compile-time constant (boxed) value within the compiler.
+ */
+public interface Constant {
+
+    boolean isDefaultForKind();
+
+    String toValueString();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/ConstantPool.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,121 @@
+/*
+ * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.meta;
+
+/**
+ * Represents the runtime representation of the constant pool that is used by the compiler when
+ * parsing bytecode. Provides methods to look up a constant pool entry without performing
+ * resolution. They are used during compilation.
+ */
+public interface ConstantPool {
+
+    /**
+     * Returns the number of entries the constant pool.
+     *
+     * @return number of entries in the constant pool
+     */
+    int length();
+
+    /**
+     * Ensures that the type referenced by the specified constant pool entry is loaded and
+     * initialized. This can be used to compile time resolve a type. It works for field, method, or
+     * type constant pool entries.
+     *
+     * @param cpi the index of the constant pool entry that references the type
+     * @param opcode the opcode of the instruction that references the type
+     */
+    void loadReferencedType(int cpi, int opcode);
+
+    /**
+     * Looks up a reference to a field. If {@code opcode} is non-negative, then resolution checks
+     * specific to the bytecode it denotes are performed if the field is already resolved. Should
+     * any of these checks fail, an unresolved field reference is returned.
+     *
+     * @param cpi the constant pool index
+     * @param opcode the opcode of the instruction for which the lookup is being performed or
+     *            {@code -1}
+     * @return a reference to the field at {@code cpi} in this pool
+     * @throws ClassFormatError if the entry at {@code cpi} is not a field
+     */
+    JavaField lookupField(int cpi, int opcode);
+
+    /**
+     * Looks up a reference to a method. If {@code opcode} is non-negative, then resolution checks
+     * specific to the bytecode it denotes are performed if the method is already resolved. Should
+     * any of these checks fail, an unresolved method reference is returned.
+     *
+     * @param cpi the constant pool index
+     * @param opcode the opcode of the instruction for which the lookup is being performed or
+     *            {@code -1}
+     * @return a reference to the method at {@code cpi} in this pool
+     * @throws ClassFormatError if the entry at {@code cpi} is not a method
+     */
+    JavaMethod lookupMethod(int cpi, int opcode);
+
+    /**
+     * Looks up a reference to a type. If {@code opcode} is non-negative, then resolution checks
+     * specific to the bytecode it denotes are performed if the type is already resolved. Should any
+     * of these checks fail, an unresolved type reference is returned.
+     *
+     * @param cpi the constant pool index
+     * @param opcode the opcode of the instruction for which the lookup is being performed or
+     *            {@code -1}
+     * @return a reference to the compiler interface type
+     */
+    JavaType lookupType(int cpi, int opcode);
+
+    /**
+     * Looks up an Utf8 string.
+     *
+     * @param cpi the constant pool index
+     * @return the Utf8 string at index {@code cpi} in this constant pool
+     */
+    String lookupUtf8(int cpi);
+
+    /**
+     * Looks up a method signature.
+     *
+     * @param cpi the constant pool index
+     * @return the method signature at index {@code cpi} in this constant pool
+     */
+    Signature lookupSignature(int cpi);
+
+    /**
+     * Looks up a constant at the specified index.
+     *
+     * @param cpi the constant pool index
+     * @return the {@code Constant} or {@code JavaType} instance representing the constant pool
+     *         entry
+     */
+    Object lookupConstant(int cpi);
+
+    /**
+     * Looks up the appendix at the specified index.
+     *
+     * @param cpi the constant pool index
+     * @param opcode the opcode of the instruction for which the lookup is being performed or
+     *            {@code -1}
+     * @return the appendix if it exists and is resolved or {@code null}
+     */
+    JavaConstant lookupAppendix(int cpi, int opcode);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/ConstantReflectionProvider.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,152 @@
+/*
+ * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.meta;
+
+import java.lang.invoke.*;
+
+/**
+ * Reflection operations on values represented as {@linkplain JavaConstant constants}. All methods
+ * in this interface require the VM to access the actual object encapsulated in {@link Kind#Object
+ * object} constants. This access is not always possible, depending on kind of VM and the state that
+ * the VM is in. Therefore, all methods can return {@code null} at any time, to indicate that the
+ * result is not available at this point. The caller is responsible to check for {@code null}
+ * results and handle them properly, e.g., not perform an optimization.
+ */
+public interface ConstantReflectionProvider {
+
+    /**
+     * Compares two constants for equality. The equality relationship is symmetric. Returns
+     * {@link Boolean#TRUE true} if the two constants represent the same run time value,
+     * {@link Boolean#FALSE false} if they are different. Returns {@code null} if the constants
+     * cannot be compared at this point.
+     */
+    Boolean constantEquals(Constant x, Constant y);
+
+    /**
+     * Returns the length of the array constant. Returns {@code null} if the constant is not an
+     * array, or if the array length is not available at this point.
+     */
+    Integer readArrayLength(JavaConstant array);
+
+    /**
+     * Reads a value from the given array at the given index. Returns {@code null} if the constant
+     * is not an array, if the index is out of bounds, or if the value is not available at this
+     * point.
+     */
+    JavaConstant readArrayElement(JavaConstant array, int index);
+
+    /**
+     * Reads a value from the given array at the given index if it is a stable array. Returns
+     * {@code null} if the constant is not a stable array, if it is a default value, if the index is
+     * out of bounds, or if the value is not available at this point.
+     */
+    JavaConstant readConstantArrayElement(JavaConstant array, int index);
+
+    /**
+     * Reads a value from the given array at the given offset if it is a stable array. The offset
+     * will decoded relative to the platform addressing into an index into the array. Returns
+     * {@code null} if the constant is not a stable array, if it is a default value, if the offset
+     * is out of bounds, or if the value is not available at this point.
+     */
+    JavaConstant readConstantArrayElementForOffset(JavaConstant array, long offset);
+
+    /**
+     * Gets the constant value of this field. Note that a {@code static final} field may not be
+     * considered constant if its declaring class is not yet initialized or if it is a well known
+     * field that can be updated via other means (e.g., {@link System#setOut(java.io.PrintStream)}).
+     *
+     * @param receiver object from which this field's value is to be read. This value is ignored if
+     *            this field is static.
+     * @return the constant value of this field or {@code null} if this field is not considered
+     *         constant by the runtime
+     */
+    JavaConstant readConstantFieldValue(JavaField field, JavaConstant receiver);
+
+    /**
+     * Gets the current value of this field for a given object, if available.
+     *
+     * There is no guarantee that the same value will be returned by this method for a field unless
+     * the field is considered to be {@linkplain #readConstantFieldValue(JavaField, JavaConstant)
+     * constant} by the runtime.
+     *
+     * @param receiver object from which this field's value is to be read. This value is ignored if
+     *            this field is static.
+     * @return the value of this field or {@code null} if the value is not available (e.g., because
+     *         the field holder is not yet initialized).
+     */
+    JavaConstant readFieldValue(JavaField field, JavaConstant receiver);
+
+    /**
+     * Gets the current value of this field for a given object, if available. Like
+     * {@link #readFieldValue(JavaField, JavaConstant)} but treats array fields as stable.
+     *
+     * There is no guarantee that the same value will be returned by this method for a field unless
+     * the field is considered to be {@linkplain #readConstantFieldValue(JavaField, JavaConstant)
+     * constant} by the runtime.
+     *
+     * @param receiver object from which this field's value is to be read. This value is ignored if
+     *            this field is static.
+     * @param isDefaultStable if {@code true}, default values are considered stable
+     * @return the value of this field or {@code null} if the value is not available (e.g., because
+     *         the field holder is not yet initialized).
+     */
+    JavaConstant readStableFieldValue(JavaField field, JavaConstant receiver, boolean isDefaultStable);
+
+    /**
+     * Converts the given {@link Kind#isPrimitive() primitive} constant to a boxed
+     * {@link Kind#Object object} constant, according to the Java boxing rules. Returns {@code null}
+     * if the source is is not a primitive constant, or the boxed value is not available at this
+     * point.
+     */
+    JavaConstant boxPrimitive(JavaConstant source);
+
+    /**
+     * Converts the given {@link Kind#Object object} constant to a {@link Kind#isPrimitive()
+     * primitive} constant, according to the Java unboxing rules. Returns {@code null} if the source
+     * is is not an object constant that can be unboxed, or the unboxed value is not available at
+     * this point.
+     */
+    JavaConstant unboxPrimitive(JavaConstant source);
+
+    /**
+     * Gets a string as a {@link JavaConstant}.
+     */
+    JavaConstant forString(String value);
+
+    /**
+     * Returns the {@link ResolvedJavaType} for a {@link Class} object (or any other object regarded
+     * as a class by the VM) encapsulated in the given constant. Returns {@code null} if the
+     * constant does not encapsulate a class, or if the type is not available at this point.
+     */
+    ResolvedJavaType asJavaType(Constant constant);
+
+    /**
+     * Gets access to the internals of {@link MethodHandle}.
+     */
+    MethodHandleAccessProvider getMethodHandleAccess();
+
+    /**
+     * Gets raw memory access.
+     */
+    MemoryAccessProvider getMemoryAccessProvider();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/DefaultProfilingInfo.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,110 @@
+/*
+ * 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.jvmci.meta;
+
+/**
+ * An implementation of {@link ProfilingInfo} that can used in the absence of real profile
+ * information.
+ */
+public final class DefaultProfilingInfo implements ProfilingInfo {
+
+    private static final ProfilingInfo[] NO_PROFILING_INFO = new ProfilingInfo[]{new DefaultProfilingInfo(TriState.TRUE), new DefaultProfilingInfo(TriState.FALSE),
+                    new DefaultProfilingInfo(TriState.UNKNOWN)};
+
+    private final TriState exceptionSeen;
+
+    DefaultProfilingInfo(TriState exceptionSeen) {
+        this.exceptionSeen = exceptionSeen;
+    }
+
+    @Override
+    public int getCodeSize() {
+        return 0;
+    }
+
+    @Override
+    public JavaTypeProfile getTypeProfile(int bci) {
+        return null;
+    }
+
+    @Override
+    public JavaMethodProfile getMethodProfile(int bci) {
+        return null;
+    }
+
+    @Override
+    public double getBranchTakenProbability(int bci) {
+        return -1;
+    }
+
+    @Override
+    public double[] getSwitchProbabilities(int bci) {
+        return null;
+    }
+
+    @Override
+    public TriState getExceptionSeen(int bci) {
+        return exceptionSeen;
+    }
+
+    @Override
+    public TriState getNullSeen(int bci) {
+        return TriState.UNKNOWN;
+    }
+
+    @Override
+    public int getExecutionCount(int bci) {
+        return -1;
+    }
+
+    public static ProfilingInfo get(TriState exceptionSeen) {
+        return NO_PROFILING_INFO[exceptionSeen.ordinal()];
+    }
+
+    @Override
+    public int getDeoptimizationCount(DeoptimizationReason reason) {
+        return 0;
+    }
+
+    @Override
+    public boolean isMature() {
+        return false;
+    }
+
+    @Override
+    public String toString() {
+        return "BaseProfilingInfo<" + this.toString(null, "; ") + ">";
+    }
+
+    public void setMature() {
+        // Do nothing
+    }
+
+    public boolean setCompilerIRSize(Class<?> irType, int nodeCount) {
+        return false;
+    }
+
+    public int getCompilerIRSize(Class<?> irType) {
+        return -1;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/DeoptimizationAction.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,70 @@
+/*
+ * 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.jvmci.meta;
+
+/**
+ * Specifies the action that should be taken by the runtime in case a certain deoptimization is
+ * triggered.
+ */
+public enum DeoptimizationAction {
+    /**
+     * Do not invalidate the machine code. This is typically used when deoptimizing at a point where
+     * it's highly likely nothing will change the likelihood of the deoptimization happening again.
+     * For example, a compiled array allocation where the size is negative.
+     */
+    None(false),
+
+    /**
+     * Do not invalidate the machine code, but schedule a recompilation if this deoptimization is
+     * triggered too often.
+     */
+    RecompileIfTooManyDeopts(true),
+
+    /**
+     * Invalidate the machine code and reset the profiling information.
+     */
+    InvalidateReprofile(true),
+
+    /**
+     * Invalidate the machine code and immediately schedule a recompilation. This is typically used
+     * when deoptimizing to resolve an unresolved symbol in which case extra profiling is not
+     * required to determine that the deoptimization will not re-occur.
+     */
+    InvalidateRecompile(true),
+
+    /**
+     * Invalidate the machine code and stop compiling the outermost method of this compilation.
+     */
+    InvalidateStopCompiling(true);
+
+    private final boolean invalidatesCompilation;
+
+    private DeoptimizationAction(boolean invalidatesCompilation) {
+        this.invalidatesCompilation = invalidatesCompilation;
+    }
+
+    public boolean doesInvalidateCompilation() {
+        return invalidatesCompilation;
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/DeoptimizationReason.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,45 @@
+/*
+ * 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.jvmci.meta;
+
+/**
+ * Enumeration of reasons for why a deoptimization is happening.
+ */
+public enum DeoptimizationReason {
+    None,
+    NullCheckException,
+    BoundsCheckException,
+    ClassCastException,
+    ArrayStoreException,
+    UnreachedCode,
+    TypeCheckedInliningViolated,
+    OptimizedTypeCheckViolated,
+    NotCompiledExceptionHandler,
+    Unresolved,
+    JavaSubroutineMismatch,
+    ArithmeticException,
+    RuntimeConstraint,
+    LoopLimitCheck,
+    Aliasing,
+    TransferToInterpreter,
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/ExceptionHandler.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,121 @@
+/*
+ * 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.jvmci.meta;
+
+import java.util.*;
+
+/**
+ * Represents an exception handler within the bytecodes.
+ */
+public final class ExceptionHandler {
+
+    private final int startBCI;
+    private final int endBCI;
+    private final int handlerBCI;
+    private final int catchTypeCPI;
+    private final JavaType 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 ExceptionHandler(int startBCI, int endBCI, int catchBCI, int catchTypeCPI, JavaType catchType) {
+        this.startBCI = startBCI;
+        this.endBCI = endBCI;
+        this.handlerBCI = catchBCI;
+        this.catchTypeCPI = catchTypeCPI;
+        this.catchType = catchType;
+    }
+
+    /**
+     * Returns the start bytecode index of the protected range of this handler.
+     */
+    public int getStartBCI() {
+        return startBCI;
+    }
+
+    /**
+     * Returns the end bytecode index of the protected range of this handler.
+     */
+    public int getEndBCI() {
+        return endBCI;
+    }
+
+    /**
+     * Returns the bytecode index of the handler block of this handler.
+     */
+    public int getHandlerBCI() {
+        return handlerBCI;
+    }
+
+    /**
+     * Returns the index into the constant pool representing the type of exception caught by this
+     * handler.
+     */
+    public int catchTypeCPI() {
+        return catchTypeCPI;
+    }
+
+    /**
+     * Checks whether this handler catches all exceptions.
+     *
+     * @return {@code true} if this handler catches all exceptions
+     */
+    public boolean isCatchAll() {
+        return catchTypeCPI == 0;
+    }
+
+    /**
+     * Returns the type of exception caught by this exception handler.
+     */
+    public JavaType getCatchType() {
+        return catchType;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (!(obj instanceof ExceptionHandler)) {
+            return false;
+        }
+        ExceptionHandler that = (ExceptionHandler) obj;
+        if (this.startBCI != that.startBCI || this.endBCI != that.endBCI || this.handlerBCI != that.handlerBCI || this.catchTypeCPI != that.catchTypeCPI) {
+            return false;
+        }
+        return Objects.equals(this.catchType, that.catchType);
+    }
+
+    @Override
+    public String toString() {
+        return "ExceptionHandler<startBCI=" + startBCI + ", endBCI=" + endBCI + ", handlerBCI=" + handlerBCI + ", catchTypeCPI=" + catchTypeCPI + ", catchType=" + catchType + ">";
+    }
+
+    @Override
+    public int hashCode() {
+        return catchTypeCPI ^ endBCI ^ handlerBCI;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/ExcludeFromIdentityComparisonVerification.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.meta;
+
+import java.lang.annotation.*;
+
+/**
+ * This annotation denotes methods which are allowed to use identity checks (==/!=) on restricted
+ * types.
+ *
+ * @see CheckGraalInvariants
+ */
+@SuppressWarnings("javadoc")
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.METHOD)
+public @interface ExcludeFromIdentityComparisonVerification {
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/ForeignCallDescriptor.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.meta;
+
+import java.util.*;
+
+/**
+ * The name and signature of a foreign call. A foreign call differs from a normal compiled Java call
+ * in at least one of these aspects:
+ * <ul>
+ * <li>The call is to C/C++/assembler code.</li>
+ * <li>The call uses different conventions for passing parameters or returning values.</li>
+ * <li>The callee has different register saving semantics. For example, the callee may save all
+ * registers (apart from some specified temporaries) in which case the register allocator doesn't
+ * not need to spill all live registers around the call site.</li>
+ * <li>The call does not occur at an INVOKE* bytecode. Such a call could be transformed into a
+ * standard Java call if the foreign routine is a normal Java method and the runtime supports
+ * linking Java calls at arbitrary bytecodes.</li>
+ * </ul>
+ */
+public class ForeignCallDescriptor {
+
+    private final String name;
+    private final Class<?> resultType;
+    private final Class<?>[] argumentTypes;
+
+    public ForeignCallDescriptor(String name, Class<?> resultType, Class<?>... argumentTypes) {
+        this.name = name;
+        this.resultType = resultType;
+        this.argumentTypes = argumentTypes;
+    }
+
+    /**
+     * Gets the name of this foreign call.
+     */
+    public String getName() {
+        return name;
+    }
+
+    /**
+     * Gets the return type of this foreign call.
+     */
+    public Class<?> getResultType() {
+        return resultType;
+    }
+
+    /**
+     * Gets the argument types of this foreign call.
+     */
+    public Class<?>[] getArgumentTypes() {
+        return argumentTypes.clone();
+    }
+
+    @Override
+    public int hashCode() {
+        return name.hashCode();
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (obj instanceof ForeignCallDescriptor) {
+            ForeignCallDescriptor other = (ForeignCallDescriptor) obj;
+            return other.name.equals(name) && other.resultType.equals(resultType) && Arrays.equals(other.argumentTypes, argumentTypes);
+        }
+        return false;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder(name).append('(');
+        String sep = "";
+        for (Class<?> arg : argumentTypes) {
+            sb.append(sep).append(arg.getSimpleName());
+            sep = ",";
+        }
+        return sb.append(')').append(resultType.getSimpleName()).toString();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/InvokeTarget.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2013, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.meta;
+
+/**
+ * Represents the resolved target of an invocation.
+ */
+public interface InvokeTarget {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/JavaConstant.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,458 @@
+/*
+ * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.meta;
+
+/**
+ * Represents a constant (boxed) value, such as an integer, floating point number, or object
+ * reference, within the compiler and across the compiler/runtime interface. Exports a set of
+ * {@code JavaConstant} instances that represent frequently used constant values, such as
+ * {@link #NULL_POINTER}.
+ */
+public interface JavaConstant extends Constant, JavaValue, Value {
+
+    /*
+     * Using a larger cache for integers leads to only a slight increase in cache hit ratio which is
+     * not enough to justify the impact on startup time.
+     */
+    JavaConstant NULL_POINTER = new NullConstant();
+    PrimitiveConstant INT_MINUS_1 = new PrimitiveConstant(Kind.Int, -1);
+    PrimitiveConstant INT_0 = new PrimitiveConstant(Kind.Int, 0);
+    PrimitiveConstant INT_1 = new PrimitiveConstant(Kind.Int, 1);
+    PrimitiveConstant INT_2 = new PrimitiveConstant(Kind.Int, 2);
+    PrimitiveConstant LONG_0 = new PrimitiveConstant(Kind.Long, 0L);
+    PrimitiveConstant LONG_1 = new PrimitiveConstant(Kind.Long, 1L);
+    PrimitiveConstant FLOAT_0 = new PrimitiveConstant(Kind.Float, Float.floatToRawIntBits(0.0F));
+    PrimitiveConstant FLOAT_1 = new PrimitiveConstant(Kind.Float, Float.floatToRawIntBits(1.0F));
+    PrimitiveConstant DOUBLE_0 = new PrimitiveConstant(Kind.Double, Double.doubleToRawLongBits(0.0D));
+    PrimitiveConstant DOUBLE_1 = new PrimitiveConstant(Kind.Double, Double.doubleToRawLongBits(1.0D));
+    PrimitiveConstant TRUE = new PrimitiveConstant(Kind.Boolean, 1L);
+    PrimitiveConstant FALSE = new PrimitiveConstant(Kind.Boolean, 0L);
+
+    /**
+     * Checks whether this constant is null.
+     *
+     * @return {@code true} if this constant is the null constant
+     */
+    boolean isNull();
+
+    static boolean isNull(Constant c) {
+        if (c instanceof JavaConstant) {
+            return ((JavaConstant) c).isNull();
+        } else {
+            return false;
+        }
+    }
+
+    /**
+     * Checks whether this constant is non-null.
+     *
+     * @return {@code true} if this constant is a primitive, or an object constant that is not null
+     */
+    default boolean isNonNull() {
+        return !isNull();
+    }
+
+    /**
+     * Checks whether this constant is the default value for its kind (null, 0, 0.0, false).
+     *
+     * @return {@code true} if this constant is the default value for its kind
+     */
+    boolean isDefaultForKind();
+
+    /**
+     * Returns the value of this constant as a boxed Java value.
+     *
+     * @return the value of this constant
+     */
+    Object asBoxedPrimitive();
+
+    /**
+     * Returns the primitive int value this constant represents. The constant must have a
+     * {@link Kind#getStackKind()} of {@link Kind#Int}.
+     *
+     * @return the constant value
+     */
+    int asInt();
+
+    /**
+     * Returns the primitive boolean value this constant represents. The constant must have kind
+     * {@link Kind#Boolean}.
+     *
+     * @return the constant value
+     */
+    boolean asBoolean();
+
+    /**
+     * Returns the primitive long value this constant represents. The constant must have kind
+     * {@link Kind#Long}, a {@link Kind#getStackKind()} of {@link Kind#Int}.
+     *
+     * @return the constant value
+     */
+    long asLong();
+
+    /**
+     * Returns the primitive float value this constant represents. The constant must have kind
+     * {@link Kind#Float}.
+     *
+     * @return the constant value
+     */
+    float asFloat();
+
+    /**
+     * Returns the primitive double value this constant represents. The constant must have kind
+     * {@link Kind#Double}.
+     *
+     * @return the constant value
+     */
+    double asDouble();
+
+    default String toValueString() {
+        if (getKind() == Kind.Illegal) {
+            return "illegal";
+        } else {
+            return getKind().format(asBoxedPrimitive());
+        }
+    }
+
+    static String toString(JavaConstant constant) {
+        if (constant.getKind() == Kind.Illegal) {
+            return "illegal";
+        } else {
+            return constant.getKind().getJavaName() + "[" + constant.toValueString() + "]";
+        }
+    }
+
+    /**
+     * Creates a boxed double constant.
+     *
+     * @param d the double value to box
+     * @return a boxed copy of {@code value}
+     */
+    static PrimitiveConstant forDouble(double d) {
+        if (Double.compare(0.0D, d) == 0) {
+            return DOUBLE_0;
+        }
+        if (Double.compare(d, 1.0D) == 0) {
+            return DOUBLE_1;
+        }
+        return new PrimitiveConstant(Kind.Double, Double.doubleToRawLongBits(d));
+    }
+
+    /**
+     * Creates a boxed float constant.
+     *
+     * @param f the float value to box
+     * @return a boxed copy of {@code value}
+     */
+    static PrimitiveConstant forFloat(float f) {
+        if (Float.compare(f, 0.0F) == 0) {
+            return FLOAT_0;
+        }
+        if (Float.compare(f, 1.0F) == 0) {
+            return FLOAT_1;
+        }
+        return new PrimitiveConstant(Kind.Float, Float.floatToRawIntBits(f));
+    }
+
+    /**
+     * Creates a boxed long constant.
+     *
+     * @param i the long value to box
+     * @return a boxed copy of {@code value}
+     */
+    static PrimitiveConstant forLong(long i) {
+        if (i == 0) {
+            return LONG_0;
+        } else if (i == 1) {
+            return LONG_1;
+        } else {
+            return new PrimitiveConstant(Kind.Long, i);
+        }
+    }
+
+    /**
+     * Creates a boxed integer constant.
+     *
+     * @param i the integer value to box
+     * @return a boxed copy of {@code value}
+     */
+    static PrimitiveConstant forInt(int i) {
+        switch (i) {
+            case -1:
+                return INT_MINUS_1;
+            case 0:
+                return INT_0;
+            case 1:
+                return INT_1;
+            case 2:
+                return INT_2;
+            default:
+                return new PrimitiveConstant(Kind.Int, i);
+        }
+    }
+
+    /**
+     * Creates a boxed byte constant.
+     *
+     * @param i the byte value to box
+     * @return a boxed copy of {@code value}
+     */
+    static PrimitiveConstant forByte(byte i) {
+        return new PrimitiveConstant(Kind.Byte, i);
+    }
+
+    /**
+     * Creates a boxed boolean constant.
+     *
+     * @param i the boolean value to box
+     * @return a boxed copy of {@code value}
+     */
+    static PrimitiveConstant forBoolean(boolean i) {
+        return i ? TRUE : FALSE;
+    }
+
+    /**
+     * Creates a boxed char constant.
+     *
+     * @param i the char value to box
+     * @return a boxed copy of {@code value}
+     */
+    static PrimitiveConstant forChar(char i) {
+        return new PrimitiveConstant(Kind.Char, i);
+    }
+
+    /**
+     * Creates a boxed short constant.
+     *
+     * @param i the short value to box
+     * @return a boxed copy of {@code value}
+     */
+    static PrimitiveConstant forShort(short i) {
+        return new PrimitiveConstant(Kind.Short, i);
+    }
+
+    /**
+     * Creates a {@link JavaConstant} from a primitive integer of a certain kind.
+     */
+    static PrimitiveConstant forIntegerKind(Kind kind, long i) {
+        switch (kind) {
+            case Boolean:
+                return forBoolean(i != 0);
+            case Byte:
+                return forByte((byte) i);
+            case Short:
+                return forShort((short) i);
+            case Char:
+                return forChar((char) i);
+            case Int:
+                return forInt((int) i);
+            case Long:
+                return forLong(i);
+            default:
+                throw new IllegalArgumentException("not an integer kind: " + kind);
+        }
+    }
+
+    /**
+     * Creates a {@link JavaConstant} from a primitive integer of a certain width.
+     */
+    static PrimitiveConstant forPrimitiveInt(int bits, long i) {
+        assert bits <= 64;
+        switch (bits) {
+            case 1:
+                return forBoolean(i != 0);
+            case 8:
+                return forByte((byte) i);
+            case 16:
+                return forShort((short) i);
+            case 32:
+                return forInt((int) i);
+            case 64:
+                return forLong(i);
+            default:
+                throw new IllegalArgumentException("unsupported integer width: " + bits);
+        }
+    }
+
+    /**
+     * Creates a boxed constant for the given boxed primitive value.
+     *
+     * @param value the Java boxed value
+     * @return the primitive constant holding the {@code value}
+     */
+    static PrimitiveConstant forBoxedPrimitive(Object value) {
+        if (value instanceof Boolean) {
+            return forBoolean((Boolean) value);
+        } else if (value instanceof Byte) {
+            return forByte((Byte) value);
+        } else if (value instanceof Character) {
+            return forChar((Character) value);
+        } else if (value instanceof Short) {
+            return forShort((Short) value);
+        } else if (value instanceof Integer) {
+            return forInt((Integer) value);
+        } else if (value instanceof Long) {
+            return forLong((Long) value);
+        } else if (value instanceof Float) {
+            return forFloat((Float) value);
+        } else if (value instanceof Double) {
+            return forDouble((Double) value);
+        } else {
+            return null;
+        }
+    }
+
+    static PrimitiveConstant forIllegal() {
+        return new PrimitiveConstant(Kind.Illegal, 0);
+    }
+
+    /**
+     * Returns a constant with the default value for the given kind.
+     */
+    static JavaConstant defaultForKind(Kind kind) {
+        switch (kind) {
+            case Boolean:
+                return FALSE;
+            case Byte:
+                return forByte((byte) 0);
+            case Char:
+                return forChar((char) 0);
+            case Short:
+                return forShort((short) 0);
+            case Int:
+                return INT_0;
+            case Double:
+                return DOUBLE_0;
+            case Float:
+                return FLOAT_0;
+            case Long:
+                return LONG_0;
+            case Object:
+                return NULL_POINTER;
+            default:
+                throw new IllegalArgumentException(kind.toString());
+        }
+    }
+
+    /**
+     * Returns the zero value for a given numeric kind.
+     */
+    static JavaConstant zero(Kind kind) {
+        switch (kind) {
+            case Boolean:
+                return FALSE;
+            case Byte:
+                return forByte((byte) 0);
+            case Char:
+                return forChar((char) 0);
+            case Double:
+                return DOUBLE_0;
+            case Float:
+                return FLOAT_0;
+            case Int:
+                return INT_0;
+            case Long:
+                return LONG_0;
+            case Short:
+                return forShort((short) 0);
+            default:
+                throw new IllegalArgumentException(kind.toString());
+        }
+    }
+
+    /**
+     * Returns the one value for a given numeric kind.
+     */
+    static JavaConstant one(Kind kind) {
+        switch (kind) {
+            case Boolean:
+                return TRUE;
+            case Byte:
+                return forByte((byte) 1);
+            case Char:
+                return forChar((char) 1);
+            case Double:
+                return DOUBLE_1;
+            case Float:
+                return FLOAT_1;
+            case Int:
+                return INT_1;
+            case Long:
+                return LONG_1;
+            case Short:
+                return forShort((short) 1);
+            default:
+                throw new IllegalArgumentException(kind.toString());
+        }
+    }
+
+    /**
+     * Adds two numeric constants.
+     */
+    static JavaConstant add(JavaConstant x, JavaConstant y) {
+        assert x.getKind() == y.getKind();
+        switch (x.getKind()) {
+            case Byte:
+                return forByte((byte) (x.asInt() + y.asInt()));
+            case Char:
+                return forChar((char) (x.asInt() + y.asInt()));
+            case Double:
+                return forDouble(x.asDouble() + y.asDouble());
+            case Float:
+                return forFloat(x.asFloat() + y.asFloat());
+            case Int:
+                return forInt(x.asInt() + y.asInt());
+            case Long:
+                return forLong(x.asLong() + y.asLong());
+            case Short:
+                return forShort((short) (x.asInt() + y.asInt()));
+            default:
+                throw new IllegalArgumentException(x.getKind().toString());
+        }
+    }
+
+    /**
+     * Multiplies two numeric constants.
+     */
+    static PrimitiveConstant mul(JavaConstant x, JavaConstant y) {
+        assert x.getKind() == y.getKind();
+        switch (x.getKind()) {
+            case Byte:
+                return forByte((byte) (x.asInt() * y.asInt()));
+            case Char:
+                return forChar((char) (x.asInt() * y.asInt()));
+            case Double:
+                return forDouble(x.asDouble() * y.asDouble());
+            case Float:
+                return forFloat(x.asFloat() * y.asFloat());
+            case Int:
+                return forInt(x.asInt() * y.asInt());
+            case Long:
+                return forLong(x.asLong() * y.asLong());
+            case Short:
+                return forShort((short) (x.asInt() * y.asInt()));
+            default:
+                throw new IllegalArgumentException(x.getKind().toString());
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/JavaField.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,129 @@
+/*
+ * 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.jvmci.meta;
+
+import java.util.*;
+
+/**
+ * Represents a reference to a Java field, either resolved or unresolved fields. Fields, like
+ * methods and types, are resolved through {@link ConstantPool constant pools}.
+ */
+public interface JavaField extends TrustedInterface {
+
+    /**
+     * Returns the name of this field.
+     */
+    String getName();
+
+    /**
+     * Returns a {@link JavaType} object that identifies the declared type for this field.
+     */
+    JavaType getType();
+
+    /**
+     * Returns the kind of this field. This is the same as calling {@link #getType}.
+     * {@link JavaType#getKind getKind}.
+     */
+    default Kind getKind() {
+        return getType().getKind();
+    }
+
+    /**
+     * Returns the {@link JavaType} object representing the class or interface that declares this
+     * field.
+     */
+    JavaType getDeclaringClass();
+
+    /**
+     * Gets a string for this 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 this 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
+     * @return the result of formatting this field according to {@code format}
+     * @throws IllegalFormatException if an illegal specifier is encountered in {@code format}
+     */
+    default String format(String format) throws IllegalFormatException {
+        StringBuilder sb = new StringBuilder();
+        int index = 0;
+        JavaType type = getType();
+        while (index < format.length()) {
+            char ch = format.charAt(index++);
+            if (ch == '%') {
+                if (index >= format.length()) {
+                    throw new UnknownFormatConversionException("An unquoted '%' character cannot terminate a field format specification");
+                }
+                char specifier = format.charAt(index++);
+                boolean qualified = false;
+                switch (specifier) {
+                    case 'T':
+                        qualified = true;
+                        // fall through
+                    case 't': {
+                        sb.append(type.toJavaName(qualified));
+                        break;
+                    }
+                    case 'H':
+                        qualified = true;
+                        // fall through
+                    case 'h': {
+                        sb.append(getDeclaringClass().toJavaName(qualified));
+                        break;
+                    }
+                    case 'n': {
+                        sb.append(getName());
+                        break;
+                    }
+                    case 'f': {
+                        sb.append(!(this instanceof ResolvedJavaField) ? "unresolved" : ((ResolvedJavaField) this).isStatic() ? "static" : "instance");
+                        break;
+                    }
+                    case '%': {
+                        sb.append('%');
+                        break;
+                    }
+                    default: {
+                        throw new UnknownFormatConversionException(String.valueOf(specifier));
+                    }
+                }
+            } else {
+                sb.append(ch);
+            }
+        }
+        return sb.toString();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/JavaMethod.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,141 @@
+/*
+ * 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.jvmci.meta;
+
+import java.util.*;
+
+/**
+ * Represents a reference to a Java method, either resolved or unresolved. Methods, like fields and
+ * types, are resolved through {@link ConstantPool constant pools}.
+ */
+public interface JavaMethod extends TrustedInterface {
+
+    /**
+     * Returns the name of this method.
+     */
+    String getName();
+
+    /**
+     * Returns the {@link JavaType} object representing the class or interface that declares this
+     * method.
+     */
+    JavaType getDeclaringClass();
+
+    /**
+     * Returns the signature of this method.
+     */
+    Signature getSignature();
+
+    /**
+     * Gets a string for this 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 this 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
+     * @return the result of formatting this method according to {@code format}
+     * @throws IllegalFormatException if an illegal specifier is encountered in {@code format}
+     */
+    default String format(String format) throws IllegalFormatException {
+        StringBuilder sb = new StringBuilder();
+        int index = 0;
+        Signature sig = null;
+        while (index < format.length()) {
+            char ch = format.charAt(index++);
+            if (ch == '%') {
+                if (index >= format.length()) {
+                    throw new UnknownFormatConversionException("An unquoted '%' character cannot terminate a method format specification");
+                }
+                char specifier = format.charAt(index++);
+                boolean qualified = false;
+                switch (specifier) {
+                    case 'R':
+                        qualified = true;
+                        // fall through
+                    case 'r': {
+                        if (sig == null) {
+                            sig = getSignature();
+                        }
+                        sb.append(sig.getReturnType(null).toJavaName(qualified));
+                        break;
+                    }
+                    case 'H':
+                        qualified = true;
+                        // fall through
+                    case 'h': {
+                        sb.append(getDeclaringClass().toJavaName(qualified));
+                        break;
+                    }
+                    case 'n': {
+                        sb.append(getName());
+                        break;
+                    }
+                    case 'P':
+                        qualified = true;
+                        // fall through
+                    case 'p': {
+                        if (sig == null) {
+                            sig = getSignature();
+                        }
+                        for (int i = 0; i < sig.getParameterCount(false); i++) {
+                            if (i != 0) {
+                                sb.append(", ");
+                            }
+                            sb.append(sig.getParameterType(i, null).toJavaName(qualified));
+                        }
+                        break;
+                    }
+                    case 'f': {
+                        sb.append(!(this instanceof ResolvedJavaMethod) ? "unresolved" : ((ResolvedJavaMethod) this).isStatic() ? "static" : "virtual");
+                        break;
+                    }
+                    case '%': {
+                        sb.append('%');
+                        break;
+                    }
+                    default: {
+                        throw new UnknownFormatConversionException(String.valueOf(specifier));
+                    }
+                }
+            } else {
+                sb.append(ch);
+            }
+        }
+        return sb.toString();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/JavaMethodProfile.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.meta;
+
+import com.oracle.jvmci.meta.JavaMethodProfile.ProfiledMethod;
+
+/**
+ * This profile object represents the method profile at a specific BCI. The precision of the
+ * supplied values may vary, but a runtime that provides this information should be aware that it
+ * will be used to guide performance-critical decisions like speculative inlining, etc.
+ */
+public final class JavaMethodProfile extends AbstractJavaProfile<ProfiledMethod, ResolvedJavaMethod> {
+
+    public JavaMethodProfile(double notRecordedProbability, ProfiledMethod[] pitems) {
+        super(notRecordedProbability, pitems);
+    }
+
+    public ProfiledMethod[] getMethods() {
+        return super.getItems();
+    }
+
+    public static class ProfiledMethod extends AbstractProfiledItem<ResolvedJavaMethod> {
+
+        public ProfiledMethod(ResolvedJavaMethod method, double probability) {
+            super(method, probability);
+        }
+
+        /**
+         * Returns the type for this profile entry.
+         */
+        public ResolvedJavaMethod getMethod() {
+            return getItem();
+        }
+
+        @Override
+        public String toString() {
+            return "{" + item.getName() + ", " + probability + "}";
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/JavaType.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,153 @@
+/*
+ * 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.jvmci.meta;
+
+import static com.oracle.jvmci.meta.MetaUtil.*;
+
+/**
+ * Represents a resolved or unresolved type. Types include primitives, objects, {@code void}, and
+ * arrays thereof.
+ */
+public interface JavaType extends TrustedInterface {
+
+    /**
+     * Returns the name of this type in internal form. The following are examples of strings
+     * returned by this method:
+     *
+     * <pre>
+     *     "Ljava/lang/Object;"
+     *     "I"
+     *     "[[B"
+     * </pre>
+     */
+    String getName();
+
+    /**
+     * Returns an unqualified name of this type.
+     *
+     * <pre>
+     *     "Object"
+     *     "Integer"
+     * </pre>
+     */
+    default String getUnqualifiedName() {
+        String name = getName();
+        if (name.indexOf('/') != -1) {
+            name = name.substring(name.lastIndexOf('/') + 1);
+        }
+        if (name.endsWith(";")) {
+            name = name.substring(0, name.length() - 1);
+        }
+        return name;
+    }
+
+    /**
+     * For array types, gets the type of the components, or {@code null} if this is not an array
+     * type. This method is analogous to {@link Class#getComponentType()}.
+     */
+    JavaType getComponentType();
+
+    /**
+     * Gets the elemental type for this given type. The elemental type is the corresponding zero
+     * dimensional type of an array type. For example, the elemental type of {@code int[][][]} is
+     * {@code int}. A non-array type is its own elemental type.
+     */
+    default JavaType getElementalType() {
+        JavaType t = this;
+        while (t.getComponentType() != null) {
+            t = t.getComponentType();
+        }
+        return t;
+    }
+
+    /**
+     * Gets the array class type representing an array with elements of this type.
+     */
+    JavaType getArrayClass();
+
+    /**
+     * Gets the kind of this type.
+     */
+    Kind getKind();
+
+    /**
+     * Resolves this type to a {@link ResolvedJavaType}.
+     *
+     * @param accessingClass the context of resolution (must not be null)
+     * @return the resolved Java type
+     * @throws LinkageError if the resolution failed
+     * @throws NullPointerException if {@code accessingClass} is {@code null}
+     */
+    ResolvedJavaType resolve(ResolvedJavaType accessingClass);
+
+    /**
+     * Gets the Java programming language name for this type. The following are examples of strings
+     * returned by this method:
+     *
+     * <pre>
+     *      java.lang.Object
+     *      int
+     *      boolean[][]
+     * </pre>
+     *
+     * @return the Java name corresponding to this type
+     */
+    default String toJavaName() {
+        return internalNameToJava(getName(), true, false);
+    }
+
+    /**
+     * Gets the Java programming language name for this type. The following are examples of strings
+     * returned by this method:
+     *
+     * <pre>
+     *     qualified == true:
+     *         java.lang.Object
+     *         int
+     *         boolean[][]
+     *     qualified == false:
+     *         Object
+     *         int
+     *         boolean[][]
+     * </pre>
+     *
+     * @param qualified specifies if the package prefix of this type should be included in the
+     *            returned name
+     * @return the Java name corresponding to this type
+     */
+    default String toJavaName(boolean qualified) {
+        Kind kind = getKind();
+        if (kind == Kind.Object) {
+            return internalNameToJava(getName(), qualified, false);
+        }
+        return getKind().getJavaName();
+    }
+
+    /**
+     * Returns this type's name in the same format as {@link Class#getName()}.
+     */
+    default String toClassName() {
+        return internalNameToJava(getName(), true, true);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/JavaTypeProfile.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,195 @@
+/*
+ * 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.jvmci.meta;
+
+import java.util.*;
+
+import com.oracle.jvmci.meta.JavaTypeProfile.ProfiledType;
+
+/**
+ * This profile object represents the type profile at a specific BCI. The precision of the supplied
+ * values may vary, but a runtime that provides this information should be aware that it will be
+ * used to guide performance-critical decisions like speculative inlining, etc.
+ */
+public final class JavaTypeProfile extends AbstractJavaProfile<ProfiledType, ResolvedJavaType> {
+
+    private static final ProfiledType[] EMPTY_ARRAY = new ProfiledType[0];
+
+    private final TriState nullSeen;
+
+    public JavaTypeProfile(TriState nullSeen, double notRecordedProbability, ProfiledType[] pitems) {
+        super(notRecordedProbability, pitems);
+        this.nullSeen = nullSeen;
+    }
+
+    /**
+     * Returns whether a null value was at the type check.
+     */
+    public TriState getNullSeen() {
+        return nullSeen;
+    }
+
+    /**
+     * A list of types for which the runtime has recorded probability information. Note that this
+     * includes both positive and negative types where a positive type is a subtype of the checked
+     * type and a negative type is not.
+     */
+    public ProfiledType[] getTypes() {
+        return getItems();
+    }
+
+    public JavaTypeProfile restrict(JavaTypeProfile otherProfile) {
+        if (otherProfile.getNotRecordedProbability() > 0.0) {
+            // Not useful for restricting since there is an unknown set of types occurring.
+            return this;
+        }
+
+        if (this.getNotRecordedProbability() > 0.0) {
+            // We are unrestricted, so the other profile is always a better estimate.
+            return otherProfile;
+        }
+
+        ArrayList<ProfiledType> result = new ArrayList<>();
+        for (int i = 0; i < getItems().length; i++) {
+            ProfiledType ptype = getItems()[i];
+            ResolvedJavaType type = ptype.getItem();
+            if (otherProfile.isIncluded(type)) {
+                result.add(ptype);
+            }
+        }
+
+        TriState newNullSeen = (otherProfile.getNullSeen() == TriState.FALSE) ? TriState.FALSE : getNullSeen();
+        double newNotRecorded = getNotRecordedProbability();
+        return createAdjustedProfile(result, newNullSeen, newNotRecorded);
+    }
+
+    public JavaTypeProfile restrict(ResolvedJavaType declaredType, boolean nonNull) {
+        ArrayList<ProfiledType> result = new ArrayList<>();
+        for (int i = 0; i < getItems().length; i++) {
+            ProfiledType ptype = getItems()[i];
+            ResolvedJavaType type = ptype.getItem();
+            if (declaredType.isAssignableFrom(type)) {
+                result.add(ptype);
+            }
+        }
+
+        TriState newNullSeen = (nonNull) ? TriState.FALSE : getNullSeen();
+        double newNotRecorded = this.getNotRecordedProbability();
+        // Assume for the types not recorded, the incompatibility rate is the same.
+        if (getItems().length != 0) {
+            newNotRecorded *= ((double) result.size() / (double) getItems().length);
+        }
+        return createAdjustedProfile(result, newNullSeen, newNotRecorded);
+    }
+
+    private JavaTypeProfile createAdjustedProfile(ArrayList<ProfiledType> result, TriState newNullSeen, double newNotRecorded) {
+        if (result.size() != this.getItems().length || newNotRecorded != getNotRecordedProbability() || newNullSeen != getNullSeen()) {
+            if (result.size() == 0) {
+                return new JavaTypeProfile(newNullSeen, 1.0, EMPTY_ARRAY);
+            }
+            double factor;
+            if (result.size() == this.getItems().length) {
+                /* List of types did not change, no need to recompute probabilities. */
+                factor = 1.0;
+            } else {
+                double probabilitySum = 0.0;
+                for (int i = 0; i < result.size(); i++) {
+                    probabilitySum += result.get(i).getProbability();
+                }
+                probabilitySum += newNotRecorded;
+
+                factor = 1.0 / probabilitySum; // Normalize to 1.0
+                assert factor >= 1.0;
+            }
+            ProfiledType[] newResult = new ProfiledType[result.size()];
+            for (int i = 0; i < newResult.length; ++i) {
+                ProfiledType curType = result.get(i);
+                newResult[i] = new ProfiledType(curType.getItem(), Math.min(1.0, curType.getProbability() * factor));
+            }
+            double newNotRecordedTypeProbability = Math.min(1.0, newNotRecorded * factor);
+            return new JavaTypeProfile(newNullSeen, newNotRecordedTypeProbability, newResult);
+        }
+        return this;
+    }
+
+    @Override
+    public boolean equals(Object other) {
+        return super.equals(other) && nullSeen.equals(((JavaTypeProfile) other).nullSeen);
+    }
+
+    @Override
+    public int hashCode() {
+        return nullSeen.hashCode() + super.hashCode();
+    }
+
+    public static class ProfiledType extends AbstractProfiledItem<ResolvedJavaType> {
+
+        public ProfiledType(ResolvedJavaType type, double probability) {
+            super(type, probability);
+            assert type.isArray() || type.isConcrete() : type;
+        }
+
+        /**
+         * Returns the type for this profile entry.
+         */
+        public ResolvedJavaType getType() {
+            return getItem();
+        }
+
+        @Override
+        public String toString() {
+            return String.format("%.6f#%s", probability, item);
+        }
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder buf = new StringBuilder("JavaTypeProfile<nullSeen=").append(getNullSeen()).append(", types=[");
+        for (int j = 0; j < getTypes().length; j++) {
+            if (j != 0) {
+                buf.append(", ");
+            }
+            ProfiledType ptype = getTypes()[j];
+            buf.append(String.format("%.6f:%s", ptype.getProbability(), ptype.getType()));
+        }
+        return buf.append(String.format("], notRecorded:%.6f>", getNotRecordedProbability())).toString();
+    }
+
+    /**
+     * Returns {@code true} if all types seen at this location have been recorded in the profile.
+     */
+    public boolean allTypesRecorded() {
+        return this.getNotRecordedProbability() == 0.0;
+    }
+
+    /**
+     * Returns the single monormorphic type representing this profile or {@code null} if no such
+     * type exists.
+     */
+    public ResolvedJavaType asSingleType() {
+        if (allTypesRecorded() && this.getTypes().length == 1) {
+            return getTypes()[0].getType();
+        }
+        return null;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/JavaValue.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.meta;
+
+/**
+ * Interface for things that represent a Java value.
+ */
+public interface JavaValue {
+
+    /**
+     * Returns the kind of this value.
+     */
+    Kind getKind();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/Kind.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,486 @@
+/*
+ * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.meta;
+
+import java.lang.reflect.*;
+
+//JaCoCo Exclude
+
+/**
+ * Denotes the basic kinds of types in CRI, including the all the Java primitive types, for example,
+ * {@link Kind#Int} for {@code int} and {@link Kind#Object} for all object types. A kind has a
+ * single character short name, a Java name, and a set of flags further describing its behavior.
+ */
+public enum Kind implements PlatformKind {
+    /** The primitive boolean kind, represented as an int on the stack. */
+    Boolean('z', "boolean", 1, true, java.lang.Boolean.TYPE, java.lang.Boolean.class),
+
+    /** The primitive byte kind, represented as an int on the stack. */
+    Byte('b', "byte", 1, true, java.lang.Byte.TYPE, java.lang.Byte.class),
+
+    /** The primitive short kind, represented as an int on the stack. */
+    Short('s', "short", 1, true, java.lang.Short.TYPE, java.lang.Short.class),
+
+    /** The primitive char kind, represented as an int on the stack. */
+    Char('c', "char", 1, true, java.lang.Character.TYPE, java.lang.Character.class),
+
+    /** The primitive int kind, represented as an int on the stack. */
+    Int('i', "int", 1, true, java.lang.Integer.TYPE, java.lang.Integer.class),
+
+    /** The primitive float kind. */
+    Float('f', "float", 1, false, java.lang.Float.TYPE, java.lang.Float.class),
+
+    /** The primitive long kind. */
+    Long('j', "long", 2, false, java.lang.Long.TYPE, java.lang.Long.class),
+
+    /** The primitive double kind. */
+    Double('d', "double", 2, false, java.lang.Double.TYPE, java.lang.Double.class),
+
+    /** The Object kind, also used for arrays. */
+    Object('a', "Object", 1, false, null, null),
+
+    /** The void float kind. */
+    Void('v', "void", 0, false, java.lang.Void.TYPE, java.lang.Void.class),
+
+    /** The non-type. */
+    Illegal('-', "illegal", 0, false, null, null);
+
+    private final char typeChar;
+    private final String javaName;
+    private final boolean isStackInt;
+    private final Class<?> primitiveJavaClass;
+    private final Class<?> boxedJavaClass;
+    private final EnumKey key = new EnumKey(this);
+    private final int slotCount;
+
+    private Kind(char typeChar, String javaName, int slotCount, boolean isStackInt, Class<?> primitiveJavaClass, Class<?> boxedJavaClass) {
+        this.typeChar = typeChar;
+        this.javaName = javaName;
+        this.slotCount = slotCount;
+        this.isStackInt = isStackInt;
+        this.primitiveJavaClass = primitiveJavaClass;
+        this.boxedJavaClass = boxedJavaClass;
+        assert primitiveJavaClass == null || javaName.equals(primitiveJavaClass.getName());
+    }
+
+    /**
+     * Returns the number of stack slots occupied by this kind according to the Java bytecodes
+     * specification.
+     */
+    public int getSlotCount() {
+        return this.slotCount;
+    }
+
+    /**
+     * Returns whether this kind occupied two stack slots.
+     */
+    public boolean needsTwoSlots() {
+        return this.slotCount == 2;
+    }
+
+    /**
+     * Returns the name of the kind as a single character.
+     */
+    public char getTypeChar() {
+        return typeChar;
+    }
+
+    /**
+     * Returns the name of this kind which will also be it Java programming language name if it is
+     * {@linkplain #isPrimitive() primitive} or {@code void}.
+     */
+    public String getJavaName() {
+        return javaName;
+    }
+
+    public Key getKey() {
+        return key;
+    }
+
+    /**
+     * Checks whether this type is a Java primitive type.
+     *
+     * @return {@code true} if this is {@link #Boolean}, {@link #Byte}, {@link #Char},
+     *         {@link #Short}, {@link #Int}, {@link #Long}, {@link #Float}, {@link #Double}, or
+     *         {@link #Void}.
+     */
+    public boolean isPrimitive() {
+        return primitiveJavaClass != null;
+    }
+
+    /**
+     * Returns the kind that represents this kind when on the Java operand stack.
+     *
+     * @return the kind used on the operand stack
+     */
+    public Kind getStackKind() {
+        if (isStackInt) {
+            return Int;
+        }
+        return this;
+    }
+
+    /**
+     * Checks whether this type is a Java primitive type representing an integer number.
+     *
+     * @return {@code true} if the stack kind is {@link #Int} or {@link #Long}.
+     */
+    public boolean isNumericInteger() {
+        return isStackInt || this == Kind.Long;
+    }
+
+    /**
+     * Checks whether this type is a Java primitive type representing an unsigned number.
+     *
+     * @return {@code true} if the kind is {@link #Boolean} or {@link #Char}.
+     */
+    public boolean isUnsigned() {
+        return this == Kind.Boolean || this == Kind.Char;
+    }
+
+    /**
+     * Checks whether this type is a Java primitive type representing a floating point number.
+     *
+     * @return {@code true} if this is {@link #Float} or {@link #Double}.
+     */
+    public boolean isNumericFloat() {
+        return this == Kind.Float || this == Kind.Double;
+    }
+
+    /**
+     * Checks whether this represent an Object of some sort.
+     *
+     * @return {@code true} if this is {@link #Object}.
+     */
+    public boolean isObject() {
+        return this == Kind.Object;
+    }
+
+    /**
+     * Returns the kind corresponding to the Java type string.
+     *
+     * @param typeString the Java type string
+     * @return the kind
+     */
+    public static Kind fromTypeString(String typeString) {
+        assert typeString.length() > 0;
+        final char first = typeString.charAt(0);
+        if (first == '[' || first == 'L') {
+            return Kind.Object;
+        }
+        return Kind.fromPrimitiveOrVoidTypeChar(first);
+    }
+
+    /**
+     * Returns the kind of a word given the size of a word in bytes.
+     *
+     * @param wordSizeInBytes the size of a word in bytes
+     * @return the kind representing a word value
+     */
+    public static Kind fromWordSize(int wordSizeInBytes) {
+        if (wordSizeInBytes == 8) {
+            return Kind.Long;
+        } else {
+            assert wordSizeInBytes == 4 : "Unsupported word size!";
+            return Kind.Int;
+        }
+    }
+
+    /**
+     * Returns the kind from the character describing a primitive or void.
+     *
+     * @param ch the character
+     * @return the kind
+     */
+    public static Kind fromPrimitiveOrVoidTypeChar(char ch) {
+        switch (ch) {
+            case 'Z':
+                return Boolean;
+            case 'C':
+                return Char;
+            case 'F':
+                return Float;
+            case 'D':
+                return Double;
+            case 'B':
+                return Byte;
+            case 'S':
+                return Short;
+            case 'I':
+                return Int;
+            case 'J':
+                return Long;
+            case 'V':
+                return Void;
+        }
+        throw new IllegalArgumentException("unknown primitive or void type character: " + ch);
+    }
+
+    /**
+     * Returns the Kind representing the given Java class.
+     *
+     * @param klass the class
+     * @return the kind
+     */
+    public static Kind fromJavaClass(Class<?> klass) {
+        if (klass == Boolean.primitiveJavaClass) {
+            return Boolean;
+        } else if (klass == Byte.primitiveJavaClass) {
+            return Byte;
+        } else if (klass == Short.primitiveJavaClass) {
+            return Short;
+        } else if (klass == Char.primitiveJavaClass) {
+            return Char;
+        } else if (klass == Int.primitiveJavaClass) {
+            return Int;
+        } else if (klass == Long.primitiveJavaClass) {
+            return Long;
+        } else if (klass == Float.primitiveJavaClass) {
+            return Float;
+        } else if (klass == Double.primitiveJavaClass) {
+            return Double;
+        } else if (klass == Void.primitiveJavaClass) {
+            return Void;
+        } else {
+            return Object;
+        }
+    }
+
+    /**
+     * Returns the Java class representing this kind.
+     *
+     * @return the Java class
+     */
+    public Class<?> toJavaClass() {
+        return primitiveJavaClass;
+    }
+
+    /**
+     * Returns the Java class for instances of boxed values of this kind.
+     *
+     * @return the Java class
+     */
+    public Class<?> toBoxedJavaClass() {
+        return boxedJavaClass;
+    }
+
+    /**
+     * Converts this value type to a string.
+     */
+    @Override
+    public String toString() {
+        return javaName;
+    }
+
+    /**
+     * Marker interface for types that should be {@linkplain Kind#format(Object) formatted} with
+     * their {@link Object#toString()} value. Calling {@link Object#toString()} on other objects
+     * poses a security risk because it can potentially call user code.
+     */
+    public interface FormatWithToString {
+    }
+
+    /**
+     * Classes for which invoking {@link Object#toString()} does not run user code.
+     */
+    private static boolean isToStringSafe(Class<?> c) {
+        return c == Boolean.class || c == Byte.class || c == Character.class || c == Short.class || c == Integer.class || c == Float.class || c == Long.class || c == Double.class;
+    }
+
+    /**
+     * Gets a formatted string for a given value of this kind.
+     *
+     * @param value a value of this kind
+     * @return a formatted string for {@code value} based on this kind
+     */
+    public String format(Object value) {
+        if (isPrimitive()) {
+            assert isToStringSafe(value.getClass());
+            return value.toString();
+        } else {
+            if (value == null) {
+                return "null";
+            } else {
+                if (value instanceof String) {
+                    String s = (String) value;
+                    if (s.length() > 50) {
+                        return "String:\"" + s.substring(0, 30) + "...\"";
+                    } else {
+                        return "String:\"" + s + '"';
+                    }
+                } else if (value instanceof JavaType) {
+                    return "JavaType:" + ((JavaType) value).toJavaName();
+                } else if (value instanceof Enum) {
+                    return MetaUtil.getSimpleName(value.getClass(), true) + ":" + ((Enum<?>) value).name();
+                } else if (value instanceof FormatWithToString) {
+                    return MetaUtil.getSimpleName(value.getClass(), true) + ":" + String.valueOf(value);
+                } else if (value instanceof Class<?>) {
+                    return "Class:" + ((Class<?>) value).getName();
+                } else if (isToStringSafe(value.getClass())) {
+                    return value.toString();
+                } else if (value.getClass().isArray()) {
+                    return formatArray(value);
+                } else {
+                    return MetaUtil.getSimpleName(value.getClass(), true) + "@" + System.identityHashCode(value);
+                }
+            }
+        }
+    }
+
+    private static final int MAX_FORMAT_ARRAY_LENGTH = 5;
+
+    private static String formatArray(Object array) {
+        Class<?> componentType = array.getClass().getComponentType();
+        assert componentType != null;
+        int arrayLength = Array.getLength(array);
+        StringBuilder buf = new StringBuilder(MetaUtil.getSimpleName(componentType, true)).append('[').append(arrayLength).append("]{");
+        int length = Math.min(MAX_FORMAT_ARRAY_LENGTH, arrayLength);
+        boolean primitive = componentType.isPrimitive();
+        for (int i = 0; i < length; i++) {
+            if (primitive) {
+                buf.append(Array.get(array, i));
+            } else {
+                Object o = ((Object[]) array)[i];
+                buf.append(Kind.Object.format(o));
+            }
+            if (i != length - 1) {
+                buf.append(", ");
+            }
+        }
+        if (arrayLength != length) {
+            buf.append(", ...");
+        }
+        return buf.append('}').toString();
+    }
+
+    /**
+     * The minimum value that can be represented as a value of this kind.
+     *
+     * @return the minimum value
+     */
+    public long getMinValue() {
+        switch (this) {
+            case Boolean:
+                return 0;
+            case Byte:
+                return java.lang.Byte.MIN_VALUE;
+            case Char:
+                return java.lang.Character.MIN_VALUE;
+            case Short:
+                return java.lang.Short.MIN_VALUE;
+            case Int:
+                return java.lang.Integer.MIN_VALUE;
+            case Long:
+                return java.lang.Long.MIN_VALUE;
+            default:
+                throw new IllegalArgumentException("illegal call to minValue on " + this);
+        }
+    }
+
+    /**
+     * The maximum value that can be represented as a value of this kind.
+     *
+     * @return the maximum value
+     */
+    public long getMaxValue() {
+        switch (this) {
+            case Boolean:
+                return 1;
+            case Byte:
+                return java.lang.Byte.MAX_VALUE;
+            case Char:
+                return java.lang.Character.MAX_VALUE;
+            case Short:
+                return java.lang.Short.MAX_VALUE;
+            case Int:
+                return java.lang.Integer.MAX_VALUE;
+            case Long:
+                return java.lang.Long.MAX_VALUE;
+            default:
+                throw new IllegalArgumentException("illegal call to maxValue on " + this);
+        }
+    }
+
+    /**
+     * Number of bytes that are necessary to represent a value of this kind.
+     *
+     * @return the number of bytes
+     */
+    public int getByteCount() {
+        if (this == Boolean) {
+            return 1;
+        } else {
+            return getBitCount() >> 3;
+        }
+    }
+
+    /**
+     * Number of bits that are necessary to represent a value of this kind.
+     *
+     * @return the number of bits
+     */
+    public int getBitCount() {
+        switch (this) {
+            case Boolean:
+                return 1;
+            case Byte:
+                return 8;
+            case Char:
+            case Short:
+                return 16;
+            case Float:
+                return 32;
+            case Int:
+                return 32;
+            case Double:
+                return 64;
+            case Long:
+                return 64;
+            default:
+                throw new IllegalArgumentException("illegal call to bits on " + this);
+        }
+    }
+
+    public JavaConstant getDefaultValue() {
+        switch (this) {
+            case Boolean:
+                return JavaConstant.FALSE;
+            case Int:
+                return JavaConstant.INT_0;
+            case Long:
+                return JavaConstant.LONG_0;
+            case Float:
+                return JavaConstant.FLOAT_0;
+            case Double:
+                return JavaConstant.DOUBLE_0;
+            case Object:
+                return JavaConstant.NULL_POINTER;
+            case Byte:
+            case Char:
+            case Short:
+                return new PrimitiveConstant(this, 0);
+            default:
+                throw new IllegalArgumentException("illegal call to getDefaultValue on " + this);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/KindProvider.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.oracle.jvmci.meta;
+
+/**
+ * Interface for classes which can be associated with a Kind.
+ */
+public interface KindProvider {
+
+    Kind getKind();
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/LIRKind.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,349 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.meta;
+
+import java.util.*;
+
+/**
+ * Represents the type of values in the LIR. It is composed of a {@link PlatformKind} that gives the
+ * low level representation of the value, and a {@link #referenceMask} that describes the location
+ * of object references in the value.
+ *
+ * <h2>Constructing {@link LIRKind} instances</h2>
+ *
+ * During LIR generation, every new {@link Value} should get a {@link LIRKind} of the correct
+ * {@link PlatformKind} that also contains the correct reference information. {@linkplain LIRKind
+ * LIRKinds} should be created as follows:
+ *
+ * <p>
+ * If the result value is created from one or more input values, the {@link LIRKind} should be
+ * created with {@link LIRKind#derive}(inputs). If the result has a different {@link PlatformKind}
+ * than the inputs, {@link LIRKind#derive}(inputs).{@link #changeType}(resultKind) should be used.
+ * <p>
+ * If the result is an exact copy of one of the inputs, {@link Value#getLIRKind()} can be used. Note
+ * that this is only correct for move-like operations, like conditional move or compare-and-swap.
+ * For convert operations, {@link LIRKind#derive} should be used.
+ * <p>
+ * If it is known that the result will be a reference (e.g. pointer arithmetic where the end result
+ * is a valid oop), {@link LIRKind#reference} should be used.
+ * <p>
+ * If it is known that the result will neither be a reference nor be derived from a reference,
+ * {@link LIRKind#value} can be used. If the operation producing this value has inputs, this is very
+ * likely wrong, and {@link LIRKind#derive} should be used instead.
+ * <p>
+ * If it is known that the result is derived from a reference, {@link LIRKind#derivedReference} can
+ * be used. In most cases, {@link LIRKind#derive} should be used instead, since it is able to detect
+ * this automatically.
+ */
+public final class LIRKind {
+
+    /**
+     * The non-type. This uses {@link #derivedReference}, so it can never be part of an oop map.
+     */
+    public static final LIRKind Illegal = derivedReference(Kind.Illegal);
+
+    private final PlatformKind platformKind;
+    private final int referenceMask;
+
+    private static final int DERIVED_REFERENCE = -1;
+
+    private LIRKind(PlatformKind platformKind, int referenceMask) {
+        this.platformKind = platformKind;
+        this.referenceMask = referenceMask;
+    }
+
+    /**
+     * Create a {@link LIRKind} of type {@code platformKind} that contains a primitive value. Should
+     * be only used when it's guaranteed that the value is not even indirectly derived from a
+     * reference. Otherwise, {@link #derive(Value...)} should be used instead.
+     */
+    public static LIRKind value(PlatformKind platformKind) {
+        assert platformKind != Kind.Object : "Object should always be used as reference type";
+        return new LIRKind(platformKind, 0);
+    }
+
+    /**
+     * Create a {@link LIRKind} of type {@code platformKind} that contains a single tracked oop
+     * reference.
+     */
+    public static LIRKind reference(PlatformKind platformKind) {
+        int length = platformKind.getVectorLength();
+        assert 0 < length && length < 32 : "vector of " + length + " references not supported";
+        return new LIRKind(platformKind, (1 << length) - 1);
+    }
+
+    /**
+     * Create a {@link LIRKind} of type {@code platformKind} that contains a value that is derived
+     * from a reference. Values of this {@link LIRKind} can not be live at safepoints. In most
+     * cases, this should not be called directly. {@link #derive} should be used instead to
+     * automatically propagate this information.
+     */
+    public static LIRKind derivedReference(PlatformKind platformKind) {
+        return new LIRKind(platformKind, DERIVED_REFERENCE);
+    }
+
+    /**
+     * Derive a new type from inputs. The result will have the {@link PlatformKind} of one of the
+     * inputs. If all inputs are values, the result is a value. Otherwise, the result is a derived
+     * reference.
+     *
+     * This method should be used to construct the result {@link LIRKind} of any operation that
+     * modifies values (e.g. arithmetics).
+     */
+    public static LIRKind derive(Value... inputs) {
+        assert inputs.length > 0;
+        for (Value input : inputs) {
+            LIRKind kind = input.getLIRKind();
+            if (kind.isDerivedReference()) {
+                return kind;
+            } else if (!kind.isValue()) {
+                return kind.makeDerivedReference();
+            }
+        }
+
+        // all inputs are values, just return one of them
+        return inputs[0].getLIRKind();
+    }
+
+    /**
+     * Merge the types of the inputs. The result will have the {@link PlatformKind} of one of the
+     * inputs. If all inputs are values (references), the result is a value (reference). Otherwise,
+     * the result is a derived reference.
+     *
+     * This method should be used to construct the result {@link LIRKind} of merge operation that do
+     * not modify values (e.g. phis).
+     */
+    public static LIRKind merge(Value... inputs) {
+        assert inputs.length > 0;
+        ArrayList<LIRKind> kinds = new ArrayList<>(inputs.length);
+        for (int i = 0; i < inputs.length; i++) {
+            kinds.add(inputs[i].getLIRKind());
+        }
+        return merge(kinds);
+    }
+
+    /**
+     * @see #merge(Value...)
+     */
+    public static LIRKind merge(Iterable<LIRKind> kinds) {
+        LIRKind mergeKind = null;
+
+        for (LIRKind kind : kinds) {
+
+            assert mergeKind == null || verifyMoveKinds(mergeKind, kind) : String.format("Input kinds do not match %s vs. %s", mergeKind, kind);
+
+            if (kind.isDerivedReference()) {
+                /**
+                 * Kind is a derived reference therefore the result can only be also a derived
+                 * reference.
+                 */
+                return kind;
+            }
+            if (mergeKind == null) {
+                mergeKind = kind;
+                continue;
+            }
+
+            if (kind.isValue()) {
+                /* Kind is a value. */
+                if (mergeKind.referenceMask != 0) {
+                    /*
+                     * Inputs consists of values and references. Make the result a derived
+                     * reference.
+                     */
+                    return mergeKind.makeDerivedReference();
+                }
+                /* Check that other inputs are also values. */
+            } else {
+                /* Kind is a reference. */
+                if (mergeKind.referenceMask != kind.referenceMask) {
+                    /*
+                     * Reference maps do not match so the result can only be a derived reference.
+                     */
+                    return mergeKind.makeDerivedReference();
+                }
+            }
+
+        }
+        assert mergeKind != null;
+
+        // all inputs are values or references, just return one of them
+        return mergeKind;
+    }
+
+    /**
+     * Create a new {@link LIRKind} with the same reference information and a new
+     * {@linkplain #getPlatformKind platform kind}. If the new kind is a longer vector than this,
+     * the new elements are marked as untracked values.
+     */
+    public LIRKind changeType(PlatformKind newPlatformKind) {
+        if (newPlatformKind == platformKind) {
+            return this;
+        } else if (isDerivedReference()) {
+            return derivedReference(newPlatformKind);
+        } else if (referenceMask == 0) {
+            // value type
+            return new LIRKind(newPlatformKind, 0);
+        } else {
+            // reference type
+            int newLength = Math.min(32, newPlatformKind.getVectorLength());
+            int newReferenceMask = referenceMask & (0xFFFFFFFF >>> (32 - newLength));
+            assert newReferenceMask != DERIVED_REFERENCE;
+            return new LIRKind(newPlatformKind, newReferenceMask);
+        }
+    }
+
+    /**
+     * Create a new {@link LIRKind} with a new {@linkplain #getPlatformKind platform kind}. If the
+     * new kind is longer than this, the reference positions are repeated to fill the vector.
+     */
+    public LIRKind repeat(PlatformKind newPlatformKind) {
+        if (isDerivedReference()) {
+            return derivedReference(newPlatformKind);
+        } else if (referenceMask == 0) {
+            // value type
+            return new LIRKind(newPlatformKind, 0);
+        } else {
+            // reference type
+            int oldLength = platformKind.getVectorLength();
+            int newLength = newPlatformKind.getVectorLength();
+            assert oldLength <= newLength && newLength < 32 && (newLength % oldLength) == 0;
+
+            // repeat reference mask to fill new kind
+            int newReferenceMask = 0;
+            for (int i = 0; i < newLength; i += platformKind.getVectorLength()) {
+                newReferenceMask |= referenceMask << i;
+            }
+
+            assert newReferenceMask != DERIVED_REFERENCE;
+            return new LIRKind(newPlatformKind, newReferenceMask);
+        }
+    }
+
+    /**
+     * Create a new {@link LIRKind} with the same type, but marked as containing a derivedReference.
+     */
+    public LIRKind makeDerivedReference() {
+        return new LIRKind(platformKind, DERIVED_REFERENCE);
+    }
+
+    /**
+     * Get the low level type that is used in code generation.
+     */
+    public PlatformKind getPlatformKind() {
+        return platformKind;
+    }
+
+    /**
+     * Check whether this value is derived from a reference. If this returns {@code true}, this
+     * value must not be live at safepoints.
+     */
+    public boolean isDerivedReference() {
+        return referenceMask == DERIVED_REFERENCE;
+    }
+
+    /**
+     * Check whether the {@code idx}th part of this value is a reference that must be tracked at
+     * safepoints.
+     *
+     * @param idx The index into the vector if this is a vector kind. Must be 0 if this is a scalar
+     *            kind.
+     */
+    public boolean isReference(int idx) {
+        assert 0 <= idx && idx < platformKind.getVectorLength() : "invalid index " + idx + " in " + this;
+        return !isDerivedReference() && (referenceMask & 1 << idx) != 0;
+    }
+
+    /**
+     * Check whether this kind is a value type that doesn't need to be tracked at safepoints.
+     */
+    public boolean isValue() {
+        return referenceMask == 0;
+    }
+
+    @Override
+    public String toString() {
+        if (isValue()) {
+            return platformKind.name();
+        } else if (isDerivedReference()) {
+            return platformKind.name() + "[*]";
+        } else {
+            StringBuilder ret = new StringBuilder();
+            ret.append(platformKind.name());
+            ret.append('[');
+            for (int i = 0; i < platformKind.getVectorLength(); i++) {
+                if (isReference(i)) {
+                    ret.append('.');
+                } else {
+                    ret.append(' ');
+                }
+            }
+            ret.append(']');
+            return ret.toString();
+        }
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((platformKind == null) ? 0 : platformKind.hashCode());
+        result = prime * result + referenceMask;
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (!(obj instanceof LIRKind)) {
+            return false;
+        }
+
+        LIRKind other = (LIRKind) obj;
+        return platformKind == other.platformKind && referenceMask == other.referenceMask;
+    }
+
+    public static boolean verifyMoveKinds(LIRKind dst, LIRKind src) {
+        if (src.equals(dst)) {
+            return true;
+        }
+        /*
+         * TODO(je,rs) What we actually want is toStackKind(src.getPlatformKind()).equals(
+         * dst.getPlatformKind()) but due to the handling of sub-integer at the current point
+         * (phi-)moves from e.g. integer to short can happen. Therefore we compare stack kinds.
+         */
+        if (toStackKind(src.getPlatformKind()).equals(toStackKind(dst.getPlatformKind()))) {
+            return !src.isDerivedReference() || dst.isDerivedReference();
+        }
+        return false;
+    }
+
+    private static PlatformKind toStackKind(PlatformKind platformKind) {
+        if (platformKind instanceof Kind) {
+            return ((Kind) platformKind).getStackKind();
+        }
+        return platformKind;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/LineNumberTable.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,32 @@
+/*
+ * 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.jvmci.meta;
+
+public interface LineNumberTable {
+
+    int[] getLineNumberEntries();
+
+    int[] getBciEntries();
+
+    int getLineNumber(int bci);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/LineNumberTableImpl.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,54 @@
+/*
+ * 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.jvmci.meta;
+
+public class LineNumberTableImpl implements LineNumberTable {
+
+    private final int[] lineNumbers;
+    private final int[] bci;
+
+    public LineNumberTableImpl(int[] lineNumbers, int[] bci) {
+        this.lineNumbers = lineNumbers;
+        this.bci = bci;
+    }
+
+    @Override
+    public int[] getLineNumberEntries() {
+        return lineNumbers;
+    }
+
+    @Override
+    public int[] getBciEntries() {
+        return bci;
+    }
+
+    @Override
+    public int getLineNumber(@SuppressWarnings("hiding") int bci) {
+        for (int i = 0; i < this.bci.length - 1; i++) {
+            if (this.bci[i] <= bci && bci < this.bci[i + 1]) {
+                return lineNumbers[i];
+            }
+        }
+        return lineNumbers[lineNumbers.length - 1];
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/Local.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,36 @@
+/*
+ * 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.jvmci.meta;
+
+public interface Local {
+
+    int getStartBCI();
+
+    int getEndBCI();
+
+    int getSlot();
+
+    String getName();
+
+    JavaType getType();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/LocalImpl.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,84 @@
+/*
+ * 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.jvmci.meta;
+
+public class LocalImpl implements Local {
+
+    private final String name;
+    private final int startBci;
+    private final int endBci;
+    private final int slot;
+    private final JavaType type;
+
+    public LocalImpl(String name, JavaType type, int startBci, int endBci, int slot) {
+        this.name = name;
+        this.startBci = startBci;
+        this.endBci = endBci;
+        this.slot = slot;
+        this.type = type;
+    }
+
+    @Override
+    public int getStartBCI() {
+        return startBci;
+    }
+
+    @Override
+    public int getEndBCI() {
+        return endBci;
+    }
+
+    @Override
+    public String getName() {
+        return name;
+    }
+
+    @Override
+    public JavaType getType() {
+        return type;
+    }
+
+    @Override
+    public int getSlot() {
+        return slot;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (!(obj instanceof LocalImpl)) {
+            return false;
+        }
+        LocalImpl that = (LocalImpl) obj;
+        return this.name.equals(that.name) && this.startBci == that.startBci && this.endBci == that.endBci && this.slot == that.slot && this.type.equals(that.type);
+    }
+
+    @Override
+    public int hashCode() {
+        return super.hashCode();
+    }
+
+    @Override
+    public String toString() {
+        return "LocalImpl<name=" + name + ", type=" + type + ", startBci=" + startBci + ", endBci=" + endBci + ", slot=" + slot + ">";
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/LocalVariableTable.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,32 @@
+/*
+ * 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.jvmci.meta;
+
+public interface LocalVariableTable {
+
+    Local[] getLocals();
+
+    Local[] getLocalsAt(int bci);
+
+    Local getLocal(int slot, int bci);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/LocalVariableTableImpl.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,66 @@
+/*
+ * 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.jvmci.meta;
+
+import java.util.*;
+
+public class LocalVariableTableImpl implements LocalVariableTable {
+
+    private final Local[] locals;
+
+    public LocalVariableTableImpl(Local[] locals) {
+        this.locals = locals;
+    }
+
+    @Override
+    public Local getLocal(int slot, int bci) {
+        Local result = null;
+        for (Local local : locals) {
+            if (local.getSlot() == slot && local.getStartBCI() <= bci && local.getEndBCI() >= bci) {
+                if (result == null) {
+                    result = local;
+                } else {
+                    throw new IllegalStateException("Locals overlap!");
+                }
+            }
+        }
+        return result;
+    }
+
+    @Override
+    public Local[] getLocals() {
+        return locals;
+    }
+
+    @Override
+    public Local[] getLocalsAt(int bci) {
+        List<Local> result = new ArrayList<>();
+        for (Local l : locals) {
+            if (l.getStartBCI() <= bci && bci <= l.getEndBCI()) {
+                result.add(l);
+            }
+        }
+        return result.toArray(new Local[result.size()]);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/LocationIdentity.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,82 @@
+/*
+ * 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.jvmci.meta;
+
+import java.util.*;
+
+// JaCoCo Exclude
+
+/**
+ * Marker interface for location identities. Apart from the special values {@link #ANY_LOCATION} and
+ * {@link #FINAL_LOCATION}, a different location identity of two memory accesses guarantees that the
+ * two accesses do not interfere.
+ *
+ * Clients of {@link LocationIdentity} must use {@link #equals(Object)}, not {@code ==}, when
+ * comparing two {@link LocationIdentity} values for equality. Likewise, they must not use
+ * {@link IdentityHashMap}s with {@link LocationIdentity} values as keys.
+ */
+public abstract class LocationIdentity {
+
+    /**
+     * Denotes any location. A write to such a location kills all values in a memory map during an
+     * analysis of memory accesses. A read from this location cannot be moved or coalesced with
+     * other reads because its interaction with other reads is not known.
+     */
+    private static final LocationIdentity ANY_LOCATION = NamedLocationIdentity.mutable("ANY_LOCATION");
+
+    /**
+     * Denotes the location of a value that is guaranteed to be unchanging.
+     */
+    public static final LocationIdentity FINAL_LOCATION = NamedLocationIdentity.immutable("FINAL_LOCATION");
+
+    /**
+     * Denotes the location of the length field of a Java array.
+     */
+    public static final LocationIdentity ARRAY_LENGTH_LOCATION = NamedLocationIdentity.immutable("[].length");
+
+    public static LocationIdentity any() {
+        return ANY_LOCATION;
+    }
+
+    /**
+     * Denotes a location is unchanging in all cases. Not that this is different than the Java
+     * notion of final which only requires definite assignment.
+     */
+    public abstract boolean isImmutable();
+
+    public final boolean isMutable() {
+        return !isImmutable();
+    }
+
+    public final boolean isAny() {
+        return this == ANY_LOCATION;
+    }
+
+    public final boolean isSingle() {
+        return this != ANY_LOCATION;
+    }
+
+    public final boolean overlaps(LocationIdentity other) {
+        return isAny() || other.isAny() || this.equals(other);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/MemoryAccessProvider.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.meta;
+
+/**
+ * Provides memory access operations for the target VM.
+ */
+public interface MemoryAccessProvider {
+
+    /**
+     * Reads a value of this kind using a base address and a displacement. No bounds checking or
+     * type checking is performed. Returns {@code null} if the value is not available at this point.
+     *
+     * @param base the base address from which the value is read.
+     * @param displacement the displacement within the object in bytes
+     * @return the read value encapsulated in a {@link JavaConstant} object, or {@code null} if the
+     *         value cannot be read.
+     */
+    JavaConstant readUnsafeConstant(Kind kind, JavaConstant base, long displacement);
+
+    /**
+     * Reads a primitive value using a base address and a displacement.
+     *
+     * @param kind the {@link Kind} of the returned {@link JavaConstant} object
+     * @param base the base address from which the value is read
+     * @param displacement the displacement within the object in bytes
+     * @param bits the number of bits to read from memory
+     * @return the read value encapsulated in a {@link JavaConstant} object of {@link Kind} kind
+     */
+    JavaConstant readPrimitiveConstant(Kind kind, Constant base, long displacement, int bits);
+
+    /**
+     * Reads a Java {@link Object} value using a base address and a displacement.
+     *
+     * @param base the base address from which the value is read
+     * @param displacement the displacement within the object in bytes
+     * @return the read value encapsulated in a {@link Constant} object
+     */
+    JavaConstant readObjectConstant(Constant base, long displacement);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/MetaAccessProvider.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,104 @@
+/*
+ * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.meta;
+
+import java.lang.reflect.*;
+
+/**
+ * Provides access to the metadata of a class typically provided in a class file.
+ */
+public interface MetaAccessProvider {
+
+    /**
+     * Returns the resolved Java type representing a given Java class.
+     *
+     * @param clazz the Java class object
+     * @return the resolved Java type object
+     */
+    ResolvedJavaType lookupJavaType(Class<?> clazz);
+
+    /**
+     * Returns the resolved Java types representing some given Java classes.
+     *
+     * @param classes the Java class objects
+     * @return the resolved Java type objects
+     */
+    default ResolvedJavaType[] lookupJavaTypes(Class<?>[] classes) {
+        ResolvedJavaType[] result = new ResolvedJavaType[classes.length];
+        for (int i = 0; i < result.length; i++) {
+            result[i] = lookupJavaType(classes[i]);
+        }
+        return result;
+    }
+
+    /**
+     * Provides the {@link ResolvedJavaMethod} for a {@link Method} or {@link Constructor} obtained
+     * via reflection.
+     */
+    ResolvedJavaMethod lookupJavaMethod(Executable reflectionMethod);
+
+    /**
+     * Provides the {@link ResolvedJavaField} for a {@link Field} obtained via reflection.
+     */
+    ResolvedJavaField lookupJavaField(Field reflectionField);
+
+    /**
+     * Returns the resolved Java type of the given {@link JavaConstant} object.
+     *
+     * @return {@code null} if {@code constant.isNull() || !constant.kind.isObject()}
+     */
+    ResolvedJavaType lookupJavaType(JavaConstant constant);
+
+    /**
+     * Returns the number of bytes occupied by this constant value or constant object.
+     *
+     * @param constant the constant whose bytes should be measured
+     * @return the number of bytes occupied by this constant
+     */
+    long getMemorySize(JavaConstant constant);
+
+    /**
+     * Parses a <a
+     * href="http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.3.3">method
+     * descriptor</a> into a {@link Signature}. The behavior of this method is undefined if the
+     * method descriptor is not well formed.
+     */
+    Signature parseMethodDescriptor(String methodDescriptor);
+
+    /**
+     * Encodes a deoptimization action and a deoptimization reason in an integer value.
+     *
+     * @param debugId an integer that can be used to track the origin of a deoptimization at
+     *            runtime. There is no guarantee that the runtime will use this value. The runtime
+     *            may even keep fewer than 32 bits.
+     *
+     * @return the encoded value as an integer
+     */
+    JavaConstant encodeDeoptActionAndReason(DeoptimizationAction action, DeoptimizationReason reason, int debugId);
+
+    DeoptimizationReason decodeDeoptReason(JavaConstant constant);
+
+    DeoptimizationAction decodeDeoptAction(JavaConstant constant);
+
+    int decodeDebugId(JavaConstant constant);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/MetaUtil.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,341 @@
+/*
+ * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.meta;
+
+import java.io.*;
+import java.util.*;
+
+/**
+ * Miscellaneous collection of utility methods used by {@code com.oracle.jvmci.meta} and its
+ * clients.
+ */
+public class MetaUtil {
+
+    private static class ClassInfo {
+        public long totalSize;
+        public long instanceCount;
+
+        @Override
+        public String toString() {
+            return "totalSize=" + totalSize + ", instanceCount=" + instanceCount;
+        }
+    }
+
+    /**
+     * Returns the number of bytes occupied by this constant value or constant object and
+     * recursively all values reachable from this value.
+     *
+     * @param constant the constant whose bytes should be measured
+     * @param printTopN print total size and instance count of the top n classes is desired
+     * @return the number of bytes occupied by this constant
+     */
+    public static long getMemorySizeRecursive(MetaAccessProvider access, ConstantReflectionProvider constantReflection, JavaConstant constant, PrintStream out, int printTopN) {
+        Set<JavaConstant> marked = new HashSet<>();
+        Deque<JavaConstant> stack = new ArrayDeque<>();
+        if (constant.getKind() == Kind.Object && constant.isNonNull()) {
+            marked.add(constant);
+        }
+        final HashMap<ResolvedJavaType, ClassInfo> histogram = new HashMap<>();
+        stack.push(constant);
+        long sum = 0;
+        while (!stack.isEmpty()) {
+            JavaConstant c = stack.pop();
+            long memorySize = access.getMemorySize(constant);
+            sum += memorySize;
+            if (c.getKind() == Kind.Object && c.isNonNull()) {
+                ResolvedJavaType clazz = access.lookupJavaType(c);
+                if (!histogram.containsKey(clazz)) {
+                    histogram.put(clazz, new ClassInfo());
+                }
+                ClassInfo info = histogram.get(clazz);
+                info.instanceCount++;
+                info.totalSize += memorySize;
+                ResolvedJavaType type = access.lookupJavaType(c);
+                if (type.isArray()) {
+                    if (!type.getComponentType().isPrimitive()) {
+                        int length = constantReflection.readArrayLength(c);
+                        for (int i = 0; i < length; i++) {
+                            JavaConstant value = constantReflection.readArrayElement(c, i);
+                            pushConstant(marked, stack, value);
+                        }
+                    }
+                } else {
+                    ResolvedJavaField[] instanceFields = type.getInstanceFields(true);
+                    for (ResolvedJavaField f : instanceFields) {
+                        if (f.getKind() == Kind.Object) {
+                            JavaConstant value = constantReflection.readFieldValue(f, c);
+                            pushConstant(marked, stack, value);
+                        }
+                    }
+                }
+            }
+        }
+        ArrayList<ResolvedJavaType> clazzes = new ArrayList<>();
+        clazzes.addAll(histogram.keySet());
+        Collections.sort(clazzes, new Comparator<ResolvedJavaType>() {
+
+            @Override
+            public int compare(ResolvedJavaType o1, ResolvedJavaType o2) {
+                long l1 = histogram.get(o1).totalSize;
+                long l2 = histogram.get(o2).totalSize;
+                if (l1 > l2) {
+                    return -1;
+                } else if (l1 == l2) {
+                    return 0;
+                } else {
+                    return 1;
+                }
+            }
+        });
+
+        int z = 0;
+        for (ResolvedJavaType c : clazzes) {
+            if (z > printTopN) {
+                break;
+            }
+            out.println("Class " + c + ", " + histogram.get(c));
+            ++z;
+        }
+
+        return sum;
+    }
+
+    private static void pushConstant(Set<JavaConstant> marked, Deque<JavaConstant> stack, JavaConstant value) {
+        if (value.isNonNull()) {
+            if (!marked.contains(value)) {
+                marked.add(value);
+                stack.push(value);
+            }
+        }
+    }
+
+    /**
+     * Calls {@link JavaType#resolve(ResolvedJavaType)} on an array of types.
+     */
+    public static ResolvedJavaType[] resolveJavaTypes(JavaType[] types, ResolvedJavaType accessingClass) {
+        ResolvedJavaType[] result = new ResolvedJavaType[types.length];
+        for (int i = 0; i < result.length; i++) {
+            result[i] = types[i].resolve(accessingClass);
+        }
+        return result;
+    }
+
+    /**
+     * Extends the functionality of {@link Class#getSimpleName()} to include a non-empty string for
+     * anonymous and local classes.
+     *
+     * @param clazz the class for which the simple name is being requested
+     * @param withEnclosingClass specifies if the returned name should be qualified with the name(s)
+     *            of the enclosing class/classes of {@code clazz} (if any). This option is ignored
+     *            if {@code clazz} denotes an anonymous or local class.
+     * @return the simple name
+     */
+    public static String getSimpleName(Class<?> clazz, boolean withEnclosingClass) {
+        final String simpleName = clazz.getSimpleName();
+        if (simpleName.length() != 0) {
+            if (withEnclosingClass) {
+                String prefix = "";
+                Class<?> enclosingClass = clazz;
+                while ((enclosingClass = enclosingClass.getEnclosingClass()) != null) {
+                    prefix = enclosingClass.getSimpleName() + "." + prefix;
+                }
+                return prefix + simpleName;
+            }
+            return simpleName;
+        }
+        // Must be an anonymous or local class
+        final String name = clazz.getName();
+        int index = name.indexOf('$');
+        if (index == -1) {
+            return name;
+        }
+        index = name.lastIndexOf('.', index);
+        if (index == -1) {
+            return name;
+        }
+        return name.substring(index + 1);
+    }
+
+    static String internalNameToJava(String name, boolean qualified, boolean classForNameCompatible) {
+        switch (name.charAt(0)) {
+            case 'L': {
+                String result = name.substring(1, name.length() - 1).replace('/', '.');
+                if (!qualified) {
+                    final int lastDot = result.lastIndexOf('.');
+                    if (lastDot != -1) {
+                        result = result.substring(lastDot + 1);
+                    }
+                }
+                return result;
+            }
+            case '[':
+                return classForNameCompatible ? name.replace('/', '.') : internalNameToJava(name.substring(1), qualified, classForNameCompatible) + "[]";
+            default:
+                if (name.length() != 1) {
+                    throw new IllegalArgumentException("Illegal internal name: " + name);
+                }
+                return Kind.fromPrimitiveOrVoidTypeChar(name.charAt(0)).getJavaName();
+        }
+    }
+
+    /**
+     * Turns an class name in internal format into a resolved Java type.
+     */
+    public static ResolvedJavaType classForName(String internal, MetaAccessProvider metaAccess, ClassLoader cl) {
+        Kind k = Kind.fromTypeString(internal);
+        try {
+            String n = internalNameToJava(internal, true, true);
+            return metaAccess.lookupJavaType(k.isPrimitive() ? k.toJavaClass() : Class.forName(n, true, cl));
+        } catch (ClassNotFoundException cnfe) {
+            throw new IllegalArgumentException("could not instantiate class described by " + internal, cnfe);
+        }
+    }
+
+    /**
+     * Convenient shortcut for calling
+     * {@link #appendLocation(StringBuilder, ResolvedJavaMethod, int)} without having to supply a
+     * {@link StringBuilder} instance and convert the result to a string.
+     */
+    public static String toLocation(ResolvedJavaMethod 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 ResolvedJavaMethod#asStackTraceElement(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 applying {@link JavaMethod#format(String)}
+     * with the format string {@code "%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
+     */
+    public static StringBuilder appendLocation(StringBuilder sb, ResolvedJavaMethod method, int bci) {
+        if (method != null) {
+            StackTraceElement ste = method.asStackTraceElement(bci);
+            if (ste.getFileName() != null && ste.getLineNumber() > 0) {
+                sb.append(ste);
+            } else {
+                sb.append(method.format("%H.%n(%p)"));
+            }
+        } else {
+            sb.append("Null method");
+        }
+        return sb.append(" [bci: ").append(bci).append(']');
+    }
+
+    static void appendProfile(StringBuilder buf, AbstractJavaProfile<?, ?> profile, int bci, String type, String sep) {
+        if (profile != null) {
+            AbstractProfiledItem<?>[] pitems = profile.getItems();
+            if (pitems != null) {
+                buf.append(String.format("%s@%d:", type, bci));
+                for (int j = 0; j < pitems.length; j++) {
+                    AbstractProfiledItem<?> pitem = pitems[j];
+                    buf.append(String.format(" %.6f (%s)%s", pitem.getProbability(), pitem.getItem(), sep));
+                }
+                if (profile.getNotRecordedProbability() != 0) {
+                    buf.append(String.format(" %.6f <other %s>%s", profile.getNotRecordedProbability(), type, sep));
+                } else {
+                    buf.append(String.format(" <no other %s>%s", type, sep));
+                }
+            }
+        }
+    }
+
+    /**
+     * 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) {
+        String prefix = "";
+        String base = className;
+        while (base.endsWith("[]")) {
+            prefix += "[";
+            base = base.substring(base.length() - 2);
+        }
+
+        switch (className) {
+            case "boolean":
+                return prefix + "Z";
+            case "byte":
+                return prefix + "B";
+            case "short":
+                return prefix + "S";
+            case "char":
+                return prefix + "C";
+            case "int":
+                return prefix + "I";
+            case "float":
+                return prefix + "F";
+            case "long":
+                return prefix + "J";
+            case "double":
+                return prefix + "D";
+            case "void":
+                return prefix + "V";
+            default:
+                return prefix + "L" + className.replace('.', '/') + ";";
+        }
+    }
+
+    /**
+     * 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);
+    }
+
+    /**
+     * Gets a string representation of an object based soley on its class and its
+     * {@linkplain System#identityHashCode(Object) identity hash code}. This avoids and calls to
+     * virtual methods on the object such as {@link Object#hashCode()}.
+     */
+    public static String identityHashCodeString(Object obj) {
+        if (obj == null) {
+            return "null";
+        }
+        return obj.getClass().getName() + "@" + System.identityHashCode(obj);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/MethodHandleAccessProvider.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.meta;
+
+import java.lang.invoke.*;
+
+/**
+ * Interface to access the internals of the {@link MethodHandle} implementation of the VM. An
+ * implementation of this interface is usually required to access non-public classes, methods, and
+ * fields of {@link MethodHandle}, i.e., data that is not standardized by the Java specification.
+ */
+public interface MethodHandleAccessProvider {
+
+    /**
+     * Identification for methods defined on the class {@link MethodHandle} that are processed by
+     * the {@link MethodHandleAccessProvider}.
+     */
+    public enum IntrinsicMethod {
+        /** The method {@code MethodHandle.invokeBasic}. */
+        INVOKE_BASIC,
+        /** The method {@code MethodHandle.linkToStatic}. */
+        LINK_TO_STATIC,
+        /** The method {@code MethodHandle.linkToSpecial}. */
+        LINK_TO_SPECIAL,
+        /** The method {@code MethodHandle.linkToVirtual}. */
+        LINK_TO_VIRTUAL,
+        /** The method {@code MethodHandle.linkToInterface}. */
+        LINK_TO_INTERFACE
+    }
+
+    /**
+     * Returns the method handle method intrinsic identifier for the provided method, or
+     * {@code null} if the method is not an intrinsic processed by this interface.
+     */
+    IntrinsicMethod lookupMethodHandleIntrinsic(ResolvedJavaMethod method);
+
+    /**
+     * Resolves the invocation target for an invocation of {@link IntrinsicMethod#INVOKE_BASIC
+     * MethodHandle.invokeBasic} with the given constant receiver {@link MethodHandle}. Returns
+     * {@code null} if the invocation target is not available at this time.
+     * <p>
+     * The first invocations of a method handle can use an interpreter to lookup the actual invoked
+     * method; frequently executed method handles can use Java bytecode generation to avoid the
+     * interpreter overhead. If the parameter forceBytecodeGeneration is set to true, the VM should
+     * try to generate bytecodes before this method returns.
+     */
+    ResolvedJavaMethod resolveInvokeBasicTarget(JavaConstant methodHandle, boolean forceBytecodeGeneration);
+
+    /**
+     * Resolves the invocation target for an invocation of a {@code MethodHandle.linkTo*} method
+     * with the given constant member name. The member name is the last parameter of the
+     * {@code linkTo*} method. Returns {@code null} if the invocation target is not available at
+     * this time.
+     */
+    ResolvedJavaMethod resolveLinkToTarget(JavaConstant memberName);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/MethodIdHolder.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2015, 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.jvmci.meta;
+
+import java.util.*;
+import java.util.function.*;
+
+/**
+ * An object that can be assigned a globally unique identifier for use as a key in a
+ * {@link MethodIdMap}.
+ */
+public interface MethodIdHolder {
+    /**
+     * Sets the unique, positive, non-zero identifier for this method.
+     */
+    void setMethodId(int id);
+
+    /**
+     * Gets the identifier set by {@link #setMethodId(int)} or 0 if no identifier was assigned to
+     * this method.
+     */
+    int getMethodId();
+
+    /**
+     * A singleton class for allocating globally unique method identifiers.
+     */
+    static final class MethodIdAllocator {
+
+        /**
+         * Ensures a given method has a unique identifier.
+         */
+        public int assignId(MethodIdHolder holder) {
+            assert Thread.holdsLock(instance) : "must only be called from within MethodIdHolder.allocateIds";
+            int id = holder.getMethodId();
+            if (id == 0) {
+                id = nextId++;
+                holder.setMethodId(id);
+                if (idVerifierMap != null) {
+                    idVerifierMap.put(holder, id);
+                }
+            } else {
+                assert !idVerifierMap.containsKey(holder) || idVerifierMap.get(holder) == id;
+            }
+            return id;
+        }
+
+        private int nextId = 1;
+        private final Map<MethodIdHolder, Integer> idVerifierMap;
+
+        @SuppressWarnings("all")
+        private MethodIdAllocator() {
+            boolean assertionsEnabled = false;
+            assert assertionsEnabled = true;
+            idVerifierMap = assertionsEnabled ? new HashMap<>() : null;
+        }
+
+        /**
+         * Singleton instance.
+         */
+        private static final MethodIdAllocator instance = new MethodIdAllocator();
+    }
+
+    /**
+     * Executes some given code that ensures some set of {@link ResolvedJavaMethod}s have unique ids
+     * {@linkplain MethodIdHolder#setMethodId(int) assigned} to them. The
+     * {@link Consumer#accept(Object)} method of the given object is called under a global lock.
+     */
+    static void assignIds(Consumer<MethodIdAllocator> methodIdConsumer) {
+        synchronized (MethodIdAllocator.instance) {
+            methodIdConsumer.accept(MethodIdAllocator.instance);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/MethodIdMap.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,236 @@
+/*
+ * Copyright (c) 2015, 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.jvmci.meta;
+
+import java.lang.reflect.*;
+import java.util.*;
+import java.util.function.*;
+import java.util.stream.*;
+
+import com.oracle.jvmci.meta.MethodIdHolder.MethodIdAllocator;
+
+/**
+ * A map whose keys are {@link MethodIdHolder}s. This data structure can be used for mapping
+ * identifiers to methods without requiring eager resolution of the latter (e.g., to
+ * {@link ResolvedJavaMethod}s) and has retrieval as fast as array indexing. The constraints on
+ * using such a map are:
+ * <ul>
+ * <li>at most one value can be added for any key</li>
+ * <li>no more entries can be added after the first {@linkplain #get(MethodIdHolder) retrieval}</li>
+ * </ul>
+ *
+ * @param <V> the type of the values in the map
+ */
+public class MethodIdMap<V> {
+
+    /**
+     * Key for a method.
+     */
+    public static class MethodKey<T> {
+        final boolean isStatic;
+        final Class<?> declaringClass;
+        final String name;
+        final Class<?>[] argumentTypes;
+        final T value;
+        int id;
+
+        MethodKey(T data, boolean isStatic, Class<?> declaringClass, String name, Class<?>... argumentTypes) {
+            assert isStatic || argumentTypes[0] == declaringClass;
+            this.value = data;
+            this.isStatic = isStatic;
+            this.declaringClass = declaringClass;
+            this.name = name;
+            this.argumentTypes = argumentTypes;
+            assert resolveJava() != null;
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            if (obj instanceof MethodKey) {
+                MethodKey<?> that = (MethodKey<?>) obj;
+                boolean res = this.name.equals(that.name) && this.declaringClass.equals(that.declaringClass) && Arrays.equals(this.argumentTypes, that.argumentTypes);
+                assert !res || this.isStatic == that.isStatic;
+                return res;
+            }
+            return false;
+        }
+
+        public int getDeclaredParameterCount() {
+            return isStatic ? argumentTypes.length : argumentTypes.length - 1;
+        }
+
+        @Override
+        public int hashCode() {
+            // Replay compilation mandates use of stable hash codes
+            return declaringClass.getName().hashCode() ^ name.hashCode();
+        }
+
+        private MethodIdHolder resolve(MetaAccessProvider metaAccess) {
+            return (MethodIdHolder) metaAccess.lookupJavaMethod(resolveJava());
+        }
+
+        private Executable resolveJava() {
+            try {
+                Executable res;
+                Class<?>[] parameterTypes = isStatic ? argumentTypes : Arrays.copyOfRange(argumentTypes, 1, argumentTypes.length);
+                if (name.equals("<init>")) {
+                    res = declaringClass.getDeclaredConstructor(parameterTypes);
+                } else {
+                    res = declaringClass.getDeclaredMethod(name, parameterTypes);
+                }
+                assert Modifier.isStatic(res.getModifiers()) == isStatic;
+                return res;
+            } catch (NoSuchMethodException | SecurityException e) {
+                throw new InternalError(e);
+            }
+        }
+
+        @Override
+        public String toString() {
+            StringBuilder sb = new StringBuilder(declaringClass.getName()).append('.').append(name).append('(');
+            for (Class<?> p : argumentTypes) {
+                if (sb.charAt(sb.length() - 1) != '(') {
+                    sb.append(", ");
+                }
+                sb.append(p.getSimpleName());
+            }
+            return sb.append(')').toString();
+        }
+    }
+
+    private final MetaAccessProvider metaAccess;
+
+    /**
+     * Initial list of entries.
+     */
+    private final List<MethodKey<V>> registrations;
+
+    /**
+     * Entry array that is initialized upon first call to {@link #get(MethodIdHolder)}.
+     *
+     * Note: this must be volatile since double-checked locking is used to initialize it
+     */
+    private volatile V[] entries;
+
+    /**
+     * The minimum {@linkplain MethodIdHolder#getMethodId() id} for a key in this map.
+     */
+    private int minId = Integer.MAX_VALUE;
+
+    public MethodIdMap(MetaAccessProvider metaAccess) {
+        this.metaAccess = metaAccess;
+        this.registrations = new ArrayList<>(INITIAL_CAPACITY);
+    }
+
+    private static final int INITIAL_CAPACITY = 64;
+
+    /**
+     * Adds an entry to this map for a specified method.
+     *
+     * @param value value to be associated with the specified method
+     * @param isStatic specifies if the method is static
+     * @param declaringClass the class declaring the method
+     * @param name the name of the method
+     * @param argumentTypes the argument types of the method. Element 0 of this array must be
+     *            {@code declaringClass} iff the method is non-static.
+     * @return an object representing the method
+     */
+    public MethodKey<V> put(V value, boolean isStatic, Class<?> declaringClass, String name, Class<?>... argumentTypes) {
+        assert isStatic || argumentTypes[0] == declaringClass;
+        MethodKey<V> methodKey = new MethodKey<>(value, isStatic, declaringClass, name, argumentTypes);
+        assert entries == null : "registration is closed";
+        assert !registrations.contains(methodKey) : "a value is already registered for " + methodKey;
+        registrations.add(methodKey);
+        return methodKey;
+    }
+
+    @SuppressWarnings("unchecked")
+    protected V[] allocateEntries(int length) {
+        return (V[]) new Object[length];
+    }
+
+    /**
+     * Determines if a method denoted by a given {@link MethodKey} is in this map.
+     */
+    public boolean containsKey(MethodKey<V> key) {
+        return registrations.contains(key);
+    }
+
+    public V get(MethodIdHolder method) {
+        if (entries == null) {
+            createEntries();
+        }
+
+        int id = method.getMethodId();
+        int index = id - minId;
+        return index >= 0 && index < entries.length ? entries[index] : null;
+    }
+
+    public void createEntries() {
+        // 'assignIds' synchronizes on a global lock which ensures thread safe
+        // allocation of identifiers across all MethodIdHolder objects
+        MethodIdHolder.assignIds(new Consumer<MethodIdAllocator>() {
+
+            public void accept(MethodIdAllocator idAllocator) {
+                if (entries == null) {
+                    if (registrations.isEmpty()) {
+                        entries = allocateEntries(0);
+                    } else {
+                        int max = Integer.MIN_VALUE;
+                        for (MethodKey<V> methodKey : registrations) {
+                            MethodIdHolder m = methodKey.resolve(metaAccess);
+                            int id = idAllocator.assignId(m);
+                            if (id < minId) {
+                                minId = id;
+                            }
+                            if (id > max) {
+                                max = id;
+                            }
+                            methodKey.id = id;
+                        }
+
+                        int length = (max - minId) + 1;
+                        entries = allocateEntries(length);
+                        for (MethodKey<V> m : registrations) {
+                            int index = m.id - minId;
+                            entries[index] = m.value;
+                        }
+                    }
+                }
+            }
+        });
+    }
+
+    @Override
+    public String toString() {
+        return registrations.stream().map(MethodKey::toString).collect(Collectors.joining(", "));
+    }
+
+    public MetaAccessProvider getMetaAccess() {
+        return metaAccess;
+    }
+
+    public int size() {
+        return registrations.size();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/ModifiersProvider.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,140 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.meta;
+
+import static java.lang.reflect.Modifier.*;
+
+import java.lang.reflect.*;
+
+/**
+ * A Java element (i.e., a class, interface, field or method) that is described by a set of Java
+ * language {@linkplain #getModifiers() modifiers}.
+ */
+public interface ModifiersProvider {
+
+    /**
+     * Returns the Java language modifiers for this element.
+     */
+    int getModifiers();
+
+    /**
+     * @see Modifier#isInterface(int)
+     */
+    default boolean isInterface() {
+        return Modifier.isInterface(getModifiers());
+    }
+
+    /**
+     * @see Modifier#isSynchronized(int)
+     */
+    default boolean isSynchronized() {
+        return Modifier.isSynchronized(getModifiers());
+    }
+
+    /**
+     * @see Modifier#isStatic(int)
+     */
+    default boolean isStatic() {
+        return Modifier.isStatic(getModifiers());
+    }
+
+    /**
+     * @see Modifier#isFinal(int)
+     */
+    default boolean isFinal() {
+        return Modifier.isFinal(getModifiers());
+    }
+
+    /**
+     * @see Modifier#isPublic(int)
+     */
+    default boolean isPublic() {
+        return Modifier.isPublic(getModifiers());
+    }
+
+    /**
+     * Determines if this element is neither {@linkplain #isPublic() public},
+     * {@linkplain #isProtected() protected} nor {@linkplain #isPrivate() private}.
+     */
+    default boolean isPackagePrivate() {
+        return ((PUBLIC | PROTECTED | PRIVATE) & getModifiers()) == 0;
+    }
+
+    /**
+     * @see Modifier#isPrivate(int)
+     */
+    default boolean isPrivate() {
+        return Modifier.isPrivate(getModifiers());
+    }
+
+    /**
+     * @see Modifier#isProtected(int)
+     */
+    default boolean isProtected() {
+        return Modifier.isProtected(getModifiers());
+    }
+
+    /**
+     * @see Modifier#isTransient(int)
+     */
+    default boolean isTransient() {
+        return Modifier.isTransient(getModifiers());
+    }
+
+    /**
+     * @see Modifier#isStrict(int)
+     */
+    default boolean isStrict() {
+        return Modifier.isStrict(getModifiers());
+    }
+
+    /**
+     * @see Modifier#isVolatile(int)
+     */
+    default boolean isVolatile() {
+        return Modifier.isVolatile(getModifiers());
+    }
+
+    /**
+     * @see Modifier#isNative(int)
+     */
+    default boolean isNative() {
+        return Modifier.isNative(getModifiers());
+    }
+
+    /**
+     * @see Modifier#isAbstract(int)
+     */
+    default boolean isAbstract() {
+        return Modifier.isAbstract(getModifiers());
+    }
+
+    /**
+     * Checks that the method is concrete and not abstract.
+     *
+     * @return whether the method is a concrete method
+     */
+    default boolean isConcrete() {
+        return !isAbstract();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/NamedLocationIdentity.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,118 @@
+/*
+ * 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.jvmci.meta;
+
+import java.util.*;
+
+import com.oracle.jvmci.meta.Kind.FormatWithToString;
+
+/**
+ * A {@link LocationIdentity} with a name.
+ */
+public final class NamedLocationIdentity extends LocationIdentity implements FormatWithToString {
+
+    /**
+     * Map for asserting all {@link NamedLocationIdentity} instances have a unique name.
+     */
+    static class DB {
+        private static final HashMap<String, NamedLocationIdentity> map = new HashMap<>();
+
+        static boolean checkUnique(NamedLocationIdentity identity) {
+            NamedLocationIdentity oldValue = map.put(identity.name, identity);
+            if (oldValue != null) {
+                throw new AssertionError("identity " + identity + " already exists");
+            }
+            return true;
+        }
+    }
+
+    private final String name;
+    private final boolean immutable;
+
+    private NamedLocationIdentity(String name, boolean immutable) {
+        this.name = name;
+        this.immutable = immutable;
+    }
+
+    /**
+     * Creates a named unique location identity for read and write operations against mutable
+     * memory.
+     *
+     * @param name the name of the new location identity
+     */
+    public static NamedLocationIdentity mutable(String name) {
+        return create(name, false);
+    }
+
+    /**
+     * Creates a named unique location identity for read operations against immutable memory.
+     * Immutable memory will never have a visible write in the graph, which is more restictive than
+     * Java final.
+     *
+     * @param name the name of the new location identity
+     */
+    public static NamedLocationIdentity immutable(String name) {
+        return create(name, true);
+    }
+
+    /**
+     * Creates a named unique location identity for read and write operations.
+     *
+     * @param name the name of the new location identity
+     * @param immutable true if the location is immutable
+     */
+    private static NamedLocationIdentity create(String name, boolean immutable) {
+        NamedLocationIdentity id = new NamedLocationIdentity(name, immutable);
+        assert DB.checkUnique(id);
+        return id;
+    }
+
+    @Override
+    public boolean isImmutable() {
+        return immutable;
+    }
+
+    @Override
+    public String toString() {
+        return name + (isImmutable() ? ":final" : "");
+    }
+
+    /**
+     * Returns the named location identity for an array of the given element kind. Array accesses of
+     * the same kind must have the same location identity unless an alias analysis guarantees that
+     * two distinct arrays are accessed.
+     */
+    public static LocationIdentity getArrayLocation(Kind elementKind) {
+        return ARRAY_LOCATIONS.get(elementKind);
+    }
+
+    private static final EnumMap<Kind, LocationIdentity> ARRAY_LOCATIONS = initArrayLocations();
+
+    private static EnumMap<Kind, LocationIdentity> initArrayLocations() {
+        EnumMap<Kind, LocationIdentity> result = new EnumMap<>(Kind.class);
+        for (Kind kind : Kind.values()) {
+            result.put(kind, NamedLocationIdentity.mutable("Array: " + kind.getJavaName()));
+        }
+        return result;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/NullConstant.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.meta;
+
+/**
+ * The implementation type of the {@link JavaConstant#NULL_POINTER null constant}.
+ */
+final class NullConstant extends AbstractValue implements JavaConstant {
+
+    protected NullConstant() {
+        super(LIRKind.reference(Kind.Object));
+    }
+
+    @Override
+    public boolean isNull() {
+        return true;
+    }
+
+    @Override
+    public boolean isDefaultForKind() {
+        return true;
+    }
+
+    @Override
+    public Object asBoxedPrimitive() {
+        throw new IllegalArgumentException();
+    }
+
+    @Override
+    public int asInt() {
+        throw new IllegalArgumentException();
+    }
+
+    @Override
+    public boolean asBoolean() {
+        throw new IllegalArgumentException();
+    }
+
+    @Override
+    public long asLong() {
+        throw new IllegalArgumentException();
+    }
+
+    @Override
+    public float asFloat() {
+        throw new IllegalArgumentException();
+    }
+
+    @Override
+    public double asDouble() {
+        throw new IllegalArgumentException();
+    }
+
+    @Override
+    public String toString() {
+        return JavaConstant.toString(this);
+    }
+
+    @Override
+    public String toValueString() {
+        return "null";
+    }
+
+    @Override
+    public int hashCode() {
+        return 13;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        return o instanceof NullConstant;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/PlatformKind.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.meta;
+
+/**
+ * Represents a platform-specific low-level type for values.
+ */
+public interface PlatformKind {
+
+    String name();
+
+    JavaConstant getDefaultValue();
+
+    public interface Key {
+
+    }
+
+    public class EnumKey implements Key {
+        @SuppressWarnings("rawtypes") private final Enum e;
+
+        @SuppressWarnings("rawtypes")
+        public EnumKey(Enum e) {
+            this.e = e;
+        }
+
+        @Override
+        public int hashCode() {
+            return e.ordinal() ^ e.name().hashCode();
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            if (obj == this) {
+                return true;
+            }
+            if (obj instanceof EnumKey) {
+                EnumKey that = (EnumKey) obj;
+                return this.e == that.e;
+            }
+            return false;
+        }
+    }
+
+    /**
+     * Gets a value associated with this object that can be used as a stable key in a map. The
+     * {@link Object#hashCode()} implementation of the returned value should be stable between VM
+     * executions.
+     */
+    Key getKey();
+
+    default int getVectorLength() {
+        return 1;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/PrimitiveConstant.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,164 @@
+/*
+ * Copyright (c) 2009, 2015, 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.jvmci.meta;
+
+import java.nio.*;
+
+/**
+ * Represents a primitive constant value, such as an integer or floating point number, within the
+ * compiler and across the compiler/runtime interface.
+ */
+public class PrimitiveConstant extends AbstractValue implements JavaConstant, SerializableConstant {
+
+    /**
+     * The boxed primitive value as a {@code long}. For {@code float} and {@code double} values,
+     * this value is the result of {@link Float#floatToRawIntBits(float)} and
+     * {@link Double#doubleToRawLongBits(double)} respectively.
+     */
+    private final long primitive;
+
+    protected PrimitiveConstant(Kind kind, long primitive) {
+        super(LIRKind.value(kind));
+        this.primitive = primitive;
+
+        assert kind.isPrimitive() || kind == Kind.Illegal;
+    }
+
+    @Override
+    public boolean isNull() {
+        return false;
+    }
+
+    @Override
+    public boolean isDefaultForKind() {
+        return primitive == 0;
+    }
+
+    @Override
+    public boolean asBoolean() {
+        assert getKind() == Kind.Boolean;
+        return primitive != 0L;
+    }
+
+    @Override
+    public int asInt() {
+        assert getKind().getStackKind() == Kind.Int : getKind().getStackKind();
+        return (int) primitive;
+    }
+
+    @Override
+    public long asLong() {
+        assert getKind().isNumericInteger();
+        return primitive;
+    }
+
+    @Override
+    public float asFloat() {
+        assert getKind() == Kind.Float;
+        return Float.intBitsToFloat((int) primitive);
+    }
+
+    @Override
+    public double asDouble() {
+        assert getKind() == Kind.Double;
+        return Double.longBitsToDouble(primitive);
+    }
+
+    @Override
+    public Object asBoxedPrimitive() {
+        switch (getKind()) {
+            case Byte:
+                return Byte.valueOf((byte) primitive);
+            case Boolean:
+                return Boolean.valueOf(asBoolean());
+            case Short:
+                return Short.valueOf((short) primitive);
+            case Char:
+                return Character.valueOf((char) primitive);
+            case Int:
+                return Integer.valueOf(asInt());
+            case Long:
+                return Long.valueOf(asLong());
+            case Float:
+                return Float.valueOf(asFloat());
+            case Double:
+                return Double.valueOf(asDouble());
+            default:
+                throw new IllegalArgumentException("unexpected kind " + getKind());
+        }
+    }
+
+    @Override
+    public int getSerializedSize() {
+        return getKind().getByteCount();
+    }
+
+    @Override
+    public void serialize(ByteBuffer buffer) {
+        switch (getKind()) {
+            case Byte:
+            case Boolean:
+                buffer.put((byte) primitive);
+                break;
+            case Short:
+                buffer.putShort((short) primitive);
+                break;
+            case Char:
+                buffer.putChar((char) primitive);
+                break;
+            case Int:
+                buffer.putInt(asInt());
+                break;
+            case Long:
+                buffer.putLong(asLong());
+                break;
+            case Float:
+                buffer.putFloat(asFloat());
+                break;
+            case Double:
+                buffer.putDouble(asDouble());
+                break;
+            default:
+                throw new IllegalArgumentException("unexpected kind " + getKind());
+        }
+    }
+
+    @Override
+    public int hashCode() {
+        return (int) (primitive ^ (primitive >>> 32)) * (getKind().ordinal() + 31);
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        return o == this || (o instanceof PrimitiveConstant && super.equals(o) && primitive == ((PrimitiveConstant) o).primitive);
+    }
+
+    @Override
+    public String toString() {
+        if (getKind() == Kind.Illegal) {
+            return "illegal";
+        } else {
+            return getKind().getJavaName() + "[" + asBoxedPrimitive() + "|0x" + Long.toHexString(primitive) + "]";
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/ProfilingInfo.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,199 @@
+/*
+ * 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.jvmci.meta;
+
+/**
+ * Provides access to the profiling information of one specific method. Every accessor method
+ * returns the information that is available at the time of invocation. If a method is invoked
+ * multiple times, it may return significantly different results for every invocation as the
+ * profiling information may be changed by other Java threads at any time.
+ */
+public interface ProfilingInfo {
+
+    /**
+     * Returns the length of the bytecodes associated with this profile.
+     */
+    int getCodeSize();
+
+    /**
+     * Returns an estimate of how often the branch at the given byte code was taken.
+     *
+     * @return The estimated probability, with 0.0 meaning never and 1.0 meaning always, or -1 if
+     *         this information is not available.
+     */
+    double getBranchTakenProbability(int bci);
+
+    /**
+     * Returns an estimate of how often the switch cases are taken at the given BCI. The default
+     * case is stored as the last entry.
+     *
+     * @return A double value that contains the estimated probabilities, with 0.0 meaning never and
+     *         1.0 meaning always, or -1 if this information is not available.
+     */
+    double[] getSwitchProbabilities(int bci);
+
+    /**
+     * Returns the TypeProfile for the given BCI.
+     *
+     * @return Returns a JavaTypeProfile object, or null if not available.
+     */
+    JavaTypeProfile getTypeProfile(int bci);
+
+    /**
+     * Returns the MethodProfile for the given BCI.
+     *
+     * @return Returns a JavaMethodProfile object, or null if not available.
+     */
+    JavaMethodProfile getMethodProfile(int bci);
+
+    /**
+     * Returns information if the given BCI did ever throw an exception.
+     *
+     * @return {@link TriState#TRUE} if the instruction has thrown an exception at least once,
+     *         {@link TriState#FALSE} if it never threw an exception, and {@link TriState#UNKNOWN}
+     *         if this information was not recorded.
+     */
+    TriState getExceptionSeen(int bci);
+
+    /**
+     * Returns information if null was ever seen for the given BCI. This information is collected
+     * for the aastore, checkcast and instanceof bytecodes.
+     *
+     * @return {@link TriState#TRUE} if null was seen for the instruction, {@link TriState#FALSE} if
+     *         null was NOT seen, and {@link TriState#UNKNOWN} if this information was not recorded.
+     */
+    TriState getNullSeen(int bci);
+
+    /**
+     * Returns an estimate how often the current BCI was executed. Avoid comparing execution counts
+     * to each other, as the returned value highly depends on the time of invocation.
+     *
+     * @return the estimated execution count or -1 if not available.
+     */
+    int getExecutionCount(int bci);
+
+    /**
+     * Returns how frequently a method was deoptimized for the given deoptimization reason. This
+     * only indicates how often the method did fall back to the interpreter for the execution and
+     * does not indicate how often it was recompiled.
+     *
+     * @param reason the reason for which the number of deoptimizations should be queried
+     * @return the number of times the compiled method deoptimized for the given reason.
+     */
+    int getDeoptimizationCount(DeoptimizationReason reason);
+
+    /**
+     * Records the size of the compiler intermediate representation (IR) associated with this
+     * method.
+     *
+     * @param irType the IR type for which the size is being recorded
+     * @param irSize the IR size to be recorded. The unit depends on the IR.
+     * @return whether recording this information for {@code irType} is supported
+     */
+    boolean setCompilerIRSize(Class<?> irType, int irSize);
+
+    /**
+     * Gets the size of the compiler intermediate representation (IR) associated with this method
+     * last recorded by {@link #setCompilerIRSize(Class, int)}.
+     *
+     * @param irType the IR type for which the size is being requested
+     * @return the requested IR size or -1 if it is unavailable for {@code irType}
+     */
+    int getCompilerIRSize(Class<?> irType);
+
+    /**
+     * Returns true if the profiling information can be assumed as sufficiently accurate.
+     *
+     * @return true if the profiling information was recorded often enough mature enough, false
+     *         otherwise.
+     */
+    boolean isMature();
+
+    /**
+     * Force data to be treated as mature if possible.
+     */
+    void setMature();
+
+    /**
+     * Formats this profiling information to a string.
+     *
+     * @param method an optional method that augments the profile string returned
+     * @param sep the separator to use for each separate profile record
+     */
+    default String toString(ResolvedJavaMethod method, String sep) {
+        StringBuilder buf = new StringBuilder(100);
+        if (method != null) {
+            buf.append(String.format("canBeStaticallyBound: %b%s", method.canBeStaticallyBound(), sep));
+        }
+        for (int i = 0; i < getCodeSize(); i++) {
+            if (getExecutionCount(i) != -1) {
+                buf.append(String.format("executionCount@%d: %d%s", i, getExecutionCount(i), sep));
+            }
+
+            if (getBranchTakenProbability(i) != -1) {
+                buf.append(String.format("branchProbability@%d: %.6f%s", i, getBranchTakenProbability(i), sep));
+            }
+
+            double[] switchProbabilities = getSwitchProbabilities(i);
+            if (switchProbabilities != null) {
+                buf.append(String.format("switchProbabilities@%d:", i));
+                for (int j = 0; j < switchProbabilities.length; j++) {
+                    buf.append(String.format(" %.6f", switchProbabilities[j]));
+                }
+                buf.append(sep);
+            }
+
+            if (getExceptionSeen(i) != TriState.UNKNOWN) {
+                buf.append(String.format("exceptionSeen@%d: %s%s", i, getExceptionSeen(i).name(), sep));
+            }
+
+            if (getNullSeen(i) != TriState.UNKNOWN) {
+                buf.append(String.format("nullSeen@%d: %s%s", i, getNullSeen(i).name(), sep));
+            }
+
+            JavaTypeProfile typeProfile = getTypeProfile(i);
+            MetaUtil.appendProfile(buf, typeProfile, i, "types", sep);
+
+            JavaMethodProfile methodProfile = getMethodProfile(i);
+            MetaUtil.appendProfile(buf, methodProfile, i, "methods", sep);
+        }
+
+        boolean firstDeoptReason = true;
+        for (DeoptimizationReason reason : DeoptimizationReason.values()) {
+            int count = 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();
+        return s.substring(0, s.length() - sep.length());
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/RawConstant.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.meta;
+
+public class RawConstant extends PrimitiveConstant {
+
+    public RawConstant(long rawValue) {
+        super(Kind.Int, rawValue);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/ResolvedJavaField.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.meta;
+
+import java.lang.annotation.*;
+import java.lang.reflect.*;
+
+/**
+ * Represents a reference to a resolved Java field. Fields, like methods and types, are resolved
+ * through {@link ConstantPool constant pools}.
+ */
+public interface ResolvedJavaField extends JavaField, ModifiersProvider {
+
+    /**
+     * {@inheritDoc}
+     * <p>
+     * Only the {@linkplain Modifier#fieldModifiers() field flags} specified in the JVM
+     * specification will be included in the returned mask.
+     */
+    int getModifiers();
+
+    /**
+     * Determines if this field was injected by the VM. Such a field, for example, is not derived
+     * from a class file.
+     */
+    boolean isInternal();
+
+    /**
+     * Determines if this field is a synthetic field as defined by the Java Language Specification.
+     */
+    boolean isSynthetic();
+
+    /**
+     * Returns the {@link ResolvedJavaType} object representing the class or interface that declares
+     * this field.
+     */
+    ResolvedJavaType getDeclaringClass();
+
+    /**
+     * Returns the annotation for the specified type of this field, if such an annotation is
+     * present.
+     *
+     * @param annotationClass the Class object corresponding to the annotation type
+     * @return this element's annotation for the specified annotation type if present on this field,
+     *         else {@code null}
+     */
+    <T extends Annotation> T getAnnotation(Class<T> annotationClass);
+
+    /**
+     * Returns an object representing the unique location identity of this resolved Java field.
+     * 
+     * @return the location identity of the field
+     */
+    LocationIdentity getLocationIdentity();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/ResolvedJavaMethod.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,298 @@
+/*
+ * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.meta;
+
+import java.lang.annotation.*;
+import java.lang.reflect.*;
+
+/**
+ * Represents a resolved Java method. Methods, like fields and types, are resolved through
+ * {@link ConstantPool constant pools}.
+ */
+public interface ResolvedJavaMethod extends JavaMethod, InvokeTarget, ModifiersProvider {
+
+    /**
+     * Returns the bytecode of this method, if the method has code. The returned byte array does not
+     * contain breakpoints or non-Java bytecodes. This may return null if the
+     * {@link #getDeclaringClass() holder} is not {@link ResolvedJavaType#isLinked() linked}.
+     *
+     * The contained constant pool indices may not be the ones found in the original class file but
+     * they can be used with the Graal API (e.g. methods in {@link ConstantPool}).
+     *
+     * @return the bytecode of the method, or {@code null} if {@code getCodeSize() == 0} or if the
+     *         code is not ready.
+     */
+    byte[] getCode();
+
+    /**
+     * Returns the size of the bytecode of this method, if the method has code. This is equivalent
+     * to {@link #getCode()}. {@code length} if the method has code.
+     *
+     * @return the size of the bytecode in bytes, or 0 if no bytecode is available
+     */
+    int getCodeSize();
+
+    /**
+     * Returns the {@link ResolvedJavaType} object representing the class or interface that declares
+     * this method.
+     */
+    ResolvedJavaType getDeclaringClass();
+
+    /**
+     * Returns the maximum number of locals used in this method's bytecodes.
+     */
+    int getMaxLocals();
+
+    /**
+     * Returns the maximum number of stack slots used in this method's bytecodes.
+     */
+    int getMaxStackSize();
+
+    /**
+     * {@inheritDoc}
+     * <p>
+     * Only the {@linkplain Modifier#methodModifiers() method flags} specified in the JVM
+     * specification will be included in the returned mask.
+     */
+    int getModifiers();
+
+    /**
+     * Determines if this method is a synthetic method as defined by the Java Language
+     * Specification.
+     */
+    boolean isSynthetic();
+
+    /**
+     * Returns {@code true} if this method is a default method; returns {@code false} otherwise.
+     *
+     * A default method is a public non-abstract instance method, that is, a non-static method with
+     * a body, declared in an interface type.
+     *
+     * @return true if and only if this method is a default method as defined by the Java Language
+     *         Specification.
+     */
+    boolean isDefault();
+
+    /**
+     * Checks whether this method is a class initializer.
+     *
+     * @return {@code true} if the method is a class initializer
+     */
+    boolean isClassInitializer();
+
+    /**
+     * Checks whether this method is a constructor.
+     *
+     * @return {@code true} if the method is a constructor
+     */
+    boolean isConstructor();
+
+    /**
+     * Checks whether this method can be statically bound (usually, that means it is final or
+     * private or static, but not abstract, or the declaring class is final).
+     *
+     * @return {@code true} if this method can be statically bound
+     */
+    boolean canBeStaticallyBound();
+
+    /**
+     * Returns the list of exception handlers for this method.
+     */
+    ExceptionHandler[] getExceptionHandlers();
+
+    /**
+     * Returns a stack trace element for this method and a given bytecode index.
+     */
+    StackTraceElement asStackTraceElement(int bci);
+
+    /**
+     * Returns an object that provides access to the profiling information recorded for this method.
+     */
+    ProfilingInfo getProfilingInfo();
+
+    /**
+     * Invalidates the profiling information and restarts profiling upon the next invocation.
+     */
+    void reprofile();
+
+    /**
+     * Returns the constant pool of this method.
+     */
+    ConstantPool getConstantPool();
+
+    /**
+     * Returns all annotations of this method. If no annotations are present, an array of length 0
+     * is returned.
+     */
+    Annotation[] getAnnotations();
+
+    /**
+     * Returns the annotation for the specified type of this method, if such an annotation is
+     * present.
+     *
+     * @param annotationClass the Class object corresponding to the annotation type
+     * @return this element's annotation for the specified annotation type if present on this
+     *         method, else {@code null}
+     */
+    <T extends Annotation> T getAnnotation(Class<T> annotationClass);
+
+    /**
+     * Returns an array of arrays that represent the annotations on the formal parameters, in
+     * declaration order, of this method.
+     *
+     * @see Method#getParameterAnnotations()
+     */
+    Annotation[][] getParameterAnnotations();
+
+    /**
+     * Returns an array of {@link Type} objects that represent the formal parameter types, in
+     * declaration order, of this method.
+     *
+     * @see Method#getGenericParameterTypes()
+     */
+    Type[] getGenericParameterTypes();
+
+    /**
+     * Returns {@code true} if this method is not excluded from inlining and has associated Java
+     * bytecodes (@see {@link ResolvedJavaMethod#hasBytecodes()}).
+     */
+    boolean canBeInlined();
+
+    /**
+     * Returns {@code true} if the inlining of this method should be forced.
+     */
+    boolean shouldBeInlined();
+
+    /**
+     * Returns the LineNumberTable of this method or null if this method does not have a line
+     * numbers table.
+     */
+    LineNumberTable getLineNumberTable();
+
+    /**
+     * Returns the local variable table of this method or null if this method does not have a local
+     * variable table.
+     */
+    LocalVariableTable getLocalVariableTable();
+
+    /**
+     * Invokes the underlying method represented by this object, on the specified object with the
+     * specified parameters. This method is similar to a reflective method invocation by
+     * {@link Method#invoke}.
+     *
+     * @param receiver The receiver for the invocation, or {@code null} if it is a static method.
+     * @param arguments The arguments for the invocation.
+     * @return The value returned by the method invocation, or {@code null} if the return type is
+     *         {@code void}.
+     */
+    JavaConstant invoke(JavaConstant receiver, JavaConstant[] arguments);
+
+    /**
+     * Gets the encoding of (that is, a constant representing the value of) this method.
+     *
+     * @return a constant representing a reference to this method
+     */
+    Constant getEncoding();
+
+    /**
+     * Checks if this method is present in the virtual table for subtypes of the specified
+     * {@linkplain ResolvedJavaType type}.
+     *
+     * @return true is this method is present in the virtual table for subtypes of this type.
+     */
+    boolean isInVirtualMethodTable(ResolvedJavaType resolved);
+
+    /**
+     * Gets the annotation of a particular type for a formal parameter of this method.
+     *
+     * @param annotationClass the Class object corresponding to the annotation type
+     * @param parameterIndex the index of a formal parameter of {@code method}
+     * @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
+     */
+    default <T extends Annotation> T getParameterAnnotation(Class<T> annotationClass, int parameterIndex) {
+        if (parameterIndex >= 0) {
+            Annotation[][] parameterAnnotations = getParameterAnnotations();
+            for (Annotation a : parameterAnnotations[parameterIndex]) {
+                if (a.annotationType() == annotationClass) {
+                    return annotationClass.cast(a);
+                }
+            }
+        }
+        return null;
+    }
+
+    default JavaType[] toParameterTypes() {
+        JavaType receiver = isStatic() || isConstructor() ? null : getDeclaringClass();
+        return getSignature().toParameterTypes(receiver);
+    }
+
+    /**
+     * Gets the annotations of a particular type for the formal parameters of this method.
+     *
+     * @param annotationClass the Class object corresponding to the annotation type
+     * @return the annotation of type {@code annotationClass} (if any) for each formal parameter
+     *         present
+     */
+    @SuppressWarnings("unchecked")
+    default <T extends Annotation> T[] getParameterAnnotations(Class<T> annotationClass) {
+        Annotation[][] parameterAnnotations = getParameterAnnotations();
+        T[] result = (T[]) Array.newInstance(annotationClass, parameterAnnotations.length);
+        for (int i = 0; i < parameterAnnotations.length; i++) {
+            for (Annotation a : parameterAnnotations[i]) {
+                if (a.annotationType() == annotationClass) {
+                    result[i] = annotationClass.cast(a);
+                }
+            }
+        }
+        return result;
+    }
+
+    /**
+     * Checks whether the method has bytecodes associated with it. Methods without bytecodes are
+     * either abstract or native methods.
+     *
+     * @return whether the definition of this method is Java bytecodes
+     */
+    default boolean hasBytecodes() {
+        return isConcrete() && !isNative();
+    }
+
+    /**
+     * Checks whether the method has a receiver parameter - i.e., whether it is not static.
+     *
+     * @return whether the method has a receiver parameter
+     */
+    default boolean hasReceiver() {
+        return !isStatic();
+    }
+
+    /**
+     * Determines if this method is {@link java.lang.Object#Object()}.
+     */
+    default boolean isJavaLangObjectInit() {
+        return getDeclaringClass().isJavaLangObject() && getName().equals("<init>");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/ResolvedJavaType.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,354 @@
+/*
+ * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.meta;
+
+import java.lang.annotation.*;
+import java.net.*;
+
+import com.oracle.jvmci.meta.Assumptions.AssumptionResult;
+
+/**
+ * Represents a resolved Java type. Types include primitives, objects, {@code void}, and arrays
+ * thereof. Types, like fields and methods, are resolved through {@link ConstantPool constant pools}
+ * .
+ */
+public interface ResolvedJavaType extends JavaType, ModifiersProvider {
+
+    /**
+     * Gets the runtime representation of the Java class object of this type.
+     */
+    JavaConstant getJavaClass();
+
+    /**
+     * Gets the runtime representation of the "hub" of this type--that is, the closest part of the
+     * type representation which is typically stored in the object header.
+     */
+    Constant getObjectHub();
+
+    /**
+     * Checks whether this type has a finalizer method.
+     *
+     * @return {@code true} if this class has a finalizer
+     */
+    boolean hasFinalizer();
+
+    /**
+     * Checks whether this type has any finalizable subclasses so far. Any decisions based on this
+     * information require the registration of a dependency, since this information may change.
+     *
+     * @return {@code true} if this class has any subclasses with finalizers
+     */
+    AssumptionResult<Boolean> hasFinalizableSubclass();
+
+    /**
+     * Checks whether this type is an interface.
+     *
+     * @return {@code true} if this type is an interface
+     */
+    boolean isInterface();
+
+    /**
+     * Checks whether this type is an instance class.
+     *
+     * @return {@code true} if this type is an instance class
+     */
+    boolean isInstanceClass();
+
+    /**
+     * Checks whether this type is an array class.
+     *
+     * @return {@code true} if this type is an array class
+     */
+    boolean isArray();
+
+    /**
+     * Checks whether this type is primitive.
+     *
+     * @return {@code true} if this type is primitive
+     */
+    boolean isPrimitive();
+
+    /**
+     * {@inheritDoc}
+     * <p>
+     * Only the flags specified in the JVM specification will be included in the returned mask. This
+     * method is identical to {@link Class#getModifiers()} in terms of the value return for this
+     * type.
+     */
+    int getModifiers();
+
+    /**
+     * Checks whether this type is initialized. If a type is initialized it implies that it was
+     * {@link #isLinked() linked} and that the static initializer has run.
+     *
+     * @return {@code true} if this type is initialized
+     */
+    boolean isInitialized();
+
+    /**
+     * Initializes this type.
+     */
+    void initialize();
+
+    /**
+     * Checks whether this type is linked and verified. When a type is linked the static initializer
+     * has not necessarily run. An {@link #isInitialized() initialized} type is always linked.
+     *
+     * @return {@code true} if this type is linked
+     */
+    boolean isLinked();
+
+    /**
+     * Determines if this type is either the same as, or is a superclass or superinterface of, the
+     * type represented by the specified parameter. This method is identical to
+     * {@link Class#isAssignableFrom(Class)} in terms of the value return for this type.
+     */
+    boolean isAssignableFrom(ResolvedJavaType other);
+
+    /**
+     * Returns true if this type is exactly the type {@link java.lang.Object}.
+     */
+    default boolean isJavaLangObject() {
+        // Removed assertion due to https://bugs.eclipse.org/bugs/show_bug.cgi?id=434442
+        return getSuperclass() == null && !isInterface() && getKind() == Kind.Object;
+    }
+
+    /**
+     * Checks whether the specified object is an instance of this type.
+     *
+     * @param obj the object to test
+     * @return {@code true} if the object is an instance of this type
+     */
+    boolean isInstance(JavaConstant obj);
+
+    /**
+     * Returns this type if it is an exact type otherwise returns null. This type is exact if it is
+     * void, primitive, final, or an array of a final or primitive type.
+     *
+     * @return this type if it is exact; {@code null} otherwise
+     */
+    ResolvedJavaType asExactType();
+
+    /**
+     * Gets the super class of this type. If this type represents either the {@code Object} class,
+     * an interface, a primitive type, or void, then null is returned. If this object represents an
+     * array class then the type object representing the {@code Object} class is returned.
+     */
+    ResolvedJavaType getSuperclass();
+
+    /**
+     * Gets the interfaces implemented or extended by this type. This method is analogous to
+     * {@link Class#getInterfaces()} and as such, only returns the interfaces directly implemented
+     * or extended by this type.
+     */
+    ResolvedJavaType[] getInterfaces();
+
+    /**
+     * Gets the single implementor of this type. Calling this method on a non-interface type causes
+     * an exception.
+     * <p>
+     * If the compiler uses the result of this method for its compilation, the usage must be guarded
+     * because the verifier can not guarantee that the assigned type really implements this
+     * interface. Additionally, class loading can invalidate the result of this method.
+     *
+     * @return {@code null} if there is no implementor, the implementor if there is only one, or
+     *         {@code this} if there are more than one.
+     */
+    ResolvedJavaType getSingleImplementor();
+
+    /**
+     * Walks the class hierarchy upwards and returns the least common class that is a superclass of
+     * both the current and the given type.
+     *
+     * @return the least common type that is a super type of both the current and the given type, or
+     *         {@code null} if primitive types are involved.
+     */
+    ResolvedJavaType findLeastCommonAncestor(ResolvedJavaType otherType);
+
+    /**
+     * Attempts to get a leaf concrete subclass of this type.
+     * <p>
+     * For an {@linkplain #isArray() array} type A, the leaf concrete subclass is A if the
+     * {@linkplain #getElementalType() elemental} type of A is final (which includes primitive
+     * types). Otherwise {@code null} is returned for A.
+     * <p>
+     * For a non-array type T, the result is the leaf concrete type in the current hierarchy of T.
+     * <p>
+     * A runtime may decide not to manage or walk a large hierarchy and so the result is
+     * conservative. That is, a non-null result is guaranteed to be the leaf concrete class in T's
+     * hierarchy <b>at the current point in time</b> but a null result does not necessarily imply
+     * that there is no leaf concrete class in T's hierarchy.
+     * <p>
+     * If the compiler uses the result of this method for its compilation, it must register the
+     * {@link AssumptionResult} in its {@link Assumptions} because dynamic class loading can
+     * invalidate the result of this method.
+     *
+     * @return an {@link AssumptionResult} containing the leaf concrete subclass for this type as
+     *         described above
+     */
+    AssumptionResult<ResolvedJavaType> findLeafConcreteSubtype();
+
+    ResolvedJavaType getComponentType();
+
+    default ResolvedJavaType getElementalType() {
+        ResolvedJavaType t = this;
+        while (t.isArray()) {
+            t = t.getComponentType();
+        }
+        return t;
+    }
+
+    ResolvedJavaType getArrayClass();
+
+    /**
+     * Resolves the method implementation for virtual dispatches on objects of this dynamic type.
+     * This resolution process only searches "up" the class hierarchy of this type.
+     *
+     * @param method the method to select the implementation of
+     * @param callerType the caller or context type used to perform access checks
+     * @param includeAbstract whether abstract methods should be returned. If it is {@code false}
+     *            this method behaves like {@link #resolveConcreteMethod}. This is just a temporary
+     *            parameter to highlight the changed semantics of this method. TODO (je) remove this
+     *            flag.
+     * @return the link-time resolved method (might be abstract) or {@code null} if it can not be
+     *         linked
+     */
+    ResolvedJavaMethod resolveMethod(ResolvedJavaMethod method, ResolvedJavaType callerType, boolean includeAbstract);
+
+    /**
+     * Resolves the method implementation for virtual dispatches on objects of this dynamic type.
+     * This resolution process only searches "up" the class hierarchy of this type. A broader search
+     * that also walks "down" the hierarchy is implemented by
+     * {@link #findUniqueConcreteMethod(ResolvedJavaMethod)}.
+     *
+     * @param method the method to select the implementation of
+     * @param callerType the caller or context type used to perform access checks
+     * @return the concrete method that would be selected at runtime, or {@code null} if there is no
+     *         concrete implementation of {@code method} in this type or any of its superclasses
+     */
+    ResolvedJavaMethod resolveConcreteMethod(ResolvedJavaMethod method, ResolvedJavaType callerType);
+
+    /**
+     * Given a {@link ResolvedJavaMethod} A, returns a concrete {@link ResolvedJavaMethod} B that is
+     * the only possible unique target for a virtual call on A(). Returns {@code null} if either no
+     * such concrete method or more than one such method exists. Returns the method A if A is a
+     * concrete method that is not overridden.
+     * <p>
+     * If the compiler uses the result of this method for its compilation, it must register an
+     * assumption because dynamic class loading can invalidate the result of this method.
+     *
+     * @param method the method A for which a unique concrete target is searched
+     * @return the unique concrete target or {@code null} if no such target exists or assumptions
+     *         are not supported by this runtime
+     */
+    AssumptionResult<ResolvedJavaMethod> findUniqueConcreteMethod(ResolvedJavaMethod method);
+
+    /**
+     * Returns the instance fields of this class, including
+     * {@linkplain ResolvedJavaField#isInternal() internal} fields. A zero-length array is returned
+     * for array and primitive types. The order of fields returned by this method is stable. That
+     * is, for a single JVM execution the same order is returned each time this method is called. It
+     * is also the "natural" order, which means that the JVM would expect the fields in this order
+     * if no specific order is given.
+     *
+     * @param includeSuperclasses if true, then instance fields for the complete hierarchy of this
+     *            type are included in the result
+     * @return an array of instance fields
+     */
+    ResolvedJavaField[] getInstanceFields(boolean includeSuperclasses);
+
+    /**
+     * Returns the static fields of this class, including
+     * {@linkplain ResolvedJavaField#isInternal() internal} fields. A zero-length array is returned
+     * for array and primitive types. The order of fields returned by this method is stable. That
+     * is, for a single JVM execution the same order is returned each time this method is called.
+     */
+    ResolvedJavaField[] getStaticFields();
+
+    /**
+     * Returns the annotation for the specified type of this class, if such an annotation is
+     * present.
+     *
+     * @param annotationClass the Class object corresponding to the annotation type
+     * @return this element's annotation for the specified annotation type if present on this class,
+     *         else {@code null}
+     */
+    <T extends Annotation> T getAnnotation(Class<T> annotationClass);
+
+    /**
+     * Returns the instance field of this class (or one of its super classes) at the given offset,
+     * or {@code null} if there is no such field.
+     *
+     * @param offset the offset of the field to look for
+     * @return the field with the given offset, or {@code null} if there is no such field.
+     */
+    ResolvedJavaField findInstanceFieldWithOffset(long offset, Kind expectedKind);
+
+    /**
+     * Returns name of source file of this type.
+     */
+    String getSourceFileName();
+
+    /**
+     * Returns the class file path - if available - of this type, or {@code null}.
+     */
+    URL getClassFilePath();
+
+    /**
+     * Returns {@code true} if the type is a local type.
+     */
+    boolean isLocal();
+
+    /**
+     * Returns {@code true} if the type is a member type.
+     */
+    boolean isMember();
+
+    /**
+     * Returns the enclosing type of this type, if it exists, or {@code null}.
+     */
+    ResolvedJavaType getEnclosingType();
+
+    /**
+     * Returns an array reflecting all the constructors declared by this type. This method is
+     * similar to {@link Class#getDeclaredConstructors()} in terms of returned constructors.
+     */
+    ResolvedJavaMethod[] getDeclaredConstructors();
+
+    /**
+     * Returns an array reflecting all the methods declared by this type. This method is similar to
+     * {@link Class#getDeclaredMethods()} in terms of returned methods.
+     */
+    ResolvedJavaMethod[] getDeclaredMethods();
+
+    /**
+     * Returns the {@code <clinit>} method for this class if there is one.
+     */
+    ResolvedJavaMethod getClassInitializer();
+
+    /**
+     * Returns true if this type represents an interface and it should be trusted even in places
+     * where the JVM verifier would not give any guarantees other than {@link Object}.
+     */
+    boolean isTrustedInterfaceType();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/SerializableConstant.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2014, 2015, 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.jvmci.meta;
+
+import java.nio.*;
+
+/**
+ * Represents a compile-time constant that can be converted to a byte array.
+ */
+public interface SerializableConstant extends Constant {
+
+    /**
+     * Return the size in bytes of the serialized representation of this constant.
+     */
+    int getSerializedSize();
+
+    /**
+     * Serialize the constant into the ByteBuffer. There must be at least
+     * {@link #getSerializedSize()} bytes available capacity in the buffer.
+     */
+    void serialize(ByteBuffer buffer);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/Signature.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,139 @@
+/*
+ * 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.jvmci.meta;
+
+/**
+ * Represents a method signature provided by the runtime.
+ *
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.3.3">Method
+ *      Descriptors</a>
+ */
+public interface Signature {
+
+    /**
+     * Returns the number of parameters in this signature, adding 1 for a receiver if requested.
+     *
+     * @param receiver true if 1 is to be added to the result for a receiver
+     * @return the number of parameters; + 1 iff {@code receiver == true}
+     */
+    int getParameterCount(boolean receiver);
+
+    /**
+     * Gets the parameter type at the specified position.
+     *
+     * @param index the index into the parameters, with {@code 0} indicating the first parameter
+     * @param accessingClass the context of the type lookup. If non-null, its class loader is used
+     *            for resolving the type. If {@code null}, then the type returned is either
+     *            unresolved or a resolved type whose resolution is context free (e.g., a primitive
+     *            type or a type in a java.* package).
+     * @return the {@code index}'th parameter type
+     * @throws LinkageError if {@code accessingClass != null} and resolution fails
+     *
+     */
+    JavaType getParameterType(int index, ResolvedJavaType accessingClass);
+
+    /**
+     * Gets the parameter kind at the specified position. This is the same as calling
+     * {@link #getParameterType}. {@link JavaType#getKind getKind}.
+     *
+     * @param index the index into the parameters, with {@code 0} indicating the first parameter
+     * @return the kind of the parameter at the specified position
+     */
+    default Kind getParameterKind(int index) {
+        return getParameterType(index, null).getKind();
+    }
+
+    /**
+     * Gets the return type of this signature.
+     *
+     * @param accessingClass the context of the type lookup. If non-null, its class loader is used
+     *            for resolving the type. If {@code null}, then the type returned is either
+     *            unresolved or a resolved type whose resolution is context free (e.g., a primitive
+     *            type or a type in a java.* package).
+     * @return the return type
+     * @throws LinkageError if {@code accessingClass != null} and resolution fails
+     */
+    JavaType getReturnType(ResolvedJavaType accessingClass);
+
+    /**
+     * Gets the return kind of this signature. This is the same as calling {@link #getReturnType}.
+     * {@link JavaType#getKind getKind}.
+     */
+    default Kind getReturnKind() {
+        return getReturnType(null).getKind();
+    }
+
+    /**
+     * Gets the <a
+     * href="http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.3.3">method
+     * descriptor</a> corresponding to this signature. For example:
+     *
+     * <pre>
+     * (ILjava/lang/String;D)V
+     * </pre>
+     *
+     * @return the signature as a string
+     */
+    default String toMethodDescriptor() {
+        StringBuilder sb = new StringBuilder("(");
+        for (int i = 0; i < getParameterCount(false); ++i) {
+            sb.append(getParameterType(i, null).getName());
+        }
+        sb.append(')').append(getReturnType(null).getName());
+        return sb.toString();
+    }
+
+    default JavaType[] toParameterTypes(JavaType receiverType) {
+        int args = getParameterCount(false);
+        JavaType[] result;
+        int i = 0;
+        if (receiverType != null) {
+            result = new JavaType[args + 1];
+            result[0] = receiverType;
+            i = 1;
+        } else {
+            result = new JavaType[args];
+        }
+        for (int j = 0; j < args; j++) {
+            result[i + j] = getParameterType(j, null);
+        }
+        return result;
+    }
+
+    default Kind[] toParameterKinds(boolean receiver) {
+        int args = getParameterCount(false);
+        Kind[] result;
+        int i = 0;
+        if (receiver) {
+            result = new Kind[args + 1];
+            result[0] = Kind.Object;
+            i = 1;
+        } else {
+            result = new Kind[args];
+        }
+        for (int j = 0; j < args; j++) {
+            result[i + j] = getParameterKind(j);
+        }
+        return result;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/TriState.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2012, 2015, 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.jvmci.meta;
+
+/**
+ * Represents a logic value that can be either {@link #TRUE}, {@link #FALSE}, or {@link #UNKNOWN}.
+ */
+public enum TriState {
+    TRUE,
+    FALSE,
+    UNKNOWN;
+
+    public static TriState get(boolean value) {
+        return value ? TRUE : FALSE;
+    }
+
+    /**
+     * This is optimistic about {@link #UNKNOWN} (it prefers known values over {@link #UNKNOWN}) and
+     * pesimistic about known (it perfers {@link #TRUE} over {@link #FALSE}).
+     */
+    public static TriState merge(TriState a, TriState b) {
+        if (a == TRUE || b == TRUE) {
+            return TRUE;
+        }
+        if (a == FALSE || b == FALSE) {
+            return FALSE;
+        }
+        assert a == UNKNOWN && b == UNKNOWN;
+        return UNKNOWN;
+    }
+
+    public boolean isTrue() {
+        return this == TRUE;
+    }
+
+    public boolean isFalse() {
+        return this == FALSE;
+    }
+
+    public boolean isUnknown() {
+        return this == UNKNOWN;
+    }
+
+    public boolean isKnown() {
+        return this != UNKNOWN;
+    }
+
+    public boolean toBoolean() {
+        if (isTrue()) {
+            return true;
+        } else if (isFalse()) {
+            return false;
+        } else {
+            throw new IllegalStateException("Cannot convert to boolean, TriState is in an unknown state");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/TrustedInterface.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.meta;
+
+/**
+ * Interfaces extanding this interface should be trusted by the compiler. See
+ * {@link ResolvedJavaType#isTrustedInterfaceType()}.
+ *
+ */
+public interface TrustedInterface {
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/VMConstant.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.meta;
+
+public interface VMConstant extends Constant {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/Value.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.meta;
+
+/**
+ * Interface for values manipulated by the compiler. All values have a {@linkplain Kind kind} and
+ * are immutable.
+ */
+public interface Value extends KindProvider, TrustedInterface {
+
+    AllocatableValue ILLEGAL = new AllocatableValue(LIRKind.Illegal) {
+
+        @Override
+        public String toString() {
+            return "-";
+        }
+
+        @Override
+        public boolean equals(Object other) {
+            // Due to de-serialization this object may exist multiple times. So we compare classes
+            // instead of the individual objects. (This anonymous class has always the same meaning)
+            return other != null && this.getClass() == other.getClass();
+        }
+    };
+
+    LIRKind getLIRKind();
+
+    /**
+     * Returns the platform specific kind used to store this value.
+     */
+    PlatformKind getPlatformKind();
+
+    /**
+     * Checks if this value is identical to {@code other}.
+     *
+     * Warning: Use with caution! Usually equivalence {@link #equals(Object)} is sufficient and
+     * should be used.
+     */
+    @ExcludeFromIdentityComparisonVerification
+    default boolean identityEquals(Value other) {
+        return this == other;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/package-info.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,29 @@
+/*
+ * 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 that defines the interface between a runtime and a Java application that wants to access meta information. The runtime
+ * provides an implementation of the {@link com.oracle.jvmci.meta.MetaAccessProvider} interface.
+ */
+package com.oracle.jvmci.meta;
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.options.processor/src/META-INF/services/javax.annotation.processing.Processor	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,1 @@
+com.oracle.jvmci.options.processor.OptionProcessor
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.options.processor/src/com/oracle/jvmci/options/processor/GraalJars.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2015, 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.jvmci.options.processor;
+
+import java.io.*;
+import java.util.*;
+import java.util.stream.*;
+import java.util.zip.*;
+
+public class GraalJars implements Iterable<ZipEntry> {
+    private final List<ZipFile> jars = new ArrayList<>(2);
+
+    public GraalJars() {
+        String classPath = System.getProperty("java.class.path");
+        for (String e : classPath.split(File.pathSeparator)) {
+            if (e.endsWith(File.separatorChar + "graal.jar") || e.endsWith(File.separatorChar + "graal-truffle.jar")) {
+                try {
+                    jars.add(new ZipFile(e));
+                } catch (IOException ioe) {
+                    throw new InternalError(ioe);
+                }
+            }
+        }
+        if (jars.size() != 2) {
+            throw new InternalError("Could not find graal.jar or graal-truffle.jar on class path: " + classPath);
+        }
+    }
+
+    public Iterator<ZipEntry> iterator() {
+        Stream<ZipEntry> entries = jars.stream().flatMap(ZipFile::stream);
+        return entries.iterator();
+    }
+
+    public InputStream getInputStream(String classFilePath) throws IOException {
+        for (ZipFile jar : jars) {
+            ZipEntry entry = jar.getEntry(classFilePath);
+            if (entry != null) {
+                return jar.getInputStream(entry);
+            }
+        }
+        return null;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.options.processor/src/com/oracle/jvmci/options/processor/OptionProcessor.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,378 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.options.processor;
+
+import java.io.*;
+import java.util.*;
+
+import javax.annotation.processing.*;
+import javax.lang.model.*;
+import javax.lang.model.element.*;
+import javax.lang.model.type.*;
+import javax.lang.model.util.*;
+import javax.tools.Diagnostic.Kind;
+import javax.tools.*;
+
+import com.oracle.jvmci.options.*;
+
+/**
+ * Processes static fields annotated with {@link Option}. An {@link Options} service is generated
+ * for each top level class containing at least one such field. These service objects can be
+ * retrieved as follows:
+ *
+ * <pre>
+ * ServiceLoader&lt;Options&gt; sl = ServiceLoader.load(Options.class);
+ * for (Options opts : sl) {
+ *     for (OptionDescriptor desc : sl) {
+ *         // use desc
+ *     }
+ * }
+ * </pre>
+ */
+@SupportedAnnotationTypes({"com.oracle.jvmci.options.Option"})
+public class OptionProcessor extends AbstractProcessor {
+
+    @Override
+    public SourceVersion getSupportedSourceVersion() {
+        return SourceVersion.latest();
+    }
+
+    private final Set<Element> processed = new HashSet<>();
+
+    private void processElement(Element element, OptionsInfo info) {
+
+        if (!element.getModifiers().contains(Modifier.STATIC)) {
+            processingEnv.getMessager().printMessage(Kind.ERROR, "Option field must be static", element);
+            return;
+        }
+
+        Option annotation = element.getAnnotation(Option.class);
+        assert annotation != null;
+        assert element instanceof VariableElement;
+        assert element.getKind() == ElementKind.FIELD;
+        VariableElement field = (VariableElement) element;
+        String fieldName = field.getSimpleName().toString();
+
+        Elements elements = processingEnv.getElementUtils();
+        Types types = processingEnv.getTypeUtils();
+
+        TypeMirror fieldType = field.asType();
+        if (fieldType.getKind() != TypeKind.DECLARED) {
+            processingEnv.getMessager().printMessage(Kind.ERROR, "Option field must be of type " + OptionValue.class.getName(), element);
+            return;
+        }
+        DeclaredType declaredFieldType = (DeclaredType) fieldType;
+
+        TypeMirror optionValueType = elements.getTypeElement(OptionValue.class.getName()).asType();
+        if (!types.isSubtype(fieldType, types.erasure(optionValueType))) {
+            String msg = String.format("Option field type %s is not a subclass of %s", fieldType, optionValueType);
+            processingEnv.getMessager().printMessage(Kind.ERROR, msg, element);
+            return;
+        }
+
+        if (!field.getModifiers().contains(Modifier.STATIC)) {
+            processingEnv.getMessager().printMessage(Kind.ERROR, "Option field must be static", element);
+            return;
+        }
+
+        String help = annotation.help();
+        if (help.length() != 0) {
+            char firstChar = help.charAt(0);
+            if (!Character.isUpperCase(firstChar)) {
+                processingEnv.getMessager().printMessage(Kind.ERROR, "Option help text must start with upper case letter", element);
+                return;
+            }
+        }
+
+        String optionName = annotation.name();
+        if (optionName.equals("")) {
+            optionName = fieldName;
+        }
+
+        DeclaredType declaredOptionValueType = declaredFieldType;
+        while (!types.isSameType(types.erasure(declaredOptionValueType), types.erasure(optionValueType))) {
+            List<? extends TypeMirror> directSupertypes = types.directSupertypes(declaredFieldType);
+            assert !directSupertypes.isEmpty();
+            declaredOptionValueType = (DeclaredType) directSupertypes.get(0);
+        }
+
+        assert !declaredOptionValueType.getTypeArguments().isEmpty();
+        String optionType = declaredOptionValueType.getTypeArguments().get(0).toString();
+        if (optionType.startsWith("java.lang.")) {
+            optionType = optionType.substring("java.lang.".length());
+        }
+
+        Element enclosing = element.getEnclosingElement();
+        String declaringClass = "";
+        String separator = "";
+        Set<Element> originatingElementsList = info.originatingElements;
+        originatingElementsList.add(field);
+        while (enclosing != null) {
+            if (enclosing.getKind() == ElementKind.CLASS || enclosing.getKind() == ElementKind.INTERFACE) {
+                if (enclosing.getModifiers().contains(Modifier.PRIVATE)) {
+                    String msg = String.format("Option field cannot be declared in a private %s %s", enclosing.getKind().name().toLowerCase(), enclosing);
+                    processingEnv.getMessager().printMessage(Kind.ERROR, msg, element);
+                    return;
+                }
+                originatingElementsList.add(enclosing);
+                declaringClass = enclosing.getSimpleName() + separator + declaringClass;
+                separator = ".";
+            } else {
+                assert enclosing.getKind() == ElementKind.PACKAGE;
+            }
+            enclosing = enclosing.getEnclosingElement();
+        }
+
+        info.options.add(new OptionInfo(optionName, help, optionType, declaringClass, field));
+    }
+
+    private void createFiles(OptionsInfo info) {
+        String pkg = ((PackageElement) info.topDeclaringType.getEnclosingElement()).getQualifiedName().toString();
+        Name topDeclaringClass = info.topDeclaringType.getSimpleName();
+
+        String optionsClassName = topDeclaringClass + "_" + Options.class.getSimpleName();
+        Element[] originatingElements = info.originatingElements.toArray(new Element[info.originatingElements.size()]);
+
+        Filer filer = processingEnv.getFiler();
+        try (PrintWriter out = createSourceFile(pkg, optionsClassName, filer, originatingElements)) {
+
+            out.println("// CheckStyle: stop header check");
+            out.println("// GENERATED CONTENT - DO NOT EDIT");
+            out.println("// Source: " + topDeclaringClass + ".java");
+            out.println("package " + pkg + ";");
+            out.println("");
+            out.println("import java.util.*;");
+            out.println("import " + Options.class.getPackage().getName() + ".*;");
+            out.println("");
+            out.println("public class " + optionsClassName + " implements " + Options.class.getSimpleName() + " {");
+            out.println("    @Override");
+            String desc = OptionDescriptor.class.getSimpleName();
+            out.println("    public Iterator<" + desc + "> iterator() {");
+            out.println("        // CheckStyle: stop line length check");
+            out.println("        List<" + desc + "> options = Arrays.asList(");
+
+            boolean needPrivateFieldAccessor = false;
+            int i = 0;
+            Collections.sort(info.options);
+            for (OptionInfo option : info.options) {
+                String optionValue;
+                if (option.field.getModifiers().contains(Modifier.PRIVATE)) {
+                    needPrivateFieldAccessor = true;
+                    optionValue = "field(" + option.declaringClass + ".class, \"" + option.field.getSimpleName() + "\")";
+                } else {
+                    optionValue = option.declaringClass + "." + option.field.getSimpleName();
+                }
+                String name = option.name;
+                String type = option.type;
+                String help = option.help;
+                String declaringClass = option.declaringClass;
+                Name fieldName = option.field.getSimpleName();
+                String comma = i == info.options.size() - 1 ? "" : ",";
+                out.printf("            new %s(\"%s\", %s.class, \"%s\", %s.class, \"%s\", %s)%s\n", desc, name, type, help, declaringClass, fieldName, optionValue, comma);
+                i++;
+            }
+            out.println("        );");
+            out.println("        // CheckStyle: resume line length check");
+            out.println("        return options.iterator();");
+            out.println("    }");
+            if (needPrivateFieldAccessor) {
+                out.println("    private static " + OptionValue.class.getSimpleName() + "<?> field(Class<?> declaringClass, String fieldName) {");
+                out.println("        try {");
+                out.println("            java.lang.reflect.Field field = declaringClass.getDeclaredField(fieldName);");
+                out.println("            field.setAccessible(true);");
+                out.println("            return (" + OptionValue.class.getSimpleName() + "<?>) field.get(null);");
+                out.println("        } catch (Exception e) {");
+                out.println("            throw (InternalError) new InternalError().initCause(e);");
+                out.println("        }");
+                out.println("    }");
+            }
+            out.println("}");
+        }
+
+        try {
+            createProviderFile(pkg, optionsClassName, originatingElements);
+            createOptionsFile(info, pkg, topDeclaringClass.toString(), originatingElements);
+        } catch (IOException e) {
+            processingEnv.getMessager().printMessage(Kind.ERROR, e.getMessage(), info.topDeclaringType);
+        }
+    }
+
+    private void createProviderFile(String pkg, String providerClassName, Element... originatingElements) throws IOException {
+        String filename = "META-INF/providers/" + pkg + "." + providerClassName;
+        FileObject file = processingEnv.getFiler().createResource(StandardLocation.CLASS_OUTPUT, "", filename, originatingElements);
+        PrintWriter writer = new PrintWriter(new OutputStreamWriter(file.openOutputStream(), "UTF-8"));
+        writer.println(Options.class.getName());
+        writer.close();
+    }
+
+    private void createOptionsFile(OptionsInfo info, String pkg, String relativeName, Element... originatingElements) throws IOException {
+        String filename = "META-INF/options/" + pkg + "." + relativeName;
+        FileObject file = processingEnv.getFiler().createResource(StandardLocation.CLASS_OUTPUT, "", filename, originatingElements);
+        PrintWriter writer = new PrintWriter(new OutputStreamWriter(file.openOutputStream(), "UTF-8"));
+        Types types = processingEnv.getTypeUtils();
+        for (OptionInfo option : info.options) {
+            String help = option.help;
+            if (help.indexOf('\t') >= 0 || help.indexOf('\r') >= 0 || help.indexOf('\n') >= 0) {
+                processingEnv.getMessager().printMessage(Kind.WARNING, "Option help should not contain '\\t', '\\r' or '\\n'", option.field);
+                help = help.replace('\t', ' ').replace('\n', ' ').replace('\r', ' ');
+            }
+            try {
+                char optionTypeToChar = optionTypeToChar(option);
+                String fqDeclaringClass = className(types.erasure(option.field.getEnclosingElement().asType()));
+                String fqFieldType = className(types.erasure(option.field.asType()));
+                writer.printf("%s\t%s\t%s\t%s\t%s%n", option.name, optionTypeToChar, help, fqDeclaringClass, fqFieldType);
+            } catch (IllegalArgumentException iae) {
+            }
+        }
+        writer.close();
+    }
+
+    private String className(TypeMirror t) {
+        DeclaredType dt = (DeclaredType) t;
+        return processingEnv.getElementUtils().getBinaryName((TypeElement) dt.asElement()).toString();
+    }
+
+    private char optionTypeToChar(OptionInfo option) {
+        switch (option.type) {
+            case "Boolean":
+                return 'z';
+            case "Integer":
+                return 'i';
+            case "Long":
+                return 'j';
+            case "Float":
+                return 'f';
+            case "Double":
+                return 'd';
+            case "String":
+                return 's';
+            default:
+                processingEnv.getMessager().printMessage(Kind.ERROR, "Unsoported option type: " + option.type, option.field);
+                throw new IllegalArgumentException();
+        }
+    }
+
+    protected PrintWriter createSourceFile(String pkg, String relativeName, Filer filer, Element... originatingElements) {
+        try {
+            // Ensure Unix line endings to comply with code style guide checked by Checkstyle
+            JavaFileObject sourceFile = filer.createSourceFile(pkg + "." + relativeName, originatingElements);
+            return new PrintWriter(sourceFile.openWriter()) {
+
+                @Override
+                public void println() {
+                    print("\n");
+                }
+            };
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    static class OptionInfo implements Comparable<OptionInfo> {
+
+        final String name;
+        final String help;
+        final String type;
+        final String declaringClass;
+        final VariableElement field;
+
+        public OptionInfo(String name, String help, String type, String declaringClass, VariableElement field) {
+            this.name = name;
+            this.help = help;
+            this.type = type;
+            this.declaringClass = declaringClass;
+            this.field = field;
+        }
+
+        @Override
+        public int compareTo(OptionInfo other) {
+            return name.compareTo(other.name);
+        }
+
+        @Override
+        public String toString() {
+            return declaringClass + "." + field;
+        }
+    }
+
+    static class OptionsInfo {
+
+        final Element topDeclaringType;
+        final List<OptionInfo> options = new ArrayList<>();
+        final Set<Element> originatingElements = new HashSet<>();
+
+        public OptionsInfo(Element topDeclaringType) {
+            this.topDeclaringType = topDeclaringType;
+        }
+    }
+
+    private static Element topDeclaringType(Element element) {
+        Element enclosing = element.getEnclosingElement();
+        if (enclosing == null || enclosing.getKind() == ElementKind.PACKAGE) {
+            assert element.getKind() == ElementKind.CLASS || element.getKind() == ElementKind.INTERFACE;
+            return element;
+        }
+        return topDeclaringType(enclosing);
+    }
+
+    @Override
+    public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
+        if (roundEnv.processingOver()) {
+            return true;
+        }
+
+        Map<Element, OptionsInfo> map = new HashMap<>();
+        for (Element element : roundEnv.getElementsAnnotatedWith(Option.class)) {
+            if (!processed.contains(element)) {
+                processed.add(element);
+                Element topDeclaringType = topDeclaringType(element);
+                OptionsInfo options = map.get(topDeclaringType);
+                if (options == null) {
+                    options = new OptionsInfo(topDeclaringType);
+                    map.put(topDeclaringType, options);
+                }
+                processElement(element, options);
+            }
+        }
+
+        boolean ok = true;
+        Map<String, OptionInfo> uniqueness = new HashMap<>();
+        for (OptionsInfo info : map.values()) {
+            for (OptionInfo option : info.options) {
+                OptionInfo conflict = uniqueness.put(option.name, option);
+                if (conflict != null) {
+                    processingEnv.getMessager().printMessage(Kind.ERROR, "Duplicate option names for " + option + " and " + conflict, option.field);
+                    ok = false;
+                }
+            }
+        }
+
+        if (ok) {
+            for (OptionsInfo info : map.values()) {
+                createFiles(info);
+            }
+        }
+
+        return true;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.options.processor/src/com/oracle/jvmci/options/processor/OptionsVerifier.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,184 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.options.processor;
+
+import static java.lang.String.*;
+
+import java.io.*;
+import java.lang.reflect.*;
+import java.util.*;
+
+import jdk.internal.org.objectweb.asm.*;
+import jdk.internal.org.objectweb.asm.Type;
+
+import com.oracle.jvmci.options.*;
+
+/**
+ * A {@link ClassVisitor} that verifies a class declaring one or more {@linkplain OptionValue
+ * options} has a class initializer that only initializes the option(s). This sanity check mitigates
+ * the possibility of an option value being used before the code that sets the value (e.g., from the
+ * command line) has been executed.
+ */
+final class OptionsVerifier extends ClassVisitor {
+
+    public static void checkClass(Class<?> cls, OptionDescriptor option, Set<Class<?>> checked, GraalJars graalJars) throws IOException {
+        if (!checked.contains(cls)) {
+            checked.add(cls);
+            Class<?> superclass = cls.getSuperclass();
+            if (superclass != null && !superclass.equals(Object.class)) {
+                checkClass(superclass, option, checked, graalJars);
+            }
+
+            String classFilePath = cls.getName().replace('.', '/') + ".class";
+            ClassReader cr = new ClassReader(Objects.requireNonNull(graalJars.getInputStream(classFilePath), "Could not find class file for " + cls.getName()));
+
+            ClassVisitor cv = new OptionsVerifier(cls, option);
+            cr.accept(cv, 0);
+        }
+    }
+
+    /**
+     * The option field context of the verification.
+     */
+    private final OptionDescriptor option;
+
+    /**
+     * The class in which {@link #option} is declared or a super-class of that class. This is the
+     * class whose {@code <clinit>} method is being verified.
+     */
+    private final Class<?> cls;
+
+    /**
+     * Source file context for error reporting.
+     */
+    String sourceFile = null;
+
+    /**
+     * Line number for error reporting.
+     */
+    int lineNo = -1;
+
+    final Class<?>[] boxingTypes = {Boolean.class, Byte.class, Short.class, Character.class, Integer.class, Float.class, Long.class, Double.class};
+
+    private static Class<?> resolve(String name) {
+        try {
+            return Class.forName(name.replace('/', '.'));
+        } catch (ClassNotFoundException e) {
+            throw new InternalError(e);
+        }
+    }
+
+    OptionsVerifier(Class<?> cls, OptionDescriptor desc) {
+        super(Opcodes.ASM5);
+        this.cls = cls;
+        this.option = desc;
+    }
+
+    @Override
+    public void visitSource(String source, String debug) {
+        this.sourceFile = source;
+    }
+
+    void verify(boolean condition, String message) {
+        if (!condition) {
+            error(message);
+        }
+    }
+
+    void error(String message) {
+        String errorMessage = format("%s:%d: Illegal code in %s.<clinit> which may be executed when %s.%s is initialized:%n%n    %s%n%n" + "The recommended solution is to move " + option.getName() +
+                        " into a separate class (e.g., %s.Options).%n", sourceFile, lineNo, cls.getSimpleName(), option.getDeclaringClass().getSimpleName(), option.getName(), message,
+                        option.getDeclaringClass().getSimpleName());
+        throw new InternalError(errorMessage);
+
+    }
+
+    @Override
+    public MethodVisitor visitMethod(int access, String name, String d, String signature, String[] exceptions) {
+        if (name.equals("<clinit>")) {
+            return new MethodVisitor(Opcodes.ASM5) {
+
+                @Override
+                public void visitLineNumber(int line, Label start) {
+                    lineNo = line;
+                }
+
+                @Override
+                public void visitFieldInsn(int opcode, String owner, String fieldName, String fieldDesc) {
+                    if (opcode == Opcodes.PUTFIELD || opcode == Opcodes.PUTSTATIC) {
+                        verify(resolve(owner).equals(option.getDeclaringClass()), format("store to field %s.%s", resolve(owner).getSimpleName(), fieldName));
+                        verify(opcode != Opcodes.PUTFIELD, format("store to non-static field %s.%s", resolve(owner).getSimpleName(), fieldName));
+                    }
+                }
+
+                private Executable resolveMethod(String owner, String methodName, String methodDesc) {
+                    Class<?> declaringClass = resolve(owner);
+                    if (methodName.equals("<init>")) {
+                        for (Constructor<?> c : declaringClass.getDeclaredConstructors()) {
+                            if (methodDesc.equals(Type.getConstructorDescriptor(c))) {
+                                return c;
+                            }
+                        }
+                    } else {
+                        Type[] argumentTypes = Type.getArgumentTypes(methodDesc);
+                        for (Method m : declaringClass.getDeclaredMethods()) {
+                            if (m.getName().equals(methodName)) {
+                                if (Arrays.equals(argumentTypes, Type.getArgumentTypes(m))) {
+                                    if (Type.getReturnType(methodDesc).equals(Type.getReturnType(m))) {
+                                        return m;
+                                    }
+                                }
+                            }
+                        }
+                    }
+                    throw new NoSuchMethodError(declaringClass + "." + methodName + methodDesc);
+                }
+
+                /**
+                 * Checks whether a given method is allowed to be called.
+                 */
+                private boolean checkInvokeTarget(Executable method) {
+                    Class<?> holder = method.getDeclaringClass();
+                    if (method instanceof Constructor) {
+                        if (OptionValue.class.isAssignableFrom(holder)) {
+                            return true;
+                        }
+                    } else if (Arrays.asList(boxingTypes).contains(holder)) {
+                        return method.getName().equals("valueOf");
+                    } else if (method.getDeclaringClass().equals(Class.class)) {
+                        return method.getName().equals("desiredAssertionStatus");
+                    }
+                    return false;
+                }
+
+                @Override
+                public void visitMethodInsn(int opcode, String owner, String methodName, String methodDesc, boolean itf) {
+                    Executable callee = resolveMethod(owner, methodName, methodDesc);
+                    verify(checkInvokeTarget(callee), "invocation of " + callee);
+                }
+            };
+        } else {
+            return null;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.options.test/src/com/oracle/jvmci/options/test/NestedBooleanOptionValueTest.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,128 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.options.test;
+
+import static com.oracle.jvmci.options.test.NestedBooleanOptionValueTest.Options.*;
+import static org.junit.Assert.*;
+
+import org.junit.*;
+
+import com.oracle.jvmci.options.*;
+import com.oracle.jvmci.options.OptionValue.OverrideScope;
+
+public class NestedBooleanOptionValueTest {
+
+    public static class Options {
+        public static final OptionValue<Boolean> Master0 = new OptionValue<>(true);
+        public static final OptionValue<Boolean> NestedOption0 = new NestedBooleanOptionValue(Master0, true);
+        public static final OptionValue<Boolean> Master1 = new OptionValue<>(true);
+        public static final OptionValue<Boolean> NestedOption1 = new NestedBooleanOptionValue(Master1, true);
+        public static final OptionValue<Boolean> Master2 = new OptionValue<>(true);
+        public static final OptionValue<Boolean> NestedOption2 = new NestedBooleanOptionValue(Master2, false);
+    }
+
+    static final OptionDescriptor master0 = new OptionDescriptor("Master0", Boolean.class, "", Options.class, "Master0", Master0);
+    static final OptionDescriptor nestedOption0 = new OptionDescriptor("NestedOption0", Boolean.class, "", Options.class, "NestedOption0", NestedOption0);
+    static final OptionDescriptor master1 = new OptionDescriptor("Master1", Boolean.class, "", Options.class, "Master1", Master1);
+    static final OptionDescriptor nestedOption1 = new OptionDescriptor("NestedOption1", Boolean.class, "", Options.class, "NestedOption1", NestedOption1);
+    static final OptionDescriptor master2 = new OptionDescriptor("Master2", Boolean.class, "", Options.class, "Master2", Master2);
+    static final OptionDescriptor nestedOption2 = new OptionDescriptor("NestedOption2", Boolean.class, "", Options.class, "NestedOption2", NestedOption2);
+
+    @Test
+    public void runOverrides() {
+        assertTrue(Master0.getValue());
+        assertTrue(NestedOption0.getValue());
+        try (OverrideScope s1 = OptionValue.override(Master0, false)) {
+            assertFalse(Master0.getValue());
+            assertFalse(NestedOption0.getValue());
+            try (OverrideScope s2 = OptionValue.override(NestedOption0, false)) {
+                assertFalse(NestedOption0.getValue());
+            }
+            try (OverrideScope s2 = OptionValue.override(NestedOption0, true)) {
+                assertTrue(NestedOption0.getValue());
+            }
+        }
+        assertTrue(Master0.getValue());
+        try (OverrideScope s1 = OptionValue.override(NestedOption0, false)) {
+            assertFalse(NestedOption0.getValue());
+        }
+        try (OverrideScope s1 = OptionValue.override(NestedOption0, true)) {
+            assertTrue(NestedOption0.getValue());
+        }
+    }
+
+    @Test
+    public void runDefaultTrue() {
+        Master1.setValue(true);
+        assertTrue(Master1.getValue());
+        assertTrue(NestedOption1.getValue());
+        // nested value unset
+        Master1.setValue(false);
+        assertFalse(Master1.getValue());
+        assertFalse(NestedOption1.getValue());
+        // set false
+        Master1.setValue(false);
+        NestedOption1.setValue(false);
+        assertFalse(Master1.getValue());
+        assertFalse(NestedOption1.getValue());
+        Master1.setValue(true);
+        assertTrue(Master1.getValue());
+        assertFalse(NestedOption1.getValue());
+        // set true
+        Master1.setValue(false);
+        NestedOption1.setValue(true);
+        assertFalse(Master1.getValue());
+        assertTrue(NestedOption1.getValue());
+        Master1.setValue(true);
+        assertTrue(Master1.getValue());
+        assertTrue(NestedOption1.getValue());
+    }
+
+    @Test
+    public void runDefaultFalse() {
+        Master2.setValue(true);
+        assertTrue(Master2.getValue());
+        assertFalse(NestedOption2.getValue());
+        // nested value unset
+        Master2.setValue(false);
+        assertFalse(Master2.getValue());
+        assertFalse(NestedOption2.getValue());
+        // set false
+        Master2.setValue(false);
+        NestedOption2.setValue(false);
+        assertFalse(Master2.getValue());
+        assertFalse(NestedOption2.getValue());
+        Master2.setValue(true);
+        assertTrue(Master2.getValue());
+        assertFalse(NestedOption2.getValue());
+        // set true
+        Master2.setValue(false);
+        NestedOption2.setValue(true);
+        assertFalse(Master2.getValue());
+        assertTrue(NestedOption2.getValue());
+        Master2.setValue(true);
+        assertTrue(Master2.getValue());
+        assertTrue(NestedOption2.getValue());
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.options.test/src/com/oracle/jvmci/options/test/TestOptionValue.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,127 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.options.test;
+
+import static com.oracle.jvmci.options.test.TestOptionValue.Options.*;
+import static org.junit.Assert.*;
+
+import java.util.*;
+
+import org.junit.*;
+
+import com.oracle.jvmci.options.*;
+import com.oracle.jvmci.options.OptionValue.OverrideScope;
+
+public class TestOptionValue {
+
+    public static class Options {
+        public static final OptionValue<Boolean> Stable = new StableOptionValue<>(true);
+        public static final OptionValue<String> Mutable = new OptionValue<>("original");
+        public static final OptionValue<String> SecondMutable = new OptionValue<>("second");
+    }
+
+    static final OptionDescriptor stable = new OptionDescriptor("Stable", Boolean.class, "", Options.class, "Stable", Stable);
+    static final OptionDescriptor mutable = new OptionDescriptor("Mutable", String.class, "", Options.class, "Mutable", Mutable);
+    static final OptionDescriptor secondMutable = new OptionDescriptor("SecondMutable", String.class, "", Options.class, "SecondMutable", SecondMutable);
+
+    @Test
+    public void testMutable() {
+        assertEquals("original", Mutable.getValue());
+        try (OverrideScope s1 = OptionValue.override(Mutable, "override1")) {
+            assertEquals("override1", Mutable.getValue());
+            try (OverrideScope s2 = OptionValue.override(Mutable, "override2")) {
+                assertEquals("override2", Mutable.getValue());
+            }
+            assertEquals("override1", Mutable.getValue());
+            try (OverrideScope s3 = OptionValue.override(Mutable, "override3")) {
+                assertEquals("override3", Mutable.getValue());
+            }
+            assertEquals("override1", Mutable.getValue());
+        }
+        assertEquals("original", Mutable.getValue());
+        try (OverrideScope s1 = OptionValue.override(Mutable, "original")) {
+            assertEquals("original", Mutable.getValue());
+        }
+    }
+
+    @Test
+    public void testMultiple() {
+        assertEquals("original", Mutable.getValue());
+        assertEquals("second", SecondMutable.getValue());
+        try (OverrideScope s1 = OptionValue.override(Mutable, "override1", SecondMutable, "secondOverride1")) {
+            assertEquals("override1", Mutable.getValue());
+            assertEquals("secondOverride1", SecondMutable.getValue());
+            try (OverrideScope s2 = OptionValue.override(Mutable, "override2", SecondMutable, "secondOverride2")) {
+                assertEquals("override2", Mutable.getValue());
+                assertEquals("secondOverride2", SecondMutable.getValue());
+            }
+            assertEquals("override1", Mutable.getValue());
+            assertEquals("secondOverride1", SecondMutable.getValue());
+            try (OverrideScope s3 = OptionValue.override(Mutable, "override3", SecondMutable, "secondOverride3")) {
+                assertEquals("override3", Mutable.getValue());
+                assertEquals("secondOverride3", SecondMutable.getValue());
+            }
+            assertEquals("override1", Mutable.getValue());
+            assertEquals("secondOverride1", SecondMutable.getValue());
+        }
+        assertEquals("original", Mutable.getValue());
+        assertEquals("second", SecondMutable.getValue());
+        try (OverrideScope s1 = OptionValue.override(Mutable, "original", SecondMutable, "second")) {
+            assertEquals("original", Mutable.getValue());
+            assertEquals("second", SecondMutable.getValue());
+        }
+    }
+
+    @Test
+    public void testStable() {
+        assertTrue(Stable.getValue());
+        try (OverrideScope s = OptionValue.override(Stable, false)) {
+            fail("cannot override stable option");
+        } catch (IllegalArgumentException e) {
+            // expected
+        }
+    }
+
+    @Test
+    public void toStringTest() {
+        assertEquals("com.oracle.jvmci.options.test.TestOptionValue$Options.Mutable=original", Mutable.toString());
+        try (OverrideScope s1 = OptionValue.override(Mutable, "override1")) {
+            assertEquals("com.oracle.jvmci.options.test.TestOptionValue$Options.Mutable=override1", Mutable.toString());
+            try (OverrideScope s2 = OptionValue.override(Mutable, "override2")) {
+                assertEquals("com.oracle.jvmci.options.test.TestOptionValue$Options.Mutable=override2", Mutable.toString());
+            }
+        }
+    }
+
+    @Test
+    public void getValuesTest() {
+        assertEquals(Arrays.asList("original"), Mutable.getValues(null));
+        assertEquals(Arrays.asList(true), Stable.getValues(null));
+        try (OverrideScope s1 = OptionValue.override(Mutable, "override1")) {
+            assertEquals(Arrays.asList("override1", "original"), Mutable.getValues(null));
+            try (OverrideScope s2 = OptionValue.override(Mutable, "override2")) {
+                assertEquals(Arrays.asList("override2", "override1", "original"), Mutable.getValues(null));
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.options/src/com/oracle/jvmci/options/DerivedOptionValue.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.options;
+
+import java.io.*;
+import java.util.function.*;
+
+import com.oracle.jvmci.options.OptionValue.OverrideScope;
+
+/**
+ * A cached value that needs to be recomputed when an option changes.
+ */
+public class DerivedOptionValue<T> {
+
+    public interface OptionSupplier<T> extends Supplier<T>, Serializable {
+    }
+
+    private final T initialValue;
+    private final OptionSupplier<T> supplier;
+
+    public DerivedOptionValue(OptionSupplier<T> supplier) {
+        this.supplier = supplier;
+        assert OptionValue.getOverrideScope() == null : "derived option value should be initialized outside any override scope";
+        this.initialValue = createValue();
+    }
+
+    public T getValue() {
+        OverrideScope overrideScope = OptionValue.getOverrideScope();
+        if (overrideScope != null) {
+            return overrideScope.getDerived(this);
+        } else {
+            return initialValue;
+        }
+    }
+
+    T createValue() {
+        return supplier.get();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.options/src/com/oracle/jvmci/options/NestedBooleanOptionValue.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2015, 2015, 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.jvmci.options;
+
+/**
+ * A nested Boolean {@link OptionValue} that can be overridden by a {@link #masterOption master
+ * option}.
+ * <p>
+ * <li>If the option is present on the command line the specified value is used.
+ * <li>Otherwise {@link #getValue()} depends on the {@link #masterOption} and evaluates as follows:
+ * <ul>
+ * <li>If {@link #masterOption} is set, this value equals to {@link #initialValue}.
+ * <li>Otherwise, if {@link #masterOption} is {@code false}, this option is {@code false}.
+ */
+public class NestedBooleanOptionValue extends OptionValue<Boolean> {
+    private final OptionValue<Boolean> masterOption;
+    private final Boolean initialValue;
+
+    public NestedBooleanOptionValue(OptionValue<Boolean> masterOption, Boolean initialValue) {
+        super(null);
+        this.masterOption = masterOption;
+        this.initialValue = initialValue;
+    }
+
+    public OptionValue<Boolean> getMasterOption() {
+        return masterOption;
+    }
+
+    @Override
+    public Boolean getValue() {
+        Boolean v = super.getValue();
+        if (v == null) {
+            return initialValue && masterOption.getValue();
+        }
+        return v;
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.options/src/com/oracle/jvmci/options/Option.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.options;
+
+import java.lang.annotation.*;
+
+/**
+ * Describes the attributes of an option whose {@link OptionValue value} is in a static field
+ * annotated by this annotation type.
+ *
+ * @see OptionDescriptor
+ */
+@Retention(RetentionPolicy.CLASS)
+@Target(ElementType.FIELD)
+public @interface Option {
+
+    /**
+     * Gets a help message for the option. New lines can be embedded in the message with
+     * {@code "%n"}.
+     */
+    String help();
+
+    /**
+     * The name of the option. By default, the name of the annotated field should be used.
+     */
+    String name() default "";
+
+    /**
+     * Specifies the type of the option.
+     */
+    OptionType type() default OptionType.Debug;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.options/src/com/oracle/jvmci/options/OptionDescriptor.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.options;
+
+/**
+ * Describes the attributes of a static field {@linkplain Option option} and provides access to its
+ * {@linkplain OptionValue value}.
+ */
+public class OptionDescriptor {
+
+    protected final String name;
+    protected final Class<?> type;
+    protected final String help;
+    protected final OptionValue<?> option;
+    protected final Class<?> declaringClass;
+    protected final String fieldName;
+
+    public OptionDescriptor(String name, Class<?> type, String help, Class<?> declaringClass, String fieldName, OptionValue<?> option) {
+        this.name = name;
+        this.type = type;
+        this.help = help;
+        this.option = option;
+        this.declaringClass = declaringClass;
+        this.fieldName = fieldName;
+        assert !type.isPrimitive() : "must used boxed type instead of " + type;
+        option.setDescriptor(this);
+    }
+
+    /**
+     * Gets the type of values stored in the option. This will be the boxed type for a primitive
+     * option.
+     */
+    public Class<?> getType() {
+        return type;
+    }
+
+    /**
+     * Gets a descriptive help message for the option.
+     */
+    public String getHelp() {
+        return help;
+    }
+
+    /**
+     * Gets the name of the option. It's up to the client of this object how to use the name to get
+     * a user specified value for the option from the environment.
+     */
+    public String getName() {
+        return name;
+    }
+
+    /**
+     * Gets the boxed option value.
+     */
+    public OptionValue<?> getOptionValue() {
+        return option;
+    }
+
+    public Class<?> getDeclaringClass() {
+        return declaringClass;
+    }
+
+    public String getFieldName() {
+        return fieldName;
+    }
+
+    /**
+     * Gets a description of the location where this option is stored.
+     */
+    public String getLocation() {
+        return getDeclaringClass().getName() + "." + getFieldName();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.options/src/com/oracle/jvmci/options/OptionType.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.options;
+
+/**
+ * Classifies JVMCI options in several categories depending on who this option is relevant for.
+ *
+ */
+public enum OptionType {
+    /**
+     * An option common for users to apply.
+     */
+    User,
+
+    /**
+     * An option only relevant in corner cases and for fine-tuning.
+     */
+    Expert,
+
+    /**
+     * An option only relevant when debugging the compiler.
+     */
+    Debug
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.options/src/com/oracle/jvmci/options/OptionUtils.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,182 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.options;
+
+import java.util.*;
+
+public class OptionUtils {
+
+    public interface OptionConsumer {
+        void set(OptionDescriptor desc, Object value);
+    }
+
+    /**
+     * Parses a given option value specification.
+     *
+     * @param option the specification of an option and its value
+     * @param setter the object to notify of the parsed option and value.
+     */
+    public static void parseOption(String option, OptionConsumer setter) {
+        SortedMap<String, OptionDescriptor> options = OptionsLoader.options;
+        Objects.requireNonNull(setter);
+        if (option.length() == 0) {
+            return;
+        }
+
+        Object value = null;
+        String optionName = null;
+        String valueString = null;
+
+        char first = option.charAt(0);
+        if (first == '+' || first == '-') {
+            optionName = option.substring(1);
+            value = (first == '+');
+        } else {
+            int index = option.indexOf('=');
+            if (index == -1) {
+                optionName = option;
+                valueString = null;
+            } else {
+                optionName = option.substring(0, index);
+                valueString = option.substring(index + 1);
+            }
+        }
+
+        OptionDescriptor desc = options.get(optionName);
+        if (desc == null) {
+            throw new IllegalArgumentException("Option '" + optionName + "' not found");
+        }
+
+        Class<?> optionType = desc.getType();
+
+        if (value == null) {
+            if (optionType == Boolean.TYPE || optionType == Boolean.class) {
+                throw new IllegalArgumentException("Boolean option '" + optionName + "' must use +/- prefix");
+            }
+
+            if (valueString == null) {
+                throw new IllegalArgumentException("Missing value for non-boolean option '" + optionName + "' must use " + optionName + "=<value> format");
+            }
+
+            if (optionType == Float.class) {
+                value = Float.parseFloat(valueString);
+            } else if (optionType == Double.class) {
+                value = Double.parseDouble(valueString);
+            } else if (optionType == Integer.class) {
+                value = Integer.valueOf((int) parseLong(valueString));
+            } else if (optionType == Long.class) {
+                value = Long.valueOf(parseLong(valueString));
+            } else if (optionType == String.class) {
+                value = valueString;
+            } else {
+                throw new IllegalArgumentException("Wrong value for option '" + optionName + "'");
+            }
+        } else {
+            if (optionType != Boolean.class) {
+                throw new IllegalArgumentException("Non-boolean option '" + optionName + "' can not use +/- prefix. Use " + optionName + "=<value> format");
+            }
+        }
+
+        setter.set(desc, value);
+    }
+
+    private static long parseLong(String v) {
+        String valueString = v.toLowerCase();
+        long scale = 1;
+        if (valueString.endsWith("k")) {
+            scale = 1024L;
+        } else if (valueString.endsWith("m")) {
+            scale = 1024L * 1024L;
+        } else if (valueString.endsWith("g")) {
+            scale = 1024L * 1024L * 1024L;
+        } else if (valueString.endsWith("t")) {
+            scale = 1024L * 1024L * 1024L * 1024L;
+        }
+
+        if (scale != 1) {
+            /* Remove trailing scale character. */
+            valueString = valueString.substring(0, valueString.length() - 1);
+        }
+
+        return Long.parseLong(valueString) * scale;
+    }
+
+    /**
+     * Wraps some given text to one or more lines of a given maximum width.
+     *
+     * @param text text to wrap
+     * @param width maximum width of an output line, exception for words in {@code text} longer than
+     *            this value
+     * @return {@code text} broken into lines
+     */
+    private static List<String> wrap(String text, int width) {
+        List<String> lines = Collections.singletonList(text);
+        if (text.length() > width) {
+            String[] chunks = text.split("\\s+");
+            lines = new ArrayList<>();
+            StringBuilder line = new StringBuilder();
+            for (String chunk : chunks) {
+                if (line.length() + chunk.length() > width) {
+                    lines.add(line.toString());
+                    line.setLength(0);
+                }
+                if (line.length() != 0) {
+                    line.append(' ');
+                }
+                String[] embeddedLines = chunk.split("%n", -2);
+                if (embeddedLines.length == 1) {
+                    line.append(chunk);
+                } else {
+                    for (int i = 0; i < embeddedLines.length; i++) {
+                        line.append(embeddedLines[i]);
+                        if (i < embeddedLines.length - 1) {
+                            lines.add(line.toString());
+                            line.setLength(0);
+                        }
+                    }
+                }
+            }
+            if (line.length() != 0) {
+                lines.add(line.toString());
+            }
+        }
+        return lines;
+    }
+
+    public static void printFlags(SortedMap<String, OptionDescriptor> options, String prefix) {
+        System.out.println("[List of " + prefix + " options]");
+        SortedMap<String, OptionDescriptor> sortedOptions = options;
+        for (Map.Entry<String, OptionDescriptor> e : sortedOptions.entrySet()) {
+            e.getKey();
+            OptionDescriptor desc = e.getValue();
+            Object value = desc.getOptionValue().getValue();
+            List<String> helpLines = wrap(desc.getHelp(), 70);
+            System.out.println(String.format("%9s %-40s = %-14s %s", desc.getType().getSimpleName(), e.getKey(), value, helpLines.get(0)));
+            for (int i = 1; i < helpLines.size(); i++) {
+                System.out.println(String.format("%67s %s", " ", helpLines.get(i)));
+            }
+        }
+
+        System.exit(0);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.options/src/com/oracle/jvmci/options/OptionValue.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,475 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.options;
+
+import java.io.*;
+import java.util.*;
+import java.util.Map.Entry;
+
+/**
+ * An option value.
+ */
+public class OptionValue<T> {
+    /**
+     * Temporarily changes the value for an option. The {@linkplain OptionValue#getValue() value} of
+     * {@code option} is set to {@code value} until {@link OverrideScope#close()} is called on the
+     * object returned by this method.
+     * <p>
+     * Since the returned object is {@link AutoCloseable} the try-with-resource construct can be
+     * used:
+     *
+     * <pre>
+     * try (OverrideScope s = OptionValue.override(myOption, myValue) {
+     *     // code that depends on myOption == myValue
+     * }
+     * </pre>
+     */
+    public static OverrideScope override(OptionValue<?> option, Object value) {
+        OverrideScope current = getOverrideScope();
+        if (current == null) {
+            if (!value.equals(option.getValue())) {
+                return new SingleOverrideScope(option, value);
+            }
+            Map<OptionValue<?>, Object> overrides = Collections.emptyMap();
+            return new MultipleOverridesScope(current, overrides);
+        }
+        return new MultipleOverridesScope(current, option, value);
+    }
+
+    /**
+     * Temporarily changes the values for a set of options. The {@linkplain OptionValue#getValue()
+     * value} of each {@code option} in {@code overrides} is set to the corresponding {@code value}
+     * in {@code overrides} until {@link OverrideScope#close()} is called on the object returned by
+     * this method.
+     * <p>
+     * Since the returned object is {@link AutoCloseable} the try-with-resource construct can be
+     * used:
+     *
+     * <pre>
+     * Map&lt;OptionValue, Object&gt; overrides = new HashMap&lt;&gt;();
+     * overrides.put(myOption1, myValue1);
+     * overrides.put(myOption2, myValue2);
+     * try (OverrideScope s = OptionValue.override(overrides) {
+     *     // code that depends on myOption == myValue
+     * }
+     * </pre>
+     */
+    public static OverrideScope override(Map<OptionValue<?>, Object> overrides) {
+        OverrideScope current = getOverrideScope();
+        if (current == null && overrides.size() == 1) {
+            Entry<OptionValue<?>, Object> single = overrides.entrySet().iterator().next();
+            OptionValue<?> option = single.getKey();
+            Object overrideValue = single.getValue();
+            if (!overrideValue.equals(option.getValue())) {
+                return new SingleOverrideScope(option, overrideValue);
+            }
+        }
+        return new MultipleOverridesScope(current, overrides);
+    }
+
+    /**
+     * Temporarily changes the values for a set of options. The {@linkplain OptionValue#getValue()
+     * value} of each {@code option} in {@code overrides} is set to the corresponding {@code value}
+     * in {@code overrides} until {@link OverrideScope#close()} is called on the object returned by
+     * this method.
+     * <p>
+     * Since the returned object is {@link AutoCloseable} the try-with-resource construct can be
+     * used:
+     *
+     * <pre>
+     * try (OverrideScope s = OptionValue.override(myOption1, myValue1, myOption2, myValue2) {
+     *     // code that depends on myOption == myValue
+     * }
+     * </pre>
+     *
+     * @param overrides overrides in the form {@code [option1, override1, option2, override2, ...]}
+     */
+    public static OverrideScope override(Object... overrides) {
+        OverrideScope current = getOverrideScope();
+        if (current == null && overrides.length == 2) {
+            OptionValue<?> option = (OptionValue<?>) overrides[0];
+            Object overrideValue = overrides[1];
+            if (!overrideValue.equals(option.getValue())) {
+                return new SingleOverrideScope(option, overrideValue);
+            }
+        }
+        Map<OptionValue<?>, Object> map = Collections.emptyMap();
+        for (int i = 0; i < overrides.length; i += 2) {
+            OptionValue<?> option = (OptionValue<?>) overrides[i];
+            Object overrideValue = overrides[i + 1];
+            if (!overrideValue.equals(option.getValue())) {
+                if (map.isEmpty()) {
+                    map = new HashMap<>();
+                }
+                map.put(option, overrideValue);
+            }
+        }
+        return new MultipleOverridesScope(current, map);
+    }
+
+    private static final ThreadLocal<OverrideScope> overrideScopeTL = new ThreadLocal<>();
+
+    protected static OverrideScope getOverrideScope() {
+        return overrideScopeTL.get();
+    }
+
+    protected static void setOverrideScope(OverrideScope overrideScope) {
+        overrideScopeTL.set(overrideScope);
+    }
+
+    private T defaultValue;
+
+    /**
+     * The raw option value.
+     */
+    protected T value;
+
+    private OptionDescriptor descriptor;
+
+    private long reads;
+    private OptionValue<?> next;
+    private static OptionValue<?> head;
+
+    private static final boolean ShowReadsHistogram = Boolean.getBoolean("jvmci.showOptionValueReadsHistogram");
+
+    private static void addToHistogram(OptionValue<?> option) {
+        if (ShowReadsHistogram) {
+            synchronized (OptionValue.class) {
+                option.next = head;
+                head = option;
+            }
+        }
+    }
+
+    @SuppressWarnings("unchecked")
+    public OptionValue(T value) {
+        this.defaultValue = value;
+        this.value = (T) DEFAULT;
+        addToHistogram(this);
+    }
+
+    private static final Object DEFAULT = "DEFAULT";
+    private static final Object UNINITIALIZED = "UNINITIALIZED";
+
+    /**
+     * Creates an uninitialized option value for a subclass that initializes itself
+     * {@link #defaultValue() lazily}.
+     */
+    @SuppressWarnings("unchecked")
+    protected OptionValue() {
+        this.defaultValue = (T) UNINITIALIZED;
+        this.value = (T) DEFAULT;
+        addToHistogram(this);
+    }
+
+    /**
+     * Lazy initialization of default value.
+     */
+    protected T defaultValue() {
+        throw new InternalError("Option without a default value value must override defaultValue()");
+    }
+
+    /**
+     * Sets the descriptor for this option.
+     */
+    public void setDescriptor(OptionDescriptor descriptor) {
+        this.descriptor = descriptor;
+    }
+
+    /**
+     * Returns the descriptor for this option, if it has been set by
+     * {@link #setDescriptor(OptionDescriptor)}.
+     */
+    public OptionDescriptor getDescriptor() {
+        return descriptor;
+    }
+
+    /**
+     * Gets the name of this option. The name for an option value with a null
+     * {@linkplain #setDescriptor(OptionDescriptor) descriptor} is the value of
+     * {@link Object#toString()}.
+     */
+    public String getName() {
+        return descriptor == null ? super.toString() : (descriptor.getDeclaringClass().getName() + "." + descriptor.getName());
+    }
+
+    @Override
+    public String toString() {
+        return getName() + "=" + getValue();
+    }
+
+    /**
+     * The initial value specified in source code. The returned value is not affected by calls to
+     * {@link #setValue(Object)} or registering {@link OverrideScope}s. Therefore, it is also not
+     * affected by options set on the command line.
+     */
+    public T getDefaultValue() {
+        if (defaultValue == UNINITIALIZED) {
+            defaultValue = defaultValue();
+        }
+        return defaultValue;
+    }
+
+    /**
+     * Returns true if the option has the same value that was set in the source code.
+     */
+    public boolean hasDefaultValue() {
+        getValue(); // ensure initialized
+        return value == DEFAULT || Objects.equals(value, getDefaultValue());
+    }
+
+    /**
+     * Gets the value of this option.
+     */
+    public T getValue() {
+        if (ShowReadsHistogram) {
+            reads++;
+        }
+        if (!(this instanceof StableOptionValue)) {
+            OverrideScope overrideScope = getOverrideScope();
+            if (overrideScope != null) {
+                T override = overrideScope.getOverride(this);
+                if (override != null) {
+                    return override;
+                }
+            }
+        }
+        if (value != DEFAULT) {
+            return value;
+        } else {
+            return getDefaultValue();
+        }
+    }
+
+    /**
+     * Gets the values of this option including overridden values.
+     *
+     * @param c the collection to which the values are added. If null, one is allocated.
+     * @return the collection to which the values were added in order from most overridden to
+     *         current value
+     */
+    @SuppressWarnings("unchecked")
+    public Collection<T> getValues(Collection<T> c) {
+        Collection<T> values = c == null ? new ArrayList<>() : c;
+        if (!(this instanceof StableOptionValue)) {
+            OverrideScope overrideScope = getOverrideScope();
+            if (overrideScope != null) {
+                overrideScope.getOverrides(this, (Collection<Object>) values);
+            }
+        }
+        if (value != DEFAULT) {
+            values.add(value);
+        } else {
+            values.add(getDefaultValue());
+        }
+        return values;
+    }
+
+    /**
+     * Sets the value of this option.
+     */
+    @SuppressWarnings("unchecked")
+    public void setValue(Object v) {
+        this.value = (T) v;
+    }
+
+    /**
+     * An object whose {@link #close()} method reverts the option value overriding initiated by
+     * {@link OptionValue#override(OptionValue, Object)} or {@link OptionValue#override(Map)}.
+     */
+    public abstract static class OverrideScope implements AutoCloseable {
+
+        private Map<DerivedOptionValue<?>, Object> derivedCache = null;
+
+        public <T> T getDerived(DerivedOptionValue<T> key) {
+            if (derivedCache == null) {
+                derivedCache = new HashMap<>();
+            }
+            @SuppressWarnings("unchecked")
+            T ret = (T) derivedCache.get(key);
+            if (ret == null) {
+                ret = key.createValue();
+                derivedCache.put(key, ret);
+            }
+            return ret;
+        }
+
+        abstract void addToInherited(Map<OptionValue<?>, Object> inherited);
+
+        abstract <T> T getOverride(OptionValue<T> option);
+
+        abstract void getOverrides(OptionValue<?> option, Collection<Object> c);
+
+        public abstract void close();
+    }
+
+    static class SingleOverrideScope extends OverrideScope {
+
+        private final OptionValue<?> option;
+        private final Object value;
+
+        public SingleOverrideScope(OptionValue<?> option, Object value) {
+            if (option instanceof StableOptionValue) {
+                throw new IllegalArgumentException("Cannot override stable option " + option);
+            }
+            this.option = option;
+            this.value = value;
+            setOverrideScope(this);
+        }
+
+        @Override
+        void addToInherited(Map<OptionValue<?>, Object> inherited) {
+            inherited.put(option, value);
+        }
+
+        @SuppressWarnings("unchecked")
+        @Override
+        <T> T getOverride(OptionValue<T> key) {
+            if (key == this.option) {
+                return (T) value;
+            }
+            return null;
+        }
+
+        @Override
+        void getOverrides(OptionValue<?> key, Collection<Object> c) {
+            if (key == this.option) {
+                c.add(value);
+            }
+        }
+
+        @Override
+        public void close() {
+            setOverrideScope(null);
+        }
+    }
+
+    static class MultipleOverridesScope extends OverrideScope {
+        final OverrideScope parent;
+        final Map<OptionValue<?>, Object> overrides;
+
+        public MultipleOverridesScope(OverrideScope parent, OptionValue<?> option, Object value) {
+            this.parent = parent;
+            this.overrides = new HashMap<>();
+            if (parent != null) {
+                parent.addToInherited(overrides);
+            }
+            if (option instanceof StableOptionValue) {
+                throw new IllegalArgumentException("Cannot override stable option " + option);
+            }
+            if (!value.equals(option.getValue())) {
+                this.overrides.put(option, value);
+            }
+            if (!overrides.isEmpty()) {
+                setOverrideScope(this);
+            }
+        }
+
+        MultipleOverridesScope(OverrideScope parent, Map<OptionValue<?>, Object> overrides) {
+            this.parent = parent;
+            if (overrides.isEmpty() && parent == null) {
+                this.overrides = Collections.emptyMap();
+                return;
+            }
+            this.overrides = new HashMap<>();
+            if (parent != null) {
+                parent.addToInherited(this.overrides);
+            }
+            for (Map.Entry<OptionValue<?>, Object> e : overrides.entrySet()) {
+                OptionValue<?> option = e.getKey();
+                if (option instanceof StableOptionValue) {
+                    throw new IllegalArgumentException("Cannot override stable option " + option);
+                }
+                if (!e.getValue().equals(option.getValue())) {
+                    this.overrides.put(option, e.getValue());
+                }
+            }
+            if (!this.overrides.isEmpty()) {
+                setOverrideScope(this);
+            }
+        }
+
+        @Override
+        void addToInherited(Map<OptionValue<?>, Object> inherited) {
+            if (parent != null) {
+                parent.addToInherited(inherited);
+            }
+            inherited.putAll(overrides);
+        }
+
+        @SuppressWarnings("unchecked")
+        @Override
+        <T> T getOverride(OptionValue<T> option) {
+            return (T) overrides.get(option);
+        }
+
+        @Override
+        void getOverrides(OptionValue<?> option, Collection<Object> c) {
+            Object v = overrides.get(option);
+            if (v != null) {
+                c.add(v);
+            }
+            if (parent != null) {
+                parent.getOverrides(option, c);
+            }
+        }
+
+        @Override
+        public void close() {
+            if (!overrides.isEmpty()) {
+                setOverrideScope(parent);
+            }
+        }
+    }
+
+    static {
+        if (ShowReadsHistogram) {
+            Runtime.getRuntime().addShutdownHook(new Thread() {
+                @Override
+                public void run() {
+                    ArrayList<OptionValue<?>> options = new ArrayList<>();
+                    for (OptionValue<?> option = head; option != null; option = option.next) {
+                        options.add(option);
+                    }
+                    Collections.sort(options, new Comparator<OptionValue<?>>() {
+
+                        public int compare(OptionValue<?> o1, OptionValue<?> o2) {
+                            if (o1.reads < o2.reads) {
+                                return -1;
+                            } else if (o1.reads > o2.reads) {
+                                return 1;
+                            } else {
+                                return o1.getName().compareTo(o2.getName());
+                            }
+                        }
+                    });
+                    PrintStream out = System.out;
+                    out.println("=== OptionValue reads histogram ===");
+                    for (OptionValue<?> option : options) {
+                        out.println(option.reads + "\t" + option);
+                    }
+                }
+            });
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.options/src/com/oracle/jvmci/options/Options.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.options;
+
+import java.util.*;
+
+/**
+ * A {@linkplain ServiceLoader service} for accessing a set of {@link OptionDescriptor}s.
+ */
+public interface Options extends Iterable<OptionDescriptor> {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.options/src/com/oracle/jvmci/options/OptionsLoader.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.options;
+
+import java.util.*;
+
+import com.oracle.jvmci.runtime.*;
+
+/**
+ * Helper class used to load option descriptors. Only to be used in the slow-path.
+ */
+public class OptionsLoader {
+    public static final SortedMap<String, OptionDescriptor> options = new TreeMap<>();
+
+    /**
+     * Initializes {@link #options} from {@link Options} services.
+     */
+    static {
+        for (Options opts : Services.load(Options.class)) {
+            for (OptionDescriptor desc : opts) {
+                String name = desc.getName();
+                OptionDescriptor existing = options.put(name, desc);
+                assert existing == null : "Option named \"" + name + "\" has multiple definitions: " + existing.getLocation() + " and " + desc.getLocation();
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.options/src/com/oracle/jvmci/options/StableOptionValue.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.options;
+
+/**
+ * An option that always returns the same {@linkplain #getValue() value}.
+ */
+public class StableOptionValue<T> extends OptionValue<T> {
+
+    /**
+     * Creates a stable option value.
+     */
+    public StableOptionValue(T value) {
+        super(value);
+    }
+
+    /**
+     * Used to assert the invariant for stability. Without using locks, this check is not safe
+     * against races and so it's only an assertion.
+     */
+    private boolean getValueCalled;
+
+    /**
+     * Creates an uninitialized stable option value for a subclass that initializes itself
+     * {@link #defaultValue() lazily}.
+     */
+    public StableOptionValue() {
+    }
+
+    /**
+     * Gets the value of this option.
+     */
+    @Override
+    public final T getValue() {
+        T result = super.getValue();
+        assert initGetValueCalled();
+        return result;
+    }
+
+    private boolean initGetValueCalled() {
+        getValueCalled = true;
+        return true;
+    }
+
+    /**
+     * {@inheritDoc}
+     * <p>
+     * This must only be called if {@link #getValue()} has never been called.
+     */
+    @Override
+    public final void setValue(Object v) {
+        assert !getValueCalled;
+        super.setValue(v);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.runtime.processor/src/META-INF/services/javax.annotation.processing.Processor	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,1 @@
+com.oracle.jvmci.runtime.processor.ServiceProviderProcessor
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.runtime.processor/src/com/oracle/jvmci/runtime/processor/ServiceProviderProcessor.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,111 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.runtime.processor;
+
+import java.io.*;
+import java.util.*;
+
+import javax.annotation.processing.*;
+import javax.lang.model.*;
+import javax.lang.model.element.*;
+import javax.lang.model.type.*;
+import javax.tools.Diagnostic.Kind;
+import javax.tools.*;
+
+import com.oracle.jvmci.runtime.*;
+
+@SupportedAnnotationTypes("com.oracle.jvmci.runtime.ServiceProvider")
+public class ServiceProviderProcessor extends AbstractProcessor {
+
+    private final Set<TypeElement> processed = new HashSet<>();
+
+    @Override
+    public SourceVersion getSupportedSourceVersion() {
+        return SourceVersion.latest();
+    }
+
+    private boolean verifyAnnotation(TypeMirror serviceInterface, TypeElement serviceProvider) {
+        if (!processingEnv.getTypeUtils().isSubtype(serviceProvider.asType(), serviceInterface)) {
+            String msg = String.format("Service provider class %s doesn't implement service interface %s", serviceProvider.getSimpleName(), serviceInterface);
+            processingEnv.getMessager().printMessage(Kind.ERROR, msg, serviceProvider);
+            return false;
+        }
+
+        return true;
+    }
+
+    private void processElement(TypeElement serviceProvider) {
+        if (processed.contains(serviceProvider)) {
+            return;
+        }
+
+        processed.add(serviceProvider);
+        ServiceProvider annotation = serviceProvider.getAnnotation(ServiceProvider.class);
+        if (annotation != null) {
+            try {
+                annotation.value();
+            } catch (MirroredTypeException ex) {
+                TypeMirror serviceInterface = ex.getTypeMirror();
+                if (verifyAnnotation(serviceInterface, serviceProvider)) {
+                    String interfaceName = ex.getTypeMirror().toString();
+                    createProviderFile(serviceProvider, interfaceName);
+                }
+            }
+        }
+    }
+
+    private void createProviderFile(TypeElement serviceProvider, String interfaceName) {
+        if (serviceProvider.getNestingKind().isNested()) {
+            // This is a simplifying constraint that means we don't have to
+            // processed the qualified name to insert '$' characters at
+            // the relevant positions.
+            String msg = String.format("Service provider class %s must be a top level class", serviceProvider.getSimpleName());
+            processingEnv.getMessager().printMessage(Kind.ERROR, msg, serviceProvider);
+            return;
+        }
+
+        String filename = "META-INF/providers/" + serviceProvider.getQualifiedName();
+        try {
+            FileObject file = processingEnv.getFiler().createResource(StandardLocation.CLASS_OUTPUT, "", filename, serviceProvider);
+            PrintWriter writer = new PrintWriter(new OutputStreamWriter(file.openOutputStream(), "UTF-8"));
+            writer.println(interfaceName);
+            writer.close();
+        } catch (IOException e) {
+            processingEnv.getMessager().printMessage(Kind.ERROR, e.getMessage(), serviceProvider);
+        }
+    }
+
+    @Override
+    public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
+        if (roundEnv.processingOver()) {
+            return true;
+        }
+
+        for (Element element : roundEnv.getElementsAnnotatedWith(ServiceProvider.class)) {
+            assert element.getKind().isClass();
+            processElement((TypeElement) element);
+        }
+
+        return true;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.runtime/src/com/oracle/jvmci/runtime/JVMCI.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2015, 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.jvmci.runtime;
+
+import java.util.*;
+
+public class JVMCI {
+
+    private static final JVMCIRuntime runtime;
+
+    private static native JVMCIRuntime initializeRuntime();
+
+    /**
+     * Gets the singleton {@link JVMCIRuntime} instance available to the application.
+     *
+     * @throws UnsupportedOperationException if JVMCI is not supported
+     */
+    public static JVMCIRuntime getRuntime() {
+        if (runtime == null) {
+            String javaHome = System.getProperty("java.home");
+            String vmName = System.getProperty("java.vm.name");
+            Formatter errorMessage = new Formatter();
+            errorMessage.format("The VM does not support the JVMCI API.%n");
+            errorMessage.format("Currently used Java home directory is %s.%n", javaHome);
+            errorMessage.format("Currently used VM configuration is: %s", vmName);
+            throw new UnsupportedOperationException(errorMessage.toString());
+        }
+        return runtime;
+    }
+
+    static {
+        JVMCIRuntime rt = null;
+        try {
+            rt = initializeRuntime();
+        } catch (UnsatisfiedLinkError e) {
+        }
+        runtime = rt;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.runtime/src/com/oracle/jvmci/runtime/JVMCIBackend.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2015, 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.jvmci.runtime;
+
+import com.oracle.jvmci.code.CodeCacheProvider;
+import com.oracle.jvmci.code.TargetDescription;
+import com.oracle.jvmci.meta.MetaAccessProvider;
+import com.oracle.jvmci.meta.ConstantReflectionProvider;
+
+/**
+ * A JVMCI backend encapsulates the capabilities needed by a Java based compiler for compiling and
+ * installing code for a single compute unit within a JVM. In a JVM with support for heterogeneous
+ * computing, more than one backend may be exposed.
+ */
+public class JVMCIBackend {
+
+    private final MetaAccessProvider metaAccess;
+    private final CodeCacheProvider codeCache;
+    private final ConstantReflectionProvider constantReflection;
+
+    public JVMCIBackend(MetaAccessProvider metaAccess, CodeCacheProvider codeCache, ConstantReflectionProvider constantReflection) {
+        this.metaAccess = metaAccess;
+        this.codeCache = codeCache;
+        this.constantReflection = constantReflection;
+    }
+
+    public MetaAccessProvider getMetaAccess() {
+        return metaAccess;
+    }
+
+    public CodeCacheProvider getCodeCache() {
+        return codeCache;
+    }
+
+    public ConstantReflectionProvider getConstantReflection() {
+        return constantReflection;
+    }
+
+    public TargetDescription getTarget() {
+        return codeCache.getTarget();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.runtime/src/com/oracle/jvmci/runtime/JVMCIRuntime.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2015, 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.jvmci.runtime;
+
+import com.oracle.jvmci.code.Architecture;
+
+/**
+ * Interface for accessing the {@link JVMCI} APIs supported by the runtime.
+ */
+public interface JVMCIRuntime {
+
+    /**
+     * Gets the host JVMCI backend.
+     */
+    JVMCIBackend getHostJVMCIBackend();
+
+    /**
+     * Gets the backend for a given architecture.
+     *
+     * @param arch a specific architecture class
+     */
+    <T extends Architecture> JVMCIBackend getJVMCIBackend(Class<T> arch);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.runtime/src/com/oracle/jvmci/runtime/OptionsParsed.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2015, 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.jvmci.runtime;
+
+/**
+ * Extension for doing post-processing once all JVMCI options have been parsed and initialized.
+ */
+public interface OptionsParsed extends Service {
+
+    /**
+     * Notifies this service that all JVMCI options have been parsed and initialized.
+     */
+    void run();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.runtime/src/com/oracle/jvmci/runtime/Service.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.runtime;
+
+/**
+ * Denotes a service that may be efficiently loaded by {@link Services#load(Class)}.
+ */
+public interface Service {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.runtime/src/com/oracle/jvmci/runtime/ServiceProvider.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.runtime;
+
+import java.lang.annotation.*;
+
+@Retention(RetentionPolicy.CLASS)
+@Target(ElementType.TYPE)
+public @interface ServiceProvider {
+
+    Class<?> value();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.jvmci.runtime/src/com/oracle/jvmci/runtime/Services.java	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.jvmci.runtime;
+
+import static java.lang.String.*;
+
+import java.util.*;
+
+/**
+ * A mechanism on top of the standard {@link ServiceLoader} that enables a runtime to efficiently
+ * load services marked by {@link Service}. This may be important for services loaded early in the
+ * runtime initialization process.
+ */
+public class Services {
+
+    private static final ClassValue<List<Service>> cache = new ClassValue<List<Service>>() {
+        @Override
+        protected List<Service> computeValue(Class<?> type) {
+            Service[] names = getServiceImpls(type);
+            if (names == null || names.length == 0) {
+                throw new InternalError(
+                                format("No implementations for %s found (ensure %s extends %s and that in suite.py the \"annotationProcessors\" attribute for the project enclosing %s includes \"com.oracle.jvmci.runtime.processor\")",
+                                                type.getSimpleName(), type.getSimpleName(), Service.class, type.getSimpleName()));
+            }
+            return Arrays.asList(names);
+        }
+    };
+
+    /**
+     * Gets an {@link Iterable} of the implementations available for a given service.
+     */
+    @SuppressWarnings("unchecked")
+    public static <S> Iterable<S> load(Class<S> service) {
+        if (Service.class.isAssignableFrom(service)) {
+            try {
+                return (Iterable<S>) cache.get(service);
+            } catch (UnsatisfiedLinkError e) {
+                // Fall back to standard SerivceLoader
+            }
+        }
+        return ServiceLoader.load(service, Services.class.getClassLoader());
+    }
+
+    private static native <S> S[] getServiceImpls(Class<?> service);
+}
--- a/graal/com.oracle.nfi.test/test/com/oracle/nfi/test/NativeFunctionInterfaceTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.nfi.test/test/com/oracle/nfi/test/NativeFunctionInterfaceTest.java	Thu May 28 21:11:28 2015 -0700
@@ -22,7 +22,7 @@
  */
 package com.oracle.nfi.test;
 
-import static com.oracle.graal.compiler.common.UnsafeAccess.*;
+import static com.oracle.jvmci.common.UnsafeAccess.*;
 import static java.io.File.*;
 import static java.lang.System.*;
 import static org.junit.Assert.*;
--- a/graal/com.oracle.truffle.api.dsl.test/src/com/oracle/truffle/api/dsl/test/CachedTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.truffle.api.dsl.test/src/com/oracle/truffle/api/dsl/test/CachedTest.java	Thu May 28 21:11:28 2015 -0700
@@ -40,7 +40,6 @@
 import com.oracle.truffle.api.dsl.test.CachedTestFactory.TestMultipleCachesFactory;
 import com.oracle.truffle.api.dsl.test.CachedTestFactory.UnboundCacheFactory;
 import com.oracle.truffle.api.dsl.test.TypeSystemTest.ValueNode;
-import com.oracle.truffle.api.nodes.*;
 
 @SuppressWarnings("unused")
 public class CachedTest {
--- a/graal/com.oracle.truffle.api.dsl.test/src/com/oracle/truffle/api/dsl/test/ExecuteGroupingTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.truffle.api.dsl.test/src/com/oracle/truffle/api/dsl/test/ExecuteGroupingTest.java	Thu May 28 21:11:28 2015 -0700
@@ -22,12 +22,10 @@
  */
 package com.oracle.truffle.api.dsl.test;
 
-import org.junit.*;
+import static org.junit.Assert.*;
+
 import org.junit.experimental.theories.*;
 import org.junit.runner.*;
-import org.junit.runners.Parameterized.Parameters;
-
-import static org.junit.Assert.*;
 
 import com.oracle.truffle.api.dsl.*;
 import com.oracle.truffle.api.dsl.test.ExecuteGroupingTestFactory.ExecuteGrouping1NodeGen;
@@ -37,7 +35,6 @@
 /*
  * This test aims to test the reuse of execute methods with evaluated parameters as much as possible.
  */
-@SuppressWarnings("unused")
 @RunWith(Theories.class)
 public class ExecuteGroupingTest {
 
--- a/graal/com.oracle.truffle.api.dsl.test/src/com/oracle/truffle/api/dsl/test/FallbackTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.truffle.api.dsl.test/src/com/oracle/truffle/api/dsl/test/FallbackTest.java	Thu May 28 21:11:28 2015 -0700
@@ -31,7 +31,8 @@
 import com.oracle.truffle.api.dsl.test.FallbackTestFactory.Fallback2Factory;
 import com.oracle.truffle.api.dsl.test.FallbackTestFactory.Fallback3Factory;
 import com.oracle.truffle.api.dsl.test.FallbackTestFactory.Fallback4Factory;
-import com.oracle.truffle.api.dsl.test.TypeSystemTest.*;
+import com.oracle.truffle.api.dsl.test.TypeSystemTest.TestRootNode;
+import com.oracle.truffle.api.dsl.test.TypeSystemTest.ValueNode;
 import com.oracle.truffle.api.frame.*;
 import com.oracle.truffle.api.nodes.*;
 
--- a/graal/com.oracle.truffle.api.dsl.test/src/com/oracle/truffle/api/dsl/test/LazyClassLoadingTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.truffle.api.dsl.test/src/com/oracle/truffle/api/dsl/test/LazyClassLoadingTest.java	Thu May 28 21:11:28 2015 -0700
@@ -28,7 +28,8 @@
 
 import com.oracle.truffle.api.dsl.*;
 import com.oracle.truffle.api.dsl.test.LazyClassLoadingTestFactory.TestNodeFactory;
-import com.oracle.truffle.api.dsl.test.TypeSystemTest.*;
+import com.oracle.truffle.api.dsl.test.TypeSystemTest.TestRootNode;
+import com.oracle.truffle.api.dsl.test.TypeSystemTest.ValueNode;
 
 public class LazyClassLoadingTest {
     @Test
--- a/graal/com.oracle.truffle.api.dsl.test/src/com/oracle/truffle/api/dsl/test/MethodGuardsTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.truffle.api.dsl.test/src/com/oracle/truffle/api/dsl/test/MethodGuardsTest.java	Thu May 28 21:11:28 2015 -0700
@@ -29,9 +29,6 @@
 
 import com.oracle.truffle.api.*;
 import com.oracle.truffle.api.dsl.*;
-import com.oracle.truffle.api.dsl.test.LimitTestFactory.ConstantLimitTestFactory;
-import com.oracle.truffle.api.dsl.test.LimitTestFactory.LocalLimitTestFactory;
-import com.oracle.truffle.api.dsl.test.LimitTestFactory.MethodLimitTestFactory;
 import com.oracle.truffle.api.dsl.test.MethodGuardsTestFactory.GuardCompareWithFieldTestFactory;
 import com.oracle.truffle.api.dsl.test.MethodGuardsTestFactory.GuardComplexTestFactory;
 import com.oracle.truffle.api.dsl.test.MethodGuardsTestFactory.GuardEqualByteIntTestFactory;
--- a/graal/com.oracle.truffle.api.dsl.test/src/com/oracle/truffle/api/dsl/test/ReachabilityTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.truffle.api.dsl.test/src/com/oracle/truffle/api/dsl/test/ReachabilityTest.java	Thu May 28 21:11:28 2015 -0700
@@ -25,7 +25,9 @@
 import java.math.*;
 
 import com.oracle.truffle.api.dsl.*;
-import com.oracle.truffle.api.dsl.test.TypeSystemTest.*;
+import com.oracle.truffle.api.dsl.test.TypeSystemTest.Abstract;
+import com.oracle.truffle.api.dsl.test.TypeSystemTest.BExtendsAbstract;
+import com.oracle.truffle.api.dsl.test.TypeSystemTest.ValueNode;
 
 public class ReachabilityTest {
 
--- a/graal/com.oracle.truffle.api.dsl.test/src/com/oracle/truffle/api/dsl/test/processor/Compile.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.truffle.api.dsl.test/src/com/oracle/truffle/api/dsl/test/processor/Compile.java	Thu May 28 21:11:28 2015 -0700
@@ -22,28 +22,14 @@
  */
 package com.oracle.truffle.api.dsl.test.processor;
 
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-import javax.tools.Diagnostic;
-import javax.tools.DiagnosticListener;
-import javax.tools.FileObject;
-import javax.tools.ForwardingJavaFileManager;
-import javax.tools.JavaFileManager;
-import javax.tools.JavaFileObject;
+import static org.junit.Assert.*;
+
+import java.io.*;
+import java.net.*;
+import java.util.*;
+
+import javax.tools.*;
 import javax.tools.JavaFileObject.Kind;
-import javax.tools.SimpleJavaFileObject;
-import javax.tools.StandardJavaFileManager;
-import javax.tools.ToolProvider;
-import static org.junit.Assert.*;
 
 final class Compile implements DiagnosticListener<JavaFileObject> {
     private final List<Diagnostic<? extends JavaFileObject>> errors = new ArrayList<>();
--- a/graal/com.oracle.truffle.api.dsl/src/com/oracle/truffle/api/dsl/internal/SpecializationNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.truffle.api.dsl/src/com/oracle/truffle/api/dsl/internal/SpecializationNode.java	Thu May 28 21:11:28 2015 -0700
@@ -39,7 +39,6 @@
 import com.oracle.truffle.api.dsl.internal.SlowPathEvent.SlowPathEventN;
 import com.oracle.truffle.api.frame.*;
 import com.oracle.truffle.api.nodes.*;
-import com.oracle.truffle.api.nodes.NodeFieldAccessor;
 
 /**
  * Internal implementation dependent base class for generated specialized nodes.
--- a/graal/com.oracle.truffle.api.object/src/com/oracle/truffle/api/object/Layout.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.truffle.api.object/src/com/oracle/truffle/api/object/Layout.java	Thu May 28 21:11:28 2015 -0700
@@ -27,7 +27,7 @@
 import java.util.*;
 
 import com.oracle.truffle.api.nodes.NodeUtil.FieldOffsetProvider;
-import com.oracle.truffle.api.object.Shape.*;
+import com.oracle.truffle.api.object.Shape.Allocator;
 
 public abstract class Layout {
     public static final EnumSet<ImplicitCast> NONE = EnumSet.noneOf(ImplicitCast.class);
--- a/graal/com.oracle.truffle.api.object/src/com/oracle/truffle/api/object/LayoutBuilder.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.truffle.api.object/src/com/oracle/truffle/api/object/LayoutBuilder.java	Thu May 28 21:11:28 2015 -0700
@@ -26,8 +26,8 @@
 
 import java.util.*;
 
-import com.oracle.truffle.api.nodes.NodeUtil.*;
-import com.oracle.truffle.api.object.Layout.*;
+import com.oracle.truffle.api.nodes.NodeUtil.FieldOffsetProvider;
+import com.oracle.truffle.api.object.Layout.ImplicitCast;
 
 public class LayoutBuilder {
     private EnumSet<ImplicitCast> allowedImplicitCasts;
--- a/graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/instrument/AdvancedInstrumentTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/instrument/AdvancedInstrumentTest.java	Thu May 28 21:11:28 2015 -0700
@@ -30,9 +30,9 @@
 import com.oracle.truffle.api.instrument.*;
 import com.oracle.truffle.api.nodes.*;
 import com.oracle.truffle.api.test.instrument.InstrumentationTestNodes.TestAdditionNode;
+import com.oracle.truffle.api.test.instrument.InstrumentationTestNodes.TestAdvancedInstrumentCounterRoot;
 import com.oracle.truffle.api.test.instrument.InstrumentationTestNodes.TestRootNode;
 import com.oracle.truffle.api.test.instrument.InstrumentationTestNodes.TestValueNode;
-import com.oracle.truffle.api.test.instrument.InstrumentationTestNodes.TestAdvancedInstrumentCounterRoot;
 
 /**
  * Tests the kind of instrumentation where a client can provide an AST fragment to be
--- a/graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/vm/TruffleTCK.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/vm/TruffleTCK.java	Thu May 28 21:11:28 2015 -0700
@@ -22,9 +22,11 @@
  */
 package com.oracle.truffle.api.test.vm;
 
-import com.oracle.truffle.api.vm.TruffleVM;
-import java.util.Random;
-import org.junit.Test;
+import java.util.*;
+
+import org.junit.*;
+
+import com.oracle.truffle.api.vm.*;
 
 /**
  * A collection of tests that can certify language implementaiton to be complient with most recent
--- a/graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/vm/TruffleVMSingleThreadedTest.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/vm/TruffleVMSingleThreadedTest.java	Thu May 28 21:11:28 2015 -0700
@@ -22,13 +22,12 @@
  */
 package com.oracle.truffle.api.test.vm;
 
-import com.oracle.truffle.api.vm.TruffleVM;
-import java.io.IOException;
-import java.io.StringReader;
-import java.net.URI;
-import java.net.URISyntaxException;
-import org.junit.Before;
-import org.junit.Test;
+import java.io.*;
+import java.net.*;
+
+import org.junit.*;
+
+import com.oracle.truffle.api.vm.*;
 
 public class TruffleVMSingleThreadedTest {
     TruffleVM tvm;
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/TruffleLanguage.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/TruffleLanguage.java	Thu May 28 21:11:28 2015 -0700
@@ -24,18 +24,14 @@
  */
 package com.oracle.truffle.api;
 
-import com.oracle.truffle.api.impl.Accessor;
-import com.oracle.truffle.api.source.Source;
-import com.oracle.truffle.api.vm.TruffleVM;
+import java.io.*;
+import java.lang.annotation.*;
+import java.lang.reflect.*;
+
+import com.oracle.truffle.api.impl.*;
+import com.oracle.truffle.api.source.*;
+import com.oracle.truffle.api.vm.*;
 import com.oracle.truffle.api.vm.TruffleVM.Language;
-import java.io.IOException;
-import java.io.Reader;
-import java.io.Writer;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-import java.lang.reflect.Constructor;
 
 /**
  * An entry point for everyone who wants to implement a Truffle based language. By providing
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/impl/Accessor.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/impl/Accessor.java	Thu May 28 21:11:28 2015 -0700
@@ -24,14 +24,13 @@
  */
 package com.oracle.truffle.api.impl;
 
-import com.oracle.truffle.api.TruffleLanguage;
-import com.oracle.truffle.api.vm.TruffleVM;
-import com.oracle.truffle.api.source.Source;
-import java.io.IOException;
-import java.lang.reflect.Constructor;
-import java.io.Reader;
-import java.io.Writer;
-import java.util.ServiceLoader;
+import java.io.*;
+import java.lang.reflect.*;
+import java.util.*;
+
+import com.oracle.truffle.api.*;
+import com.oracle.truffle.api.source.*;
+import com.oracle.truffle.api.vm.*;
 
 /**
  * Communication between TruffleVM and TruffleLanguage API/SPI.
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/impl/SymbolInvoker.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/impl/SymbolInvoker.java	Thu May 28 21:11:28 2015 -0700
@@ -24,7 +24,7 @@
  */
 package com.oracle.truffle.api.impl;
 
-import java.io.IOException;
+import java.io.*;
 
 /**
  * XXX: Temporary class to make unit tests pass without messing with Message implementations and
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/utilities/BinaryConditionProfile.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/utilities/BinaryConditionProfile.java	Thu May 28 21:11:28 2015 -0700
@@ -25,7 +25,7 @@
 package com.oracle.truffle.api.utilities;
 
 import com.oracle.truffle.api.*;
-import com.oracle.truffle.api.CompilerDirectives.*;
+import com.oracle.truffle.api.CompilerDirectives.CompilationFinal;
 
 /**
  * Utility class to speculate on conditions to be never true or to be never false. Condition
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/utilities/CountingConditionProfile.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/utilities/CountingConditionProfile.java	Thu May 28 21:11:28 2015 -0700
@@ -25,7 +25,7 @@
 package com.oracle.truffle.api.utilities;
 
 import com.oracle.truffle.api.*;
-import com.oracle.truffle.api.CompilerDirectives.*;
+import com.oracle.truffle.api.CompilerDirectives.CompilationFinal;
 
 /**
  * Utility class to speculate on conditions to be never true or to be never false. Additionally to
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/vm/TruffleVM.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/vm/TruffleVM.java	Thu May 28 21:11:28 2015 -0700
@@ -24,36 +24,18 @@
  */
 package com.oracle.truffle.api.vm;
 
-import com.oracle.truffle.api.TruffleLanguage;
-import com.oracle.truffle.api.TruffleLanguage.Registration;
+import java.io.*;
+import java.lang.reflect.*;
+import java.net.*;
+import java.nio.file.*;
+import java.util.*;
+import java.util.logging.*;
+
+import com.oracle.truffle.api.*;
 import com.oracle.truffle.api.TruffleLanguage.Env;
-import com.oracle.truffle.api.impl.Accessor;
-import com.oracle.truffle.api.source.Source;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStreamWriter;
-import java.io.Reader;
-import java.lang.reflect.Constructor;
-import java.io.Writer;
-import java.net.URI;
-import java.net.URL;
-import java.net.URLConnection;
-import java.nio.file.Files;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-import java.util.TreeSet;
-import java.util.logging.Level;
-import java.util.logging.Logger;
+import com.oracle.truffle.api.TruffleLanguage.Registration;
+import com.oracle.truffle.api.impl.*;
+import com.oracle.truffle.api.source.*;
 
 /**
  * Virtual machine for Truffle based languages. Use {@link #newVM()} to create new isolated virtual
--- a/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/expression/Parser.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/expression/Parser.java	Thu May 28 21:11:28 2015 -0700
@@ -25,11 +25,15 @@
 
 package com.oracle.truffle.dsl.processor.expression;
 
-import java.util.*;
 import java.io.*;
 import java.nio.charset.*;
+import java.util.*;
 
-import com.oracle.truffle.dsl.processor.expression.DSLExpression.*;
+import com.oracle.truffle.dsl.processor.expression.DSLExpression.Binary;
+import com.oracle.truffle.dsl.processor.expression.DSLExpression.Call;
+import com.oracle.truffle.dsl.processor.expression.DSLExpression.IntLiteral;
+import com.oracle.truffle.dsl.processor.expression.DSLExpression.Negate;
+import com.oracle.truffle.dsl.processor.expression.DSLExpression.Variable;
 
 // Checkstyle: stop
 // @formatter:off
--- a/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/expression/Scanner.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/expression/Scanner.java	Thu May 28 21:11:28 2015 -0700
@@ -25,11 +25,8 @@
 
 package com.oracle.truffle.dsl.processor.expression;
 
-import java.io.InputStream;
-import java.io.IOException;
-import java.io.RandomAccessFile;
-import java.util.Map;
-import java.util.HashMap;
+import java.io.*;
+import java.util.*;
 
 // Checkstyle: stop
 // @formatter:off
--- a/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/generator/GeneratorUtils.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/generator/GeneratorUtils.java	Thu May 28 21:11:28 2015 -0700
@@ -33,7 +33,7 @@
 
 import com.oracle.truffle.api.*;
 import com.oracle.truffle.api.dsl.*;
-import com.oracle.truffle.api.dsl.internal.DSLOptions.*;
+import com.oracle.truffle.api.dsl.internal.DSLOptions.TypeBoxingOptimization;
 import com.oracle.truffle.dsl.processor.*;
 import com.oracle.truffle.dsl.processor.java.*;
 import com.oracle.truffle.dsl.processor.java.model.*;
--- a/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/generator/ImplicitCastNodeFactory.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/generator/ImplicitCastNodeFactory.java	Thu May 28 21:11:28 2015 -0700
@@ -22,6 +22,7 @@
  */
 package com.oracle.truffle.dsl.processor.generator;
 
+import static com.oracle.truffle.dsl.processor.generator.GeneratorUtils.*;
 import static com.oracle.truffle.dsl.processor.java.ElementUtils.*;
 import static javax.lang.model.element.Modifier.*;
 
@@ -31,7 +32,7 @@
 import javax.lang.model.type.*;
 
 import com.oracle.truffle.api.*;
-import com.oracle.truffle.api.CompilerDirectives.*;
+import com.oracle.truffle.api.CompilerDirectives.CompilationFinal;
 import com.oracle.truffle.api.dsl.internal.*;
 import com.oracle.truffle.api.nodes.*;
 import com.oracle.truffle.dsl.processor.*;
@@ -39,8 +40,6 @@
 import com.oracle.truffle.dsl.processor.java.model.*;
 import com.oracle.truffle.dsl.processor.model.*;
 
-import static com.oracle.truffle.dsl.processor.generator.GeneratorUtils.*;
-
 public class ImplicitCastNodeFactory {
 
     private final ProcessorContext context;
--- a/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/model/ExecutableTypeData.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/model/ExecutableTypeData.java	Thu May 28 21:11:28 2015 -0700
@@ -22,9 +22,9 @@
  */
 package com.oracle.truffle.dsl.processor.model;
 
-import java.util.*;
+import static com.oracle.truffle.dsl.processor.java.ElementUtils.*;
 
-import static com.oracle.truffle.dsl.processor.java.ElementUtils.*;
+import java.util.*;
 
 import javax.lang.model.element.*;
 import javax.lang.model.type.*;
--- a/graal/com.oracle.truffle.interop/src/com/oracle/truffle/interop/SymbolInvokerImpl.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.truffle.interop/src/com/oracle/truffle/interop/SymbolInvokerImpl.java	Thu May 28 21:11:28 2015 -0700
@@ -24,19 +24,16 @@
  */
 package com.oracle.truffle.interop;
 
-import com.oracle.truffle.api.CallTarget;
-import com.oracle.truffle.api.Truffle;
-import com.oracle.truffle.api.frame.FrameDescriptor;
-import com.oracle.truffle.api.frame.VirtualFrame;
+import java.io.*;
+
+import com.oracle.truffle.api.*;
+import com.oracle.truffle.api.frame.*;
+import com.oracle.truffle.api.impl.*;
 import com.oracle.truffle.api.instrument.*;
-import com.oracle.truffle.api.interop.TruffleObject;
-import com.oracle.truffle.api.impl.SymbolInvoker;
-import com.oracle.truffle.api.nodes.RootNode;
-import com.oracle.truffle.interop.messages.Execute;
-import com.oracle.truffle.interop.messages.Receiver;
-import com.oracle.truffle.interop.node.ForeignObjectAccessNode;
-
-import java.io.IOException;
+import com.oracle.truffle.api.interop.*;
+import com.oracle.truffle.api.nodes.*;
+import com.oracle.truffle.interop.messages.*;
+import com.oracle.truffle.interop.node.*;
 
 public final class SymbolInvokerImpl extends SymbolInvoker {
     static final FrameDescriptor UNUSED_FRAMEDESCRIPTOR = new FrameDescriptor();
--- a/graal/com.oracle.truffle.interop/src/com/oracle/truffle/interop/node/ObjectAccessNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.truffle.interop/src/com/oracle/truffle/interop/node/ObjectAccessNode.java	Thu May 28 21:11:28 2015 -0700
@@ -27,7 +27,6 @@
 import com.oracle.truffle.api.*;
 import com.oracle.truffle.api.frame.*;
 import com.oracle.truffle.api.interop.*;
-import com.oracle.truffle.api.interop.InteropPredicate;
 import com.oracle.truffle.api.interop.messages.*;
 import com.oracle.truffle.api.nodes.*;
 import com.oracle.truffle.interop.*;
--- a/graal/com.oracle.truffle.object.basic/src/com/oracle/truffle/object/basic/DynamicObjectBasic.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.truffle.object.basic/src/com/oracle/truffle/object/basic/DynamicObjectBasic.java	Thu May 28 21:11:28 2015 -0700
@@ -26,7 +26,8 @@
 
 import com.oracle.truffle.api.object.*;
 import com.oracle.truffle.object.*;
-import com.oracle.truffle.object.basic.BasicLocations.*;
+import com.oracle.truffle.object.basic.BasicLocations.SimpleLongFieldLocation;
+import com.oracle.truffle.object.basic.BasicLocations.SimpleObjectFieldLocation;
 
 public class DynamicObjectBasic extends DynamicObjectImpl {
     @Retention(RetentionPolicy.RUNTIME)
--- a/graal/com.oracle.truffle.object/src/com/oracle/truffle/object/LayoutStrategy.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.truffle.object/src/com/oracle/truffle/object/LayoutStrategy.java	Thu May 28 21:11:28 2015 -0700
@@ -23,7 +23,7 @@
 package com.oracle.truffle.object;
 
 import com.oracle.truffle.api.object.*;
-import com.oracle.truffle.object.ShapeImpl.*;
+import com.oracle.truffle.object.ShapeImpl.BaseAllocator;
 
 public interface LayoutStrategy {
     boolean updateShape(DynamicObject object);
--- a/graal/com.oracle.truffle.object/src/com/oracle/truffle/object/PropertyImpl.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.truffle.object/src/com/oracle/truffle/object/PropertyImpl.java	Thu May 28 21:11:28 2015 -0700
@@ -25,7 +25,7 @@
 import java.util.*;
 
 import com.oracle.truffle.api.object.*;
-import com.oracle.truffle.object.Locations.*;
+import com.oracle.truffle.object.Locations.DeclaredLocation;
 
 /**
  * Property objects represent the mapping between property identifiers (keys) and storage locations.
--- a/graal/com.oracle.truffle.object/src/com/oracle/truffle/object/ShapeImpl.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.truffle.object/src/com/oracle/truffle/object/ShapeImpl.java	Thu May 28 21:11:28 2015 -0700
@@ -31,7 +31,8 @@
 import com.oracle.truffle.api.nodes.*;
 import com.oracle.truffle.api.object.*;
 import com.oracle.truffle.api.utilities.*;
-import com.oracle.truffle.object.LocationImpl.*;
+import com.oracle.truffle.object.LocationImpl.InternalLongLocation;
+import com.oracle.truffle.object.LocationImpl.LocationVisitor;
 import com.oracle.truffle.object.Locations.ConstantLocation;
 import com.oracle.truffle.object.Locations.DeclaredDualLocation;
 import com.oracle.truffle.object.Locations.DeclaredLocation;
--- a/graal/com.oracle.truffle.object/src/com/oracle/truffle/object/debug/JSONShapeVisitor.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.truffle.object/src/com/oracle/truffle/object/debug/JSONShapeVisitor.java	Thu May 28 21:11:28 2015 -0700
@@ -30,7 +30,7 @@
 import com.oracle.truffle.api.utilities.JSONHelper.JSONArrayBuilder;
 import com.oracle.truffle.api.utilities.JSONHelper.JSONObjectBuilder;
 import com.oracle.truffle.object.*;
-import com.oracle.truffle.object.Transition.*;
+import com.oracle.truffle.object.Transition.PropertyTransition;
 
 public class JSONShapeVisitor extends DebugShapeVisitor<JSONObjectBuilder> {
     @Override
--- a/graal/com.oracle.truffle.sl.test/src/com/oracle/truffle/sl/test/SLTestRunner.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.truffle.sl.test/src/com/oracle/truffle/sl/test/SLTestRunner.java	Thu May 28 21:11:28 2015 -0700
@@ -37,8 +37,8 @@
 import org.junit.runners.model.*;
 
 import com.oracle.truffle.api.dsl.*;
-import com.oracle.truffle.api.vm.TruffleVM;
-import com.oracle.truffle.sl.SLMain;
+import com.oracle.truffle.api.vm.*;
+import com.oracle.truffle.sl.*;
 import com.oracle.truffle.sl.builtins.*;
 import com.oracle.truffle.sl.test.SLTestRunner.TestCase;
 
--- a/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/builtins/SLHelloEqualsWorldBuiltin.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/builtins/SLHelloEqualsWorldBuiltin.java	Thu May 28 21:11:28 2015 -0700
@@ -22,8 +22,8 @@
  */
 package com.oracle.truffle.sl.builtins;
 
+import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
 import com.oracle.truffle.api.*;
-import com.oracle.truffle.api.CompilerDirectives.*;
 import com.oracle.truffle.api.dsl.*;
 import com.oracle.truffle.api.frame.*;
 import com.oracle.truffle.api.frame.FrameInstance.FrameAccess;
--- a/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/access/SLWritePropertyCacheNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/access/SLWritePropertyCacheNode.java	Thu May 28 21:11:28 2015 -0700
@@ -23,7 +23,7 @@
 package com.oracle.truffle.sl.nodes.access;
 
 import com.oracle.truffle.api.*;
-import com.oracle.truffle.api.CompilerDirectives.*;
+import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
 import com.oracle.truffle.api.dsl.*;
 import com.oracle.truffle.api.nodes.*;
 import com.oracle.truffle.api.object.*;
--- a/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/expression/SLAddNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/expression/SLAddNode.java	Thu May 28 21:11:28 2015 -0700
@@ -24,8 +24,8 @@
 
 import java.math.*;
 
+import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
 import com.oracle.truffle.api.*;
-import com.oracle.truffle.api.CompilerDirectives.*;
 import com.oracle.truffle.api.dsl.*;
 import com.oracle.truffle.api.nodes.*;
 import com.oracle.truffle.api.source.*;
--- a/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/expression/SLMulNode.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/expression/SLMulNode.java	Thu May 28 21:11:28 2015 -0700
@@ -24,8 +24,8 @@
 
 import java.math.*;
 
+import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
 import com.oracle.truffle.api.*;
-import com.oracle.truffle.api.CompilerDirectives.*;
 import com.oracle.truffle.api.dsl.*;
 import com.oracle.truffle.api.nodes.*;
 import com.oracle.truffle.api.source.*;
--- a/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/parser/Scanner.java	Thu May 28 15:10:18 2015 -0700
+++ b/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/parser/Scanner.java	Thu May 28 21:11:28 2015 -0700
@@ -25,11 +25,8 @@
 
 package com.oracle.truffle.sl.parser;
 
-import java.io.InputStream;
-import java.io.IOException;
-import java.io.RandomAccessFile;
-import java.util.Map;
-import java.util.HashMap;
+import java.io.*;
+import java.util.*;
 
 // Checkstyle: stop
 // @formatter:off
--- a/hotspot/.cproject	Thu May 28 15:10:18 2015 -0700
+++ b/hotspot/.cproject	Thu May 28 21:11:28 2015 -0700
@@ -26,7 +26,7 @@
 							<tool id="cdt.managedbuild.tool.gnu.archiver.base.1094883386" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/>
 							<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.base.1342888057" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.base">
 								<option id="gnu.cpp.compiler.option.include.paths.801956928" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath">
-									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/com.oracle.graal.hotspot/src_gen/hotspot}&quot;"/>
+									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/com.oracle.jvmci.hotspot/src_gen/hotspot}&quot;"/>
 								</option>
 								<option id="gnu.cpp.compiler.option.preprocessor.def.634868600" name="Defined symbols (-D)" superClass="gnu.cpp.compiler.option.preprocessor.def" valueType="definedSymbols">
 									<listOptionValue builtIn="false" value="_LP64=1"/>
@@ -42,9 +42,9 @@
 									<listOptionValue builtIn="false" value="TARGET_OS_FAMILY_linux=1"/>
 									<listOptionValue builtIn="false" value="TARGET_OS_ARCH_linux_x86=1"/>
 									<listOptionValue builtIn="false" value="TARGET_ARCH_MODEL_x86_64=1"/>
-									<listOptionValue builtIn="false" value="GRAAL=1"/>
+									<listOptionValue builtIn="false" value="JVMCI=1"/>
 									<listOptionValue builtIn="false" value="COMPILER2=1"/>
-									<listOptionValue builtIn="false" value="COMPILERGRAAL=1"/>
+									<listOptionValue builtIn="false" value="COMPILERJVMCI=1"/>
 								</option>
 								<option id="gnu.cpp.compiler.option.preprocessor.undef.2137486146" name="Undefined symbols (-U)" superClass="gnu.cpp.compiler.option.preprocessor.undef"/>
 								<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.866181452" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
@@ -96,7 +96,7 @@
 				</extensions>
 			</storageModule>
 			<storageModule moduleId="cdtBuildSystem" version="4.0.0">
-				<configuration artifactName="hotspot" buildProperties="" description="Server VM with graal enabled (Tiered)" id="cdt.managedbuild.toolchain.gnu.solaris.base.945602881.1958236162" name="Server" parent="org.eclipse.cdt.build.core.emptycfg">
+				<configuration artifactName="hotspot" buildProperties="" description="Server VM with JVMCI enabled (Tiered)" id="cdt.managedbuild.toolchain.gnu.solaris.base.945602881.1958236162" name="Server" parent="org.eclipse.cdt.build.core.emptycfg">
 					<folderInfo id="cdt.managedbuild.toolchain.gnu.solaris.base.945602881.1958236162." name="/" resourcePath="">
 						<toolChain id="cdt.managedbuild.toolchain.gnu.base.1741231788" name="Linux GCC" superClass="cdt.managedbuild.toolchain.gnu.base">
 							<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="cdt.managedbuild.target.gnu.platform.base.1058861512" name="Debug Platform" osList="linux,hpux,aix,qnx" superClass="cdt.managedbuild.target.gnu.platform.base"/>
@@ -108,7 +108,7 @@
 							<tool id="cdt.managedbuild.tool.gnu.archiver.base.446231503" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/>
 							<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.base.677873708" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.base">
 								<option id="gnu.cpp.compiler.option.include.paths.2060190160" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath">
-									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/com.oracle.graal.hotspot/src_gen/hotspot}&quot;"/>
+									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/com.oracle.jvmci.hotspot/src_gen/hotspot}&quot;"/>
 								</option>
 								<option id="gnu.cpp.compiler.option.preprocessor.def.270375031" name="Defined symbols (-D)" superClass="gnu.cpp.compiler.option.preprocessor.def" valueType="definedSymbols">
 									<listOptionValue builtIn="false" value="_LP64=1"/>
@@ -124,7 +124,7 @@
 									<listOptionValue builtIn="false" value="TARGET_OS_FAMILY_linux=1"/>
 									<listOptionValue builtIn="false" value="TARGET_OS_ARCH_linux_x86=1"/>
 									<listOptionValue builtIn="false" value="TARGET_ARCH_MODEL_x86_64=1"/>
-									<listOptionValue builtIn="false" value="GRAAL=1"/>
+									<listOptionValue builtIn="false" value="JVMCI=1"/>
 									<listOptionValue builtIn="false" value="COMPILER2=1"/>
 								</option>
 								<option id="gnu.cpp.compiler.option.preprocessor.undef.553556482" name="Undefined symbols (-U)" superClass="gnu.cpp.compiler.option.preprocessor.undef"/>
@@ -177,7 +177,7 @@
 				</extensions>
 			</storageModule>
 			<storageModule moduleId="cdtBuildSystem" version="4.0.0">
-				<configuration artifactName="hotspot" buildProperties="" description="Client VM with Graal enabled" id="cdt.managedbuild.toolchain.gnu.solaris.base.945602881.982312162" name="Client" parent="org.eclipse.cdt.build.core.emptycfg">
+				<configuration artifactName="hotspot" buildProperties="" description="Client VM with JVMCI enabled" id="cdt.managedbuild.toolchain.gnu.solaris.base.945602881.982312162" name="Client" parent="org.eclipse.cdt.build.core.emptycfg">
 					<folderInfo id="cdt.managedbuild.toolchain.gnu.solaris.base.945602881.982312162." name="/" resourcePath="">
 						<toolChain id="cdt.managedbuild.toolchain.gnu.base.1944635494" name="Linux GCC" superClass="cdt.managedbuild.toolchain.gnu.base">
 							<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="cdt.managedbuild.target.gnu.platform.base.760397453" name="Debug Platform" osList="linux,hpux,aix,qnx" superClass="cdt.managedbuild.target.gnu.platform.base"/>
@@ -189,7 +189,7 @@
 							<tool id="cdt.managedbuild.tool.gnu.archiver.base.805698881" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/>
 							<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.base.1673917487" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.base">
 								<option id="gnu.cpp.compiler.option.include.paths.1395828869" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath">
-									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/com.oracle.graal.hotspot/src_gen/hotspot}&quot;"/>
+									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/com.oracle.jvmci.hotspot/src_gen/hotspot}&quot;"/>
 								</option>
 								<option id="gnu.cpp.compiler.option.preprocessor.def.1699174802" name="Defined symbols (-D)" superClass="gnu.cpp.compiler.option.preprocessor.def" valueType="definedSymbols">
 									<listOptionValue builtIn="false" value="_LP64=1"/>
@@ -205,7 +205,7 @@
 									<listOptionValue builtIn="false" value="TARGET_OS_FAMILY_linux=1"/>
 									<listOptionValue builtIn="false" value="TARGET_OS_ARCH_linux_x86=1"/>
 									<listOptionValue builtIn="false" value="TARGET_ARCH_MODEL_x86_64=1"/>
-									<listOptionValue builtIn="false" value="GRAAL=1"/>
+									<listOptionValue builtIn="false" value="JVMCI=1"/>
 								</option>
 								<option id="gnu.cpp.compiler.option.preprocessor.undef.2019710410" name="Undefined symbols (-U)" superClass="gnu.cpp.compiler.option.preprocessor.undef"/>
 								<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.931461388" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
@@ -245,7 +245,7 @@
 			<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
 		</cconfiguration>
 		<cconfiguration id="cdt.managedbuild.toolchain.gnu.solaris.base.945602881.2116626004">
-			<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.toolchain.gnu.solaris.base.945602881.2116626004" moduleId="org.eclipse.cdt.core.settings" name="Graal">
+			<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.toolchain.gnu.solaris.base.945602881.2116626004" moduleId="org.eclipse.cdt.core.settings" name="JVMCI">
 				<externalSettings/>
 				<extensions>
 					<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
@@ -257,7 +257,7 @@
 				</extensions>
 			</storageModule>
 			<storageModule moduleId="cdtBuildSystem" version="4.0.0">
-				<configuration artifactName="hotspot" buildProperties="" description="Graal VM (Tiered)" id="cdt.managedbuild.toolchain.gnu.solaris.base.945602881.2116626004" name="Graal" parent="org.eclipse.cdt.build.core.emptycfg">
+				<configuration artifactName="hotspot" buildProperties="" description="Graal VM (Tiered)" id="cdt.managedbuild.toolchain.gnu.solaris.base.945602881.2116626004" name="JVMCI" parent="org.eclipse.cdt.build.core.emptycfg">
 					<folderInfo id="cdt.managedbuild.toolchain.gnu.solaris.base.945602881.2116626004." name="/" resourcePath="">
 						<toolChain id="cdt.managedbuild.toolchain.gnu.base.1790873354" name="Linux GCC" superClass="cdt.managedbuild.toolchain.gnu.base">
 							<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="cdt.managedbuild.target.gnu.platform.base.2087199731" name="Debug Platform" osList="linux,hpux,aix,qnx" superClass="cdt.managedbuild.target.gnu.platform.base"/>
@@ -269,7 +269,7 @@
 							<tool id="cdt.managedbuild.tool.gnu.archiver.base.111821059" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/>
 							<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.base.501581878" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.base">
 								<option id="gnu.cpp.compiler.option.include.paths.1285141101" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath">
-									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/com.oracle.graal.hotspot/src_gen/hotspot}&quot;"/>
+									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/com.oracle.jvmci.hotspot/src_gen/hotspot}&quot;"/>
 								</option>
 								<option id="gnu.cpp.compiler.option.preprocessor.def.1301765451" name="Defined symbols (-D)" superClass="gnu.cpp.compiler.option.preprocessor.def" valueType="definedSymbols">
 									<listOptionValue builtIn="false" value="_LP64=1"/>
@@ -285,8 +285,8 @@
 									<listOptionValue builtIn="false" value="TARGET_OS_FAMILY_linux=1"/>
 									<listOptionValue builtIn="false" value="TARGET_OS_ARCH_linux_x86=1"/>
 									<listOptionValue builtIn="false" value="TARGET_ARCH_MODEL_x86_64=1"/>
-									<listOptionValue builtIn="false" value="GRAAL=1"/>
-									<listOptionValue builtIn="false" value="COMPILERGRAAL=1"/>
+									<listOptionValue builtIn="false" value="JVMCI=1"/>
+									<listOptionValue builtIn="false" value="COMPILERJVMCI=1"/>
 								</option>
 								<option id="gnu.cpp.compiler.option.preprocessor.undef.1682796822" name="Undefined symbols (-U)" superClass="gnu.cpp.compiler.option.preprocessor.undef"/>
 								<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.1552002453" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
@@ -326,7 +326,7 @@
 			<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
 		</cconfiguration>
 		<cconfiguration id="cdt.managedbuild.toolchain.gnu.solaris.base.945602881.500153051">
-			<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.toolchain.gnu.solaris.base.945602881.500153051" moduleId="org.eclipse.cdt.core.settings" name="Server no Graal">
+			<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.toolchain.gnu.solaris.base.945602881.500153051" moduleId="org.eclipse.cdt.core.settings" name="Server no JVMCI">
 				<externalSettings/>
 				<extensions>
 					<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
@@ -338,7 +338,7 @@
 				</extensions>
 			</storageModule>
 			<storageModule moduleId="cdtBuildSystem" version="4.0.0">
-				<configuration artifactName="hotspot" buildProperties="" description="Server VM without Graal extentions (Tiered)" id="cdt.managedbuild.toolchain.gnu.solaris.base.945602881.500153051" name="Server no Graal" parent="org.eclipse.cdt.build.core.emptycfg">
+				<configuration artifactName="hotspot" buildProperties="" description="Server VM without JVMCI extentions (Tiered)" id="cdt.managedbuild.toolchain.gnu.solaris.base.945602881.500153051" name="Server no JVMCI" parent="org.eclipse.cdt.build.core.emptycfg">
 					<folderInfo id="cdt.managedbuild.toolchain.gnu.solaris.base.945602881.500153051." name="/" resourcePath="">
 						<toolChain id="cdt.managedbuild.toolchain.gnu.base.264813073" name="Linux GCC" superClass="cdt.managedbuild.toolchain.gnu.base">
 							<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="cdt.managedbuild.target.gnu.platform.base.555589372" name="Debug Platform" osList="linux,hpux,aix,qnx" superClass="cdt.managedbuild.target.gnu.platform.base"/>
@@ -350,7 +350,7 @@
 							<tool id="cdt.managedbuild.tool.gnu.archiver.base.832885832" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/>
 							<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.base.1920567990" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.base">
 								<option id="gnu.cpp.compiler.option.include.paths.839069865" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath">
-									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/com.oracle.graal.hotspot/src_gen/hotspot}&quot;"/>
+									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/com.oracle.jvmci.hotspot/src_gen/hotspot}&quot;"/>
 								</option>
 								<option id="gnu.cpp.compiler.option.preprocessor.def.1804264717" name="Defined symbols (-D)" superClass="gnu.cpp.compiler.option.preprocessor.def" valueType="definedSymbols">
 									<listOptionValue builtIn="false" value="_LP64=1"/>
@@ -406,7 +406,7 @@
 			<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
 		</cconfiguration>
 		<cconfiguration id="cdt.managedbuild.toolchain.gnu.solaris.base.945602881.915924225">
-			<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.toolchain.gnu.solaris.base.945602881.915924225" moduleId="org.eclipse.cdt.core.settings" name="Client no Graal">
+			<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.toolchain.gnu.solaris.base.945602881.915924225" moduleId="org.eclipse.cdt.core.settings" name="Client no JVMCI">
 				<externalSettings/>
 				<extensions>
 					<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
@@ -418,7 +418,7 @@
 				</extensions>
 			</storageModule>
 			<storageModule moduleId="cdtBuildSystem" version="4.0.0">
-				<configuration artifactName="hotspot" buildProperties="" description="Client VM without Graal extentions" id="cdt.managedbuild.toolchain.gnu.solaris.base.945602881.915924225" name="Client no Graal" parent="org.eclipse.cdt.build.core.emptycfg">
+				<configuration artifactName="hotspot" buildProperties="" description="Client VM without JVMCI extentions" id="cdt.managedbuild.toolchain.gnu.solaris.base.945602881.915924225" name="Client no JVMCI" parent="org.eclipse.cdt.build.core.emptycfg">
 					<folderInfo id="cdt.managedbuild.toolchain.gnu.solaris.base.945602881.915924225." name="/" resourcePath="">
 						<toolChain id="cdt.managedbuild.toolchain.gnu.base.237868264" name="Linux GCC" superClass="cdt.managedbuild.toolchain.gnu.base">
 							<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="cdt.managedbuild.target.gnu.platform.base.819675926" name="Debug Platform" osList="linux,hpux,aix,qnx" superClass="cdt.managedbuild.target.gnu.platform.base"/>
@@ -430,7 +430,7 @@
 							<tool id="cdt.managedbuild.tool.gnu.archiver.base.1406128591" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/>
 							<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.base.1404788740" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.base">
 								<option id="gnu.cpp.compiler.option.include.paths.701589205" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath">
-									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/com.oracle.graal.hotspot/src_gen/hotspot}&quot;"/>
+									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/com.oracle.jvmci.hotspot/src_gen/hotspot}&quot;"/>
 								</option>
 								<option id="gnu.cpp.compiler.option.preprocessor.def.815907884" name="Defined symbols (-D)" superClass="gnu.cpp.compiler.option.preprocessor.def" valueType="definedSymbols">
 									<listOptionValue builtIn="false" value="_LP64=1"/>
@@ -475,7 +475,7 @@
 						</toolChain>
 					</folderInfo>
 					<sourceEntries>
-						<entry excluding="cpu/vm/templateTable_x86_32.cpp|cpu/vm/templateInterpreter_x86_32.cpp|cpu/vm/stubRoutines_x86_32.cpp|cpu/vm/stubGenerator_x86_32.cpp|cpu/vm/sharedRuntime_x86_32.cpp|cpu/vm/jniFastGetField_x86_32.cpp|cpu/vm/interpreterRT_x86_32.cpp|cpu/vm/interpreter_x86_32.cpp|cpu/vm/interp_masm_x86_32.cpp|cpu/vm/vtableStubs_x86_32.cpp|shared/vm/opto|shared/vm/graal" flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name=""/>
+						<entry excluding="cpu/vm/templateTable_x86_32.cpp|cpu/vm/templateInterpreter_x86_32.cpp|cpu/vm/stubRoutines_x86_32.cpp|cpu/vm/stubGenerator_x86_32.cpp|cpu/vm/sharedRuntime_x86_32.cpp|cpu/vm/jniFastGetField_x86_32.cpp|cpu/vm/interpreterRT_x86_32.cpp|cpu/vm/interpreter_x86_32.cpp|cpu/vm/interp_masm_x86_32.cpp|cpu/vm/vtableStubs_x86_32.cpp|shared/vm/opto|shared/vm/jvmci" flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name=""/>
 					</sourceEntries>
 				</configuration>
 			</storageModule>
--- a/hotspot/.project	Thu May 28 15:10:18 2015 -0700
+++ b/hotspot/.project	Thu May 28 21:11:28 2015 -0700
@@ -106,14 +106,14 @@
 			<locationURI>PARENT-1-PROJECT_LOC/build/linux/linux_amd64_compiler2/generated</locationURI>
 		</link>
 		<link>
-			<name>generated_graal</name>
+			<name>generated_jvmci</name>
 			<type>2</type>
-			<locationURI>PARENT-1-PROJECT_LOC/build/linux/linux_amd64_graal/generated</locationURI>
+			<locationURI>PARENT-1-PROJECT_LOC/build/linux/linux_amd64_jvmci/generated</locationURI>
 		</link>
 		<link>
 			<name>generated_java_processor</name>
 			<type>2</type>
-			<locationURI>PARENT-1-PROJECT_LOC/graal/com.oracle.graal.hotspot/src_gen/hotspot</locationURI>
+			<locationURI>PARENT-1-PROJECT_LOC/graal/com.oracle.jvmci.hotspot/src_gen/hotspot</locationURI>
 		</link>
 		<link>
 			<name>linux</name>
Binary file lib/findbugs-SuppressFBWarnings.jar has changed
--- a/make/Makefile	Thu May 28 15:10:18 2015 -0700
+++ b/make/Makefile	Thu May 28 21:11:28 2015 -0700
@@ -84,7 +84,7 @@
   ALT_OUT=
 endif
 
-# Directory for shared code (e.g. graal.jar)
+# Directory for shared code (e.g. jvmci.jar)
 SHARED_DIR=$(OUTPUTDIR)/shared
 
 # Typical C1/C2 targets made available with this Makefile
@@ -94,7 +94,7 @@
 ZERO_VM_TARGETS=productzero fastdebugzero optimizedzero debugzero
 SHARK_VM_TARGETS=productshark fastdebugshark optimizedshark debugshark
 MINIMAL1_VM_TARGETS=productminimal1 fastdebugminimal1 debugminimal1
-GRAAL_VM_TARGETS=productgraal fastdebuggraal optimizedgraal debuggraal
+JVMCI_VM_TARGETS=productjvmci fastdebugjvmci optimizedjvmci debugjvmci
 
 COMMON_VM_PRODUCT_TARGETS=product product1 docs export_product
 COMMON_VM_FASTDEBUG_TARGETS=fastdebug fastdebug1 docs export_fastdebug
@@ -149,11 +149,11 @@
 all_debugcore:     debugcore docs export_debug
 all_optimizedcore: optimizedcore docs export_optimized
 
-allgraal:           all_productgraal all_fastdebuggraal
-all_productgraal:   productgraal docs export_product
-all_fastdebuggraal: fastdebuggraal docs export_fastdebug
-all_debuggraal:     debuggraal docs export_debug
-all_optimizedgraal: optimizedgraal docs export_optimized
+alljvmci:           all_productjvmci all_fastdebugjvmci
+all_productjvmci:   productjvmci docs export_product
+all_fastdebugjvmci: fastdebugjvmci docs export_fastdebug
+all_debugjvmci:     debugjvmci docs export_debug
+all_optimizedjvmci: optimizedjvmci docs export_optimized
 
 # Do everything
 world:         all create_jdk
@@ -174,11 +174,11 @@
 C1_DIR      =$(OUTPUTDIR)/$(VM_PLATFORM)_compiler1
 C2_DIR      =$(OUTPUTDIR)/$(VM_PLATFORM)_compiler2
 CORE_DIR    =$(OUTPUTDIR)/$(VM_PLATFORM)_core
-GRAAL_DIR   =$(OUTPUTDIR)/$(VM_PLATFORM)_graal
+JVMCI_DIR   =$(OUTPUTDIR)/$(VM_PLATFORM)_jvmci
 MINIMAL1_DIR=$(OUTPUTDIR)/$(VM_PLATFORM)_minimal1
 ZERO_DIR    =$(OUTPUTDIR)/$(VM_PLATFORM)_zero
 SHARK_DIR   =$(OUTPUTDIR)/$(VM_PLATFORM)_shark
-GRAAL_DIR   =$(OUTPUTDIR)/$(VM_PLATFORM)_graal
+JVMCI_DIR   =$(OUTPUTDIR)/$(VM_PLATFORM)_jvmci
 
 # Build variation of hotspot
 $(C1_VM_TARGETS):
@@ -205,9 +205,9 @@
 	$(CD) $(GAMMADIR)/make; \
 	$(MAKE) BUILD_DIR=$(MINIMAL1_DIR) BUILD_FLAVOR=$(@:%minimal1=%) VM_TARGET=$@ generic_buildminimal1 $(ALT_OUT)
 
-$(GRAAL_VM_TARGETS):
+$(JVMCI_VM_TARGETS):
 	$(CD) $(GAMMADIR)/make; \
-	$(MAKE) BUILD_DIR=$(GRAAL_DIR) BUILD_FLAVOR=$(@:%graal=%) VM_TARGET=$@ INCLUDE_GRAAL=true generic_buildgraal $(ALT_OUT)
+	$(MAKE) BUILD_DIR=$(JVMCI_DIR) BUILD_FLAVOR=$(@:%jvmci=%) VM_TARGET=$@ INCLUDE_JVMCI=true generic_buildjvmci $(ALT_OUT)
 
 # Install hotspot script in build directory
 HOTSPOT_SCRIPT=$(BUILD_DIR)/$(BUILD_FLAVOR)/hotspot
@@ -301,7 +301,7 @@
 	@$(ECHO) "Error: trying to build a minimal target but JVM_VARIANT_MINIMAL1 is not true."
 endif
 
-generic_buildgraal: $(HOTSPOT_SCRIPT) buildshared
+generic_buildjvmci: $(HOTSPOT_SCRIPT) buildshared
 	$(MKDIR) -p $(OUTPUTDIR)
 	$(CD) $(OUTPUTDIR); \
 		$(MAKE) -f $(ABS_OS_MAKEFILE) \
@@ -350,7 +350,7 @@
 C1_BUILD_DIR      =$(C1_DIR)/$(BUILD_FLAVOR)
 C2_BUILD_DIR      =$(C2_DIR)/$(BUILD_FLAVOR)
 CORE_BUILD_DIR    =$(CORE_DIR)/$(BUILD_FLAVOR)
-GRAAL_BUILD_DIR   =$(GRAAL_DIR)/$(BUILD_FLAVOR)
+JVMCI_BUILD_DIR   =$(JVMCI_DIR)/$(BUILD_FLAVOR)
 MINIMAL1_BUILD_DIR=$(MINIMAL1_DIR)/$(BUILD_FLAVOR)
 ZERO_BUILD_DIR    =$(ZERO_DIR)/$(BUILD_FLAVOR)
 SHARK_BUILD_DIR   =$(SHARK_DIR)/$(BUILD_FLAVOR)
@@ -404,52 +404,52 @@
 $(EXPORT_SERVER_DIR)/%.dSYM:       		$(C2_BUILD_DIR)/%.dSYM
 	$(install-dir)
 
-# Graal
+# JVMCI
 # Common
-$(EXPORT_SERVER_DIR)/%.diz:       		$(GRAAL_BUILD_DIR)/%.diz
+$(EXPORT_SERVER_DIR)/%.diz:       		$(JVMCI_BUILD_DIR)/%.diz
 	$(install-file)
-$(EXPORT_LIB_DIR)/%.jar:			$(GRAAL_BUILD_DIR)/../generated/%.jar
+$(EXPORT_LIB_DIR)/%.jar:			$(JVMCI_BUILD_DIR)/../generated/%.jar
 	$(install-file)
-$(EXPORT_INCLUDE_DIR)/%:			$(GRAAL_BUILD_DIR)/../generated/jvmtifiles/%
+$(EXPORT_INCLUDE_DIR)/%:			$(JVMCI_BUILD_DIR)/../generated/jvmtifiles/%
 	$(install-file)
 # Windows
-$(EXPORT_SERVER_DIR)/%.dll:			$(GRAAL_BUILD_DIR)/%.dll
+$(EXPORT_SERVER_DIR)/%.dll:			$(JVMCI_BUILD_DIR)/%.dll
 	$(install-file)
-$(EXPORT_SERVER_DIR)/%.pdb:			$(GRAAL_BUILD_DIR)/%.pdb
+$(EXPORT_SERVER_DIR)/%.pdb:			$(JVMCI_BUILD_DIR)/%.pdb
 	$(install-file)
-$(EXPORT_SERVER_DIR)/%.map:			$(GRAAL_BUILD_DIR)/%.map
+$(EXPORT_SERVER_DIR)/%.map:			$(JVMCI_BUILD_DIR)/%.map
 	$(install-file)
-$(EXPORT_LIB_DIR)/%.lib:			$(GRAAL_BUILD_DIR)/%.lib
+$(EXPORT_LIB_DIR)/%.lib:			$(JVMCI_BUILD_DIR)/%.lib
 	$(install-file)
-$(EXPORT_JRE_BIN_DIR)/%.diz:			$(GRAAL_BUILD_DIR)/%.diz
+$(EXPORT_JRE_BIN_DIR)/%.diz:			$(JVMCI_BUILD_DIR)/%.diz
 	$(install-file)
-$(EXPORT_JRE_BIN_DIR)/%.dll:			$(GRAAL_BUILD_DIR)/%.dll
+$(EXPORT_JRE_BIN_DIR)/%.dll:			$(JVMCI_BUILD_DIR)/%.dll
 	$(install-file)
-$(EXPORT_JRE_BIN_DIR)/%.pdb:			$(GRAAL_BUILD_DIR)/%.pdb
+$(EXPORT_JRE_BIN_DIR)/%.pdb:			$(JVMCI_BUILD_DIR)/%.pdb
 	$(install-file)
-$(EXPORT_JRE_BIN_DIR)/%.map:			$(GRAAL_BUILD_DIR)/%.map
+$(EXPORT_JRE_BIN_DIR)/%.map:			$(JVMCI_BUILD_DIR)/%.map
 	$(install-file)
 # Unix
-$(EXPORT_JRE_LIB_ARCH_DIR)/%.$(LIBRARY_SUFFIX): $(GRAAL_BUILD_DIR)/%.$(LIBRARY_SUFFIX)
+$(EXPORT_JRE_LIB_ARCH_DIR)/%.$(LIBRARY_SUFFIX): $(JVMCI_BUILD_DIR)/%.$(LIBRARY_SUFFIX)
 	$(install-file)
-$(EXPORT_SERVER_DIR)/%.$(LIBRARY_SUFFIX):       $(GRAAL_BUILD_DIR)/%.$(LIBRARY_SUFFIX)
+$(EXPORT_SERVER_DIR)/%.$(LIBRARY_SUFFIX):       $(JVMCI_BUILD_DIR)/%.$(LIBRARY_SUFFIX)
 	$(install-file)
-$(EXPORT_SERVER_DIR)/64/%.$(LIBRARY_SUFFIX):    $(GRAAL_BUILD_DIR)/%.$(LIBRARY_SUFFIX)
+$(EXPORT_SERVER_DIR)/64/%.$(LIBRARY_SUFFIX):    $(JVMCI_BUILD_DIR)/%.$(LIBRARY_SUFFIX)
 	$(install-file)
-$(EXPORT_JRE_LIB_ARCH_DIR)/%.debuginfo: 	$(GRAAL_BUILD_DIR)/%.debuginfo
+$(EXPORT_JRE_LIB_ARCH_DIR)/%.debuginfo: 	$(JVMCI_BUILD_DIR)/%.debuginfo
 	$(install-file)
-$(EXPORT_SERVER_DIR)/%.debuginfo:       	$(GRAAL_BUILD_DIR)/%.debuginfo
+$(EXPORT_SERVER_DIR)/%.debuginfo:       	$(JVMCI_BUILD_DIR)/%.debuginfo
 	$(install-file)
-$(EXPORT_SERVER_DIR)/64/%.debuginfo:    	$(GRAAL_BUILD_DIR)/%.debuginfo
+$(EXPORT_SERVER_DIR)/64/%.debuginfo:    	$(JVMCI_BUILD_DIR)/%.debuginfo
 	$(install-file)
-$(EXPORT_JRE_LIB_ARCH_DIR)/%.diz: 		$(GRAAL_BUILD_DIR)/%.diz
+$(EXPORT_JRE_LIB_ARCH_DIR)/%.diz: 		$(JVMCI_BUILD_DIR)/%.diz
 	$(install-file)
-$(EXPORT_SERVER_DIR)/64/%.diz:    		$(GRAAL_BUILD_DIR)/%.diz
+$(EXPORT_SERVER_DIR)/64/%.diz:    		$(JVMCI_BUILD_DIR)/%.diz
 	$(install-file)
 # MacOS X
-$(EXPORT_JRE_LIB_ARCH_DIR)/%.dSYM: 		$(GRAAL_BUILD_DIR)/%.dSYM
+$(EXPORT_JRE_LIB_ARCH_DIR)/%.dSYM: 		$(JVMCI_BUILD_DIR)/%.dSYM
 	$(install-dir)
-$(EXPORT_SERVER_DIR)/%.dSYM:       		$(GRAAL_BUILD_DIR)/%.dSYM
+$(EXPORT_SERVER_DIR)/%.dSYM:       		$(JVMCI_BUILD_DIR)/%.dSYM
 	$(install-dir)
 
 endif
@@ -632,13 +632,13 @@
 $(EXPORT_JRE_LIB_EXT_DIR)/%.jar: $(SHARED_DIR)/%.jar
 	$(install-file)
 
-$(EXPORT_JRE_LIB_GRAAL_DIR)/%.jar: $(SHARED_DIR)/%.jar
+$(EXPORT_JRE_LIB_JVMCI_DIR)/%.jar: $(SHARED_DIR)/%.jar
 	$(install-file)
 
-$(EXPORT_JRE_LIB_GRAAL_SERVICES_DIR)/%: $(SHARED_DIR)/services/%
+$(EXPORT_JRE_LIB_JVMCI_SERVICES_DIR)/%: $(SHARED_DIR)/services/%
 	$(install-file)
 
-$(EXPORT_JRE_LIB_GRAAL_OPTIONS_DIR)/%: $(SHARED_DIR)/options/%
+$(EXPORT_JRE_LIB_JVMCI_OPTIONS_DIR)/%: $(SHARED_DIR)/options/%
 	$(install-file)
 
 $(EXPORT_INCLUDE_DIR)/%: $(HS_SRC_DIR)/share/vm/code/%
@@ -683,7 +683,7 @@
 	$(RM) -r $(C1_DIR)
 	$(RM) -r $(C2_DIR)
 	$(RM) -r $(CORE_DIR)
-	$(RM) -r $(GRAAL_DIR)
+	$(RM) -r $(JVMCI_DIR)
 	$(RM) -r $(ZERO_DIR)
 	$(RM) -r $(SHARK_DIR)
 	$(RM) -r $(MINIMAL1_DIR)
@@ -947,7 +947,7 @@
 
 jvmgshark: warn_jvmg_deprecated debugshark
 
-jvmggraal: warn_jvmg_deprecated debuggraal
+jvmgjvmci: warn_jvmg_deprecated debugjvmci
 
 # JPRT rule to build this workspace
 include $(GAMMADIR)/make/jprt.gmk
--- a/make/bsd/Makefile	Thu May 28 15:10:18 2015 -0700
+++ b/make/bsd/Makefile	Thu May 28 21:11:28 2015 -0700
@@ -192,7 +192,7 @@
 SUBDIRS_ZERO      = $(addprefix $(OSNAME)_$(VARIANTARCH)_zero/,$(TARGETS))
 SUBDIRS_SHARK     = $(addprefix $(OSNAME)_$(VARIANTARCH)_shark/,$(TARGETS))
 SUBDIRS_MINIMAL1  = $(addprefix $(OSNAME)_$(BUILDARCH)_minimal1/,$(TARGETS))
-SUBDIRS_GRAAL     = $(addprefix $(OSNAME)_$(BUILDARCH)_graal/,$(TARGETS))
+SUBDIRS_JVMCI     = $(addprefix $(OSNAME)_$(BUILDARCH)_jvmci/,$(TARGETS))
 
 TARGETS_C2        = $(TARGETS)
 TARGETS_C1        = $(addsuffix 1,$(TARGETS))
@@ -201,7 +201,7 @@
 TARGETS_ZERO      = $(addsuffix zero,$(TARGETS))
 TARGETS_SHARK     = $(addsuffix shark,$(TARGETS))
 TARGETS_MINIMAL1  = $(addsuffix minimal1,$(TARGETS))
-TARGETS_GRAAL     = $(addsuffix graal,$(TARGETS))
+TARGETS_JVMCI     = $(addsuffix jvmci,$(TARGETS))
 
 BUILDTREE_MAKE    = $(GAMMADIR)/make/$(OSNAME)/makefiles/buildtree.make
 BUILDTREE_VARS    = GAMMADIR=$(GAMMADIR) OS_FAMILY=$(OSNAME) SRCARCH=$(SRCARCH) BUILDARCH=$(BUILDARCH) LIBARCH=$(LIBARCH) LIBRARY_SUFFIX=$(LIBRARY_SUFFIX)
@@ -221,7 +221,7 @@
 	@echo "  $(TARGETS_ZERO)"
 	@echo "  $(TARGETS_SHARK)"
 	@echo "  $(TARGETS_MINIMAL1)"
-	@echo "  $(TARGETS_GRAAL)"
+	@echo "  $(TARGETS_JVMCI)"
 
 checks: check_os_version check_j2se_version
 
@@ -284,9 +284,9 @@
 	$(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks
 	$(BUILDTREE) VARIANT=minimal1
 
-$(SUBDIRS_GRAAL): $(BUILDTREE_MAKE)
+$(SUBDIRS_JVMCI): $(BUILDTREE_MAKE)
 	$(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks
-	$(BUILDTREE) VARIANT=graal
+	$(BUILDTREE) VARIANT=jvmci
 
 platform_zero: $(GAMMADIR)/make/$(OSNAME)/platform_zero.in
 	$(SED) 's/@ZERO_ARCHDEF@/$(ZERO_ARCHDEF)/g;s/@ZERO_LIBARCH@/$(ZERO_LIBARCH)/g;' < $< > $@
@@ -335,10 +335,10 @@
 	cd $(OSNAME)_$(BUILDARCH)_minimal1/$(patsubst %minimal1,%,$@) && $(MAKE) $(MFLAGS) install
 endif
 
-$(TARGETS_GRAAL):  $(SUBDIRS_GRAAL)
-	cd $(OSNAME)_$(BUILDARCH)_graal/$(patsubst %graal,%,$@) && $(MAKE) $(MFLAGS)
+$(TARGETS_JVMCI):  $(SUBDIRS_JVMCI)
+	cd $(OSNAME)_$(BUILDARCH)_jvmci/$(patsubst %jvmci,%,$@) && $(MAKE) $(MFLAGS)
 ifdef INSTALL
-	cd $(OSNAME)_$(BUILDARCH)_graal/$(patsubst %graal,%,$@) && $(MAKE) $(MFLAGS) install
+	cd $(OSNAME)_$(BUILDARCH)_jvmci/$(patsubst %jvmci,%,$@) && $(MAKE) $(MFLAGS) install
 endif
 
 # Just build the tree, and nothing else:
@@ -348,7 +348,7 @@
 treezero:  $(SUBDIRS_ZERO)
 treeshark: $(SUBDIRS_SHARK)
 treeminimal1: $(SUBDIRS_MINIMAL1)
-treegraal: $(SUBDIRS_GRAAL)
+treejvmci: $(SUBDIRS_JVMCI)
 
 # Doc target.  This is the same for all build options.
 #     Hence create a docs directory beside ...$(ARCH)_[...]
@@ -400,9 +400,9 @@
 
 #-------------------------------------------------------------------------------
 
-.PHONY: $(TARGETS_C2) $(TARGETS_C1) $(TARGETS_CORE) $(TARGETS_ZERO) $(TARGETS_SHARK) $(TARGETS_MINIMAL1) $(TARGETS_GRAAL)
-.PHONY: tree tree1 treecore treezero treeshark treegraal
-.PHONY: all compiler1 compiler2 core zero shark graal
-.PHONY: clean clean_compiler1 clean_compiler2 clean_core clean_zero clean_shark docs clean_docs clean_graal
+.PHONY: $(TARGETS_C2) $(TARGETS_C1) $(TARGETS_CORE) $(TARGETS_ZERO) $(TARGETS_SHARK) $(TARGETS_MINIMAL1) $(TARGETS_JVMCI)
+.PHONY: tree tree1 treecore treezero treeshark treejvmci
+.PHONY: all compiler1 compiler2 core zero shark jvmci
+.PHONY: clean clean_compiler1 clean_compiler2 clean_core clean_zero clean_shark docs clean_docs clean_jvmci
 .PHONY: checks check_os_version check_j2se_version
 .PHONY: $(HS_ALT_MAKE)/$(OSNAME)/Makefile.make
--- a/make/bsd/makefiles/compiler1.make	Thu May 28 15:10:18 2015 -0700
+++ b/make/bsd/makefiles/compiler1.make	Thu May 28 21:11:28 2015 -0700
@@ -30,8 +30,8 @@
 
 CFLAGS += -DCOMPILER1
 
-ifeq ($(INCLUDE_GRAAL), true)
-  CFLAGS += -DGRAAL
+ifeq ($(INCLUDE_JVMCI), true)
+  CFLAGS += -DJVMCI
 else
-  VM_SUBDIR = client-nograal
+  VM_SUBDIR = client-nojvmci
 endif
\ No newline at end of file
--- a/make/bsd/makefiles/compiler2.make	Thu May 28 15:10:18 2015 -0700
+++ b/make/bsd/makefiles/compiler2.make	Thu May 28 21:11:28 2015 -0700
@@ -30,8 +30,8 @@
 
 CFLAGS += -DCOMPILER2
 
-ifeq ($(INCLUDE_GRAAL), true)
-  CFLAGS += -DGRAAL
+ifeq ($(INCLUDE_JVMCI), true)
+  CFLAGS += -DJVMCI
 else
-  VM_SUBDIR = server-nograal
+  VM_SUBDIR = server-nojvmci
 endif
\ No newline at end of file
--- a/make/bsd/makefiles/gcc.make	Thu May 28 15:10:18 2015 -0700
+++ b/make/bsd/makefiles/gcc.make	Thu May 28 21:11:28 2015 -0700
@@ -149,7 +149,7 @@
     PCH_FLAG/sharedRuntimeTrig.o = $(PCH_FLAG/NO_PCH)
     PCH_FLAG/sharedRuntimeTrans.o = $(PCH_FLAG/NO_PCH)
     PCH_FLAG/unsafe.o = $(PCH_FLAG/NO_PCH)
-    PCH_FLAG/graalCompilerToVM.o = $(PCH_FLAG/NO_PCH)
+    PCH_FLAG/jvmciCompilerToVM.o = $(PCH_FLAG/NO_PCH)
 
   endif
 else # ($(USE_CLANG), true)
--- a/make/bsd/makefiles/graal.make	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-#
-# Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
-# Copyright 2008, 2010 Red Hat, Inc.
-# 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.
-#  
-#
-
-# Sets make macros for making Graal version of VM
-
-TYPE = GRAAL
-
-VM_SUBDIR = graal
-
-# To make a non-tiered Graal build, remove the -DCOMPILER1 below and
-# in vm.make remove COMPILER1_PATHS from Src_Dirs/GRAAL and add
-# COMPILER1_SPECIFIC_FILES to Src_Files_EXCLUDE/GRAAL
-CFLAGS += -DCOMPILERGRAAL -DGRAAL -DCOMPILER1
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/bsd/makefiles/jvmci.make	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,35 @@
+#
+# Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright 2008, 2010 Red Hat, Inc.
+# 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.
+#  
+#
+
+# Sets make macros for making JVMCI version of VM
+
+TYPE = JVMCI
+
+VM_SUBDIR = jvmci
+
+# To make a non-tiered JVMCI build, remove the -DCOMPILER1 below and
+# in vm.make remove COMPILER1_PATHS from Src_Dirs/JVMCI and add
+# COMPILER1_SPECIFIC_FILES to Src_Files_EXCLUDE/JVMCI
+CFLAGS += -DCOMPILERJVMCI -DJVMCI -DCOMPILER1
--- a/make/bsd/makefiles/tiered.make	Thu May 28 15:10:18 2015 -0700
+++ b/make/bsd/makefiles/tiered.make	Thu May 28 21:11:28 2015 -0700
@@ -30,8 +30,8 @@
 
 CFLAGS += -DCOMPILER2 -DCOMPILER1
 
-ifeq ($(INCLUDE_GRAAL), true)
-  CFLAGS += -DGRAAL
+ifeq ($(INCLUDE_JVMCI), true)
+  CFLAGS += -DJVMCI
 else
-  VM_SUBDIR = server-nograal
+  VM_SUBDIR = server-nojvmci
 endif
--- a/make/bsd/makefiles/vm.make	Thu May 28 15:10:18 2015 -0700
+++ b/make/bsd/makefiles/vm.make	Thu May 28 21:11:28 2015 -0700
@@ -111,10 +111,6 @@
 CXXFLAGS += -DDEFAULT_LIBPATH="\"$(DEFAULT_LIBPATH)\""
 endif
 
-ifeq ($(INCLUDE_GRAAL), true)
-  CXXFLAGS += -DGRAAL_VERSION="\"$(GRAAL_VERSION)\""
-endif
-
 # CFLAGS_WARN holds compiler options to suppress/enable warnings.
 CFLAGS += $(CFLAGS_WARN/BYFILE)
 
@@ -171,7 +167,7 @@
   LIBJVM_DIZ         = lib$(JVM).diz
 endif
 
-SPECIAL_PATHS:=adlc c1 gc_implementation opto shark libadt graal
+SPECIAL_PATHS:=adlc c1 gc_implementation opto shark libadt jvmci
 
 SOURCE_PATHS=\
   $(shell find $(HS_COMMON_SRC)/share/vm/* -type d \! \
@@ -201,17 +197,17 @@
 
 SHARK_PATHS := $(GAMMADIR)/src/share/vm/shark
 
-GRAAL_PATHS += $(call altsrc,$(HS_COMMON_SRC)/share/vm/graal)
-GRAAL_PATHS += $(HS_COMMON_SRC)/share/vm/graal
+JVMCI_PATHS += $(call altsrc,$(HS_COMMON_SRC)/share/vm/jvmci)
+JVMCI_PATHS += $(HS_COMMON_SRC)/share/vm/jvmci
 
 # Include dirs per type.
 Src_Dirs/CORE      := $(CORE_PATHS)
-Src_Dirs/COMPILER1 := $(CORE_PATHS) $(COMPILER1_PATHS) $(GRAAL_PATHS)
-Src_Dirs/COMPILER2 := $(CORE_PATHS) $(COMPILER2_PATHS) $(GRAAL_PATHS)
-Src_Dirs/TIERED    := $(CORE_PATHS) $(COMPILER1_PATHS) $(COMPILER2_PATHS) $(GRAAL_PATHS)
+Src_Dirs/COMPILER1 := $(CORE_PATHS) $(COMPILER1_PATHS) $(JVMCI_PATHS)
+Src_Dirs/COMPILER2 := $(CORE_PATHS) $(COMPILER2_PATHS) $(JVMCI_PATHS)
+Src_Dirs/TIERED    := $(CORE_PATHS) $(COMPILER1_PATHS) $(COMPILER2_PATHS) $(JVMCI_PATHS)
 Src_Dirs/ZERO      := $(CORE_PATHS)
 Src_Dirs/SHARK     := $(CORE_PATHS) $(SHARK_PATHS)
-Src_Dirs/GRAAL     := $(CORE_PATHS) $(COMPILER1_PATHS) $(GRAAL_PATHS)
+Src_Dirs/JVMCI     := $(CORE_PATHS) $(COMPILER1_PATHS) $(JVMCI_PATHS)
 Src_Dirs := $(Src_Dirs/$(TYPE))
 
 COMPILER2_SPECIFIC_FILES := opto libadt bcEscapeAnalyzer.cpp c2_\* runtime_\*
@@ -219,24 +215,24 @@
 SHARK_SPECIFIC_FILES     := shark
 ZERO_SPECIFIC_FILES      := zero
 
-ifneq ($(INCLUDE_GRAAL), true)
-  GRAAL_SPECIFIC_FILES   := graal\*
+ifneq ($(INCLUDE_JVMCI), true)
+  JVMCI_SPECIFIC_FILES   := jvmci\*
 else
-  GRAAL_SPECIFIC_FILES   :=
-  Src_Dirs_I += $(HS_COMMON_SRC)/../graal/com.oracle.graal.hotspot/src_gen/hotspot
+  JVMCI_SPECIFIC_FILES   :=
+  Src_Dirs_I += $(HS_COMMON_SRC)/../graal/com.oracle.jvmci.hotspot/src_gen/hotspot
 endif
 
 # Always exclude these.
 Src_Files_EXCLUDE += jsig.c jvmtiEnvRecommended.cpp jvmtiEnvStub.cpp
 
 # Exclude per type.
-Src_Files_EXCLUDE/CORE      := $(COMPILER1_SPECIFIC_FILES) $(COMPILER2_SPECIFIC_FILES) $(ZERO_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES) $(GRAAL_SPECIFIC_FILES) ciTypeFlow.cpp
-Src_Files_EXCLUDE/COMPILER1 := $(COMPILER2_SPECIFIC_FILES) $(ZERO_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES) $(GRAAL_SPECIFIC_FILES) ciTypeFlow.cpp
-Src_Files_EXCLUDE/COMPILER2 := $(COMPILER1_SPECIFIC_FILES) $(ZERO_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES) $(GRAAL_SPECIFIC_FILES)
-Src_Files_EXCLUDE/TIERED    := $(ZERO_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES) $(GRAAL_SPECIFIC_FILES)
-Src_Files_EXCLUDE/ZERO      := $(COMPILER1_SPECIFIC_FILES) $(COMPILER2_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES) $(GRAAL_SPECIFIC_FILES) ciTypeFlow.cpp
-Src_Files_EXCLUDE/SHARK     := $(COMPILER1_SPECIFIC_FILES) $(COMPILER2_SPECIFIC_FILES) $(ZERO_SPECIFIC_FILES) $(GRAAL_SPECIFIC_FILES)
-Src_Files_EXCLUDE/GRAAL     := $(COMPILER2_SPECIFIC_FILES) $(ZERO_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES) ciTypeFlow.cpp
+Src_Files_EXCLUDE/CORE      := $(COMPILER1_SPECIFIC_FILES) $(COMPILER2_SPECIFIC_FILES) $(ZERO_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES) $(JVMCI_SPECIFIC_FILES) ciTypeFlow.cpp
+Src_Files_EXCLUDE/COMPILER1 := $(COMPILER2_SPECIFIC_FILES) $(ZERO_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES) $(JVMCI_SPECIFIC_FILES) ciTypeFlow.cpp
+Src_Files_EXCLUDE/COMPILER2 := $(COMPILER1_SPECIFIC_FILES) $(ZERO_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES) $(JVMCI_SPECIFIC_FILES)
+Src_Files_EXCLUDE/TIERED    := $(ZERO_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES) $(JVMCI_SPECIFIC_FILES)
+Src_Files_EXCLUDE/ZERO      := $(COMPILER1_SPECIFIC_FILES) $(COMPILER2_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES) $(JVMCI_SPECIFIC_FILES) ciTypeFlow.cpp
+Src_Files_EXCLUDE/SHARK     := $(COMPILER1_SPECIFIC_FILES) $(COMPILER2_SPECIFIC_FILES) $(ZERO_SPECIFIC_FILES) $(JVMCI_SPECIFIC_FILES)
+Src_Files_EXCLUDE/JVMCI     := $(COMPILER2_SPECIFIC_FILES) $(ZERO_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES) ciTypeFlow.cpp
 
 Src_Files_EXCLUDE +=  $(Src_Files_EXCLUDE/$(TYPE))
 
--- a/make/defs.make	Thu May 28 15:10:18 2015 -0700
+++ b/make/defs.make	Thu May 28 21:11:28 2015 -0700
@@ -341,8 +341,8 @@
 EXPORT_JRE_BIN_DIR = $(EXPORT_JRE_DIR)/bin
 EXPORT_JRE_LIB_DIR = $(EXPORT_JRE_DIR)/lib
 EXPORT_JRE_LIB_EXT_DIR = $(EXPORT_JRE_LIB_DIR)/ext
-EXPORT_JRE_LIB_GRAAL_DIR = $(EXPORT_JRE_LIB_DIR)/graal
-EXPORT_JRE_LIB_GRAAL_SERVICES_DIR = $(EXPORT_JRE_LIB_GRAAL_DIR)/services
+EXPORT_JRE_LIB_JVMCI_DIR = $(EXPORT_JRE_LIB_DIR)/jvmci
+EXPORT_JRE_LIB_JVMCI_SERVICES_DIR = $(EXPORT_JRE_LIB_JVMCI_DIR)/services
 EXPORT_JRE_LIB_ARCH_DIR = $(EXPORT_JRE_LIB_DIR)/$(LIBARCH)
 
 # non-universal macosx builds need to appear universal
@@ -358,53 +358,57 @@
 EXPORT_LIST += $(EXPORT_INCLUDE_DIR)/jni.h
 EXPORT_LIST += $(EXPORT_INCLUDE_DIR)/$(JDK_INCLUDE_SUBDIR)/jni_md.h
 EXPORT_LIST += $(EXPORT_INCLUDE_DIR)/jmm.h
-EXPORT_LIST += $(EXPORT_JRE_LIB_DIR)/graal-loader.jar
+EXPORT_LIST += $(EXPORT_JRE_LIB_DIR)/jvmci-loader.jar
 EXPORT_LIST += $(EXPORT_JRE_LIB_DIR)/truffle.jar
-EXPORT_LIST += $(EXPORT_JRE_LIB_GRAAL_DIR)/graal.jar
-EXPORT_LIST += $(EXPORT_JRE_LIB_GRAAL_DIR)/graal-truffle.jar
+EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_DIR)/graal.jar
+EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_DIR)/graal-truffle.jar
 
-EXPORT_LIST += $(EXPORT_JRE_LIB_GRAAL_SERVICES_DIR)/com.oracle.graal.compiler.match.MatchStatementSet
-EXPORT_LIST += $(EXPORT_JRE_LIB_GRAAL_SERVICES_DIR)/com.oracle.graal.hotspot.HotSpotBackendFactory
-EXPORT_LIST += $(EXPORT_JRE_LIB_GRAAL_SERVICES_DIR)/com.oracle.graal.nodes.spi.ReplacementsProvider
-EXPORT_LIST += $(EXPORT_JRE_LIB_GRAAL_SERVICES_DIR)/com.oracle.graal.phases.tiers.CompilerConfiguration
-EXPORT_LIST += $(EXPORT_JRE_LIB_GRAAL_SERVICES_DIR)/com.oracle.graal.truffle.hotspot.nfi.RawNativeCallNodeFactory
-EXPORT_LIST += $(EXPORT_JRE_LIB_GRAAL_SERVICES_DIR)/com.oracle.graal.truffle.OptimizedCallTargetInstrumentationFactory
+EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_SERVICES_DIR)/com.oracle.jvmci.hotspot.HotSpotJVMCIBackendFactory
+EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_SERVICES_DIR)/com.oracle.jvmci.hotspot.HotSpotVMEventListener
+EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_SERVICES_DIR)/com.oracle.jvmci.runtime.OptionsParsed
+
+EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_SERVICES_DIR)/com.oracle.graal.api.runtime.GraalRuntimeFactory
+EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_SERVICES_DIR)/com.oracle.graal.compiler.match.MatchStatementSet
+EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_SERVICES_DIR)/com.oracle.graal.hotspot.HotSpotBackendFactory
+EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_SERVICES_DIR)/com.oracle.graal.nodes.spi.ReplacementsProvider
+EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_SERVICES_DIR)/com.oracle.graal.phases.tiers.CompilerConfiguration
+EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_SERVICES_DIR)/com.oracle.graal.truffle.hotspot.nfi.RawNativeCallNodeFactory
+EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_SERVICES_DIR)/com.oracle.graal.truffle.OptimizedCallTargetInstrumentationFactory
 
-EXPORT_LIST += $(EXPORT_JRE_LIB_GRAAL_OPTIONS_DIR)/com.oracle.graal.compiler.common.GraalOptions
-EXPORT_LIST += $(EXPORT_JRE_LIB_GRAAL_OPTIONS_DIR)/com.oracle.graal.compiler.GraalCompiler
-EXPORT_LIST += $(EXPORT_JRE_LIB_GRAAL_OPTIONS_DIR)/com.oracle.graal.compiler.GraalDebugConfig
-EXPORT_LIST += $(EXPORT_JRE_LIB_GRAAL_OPTIONS_DIR)/com.oracle.graal.compiler.phases.HighTier
-EXPORT_LIST += $(EXPORT_JRE_LIB_GRAAL_OPTIONS_DIR)/com.oracle.graal.compiler.phases.LowTier
-EXPORT_LIST += $(EXPORT_JRE_LIB_GRAAL_OPTIONS_DIR)/com.oracle.graal.graph.Graph
-EXPORT_LIST += $(EXPORT_JRE_LIB_GRAAL_OPTIONS_DIR)/com.oracle.graal.hotspot.CompileTheWorld
-EXPORT_LIST += $(EXPORT_JRE_LIB_GRAAL_OPTIONS_DIR)/com.oracle.graal.hotspot.debug.BenchmarkCounters
-EXPORT_LIST += $(EXPORT_JRE_LIB_GRAAL_OPTIONS_DIR)/com.oracle.graal.hotspot.HotSpotBackend
-EXPORT_LIST += $(EXPORT_JRE_LIB_GRAAL_OPTIONS_DIR)/com.oracle.graal.hotspot.HotSpotGraalRuntime
-EXPORT_LIST += $(EXPORT_JRE_LIB_GRAAL_OPTIONS_DIR)/com.oracle.graal.hotspot.replacements.InstanceOfSnippets
-EXPORT_LIST += $(EXPORT_JRE_LIB_GRAAL_OPTIONS_DIR)/com.oracle.graal.hotspot.replacements.MonitorSnippets
-EXPORT_LIST += $(EXPORT_JRE_LIB_GRAAL_OPTIONS_DIR)/com.oracle.graal.hotspot.replacements.NewObjectSnippets
-EXPORT_LIST += $(EXPORT_JRE_LIB_GRAAL_OPTIONS_DIR)/com.oracle.graal.java.AbstractBytecodeParser
-EXPORT_LIST += $(EXPORT_JRE_LIB_GRAAL_OPTIONS_DIR)/com.oracle.graal.lir.alloc.lsra.LinearScan
-EXPORT_LIST += $(EXPORT_JRE_LIB_GRAAL_OPTIONS_DIR)/com.oracle.graal.lir.alloc.lsra.LocationMarker
-EXPORT_LIST += $(EXPORT_JRE_LIB_GRAAL_OPTIONS_DIR)/com.oracle.graal.lir.alloc.lsra.OptimizingLinearScanWalker
-EXPORT_LIST += $(EXPORT_JRE_LIB_GRAAL_OPTIONS_DIR)/com.oracle.graal.lir.constopt.ConstantLoadOptimization
-EXPORT_LIST += $(EXPORT_JRE_LIB_GRAAL_OPTIONS_DIR)/com.oracle.graal.lir.gen.LIRGenerator
-EXPORT_LIST += $(EXPORT_JRE_LIB_GRAAL_OPTIONS_DIR)/com.oracle.graal.lir.phases.LIRPhase
-EXPORT_LIST += $(EXPORT_JRE_LIB_GRAAL_OPTIONS_DIR)/com.oracle.graal.lir.phases.PostAllocationOptimizationStage
-EXPORT_LIST += $(EXPORT_JRE_LIB_GRAAL_OPTIONS_DIR)/com.oracle.graal.lir.ssa.SSADestructionPhase
-EXPORT_LIST += $(EXPORT_JRE_LIB_GRAAL_OPTIONS_DIR)/com.oracle.graal.lir.stackslotalloc.LSStackSlotAllocator
-EXPORT_LIST += $(EXPORT_JRE_LIB_GRAAL_OPTIONS_DIR)/com.oracle.graal.loop.LoopPolicies
-EXPORT_LIST += $(EXPORT_JRE_LIB_GRAAL_OPTIONS_DIR)/com.oracle.graal.phases.common.DeadCodeEliminationPhase
-EXPORT_LIST += $(EXPORT_JRE_LIB_GRAAL_OPTIONS_DIR)/com.oracle.graal.phases.common.inlining.InliningPhase
-EXPORT_LIST += $(EXPORT_JRE_LIB_GRAAL_OPTIONS_DIR)/com.oracle.graal.phases.tiers.Suites
-EXPORT_LIST += $(EXPORT_JRE_LIB_GRAAL_OPTIONS_DIR)/com.oracle.graal.printer.NoDeadCodeVerifyHandler
-EXPORT_LIST += $(EXPORT_JRE_LIB_GRAAL_OPTIONS_DIR)/com.oracle.graal.replacements.StandardGraphBuilderPlugins
-EXPORT_LIST += $(EXPORT_JRE_LIB_GRAAL_OPTIONS_DIR)/com.oracle.graal.truffle.PartialEvaluator
-EXPORT_LIST += $(EXPORT_JRE_LIB_GRAAL_OPTIONS_DIR)/com.oracle.graal.truffle.TruffleCompilerOptions
-EXPORT_LIST += $(EXPORT_JRE_LIB_GRAAL_OPTIONS_DIR)/com.oracle.graal.virtual.phases.ea.PartialEscapePhase
-EXPORT_LIST += $(EXPORT_JRE_LIB_GRAAL_OPTIONS_DIR)/com.oracle.graal.lir.asm.CompilationResultBuilder
-EXPORT_LIST += $(EXPORT_JRE_LIB_GRAAL_OPTIONS_DIR)/com.oracle.graal.java.GraphBuilderPhase
-
+EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_OPTIONS_DIR)/com.oracle.graal.compiler.common.GraalOptions
+EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_OPTIONS_DIR)/com.oracle.graal.compiler.GraalCompiler
+EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_OPTIONS_DIR)/com.oracle.graal.compiler.GraalDebugConfig
+EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_OPTIONS_DIR)/com.oracle.graal.compiler.phases.HighTier
+EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_OPTIONS_DIR)/com.oracle.graal.compiler.phases.LowTier
+EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_OPTIONS_DIR)/com.oracle.graal.graph.Graph
+EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_OPTIONS_DIR)/com.oracle.graal.hotspot.CompileTheWorld
+EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_OPTIONS_DIR)/com.oracle.graal.hotspot.debug.BenchmarkCounters
+EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_OPTIONS_DIR)/com.oracle.graal.hotspot.HotSpotBackend
+EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_OPTIONS_DIR)/com.oracle.graal.hotspot.HotSpotGraalRuntime
+EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_OPTIONS_DIR)/com.oracle.graal.hotspot.replacements.InstanceOfSnippets
+EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_OPTIONS_DIR)/com.oracle.graal.hotspot.replacements.MonitorSnippets
+EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_OPTIONS_DIR)/com.oracle.graal.hotspot.replacements.NewObjectSnippets
+EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_OPTIONS_DIR)/com.oracle.graal.java.AbstractBytecodeParser
+EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_OPTIONS_DIR)/com.oracle.graal.lir.alloc.lsra.LinearScan
+EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_OPTIONS_DIR)/com.oracle.graal.lir.alloc.lsra.LocationMarker
+EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_OPTIONS_DIR)/com.oracle.graal.lir.alloc.lsra.OptimizingLinearScanWalker
+EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_OPTIONS_DIR)/com.oracle.graal.lir.constopt.ConstantLoadOptimization
+EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_OPTIONS_DIR)/com.oracle.graal.lir.gen.LIRGenerator
+EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_OPTIONS_DIR)/com.oracle.graal.lir.phases.LIRPhase
+EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_OPTIONS_DIR)/com.oracle.graal.lir.phases.PostAllocationOptimizationStage
+EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_OPTIONS_DIR)/com.oracle.graal.lir.ssa.SSADestructionPhase
+EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_OPTIONS_DIR)/com.oracle.graal.lir.stackslotalloc.LSStackSlotAllocator
+EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_OPTIONS_DIR)/com.oracle.graal.loop.LoopPolicies
+EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_OPTIONS_DIR)/com.oracle.graal.phases.common.DeadCodeEliminationPhase
+EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_OPTIONS_DIR)/com.oracle.graal.phases.common.inlining.InliningPhase
+EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_OPTIONS_DIR)/com.oracle.graal.phases.tiers.Suites
+EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_OPTIONS_DIR)/com.oracle.graal.printer.NoDeadCodeVerifyHandler
+EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_OPTIONS_DIR)/com.oracle.graal.replacements.StandardGraphBuilderPlugins
+EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_OPTIONS_DIR)/com.oracle.graal.truffle.PartialEvaluator
+EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_OPTIONS_DIR)/com.oracle.graal.truffle.TruffleCompilerOptions
+EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_OPTIONS_DIR)/com.oracle.graal.virtual.phases.ea.PartialEscapePhase
+EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_OPTIONS_DIR)/com.oracle.graal.lir.asm.CompilationResultBuilder
+EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_OPTIONS_DIR)/com.oracle.graal.java.GraphBuilderPhase
 
 .PHONY: $(HS_ALT_MAKE)/defs.make
 
--- a/make/linux/Makefile	Thu May 28 15:10:18 2015 -0700
+++ b/make/linux/Makefile	Thu May 28 21:11:28 2015 -0700
@@ -195,7 +195,7 @@
 SUBDIRS_ZERO      = $(addprefix $(OSNAME)_$(VARIANTARCH)_zero/,$(TARGETS))
 SUBDIRS_SHARK     = $(addprefix $(OSNAME)_$(VARIANTARCH)_shark/,$(TARGETS))
 SUBDIRS_MINIMAL1  = $(addprefix $(OSNAME)_$(BUILDARCH)_minimal1/,$(TARGETS))
-SUBDIRS_GRAAL     = $(addprefix $(OSNAME)_$(BUILDARCH)_graal/,$(TARGETS))
+SUBDIRS_JVMCI     = $(addprefix $(OSNAME)_$(BUILDARCH)_jvmci/,$(TARGETS))
 
 TARGETS_C2        = $(TARGETS)
 TARGETS_C1        = $(addsuffix 1,$(TARGETS))
@@ -204,7 +204,7 @@
 TARGETS_ZERO      = $(addsuffix zero,$(TARGETS))
 TARGETS_SHARK     = $(addsuffix shark,$(TARGETS))
 TARGETS_MINIMAL1 =  $(addsuffix minimal1,$(TARGETS))
-TARGETS_GRAAL     = $(addsuffix graal,$(TARGETS))
+TARGETS_JVMCI     = $(addsuffix jvmci,$(TARGETS))
 
 BUILDTREE_MAKE    = $(GAMMADIR)/make/$(OSNAME)/makefiles/buildtree.make
 BUILDTREE_VARS    = GAMMADIR=$(GAMMADIR) OS_FAMILY=$(OSNAME) SRCARCH=$(SRCARCH) BUILDARCH=$(BUILDARCH) LIBARCH=$(LIBARCH)
@@ -224,7 +224,7 @@
 	@echo "  $(TARGETS_ZERO)"
 	@echo "  $(TARGETS_SHARK)"
 	@echo "  $(TARGETS_MINIMAL1)"
-	@echo "  $(TARGETS_GRAAL)"
+	@echo "  $(TARGETS_JVMCI)"
 
 checks: check_os_version check_j2se_version
 
@@ -286,9 +286,9 @@
 	$(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks
 	$(BUILDTREE) VARIANT=minimal1
 
-$(SUBDIRS_GRAAL): $(BUILDTREE_MAKE)
+$(SUBDIRS_JVMCI): $(BUILDTREE_MAKE)
 	$(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks
-	$(BUILDTREE) VARIANT=graal
+	$(BUILDTREE) VARIANT=jvmci
 
 platform_zero: $(GAMMADIR)/make/$(OSNAME)/platform_zero.in
 	$(SED) 's/@ZERO_ARCHDEF@/$(ZERO_ARCHDEF)/g;s/@ZERO_LIBARCH@/$(ZERO_LIBARCH)/g;' < $< > $@
@@ -337,10 +337,10 @@
 	cd $(OSNAME)_$(BUILDARCH)_minimal1/$(patsubst %minimal1,%,$@) && $(MAKE) $(MFLAGS) install
 endif
 
-$(TARGETS_GRAAL):  $(SUBDIRS_GRAAL)
-	cd $(OSNAME)_$(BUILDARCH)_graal/$(patsubst %graal,%,$@) && $(MAKE) $(MFLAGS)
+$(TARGETS_JVMCI):  $(SUBDIRS_JVMCI)
+	cd $(OSNAME)_$(BUILDARCH)_jvmci/$(patsubst %jvmci,%,$@) && $(MAKE) $(MFLAGS)
 ifdef INSTALL
-	cd $(OSNAME)_$(BUILDARCH)_graal/$(patsubst %graal,%,$@) && $(MAKE) $(MFLAGS) install
+	cd $(OSNAME)_$(BUILDARCH)_jvmci/$(patsubst %jvmci,%,$@) && $(MAKE) $(MFLAGS) install
 endif
 
 # Just build the tree, and nothing else:
@@ -350,7 +350,7 @@
 treezero:  $(SUBDIRS_ZERO)
 treeshark: $(SUBDIRS_SHARK)
 treeminimal1: $(SUBDIRS_MINIMAL1)
-treegraal: $(SUBDIRS_GRAAL)
+treejvmci: $(SUBDIRS_JVMCI)
 
 # Doc target.  This is the same for all build options.
 #     Hence create a docs directory beside ...$(ARCH)_[...]
@@ -388,10 +388,10 @@
 clean_docs:
 	rm -rf $(SUBDIR_DOCS)
 
-clean_compiler1 clean_compiler2 clean_core clean_zero clean_shark clean_graal clean_minimal1:
+clean_compiler1 clean_compiler2 clean_core clean_zero clean_shark clean_jvmci clean_minimal1:
 	rm -rf $(OSNAME)_$(BUILDARCH)_$(subst clean_,,$@)
 
-clean:  clean_compiler2 clean_compiler1 clean_core clean_zero clean_shark clean_minimal1 clean_graal clean_docs
+clean:  clean_compiler2 clean_compiler1 clean_core clean_zero clean_shark clean_minimal1 clean_jvmci clean_docs
 
 include $(GAMMADIR)/make/cscope.make
 
@@ -402,9 +402,9 @@
 
 #-------------------------------------------------------------------------------
 
-.PHONY: $(TARGETS_C2) $(TARGETS_C1) $(TARGETS_CORE) $(TARGETS_ZERO) $(TARGETS_SHARK) $(TARGETS_MINIMAL1) $(TARGETS_GRAAL)
-.PHONY: tree tree1 treecore treezero treeshark treegraal
-.PHONY: all compiler1 compiler2 core zero shark graal
-.PHONY: clean clean_compiler1 clean_compiler2 clean_core clean_zero clean_shark docs clean_docs clean_graal
+.PHONY: $(TARGETS_C2) $(TARGETS_C1) $(TARGETS_CORE) $(TARGETS_ZERO) $(TARGETS_SHARK) $(TARGETS_MINIMAL1) $(TARGETS_JVMCI)
+.PHONY: tree tree1 treecore treezero treeshark treejvmci
+.PHONY: all compiler1 compiler2 core zero shark jvmci
+.PHONY: clean clean_compiler1 clean_compiler2 clean_core clean_zero clean_shark docs clean_docs clean_jvmci
 .PHONY: checks check_os_version check_j2se_version
 .PHONY: $(HS_ALT_MAKE)/$(OSNAME)/Makefile.make
--- a/make/linux/makefiles/compiler1.make	Thu May 28 15:10:18 2015 -0700
+++ b/make/linux/makefiles/compiler1.make	Thu May 28 21:11:28 2015 -0700
@@ -30,8 +30,8 @@
 
 CFLAGS += -DCOMPILER1
 
-ifeq ($(INCLUDE_GRAAL), true)
-  CFLAGS += -DGRAAL
+ifeq ($(INCLUDE_JVMCI), true)
+  CFLAGS += -DJVMCI
 else
-  VM_SUBDIR = client-nograal
+  VM_SUBDIR = client-nojvmci
 endif
\ No newline at end of file
--- a/make/linux/makefiles/compiler2.make	Thu May 28 15:10:18 2015 -0700
+++ b/make/linux/makefiles/compiler2.make	Thu May 28 21:11:28 2015 -0700
@@ -30,8 +30,8 @@
 
 CFLAGS += -DCOMPILER2
 
-ifeq ($(INCLUDE_GRAAL), true)
-  CFLAGS += -DGRAAL
+ifeq ($(INCLUDE_JVMCI), true)
+  CFLAGS += -DJVMCI
 else
-  VM_SUBDIR = server-nograal
+  VM_SUBDIR = server-nojvmci
 endif
\ No newline at end of file
--- a/make/linux/makefiles/graal.make	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-#
-# Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
-# Copyright 2008, 2010 Red Hat, Inc.
-# 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.
-#  
-#
-
-# Sets make macros for making Graal version of VM
-
-TYPE = GRAAL
-
-VM_SUBDIR = graal
-
-# To make a non-tiered Graal build, remove the -DCOMPILER1 below and
-# in vm.make remove COMPILER1_PATHS from Src_Dirs/GRAAL and add
-# COMPILER1_SPECIFIC_FILES to Src_Files_EXCLUDE/GRAAL
-CFLAGS += -DCOMPILERGRAAL -DGRAAL -DCOMPILER1
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/linux/makefiles/jvmci.make	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,35 @@
+#
+# Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright 2008, 2010 Red Hat, Inc.
+# 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.
+#  
+#
+
+# Sets make macros for making JVMCI version of VM
+
+TYPE = JVMCI
+
+VM_SUBDIR = jvmci
+
+# To make a non-tiered JVMCI build, remove the -DCOMPILER1 below and
+# in vm.make remove COMPILER1_PATHS from Src_Dirs/JVMCI and add
+# COMPILER1_SPECIFIC_FILES to Src_Files_EXCLUDE/JVMCI
+CFLAGS += -DCOMPILERJVMCI -DJVMCI -DCOMPILER1
--- a/make/linux/makefiles/tiered.make	Thu May 28 15:10:18 2015 -0700
+++ b/make/linux/makefiles/tiered.make	Thu May 28 21:11:28 2015 -0700
@@ -30,8 +30,8 @@
 
 CFLAGS += -DCOMPILER2 -DCOMPILER1
 
-ifeq ($(INCLUDE_GRAAL), true)
-  CFLAGS += -DGRAAL
+ifeq ($(INCLUDE_JVMCI), true)
+  CFLAGS += -DJVMCI
 else
-  VM_SUBDIR = server-nograal
+  VM_SUBDIR = server-nojvmci
 endif
\ No newline at end of file
--- a/make/linux/makefiles/vm.make	Thu May 28 15:10:18 2015 -0700
+++ b/make/linux/makefiles/vm.make	Thu May 28 21:11:28 2015 -0700
@@ -113,10 +113,6 @@
 CXXFLAGS/ostream.o += -D_FILE_OFFSET_BITS=64
 endif # ifneq ($(LP64), 1)
 
-ifeq ($(INCLUDE_GRAAL), true)
-  CXXFLAGS += -DGRAAL_VERSION="\"$(GRAAL_VERSION)\""
-endif
-
 # CFLAGS_WARN holds compiler options to suppress/enable warnings.
 CFLAGS += $(CFLAGS_WARN/BYFILE)
 
@@ -151,7 +147,7 @@
 LIBJVM_DEBUGINFO   = lib$(JVM).debuginfo
 LIBJVM_DIZ         = lib$(JVM).diz
 
-SPECIAL_PATHS:=adlc c1 gc_implementation opto shark libadt graal
+SPECIAL_PATHS:=adlc c1 gc_implementation opto shark libadt jvmci
 
 SOURCE_PATHS=\
   $(shell find $(HS_COMMON_SRC)/share/vm/* -type d \! \
@@ -181,17 +177,17 @@
 
 SHARK_PATHS := $(GAMMADIR)/src/share/vm/shark
 
-GRAAL_PATHS += $(call altsrc,$(HS_COMMON_SRC)/share/vm/graal)
-GRAAL_PATHS += $(HS_COMMON_SRC)/share/vm/graal
+JVMCI_PATHS += $(call altsrc,$(HS_COMMON_SRC)/share/vm/jvmci)
+JVMCI_PATHS += $(HS_COMMON_SRC)/share/vm/jvmci
 
 # Include dirs per type.
 Src_Dirs/CORE      := $(CORE_PATHS)
-Src_Dirs/COMPILER1 := $(CORE_PATHS) $(COMPILER1_PATHS) $(GRAAL_PATHS)
-Src_Dirs/COMPILER2 := $(CORE_PATHS) $(COMPILER2_PATHS) $(GRAAL_PATHS)
-Src_Dirs/TIERED    := $(CORE_PATHS) $(COMPILER1_PATHS) $(COMPILER2_PATHS) $(GRAAL_PATHS)
+Src_Dirs/COMPILER1 := $(CORE_PATHS) $(COMPILER1_PATHS) $(JVMCI_PATHS)
+Src_Dirs/COMPILER2 := $(CORE_PATHS) $(COMPILER2_PATHS) $(JVMCI_PATHS)
+Src_Dirs/TIERED    := $(CORE_PATHS) $(COMPILER1_PATHS) $(COMPILER2_PATHS) $(JVMCI_PATHS)
 Src_Dirs/ZERO      := $(CORE_PATHS)
 Src_Dirs/SHARK     := $(CORE_PATHS) $(SHARK_PATHS)
-Src_Dirs/GRAAL     := $(CORE_PATHS) $(COMPILER1_PATHS) $(GRAAL_PATHS)
+Src_Dirs/JVMCI     := $(CORE_PATHS) $(COMPILER1_PATHS) $(JVMCI_PATHS)
 Src_Dirs := $(Src_Dirs/$(TYPE))
 
 COMPILER2_SPECIFIC_FILES := opto libadt bcEscapeAnalyzer.cpp c2_\* runtime_\*
@@ -199,24 +195,24 @@
 SHARK_SPECIFIC_FILES     := shark
 ZERO_SPECIFIC_FILES      := zero
 
-ifneq ($(INCLUDE_GRAAL), true)
-  GRAAL_SPECIFIC_FILES   := graal\* 
+ifneq ($(INCLUDE_JVMCI), true)
+  JVMCI_SPECIFIC_FILES   := jvmci\* 
 else
-  GRAAL_SPECIFIC_FILES   :=
-  Src_Dirs_I += $(HS_COMMON_SRC)/../graal/com.oracle.graal.hotspot/src_gen/hotspot
+  JVMCI_SPECIFIC_FILES   :=
+  Src_Dirs_I += $(HS_COMMON_SRC)/../graal/com.oracle.jvmci.hotspot/src_gen/hotspot
 endif
 
 # Always exclude these.
 Src_Files_EXCLUDE += jsig.c jvmtiEnvRecommended.cpp jvmtiEnvStub.cpp
 
 # Exclude per type.
-Src_Files_EXCLUDE/CORE      := $(COMPILER1_SPECIFIC_FILES) $(COMPILER2_SPECIFIC_FILES) $(ZERO_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES) $(GRAAL_SPECIFIC_FILES) ciTypeFlow.cpp
-Src_Files_EXCLUDE/COMPILER1 := $(COMPILER2_SPECIFIC_FILES) $(ZERO_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES) $(GRAAL_SPECIFIC_FILES) ciTypeFlow.cpp
-Src_Files_EXCLUDE/COMPILER2 := $(COMPILER1_SPECIFIC_FILES) $(ZERO_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES) $(GRAAL_SPECIFIC_FILES)
-Src_Files_EXCLUDE/TIERED    := $(ZERO_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES) $(GRAAL_SPECIFIC_FILES)
-Src_Files_EXCLUDE/ZERO      := $(COMPILER1_SPECIFIC_FILES) $(COMPILER2_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES) $(GRAAL_SPECIFIC_FILES) ciTypeFlow.cpp
-Src_Files_EXCLUDE/SHARK     := $(COMPILER1_SPECIFIC_FILES) $(COMPILER2_SPECIFIC_FILES) $(ZERO_SPECIFIC_FILES) $(GRAAL_SPECIFIC_FILES)
-Src_Files_EXCLUDE/GRAAL     := $(COMPILER2_SPECIFIC_FILES) $(ZERO_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES) ciTypeFlow.cpp
+Src_Files_EXCLUDE/CORE      := $(COMPILER1_SPECIFIC_FILES) $(COMPILER2_SPECIFIC_FILES) $(ZERO_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES) $(JVMCI_SPECIFIC_FILES) ciTypeFlow.cpp
+Src_Files_EXCLUDE/COMPILER1 := $(COMPILER2_SPECIFIC_FILES) $(ZERO_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES) $(JVMCI_SPECIFIC_FILES) ciTypeFlow.cpp
+Src_Files_EXCLUDE/COMPILER2 := $(COMPILER1_SPECIFIC_FILES) $(ZERO_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES) $(JVMCI_SPECIFIC_FILES)
+Src_Files_EXCLUDE/TIERED    := $(ZERO_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES) $(JVMCI_SPECIFIC_FILES)
+Src_Files_EXCLUDE/ZERO      := $(COMPILER1_SPECIFIC_FILES) $(COMPILER2_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES) $(JVMCI_SPECIFIC_FILES) ciTypeFlow.cpp
+Src_Files_EXCLUDE/SHARK     := $(COMPILER1_SPECIFIC_FILES) $(COMPILER2_SPECIFIC_FILES) $(ZERO_SPECIFIC_FILES) $(JVMCI_SPECIFIC_FILES)
+Src_Files_EXCLUDE/JVMCI     := $(COMPILER2_SPECIFIC_FILES) $(ZERO_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES) ciTypeFlow.cpp
 
 Src_Files_EXCLUDE +=  $(Src_Files_EXCLUDE/$(TYPE))
 
--- a/make/solaris/Makefile	Thu May 28 15:10:18 2015 -0700
+++ b/make/solaris/Makefile	Thu May 28 21:11:28 2015 -0700
@@ -149,13 +149,13 @@
 SUBDIRS_C2        = $(addprefix $(OSNAME)_$(BUILDARCH)_compiler2/,$(TARGETS))
 SUBDIRS_TIERED    = $(addprefix $(OSNAME)_$(BUILDARCH)_tiered/,$(TARGETS))
 SUBDIRS_CORE      = $(addprefix $(OSNAME)_$(BUILDARCH)_core/,$(TARGETS))
-SUBDIRS_GRAAL     = $(addprefix $(OSNAME)_$(BUILDARCH)_graal/,$(TARGETS))
+SUBDIRS_JVMCI     = $(addprefix $(OSNAME)_$(BUILDARCH)_jvmci/,$(TARGETS))
 
 TARGETS_C2        = $(TARGETS)
 TARGETS_C1        = $(addsuffix 1,$(TARGETS))
 TARGETS_TIERED    = $(addsuffix tiered,$(TARGETS))
 TARGETS_CORE      = $(addsuffix core,$(TARGETS))
-TARGETS_GRAAL     = $(addsuffix graal,$(TARGETS))
+TARGETS_JVMCI     = $(addsuffix jvmci,$(TARGETS))
 
 BUILDTREE_MAKE    = $(GAMMADIR)/make/$(OSNAME)/makefiles/buildtree.make
 BUILDTREE_VARS    = GAMMADIR=$(GAMMADIR) OS_FAMILY=$(OSNAME) ARCH=$(SRCARCH) BUILDARCH=$(BUILDARCH) LIBARCH=$(LIBARCH)
@@ -173,7 +173,7 @@
 	@echo "  $(TARGETS_C2)"
 	@echo "  $(TARGETS_C1)"
 	@echo "  $(TARGETS_CORE)"
-	@echo "  $(TARGETS_GRAAL)"
+	@echo "  $(TARGETS_JVMCI)"
 
 checks: check_os_version check_j2se_version
 
@@ -223,9 +223,9 @@
 	$(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks
 	$(BUILDTREE) VARIANT=core
 
-$(SUBDIRS_GRAAL): $(BUILDTREE_MAKE)
+$(SUBDIRS_JVMCI): $(BUILDTREE_MAKE)
 	$(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks
-	$(BUILDTREE) VARIANT=graal
+	$(BUILDTREE) VARIANT=jvmci
 
 # Define INSTALL=y at command line to automatically copy JVM into JAVA_HOME
 
@@ -253,17 +253,17 @@
 	cd $(OSNAME)_$(BUILDARCH)_core/$(patsubst %core,%,$@) && $(MAKE) $(MFLAGS) install
 endif
 
-$(TARGETS_GRAAL):  $(SUBDIRS_GRAAL)
-	cd $(OSNAME)_$(BUILDARCH)_graal/$(patsubst %graal,%,$@) && $(MAKE) $(MFLAGS)
+$(TARGETS_JVMCI):  $(SUBDIRS_JVMCI)
+	cd $(OSNAME)_$(BUILDARCH)_jvmci/$(patsubst %jvmci,%,$@) && $(MAKE) $(MFLAGS)
 ifdef INSTALL
-	cd $(OSNAME)_$(BUILDARCH)_graal/$(patsubst %graal,%,$@) && $(MAKE) $(MFLAGS) install
+	cd $(OSNAME)_$(BUILDARCH)_jvmci/$(patsubst %jvmci,%,$@) && $(MAKE) $(MFLAGS) install
 endif
 
 # Just build the tree, and nothing else:
 tree:      $(SUBDIRS_C2)
 tree1:     $(SUBDIRS_C1)
 treecore:  $(SUBDIRS_CORE)
-treegraal: $(SUBDIRS_GRAAL)
+treejvmci: $(SUBDIRS_JVMCI)
 
 # Doc target.  This is the same for all build options.
 #     Hence create a docs directory beside ...$(ARCH)_[...]
@@ -293,17 +293,17 @@
 clean_docs:
 	rm -rf $(SUBDIR_DOCS)
 
-clean_compiler1 clean_compiler2 clean_core clean_graal:
+clean_compiler1 clean_compiler2 clean_core clean_jvmci:
 	rm -rf $(OSNAME)_$(BUILDARCH)_$(subst clean_,,$@)
 
-clean:  clean_compiler2 clean_compiler1 clean_core clean_docs clean_graal
+clean:  clean_compiler2 clean_compiler1 clean_core clean_docs clean_jvmci
 
 include $(GAMMADIR)/make/cscope.make
 
 #-------------------------------------------------------------------------------
 
 .PHONY: $(TARGETS_C2) $(TARGETS_C1) $(TARGETS_CORE)
-.PHONY: tree tree1 treecore treegraal
-.PHONY: all compiler1 compiler2 core graal
-.PHONY: clean clean_compiler1 clean_compiler2 clean_core docs clean_docs clean_graal
+.PHONY: tree tree1 treecore treejvmci
+.PHONY: all compiler1 compiler2 core jvmci
+.PHONY: clean clean_compiler1 clean_compiler2 clean_core docs clean_docs clean_jvmci
 .PHONY: checks check_os_version check_j2se_version
--- a/make/solaris/makefiles/compiler1.make	Thu May 28 15:10:18 2015 -0700
+++ b/make/solaris/makefiles/compiler1.make	Thu May 28 21:11:28 2015 -0700
@@ -30,8 +30,8 @@
 
 CFLAGS += -DCOMPILER1
 
-ifeq ($(INCLUDE_GRAAL), true)
-  CFLAGS += -DGRAAL
+ifeq ($(INCLUDE_JVMCI), true)
+  CFLAGS += -DJVMCI
 else
-  VM_SUBDIR = client-nograal
+  VM_SUBDIR = client-nojvmci
 endif
--- a/make/solaris/makefiles/compiler2.make	Thu May 28 15:10:18 2015 -0700
+++ b/make/solaris/makefiles/compiler2.make	Thu May 28 21:11:28 2015 -0700
@@ -30,8 +30,8 @@
 
 CFLAGS += -DCOMPILER2
 
-ifeq ($(INCLUDE_GRAAL), true)
-  CFLAGS += -DGRAAL
+ifeq ($(INCLUDE_JVMCI), true)
+  CFLAGS += -DJVMCI
 else
-  VM_SUBDIR = server-nograal
+  VM_SUBDIR = server-nojvmci
 endif
--- a/make/solaris/makefiles/debug.make	Thu May 28 15:10:18 2015 -0700
+++ b/make/solaris/makefiles/debug.make	Thu May 28 21:11:28 2015 -0700
@@ -46,8 +46,8 @@
 # Linker mapfiles
 MAPFILE = $(GAMMADIR)/make/solaris/makefiles/mapfile-vers \
           $(GAMMADIR)/make/solaris/makefiles/mapfile-vers-debug
-#ifdef GRAAL
-MAPFILE += $(GAMMADIR)/make/solaris/makefiles/mapfile-vers-GRAAL
+#ifdef JVMCI
+MAPFILE += $(GAMMADIR)/make/solaris/makefiles/mapfile-vers-JVMCI
 #endif
 
 # This mapfile is only needed when compiling with dtrace support,
--- a/make/solaris/makefiles/fastdebug.make	Thu May 28 15:10:18 2015 -0700
+++ b/make/solaris/makefiles/fastdebug.make	Thu May 28 21:11:28 2015 -0700
@@ -117,8 +117,8 @@
 # Linker mapfiles
 MAPFILE = $(GAMMADIR)/make/solaris/makefiles/mapfile-vers \
 	  $(GAMMADIR)/make/solaris/makefiles/mapfile-vers-debug
-#ifdef GRAAL
-MAPFILE += $(GAMMADIR)/make/solaris/makefiles/mapfile-vers-GRAAL
+#ifdef JVMCI
+MAPFILE += $(GAMMADIR)/make/solaris/makefiles/mapfile-vers-JVMCI
 #endif
 
 # This mapfile is only needed when compiling with dtrace support,
--- a/make/solaris/makefiles/graal.make	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-#
-# Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
-# Copyright 2008, 2010 Red Hat, Inc.
-# 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.
-#  
-#
-
-# Sets make macros for making Graal version of VM
-
-TYPE = GRAAL
-
-VM_SUBDIR = graal
-
-# To make a non-tiered Graal build, remove the -DCOMPILER1 below and
-# in vm.make remove COMPILER1_PATHS from Src_Dirs/GRAAL and add
-# COMPILER1_SPECIFIC_FILES to Src_Files_EXCLUDE/GRAAL
-CFLAGS += -DCOMPILERGRAAL -DGRAAL -DCOMPILER1
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/solaris/makefiles/jvmci.make	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,35 @@
+#
+# Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright 2008, 2010 Red Hat, Inc.
+# 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.
+#  
+#
+
+# Sets make macros for making JVMCI version of VM
+
+TYPE = JVMCI
+
+VM_SUBDIR = jvmci
+
+# To make a non-tiered JVMCI build, remove the -DCOMPILER1 below and
+# in vm.make remove COMPILER1_PATHS from Src_Dirs/JVMCI and add
+# COMPILER1_SPECIFIC_FILES to Src_Files_EXCLUDE/JVMCI
+CFLAGS += -DCOMPILERJVMCI -DJVMCI -DCOMPILER1
--- a/make/solaris/makefiles/optimized.make	Thu May 28 15:10:18 2015 -0700
+++ b/make/solaris/makefiles/optimized.make	Thu May 28 21:11:28 2015 -0700
@@ -54,8 +54,8 @@
 
 # Linker mapfiles
 MAPFILE = $(GAMMADIR)/make/solaris/makefiles/mapfile-vers
-#ifdef GRAAL
-MAPFILE += $(GAMMADIR)/make/solaris/makefiles/mapfile-vers-GRAAL
+#ifdef JVMCI
+MAPFILE += $(GAMMADIR)/make/solaris/makefiles/mapfile-vers-JVMCI
 #endif
 
 # This mapfile is only needed when compiling with dtrace support, 
--- a/make/solaris/makefiles/product.make	Thu May 28 15:10:18 2015 -0700
+++ b/make/solaris/makefiles/product.make	Thu May 28 21:11:28 2015 -0700
@@ -66,8 +66,8 @@
 
 # Linker mapfiles
 MAPFILE = $(GAMMADIR)/make/solaris/makefiles/mapfile-vers
-ifdef GRAAL
-MAPFILE += $(GAMMADIR)/make/solaris/makefiles/mapfile-vers-GRAAL
+ifdef JVMCI
+MAPFILE += $(GAMMADIR)/make/solaris/makefiles/mapfile-vers-JVMCI
 endif
 
 ifndef USE_GCC
--- a/make/solaris/makefiles/tiered.make	Thu May 28 15:10:18 2015 -0700
+++ b/make/solaris/makefiles/tiered.make	Thu May 28 21:11:28 2015 -0700
@@ -30,8 +30,8 @@
 
 CFLAGS += -DCOMPILER2 -DCOMPILER1
 
-ifeq ($(INCLUDE_GRAAL), true)
-  CFLAGS += -DGRAAL
+ifeq ($(INCLUDE_JVMCI), true)
+  CFLAGS += -DJVMCI
 else
-  VM_SUBDIR = server-nograal
+  VM_SUBDIR = server-nojvmci
 endif
--- a/make/solaris/makefiles/vm.make	Thu May 28 15:10:18 2015 -0700
+++ b/make/solaris/makefiles/vm.make	Thu May 28 21:11:28 2015 -0700
@@ -100,10 +100,6 @@
 CXXFLAGS/ostream.o += -D_FILE_OFFSET_BITS=64
 endif # ifneq ($(LP64), 1)
 
-ifeq ($(INCLUDE_GRAAL), true)
-  CXXFLAGS += -DGRAAL_VERSION="\"$(GRAAL_VERSION)\""
-endif
-
 # CFLAGS_WARN holds compiler options to suppress/enable warnings.
 CFLAGS += $(CFLAGS_WARN)
 
@@ -165,7 +161,7 @@
 LIBJVM_DEBUGINFO   = lib$(JVM).debuginfo
 LIBJVM_DIZ         = lib$(JVM).diz
 
-SPECIAL_PATHS:=adlc c1 dist gc_implementation opto shark libadt graal
+SPECIAL_PATHS:=adlc c1 dist gc_implementation opto shark libadt jvmci
 
 SOURCE_PATHS=\
   $(shell find $(HS_COMMON_SRC)/share/vm/* -type d \! \
@@ -193,17 +189,17 @@
 COMPILER2_PATHS += $(HS_COMMON_SRC)/share/vm/libadt
 COMPILER2_PATHS +=  $(GENERATED)/adfiles
 
-GRAAL_PATHS += $(call altsrc,$(HS_COMMON_SRC)/share/vm/graal)
-GRAAL_PATHS += $(HS_COMMON_SRC)/share/vm/graal
+JVMCI_PATHS += $(call altsrc,$(HS_COMMON_SRC)/share/vm/jvmci)
+JVMCI_PATHS += $(HS_COMMON_SRC)/share/vm/jvmci
 
 # Include dirs per type.
 Src_Dirs/CORE      := $(CORE_PATHS)
-Src_Dirs/COMPILER1 := $(CORE_PATHS) $(COMPILER1_PATHS) $(GRAAL_PATHS)
-Src_Dirs/COMPILER2 := $(CORE_PATHS) $(COMPILER2_PATHS) $(GRAAL_PATHS)
-Src_Dirs/TIERED    := $(CORE_PATHS) $(COMPILER1_PATHS) $(COMPILER2_PATHS) $(GRAAL_PATHS)
+Src_Dirs/COMPILER1 := $(CORE_PATHS) $(COMPILER1_PATHS) $(JVMCI_PATHS)
+Src_Dirs/COMPILER2 := $(CORE_PATHS) $(COMPILER2_PATHS) $(JVMCI_PATHS)
+Src_Dirs/TIERED    := $(CORE_PATHS) $(COMPILER1_PATHS) $(COMPILER2_PATHS) $(JVMCI_PATHS)
 Src_Dirs/ZERO      := $(CORE_PATHS)
 Src_Dirs/SHARK     := $(CORE_PATHS) $(SHARK_PATHS)
-Src_Dirs/GRAAL     := $(CORE_PATHS) $(COMPILER1_PATHS) $(GRAAL_PATHS)
+Src_Dirs/JVMCI     := $(CORE_PATHS) $(COMPILER1_PATHS) $(JVMCI_PATHS)
 Src_Dirs := $(Src_Dirs/$(TYPE))
 
 COMPILER2_SPECIFIC_FILES := opto libadt bcEscapeAnalyzer.cpp c2_\* runtime_\*
@@ -211,24 +207,24 @@
 SHARK_SPECIFIC_FILES     := shark
 ZERO_SPECIFIC_FILES      := zero
 
-ifneq ($(INCLUDE_GRAAL), true)
-  GRAAL_SPECIFIC_FILES   := graal\* 
+ifneq ($(INCLUDE_JVMCI), true)
+  JVMCI_SPECIFIC_FILES   := jvmci\* 
 else
-  GRAAL_SPECIFIC_FILES   :=
-  Src_Dirs_I += $(HS_COMMON_SRC)/../graal/com.oracle.graal.hotspot/src_gen/hotspot
+  JVMCI_SPECIFIC_FILES   :=
+  Src_Dirs_I += $(HS_COMMON_SRC)/../graal/com.oracle.jvmci.hotspot/src_gen/hotspot
 endif
 
 # Always exclude these.
 Src_Files_EXCLUDE := dtrace jsig.c jvmtiEnvRecommended.cpp jvmtiEnvStub.cpp
 
 # Exclude per type.
-Src_Files_EXCLUDE/CORE      := $(COMPILER1_SPECIFIC_FILES) $(COMPILER2_SPECIFIC_FILES) $(ZERO_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES) $(GRAAL_SPECIFIC_FILES) ciTypeFlow.cpp
-Src_Files_EXCLUDE/COMPILER1 := $(COMPILER2_SPECIFIC_FILES) $(ZERO_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES) $(GRAAL_SPECIFIC_FILES) ciTypeFlow.cpp
-Src_Files_EXCLUDE/COMPILER2 := $(COMPILER1_SPECIFIC_FILES) $(ZERO_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES) $(GRAAL_SPECIFIC_FILES)
-Src_Files_EXCLUDE/TIERED    := $(ZERO_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES) $(GRAAL_SPECIFIC_FILES)
-Src_Files_EXCLUDE/ZERO      := $(COMPILER1_SPECIFIC_FILES) $(COMPILER2_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES) $(GRAAL_SPECIFIC_FILES) ciTypeFlow.cpp
-Src_Files_EXCLUDE/SHARK     := $(COMPILER1_SPECIFIC_FILES) $(COMPILER2_SPECIFIC_FILES) $(ZERO_SPECIFIC_FILES) $(GRAAL_SPECIFIC_FILES)
-Src_Files_EXCLUDE/GRAAL     := $(COMPILER2_SPECIFIC_FILES) $(ZERO_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES) ciTypeFlow.cpp
+Src_Files_EXCLUDE/CORE      := $(COMPILER1_SPECIFIC_FILES) $(COMPILER2_SPECIFIC_FILES) $(ZERO_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES) $(JVMCI_SPECIFIC_FILES) ciTypeFlow.cpp
+Src_Files_EXCLUDE/COMPILER1 := $(COMPILER2_SPECIFIC_FILES) $(ZERO_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES) $(JVMCI_SPECIFIC_FILES) ciTypeFlow.cpp
+Src_Files_EXCLUDE/COMPILER2 := $(COMPILER1_SPECIFIC_FILES) $(ZERO_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES) $(JVMCI_SPECIFIC_FILES)
+Src_Files_EXCLUDE/TIERED    := $(ZERO_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES) $(JVMCI_SPECIFIC_FILES)
+Src_Files_EXCLUDE/ZERO      := $(COMPILER1_SPECIFIC_FILES) $(COMPILER2_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES) $(JVMCI_SPECIFIC_FILES) ciTypeFlow.cpp
+Src_Files_EXCLUDE/SHARK     := $(COMPILER1_SPECIFIC_FILES) $(COMPILER2_SPECIFIC_FILES) $(ZERO_SPECIFIC_FILES) $(JVMCI_SPECIFIC_FILES)
+Src_Files_EXCLUDE/JVMCI     := $(COMPILER2_SPECIFIC_FILES) $(ZERO_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES) ciTypeFlow.cpp
 
 Src_Files_EXCLUDE +=  $(Src_Files_EXCLUDE/$(TYPE))
 
--- a/make/windows/build.make	Thu May 28 15:10:18 2015 -0700
+++ b/make/windows/build.make	Thu May 28 21:11:28 2015 -0700
@@ -110,8 +110,8 @@
 !endif
 !elseif "$(Variant)" == "tiered"
 VARIANT_TEXT=Tiered
-!elseif "$(Variant)" == "graal"
-VARIANT_TEXT=Graal
+!elseif "$(Variant)" == "jvmci"
+VARIANT_TEXT=JVMCI
 !endif
 
 #########################################################################
@@ -308,9 +308,9 @@
 checks: checkVariant checkWorkSpace checkSA
 
 checkVariant:
-	@ if "$(Variant)"=="" echo Need to specify "Variant=[graal|tiered|compiler2|compiler1|core]" && false
-	@ if "$(Variant)" NEQ "graal" if "$(Variant)" NEQ "tiered" if "$(Variant)" NEQ "compiler2" if "$(Variant)" NEQ "compiler1" if "$(Variant)" NEQ "core" \
-          echo Need to specify "Variant=[graal|tiered|compiler2|compiler1|core]" && false
+	@ if "$(Variant)"=="" echo Need to specify "Variant=[jvmci|tiered|compiler2|compiler1|core]" && false
+	@ if "$(Variant)" NEQ "jvmci" if "$(Variant)" NEQ "tiered" if "$(Variant)" NEQ "compiler2" if "$(Variant)" NEQ "compiler1" if "$(Variant)" NEQ "core" \
+          echo Need to specify "Variant=[jvmci|tiered|compiler2|compiler1|core]" && false
 
 checkWorkSpace:
 	@ if "$(WorkSpace)"=="" echo Need to specify "WorkSpace=..." && false
--- a/make/windows/create.bat	Thu May 28 15:10:18 2015 -0700
+++ b/make/windows/create.bat	Thu May 28 21:11:28 2015 -0700
@@ -159,7 +159,7 @@
 
 REM This is now safe to do.
 :copyfiles
-for /D %%i in (graal, compiler1, compiler2, tiered) do (
+for /D %%i in (jvmci, compiler1, compiler2, tiered) do (
 if NOT EXIST %HotSpotBuildSpace%\%%i\generated mkdir %HotSpotBuildSpace%\%%i\generated
 copy %HotSpotWorkSpace%\make\windows\projectfiles\%%i\* %HotSpotBuildSpace%\%%i\generated > NUL
 )
@@ -167,7 +167,7 @@
 REM force regneration of ProjectFile
 if exist %ProjectFile% del %ProjectFile%
 
-for /D %%i in (graal, compiler1, compiler2, tiered) do (
+for /D %%i in (jvmci, compiler1, compiler2, tiered) do (
 echo -- %%i --
 echo # Generated file!                                                        >    %HotSpotBuildSpace%\%%i\local.make
 echo # Changing a variable below and then deleting %ProjectFile% will cause  >>    %HotSpotBuildSpace%\%%i\local.make
--- a/make/windows/makefiles/projectcreator.make	Thu May 28 15:10:18 2015 -0700
+++ b/make/windows/makefiles/projectcreator.make	Thu May 28 21:11:28 2015 -0700
@@ -56,7 +56,7 @@
         -relativeInclude src\os\windows\vm \
         -relativeInclude src\os_cpu\windows_$(Platform_arch)\vm \
         -relativeInclude src\cpu\$(Platform_arch)\vm \
-        -relativeInclude graal\com.oracle.graal.hotspot\src_gen\hotspot \
+        -relativeInclude graal\com.oracle.jvmci.hotspot\src_gen\hotspot \
         -absoluteInclude $(HOTSPOTBUILDSPACE)/%f/generated \
         -relativeSrcInclude src \
         -absoluteSrcInclude $(HOTSPOTBUILDSPACE) \
@@ -150,10 +150,10 @@
  -ignorePath_TARGET tiered \
  -ignorePath_TARGET c1_
 
-ProjectCreatorIDEOptionsIgnoreGraal=\
- -ignorePath_TARGET src/share/vm/graal \
- -ignorePath_TARGET graal\com.oracle.graal.hotspot\src_gen\hotspot \
- -ignorePath_TARGET vm/graal
+ProjectCreatorIDEOptionsIgnoreJVMCI=\
+ -ignorePath_TARGET src/share/vm/jvmci \
+ -ignorePath_TARGET graal\com.oracle.jvmci.hotspot\src_gen\hotspot \
+ -ignorePath_TARGET vm/jvmci
 
 ProjectCreatorIDEOptionsIgnoreCompiler2=\
  -ignorePath_TARGET compiler2 \
@@ -175,17 +175,17 @@
 ##################################################
 ProjectCreatorIDEOptions=$(ProjectCreatorIDEOptions) \
  -define_compiler1 COMPILER1 \
- -define_compiler1 GRAAL \
+ -define_compiler1 JVMCI \
  $(ProjectCreatorIDEOptionsIgnoreCompiler2:TARGET=compiler1)
 
 ##################################################
-# Graal compiler specific options
+# JVMCI compiler specific options
 ##################################################
 ProjectCreatorIDEOptions=$(ProjectCreatorIDEOptions) \
- -define_graal COMPILER1 \
- -define_graal COMPILERGRAAL \
- -define_graal GRAAL \
- $(ProjectCreatorIDEOptionsIgnoreCompiler2:TARGET=graal)
+ -define_jvmci COMPILER1 \
+ -define_jvmci COMPILERJVMCI \
+ -define_jvmci JVMCI \
+ $(ProjectCreatorIDEOptionsIgnoreCompiler2:TARGET=jvmci)
 
 ##################################################
 # Server(C2) compiler specific options
@@ -194,7 +194,7 @@
 ProjectCreatorIDEOptions=$(ProjectCreatorIDEOptions) \
  -define_compiler2 COMPILER1 \
  -define_compiler2 COMPILER2 \
- -define_compiler2 GRAAL \
+ -define_compiler2 JVMCI \
  -additionalFile_compiler2 $(Platform_arch_model).ad \
  -additionalFile_compiler2 ad_$(Platform_arch_model).cpp \
  -additionalFile_compiler2 ad_$(Platform_arch_model).hpp \
--- a/make/windows/makefiles/vm.make	Thu May 28 15:10:18 2015 -0700
+++ b/make/windows/makefiles/vm.make	Thu May 28 21:11:28 2015 -0700
@@ -48,8 +48,8 @@
 CXX_FLAGS=$(CXX_FLAGS) /D "COMPILER1" /D "COMPILER2"
 !endif
 
-!if "$(Variant)" == "graal"
-CXX_FLAGS=$(CXX_FLAGS) /D "GRAAL" /D "COMPILERGRAAL" /D "COMPILER1"
+!if "$(Variant)" == "jvmci"
+CXX_FLAGS=$(CXX_FLAGS) /D "JVMCI" /D "COMPILERJVMCI" /D "COMPILER1"
 !endif
 
 !if "$(BUILDARCH)" == "i486"
@@ -71,10 +71,6 @@
 # Define that so jni.h is on correct side
 CXX_FLAGS=$(CXX_FLAGS) /D "_JNI_IMPLEMENTATION_"
 
-!if "$(INCLUDE_GRAAL)" == "true"
-  CXX_FLAGS=$(CXX_FLAGS) /D "GRAAL_VERSION=\"$(GRAAL_VERSION)\""
-!endif
-
 !if "$(BUILDARCH)" == "ia64"
 STACK_SIZE="/STACK:1048576,262144"
 !else
@@ -150,7 +146,7 @@
 VM_PATH=$(VM_PATH);../generated/jvmtifiles
 VM_PATH=$(VM_PATH);../generated/tracefiles
 VM_PATH=$(VM_PATH);$(WorkSpace)/src/share/vm/c1
-VM_PATH=$(VM_PATH);$(WorkSpace)/src/share/vm/graal
+VM_PATH=$(VM_PATH);$(WorkSpace)/src/share/vm/jvmci
 VM_PATH=$(VM_PATH);$(WorkSpace)/src/share/vm/compiler
 VM_PATH=$(VM_PATH);$(WorkSpace)/src/share/vm/code
 VM_PATH=$(VM_PATH);$(WorkSpace)/src/share/vm/interpreter
--- a/mx/mx_graal.py	Thu May 28 15:10:18 2015 -0700
+++ b/mx/mx_graal.py	Thu May 28 21:11:28 2015 -0700
@@ -47,11 +47,11 @@
 """ The VMs that can be built and run along with an optional description. Only VMs with a
     description are listed in the dialogue for setting the default VM (see _get_vm()). """
 _vmChoices = {
-    'graal' : 'Normal compilation is performed with a tiered system (C1 + Graal), Truffle compilation is performed with Graal.',
+    'jvmci' : 'Normal compilation is performed with a tiered system (C1 + Graal), Truffle compilation is performed with Graal.',
     'server' : 'Normal compilation is performed with a tiered system (C1 + C2), Truffle compilation is performed with Graal. Use this for optimal Truffle performance.',
     'client' : None,  # normal compilation with client compiler, explicit compilation (e.g., by Truffle) with Graal
-    'server-nograal' : None,  # all compilation with tiered system (i.e., client + server), Graal omitted
-    'client-nograal' : None,  # all compilation with client compiler, Graal omitted
+    'server-nojvmci' : None,  # all compilation with tiered system (i.e., client + server), JVMCI omitted
+    'client-nojvmci' : None,  # all compilation with client compiler, JVMCI omitted
     'original' : None,  # default VM copied from bootstrap JDK
 }
 
@@ -87,16 +87,16 @@
 _untilVersion = None
 
 class JDKDeployedDist:
-    def __init__(self, name, isExtension=False, isGraalClassLoader=False):
+    def __init__(self, name, isExtension=False, usesJVMCIClassLoader=False):
         self.name = name
         self.isExtension = isExtension
-        self.isGraalClassLoader = isGraalClassLoader
+        self.usesJVMCIClassLoader = usesJVMCIClassLoader
 
 _jdkDeployedDists = [
     JDKDeployedDist('TRUFFLE'),
-    JDKDeployedDist('GRAAL_LOADER'),
-    JDKDeployedDist('GRAAL', isGraalClassLoader=True),
-    JDKDeployedDist('GRAAL_TRUFFLE', isGraalClassLoader=True)
+    JDKDeployedDist('JVMCI_LOADER'),
+    JDKDeployedDist('GRAAL', usesJVMCIClassLoader=True),
+    JDKDeployedDist('GRAAL_TRUFFLE', usesJVMCIClassLoader=True)
 ]
 
 JDK_UNIX_PERMISSIONS_DIR = 0755
@@ -167,7 +167,7 @@
     os.path.walk(dirname, _chmodDir, chmodFlagsDir)
 
 def clean(args):
-    """clean the GraalVM source tree"""
+    """clean the source tree"""
     opts = mx.clean(args, parser=ArgumentParser(prog='mx clean'))
 
     if opts.native:
@@ -186,7 +186,7 @@
                 os.unlink(name)
 
         rmIfExists(join(_graal_home, 'build'))
-        rmIfExists(join(_graal_home, 'build-nograal'))
+        rmIfExists(join(_graal_home, 'build-nojvmci'))
         rmIfExists(_jdksDir())
 
 def export(args):
@@ -499,22 +499,22 @@
 
     return jdk
 
-def _updateInstalledGraalOptionsFile(jdk):
-    graalOptions = join(_graal_home, 'graal.options')
+def _updateInstalledJVMCIOptionsFile(jdk):
+    jvmciOptions = join(_graal_home, 'jvmci.options')
     jreLibDir = join(jdk, 'jre', 'lib')
-    if exists(graalOptions):
-        shutil.copy(graalOptions, join(jreLibDir, 'graal.options'))
+    if exists(jvmciOptions):
+        shutil.copy(jvmciOptions, join(jreLibDir, 'jvmci.options'))
     else:
-        toDelete = join(jreLibDir, 'graal.options')
+        toDelete = join(jreLibDir, 'jvmci.options')
         if exists(toDelete):
             os.unlink(toDelete)
 
 def _makeHotspotGeneratedSourcesDir():
     """
     Gets the directory containing all the HotSpot sources generated from
-    Graal Java sources. This directory will be created if it doesn't yet exist.
+    JVMCI Java sources. This directory will be created if it doesn't yet exist.
     """
-    hsSrcGenDir = join(mx.project('com.oracle.graal.hotspot').source_gen_dir(), 'hotspot')
+    hsSrcGenDir = join(mx.project('com.oracle.jvmci.hotspot').source_gen_dir(), 'hotspot')
     if not exists(hsSrcGenDir):
         os.makedirs(hsSrcGenDir)
     return hsSrcGenDir
@@ -543,14 +543,14 @@
         return className[:className.index('<')]
     return className
 
-def _classifyGraalServices(classNames, graalJars):
+def _classifyJVMCIServices(classNames, jvmciJars):
     classification = {}
     if not classNames:
         return classification
     for className in classNames:
         classification[className] = None
     javap = mx.java().javap
-    output = subprocess.check_output([javap, '-cp', os.pathsep.join(graalJars)] + classNames, stderr=subprocess.STDOUT)
+    output = subprocess.check_output([javap, '-cp', os.pathsep.join(jvmciJars)] + classNames, stderr=subprocess.STDOUT)
     lines = output.split(os.linesep)
     for line in lines:
         if line.startswith('public interface '):
@@ -563,7 +563,7 @@
                         classification[className] = False
                         break
                     superInterfaces = afterName[len(' extends '):-len(' {')].split(',')
-                    if 'com.oracle.graal.api.runtime.Service' in superInterfaces:
+                    if 'com.oracle.jvmci.runtime.Service' in superInterfaces:
                         classification[className] = True
                         break
                     maybe = [_eraseGenerics(superInterface) for superInterface in superInterfaces]
@@ -575,11 +575,11 @@
     return classification
 
 def _extractMaybes(classification):
-    maybes = []
+    maybes = set()
     for v in classification.values():
         if isinstance(v, list):
-            maybes.extend(v)
-    return maybes
+            maybes.update(v)
+    return list(maybes)
 
 def _mergeClassification(classification, newClassification):
     for className, value in classification.items():
@@ -597,11 +597,11 @@
                         classification[className] = []
                     classification[className].extend(newClassification[superInterface])
 
-def _filterGraalService(classNames, graalJars):
-    classification = _classifyGraalServices(classNames, graalJars)
+def _filterJVMCIService(classNames, jvmciJars):
+    classification = _classifyJVMCIServices(classNames, jvmciJars)
     needClassification = _extractMaybes(classification)
     while needClassification:
-        _mergeClassification(classification, _classifyGraalServices(needClassification, graalJars))
+        _mergeClassification(classification, _classifyJVMCIServices(needClassification, jvmciJars))
         needClassification = _extractMaybes(classification)
     filtered = []
     for className in classNames:
@@ -609,7 +609,7 @@
             filtered.append(className)
     return filtered
 
-def _extractGraalFiles(graalJars, servicesDir, optionsDir, cleanDestination=True):
+def _extractJVMCIFiles(jvmciJars, servicesDir, optionsDir, cleanDestination=True):
     if cleanDestination:
         if exists(servicesDir):
             shutil.rmtree(servicesDir)
@@ -621,7 +621,7 @@
         os.makedirs(optionsDir)
     servicesMap = {}
     optionsFiles = []
-    for jar in graalJars:
+    for jar in jvmciJars:
         if os.path.isfile(jar):
             with zipfile.ZipFile(jar) as zf:
                 for member in zf.namelist():
@@ -644,8 +644,8 @@
                         with zf.open(member) as optionsFile, \
                              file(targetpath, "wb") as target:
                             shutil.copyfileobj(optionsFile, target)
-    graalServices = _filterGraalService(servicesMap.keys(), graalJars)
-    for serviceName in graalServices:
+    jvmciServices = _filterJVMCIService(servicesMap.keys(), jvmciJars)
+    for serviceName in jvmciServices:
         serviceImpls = servicesMap[serviceName]
         fd, tmp = tempfile.mkstemp(prefix=serviceName)
         f = os.fdopen(fd, 'w+')
@@ -656,23 +656,45 @@
         shutil.move(tmp, target)
         if mx.get_os() != 'windows':
             os.chmod(target, JDK_UNIX_PERMISSIONS_FILE)
-    return (graalServices, optionsFiles)
-
-def _updateGraalFiles(jdkDir):
-    jreGraalDir = join(jdkDir, 'jre', 'lib', 'graal')
-    graalJars = [join(jreGraalDir, e) for e in os.listdir(jreGraalDir) if e.startswith('graal') and e.endswith('.jar')]
-    jreGraalServicesDir = join(jreGraalDir, 'services')
-    jreGraalOptionsDir = join(jreGraalDir, 'options')
-    _extractGraalFiles(graalJars, jreGraalServicesDir, jreGraalOptionsDir)
-
-
+    return (jvmciServices, optionsFiles)
+
+def _updateJVMCIFiles(jdkDir):
+    jreJVMCIDir = join(jdkDir, 'jre', 'lib', 'jvmci')
+    graalJars = [join(jreJVMCIDir, e) for e in os.listdir(jreJVMCIDir) if e.startswith('graal') and e.endswith('.jar')]
+    jreGraalServicesDir = join(jreJVMCIDir, 'services')
+    jreGraalOptionsDir = join(jreJVMCIDir, 'options')
+    _extractJVMCIFiles(graalJars, jreGraalServicesDir, jreGraalOptionsDir)
+
+def _patchGraalVersionConstant(dist):
+    """
+    Patches the constant "@@graal.version@@" in the constant pool of Graal.class
+    with the computed Graal version string.
+    """
+    zfOutFd, zfOutPath = tempfile.mkstemp(suffix='', prefix=basename(dist.path) + '.', dir=dirname(dist.path))
+    zfOut = zipfile.ZipFile(zfOutPath, 'w')
+    zf = zipfile.ZipFile(dist.path, 'r')
+    for zi in zf.infolist():
+        data = zf.read(zi)
+        if zi.filename == 'com/oracle/graal/api/runtime/Graal.class':
+            versionSpec = '{:' + str(len('@@graal.version@@')) + '}'
+            versionStr = versionSpec.format(graal_version())
+            assert '@@graal.version@@' in data, 'could not find "@@graal.version@@" constant in ' + dist.path + '!' + zi.filename
+            data = data.replace('@@graal.version@@', versionStr)
+        zfOut.writestr(zi, data)
+    zfOut.close()
+    os.close(zfOutFd)
+    zf.close()
+    shutil.move(zfOutPath, dist.path)
 
 def _installDistInJdks(deployableDist):
     """
-    Installs the jar(s) for a given Distribution into all existing Graal JDKs
+    Installs the jar(s) for a given Distribution into all existing JVMCI JDKs
     """
 
     dist = mx.distribution(deployableDist.name)
+    if dist.name == 'GRAAL':
+        _patchGraalVersionConstant(dist)
+
     jdks = _jdksDir()
     if exists(jdks):
         for e in os.listdir(jdks):
@@ -681,8 +703,8 @@
             if exists(jreLibDir):
                 if deployableDist.isExtension:
                     targetDir = join(jreLibDir, 'ext')
-                elif deployableDist.isGraalClassLoader:
-                    targetDir = join(jreLibDir, 'graal')
+                elif deployableDist.usesJVMCIClassLoader:
+                    targetDir = join(jreLibDir, 'jvmci')
                 else:
                     targetDir = jreLibDir
                 if not exists(targetDir):
@@ -690,9 +712,9 @@
                 _copyToJdk(dist.path, targetDir)
                 if dist.sourcesPath:
                     _copyToJdk(dist.sourcesPath, jdkDir)
-                if deployableDist.isGraalClassLoader:
+                if deployableDist.usesJVMCIClassLoader:
                     # deploy service files
-                    _updateGraalFiles(jdkDir)
+                    _updateJVMCIFiles(jdkDir)
 
 # run a command in the windows SDK Debug Shell
 def _runInDebugShell(cmd, workingDir, logFile=None, findInOutput=None, respondTo=None):
@@ -839,7 +861,7 @@
 
     # Call mx.build to compile the Java sources
     parser = AP()
-    parser.add_argument('--export-dir', help='directory to which graal.jar and graal.options will be copied', metavar='<path>')
+    parser.add_argument('--export-dir', help='directory to which JVMCI and Graal jars and jvmci.options will be copied', metavar='<path>')
     parser.add_argument('-D', action='append', help='set a HotSpot build variable (run \'mx buildvars\' to list variables)', metavar='name=value')
     opts2 = mx.build(['--source', '1.7'] + args, parser=parser)
     assert len(opts2.remainder) == 0
@@ -853,32 +875,32 @@
         defsPath = join(_graal_home, 'make', 'defs.make')
         with open(defsPath) as fp:
             defs = fp.read()
-        graalJars = []
+        jvmciJars = []
         for jdkDist in _jdkDeployedDists:
             dist = mx.distribution(jdkDist.name)
             defLine = 'EXPORT_LIST += $(EXPORT_JRE_LIB_DIR)/' + basename(dist.path)
             if jdkDist.isExtension:
                 defLine = 'EXPORT_LIST += $(EXPORT_JRE_LIB_EXT_DIR)/' + basename(dist.path)
-            elif jdkDist.isGraalClassLoader:
-                defLine = 'EXPORT_LIST += $(EXPORT_JRE_LIB_GRAAL_DIR)/' + basename(dist.path)
-                graalJars.append(dist.path)
+            elif jdkDist.usesJVMCIClassLoader:
+                defLine = 'EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_DIR)/' + basename(dist.path)
+                jvmciJars.append(dist.path)
             else:
                 defLine = 'EXPORT_LIST += $(EXPORT_JRE_LIB_DIR)/' + basename(dist.path)
             if defLine not in defs:
                 mx.abort('Missing following line in ' + defsPath + '\n' + defLine)
             shutil.copy(dist.path, opts2.export_dir)
-        services, optionsFiles = _extractGraalFiles(graalJars, join(opts2.export_dir, 'services'), join(opts2.export_dir, 'options'))
+        services, optionsFiles = _extractJVMCIFiles(jvmciJars, join(opts2.export_dir, 'services'), join(opts2.export_dir, 'options'))
         for service in services:
-            defLine = 'EXPORT_LIST += $(EXPORT_JRE_LIB_GRAAL_SERVICES_DIR)/' + service
+            defLine = 'EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_SERVICES_DIR)/' + service
             if defLine not in defs:
                 mx.abort('Missing following line in ' + defsPath + ' for service from ' + dist.name + '\n' + defLine)
         for optionsFile in optionsFiles:
-            defLine = 'EXPORT_LIST += $(EXPORT_JRE_LIB_GRAAL_OPTIONS_DIR)/' + optionsFile
+            defLine = 'EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_OPTIONS_DIR)/' + optionsFile
             if defLine not in defs:
                 mx.abort('Missing following line in ' + defsPath + ' for options from ' + dist.name + '\n' + defLine)
-        graalOptions = join(_graal_home, 'graal.options')
-        if exists(graalOptions):
-            shutil.copy(graalOptions, opts2.export_dir)
+        jvmciOptions = join(_graal_home, 'jvmci.options')
+        if exists(jvmciOptions):
+            shutil.copy(jvmciOptions, opts2.export_dir)
 
     if not _vmSourcesAvailable or not opts2.native:
         return
@@ -904,8 +926,8 @@
     elif vm.startswith('client'):
         buildSuffix = '1'
     else:
-        assert vm == 'graal', vm
-        buildSuffix = 'graal'
+        assert vm == 'jvmci', vm
+        buildSuffix = 'jvmci'
 
     if _installed_jdks and _installed_jdks != _graal_home:
         if not mx.ask_yes_no("Warning: building while --installed-jdks is set (" + _installed_jdks + ") is not recommanded - are you sure you want to continue", 'n'):
@@ -943,7 +965,7 @@
             mustBuild = False
             timestamp = os.path.getmtime(timestampFile)
             sources = []
-            for d in ['src', 'make', join('graal', 'com.oracle.graal.hotspot', 'src_gen', 'hotspot')]:
+            for d in ['src', 'make', join('graal', 'com.oracle.jvmci.hotspot', 'src_gen', 'hotspot')]:
                 for root, dirnames, files in os.walk(join(_graal_home, d)):
                     # ignore <graal>/src/share/tools
                     if root == join(_graal_home, 'src', 'share'):
@@ -1004,14 +1026,13 @@
             setMakeVar('ALT_BOOTDIR', mx.java().jdk, env=env)
 
             setMakeVar('MAKE_VERBOSE', 'y' if mx._opts.verbose else '')
-            if vm.endswith('nograal'):
-                setMakeVar('INCLUDE_GRAAL', 'false')
-                setMakeVar('ALT_OUTPUTDIR', join(_graal_home, 'build-nograal', mx.get_os()), env=env)
+            if vm.endswith('nojvmci'):
+                setMakeVar('INCLUDE_JVMCI', 'false')
+                setMakeVar('ALT_OUTPUTDIR', join(_graal_home, 'build-nojvmci', mx.get_os()), env=env)
             else:
                 version = graal_version()
-                setMakeVar('USER_RELEASE_SUFFIX', 'graal-' + version)
-                setMakeVar('GRAAL_VERSION', version)
-                setMakeVar('INCLUDE_GRAAL', 'true')
+                setMakeVar('USER_RELEASE_SUFFIX', 'jvmci-' + version)
+                setMakeVar('INCLUDE_JVMCI', 'true')
             setMakeVar('INSTALL', 'y', env=env)
             if mx.get_os() == 'darwin' and platform.mac_ver()[0] != '':
                 # Force use of clang on MacOS
@@ -1103,7 +1124,7 @@
 
     build = vmbuild if vmbuild else _vmbuild if _vmSourcesAvailable else 'product'
     jdk = _jdk(build, vmToCheck=vm, installJars=False)
-    _updateInstalledGraalOptionsFile(jdk)
+    _updateInstalledJVMCIOptionsFile(jdk)
     mx.expand_project_in_args(args)
     if _make_eclipse_launch:
         mx.make_eclipse_launch(args, 'graal-' + build, name=None, deps=mx.project('com.oracle.graal.hotspot').all_deps([], True))
@@ -1111,7 +1132,7 @@
         jacocoagent = mx.library("JACOCOAGENT", True)
         # Exclude all compiler tests and snippets
 
-        includes = ['com.oracle.graal.*']
+        includes = ['com.oracle.graal.*', 'com.oracle.jvmci.*']
         baseExcludes = []
         for p in mx.projects():
             projsetting = getattr(p, 'jacoco', '')
@@ -1291,7 +1312,7 @@
 
 
     def harness(projectsCp, vmArgs):
-        if _get_vm() != 'graal':
+        if _get_vm() != 'jvmci':
             prefixArgs = ['-esa', '-ea']
         else:
             prefixArgs = ['-XX:-BootstrapGraal', '-esa', '-ea']
@@ -1304,13 +1325,13 @@
         # run the VM in a mode where application/test classes can
         # access core Graal classes.
         cp = prefixCp + coreCp + os.pathsep + projectsCp
-        if isGraalEnabled(_get_vm()):
+        if isJVMCIEnabled(_get_vm()):
             excluded = set()
             for jdkDist in _jdkDeployedDists:
                 dist = mx.distribution(jdkDist.name)
                 excluded.update([d.output_dir() for d in dist.sorted_deps()])
             cp = os.pathsep.join([e for e in cp.split(os.pathsep) if e not in excluded])
-            vmArgs = ['-XX:-UseGraalClassLoader'] + vmArgs
+            vmArgs = ['-XX:-UseJVMCIClassLoader'] + vmArgs
 
         # suppress menubar and dock when running on Mac
         vmArgs = ['-Djava.awt.headless=true'] + vmArgs
@@ -1509,8 +1530,8 @@
                     build(check_dists_args)
             if not args.no_check:
                 vmargs = ['-version']
-                if v == 'graal':
-                    vmargs.insert(0, '-XX:-BootstrapGraal')
+                if v == 'jvmci':
+                    vmargs.insert(0, '-XX:-BootstrapJVMCI')
                 vm(vmargs, vm=v, vmbuild=vmbuild)
     allDuration = datetime.timedelta(seconds=time.time() - allStart)
     mx.log('TOTAL TIME:   ' + '[' + str(allDuration) + ']')
@@ -1557,7 +1578,7 @@
     defaultCtwopts = '-Inline'
 
     parser = ArgumentParser(prog='mx ctw')
-    parser.add_argument('--ctwopts', action='store', help='space separated Graal options used for CTW compilations (default: --ctwopts="' + defaultCtwopts + '")', default=defaultCtwopts, metavar='<options>')
+    parser.add_argument('--ctwopts', action='store', help='space separated JVMCI options used for CTW compilations (default: --ctwopts="' + defaultCtwopts + '")', default=defaultCtwopts, metavar='<options>')
     parser.add_argument('--jar', action='store', help='jar of classes to compiled instead of rt.jar', metavar='<path>')
 
     args, vmargs = parser.parse_known_args(args)
@@ -1573,9 +1594,9 @@
 
     vmargs += ['-XX:+CompileTheWorld']
     vm_ = _get_vm()
-    if isGraalEnabled(vm_):
-        if vm_ == 'graal':
-            vmargs += ['-XX:+BootstrapGraal']
+    if isJVMCIEnabled(vm_):
+        if vm_ == 'jvmci':
+            vmargs += ['-XX:+BootstrapJVMCI']
         vmargs += ['-G:CompileTheWorldClasspath=' + jar]
     else:
         vmargs += ['-Xbootclasspath/p:' + jar]
@@ -1586,81 +1607,81 @@
     vm(vmargs)
 
 def _basic_gate_body(args, tasks):
-    # Build server-hosted-graal now so we can run the unit tests
-    with Task('BuildHotSpotGraalHosted: product', tasks) as t:
+    # Build server-hosted-jvmci now so we can run the unit tests
+    with Task('BuildHotSpotJVMCIHosted: product', tasks) as t:
         if t: buildvms(['--vms', 'server', '--builds', 'product', '--check-distributions'])
 
-    # Run unit tests on server-hosted-graal
+    # Run unit tests on server-hosted-jvmci
     with VM('server', 'product'):
         with Task('UnitTests:hosted-product', tasks) as t:
             if t: unittest(['--enable-timing', '--verbose', '--fail-fast'])
 
-    # Run ctw against rt.jar on server-hosted-graal
+    # Run ctw against rt.jar on server-hosted-jvmci
     with VM('server', 'product'):
         with Task('CTW:hosted-product', tasks) as t:
             if t: ctw(['--ctwopts', '-Inline +ExitVMOnException', '-esa', '-G:+CompileTheWorldMultiThreaded', '-G:-CompileTheWorldVerbose'])
 
     # Build the other VM flavors
     with Task('BuildHotSpotGraalOthers: fastdebug,product', tasks) as t:
-        if t: buildvms(['--vms', 'graal,server', '--builds', 'fastdebug,product', '--check-distributions'])
-
-    with VM('graal', 'fastdebug'):
+        if t: buildvms(['--vms', 'jvmci,server', '--builds', 'fastdebug,product', '--check-distributions'])
+
+    with VM('jvmci', 'fastdebug'):
         with Task('BootstrapWithSystemAssertions:fastdebug', tasks) as t:
             if t: vm(['-esa', '-XX:-TieredCompilation', '-version'])
 
-    with VM('graal', 'fastdebug'):
+    with VM('jvmci', 'fastdebug'):
         with Task('BootstrapEconomyWithSystemAssertions:fastdebug', tasks) as t:
             if t: vm(['-esa', '-XX:-TieredCompilation', '-G:CompilerConfiguration=economy', '-version'])
 
-    with VM('graal', 'fastdebug'):
+    with VM('jvmci', 'fastdebug'):
         with Task('BootstrapWithSystemAssertionsNoCoop:fastdebug', tasks) as t:
             if t: vm(['-esa', '-XX:-TieredCompilation', '-XX:-UseCompressedOops', '-version'])
 
-    with VM('graal', 'fastdebug'):
+    with VM('jvmci', 'fastdebug'):
         with Task('BootstrapWithExceptionEdges:fastdebug', tasks) as t:
             if t: vm(['-esa', '-XX:-TieredCompilation', '-G:+StressInvokeWithExceptionNode', '-version'])
 
-    with VM('graal', 'product'):
+    with VM('jvmci', 'product'):
         with Task('BootstrapWithGCVerification:product', tasks) as t:
             if t:
                 out = mx.DuplicateSuppressingStream(['VerifyAfterGC:', 'VerifyBeforeGC:']).write
                 vm(['-XX:-TieredCompilation', '-XX:+UnlockDiagnosticVMOptions', '-XX:+VerifyBeforeGC', '-XX:+VerifyAfterGC', '-version'], out=out)
 
-    with VM('graal', 'product'):
+    with VM('jvmci', 'product'):
         with Task('BootstrapWithG1GCVerification:product', tasks) as t:
             if t:
                 out = mx.DuplicateSuppressingStream(['VerifyAfterGC:', 'VerifyBeforeGC:']).write
                 vm(['-XX:-TieredCompilation', '-XX:+UnlockDiagnosticVMOptions', '-XX:-UseSerialGC', '-XX:+UseG1GC', '-XX:+VerifyBeforeGC', '-XX:+VerifyAfterGC', '-version'], out=out)
 
-    with VM('graal', 'product'):
+    with VM('jvmci', 'product'):
         with Task('BootstrapWithRegisterPressure:product', tasks) as t:
             if t:
                 registers = 'o0,o1,o2,o3,f8,f9,d32,d34' if platform.processor() == 'sparc' else 'rbx,r11,r10,r14,xmm3,xmm11,xmm14'
                 vm(['-XX:-TieredCompilation', '-G:RegisterPressure=' + registers, '-esa', '-version'])
 
-    with VM('graal', 'product'):
+    with VM('jvmci', 'product'):
         with Task('BootstrapSSAWithRegisterPressure:product', tasks) as t:
             if t:
                 registers = 'o0,o1,o2,o3,f8,f9,d32,d34' if platform.processor() == 'sparc' else 'rbx,r11,r10,r14,xmm3,xmm11,xmm14'
                 vm(['-XX:-TieredCompilation', '-G:+SSA_LIR', '-G:RegisterPressure=' + registers, '-esa', '-version'])
 
-    with VM('graal', 'product'):
+    with VM('jvmci', 'product'):
         with Task('BootstrapWithImmutableCode:product', tasks) as t:
             if t: vm(['-XX:-TieredCompilation', '-G:+ImmutableCode', '-G:+VerifyPhases', '-esa', '-version'])
 
     for vmbuild in ['fastdebug', 'product']:
         for test in sanitycheck.getDacapos(level=sanitycheck.SanityCheckLevel.Gate, gateBuildLevel=vmbuild) + sanitycheck.getScalaDacapos(level=sanitycheck.SanityCheckLevel.Gate, gateBuildLevel=vmbuild):
             with Task(str(test) + ':' + vmbuild, tasks) as t:
-                if t and not test.test('graal'):
+                if t and not test.test('jvmci'):
                     t.abort(test.name + ' Failed')
 
     # ensure -Xbatch still works
-    with VM('graal', 'product'):
+    with VM('jvmci', 'product'):
         with Task('DaCapo_pmd:BatchMode:product', tasks) as t:
             if t: dacapo(['-Xbatch', 'pmd'])
 
     # ensure -Xcomp still works
-    with VM('graal', 'product'):
+    with VM('jvmci', 'product'):
         with Task('XCompMode:product', tasks) as t:
             if t: vm(['-Xcomp', '-version'])
 
@@ -1675,13 +1696,13 @@
             buildxml = mx._cygpathU2W(join(_graal_home, 'src', 'share', 'tools', 'IdealGraphVisualizer', 'build.xml'))
             mx.run(['ant', '-f', buildxml, '-q', 'clean', 'build'], env=_igvBuildEnv())
 
-    # Prevent Graal modifications from breaking the standard builds
-    if args.buildNonGraal:
+    # Prevent JVMCI modifications from breaking the standard builds
+    if args.buildNonJVMCI:
         with Task('BuildHotSpotVarieties', tasks) as t:
             if t:
                 buildvms(['--vms', 'client,server', '--builds', 'fastdebug,product'])
                 if mx.get_os() not in ['windows', 'cygwin']:
-                    buildvms(['--vms', 'server-nograal', '--builds', 'product,optimized'])
+                    buildvms(['--vms', 'server-nojvmci', '--builds', 'product,optimized'])
 
         for vmbuild in ['product', 'fastdebug']:
             for theVm in ['client', 'server']:
@@ -1693,7 +1714,7 @@
                         if t: dacapo(['pmd'])
 
                     with Task('UnitTests:' + theVm + ':' + vmbuild, tasks) as t:
-                        if t: unittest(['-XX:CompileCommand=exclude,*::run*', 'graal.api'])
+                        if t: unittest(['-XX:CompileCommand=exclude,*::run*', 'graal.api', 'java.test'])
 
 
 def gate(args, gate_body=_basic_gate_body):
@@ -1706,7 +1727,7 @@
     parser.add_argument('-j', '--omit-java-clean', action='store_false', dest='cleanJava', help='omit cleaning Java native code')
     parser.add_argument('-n', '--omit-native-clean', action='store_false', dest='cleanNative', help='omit cleaning and building native code')
     parser.add_argument('-i', '--omit-ide-clean', action='store_false', dest='cleanIde', help='omit cleaning the ide project files')
-    parser.add_argument('-g', '--only-build-graalvm', action='store_false', dest='buildNonGraal', help='only build the Graal VM')
+    parser.add_argument('-g', '--only-build-jvmci', action='store_false', dest='buildNonJVMCI', help='only build the JVMCI VM')
     parser.add_argument('-t', '--task-filter', help='comma separated list of substrings to select subset of tasks to be run')
     parser.add_argument('--jacocout', help='specify the output directory for jacoco report')
 
@@ -1806,7 +1827,7 @@
         Task.filters = None
 
 def deoptalot(args):
-    """bootstrap a fastdebug Graal VM with DeoptimizeALot and VerifyOops on
+    """bootstrap a fastdebug JVMCI VM with DeoptimizeALot and VerifyOops on
 
     If the first argument is a number, the process will be repeated
     this number of times. All other arguments are passed to the VM."""
@@ -2104,7 +2125,7 @@
                 buildOutput.append(x)
         env = os.environ.copy()
         env['JAVA_HOME'] = _jdk(vmToCheck='server')
-        env['MAVEN_OPTS'] = '-server -XX:-UseGraalClassLoader'
+        env['MAVEN_OPTS'] = '-server -XX:-UseJVMCIClassLoader'
         mx.log("Building benchmarks...")
         cmd = ['mvn']
         if args.settings:
@@ -2130,8 +2151,8 @@
         mx.abort(1)
 
     vmArgs, benchmarksAndJsons = _extract_VM_args(args)
-    if isGraalEnabled(_get_vm()) and  '-XX:-UseGraalClassLoader' not in vmArgs:
-        vmArgs = ['-XX:-UseGraalClassLoader'] + vmArgs
+    if isJVMCIEnabled(_get_vm()) and  '-XX:-UseJVMCIClassLoader' not in vmArgs:
+        vmArgs = ['-XX:-UseJVMCIClassLoader'] + vmArgs
 
     benchmarks = [b for b in benchmarksAndJsons if not b.startswith('{')]
     jmhArgJsons = [b for b in benchmarksAndJsons if b.startswith('{')]
@@ -2335,7 +2356,7 @@
     elif len(args) > 1:
         mx.abort('jacocoreport takes only one argument : an output directory')
 
-    includes = ['com.oracle.graal']
+    includes = ['com.oracle.graal', 'com.oracle.jvmci']
     for p in mx.projects():
         projsetting = getattr(p, 'jacoco', '')
         if projsetting == 'include':
@@ -2367,8 +2388,8 @@
     vmArgs, slArgs = _extract_VM_args(args, useDoubleDash=True)
     vm(vmArgs + ['-cp', mx.classpath("com.oracle.truffle.sl.tools"), "com.oracle.truffle.sl.tools.debug.SLREPLServer"] + slArgs)
 
-def isGraalEnabled(vm):
-    return vm != 'original' and not vm.endswith('nograal')
+def isJVMCIEnabled(vm):
+    return vm != 'original' and not vm.endswith('nojvmci')
 
 def jol(args):
     """Java Object Layout"""
@@ -2437,7 +2458,7 @@
     complt += '\t\t\t(vm | vmg | vmfg | unittest | jmh | dacapo | scaladacapo | specjvm2008 | specjbb2013 | specjbb2005)\n'
     complt += '\t\t\t\tnoglob \\\n'
     complt += '\t\t\t\t\t_arguments -s -S \\\n'
-    complt += _appendOptions("graal", r"G\:")
+    complt += _appendOptions("jvmci", r"G\:")
     # TODO: fix -XX:{-,+}Use* flags
     complt += _appendOptions("hotspot", r"XX\:")
     complt += '\t\t\t\t\t"-version" && ret=0 \n'
@@ -2499,10 +2520,10 @@
         'optDoc' : '<optDoc>',
         }))
 
-    # gather graal options
+    # gather JVMCI options
     output = StringIO.StringIO()
-    vm(['-XX:-BootstrapGraal', '-XX:+UnlockDiagnosticVMOptions', '-G:+PrintFlags' if optionType == "graal" else '-XX:+PrintFlagsWithComments'],
-       vm="graal",
+    vm(['-XX:-BootstrapJVMCI', '-XX:+UnlockDiagnosticVMOptions', '-G:+PrintFlags' if optionType == "jvmci" else '-XX:+PrintFlagsWithComments'],
+       vm="jvmci",
        vmbuild="optimized",
        nonZeroIsFatal=False,
        out=output.write,
--- a/mx/sanitycheck.py	Thu May 28 15:10:18 2015 -0700
+++ b/mx/sanitycheck.py	Thu May 28 21:11:28 2015 -0700
@@ -278,10 +278,10 @@
 
 
     args = ['-XX:+CompileTheWorld', '-Xbootclasspath/p:' + rtjar]
-    if vm == 'graal':
+    if vm == 'jvmci':
         args += ['-XX:+BootstrapGraal']
     if mode >= CTWMode.NoInline:
-        if not mx_graal.isGraalEnabled(vm):
+        if not mx_graal.isJVMCIEnabled(vm):
             args.append('-XX:-Inline')
         else:
             args.append('-G:CompileTheWordConfig=-Inline')
@@ -380,7 +380,7 @@
             parser.addMatcher(scoreMatcher)
 
         if self.benchmarkCompilationRate:
-            if vm == 'graal':
+            if vm == 'jvmci':
                 bps = re.compile(r"ParsedBytecodesPerSecond@final: (?P<rate>[0-9]+)")
                 ibps = re.compile(r"InlinedBytecodesPerSecond@final: (?P<rate>[0-9]+)")
                 parser.addMatcher(ValuesMatcher(bps, {'group' : 'ParsedBytecodesPerSecond', 'name' : self.name, 'score' : '<rate>'}))
--- a/mx/suite.py	Thu May 28 15:10:18 2015 -0700
+++ b/mx/suite.py	Thu May 28 21:11:28 2015 -0700
@@ -81,12 +81,8 @@
     },
 
     "FINDBUGS" : {
-      "path" : "lib/findbugs-3.0.0.jar",
-      "urls" : [
-        "jar:http://lafo.ssw.uni-linz.ac.at/graal-external-deps/findbugs-3.0.0.zip!/findbugs-3.0.0/lib/findbugs.jar",
-        "jar:http://sourceforge.net/projects/findbugs/files/findbugs/3.0.0/findbugs-3.0.0.zip/download!/findbugs-3.0.0/lib/findbugs.jar",
-      ],
-      "sha1" : "e9a938f0cb34e2ab5853f9ecb1989f6f590ee385",
+      "path" : "lib/findbugs-SuppressFBWarnings.jar",
+      "sha1" : "fb78822d27c68fabf2cb2e5e573b3cdb5f9cae2d",
     },
 
     "DACAPO" : {
@@ -157,6 +153,43 @@
   },
 
   "projects" : {
+    "com.oracle.jvmci.common" : {
+      "subDir" : "graal",
+      "sourceDirs" : ["src"],
+      "checkstyle" : "com.oracle.graal.graph",
+      "javaCompliance" : "1.8",
+      "workingSets" : "API,Graal",
+    },
+
+    "com.oracle.jvmci.runtime" : {
+      "subDir" : "graal",
+      "sourceDirs" : ["src"],
+      "dependencies" : [
+        "com.oracle.jvmci.code"
+      ],
+      "checkstyle" : "com.oracle.graal.graph",
+      "javaCompliance" : "1.8",
+      "workingSets" : "API,Graal",
+    },
+
+    "com.oracle.jvmci.hotspot" : {
+      "subDir" : "graal",
+      "sourceDirs" : ["src"],
+      "dependencies" : [
+        "com.oracle.jvmci.hotspotvmconfig",
+        "com.oracle.jvmci.options",
+        "com.oracle.jvmci.debug",
+        "com.oracle.jvmci.common",
+        "FINDBUGS",
+      ],
+      "annotationProcessors" : [
+        "com.oracle.jvmci.hotspotvmconfig.processor",
+      ],
+      "checkstyle" : "com.oracle.graal.graph",
+      "javaCompliance" : "1.8",
+      "workingSets" : "API,Graal",
+    },
+
     "com.oracle.nfi" : {
       "subDir" : "graal",
       "sourceDirs" : ["src"],
@@ -170,7 +203,7 @@
       "sourceDirs" : ["test"],
       "dependencies" : [
         "com.oracle.nfi",
-        "com.oracle.graal.compiler.common",
+        "com.oracle.jvmci.common",
         "JUNIT",
       ],
       "checkstyle" : "com.oracle.graal.graph",
@@ -207,6 +240,9 @@
     "com.oracle.graal.api.runtime" : {
       "subDir" : "graal",
       "sourceDirs" : ["src"],
+      "dependencies" : [
+        "com.oracle.jvmci.runtime",
+      ],
       "checkstyle" : "com.oracle.graal.graph",
       "javaCompliance" : "1.8",
       "workingSets" : "API,Graal",
@@ -224,7 +260,7 @@
       "workingSets" : "API,Graal,Test",
     },
 
-    "com.oracle.graal.api.meta" : {
+    "com.oracle.jvmci.meta" : {
       "subDir" : "graal",
       "sourceDirs" : ["src"],
       "checkstyle" : "com.oracle.graal.graph",
@@ -232,24 +268,10 @@
       "workingSets" : "API,Graal",
     },
 
-    "com.oracle.graal.api.meta.test" : {
+    "com.oracle.jvmci.code" : {
       "subDir" : "graal",
       "sourceDirs" : ["src"],
-      "dependencies" : [
-        "JUNIT",
-        "com.oracle.graal.runtime",
-        "com.oracle.graal.java",
-      ],
-      "checkstyle" : "com.oracle.graal.graph",
-      "javaCompliance" : "1.8",
-      "workingSets" : "API,Graal,Test",
-      "jacoco" : "exclude",
-    },
-
-    "com.oracle.graal.api.code" : {
-      "subDir" : "graal",
-      "sourceDirs" : ["src"],
-      "dependencies" : ["com.oracle.graal.api.meta"],
+      "dependencies" : ["com.oracle.jvmci.meta"],
       "checkstyle" : "com.oracle.graal.graph",
       "javaCompliance" : "1.8",
       "workingSets" : "API,Graal",
@@ -258,16 +280,16 @@
     "com.oracle.graal.api.replacements" : {
       "subDir" : "graal",
       "sourceDirs" : ["src"],
-      "dependencies" : ["com.oracle.graal.api.meta"],
+      "dependencies" : ["com.oracle.jvmci.meta"],
       "checkstyle" : "com.oracle.graal.graph",
       "javaCompliance" : "1.8",
       "workingSets" : "API,Graal,Replacements",
     },
 
-    "com.oracle.graal.service.processor" : {
+    "com.oracle.jvmci.runtime.processor" : {
       "subDir" : "graal",
       "sourceDirs" : ["src"],
-      "dependencies" : ["com.oracle.graal.api.runtime"],
+      "dependencies" : ["com.oracle.jvmci.runtime"],
       "checkstyle" : "com.oracle.graal.graph",
       "javaCompliance" : "1.8",
       "workingSets" : "Codegen,HotSpot",
@@ -276,7 +298,7 @@
     "com.oracle.graal.amd64" : {
       "subDir" : "graal",
       "sourceDirs" : ["src"],
-      "dependencies" : ["com.oracle.graal.api.code"],
+      "dependencies" : ["com.oracle.jvmci.code"],
       "checkstyle" : "com.oracle.graal.graph",
       "javaCompliance" : "1.8",
       "workingSets" : "Graal,AMD64",
@@ -285,13 +307,13 @@
     "com.oracle.graal.sparc" : {
       "subDir" : "graal",
       "sourceDirs" : ["src"],
-      "dependencies" : ["com.oracle.graal.api.code"],
+      "dependencies" : ["com.oracle.jvmci.code"],
       "checkstyle" : "com.oracle.graal.graph",
       "javaCompliance" : "1.8",
       "workingSets" : "Graal,SPARC",
     },
 
-    "com.oracle.graal.hotspotvmconfig" : {
+    "com.oracle.jvmci.hotspotvmconfig" : {
       "subDir" : "graal",
       "sourceDirs" : ["src"],
       "checkstyle" : "com.oracle.graal.graph",
@@ -299,10 +321,10 @@
       "workingSets" : "Graal,HotSpot",
     },
 
-    "com.oracle.graal.hotspotvmconfig.processor" : {
+    "com.oracle.jvmci.hotspotvmconfig.processor" : {
       "subDir" : "graal",
       "sourceDirs" : ["src"],
-      "dependencies" : ["com.oracle.graal.hotspotvmconfig", "com.oracle.graal.compiler.common"],
+      "dependencies" : ["com.oracle.jvmci.hotspotvmconfig", "com.oracle.jvmci.common"],
       "checkstyle" : "com.oracle.graal.graph",
       "javaCompliance" : "1.8",
       "workingSets" : "Graal,HotSpot,Codegen",
@@ -312,22 +334,21 @@
       "subDir" : "graal",
       "sourceDirs" : ["src"],
       "dependencies" : [
+        "com.oracle.jvmci.hotspot",
         "com.oracle.graal.replacements",
+        "com.oracle.graal.printer",
         "com.oracle.graal.runtime",
-        "com.oracle.graal.printer",
-        "com.oracle.graal.hotspotvmconfig",
       ],
       "checkstyle" : "com.oracle.graal.graph",
       "annotationProcessors" : [
         "com.oracle.graal.replacements.verifier",
-        "com.oracle.graal.service.processor",
-        "com.oracle.graal.hotspotvmconfig.processor",
+        "com.oracle.jvmci.runtime.processor",
       ],
       "javaCompliance" : "1.8",
       "workingSets" : "Graal,HotSpot",
     },
 
-    "com.oracle.graal.hotspot.loader" : {
+    "com.oracle.jvmci.hotspot.loader" : {
       "subDir" : "graal",
       "sourceDirs" : ["src"],
       "dependencies" : [],
@@ -344,7 +365,7 @@
         "JFR",
       ],
       "checkstyle" : "com.oracle.graal.graph",
-      "annotationProcessors" : ["com.oracle.graal.service.processor"],
+      "annotationProcessors" : ["com.oracle.jvmci.runtime.processor"],
       "javaCompliance" : "1.8",
       "profile" : "",
       "workingSets" : "Graal,HotSpot",
@@ -359,7 +380,7 @@
         "com.oracle.graal.replacements.amd64",
       ],
       "checkstyle" : "com.oracle.graal.graph",
-      "annotationProcessors" : ["com.oracle.graal.service.processor"],
+      "annotationProcessors" : ["com.oracle.jvmci.runtime.processor"],
       "javaCompliance" : "1.8",
       "workingSets" : "Graal,HotSpot,AMD64",
     },
@@ -372,7 +393,7 @@
         "com.oracle.graal.replacements.sparc",
       ],
       "checkstyle" : "com.oracle.graal.graph",
-      "annotationProcessors" : ["com.oracle.graal.service.processor", "com.oracle.graal.compiler.match.processor"],
+      "annotationProcessors" : ["com.oracle.jvmci.runtime.processor", "com.oracle.graal.compiler.match.processor"],
       "javaCompliance" : "1.8",
       "workingSets" : "Graal,HotSpot,SPARC",
     },
@@ -401,33 +422,33 @@
       "workingSets" : "Graal,HotSpot,AMD64,Test",
     },
 
-    "com.oracle.graal.options" : {
+    "com.oracle.jvmci.options" : {
       "subDir" : "graal",
       "sourceDirs" : ["src"],
       "dependencies" : [
-        "com.oracle.graal.api.runtime",
+        "com.oracle.jvmci.runtime",
       ],
       "checkstyle" : "com.oracle.graal.graph",
       "javaCompliance" : "1.8",
       "workingSets" : "Graal",
     },
 
-    "com.oracle.graal.options.processor" : {
+    "com.oracle.jvmci.options.processor" : {
       "subDir" : "graal",
       "sourceDirs" : ["src"],
       "dependencies" : [
-        "com.oracle.graal.options",
+        "com.oracle.jvmci.options",
       ],
       "checkstyle" : "com.oracle.graal.graph",
       "javaCompliance" : "1.8",
       "workingSets" : "Graal,Codegen",
     },
 
-    "com.oracle.graal.options.test" : {
+    "com.oracle.jvmci.options.test" : {
       "subDir" : "graal",
       "sourceDirs" : ["src"],
       "dependencies" : [
-        "com.oracle.graal.options",
+        "com.oracle.jvmci.options",
         "JUNIT",
       ],
       "checkstyle" : "com.oracle.graal.graph",
@@ -461,6 +482,7 @@
         "com.oracle.graal.nodeinfo",
         "com.oracle.graal.compiler.common",
         "com.oracle.graal.api.collections",
+        "com.oracle.graal.api.runtime",
         "FINDBUGS",
       ],
       "javaCompliance" : "1.8",
@@ -480,7 +502,7 @@
       "workingSets" : "Graal,Graph,Test",
     },
 
-    "com.oracle.graal.debug" : {
+    "com.oracle.jvmci.debug" : {
       "subDir" : "graal",
       "sourceDirs" : ["src"],
       "checkstyle" : "com.oracle.graal.graph",
@@ -488,12 +510,12 @@
       "workingSets" : "Graal,Debug",
     },
 
-    "com.oracle.graal.debug.test" : {
+    "com.oracle.jvmci.debug.test" : {
       "subDir" : "graal",
       "sourceDirs" : ["src"],
       "dependencies" : [
         "JUNIT",
-        "com.oracle.graal.debug",
+        "com.oracle.jvmci.debug",
       ],
       "checkstyle" : "com.oracle.graal.graph",
       "javaCompliance" : "1.8",
@@ -578,7 +600,7 @@
       "javaCompliance" : "1.8",
       "annotationProcessors" : [
         "com.oracle.graal.replacements.verifier",
-        "com.oracle.graal.service.processor",
+        "com.oracle.jvmci.runtime.processor",
       ],
       "workingSets" : "Graal,Replacements",
     },
@@ -592,7 +614,7 @@
           ],
       "checkstyle" : "com.oracle.graal.graph",
       "javaCompliance" : "1.8",
-      "annotationProcessors" : ["com.oracle.graal.service.processor"],
+      "annotationProcessors" : ["com.oracle.jvmci.runtime.processor"],
       "workingSets" : "Graal,Replacements,AMD64",
     },
 
@@ -722,7 +744,7 @@
       ],
       "checkstyle" : "com.oracle.graal.graph",
       "javaCompliance" : "1.8",
-      "annotationProcessors" : ["com.oracle.graal.service.processor"],
+      "annotationProcessors" : ["com.oracle.jvmci.runtime.processor"],
       "workingSets" : "Graal",
     },
 
@@ -808,11 +830,25 @@
         "com.oracle.graal.graphbuilderconf"
       ],
       "checkstyle" : "com.oracle.graal.graph",
-      "annotationProcessors" : ["com.oracle.graal.service.processor"],
+      "annotationProcessors" : ["com.oracle.jvmci.runtime.processor"],
       "javaCompliance" : "1.8",
       "workingSets" : "Graal,Java",
     },
 
+    "com.oracle.graal.java.test" : {
+      "subDir" : "graal",
+      "sourceDirs" : ["src"],
+      "dependencies" : [
+        "JUNIT",
+        "com.oracle.graal.runtime",
+        "com.oracle.graal.java",
+      ],
+      "checkstyle" : "com.oracle.graal.graph",
+      "javaCompliance" : "1.8",
+      "workingSets" : "API,Graal,Test",
+      "jacoco" : "exclude",
+    },
+
     "com.oracle.graal.graphbuilderconf" : {
       "subDir" : "graal",
       "sourceDirs" : ["src"],
@@ -828,11 +864,11 @@
       "subDir" : "graal",
       "sourceDirs" : ["src"],
       "dependencies" : [
-        "com.oracle.graal.api.code",
-        "com.oracle.graal.options",
-        "com.oracle.graal.debug",
+        "com.oracle.jvmci.options",
+        "com.oracle.jvmci.debug",
+        "com.oracle.jvmci.common",
       ],
-      "annotationProcessors" : ["com.oracle.graal.options.processor"],
+      "annotationProcessors" : ["com.oracle.jvmci.options.processor"],
       "checkstyle" : "com.oracle.graal.graph",
       "javaCompliance" : "1.8",
       "workingSets" : "Graal,Java",
@@ -855,7 +891,7 @@
       "sourceDirs" : ["src"],
       "dependencies" : [
         "JUNIT",
-        "com.oracle.graal.debug",
+        "com.oracle.jvmci.debug",
       ],
       "checkstyle" : "com.oracle.graal.graph",
       "javaCompliance" : "1.8",
@@ -893,7 +929,7 @@
     "com.oracle.graal.asm" : {
       "subDir" : "graal",
       "sourceDirs" : ["src"],
-      "dependencies" : ["com.oracle.graal.api.code"],
+      "dependencies" : ["com.oracle.jvmci.code"],
       "checkstyle" : "com.oracle.graal.graph",
       "javaCompliance" : "1.8",
       "workingSets" : "Graal,Assembler",
@@ -1167,7 +1203,7 @@
       ],
       "checkstyle" : "com.oracle.graal.graph",
       "javaCompliance" : "1.8",
-      "annotationProcessors" : ["com.oracle.graal.service.processor"],
+      "annotationProcessors" : ["com.oracle.jvmci.runtime.processor"],
       "workingSets" : "Graal,Truffle",
     },
 
@@ -1180,7 +1216,7 @@
       ],
       "checkstyle" : "com.oracle.graal.graph",
       "javaCompliance" : "1.8",
-      "annotationProcessors" : ["com.oracle.graal.service.processor"],
+      "annotationProcessors" : ["com.oracle.jvmci.runtime.processor"],
       "workingSets" : "Graal,Truffle",
     },
 
@@ -1193,7 +1229,7 @@
       ],
       "checkstyle" : "com.oracle.graal.graph",
       "javaCompliance" : "1.8",
-      "annotationProcessors" : ["com.oracle.graal.service.processor"],
+      "annotationProcessors" : ["com.oracle.jvmci.runtime.processor"],
       "workingSets" : "Graal,Truffle,SPARC",
     }
   },
@@ -1212,11 +1248,11 @@
       "exclude" : ["FINDBUGS"],
     },
 
-    "GRAAL_LOADER" : {
-      "path" : "build/graal-loader.jar",
+    "JVMCI_LOADER" : {
+      "path" : "build/jvmci-loader.jar",
       "subDir" : "graal",
-      "sourcesPath" : "build/graal-loader.src.zip",
-      "dependencies" : ["com.oracle.graal.hotspot.loader"],
+      "sourcesPath" : "build/jvmci-loader.src.zip",
+      "dependencies" : ["com.oracle.jvmci.hotspot.loader"],
     },
 
     "TRUFFLE" : {
--- a/src/cpu/ppc/vm/graalGlobals_ppc.hpp	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 2000, 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.
- *
- */
-
-#ifndef CPU_PPC_VM_GRAALGLOBALS_PPC_HPP
-#define CPU_PPC_VM_GRAALGLOBALS_PPC_HPP
-
-#include "utilities/globalDefinitions.hpp"
-#include "utilities/macros.hpp"
-
-// Sets the default values for platform dependent flags used by the Graal compiler.
-// (see graalGlobals.hpp)
-
-#ifdef COMPILERGRAAL
-#error Unimplemented
-#endif // COMPILERGRAAL
-
-#endif // CPU_PPC_VM_GRAALGLOBALS_PPC_HPP
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/cpu/ppc/vm/jvmciGlobals_ppc.hpp	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2000, 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.
+ *
+ */
+
+#ifndef CPU_PPC_VM_GRAALGLOBALS_PPC_HPP
+#define CPU_PPC_VM_GRAALGLOBALS_PPC_HPP
+
+#include "utilities/globalDefinitions.hpp"
+#include "utilities/macros.hpp"
+
+// Sets the default values for platform dependent flags used by the Graal compiler.
+// (see graalGlobals.hpp)
+
+#ifdef COMPILERGRAAL
+#error Unimplemented
+#endif // COMPILERGRAAL
+
+#endif // CPU_PPC_VM_GRAALGLOBALS_PPC_HPP
--- a/src/cpu/sparc/vm/compiledIC_sparc.cpp	Thu May 28 15:10:18 2015 -0700
+++ b/src/cpu/sparc/vm/compiledIC_sparc.cpp	Thu May 28 21:11:28 2015 -0700
@@ -102,7 +102,7 @@
 
 void CompiledStaticCall::set_to_interpreted(methodHandle callee, address entry) {
   address stub = find_stub();
-#ifdef GRAAL
+#ifdef JVMCI
   if (stub == NULL) {
     set_destination_mt_safe(entry);
     return;
@@ -159,7 +159,7 @@
 
   // Verify stub.
   address stub = find_stub();
-#ifndef GRAAL
+#ifndef JVMCI
   assert(stub != NULL, "no stub found for static call");
   // Creation also verifies the object.
   NativeMovConstReg* method_holder = nativeMovConstReg_at(stub);
--- a/src/cpu/sparc/vm/graalCodeInstaller_sparc.cpp	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,173 +0,0 @@
-/*
- * Copyright (c) 2013, 2015, 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.
- */
-
-#include "graal/graalCodeInstaller.hpp"
-#include "graal/graalRuntime.hpp"
-#include "graal/graalCompilerToVM.hpp"
-#include "graal/graalJavaAccess.hpp"
-#include "vmreg_sparc.inline.hpp"
-
-jint CodeInstaller::pd_next_offset(NativeInstruction* inst, jint pc_offset, oop method) {
-  if (inst->is_call() || inst->is_jump()) {
-    return pc_offset + NativeCall::instruction_size;
-  } else if (inst->is_call_reg()) {
-    return pc_offset + NativeCallReg::instruction_size;
-  } else if (inst->is_sethi()) {
-    return pc_offset + NativeFarCall::instruction_size;
-  } else {
-    fatal("unsupported type of instruction for call site");
-    return 0;
-  }
-}
-
-void CodeInstaller::pd_patch_OopConstant(int pc_offset, Handle& constant) {
-  address pc = _instructions->start() + pc_offset;
-  Handle obj = HotSpotObjectConstantImpl::object(constant);
-  jobject value = JNIHandles::make_local(obj());
-  if (HotSpotObjectConstantImpl::compressed(constant)) {
-#ifdef _LP64
-    int oop_index = _oop_recorder->find_index(value);
-    RelocationHolder rspec = oop_Relocation::spec(oop_index);
-    _instructions->relocate(pc, rspec, 1);
-#else
-    fatal("compressed oop on 32bit");
-#endif
-  } else {
-    NativeMovConstReg* move = nativeMovConstReg_at(pc);
-    move->set_data((intptr_t) value);
-
-    // We need two relocations:  one on the sethi and one on the add.
-    int oop_index = _oop_recorder->find_index(value);
-    RelocationHolder rspec = oop_Relocation::spec(oop_index);
-    _instructions->relocate(pc + NativeMovConstReg::sethi_offset, rspec);
-    _instructions->relocate(pc + NativeMovConstReg::add_offset, rspec);
-  }
-}
-
-void CodeInstaller::pd_patch_DataSectionReference(int pc_offset, int data_offset) {
-  address pc = _instructions->start() + pc_offset;
-  address const_start = _constants->start();
-  address dest = _constants->start() + data_offset;
-
-  _instructions->relocate(pc + NativeMovConstReg::sethi_offset, internal_word_Relocation::spec((address) dest));
-  _instructions->relocate(pc + NativeMovConstReg::add_offset, internal_word_Relocation::spec((address) dest));
-  TRACE_graal_3("relocating at %p with destination at %p (%d)", pc, dest, data_offset);
-}
-
-void CodeInstaller::pd_relocate_CodeBlob(CodeBlob* cb, NativeInstruction* inst) {
-  fatal("CodeInstaller::pd_relocate_CodeBlob - sparc unimp");
-}
-
-void CodeInstaller::pd_relocate_ForeignCall(NativeInstruction* inst, jlong foreign_call_destination) {
-  address pc = (address) inst;
-  if (inst->is_call()) {
-    NativeCall* call = nativeCall_at(pc);
-    call->set_destination((address) foreign_call_destination);
-    _instructions->relocate(call->instruction_address(), runtime_call_Relocation::spec());
-  } else if (inst->is_sethi()) {
-    NativeJump* jump = nativeJump_at(pc);
-    jump->set_jump_destination((address) foreign_call_destination);
-    _instructions->relocate(jump->instruction_address(), runtime_call_Relocation::spec());
-  } else {
-    fatal(err_msg("unknown call or jump instruction at %p", pc));
-  }
-  TRACE_graal_3("relocating (foreign call) at %p", inst);
-}
-
-void CodeInstaller::pd_relocate_JavaMethod(oop hotspot_method, jint pc_offset) {
-#ifdef ASSERT
-  Method* method = NULL;
-  // we need to check, this might also be an unresolved method
-  if (hotspot_method->is_a(HotSpotResolvedJavaMethodImpl::klass())) {
-    method = getMethodFromHotSpotMethod(hotspot_method);
-  }
-#endif
-  switch (_next_call_type) {
-    case INLINE_INVOKE:
-      break;
-    case INVOKEVIRTUAL:
-    case INVOKEINTERFACE: {
-      assert(method == NULL || !method->is_static(), "cannot call static method with invokeinterface");
-      NativeCall* call = nativeCall_at(_instructions->start() + pc_offset);
-      call->set_destination(SharedRuntime::get_resolve_virtual_call_stub());
-      _instructions->relocate(call->instruction_address(), virtual_call_Relocation::spec(_invoke_mark_pc));
-      break;
-    }
-    case INVOKESTATIC: {
-      assert(method == NULL || method->is_static(), "cannot call non-static method with invokestatic");
-      NativeCall* call = nativeCall_at(_instructions->start() + pc_offset);
-      call->set_destination(SharedRuntime::get_resolve_static_call_stub());
-      _instructions->relocate(call->instruction_address(), relocInfo::static_call_type);
-      break;
-    }
-    case INVOKESPECIAL: {
-      assert(method == NULL || !method->is_static(), "cannot call static method with invokespecial");
-      NativeCall* call = nativeCall_at(_instructions->start() + pc_offset);
-      call->set_destination(SharedRuntime::get_resolve_opt_virtual_call_stub());
-      _instructions->relocate(call->instruction_address(), relocInfo::opt_virtual_call_type);
-      break;
-    }
-    default:
-      fatal("invalid _next_call_type value");
-      break;
-  }
-}
-
-void CodeInstaller::pd_relocate_poll(address pc, jint mark) {
-  switch (mark) {
-    case POLL_NEAR:
-      fatal("unimplemented");
-      break;
-    case POLL_FAR:
-      _instructions->relocate(pc, relocInfo::poll_type);
-      break;
-    case POLL_RETURN_NEAR:
-      fatal("unimplemented");
-      break;
-    case POLL_RETURN_FAR:
-      _instructions->relocate(pc, relocInfo::poll_return_type);
-      break;
-    default:
-      fatal("invalid mark value");
-      break;
-  }
-}
-
-// convert Graal register indices (as used in oop maps) to HotSpot registers
-VMReg CodeInstaller::get_hotspot_reg(jint graal_reg) {
-  if (graal_reg < RegisterImpl::number_of_registers) {
-    return as_Register(graal_reg)->as_VMReg();
-  } else {
-    jint floatRegisterNumber = graal_reg - RegisterImpl::number_of_registers;
-    floatRegisterNumber += MAX2(0, floatRegisterNumber-32); // Beginning with f32, only every second register is going to be addressed
-    if (floatRegisterNumber < FloatRegisterImpl::number_of_registers) {
-      return as_FloatRegister(floatRegisterNumber)->as_VMReg();
-    }
-    ShouldNotReachHere();
-    return NULL;
-  }
-}
-
-bool CodeInstaller::is_general_purpose_reg(VMReg hotspotRegister) {
-  return !hotspotRegister->is_FloatRegister();
-}
--- a/src/cpu/sparc/vm/graalGlobals_sparc.hpp	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,65 +0,0 @@
-/*
- * Copyright (c) 2000, 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.
- *
- */
-
-#ifndef CPU_SPARC_VM_GRAALGLOBALS_SPARC_HPP
-#define CPU_SPARC_VM_GRAALGLOBALS_SPARC_HPP
-
-#include "utilities/globalDefinitions.hpp"
-#include "utilities/macros.hpp"
-
-// Sets the default values for platform dependent flags used by the Graal compiler.
-// (see graalGlobals.hpp)
-
-#ifdef COMPILERGRAAL
-define_pd_global(bool, BackgroundCompilation,        true );
-define_pd_global(bool, UseTLAB,                      true );
-define_pd_global(bool, ResizeTLAB,                   true );
-define_pd_global(bool, InlineIntrinsics,             true );
-define_pd_global(bool, PreferInterpreterNativeStubs, false);
-define_pd_global(bool, TieredCompilation,            trueInTiered);
-define_pd_global(intx, BackEdgeThreshold,            100000);
-
-define_pd_global(intx, OnStackReplacePercentage,     933  );
-define_pd_global(intx, FreqInlineSize,               325  );
-define_pd_global(intx, NewSizeThreadIncrease,        4*K  );
-define_pd_global(uintx,MetaspaceSize,                12*M );
-define_pd_global(bool, NeverActAsServerClassMachine, false);
-define_pd_global(uint64_t,MaxRAM,                    128ULL*G);
-define_pd_global(bool, CICompileOSR,                 true );
-define_pd_global(bool, ProfileTraps,                 true );
-define_pd_global(bool, UseOnStackReplacement,        true );
-define_pd_global(intx, CompileThreshold,             10000);
-define_pd_global(intx, InitialCodeCacheSize,         16*M );
-define_pd_global(intx, ReservedCodeCacheSize,        64*M );
-define_pd_global(bool, ProfileInterpreter,           true );
-define_pd_global(intx, CodeCacheExpansionSize,       64*K );
-define_pd_global(uintx,CodeCacheMinBlockLength,      4);
-define_pd_global(uintx, CodeCacheMinimumUseSpace,    400*K);
-define_pd_global(intx, TypeProfileWidth,             8);
-define_pd_global(intx, MethodProfileWidth,           0);
-#endif // COMPILERGRAAL
-
-define_pd_global(intx, MaxVectorSize,                8);
-
-#endif // CPU_SPARC_VM_GRAALGLOBALS_SPARC_HPP
--- a/src/cpu/sparc/vm/interp_masm_sparc.cpp	Thu May 28 15:10:18 2015 -0700
+++ b/src/cpu/sparc/vm/interp_masm_sparc.cpp	Thu May 28 21:11:28 2015 -0700
@@ -1644,7 +1644,7 @@
     bind(skip_receiver_profile);
 
     // The method data pointer needs to be updated to reflect the new target.
-#ifdef GRAAL
+#ifdef JVMCI
     if (MethodProfileWidth == 0) {
       update_mdp_by_constant(in_bytes(VirtualCallData::virtual_call_data_size()));
     }
@@ -1655,7 +1655,7 @@
   }
 }
 
-#ifdef GRAAL
+#ifdef JVMCI
 void InterpreterMacroAssembler::profile_called_method(Register method, Register scratch) {
   assert_different_registers(method, scratch);
   if (ProfileInterpreter && MethodProfileWidth > 0) {
@@ -1681,17 +1681,17 @@
     if (is_virtual_call) {
       increment_mdp_data_at(in_bytes(CounterData::count_offset()), scratch);
     }
-#ifdef GRAAL
+#ifdef JVMCI
     else {
       increment_mdp_data_at(in_bytes(ReceiverTypeData::nonprofiled_receiver_count_offset()), scratch);
     }
 #endif
   } else {
-    bool use_non_profiled_counter = !is_virtual_call || IS_GRAAL_DEFINED;
+    bool use_non_profiled_counter = !is_virtual_call || IS_JVMCI_DEFINED;
     int non_profiled_offset = -1;
     if (use_non_profiled_counter) {
        non_profiled_offset = in_bytes(CounterData::count_offset());
-    #ifdef GRAAL
+    #ifdef JVMCI
       if (!is_virtual_call) {
         non_profiled_offset = in_bytes(ReceiverTypeData::nonprofiled_receiver_count_offset());
       }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/cpu/sparc/vm/jvmciCodeInstaller_sparc.cpp	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,173 @@
+/*
+ * Copyright (c) 2013, 2015, 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.
+ */
+
+#include "jvmci/jvmciCodeInstaller.hpp"
+#include "jvmci/jvmciRuntime.hpp"
+#include "jvmci/jvmciCompilerToVM.hpp"
+#include "jvmci/jvmciJavaAccess.hpp"
+#include "vmreg_sparc.inline.hpp"
+
+jint CodeInstaller::pd_next_offset(NativeInstruction* inst, jint pc_offset, oop method) {
+  if (inst->is_call() || inst->is_jump()) {
+    return pc_offset + NativeCall::instruction_size;
+  } else if (inst->is_call_reg()) {
+    return pc_offset + NativeCallReg::instruction_size;
+  } else if (inst->is_sethi()) {
+    return pc_offset + NativeFarCall::instruction_size;
+  } else {
+    fatal("unsupported type of instruction for call site");
+    return 0;
+  }
+}
+
+void CodeInstaller::pd_patch_OopConstant(int pc_offset, Handle& constant) {
+  address pc = _instructions->start() + pc_offset;
+  Handle obj = HotSpotObjectConstantImpl::object(constant);
+  jobject value = JNIHandles::make_local(obj());
+  if (HotSpotObjectConstantImpl::compressed(constant)) {
+#ifdef _LP64
+    int oop_index = _oop_recorder->find_index(value);
+    RelocationHolder rspec = oop_Relocation::spec(oop_index);
+    _instructions->relocate(pc, rspec, 1);
+#else
+    fatal("compressed oop on 32bit");
+#endif
+  } else {
+    NativeMovConstReg* move = nativeMovConstReg_at(pc);
+    move->set_data((intptr_t) value);
+
+    // We need two relocations:  one on the sethi and one on the add.
+    int oop_index = _oop_recorder->find_index(value);
+    RelocationHolder rspec = oop_Relocation::spec(oop_index);
+    _instructions->relocate(pc + NativeMovConstReg::sethi_offset, rspec);
+    _instructions->relocate(pc + NativeMovConstReg::add_offset, rspec);
+  }
+}
+
+void CodeInstaller::pd_patch_DataSectionReference(int pc_offset, int data_offset) {
+  address pc = _instructions->start() + pc_offset;
+  address const_start = _constants->start();
+  address dest = _constants->start() + data_offset;
+
+  _instructions->relocate(pc + NativeMovConstReg::sethi_offset, internal_word_Relocation::spec((address) dest));
+  _instructions->relocate(pc + NativeMovConstReg::add_offset, internal_word_Relocation::spec((address) dest));
+  TRACE_jvmci_3("relocating at %p with destination at %p (%d)", pc, dest, data_offset);
+}
+
+void CodeInstaller::pd_relocate_CodeBlob(CodeBlob* cb, NativeInstruction* inst) {
+  fatal("CodeInstaller::pd_relocate_CodeBlob - sparc unimp");
+}
+
+void CodeInstaller::pd_relocate_ForeignCall(NativeInstruction* inst, jlong foreign_call_destination) {
+  address pc = (address) inst;
+  if (inst->is_call()) {
+    NativeCall* call = nativeCall_at(pc);
+    call->set_destination((address) foreign_call_destination);
+    _instructions->relocate(call->instruction_address(), runtime_call_Relocation::spec());
+  } else if (inst->is_sethi()) {
+    NativeJump* jump = nativeJump_at(pc);
+    jump->set_jump_destination((address) foreign_call_destination);
+    _instructions->relocate(jump->instruction_address(), runtime_call_Relocation::spec());
+  } else {
+    fatal(err_msg("unknown call or jump instruction at %p", pc));
+  }
+  TRACE_jvmci_3("relocating (foreign call) at %p", inst);
+}
+
+void CodeInstaller::pd_relocate_JavaMethod(oop hotspot_method, jint pc_offset) {
+#ifdef ASSERT
+  Method* method = NULL;
+  // we need to check, this might also be an unresolved method
+  if (hotspot_method->is_a(HotSpotResolvedJavaMethodImpl::klass())) {
+    method = getMethodFromHotSpotMethod(hotspot_method);
+  }
+#endif
+  switch (_next_call_type) {
+    case INLINE_INVOKE:
+      break;
+    case INVOKEVIRTUAL:
+    case INVOKEINTERFACE: {
+      assert(method == NULL || !method->is_static(), "cannot call static method with invokeinterface");
+      NativeCall* call = nativeCall_at(_instructions->start() + pc_offset);
+      call->set_destination(SharedRuntime::get_resolve_virtual_call_stub());
+      _instructions->relocate(call->instruction_address(), virtual_call_Relocation::spec(_invoke_mark_pc));
+      break;
+    }
+    case INVOKESTATIC: {
+      assert(method == NULL || method->is_static(), "cannot call non-static method with invokestatic");
+      NativeCall* call = nativeCall_at(_instructions->start() + pc_offset);
+      call->set_destination(SharedRuntime::get_resolve_static_call_stub());
+      _instructions->relocate(call->instruction_address(), relocInfo::static_call_type);
+      break;
+    }
+    case INVOKESPECIAL: {
+      assert(method == NULL || !method->is_static(), "cannot call static method with invokespecial");
+      NativeCall* call = nativeCall_at(_instructions->start() + pc_offset);
+      call->set_destination(SharedRuntime::get_resolve_opt_virtual_call_stub());
+      _instructions->relocate(call->instruction_address(), relocInfo::opt_virtual_call_type);
+      break;
+    }
+    default:
+      fatal("invalid _next_call_type value");
+      break;
+  }
+}
+
+void CodeInstaller::pd_relocate_poll(address pc, jint mark) {
+  switch (mark) {
+    case POLL_NEAR:
+      fatal("unimplemented");
+      break;
+    case POLL_FAR:
+      _instructions->relocate(pc, relocInfo::poll_type);
+      break;
+    case POLL_RETURN_NEAR:
+      fatal("unimplemented");
+      break;
+    case POLL_RETURN_FAR:
+      _instructions->relocate(pc, relocInfo::poll_return_type);
+      break;
+    default:
+      fatal("invalid mark value");
+      break;
+  }
+}
+
+// convert JVMCI register indices (as used in oop maps) to HotSpot registers
+VMReg CodeInstaller::get_hotspot_reg(jint jvmci_reg) {
+  if (jvmci_reg < RegisterImpl::number_of_registers) {
+    return as_Register(jvmci_reg)->as_VMReg();
+  } else {
+    jint floatRegisterNumber = jvmci_reg - RegisterImpl::number_of_registers;
+    floatRegisterNumber += MAX2(0, floatRegisterNumber-32); // Beginning with f32, only every second register is going to be addressed
+    if (floatRegisterNumber < FloatRegisterImpl::number_of_registers) {
+      return as_FloatRegister(floatRegisterNumber)->as_VMReg();
+    }
+    ShouldNotReachHere();
+    return NULL;
+  }
+}
+
+bool CodeInstaller::is_general_purpose_reg(VMReg hotspotRegister) {
+  return !hotspotRegister->is_FloatRegister();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/cpu/sparc/vm/jvmciGlobals_sparc.hpp	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2000, 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.
+ *
+ */
+
+#ifndef CPU_SPARC_VM_JVMCIGLOBALS_SPARC_HPP
+#define CPU_SPARC_VM_JVMCIGLOBALS_SPARC_HPP
+
+#include "utilities/globalDefinitions.hpp"
+#include "utilities/macros.hpp"
+
+// Sets the default values for platform dependent flags used by the JVMCI compiler.
+// (see jvmciGlobals.hpp)
+
+#ifdef COMPILERJVMCI
+define_pd_global(bool, BackgroundCompilation,        true );
+define_pd_global(bool, UseTLAB,                      true );
+define_pd_global(bool, ResizeTLAB,                   true );
+define_pd_global(bool, InlineIntrinsics,             true );
+define_pd_global(bool, PreferInterpreterNativeStubs, false);
+define_pd_global(bool, TieredCompilation,            trueInTiered);
+define_pd_global(intx, BackEdgeThreshold,            100000);
+
+define_pd_global(intx, OnStackReplacePercentage,     933  );
+define_pd_global(intx, FreqInlineSize,               325  );
+define_pd_global(intx, NewSizeThreadIncrease,        4*K  );
+define_pd_global(uintx,MetaspaceSize,                12*M );
+define_pd_global(bool, NeverActAsServerClassMachine, false);
+define_pd_global(uint64_t,MaxRAM,                    128ULL*G);
+define_pd_global(bool, CICompileOSR,                 true );
+define_pd_global(bool, ProfileTraps,                 true );
+define_pd_global(bool, UseOnStackReplacement,        true );
+define_pd_global(intx, CompileThreshold,             10000);
+define_pd_global(intx, InitialCodeCacheSize,         16*M );
+define_pd_global(intx, ReservedCodeCacheSize,        64*M );
+define_pd_global(bool, ProfileInterpreter,           true );
+define_pd_global(intx, CodeCacheExpansionSize,       64*K );
+define_pd_global(uintx,CodeCacheMinBlockLength,      4);
+define_pd_global(uintx, CodeCacheMinimumUseSpace,    400*K);
+define_pd_global(intx, TypeProfileWidth,             8);
+define_pd_global(intx, MethodProfileWidth,           0);
+#endif // COMPILERJVMCI
+
+define_pd_global(intx, MaxVectorSize,                8);
+
+#endif // CPU_SPARC_VM_JVMCIGLOBALS_SPARC_HPP
--- a/src/cpu/sparc/vm/sharedRuntime_sparc.cpp	Thu May 28 15:10:18 2015 -0700
+++ b/src/cpu/sparc/vm/sharedRuntime_sparc.cpp	Thu May 28 21:11:28 2015 -0700
@@ -43,8 +43,8 @@
 #include "compiler/compileBroker.hpp"
 #include "shark/sharkCompiler.hpp"
 #endif
-#ifdef GRAAL
-#include "graal/graalJavaAccess.hpp"
+#ifdef JVMCI
+#include "jvmci/jvmciJavaAccess.hpp"
 #endif
 
 #define __ masm->
@@ -995,16 +995,16 @@
 
   // Jump to the compiled code just as if compiled code was doing it.
   __ ld_ptr(G5_method, in_bytes(Method::from_compiled_offset()), G3);
-#ifdef GRAAL
+#ifdef JVMCI
   // check if this call should be routed towards a specific entry point
-  __ ld(Address(G2_thread, in_bytes(JavaThread::graal_alternate_call_target_offset())), G1);
+  __ ld(Address(G2_thread, in_bytes(JavaThread::jvmci_alternate_call_target_offset())), G1);
   __ cmp(G0, G1);
   Label no_alternative_target;
   __ br(Assembler::equal, false, Assembler::pn, no_alternative_target);
   __ delayed()->nop();
 
-  __ ld_ptr(G2_thread, in_bytes(JavaThread::graal_alternate_call_target_offset()), G3);
-  __ st(G0, Address(G2_thread, in_bytes(JavaThread::graal_alternate_call_target_offset())));
+  __ ld_ptr(G2_thread, in_bytes(JavaThread::jvmci_alternate_call_target_offset()), G3);
+  __ st(G0, Address(G2_thread, in_bytes(JavaThread::jvmci_alternate_call_target_offset())));
 
   __ bind(no_alternative_target);
 #endif
@@ -3473,8 +3473,8 @@
     pad += StackShadowPages*16 + 32;
   }
 #endif
-#ifdef GRAAL
-  pad += 1000; // Increase the buffer size when compiling for GRAAL
+#ifdef JVMCI
+  pad += 1000; // Increase the buffer size when compiling for JVMCI
 #endif
 #ifdef _LP64
   CodeBuffer buffer("deopt_blob", 2100+pad+1000, 512);
@@ -3543,10 +3543,10 @@
   __ delayed()->mov(Deoptimization::Unpack_deopt, L0deopt_mode);
 
 
-#ifdef GRAAL
-  masm->block_comment("BEGIN GRAAL");
+#ifdef JVMCI
+  masm->block_comment("BEGIN JVMCI");
   int implicit_exception_uncommon_trap_offset = __ offset() - start;
-  __ ld_ptr(G2_thread, in_bytes(JavaThread::graal_implicit_exception_pc_offset()), O7);
+  __ ld_ptr(G2_thread, in_bytes(JavaThread::jvmci_implicit_exception_pc_offset()), O7);
   __ add(O7, -8, O7);
 
   int uncommon_trap_offset = __ offset() - start;
@@ -3575,8 +3575,8 @@
   Label after_fetch_unroll_info_call;
   __ ba(after_fetch_unroll_info_call);
   __ delayed()->nop(); // Delay slot
-  masm->block_comment("END GRAAL");
-#endif // GRAAL
+  masm->block_comment("END JVMCI");
+#endif // JVMCI
 
   int exception_offset = __ offset() - start;
 
@@ -3632,8 +3632,8 @@
   // Reexecute entry, similar to c2 uncommon trap
   //
   int reexecute_offset = __ offset() - start;
-#if defined(COMPILERGRAAL) && !defined(COMPILER1)
-  // Graal does not use this kind of deoptimization
+#if defined(COMPILERJVMCI) && !defined(COMPILER1)
+  // JVMCI does not use this kind of deoptimization
   __ should_not_reach_here();
 #endif
   // No need to update oop_map  as each call to save_live_registers will produce identical oopmap
@@ -3659,7 +3659,7 @@
 
   __ reset_last_Java_frame();
 
-#ifdef GRAAL
+#ifdef JVMCI
   __ bind(after_fetch_unroll_info_call);
 #endif
   // NOTE: we know that only O0/O1 will be reloaded by restore_result_registers
@@ -3727,7 +3727,7 @@
   masm->flush();
   _deopt_blob = DeoptimizationBlob::create(&buffer, oop_maps, 0, exception_offset, reexecute_offset, frame_size_words);
   _deopt_blob->set_unpack_with_exception_in_tls_offset(exception_in_tls_offset);
-#ifdef GRAAL
+#ifdef JVMCI
   _deopt_blob->set_uncommon_trap_offset(uncommon_trap_offset);
   _deopt_blob->set_implicit_exception_uncommon_trap_offset(implicit_exception_uncommon_trap_offset);
 #endif
--- a/src/cpu/sparc/vm/templateInterpreter_sparc.cpp	Thu May 28 15:10:18 2015 -0700
+++ b/src/cpu/sparc/vm/templateInterpreter_sparc.cpp	Thu May 28 21:11:28 2015 -0700
@@ -203,7 +203,7 @@
 address InterpreterGenerator::generate_deopt_entry_for(TosState state, int step) {
   address entry = __ pc();
   __ get_constant_pool_cache(LcpoolCache); // load LcpoolCache
-#ifdef GRAAL
+#ifdef JVMCI
   // Check if we need to take lock at entry of synchronized method.
   {
     Label L;
--- a/src/cpu/sparc/vm/templateTable_sparc.cpp	Thu May 28 15:10:18 2015 -0700
+++ b/src/cpu/sparc/vm/templateTable_sparc.cpp	Thu May 28 21:11:28 2015 -0700
@@ -2949,7 +2949,7 @@
   // get target Method* & entry point
   __ lookup_virtual_method(Rrecv, Rindex, G5_method);
   __ profile_arguments_type(G5_method, Rcall, Gargs, true);
-#ifdef GRAAL
+#ifdef JVMCI
   __ profile_called_method(G5_method, Rtemp);
 #endif
   __ call_from_interpreter(Rcall, Gargs, Rret);
@@ -3206,7 +3206,7 @@
   assert_different_registers(Rcall, G5_method, Gargs, Rret);
 
   __ profile_arguments_type(G5_method, Rcall, Gargs, true);
-#ifdef GRAAL
+#ifdef JVMCI
   __ profile_called_method(G5_method, Rscratch);
 #endif
   __ call_from_interpreter(Rcall, Gargs, Rret);
--- a/src/cpu/x86/vm/c2_globals_x86.hpp	Thu May 28 15:10:18 2015 -0700
+++ b/src/cpu/x86/vm/c2_globals_x86.hpp	Thu May 28 21:11:28 2015 -0700
@@ -86,7 +86,7 @@
 define_pd_global(bool, OptoScheduling,               false);
 define_pd_global(bool, OptoBundling,                 false);
 
-#ifdef GRAAL
+#ifdef JVMCI
 define_pd_global(intx, ReservedCodeCacheSize,        64*M);
 #else
 define_pd_global(intx, ReservedCodeCacheSize,        48*M);
--- a/src/cpu/x86/vm/frame_x86.cpp	Thu May 28 15:10:18 2015 -0700
+++ b/src/cpu/x86/vm/frame_x86.cpp	Thu May 28 21:11:28 2015 -0700
@@ -460,11 +460,11 @@
   // This is the sp before any possible extension (adapter/locals).
   intptr_t* unextended_sp = interpreter_frame_sender_sp();
 
-#if defined(COMPILER2) || defined(GRAAL)
+#if defined(COMPILER2) || defined(JVMCI)
   if (map->update_map()) {
     update_map_with_saved_link(map, (intptr_t**) addr_at(link_offset));
   }
-#endif // COMPILER2 || GRAAL
+#endif // COMPILER2 || JVMCI
 
   return frame(sender_sp, unextended_sp, link(), sender_pc());
 }
--- a/src/cpu/x86/vm/globals_x86.hpp	Thu May 28 15:10:18 2015 -0700
+++ b/src/cpu/x86/vm/globals_x86.hpp	Thu May 28 21:11:28 2015 -0700
@@ -47,7 +47,7 @@
 // the the vep is aligned at CodeEntryAlignment whereas c2 only aligns
 // the uep and the vep doesn't get real alignment but just slops on by
 // only assured that the entry instruction meets the 5 byte size requirement.
-#if defined(COMPILER2) || defined(GRAAL)
+#if defined(COMPILER2) || defined(JVMCI)
 define_pd_global(intx, CodeEntryAlignment,       32);
 #else
 define_pd_global(intx, CodeEntryAlignment,       16);
@@ -80,8 +80,8 @@
 // GC Ergo Flags
 define_pd_global(uintx, CMSYoungGenPerWorker, 64*M);  // default max size of CMS young gen, per GC worker thread
 
-// Disabled in GRAAL until HotSpotMethodData is updated to be aware of the new profiling tags
-define_pd_global(uintx, TypeProfileLevel, GRAAL_ONLY(0) NOT_GRAAL(111));
+// Disabled in JVMCI until HotSpotMethodData is updated to be aware of the new profiling tags
+define_pd_global(uintx, TypeProfileLevel, JVMCI_ONLY(0) NOT_JVMCI(111));
 
 #define ARCH_FLAGS(develop, product, diagnostic, experimental, notproduct) \
                                                                             \
--- a/src/cpu/x86/vm/graalCodeInstaller_x86.cpp	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,237 +0,0 @@
-/*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-#include "precompiled.hpp"
-#include "compiler/disassembler.hpp"
-#include "runtime/javaCalls.hpp"
-#include "graal/graalEnv.hpp"
-#include "graal/graalCodeInstaller.hpp"
-#include "graal/graalJavaAccess.hpp"
-#include "graal/graalCompilerToVM.hpp"
-#include "graal/graalRuntime.hpp"
-#include "asm/register.hpp"
-#include "classfile/vmSymbols.hpp"
-#include "code/vmreg.hpp"
-#include "vmreg_x86.inline.hpp"
-
-jint CodeInstaller::pd_next_offset(NativeInstruction* inst, jint pc_offset, oop method) {
-  if (inst->is_call() || inst->is_jump()) {
-    assert(NativeCall::instruction_size == (int)NativeJump::instruction_size, "unexpected size");
-    return (pc_offset + NativeCall::instruction_size);
-  } else if (inst->is_mov_literal64()) {
-    // mov+call instruction pair
-    jint offset = pc_offset + NativeMovConstReg::instruction_size;
-    u_char* call = (u_char*) (_instructions->start() + offset);
-    if (call[0] == Assembler::REX_B) {
-      offset += 1; /* prefix byte for extended register R8-R15 */
-      call++;
-    }
-    assert(call[0] == 0xFF, "expected call");
-    offset += 2; /* opcode byte + modrm byte */
-    return (offset);
-  } else if (inst->is_call_reg()) {
-    // the inlined vtable stub contains a "call register" instruction
-    assert(method != NULL, "only valid for virtual calls");
-    return (pc_offset + ((NativeCallReg *) inst)->next_instruction_offset());
-  } else if (inst->is_cond_jump()) {
-    address pc = (address) (inst);
-    return pc_offset + (jint) (Assembler::locate_next_instruction(pc) - pc);
-  } else {
-    fatal("unsupported type of instruction for call site");
-    return 0;
-  }
-}
-
-void CodeInstaller::pd_patch_OopConstant(int pc_offset, Handle& constant) {
-  address pc = _instructions->start() + pc_offset;
-  Handle obj = HotSpotObjectConstantImpl::object(constant);
-  jobject value = JNIHandles::make_local(obj());
-  if (HotSpotObjectConstantImpl::compressed(constant)) {
-#ifdef _LP64
-    address operand = Assembler::locate_operand(pc, Assembler::narrow_oop_operand);
-    int oop_index = _oop_recorder->find_index(value);
-    _instructions->relocate(pc, oop_Relocation::spec(oop_index), Assembler::narrow_oop_operand);
-    TRACE_graal_3("relocating (narrow oop constant) at %p/%p", pc, operand);
-#else
-    fatal("compressed oop on 32bit");
-#endif
-  } else {
-    address operand = Assembler::locate_operand(pc, Assembler::imm_operand);
-    *((jobject*) operand) = value;
-    _instructions->relocate(pc, oop_Relocation::spec_for_immediate(), Assembler::imm_operand);
-    TRACE_graal_3("relocating (oop constant) at %p/%p", pc, operand);
-  }
-}
-
-void CodeInstaller::pd_patch_DataSectionReference(int pc_offset, int data_offset) {
-  address pc = _instructions->start() + pc_offset;
-
-  address operand = Assembler::locate_operand(pc, Assembler::disp32_operand);
-  address next_instruction = Assembler::locate_next_instruction(pc);
-  address dest = _constants->start() + data_offset;
-
-  long disp = dest - next_instruction;
-  assert(disp == (jint) disp, "disp doesn't fit in 32 bits");
-  *((jint*) operand) = (jint) disp;
-
-  _instructions->relocate(pc, section_word_Relocation::spec((address) dest, CodeBuffer::SECT_CONSTS), Assembler::disp32_operand);
-  TRACE_graal_3("relocating at %p/%p with destination at %p (%d)", pc, operand, dest, data_offset);
-}
-
-void CodeInstaller::pd_relocate_CodeBlob(CodeBlob* cb, NativeInstruction* inst) {
-  if (cb->is_nmethod()) {
-    nmethod* nm = (nmethod*) cb;
-    nativeJump_at((address)inst)->set_jump_destination(nm->verified_entry_point());
-  } else {
-    nativeJump_at((address)inst)->set_jump_destination(cb->code_begin());
-  }
-  _instructions->relocate((address)inst, runtime_call_Relocation::spec(), Assembler::call32_operand);
-}
-
-void CodeInstaller::pd_relocate_ForeignCall(NativeInstruction* inst, jlong foreign_call_destination) {
-  address pc = (address) inst;
-  if (inst->is_call()) {
-    // NOTE: for call without a mov, the offset must fit a 32-bit immediate
-    //       see also CompilerToVM.getMaxCallTargetOffset()
-    NativeCall* call = nativeCall_at(pc);
-    call->set_destination((address) foreign_call_destination);
-    _instructions->relocate(call->instruction_address(), runtime_call_Relocation::spec(), Assembler::call32_operand);
-  } else if (inst->is_mov_literal64()) {
-    NativeMovConstReg* mov = nativeMovConstReg_at(pc);
-    mov->set_data((intptr_t) foreign_call_destination);
-    _instructions->relocate(mov->instruction_address(), runtime_call_Relocation::spec(), Assembler::imm_operand);
-  } else if (inst->is_jump()) {
-    NativeJump* jump = nativeJump_at(pc);
-    jump->set_jump_destination((address) foreign_call_destination);
-    _instructions->relocate(jump->instruction_address(), runtime_call_Relocation::spec(), Assembler::call32_operand);
-  } else if (inst->is_cond_jump()) {
-    address old_dest = nativeGeneralJump_at(pc)->jump_destination();
-    address disp = Assembler::locate_operand(pc, Assembler::call32_operand);
-    *(jint*) disp += ((address) foreign_call_destination) - old_dest;
-    _instructions->relocate(pc, runtime_call_Relocation::spec(), Assembler::call32_operand);
-  } else {
-    fatal("unsupported relocation for foreign call");
-  }
-
-  TRACE_graal_3("relocating (foreign call)  at %p", inst);
-}
-
-void CodeInstaller::pd_relocate_JavaMethod(oop hotspot_method, jint pc_offset) {
-#ifdef ASSERT
-  Method* method = NULL;
-  // we need to check, this might also be an unresolved method
-  if (hotspot_method->is_a(HotSpotResolvedJavaMethodImpl::klass())) {
-    method = getMethodFromHotSpotMethod(hotspot_method);
-  }
-#endif
-  switch (_next_call_type) {
-    case INLINE_INVOKE:
-      break;
-    case INVOKEVIRTUAL:
-    case INVOKEINTERFACE: {
-      assert(method == NULL || !method->is_static(), "cannot call static method with invokeinterface");
-
-      NativeCall* call = nativeCall_at(_instructions->start() + pc_offset);
-      call->set_destination(SharedRuntime::get_resolve_virtual_call_stub());
-      _instructions->relocate(call->instruction_address(),
-                                             virtual_call_Relocation::spec(_invoke_mark_pc),
-                                             Assembler::call32_operand);
-      break;
-    }
-    case INVOKESTATIC: {
-      assert(method == NULL || method->is_static(), "cannot call non-static method with invokestatic");
-
-      NativeCall* call = nativeCall_at(_instructions->start() + pc_offset);
-      call->set_destination(SharedRuntime::get_resolve_static_call_stub());
-      _instructions->relocate(call->instruction_address(),
-                                             relocInfo::static_call_type, Assembler::call32_operand);
-      break;
-    }
-    case INVOKESPECIAL: {
-      assert(method == NULL || !method->is_static(), "cannot call static method with invokespecial");
-      NativeCall* call = nativeCall_at(_instructions->start() + pc_offset);
-      call->set_destination(SharedRuntime::get_resolve_opt_virtual_call_stub());
-      _instructions->relocate(call->instruction_address(),
-                              relocInfo::opt_virtual_call_type, Assembler::call32_operand);
-      break;
-    }
-    default:
-      break;
-  }
-}
-
-static void relocate_poll_near(address pc) {
-  NativeInstruction* ni = nativeInstruction_at(pc);
-  int32_t* disp = (int32_t*) Assembler::locate_operand(pc, Assembler::disp32_operand);
-  int32_t offset = *disp; // The Java code installed the polling page offset into the disp32 operand
-  intptr_t new_disp = (intptr_t) (os::get_polling_page() + offset) - (intptr_t) ni;
-  *disp = (int32_t)new_disp;
-}
-
-
-void CodeInstaller::pd_relocate_poll(address pc, jint mark) {
-  switch (mark) {
-    case POLL_NEAR: {
-      relocate_poll_near(pc);
-      _instructions->relocate(pc, relocInfo::poll_type, Assembler::disp32_operand);
-      break;
-    }
-    case POLL_FAR:
-      // This is a load from a register so there is no relocatable operand.
-      // We just have to ensure that the format is not disp32_operand
-      // so that poll_Relocation::fix_relocation_after_move does the right
-      // thing (i.e. ignores this relocation record)
-      _instructions->relocate(pc, relocInfo::poll_type, Assembler::imm_operand);
-      break;
-    case POLL_RETURN_NEAR: {
-      relocate_poll_near(pc);
-      _instructions->relocate(pc, relocInfo::poll_return_type, Assembler::disp32_operand);
-      break;
-    }
-    case POLL_RETURN_FAR:
-      // see comment above for POLL_FAR
-      _instructions->relocate(pc, relocInfo::poll_return_type, Assembler::imm_operand);
-      break;
-    default:
-      fatal("invalid mark value");
-      break;
-  }
-}
-
-// convert Graal register indices (as used in oop maps) to HotSpot registers
-VMReg CodeInstaller::get_hotspot_reg(jint graal_reg) {
-  if (graal_reg < RegisterImpl::number_of_registers) {
-    return as_Register(graal_reg)->as_VMReg();
-  } else {
-    jint floatRegisterNumber = graal_reg - RegisterImpl::number_of_registers;
-    if (floatRegisterNumber < XMMRegisterImpl::number_of_registers) {
-      return as_XMMRegister(floatRegisterNumber)->as_VMReg();
-    }
-    ShouldNotReachHere();
-    return NULL;
-  }
-}
-
-bool CodeInstaller::is_general_purpose_reg(VMReg hotspotRegister) {
-  return !(hotspotRegister->is_FloatRegister() || hotspotRegister->is_XMMRegister());
-}
--- a/src/cpu/x86/vm/graalGlobals_x86.hpp	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,65 +0,0 @@
-/*
- * Copyright (c) 2000, 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.
- *
- */
-
-#ifndef CPU_X86_VM_GRAALGLOBALS_X86_HPP
-#define CPU_X86_VM_GRAALGLOBALS_X86_HPP
-
-#include "utilities/globalDefinitions.hpp"
-#include "utilities/macros.hpp"
-
-// Sets the default values for platform dependent flags used by the Graal compiler.
-// (see graalGlobals.hpp)
-
-#ifdef COMPILERGRAAL
-define_pd_global(bool, BackgroundCompilation,        true );
-define_pd_global(bool, UseTLAB,                      true );
-define_pd_global(bool, ResizeTLAB,                   true );
-define_pd_global(bool, InlineIntrinsics,             true );
-define_pd_global(bool, PreferInterpreterNativeStubs, false);
-define_pd_global(bool, TieredCompilation,            trueInTiered);
-define_pd_global(intx, BackEdgeThreshold,            100000);
-
-define_pd_global(intx, OnStackReplacePercentage,     933  );
-define_pd_global(intx, FreqInlineSize,               325  );
-define_pd_global(intx, NewSizeThreadIncrease,        4*K  );
-define_pd_global(uintx,MetaspaceSize,                12*M );
-define_pd_global(bool, NeverActAsServerClassMachine, false);
-define_pd_global(uint64_t,MaxRAM,                    128ULL*G);
-define_pd_global(bool, CICompileOSR,                 true );
-define_pd_global(bool, ProfileTraps,                 true );
-define_pd_global(bool, UseOnStackReplacement,        true );
-define_pd_global(intx, CompileThreshold,             10000);
-define_pd_global(intx, InitialCodeCacheSize,         16*M );
-define_pd_global(intx, ReservedCodeCacheSize,        64*M );
-define_pd_global(bool, ProfileInterpreter,           true );
-define_pd_global(intx, CodeCacheExpansionSize,       64*K );
-define_pd_global(uintx,CodeCacheMinBlockLength,      4);
-define_pd_global(uintx, CodeCacheMinimumUseSpace,    400*K);
-define_pd_global(intx, TypeProfileWidth,             8);
-define_pd_global(intx, MethodProfileWidth,           0);
-#endif // COMPILERGRAAL
-
-define_pd_global(intx, MaxVectorSize,                32);
-
-#endif // CPU_X86_VM_GRAALGLOBALS_X86_HPP
--- a/src/cpu/x86/vm/interp_masm_x86_64.cpp	Thu May 28 15:10:18 2015 -0700
+++ b/src/cpu/x86/vm/interp_masm_x86_64.cpp	Thu May 28 21:11:28 2015 -0700
@@ -1129,7 +1129,7 @@
     bind(skip_receiver_profile);
 
     // The method data pointer needs to be updated to reflect the new target.
-#ifdef GRAAL
+#ifdef JVMCI
     if (MethodProfileWidth == 0) {
       update_mdp_by_constant(mdp, in_bytes(VirtualCallData::virtual_call_data_size()));
     }
@@ -1140,7 +1140,7 @@
   }
 }
 
-#ifdef GRAAL
+#ifdef JVMCI
 void InterpreterMacroAssembler::profile_called_method(Register method, Register mdp, Register reg2) {
   assert_different_registers(method, mdp, reg2);
   if (ProfileInterpreter && MethodProfileWidth > 0) {
@@ -1178,17 +1178,17 @@
     if (is_virtual_call) {
       increment_mdp_data_at(mdp, in_bytes(CounterData::count_offset()));
     }
-#ifdef GRAAL
+#ifdef JVMCI
     else {
       increment_mdp_data_at(mdp, in_bytes(ReceiverTypeData::nonprofiled_receiver_count_offset()));
     }
 #endif
   } else {                                      
-    bool use_non_profiled_counter = !is_virtual_call || IS_GRAAL_DEFINED;
+    bool use_non_profiled_counter = !is_virtual_call || IS_JVMCI_DEFINED;
     int non_profiled_offset = -1;
     if (use_non_profiled_counter) {
        non_profiled_offset = in_bytes(CounterData::count_offset());
-    #ifdef GRAAL
+    #ifdef JVMCI
       if (!is_virtual_call) {
         non_profiled_offset = in_bytes(ReceiverTypeData::nonprofiled_receiver_count_offset());
       }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/cpu/x86/vm/jvmciCodeInstaller_x86.cpp	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,237 @@
+/*
+ * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+#include "precompiled.hpp"
+#include "compiler/disassembler.hpp"
+#include "runtime/javaCalls.hpp"
+#include "jvmci/jvmciEnv.hpp"
+#include "jvmci/jvmciCodeInstaller.hpp"
+#include "jvmci/jvmciJavaAccess.hpp"
+#include "jvmci/jvmciCompilerToVM.hpp"
+#include "jvmci/jvmciRuntime.hpp"
+#include "asm/register.hpp"
+#include "classfile/vmSymbols.hpp"
+#include "code/vmreg.hpp"
+#include "vmreg_x86.inline.hpp"
+
+jint CodeInstaller::pd_next_offset(NativeInstruction* inst, jint pc_offset, oop method) {
+  if (inst->is_call() || inst->is_jump()) {
+    assert(NativeCall::instruction_size == (int)NativeJump::instruction_size, "unexpected size");
+    return (pc_offset + NativeCall::instruction_size);
+  } else if (inst->is_mov_literal64()) {
+    // mov+call instruction pair
+    jint offset = pc_offset + NativeMovConstReg::instruction_size;
+    u_char* call = (u_char*) (_instructions->start() + offset);
+    if (call[0] == Assembler::REX_B) {
+      offset += 1; /* prefix byte for extended register R8-R15 */
+      call++;
+    }
+    assert(call[0] == 0xFF, "expected call");
+    offset += 2; /* opcode byte + modrm byte */
+    return (offset);
+  } else if (inst->is_call_reg()) {
+    // the inlined vtable stub contains a "call register" instruction
+    assert(method != NULL, "only valid for virtual calls");
+    return (pc_offset + ((NativeCallReg *) inst)->next_instruction_offset());
+  } else if (inst->is_cond_jump()) {
+    address pc = (address) (inst);
+    return pc_offset + (jint) (Assembler::locate_next_instruction(pc) - pc);
+  } else {
+    fatal("unsupported type of instruction for call site");
+    return 0;
+  }
+}
+
+void CodeInstaller::pd_patch_OopConstant(int pc_offset, Handle& constant) {
+  address pc = _instructions->start() + pc_offset;
+  Handle obj = HotSpotObjectConstantImpl::object(constant);
+  jobject value = JNIHandles::make_local(obj());
+  if (HotSpotObjectConstantImpl::compressed(constant)) {
+#ifdef _LP64
+    address operand = Assembler::locate_operand(pc, Assembler::narrow_oop_operand);
+    int oop_index = _oop_recorder->find_index(value);
+    _instructions->relocate(pc, oop_Relocation::spec(oop_index), Assembler::narrow_oop_operand);
+    TRACE_jvmci_3("relocating (narrow oop constant) at %p/%p", pc, operand);
+#else
+    fatal("compressed oop on 32bit");
+#endif
+  } else {
+    address operand = Assembler::locate_operand(pc, Assembler::imm_operand);
+    *((jobject*) operand) = value;
+    _instructions->relocate(pc, oop_Relocation::spec_for_immediate(), Assembler::imm_operand);
+    TRACE_jvmci_3("relocating (oop constant) at %p/%p", pc, operand);
+  }
+}
+
+void CodeInstaller::pd_patch_DataSectionReference(int pc_offset, int data_offset) {
+  address pc = _instructions->start() + pc_offset;
+
+  address operand = Assembler::locate_operand(pc, Assembler::disp32_operand);
+  address next_instruction = Assembler::locate_next_instruction(pc);
+  address dest = _constants->start() + data_offset;
+
+  long disp = dest - next_instruction;
+  assert(disp == (jint) disp, "disp doesn't fit in 32 bits");
+  *((jint*) operand) = (jint) disp;
+
+  _instructions->relocate(pc, section_word_Relocation::spec((address) dest, CodeBuffer::SECT_CONSTS), Assembler::disp32_operand);
+  TRACE_jvmci_3("relocating at %p/%p with destination at %p (%d)", pc, operand, dest, data_offset);
+}
+
+void CodeInstaller::pd_relocate_CodeBlob(CodeBlob* cb, NativeInstruction* inst) {
+  if (cb->is_nmethod()) {
+    nmethod* nm = (nmethod*) cb;
+    nativeJump_at((address)inst)->set_jump_destination(nm->verified_entry_point());
+  } else {
+    nativeJump_at((address)inst)->set_jump_destination(cb->code_begin());
+  }
+  _instructions->relocate((address)inst, runtime_call_Relocation::spec(), Assembler::call32_operand);
+}
+
+void CodeInstaller::pd_relocate_ForeignCall(NativeInstruction* inst, jlong foreign_call_destination) {
+  address pc = (address) inst;
+  if (inst->is_call()) {
+    // NOTE: for call without a mov, the offset must fit a 32-bit immediate
+    //       see also CompilerToVM.getMaxCallTargetOffset()
+    NativeCall* call = nativeCall_at(pc);
+    call->set_destination((address) foreign_call_destination);
+    _instructions->relocate(call->instruction_address(), runtime_call_Relocation::spec(), Assembler::call32_operand);
+  } else if (inst->is_mov_literal64()) {
+    NativeMovConstReg* mov = nativeMovConstReg_at(pc);
+    mov->set_data((intptr_t) foreign_call_destination);
+    _instructions->relocate(mov->instruction_address(), runtime_call_Relocation::spec(), Assembler::imm_operand);
+  } else if (inst->is_jump()) {
+    NativeJump* jump = nativeJump_at(pc);
+    jump->set_jump_destination((address) foreign_call_destination);
+    _instructions->relocate(jump->instruction_address(), runtime_call_Relocation::spec(), Assembler::call32_operand);
+  } else if (inst->is_cond_jump()) {
+    address old_dest = nativeGeneralJump_at(pc)->jump_destination();
+    address disp = Assembler::locate_operand(pc, Assembler::call32_operand);
+    *(jint*) disp += ((address) foreign_call_destination) - old_dest;
+    _instructions->relocate(pc, runtime_call_Relocation::spec(), Assembler::call32_operand);
+  } else {
+    fatal("unsupported relocation for foreign call");
+  }
+
+  TRACE_jvmci_3("relocating (foreign call)  at %p", inst);
+}
+
+void CodeInstaller::pd_relocate_JavaMethod(oop hotspot_method, jint pc_offset) {
+#ifdef ASSERT
+  Method* method = NULL;
+  // we need to check, this might also be an unresolved method
+  if (hotspot_method->is_a(HotSpotResolvedJavaMethodImpl::klass())) {
+    method = getMethodFromHotSpotMethod(hotspot_method);
+  }
+#endif
+  switch (_next_call_type) {
+    case INLINE_INVOKE:
+      break;
+    case INVOKEVIRTUAL:
+    case INVOKEINTERFACE: {
+      assert(method == NULL || !method->is_static(), "cannot call static method with invokeinterface");
+
+      NativeCall* call = nativeCall_at(_instructions->start() + pc_offset);
+      call->set_destination(SharedRuntime::get_resolve_virtual_call_stub());
+      _instructions->relocate(call->instruction_address(),
+                                             virtual_call_Relocation::spec(_invoke_mark_pc),
+                                             Assembler::call32_operand);
+      break;
+    }
+    case INVOKESTATIC: {
+      assert(method == NULL || method->is_static(), "cannot call non-static method with invokestatic");
+
+      NativeCall* call = nativeCall_at(_instructions->start() + pc_offset);
+      call->set_destination(SharedRuntime::get_resolve_static_call_stub());
+      _instructions->relocate(call->instruction_address(),
+                                             relocInfo::static_call_type, Assembler::call32_operand);
+      break;
+    }
+    case INVOKESPECIAL: {
+      assert(method == NULL || !method->is_static(), "cannot call static method with invokespecial");
+      NativeCall* call = nativeCall_at(_instructions->start() + pc_offset);
+      call->set_destination(SharedRuntime::get_resolve_opt_virtual_call_stub());
+      _instructions->relocate(call->instruction_address(),
+                              relocInfo::opt_virtual_call_type, Assembler::call32_operand);
+      break;
+    }
+    default:
+      break;
+  }
+}
+
+static void relocate_poll_near(address pc) {
+  NativeInstruction* ni = nativeInstruction_at(pc);
+  int32_t* disp = (int32_t*) Assembler::locate_operand(pc, Assembler::disp32_operand);
+  int32_t offset = *disp; // The Java code installed the polling page offset into the disp32 operand
+  intptr_t new_disp = (intptr_t) (os::get_polling_page() + offset) - (intptr_t) ni;
+  *disp = (int32_t)new_disp;
+}
+
+
+void CodeInstaller::pd_relocate_poll(address pc, jint mark) {
+  switch (mark) {
+    case POLL_NEAR: {
+      relocate_poll_near(pc);
+      _instructions->relocate(pc, relocInfo::poll_type, Assembler::disp32_operand);
+      break;
+    }
+    case POLL_FAR:
+      // This is a load from a register so there is no relocatable operand.
+      // We just have to ensure that the format is not disp32_operand
+      // so that poll_Relocation::fix_relocation_after_move does the right
+      // thing (i.e. ignores this relocation record)
+      _instructions->relocate(pc, relocInfo::poll_type, Assembler::imm_operand);
+      break;
+    case POLL_RETURN_NEAR: {
+      relocate_poll_near(pc);
+      _instructions->relocate(pc, relocInfo::poll_return_type, Assembler::disp32_operand);
+      break;
+    }
+    case POLL_RETURN_FAR:
+      // see comment above for POLL_FAR
+      _instructions->relocate(pc, relocInfo::poll_return_type, Assembler::imm_operand);
+      break;
+    default:
+      fatal("invalid mark value");
+      break;
+  }
+}
+
+// convert JVMCI register indices (as used in oop maps) to HotSpot registers
+VMReg CodeInstaller::get_hotspot_reg(jint jvmci_reg) {
+  if (jvmci_reg < RegisterImpl::number_of_registers) {
+    return as_Register(jvmci_reg)->as_VMReg();
+  } else {
+    jint floatRegisterNumber = jvmci_reg - RegisterImpl::number_of_registers;
+    if (floatRegisterNumber < XMMRegisterImpl::number_of_registers) {
+      return as_XMMRegister(floatRegisterNumber)->as_VMReg();
+    }
+    ShouldNotReachHere();
+    return NULL;
+  }
+}
+
+bool CodeInstaller::is_general_purpose_reg(VMReg hotspotRegister) {
+  return !(hotspotRegister->is_FloatRegister() || hotspotRegister->is_XMMRegister());
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/cpu/x86/vm/jvmciGlobals_x86.hpp	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2000, 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.
+ *
+ */
+
+#ifndef CPU_X86_VM_JVMCIGLOBALS_X86_HPP
+#define CPU_X86_VM_JVMCIGLOBALS_X86_HPP
+
+#include "utilities/globalDefinitions.hpp"
+#include "utilities/macros.hpp"
+
+// Sets the default values for platform dependent flags used by the JVMCI compiler.
+// (see jvmciGlobals.hpp)
+
+#ifdef COMPILERJVMCI
+define_pd_global(bool, BackgroundCompilation,        true );
+define_pd_global(bool, UseTLAB,                      true );
+define_pd_global(bool, ResizeTLAB,                   true );
+define_pd_global(bool, InlineIntrinsics,             true );
+define_pd_global(bool, PreferInterpreterNativeStubs, false);
+define_pd_global(bool, TieredCompilation,            trueInTiered);
+define_pd_global(intx, BackEdgeThreshold,            100000);
+
+define_pd_global(intx, OnStackReplacePercentage,     933  );
+define_pd_global(intx, FreqInlineSize,               325  );
+define_pd_global(intx, NewSizeThreadIncrease,        4*K  );
+define_pd_global(uintx,MetaspaceSize,                12*M );
+define_pd_global(bool, NeverActAsServerClassMachine, false);
+define_pd_global(uint64_t,MaxRAM,                    128ULL*G);
+define_pd_global(bool, CICompileOSR,                 true );
+define_pd_global(bool, ProfileTraps,                 true );
+define_pd_global(bool, UseOnStackReplacement,        true );
+define_pd_global(intx, CompileThreshold,             10000);
+define_pd_global(intx, InitialCodeCacheSize,         16*M );
+define_pd_global(intx, ReservedCodeCacheSize,        64*M );
+define_pd_global(bool, ProfileInterpreter,           true );
+define_pd_global(intx, CodeCacheExpansionSize,       64*K );
+define_pd_global(uintx,CodeCacheMinBlockLength,      4);
+define_pd_global(uintx, CodeCacheMinimumUseSpace,    400*K);
+define_pd_global(intx, TypeProfileWidth,             8);
+define_pd_global(intx, MethodProfileWidth,           0);
+#endif // COMPILERJVMCI
+
+define_pd_global(intx, MaxVectorSize,                32);
+
+#endif // CPU_X86_VM_JVMCIGLOBALS_X86_HPP
--- a/src/cpu/x86/vm/macroAssembler_x86.cpp	Thu May 28 15:10:18 2015 -0700
+++ b/src/cpu/x86/vm/macroAssembler_x86.cpp	Thu May 28 21:11:28 2015 -0700
@@ -2945,7 +2945,7 @@
 }
 
 // !defined(COMPILER2) is because of stupid core builds
-#if !defined(_LP64) || defined(COMPILER1) || !defined(COMPILER2) || defined(GRAAL)
+#if !defined(_LP64) || defined(COMPILER1) || !defined(COMPILER2) || defined(JVMCI)
 void MacroAssembler::empty_FPU_stack() {
   if (VM_Version::supports_mmx()) {
     emms();
--- a/src/cpu/x86/vm/nativeInst_x86.cpp	Thu May 28 15:10:18 2015 -0700
+++ b/src/cpu/x86/vm/nativeInst_x86.cpp	Thu May 28 21:11:28 2015 -0700
@@ -474,7 +474,7 @@
 //
 // In C2 the 5+ byte sized instruction is enforced by code in MachPrologNode::emit.
 // In C1 the restriction is enforced by CodeEmitter::method_entry
-// In Graal, the restriction is enforced by HotSpotFrameContext.enter(...)
+// In JVMCI, the restriction is enforced by HotSpotFrameContext.enter(...)
 //
 void NativeJump::patch_verified_entry(address entry, address verified_entry, address dest) {
   // complete jump instruction (to be inserted) is in code_buffer;
--- a/src/cpu/x86/vm/nativeInst_x86.hpp	Thu May 28 15:10:18 2015 -0700
+++ b/src/cpu/x86/vm/nativeInst_x86.hpp	Thu May 28 21:11:28 2015 -0700
@@ -566,7 +566,7 @@
   if (ubyte_at(0) == NativeTstRegMem::instruction_code_memXregl &&
       ubyte_at(1) == 0x05) { // 00 rax 101
     address fault = addr_at(6) + int_at(2);
-    NOT_GRAAL(assert(!Assembler::is_polling_page_far(), "unexpected poll encoding");)
+    NOT_JVMCI(assert(!Assembler::is_polling_page_far(), "unexpected poll encoding");)
     return os::is_poll_address(fault);
   }
   // Now try decoding a far safepoint:
@@ -576,7 +576,7 @@
        (ubyte_at(2) & NativeTstRegMem::modrm_mask) == NativeTstRegMem::modrm_reg) ||
       ubyte_at(0) == NativeTstRegMem::instruction_code_memXregl &&
       (ubyte_at(1) & NativeTstRegMem::modrm_mask) == NativeTstRegMem::modrm_reg) {
-    NOT_GRAAL(assert(Assembler::is_polling_page_far(), "unexpected poll encoding");)
+    NOT_JVMCI(assert(Assembler::is_polling_page_far(), "unexpected poll encoding");)
     return true;
   }
   return false;
--- a/src/cpu/x86/vm/relocInfo_x86.cpp	Thu May 28 15:10:18 2015 -0700
+++ b/src/cpu/x86/vm/relocInfo_x86.cpp	Thu May 28 21:11:28 2015 -0700
@@ -181,7 +181,7 @@
 #ifdef _LP64
   typedef Assembler::WhichOperand WhichOperand;
   WhichOperand which = (WhichOperand) format();
-#ifndef GRAAL
+#ifndef JVMCI
   assert((which == Assembler::disp32_operand) == !Assembler::is_polling_page_far(), "format not set correctly");
 #endif
   if (which == Assembler::disp32_operand) {
--- a/src/cpu/x86/vm/sharedRuntime_x86_64.cpp	Thu May 28 15:10:18 2015 -0700
+++ b/src/cpu/x86/vm/sharedRuntime_x86_64.cpp	Thu May 28 21:11:28 2015 -0700
@@ -40,8 +40,8 @@
 #ifdef COMPILER2
 #include "opto/runtime.hpp"
 #endif
-#ifdef GRAAL
-#include "graal/graalJavaAccess.hpp"
+#ifdef JVMCI
+#include "jvmci/jvmciJavaAccess.hpp"
 #endif
 
 #define __ masm->
@@ -73,7 +73,7 @@
 #define DEF_YMM_HI_OFFS(regnum) ymm_hi ## regnum ## _off = ymm_off + (regnum)*16/BytesPerInt
   enum layout {
     fpu_state_off = frame::arg_reg_save_area_bytes/BytesPerInt, // fxsave save area
-#if defined(COMPILER2) || defined(GRAAL)
+#if defined(COMPILER2) || defined(JVMCI)
     ymm_off       = fpu_state_off,            // offset in fxsave save area
     DEF_YMM_HI_OFFS(0),
     DEF_YMM_HI_OFFS(1),
@@ -182,7 +182,7 @@
   __ enter();          // rsp becomes 16-byte aligned here
   __ push_CPU_state(); // Push a multiple of 16 bytes
 
-#if defined(COMPILER2) || defined(GRAAL)
+#if defined(COMPILER2) || defined(JVMCI)
   __ subptr(rsp, 256); // Save upper half of YMM registers
   if (save_vectors) {
     assert(UseAVX > 0, "256bit vectors are supported only with AVX");
@@ -206,7 +206,7 @@
     __ vextractf128h(Address(rsp, ymm_hi15_off * BytesPerInt), xmm15);
   }
 #else
-  assert(!save_vectors, "vectors are generated only by C2 and Graal");
+  assert(!save_vectors, "vectors are generated only by C2 and JVMCI");
 #endif
   if (frame::arg_reg_save_area_bytes != 0) {
     // Allocate argument register save area
@@ -257,7 +257,7 @@
   map->set_callee_saved(STACK_OFFSET(xmm15_off), xmm15->as_VMReg());
 
 
-#if defined(COMPILER2) || defined(GRAAL)
+#if defined(COMPILER2) || defined(JVMCI)
   if (save_vectors) {
     map->set_callee_saved(STACK_OFFSET(ymm_hi0_off ), xmm0->as_VMReg()->next()->next()->next()->next());
     map->set_callee_saved(STACK_OFFSET(ymm_hi1_off ), xmm1->as_VMReg()->next()->next()->next()->next());
@@ -321,7 +321,7 @@
     // Pop arg register save area
     __ addptr(rsp, frame::arg_reg_save_area_bytes);
   }
-#if defined(COMPILER2) || defined(GRAAL)
+#if defined(COMPILER2) || defined(JVMCI)
   if (restore_vectors) {
     // Restore upper half of YMM registes.
     assert(UseAVX > 0, "256bit vectors are supported only with AVX");
@@ -345,7 +345,7 @@
   }
   __ addptr(rsp, 256);
 #else
-  assert(!restore_vectors, "vectors are generated only by C2 and Graal");
+  assert(!restore_vectors, "vectors are generated only by C2 and JVMCI");
 #endif
   // Recover CPU state
   __ pop_CPU_state();
@@ -743,7 +743,7 @@
     __ block_comment("} verify_i2ce ");
   }
 
-#ifdef GRAAL
+#ifdef JVMCI
   if (frame_extension_argument != -1) {
     // The frame_extension_argument is an int that describes the
     // expected amount of argument space in the caller frame.  If that
@@ -814,13 +814,13 @@
   // Pre-load the register-jump target early, to schedule it better.
   __ movptr(r11, Address(rbx, in_bytes(Method::from_compiled_offset())));
 
-#ifdef GRAAL
+#ifdef JVMCI
   // check if this call should be routed towards a specific entry point
-  __ cmpptr(Address(r15_thread, in_bytes(JavaThread::graal_alternate_call_target_offset())), 0);
+  __ cmpptr(Address(r15_thread, in_bytes(JavaThread::jvmci_alternate_call_target_offset())), 0);
   Label no_alternative_target;
   __ jcc(Assembler::equal, no_alternative_target);
-  __ movptr(r11, Address(r15_thread, in_bytes(JavaThread::graal_alternate_call_target_offset())));
-  __ movptr(Address(r15_thread, in_bytes(JavaThread::graal_alternate_call_target_offset())), 0);
+  __ movptr(r11, Address(r15_thread, in_bytes(JavaThread::jvmci_alternate_call_target_offset())));
+  __ movptr(Address(r15_thread, in_bytes(JavaThread::jvmci_alternate_call_target_offset())), 0);
   __ bind(no_alternative_target);
 #endif
 
@@ -3428,8 +3428,8 @@
   __ jmp(cont);
 
   int reexecute_offset = __ pc() - start;
-#if defined(COMPILERGRAAL) && !defined(COMPILER1)
-  // Graal does not use this kind of deoptimization
+#if defined(COMPILERJVMCI) && !defined(COMPILER1)
+  // JVMCI does not use this kind of deoptimization
   __ should_not_reach_here();
 #endif
 
@@ -3442,10 +3442,10 @@
   __ movl(r14, Deoptimization::Unpack_reexecute); // callee-saved
   __ jmp(cont);
 
-#ifdef GRAAL
+#ifdef JVMCI
   int implicit_exception_uncommon_trap_offset = __ pc() - start;
 
-  __ pushptr(Address(r15_thread, in_bytes(JavaThread::graal_implicit_exception_pc_offset())));
+  __ pushptr(Address(r15_thread, in_bytes(JavaThread::jvmci_implicit_exception_pc_offset())));
 
   int uncommon_trap_offset = __ pc() - start;
 
@@ -3466,7 +3466,7 @@
 
   Label after_fetch_unroll_info_call;
   __ jmp(after_fetch_unroll_info_call);
-#endif // GRAAL
+#endif // JVMCI
 
   int exception_offset = __ pc() - start;
 
@@ -3553,7 +3553,7 @@
 
   __ reset_last_Java_frame(false, false);
 
-#ifdef GRAAL
+#ifdef JVMCI
   __ bind(after_fetch_unroll_info_call);
 #endif
 
@@ -3731,7 +3731,7 @@
 
   _deopt_blob = DeoptimizationBlob::create(&buffer, oop_maps, 0, exception_offset, reexecute_offset, frame_size_in_words);
   _deopt_blob->set_unpack_with_exception_in_tls_offset(exception_in_tls_offset);
-#ifdef GRAAL
+#ifdef JVMCI
   _deopt_blob->set_uncommon_trap_offset(uncommon_trap_offset);
   _deopt_blob->set_implicit_exception_uncommon_trap_offset(implicit_exception_uncommon_trap_offset);
 #endif
--- a/src/cpu/x86/vm/templateInterpreter_x86_64.cpp	Thu May 28 15:10:18 2015 -0700
+++ b/src/cpu/x86/vm/templateInterpreter_x86_64.cpp	Thu May 28 21:11:28 2015 -0700
@@ -204,7 +204,7 @@
   __ movptr(Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize), (int32_t)NULL_WORD);
   __ restore_bcp();
   __ restore_locals();
-#ifdef GRAAL
+#ifdef JVMCI
   // Check if we need to take lock at entry of synchronized method.
   {
     Label L;
--- a/src/cpu/x86/vm/templateTable_x86_64.cpp	Thu May 28 15:10:18 2015 -0700
+++ b/src/cpu/x86/vm/templateTable_x86_64.cpp	Thu May 28 21:11:28 2015 -0700
@@ -3039,7 +3039,7 @@
 
   // get target Method* & entry point
   __ lookup_virtual_method(rax, index, method);
-#ifdef GRAAL
+#ifdef JVMCI
   // r14: MethodDataPointer (r14 is callee saved)
   __ profile_called_method(method, r14, r13);
 #endif
@@ -3143,7 +3143,7 @@
   __ testptr(rbx, rbx);
   __ jcc(Assembler::zero, no_such_method);
 
-#ifdef GRAAL
+#ifdef JVMCI
   // r13: MethodDataPointer (r13 is callee saved)
   __ profile_called_method(rbx, r13, r14);
 #endif
--- a/src/cpu/x86/vm/vm_version_x86.cpp	Thu May 28 15:10:18 2015 -0700
+++ b/src/cpu/x86/vm/vm_version_x86.cpp	Thu May 28 21:11:28 2015 -0700
@@ -668,7 +668,7 @@
     }
   }
 #endif
-#if defined(COMPILER2) || defined(GRAAL)
+#if defined(COMPILER2) || defined(JVMCI)
   if (MaxVectorSize > 0) {
     if (!is_power_of_2(MaxVectorSize)) {
       warning("MaxVectorSize must be a power of 2");
--- a/src/os/windows/vm/os_windows.cpp	Thu May 28 15:10:18 2015 -0700
+++ b/src/os/windows/vm/os_windows.cpp	Thu May 28 21:11:28 2015 -0700
@@ -2253,7 +2253,7 @@
 #elif _M_AMD64
   PCONTEXT ctx = exceptionInfo->ContextRecord;
   address pc = (address)ctx->Rip;
-#ifdef GRAAL
+#ifdef JVMCI
   assert(pc[0] >= Assembler::REX && pc[0] <= Assembler::REX_WRXB && pc[1] == 0xF7 || pc[0] == 0xF7, "not an idiv opcode");
   if (pc[0] == 0xF7) {
     // set correct result values and continue after idiv instruction
@@ -2271,7 +2271,7 @@
   // set correct result values and continue after idiv instruction
   ctx->Rip = (DWORD)pc + 2;        // idiv reg, reg  is 2 bytes
   ctx->Rax = (DWORD)min_jint;      // result
-#endif // GRAAL
+#endif // JVMCI
   ctx->Rdx = (DWORD)0;             // remainder
   // Continue the execution
 #else
--- a/src/os_cpu/bsd_x86/vm/thread_bsd_x86.cpp	Thu May 28 15:10:18 2015 -0700
+++ b/src/os_cpu/bsd_x86/vm/thread_bsd_x86.cpp	Thu May 28 21:11:28 2015 -0700
@@ -66,8 +66,8 @@
 
     frame ret_frame(ret_sp, ret_fp, addr.pc());
     if (!ret_frame.safe_for_sender(jt)) {
-#if defined(COMPILER2) || defined(GRAAL)
-      // C2 and Graal use ebp as a general register see if NULL fp helps
+#if defined(COMPILER2) || defined(JVMCI)
+      // C2 and JVMCI use ebp as a general register see if NULL fp helps
       frame ret_frame2(ret_sp, NULL, addr.pc());
       if (!ret_frame2.safe_for_sender(jt)) {
         // nothing else to try if the frame isn't good
@@ -77,7 +77,7 @@
 #else
       // nothing else to try if the frame isn't good
       return false;
-#endif /* COMPILER2 || GRAAL*/
+#endif /* COMPILER2 || JVMCI*/
     }
     *fr_addr = ret_frame;
     return true;
--- a/src/os_cpu/linux_x86/vm/thread_linux_x86.cpp	Thu May 28 15:10:18 2015 -0700
+++ b/src/os_cpu/linux_x86/vm/thread_linux_x86.cpp	Thu May 28 21:11:28 2015 -0700
@@ -67,8 +67,8 @@
 
     frame ret_frame(ret_sp, ret_fp, addr.pc());
     if (!ret_frame.safe_for_sender(jt)) {
-#if defined(COMPILER2) || defined(GRAAL)
-      // C2 and Graal use ebp as a general register see if NULL fp helps
+#if defined(COMPILER2) || defined(JVMCI)
+      // C2 and JVMCI use ebp as a general register see if NULL fp helps
       frame ret_frame2(ret_sp, NULL, addr.pc());
       if (!ret_frame2.safe_for_sender(jt)) {
         // nothing else to try if the frame isn't good
@@ -78,7 +78,7 @@
 #else
       // nothing else to try if the frame isn't good
       return false;
-#endif /* COMPILER2 || GRAAL */
+#endif /* COMPILER2 || JVMCI */
     }
     *fr_addr = ret_frame;
     return true;
--- a/src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp	Thu May 28 15:10:18 2015 -0700
+++ b/src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp	Thu May 28 21:11:28 2015 -0700
@@ -484,14 +484,14 @@
       }
 #endif  // COMPILER2
 
-#ifdef GRAAL
+#ifdef JVMCI
       else if (sig == SIGILL && info->si_trapno == 0x100 + ST_RESERVED_FOR_USER_0) {
 	printf("SIGILL 0x%x 0x%x\n", info->si_trapno, ST_RESERVED_FOR_USER_0);
 	uc->uc_mcontext.gregs[REG_PC] = (greg_t)pc+4;
 	uc->uc_mcontext.gregs[REG_nPC] = (greg_t)npc + 4;
 	return true;
       }
-#endif // GRAAL
+#endif // JVMCI
 
       else if (sig == SIGSEGV && info->si_code > 0 && !MacroAssembler::needs_explicit_null_check((intptr_t)info->si_addr)) {
         // Determination of interpreter/vtable stub/compiled code null exception
--- a/src/os_cpu/windows_x86/vm/thread_windows_x86.cpp	Thu May 28 15:10:18 2015 -0700
+++ b/src/os_cpu/windows_x86/vm/thread_windows_x86.cpp	Thu May 28 21:11:28 2015 -0700
@@ -74,8 +74,8 @@
 
     frame ret_frame(ret_sp, ret_fp, addr.pc());
     if (!ret_frame.safe_for_sender(jt)) {
-#if defined(COMPILER2) || defined(GRAAL)
-      // C2 and Graal use ebp as a general register see if NULL fp helps
+#if defined(COMPILER2) || defined(JVMCI)
+      // C2 and JVMCI use ebp as a general register see if NULL fp helps
       frame ret_frame2(ret_sp, NULL, addr.pc());
       if (!ret_frame2.safe_for_sender(jt)) {
         // nothing else to try if the frame isn't good
@@ -85,7 +85,7 @@
 #else
       // nothing else to try if the frame isn't good
       return false;
-#endif /* COMPILER2 || GRAAL */
+#endif /* COMPILER2 || JVMCI */
     }
     *fr_addr = ret_frame;
     return true;
--- a/src/share/vm/c1/c1_GraphBuilder.cpp	Thu May 28 15:10:18 2015 -0700
+++ b/src/share/vm/c1/c1_GraphBuilder.cpp	Thu May 28 21:11:28 2015 -0700
@@ -3560,7 +3560,7 @@
     case vmIntrinsics::_updateBytesCRC32:
     case vmIntrinsics::_updateByteBufferCRC32:
       if (!UseCRC32Intrinsics) return false;
-      // GRAAL-409: CRC32 C1 intrinsics cause errors on jdk version earlier than 8
+      // JVMCI-409: CRC32 C1 intrinsics cause errors on jdk version earlier than 8
       if (!JDK_Version::is_gte_jdk18x_version()) return false;
       cantrap = false;
       preserves_state = true;
--- a/src/share/vm/classfile/classFileParser.cpp	Thu May 28 15:10:18 2015 -0700
+++ b/src/share/vm/classfile/classFileParser.cpp	Thu May 28 21:11:28 2015 -0700
@@ -1791,10 +1791,10 @@
     if (_location != _in_method)  break;  // only allow for methods
     if (!privileged)              break;  // only allow in privileged code
     return _method_LambdaForm_Hidden;
-#ifdef GRAAL
-  case vmSymbols::VM_SYMBOL_ENUM_NAME(com_oracle_graal_hotspot_Stable_signature):
+#ifdef JVMCI
+  case vmSymbols::VM_SYMBOL_ENUM_NAME(com_oracle_jvmci_hotspot_Stable_signature):
     if (_location != _in_field)   break;  // only allow for fields
-    if (!privileged && loader_data->class_loader() != SystemDictionary::graal_loader()) break;  // only allow in privileged code
+    if (!privileged && loader_data->class_loader() != SystemDictionary::jvmci_loader()) break;  // only allow in privileged code
     return _field_Stable;
 #endif
   case vmSymbols::VM_SYMBOL_ENUM_NAME(java_lang_invoke_Stable_signature):
--- a/src/share/vm/classfile/javaClasses.cpp	Thu May 28 15:10:18 2015 -0700
+++ b/src/share/vm/classfile/javaClasses.cpp	Thu May 28 21:11:28 2015 -0700
@@ -563,8 +563,8 @@
   set_init_lock(mirror(), r);
 
   // Set protection domain also
-#ifdef GRAAL
-  if (k->class_loader() == SystemDictionary::graal_loader()) {
+#ifdef JVMCI
+  if (k->class_loader() == SystemDictionary::jvmci_loader()) {
     // Same protection domain as for classes loaded by the boot loader
     protection_domain = Handle();
   }
--- a/src/share/vm/classfile/systemDictionary.cpp	Thu May 28 15:10:18 2015 -0700
+++ b/src/share/vm/classfile/systemDictionary.cpp	Thu May 28 21:11:28 2015 -0700
@@ -64,8 +64,8 @@
 #include "services/threadService.hpp"
 #include "utilities/macros.hpp"
 #include "utilities/ticks.hpp"
-#ifdef GRAAL
-#include "graal/graalRuntime.hpp"
+#ifdef JVMCI
+#include "jvmci/jvmciRuntime.hpp"
 #endif
 #if INCLUDE_TRACE
 #include "trace/tracing.hpp"
@@ -96,15 +96,15 @@
 bool        SystemDictionary::_has_loadClassInternal      =  false;
 bool        SystemDictionary::_has_checkPackageAccess     =  false;
 
-#ifdef GRAAL
-oop         SystemDictionary::_graal_loader               = NULL;
-
-oop SystemDictionary::graal_loader() {
-  return _graal_loader;
+#ifdef JVMCI
+oop         SystemDictionary::_jvmci_loader               = NULL;
+
+oop SystemDictionary::jvmci_loader() {
+  return _jvmci_loader;
 }
-void SystemDictionary::init_graal_loader(oop loader) {
-  assert(UseGraalClassLoader == (loader != NULL), "must be");
-  _graal_loader = loader;
+void SystemDictionary::init_jvmci_loader(oop loader) {
+  assert(UseJVMCIClassLoader == (loader != NULL), "must be");
+  _jvmci_loader = loader;
 }
 #endif
 
@@ -1728,7 +1728,7 @@
   strong->do_oop(&_java_system_loader);
   strong->do_oop(&_system_loader_lock_obj);
   CDS_ONLY(SystemDictionaryShared::roots_oops_do(strong);)
-  GRAAL_ONLY(strong->do_oop(&_graal_loader);)
+  JVMCI_ONLY(strong->do_oop(&_jvmci_loader);)
 
   // Adjust dictionary
   dictionary()->roots_oops_do(strong, weak);
@@ -1741,7 +1741,7 @@
   f->do_oop(&_java_system_loader);
   f->do_oop(&_system_loader_lock_obj);
   CDS_ONLY(SystemDictionaryShared::oops_do(f);)
-  GRAAL_ONLY(f->do_oop(&_graal_loader);)
+  JVMCI_ONLY(f->do_oop(&_jvmci_loader);)
 
   // Adjust dictionary
   dictionary()->oops_do(f);
@@ -1865,12 +1865,12 @@
   Klass**    klassp = &_well_known_klasses[id];
   bool must_load = (init_opt < SystemDictionary::Opt);
   if ((*klassp) == NULL) {
-#ifdef GRAAL
-    bool is_graal = init_opt == SystemDictionary::Graal;
-    assert(is_graal == (id >= (int)FIRST_GRAAL_WKID && id <= (int)LAST_GRAAL_WKID),
-        "Graal WKIDs must be contiguous and separate from non-Graal WKIDs");
-    if (is_graal) {
-      (*klassp) = resolve_or_fail(symbol, _graal_loader, Handle(), true, CHECK_0); // load required Graal class
+#ifdef JVMCI
+    bool is_jvmci = init_opt == SystemDictionary::Jvmci;
+    assert(is_jvmci == (id >= (int)FIRST_JVMCI_WKID && id <= (int)LAST_JVMCI_WKID),
+        "JVMCI WKIDs must be contiguous and separate from non-JVMCI WKIDs");
+    if (is_jvmci) {
+      (*klassp) = resolve_or_fail(symbol, _jvmci_loader, Handle(), true, CHECK_0); // load required JVMCI class
     } else
 #endif
     if (must_load) {
@@ -1950,7 +1950,7 @@
     scan = WKID(jsr292_group_end + 1);
   }
 
-  initialize_wk_klasses_until(NOT_GRAAL(WKID_LIMIT) GRAAL_ONLY(FIRST_GRAAL_WKID), scan, CHECK);
+  initialize_wk_klasses_until(NOT_JVMCI(WKID_LIMIT) JVMCI_ONLY(FIRST_JVMCI_WKID), scan, CHECK);
 
   _box_klasses[T_BOOLEAN] = WK_KLASS(Boolean_klass);
   _box_klasses[T_CHAR]    = WK_KLASS(Character_klass);
--- a/src/share/vm/classfile/systemDictionary.hpp	Thu May 28 15:10:18 2015 -0700
+++ b/src/share/vm/classfile/systemDictionary.hpp	Thu May 28 21:11:28 2015 -0700
@@ -196,62 +196,61 @@
   do_klass(Integer_klass,                               java_lang_Integer,                         Pre                 ) \
   do_klass(Long_klass,                                  java_lang_Long,                            Pre                 ) \
                                                                                                                          \
-  /* Support for Graal */                                                                                                \
+  /* Support for JVMCI */                                                                                                \
   do_klass(BitSet_klass,                                java_util_BitSet,                          Opt                 ) \
-  /* Graal classes. These are loaded on-demand. */                                                                                 \
-  GRAAL_ONLY(do_klass(Debug_klass,                           com_oracle_graal_debug_Debug,                                 Graal)) \
-  GRAAL_ONLY(do_klass(HotSpotCompiledCode_klass,             com_oracle_graal_hotspot_HotSpotCompiledCode,                 Graal)) \
-  GRAAL_ONLY(do_klass(HotSpotCompiledCode_Comment_klass,     com_oracle_graal_hotspot_HotSpotCompiledCode_Comment,         Graal)) \
-  GRAAL_ONLY(do_klass(HotSpotCompiledNmethod_klass,          com_oracle_graal_hotspot_HotSpotCompiledNmethod,              Graal)) \
-  GRAAL_ONLY(do_klass(HotSpotCompiledRuntimeStub_klass,      com_oracle_graal_hotspot_HotSpotCompiledRuntimeStub,          Graal)) \
-  GRAAL_ONLY(do_klass(HotSpotForeignCallLinkageImpl_klass,   com_oracle_graal_hotspot_HotSpotForeignCallLinkageImpl,       Graal)) \
-  GRAAL_ONLY(do_klass(HotSpotReferenceMap_klass,             com_oracle_graal_hotspot_HotSpotReferenceMap,                 Graal)) \
-  GRAAL_ONLY(do_klass(HotSpotOopMap_klass,                   com_oracle_graal_hotspot_HotSpotReferenceMap_HotSpotOopMap,   Graal)) \
-  GRAAL_ONLY(do_klass(HotSpotInstalledCode_klass,            com_oracle_graal_hotspot_meta_HotSpotInstalledCode,           Graal)) \
-  GRAAL_ONLY(do_klass(HotSpotNmethod_klass,                  com_oracle_graal_hotspot_meta_HotSpotNmethod,                 Graal)) \
-  GRAAL_ONLY(do_klass(HotSpotResolvedJavaMethodImpl_klass,   com_oracle_graal_hotspot_meta_HotSpotResolvedJavaMethodImpl,  Graal)) \
-  GRAAL_ONLY(do_klass(HotSpotResolvedObjectTypeImpl_klass,   com_oracle_graal_hotspot_meta_HotSpotResolvedObjectTypeImpl,  Graal)) \
-  GRAAL_ONLY(do_klass(HotSpotCompressedNullConstant_klass,   com_oracle_graal_hotspot_meta_HotSpotCompressedNullConstant,  Graal)) \
-  GRAAL_ONLY(do_klass(HotSpotObjectConstantImpl_klass,       com_oracle_graal_hotspot_meta_HotSpotObjectConstantImpl,      Graal)) \
-  GRAAL_ONLY(do_klass(HotSpotMetaspaceConstantImpl_klass,    com_oracle_graal_hotspot_meta_HotSpotMetaspaceConstantImpl,   Graal)) \
-  GRAAL_ONLY(do_klass(HotSpotStackFrameReference_klass,      com_oracle_graal_hotspot_HotSpotStackFrameReference,          Graal)) \
-  GRAAL_ONLY(do_klass(CompilationTask_klass,                 com_oracle_graal_hotspot_CompilationTask,                     Graal)) \
-  GRAAL_ONLY(do_klass(Assumptions_ConcreteMethod_klass,      com_oracle_graal_api_meta_Assumptions_ConcreteMethod,         Graal)) \
-  GRAAL_ONLY(do_klass(Assumptions_NoFinalizableSubclass_klass, com_oracle_graal_api_meta_Assumptions_NoFinalizableSubclass, Graal))\
-  GRAAL_ONLY(do_klass(Assumptions_ConcreteSubtype_klass,     com_oracle_graal_api_meta_Assumptions_ConcreteSubtype,        Graal)) \
-  GRAAL_ONLY(do_klass(Assumptions_LeafType_klass,            com_oracle_graal_api_meta_Assumptions_LeafType,               Graal)) \
-  GRAAL_ONLY(do_klass(Assumptions_CallSiteTargetValue_klass, com_oracle_graal_api_meta_Assumptions_CallSiteTargetValue,    Graal)) \
-  GRAAL_ONLY(do_klass(BytecodePosition_klass,                com_oracle_graal_api_code_BytecodePosition,                   Graal)) \
-  GRAAL_ONLY(do_klass(DebugInfo_klass,                       com_oracle_graal_api_code_DebugInfo,                          Graal)) \
-  GRAAL_ONLY(do_klass(RegisterSaveLayout_klass,              com_oracle_graal_api_code_RegisterSaveLayout,                 Graal)) \
-  GRAAL_ONLY(do_klass(BytecodeFrame_klass,                   com_oracle_graal_api_code_BytecodeFrame,                      Graal)) \
-  GRAAL_ONLY(do_klass(CompilationResult_Call_klass,          com_oracle_graal_api_code_CompilationResult_Call,             Graal)) \
-  GRAAL_ONLY(do_klass(CompilationResult_ConstantReference_klass, com_oracle_graal_api_code_CompilationResult_ConstantReference, Graal)) \
-  GRAAL_ONLY(do_klass(CompilationResult_DataPatch_klass,     com_oracle_graal_api_code_CompilationResult_DataPatch,        Graal)) \
-  GRAAL_ONLY(do_klass(CompilationResult_DataSectionReference_klass, com_oracle_graal_api_code_CompilationResult_DataSectionReference, Graal)) \
-  GRAAL_ONLY(do_klass(CompilationResult_ExceptionHandler_klass, com_oracle_graal_api_code_CompilationResult_ExceptionHandler, Graal))\
-  GRAAL_ONLY(do_klass(CompilationResult_Mark_klass,          com_oracle_graal_api_code_CompilationResult_Mark,             Graal)) \
-  GRAAL_ONLY(do_klass(CompilationResult_Infopoint_klass,     com_oracle_graal_api_code_CompilationResult_Infopoint,        Graal)) \
-  GRAAL_ONLY(do_klass(CompilationResult_Site_klass,          com_oracle_graal_api_code_CompilationResult_Site,             Graal)) \
-  GRAAL_ONLY(do_klass(InfopointReason_klass,                 com_oracle_graal_api_code_InfopointReason,                    Graal)) \
-  GRAAL_ONLY(do_klass(InstalledCode_klass,                   com_oracle_graal_api_code_InstalledCode,                      Graal)) \
-  GRAAL_ONLY(do_klass(code_Register_klass,                   com_oracle_graal_api_code_Register,                           Graal)) \
-  GRAAL_ONLY(do_klass(RegisterValue_klass,                   com_oracle_graal_api_code_RegisterValue,                      Graal)) \
-  GRAAL_ONLY(do_klass(RegisterCategory_klass,                com_oracle_graal_api_code_Register_RegisterCategory,          Graal)) \
-  GRAAL_ONLY(do_klass(StackSlot_klass,                       com_oracle_graal_api_code_StackSlot,                          Graal)) \
-  GRAAL_ONLY(do_klass(StackLockValue_klass,                  com_oracle_graal_api_code_StackLockValue,                     Graal)) \
-  GRAAL_ONLY(do_klass(VirtualObject_klass,                   com_oracle_graal_api_code_VirtualObject,                      Graal)) \
-  GRAAL_ONLY(do_klass(SpeculationLog_klass,                  com_oracle_graal_api_code_SpeculationLog,                     Graal)) \
-  GRAAL_ONLY(do_klass(JavaConstant_klass,                    com_oracle_graal_api_meta_JavaConstant,                       Graal)) \
-  GRAAL_ONLY(do_klass(PrimitiveConstant_klass,               com_oracle_graal_api_meta_PrimitiveConstant,                  Graal)) \
-  GRAAL_ONLY(do_klass(RawConstant_klass,                     com_oracle_graal_api_meta_RawConstant,                        Graal)) \
-  GRAAL_ONLY(do_klass(NullConstant_klass,                    com_oracle_graal_api_meta_NullConstant,                       Graal)) \
-  GRAAL_ONLY(do_klass(ExceptionHandler_klass,                com_oracle_graal_api_meta_ExceptionHandler,                   Graal)) \
-  GRAAL_ONLY(do_klass(Kind_klass,                            com_oracle_graal_api_meta_Kind,                               Graal)) \
-  GRAAL_ONLY(do_klass(LIRKind_klass,                         com_oracle_graal_api_meta_LIRKind,                            Graal)) \
-  GRAAL_ONLY(do_klass(JavaMethod_klass,                      com_oracle_graal_api_meta_JavaMethod,                         Graal)) \
-  GRAAL_ONLY(do_klass(JavaType_klass,                        com_oracle_graal_api_meta_JavaType,                           Graal)) \
-  GRAAL_ONLY(do_klass(AbstractValue_klass,                   com_oracle_graal_api_meta_AbstractValue,                      Graal)) \
+  /* JVMCI classes. These are loaded on-demand. */                                                                                 \
+  JVMCI_ONLY(do_klass(Debug_klass,                           com_oracle_jvmci_debug_Debug,                                 Jvmci)) \
+  JVMCI_ONLY(do_klass(HotSpotCompiledCode_klass,             com_oracle_jvmci_hotspot_HotSpotCompiledCode,                 Jvmci)) \
+  JVMCI_ONLY(do_klass(HotSpotCompiledCode_Comment_klass,     com_oracle_jvmci_hotspot_HotSpotCompiledCode_Comment,         Jvmci)) \
+  JVMCI_ONLY(do_klass(HotSpotCompiledNmethod_klass,          com_oracle_jvmci_hotspot_HotSpotCompiledNmethod,              Jvmci)) \
+  JVMCI_ONLY(do_klass(HotSpotForeignCallTarget_klass,        com_oracle_jvmci_hotspot_HotSpotForeignCallTarget,            Jvmci)) \
+  JVMCI_ONLY(do_klass(HotSpotReferenceMap_klass,             com_oracle_jvmci_hotspot_HotSpotReferenceMap,                 Jvmci)) \
+  JVMCI_ONLY(do_klass(HotSpotOopMap_klass,                   com_oracle_jvmci_hotspot_HotSpotReferenceMap_HotSpotOopMap,   Jvmci)) \
+  JVMCI_ONLY(do_klass(HotSpotInstalledCode_klass,            com_oracle_jvmci_hotspot_HotSpotInstalledCode,                Jvmci)) \
+  JVMCI_ONLY(do_klass(HotSpotNmethod_klass,                  com_oracle_jvmci_hotspot_HotSpotNmethod,                      Jvmci)) \
+  JVMCI_ONLY(do_klass(HotSpotResolvedJavaMethodImpl_klass,   com_oracle_jvmci_hotspot_HotSpotResolvedJavaMethodImpl,       Jvmci)) \
+  JVMCI_ONLY(do_klass(HotSpotResolvedObjectTypeImpl_klass,   com_oracle_jvmci_hotspot_HotSpotResolvedObjectTypeImpl,       Jvmci)) \
+  JVMCI_ONLY(do_klass(HotSpotCompressedNullConstant_klass,   com_oracle_jvmci_hotspot_HotSpotCompressedNullConstant,       Jvmci)) \
+  JVMCI_ONLY(do_klass(HotSpotObjectConstantImpl_klass,       com_oracle_jvmci_hotspot_HotSpotObjectConstantImpl,           Jvmci)) \
+  JVMCI_ONLY(do_klass(HotSpotMetaspaceConstantImpl_klass,    com_oracle_jvmci_hotspot_HotSpotMetaspaceConstantImpl,        Jvmci)) \
+  JVMCI_ONLY(do_klass(HotSpotStackFrameReference_klass,      com_oracle_jvmci_hotspot_HotSpotStackFrameReference,          Jvmci)) \
+  JVMCI_ONLY(do_klass(CompilationTask_klass,                 com_oracle_graal_hotspot_CompilationTask,                     Jvmci)) \
+  JVMCI_ONLY(do_klass(Assumptions_ConcreteMethod_klass,      com_oracle_jvmci_meta_Assumptions_ConcreteMethod,             Jvmci)) \
+  JVMCI_ONLY(do_klass(Assumptions_NoFinalizableSubclass_klass, com_oracle_jvmci_meta_Assumptions_NoFinalizableSubclass,    Jvmci))\
+  JVMCI_ONLY(do_klass(Assumptions_ConcreteSubtype_klass,     com_oracle_jvmci_meta_Assumptions_ConcreteSubtype,            Jvmci)) \
+  JVMCI_ONLY(do_klass(Assumptions_LeafType_klass,            com_oracle_jvmci_meta_Assumptions_LeafType,                   Jvmci)) \
+  JVMCI_ONLY(do_klass(Assumptions_CallSiteTargetValue_klass, com_oracle_jvmci_meta_Assumptions_CallSiteTargetValue,        Jvmci)) \
+  JVMCI_ONLY(do_klass(BytecodePosition_klass,                com_oracle_jvmci_code_BytecodePosition,                       Jvmci)) \
+  JVMCI_ONLY(do_klass(DebugInfo_klass,                       com_oracle_jvmci_code_DebugInfo,                              Jvmci)) \
+  JVMCI_ONLY(do_klass(RegisterSaveLayout_klass,              com_oracle_jvmci_code_RegisterSaveLayout,                     Jvmci)) \
+  JVMCI_ONLY(do_klass(BytecodeFrame_klass,                   com_oracle_jvmci_code_BytecodeFrame,                          Jvmci)) \
+  JVMCI_ONLY(do_klass(CompilationResult_Call_klass,          com_oracle_jvmci_code_CompilationResult_Call,                 Jvmci)) \
+  JVMCI_ONLY(do_klass(CompilationResult_ConstantReference_klass, com_oracle_jvmci_code_CompilationResult_ConstantReference, Jvmci)) \
+  JVMCI_ONLY(do_klass(CompilationResult_DataPatch_klass,     com_oracle_jvmci_code_CompilationResult_DataPatch,            Jvmci)) \
+  JVMCI_ONLY(do_klass(CompilationResult_DataSectionReference_klass, com_oracle_jvmci_code_CompilationResult_DataSectionReference, Jvmci)) \
+  JVMCI_ONLY(do_klass(CompilationResult_ExceptionHandler_klass, com_oracle_jvmci_code_CompilationResult_ExceptionHandler,  Jvmci))\
+  JVMCI_ONLY(do_klass(CompilationResult_Mark_klass,          com_oracle_jvmci_code_CompilationResult_Mark,                 Jvmci)) \
+  JVMCI_ONLY(do_klass(CompilationResult_Infopoint_klass,     com_oracle_jvmci_code_CompilationResult_Infopoint,            Jvmci)) \
+  JVMCI_ONLY(do_klass(CompilationResult_Site_klass,          com_oracle_jvmci_code_CompilationResult_Site,                 Jvmci)) \
+  JVMCI_ONLY(do_klass(InfopointReason_klass,                 com_oracle_jvmci_code_InfopointReason,                        Jvmci)) \
+  JVMCI_ONLY(do_klass(InstalledCode_klass,                   com_oracle_jvmci_code_InstalledCode,                          Jvmci)) \
+  JVMCI_ONLY(do_klass(code_Register_klass,                   com_oracle_jvmci_code_Register,                               Jvmci)) \
+  JVMCI_ONLY(do_klass(RegisterValue_klass,                   com_oracle_jvmci_code_RegisterValue,                          Jvmci)) \
+  JVMCI_ONLY(do_klass(RegisterCategory_klass,                com_oracle_jvmci_code_Register_RegisterCategory,              Jvmci)) \
+  JVMCI_ONLY(do_klass(StackSlot_klass,                       com_oracle_jvmci_code_StackSlot,                              Jvmci)) \
+  JVMCI_ONLY(do_klass(StackLockValue_klass,                  com_oracle_jvmci_code_StackLockValue,                         Jvmci)) \
+  JVMCI_ONLY(do_klass(VirtualObject_klass,                   com_oracle_jvmci_code_VirtualObject,                          Jvmci)) \
+  JVMCI_ONLY(do_klass(SpeculationLog_klass,                  com_oracle_jvmci_code_SpeculationLog,                         Jvmci)) \
+  JVMCI_ONLY(do_klass(JavaConstant_klass,                    com_oracle_jvmci_meta_JavaConstant,                           Jvmci)) \
+  JVMCI_ONLY(do_klass(PrimitiveConstant_klass,               com_oracle_jvmci_meta_PrimitiveConstant,                      Jvmci)) \
+  JVMCI_ONLY(do_klass(RawConstant_klass,                     com_oracle_jvmci_meta_RawConstant,                            Jvmci)) \
+  JVMCI_ONLY(do_klass(NullConstant_klass,                    com_oracle_jvmci_meta_NullConstant,                           Jvmci)) \
+  JVMCI_ONLY(do_klass(ExceptionHandler_klass,                com_oracle_jvmci_meta_ExceptionHandler,                       Jvmci)) \
+  JVMCI_ONLY(do_klass(Kind_klass,                            com_oracle_jvmci_meta_Kind,                                   Jvmci)) \
+  JVMCI_ONLY(do_klass(LIRKind_klass,                         com_oracle_jvmci_meta_LIRKind,                                Jvmci)) \
+  JVMCI_ONLY(do_klass(JavaMethod_klass,                      com_oracle_jvmci_meta_JavaMethod,                             Jvmci)) \
+  JVMCI_ONLY(do_klass(JavaType_klass,                        com_oracle_jvmci_meta_JavaType,                               Jvmci)) \
+  JVMCI_ONLY(do_klass(AbstractValue_klass,                   com_oracle_jvmci_meta_AbstractValue,                          Jvmci)) \
 
   /*end*/
 
@@ -270,9 +269,9 @@
 
     WKID_LIMIT,
 
-#ifdef GRAAL
-    FIRST_GRAAL_WKID = WK_KLASS_ENUM_NAME(Debug_klass),
-    LAST_GRAAL_WKID  = WK_KLASS_ENUM_NAME(AbstractValue_klass),
+#ifdef JVMCI
+    FIRST_JVMCI_WKID = WK_KLASS_ENUM_NAME(Debug_klass),
+    LAST_JVMCI_WKID  = WK_KLASS_ENUM_NAME(AbstractValue_klass),
 #endif
 
     FIRST_WKID = NO_WKID + 1
@@ -288,8 +287,8 @@
     Opt,                        // preload tried; NULL if not present
     Opt_Only_JDK14NewRef,       // preload tried; use only with NewReflection
     Opt_Only_JDK15,             // preload tried; use only with JDK1.5+
-#ifdef GRAAL
-    Graal,                      // preload tried; error if not present, use only with GRAAL
+#ifdef JVMCI
+    Jvmci,                      // preload tried; error if not present, use only with JVMCI
 #endif
     OPTION_LIMIT,
     CEIL_LG_OPTION_LIMIT = 4    // OPTION_LIMIT <= (1<<CEIL_LG_OPTION_LIMIT)
@@ -480,8 +479,8 @@
     // despite the optional loading, if you use this it must be present:
     return check_klass(k);
   }
-#ifdef GRAAL
-  static Klass* check_klass_Graal(Klass* k)      { return k; }
+#ifdef JVMCI
+  static Klass* check_klass_Jvmci(Klass* k)      { return k; }
 #endif
 
   static bool initialize_wk_klass(WKID id, int init_opt, TRAPS);
@@ -548,12 +547,12 @@
   // Returns default system loader
   static oop java_system_loader();
 
-#ifdef GRAAL
-  // Returns the Graal loader. This will be NULL if !UseGraalClassLoader
+#ifdef JVMCI
+  // Returns the JVMCI loader. This will be NULL if !UseJVMCIClassLoader
   // in which case it's equivalent to the boot loader
-  static oop graal_loader();
-  // Sets the Graal loader. This is called at most once.
-  static void init_graal_loader(oop loader);
+  static oop jvmci_loader();
+  // Sets the JVMCI loader. This is called at most once.
+  static void init_jvmci_loader(oop loader);
 #endif
 
   // Compute the default system loader
@@ -786,8 +785,8 @@
   static Klass* _box_klasses[T_VOID+1];
 
   static oop  _java_system_loader;
-#ifdef GRAAL
-  static oop  _graal_loader;
+#ifdef JVMCI
+  static oop  _jvmci_loader;
 #endif
 
   static bool _has_loadClassInternal;
--- a/src/share/vm/classfile/verifier.cpp	Thu May 28 15:10:18 2015 -0700
+++ b/src/share/vm/classfile/verifier.cpp	Thu May 28 21:11:28 2015 -0700
@@ -94,7 +94,7 @@
 // Methods in Verifier
 
 bool Verifier::should_verify_for(oop class_loader, bool should_verify_class) {
-  return (class_loader == NULL GRAAL_ONLY(|| class_loader == SystemDictionary::graal_loader()) || !should_verify_class) ?
+  return (class_loader == NULL JVMCI_ONLY(|| class_loader == SystemDictionary::jvmci_loader()) || !should_verify_class) ?
     BytecodeVerificationLocal : BytecodeVerificationRemote;
 }
 
--- a/src/share/vm/classfile/vmSymbols.hpp	Thu May 28 15:10:18 2015 -0700
+++ b/src/share/vm/classfile/vmSymbols.hpp	Thu May 28 21:11:28 2015 -0700
@@ -298,68 +298,65 @@
   LP64_ONLY( do_alias(intptr_signature,               long_signature) )                           \
   template(selectAlternative_signature, "(ZLjava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodHandle;)Ljava/lang/invoke/MethodHandle;") \
                                                                                                                                       \
-  /* Support for Graal */                                                                                                             \
+  /* Support for JVMCI */                                                                                                             \
   template(java_util_BitSet,                                         "java/util/BitSet")                                              \
-  GRAAL_ONLY(template(com_oracle_graal_debug_Debug,                             "com/oracle/graal/debug/Debug"))                                  \
-  GRAAL_ONLY(template(com_oracle_graal_hotspot_HotSpotGraalRuntime,             "com/oracle/graal/hotspot/HotSpotGraalRuntime"))                  \
-  GRAAL_ONLY(template(com_oracle_graal_hotspot_HotSpotCompiledCode,             "com/oracle/graal/hotspot/HotSpotCompiledCode"))                  \
-  GRAAL_ONLY(template(com_oracle_graal_hotspot_HotSpotCompiledCode_Comment,     "com/oracle/graal/hotspot/HotSpotCompiledCode$Comment"))          \
-  GRAAL_ONLY(template(com_oracle_graal_hotspot_HotSpotCompiledNmethod,          "com/oracle/graal/hotspot/HotSpotCompiledNmethod"))               \
-  GRAAL_ONLY(template(com_oracle_graal_hotspot_HotSpotCompiledRuntimeStub,      "com/oracle/graal/hotspot/HotSpotCompiledRuntimeStub"))           \
-  GRAAL_ONLY(template(com_oracle_graal_hotspot_HotSpotForeignCallLinkageImpl,   "com/oracle/graal/hotspot/HotSpotForeignCallLinkageImpl"))        \
-  GRAAL_ONLY(template(com_oracle_graal_hotspot_HotSpotReferenceMap,             "com/oracle/graal/hotspot/HotSpotReferenceMap"))                  \
-  GRAAL_ONLY(template(com_oracle_graal_hotspot_HotSpotReferenceMap_HotSpotOopMap, "com/oracle/graal/hotspot/HotSpotReferenceMap$HotSpotOopMap"))  \
-  GRAAL_ONLY(template(com_oracle_graal_hotspot_bridge_CompilerToVMImpl,         "com/oracle/graal/hotspot/bridge/CompilerToVMImpl"))              \
-  GRAAL_ONLY(template(com_oracle_graal_hotspot_meta_HotSpotInstalledCode,       "com/oracle/graal/hotspot/meta/HotSpotInstalledCode"))            \
-  GRAAL_ONLY(template(com_oracle_graal_hotspot_meta_HotSpotNmethod,             "com/oracle/graal/hotspot/meta/HotSpotNmethod"))                  \
-  GRAAL_ONLY(template(com_oracle_graal_hotspot_meta_HotSpotResolvedJavaMethodImpl, "com/oracle/graal/hotspot/meta/HotSpotResolvedJavaMethodImpl")) \
-  GRAAL_ONLY(template(com_oracle_graal_hotspot_meta_HotSpotResolvedObjectTypeImpl, "com/oracle/graal/hotspot/meta/HotSpotResolvedObjectTypeImpl")) \
-  GRAAL_ONLY(template(com_oracle_graal_hotspot_meta_HotSpotCompressedNullConstant, "com/oracle/graal/hotspot/meta/HotSpotCompressedNullConstant")) \
-  GRAAL_ONLY(template(com_oracle_graal_hotspot_meta_HotSpotObjectConstantImpl,  "com/oracle/graal/hotspot/meta/HotSpotObjectConstantImpl"))       \
-  GRAAL_ONLY(template(com_oracle_graal_hotspot_meta_HotSpotMetaspaceConstantImpl,"com/oracle/graal/hotspot/meta/HotSpotMetaspaceConstantImpl"))   \
-  GRAAL_ONLY(template(com_oracle_graal_hotspot_HotSpotStackFrameReference,      "com/oracle/graal/hotspot/HotSpotStackFrameReference"))           \
-  GRAAL_ONLY(template(com_oracle_graal_hotspot_CompilationTask,                 "com/oracle/graal/hotspot/CompilationTask"))                      \
-  GRAAL_ONLY(template(com_oracle_graal_api_meta_JavaConstant,                   "com/oracle/graal/api/meta/JavaConstant"))                        \
-  GRAAL_ONLY(template(com_oracle_graal_api_meta_PrimitiveConstant,              "com/oracle/graal/api/meta/PrimitiveConstant"))                   \
-  GRAAL_ONLY(template(com_oracle_graal_api_meta_RawConstant,                    "com/oracle/graal/api/meta/RawConstant"))                         \
-  GRAAL_ONLY(template(com_oracle_graal_api_meta_NullConstant,                   "com/oracle/graal/api/meta/NullConstant"))                        \
-  GRAAL_ONLY(template(com_oracle_graal_api_meta_ExceptionHandler,               "com/oracle/graal/api/meta/ExceptionHandler"))                    \
-  GRAAL_ONLY(template(com_oracle_graal_api_meta_JavaMethod,                     "com/oracle/graal/api/meta/JavaMethod"))                          \
-  GRAAL_ONLY(template(com_oracle_graal_api_meta_JavaType,                       "com/oracle/graal/api/meta/JavaType"))                            \
-  GRAAL_ONLY(template(com_oracle_graal_api_meta_Kind,                           "com/oracle/graal/api/meta/Kind"))                                \
-  GRAAL_ONLY(template(com_oracle_graal_api_meta_LIRKind,                        "com/oracle/graal/api/meta/LIRKind"))                             \
-  GRAAL_ONLY(template(com_oracle_graal_api_meta_AbstractValue,                  "com/oracle/graal/api/meta/AbstractValue"))                       \
-  GRAAL_ONLY(template(com_oracle_graal_api_meta_Assumptions_ConcreteSubtype,    "com/oracle/graal/api/meta/Assumptions$ConcreteSubtype"))         \
-  GRAAL_ONLY(template(com_oracle_graal_api_meta_Assumptions_LeafType,           "com/oracle/graal/api/meta/Assumptions$LeafType"))                \
-  GRAAL_ONLY(template(com_oracle_graal_api_meta_Assumptions_NoFinalizableSubclass, "com/oracle/graal/api/meta/Assumptions$NoFinalizableSubclass")) \
-  GRAAL_ONLY(template(com_oracle_graal_api_meta_Assumptions_ConcreteMethod,     "com/oracle/graal/api/meta/Assumptions$ConcreteMethod"))          \
-  GRAAL_ONLY(template(com_oracle_graal_api_meta_Assumptions_CallSiteTargetValue,"com/oracle/graal/api/meta/Assumptions$CallSiteTargetValue"))     \
-  GRAAL_ONLY(template(com_oracle_graal_api_code_CompilationResult_Call,         "com/oracle/graal/api/code/CompilationResult$Call"))              \
-  GRAAL_ONLY(template(com_oracle_graal_api_code_CompilationResult_ConstantReference, "com/oracle/graal/api/code/CompilationResult$ConstantReference")) \
-  GRAAL_ONLY(template(com_oracle_graal_api_code_CompilationResult_DataPatch,    "com/oracle/graal/api/code/CompilationResult$DataPatch"))         \
-  GRAAL_ONLY(template(com_oracle_graal_api_code_CompilationResult_DataSectionReference, "com/oracle/graal/api/code/CompilationResult$DataSectionReference")) \
-  GRAAL_ONLY(template(com_oracle_graal_api_code_CompilationResult_ExceptionHandler, "com/oracle/graal/api/code/CompilationResult$ExceptionHandler")) \
-  GRAAL_ONLY(template(com_oracle_graal_api_code_CompilationResult_Mark,         "com/oracle/graal/api/code/CompilationResult$Mark"))              \
-  GRAAL_ONLY(template(com_oracle_graal_api_code_CompilationResult_Infopoint,    "com/oracle/graal/api/code/CompilationResult$Infopoint"))         \
-  GRAAL_ONLY(template(com_oracle_graal_api_code_CompilationResult_Site,         "com/oracle/graal/api/code/CompilationResult$Site"))              \
-  GRAAL_ONLY(template(com_oracle_graal_api_code_InfopointReason,                "com/oracle/graal/api/code/InfopointReason"))                     \
-  GRAAL_ONLY(template(com_oracle_graal_api_code_InstalledCode,                  "com/oracle/graal/api/code/InstalledCode"))                       \
-  GRAAL_ONLY(template(com_oracle_graal_api_code_BytecodeFrame,                  "com/oracle/graal/api/code/BytecodeFrame"))                       \
-  GRAAL_ONLY(template(com_oracle_graal_api_code_BytecodePosition,               "com/oracle/graal/api/code/BytecodePosition"))                    \
-  GRAAL_ONLY(template(com_oracle_graal_api_code_DebugInfo,                      "com/oracle/graal/api/code/DebugInfo"))                           \
-  GRAAL_ONLY(template(com_oracle_graal_api_code_Register,                       "com/oracle/graal/api/code/Register"))                            \
-  GRAAL_ONLY(template(com_oracle_graal_api_code_RegisterValue,                  "com/oracle/graal/api/code/RegisterValue"))                       \
-  GRAAL_ONLY(template(com_oracle_graal_api_code_Register_RegisterCategory,      "com/oracle/graal/api/code/Register$RegisterCategory"))           \
-  GRAAL_ONLY(template(com_oracle_graal_api_code_StackSlot,                      "com/oracle/graal/api/code/StackSlot"))                           \
-  GRAAL_ONLY(template(com_oracle_graal_api_code_StackLockValue,                 "com/oracle/graal/api/code/StackLockValue"))                      \
-  GRAAL_ONLY(template(com_oracle_graal_api_code_VirtualObject,                  "com/oracle/graal/api/code/VirtualObject"))                       \
-  GRAAL_ONLY(template(com_oracle_graal_api_code_RegisterSaveLayout,             "com/oracle/graal/api/code/RegisterSaveLayout"))                  \
-  GRAAL_ONLY(template(com_oracle_graal_api_code_InvalidInstalledCodeException,  "com/oracle/graal/api/code/InvalidInstalledCodeException"))       \
-  GRAAL_ONLY(template(com_oracle_graal_api_code_SpeculationLog,                 "com/oracle/graal/api/code/SpeculationLog"))                      \
-  GRAAL_ONLY(template(compileMetaspaceMethod_name,               "compileMetaspaceMethod"))                                                       \
-  GRAAL_ONLY(template(compileMetaspaceMethod_signature,          "(JIJI)V"))                                                                      \
-  GRAAL_ONLY(template(graal_mirror_name,                         "graal_mirror"))                                                                 \
-  GRAAL_ONLY(template(com_oracle_graal_hotspot_Stable_signature, "Lcom/oracle/graal/hotspot/Stable;"))                                            \
+  JVMCI_ONLY(template(com_oracle_jvmci_debug_Debug,                             "com/oracle/jvmci/debug/Debug"))                                  \
+  JVMCI_ONLY(template(com_oracle_jvmci_hotspot_HotSpotCompiledCode,             "com/oracle/jvmci/hotspot/HotSpotCompiledCode"))                  \
+  JVMCI_ONLY(template(com_oracle_jvmci_hotspot_HotSpotCompiledCode_Comment,     "com/oracle/jvmci/hotspot/HotSpotCompiledCode$Comment"))          \
+  JVMCI_ONLY(template(com_oracle_jvmci_hotspot_HotSpotCompiledNmethod,          "com/oracle/jvmci/hotspot/HotSpotCompiledNmethod"))               \
+  JVMCI_ONLY(template(com_oracle_jvmci_hotspot_HotSpotForeignCallTarget,        "com/oracle/jvmci/hotspot/HotSpotForeignCallTarget"))             \
+  JVMCI_ONLY(template(com_oracle_jvmci_hotspot_HotSpotReferenceMap,             "com/oracle/jvmci/hotspot/HotSpotReferenceMap"))                  \
+  JVMCI_ONLY(template(com_oracle_jvmci_hotspot_HotSpotReferenceMap_HotSpotOopMap, "com/oracle/jvmci/hotspot/HotSpotReferenceMap$HotSpotOopMap"))  \
+  JVMCI_ONLY(template(com_oracle_jvmci_hotspot_CompilerToVMImpl,                "com/oracle/jvmci/hotspot/CompilerToVMImpl"))                     \
+  JVMCI_ONLY(template(com_oracle_jvmci_hotspot_HotSpotInstalledCode,            "com/oracle/jvmci/hotspot/HotSpotInstalledCode"))                 \
+  JVMCI_ONLY(template(com_oracle_jvmci_hotspot_HotSpotNmethod,                  "com/oracle/jvmci/hotspot/HotSpotNmethod"))                       \
+  JVMCI_ONLY(template(com_oracle_jvmci_hotspot_HotSpotResolvedJavaMethodImpl,   "com/oracle/jvmci/hotspot/HotSpotResolvedJavaMethodImpl"))        \
+  JVMCI_ONLY(template(com_oracle_jvmci_hotspot_HotSpotResolvedObjectTypeImpl,   "com/oracle/jvmci/hotspot/HotSpotResolvedObjectTypeImpl"))        \
+  JVMCI_ONLY(template(com_oracle_jvmci_hotspot_HotSpotCompressedNullConstant,   "com/oracle/jvmci/hotspot/HotSpotCompressedNullConstant"))        \
+  JVMCI_ONLY(template(com_oracle_jvmci_hotspot_HotSpotObjectConstantImpl,       "com/oracle/jvmci/hotspot/HotSpotObjectConstantImpl"))            \
+  JVMCI_ONLY(template(com_oracle_jvmci_hotspot_HotSpotMetaspaceConstantImpl,    "com/oracle/jvmci/hotspot/HotSpotMetaspaceConstantImpl"))         \
+  JVMCI_ONLY(template(com_oracle_jvmci_hotspot_HotSpotStackFrameReference,      "com/oracle/jvmci/hotspot/HotSpotStackFrameReference"))           \
+  JVMCI_ONLY(template(com_oracle_graal_hotspot_CompilationTask,                 "com/oracle/graal/hotspot/CompilationTask"))                      \
+  JVMCI_ONLY(template(com_oracle_jvmci_meta_JavaConstant,                       "com/oracle/jvmci/meta/JavaConstant"))                            \
+  JVMCI_ONLY(template(com_oracle_jvmci_meta_PrimitiveConstant,                  "com/oracle/jvmci/meta/PrimitiveConstant"))                       \
+  JVMCI_ONLY(template(com_oracle_jvmci_meta_RawConstant,                        "com/oracle/jvmci/meta/RawConstant"))                             \
+  JVMCI_ONLY(template(com_oracle_jvmci_meta_NullConstant,                       "com/oracle/jvmci/meta/NullConstant"))                            \
+  JVMCI_ONLY(template(com_oracle_jvmci_meta_ExceptionHandler,                   "com/oracle/jvmci/meta/ExceptionHandler"))                        \
+  JVMCI_ONLY(template(com_oracle_jvmci_meta_JavaMethod,                         "com/oracle/jvmci/meta/JavaMethod"))                              \
+  JVMCI_ONLY(template(com_oracle_jvmci_meta_JavaType,                           "com/oracle/jvmci/meta/JavaType"))                                \
+  JVMCI_ONLY(template(com_oracle_jvmci_meta_Kind,                               "com/oracle/jvmci/meta/Kind"))                                    \
+  JVMCI_ONLY(template(com_oracle_jvmci_meta_LIRKind,                            "com/oracle/jvmci/meta/LIRKind"))                                 \
+  JVMCI_ONLY(template(com_oracle_jvmci_meta_AbstractValue,                      "com/oracle/jvmci/meta/AbstractValue"))                           \
+  JVMCI_ONLY(template(com_oracle_jvmci_meta_Assumptions_ConcreteSubtype,        "com/oracle/jvmci/meta/Assumptions$ConcreteSubtype"))             \
+  JVMCI_ONLY(template(com_oracle_jvmci_meta_Assumptions_LeafType,               "com/oracle/jvmci/meta/Assumptions$LeafType"))                    \
+  JVMCI_ONLY(template(com_oracle_jvmci_meta_Assumptions_NoFinalizableSubclass,  "com/oracle/jvmci/meta/Assumptions$NoFinalizableSubclass"))       \
+  JVMCI_ONLY(template(com_oracle_jvmci_meta_Assumptions_ConcreteMethod,         "com/oracle/jvmci/meta/Assumptions$ConcreteMethod"))              \
+  JVMCI_ONLY(template(com_oracle_jvmci_meta_Assumptions_CallSiteTargetValue,    "com/oracle/jvmci/meta/Assumptions$CallSiteTargetValue"))         \
+  JVMCI_ONLY(template(com_oracle_jvmci_code_CompilationResult_Call,             "com/oracle/jvmci/code/CompilationResult$Call"))                  \
+  JVMCI_ONLY(template(com_oracle_jvmci_code_CompilationResult_ConstantReference, "com/oracle/jvmci/code/CompilationResult$ConstantReference"))    \
+  JVMCI_ONLY(template(com_oracle_jvmci_code_CompilationResult_DataPatch,        "com/oracle/jvmci/code/CompilationResult$DataPatch"))             \
+  JVMCI_ONLY(template(com_oracle_jvmci_code_CompilationResult_DataSectionReference, "com/oracle/jvmci/code/CompilationResult$DataSectionReference")) \
+  JVMCI_ONLY(template(com_oracle_jvmci_code_CompilationResult_ExceptionHandler, "com/oracle/jvmci/code/CompilationResult$ExceptionHandler"))      \
+  JVMCI_ONLY(template(com_oracle_jvmci_code_CompilationResult_Mark,             "com/oracle/jvmci/code/CompilationResult$Mark"))                  \
+  JVMCI_ONLY(template(com_oracle_jvmci_code_CompilationResult_Infopoint,        "com/oracle/jvmci/code/CompilationResult$Infopoint"))             \
+  JVMCI_ONLY(template(com_oracle_jvmci_code_CompilationResult_Site,             "com/oracle/jvmci/code/CompilationResult$Site"))                  \
+  JVMCI_ONLY(template(com_oracle_jvmci_code_InfopointReason,                    "com/oracle/jvmci/code/InfopointReason"))                         \
+  JVMCI_ONLY(template(com_oracle_jvmci_code_InstalledCode,                      "com/oracle/jvmci/code/InstalledCode"))                           \
+  JVMCI_ONLY(template(com_oracle_jvmci_code_BytecodeFrame,                      "com/oracle/jvmci/code/BytecodeFrame"))                           \
+  JVMCI_ONLY(template(com_oracle_jvmci_code_BytecodePosition,                   "com/oracle/jvmci/code/BytecodePosition"))                        \
+  JVMCI_ONLY(template(com_oracle_jvmci_code_DebugInfo,                          "com/oracle/jvmci/code/DebugInfo"))                               \
+  JVMCI_ONLY(template(com_oracle_jvmci_code_Register,                           "com/oracle/jvmci/code/Register"))                                \
+  JVMCI_ONLY(template(com_oracle_jvmci_code_RegisterValue,                      "com/oracle/jvmci/code/RegisterValue"))                           \
+  JVMCI_ONLY(template(com_oracle_jvmci_code_Register_RegisterCategory,          "com/oracle/jvmci/code/Register$RegisterCategory"))               \
+  JVMCI_ONLY(template(com_oracle_jvmci_code_StackSlot,                          "com/oracle/jvmci/code/StackSlot"))                               \
+  JVMCI_ONLY(template(com_oracle_jvmci_code_StackLockValue,                     "com/oracle/jvmci/code/StackLockValue"))                          \
+  JVMCI_ONLY(template(com_oracle_jvmci_code_VirtualObject,                      "com/oracle/jvmci/code/VirtualObject"))                           \
+  JVMCI_ONLY(template(com_oracle_jvmci_code_RegisterSaveLayout,                 "com/oracle/jvmci/code/RegisterSaveLayout"))                      \
+  JVMCI_ONLY(template(com_oracle_jvmci_code_InvalidInstalledCodeException,      "com/oracle/jvmci/code/InvalidInstalledCodeException"))           \
+  JVMCI_ONLY(template(com_oracle_jvmci_code_SpeculationLog,                     "com/oracle/jvmci/code/SpeculationLog"))                          \
+  JVMCI_ONLY(template(compileMetaspaceMethod_name,                     "compileMetaspaceMethod"))                                                 \
+  JVMCI_ONLY(template(compileMetaspaceMethod_signature,                "(JIJI)V"))                                                                \
+  JVMCI_ONLY(template(com_oracle_jvmci_hotspot_Stable_signature, "Lcom/oracle/jvmci/hotspot/Stable;"))                                            \
                                                                                                   \
   /* common method and field names */                                                             \
   template(object_initializer_name,                   "<init>")                                   \
--- a/src/share/vm/code/codeBlob.hpp	Thu May 28 15:10:18 2015 -0700
+++ b/src/share/vm/code/codeBlob.hpp	Thu May 28 21:11:28 2015 -0700
@@ -105,7 +105,7 @@
 
   virtual bool is_compiled_by_c2() const         { return false; }
   virtual bool is_compiled_by_c1() const         { return false; }
-  virtual bool is_compiled_by_graal() const      { return false; }
+  virtual bool is_compiled_by_jvmci() const      { return false; }
 
   // Casting
   nmethod* as_nmethod_or_null()                  { return is_nmethod() ? (nmethod*) this : NULL; }
@@ -357,8 +357,8 @@
 
   int _unpack_with_exception_in_tls;
 
-#ifdef GRAAL
-  // (thomaswue) Offset when Graal calls uncommon_trap.
+#ifdef JVMCI
+  // (thomaswue) Offset when JVMCI calls uncommon_trap.
   int _uncommon_trap_offset;
   int _implicit_exception_uncommon_trap_offset;
 #endif
@@ -416,8 +416,8 @@
   }
   address unpack_with_exception_in_tls() const   { return code_begin() + _unpack_with_exception_in_tls; }
 
-#ifdef GRAAL
-  // (thomaswue) Offset when Graal calls uncommon_trap.
+#ifdef JVMCI
+  // (thomaswue) Offset when JVMCI calls uncommon_trap.
   void set_uncommon_trap_offset(int offset) {
     _uncommon_trap_offset = offset;
     assert(contains(code_begin() + _uncommon_trap_offset), "must be PC inside codeblob");
--- a/src/share/vm/code/compiledIC.cpp	Thu May 28 15:10:18 2015 -0700
+++ b/src/share/vm/code/compiledIC.cpp	Thu May 28 21:11:28 2015 -0700
@@ -273,12 +273,12 @@
   // Check that the cached_value is a klass for non-optimized monomorphic calls
   // This assertion is invalid for compiler1: a call that does not look optimized (no static stub) can be used
   // for calling directly to vep without using the inline cache (i.e., cached_value == NULL).
-  // For Graal this occurs because CHA is only used to improve inlining so call sites which could be optimized
+  // For JVMCI this occurs because CHA is only used to improve inlining so call sites which could be optimized
   // virtuals because there are no currently loaded subclasses of a type are left as virtual call sites.
 #ifdef ASSERT
   CodeBlob* caller = CodeCache::find_blob_unsafe(instruction_address());
-  bool is_c1_or_graal_method = caller->is_compiled_by_c1() || caller->is_compiled_by_graal();
-  assert( is_c1_or_graal_method ||
+  bool is_c1_or_jvmci_method = caller->is_compiled_by_c1() || caller->is_compiled_by_jvmci();
+  assert( is_c1_or_jvmci_method ||
          !is_monomorphic ||
          is_optimized() ||
          (cached_metadata() != NULL && cached_metadata()->is_klass()), "sanity check");
--- a/src/share/vm/code/debugInfoRec.cpp	Thu May 28 15:10:18 2015 -0700
+++ b/src/share/vm/code/debugInfoRec.cpp	Thu May 28 21:11:28 2015 -0700
@@ -37,7 +37,7 @@
   int  _offset; // location in the stream of this scope
   int  _length; // number of bytes in the stream
   int  _hash;   // hash of stream bytes (for quicker reuse)
-#ifdef GRAAL
+#ifdef JVMCI
   DebugInformationRecorder* _DIR;
 #endif
 
@@ -54,7 +54,7 @@
   DIR_Chunk(int offset, int length, DebugInformationRecorder* dir) {
     _offset = offset;
     _length = length;
-#ifdef GRAAL
+#ifdef JVMCI
     _DIR = dir;
 #endif
     unsigned int hash = 0;
@@ -84,7 +84,7 @@
     return NULL;
   }
 
-#ifdef GRAAL
+#ifdef JVMCI
   static int compare(DIR_Chunk* a, DIR_Chunk* b) {
     if (b->_hash > a->_hash) {
       return 1;
@@ -138,7 +138,7 @@
   _oop_recorder = oop_recorder;
 
   _all_chunks    = new GrowableArray<DIR_Chunk*>(300);
-#ifndef GRAAL
+#ifndef JVMCI
   _shared_chunks = new GrowableArray<DIR_Chunk*>(30);
 #endif
   _next_chunk = _next_chunk_limit = NULL;
@@ -277,7 +277,7 @@
 
   DIR_Chunk* ns = new(this) DIR_Chunk(stream_offset, stream_length, this);
 
-#ifdef GRAAL
+#ifdef JVMCI
   DIR_Chunk* match = _all_chunks->find_insert_binary<DIR_Chunk::compare>(ns);
   if (match != ns) {
     // Found an existing chunk
--- a/src/share/vm/code/debugInfoRec.hpp	Thu May 28 15:10:18 2015 -0700
+++ b/src/share/vm/code/debugInfoRec.hpp	Thu May 28 21:11:28 2015 -0700
@@ -163,7 +163,7 @@
 
   // Scopes that have been described so far.
   GrowableArray<DIR_Chunk*>* _all_chunks;
-#ifndef GRAAL
+#ifndef JVMCI
   GrowableArray<DIR_Chunk*>* _shared_chunks;
 #endif
   DIR_Chunk* _next_chunk;
--- a/src/share/vm/code/dependencies.cpp	Thu May 28 15:10:18 2015 -0700
+++ b/src/share/vm/code/dependencies.cpp	Thu May 28 21:11:28 2015 -0700
@@ -52,9 +52,9 @@
   _oop_recorder = env->oop_recorder();
   _log = env->log();
   _dep_seen = new(arena) GrowableArray<int>(arena, 500, 0, 0);
-#ifdef GRAAL
+#ifdef JVMCI
   _using_dep_values = false;
-#endif // GRAAL
+#endif // JVMCI
   DEBUG_ONLY(_deps[end_marker] = NULL);
   for (int i = (int)FIRST_TYPE; i < (int)TYPE_LIMIT; i++) {
     _deps[i] = new(arena) GrowableArray<ciBaseObject*>(arena, 10, 0, 0);
@@ -124,7 +124,7 @@
   assert_common_2(call_site_target_value, call_site, method_handle);
 }
 
-#ifdef GRAAL
+#ifdef JVMCI
 
 Dependencies::Dependencies(Arena* arena, OopRecorder* oop_recorder, CompileLog* log) {
   _oop_recorder = oop_recorder;
@@ -180,7 +180,7 @@
 void Dependencies::assert_call_site_target_value(oop call_site, oop method_handle) {
   assert_common_2(call_site_target_value, DepValue(_oop_recorder, JNIHandles::make_local(call_site)), DepValue(_oop_recorder, JNIHandles::make_local(method_handle)));
 }
-#endif // GRAAL
+#endif // JVMCI
 
 
 // Helper function.  If we are adding a new dep. under ctxk2,
@@ -294,7 +294,7 @@
   deps->append(x2);
 }
 
-#ifdef GRAAL
+#ifdef JVMCI
 bool Dependencies::maybe_merge_ctxk(GrowableArray<DepValue>* deps,
                                     int ctxk_i, DepValue ctxk2_dv) {
   Klass* ctxk1 = deps->at(ctxk_i).as_klass(_oop_recorder);
@@ -364,7 +364,7 @@
   deps->append(x0);
   deps->append(x1);
 }
-#endif // GRAAL
+#endif // JVMCI
 
 /// Support for encoding dependencies into an nmethod:
 
@@ -392,7 +392,7 @@
 static int sort_dep_arg_3(ciBaseObject** p1, ciBaseObject** p2)
 { return sort_dep(p1, p2, 3); }
 
-#ifdef GRAAL
+#ifdef JVMCI
 // metadata deps are sorted before object deps
 static int sort_dep_value(Dependencies::DepValue* p1, Dependencies::DepValue* p2, int narg) {
   for (int i = 0; i < narg; i++) {
@@ -407,10 +407,10 @@
 { return sort_dep_value(p1, p2, 2); }
 static int sort_dep_value_arg_3(Dependencies::DepValue* p1, Dependencies::DepValue* p2)
 { return sort_dep_value(p1, p2, 3); }
-#endif // GRAAL
+#endif // JVMCI
 
 void Dependencies::sort_all_deps() {
-#ifdef GRAAL
+#ifdef JVMCI
   if (_using_dep_values) {
     for (int deptv = (int)FIRST_TYPE; deptv < (int)TYPE_LIMIT; deptv++) {
       DepType dept = (DepType)deptv;
@@ -425,7 +425,7 @@
     }
     return;
   }
-#endif // GRAAL
+#endif // JVMCI
   for (int deptv = (int)FIRST_TYPE; deptv < (int)TYPE_LIMIT; deptv++) {
     DepType dept = (DepType)deptv;
     GrowableArray<ciBaseObject*>* deps = _deps[dept];
@@ -441,7 +441,7 @@
 
 size_t Dependencies::estimate_size_in_bytes() {
   size_t est_size = 100;
-#ifdef GRAAL
+#ifdef JVMCI
   if (_using_dep_values) {
     for (int deptv = (int)FIRST_TYPE; deptv < (int)TYPE_LIMIT; deptv++) {
       DepType dept = (DepType)deptv;
@@ -450,7 +450,7 @@
     }
     return est_size;
   }
-#endif // GRAAL
+#endif // JVMCI
   for (int deptv = (int)FIRST_TYPE; deptv < (int)TYPE_LIMIT; deptv++) {
     DepType dept = (DepType)deptv;
     GrowableArray<ciBaseObject*>* deps = _deps[dept];
@@ -490,7 +490,7 @@
   // cast is safe, no deps can overflow INT_MAX
   CompressedWriteStream bytes((int)estimate_size_in_bytes());
 
-#ifdef GRAAL
+#ifdef JVMCI
   if (_using_dep_values) {
     for (int deptv = (int)FIRST_TYPE; deptv < (int)TYPE_LIMIT; deptv++) {
       DepType dept = (DepType)deptv;
@@ -520,7 +520,7 @@
       }
     }
   } else {
-#endif // GRAAL
+#endif // JVMCI
   for (int deptv = (int)FIRST_TYPE; deptv < (int)TYPE_LIMIT; deptv++) {
     DepType dept = (DepType)deptv;
     GrowableArray<ciBaseObject*>* deps = _deps[dept];
@@ -554,9 +554,9 @@
       }
     }
   }
-#ifdef GRAAL
+#ifdef JVMCI
   }
-#endif // GRAAL
+#endif // JVMCI
 
   // write a sentinel byte to mark the end
   bytes.write_byte(end_marker);
--- a/src/share/vm/code/dependencies.hpp	Thu May 28 15:10:18 2015 -0700
+++ b/src/share/vm/code/dependencies.hpp	Thu May 28 21:11:28 2015 -0700
@@ -200,7 +200,7 @@
 
   static void check_valid_dependency_type(DepType dept);
 
-#ifdef GRAAL
+#ifdef JVMCI
   // A Metadata* or object value recorded in an OopRecorder
   class DepValue VALUE_OBJ_CLASS_SPEC {
    private:
@@ -249,7 +249,7 @@
   // State for writing a new set of dependencies:
   GrowableArray<int>*       _dep_seen;  // (seen[h->ident] & (1<<dept))
   GrowableArray<ciBaseObject*>*  _deps[TYPE_LIMIT];
-#ifdef GRAAL
+#ifdef JVMCI
   bool _using_dep_values;
   GrowableArray<DepValue>*  _dep_values[TYPE_LIMIT];
 #endif
@@ -271,7 +271,7 @@
     return (seen & (1<<dept)) != 0;
   }
 
-#ifdef GRAAL
+#ifdef JVMCI
   bool note_dep_seen(int dept, DepValue x) {
     assert(dept < BitsPerInt, "oops");
     // place metadata deps at even indexes, object deps at odd indexes
@@ -286,7 +286,7 @@
 
   bool maybe_merge_ctxk(GrowableArray<ciBaseObject*>* deps,
                         int ctxk_i, ciKlass* ctxk);
-#ifdef GRAAL
+#ifdef JVMCI
   bool maybe_merge_ctxk(GrowableArray<DepValue>* deps,
                         int ctxk_i, DepValue ctxk);
 #endif
@@ -311,9 +311,9 @@
   Dependencies(ciEnv* env) {
     initialize(env);
   }
-#ifdef GRAAL
+#ifdef JVMCI
   Dependencies(Arena* arena, OopRecorder* oop_recorder, CompileLog* log);
-#endif // GRAAL
+#endif // JVMCI
 
  private:
   // Check for a valid context type.
@@ -346,7 +346,7 @@
   void assert_has_no_finalizable_subclasses(ciKlass* ctxk);
   void assert_call_site_target_value(ciCallSite* call_site, ciMethodHandle* method_handle);
 
-#ifdef GRAAL
+#ifdef JVMCI
  private:
   static void check_ctxk(Klass* ctxk) {
     assert(ctxk->oop_is_instance(), "java types only");
@@ -365,7 +365,7 @@
   void assert_unique_concrete_method(Klass* ctxk, Method* uniqm);
   void assert_abstract_with_unique_concrete_subtype(Klass* ctxk, Klass* conck);
   void assert_call_site_target_value(oop callSite, oop methodHandle);
-#endif // GRAAL
+#endif // JVMCI
 
   // Define whether a given method or type is concrete.
   // These methods define the term "concrete" as used in this module.
--- a/src/share/vm/code/nmethod.cpp	Thu May 28 15:10:18 2015 -0700
+++ b/src/share/vm/code/nmethod.cpp	Thu May 28 21:11:28 2015 -0700
@@ -46,8 +46,8 @@
 #ifdef SHARK
 #include "shark/sharkCompiler.hpp"
 #endif
-#ifdef GRAAL
-#include "graal/graalJavaAccess.hpp"
+#ifdef JVMCI
+#include "jvmci/jvmciJavaAccess.hpp"
 #endif
 
 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
@@ -106,10 +106,10 @@
   }
   return compiler()->is_c1();
 }
-bool nmethod::is_compiled_by_graal() const {
+bool nmethod::is_compiled_by_jvmci() const {
   if (compiler() == NULL || method() == NULL)  return false;  // can happen during debug printing
   if (is_native_method()) return false;
-  return compiler()->is_graal();
+  return compiler()->is_jvmci();
 }
 bool nmethod::is_compiled_by_c2() const {
   if (compiler() == NULL) {
@@ -238,8 +238,8 @@
 #ifdef COMPILER2
 static java_nmethod_stats_struct c2_java_nmethod_stats;
 #endif
-#ifdef GRAAL
-static java_nmethod_stats_struct graal_java_nmethod_stats;
+#ifdef JVMCI
+static java_nmethod_stats_struct jvmci_java_nmethod_stats;
 #endif
 #ifdef SHARK
 static java_nmethod_stats_struct shark_java_nmethod_stats;
@@ -264,9 +264,9 @@
     c2_java_nmethod_stats.note_nmethod(nm);
   } else
 #endif
-#ifdef GRAAL
-  if (nm->is_compiled_by_graal()) {
-    graal_java_nmethod_stats.note_nmethod(nm);
+#ifdef JVMCI
+  if (nm->is_compiled_by_jvmci()) {
+    jvmci_java_nmethod_stats.note_nmethod(nm);
   } else
 #endif
 #ifdef SHARK
@@ -559,8 +559,8 @@
 #if INCLUDE_RTM_OPT
   _rtm_state               = NoRTM;
 #endif
-#ifdef GRAAL
-  _graal_installed_code   = NULL;
+#ifdef JVMCI
+  _jvmci_installed_code   = NULL;
   _speculation_log        = NULL;
 #endif
 #ifdef HAVE_DTRACE_H
@@ -657,7 +657,7 @@
   ImplicitExceptionTable* nul_chk_table,
   AbstractCompiler* compiler,
   int comp_level
-#ifdef GRAAL
+#ifdef JVMCI
   , Handle installed_code,
   Handle speculationLog
 #endif
@@ -684,7 +684,7 @@
             nul_chk_table,
             compiler,
             comp_level
-#ifdef GRAAL
+#ifdef JVMCI
             , installed_code,
             speculationLog
 #endif
@@ -920,7 +920,7 @@
   ImplicitExceptionTable* nul_chk_table,
   AbstractCompiler* compiler,
   int comp_level
-#ifdef GRAAL
+#ifdef JVMCI
   , Handle installed_code,
   Handle speculation_log
 #endif
@@ -948,12 +948,12 @@
     _consts_offset           = content_offset()      + code_buffer->total_offset_of(code_buffer->consts());
     _stub_offset             = content_offset()      + code_buffer->total_offset_of(code_buffer->stubs());
 
-#ifdef GRAAL
-    _graal_installed_code = installed_code();
+#ifdef JVMCI
+    _jvmci_installed_code = installed_code();
     _speculation_log = (instanceOop)speculation_log();
 
-    if (compiler->is_graal()) {
-      // Graal might not produce any stub sections
+    if (compiler->is_jvmci()) {
+      // JVMCI might not produce any stub sections
       if (offsets->value(CodeOffsets::Exceptions) != -1) {
         _exception_offset        = code_offset()          + offsets->value(CodeOffsets::Exceptions);
       } else {
@@ -981,7 +981,7 @@
       _deoptimize_mh_offset  = _stub_offset          + offsets->value(CodeOffsets::DeoptMH);
     } else {
       _deoptimize_mh_offset  = -1;
-#ifdef GRAAL
+#ifdef JVMCI
     }
 #endif
     }
@@ -1027,7 +1027,7 @@
 
     // we use the information of entry points to find out if a method is
     // static or non static
-    assert(compiler->is_c2() || compiler->is_graal() ||
+    assert(compiler->is_c2() || compiler->is_jvmci() ||
            _method->is_static() == (entry_point() == _verified_entry_point),
            " entry points must be same for static methods and vice versa");
   }
@@ -1398,7 +1398,7 @@
 }
 
 void nmethod::inc_decompile_count() {
-  if (!is_compiled_by_c2() && !is_compiled_by_graal()) return;
+  if (!is_compiled_by_c2() && !is_compiled_by_jvmci()) return;
   // Could be gated by ProfileTraps, but do not bother...
   Method* m = method();
   if (m == NULL)  return;
@@ -1475,15 +1475,15 @@
   // Unregister must be done before the state change
   Universe::heap()->unregister_nmethod(this);
 
-#ifdef GRAAL
+#ifdef JVMCI
   // The method can only be unloaded after the pointer to the installed code
   // Java wrapper is no longer alive. Here we need to clear out this weak
   // reference to the dead object. Nulling out the reference has to happen
   // after the method is unregistered since the original value may be still
   // tracked by the rset.
-  if (_graal_installed_code != NULL) {
-    InstalledCode::set_address(_graal_installed_code, 0);
-    _graal_installed_code = NULL;
+  if (_jvmci_installed_code != NULL) {
+    InstalledCode::set_address(_jvmci_installed_code, 0);
+    _jvmci_installed_code = NULL;
   }
 #endif
 
@@ -1652,10 +1652,10 @@
   } else {
     assert(state == not_entrant, "other cases may need to be handled differently");
   }
-#ifdef GRAAL
-  if (_graal_installed_code != NULL) {
+#ifdef JVMCI
+  if (_jvmci_installed_code != NULL) {
     // Break the link between nmethod and InstalledCode such that the nmethod can subsequently be flushed safely.
-    InstalledCode::set_address(_graal_installed_code, 0);
+    InstalledCode::set_address(_jvmci_installed_code, 0);
   }
 #endif
 
@@ -1964,18 +1964,18 @@
     }
   }
 
-#ifdef GRAAL
-  // Follow Graal method
+#ifdef JVMCI
+  // Follow JVMCI method
   BarrierSet* bs = Universe::heap()->barrier_set();
-  if (_graal_installed_code != NULL) {
-    if (_graal_installed_code->is_a(HotSpotNmethod::klass()) && HotSpotNmethod::isDefault(_graal_installed_code)) {
-      if (!is_alive->do_object_b(_graal_installed_code)) {
-        bs->write_ref_nmethod_pre(&_graal_installed_code, this);
-        _graal_installed_code = NULL;
-        bs->write_ref_nmethod_post(&_graal_installed_code, this);
+  if (_jvmci_installed_code != NULL) {
+    if (_jvmci_installed_code->is_a(HotSpotNmethod::klass()) && HotSpotNmethod::isDefault(_jvmci_installed_code)) {
+      if (!is_alive->do_object_b(_jvmci_installed_code)) {
+        bs->write_ref_nmethod_pre(&_jvmci_installed_code, this);
+        _jvmci_installed_code = NULL;
+        bs->write_ref_nmethod_post(&_jvmci_installed_code, this);
       }
     } else {
-      if (can_unload(is_alive, (oop*)&_graal_installed_code, unloading_occurred)) {
+      if (can_unload(is_alive, (oop*)&_jvmci_installed_code, unloading_occurred)) {
         return;
       }
     }
@@ -2101,15 +2101,15 @@
     unloading_occurred = true;
   }
 
-#ifdef GRAAL
-  // Follow Graal method
-  if (_graal_installed_code != NULL) {
-    if (_graal_installed_code->is_a(HotSpotNmethod::klass()) && HotSpotNmethod::isDefault(_graal_installed_code)) {
-      if (!is_alive->do_object_b(_graal_installed_code)) {
-        _graal_installed_code = NULL;
+#ifdef JVMCI
+  // Follow JVMCI method
+  if (_jvmci_installed_code != NULL) {
+    if (_jvmci_installed_code->is_a(HotSpotNmethod::klass()) && HotSpotNmethod::isDefault(_jvmci_installed_code)) {
+      if (!is_alive->do_object_b(_jvmci_installed_code)) {
+        _jvmci_installed_code = NULL;
       }
     } else {
-      if (can_unload(is_alive, (oop*)&_graal_installed_code, unloading_occurred)) {
+      if (can_unload(is_alive, (oop*)&_jvmci_installed_code, unloading_occurred)) {
         return false;
       }
     }
@@ -2190,18 +2190,18 @@
     return postponed;
   }
 
-#ifdef GRAAL
-  // Follow Graal method
+#ifdef JVMCI
+  // Follow JVMCI method
   BarrierSet* bs = Universe::heap()->barrier_set();
-  if (_graal_installed_code != NULL) {
-    if (_graal_installed_code->is_a(HotSpotNmethod::klass()) && HotSpotNmethod::isDefault(_graal_installed_code)) {
-      if (!is_alive->do_object_b(_graal_installed_code)) {
-        bs->write_ref_nmethod_pre(&_graal_installed_code, this);
-        _graal_installed_code = NULL;
-        bs->write_ref_nmethod_post(&_graal_installed_code, this);
+  if (_jvmci_installed_code != NULL) {
+    if (_jvmci_installed_code->is_a(HotSpotNmethod::klass()) && HotSpotNmethod::isDefault(_jvmci_installed_code)) {
+      if (!is_alive->do_object_b(_jvmci_installed_code)) {
+        bs->write_ref_nmethod_pre(&_jvmci_installed_code, this);
+        _jvmci_installed_code = NULL;
+        bs->write_ref_nmethod_post(&_jvmci_installed_code, this);
       }
     } else {
-      if (can_unload(is_alive, (oop*)&_graal_installed_code, unloading_occurred)) {
+      if (can_unload(is_alive, (oop*)&_jvmci_installed_code, unloading_occurred)) {
         is_unloaded = true;
       }
     }
@@ -2400,9 +2400,9 @@
     // (See comment above.)
   }
 
-#ifdef GRAAL
-  if (_graal_installed_code != NULL) {
-    f->do_oop((oop*) &_graal_installed_code);
+#ifdef JVMCI
+  if (_jvmci_installed_code != NULL) {
+    f->do_oop((oop*) &_jvmci_installed_code);
   }
   if (_speculation_log != NULL) {
     f->do_oop((oop*) &_speculation_log);
@@ -3057,8 +3057,8 @@
     tty->print("(c2) ");
   } else if (is_compiled_by_shark()) {
     tty->print("(shark) ");
-  } else if (is_compiled_by_graal()) {
-    tty->print("(Graal) ");
+  } else if (is_compiled_by_jvmci()) {
+    tty->print("(JVMCI) ");
   } else {
     tty->print("(nm) ");
   }
@@ -3262,9 +3262,9 @@
 void nmethod::print_nmethod_labels(outputStream* stream, address block_begin) const {
   if (block_begin == entry_point())             stream->print_cr("[Entry Point]");
   if (block_begin == verified_entry_point())    stream->print_cr("[Verified Entry Point]");
-  if (GRAAL_ONLY(_exception_offset >= 0 &&) block_begin == exception_begin())         stream->print_cr("[Exception Handler]");
+  if (JVMCI_ONLY(_exception_offset >= 0 &&) block_begin == exception_begin())         stream->print_cr("[Exception Handler]");
   if (block_begin == stub_begin())              stream->print_cr("[Stub Code]");
-  if (GRAAL_ONLY(_deoptimize_offset >= 0 &&) block_begin == deopt_handler_begin())     stream->print_cr("[Deopt Handler Code]");
+  if (JVMCI_ONLY(_deoptimize_offset >= 0 &&) block_begin == deopt_handler_begin())     stream->print_cr("[Deopt Handler Code]");
 
   if (has_method_handle_invokes())
     if (block_begin == deopt_mh_handler_begin())  stream->print_cr("[Deopt MH Handler Code]");
@@ -3510,8 +3510,8 @@
 #ifdef COMPILER2
   c2_java_nmethod_stats.print_nmethod_stats("C2");
 #endif
-#ifdef GRAAL
-  graal_java_nmethod_stats.print_nmethod_stats("Graal");
+#ifdef JVMCI
+  jvmci_java_nmethod_stats.print_nmethod_stats("JVMCI");
 #endif
 #ifdef SHARK
   shark_java_nmethod_stats.print_nmethod_stats("Shark");
@@ -3525,12 +3525,12 @@
   if (xtty != NULL)  xtty->tail("statistics");
 }
 
-#ifdef GRAAL
-char* nmethod::graal_installed_code_name(char* buf, size_t buflen) {
-  if (!this->is_compiled_by_graal()) {
+#ifdef JVMCI
+char* nmethod::jvmci_installed_code_name(char* buf, size_t buflen) {
+  if (!this->is_compiled_by_jvmci()) {
     return NULL;
   }
-  oop installedCode = this->graal_installed_code();
+  oop installedCode = this->jvmci_installed_code();
   if (installedCode != NULL) {
     oop installedCodeName = NULL;
     if (installedCode->is_a(InstalledCode::klass())) {
--- a/src/share/vm/code/nmethod.hpp	Thu May 28 15:10:18 2015 -0700
+++ b/src/share/vm/code/nmethod.hpp	Thu May 28 21:11:28 2015 -0700
@@ -126,9 +126,9 @@
   int       _entry_bci;        // != InvocationEntryBci if this nmethod is an on-stack replacement method
   jmethodID _jmethod_id;       // Cache of method()->jmethod_id()
 
-#ifdef GRAAL
+#ifdef JVMCI
   // Needed to keep nmethods alive that are not the default nmethod for the associated Method.
-  oop       _graal_installed_code;
+  oop       _jvmci_installed_code;
   oop       _speculation_log;
 #endif
 
@@ -299,7 +299,7 @@
           ImplicitExceptionTable* nul_chk_table,
           AbstractCompiler* compiler,
           int comp_level
-#ifdef GRAAL
+#ifdef JVMCI
           , Handle installed_code,
           Handle speculation_log
 #endif
@@ -340,7 +340,7 @@
                               ImplicitExceptionTable* nul_chk_table,
                               AbstractCompiler* compiler,
                               int comp_level
-#ifdef GRAAL
+#ifdef JVMCI
                               , Handle installed_code = Handle(),
                               Handle speculation_log = Handle()
 #endif
@@ -383,7 +383,7 @@
   bool is_osr_method() const                      { return _entry_bci != InvocationEntryBci; }
 
   bool is_compiled_by_c1() const;
-  bool is_compiled_by_graal() const;
+  bool is_compiled_by_jvmci() const;
   bool is_compiled_by_c2() const;
   bool is_compiled_by_shark() const;
 
@@ -626,10 +626,10 @@
   // Evolution support. We make old (discarded) compiled methods point to new Method*s.
   void set_method(Method* method) { _method = method; }
 
-#ifdef GRAAL
-  oop graal_installed_code() { return _graal_installed_code ; }
-  char* graal_installed_code_name(char* buf, size_t buflen);
-  void set_graal_installed_code(oop installed_code) { _graal_installed_code = installed_code;  }
+#ifdef JVMCI
+  oop jvmci_installed_code() { return _jvmci_installed_code ; }
+  char* jvmci_installed_code_name(char* buf, size_t buflen);
+  void set_jvmci_installed_code(oop installed_code) { _jvmci_installed_code = installed_code;  }
   oop speculation_log() { return _speculation_log ; }
   void set_speculation_log(oop speculation_log) { _speculation_log = speculation_log;  }
 #endif
@@ -695,13 +695,13 @@
   // Return true is the PC is one would expect if the frame is being deopted.
   bool is_deopt_pc      (address pc) { return is_deopt_entry(pc) || is_deopt_mh_entry(pc); }
 
-  // (thomaswue) When using graal, the address might be off by 5 (because this is the size of the call instruction.
+  // (thomaswue) When using jvmci, the address might be off by 5 (because this is the size of the call instruction.
   // (thomaswue) TODO: Replace this by a more general mechanism.
   // (sanzinger) SPARC has another offset, looked for some variable existing in HotSpot which describes this offset, but i have not
   // found anything.
   bool is_deopt_entry   (address pc) {
     return pc == deopt_handler_begin()
-#ifdef GRAAL
+#ifdef JVMCI
       || pc == deopt_handler_begin() +
 #ifdef TARGET_ARCH_sparc
   8
@@ -709,7 +709,7 @@
 #ifdef TARGET_ARCH_x86
   5
 #endif // x86
-#endif // GRAAL
+#endif // JVMCI
       ;
   }
   bool is_deopt_mh_entry(address pc) { return pc == deopt_mh_handler_begin(); }
--- a/src/share/vm/code/scopeDesc.cpp	Thu May 28 15:10:18 2015 -0700
+++ b/src/share/vm/code/scopeDesc.cpp	Thu May 28 21:11:28 2015 -0700
@@ -226,8 +226,8 @@
     }
   }
 
-#if defined(COMPILER2) || defined(GRAAL)
-  if (NOT_GRAAL(DoEscapeAnalysis &&) is_top() && _objects != NULL) {
+#if defined(COMPILER2) || defined(JVMCI)
+  if (NOT_JVMCI(DoEscapeAnalysis &&) is_top() && _objects != NULL) {
     tty->print_cr("Objects");
     for (int i = 0; i < _objects->length(); i++) {
       ObjectValue* sv = _objects->at(i)->as_ObjectValue();
@@ -237,7 +237,7 @@
       tty->cr();
     }
   }
-#endif // COMPILER2 || GRAAL
+#endif // COMPILER2 || JVMCI
 }
 
 #endif
--- a/src/share/vm/compiler/abstractCompiler.hpp	Thu May 28 15:10:18 2015 -0700
+++ b/src/share/vm/compiler/abstractCompiler.hpp	Thu May 28 21:11:28 2015 -0700
@@ -29,7 +29,7 @@
 
 typedef void (*initializer)(void);
 
-#ifdef GRAAL
+#ifdef JVMCI
 // Per-compiler statistics
 class CompilerStatistics VALUE_OBJ_CLASS_SPEC {
   friend class VMStructs;
@@ -84,12 +84,12 @@
   // The (closed set) of concrete compiler classes. Using an tag like this
   // avoids a confusing use of macros around the definition of the
   // 'is_<compiler type>' methods.
-  enum Type { c1, c2, shark, graal };
+  enum Type { c1, c2, shark, jvmci };
 
  private:
   Type _type;
 
-#ifdef GRAAL
+#ifdef JVMCI
   CompilerStatistics _stats;
 #endif
 
@@ -112,7 +112,7 @@
   bool is_c1   ()                                { return _type == c1; }
   bool is_c2   ()                                { return _type == c2; }
   bool is_shark()                                { return _type == shark; }
-  bool is_graal()                                { return _type == graal; }
+  bool is_jvmci()                                { return _type == jvmci; }
 
   // Customization
   virtual void initialize () = 0;
@@ -136,7 +136,7 @@
     ShouldNotReachHere();
   }
 
-#ifdef GRAAL
+#ifdef JVMCI
   CompilerStatistics* stats() { return &_stats; }
 #endif
 };
--- a/src/share/vm/compiler/compileBroker.cpp	Thu May 28 15:10:18 2015 -0700
+++ b/src/share/vm/compiler/compileBroker.cpp	Thu May 28 21:11:28 2015 -0700
@@ -49,10 +49,10 @@
 #ifdef COMPILER1
 #include "c1/c1_Compiler.hpp"
 #endif
-#ifdef GRAAL
-#include "graal/graalCompiler.hpp"
-#ifdef COMPILERGRAAL
-#include "graal/graalRuntime.hpp"
+#ifdef JVMCI
+#include "jvmci/jvmciCompiler.hpp"
+#ifdef COMPILERJVMCI
+#include "jvmci/jvmciRuntime.hpp"
 #include "runtime/vframe.hpp"
 #endif
 #endif
@@ -916,25 +916,25 @@
   // Set the interface to the current compiler(s).
   int c1_count = CompilationPolicy::policy()->compiler_count(CompLevel_simple);
   int c2_count = CompilationPolicy::policy()->compiler_count(CompLevel_full_optimization);
-#ifdef GRAAL
-  GraalCompiler* graal = new GraalCompiler();
+#ifdef JVMCI
+  JVMCICompiler* jvmci = new JVMCICompiler();
 #endif
 
-#if defined(COMPILERGRAAL)
-  _compilers[1] = graal;
-  if (FLAG_IS_DEFAULT(GraalThreads)) {
-    if (!TieredCompilation && FLAG_IS_DEFAULT(BootstrapGraal) || BootstrapGraal) {
-      // Graal will bootstrap so give it more threads
+#if defined(COMPILERJVMCI)
+  _compilers[1] = jvmci;
+  if (FLAG_IS_DEFAULT(JVMCIThreads)) {
+    if (!TieredCompilation && FLAG_IS_DEFAULT(BootstrapJVMCI) || BootstrapJVMCI) {
+      // JVMCI will bootstrap so give it more threads
       c2_count = MIN2(32, os::active_processor_count());
     }
   } else {
-    c2_count = GraalThreads;
+    c2_count = JVMCIThreads;
   }
-  if (FLAG_IS_DEFAULT(GraalHostThreads)) {
+  if (FLAG_IS_DEFAULT(JVMCIHostThreads)) {
   } else {
-    c1_count = GraalHostThreads;
+    c1_count = JVMCIHostThreads;
   }
-#endif // COMPILERGRAAL
+#endif // COMPILERJVMCI
 
 #ifdef COMPILER1
   if (c1_count > 0) {
@@ -1142,9 +1142,9 @@
 
 void CompileBroker::init_compiler_threads(int c1_compiler_count, int c2_compiler_count) {
   EXCEPTION_MARK;
-#if !defined(ZERO) && !defined(SHARK) && !defined(COMPILERGRAAL)
+#if !defined(ZERO) && !defined(SHARK) && !defined(COMPILERJVMCI)
   assert(c2_compiler_count > 0 || c1_compiler_count > 0, "No compilers?");
-#endif // !ZERO && !SHARK && !COMPILERGRAAL
+#endif // !ZERO && !SHARK && !COMPILERJVMCI
   // Initialize the compilation queue
   if (c2_compiler_count > 0) {
     _c2_compile_queue  = new CompileQueue("C2 CompileQueue",  MethodCompileQueue_lock);
@@ -1322,9 +1322,9 @@
     // Should this thread wait for completion of the compile?
     blocking = is_compile_blocking();
 
-#ifdef COMPILERGRAAL
+#ifdef COMPILERJVMCI
     if (blocking) {
-      // Don't allow blocking compiles for requests triggered by Graal.
+      // Don't allow blocking compiles for requests triggered by JVMCI.
       if (thread->is_Compiler_thread()) {
         blocking = false;
       }
@@ -1340,16 +1340,16 @@
         }
       }
 
-      // Don't allow blocking compilation requests to Graal
-      // if Graal itself is not yet initialized
-      if (!GraalRuntime::is_HotSpotGraalRuntime_initialized() && compiler(comp_level)->is_graal()) {
+      // Don't allow blocking compilation requests to JVMCI
+      // if JVMCI itself is not yet initialized
+      if (!JVMCIRuntime::is_HotSpotJVMCIRuntime_initialized() && compiler(comp_level)->is_jvmci()) {
         blocking = false;
       }
 
-      // Don't allow blocking compilation requests if we are in GraalRuntime::shutdown
+      // Don't allow blocking compilation requests if we are in JVMCIRuntime::shutdown
       // to avoid deadlock between compiler thread(s) and threads run at shutdown
       // such as the DestroyJavaVM thread.
-      if (GraalRuntime::shutdown_called()) {
+      if (JVMCIRuntime::shutdown_called()) {
         blocking = false;
       }
     }
@@ -2081,19 +2081,19 @@
     MutexLocker locker(Compile_lock, thread);
     system_dictionary_modification_counter = SystemDictionary::number_of_modifications();
   }
-#ifdef COMPILERGRAAL
-  if (comp != NULL && comp->is_graal()) {
-    GraalCompiler* graal = (GraalCompiler*) comp;
+#ifdef COMPILERJVMCI
+  if (comp != NULL && comp->is_jvmci()) {
+    JVMCICompiler* jvmci = (JVMCICompiler*) comp;
 
     TraceTime t1("compilation", &time);
     EventCompilation event;
 
-    GraalEnv env(task, system_dictionary_modification_counter);
-    graal->compile_method(target_handle, osr_bci, &env);
+    JVMCIEnv env(task, system_dictionary_modification_counter);
+    jvmci->compile_method(target_handle, osr_bci, &env);
 
     post_compile(thread, task, event, task->code() != NULL, NULL);
   } else
-#endif // COMPILERGRAAL
+#endif // COMPILERJVMCI
   {
 
     NoHandleMark  nhm;
@@ -2406,18 +2406,18 @@
 
     if (CITime) {
       int bytes_compiled = method->code_size() + task->num_inlined_bytecodes();
-      GRAAL_ONLY(CompilerStatistics* stats = compiler(task->comp_level())->stats();)
+      JVMCI_ONLY(CompilerStatistics* stats = compiler(task->comp_level())->stats();)
       if (is_osr) {
         _t_osr_compilation.add(time);
         _sum_osr_bytes_compiled += bytes_compiled;
-        GRAAL_ONLY(stats->_osr.update(time, bytes_compiled);)
+        JVMCI_ONLY(stats->_osr.update(time, bytes_compiled);)
       } else {
         _t_standard_compilation.add(time);
         _sum_standard_bytes_compiled += method->code_size() + task->num_inlined_bytecodes();
-        GRAAL_ONLY(stats->_standard.update(time, bytes_compiled);)
+        JVMCI_ONLY(stats->_standard.update(time, bytes_compiled);)
       }
-      GRAAL_ONLY(stats->_nmethods_size += code->total_size();)
-      GRAAL_ONLY(stats->_nmethods_code_size += code->insts_size();)
+      JVMCI_ONLY(stats->_nmethods_size += code->total_size();)
+      JVMCI_ONLY(stats->_nmethods_code_size += code->insts_size();)
     }
 
     if (UsePerfData) {
@@ -2473,7 +2473,7 @@
   }
 }
 
-#ifdef GRAAL
+#ifdef JVMCI
 void CompileBroker::print_times(AbstractCompiler* comp) {
   CompilerStatistics* stats = comp->stats();
   tty->print_cr("  %s {speed: %d bytes/s; standard: %6.3f s, %d bytes, %d methods; osr: %6.3f s, %d bytes, %d methods; nmethods_size: %d bytes; nmethods_code_size: %d bytes}",
@@ -2486,7 +2486,7 @@
 #endif
 
 void CompileBroker::print_times(bool per_compiler, bool aggregate) {
-#ifdef GRAAL
+#ifdef JVMCI
   elapsedTimer standard_compilation;
   elapsedTimer total_compilation;
   elapsedTimer osr_compilation;
@@ -2535,9 +2535,9 @@
   total_compilation.add(osr_compilation);
   total_compilation.add(standard_compilation);
 
-#ifndef COMPILERGRAAL
-  // In hosted mode, print the Graal compiler specific counters manually.
-  GraalCompiler::print_compilation_timers();
+#ifndef COMPILERJVMCI
+  // In hosted mode, print the JVMCI compiler specific counters manually.
+  JVMCICompiler::print_compilation_timers();
 #endif
 #else
   elapsedTimer standard_compilation = CompileBroker::_t_standard_compilation;
--- a/src/share/vm/compiler/compileBroker.hpp	Thu May 28 15:10:18 2015 -0700
+++ b/src/share/vm/compiler/compileBroker.hpp	Thu May 28 21:11:28 2015 -0700
@@ -456,7 +456,7 @@
   // Redefine Classes support
   static void mark_on_stack();
 
-#ifdef GRAAL
+#ifdef JVMCI
   // Print curent compilation time stats for a given compiler
   static void print_times(AbstractCompiler* comp);
 #endif
--- a/src/share/vm/compiler/disassembler.cpp	Thu May 28 15:10:18 2015 -0700
+++ b/src/share/vm/compiler/disassembler.cpp	Thu May 28 21:11:28 2015 -0700
@@ -529,12 +529,12 @@
   nm->method()->method_holder()->name()->print_symbol_on(env.output());
   env.output()->print(".");
   nm->method()->name()->print_symbol_on(env.output());
-#ifdef GRAAL
+#ifdef JVMCI
   {
     char buffer[O_BUFLEN];
-    char* graalName = nm->graal_installed_code_name(buffer, O_BUFLEN);
-    if (graalName != NULL) {
-      env.output()->print(" (%s)", graalName);
+    char* jvmciName = nm->jvmci_installed_code_name(buffer, O_BUFLEN);
+    if (jvmciName != NULL) {
+      env.output()->print(" (%s)", jvmciName);
     }
   }
 #endif
--- a/src/share/vm/compiler/oopMap.cpp	Thu May 28 15:10:18 2015 -0700
+++ b/src/share/vm/compiler/oopMap.cpp	Thu May 28 21:11:28 2015 -0700
@@ -317,7 +317,7 @@
 static void add_derived_oop(oop* base, oop* derived) {
 #ifndef TIERED
   COMPILER1_PRESENT(ShouldNotReachHere();)
-  COMPILERGRAAL_PRESENT(ShouldNotReachHere();)
+  COMPILERJVMCI_PRESENT(ShouldNotReachHere();)
 #endif // TIERED
 #ifdef COMPILER2
   DerivedPointerTable::add(derived, base);
@@ -379,7 +379,7 @@
     if (!oms.is_done()) {
 #ifndef TIERED
       COMPILER1_PRESENT(ShouldNotReachHere();)
-      COMPILERGRAAL_PRESENT(ShouldNotReachHere();)
+      COMPILERJVMCI_PRESENT(ShouldNotReachHere();)
 #endif // !TIERED
       // Protect the operation on the derived pointers.  This
       // protects the addition of derived pointers to the shared
@@ -493,7 +493,7 @@
 
   // Check that runtime stubs save all callee-saved registers
 #ifdef COMPILER2
-  assert(cb->is_compiled_by_c1() || cb->is_compiled_by_graal() || !cb->is_runtime_stub() ||
+  assert(cb->is_compiled_by_c1() || cb->is_compiled_by_jvmci() || !cb->is_runtime_stub() ||
          (nof_callee >= SAVED_ON_ENTRY_REG_COUNT || nof_callee >= C_SAVED_ON_ENTRY_REG_COUNT),
          "must save all");
 #endif // COMPILER2
@@ -507,7 +507,7 @@
 bool OopMap::has_derived_pointer() const {
 #ifndef TIERED
   COMPILER1_PRESENT(return false);
-  COMPILERGRAAL_PRESENT(return false);
+  COMPILERJVMCI_PRESENT(return false);
 #endif // !TIERED
 #ifdef COMPILER2
   OopMapStream oms((OopMap*)this,OopMapValue::derived_oop_value);
--- a/src/share/vm/gc_interface/collectedHeap.cpp	Thu May 28 15:10:18 2015 -0700
+++ b/src/share/vm/gc_interface/collectedHeap.cpp	Thu May 28 21:11:28 2015 -0700
@@ -217,8 +217,8 @@
 #ifdef COMPILER2
   _defer_initial_card_mark =    ReduceInitialCardMarks && can_elide_tlab_store_barriers()
                              && (DeferInitialCardMark || card_mark_must_follow_store());
-#elif defined GRAAL
-  _defer_initial_card_mark =   GraalDeferredInitBarriers && can_elide_tlab_store_barriers()
+#elif defined JVMCI
+  _defer_initial_card_mark =   JVMCIDeferredInitBarriers && can_elide_tlab_store_barriers()
                                && (DeferInitialCardMark || card_mark_must_follow_store());
 #else
   assert(_defer_initial_card_mark == false, "Who would set it?");
@@ -527,7 +527,7 @@
          " to threads list is doomed to failure!");
   for (JavaThread *thread = Threads::first(); thread; thread = thread->next()) {
      if (use_tlab) thread->tlab().make_parsable(retire_tlabs);
-#if defined(COMPILER2) || defined(GRAAL)
+#if defined(COMPILER2) || defined(JVMCI)
      // The deferred store barriers must all have been flushed to the
      // card-table (or other remembered set structure) before GC starts
      // processing the card-table (or other remembered set).
--- a/src/share/vm/graal/graalCodeInstaller.cpp	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,988 +0,0 @@
-/*
- * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-#include "precompiled.hpp"
-#include "code/compiledIC.hpp"
-#include "compiler/compileBroker.hpp"
-#include "compiler/disassembler.hpp"
-#include "runtime/javaCalls.hpp"
-#include "graal/graalEnv.hpp"
-#include "graal/graalCompiler.hpp"
-#include "graal/graalCodeInstaller.hpp"
-#include "graal/graalJavaAccess.hpp"
-#include "graal/graalCompilerToVM.hpp"
-#include "graal/graalRuntime.hpp"
-#include "asm/register.hpp"
-#include "classfile/vmSymbols.hpp"
-#include "code/vmreg.hpp"
-
-#ifdef TARGET_ARCH_x86
-# include "vmreg_x86.inline.hpp"
-#endif
-#ifdef TARGET_ARCH_sparc
-# include "vmreg_sparc.inline.hpp"
-#endif
-#ifdef TARGET_ARCH_zero
-# include "vmreg_zero.inline.hpp"
-#endif
-#ifdef TARGET_ARCH_arm
-# include "vmreg_arm.inline.hpp"
-#endif
-#ifdef TARGET_ARCH_ppc
-# include "vmreg_ppc.inline.hpp"
-#endif
-
-
-// frequently used constants
-// Allocate them with new so they are never destroyed (otherwise, a
-// forced exit could destroy these objects while they are still in
-// use).
-ConstantOopWriteValue* CodeInstaller::_oop_null_scope_value = new (ResourceObj::C_HEAP, mtCompiler) ConstantOopWriteValue(NULL);
-ConstantIntValue*      CodeInstaller::_int_m1_scope_value = new (ResourceObj::C_HEAP, mtCompiler) ConstantIntValue(-1);
-ConstantIntValue*      CodeInstaller::_int_0_scope_value =  new (ResourceObj::C_HEAP, mtCompiler) ConstantIntValue(0);
-ConstantIntValue*      CodeInstaller::_int_1_scope_value =  new (ResourceObj::C_HEAP, mtCompiler) ConstantIntValue(1);
-ConstantIntValue*      CodeInstaller::_int_2_scope_value =  new (ResourceObj::C_HEAP, mtCompiler) ConstantIntValue(2);
-LocationValue*         CodeInstaller::_illegal_value = new (ResourceObj::C_HEAP, mtCompiler) LocationValue(Location());
-
-Method* getMethodFromHotSpotMethod(oop hotspot_method) {
-  assert(hotspot_method != NULL && hotspot_method->is_a(HotSpotResolvedJavaMethodImpl::klass()), "sanity");
-  return asMethod(HotSpotResolvedJavaMethodImpl::metaspaceMethod(hotspot_method));
-}
-
-const int MapWordBits = 64;
-
-static int entry_value(typeArrayOop words, int i) {
-  jint words_idx = i / MapWordBits;
-  assert(words_idx >= 0 && words_idx < words->length(), "unexpected index");
-  jlong word = words->long_at(words_idx);
-  return (word >> (i % MapWordBits)) & 15LL;
-}
-
-static int fixedmap_size(oop bitset) {
-  typeArrayOop arr = HotSpotOopMap::words(bitset);
-  return arr->length() * MapWordBits;
-}
-
-static void set_vmreg_oops(OopMap* map, VMReg reg, typeArrayOop words, int idx) {
-  int value = entry_value(words, 4 * idx);
-  switch (value) {
-    case 10:
-      map->set_oop(reg);
-      break;
-    case 5:
-      map->set_narrowoop(reg);
-      map->set_narrowoop(reg->next());
-      break;
-    case 1:
-      map->set_narrowoop(reg);
-      break;
-    case 4:
-      map->set_narrowoop(reg->next());
-      break;
-    case 0:
-      break;
-    default:
-      assert(false, err_msg("unexpected bit pattern at %d = 0x%x", idx, value));
-      ShouldNotReachHere();
-  }
-}
-
-// creates a HotSpot oop map out of the byte arrays provided by DebugInfo
-static OopMap* create_oop_map(jint total_frame_size, jint parameter_count, oop debug_info) {
-  OopMap* map = new OopMap(total_frame_size, parameter_count);
-  oop reference_map = DebugInfo::referenceMap(debug_info);
-  oop register_map = HotSpotReferenceMap::registerRefMap(reference_map);
-  oop frame_map = HotSpotReferenceMap::frameRefMap(reference_map);
-  oop callee_save_info = (oop) DebugInfo::calleeSaveInfo(debug_info);
-
-  if (register_map != NULL) {
-    typeArrayOop words = HotSpotOopMap::words(register_map);
-    int mapIdx = 0;
-    for (jint i = 0; i < RegisterImpl::number_of_registers; i++) {
-      set_vmreg_oops(map, as_Register(i)->as_VMReg(), words, mapIdx);
-      mapIdx++;
-    }
-#ifdef TARGET_ARCH_x86
-    for (jint i = 0; i < XMMRegisterImpl::number_of_registers; i++) {
-      VMReg reg = as_XMMRegister(i)->as_VMReg();
-      for (jint j = 0; j < 4; j++) {
-        set_vmreg_oops(map, reg->next(2 * j), words, mapIdx++);
-      }
-    }
-#endif
-#ifdef TARGET_ARCH_sparc
-    for (jint i = 0; i < FloatRegisterImpl::number_of_registers; i++) {
-      VMReg reg = as_FloatRegister(i)->as_VMReg();
-      set_vmreg_oops(map, reg, words, mapIdx++);
-    }
-#endif
-  }
-
-  typeArrayOop words = HotSpotOopMap::words(frame_map);
-  int size = fixedmap_size(frame_map) / 4;
-  for (jint i = 0; i < size; i++) {
-    // HotSpot stack slots are 4 bytes
-    VMReg reg = VMRegImpl::stack2reg(i * VMRegImpl::slots_per_word);
-    set_vmreg_oops(map, reg, words, i);
-  }
-
-  if (callee_save_info != NULL) {
-    objArrayOop registers = RegisterSaveLayout::registers(callee_save_info);
-    typeArrayOop slots = RegisterSaveLayout::slots(callee_save_info);
-    for (jint i = 0; i < slots->length(); i++) {
-      oop graal_reg = registers->obj_at(i);
-      jint graal_reg_number = code_Register::number(graal_reg);
-      VMReg hotspot_reg = CodeInstaller::get_hotspot_reg(graal_reg_number);
-      // HotSpot stack slots are 4 bytes
-      jint graal_slot = slots->int_at(i);
-      jint hotspot_slot = graal_slot * VMRegImpl::slots_per_word;
-      VMReg hotspot_slot_as_reg = VMRegImpl::stack2reg(hotspot_slot);
-      map->set_callee_saved(hotspot_slot_as_reg, hotspot_reg);
-#ifdef _LP64
-      // (copied from generate_oop_map() in c1_Runtime1_x86.cpp)
-      VMReg hotspot_slot_hi_as_reg = VMRegImpl::stack2reg(hotspot_slot + 1);
-      map->set_callee_saved(hotspot_slot_hi_as_reg, hotspot_reg->next());
-#endif
-    }
-  }
-  return map;
-}
-
-static void record_metadata_reference(oop obj, jlong prim, jboolean compressed, OopRecorder* oop_recorder) {
-  if (obj->is_a(HotSpotResolvedObjectTypeImpl::klass())) {
-    Klass* klass = java_lang_Class::as_Klass(HotSpotResolvedObjectTypeImpl::javaClass(obj));
-    if (compressed) {
-      assert(Klass::decode_klass((narrowKlass) prim) == klass, err_msg("%s @ " INTPTR_FORMAT " != " PTR64_FORMAT, klass->name()->as_C_string(), p2i(klass), prim));
-    } else {
-      assert((Klass*) prim == klass, err_msg("%s @ " INTPTR_FORMAT " != " PTR64_FORMAT, klass->name()->as_C_string(), p2i(klass), prim));
-    }
-    int index = oop_recorder->find_index(klass);
-    TRACE_graal_3("metadata[%d of %d] = %s", index, oop_recorder->metadata_count(), klass->name()->as_C_string());
-  } else if (obj->is_a(HotSpotResolvedJavaMethodImpl::klass())) {
-    Method* method = (Method*) (address) HotSpotResolvedJavaMethodImpl::metaspaceMethod(obj);
-    assert(!compressed, err_msg("unexpected compressed method pointer %s @ " INTPTR_FORMAT " = " PTR64_FORMAT, method->name()->as_C_string(), p2i(method), prim));
-    int index = oop_recorder->find_index(method);
-    TRACE_graal_3("metadata[%d of %d] = %s", index, oop_recorder->metadata_count(), method->name()->as_C_string());
-  } else {
-    assert(java_lang_String::is_instance(obj),
-        err_msg("unexpected metadata reference (%s) for constant " JLONG_FORMAT " (" PTR64_FORMAT ")", obj->klass()->name()->as_C_string(), prim, prim));
-  }
-}
-
-// Records any Metadata values embedded in a Constant (e.g., the value returned by HotSpotResolvedObjectTypeImpl.klass()).
-static void record_metadata_in_constant(oop constant, OopRecorder* oop_recorder) {
-  if (constant->is_a(HotSpotMetaspaceConstantImpl::klass())) {
-    oop obj = HotSpotMetaspaceConstantImpl::metaspaceObject(constant);
-    jlong prim = HotSpotMetaspaceConstantImpl::primitive(constant);
-    assert(Kind::typeChar(AbstractValue::kind(constant)) == 'j', "must have word kind");
-    assert(obj != NULL, "must have an object");
-    assert(prim != 0, "must have a primitive value");
-
-    record_metadata_reference(obj, prim, false, oop_recorder);
-  }
-}
-
-static void record_metadata_in_patch(Handle& constant, OopRecorder* oop_recorder) {
-  record_metadata_reference(HotSpotMetaspaceConstantImpl::metaspaceObject(constant), HotSpotMetaspaceConstantImpl::primitive(constant), HotSpotMetaspaceConstantImpl::compressed(constant), oop_recorder);
-}
-
-ScopeValue* CodeInstaller::get_scope_value(oop value, GrowableArray<ScopeValue*>* objects, ScopeValue* &second) {
-  second = NULL;
-  if (value == AbstractValue::ILLEGAL()) {
-    return _illegal_value;
-  }
-
-  oop lirKind = AbstractValue::lirKind(value);
-  oop platformKind = LIRKind::platformKind(lirKind);
-  jint referenceMask = LIRKind::referenceMask(lirKind);
-  assert(referenceMask != -1, "derived pointers are not allowed");
-  assert(referenceMask == 0 || referenceMask == 1, "unexpected referenceMask");
-  bool reference = referenceMask == 1;
-
-  BasicType type = GraalRuntime::kindToBasicType(Kind::typeChar(platformKind));
-
-  if (value->is_a(RegisterValue::klass())) {
-    oop reg = RegisterValue::reg(value);
-    jint number = code_Register::number(reg);
-    VMReg hotspotRegister = get_hotspot_reg(number);
-    if (is_general_purpose_reg(hotspotRegister)) {
-      Location::Type locationType;
-      if (type == T_INT) {
-        locationType = reference ? Location::narrowoop : Location::int_in_long;
-      } else if(type == T_SHORT || type == T_CHAR || type == T_BYTE || type == T_BOOLEAN) {
-        locationType = Location::int_in_long;
-      } else if (type == T_FLOAT) {
-        locationType = Location::int_in_long;
-      } else if (type == T_LONG) {
-        locationType = reference ? Location::oop : Location::lng;
-      } else {
-        assert(type == T_OBJECT && reference, "unexpected type in cpu register");
-        locationType = Location::oop;
-      }
-      ScopeValue* value = new LocationValue(Location::new_reg_loc(locationType, hotspotRegister));
-      if (type == T_LONG && !reference) {
-        second = value;
-      }
-      return value;
-    } else {
-      assert(type == T_FLOAT || type == T_DOUBLE, "only float and double expected in xmm register");
-      Location::Type locationType;
-      if (type == T_FLOAT) {
-        // this seems weird, but the same value is used in c1_LinearScan
-        locationType = Location::normal;
-      } else {
-        locationType = Location::dbl;
-      }
-      assert(!reference, "unexpected type in floating point register");
-      ScopeValue* value = new LocationValue(Location::new_reg_loc(locationType, hotspotRegister));
-      if (type == T_DOUBLE) {
-        second = value;
-      }
-      return value;
-    }
-  } else if (value->is_a(StackSlot::klass())) {
-      Location::Type locationType;
-    if (type == T_LONG) {
-      locationType = reference ? Location::oop : Location::lng;
-    } else if (type == T_INT) {
-      locationType = reference ? Location::narrowoop : Location::normal;
-    } else if(type == T_SHORT || type == T_CHAR || type == T_BYTE || type == T_BOOLEAN) {
-      locationType = Location::normal;
-    } else if (type == T_FLOAT) {
-      assert(!reference, "unexpected type in stack slot");
-      locationType = Location::normal;
-    } else if (type == T_DOUBLE) {
-      assert(!reference, "unexpected type in stack slot");
-      locationType = Location::dbl;
-    } else {
-      assert(type == T_OBJECT && reference, "unexpected type in stack slot");
-      locationType = Location::oop;
-    }
-    jint offset = StackSlot::offset(value);
-#ifdef TARGET_ARCH_sparc
-    if(offset >= 0) {
-      offset += 128;
-    }
-#endif
-    if (StackSlot::addFrameSize(value)) {
-      offset += _total_frame_size;
-    }
-    ScopeValue* value = new LocationValue(Location::new_stk_loc(locationType, offset));
-    if (type == T_DOUBLE || (type == T_LONG && !reference)) {
-      second = value;
-    }
-    return value;
-  } else if (value->is_a(JavaConstant::klass())){
-    record_metadata_in_constant(value, _oop_recorder);
-    if (value->is_a(PrimitiveConstant::klass())) {
-      assert(!reference, "unexpected primitive constant type");
-      if(value->is_a(RawConstant::klass())) {
-        jlong prim = PrimitiveConstant::primitive(value);
-        return new ConstantLongValue(prim);
-      } else if (type == T_INT || type == T_FLOAT) {
-        jint prim = (jint)PrimitiveConstant::primitive(value);
-        switch (prim) {
-          case -1: return _int_m1_scope_value;
-          case  0: return _int_0_scope_value;
-          case  1: return _int_1_scope_value;
-          case  2: return _int_2_scope_value;
-          default: return new ConstantIntValue(prim);
-        }
-      } else {
-        assert(type == T_LONG || type == T_DOUBLE, "unexpected primitive constant type");
-        jlong prim = PrimitiveConstant::primitive(value);
-        second = _int_1_scope_value;
-        return new ConstantLongValue(prim);
-      }
-    } else {
-        assert(reference, "unexpected object constant type");
-      if (value->is_a(NullConstant::klass()) || value->is_a(HotSpotCompressedNullConstant::klass())) {
-        return _oop_null_scope_value;
-      } else {
-        assert(value->is_a(HotSpotObjectConstantImpl::klass()), "unexpected constant type");
-        oop obj = HotSpotObjectConstantImpl::object(value);
-        assert(obj != NULL, "null value must be in NullConstant");
-        return new ConstantOopWriteValue(JNIHandles::make_local(obj));
-      }
-    }
-  } else if (value->is_a(VirtualObject::klass())) {
-    int id = VirtualObject::id(value);
-    ScopeValue* object = objects->at(id);
-    assert(object != NULL, "missing value");
-    return object;
-  } else {
-    value->klass()->print();
-    value->print();
-  }
-  ShouldNotReachHere();
-  return NULL;
-}
-
-void CodeInstaller::record_object_value(ObjectValue* sv, oop value, GrowableArray<ScopeValue*>* objects) {
-  oop type = VirtualObject::type(value);
-  int id = VirtualObject::id(value);
-  oop javaMirror = HotSpotResolvedObjectTypeImpl::javaClass(type);
-  Klass* klass = java_lang_Class::as_Klass(javaMirror);
-  bool isLongArray = klass == Universe::longArrayKlassObj();
-
-  objArrayOop values = VirtualObject::values(value);
-  for (jint i = 0; i < values->length(); i++) {
-    ScopeValue* cur_second = NULL;
-    oop object = values->obj_at(i);
-    ScopeValue* value = get_scope_value(object, objects, cur_second);
-
-    if (isLongArray && cur_second == NULL) {
-      // we're trying to put ints into a long array... this isn't really valid, but it's used for some optimizations.
-      // add an int 0 constant
-      cur_second = _int_0_scope_value;
-    }
-
-    if (cur_second != NULL) {
-      sv->field_values()->append(cur_second);
-    }
-    assert(value != NULL, "missing value");
-    sv->field_values()->append(value);
-  }
-}
-
-MonitorValue* CodeInstaller::get_monitor_value(oop value, GrowableArray<ScopeValue*>* objects) {
-  guarantee(value->is_a(StackLockValue::klass()), "Monitors must be of type MonitorValue");
-
-  ScopeValue* second = NULL;
-  ScopeValue* owner_value = get_scope_value(StackLockValue::owner(value), objects, second);
-  assert(second == NULL, "monitor cannot occupy two stack slots");
-
-  ScopeValue* lock_data_value = get_scope_value(StackLockValue::slot(value), objects, second);
-  assert(second == lock_data_value, "monitor is LONG value that occupies two stack slots");
-  assert(lock_data_value->is_location(), "invalid monitor location");
-  Location lock_data_loc = ((LocationValue*)lock_data_value)->location();
-
-  bool eliminated = false;
-  if (StackLockValue::eliminated(value)) {
-    eliminated = true;
-  }
-
-  return new MonitorValue(owner_value, lock_data_loc, eliminated);
-}
-
-void CodeInstaller::initialize_dependencies(oop compiled_code) {
-  JavaThread* thread = JavaThread::current();
-  CompilerThread* compilerThread = thread->is_Compiler_thread() ? thread->as_CompilerThread() : NULL;
-  _oop_recorder = new OopRecorder(&_arena, true);
-  _dependencies = new Dependencies(&_arena, _oop_recorder, compilerThread != NULL ? compilerThread->log() : NULL);
-  objArrayHandle assumptions = HotSpotCompiledCode::assumptions(compiled_code);
-  if (!assumptions.is_null()) {
-    int length = assumptions->length();
-    for (int i = 0; i < length; ++i) {
-      Handle assumption = assumptions->obj_at(i);
-      if (!assumption.is_null()) {
-        if (assumption->klass() == Assumptions_NoFinalizableSubclass::klass()) {
-          assumption_NoFinalizableSubclass(assumption);
-        } else if (assumption->klass() == Assumptions_ConcreteSubtype::klass()) {
-          assumption_ConcreteSubtype(assumption);
-        } else if (assumption->klass() == Assumptions_LeafType::klass()) {
-          assumption_LeafType(assumption);
-        } else if (assumption->klass() == Assumptions_ConcreteMethod::klass()) {
-          assumption_ConcreteMethod(assumption);
-        } else if (assumption->klass() == Assumptions_CallSiteTargetValue::klass()) {
-          assumption_CallSiteTargetValue(assumption);
-        } else {
-          assumption->print();
-          fatal("unexpected Assumption subclass");
-        }
-      }
-    }
-  }
-  objArrayHandle methods = HotSpotCompiledCode::methods(compiled_code);
-  if (!methods.is_null()) {
-    int length = methods->length();
-    for (int i = 0; i < length; ++i) {
-      Handle method_handle = methods->obj_at(i);
-      methodHandle method = getMethodFromHotSpotMethod(method_handle());
-      _dependencies->assert_evol_method(method());
-    }
-  }
-}
-
-// constructor used to create a method
-GraalEnv::CodeInstallResult CodeInstaller::install(Handle& compiled_code, CodeBlob*& cb, Handle installed_code, Handle speculation_log) {
-  BufferBlob* buffer_blob = GraalRuntime::initialize_buffer_blob();
-  if (buffer_blob == NULL) {
-    return GraalEnv::cache_full;
-  }
-
-  CodeBuffer buffer(buffer_blob);
-  jobject compiled_code_obj = JNIHandles::make_local(compiled_code());
-  initialize_dependencies(JNIHandles::resolve(compiled_code_obj));
-
-  // Get instructions and constants CodeSections early because we need it.
-  _instructions = buffer.insts();
-  _constants = buffer.consts();
-
-  {
-    initialize_fields(JNIHandles::resolve(compiled_code_obj));
-    if (!initialize_buffer(buffer)) {
-      return GraalEnv::code_too_large;
-    }
-    process_exception_handlers();
-  }
-
-  int stack_slots = _total_frame_size / HeapWordSize; // conversion to words
-
-  GraalEnv::CodeInstallResult result;
-  if (compiled_code->is_a(HotSpotCompiledRuntimeStub::klass())) {
-    oop stubName = HotSpotCompiledRuntimeStub::stubName(compiled_code);
-    char* name = strdup(java_lang_String::as_utf8_string(stubName));
-    cb = RuntimeStub::new_runtime_stub(name,
-                                       &buffer,
-                                       CodeOffsets::frame_never_safe,
-                                       stack_slots,
-                                       _debug_recorder->_oopmaps,
-                                       false);
-    result = GraalEnv::ok;
-  } else {
-    nmethod* nm = NULL;
-    methodHandle method = getMethodFromHotSpotMethod(HotSpotCompiledNmethod::method(compiled_code));
-    jint entry_bci = HotSpotCompiledNmethod::entryBCI(compiled_code);
-    jint id = HotSpotCompiledNmethod::id(compiled_code);
-    GraalEnv* env = (GraalEnv*) (address) HotSpotCompiledNmethod::graalEnv(compiled_code);
-    if (id == -1) {
-      // Make sure a valid compile_id is associated with every compile
-      id = CompileBroker::assign_compile_id_unlocked(Thread::current(), method, entry_bci);
-    }
-    result = GraalEnv::register_method(method, nm, entry_bci, &_offsets, _custom_stack_area_offset, &buffer, stack_slots, _debug_recorder->_oopmaps, &_exception_handler_table,
-        GraalCompiler::instance(), _debug_recorder, _dependencies, env, id, false, installed_code, compiled_code, speculation_log);
-    cb = nm;
-  }
-
-  if (cb != NULL) {
-    // Make sure the pre-calculated constants section size was correct.
-    guarantee((cb->code_begin() - cb->content_begin()) >= _constants_size, err_msg("%d < %d", (int)(cb->code_begin() - cb->content_begin()), _constants_size));
-  }
-  return result;
-}
-
-void CodeInstaller::initialize_fields(oop compiled_code) {
-  if (compiled_code->is_a(HotSpotCompiledNmethod::klass())) {
-    Handle hotspotJavaMethod = HotSpotCompiledNmethod::method(compiled_code);
-    methodHandle method = getMethodFromHotSpotMethod(hotspotJavaMethod());
-    _parameter_count = method->size_of_parameters();
-    TRACE_graal_1("installing code for %s", method->name_and_sig_as_C_string());
-  } else {
-    assert(compiled_code->is_a(HotSpotCompiledRuntimeStub::klass()), "CCE");
-    // TODO (ds) not sure if this is correct - only used in OopMap constructor for non-product builds
-    _parameter_count = 0;
-  }
-  _sites_handle = JNIHandles::make_local(HotSpotCompiledCode::sites(compiled_code));
-  _exception_handlers_handle = JNIHandles::make_local(HotSpotCompiledCode::exceptionHandlers(compiled_code));
-
-  _code_handle = JNIHandles::make_local(HotSpotCompiledCode::targetCode(compiled_code));
-  _code_size = HotSpotCompiledCode::targetCodeSize(compiled_code);
-  _total_frame_size = HotSpotCompiledCode::totalFrameSize(compiled_code);
-  _custom_stack_area_offset = HotSpotCompiledCode::customStackAreaOffset(compiled_code);
-
-  // Pre-calculate the constants section size.  This is required for PC-relative addressing.
-  _data_section_handle = JNIHandles::make_local(HotSpotCompiledCode::dataSection(compiled_code));
-  guarantee(HotSpotCompiledCode::dataSectionAlignment(compiled_code) <= _constants->alignment(), "Alignment inside constants section is restricted by alignment of section begin");
-  _constants_size = data_section()->length();
-
-  _data_section_patches_handle = JNIHandles::make_local(HotSpotCompiledCode::dataSectionPatches(compiled_code));
-
-#ifndef PRODUCT
-  _comments_handle = JNIHandles::make_local(HotSpotCompiledCode::comments(compiled_code));
-#endif
-
-  _next_call_type = INVOKE_INVALID;
-}
-
-int CodeInstaller::estimate_stub_entries() {
-  // Estimate the number of static call stubs that might be emitted.
-  int static_call_stubs = 0;
-  objArrayOop sites = this->sites();
-  for (int i = 0; i < sites->length(); i++) {
-    oop site = sites->obj_at(i);
-    if (site->is_a(CompilationResult_Mark::klass())) {
-      oop id_obj = CompilationResult_Mark::id(site);
-      if (id_obj != NULL) {
-        assert(java_lang_boxing_object::is_instance(id_obj, T_INT), "Integer id expected");
-        jint id = id_obj->int_field(java_lang_boxing_object::value_offset_in_bytes(T_INT));
-        if (id == INVOKESTATIC || id == INVOKESPECIAL) {
-          static_call_stubs++;
-        }
-      }
-    }
-  }
-  return static_call_stubs;
-}
-
-// perform data and call relocation on the CodeBuffer
-bool CodeInstaller::initialize_buffer(CodeBuffer& buffer) {
-  HandleMark hm;
-  objArrayHandle sites = this->sites();
-  int locs_buffer_size = sites->length() * (relocInfo::length_limit + sizeof(relocInfo));
-  char* locs_buffer = NEW_RESOURCE_ARRAY(char, locs_buffer_size);
-  buffer.insts()->initialize_shared_locs((relocInfo*)locs_buffer, locs_buffer_size / sizeof(relocInfo));
-  // Allocate enough space in the stub section for the static call
-  // stubs.  Stubs have extra relocs but they are managed by the stub
-  // section itself so they don't need to be accounted for in the
-  // locs_buffer above.
-  buffer.initialize_stubs_size(estimate_stub_entries() * CompiledStaticCall::to_interp_stub_size());
-  buffer.initialize_consts_size(_constants_size);
-
-  _debug_recorder = new DebugInformationRecorder(_oop_recorder);
-  _debug_recorder->set_oopmaps(new OopMapSet());
-
-  buffer.initialize_oop_recorder(_oop_recorder);
-
-  // copy the constant data into the newly created CodeBuffer
-  address end_data = _constants->start() + _constants_size;
-  memcpy(_constants->start(), data_section()->base(T_BYTE), _constants_size);
-  _constants->set_end(end_data);
-
-  // copy the code into the newly created CodeBuffer
-  address end_pc = _instructions->start() + _code_size;
-  if (!_instructions->allocates2(end_pc)) {
-    return false;
-  }
-  memcpy(_instructions->start(), code()->base(T_BYTE), _code_size);
-  _instructions->set_end(end_pc);
-
-  for (int i = 0; i < data_section_patches()->length(); i++) {
-    Handle patch = data_section_patches()->obj_at(i);
-    Handle reference = CompilationResult_DataPatch::reference(patch);
-    assert(reference->is_a(CompilationResult_ConstantReference::klass()), err_msg("patch in data section must be a ConstantReference"));
-    Handle constant = CompilationResult_ConstantReference::constant(reference);
-    if (constant->is_a(HotSpotMetaspaceConstantImpl::klass())) {
-      record_metadata_in_patch(constant, _oop_recorder);
-    } else if (constant->is_a(HotSpotObjectConstantImpl::klass())) {
-      Handle obj = HotSpotObjectConstantImpl::object(constant);
-      jobject value = JNIHandles::make_local(obj());
-      int oop_index = _oop_recorder->find_index(value);
-
-      address dest = _constants->start() + CompilationResult_Site::pcOffset(patch);
-      if (HotSpotObjectConstantImpl::compressed(constant)) {
-#ifdef _LP64
-        _constants->relocate(dest, oop_Relocation::spec(oop_index), relocInfo::narrow_oop_in_const);
-#else
-        fatal("unexpected compressed oop in 32-bit mode");
-#endif
-      } else {
-        _constants->relocate(dest, oop_Relocation::spec(oop_index));
-      }
-    } else {
-      ShouldNotReachHere();
-    }
-  }
-  jint last_pc_offset = -1;
-  for (int i = 0; i < sites->length(); i++) {
-    {
-        No_Safepoint_Verifier no_safepoint;
-        oop site = sites->obj_at(i);
-        jint pc_offset = CompilationResult_Site::pcOffset(site);
-
-        if (site->is_a(CompilationResult_Call::klass())) {
-          TRACE_graal_4("call at %i", pc_offset);
-          site_Call(buffer, pc_offset, site);
-        } else if (site->is_a(CompilationResult_Infopoint::klass())) {
-          // three reasons for infopoints denote actual safepoints
-          oop reason = CompilationResult_Infopoint::reason(site);
-          if (InfopointReason::SAFEPOINT() == reason || InfopointReason::CALL() == reason || InfopointReason::IMPLICIT_EXCEPTION() == reason) {
-            TRACE_graal_4("safepoint at %i", pc_offset);
-            site_Safepoint(buffer, pc_offset, site);
-          } else {
-            // if the infopoint is not an actual safepoint, it must have one of the other reasons
-            // (safeguard against new safepoint types that require handling above)
-            assert(InfopointReason::METHOD_START() == reason || InfopointReason::METHOD_END() == reason || InfopointReason::LINE_NUMBER() == reason, "");
-            site_Infopoint(buffer, pc_offset, site);
-          }
-        } else if (site->is_a(CompilationResult_DataPatch::klass())) {
-          TRACE_graal_4("datapatch at %i", pc_offset);
-          site_DataPatch(buffer, pc_offset, site);
-        } else if (site->is_a(CompilationResult_Mark::klass())) {
-          TRACE_graal_4("mark at %i", pc_offset);
-          site_Mark(buffer, pc_offset, site);
-        } else {
-          fatal("unexpected Site subclass");
-        }
-        last_pc_offset = pc_offset;
-    }
-    if (CodeInstallSafepointChecks && SafepointSynchronize::do_call_back()) {
-      // this is a hacky way to force a safepoint check but nothing else was jumping out at me.
-      ThreadToNativeFromVM ttnfv(JavaThread::current());
-    }
-  }
-
-#ifndef PRODUCT
-  if (comments() != NULL) {
-    No_Safepoint_Verifier no_safepoint;
-    for (int i = 0; i < comments()->length(); i++) {
-      oop comment = comments()->obj_at(i);
-      assert(comment->is_a(HotSpotCompiledCode_Comment::klass()), "cce");
-      jint offset = HotSpotCompiledCode_Comment::pcOffset(comment);
-      char* text = java_lang_String::as_utf8_string(HotSpotCompiledCode_Comment::text(comment));
-      buffer.block_comment(offset, text);
-    }
-  }
-#endif
-  return true;
-}
-
-void CodeInstaller::assumption_NoFinalizableSubclass(Handle assumption) {
-  Handle receiverType_handle = Assumptions_NoFinalizableSubclass::receiverType(assumption());
-  Klass* receiverType = java_lang_Class::as_Klass(HotSpotResolvedObjectTypeImpl::javaClass(receiverType_handle));
-  _dependencies->assert_has_no_finalizable_subclasses(receiverType);
-}
-
-void CodeInstaller::assumption_ConcreteSubtype(Handle assumption) {
-  Handle context_handle = Assumptions_ConcreteSubtype::context(assumption());
-  Handle subtype_handle = Assumptions_ConcreteSubtype::subtype(assumption());
-  Klass* context = java_lang_Class::as_Klass(HotSpotResolvedObjectTypeImpl::javaClass(context_handle));
-  Klass* subtype = java_lang_Class::as_Klass(HotSpotResolvedObjectTypeImpl::javaClass(subtype_handle));
-
-  assert(context->is_abstract(), "");
-  _dependencies->assert_abstract_with_unique_concrete_subtype(context, subtype);
-}
-
-void CodeInstaller::assumption_LeafType(Handle assumption) {
-  Handle context_handle = Assumptions_LeafType::context(assumption());
-  Klass* context = java_lang_Class::as_Klass(HotSpotResolvedObjectTypeImpl::javaClass(context_handle));
-
-  _dependencies->assert_leaf_type(context);
-}
-
-void CodeInstaller::assumption_ConcreteMethod(Handle assumption) {
-  Handle impl_handle = Assumptions_ConcreteMethod::impl(assumption());
-  Handle context_handle = Assumptions_ConcreteMethod::context(assumption());
-
-  methodHandle impl = getMethodFromHotSpotMethod(impl_handle());
-  Klass* context = java_lang_Class::as_Klass(HotSpotResolvedObjectTypeImpl::javaClass(context_handle));
-
-  _dependencies->assert_unique_concrete_method(context, impl());
-}
-
-void CodeInstaller::assumption_CallSiteTargetValue(Handle assumption) {
-  Handle callSite = Assumptions_CallSiteTargetValue::callSite(assumption());
-  Handle methodHandle = Assumptions_CallSiteTargetValue::methodHandle(assumption());
-
-  _dependencies->assert_call_site_target_value(callSite(), methodHandle());
-}
-
-void CodeInstaller::process_exception_handlers() {
-  if (exception_handlers() != NULL) {
-    objArrayOop handlers = exception_handlers();
-    for (int i = 0; i < handlers->length(); i++) {
-      oop exc = handlers->obj_at(i);
-      jint pc_offset = CompilationResult_Site::pcOffset(exc);
-      jint handler_offset = CompilationResult_ExceptionHandler::handlerPos(exc);
-
-      // Subtable header
-      _exception_handler_table.add_entry(HandlerTableEntry(1, pc_offset, 0));
-
-      // Subtable entry
-      _exception_handler_table.add_entry(HandlerTableEntry(-1, handler_offset, 0));
-    }
-  }
-}
-
-// If deoptimization happens, the interpreter should reexecute these bytecodes.
-// This function mainly helps the compilers to set up the reexecute bit.
-static bool bytecode_should_reexecute(Bytecodes::Code code) {
-  switch (code) {
-    case Bytecodes::_invokedynamic:
-    case Bytecodes::_invokevirtual:
-    case Bytecodes::_invokeinterface:
-    case Bytecodes::_invokespecial:
-    case Bytecodes::_invokestatic:
-      return false;
-    default:
-      return true;
-    }
-  return true;
-}
-
-GrowableArray<ScopeValue*>* CodeInstaller::record_virtual_objects(oop debug_info) {
-  objArrayOop virtualObjects = DebugInfo::virtualObjectMapping(debug_info);
-  if (virtualObjects == NULL) {
-    return NULL;
-  }
-  GrowableArray<ScopeValue*>* objects = new GrowableArray<ScopeValue*>(virtualObjects->length(), virtualObjects->length(), NULL);
-  // Create the unique ObjectValues
-  for (int i = 0; i < virtualObjects->length(); i++) {
-    oop value = virtualObjects->obj_at(i);
-    int id = VirtualObject::id(value);
-    oop type = VirtualObject::type(value);
-    oop javaMirror = HotSpotResolvedObjectTypeImpl::javaClass(type);
-    ObjectValue* sv = new ObjectValue(id, new ConstantOopWriteValue(JNIHandles::make_local(Thread::current(), javaMirror)));
-    assert(objects->at(id) == NULL, "once");
-    objects->at_put(id, sv);
-  }
-  // All the values which could be referenced by the VirtualObjects
-  // exist, so now describe all the VirtualObjects themselves.
-  for (int i = 0; i < virtualObjects->length(); i++) {
-    oop value = virtualObjects->obj_at(i);
-    int id = VirtualObject::id(value);
-    record_object_value(objects->at(id)->as_ObjectValue(), value, objects);
-  }
-  _debug_recorder->dump_object_pool(objects);
-  return objects;
-}
-
-void CodeInstaller::record_scope(jint pc_offset, oop debug_info) {
-  oop position = DebugInfo::bytecodePosition(debug_info);
-  if (position == NULL) {
-    // Stubs do not record scope info, just oop maps
-    return;
-  }
-  
-  GrowableArray<ScopeValue*>* objectMapping = record_virtual_objects(debug_info);
-  record_scope(pc_offset, position, objectMapping);
-}
-
-void CodeInstaller::record_scope(jint pc_offset, oop position, GrowableArray<ScopeValue*>* objects) {
-  oop frame = NULL;
-  if (position->is_a(BytecodeFrame::klass())) {
-    frame = position;
-  }
-  oop caller_frame = BytecodePosition::caller(position);
-  if (caller_frame != NULL) {
-    record_scope(pc_offset, caller_frame, objects);
-  }
-
-  oop hotspot_method = BytecodePosition::method(position);
-  Method* method = getMethodFromHotSpotMethod(hotspot_method);
-  jint bci = BytecodePosition::bci(position);
-  if (bci == BytecodeFrame::BEFORE_BCI()) {
-    bci = SynchronizationEntryBCI;
-  }
-
-  if (TraceGraal >= 2) {
-    tty->print_cr("Recording scope pc_offset=%d bci=%d method=%s", pc_offset, bci, method->name_and_sig_as_C_string());
-  }
-
-  bool reexecute = false;
-  if (frame != NULL) {
-    if (bci == SynchronizationEntryBCI){
-       reexecute = false;
-    } else {
-      Bytecodes::Code code = Bytecodes::java_code_at(method, method->bcp_from(bci));
-      reexecute = bytecode_should_reexecute(code);
-      if (frame != NULL) {
-        reexecute = (BytecodeFrame::duringCall(frame) == JNI_FALSE);
-      }
-    }
-  }
-
-  DebugToken* locals_token = NULL;
-  DebugToken* expressions_token = NULL;
-  DebugToken* monitors_token = NULL;
-  bool throw_exception = false;
-
-  if (frame != NULL) {
-    jint local_count = BytecodeFrame::numLocals(frame);
-    jint expression_count = BytecodeFrame::numStack(frame);
-    jint monitor_count = BytecodeFrame::numLocks(frame);
-    objArrayOop values = BytecodeFrame::values(frame);
-
-    assert(local_count + expression_count + monitor_count == values->length(), "unexpected values length");
-
-    GrowableArray<ScopeValue*>* locals = local_count > 0 ? new GrowableArray<ScopeValue*> (local_count) : NULL;
-    GrowableArray<ScopeValue*>* expressions = expression_count > 0 ? new GrowableArray<ScopeValue*> (expression_count) : NULL;
-    GrowableArray<MonitorValue*>* monitors = monitor_count > 0 ? new GrowableArray<MonitorValue*> (monitor_count) : NULL;
-
-    if (TraceGraal >= 2) {
-      tty->print_cr("Scope at bci %d with %d values", bci, values->length());
-      tty->print_cr("%d locals %d expressions, %d monitors", local_count, expression_count, monitor_count);
-    }
-
-    for (jint i = 0; i < values->length(); i++) {
-      ScopeValue* second = NULL;
-      oop value = values->obj_at(i);
-      if (i < local_count) {
-        ScopeValue* first = get_scope_value(value, objects, second);
-        if (second != NULL) {
-          locals->append(second);
-        }
-        locals->append(first);
-      } else if (i < local_count + expression_count) {
-        ScopeValue* first = get_scope_value(value, objects, second);
-        if (second != NULL) {
-          expressions->append(second);
-        }
-        expressions->append(first);
-      } else {
-        monitors->append(get_monitor_value(value, objects));
-      }
-      if (second != NULL) {
-        i++;
-        assert(i < values->length(), "double-slot value not followed by Value.ILLEGAL");
-        assert(values->obj_at(i) == AbstractValue::ILLEGAL(), "double-slot value not followed by Value.ILLEGAL");
-      }
-    }
-
-    locals_token = _debug_recorder->create_scope_values(locals);
-    expressions_token = _debug_recorder->create_scope_values(expressions);
-    monitors_token = _debug_recorder->create_monitor_values(monitors);
-
-    throw_exception = BytecodeFrame::rethrowException(frame) == JNI_TRUE;
-  }
-
-  _debug_recorder->describe_scope(pc_offset, method, NULL, bci, reexecute, throw_exception, false, false,
-                                  locals_token, expressions_token, monitors_token);
-}
-
-void CodeInstaller::site_Safepoint(CodeBuffer& buffer, jint pc_offset, oop site) {
-  oop debug_info = CompilationResult_Infopoint::debugInfo(site);
-  assert(debug_info != NULL, "debug info expected");
-
-  // address instruction = _instructions->start() + pc_offset;
-  // jint next_pc_offset = Assembler::locate_next_instruction(instruction) - _instructions->start();
-  _debug_recorder->add_safepoint(pc_offset, create_oop_map(_total_frame_size, _parameter_count, debug_info));
-  record_scope(pc_offset, debug_info);
-  _debug_recorder->end_safepoint(pc_offset);
-}
-
-void CodeInstaller::site_Infopoint(CodeBuffer& buffer, jint pc_offset, oop site) {
-  oop debug_info = CompilationResult_Infopoint::debugInfo(site);
-  assert(debug_info != NULL, "debug info expected");
-
-  _debug_recorder->add_non_safepoint(pc_offset);
-  record_scope(pc_offset, debug_info);
-  _debug_recorder->end_non_safepoint(pc_offset);
-}
-
-void CodeInstaller::site_Call(CodeBuffer& buffer, jint pc_offset, oop site) {
-  oop target = CompilationResult_Call::target(site);
-  InstanceKlass* target_klass = InstanceKlass::cast(target->klass());
-
-  oop hotspot_method = NULL; // JavaMethod
-  oop foreign_call = NULL;
-
-  if (target_klass->is_subclass_of(SystemDictionary::HotSpotForeignCallLinkageImpl_klass())) {
-    foreign_call = target;
-  } else {
-    hotspot_method = target;
-  }
-
-  oop debug_info = CompilationResult_Call::debugInfo(site);
-
-  assert(!!hotspot_method ^ !!foreign_call, "Call site needs exactly one type");
-
-  NativeInstruction* inst = nativeInstruction_at(_instructions->start() + pc_offset);
-  jint next_pc_offset = CodeInstaller::pd_next_offset(inst, pc_offset, hotspot_method);
-
-  if (debug_info != NULL) {
-    _debug_recorder->add_safepoint(next_pc_offset, create_oop_map(_total_frame_size, _parameter_count, debug_info));
-    record_scope(next_pc_offset, debug_info);
-  }
-
-  if (foreign_call != NULL) {
-    jlong foreign_call_destination = HotSpotForeignCallLinkageImpl::address(foreign_call);
-    CodeInstaller::pd_relocate_ForeignCall(inst, foreign_call_destination);
-  } else { // method != NULL
-    assert(hotspot_method != NULL, "unexpected JavaMethod");
-    assert(debug_info != NULL, "debug info expected");
-
-    TRACE_graal_3("method call");
-    CodeInstaller::pd_relocate_JavaMethod(hotspot_method, pc_offset);
-    if (_next_call_type == INVOKESTATIC || _next_call_type == INVOKESPECIAL) {
-      // Need a static call stub for transitions from compiled to interpreted.
-      CompiledStaticCall::emit_to_interp_stub(buffer, _instructions->start() + pc_offset);
-    }
-  }
-
-  _next_call_type = INVOKE_INVALID;
-
-  if (debug_info != NULL) {
-    _debug_recorder->end_safepoint(next_pc_offset);
-  }
-}
-
-void CodeInstaller::site_DataPatch(CodeBuffer& buffer, jint pc_offset, oop site) {
-  oop reference = CompilationResult_DataPatch::reference(site);
-  if (reference->is_a(CompilationResult_ConstantReference::klass())) {
-    Handle constant = CompilationResult_ConstantReference::constant(reference);
-    if (constant->is_a(HotSpotObjectConstantImpl::klass())) {
-      pd_patch_OopConstant(pc_offset, constant);
-    } else if (constant->is_a(HotSpotMetaspaceConstantImpl::klass())) {
-      record_metadata_in_patch(constant, _oop_recorder);
-    } else {
-      fatal("unknown constant type in data patch");
-    }
-  } else if (reference->is_a(CompilationResult_DataSectionReference::klass())) {
-    int data_offset = CompilationResult_DataSectionReference::offset(reference);
-    assert(0 <= data_offset && data_offset < _constants_size, err_msg("data offset 0x%X points outside data section (size 0x%X)", data_offset, _constants_size));
-    pd_patch_DataSectionReference(pc_offset, data_offset);
-  } else {
-    fatal("unknown data patch type");
-  }
-}
-
-void CodeInstaller::site_Mark(CodeBuffer& buffer, jint pc_offset, oop site) {
-  oop id_obj = CompilationResult_Mark::id(site);
-
-  if (id_obj != NULL) {
-    assert(java_lang_boxing_object::is_instance(id_obj, T_INT), "Integer id expected");
-    jint id = id_obj->int_field(java_lang_boxing_object::value_offset_in_bytes(T_INT));
-
-    address pc = _instructions->start() + pc_offset;
-
-    switch (id) {
-      case UNVERIFIED_ENTRY:
-        _offsets.set_value(CodeOffsets::Entry, pc_offset);
-        break;
-      case VERIFIED_ENTRY:
-        _offsets.set_value(CodeOffsets::Verified_Entry, pc_offset);
-        break;
-      case OSR_ENTRY:
-        _offsets.set_value(CodeOffsets::OSR_Entry, pc_offset);
-        break;
-      case EXCEPTION_HANDLER_ENTRY:
-        _offsets.set_value(CodeOffsets::Exceptions, pc_offset);
-        break;
-      case DEOPT_HANDLER_ENTRY:
-        _offsets.set_value(CodeOffsets::Deopt, pc_offset);
-        break;
-      case INVOKEVIRTUAL:
-      case INVOKEINTERFACE:
-      case INLINE_INVOKE:
-      case INVOKESTATIC:
-      case INVOKESPECIAL:
-        _next_call_type = (MarkId) id;
-        _invoke_mark_pc = pc;
-        break;
-      case POLL_NEAR:
-      case POLL_FAR:
-      case POLL_RETURN_NEAR:
-      case POLL_RETURN_FAR:
-        pd_relocate_poll(pc, id);
-        break;
-      case CARD_TABLE_SHIFT:
-      case CARD_TABLE_ADDRESS:
-        break;
-      default:
-        ShouldNotReachHere();
-        break;
-    }
-  }
-}
-
--- a/src/share/vm/graal/graalCodeInstaller.hpp	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,159 +0,0 @@
-/*
- * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-#ifndef SHARE_VM_GRAAL_GRAAL_CODE_INSTALLER_HPP
-#define SHARE_VM_GRAAL_GRAAL_CODE_INSTALLER_HPP
-
-#include "graal/graalEnv.hpp"
-
-/*
- * This class handles the conversion from a InstalledCode to a CodeBlob or an nmethod.
- */
-class CodeInstaller : public StackObj {
-  friend class VMStructs;
-private:
-  enum MarkId {
-    VERIFIED_ENTRY             = 1,
-    UNVERIFIED_ENTRY           = 2,
-    OSR_ENTRY                  = 3,
-    EXCEPTION_HANDLER_ENTRY    = 4,
-    DEOPT_HANDLER_ENTRY        = 5,
-    INVOKEINTERFACE            = 6,
-    INVOKEVIRTUAL              = 7,
-    INVOKESTATIC               = 8,
-    INVOKESPECIAL              = 9,
-    INLINE_INVOKE              = 10,
-    POLL_NEAR                  = 11,
-    POLL_RETURN_NEAR           = 12,
-    POLL_FAR                   = 13,
-    POLL_RETURN_FAR            = 14,
-    CARD_TABLE_ADDRESS         = 15,
-    CARD_TABLE_SHIFT           = 16,
-    INVOKE_INVALID             = -1
-  };
-
-  Arena         _arena;
-
-  jobject       _data_section_handle;
-  jobject       _data_section_patches_handle;
-  jobject       _sites_handle;
-  jobject       _exception_handlers_handle;
-  CodeOffsets   _offsets;
-
-  jobject       _code_handle;
-  jint          _code_size;
-  jint          _total_frame_size;
-  jint          _custom_stack_area_offset;
-  jint          _parameter_count;
-  jint          _constants_size;
-#ifndef PRODUCT
-  jobject       _comments_handle;
-#endif
-
-  MarkId        _next_call_type;
-  address       _invoke_mark_pc;
-
-  CodeSection*  _instructions;
-  CodeSection*  _constants;
-
-  OopRecorder*              _oop_recorder;
-  DebugInformationRecorder* _debug_recorder;
-  Dependencies*             _dependencies;
-  ExceptionHandlerTable     _exception_handler_table;
-
-  static ConstantOopWriteValue* _oop_null_scope_value;
-  static ConstantIntValue*    _int_m1_scope_value;
-  static ConstantIntValue*    _int_0_scope_value;
-  static ConstantIntValue*    _int_1_scope_value;
-  static ConstantIntValue*    _int_2_scope_value;
-  static LocationValue*       _illegal_value;
-
-  jint pd_next_offset(NativeInstruction* inst, jint pc_offset, oop method);
-  void pd_patch_OopConstant(int pc_offset, Handle& constant);
-  void pd_patch_DataSectionReference(int pc_offset, int data_offset);
-  void pd_relocate_CodeBlob(CodeBlob* cb, NativeInstruction* inst);
-  void pd_relocate_ForeignCall(NativeInstruction* inst, jlong foreign_call_destination);
-  void pd_relocate_JavaMethod(oop method, jint pc_offset);
-  void pd_relocate_poll(address pc, jint mark);
-
-  objArrayOop sites() { return (objArrayOop) JNIHandles::resolve(_sites_handle); }
-  arrayOop code() { return (arrayOop) JNIHandles::resolve(_code_handle); }
-  arrayOop data_section() { return (arrayOop) JNIHandles::resolve(_data_section_handle); }
-  objArrayOop data_section_patches() { return (objArrayOop) JNIHandles::resolve(_data_section_patches_handle); }
-  objArrayOop exception_handlers() { return (objArrayOop) JNIHandles::resolve(_exception_handlers_handle); }
-#ifndef PRODUCT
-  objArrayOop comments() { return (objArrayOop) JNIHandles::resolve(_comments_handle); }
-#endif
-
-public:
-
-  CodeInstaller() : _arena(mtCompiler) {}
-  GraalEnv::CodeInstallResult install(Handle& compiled_code, CodeBlob*& cb, Handle installed_code, Handle speculation_log);
-
-  static address runtime_call_target_address(oop runtime_call);
-  static VMReg get_hotspot_reg(jint graalRegisterNumber);
-  static bool is_general_purpose_reg(VMReg hotspotRegister);
-
-private:
-  ScopeValue* get_scope_value(oop value, GrowableArray<ScopeValue*>* objects, ScopeValue* &second);
-  MonitorValue* get_monitor_value(oop value, GrowableArray<ScopeValue*>* objects);
-
-  // extract the fields of the CompilationResult
-  void initialize_fields(oop target_method);
-  void initialize_dependencies(oop target_method);
-  
-  int estimate_stub_entries();
-  
-  // perform data and call relocation on the CodeBuffer
-  bool initialize_buffer(CodeBuffer& buffer);
-
-  void assumption_NoFinalizableSubclass(Handle assumption);
-  void assumption_ConcreteSubtype(Handle assumption);
-  void assumption_LeafType(Handle assumption);
-  void assumption_ConcreteMethod(Handle assumption);
-  void assumption_CallSiteTargetValue(Handle assumption);
-
-  void site_Safepoint(CodeBuffer& buffer, jint pc_offset, oop site);
-  void site_Infopoint(CodeBuffer& buffer, jint pc_offset, oop site);
-  void site_Call(CodeBuffer& buffer, jint pc_offset, oop site);
-  void site_DataPatch(CodeBuffer& buffer, jint pc_offset, oop site);
-  void site_Mark(CodeBuffer& buffer, jint pc_offset, oop site);
-
-  void record_scope(jint pc_offset, oop debug_info);
-  void record_scope(jint pc_offset, oop code_pos, GrowableArray<ScopeValue*>* objects);
-  void record_object_value(ObjectValue* sv, oop value, GrowableArray<ScopeValue*>* objects);
-
-  GrowableArray<ScopeValue*>* record_virtual_objects(oop debug_info);
-
-  void process_exception_handlers();
-  int estimateStubSpace(int static_call_stubs);
-};
-
-/**
- * Gets the Method metaspace object from a HotSpotResolvedJavaMethodImpl Java object.
- */
-Method* getMethodFromHotSpotMethod(oop hotspot_method);
-
-
-
-#endif // SHARE_VM_GRAAL_GRAAL_CODE_INSTALLER_HPP
--- a/src/share/vm/graal/graalCompiler.cpp	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,168 +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.
- */
-
-#include "precompiled.hpp"
-#include "memory/oopFactory.hpp"
-#include "runtime/javaCalls.hpp"
-#include "graal/graalCompiler.hpp"
-#include "graal/graalEnv.hpp"
-#include "graal/graalRuntime.hpp"
-#include "runtime/compilationPolicy.hpp"
-#include "runtime/globals_extension.hpp"
-
-GraalCompiler* GraalCompiler::_instance = NULL;
-elapsedTimer GraalCompiler::_codeInstallTimer;
-
-GraalCompiler::GraalCompiler() : AbstractCompiler(graal) {
-#ifdef COMPILERGRAAL
-  _bootstrapping = false;
-  _methodsCompiled = 0;
-#endif
-  assert(_instance == NULL, "only one instance allowed");
-  _instance = this;
-}
-
-// Initialization
-void GraalCompiler::initialize() {
-#ifdef COMPILERGRAAL
-  if (!UseCompiler || !should_perform_init()) {
-    return;
-  }
-
-  BufferBlob* buffer_blob = GraalRuntime::initialize_buffer_blob();
-  if (buffer_blob == NULL) {
-    set_state(failed);
-  } else {
-    set_state(initialized);
-  }
-  // Graal is considered as application code so we need to
-  // stop the VM deferring compilation now.
-  CompilationPolicy::completed_vm_startup();
-#endif // COMPILERGRAAL
-}
-
-#ifdef COMPILERGRAAL
-void GraalCompiler::bootstrap() {
-  JavaThread* THREAD = JavaThread::current();
-  _bootstrapping = true;
-  // Allow bootstrap to perform Graal compilations of itself
-  bool c1only = GraalCompileWithC1Only;
-  GraalCompileWithC1Only = false;
-  ResourceMark rm;
-  HandleMark hm;
-  if (PrintBootstrap) {
-    tty->print("Bootstrapping Graal");
-  }
-  jlong start = os::javaTimeMillis();
-
-  Array<Method*>* objectMethods = InstanceKlass::cast(SystemDictionary::Object_klass())->methods();
-  // Initialize compile queue with a selected set of methods.
-  int len = objectMethods->length();
-  for (int i = 0; i < len; i++) {
-    methodHandle mh = objectMethods->at(i);
-    if (!mh->is_native() && !mh->is_static() && !mh->is_initializer()) {
-      ResourceMark rm;
-      int hot_count = 10; // TODO: what's the appropriate value?
-      CompileBroker::compile_method(mh, InvocationEntryBci, CompLevel_full_optimization, mh, hot_count, "bootstrap", THREAD);
-    }
-  }
-
-  int qsize;
-  bool first_round = true;
-  int z = 0;
-  do {
-    // Loop until there is something in the queue.
-    do {
-      os::sleep(THREAD, 100, true);
-      qsize = CompileBroker::queue_size(CompLevel_full_optimization);
-    } while (first_round && qsize == 0);
-    first_round = false;
-    if (PrintBootstrap) {
-      while (z < (_methodsCompiled / 100)) {
-        ++z;
-        tty->print_raw(".");
-      }
-    }
-  } while (qsize != 0);
-
-  if (PrintBootstrap) {
-    tty->print_cr(" in " JLONG_FORMAT " ms (compiled %d methods)", os::javaTimeMillis() - start, _methodsCompiled);
-  }
-  GraalCompileWithC1Only = c1only;
-  _bootstrapping = false;
-}
-
-void GraalCompiler::compile_method(methodHandle method, int entry_bci, GraalEnv* env) {
-  GRAAL_EXCEPTION_CONTEXT
-
-  bool is_osr = entry_bci != InvocationEntryBci;
-  if (_bootstrapping && is_osr) {
-      // no OSR compilations during bootstrap - the compiler is just too slow at this point,
-      // and we know that there are no endless loops
-      return;
-  }
-
-  GraalRuntime::ensure_graal_class_loader_is_initialized();
-  HandleMark hm;
-  ResourceMark rm;
-  JavaValue result(T_VOID);
-  JavaCallArguments args;
-  args.push_long((jlong) (address) method());
-  args.push_int(entry_bci);
-  args.push_long((jlong) (address) env);
-  args.push_int(env->task()->compile_id());
-  JavaCalls::call_static(&result, SystemDictionary::CompilationTask_klass(), vmSymbols::compileMetaspaceMethod_name(), vmSymbols::compileMetaspaceMethod_signature(), &args, CHECK_ABORT);
-
-  _methodsCompiled++;
-}
-
-
-// Compilation entry point for methods
-void GraalCompiler::compile_method(ciEnv* env, ciMethod* target, int entry_bci) {
-  ShouldNotReachHere();
-}
-
-// Print compilation timers and statistics
-void GraalCompiler::print_timers() {
-  print_compilation_timers();
-}
-
-#endif // COMPILERGRAAL
-
-// Print compilation timers and statistics
-void GraalCompiler::print_compilation_timers() {
-  TRACE_graal_1("GraalCompiler::print_timers");
-  tty->print_cr("       Graal code install time:        %6.3f s",    _codeInstallTimer.seconds());
-}
-
-void GraalCompiler::compile_the_world() {
-  HandleMark hm;
-  JavaThread* THREAD = JavaThread::current();
-  TempNewSymbol name = SymbolTable::new_symbol("com/oracle/graal/hotspot/HotSpotGraalRuntime", CHECK_ABORT);
-  KlassHandle klass = GraalRuntime::load_required_class(name);
-  TempNewSymbol compileTheWorld = SymbolTable::new_symbol("compileTheWorld", CHECK_ABORT);
-  JavaValue result(T_VOID);
-  JavaCallArguments args;
-  args.push_oop(GraalRuntime::get_HotSpotGraalRuntime());
-  JavaCalls::call_special(&result, klass, compileTheWorld, vmSymbols::void_method_signature(), &args, CHECK_ABORT);
-}
--- a/src/share/vm/graal/graalCompiler.hpp	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,93 +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.
- */
-
-#ifndef SHARE_VM_GRAAL_GRAAL_COMPILER_HPP
-#define SHARE_VM_GRAAL_GRAAL_COMPILER_HPP
-
-#include "compiler/abstractCompiler.hpp"
-#include "graal/graalEnv.hpp"
-
-class GraalCompiler : public AbstractCompiler {
-
-private:
-
-#ifdef COMPILERGRAAL
-  bool _bootstrapping;
-
-  /**
-   * Number of methods compiled by Graal. This is not synchronized
-   * so may not be 100% accurate.
-   */
-  volatile int  _methodsCompiled;
-
-#endif
-
-  static GraalCompiler* _instance;
- 
-  static elapsedTimer _codeInstallTimer;
-
-public:
-
-  GraalCompiler();
-
-  static GraalCompiler* instance() { return _instance; }
-
-  virtual const char* name() { return "Graal"; }
-
-  virtual bool supports_native()                 { return true; }
-  virtual bool supports_osr   ()                 { return true; }
-
-  bool is_graal()                                { return true; }
-  bool is_c1   ()                                { return false; }
-  bool is_c2   ()                                { return false; }
-
-  bool needs_stubs            () { return false; }
-
-  // Initialization
-  virtual void initialize();
-
-#ifdef COMPILERGRAAL
-
-  void bootstrap();
-  
-  // Compilation entry point for methods
-  virtual void compile_method(ciEnv* env, ciMethod* target, int entry_bci);
-
-  void compile_method(methodHandle target, int entry_bci, GraalEnv* env);
-
-  // Print compilation timers and statistics
-  virtual void print_timers();
-
-  // Print compilation statistics
-  void reset_compilation_stats();
-#endif // COMPILERGRAAL
-
-  // Print compilation timers and statistics
-  static void print_compilation_timers();
-
-  static elapsedTimer* codeInstallTimer() { return &_codeInstallTimer; }
-
-  void compile_the_world();
-};
-
-#endif // SHARE_VM_GRAAL_GRAAL_COMPILER_HPP
--- a/src/share/vm/graal/graalCompilerToVM.cpp	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1115 +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.
- */
-
-#include "precompiled.hpp"
-#include "code/scopeDesc.hpp"
-#include "memory/oopFactory.hpp"
-#include "oops/generateOopMap.hpp"
-#include "oops/fieldStreams.hpp"
-#include "runtime/fieldDescriptor.hpp"
-#include "runtime/javaCalls.hpp"
-#include "graal/graalRuntime.hpp"
-#include "compiler/compileBroker.hpp"
-#include "compiler/compilerOracle.hpp"
-#include "compiler/disassembler.hpp"
-#include "graal/graalCompilerToVM.hpp"
-#include "graal/graalCompiler.hpp"
-#include "graal/graalEnv.hpp"
-#include "graal/graalJavaAccess.hpp"
-#include "graal/graalCodeInstaller.hpp"
-#include "gc_implementation/g1/heapRegion.hpp"
-#include "runtime/javaCalls.hpp"
-#include "runtime/deoptimization.hpp"
-#include "runtime/vframe.hpp"
-#include "runtime/vframe_hp.hpp"
-#include "runtime/vmStructs.hpp"
-
-
-// Entry to native method implementation that transitions current thread to '_thread_in_vm'.
-#define C2V_VMENTRY(result_type, name, signature) \
-  JNIEXPORT result_type JNICALL c2v_ ## name signature { \
-  TRACE_graal_3("CompilerToVM::" #name); \
-  GRAAL_VM_ENTRY_MARK; \
-
-#define C2V_END }
-
-extern "C" {
-extern VMStructEntry* gHotSpotVMStructs;
-extern uint64_t gHotSpotVMStructEntryTypeNameOffset;
-extern uint64_t gHotSpotVMStructEntryFieldNameOffset;
-extern uint64_t gHotSpotVMStructEntryTypeStringOffset;
-extern uint64_t gHotSpotVMStructEntryIsStaticOffset;
-extern uint64_t gHotSpotVMStructEntryOffsetOffset;
-extern uint64_t gHotSpotVMStructEntryAddressOffset;
-extern uint64_t gHotSpotVMStructEntryArrayStride;
-
-extern VMTypeEntry* gHotSpotVMTypes;
-extern uint64_t gHotSpotVMTypeEntryTypeNameOffset;
-extern uint64_t gHotSpotVMTypeEntrySuperclassNameOffset;
-extern uint64_t gHotSpotVMTypeEntryIsOopTypeOffset;
-extern uint64_t gHotSpotVMTypeEntryIsIntegerTypeOffset;
-extern uint64_t gHotSpotVMTypeEntryIsUnsignedOffset;
-extern uint64_t gHotSpotVMTypeEntrySizeOffset;
-extern uint64_t gHotSpotVMTypeEntryArrayStride;
-
-extern VMIntConstantEntry* gHotSpotVMIntConstants;
-extern uint64_t gHotSpotVMIntConstantEntryNameOffset;
-extern uint64_t gHotSpotVMIntConstantEntryValueOffset;
-extern uint64_t gHotSpotVMIntConstantEntryArrayStride;
-
-extern VMLongConstantEntry* gHotSpotVMLongConstants;
-extern uint64_t gHotSpotVMLongConstantEntryNameOffset;
-extern uint64_t gHotSpotVMLongConstantEntryValueOffset;
-extern uint64_t gHotSpotVMLongConstantEntryArrayStride;
-}
-
-C2V_VMENTRY(void, initializeConfiguration, (JNIEnv *, jobject, jobject config))
-  VMStructs::initHotSpotVMConfig(JNIHandles::resolve(config));
-C2V_END
-
-C2V_VMENTRY(jbyteArray, getBytecode, (JNIEnv *, jobject, jlong metaspace_method))
-  methodHandle method = asMethod(metaspace_method);
-  ResourceMark rm;
-
-  int code_size = method->code_size();
-  typeArrayOop reconstituted_code = oopFactory::new_byteArray(code_size, CHECK_NULL);
-
-  guarantee(method->method_holder()->is_rewritten(), "Method's holder should be rewritten");
-  // iterate over all bytecodes and replace non-Java bytecodes
-
-  for (BytecodeStream s(method); s.next() != Bytecodes::_illegal; ) {
-    Bytecodes::Code code = s.code();
-    Bytecodes::Code raw_code = s.raw_code();
-    int bci = s.bci();
-    int len = s.instruction_size();
-
-    // Restore original byte code.
-    reconstituted_code->byte_at_put(bci, (jbyte) (s.is_wide()? Bytecodes::_wide : code));
-    if (len > 1) {
-      memcpy(reconstituted_code->byte_at_addr(bci + 1), s.bcp()+1, len-1);
-    }
-
-    if (len > 1) {
-      // Restore the big-endian constant pool indexes.
-      // Cf. Rewriter::scan_method
-      switch (code) {
-        case Bytecodes::_getstatic:
-        case Bytecodes::_putstatic:
-        case Bytecodes::_getfield:
-        case Bytecodes::_putfield:
-        case Bytecodes::_invokevirtual:
-        case Bytecodes::_invokespecial:
-        case Bytecodes::_invokestatic:
-        case Bytecodes::_invokeinterface:
-        case Bytecodes::_invokehandle: {
-          int cp_index = Bytes::get_native_u2((address) reconstituted_code->byte_at_addr(bci + 1));
-          Bytes::put_Java_u2((address) reconstituted_code->byte_at_addr(bci + 1), (u2) cp_index);
-          break;
-        }
-
-        case Bytecodes::_invokedynamic:
-          int cp_index = Bytes::get_native_u4((address) reconstituted_code->byte_at_addr(bci + 1));
-          Bytes::put_Java_u4((address) reconstituted_code->byte_at_addr(bci + 1), (u4) cp_index);
-          break;
-      }
-
-      // Not all ldc byte code are rewritten.
-      switch (raw_code) {
-        case Bytecodes::_fast_aldc: {
-          int cpc_index = reconstituted_code->byte_at(bci + 1) & 0xff;
-          int cp_index = method->constants()->object_to_cp_index(cpc_index);
-          assert(cp_index < method->constants()->length(), "sanity check");
-          reconstituted_code->byte_at_put(bci + 1, (jbyte) cp_index);
-          break;
-        }
-
-        case Bytecodes::_fast_aldc_w: {
-          int cpc_index = Bytes::get_native_u2((address) reconstituted_code->byte_at_addr(bci + 1));
-          int cp_index = method->constants()->object_to_cp_index(cpc_index);
-          assert(cp_index < method->constants()->length(), "sanity check");
-          Bytes::put_Java_u2((address) reconstituted_code->byte_at_addr(bci + 1), (u2) cp_index);
-          break;
-        }
-      }
-    }
-  }
-
-  return (jbyteArray) JNIHandles::make_local(THREAD, reconstituted_code);
-C2V_END
-
-C2V_VMENTRY(jint, exceptionTableLength, (JNIEnv *, jobject, jlong metaspace_method))
-  ResourceMark rm;
-  methodHandle method = asMethod(metaspace_method);
-  return method->exception_table_length();
-C2V_END
-
-C2V_VMENTRY(jlong, exceptionTableStart, (JNIEnv *, jobject, jlong metaspace_method))
-  ResourceMark rm;
-  methodHandle method = asMethod(metaspace_method);
-  assert(method->exception_table_length() != 0, "should be handled in Java code");
-  return (jlong) (address) method->exception_table_start();
-C2V_END
-
-C2V_VMENTRY(jint, hasBalancedMonitors, (JNIEnv *, jobject, jlong metaspace_method))
-  // Analyze the method to see if monitors are used properly.
-  methodHandle method(THREAD, asMethod(metaspace_method));
-  {
-    EXCEPTION_MARK;
-    ResourceMark rm(THREAD);
-    GeneratePairingInfo gpi(method);
-    gpi.compute_map(CATCH);
-    if (!gpi.monitor_safe()) {
-      return false;
-    }
-    method->set_guaranteed_monitor_matching();
-  }
-  return true;
-C2V_END
-
-C2V_VMENTRY(jlong, getMetaspaceMethod, (JNIEnv *, jobject, jclass holder_handle, jint slot))
-  oop java_class = JNIHandles::resolve(holder_handle);
-  Klass* holder = java_lang_Class::as_Klass(java_class);
-  methodHandle method = InstanceKlass::cast(holder)->method_with_idnum(slot);
-  return (jlong) (address) method();
-}
-
-C2V_VMENTRY(jlong, findUniqueConcreteMethod, (JNIEnv *, jobject, jlong metaspace_klass, jlong metaspace_method))
-  methodHandle method = asMethod(metaspace_method);
-  KlassHandle holder = asKlass(metaspace_klass);
-  assert(!holder->is_interface(), "should be handled in Java code");
-  ResourceMark rm;
-  MutexLocker locker(Compile_lock);
-  Method* ucm = Dependencies::find_unique_concrete_method(holder(), method());
-  return (jlong) (address) ucm;
-C2V_END
-
-C2V_VMENTRY(jlong, getKlassImplementor, (JNIEnv *, jobject, jlong metaspace_klass))
-  InstanceKlass* klass = (InstanceKlass*) asKlass(metaspace_klass);
-  return (jlong) (address) klass->implementor();
-C2V_END
-
-C2V_VMENTRY(jboolean, methodIsIgnoredBySecurityStackWalk,(JNIEnv *, jobject, jlong metaspace_method))
-  methodHandle method = asMethod(metaspace_method);
-  return method->is_ignored_by_security_stack_walk();
-C2V_END
-
-C2V_VMENTRY(jboolean, canInlineMethod,(JNIEnv *, jobject, jlong metaspace_method))
-  methodHandle method = asMethod(metaspace_method);
-  return !method->is_not_compilable() && !CompilerOracle::should_not_inline(method) && !method->dont_inline();
-C2V_END
-
-C2V_VMENTRY(jboolean, shouldInlineMethod,(JNIEnv *, jobject, jlong metaspace_method))
-  methodHandle method = asMethod(metaspace_method);
-  return CompilerOracle::should_inline(method) || method->force_inline();
-C2V_END
-
-C2V_VMENTRY(jlong, lookupType, (JNIEnv*, jobject, jstring jname, jclass accessing_class, jboolean resolve))
-  ResourceMark rm;
-  Handle name = JNIHandles::resolve(jname);
-  Symbol* class_name = java_lang_String::as_symbol(name, THREAD);
-  assert(class_name != NULL, "name to symbol creation failed");
-  assert(class_name->size() > 1, "primitive types should be handled in Java code");
-
-  Klass* resolved_klass = NULL;
-  Handle class_loader;
-  Handle protection_domain;
-  if (JNIHandles::resolve(accessing_class) == NULL) {
-    THROW_(vmSymbols::java_lang_NullPointerException(), 0L);
-  }
-  Klass* accessing_klass = java_lang_Class::as_Klass(JNIHandles::resolve(accessing_class));
-  class_loader = accessing_klass->class_loader();
-  protection_domain = accessing_klass->protection_domain();
-
-  if (resolve) {
-    resolved_klass = SystemDictionary::resolve_or_null(class_name, class_loader, protection_domain, CHECK_0);
-  } else {
-    if (class_name->byte_at(0) == 'L' &&
-      class_name->byte_at(class_name->utf8_length()-1) == ';') {
-      // This is a name from a signature.  Strip off the trimmings.
-      // Call recursive to keep scope of strippedsym.
-      TempNewSymbol strippedsym = SymbolTable::new_symbol(class_name->as_utf8()+1,
-                                                          class_name->utf8_length()-2,
-                                                          CHECK_0);
-      resolved_klass = SystemDictionary::find(strippedsym, class_loader, protection_domain, CHECK_0);
-    } else if (FieldType::is_array(class_name)) {
-      FieldArrayInfo fd;
-      // dimension and object_key in FieldArrayInfo are assigned as a side-effect
-      // of this call
-      BasicType t = FieldType::get_array_info(class_name, fd, CHECK_0);
-      if (t == T_OBJECT) {
-        TempNewSymbol strippedsym = SymbolTable::new_symbol(class_name->as_utf8()+1+fd.dimension(),
-                                                            class_name->utf8_length()-2-fd.dimension(),
-                                                            CHECK_0);
-        // naked oop "k" is OK here -- we assign back into it
-        resolved_klass = SystemDictionary::find(strippedsym,
-                                                             class_loader,
-                                                             protection_domain,
-                                                             CHECK_0);
-        if (resolved_klass != NULL) {
-          resolved_klass = resolved_klass->array_klass(fd.dimension(), CHECK_0);
-        }
-      } else {
-        resolved_klass = Universe::typeArrayKlassObj(t);
-        resolved_klass = TypeArrayKlass::cast(resolved_klass)->array_klass(fd.dimension(), CHECK_0);
-      }
-    }
-  }
-  return (jlong) (address) resolved_klass;
-C2V_END
-
-C2V_VMENTRY(jobject, resolveConstantInPool, (JNIEnv*, jobject, jlong metaspace_constant_pool, jint index))
-  ConstantPool* cp = (ConstantPool*) metaspace_constant_pool;
-  oop result = cp->resolve_constant_at(index, CHECK_NULL);
-  return JNIHandles::make_local(THREAD, result);
-C2V_END
-
-C2V_VMENTRY(jobject, resolvePossiblyCachedConstantInPool, (JNIEnv*, jobject, jlong metaspace_constant_pool, jint index))
-  ConstantPool* cp = (ConstantPool*) metaspace_constant_pool;
-  oop result = cp->resolve_possibly_cached_constant_at(index, CHECK_NULL);
-  return JNIHandles::make_local(THREAD, result);
-C2V_END
-
-C2V_VMENTRY(jint, lookupNameAndTypeRefIndexInPool, (JNIEnv*, jobject, jlong metaspace_constant_pool, jint index))
-  constantPoolHandle cp = (ConstantPool*) metaspace_constant_pool;
-  return cp->name_and_type_ref_index_at(index);
-C2V_END
-
-C2V_VMENTRY(jobject, lookupNameRefInPool, (JNIEnv*, jobject, jlong metaspace_constant_pool, jint index))
-  constantPoolHandle cp = (ConstantPool*) metaspace_constant_pool;
-  Handle sym = java_lang_String::create_from_symbol(cp->name_ref_at(index), CHECK_NULL);
-  return JNIHandles::make_local(THREAD, sym());
-C2V_END
-
-C2V_VMENTRY(jobject, lookupSignatureRefInPool, (JNIEnv*, jobject, jlong metaspace_constant_pool, jint index))
-  constantPoolHandle cp = (ConstantPool*) metaspace_constant_pool;
-  Handle sym = java_lang_String::create_from_symbol(cp->signature_ref_at(index), CHECK_NULL);
-  return JNIHandles::make_local(THREAD, sym());
-C2V_END
-
-C2V_VMENTRY(jint, lookupKlassRefIndexInPool, (JNIEnv*, jobject, jlong metaspace_constant_pool, jint index))
-  constantPoolHandle cp = (ConstantPool*) metaspace_constant_pool;
-  return cp->klass_ref_index_at(index);
-C2V_END
-
-C2V_VMENTRY(jlong, constantPoolKlassAt, (JNIEnv*, jobject, jlong metaspace_constant_pool, jint index))
-  ConstantPool* cp = (ConstantPool*) metaspace_constant_pool;
-  return (jlong) (address) cp->klass_at(index, THREAD);
-C2V_END
-
-C2V_VMENTRY(jlong, lookupKlassInPool, (JNIEnv*, jobject, jlong metaspace_constant_pool, jint index, jbyte opcode))
-  constantPoolHandle cp = (ConstantPool*) metaspace_constant_pool;
-  KlassHandle loading_klass(cp->pool_holder());
-  bool is_accessible = false;
-  KlassHandle klass = GraalEnv::get_klass_by_index(cp, index, is_accessible, loading_klass);
-  if (klass.is_null()) {
-    // We have to lock the cpool to keep the oop from being resolved
-    // while we are accessing it.
-    MonitorLockerEx ml(cp->lock());
-    constantTag tag = cp->tag_at(index);
-    if (tag.is_klass()) {
-      // The klass has been inserted into the constant pool
-      // very recently.
-      return (jlong) CompilerToVM::tag_pointer(cp->resolved_klass_at(index));
-    } else if (tag.is_symbol()) {
-      return (jlong) CompilerToVM::tag_pointer(cp->symbol_at(index));
-    } else {
-      assert(cp->tag_at(index).is_unresolved_klass(), "wrong tag");
-      return (jlong) CompilerToVM::tag_pointer(cp->unresolved_klass_at(index));
-    }
-  }
-  return (jlong) CompilerToVM::tag_pointer(klass());
-C2V_END
-
-C2V_VMENTRY(jobject, lookupAppendixInPool, (JNIEnv*, jobject, jlong metaspace_constant_pool, jint index))
-  constantPoolHandle cp = (ConstantPool*) metaspace_constant_pool;
-  oop appendix_oop = ConstantPool::appendix_at_if_loaded(cp, index);
-  return JNIHandles::make_local(THREAD, appendix_oop);
-C2V_END
-
-C2V_VMENTRY(jlong, lookupMethodInPool, (JNIEnv*, jobject, jlong metaspace_constant_pool, jint index, jbyte opcode))
-  constantPoolHandle cp = (ConstantPool*) metaspace_constant_pool;
-  instanceKlassHandle pool_holder(cp->pool_holder());
-  Bytecodes::Code bc = (Bytecodes::Code) (((int) opcode) & 0xFF);
-  methodHandle method = GraalEnv::get_method_by_index(cp, index, bc, pool_holder);
-  return (jlong) (address) method();
-C2V_END
-
-C2V_VMENTRY(jint, constantPoolRemapInstructionOperandFromCache, (JNIEnv*, jobject, jlong metaspace_constant_pool, jint index))
-  ConstantPool* cp = (ConstantPool*) metaspace_constant_pool;
-  return cp->remap_instruction_operand_from_cache(index);
-C2V_END
-
-C2V_VMENTRY(jlong, resolveField, (JNIEnv*, jobject, jlong metaspace_constant_pool, jint index, jbyte opcode, jlongArray info_handle))
-  ResourceMark rm;
-  constantPoolHandle cp = (ConstantPool*) metaspace_constant_pool;
-  Bytecodes::Code code = (Bytecodes::Code)(((int) opcode) & 0xFF);
-  fieldDescriptor result;
-  LinkResolver::resolve_field_access(result, cp, index, Bytecodes::java_code(code), true, false, CHECK_0);
-  typeArrayOop info = (typeArrayOop) JNIHandles::resolve(info_handle);
-  assert(info != NULL && info->length() == 2, "must be");
-  info->long_at_put(0, (jlong) result.access_flags().as_int());
-  info->long_at_put(1, (jlong) result.offset());
-  return (jlong) (address) result.field_holder();
-C2V_END
-
-C2V_VMENTRY(jint, getVtableIndexForInterface, (JNIEnv *, jobject, jlong metaspace_klass, jlong metaspace_method))
-  Klass* klass = (Klass*) metaspace_klass;
-  Method* method = (Method*) metaspace_method;
-  assert(!klass->is_interface(), "");
-  return LinkResolver::vtable_index_of_interface_method(klass, method);
-C2V_END
-
-C2V_VMENTRY(jlong, resolveMethod, (JNIEnv *, jobject, jlong metaspace_klass_receiver, jlong metaspace_method, jlong metaspace_klass_caller))
-  Klass* recv_klass = (Klass*) metaspace_klass_receiver;
-  Klass* caller_klass = (Klass*) metaspace_klass_caller;
-  Method* method = (Method*) metaspace_method;
-
-  if (recv_klass->oop_is_array() || (InstanceKlass::cast(recv_klass)->is_linked())) {
-    Klass* holder_klass = method->method_holder();
-    Symbol* method_name = method->name();
-    Symbol* method_signature = method->signature();
-
-
-    if (holder_klass->is_interface()) {
-      // do link-time resolution to check all access rules.
-      methodHandle resolved_method;
-      LinkResolver::linktime_resolve_interface_method(resolved_method, holder_klass, method_name, method_signature, caller_klass, true, CHECK_AND_CLEAR_0);
-      if (resolved_method->is_private()) {
-        return (jlong) (address) NULL;
-      }
-      assert(recv_klass->is_subtype_of(holder_klass), "");
-      // do actual lookup
-      methodHandle sel_method;
-      LinkResolver::lookup_instance_method_in_klasses(sel_method, recv_klass,
-                resolved_method->name(),
-                resolved_method->signature(), CHECK_AND_CLEAR_0);
-      return (jlong) (address) sel_method();
-    } else {
-      // do link-time resolution to check all access rules.
-      methodHandle resolved_method;
-      LinkResolver::linktime_resolve_virtual_method(resolved_method, holder_klass, method_name, method_signature, caller_klass, true, CHECK_AND_CLEAR_0);
-      // do actual lookup (see LinkResolver::runtime_resolve_virtual_method)
-      int vtable_index = Method::invalid_vtable_index;
-      Method* selected_method;
-
-      if (resolved_method->method_holder()->is_interface()) { // miranda method
-        vtable_index = LinkResolver::vtable_index_of_interface_method(holder_klass, resolved_method);
-        assert(vtable_index >= 0 , "we should have valid vtable index at this point");
-
-        InstanceKlass* inst = InstanceKlass::cast(recv_klass);
-        selected_method = inst->method_at_vtable(vtable_index);
-      } else {
-        // at this point we are sure that resolved_method is virtual and not
-        // a miranda method; therefore, it must have a valid vtable index.
-        assert(!resolved_method->has_itable_index(), "");
-        vtable_index = resolved_method->vtable_index();
-        // We could get a negative vtable_index for final methods,
-        // because as an optimization they are they are never put in the vtable,
-        // unless they override an existing method.
-        // If we do get a negative, it means the resolved method is the the selected
-        // method, and it can never be changed by an override.
-        if (vtable_index == Method::nonvirtual_vtable_index) {
-          assert(resolved_method->can_be_statically_bound(), "cannot override this method");
-          selected_method = resolved_method();
-        } else {
-          // recv_klass might be an arrayKlassOop but all vtables start at
-          // the same place. The cast is to avoid virtual call and assertion.
-          InstanceKlass* inst = (InstanceKlass*)recv_klass;
-          selected_method = inst->method_at_vtable(vtable_index);
-        }
-      }
-      return (jlong) (address) selected_method;
-    }
-  }
-  return (jlong) (address) NULL;
-C2V_END
-
-C2V_VMENTRY(jboolean, hasFinalizableSubclass,(JNIEnv *, jobject, jlong metaspace_klass))
-  Klass* klass = (Klass*) metaspace_klass;
-  assert(klass != NULL, "method must not be called for primitive types");
-  return Dependencies::find_finalizable_subclass(klass) != NULL;
-C2V_END
-
-C2V_VMENTRY(jlong, getClassInitializer, (JNIEnv *, jobject, jlong metaspace_klass))
-  InstanceKlass* klass = (InstanceKlass*) metaspace_klass;
-  return (jlong) (address) klass->class_initializer();
-C2V_END
-
-C2V_VMENTRY(jlong, getMaxCallTargetOffset, (JNIEnv*, jobject, jlong addr))
-  address target_addr = (address) addr;
-  if (target_addr != 0x0) {
-    int64_t off_low = (int64_t)target_addr - ((int64_t)CodeCache::low_bound() + sizeof(int));
-    int64_t off_high = (int64_t)target_addr - ((int64_t)CodeCache::high_bound() + sizeof(int));
-    return MAX2(ABS(off_low), ABS(off_high));
-  }
-  return -1;
-C2V_END
-
-C2V_VMENTRY(void, doNotInlineOrCompile,(JNIEnv *, jobject,  jlong metaspace_method))
-  methodHandle method = asMethod(metaspace_method);
-  method->set_not_c1_compilable();
-  method->set_not_c2_compilable();
-  method->set_dont_inline(true);
-C2V_END
-
-C2V_VMENTRY(jint, installCode, (JNIEnv *jniEnv, jobject, jobject compiled_code, jobject installed_code, jobject speculation_log))
-  ResourceMark rm;
-  HandleMark hm;
-  Handle compiled_code_handle = JNIHandles::resolve(compiled_code);
-  CodeBlob* cb = NULL;
-  Handle installed_code_handle = JNIHandles::resolve(installed_code);
-  Handle speculation_log_handle = JNIHandles::resolve(speculation_log);
-
-  TraceTime install_time("installCode", GraalCompiler::codeInstallTimer());
-  CodeInstaller installer;
-  GraalEnv::CodeInstallResult result = installer.install(compiled_code_handle, cb, installed_code_handle, speculation_log_handle);
-
-  if (PrintCodeCacheOnCompilation) {
-    stringStream s;
-    // Dump code cache  into a buffer before locking the tty,
-    {
-      MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
-      CodeCache::print_summary(&s, false);
-    }
-    ttyLocker ttyl;
-    tty->print_raw_cr(s.as_string());
-  }
-
-  if (result != GraalEnv::ok) {
-    assert(cb == NULL, "should be");
-  } else {
-    if (!installed_code_handle.is_null()) {
-      assert(installed_code_handle->is_a(InstalledCode::klass()), "wrong type");
-      InstalledCode::set_address(installed_code_handle, (jlong) cb);
-      InstalledCode::set_version(installed_code_handle, InstalledCode::version(installed_code_handle) + 1);
-      if (installed_code_handle->is_a(HotSpotInstalledCode::klass())) {
-        HotSpotInstalledCode::set_size(installed_code_handle, cb->size());
-        HotSpotInstalledCode::set_codeStart(installed_code_handle, (jlong) cb->code_begin());
-        HotSpotInstalledCode::set_codeSize(installed_code_handle, cb->code_size());
-      }
-      nmethod* nm = cb->as_nmethod_or_null();
-      if (nm != NULL && installed_code_handle->is_scavengable()) {
-        assert(nm->detect_scavenge_root_oops(), "nm should be scavengable if installed_code is scavengable");
-        if (!UseG1GC) {
-          assert(nm->on_scavenge_root_list(), "nm should be on scavengable list");
-        }
-      }
-    }
-  }
-  return result;
-C2V_END
-
-C2V_VMENTRY(void, notifyCompilationStatistics, (JNIEnv *jniEnv, jobject, jint id, jobject hotspot_method, jboolean osr, jint processedBytecodes, jlong time, jlong timeUnitsPerSecond, jobject installed_code))
-  CompilerStatistics* stats = GraalCompiler::instance()->stats();
-
-  elapsedTimer timer = elapsedTimer(time, timeUnitsPerSecond);
-  if (osr) {
-    stats->_osr.update(timer, processedBytecodes);
-  } else {
-    stats->_standard.update(timer, processedBytecodes);
-  }
-  Handle installed_code_handle = JNIHandles::resolve(installed_code);
-  if (installed_code_handle->is_a(HotSpotInstalledCode::klass())) {
-    stats->_nmethods_size += HotSpotInstalledCode::size(installed_code_handle);
-    stats->_nmethods_code_size += HotSpotInstalledCode::codeSize(installed_code_handle);
-  }
-
-  if (CITimeEach) {
-    methodHandle method = asMethod(HotSpotResolvedJavaMethodImpl::metaspaceMethod(hotspot_method));
-    float bytes_per_sec = 1.0 * processedBytecodes / timer.seconds();
-    tty->print_cr("%3d   seconds: %f bytes/sec: %f (bytes %d)",
-                  id, timer.seconds(), bytes_per_sec, processedBytecodes);
-  }
-C2V_END
-
-C2V_VMENTRY(void, resetCompilationStatistics, (JNIEnv *jniEnv, jobject))
-  CompilerStatistics* stats = GraalCompiler::instance()->stats();
-  stats->_standard.reset();
-  stats->_osr.reset();
-C2V_END
-
-C2V_VMENTRY(jobject, disassembleCodeBlob, (JNIEnv *jniEnv, jobject, jlong codeBlob))
-  ResourceMark rm;
-  HandleMark hm;
-
-  CodeBlob* cb = (CodeBlob*) (address) codeBlob;
-  if (cb == NULL) {
-    return NULL;
-  }
-
-  // We don't want the stringStream buffer to resize during disassembly as it
-  // uses scoped resource memory. If a nested function called during disassembly uses
-  // a ResourceMark and the buffer expands within the scope of the mark,
-  // the buffer becomes garbage when that scope is exited. Experience shows that
-  // the disassembled code is typically about 10x the code size so a fixed buffer
-  // sized to 20x code size plus a fixed amount for header info should be sufficient.
-  int bufferSize = cb->code_size() * 20 + 1024;
-  char* buffer = NEW_RESOURCE_ARRAY(char, bufferSize);
-  stringStream st(buffer, bufferSize);
-  if (cb->is_nmethod()) {
-    nmethod* nm = (nmethod*) cb;
-    if (!nm->is_alive()) {
-      return NULL;
-    }
-    Disassembler::decode(nm, &st);
-  } else {
-    Disassembler::decode(cb, &st);
-  }
-  if (st.size() <= 0) {
-    return NULL;
-  }
-
-  Handle result = java_lang_String::create_from_platform_dependent_str(st.as_string(), CHECK_NULL);
-  return JNIHandles::make_local(THREAD, result());
-C2V_END
-
-C2V_VMENTRY(jobject, getStackTraceElement, (JNIEnv*, jobject, jlong metaspace_method, int bci))
-  ResourceMark rm;
-  HandleMark hm;
-
-  methodHandle method = asMethod(metaspace_method);
-  oop element = java_lang_StackTraceElement::create(method, bci, CHECK_NULL);
-  return JNIHandles::make_local(THREAD, element);
-C2V_END
-
-C2V_VMENTRY(jobject, executeCompiledMethodVarargs, (JNIEnv*, jobject, jobject args, jobject hotspotInstalledCode))
-  ResourceMark rm;
-  HandleMark hm;
-
-  jlong nmethodValue = InstalledCode::address(hotspotInstalledCode);
-  if (nmethodValue == 0L) {
-    THROW_(vmSymbols::com_oracle_graal_api_code_InvalidInstalledCodeException(), NULL);
-  }
-  nmethod* nm = (nmethod*) (address) nmethodValue;
-  methodHandle mh = nm->method();
-  Symbol* signature = mh->signature();
-  JavaCallArguments jca(mh->size_of_parameters());
-
-  JavaArgumentUnboxer jap(signature, &jca, (arrayOop) JNIHandles::resolve(args), mh->is_static());
-  JavaValue result(jap.get_ret_type());
-  jca.set_alternative_target(nm);
-  JavaCalls::call(&result, mh, &jca, CHECK_NULL);
-
-  if (jap.get_ret_type() == T_VOID) {
-    return NULL;
-  } else if (jap.get_ret_type() == T_OBJECT || jap.get_ret_type() == T_ARRAY) {
-    return JNIHandles::make_local(THREAD, (oop) result.get_jobject());
-  } else {
-    jvalue *value = (jvalue *) result.get_value_addr();
-    // Narrow the value down if required (Important on big endian machines)
-    switch (jap.get_ret_type()) {
-      case T_BOOLEAN:
-       value->z = (jboolean) value->i;
-       break;
-      case T_BYTE:
-       value->b = (jbyte) value->i;
-       break;
-      case T_CHAR:
-       value->c = (jchar) value->i;
-       break;
-      case T_SHORT:
-       value->s = (jshort) value->i;
-       break;
-     }
-    oop o = java_lang_boxing_object::create(jap.get_ret_type(), value, CHECK_NULL);
-    return JNIHandles::make_local(THREAD, o);
-  }
-C2V_END
-
-C2V_VMENTRY(jlongArray, getLineNumberTable, (JNIEnv *, jobject, jlong metaspace_method))
-  Method* method = (Method*) metaspace_method;
-  if (!method->has_linenumber_table()) {
-    return NULL;
-  }
-  u2 num_entries = 0;
-  CompressedLineNumberReadStream streamForSize(method->compressed_linenumber_table());
-  while (streamForSize.read_pair()) {
-    num_entries++;
-  }
-
-  CompressedLineNumberReadStream stream(method->compressed_linenumber_table());
-  typeArrayOop result = oopFactory::new_longArray(2 * num_entries, CHECK_NULL);
-
-  int i = 0;
-  jlong value;
-  while (stream.read_pair()) {
-    value = ((long) stream.bci());
-    result->long_at_put(i, value);
-    value = ((long) stream.line());
-    result->long_at_put(i + 1, value);
-    i += 2;
-  }
-
-  return (jlongArray) JNIHandles::make_local(THREAD, result);
-C2V_END
-
-C2V_VMENTRY(jlong, getLocalVariableTableStart, (JNIEnv *, jobject, jlong metaspace_method))
-  ResourceMark rm;
-  Method* method = (Method*) metaspace_method;
-  if (!method->has_localvariable_table()) {
-    return 0;
-  }
-  return (jlong) (address) method->localvariable_table_start();
-C2V_END
-
-C2V_VMENTRY(jint, getLocalVariableTableLength, (JNIEnv *, jobject, jlong metaspace_method))
-  ResourceMark rm;
-  Method* method = (Method*) metaspace_method;
-  return method->localvariable_table_length();
-C2V_END
-
-C2V_VMENTRY(void, reprofile, (JNIEnv*, jobject, jlong metaspace_method))
-  Method* method = asMethod(metaspace_method);
-  MethodCounters* mcs = method->method_counters();
-  if (mcs != NULL) {
-    mcs->clear_counters();
-  }
-  NOT_PRODUCT(method->set_compiled_invocation_count(0));
-
-  nmethod* code = method->code();
-  if (code != NULL) {
-    code->make_not_entrant();
-  }
-
-  MethodData* method_data = method->method_data();
-  if (method_data == NULL) {
-    ClassLoaderData* loader_data = method->method_holder()->class_loader_data();
-    method_data = MethodData::allocate(loader_data, method, CHECK);
-    method->set_method_data(method_data);
-  } else {
-    method_data->initialize();
-  }
-C2V_END
-
-
-C2V_VMENTRY(void, invalidateInstalledCode, (JNIEnv*, jobject, jobject hotspotInstalledCode))
-  jlong nativeMethod = InstalledCode::address(hotspotInstalledCode);
-  nmethod* m = (nmethod*)nativeMethod;
-  if (m != NULL && !m->is_not_entrant()) {
-    m->mark_for_deoptimization();
-    VM_Deoptimize op;
-    VMThread::execute(&op);
-  }
-  InstalledCode::set_address(hotspotInstalledCode, 0);
-C2V_END
-
-C2V_VMENTRY(jobject, getJavaMirror, (JNIEnv* env, jobject, jlong metaspace_klass))
-  Klass* klass = asKlass(metaspace_klass);
-  return JNIHandles::make_local(THREAD, klass->java_mirror());
-C2V_END
-
-C2V_VMENTRY(jlong, readUnsafeKlassPointer, (JNIEnv*, jobject, jobject o))
-  oop resolved_o = JNIHandles::resolve(o);
-  jlong klass = (jlong)(address)resolved_o->klass();
-  return klass;
-C2V_END
-
-C2V_VMENTRY(jobject, readUncompressedOop, (JNIEnv*, jobject, jlong addr))
-  oop ret = oopDesc::load_decode_heap_oop((oop*)(address)addr);
-  return JNIHandles::make_local(THREAD, ret);
-C2V_END
-
-C2V_VMENTRY(jlongArray, collectCounters, (JNIEnv*, jobject))
-  typeArrayOop arrayOop = oopFactory::new_longArray(GraalCounterSize, CHECK_NULL);
-  JavaThread::collect_counters(arrayOop);
-  return (jlongArray) JNIHandles::make_local(THREAD, arrayOop);
-C2V_END
-
-C2V_VMENTRY(int, allocateCompileId, (JNIEnv*, jobject, jlong metaspace_method, int entry_bci))
-  HandleMark hm;
-  ResourceMark rm;
-  Method* method = (Method*) metaspace_method;
-  return CompileBroker::assign_compile_id_unlocked(THREAD, method, entry_bci);
-C2V_END
-
-
-C2V_VMENTRY(jboolean, isMature, (JNIEnv*, jobject, jlong metaspace_method_data))
-  MethodData* mdo = asMethodData(metaspace_method_data);
-  return mdo != NULL && mdo->is_mature();
-C2V_END
-
-C2V_VMENTRY(jboolean, hasCompiledCodeForOSR, (JNIEnv*, jobject, jlong metaspace_method, int entry_bci, int comp_level))
-  Method* method = asMethod(metaspace_method);
-  return method->lookup_osr_nmethod_for(entry_bci, comp_level, true) != NULL;
-C2V_END
-
-C2V_VMENTRY(jlong, getTimeStamp, (JNIEnv*, jobject))
-  // tty->time_stamp is the time since VM start which should be used
-  // for all HotSpot log output when a timestamp is required.
-  return tty->time_stamp().milliseconds();
-C2V_END
-
-C2V_VMENTRY(jobject, getSymbol, (JNIEnv*, jobject, jlong metaspaceSymbol))
-  Handle sym = java_lang_String::create_from_symbol((Symbol*)(address)metaspaceSymbol, CHECK_NULL);
-  return JNIHandles::make_local(THREAD, sym());
-C2V_END
-
-bool matches(jlongArray methods, Method* method) {
-  typeArrayOop methods_oop = (typeArrayOop) JNIHandles::resolve(methods);
-
-  for (int i = 0; i < methods_oop->length(); i++) {
-    if (methods_oop->long_at(i) == (jlong) method) {
-      return true;
-    }
-  }
-  return false;
-}
-
-C2V_VMENTRY(jobject, getNextStackFrame, (JNIEnv*, jobject compilerToVM, jobject hs_frame, jlongArray methods, jint initialSkip))
-  ResourceMark rm;
-
-  if (!thread->has_last_Java_frame()) return NULL;
-  Handle result = InstanceKlass::cast(HotSpotStackFrameReference::klass())->allocate_instance(thread);
-  HotSpotStackFrameReference::klass()->initialize(thread);
-
-  StackFrameStream fst(thread);
-  if (hs_frame != NULL) {
-    // look for the correct stack frame if one is given
-    intptr_t* stack_pointer = (intptr_t*) HotSpotStackFrameReference::stackPointer(hs_frame);
-    while (fst.current()->sp() != stack_pointer && !fst.is_done()) {
-      fst.next();
-    }
-    if (fst.current()->sp() != stack_pointer) {
-      THROW_MSG_NULL(vmSymbols::java_lang_IllegalStateException(), "stack frame not found")
-    }
-  }
-
-  int frame_number = 0;
-  vframe* vf = vframe::new_vframe(fst.current(), fst.register_map(), thread);
-  if (hs_frame != NULL) {
-    // look for the correct vframe within the stack frame if one is given
-    int last_frame_number = HotSpotStackFrameReference::frameNumber(hs_frame);
-    while (frame_number < last_frame_number) {
-      if (vf->is_top()) {
-        THROW_MSG_NULL(vmSymbols::java_lang_IllegalStateException(), "invalid frame number")
-      }
-      vf = vf->sender();
-      frame_number ++;
-    }
-    // move one frame forward
-    if (vf->is_top()) {
-      if (fst.is_done()) {
-        return NULL;
-      }
-      fst.next();
-      vf = vframe::new_vframe(fst.current(), fst.register_map(), thread);
-      frame_number = 0;
-    } else {
-      vf = vf->sender();
-      frame_number++;
-    }
-  }
-
-  while (true) {
-    // look for the given method
-    while (true) {
-      StackValueCollection* locals = NULL;
-      if (vf->is_compiled_frame()) {
-        // compiled method frame
-        compiledVFrame* cvf = compiledVFrame::cast(vf);
-        if (methods == NULL || matches(methods, cvf->method())) {
-          if (initialSkip > 0) {
-            initialSkip --;
-          } else {
-            GrowableArray<ScopeValue*>* objects = cvf->scope()->objects();
-            bool reallocated = false;
-            if (objects != NULL) {
-              reallocated = Deoptimization::realloc_objects(thread, fst.current(), objects, THREAD);
-              Deoptimization::reassign_fields(fst.current(), fst.register_map(), objects, reallocated);
-
-              GrowableArray<ScopeValue*>* local_values = cvf->scope()->locals();
-              typeArrayHandle array = oopFactory::new_boolArray(local_values->length(), thread);
-              for (int i = 0; i < local_values->length(); i++) {
-                ScopeValue* value = local_values->at(i);
-                if (value->is_object()) {
-                  array->bool_at_put(i, true);
-                }
-              }
-              HotSpotStackFrameReference::set_localIsVirtual(result, array());
-            } else {
-              HotSpotStackFrameReference::set_localIsVirtual(result, NULL);
-            }
-
-            locals = cvf->locals();
-            HotSpotStackFrameReference::set_bci(result, cvf->bci());
-            HotSpotStackFrameReference::set_metaspaceMethod(result, (jlong) cvf->method());
-          }
-        }
-      } else if (vf->is_interpreted_frame()) {
-        // interpreted method frame
-        interpretedVFrame* ivf = interpretedVFrame::cast(vf);
-        if (methods == NULL || matches(methods, ivf->method())) {
-          if (initialSkip > 0) {
-            initialSkip --;
-          } else {
-            locals = ivf->locals();
-            HotSpotStackFrameReference::set_bci(result, ivf->bci());
-            HotSpotStackFrameReference::set_metaspaceMethod(result, (jlong) ivf->method());
-            HotSpotStackFrameReference::set_localIsVirtual(result, NULL);
-          }
-        }
-      }
-
-      // locals != NULL means that we found a matching frame and result is already partially initialized
-      if (locals != NULL) {
-        HotSpotStackFrameReference::set_compilerToVM(result, JNIHandles::resolve(compilerToVM));
-        HotSpotStackFrameReference::set_stackPointer(result, (jlong) fst.current()->sp());
-        HotSpotStackFrameReference::set_frameNumber(result, frame_number);
-
-        // initialize the locals array
-        objArrayHandle array = oopFactory::new_objectArray(locals->size(), thread);
-        for (int i = 0; i < locals->size(); i++) {
-          StackValue* var = locals->at(i);
-          if (var->type() == T_OBJECT) {
-            array->obj_at_put(i, locals->at(i)->get_obj()());
-          }
-        }
-        HotSpotStackFrameReference::set_locals(result, array());
-
-        return JNIHandles::make_local(thread, result());
-      }
-
-      if (vf->is_top()) {
-        break;
-      }
-      frame_number++;
-      vf = vf->sender();
-    } // end of vframe loop
-
-    if (fst.is_done()) {
-      break;
-    }
-    fst.next();
-    vf = vframe::new_vframe(fst.current(), fst.register_map(), thread);
-    frame_number = 0;
-  } // end of frame loop
-
-  // the end was reached without finding a matching method
-  return NULL;
-C2V_END
-
-C2V_VMENTRY(void, resolveInvokeDynamic, (JNIEnv*, jobject, jlong metaspace_constant_pool, jint index))
-  ConstantPool* cp = (ConstantPool*)metaspace_constant_pool;
-  CallInfo callInfo;
-  LinkResolver::resolve_invokedynamic(callInfo, cp, index, CHECK);
-  ConstantPoolCacheEntry* cp_cache_entry = cp->invokedynamic_cp_cache_entry_at(index);
-  cp_cache_entry->set_dynamic_call(cp, callInfo);
-C2V_END
-
-C2V_VMENTRY(jboolean, shouldDebugNonSafepoints, (JNIEnv*, jobject))
-  //see compute_recording_non_safepoints in debugInfroRec.cpp
-  if (JvmtiExport::should_post_compiled_method_load() && FLAG_IS_DEFAULT(DebugNonSafepoints)) {
-    return true;
-  }
-  return DebugNonSafepoints;
-C2V_END
-
-// public native void materializeVirtualObjects(HotSpotStackFrameReference stackFrame, boolean invalidate);
-C2V_VMENTRY(void, materializeVirtualObjects, (JNIEnv*, jobject, jobject hs_frame, bool invalidate))
-  ResourceMark rm;
-
-  if (hs_frame == NULL) {
-    THROW_MSG(vmSymbols::java_lang_NullPointerException(), "stack frame is null")
-  }
-
-  HotSpotStackFrameReference::klass()->initialize(thread);
-
-  // look for the given stack frame
-  StackFrameStream fst(thread);
-  intptr_t* stack_pointer = (intptr_t*) HotSpotStackFrameReference::stackPointer(hs_frame);
-  while (fst.current()->sp() != stack_pointer && !fst.is_done()) {
-    fst.next();
-  }
-  if (fst.current()->sp() != stack_pointer) {
-    THROW_MSG(vmSymbols::java_lang_IllegalStateException(), "stack frame not found")
-  }
-
-  if (invalidate) {
-    assert(fst.current()->cb()->is_nmethod(), "nmethod expected");
-    ((nmethod*) fst.current()->cb())->make_not_entrant();
-  }
-  Deoptimization::deoptimize(thread, *fst.current(), fst.register_map(), Deoptimization::Reason_none);
-
-  vframe* vf = vframe::new_vframe(fst.current(), fst.register_map(), thread);
-  if (!vf->is_compiled_frame()) {
-    THROW_MSG(vmSymbols::java_lang_IllegalStateException(), "compiled stack frame expected")
-  }
-
-  GrowableArray<compiledVFrame*>* virtualFrames = new GrowableArray<compiledVFrame*>(10);
-  while (true) {
-    assert(vf->is_compiled_frame(), "Wrong frame type");
-    virtualFrames->push(compiledVFrame::cast(vf));
-    if (vf->is_top()) {
-      break;
-    }
-    vf = vf->sender();
-  }
-
-  int last_frame_number = HotSpotStackFrameReference::frameNumber(hs_frame);
-  if (last_frame_number >= virtualFrames->length()) {
-    THROW_MSG(vmSymbols::java_lang_IllegalStateException(), "invalid frame number")
-  }
-
-  // Reallocate the non-escaping objects and restore their fields.
-  assert (virtualFrames->at(last_frame_number)->scope() != NULL,"invalid scope");
-  GrowableArray<ScopeValue*>* objects = virtualFrames->at(last_frame_number)->scope()->objects();
-
-  if (objects == NULL) {
-    // no objects to materialize
-    return;
-  }
-
-  bool reallocated = Deoptimization::realloc_objects(thread, fst.current(), objects, THREAD);
-  Deoptimization::reassign_fields(fst.current(), fst.register_map(), objects, reallocated);
-
-  for (int frame_index = 0; frame_index < virtualFrames->length(); frame_index++) {
-    compiledVFrame* cvf = virtualFrames->at(frame_index);
-
-    GrowableArray<ScopeValue*>* scopeLocals = cvf->scope()->locals();
-    StackValueCollection* locals = cvf->locals();
-
-    if (locals != NULL) {
-      for (int i2 = 0; i2 < locals->size(); i2++) {
-        StackValue* var = locals->at(i2);
-        if (var->type() == T_OBJECT && scopeLocals->at(i2)->is_object()) {
-          jvalue val;
-          val.l = (jobject) locals->at(i2)->get_obj()();
-          cvf->update_local(T_OBJECT, i2, val);
-        }
-      }
-    }
-  }
-
-  // all locals are materialized by now
-  HotSpotStackFrameReference::set_localIsVirtual(hs_frame, NULL);
-
-  // update the locals array
-  objArrayHandle array = HotSpotStackFrameReference::locals(hs_frame);
-  StackValueCollection* locals = virtualFrames->at(last_frame_number)->locals();
-  for (int i = 0; i < locals->size(); i++) {
-    StackValue* var = locals->at(i);
-    if (var->type() == T_OBJECT) {
-      array->obj_at_put(i, locals->at(i)->get_obj()());
-    }
-  }
-C2V_END
-
-C2V_VMENTRY(void, writeDebugOutput, (JNIEnv*, jobject, jbyteArray bytes, jint offset, jint length))
-  while (length > 0) {
-    jbyte* start = ((typeArrayOop) JNIHandles::resolve(bytes))->byte_at_addr(offset);
-    tty->write((char*) start, MIN2(length, O_BUFLEN));
-    length -= O_BUFLEN;
-    offset += O_BUFLEN;
-  }
-C2V_END
-
-C2V_VMENTRY(void, flushDebugOutput, (JNIEnv*, jobject))
-  tty->flush();
-C2V_END
-
-
-#define CC (char*)  /*cast a literal from (const char*)*/
-#define FN_PTR(f) CAST_FROM_FN_PTR(void*, &(c2v_ ## f))
-
-#define TYPE                  "Lcom/oracle/graal/api/meta/JavaType;"
-#define METHOD                "Lcom/oracle/graal/api/meta/JavaMethod;"
-#define FIELD                 "Lcom/oracle/graal/api/meta/JavaField;"
-#define SPECULATION_LOG       "Lcom/oracle/graal/api/code/SpeculationLog;"
-#define STRING                "Ljava/lang/String;"
-#define OBJECT                "Ljava/lang/Object;"
-#define CLASS                 "Ljava/lang/Class;"
-#define STACK_TRACE_ELEMENT   "Ljava/lang/StackTraceElement;"
-#define HS_RESOLVED_METHOD    "Lcom/oracle/graal/hotspot/meta/HotSpotResolvedJavaMethod;"
-#define RESOLVED_METHOD       "Lcom/oracle/graal/api/meta/ResolvedJavaMethod;"
-#define HS_COMPILED_CODE      "Lcom/oracle/graal/hotspot/HotSpotCompiledCode;"
-#define HS_CONFIG             "Lcom/oracle/graal/hotspot/HotSpotVMConfig;"
-#define INSTALLED_CODE        "Lcom/oracle/graal/api/code/InstalledCode;"
-#define HS_STACK_FRAME_REF    "Lcom/oracle/graal/hotspot/HotSpotStackFrameReference;"
-#define METASPACE_KLASS       "J"
-#define METASPACE_METHOD      "J"
-#define METASPACE_METHOD_DATA "J"
-#define METASPACE_CONSTANT_POOL "J"
-
-JNINativeMethod CompilerToVM_methods[] = {
-  {CC"getBytecode",                                  CC"("METASPACE_METHOD")[B",                                               FN_PTR(getBytecode)},
-  {CC"exceptionTableStart",                          CC"("METASPACE_METHOD")J",                                                FN_PTR(exceptionTableStart)},
-  {CC"exceptionTableLength",                         CC"("METASPACE_METHOD")I",                                                FN_PTR(exceptionTableLength)},
-  {CC"hasBalancedMonitors",                          CC"("METASPACE_METHOD")Z",                                                FN_PTR(hasBalancedMonitors)},
-  {CC"findUniqueConcreteMethod",                     CC"("METASPACE_KLASS METASPACE_METHOD")"METASPACE_METHOD,                 FN_PTR(findUniqueConcreteMethod)},
-  {CC"getKlassImplementor",                          CC"("METASPACE_KLASS")"METASPACE_KLASS,                                   FN_PTR(getKlassImplementor)},
-  {CC"getStackTraceElement",                         CC"("METASPACE_METHOD"I)"STACK_TRACE_ELEMENT,                             FN_PTR(getStackTraceElement)},
-  {CC"methodIsIgnoredBySecurityStackWalk",           CC"("METASPACE_METHOD")Z",                                                FN_PTR(methodIsIgnoredBySecurityStackWalk)},
-  {CC"doNotInlineOrCompile",                         CC"("METASPACE_METHOD")V",                                                FN_PTR(doNotInlineOrCompile)},
-  {CC"canInlineMethod",                              CC"("METASPACE_METHOD")Z",                                                FN_PTR(canInlineMethod)},
-  {CC"shouldInlineMethod",                           CC"("METASPACE_METHOD")Z",                                                FN_PTR(shouldInlineMethod)},
-  {CC"lookupType",                                   CC"("STRING CLASS"Z)"METASPACE_KLASS,                                     FN_PTR(lookupType)},
-  {CC"resolveConstantInPool",                        CC"("METASPACE_CONSTANT_POOL"I)"OBJECT,                                   FN_PTR(resolveConstantInPool)},
-  {CC"resolvePossiblyCachedConstantInPool",          CC"("METASPACE_CONSTANT_POOL"I)"OBJECT,                                   FN_PTR(resolvePossiblyCachedConstantInPool)},
-  {CC"lookupNameRefInPool",                          CC"("METASPACE_CONSTANT_POOL"I)"STRING,                                   FN_PTR(lookupNameRefInPool)},
-  {CC"lookupNameAndTypeRefIndexInPool",              CC"("METASPACE_CONSTANT_POOL"I)I",                                        FN_PTR(lookupNameAndTypeRefIndexInPool)},
-  {CC"lookupSignatureRefInPool",                     CC"("METASPACE_CONSTANT_POOL"I)"STRING,                                   FN_PTR(lookupSignatureRefInPool)},
-  {CC"lookupKlassRefIndexInPool",                    CC"("METASPACE_CONSTANT_POOL"I)I",                                        FN_PTR(lookupKlassRefIndexInPool)},
-  {CC"constantPoolKlassAt",                          CC"("METASPACE_CONSTANT_POOL"I)"METASPACE_KLASS,                          FN_PTR(constantPoolKlassAt)},
-  {CC"lookupKlassInPool",                            CC"("METASPACE_CONSTANT_POOL"I)"METASPACE_KLASS,                          FN_PTR(lookupKlassInPool)},
-  {CC"lookupAppendixInPool",                         CC"("METASPACE_CONSTANT_POOL"I)"OBJECT,                                   FN_PTR(lookupAppendixInPool)},
-  {CC"lookupMethodInPool",                           CC"("METASPACE_CONSTANT_POOL"IB)"METASPACE_METHOD,                        FN_PTR(lookupMethodInPool)},
-  {CC"constantPoolRemapInstructionOperandFromCache", CC"("METASPACE_CONSTANT_POOL"I)I",                                        FN_PTR(constantPoolRemapInstructionOperandFromCache)},
-  {CC"resolveField",                                 CC"("METASPACE_CONSTANT_POOL"IB[J)"METASPACE_KLASS,                       FN_PTR(resolveField)},
-  {CC"resolveInvokeDynamic",                         CC"("METASPACE_CONSTANT_POOL"I)V",                                        FN_PTR(resolveInvokeDynamic)},
-  {CC"resolveMethod",                                CC"("METASPACE_KLASS METASPACE_METHOD METASPACE_KLASS")"METASPACE_METHOD, FN_PTR(resolveMethod)},
-  {CC"getVtableIndexForInterface",                   CC"("METASPACE_KLASS METASPACE_METHOD")I",                                FN_PTR(getVtableIndexForInterface)},
-  {CC"getClassInitializer",                          CC"("METASPACE_KLASS")"METASPACE_METHOD,                                  FN_PTR(getClassInitializer)},
-  {CC"hasFinalizableSubclass",                       CC"("METASPACE_KLASS")Z",                                                 FN_PTR(hasFinalizableSubclass)},
-  {CC"getMaxCallTargetOffset",                       CC"(J)J",                                                                 FN_PTR(getMaxCallTargetOffset)},
-  {CC"getMetaspaceMethod",                           CC"("CLASS"I)"METASPACE_METHOD,                                           FN_PTR(getMetaspaceMethod)},
-  {CC"initializeConfiguration",                      CC"("HS_CONFIG")V",                                                       FN_PTR(initializeConfiguration)},
-  {CC"installCode",                                  CC"("HS_COMPILED_CODE INSTALLED_CODE SPECULATION_LOG")I",                 FN_PTR(installCode)},
-  {CC"notifyCompilationStatistics",                  CC"(I"HS_RESOLVED_METHOD"ZIJJ"INSTALLED_CODE")V",                         FN_PTR(notifyCompilationStatistics)},
-  {CC"resetCompilationStatistics",                   CC"()V",                                                                  FN_PTR(resetCompilationStatistics)},
-  {CC"disassembleCodeBlob",                          CC"(J)"STRING,                                                            FN_PTR(disassembleCodeBlob)},
-  {CC"executeCompiledMethodVarargs",                 CC"(["OBJECT INSTALLED_CODE")"OBJECT,                                     FN_PTR(executeCompiledMethodVarargs)},
-  {CC"getLineNumberTable",                           CC"("METASPACE_METHOD")[J",                                               FN_PTR(getLineNumberTable)},
-  {CC"getLocalVariableTableStart",                   CC"("METASPACE_METHOD")J",                                                FN_PTR(getLocalVariableTableStart)},
-  {CC"getLocalVariableTableLength",                  CC"("METASPACE_METHOD")I",                                                FN_PTR(getLocalVariableTableLength)},
-  {CC"reprofile",                                    CC"("METASPACE_METHOD")V",                                                FN_PTR(reprofile)},
-  {CC"invalidateInstalledCode",                      CC"("INSTALLED_CODE")V",                                                  FN_PTR(invalidateInstalledCode)},
-  {CC"getJavaMirror",                                CC"("METASPACE_KLASS")"CLASS,                                             FN_PTR(getJavaMirror)},
-  {CC"readUnsafeKlassPointer",                       CC"("OBJECT")J",                                                          FN_PTR(readUnsafeKlassPointer)},
-  {CC"readUncompressedOop",                          CC"(J)"OBJECT,                                                            FN_PTR(readUncompressedOop)},
-  {CC"collectCounters",                              CC"()[J",                                                                 FN_PTR(collectCounters)},
-  {CC"allocateCompileId",                            CC"("METASPACE_METHOD"I)I",                                               FN_PTR(allocateCompileId)},
-  {CC"isMature",                                     CC"("METASPACE_METHOD_DATA")Z",                                           FN_PTR(isMature)},
-  {CC"hasCompiledCodeForOSR",                        CC"("METASPACE_METHOD"II)Z",                                              FN_PTR(hasCompiledCodeForOSR)},
-  {CC"getSymbol",                                    CC"(J)"STRING,                                                            FN_PTR(getSymbol)},
-  {CC"getTimeStamp",                                 CC"()J",                                                                  FN_PTR(getTimeStamp)},
-  {CC"getNextStackFrame",                            CC"("HS_STACK_FRAME_REF "[JI)"HS_STACK_FRAME_REF,                         FN_PTR(getNextStackFrame)},
-  {CC"materializeVirtualObjects",                    CC"("HS_STACK_FRAME_REF"Z)V",                                             FN_PTR(materializeVirtualObjects)},
-  {CC"shouldDebugNonSafepoints",                     CC"()Z",                                                                  FN_PTR(shouldDebugNonSafepoints)},
-  {CC"writeDebugOutput",                             CC"([BII)V",                                                              FN_PTR(writeDebugOutput)},
-  {CC"flushDebugOutput",                             CC"()V",                                                                  FN_PTR(flushDebugOutput)},
-};
-
-int CompilerToVM_methods_count() {
-  return sizeof(CompilerToVM_methods) / sizeof(JNINativeMethod);
-}
-
--- a/src/share/vm/graal/graalCompilerToVM.hpp	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,108 +0,0 @@
-/*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-#ifndef SHARE_VM_GRAAL_GRAAL_COMPILER_TO_VM_HPP
-#define SHARE_VM_GRAAL_GRAAL_COMPILER_TO_VM_HPP
-
-#include "prims/jni.h"
-#include "runtime/javaCalls.hpp"
-
-class CompilerToVM {
-public:
-  /**
-   * Tag bits used by lookupKlassInPool to distinguish the types in Java.
-   */
-  enum Tags {
-    KLASS_TAG = 0x0,
-    SYMBOL_TAG = 0x1
-  };
-
-  static intptr_t tag_pointer(Klass* klass) {
-    return ((intptr_t) klass) | KLASS_TAG;
-  }
-
-  static intptr_t tag_pointer(Symbol* symbol) {
-    return ((intptr_t) symbol) | SYMBOL_TAG;
-  }
-
-  // nothing here - no need to define the jni method implementations in a header file
-};
-
-extern JNINativeMethod CompilerToVM_methods[];
-int CompilerToVM_methods_count();
-
-inline Method* asMethod(jlong metaspaceMethod) {
-  return (Method*) (address) metaspaceMethod;
-}
-
-inline MethodData* asMethodData(jlong metaspaceMethodData) {
-  return (MethodData*) (address) metaspaceMethodData;
-}
-
-inline Klass* asKlass(jlong metaspaceKlass) {
-  return (Klass*) (address) metaspaceKlass;
-}
-
-class JavaArgumentUnboxer : public SignatureIterator {
- protected:
-  JavaCallArguments*  _jca;
-  arrayOop _args;
-  int _index;
-
-  oop next_arg(BasicType expectedType) {
-    assert(_index < _args->length(), "out of bounds");
-    oop arg=((objArrayOop) (_args))->obj_at(_index++);
-    assert(expectedType == T_OBJECT || java_lang_boxing_object::is_instance(arg, expectedType), "arg type mismatch");
-    return arg;
-  }
-
- public:
-  JavaArgumentUnboxer(Symbol* signature, JavaCallArguments*  jca, arrayOop args, bool is_static) : SignatureIterator(signature) {
-    this->_return_type = T_ILLEGAL;
-    _jca = jca;
-    _index = 0;
-    _args = args;
-    if (!is_static) {
-      _jca->push_oop(next_arg(T_OBJECT));
-    }
-    iterate();
-    assert(_index == args->length(), "arg count mismatch with signature");
-  }
-
-  inline void do_bool()   { if (!is_return_type()) _jca->push_int(next_arg(T_BOOLEAN)->bool_field(java_lang_boxing_object::value_offset_in_bytes(T_BOOLEAN))); }
-  inline void do_char()   { if (!is_return_type()) _jca->push_int(next_arg(T_CHAR)->char_field(java_lang_boxing_object::value_offset_in_bytes(T_CHAR))); }
-  inline void do_short()  { if (!is_return_type()) _jca->push_int(next_arg(T_SHORT)->short_field(java_lang_boxing_object::value_offset_in_bytes(T_SHORT))); }
-  inline void do_byte()   { if (!is_return_type()) _jca->push_int(next_arg(T_BYTE)->byte_field(java_lang_boxing_object::value_offset_in_bytes(T_BYTE))); }
-  inline void do_int()    { if (!is_return_type()) _jca->push_int(next_arg(T_INT)->int_field(java_lang_boxing_object::value_offset_in_bytes(T_INT))); }
-
-  inline void do_long()   { if (!is_return_type()) _jca->push_long(next_arg(T_LONG)->long_field(java_lang_boxing_object::value_offset_in_bytes(T_LONG))); }
-  inline void do_float()  { if (!is_return_type()) _jca->push_float(next_arg(T_FLOAT)->float_field(java_lang_boxing_object::value_offset_in_bytes(T_FLOAT))); }
-  inline void do_double() { if (!is_return_type()) _jca->push_double(next_arg(T_DOUBLE)->double_field(java_lang_boxing_object::value_offset_in_bytes(T_DOUBLE))); }
-
-  inline void do_object() { _jca->push_oop(next_arg(T_OBJECT)); }
-  inline void do_object(int begin, int end) { if (!is_return_type()) _jca->push_oop(next_arg(T_OBJECT)); }
-  inline void do_array(int begin, int end)  { if (!is_return_type()) _jca->push_oop(next_arg(T_OBJECT)); }
-  inline void do_void()                     { }
-};
-
-#endif // SHARE_VM_GRAAL_GRAAL_COMPILER_TO_VM_HPP
--- a/src/share/vm/graal/graalEnv.cpp	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,617 +0,0 @@
-/*
- * Copyright (c) 1999, 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.
- *
- */
-
-#include "precompiled.hpp"
-#include "graal/graalEnv.hpp"
-#include "classfile/systemDictionary.hpp"
-#include "classfile/vmSymbols.hpp"
-#include "code/scopeDesc.hpp"
-#include "runtime/sweeper.hpp"
-#include "compiler/compileBroker.hpp"
-#include "compiler/compileLog.hpp"
-#include "compiler/compilerOracle.hpp"
-#include "interpreter/linkResolver.hpp"
-#include "memory/allocation.inline.hpp"
-#include "memory/oopFactory.hpp"
-#include "memory/universe.inline.hpp"
-#include "oops/methodData.hpp"
-#include "oops/objArrayKlass.hpp"
-#include "prims/jvmtiExport.hpp"
-#include "runtime/init.hpp"
-#include "runtime/reflection.hpp"
-#include "runtime/sharedRuntime.hpp"
-#include "utilities/dtrace.hpp"
-#include "graal/graalRuntime.hpp"
-#include "graal/graalJavaAccess.hpp"
-
-GraalEnv::GraalEnv(CompileTask* task, int system_dictionary_modification_counter) {
-  _task = task;
-  _system_dictionary_modification_counter = system_dictionary_modification_counter;
-  {
-    // Get Jvmti capabilities under lock to get consistent values.
-    MutexLocker mu(JvmtiThreadState_lock);
-    _jvmti_can_hotswap_or_post_breakpoint = JvmtiExport::can_hotswap_or_post_breakpoint();
-    _jvmti_can_access_local_variables     = JvmtiExport::can_access_local_variables();
-    _jvmti_can_post_on_exceptions         = JvmtiExport::can_post_on_exceptions();
-  }
-}
-
-// ------------------------------------------------------------------
-// Note: the logic of this method should mirror the logic of
-// constantPoolOopDesc::verify_constant_pool_resolve.
-bool GraalEnv::check_klass_accessibility(KlassHandle accessing_klass, KlassHandle resolved_klass) {
-  if (accessing_klass->oop_is_objArray()) {
-    accessing_klass = ObjArrayKlass::cast(accessing_klass())->bottom_klass();
-  }
-  if (!accessing_klass->oop_is_instance()) {
-    return true;
-  }
-
-  if (resolved_klass->oop_is_objArray()) {
-    // Find the element klass, if this is an array.
-    resolved_klass = ObjArrayKlass::cast(resolved_klass())->bottom_klass();
-  }
-  if (resolved_klass->oop_is_instance()) {
-    return Reflection::verify_class_access(accessing_klass(), resolved_klass(), true);
-  }
-  return true;
-}
-
-// ------------------------------------------------------------------
-KlassHandle GraalEnv::get_klass_by_name_impl(KlassHandle& accessing_klass,
-                                          constantPoolHandle& cpool,
-                                          Symbol* sym,
-                                          bool require_local) {
-  GRAAL_EXCEPTION_CONTEXT;
-
-  // Now we need to check the SystemDictionary
-  if (sym->byte_at(0) == 'L' &&
-    sym->byte_at(sym->utf8_length()-1) == ';') {
-    // This is a name from a signature.  Strip off the trimmings.
-    // Call recursive to keep scope of strippedsym.
-    TempNewSymbol strippedsym = SymbolTable::new_symbol(sym->as_utf8()+1,
-                    sym->utf8_length()-2,
-                    CHECK_(KlassHandle()));
-    return get_klass_by_name_impl(accessing_klass, cpool, strippedsym, require_local);
-  }
-
-  Handle loader(THREAD, (oop)NULL);
-  Handle domain(THREAD, (oop)NULL);
-  if (!accessing_klass.is_null()) {
-    loader = Handle(THREAD, accessing_klass->class_loader());
-    domain = Handle(THREAD, accessing_klass->protection_domain());
-  }
-
-  KlassHandle found_klass;
-  {
-    ttyUnlocker ttyul;  // release tty lock to avoid ordering problems
-    MutexLocker ml(Compile_lock);
-    Klass*  kls;
-    if (!require_local) {
-      kls = SystemDictionary::find_constrained_instance_or_array_klass(sym, loader, CHECK_(KlassHandle()));
-    } else {
-      kls = SystemDictionary::find_instance_or_array_klass(sym, loader, domain, CHECK_(KlassHandle()));
-    }
-    found_klass = KlassHandle(THREAD, kls);
-  }
-
-  // If we fail to find an array klass, look again for its element type.
-  // The element type may be available either locally or via constraints.
-  // In either case, if we can find the element type in the system dictionary,
-  // we must build an array type around it.  The CI requires array klasses
-  // to be loaded if their element klasses are loaded, except when memory
-  // is exhausted.
-  if (sym->byte_at(0) == '[' &&
-      (sym->byte_at(1) == '[' || sym->byte_at(1) == 'L')) {
-    // We have an unloaded array.
-    // Build it on the fly if the element class exists.
-    TempNewSymbol elem_sym = SymbolTable::new_symbol(sym->as_utf8()+1,
-                                                 sym->utf8_length()-1,
-                                                 CHECK_(KlassHandle()));
-
-    // Get element Klass recursively.
-    KlassHandle elem_klass =
-      get_klass_by_name_impl(accessing_klass,
-                             cpool,
-                             elem_sym,
-                             require_local);
-    if (!elem_klass.is_null()) {
-      // Now make an array for it
-      return elem_klass->array_klass(CHECK_(KlassHandle()));
-    }
-  }
-
-  if (found_klass.is_null() && !cpool.is_null() && cpool->has_preresolution()) {
-    // Look inside the constant pool for pre-resolved class entries.
-    for (int i = cpool->length() - 1; i >= 1; i--) {
-      if (cpool->tag_at(i).is_klass()) {
-        Klass*  kls = cpool->resolved_klass_at(i);
-        if (kls->name() == sym) {
-          return kls;
-        }
-      }
-    }
-  }
-
-  return found_klass();
-}
-
-// ------------------------------------------------------------------
-KlassHandle GraalEnv::get_klass_by_name(KlassHandle& accessing_klass,
-                                  Symbol* klass_name,
-                                  bool require_local) {
-  ResourceMark rm;
-  constantPoolHandle cpool;
-  return get_klass_by_name_impl(accessing_klass,
-                                                 cpool,
-                                                 klass_name,
-                                                 require_local);
-}
-
-// ------------------------------------------------------------------
-// Implementation of get_klass_by_index.
-KlassHandle GraalEnv::get_klass_by_index_impl(constantPoolHandle& cpool,
-                                        int index,
-                                        bool& is_accessible,
-                                        KlassHandle& accessor) {
-  GRAAL_EXCEPTION_CONTEXT;
-  KlassHandle klass (THREAD, ConstantPool::klass_at_if_loaded(cpool, index));
-  Symbol* klass_name = NULL;
-  if (klass.is_null()) {
-    // The klass has not been inserted into the constant pool.
-    // Try to look it up by name.
-    {
-      // We have to lock the cpool to keep the oop from being resolved
-      // while we are accessing it.
-      MonitorLockerEx ml(cpool->lock());
-
-      constantTag tag = cpool->tag_at(index);
-      if (tag.is_klass()) {
-        // The klass has been inserted into the constant pool
-        // very recently.
-        klass = KlassHandle(THREAD, cpool->resolved_klass_at(index));
-      } else if (tag.is_symbol()) {
-        klass_name = cpool->symbol_at(index);
-      } else {
-        assert(cpool->tag_at(index).is_unresolved_klass(), "wrong tag");
-        klass_name = cpool->unresolved_klass_at(index);
-      }
-    }
-  }
-
-  if (klass.is_null()) {
-    // Not found in constant pool.  Use the name to do the lookup.
-    KlassHandle k = get_klass_by_name_impl(accessor,
-                                        cpool,
-                                        klass_name,
-                                        false);
-    // Calculate accessibility the hard way.
-    if (k.is_null()) {
-      is_accessible = false;
-    } else if (k->class_loader() != accessor->class_loader() &&
-               get_klass_by_name_impl(accessor, cpool, k->name(), true).is_null()) {
-      // Loaded only remotely.  Not linked yet.
-      is_accessible = false;
-    } else {
-      // Linked locally, and we must also check public/private, etc.
-      is_accessible = check_klass_accessibility(accessor, k);
-    }
-    if (!is_accessible) {
-      return KlassHandle();
-    }
-    return k;
-  }
-
-  // It is known to be accessible, since it was found in the constant pool.
-  is_accessible = true;
-  return klass;
-}
-
-// ------------------------------------------------------------------
-// Get a klass from the constant pool.
-KlassHandle GraalEnv::get_klass_by_index(constantPoolHandle& cpool,
-                                   int index,
-                                   bool& is_accessible,
-                                   KlassHandle& accessor) {
-  ResourceMark rm;
-  KlassHandle result = get_klass_by_index_impl(cpool, index, is_accessible, accessor);
-  return result;
-}
-
-// ------------------------------------------------------------------
-// Implementation of get_field_by_index.
-//
-// Implementation note: the results of field lookups are cached
-// in the accessor klass.
-void GraalEnv::get_field_by_index_impl(instanceKlassHandle& klass, fieldDescriptor& field_desc,
-                                        int index) {
-  GRAAL_EXCEPTION_CONTEXT;
-
-  assert(klass->is_linked(), "must be linked before using its constant-pool");
-
-  constantPoolHandle cpool(thread, klass->constants());
-
-  // Get the field's name, signature, and type.
-  Symbol* name  = cpool->name_ref_at(index);
-
-  int nt_index = cpool->name_and_type_ref_index_at(index);
-  int sig_index = cpool->signature_ref_index_at(nt_index);
-  Symbol* signature = cpool->symbol_at(sig_index);
-
-  // Get the field's declared holder.
-  int holder_index = cpool->klass_ref_index_at(index);
-  bool holder_is_accessible;
-  KlassHandle declared_holder = get_klass_by_index(cpool, holder_index,
-                                               holder_is_accessible,
-                                               klass);
-
-  // The declared holder of this field may not have been loaded.
-  // Bail out with partial field information.
-  if (!holder_is_accessible) {
-    return;
-  }
-
-
-  // Perform the field lookup.
-  Klass*  canonical_holder =
-    InstanceKlass::cast(declared_holder())->find_field(name, signature, &field_desc);
-  if (canonical_holder == NULL) {
-    return;
-  }
-
-  assert(canonical_holder == field_desc.field_holder(), "just checking");
-}
-
-// ------------------------------------------------------------------
-// Get a field by index from a klass's constant pool.
-void GraalEnv::get_field_by_index(instanceKlassHandle& accessor, fieldDescriptor& fd, int index) {
-  ResourceMark rm;
-  return get_field_by_index_impl(accessor, fd, index);
-}
-
-// ------------------------------------------------------------------
-// Perform an appropriate method lookup based on accessor, holder,
-// name, signature, and bytecode.
-methodHandle GraalEnv::lookup_method(instanceKlassHandle& h_accessor,
-                               instanceKlassHandle& h_holder,
-                               Symbol*       name,
-                               Symbol*       sig,
-                               Bytecodes::Code bc) {
-  GRAAL_EXCEPTION_CONTEXT;
-  LinkResolver::check_klass_accessability(h_accessor, h_holder, KILL_COMPILE_ON_FATAL_(NULL));
-  methodHandle dest_method;
-  switch (bc) {
-  case Bytecodes::_invokestatic:
-    dest_method =
-      LinkResolver::resolve_static_call_or_null(h_holder, name, sig, h_accessor);
-    break;
-  case Bytecodes::_invokespecial:
-    dest_method =
-      LinkResolver::resolve_special_call_or_null(h_holder, name, sig, h_accessor);
-    break;
-  case Bytecodes::_invokeinterface:
-    dest_method =
-      LinkResolver::linktime_resolve_interface_method_or_null(h_holder, name, sig,
-                                                              h_accessor, true);
-    break;
-  case Bytecodes::_invokevirtual:
-    dest_method =
-      LinkResolver::linktime_resolve_virtual_method_or_null(h_holder, name, sig,
-                                                            h_accessor, true);
-    break;
-  default: ShouldNotReachHere();
-  }
-
-  return dest_method;
-}
-
-
-// ------------------------------------------------------------------
-methodHandle GraalEnv::get_method_by_index_impl(constantPoolHandle& cpool,
-                                          int index, Bytecodes::Code bc,
-                                          instanceKlassHandle& accessor) {
-  if (bc == Bytecodes::_invokedynamic) {
-    ConstantPoolCacheEntry* cpce = cpool->invokedynamic_cp_cache_entry_at(index);
-    bool is_resolved = !cpce->is_f1_null();
-    if (is_resolved) {
-      // Get the invoker Method* from the constant pool.
-      // (The appendix argument, if any, will be noted in the method's signature.)
-      Method* adapter = cpce->f1_as_method();
-      return methodHandle(adapter);
-    }
-
-    return NULL;
-  }
-
-  int holder_index = cpool->klass_ref_index_at(index);
-  bool holder_is_accessible;
-  KlassHandle holder = get_klass_by_index_impl(cpool, holder_index, holder_is_accessible, accessor);
-
-  // Get the method's name and signature.
-  Symbol* name_sym = cpool->name_ref_at(index);
-  Symbol* sig_sym  = cpool->signature_ref_at(index);
-
-  if (cpool->has_preresolution()
-      || (holder() == SystemDictionary::MethodHandle_klass() &&
-          MethodHandles::is_signature_polymorphic_name(holder(), name_sym))) {
-    // Short-circuit lookups for JSR 292-related call sites.
-    // That is, do not rely only on name-based lookups, because they may fail
-    // if the names are not resolvable in the boot class loader (7056328).
-    switch (bc) {
-    case Bytecodes::_invokevirtual:
-    case Bytecodes::_invokeinterface:
-    case Bytecodes::_invokespecial:
-    case Bytecodes::_invokestatic:
-      {
-        Method* m = ConstantPool::method_at_if_loaded(cpool, index);
-        if (m != NULL) {
-          return m;
-        }
-      }
-      break;
-    }
-  }
-
-  if (holder_is_accessible) { // Our declared holder is loaded.
-    instanceKlassHandle lookup = get_instance_klass_for_declared_method_holder(holder);
-    methodHandle m = lookup_method(accessor, lookup, name_sym, sig_sym, bc);
-    if (!m.is_null() &&
-        (bc == Bytecodes::_invokestatic
-         ?  InstanceKlass::cast(m->method_holder())->is_not_initialized()
-         : !InstanceKlass::cast(m->method_holder())->is_loaded())) {
-      m = NULL;
-    }
-    if (!m.is_null()) {
-      // We found the method.
-      return m;
-    }
-  }
-
-  // Either the declared holder was not loaded, or the method could
-  // not be found.
-
-  return NULL;
-}
-
-// ------------------------------------------------------------------
-instanceKlassHandle GraalEnv::get_instance_klass_for_declared_method_holder(KlassHandle& method_holder) {
-  // For the case of <array>.clone(), the method holder can be an ArrayKlass*
-  // instead of an InstanceKlass*.  For that case simply pretend that the
-  // declared holder is Object.clone since that's where the call will bottom out.
-  if (method_holder->oop_is_instance()) {
-    return instanceKlassHandle(method_holder());
-  } else if (method_holder->oop_is_array()) {
-    return instanceKlassHandle(SystemDictionary::Object_klass());
-  } else {
-    ShouldNotReachHere();
-  }
-  return NULL;
-}
-
-
-// ------------------------------------------------------------------
-methodHandle GraalEnv::get_method_by_index(constantPoolHandle& cpool,
-                                     int index, Bytecodes::Code bc,
-                                     instanceKlassHandle& accessor) {
-  ResourceMark rm;
-  return get_method_by_index_impl(cpool, index, bc, accessor);
-}
-
-// ------------------------------------------------------------------
-// Check for changes to the system dictionary during compilation
-// class loads, evolution, breakpoints
-GraalEnv::CodeInstallResult GraalEnv::check_for_system_dictionary_modification(Dependencies* dependencies, Handle compiled_code,
-                                                                               GraalEnv* env, char** failure_detail) {
-  // If JVMTI capabilities were enabled during compile, the compilation is invalidated.
-  if (env != NULL) {
-    if (!env->_jvmti_can_hotswap_or_post_breakpoint && JvmtiExport::can_hotswap_or_post_breakpoint()) {
-      *failure_detail = (char*) "Hotswapping or breakpointing was enabled during compilation";
-      return GraalEnv::dependencies_failed;
-    }
-  }
-
-  // Dependencies must be checked when the system dictionary changes
-  // or if we don't know whether it has changed (i.e., env == NULL).
-  // In debug mode, always check dependencies.
-  bool counter_changed = env != NULL && env->_system_dictionary_modification_counter != SystemDictionary::number_of_modifications();
-  bool verify_deps = env == NULL || trueInDebug || Debug::ENABLED();
-  if (!counter_changed && !verify_deps) {
-    return GraalEnv::ok;
-  }
-
-  for (Dependencies::DepStream deps(dependencies); deps.next(); ) {
-    Klass* witness = deps.check_dependency();
-    if (witness != NULL) {
-      // Use a fixed size buffer to prevent the string stream from
-      // resizing in the context of an inner resource mark.
-      char* buffer = NEW_RESOURCE_ARRAY(char, O_BUFLEN);
-      stringStream st(buffer, O_BUFLEN);
-      deps.print_dependency(witness, true, &st);
-      *failure_detail = st.as_string();
-      if (env == NULL || counter_changed) {
-        return GraalEnv::dependencies_failed;
-      } else {
-        // The dependencies were invalid at the time of installation
-        // without any intervening modification of the system
-        // dictionary.  That means they were invalidly constructed.
-        return GraalEnv::dependencies_invalid;
-      }
-    }
-    if (LogCompilation) {
-      deps.log_dependency();
-    }
-  }
-
-  return GraalEnv::ok;
-}
-
-// ------------------------------------------------------------------
-GraalEnv::CodeInstallResult GraalEnv::register_method(
-                                methodHandle& method,
-                                nmethod*& nm,
-                                int entry_bci,
-                                CodeOffsets* offsets,
-                                int orig_pc_offset,
-                                CodeBuffer* code_buffer,
-                                int frame_words,
-                                OopMapSet* oop_map_set,
-                                ExceptionHandlerTable* handler_table,
-                                AbstractCompiler* compiler,
-                                DebugInformationRecorder* debug_info,
-                                Dependencies* dependencies,
-                                GraalEnv* env,
-                                int compile_id,
-                                bool has_unsafe_access,
-                                Handle installed_code,
-                                Handle compiled_code,
-                                Handle speculation_log) {
-  GRAAL_EXCEPTION_CONTEXT;
-  NMethodSweeper::possibly_sweep();
-  nm = NULL;
-  int comp_level = CompLevel_full_optimization;
-  char* failure_detail = NULL;
-  GraalEnv::CodeInstallResult result;
-  {
-    // To prevent compile queue updates.
-    MutexLocker locker(MethodCompileQueue_lock, THREAD);
-
-    // Prevent SystemDictionary::add_to_hierarchy from running
-    // and invalidating our dependencies until we install this method.
-    MutexLocker ml(Compile_lock);
-
-    // Encode the dependencies now, so we can check them right away.
-    dependencies->encode_content_bytes();
-
-    // Check for {class loads, evolution, breakpoints} during compilation
-    result = check_for_system_dictionary_modification(dependencies, compiled_code, env, &failure_detail);
-    if (result != GraalEnv::ok) {
-      // While not a true deoptimization, it is a preemptive decompile.
-      MethodData* mdp = method()->method_data();
-      if (mdp != NULL) {
-        mdp->inc_decompile_count();
-        if (mdp->decompile_count() > (uint)PerMethodRecompilationCutoff) {
-          // TODO (chaeubl) enable this in the fastdebug build only once we are more stable
-          ResourceMark m;
-          tty->print_cr("WARN: endless recompilation of %s. Method was set to not compilable.", method()->name_and_sig_as_C_string());
-          //ShouldNotReachHere();
-        }
-      }
-
-      // All buffers in the CodeBuffer are allocated in the CodeCache.
-      // If the code buffer is created on each compile attempt
-      // as in C2, then it must be freed.
-      //code_buffer->free_blob();
-    } else {
-      ImplicitExceptionTable implicit_tbl;
-      nm =  nmethod::new_nmethod(method,
-                                 compile_id,
-                                 entry_bci,
-                                 offsets,
-                                 orig_pc_offset,
-                                 debug_info, dependencies, code_buffer,
-                                 frame_words, oop_map_set,
-                                 handler_table, &implicit_tbl,
-                                 compiler, comp_level, installed_code, speculation_log);
-
-      // Free codeBlobs
-      //code_buffer->free_blob();
-
-      if (nm == NULL) {
-        // The CodeCache is full.  Print out warning and disable compilation.
-        {
-          MutexUnlocker ml(Compile_lock);
-          MutexUnlocker locker(MethodCompileQueue_lock);
-          CompileBroker::handle_full_code_cache();
-        }
-      } else {
-        nm->set_has_unsafe_access(has_unsafe_access);
-#ifdef TARGET_ARCH_x86
-        // It might be preferable to set this only for methods which
-        // use vector instructions but we currently don't track this
-        // and it probably wouldn't make much difference.
-        nm->set_has_wide_vectors(MaxVectorSize > 16);
-#endif
-
-        // Record successful registration.
-        // (Put nm into the task handle *before* publishing to the Java heap.)
-        CompileTask* task = env == NULL ? NULL : env->task();
-        if (task != NULL)  task->set_code(nm);
-
-        if (installed_code->is_a(HotSpotNmethod::klass()) && HotSpotNmethod::isDefault(installed_code())) {
-          if (entry_bci == InvocationEntryBci) {
-            if (TieredCompilation) {
-              // If there is an old version we're done with it
-              nmethod* old = method->code();
-              if (TraceMethodReplacement && old != NULL) {
-                ResourceMark rm;
-                char *method_name = method->name_and_sig_as_C_string();
-                tty->print_cr("Replacing method %s", method_name);
-              }
-              if (old != NULL ) {
-                old->make_not_entrant();
-              }
-            }
-            if (TraceNMethodInstalls) {
-              ResourceMark rm;
-              char *method_name = method->name_and_sig_as_C_string();
-              ttyLocker ttyl;
-              tty->print_cr("Installing method (%d) %s [entry point: %p]",
-                            comp_level,
-                            method_name, nm->entry_point());
-            }
-            // Allow the code to be executed
-            method->set_code(method, nm);
-          } else {
-            if (TraceNMethodInstalls ) {
-              ResourceMark rm;
-              char *method_name = method->name_and_sig_as_C_string();
-              ttyLocker ttyl;
-              tty->print_cr("Installing osr method (%d) %s @ %d",
-                            comp_level,
-                            method_name,
-                            entry_bci);
-            }
-            InstanceKlass::cast(method->method_holder())->add_osr_nmethod(nm);
-          }
-        }
-      }
-      result = nm != NULL ? GraalEnv::ok :GraalEnv::cache_full;
-    }
-  }
-
-  // String creation must be done outside lock
-  if (failure_detail != NULL) {
-    // A failure to allocate the string is silently ignored.
-    Handle message = java_lang_String::create_from_str(failure_detail, THREAD);
-    HotSpotCompiledNmethod::set_installationFailureMessage(compiled_code, message());
-  }
-
-  // JVMTI -- compiled method notification (must be done outside lock)
-  if (nm != NULL) {
-    nm->post_compiled_method_load_event();
-  }
-
-  return result;
-}
-
--- a/src/share/vm/graal/graalEnv.hpp	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,171 +0,0 @@
-/*
- * Copyright (c) 1999, 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.
- *
- */
-
-#ifndef SHARE_VM_GRAAL_GRAALENV_HPP
-#define SHARE_VM_GRAAL_GRAALENV_HPP
-
-#include "classfile/systemDictionary.hpp"
-#include "code/debugInfoRec.hpp"
-#include "code/dependencies.hpp"
-#include "code/exceptionHandlerTable.hpp"
-#include "compiler/oopMap.hpp"
-#include "runtime/thread.hpp"
-
-class CompileTask;
-
-// Bring the Graal compiler thread into the VM state.
-#define GRAAL_VM_ENTRY_MARK                       \
-  JavaThread* thread = JavaThread::current(); \
-  ThreadInVMfromNative __tiv(thread);       \
-  ResetNoHandleMark rnhm;                   \
-  HandleMarkCleaner __hm(thread);           \
-  Thread* THREAD = thread;                  \
-  debug_only(VMNativeEntryWrapper __vew;)
-
-#define GRAAL_EXCEPTION_CONTEXT \
-  JavaThread* thread=JavaThread::current(); \
-  Thread* THREAD = thread;
-
-//
-// This class is the top level broker for requests from the compiler
-// to the VM.
-class GraalEnv : StackObj {
-  CI_PACKAGE_ACCESS_TO
-
-  friend class CompileBroker;
-  friend class Dependencies;  // for get_object, during logging
-
-public:
-
-  enum CodeInstallResult {
-     ok,
-     dependencies_failed,
-     dependencies_invalid,
-     cache_full,
-     code_too_large
-  };
-
-  // Look up a klass by name from a particular class loader (the accessor's).
-  // If require_local, result must be defined in that class loader, or NULL.
-  // If !require_local, a result from remote class loader may be reported,
-  // if sufficient class loader constraints exist such that initiating
-  // a class loading request from the given loader is bound to return
-  // the class defined in the remote loader (or throw an error).
-  //
-  // Return an unloaded klass if !require_local and no class at all is found.
-  //
-  // The CI treats a klass as loaded if it is consistently defined in
-  // another loader, even if it hasn't yet been loaded in all loaders
-  // that could potentially see it via delegation.
-  static KlassHandle get_klass_by_name(KlassHandle& accessing_klass,
-                             Symbol* klass_name,
-                             bool require_local);
-
-  // Constant pool access.
-  static KlassHandle   get_klass_by_index(constantPoolHandle& cpool,
-                                int klass_index,
-                                bool& is_accessible,
-                                KlassHandle& loading_klass);
-  static void   get_field_by_index(instanceKlassHandle& loading_klass, fieldDescriptor& fd,
-                                int field_index);
-  static methodHandle  get_method_by_index(constantPoolHandle& cpool,
-                                 int method_index, Bytecodes::Code bc,
-                                 instanceKlassHandle& loading_klass);
-
-  GraalEnv(CompileTask* task, int system_dictionary_modification_counter);
-
-private:
-  CompileTask*     _task;
-  int              _system_dictionary_modification_counter;
-
-  // Cache JVMTI state
-  bool  _jvmti_can_hotswap_or_post_breakpoint;
-  bool  _jvmti_can_access_local_variables;
-  bool  _jvmti_can_post_on_exceptions;
-
-  // Implementation methods for loading and constant pool access.
-  static KlassHandle get_klass_by_name_impl(KlassHandle& accessing_klass,
-                                  constantPoolHandle& cpool,
-                                  Symbol* klass_name,
-                                  bool require_local);
-  static KlassHandle   get_klass_by_index_impl(constantPoolHandle& cpool,
-                                     int klass_index,
-                                     bool& is_accessible,
-                                     KlassHandle& loading_klass);
-  static void   get_field_by_index_impl(instanceKlassHandle& loading_klass, fieldDescriptor& fd,
-                                     int field_index);
-  static methodHandle  get_method_by_index_impl(constantPoolHandle& cpool,
-                                      int method_index, Bytecodes::Code bc,
-                                      instanceKlassHandle& loading_klass);
-
-  // Helper methods
-  static bool       check_klass_accessibility(KlassHandle accessing_klass, KlassHandle resolved_klass);
-  static methodHandle  lookup_method(instanceKlassHandle&  accessor,
-                           instanceKlassHandle&  holder,
-                           Symbol*         name,
-                           Symbol*         sig,
-                           Bytecodes::Code bc);
-
-  private:
-
-  // Is this thread currently in the VM state?
-  static bool is_in_vm();
-
-  // Helper routine for determining the validity of a compilation
-  // with respect to concurrent class loading.
-  static GraalEnv::CodeInstallResult check_for_system_dictionary_modification(Dependencies* target, Handle compiled_code,
-                                                                              GraalEnv* env, char** failure_detail);
-
-public:
-  CompileTask* task() { return _task; }
-
-  // Register the result of a compilation.
-  static GraalEnv::CodeInstallResult register_method(
-                       methodHandle&             target,
-                       nmethod*&                 nm,
-                       int                       entry_bci,
-                       CodeOffsets*              offsets,
-                       int                       orig_pc_offset,
-                       CodeBuffer*               code_buffer,
-                       int                       frame_words,
-                       OopMapSet*                oop_map_set,
-                       ExceptionHandlerTable*    handler_table,
-                       AbstractCompiler*         compiler,
-                       DebugInformationRecorder* debug_info,
-                       Dependencies*             dependencies,
-                       GraalEnv*                 env,
-                       int                       compile_id,
-                       bool                      has_unsafe_access,
-                       Handle                    installed_code,
-                       Handle                    compiled_code,
-                       Handle                    speculation_log);
-
-  // converts the Klass* representing the holder of a method into a
-  // InstanceKlass*.  This is needed since the holder of a method in
-  // the bytecodes could be an array type.  Basically this converts
-  // array types into java/lang/Object and other types stay as they are.
-  static instanceKlassHandle get_instance_klass_for_declared_method_holder(KlassHandle& klass);
-};
-
-#endif // SHARE_VM_GRAAL_GRAALENV_HPP
--- a/src/share/vm/graal/graalGlobals.cpp	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2000, 2010, 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.
- *
- */
-
-#include "precompiled.hpp"
-#include "graal/graalGlobals.hpp"
-
-GRAAL_FLAGS(MATERIALIZE_DEVELOPER_FLAG, MATERIALIZE_PD_DEVELOPER_FLAG, MATERIALIZE_PRODUCT_FLAG, MATERIALIZE_PD_PRODUCT_FLAG, MATERIALIZE_NOTPRODUCT_FLAG)
--- a/src/share/vm/graal/graalGlobals.hpp	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,118 +0,0 @@
-/*
- * Copyright (c) 2000, 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.
- *
- */
-
-#ifndef SHARE_VM_GRAAL_GRAALGLOBALS_HPP
-#define SHARE_VM_GRAAL_GRAALGLOBALS_HPP
-
-#include "runtime/globals.hpp"
-#ifdef TARGET_ARCH_x86
-# include "graalGlobals_x86.hpp"
-#endif
-#ifdef TARGET_ARCH_sparc
-# include "graalGlobals_sparc.hpp"
-#endif
-#ifdef TARGET_ARCH_arm
-# include "graalGlobals_arm.hpp"
-#endif
-#ifdef TARGET_ARCH_ppc
-# include "graalGlobals_ppc.hpp"
-#endif
-
-//
-// Defines all global flags used by the Graal compiler. Only flags that need
-// to be accessible to the Graal C++ code should be defined here. All other
-// Graal flags should be defined in GraalOptions.java.
-//
-#define GRAAL_FLAGS(develop, develop_pd, product, product_pd, notproduct)   \
-                                                                            \
-  product(bool, DebugGraal, true,                                           \
-          "Enable JVMTI for the compiler thread")                           \
-                                                                            \
-  product(bool, UseGraalClassLoader, true,                                  \
-          "Load Graal classes with separate class loader")                  \
-                                                                            \
-  COMPILERGRAAL_PRESENT(product(bool, BootstrapGraal, true,                 \
-          "Bootstrap Graal before running Java main method"))               \
-                                                                            \
-  COMPILERGRAAL_PRESENT(product(bool, PrintBootstrap, true,                 \
-          "Print Graal bootstrap progress and summary"))                    \
-                                                                            \
-  COMPILERGRAAL_PRESENT(product(intx, GraalThreads, 1,                      \
-          "Force number of Graal compiler threads to use"))                 \
-                                                                            \
-  COMPILERGRAAL_PRESENT(product(intx, GraalHostThreads, 1,                  \
-          "Force number of compiler threads for Graal host compiler"))      \
-                                                                            \
-  GRAAL_ONLY(product(bool, CodeInstallSafepointChecks, true,                \
-          "Perform explicit safepoint checks while installing code"))       \
-                                                                            \
-  NOT_COMPILER2(product_pd(intx, MaxVectorSize,                                \
-          "Max vector size in bytes, "                                      \
-          "actual size could be less depending on elements type"))          \
-                                                                            \
-  product(intx, TraceGraal, 0,                                              \
-          "Trace level for Graal")                                          \
-                                                                            \
-  product(intx, GraalCounterSize, 0,                                        \
-          "Reserved size for benchmark counters")                           \
-                                                                            \
-  product(bool, GraalCountersExcludeCompiler, true,                         \
-          "Exclude Graal compiler threads from benchmark counters")         \
-                                                                            \
-  product(bool, GraalDeferredInitBarriers, true,                            \
-          "Defer write barriers of young objects")                          \
-                                                                            \
-  product(bool, GraalHProfEnabled, false,                                   \
-          "Is Heap  Profiler enabled")                                      \
-                                                                            \
-  product(bool, GraalCompileWithC1Only, true,                               \
-          "Only compile Graal classes with C1")                             \
-                                                                            \
-  product(bool, GraalCompileAppFirst, false,                                \
-          "Prioritize application compilations over Graal compilations")    \
-                                                                            \
-  develop(bool, GraalUseFastLocking, true,                                  \
-          "Use fast inlined locking code")                                  \
-                                                                            \
-  develop(bool, GraalUseFastNewTypeArray, true,                             \
-          "Use fast inlined type array allocation")                         \
-                                                                            \
-  develop(bool, GraalUseFastNewObjectArray, true,                           \
-          "Use fast inlined object array allocation")                       \
-                                                                            \
-  product(intx, GraalNMethodSizeLimit, (80*K)*wordSize,                     \
-          "Maximum size of a compiled method.")                             \
-                                                                            \
-  notproduct(bool, GraalPrintSimpleStubs, false,                            \
-          "Print simple Graal stubs")                                       \
-                                                                            \
-  develop(bool, TraceUncollectedSpeculations, false,                        \
-          "Print message when a failed speculation was not collected")      \
-
-
-// Read default values for Graal globals
-
-GRAAL_FLAGS(DECLARE_DEVELOPER_FLAG, DECLARE_PD_DEVELOPER_FLAG, DECLARE_PRODUCT_FLAG, DECLARE_PD_PRODUCT_FLAG, DECLARE_NOTPRODUCT_FLAG)
-
-#endif // SHARE_VM_GRAAL_GRAALGLOBALS_HPP
--- a/src/share/vm/graal/graalHashtable.cpp	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,78 +0,0 @@
-/*
- * Copyright (c) 2015, 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.
- */
-
-#include "graal/graalHashtable.hpp"
-
-template<class K, class V> bool GraalHashtable<K,V>::add(V value, bool replace) {
-  K key = get_key(value);
-  unsigned int hash = compute_hash(key);
-  unsigned int index = hash_to_index(hash);
-  for (GraalHashtableEntry<V>* e = bucket(index); e != NULL; e = e->next()) {
-    if (key_equals(get_key(e->literal_addr()), key)) {
-      if (replace) {
-        e->set_literal(value);
-      }
-      return false;
-    }
-  }
-  GraalHashtableEntry<V>* e = new GraalHashtableEntry<V>(value);
-  e->set_next(_buckets[index]);
-  _buckets[index] = e;
-  ++_number_of_entries;
-  return true;
-}
-
-template<class K, class V> V* GraalHashtable<K,V>::get(K key) {
-  unsigned int index = index_for(key);
-  for (GraalHashtableEntry<V>* e = bucket(index); e != NULL; e = e->next()) {
-    if (key_equals(get_key(e->literal_addr()), key)) {
-      return e->literal_addr();
-    }
-  }
-  return NULL;
-}
-
-template<class K, class V> void GraalHashtable<K, V>::for_each(ValueClosure<V>* closure) {
-  for (size_t i = 0; i < table_size(); ++i) {
-    for (GraalHashtableEntry<V>* e = bucket(i); e != NULL && !closure->is_aborted(); e = e->next()) {
-      closure->do_value(e->literal_addr());
-    }
-  }
-}
-
-template<class K, class V> GraalHashtable<K,V>::~GraalHashtable() {
-  for (size_t i = 0; i < table_size(); ++i) {
-    GraalHashtableEntry<V>* e = bucket(i);
-    while (e != NULL) {
-      GraalHashtableEntry<V>* current = e;
-      e = e->next();
-      delete current;
-    }
-  }
-  FREE_C_HEAP_ARRAY(GraalHashtableEntry*, _buckets, mtCompiler);
-}
-
-// Instantiation
-#include "graal/graalOptions.hpp"
-template class GraalHashtable<const char*, OptionDesc>;
-template class GraalHashtable<const char*, OptionValue>;
--- a/src/share/vm/graal/graalHashtable.hpp	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,137 +0,0 @@
-/*
- * Copyright (c) 2015, 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.
- */
-
-#ifndef SHARE_VM_GRAAL_GRAAL_HASHTABLE_HPP
-#define SHARE_VM_GRAAL_GRAAL_HASHTABLE_HPP
-
-#include "memory/allocation.hpp"
-#include "memory/allocation.inline.hpp"
-
-// based on hashtable.hpp
-
-template <class T> class GraalHashtableEntry : public CHeapObj<mtCompiler> {
-  friend class VMStructs;
-private:
-  T               _literal;       // ref to item in table.
-  GraalHashtableEntry*  _next;          // Link to next element in the linked list for this bucket
-
-public:
-  GraalHashtableEntry(T literal) :  _literal(literal), _next(NULL) {}
-
-  T literal() {
-    return _literal;
-  }
-
-  void set_literal(T value) {
-    _literal = value;
-  }
-
-  T* literal_addr() {
-    return &_literal;
-  }
-
-  GraalHashtableEntry* next() const {
-    return _next;
-  }
-
-  void set_next(GraalHashtableEntry* next) {
-    _next = next;
-  }
-};
-
-template <class V>
-class ValueClosure : public StackObj {
-  bool _abort;
-protected:
-  void abort() { _abort = true; }
-public:
-  ValueClosure() : _abort(false) {}
-  virtual void do_value(V* value) = 0;
-  bool is_aborted() { return _abort; }
-};
-
-template <class K, class V> class GraalHashtable : public CHeapObj<mtCompiler> {
-  friend class VMStructs;
-private:
-  // Instance variables
-  unsigned int             _table_size;
-  GraalHashtableEntry<V>** _buckets;
-  unsigned int             _number_of_entries;
-
-public:
-  GraalHashtable(size_t size) : _table_size(size), _number_of_entries(0) {
-    _buckets = NEW_C_HEAP_ARRAY(GraalHashtableEntry<V>*, table_size(), mtCompiler);
-    for (size_t i = 0; i < table_size(); ++i) {
-      _buckets[i] = NULL;
-    }
-  }
-  virtual ~GraalHashtable();
-
-private:
-  // Bucket handling
-  unsigned int hash_to_index(unsigned int full_hash) {
-    unsigned int h = full_hash % _table_size;
-    assert(h >= 0 && h < _table_size, "Illegal hash value");
-    return h;
-  }
-
-  unsigned  int index_for(K key) {
-    return hash_to_index(compute_hash(key));
-  }
-
-  size_t entry_size() {
-    return sizeof(V);
-  }
-
-  size_t table_size() { return _table_size; }
-
-  GraalHashtableEntry<V>* bucket(unsigned int index) {
-    return _buckets[index];
-  }
-
-  bool add(V v, bool replace);
-
-protected:
-  virtual unsigned int compute_hash(K key) = 0;
-  virtual bool key_equals(K k1, K k2) = 0;
-  virtual K get_key(V value) = 0;
-  virtual K get_key(V* value) = 0;
-
-public:
-  /**
-   * Tries to insert the value in the hash table. Returns false if an entry with the same key already exists.
-   * In this case it does *not* replace the existing entry.
-   */
-  bool add(V v) { return add(v, false); }
-  /**
-   * Inserts the value in the hash table. Returns false if an entry with the same key already exists.
-   * In this case it replaces the existing entry.
-   */
-  bool put(V v) { return add(v, true); }
-  V* get(K k);
-  void for_each(ValueClosure<V>* closure);
-  int number_of_entries() { return _number_of_entries; }
-
-};
-
-#endif // SHARE_VM_GRAAL_GRAAL_HASHTABLE_HPP
--- a/src/share/vm/graal/graalJavaAccess.cpp	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,85 +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.
- */
-
-#include "precompiled.hpp"
-#include "graal/graalJavaAccess.hpp"
-#include "runtime/jniHandles.hpp"
-#include "classfile/symbolTable.hpp"
-// This function is similar to javaClasses.cpp, it computes the field offset of a (static or instance) field.
-// It looks up the name and signature symbols without creating new ones, all the symbols of these classes need to be already loaded.
-
-void compute_offset(int &dest_offset, Klass* klass, const char* name, const char* signature, bool static_field) {
-  InstanceKlass* ik = InstanceKlass::cast(klass);
-  Symbol* name_symbol = SymbolTable::probe(name, (int)strlen(name));
-  Symbol* signature_symbol = SymbolTable::probe(signature, (int)strlen(signature));
-  if (name_symbol == NULL || signature_symbol == NULL) {
-#ifndef PRODUCT
-    ik->print_on(tty);
-#endif
-    guarantee(false, err_msg("symbol with name %s and signature %s was not found in symbol table (klass=%s)", name, signature, klass->name()->as_C_string()));
-  }
-
-  fieldDescriptor fd;
-  if (!ik->find_field(name_symbol, signature_symbol, &fd)) {
-    ResourceMark rm;
-    fatal(err_msg("Invalid layout of %s at %s", name_symbol->as_C_string(), ik->external_name()));
-  }
-  guarantee(fd.is_static() == static_field, "static/instance mismatch");
-  dest_offset = fd.offset();
-}
-
-// This piece of macro magic creates the contents of the graal_compute_offsets method that initializes the field indices of all the access classes.
-
-#define START_CLASS(name) { Klass* k = SystemDictionary::name##_klass(); assert(k != NULL, "Could not find class " #name "");
-
-#define END_CLASS }
-
-#define FIELD(klass, name, signature, static_field) compute_offset(klass::_##name##_offset, k, #name, signature, static_field);
-#define CHAR_FIELD(klass, name) FIELD(klass, name, "C", false)
-#define INT_FIELD(klass, name) FIELD(klass, name, "I", false)
-#define BOOLEAN_FIELD(klass, name) FIELD(klass, name, "Z", false)
-#define LONG_FIELD(klass, name) FIELD(klass, name, "J", false)
-#define FLOAT_FIELD(klass, name) FIELD(klass, name, "F", false)
-#define OOP_FIELD(klass, name, signature) FIELD(klass, name, signature, false)
-#define STATIC_OOP_FIELD(klass, name, signature) FIELD(klass, name, signature, true)
-#define STATIC_INT_FIELD(klass, name) FIELD(klass, name, "I", true)
-#define STATIC_BOOLEAN_FIELD(klass, name) FIELD(klass, name, "Z", true)
-
-
-void graal_compute_offsets() {
-  COMPILER_CLASSES_DO(START_CLASS, END_CLASS, CHAR_FIELD, INT_FIELD, BOOLEAN_FIELD, LONG_FIELD, FLOAT_FIELD, OOP_FIELD, OOP_FIELD, OOP_FIELD, STATIC_OOP_FIELD, STATIC_INT_FIELD, STATIC_BOOLEAN_FIELD)
-  guarantee(InstalledCode::_address_offset == sizeof(oopDesc), "codeBlob must be first field!");
-}
-
-#define EMPTY0
-#define EMPTY1(x)
-#define EMPTY2(x,y)
-#define FIELD2(klass, name) int klass::_##name##_offset = 0;
-#define FIELD3(klass, name, sig) FIELD2(klass, name)
-
-COMPILER_CLASSES_DO(EMPTY1, EMPTY0, FIELD2, FIELD2, FIELD2, FIELD2, FIELD2, FIELD3, FIELD3, FIELD3, FIELD3, FIELD2, FIELD2)
-
-
-
-
-
--- a/src/share/vm/graal/graalJavaAccess.hpp	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,356 +0,0 @@
-/*
- * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-#ifndef SHARE_VM_GRAAL_GRAAL_JAVA_ACCESS_HPP
-#define SHARE_VM_GRAAL_GRAAL_JAVA_ACCESS_HPP
-
-void graal_compute_offsets();
-
-#include "classfile/systemDictionary.hpp"
-#include "oops/instanceMirrorKlass.hpp"
-
-/* This macro defines the structure of the CompilationResult - classes.
- * It will generate classes with accessors similar to javaClasses.hpp, but with specializations for oops, Handles and jni handles.
- *
- * The public interface of these classes will look like this:
-
- * class StackSlot : AllStatic {
- * public:
- *   static Klass* klass();
- *   static jint  index(oop obj);
- *   static jint  index(Handle obj);
- *   static jint  index(jobject obj);
- *   static void set_index(oop obj, jint x);
- *   static void set_index(Handle obj, jint x);
- *   static void set_index(jobject obj, jint x);
- * };
- *
- */
-
-#define COMPILER_CLASSES_DO(start_class, end_class, char_field, int_field, boolean_field, long_field, float_field, oop_field, typeArrayOop_field, objArrayOop_field, static_oop_field, static_int_field, static_boolean_field) \
-  start_class(HotSpotResolvedObjectTypeImpl)                                                                                                                       \
-    oop_field(HotSpotResolvedObjectTypeImpl, javaClass, "Ljava/lang/Class;")                                                                                       \
-  end_class                                                                                                                                                    \
-  start_class(HotSpotResolvedJavaMethodImpl)                                                                                                                       \
-    long_field(HotSpotResolvedJavaMethodImpl, metaspaceMethod)                                                                                                     \
-  end_class                                                                                                                                                    \
-  start_class(InstalledCode)                                                                                                                                   \
-    long_field(InstalledCode, address)                                                                                                                         \
-    long_field(InstalledCode, version)                                                                                                                         \
-    oop_field(InstalledCode, name, "Ljava/lang/String;")                                                                                                       \
-  end_class                                                                                                                                                    \
-  start_class(HotSpotInstalledCode)                                                                                                                            \
-    int_field(HotSpotInstalledCode, size)                                                                                                                      \
-    long_field(HotSpotInstalledCode, codeStart)                                                                                                                \
-    int_field(HotSpotInstalledCode, codeSize)                                                                                                                  \
-  end_class                                                                                                                                                    \
-  start_class(HotSpotNmethod)                                                                                                                                  \
-    boolean_field(HotSpotNmethod, isDefault)                                                                                                                   \
-  end_class                                                                                                                                                    \
-  start_class(HotSpotCompiledCode)                                                                                                                             \
-    objArrayOop_field(HotSpotCompiledCode, sites, "[Lcom/oracle/graal/api/code/CompilationResult$Site;")                                                       \
-    objArrayOop_field(HotSpotCompiledCode, exceptionHandlers, "[Lcom/oracle/graal/api/code/CompilationResult$ExceptionHandler;")                               \
-    objArrayOop_field(HotSpotCompiledCode, comments, "[Lcom/oracle/graal/hotspot/HotSpotCompiledCode$Comment;")                                                \
-    objArrayOop_field(HotSpotCompiledCode, assumptions, "[Lcom/oracle/graal/api/meta/Assumptions$Assumption;")                                                 \
-    typeArrayOop_field(HotSpotCompiledCode, targetCode, "[B")                                                                                                  \
-    int_field(HotSpotCompiledCode, targetCodeSize)                                                                                                             \
-    typeArrayOop_field(HotSpotCompiledCode, dataSection, "[B")                                                                                                 \
-    int_field(HotSpotCompiledCode, dataSectionAlignment)                                                                                                       \
-    objArrayOop_field(HotSpotCompiledCode, dataSectionPatches, "[Lcom/oracle/graal/api/code/CompilationResult$DataPatch;")                                     \
-    int_field(HotSpotCompiledCode, totalFrameSize)                                                                                                             \
-    int_field(HotSpotCompiledCode, customStackAreaOffset)                                                                                                      \
-    objArrayOop_field(HotSpotCompiledCode, methods, "[Lcom/oracle/graal/api/meta/ResolvedJavaMethod;")                                                         \
-  end_class                                                                                                                                                    \
-  start_class(HotSpotCompiledCode_Comment)                                                                                                                     \
-    oop_field(HotSpotCompiledCode_Comment, text, "Ljava/lang/String;")                                                                                         \
-    int_field(HotSpotCompiledCode_Comment, pcOffset)                                                                                                           \
-  end_class                                                                                                                                                    \
-  start_class(HotSpotCompiledNmethod)                                                                                                                          \
-    oop_field(HotSpotCompiledNmethod, method, "Lcom/oracle/graal/hotspot/meta/HotSpotResolvedJavaMethod;")                                                     \
-    oop_field(HotSpotCompiledNmethod, installationFailureMessage, "Ljava/lang/String;")                                                                        \
-    int_field(HotSpotCompiledNmethod, entryBCI)                                                                                                                \
-    int_field(HotSpotCompiledNmethod, id)                                                                                                                      \
-    long_field(HotSpotCompiledNmethod, graalEnv)                                                                                                               \
-  end_class                                                                                                                                                    \
-  start_class(HotSpotCompiledRuntimeStub)                                                                                                                      \
-    oop_field(HotSpotCompiledRuntimeStub, stubName, "Ljava/lang/String;")                                                                                      \
-  end_class                                                                                                                                                    \
-  start_class(HotSpotForeignCallLinkageImpl)                                                                                                                   \
-    long_field(HotSpotForeignCallLinkageImpl, address)                                                                                                         \
-  end_class                                                                                                                                                    \
-  start_class(Assumptions_NoFinalizableSubclass)                                                                                                               \
-    oop_field(Assumptions_NoFinalizableSubclass, receiverType, "Lcom/oracle/graal/api/meta/ResolvedJavaType;")                                                 \
-  end_class                                                                                                                                                    \
-  start_class(Assumptions_ConcreteSubtype)                                                                                                                     \
-    oop_field(Assumptions_ConcreteSubtype, context, "Lcom/oracle/graal/api/meta/ResolvedJavaType;")                                                            \
-    oop_field(Assumptions_ConcreteSubtype, subtype, "Lcom/oracle/graal/api/meta/ResolvedJavaType;")                                                            \
-  end_class                                                                                                                                                    \
-  start_class(Assumptions_LeafType)                                                                                                                            \
-    oop_field(Assumptions_LeafType, context, "Lcom/oracle/graal/api/meta/ResolvedJavaType;")                                                                   \
-  end_class                                                                                                                                                    \
-  start_class(Assumptions_ConcreteMethod)                                                                                                                      \
-    oop_field(Assumptions_ConcreteMethod, method, "Lcom/oracle/graal/api/meta/ResolvedJavaMethod;")                                                            \
-    oop_field(Assumptions_ConcreteMethod, context, "Lcom/oracle/graal/api/meta/ResolvedJavaType;")                                                             \
-    oop_field(Assumptions_ConcreteMethod, impl, "Lcom/oracle/graal/api/meta/ResolvedJavaMethod;")                                                              \
-  end_class                                                                                                                                                    \
-  start_class(Assumptions_CallSiteTargetValue)                                                                                                                 \
-    oop_field(Assumptions_CallSiteTargetValue, callSite, "Ljava/lang/invoke/CallSite;")                                                                        \
-    oop_field(Assumptions_CallSiteTargetValue, methodHandle, "Ljava/lang/invoke/MethodHandle;")                                                                \
-  end_class                                                                                                                                                    \
-  start_class(CompilationResult_Site)                                                                                                                          \
-    int_field(CompilationResult_Site, pcOffset)                                                                                                                \
-  end_class                                                                                                                                                    \
-  start_class(CompilationResult_Call)                                                                                                                          \
-    oop_field(CompilationResult_Call, target, "Lcom/oracle/graal/api/meta/InvokeTarget;")                                                                      \
-    oop_field(CompilationResult_Call, debugInfo, "Lcom/oracle/graal/api/code/DebugInfo;")                                                                      \
-  end_class                                                                                                                                                    \
-  start_class(CompilationResult_DataPatch)                                                                                                                     \
-    oop_field(CompilationResult_DataPatch, reference, "Lcom/oracle/graal/api/code/CompilationResult$Reference;")                                               \
-  end_class                                                                                                                                                    \
-  start_class(CompilationResult_ConstantReference)                                                                                                             \
-    oop_field(CompilationResult_ConstantReference, constant, "Lcom/oracle/graal/api/meta/VMConstant;")                                                         \
-  end_class                                                                                                                                                    \
-  start_class(CompilationResult_DataSectionReference)                                                                                                          \
-    int_field(CompilationResult_DataSectionReference, offset)                                                                                                  \
-  end_class                                                                                                                                                    \
-  start_class(InfopointReason)                                                                                                                                 \
-    static_oop_field(InfopointReason, UNKNOWN, "Lcom/oracle/graal/api/code/InfopointReason;")                                                                  \
-    static_oop_field(InfopointReason, SAFEPOINT, "Lcom/oracle/graal/api/code/InfopointReason;")                                                                \
-    static_oop_field(InfopointReason, CALL, "Lcom/oracle/graal/api/code/InfopointReason;")                                                                     \
-    static_oop_field(InfopointReason, IMPLICIT_EXCEPTION, "Lcom/oracle/graal/api/code/InfopointReason;")                                                       \
-    static_oop_field(InfopointReason, METHOD_START, "Lcom/oracle/graal/api/code/InfopointReason;")                                                             \
-    static_oop_field(InfopointReason, METHOD_END, "Lcom/oracle/graal/api/code/InfopointReason;")                                                               \
-    static_oop_field(InfopointReason, LINE_NUMBER, "Lcom/oracle/graal/api/code/InfopointReason;")                                                              \
-  end_class                                                                                                                                                    \
-  start_class(CompilationResult_Infopoint)                                                                                                                     \
-    oop_field(CompilationResult_Infopoint, debugInfo, "Lcom/oracle/graal/api/code/DebugInfo;")                                                                 \
-    oop_field(CompilationResult_Infopoint, reason, "Lcom/oracle/graal/api/code/InfopointReason;")                                                              \
-  end_class                                                                                                                                                    \
-  start_class(CompilationResult_ExceptionHandler)                                                                                                              \
-    int_field(CompilationResult_ExceptionHandler, handlerPos)                                                                                                  \
-  end_class                                                                                                                                                    \
-  start_class(CompilationResult_Mark)                                                                                                                          \
-    oop_field(CompilationResult_Mark, id, "Ljava/lang/Object;")                                                                                                \
-  end_class                                                                                                                                                    \
-  start_class(DebugInfo)                                                                                                                                       \
-    oop_field(DebugInfo, bytecodePosition, "Lcom/oracle/graal/api/code/BytecodePosition;")                                                                     \
-    oop_field(DebugInfo, referenceMap, "Lcom/oracle/graal/api/code/ReferenceMap;")                                                                             \
-    oop_field(DebugInfo, calleeSaveInfo, "Lcom/oracle/graal/api/code/RegisterSaveLayout;")                                                                     \
-    objArrayOop_field(DebugInfo, virtualObjectMapping, "[Lcom/oracle/graal/api/meta/Value;")                                                                   \
-  end_class                                                                                                                                                    \
-  start_class(HotSpotReferenceMap)                                                                                                                             \
-    oop_field(HotSpotReferenceMap, registerRefMap, "Lcom/oracle/graal/hotspot/HotSpotReferenceMap$HotSpotOopMap;")                                             \
-    oop_field(HotSpotReferenceMap, frameRefMap, "Lcom/oracle/graal/hotspot/HotSpotReferenceMap$HotSpotOopMap;")                                                \
-  end_class                                                                                                                                                    \
-  start_class(RegisterSaveLayout)                                                                                                                              \
-    objArrayOop_field(RegisterSaveLayout, registers, "[Lcom/oracle/graal/api/code/Register;")                                                                  \
-    typeArrayOop_field(RegisterSaveLayout, slots, "[I")                                                                                                        \
-  end_class                                                                                                                                                    \
-  start_class(HotSpotOopMap)                                                                                                                                   \
-    typeArrayOop_field(HotSpotOopMap, words, "[J")                                                                                                             \
-  end_class                                                                                                                                                    \
-  start_class(BytecodeFrame)                                                                                                                                   \
-    objArrayOop_field(BytecodeFrame, values, "[Lcom/oracle/graal/api/meta/Value;")                                                                             \
-    int_field(BytecodeFrame, numLocals)                                                                                                                        \
-    int_field(BytecodeFrame, numStack)                                                                                                                         \
-    int_field(BytecodeFrame, numLocks)                                                                                                                         \
-    boolean_field(BytecodeFrame, rethrowException)                                                                                                             \
-    boolean_field(BytecodeFrame, duringCall)                                                                                                                   \
-    static_int_field(BytecodeFrame, BEFORE_BCI)                                                                                                                \
-  end_class                                                                                                                                                    \
-  start_class(BytecodePosition)                                                                                                                                \
-    oop_field(BytecodePosition, caller, "Lcom/oracle/graal/api/code/BytecodePosition;")                                                                        \
-    oop_field(BytecodePosition, method, "Lcom/oracle/graal/api/meta/ResolvedJavaMethod;")                                                                      \
-    int_field(BytecodePosition, bci)                                                                                                                           \
-  end_class                                                                                                                                                    \
-  start_class(JavaConstant)                                                                                                                                    \
-  end_class                                                                                                                                                    \
-  start_class(PrimitiveConstant)                                                                                                                               \
-    long_field(PrimitiveConstant, primitive)                                                                                                                   \
-  end_class                                                                                                                                                    \
-  start_class(RawConstant)                                                                                                                                     \
-    long_field(RawConstant, primitive)                                                                                                                         \
-  end_class                                                                                                                                                    \
-  start_class(NullConstant)                                                                                                                                    \
-  end_class                                                                                                                                                    \
-  start_class(HotSpotCompressedNullConstant)                                                                                                                   \
-  end_class                                                                                                                                                    \
-  start_class(HotSpotObjectConstantImpl)                                                                                                                       \
-    oop_field(HotSpotObjectConstantImpl, object, "Ljava/lang/Object;")                                                                                         \
-    boolean_field(HotSpotObjectConstantImpl, compressed)                                                                                                       \
-  end_class                                                                                                                                                    \
-  start_class(HotSpotMetaspaceConstantImpl)                                                                                                                    \
-    long_field(HotSpotMetaspaceConstantImpl, primitive)                                                                                                        \
-    oop_field(HotSpotMetaspaceConstantImpl, metaspaceObject, "Ljava/lang/Object;")                                                                             \
-    boolean_field(HotSpotMetaspaceConstantImpl, compressed)                                                                                                    \
-  end_class                                                                                                                                                    \
-  start_class(Kind)                                                                                                                                            \
-    char_field(Kind, typeChar)                                                                                                                                 \
-    static_oop_field(Kind, Boolean, "Lcom/oracle/graal/api/meta/Kind;");                                                                                       \
-    static_oop_field(Kind, Byte, "Lcom/oracle/graal/api/meta/Kind;");                                                                                          \
-    static_oop_field(Kind, Char, "Lcom/oracle/graal/api/meta/Kind;");                                                                                          \
-    static_oop_field(Kind, Short, "Lcom/oracle/graal/api/meta/Kind;");                                                                                         \
-    static_oop_field(Kind, Int, "Lcom/oracle/graal/api/meta/Kind;");                                                                                           \
-    static_oop_field(Kind, Long, "Lcom/oracle/graal/api/meta/Kind;");                                                                                          \
-  end_class                                                                                                                                                    \
-  start_class(LIRKind)                                                                                                                                         \
-    oop_field(LIRKind, platformKind, "Lcom/oracle/graal/api/meta/PlatformKind;")                                                                               \
-    int_field(LIRKind, referenceMask)                                                                                                                          \
-  end_class                                                                                                                                                    \
-  start_class(AbstractValue)                                                                                                                                   \
-    oop_field(AbstractValue, kind, "Lcom/oracle/graal/api/meta/Kind;")                                                                                         \
-    oop_field(AbstractValue, lirKind, "Lcom/oracle/graal/api/meta/LIRKind;")                                                                                   \
-    static_oop_field(AbstractValue, ILLEGAL, "Lcom/oracle/graal/api/meta/AllocatableValue;");                                                                  \
-  end_class                                                                                                                                                    \
-  start_class(RegisterValue)                                                                                                                                   \
-    oop_field(RegisterValue, reg, "Lcom/oracle/graal/api/code/Register;")                                                                                      \
-  end_class                                                                                                                                                    \
-  start_class(RegisterCategory)                                                                                                                                \
-    oop_field(RegisterCategory, name, "Ljava/lang/String;")                                                                                                    \
-    int_field(RegisterCategory, referenceMapOffset)                                                                                                            \
-    int_field(RegisterCategory, referenceMapShift)                                                                                                             \
-  end_class                                                                                                                                                    \
-  start_class(code_Register)                                                                                                                                   \
-    int_field(code_Register, number)                                                                                                                           \
-    int_field(code_Register, encoding)                                                                                                                         \
-    oop_field(code_Register, registerCategory, "Lcom/oracle/graal/api/code/Register$RegisterCategory;")                                                        \
-  end_class                                                                                                                                                    \
-  start_class(StackSlot)                                                                                                                                       \
-    int_field(StackSlot, offset)                                                                                                                               \
-    boolean_field(StackSlot, addFrameSize)                                                                                                                     \
-  end_class                                                                                                                                                    \
-  start_class(VirtualObject)                                                                                                                                   \
-    int_field(VirtualObject, id)                                                                                                                               \
-    oop_field(VirtualObject, type, "Lcom/oracle/graal/api/meta/ResolvedJavaType;")                                                                             \
-    objArrayOop_field(VirtualObject, values, "[Lcom/oracle/graal/api/meta/Value;")                                                                             \
-  end_class                                                                                                                                                    \
-  start_class(StackLockValue)                                                                                                                                  \
-    oop_field(StackLockValue, owner, "Lcom/oracle/graal/api/meta/Value;")                                                                                      \
-    oop_field(StackLockValue, slot, "Lcom/oracle/graal/api/code/StackSlotValue;")                                                                              \
-    boolean_field(StackLockValue, eliminated)                                                                                                                  \
-  end_class                                                                                                                                                    \
-  start_class(SpeculationLog)                                                                                                                                  \
-    oop_field(SpeculationLog, lastFailed, "Ljava/lang/Object;")                                                                                                \
-  end_class                                                                                                                                                    \
-  start_class(HotSpotStackFrameReference)                                                                                                                      \
-    oop_field(HotSpotStackFrameReference, compilerToVM, "Lcom/oracle/graal/hotspot/bridge/CompilerToVM;")                                                      \
-    long_field(HotSpotStackFrameReference, stackPointer)                                                                                                       \
-    int_field(HotSpotStackFrameReference, frameNumber)                                                                                                         \
-    int_field(HotSpotStackFrameReference, bci)                                                                                                                 \
-    long_field(HotSpotStackFrameReference, metaspaceMethod)                                                                                                    \
-    objArrayOop_field(HotSpotStackFrameReference, locals, "[Ljava/lang/Object;")                                                                               \
-    typeArrayOop_field(HotSpotStackFrameReference, localIsVirtual, "[Z")                                                                                       \
-  end_class                                                                                                                                                    \
-  start_class(Debug)                                                                                                                                           \
-    static_boolean_field(Debug, ENABLED)                                                                                                                       \
-  end_class                                                                                                                                                    \
-  /* end*/
-
-#define START_CLASS(name)                                                                                                                                      \
-class name : AllStatic {                                                                                                                                       \
-  private:                                                                                                                                                     \
-    friend class GraalCompiler;                                                                                                                                \
-    static void check(oop obj, const char* field_name) {                                                                                                       \
-        assert(obj != NULL, err_msg("NULL field access of %s.%s", #name, field_name));                                                                         \
-        assert(obj->is_a(SystemDictionary::name##_klass()), "wrong class, " #name " expected");                                                                \
-    }                                                                                                                                                          \
-    static void compute_offsets();                                                                                                                             \
-  public:                                                                                                                                                      \
-    static Klass* klass() { return SystemDictionary::name##_klass(); }
-
-#define END_CLASS };
-
-#define FIELD(name, type, accessor, cast)                                                                                                                         \
-    static int _##name##_offset;                                                                                                                                  \
-    static type name(oop obj)                   { check(obj, #name); return cast obj->accessor(_##name##_offset); }                                               \
-    static type name(Handle& obj)                { check(obj(), #name); return cast obj->accessor(_##name##_offset); }                                            \
-    static type name(jobject obj)               { check(JNIHandles::resolve(obj), #name); return cast JNIHandles::resolve(obj)->accessor(_##name##_offset); }     \
-    static void set_##name(oop obj, type x)     { check(obj, #name); obj->accessor##_put(_##name##_offset, x); }                                                  \
-    static void set_##name(Handle& obj, type x)  { check(obj(), #name); obj->accessor##_put(_##name##_offset, x); }                                               \
-    static void set_##name(jobject obj, type x) { check(JNIHandles::resolve(obj), #name); JNIHandles::resolve(obj)->accessor##_put(_##name##_offset, x); }
-
-#define EMPTY_CAST 
-#define CHAR_FIELD(klass, name) FIELD(name, jchar, char_field, EMPTY_CAST)
-#define INT_FIELD(klass, name) FIELD(name, jint, int_field, EMPTY_CAST)
-#define BOOLEAN_FIELD(klass, name) FIELD(name, jboolean, bool_field, EMPTY_CAST)
-#define LONG_FIELD(klass, name) FIELD(name, jlong, long_field, EMPTY_CAST)
-#define FLOAT_FIELD(klass, name) FIELD(name, jfloat, float_field, EMPTY_CAST)
-#define OOP_FIELD(klass, name, signature) FIELD(name, oop, obj_field, EMPTY_CAST)
-#define OBJARRAYOOP_FIELD(klass, name, signature) FIELD(name, objArrayOop, obj_field, (objArrayOop))
-#define TYPEARRAYOOP_FIELD(klass, name, signature) FIELD(name, typeArrayOop, obj_field, (typeArrayOop))
-#define STATIC_OOP_FIELD(klassName, name, signature)                                                           \
-    static int _##name##_offset;                                                                               \
-    static oop name() {                                                                                        \
-      InstanceKlass* ik = InstanceKlass::cast(klassName::klass());                                             \
-      address addr = ik->static_field_addr(_##name##_offset - InstanceMirrorKlass::offset_of_static_fields()); \
-      if (UseCompressedOops) {                                                                                 \
-        return oopDesc::load_decode_heap_oop((narrowOop *)addr);                                               \
-      } else {                                                                                                 \
-        return oopDesc::load_decode_heap_oop((oop*)addr);                                                      \
-      }                                                                                                        \
-    }                                                                                                          \
-    static void set_##name(oop x) {                                                                            \
-      InstanceKlass* ik = InstanceKlass::cast(klassName::klass());                                             \
-      address addr = ik->static_field_addr(_##name##_offset - InstanceMirrorKlass::offset_of_static_fields()); \
-      if (UseCompressedOops) {                                                                                 \
-        oop_store((narrowOop *)addr, x);                                                                       \
-      } else {                                                                                                 \
-        oop_store((oop*)addr, x);                                                                              \
-      }                                                                                                        \
-    }
-#define STATIC_PRIMITIVE_FIELD(klassName, name, jtypename)                                                     \
-    static int _##name##_offset;                                                                               \
-    static jtypename name() {                                                                                  \
-      InstanceKlass* ik = InstanceKlass::cast(klassName::klass());                                             \
-      address addr = ik->static_field_addr(_##name##_offset - InstanceMirrorKlass::offset_of_static_fields()); \
-      return *((jtypename *)addr);                                                                             \
-    }                                                                                                          \
-    static void set_##name(jtypename x) {                                                                      \
-      InstanceKlass* ik = InstanceKlass::cast(klassName::klass());                                             \
-      address addr = ik->static_field_addr(_##name##_offset - InstanceMirrorKlass::offset_of_static_fields()); \
-      *((jtypename *)addr) = x;                                                                                \
-    }
-
-#define STATIC_INT_FIELD(klassName, name) STATIC_PRIMITIVE_FIELD(klassName, name, jint)
-#define STATIC_BOOLEAN_FIELD(klassName, name) STATIC_PRIMITIVE_FIELD(klassName, name, jboolean)
-
-COMPILER_CLASSES_DO(START_CLASS, END_CLASS, CHAR_FIELD, INT_FIELD, BOOLEAN_FIELD, LONG_FIELD, FLOAT_FIELD, OOP_FIELD, TYPEARRAYOOP_FIELD, OBJARRAYOOP_FIELD, STATIC_OOP_FIELD, STATIC_INT_FIELD, STATIC_BOOLEAN_FIELD)
-#undef START_CLASS
-#undef END_CLASS
-#undef FIELD
-#undef CHAR_FIELD
-#undef INT_FIELD
-#undef BOOLEAN_FIELD
-#undef LONG_FIELD
-#undef FLOAT_FIELD
-#undef OOP_FIELD
-#undef TYPEARRAYOOP_FIELD
-#undef OBJARRAYOOP_FIELD
-#undef STATIC_OOP_FIELD
-#undef STATIC_INT_FIELD
-#undef STATIC_BOOLEAN_FIELD
-#undef EMPTY_CAST
-
-void compute_offset(int &dest_offset, Klass* klass, const char* name, const char* signature, bool static_field);
-
-#endif // SHARE_VM_GRAAL_GRAAL_JAVA_ACCESS_HPP
--- a/src/share/vm/graal/graalOptions.cpp	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,241 +0,0 @@
-/*
- * Copyright (c) 2015, 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.
- */
-
-#include "precompiled.hpp"
-#include "graal/graalOptions.hpp"
-#include "graal/graalRuntime.hpp"
-#include "runtime/arguments.hpp"
-#include "utilities/hashtable.inline.hpp"
-
-class OptionsParseClosure : public ParseClosure {
-  OptionsTable* _table;
-public:
-  OptionsParseClosure(OptionsTable* table) : _table(table) {}
-  void do_line(char* line) {
-    char* idx = strchr(line, '\t');
-    if (idx == NULL) {
-      warn_and_abort("invalid format: could not find first tab");
-      return;
-    }
-    *idx = '\0';
-    char* name = line;
-    line = idx + 1;
-    idx = strchr(line, '\t');
-    if (idx == NULL) {
-      warn_and_abort("invalid format: could not find second tab");
-      return;
-    }
-    *idx = '\0';
-    if (strlen(line) != 1) {
-      warn_and_abort("invalid format: type should be 1 char long");
-      return;
-    }
-    char typeChar = *line;
-    line = idx + 1;
-    idx = strchr(line, '\t');
-    if (idx == NULL) {
-      warn_and_abort("invalid format: could not find third tab");
-      return;
-    }
-    *idx = '\0';
-    char* help = line;
-    line = idx + 1;
-    idx = strchr(line, '\t');
-    if (idx == NULL) {
-      warn_and_abort("invalid format: could not find fourth tab");
-      return;
-    }
-    *idx = '\0';
-    char* declaringClass = line;
-    line = idx + 1;
-    char* fieldClass = line;
-    OptionType type;
-    switch(typeChar) {
-      case 's':
-        type = _string;
-        break;
-      case 'i':
-        type = _int;
-        break;
-      case 'j':
-        type = _long;
-        break;
-      case 'f':
-        type = _float;
-        break;
-      case 'd':
-        type = _double;
-        break;
-      case 'z':
-        type = _boolean;
-        break;
-      default:
-        warn_and_abort("unkown type");
-        return;
-    }
-    char* name2 = NEW_C_HEAP_ARRAY(char, (strlen(name) + 1 + strlen(help) + 1 + strlen(declaringClass) + 1 + strlen(fieldClass) + 1), mtCompiler);
-    char* help2 = name2 + strlen(name) + 1;
-    char* declaringClass2 = help2 + strlen(help) + 1;
-    char* fieldClass2 = declaringClass2 + strlen(declaringClass) + 1;
-    strcpy(name2, name);
-    strcpy(help2, help);
-    strcpy(declaringClass2, declaringClass);
-    strcpy(fieldClass2, fieldClass);
-    OptionDesc desc = {name2, help2, type, declaringClass2, fieldClass2};
-    if (!_table->add(desc)) {
-      warn_and_abort("duplicate option");
-      return;
-    }
-  }
-};
-
-class FreeNamesClosure : public ValueClosure<OptionDesc> {
-  void do_value(OptionDesc* desc) {
-    FREE_C_HEAP_ARRAY(char, desc->name, mtCompiler);
-  }
-};
-
-OptionsTable::~OptionsTable() {
-  FreeNamesClosure closure;
-  for_each(&closure);
-}
-
-OptionsTable* OptionsTable::load_options() {
-  OptionsTable* table = new OptionsTable();
-  // Add PrintFlags option manually
-  OptionDesc printFlagsDesc;
-  printFlagsDesc.name = PRINT_FLAGS_ARG;
-  printFlagsDesc.type = _boolean;
-  printFlagsDesc.help = PRINT_FLAGS_HELP;
-  printFlagsDesc.declaringClass = NULL;
-  printFlagsDesc.fieldClass = NULL;
-  table->add(printFlagsDesc);
-
-  char optionsDir[JVM_MAXPATHLEN];
-  const char* fileSep = os::file_separator();
-  jio_snprintf(optionsDir, sizeof(optionsDir), "%s%slib%sgraal%soptions",
-               Arguments::get_java_home(), fileSep, fileSep, fileSep);
-  DIR* dir = os::opendir(optionsDir);
-  if (dir != NULL) {
-    struct dirent *entry;
-    char *dbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(optionsDir), mtInternal);
-    OptionsParseClosure closure(table);
-    while ((entry = os::readdir(dir, (dirent *) dbuf)) != NULL && !closure.is_aborted()) {
-      const char* name = entry->d_name;
-      char optionFilePath[JVM_MAXPATHLEN];
-      jio_snprintf(optionFilePath, sizeof(optionFilePath), "%s%s%s",optionsDir, fileSep, name);
-      GraalRuntime::parse_lines(optionFilePath, &closure, false);
-    }
-    FREE_C_HEAP_ARRAY(char, dbuf, mtInternal);
-    os::closedir(dir);
-    if (closure.is_aborted()) {
-      delete table;
-      return NULL;
-    }
-    return table;
-  }
-  // TODO(gd) should this be silent?
-  warning("Could not open graal options directory (%s)",optionsDir);
-  return table;
-}
-
-OptionDesc* OptionsTable::get(const char* name, size_t arglen) {
-  char nameOnly[256];
-  guarantee(arglen < 256, "Max supported option name len is 256");
-  strncpy(nameOnly, name, arglen);
-  nameOnly[arglen] = '\0';
-  return GraalHashtable<const char*, OptionDesc>::get(nameOnly);
-}
-
-// Compute string similarity based on Dice's coefficient
-static float str_similar(const char* str1, const char* str2) {
-  size_t len1 = strlen(str1);
-  size_t len2 = strlen(str2);
-
-  if (len1 == 0 || len2 == 0) {
-    return 0;
-  }
-
-  int hits = 0;
-  for (size_t i = 0; i < len1 - 1; ++i) {
-    for (size_t j = 0; j < len2 -1; ++j) {
-      if ((str1[i] == str2[j]) && (str1[i+1] == str2[j+1])) {
-        ++hits;
-        break;
-      }
-    }
-  }
-
-  size_t total = len1 + len2;
-  return 2.0f * (float) hits / (float) total;
-}
-
-float VMOptionsFuzzyMatchSimilarity = 0.7f;
-
-class FuzzyMatchClosure : public ValueClosure<OptionDesc> {
-  OptionDesc* _match;
-  float _max_score;
-  const char* _name;
-public:
-  FuzzyMatchClosure(const char* name) : _name(name), _match(NULL), _max_score(-1) {}
-  void do_value(OptionDesc* value) {
-    float score = str_similar(value->name, _name);
-    if (score > VMOptionsFuzzyMatchSimilarity && score > _max_score) {
-      _max_score = score;
-      _match = value;
-    }
-  }
-  OptionDesc* get_match() {
-    return _match;
-  }
-};
-
-OptionDesc * OptionsTable::fuzzy_match(const char* name, size_t length) {
-  FuzzyMatchClosure closure(name);
-  for_each(&closure);
-  return closure.get_match();
-}
-
-class FreeStringsClosure : public ValueClosure<OptionValue> {
-  void do_value(OptionValue* value) {
-    if (value->desc.type == _string) {
-      FREE_C_HEAP_ARRAY(char, value->string_value, mtCompiler);
-    }
-  }
-};
-
-OptionsValueTable::~OptionsValueTable() {
-  FreeStringsClosure closure;
-  for_each(&closure);
-  delete _table;
-}
-
-
-
-OptionValue* OptionsValueTable::get(const char* name, size_t arglen) {
-  char nameOnly[256];
-  guarantee(arglen < 256, "Max supported option name len is 256");
-  strncpy(nameOnly, name, arglen);
-  nameOnly[arglen] = '\0';
-  return GraalHashtable<const char*, OptionValue>::get(nameOnly);
-}
--- a/src/share/vm/graal/graalOptions.hpp	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,103 +0,0 @@
-/*
- * Copyright (c) 2015, 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.
- */
-
-#ifndef SHARE_VM_GRAAL_GRAAL_OPTIONS_HPP
-#define SHARE_VM_GRAAL_GRAAL_OPTIONS_HPP
-
-#include "memory/allocation.hpp"
-#include "utilities/exceptions.hpp"
-#include "graal/graalHashtable.hpp"
-
-#define PRINT_FLAGS_ARG "PrintFlags"
-#define PRINT_FLAGS_HELP "Prints all Graal flags (similar to XX's PrintFlagsFinal)"
-
-enum OptionType {
-  _string,
-  _int,
-  _long,
-  _float,
-  _double,
-  _boolean
-};
-
-struct OptionDesc {
-  const char* name;
-  const char* help;
-  OptionType type;
-  const char* declaringClass;
-  const char* fieldClass;
-};
-
-inline unsigned int compute_string_hash(const char *s, int n) {
-  unsigned int val = 0;
-  while (--n >= 0) {
-    val = *s++ + 31 * val;
-  }
-  return val;
-}
-
-class OptionsTable : public GraalHashtable<const char*, OptionDesc> {
-protected:
-  unsigned int compute_hash(const char* key) { return compute_string_hash(key, strlen(key)); }
-  bool key_equals(const char* k1, const char* k2) { return strcmp(k1, k2) == 0; }
-  const char* get_key(OptionDesc value) { return value.name; } ;
-  const char* get_key(OptionDesc* value) { return value->name; } ;
-public:
-  OptionsTable() : GraalHashtable<const char*, OptionDesc>(100) {}
-  ~OptionsTable();
-  using GraalHashtable<const char*, OptionDesc>::get;
-  OptionDesc* get(const char* name, size_t arglen);
-  OptionDesc * fuzzy_match(const char* name, size_t length);
-
-  static OptionsTable* load_options();
-};
-
-struct OptionValue {
-  OptionDesc desc;
-  union {
-    const char* string_value;
-    jint int_value;
-    jlong long_value;
-    jfloat float_value;
-    jdouble double_value;
-    jboolean boolean_value;
-  };
-};
-
-class OptionsValueTable : public GraalHashtable<const char*, OptionValue> {
-  OptionsTable* _table;
-protected:
-  unsigned int compute_hash(const char* key) { return compute_string_hash(key, strlen(key)); }
-  bool key_equals(const char* k1, const char* k2) { return strcmp(k1, k2) == 0; }
-  const char* get_key(OptionValue value) { return value.desc.name; } ;
-  const char* get_key(OptionValue* value) { return value->desc.name; } ;
-public:
-  OptionsValueTable(OptionsTable* table) : _table(table), GraalHashtable<const char*, OptionValue>(100) {}
-  ~OptionsValueTable();
-  using GraalHashtable<const char*, OptionValue>::get;
-  OptionValue* get(const char* name, size_t arglen);
-  OptionsTable* options_table() { return _table; }
-};
-
-
-#endif // SHARE_VM_GRAAL_GRAAL_OPTIONS_HPP
--- a/src/share/vm/graal/graalRuntime.cpp	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1245 +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.
- */
-
-#include "precompiled.hpp"
-#include "asm/codeBuffer.hpp"
-#include "compiler/compileBroker.hpp"
-#include "compiler/disassembler.hpp"
-#include "graal/graalRuntime.hpp"
-#include "graal/graalCompilerToVM.hpp"
-#include "graal/graalCompiler.hpp"
-#include "graal/graalJavaAccess.hpp"
-#include "graal/graalEnv.hpp"
-#include "memory/oopFactory.hpp"
-#include "prims/jvm.h"
-#include "runtime/biasedLocking.hpp"
-#include "runtime/interfaceSupport.hpp"
-#include "runtime/arguments.hpp"
-#include "runtime/reflection.hpp"
-#include "utilities/debug.hpp"
-#include "utilities/defaultStream.hpp"
-
-jobject GraalRuntime::_HotSpotGraalRuntime_instance = NULL;
-bool GraalRuntime::_HotSpotGraalRuntime_initialized = false;
-bool GraalRuntime::_shutdown_called = false;
-
-void GraalRuntime::initialize_natives(JNIEnv *env, jclass c2vmClass) {
-  uintptr_t heap_end = (uintptr_t) Universe::heap()->reserved_region().end();
-  uintptr_t allocation_end = heap_end + ((uintptr_t)16) * 1024 * 1024 * 1024;
-  AMD64_ONLY(guarantee(heap_end < allocation_end, "heap end too close to end of address space (might lead to erroneous TLAB allocations)"));
-  NOT_LP64(error("check TLAB allocation code for address space conflicts"));
-
-  ensure_graal_class_loader_is_initialized();
-
-  JavaThread* THREAD = JavaThread::current();
-  {
-    ThreadToNativeFromVM trans(THREAD);
-
-    ResourceMark rm;
-    HandleMark hm;
-
-    graal_compute_offsets();
-
-    // Ensure _non_oop_bits is initialized
-    Universe::non_oop_word();
-
-    env->RegisterNatives(c2vmClass, CompilerToVM_methods, CompilerToVM_methods_count());
-  }
-  if (HAS_PENDING_EXCEPTION) {
-    abort_on_pending_exception(PENDING_EXCEPTION, "Could not register natives");
-  }
-}
-
-BufferBlob* GraalRuntime::initialize_buffer_blob() {
-  JavaThread* THREAD = JavaThread::current();
-  BufferBlob* buffer_blob = THREAD->get_buffer_blob();
-  if (buffer_blob == NULL) {
-    buffer_blob = BufferBlob::create("Graal thread-local CodeBuffer", GraalNMethodSizeLimit);
-    if (buffer_blob != NULL) {
-      THREAD->set_buffer_blob(buffer_blob);
-    }
-  }
-  return buffer_blob;
-}
-
-BasicType GraalRuntime::kindToBasicType(jchar ch) {
-  switch(ch) {
-    case 'z': return T_BOOLEAN;
-    case 'b': return T_BYTE;
-    case 's': return T_SHORT;
-    case 'c': return T_CHAR;
-    case 'i': return T_INT;
-    case 'f': return T_FLOAT;
-    case 'j': return T_LONG;
-    case 'd': return T_DOUBLE;
-    case 'a': return T_OBJECT;
-    case '-': return T_ILLEGAL;
-    default:
-      fatal(err_msg("unexpected Kind: %c", ch));
-      break;
-  }
-  return T_ILLEGAL;
-}
-
-// Simple helper to see if the caller of a runtime stub which
-// entered the VM has been deoptimized
-
-static bool caller_is_deopted() {
-  JavaThread* thread = JavaThread::current();
-  RegisterMap reg_map(thread, false);
-  frame runtime_frame = thread->last_frame();
-  frame caller_frame = runtime_frame.sender(&reg_map);
-  assert(caller_frame.is_compiled_frame(), "must be compiled");
-  return caller_frame.is_deoptimized_frame();
-}
-
-// Stress deoptimization
-static void deopt_caller() {
-  if ( !caller_is_deopted()) {
-    JavaThread* thread = JavaThread::current();
-    RegisterMap reg_map(thread, false);
-    frame runtime_frame = thread->last_frame();
-    frame caller_frame = runtime_frame.sender(&reg_map);
-    Deoptimization::deoptimize_frame(thread, caller_frame.id(), Deoptimization::Reason_constraint);
-    assert(caller_is_deopted(), "Must be deoptimized");
-  }
-}
-
-JRT_BLOCK_ENTRY(void, GraalRuntime::new_instance(JavaThread* thread, Klass* klass))
-  JRT_BLOCK;
-  assert(klass->is_klass(), "not a class");
-  instanceKlassHandle h(thread, klass);
-  h->check_valid_for_instantiation(true, CHECK);
-  // make sure klass is initialized
-  h->initialize(CHECK);
-  // allocate instance and return via TLS
-  oop obj = h->allocate_instance(CHECK);
-  thread->set_vm_result(obj);
-  JRT_BLOCK_END;
-
-  if (GraalDeferredInitBarriers) {
-    new_store_pre_barrier(thread);
-  }
-JRT_END
-
-JRT_BLOCK_ENTRY(void, GraalRuntime::new_array(JavaThread* thread, Klass* array_klass, jint length))
-  JRT_BLOCK;
-  // Note: no handle for klass needed since they are not used
-  //       anymore after new_objArray() and no GC can happen before.
-  //       (This may have to change if this code changes!)
-  assert(array_klass->is_klass(), "not a class");
-  oop obj;
-  if (array_klass->oop_is_typeArray()) {
-    BasicType elt_type = TypeArrayKlass::cast(array_klass)->element_type();
-    obj = oopFactory::new_typeArray(elt_type, length, CHECK);
-  } else {
-    Klass* elem_klass = ObjArrayKlass::cast(array_klass)->element_klass();
-    obj = oopFactory::new_objArray(elem_klass, length, CHECK);
-  }
-  thread->set_vm_result(obj);
-  // This is pretty rare but this runtime patch is stressful to deoptimization
-  // if we deoptimize here so force a deopt to stress the path.
-  if (DeoptimizeALot) {
-    static int deopts = 0;
-    // Alternate between deoptimizing and raising an error (which will also cause a deopt)
-    if (deopts++ % 2 == 0) {
-      ResourceMark rm(THREAD);
-      THROW(vmSymbols::java_lang_OutOfMemoryError());
-    } else {
-      deopt_caller();
-    }
-  }
-  JRT_BLOCK_END;
-
-  if (GraalDeferredInitBarriers) {
-    new_store_pre_barrier(thread);
-  }
-JRT_END
-
-void GraalRuntime::new_store_pre_barrier(JavaThread* thread) {
-  // After any safepoint, just before going back to compiled code,
-  // we inform the GC that we will be doing initializing writes to
-  // this object in the future without emitting card-marks, so
-  // GC may take any compensating steps.
-  // NOTE: Keep this code consistent with GraphKit::store_barrier.
-
-  oop new_obj = thread->vm_result();
-  if (new_obj == NULL)  return;
-
-  assert(Universe::heap()->can_elide_tlab_store_barriers(),
-         "compiler must check this first");
-  // GC may decide to give back a safer copy of new_obj.
-  new_obj = Universe::heap()->new_store_pre_barrier(thread, new_obj);
-  thread->set_vm_result(new_obj);
-}
-
-JRT_ENTRY(void, GraalRuntime::new_multi_array(JavaThread* thread, Klass* klass, int rank, jint* dims))
-  assert(klass->is_klass(), "not a class");
-  assert(rank >= 1, "rank must be nonzero");
-  oop obj = ArrayKlass::cast(klass)->multi_allocate(rank, dims, CHECK);
-  thread->set_vm_result(obj);
-JRT_END
-
-JRT_ENTRY(void, GraalRuntime::dynamic_new_array(JavaThread* thread, oopDesc* element_mirror, jint length))
-  oop obj = Reflection::reflect_new_array(element_mirror, length, CHECK);
-  thread->set_vm_result(obj);
-JRT_END
-
-JRT_ENTRY(void, GraalRuntime::dynamic_new_instance(JavaThread* thread, oopDesc* type_mirror))
-  instanceKlassHandle klass(THREAD, java_lang_Class::as_Klass(type_mirror));
-
-  if (klass == NULL) {
-    ResourceMark rm(THREAD);
-    THROW(vmSymbols::java_lang_InstantiationException());
-  }
-
-  // Create new instance (the receiver)
-  klass->check_valid_for_instantiation(false, CHECK);
-
-  // Make sure klass gets initialized
-  klass->initialize(CHECK);
-
-  oop obj = klass->allocate_instance(CHECK);
-  thread->set_vm_result(obj);
-JRT_END
-
-extern void vm_exit(int code);
-
-// Enter this method from compiled code handler below. This is where we transition
-// to VM mode. This is done as a helper routine so that the method called directly
-// from compiled code does not have to transition to VM. This allows the entry
-// method to see if the nmethod that we have just looked up a handler for has
-// been deoptimized while we were in the vm. This simplifies the assembly code
-// cpu directories.
-//
-// We are entering here from exception stub (via the entry method below)
-// If there is a compiled exception handler in this method, we will continue there;
-// otherwise we will unwind the stack and continue at the caller of top frame method
-// Note: we enter in Java using a special JRT wrapper. This wrapper allows us to
-// control the area where we can allow a safepoint. After we exit the safepoint area we can
-// check to see if the handler we are going to return is now in a nmethod that has
-// been deoptimized. If that is the case we return the deopt blob
-// unpack_with_exception entry instead. This makes life for the exception blob easier
-// because making that same check and diverting is painful from assembly language.
-JRT_ENTRY_NO_ASYNC(static address, exception_handler_for_pc_helper(JavaThread* thread, oopDesc* ex, address pc, nmethod*& nm))
-  // Reset method handle flag.
-  thread->set_is_method_handle_return(false);
-
-  Handle exception(thread, ex);
-  nm = CodeCache::find_nmethod(pc);
-  assert(nm != NULL, "this is not an nmethod");
-  // Adjust the pc as needed/
-  if (nm->is_deopt_pc(pc)) {
-    RegisterMap map(thread, false);
-    frame exception_frame = thread->last_frame().sender(&map);
-    // if the frame isn't deopted then pc must not correspond to the caller of last_frame
-    assert(exception_frame.is_deoptimized_frame(), "must be deopted");
-    pc = exception_frame.pc();
-  }
-#ifdef ASSERT
-  assert(exception.not_null(), "NULL exceptions should be handled by throw_exception");
-  assert(exception->is_oop(), "just checking");
-  // Check that exception is a subclass of Throwable, otherwise we have a VerifyError
-  if (!(exception->is_a(SystemDictionary::Throwable_klass()))) {
-    if (ExitVMOnVerifyError) vm_exit(-1);
-    ShouldNotReachHere();
-  }
-#endif
-
-  // Check the stack guard pages and reenable them if necessary and there is
-  // enough space on the stack to do so.  Use fast exceptions only if the guard
-  // pages are enabled.
-  bool guard_pages_enabled = thread->stack_yellow_zone_enabled();
-  if (!guard_pages_enabled) guard_pages_enabled = thread->reguard_stack();
-
-  if (JvmtiExport::can_post_on_exceptions()) {
-    // To ensure correct notification of exception catches and throws
-    // we have to deoptimize here.  If we attempted to notify the
-    // catches and throws during this exception lookup it's possible
-    // we could deoptimize on the way out of the VM and end back in
-    // the interpreter at the throw site.  This would result in double
-    // notifications since the interpreter would also notify about
-    // these same catches and throws as it unwound the frame.
-
-    RegisterMap reg_map(thread);
-    frame stub_frame = thread->last_frame();
-    frame caller_frame = stub_frame.sender(&reg_map);
-
-    // We don't really want to deoptimize the nmethod itself since we
-    // can actually continue in the exception handler ourselves but I
-    // don't see an easy way to have the desired effect.
-    Deoptimization::deoptimize_frame(thread, caller_frame.id(), Deoptimization::Reason_constraint);
-    assert(caller_is_deopted(), "Must be deoptimized");
-
-    return SharedRuntime::deopt_blob()->unpack_with_exception_in_tls();
-  }
-
-  // ExceptionCache is used only for exceptions at call sites and not for implicit exceptions
-  if (guard_pages_enabled) {
-    address fast_continuation = nm->handler_for_exception_and_pc(exception, pc);
-    if (fast_continuation != NULL) {
-      // Set flag if return address is a method handle call site.
-      thread->set_is_method_handle_return(nm->is_method_handle_return(pc));
-      return fast_continuation;
-    }
-  }
-
-  // If the stack guard pages are enabled, check whether there is a handler in
-  // the current method.  Otherwise (guard pages disabled), force an unwind and
-  // skip the exception cache update (i.e., just leave continuation==NULL).
-  address continuation = NULL;
-  if (guard_pages_enabled) {
-
-    // New exception handling mechanism can support inlined methods
-    // with exception handlers since the mappings are from PC to PC
-
-    // debugging support
-    // tracing
-    if (TraceExceptions) {
-      ttyLocker ttyl;
-      ResourceMark rm;
-      tty->print_cr("Exception <%s> (" INTPTR_FORMAT ") thrown in compiled method <%s> at PC " INTPTR_FORMAT " for thread " INTPTR_FORMAT "",
-                    exception->print_value_string(), p2i((address)exception()), nm->method()->print_value_string(), p2i(pc), p2i(thread));
-    }
-    // for AbortVMOnException flag
-    NOT_PRODUCT(Exceptions::debug_check_abort(exception));
-
-    // Clear out the exception oop and pc since looking up an
-    // exception handler can cause class loading, which might throw an
-    // exception and those fields are expected to be clear during
-    // normal bytecode execution.
-    thread->clear_exception_oop_and_pc();
-
-    continuation = SharedRuntime::compute_compiled_exc_handler(nm, pc, exception, false, false);
-    // If an exception was thrown during exception dispatch, the exception oop may have changed
-    thread->set_exception_oop(exception());
-    thread->set_exception_pc(pc);
-
-    // the exception cache is used only by non-implicit exceptions
-    if (continuation != NULL && !SharedRuntime::deopt_blob()->contains(continuation)) {
-      nm->add_handler_for_exception_and_pc(exception, pc, continuation);
-    }
-  }
-
-  // Set flag if return address is a method handle call site.
-  thread->set_is_method_handle_return(nm->is_method_handle_return(pc));
-
-  if (TraceExceptions) {
-    ttyLocker ttyl;
-    ResourceMark rm;
-    tty->print_cr("Thread " PTR_FORMAT " continuing at PC " PTR_FORMAT " for exception thrown at PC " PTR_FORMAT,
-                  p2i(thread), p2i(continuation), p2i(pc));
-  }
-
-  return continuation;
-JRT_END
-
-// Enter this method from compiled code only if there is a Java exception handler
-// in the method handling the exception.
-// We are entering here from exception stub. We don't do a normal VM transition here.
-// We do it in a helper. This is so we can check to see if the nmethod we have just
-// searched for an exception handler has been deoptimized in the meantime.
-address GraalRuntime::exception_handler_for_pc(JavaThread* thread) {
-  oop exception = thread->exception_oop();
-  address pc = thread->exception_pc();
-  // Still in Java mode
-  DEBUG_ONLY(ResetNoHandleMark rnhm);
-  nmethod* nm = NULL;
-  address continuation = NULL;
-  {
-    // Enter VM mode by calling the helper
-    ResetNoHandleMark rnhm;
-    continuation = exception_handler_for_pc_helper(thread, exception, pc, nm);
-  }
-  // Back in JAVA, use no oops DON'T safepoint
-
-  // Now check to see if the nmethod we were called from is now deoptimized.
-  // If so we must return to the deopt blob and deoptimize the nmethod
-  if (nm != NULL && caller_is_deopted()) {
-    continuation = SharedRuntime::deopt_blob()->unpack_with_exception_in_tls();
-  }
-
-  assert(continuation != NULL, "no handler found");
-  return continuation;
-}
-
-JRT_ENTRY(void, GraalRuntime::create_null_exception(JavaThread* thread))
-  SharedRuntime::throw_and_post_jvmti_exception(thread, vmSymbols::java_lang_NullPointerException());
-  thread->set_vm_result(PENDING_EXCEPTION);
-  CLEAR_PENDING_EXCEPTION;
-JRT_END
-
-JRT_ENTRY(void, GraalRuntime::create_out_of_bounds_exception(JavaThread* thread, jint index))
-  char message[jintAsStringSize];
-  sprintf(message, "%d", index);
-  SharedRuntime::throw_and_post_jvmti_exception(thread, vmSymbols::java_lang_ArrayIndexOutOfBoundsException(), message);
-  thread->set_vm_result(PENDING_EXCEPTION);
-  CLEAR_PENDING_EXCEPTION;
-JRT_END
-
-JRT_ENTRY_NO_ASYNC(void, GraalRuntime::monitorenter(JavaThread* thread, oopDesc* obj, BasicLock* lock))
-  if (TraceGraal >= 3) {
-    char type[O_BUFLEN];
-    obj->klass()->name()->as_C_string(type, O_BUFLEN);
-    markOop mark = obj->mark();
-    tty->print_cr("%s: entered locking slow case with obj=" INTPTR_FORMAT ", type=%s, mark=" INTPTR_FORMAT ", lock=" INTPTR_FORMAT, thread->name(), p2i(obj), type, p2i(mark), p2i(lock));
-    tty->flush();
-  }
-#ifdef ASSERT
-  if (PrintBiasedLockingStatistics) {
-    Atomic::inc(BiasedLocking::slow_path_entry_count_addr());
-  }
-#endif
-  Handle h_obj(thread, obj);
-  assert(h_obj()->is_oop(), "must be NULL or an object");
-  if (UseBiasedLocking) {
-    // Retry fast entry if bias is revoked to avoid unnecessary inflation
-    ObjectSynchronizer::fast_enter(h_obj, lock, true, CHECK);
-  } else {
-    if (GraalUseFastLocking) {
-      // When using fast locking, the compiled code has already tried the fast case
-      ObjectSynchronizer::slow_enter(h_obj, lock, THREAD);
-    } else {
-      ObjectSynchronizer::fast_enter(h_obj, lock, false, THREAD);
-    }
-  }
-  if (TraceGraal >= 3) {
-    tty->print_cr("%s: exiting locking slow with obj=" INTPTR_FORMAT, thread->name(), p2i(obj));
-  }
-JRT_END
-
-JRT_LEAF(void, GraalRuntime::monitorexit(JavaThread* thread, oopDesc* obj, BasicLock* lock))
-  assert(thread == JavaThread::current(), "threads must correspond");
-  assert(thread->last_Java_sp(), "last_Java_sp must be set");
-  // monitorexit is non-blocking (leaf routine) => no exceptions can be thrown
-  EXCEPTION_MARK;
-
-#ifdef DEBUG
-  if (!obj->is_oop()) {
-    ResetNoHandleMark rhm;
-    nmethod* method = thread->last_frame().cb()->as_nmethod_or_null();
-    if (method != NULL) {
-      tty->print_cr("ERROR in monitorexit in method %s wrong obj " INTPTR_FORMAT, method->name(), p2i(obj));
-    }
-    thread->print_stack_on(tty);
-    assert(false, "invalid lock object pointer dected");
-  }
-#endif
-
-  if (GraalUseFastLocking) {
-    // When using fast locking, the compiled code has already tried the fast case
-    ObjectSynchronizer::slow_exit(obj, lock, THREAD);
-  } else {
-    ObjectSynchronizer::fast_exit(obj, lock, THREAD);
-  }
-  if (TraceGraal >= 3) {
-    char type[O_BUFLEN];
-    obj->klass()->name()->as_C_string(type, O_BUFLEN);
-    tty->print_cr("%s: exited locking slow case with obj=" INTPTR_FORMAT ", type=%s, mark=" INTPTR_FORMAT ", lock=" INTPTR_FORMAT, thread->name(), p2i(obj), type, p2i(obj->mark()), p2i(lock));
-    tty->flush();
-  }
-JRT_END
-
-JRT_LEAF(void, GraalRuntime::log_object(JavaThread* thread, oopDesc* obj, jint flags))
-  bool string =  mask_bits_are_true(flags, LOG_OBJECT_STRING);
-  bool addr = mask_bits_are_true(flags, LOG_OBJECT_ADDRESS);
-  bool newline = mask_bits_are_true(flags, LOG_OBJECT_NEWLINE);
-  if (!string) {
-    if (!addr && obj->is_oop_or_null(true)) {
-      char buf[O_BUFLEN];
-      tty->print("%s@" INTPTR_FORMAT, obj->klass()->name()->as_C_string(buf, O_BUFLEN), p2i(obj));
-    } else {
-      tty->print(INTPTR_FORMAT, p2i(obj));
-    }
-  } else {
-    ResourceMark rm;
-    assert(obj != NULL && java_lang_String::is_instance(obj), "must be");
-    char *buf = java_lang_String::as_utf8_string(obj);
-    tty->print_raw(buf);
-  }
-  if (newline) {
-    tty->cr();
-  }
-JRT_END
-
-JRT_LEAF(void, GraalRuntime::write_barrier_pre(JavaThread* thread, oopDesc* obj))
-  thread->satb_mark_queue().enqueue(obj);
-JRT_END
-
-JRT_LEAF(void, GraalRuntime::write_barrier_post(JavaThread* thread, void* card_addr))
-  thread->dirty_card_queue().enqueue(card_addr);
-JRT_END
-
-JRT_LEAF(jboolean, GraalRuntime::validate_object(JavaThread* thread, oopDesc* parent, oopDesc* child))
-  bool ret = true;
-  if(!Universe::heap()->is_in_closed_subset(parent)) {
-    tty->print_cr("Parent Object "INTPTR_FORMAT" not in heap", p2i(parent));
-    parent->print();
-    ret=false;
-  }
-  if(!Universe::heap()->is_in_closed_subset(child)) {
-    tty->print_cr("Child Object "INTPTR_FORMAT" not in heap", p2i(child));
-    child->print();
-    ret=false;
-  }
-  return (jint)ret;
-JRT_END
-
-JRT_ENTRY(void, GraalRuntime::vm_error(JavaThread* thread, jlong where, jlong format, jlong value))
-  ResourceMark rm;
-  const char *error_msg = where == 0L ? "<internal Graal error>" : (char*) (address) where;
-  char *detail_msg = NULL;
-  if (format != 0L) {
-    const char* buf = (char*) (address) format;
-    size_t detail_msg_length = strlen(buf) * 2;
-    detail_msg = (char *) NEW_RESOURCE_ARRAY(u_char, detail_msg_length);
-    jio_snprintf(detail_msg, detail_msg_length, buf, value);
-  }
-  report_vm_error(__FILE__, __LINE__, error_msg, detail_msg);
-JRT_END
-
-JRT_LEAF(oopDesc*, GraalRuntime::load_and_clear_exception(JavaThread* thread))
-  oop exception = thread->exception_oop();
-  assert(exception != NULL, "npe");
-  thread->set_exception_oop(NULL);
-  thread->set_exception_pc(0);
-  return exception;
-JRT_END
-
-JRT_LEAF(void, GraalRuntime::log_printf(JavaThread* thread, oopDesc* format, jlong v1, jlong v2, jlong v3))
-  ResourceMark rm;
-  assert(format != NULL && java_lang_String::is_instance(format), "must be");
-  char *buf = java_lang_String::as_utf8_string(format);
-  tty->print(buf, v1, v2, v3);
-JRT_END
-
-static void decipher(jlong v, bool ignoreZero) {
-  if (v != 0 || !ignoreZero) {
-    void* p = (void *)(address) v;
-    CodeBlob* cb = CodeCache::find_blob(p);
-    if (cb) {
-      if (cb->is_nmethod()) {
-        char buf[O_BUFLEN];
-        tty->print("%s [" INTPTR_FORMAT "+" JLONG_FORMAT "]", cb->as_nmethod_or_null()->method()->name_and_sig_as_C_string(buf, O_BUFLEN), p2i(cb->code_begin()), (jlong)((address)v - cb->code_begin()));
-        return;
-      }
-      cb->print_value_on(tty);
-      return;
-    }
-    if (Universe::heap()->is_in(p)) {
-      oop obj = oop(p);
-      obj->print_value_on(tty);
-      return;
-    }
-    tty->print(INTPTR_FORMAT " [long: " JLONG_FORMAT ", double %lf, char %c]",p2i((void *)v), (jlong)v, (jdouble)v, (char)v);
-  }
-}
-
-JRT_LEAF(void, GraalRuntime::vm_message(jboolean vmError, jlong format, jlong v1, jlong v2, jlong v3))
-  ResourceMark rm;
-  char *buf = (char*) (address) format;
-  if (vmError) {
-    if (buf != NULL) {
-      fatal(err_msg(buf, v1, v2, v3));
-    } else {
-      fatal("<anonymous error>");
-    }
-  } else if (buf != NULL) {
-    tty->print(buf, v1, v2, v3);
-  } else {
-    assert(v2 == 0, "v2 != 0");
-    assert(v3 == 0, "v3 != 0");
-    decipher(v1, false);
-  }
-JRT_END
-
-JRT_LEAF(void, GraalRuntime::log_primitive(JavaThread* thread, jchar typeChar, jlong value, jboolean newline))
-  union {
-      jlong l;
-      jdouble d;
-      jfloat f;
-  } uu;
-  uu.l = value;
-  switch (typeChar) {
-    case 'z': tty->print(value == 0 ? "false" : "true"); break;
-    case 'b': tty->print("%d", (jbyte) value); break;
-    case 'c': tty->print("%c", (jchar) value); break;
-    case 's': tty->print("%d", (jshort) value); break;
-    case 'i': tty->print("%d", (jint) value); break;
-    case 'f': tty->print("%f", uu.f); break;
-    case 'j': tty->print(JLONG_FORMAT, value); break;
-    case 'd': tty->print("%lf", uu.d); break;
-    default: assert(false, "unknown typeChar"); break;
-  }
-  if (newline) {
-    tty->cr();
-  }
-JRT_END
-
-JRT_ENTRY(jint, GraalRuntime::identity_hash_code(JavaThread* thread, oopDesc* obj))
-  return (jint) obj->identity_hash();
-JRT_END
-
-JRT_ENTRY(jboolean, GraalRuntime::thread_is_interrupted(JavaThread* thread, oopDesc* receiver, jboolean clear_interrupted))
-  // Ensure that the C++ Thread and OSThread structures aren't freed before we operate.
-  // This locking requires thread_in_vm which is why this method cannot be JRT_LEAF.
-  Handle receiverHandle(thread, receiver);
-  MutexLockerEx ml(thread->threadObj() == (void*)receiver ? NULL : Threads_lock);
-  JavaThread* receiverThread = java_lang_Thread::thread(receiverHandle());
-  if (receiverThread == NULL) {
-    // The other thread may exit during this process, which is ok so return false.
-    return JNI_FALSE;
-  } else {
-    return (jint) Thread::is_interrupted(receiverThread, clear_interrupted != 0);
-  }
-JRT_END
-
-JRT_ENTRY(jint, GraalRuntime::test_deoptimize_call_int(JavaThread* thread, int value))
-  deopt_caller();
-  return value;
-JRT_END
-
-// private static void Factory.init()
-JVM_ENTRY(void, JVM_InitGraalClassLoader(JNIEnv *env, jclass c, jobject loader_handle))
-  SystemDictionary::init_graal_loader(JNIHandles::resolve(loader_handle));
-  SystemDictionary::WKID scan = SystemDictionary::FIRST_GRAAL_WKID;
-  SystemDictionary::initialize_wk_klasses_through(SystemDictionary::LAST_GRAAL_WKID, scan, CHECK);
-JVM_END
-
-// boolean com.oracle.graal.hotspot.HotSpotOptions.isCITimingEnabled()
-JVM_ENTRY(jboolean, JVM_IsCITimingEnabled(JNIEnv *env, jclass c))
-  return CITime || CITimeEach;
-JVM_END
-
-// private static GraalRuntime Graal.initializeRuntime()
-JVM_ENTRY(jobject, JVM_GetGraalRuntime(JNIEnv *env, jclass c))
-  GraalRuntime::initialize_HotSpotGraalRuntime();
-  return GraalRuntime::get_HotSpotGraalRuntime_jobject();
-JVM_END
-
-// private static String[] Services.getServiceImpls(Class service)
-JVM_ENTRY(jobject, JVM_GetGraalServiceImpls(JNIEnv *env, jclass c, jclass serviceClass))
-  HandleMark hm;
-  ResourceMark rm;
-  KlassHandle serviceKlass(THREAD, java_lang_Class::as_Klass(JNIHandles::resolve_non_null(serviceClass)));
-  return JNIHandles::make_local(THREAD, GraalRuntime::get_service_impls(serviceKlass, THREAD)());
-JVM_END
-
-// private static TruffleRuntime Truffle.createRuntime()
-JVM_ENTRY(jobject, JVM_CreateTruffleRuntime(JNIEnv *env, jclass c))
-  GraalRuntime::ensure_graal_class_loader_is_initialized();
-  TempNewSymbol name = SymbolTable::new_symbol("com/oracle/graal/truffle/hotspot/HotSpotTruffleRuntime", CHECK_NULL);
-  KlassHandle klass = GraalRuntime::resolve_or_fail(name, CHECK_NULL);
-
-  TempNewSymbol makeInstance = SymbolTable::new_symbol("makeInstance", CHECK_NULL);
-  TempNewSymbol sig = SymbolTable::new_symbol("()Lcom/oracle/truffle/api/TruffleRuntime;", CHECK_NULL);
-  JavaValue result(T_OBJECT);
-  JavaCalls::call_static(&result, klass, makeInstance, sig, CHECK_NULL);
-  return JNIHandles::make_local(THREAD, (oop) result.get_jobject());
-JVM_END
-
-// private static NativeFunctionInterfaceRuntime.createInterface()
-JVM_ENTRY(jobject, JVM_CreateNativeFunctionInterface(JNIEnv *env, jclass c))
-  GraalRuntime::ensure_graal_class_loader_is_initialized();
-  TempNewSymbol name = SymbolTable::new_symbol("com/oracle/graal/truffle/hotspot/HotSpotTruffleRuntime", CHECK_NULL);
-  KlassHandle klass = GraalRuntime::resolve_or_fail(name, CHECK_NULL);
-
-  TempNewSymbol makeInstance = SymbolTable::new_symbol("createNativeFunctionInterface", CHECK_NULL);
-  TempNewSymbol sig = SymbolTable::new_symbol("()Lcom/oracle/nfi/api/NativeFunctionInterface;", CHECK_NULL);
-  JavaValue result(T_OBJECT);
-  JavaCalls::call_static(&result, klass, makeInstance, sig, CHECK_NULL);
-  return JNIHandles::make_local(THREAD, (oop) result.get_jobject());
-JVM_END
-
-Handle GraalRuntime::callInitializer(const char* className, const char* methodName, const char* returnType) {
-  guarantee(!_HotSpotGraalRuntime_initialized, "cannot reinitialize HotSpotGraalRuntime");
-  Thread* THREAD = Thread::current();
-
-  TempNewSymbol name = SymbolTable::new_symbol(className, CHECK_ABORT_(Handle()));
-  KlassHandle klass = load_required_class(name);
-  TempNewSymbol runtime = SymbolTable::new_symbol(methodName, CHECK_ABORT_(Handle()));
-  TempNewSymbol sig = SymbolTable::new_symbol(returnType, CHECK_ABORT_(Handle()));
-  JavaValue result(T_OBJECT);
-  JavaCalls::call_static(&result, klass, runtime, sig, CHECK_ABORT_(Handle()));
-  return Handle((oop)result.get_jobject());
-}
-
-void GraalRuntime::initialize_HotSpotGraalRuntime() {
-  if (JNIHandles::resolve(_HotSpotGraalRuntime_instance) == NULL) {
-#ifdef ASSERT
-    // This should only be called in the context of the Graal class being initialized
-    Thread* THREAD = Thread::current();
-    TempNewSymbol name = SymbolTable::new_symbol("com/oracle/graal/api/runtime/Graal", CHECK_ABORT);
-    instanceKlassHandle klass = InstanceKlass::cast(load_required_class(name));
-    assert(klass->is_being_initialized() && klass->is_reentrant_initialization(THREAD),
-           "HotSpotGraalRuntime initialization should only be triggered through Graal initialization");
-#endif
-
-    Handle result = callInitializer("com/oracle/graal/hotspot/HotSpotGraalRuntime", "runtime",
-                                    "()Lcom/oracle/graal/hotspot/HotSpotGraalRuntime;");
-    _HotSpotGraalRuntime_initialized = true;
-    _HotSpotGraalRuntime_instance = JNIHandles::make_global(result());
-  }
-}
-
-void GraalRuntime::initialize_Graal() {
-  if (JNIHandles::resolve(_HotSpotGraalRuntime_instance) == NULL) {
-    callInitializer("com/oracle/graal/api/runtime/Graal",     "getRuntime",      "()Lcom/oracle/graal/api/runtime/GraalRuntime;");
-  }
-  assert(_HotSpotGraalRuntime_initialized == true, "what?");
-}
-
-// private static void CompilerToVMImpl.init()
-JVM_ENTRY(void, JVM_InitializeGraalNatives(JNIEnv *env, jclass c2vmClass))
-  GraalRuntime::initialize_natives(env, c2vmClass);
-JVM_END
-
-void GraalRuntime::ensure_graal_class_loader_is_initialized() {
-  // This initialization code is guarded by a static pointer to the Factory class.
-  // Once it is non-null, the Graal class loader and well known Graal classes are
-  // guaranteed to have been initialized. By going through the static
-  // initializer of Factory, we can rely on class initialization semantics to
-  // synchronize threads racing to do the initialization.
-  static Klass* _FactoryKlass = NULL;
-  if (_FactoryKlass == NULL) {
-    Thread* THREAD = Thread::current();
-    TempNewSymbol name = SymbolTable::new_symbol("com/oracle/graal/hotspot/loader/Factory", CHECK_ABORT);
-    KlassHandle klass = SystemDictionary::resolve_or_fail(name, true, THREAD);
-    if (HAS_PENDING_EXCEPTION) {
-      static volatile int seen_error = 0;
-      if (!seen_error && Atomic::cmpxchg(1, &seen_error, 0) == 0) {
-        // Only report the failure on the first thread that hits it
-        abort_on_pending_exception(PENDING_EXCEPTION, "Graal classes are not available");
-      } else {
-        CLEAR_PENDING_EXCEPTION;
-        // Give first thread time to report the error.
-        os::sleep(THREAD, 100, false);
-        vm_abort(false);
-      }
-    }
-
-    // We cannot use graalJavaAccess for this because we are currently in the
-    // process of initializing that mechanism.
-    TempNewSymbol field_name = SymbolTable::new_symbol("useGraalClassLoader", CHECK_ABORT);
-    fieldDescriptor field_desc;
-    if (klass->find_field(field_name, vmSymbols::bool_signature(), &field_desc) == NULL) {
-      ResourceMark rm;
-      fatal(err_msg("Invalid layout of %s at %s", field_name->as_C_string(), klass->external_name()));
-    }
-
-    InstanceKlass* ik = InstanceKlass::cast(klass());
-    address addr = ik->static_field_addr(field_desc.offset() - InstanceMirrorKlass::offset_of_static_fields());
-    *((jboolean *) addr) = (jboolean) UseGraalClassLoader;
-    klass->initialize(CHECK_ABORT);
-    _FactoryKlass = klass();
-    assert(!UseGraalClassLoader || SystemDictionary::graal_loader() != NULL, "Graal classloader should have been initialized");
-  }
-}
-
-OptionsValueTable* GraalRuntime::parse_arguments() {
-  OptionsTable* table = OptionsTable::load_options();
-  if (table == NULL) {
-    return NULL;
-  }
-
-  OptionsValueTable* options = new OptionsValueTable(table);
-
-  // Process option overrides from graal.options first
-  parse_graal_options_file(options);
-
-  // Now process options on the command line
-  int numOptions = Arguments::num_graal_args();
-  for (int i = 0; i < numOptions; i++) {
-    char* arg = Arguments::graal_args_array()[i];
-    if (!parse_argument(options, arg)) {
-      delete options;
-      return NULL;
-    }
-  }
-  return options;
-}
-
-void not_found(OptionsTable* table, const char* argname, size_t namelen) {
-  jio_fprintf(defaultStream::error_stream(),"Unrecognized VM option '%.*s'\n", namelen, argname);
-  OptionDesc* fuzzy_matched = table->fuzzy_match(argname, strlen(argname));
-  if (fuzzy_matched != NULL) {
-    jio_fprintf(defaultStream::error_stream(),
-                "Did you mean '%s%s%s'?\n",
-                (fuzzy_matched->type == _boolean) ? "(+/-)" : "",
-                fuzzy_matched->name,
-                (fuzzy_matched->type == _boolean) ? "" : "=<value>");
-  }
-}
-
-bool GraalRuntime::parse_argument(OptionsValueTable* options, const char* arg) {
-  OptionsTable* table = options->options_table();
-  char first = arg[0];
-  const char* name;
-  size_t name_len;
-  if (first == '+' || first == '-') {
-    name = arg + 1;
-    OptionDesc* optionDesc = table->get(name);
-    if (optionDesc == NULL) {
-      not_found(table, name, strlen(name));
-      return false;
-    }
-    if (optionDesc->type != _boolean) {
-      jio_fprintf(defaultStream::error_stream(), "Unexpected +/- setting in VM option '%s'\n", name);
-      return false;
-    }
-    OptionValue value;
-    value.desc = *optionDesc;
-    value.boolean_value = first == '+';
-    options->put(value);
-    return true;
-  } else {
-    const char* sep = strchr(arg, '=');
-    name = arg;
-    const char* value = NULL;
-    if (sep != NULL) {
-      name_len = sep - name;
-      value = sep + 1;
-    } else {
-      name_len = strlen(name);
-    }
-    OptionDesc* optionDesc = table->get(name, name_len);
-    if (optionDesc == NULL) {
-      not_found(table, name, name_len);
-      return false;
-    }
-    if (optionDesc->type == _boolean) {
-      jio_fprintf(defaultStream::error_stream(), "Missing +/- setting for VM option '%s'\n", name);
-      return false;
-    }
-    if (value == NULL) {
-      jio_fprintf(defaultStream::error_stream(), "Must use '-G:%.*s=<value>' format for %.*s option", name_len, name, name_len, name);
-      return false;
-    }
-    OptionValue optionValue;
-    optionValue.desc = *optionDesc;
-    char* check;
-    errno = 0;
-    switch(optionDesc->type) {
-      case _int: {
-        long int int_value = ::strtol(value, &check, 10);
-        if (*check != '\0' || errno == ERANGE || int_value > max_jint || int_value < min_jint) {
-          jio_fprintf(defaultStream::error_stream(), "Expected int value for VM option '%s'\n", name);
-          return false;
-        }
-        optionValue.int_value = int_value;
-        break;
-      }
-      case _long: {
-        long long int long_value = ::strtoll(value, &check, 10);
-        if (*check != '\0' || errno == ERANGE || long_value > max_jlong || long_value < min_jlong) {
-          jio_fprintf(defaultStream::error_stream(), "Expected long value for VM option '%s'\n", name);
-          return false;
-        }
-        optionValue.long_value = long_value;
-        break;
-      }
-      case _float: {
-        optionValue.float_value = ::strtof(value, &check);
-        if (*check != '\0' || errno == ERANGE) {
-          jio_fprintf(defaultStream::error_stream(), "Expected float value for VM option '%s'\n", name);
-          return false;
-        }
-        break;
-      }
-      case _double: {
-        optionValue.double_value = ::strtod(value, &check);
-        if (*check != '\0' || errno == ERANGE) {
-          jio_fprintf(defaultStream::error_stream(), "Expected double value for VM option '%s'\n", name);
-          return false;
-        }
-        break;
-      }
-      case _string: {
-        char* copy = NEW_C_HEAP_ARRAY(char, strlen(value) + 1, mtCompiler);
-        strcpy(copy, value);
-        optionValue.string_value = copy;
-        break;
-      }
-      default:
-        ShouldNotReachHere();
-    }
-    options->put(optionValue);
-    return true;
-  }
-}
-
-class GraalOptionParseClosure : public ParseClosure {
-  OptionsValueTable* _options;
-public:
-  GraalOptionParseClosure(OptionsValueTable* options) : _options(options) {}
-  void do_line(char* line) {
-    if (!GraalRuntime::parse_argument(_options, line)) {
-      warn("There was an error parsing an argument. Skipping it.");
-    }
-  }
-};
-
-void GraalRuntime::parse_graal_options_file(OptionsValueTable* options) {
-  const char* home = Arguments::get_java_home();
-  size_t path_len = strlen(home) + strlen("/lib/graal.options") + 1;
-  char path[JVM_MAXPATHLEN];
-  char sep = os::file_separator()[0];
-  jio_snprintf(path, JVM_MAXPATHLEN, "%s%clib%cgraal.options", home, sep, sep);
-  GraalOptionParseClosure closure(options);
-  parse_lines(path, &closure, false);
-}
-
-#define CHECK_WARN_ABORT_(message) THREAD); \
-  if (HAS_PENDING_EXCEPTION) { \
-    warning(message); \
-    char buf[512]; \
-    jio_snprintf(buf, 512, "Uncaught exception at %s:%d", __FILE__, __LINE__); \
-    GraalRuntime::abort_on_pending_exception(PENDING_EXCEPTION, buf); \
-    return; \
-  } \
-  (void)(0
-
-class SetOptionClosure : public ValueClosure<OptionValue> {
-  Thread* _thread;
-public:
-  SetOptionClosure(TRAPS) : _thread(THREAD) {}
-  void do_value(OptionValue* optionValue) {
-    TRAPS = _thread;
-    const char* declaringClass = optionValue->desc.declaringClass;
-    if (declaringClass == NULL) {
-      // skip PrintFlags pseudo-option
-      return;
-    }
-    const char* fieldName = optionValue->desc.name;
-    const char* fieldClass = optionValue->desc.fieldClass;
-
-    size_t fieldSigLen = 2 + strlen(fieldClass);
-    char* fieldSig = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, char, fieldSigLen + 1);
-    jio_snprintf(fieldSig, fieldSigLen + 1, "L%s;", fieldClass);
-    for (size_t i = 0; i < fieldSigLen; ++i) {
-      if (fieldSig[i] == '.') {
-        fieldSig[i] = '/';
-      }
-    }
-    fieldSig[fieldSigLen] = '\0';
-    size_t declaringClassLen = strlen(declaringClass);
-    char* declaringClassBinary = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, char, declaringClassLen + 1);
-    for (size_t i = 0; i < declaringClassLen; ++i) {
-      if (declaringClass[i] == '.') {
-        declaringClassBinary[i] = '/';
-      } else {
-        declaringClassBinary[i] = declaringClass[i];
-      }
-    }
-    declaringClassBinary[declaringClassLen] = '\0';
-
-    TempNewSymbol name = SymbolTable::new_symbol(declaringClassBinary, CHECK_WARN_ABORT_("Declaring class could not be found"));
-    Klass* klass = GraalRuntime::resolve_or_null(name, CHECK_WARN_ABORT_("Declaring class could not be resolved"));
-
-    if (klass == NULL) {
-      warning("Declaring class for option %s could not be resolved", declaringClass);
-      abort();
-      return;
-    }
-
-    // The class has been loaded so the field and signature should already be in the symbol
-    // table.  If they're not there, the field doesn't exist.
-    TempNewSymbol fieldname = SymbolTable::probe(fieldName, (int)strlen(fieldName));
-    TempNewSymbol signame = SymbolTable::probe(fieldSig, (int)fieldSigLen);
-    if (fieldname == NULL || signame == NULL) {
-      warning("Symbols for field for option %s not found (in %s)", fieldName, declaringClass);
-      abort();
-      return;
-    }
-    // Make sure class is initialized before handing id's out to fields
-    klass->initialize(CHECK_WARN_ABORT_("Error while initializing declaring class for option"));
-
-    fieldDescriptor fd;
-    if (!InstanceKlass::cast(klass)->find_field(fieldname, signame, true, &fd)) {
-      warning("Field for option %s not found (in %s)", fieldName, declaringClass);
-      abort();
-      return;
-    }
-    oop value;
-    switch(optionValue->desc.type) {
-    case _boolean: {
-      jvalue jv;
-      jv.z = optionValue->boolean_value;
-      value = java_lang_boxing_object::create(T_BOOLEAN, &jv, THREAD);
-      break;
-    }
-    case _int: {
-      jvalue jv;
-      jv.i = optionValue->int_value;
-      value = java_lang_boxing_object::create(T_INT, &jv, THREAD);
-      break;
-    }
-    case _long: {
-      jvalue jv;
-      jv.j = optionValue->long_value;
-      value = java_lang_boxing_object::create(T_LONG, &jv, THREAD);
-      break;
-    }
-    case _float: {
-      jvalue jv;
-      jv.f = optionValue->float_value;
-      value = java_lang_boxing_object::create(T_FLOAT, &jv, THREAD);
-      break;
-    }
-    case _double: {
-      jvalue jv;
-      jv.d = optionValue->double_value;
-      value = java_lang_boxing_object::create(T_DOUBLE, &jv, THREAD);
-      break;
-    }
-    case _string:
-      value = java_lang_String::create_from_str(optionValue->string_value, THREAD)();
-      break;
-    default:
-      ShouldNotReachHere();
-    }
-
-    oop optionValueOop = klass->java_mirror()->obj_field(fd.offset());
-
-    if (optionValueOop == NULL) {
-      warning("Option field was null, can not set %s", fieldName);
-      abort();
-      return;
-    }
-
-    if (!InstanceKlass::cast(optionValueOop->klass())->find_field(vmSymbols::value_name(), vmSymbols::object_signature(), false, &fd)) {
-      warning("'Object value' field not found in option class %s, can not set option %s", fieldClass, fieldName);
-      abort();
-      return;
-    }
-
-    optionValueOop->obj_field_put(fd.offset(), value);
-  }
-};
-
-void GraalRuntime::set_options(OptionsValueTable* options, TRAPS) {
-  ensure_graal_class_loader_is_initialized();
-  {
-    ResourceMark rm;
-    SetOptionClosure closure(THREAD);
-    options->for_each(&closure);
-    if (closure.is_aborted()) {
-      vm_abort(false);
-    }
-  }
-  OptionValue* printFlags = options->get(PRINT_FLAGS_ARG);
-  if (printFlags != NULL && printFlags->boolean_value) {
-    print_flags_helper(CHECK_ABORT);
-  }
-}
-
-void GraalRuntime::print_flags_helper(TRAPS) {
-  // TODO(gd) write this in C++?
-  HandleMark hm(THREAD);
-  TempNewSymbol name = SymbolTable::new_symbol("com/oracle/graal/hotspot/HotSpotOptions", CHECK_ABORT);
-  KlassHandle hotSpotOptionsClass = load_required_class(name);
-  TempNewSymbol setOption = SymbolTable::new_symbol("printFlags", CHECK);
-  JavaValue result(T_VOID);
-  JavaCallArguments args;
-  JavaCalls::call_static(&result, hotSpotOptionsClass, setOption, vmSymbols::void_method_signature(), &args, CHECK);
-}
-
-Handle GraalRuntime::create_Service(const char* name, TRAPS) {
-  TempNewSymbol kname = SymbolTable::new_symbol(name, CHECK_NH);
-  Klass* k = resolve_or_fail(kname, CHECK_NH);
-  instanceKlassHandle klass(THREAD, k);
-  klass->initialize(CHECK_NH);
-  klass->check_valid_for_instantiation(true, CHECK_NH);
-  JavaValue result(T_VOID);
-  instanceHandle service = klass->allocate_instance_handle(CHECK_NH);
-  JavaCalls::call_special(&result, service, klass, vmSymbols::object_initializer_name(), vmSymbols::void_method_signature(), THREAD);
-  return service;
-}
-
-void GraalRuntime::shutdown() {
-  if (_HotSpotGraalRuntime_instance != NULL) {
-    _shutdown_called = true;
-    JavaThread* THREAD = JavaThread::current();
-    HandleMark hm(THREAD);
-    TempNewSymbol name = SymbolTable::new_symbol("com/oracle/graal/hotspot/HotSpotGraalRuntime", CHECK_ABORT);
-    KlassHandle klass = load_required_class(name);
-    JavaValue result(T_VOID);
-    JavaCallArguments args;
-    args.push_oop(get_HotSpotGraalRuntime());
-    JavaCalls::call_special(&result, klass, vmSymbols::shutdown_method_name(), vmSymbols::void_method_signature(), &args, CHECK_ABORT);
-
-    JNIHandles::destroy_global(_HotSpotGraalRuntime_instance);
-    _HotSpotGraalRuntime_instance = NULL;
-  }
-}
-
-void GraalRuntime::call_printStackTrace(Handle exception, Thread* thread) {
-  assert(exception->is_a(SystemDictionary::Throwable_klass()), "Throwable instance expected");
-  JavaValue result(T_VOID);
-  JavaCalls::call_virtual(&result,
-                          exception,
-                          KlassHandle(thread,
-                          SystemDictionary::Throwable_klass()),
-                          vmSymbols::printStackTrace_name(),
-                          vmSymbols::void_method_signature(),
-                          thread);
-}
-
-void GraalRuntime::abort_on_pending_exception(Handle exception, const char* message, bool dump_core) {
-  Thread* THREAD = Thread::current();
-  CLEAR_PENDING_EXCEPTION;
-  tty->print_raw_cr(message);
-  call_printStackTrace(exception, THREAD);
-
-  // Give other aborting threads to also print their stack traces.
-  // This can be very useful when debugging class initialization
-  // failures.
-  os::sleep(THREAD, 200, false);
-
-  vm_abort(dump_core);
-}
-
-Klass* GraalRuntime::resolve_or_null(Symbol* name, TRAPS) {
-  return SystemDictionary::resolve_or_null(name, SystemDictionary::graal_loader(), Handle(), CHECK_NULL);
-}
-
-Klass* GraalRuntime::resolve_or_fail(Symbol* name, TRAPS) {
-  return SystemDictionary::resolve_or_fail(name, SystemDictionary::graal_loader(), Handle(), true, CHECK_NULL);
-}
-
-Klass* GraalRuntime::load_required_class(Symbol* name) {
-  Klass* klass = resolve_or_null(name, Thread::current());
-  if (klass == NULL) {
-    tty->print_cr("Could not load class %s", name->as_C_string());
-    vm_abort(false);
-  }
-  return klass;
-}
-
-void GraalRuntime::parse_lines(char* path, ParseClosure* closure, bool warnStatFailure) {
-  struct stat st;
-  if (os::stat(path, &st) == 0 && (st.st_mode & S_IFREG) == S_IFREG) { // exists & is regular file
-    int file_handle = os::open(path, 0, 0);
-    if (file_handle != -1) {
-      char* buffer = NEW_C_HEAP_ARRAY(char, st.st_size + 1, mtInternal);
-      int num_read = (int) os::read(file_handle, (char*) buffer, st.st_size);
-      if (num_read == -1) {
-        warning("Error reading file %s due to %s", path, strerror(errno));
-      } else if (num_read != st.st_size) {
-        warning("Only read %d of " SIZE_FORMAT " bytes from %s", num_read, (size_t) st.st_size, path);
-      }
-      os::close(file_handle);
-      closure->set_filename(path);
-      if (num_read == st.st_size) {
-        buffer[num_read] = '\0';
-
-        char* line = buffer;
-        while (line - buffer < num_read && !closure->is_aborted()) {
-          // find line end (\r, \n or \r\n)
-          char* nextline = NULL;
-          char* cr = strchr(line, '\r');
-          char* lf = strchr(line, '\n');
-          if (cr != NULL && lf != NULL) {
-            char* min = MIN2(cr, lf);
-            *min = '\0';
-            if (lf == cr + 1) {
-              nextline = lf + 1;
-            } else {
-              nextline = min + 1;
-            }
-          } else if (cr != NULL) {
-            *cr = '\0';
-            nextline = cr + 1;
-          } else if (lf != NULL) {
-            *lf = '\0';
-            nextline = lf + 1;
-          }
-          // trim left
-          while (*line == ' ' || *line == '\t') line++;
-          char* end = line + strlen(line);
-          // trim right
-          while (end > line && (*(end -1) == ' ' || *(end -1) == '\t')) end--;
-          *end = '\0';
-          // skip comments and empty lines
-          if (*line != '#' && strlen(line) > 0) {
-            closure->parse_line(line);
-          }
-          if (nextline != NULL) {
-            line = nextline;
-          } else {
-            // File without newline at the end
-            break;
-          }
-        }
-      }
-      FREE_C_HEAP_ARRAY(char, buffer, mtInternal);
-    } else {
-      warning("Error opening file %s due to %s", path, strerror(errno));
-    }
-  } else if (warnStatFailure) {
-    warning("Could not stat file %s due to %s", path, strerror(errno));
-  }
-}
-
-class ServiceParseClosure : public ParseClosure {
-  GrowableArray<char*> _implNames;
-public:
-  ServiceParseClosure() : _implNames() {}
-  void do_line(char* line) {
-    size_t lineLen = strlen(line);
-    char* implName = NEW_C_HEAP_ARRAY(char, lineLen + 1, mtCompiler); // TODO (gd) i'm leaking
-    // Turn all '.'s into '/'s
-    for (size_t index = 0; index < lineLen; ++index) {
-      if (line[index] == '.') {
-        implName[index] = '/';
-      } else {
-        implName[index] = line[index];
-      }
-    }
-    implName[lineLen] = '\0';
-    _implNames.append(implName);
-  }
-  GrowableArray<char*>* implNames() {return &_implNames;}
-};
-
-
-Handle GraalRuntime::get_service_impls(KlassHandle serviceKlass, TRAPS) {
-  const char* home = Arguments::get_java_home();
-  const char* serviceName = serviceKlass->external_name();
-  size_t path_len = strlen(home) + strlen("/lib/graal/services/") + strlen(serviceName) + 1;
-  char* path = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, char, path_len);
-  char sep = os::file_separator()[0];
-  sprintf(path, "%s%clib%cgraal%cservices%c%s", home, sep, sep, sep, sep, serviceName);
-  ServiceParseClosure closure;
-  parse_lines(path, &closure, true); // TODO(gd) cache parsing results?
-
-  GrowableArray<char*>* implNames = closure.implNames();
-  objArrayOop servicesOop = oopFactory::new_objArray(serviceKlass(), implNames->length(), CHECK_NH);
-  objArrayHandle services(THREAD, servicesOop);
-  for (int i = 0; i < implNames->length(); ++i) {
-    char* implName = implNames->at(i);
-    Handle service = create_Service(implName, CHECK_NH);
-    services->obj_at_put(i, service());
-  }
-  return services;
-}
--- a/src/share/vm/graal/graalRuntime.hpp	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,240 +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.
- */
-
-#ifndef SHARE_VM_GRAAL_GRAAL_RUNTIME_HPP
-#define SHARE_VM_GRAAL_GRAAL_RUNTIME_HPP
-
-#include "interpreter/interpreter.hpp"
-#include "memory/allocation.hpp"
-#include "runtime/deoptimization.hpp"
-#include "graal/graalOptions.hpp"
-
-class ParseClosure : public StackObj {
-  int _lineNo;
-  char* _filename;
-  bool _abort;
-protected:
-  void abort() { _abort = true; }
-  void warn_and_abort(const char* message) {
-    warn(message);
-    abort();
-  }
-  void warn(const char* message) {
-    warning("Error at line %d while parsing %s: %s", _lineNo, _filename == NULL ? "?" : _filename, message);
-  }
- public:
-  ParseClosure() : _lineNo(0), _filename(NULL), _abort(false) {}
-  void parse_line(char* line) {
-    _lineNo++;
-    do_line(line);
-  }
-  virtual void do_line(char* line) = 0;
-  int lineNo() { return _lineNo; }
-  bool is_aborted() { return _abort; }
-  void set_filename(char* path) {_filename = path; _lineNo = 0;}
-};
-
-class GraalRuntime: public CHeapObj<mtCompiler> {
- private:
-  static jobject _HotSpotGraalRuntime_instance;
-  static bool _HotSpotGraalRuntime_initialized;
-
-  static bool _shutdown_called;
-
-  /**
-   * Loads default option value overrides from a <jre_home>/lib/graal.options if it exists. Each
-   * line in this file must have the format of a Graal command line option without the
-   * leading "-G:" prefix. These option values are set prior to processing of any Graal
-   * options present on the command line.
-   */
-  static void parse_graal_options_file(OptionsValueTable* options);
-
-  static void print_flags_helper(TRAPS);
-  /**
-   * Instantiates a service object, calls its default constructor and returns it.
-   *
-   * @param name the name of a class implementing com.oracle.graal.api.runtime.Service
-   */
-  static Handle create_Service(const char* name, TRAPS);
-
- public:
-
-  /**
-   * Parses the Graal specific VM options that were presented by the launcher and sets
-   * the relevants Java fields.
-   */
-  static OptionsValueTable* parse_arguments();
-
-  static bool parse_argument(OptionsValueTable* options, const char* arg);
-
-  static void set_options(OptionsValueTable* options, TRAPS);
-
-  /**
-   * Ensures that the Graal class loader is initialized and the well known Graal classes are loaded.
-   */
-  static void ensure_graal_class_loader_is_initialized();
-
-  static void initialize_natives(JNIEnv *env, jclass c2vmClass);
-
-  static bool is_HotSpotGraalRuntime_initialized() { return _HotSpotGraalRuntime_initialized; }
-
-  /**
-   * Gets the singleton HotSpotGraalRuntime instance, initializing it if necessary
-   */
-  static Handle get_HotSpotGraalRuntime() {
-    initialize_Graal();
-    return Handle(JNIHandles::resolve_non_null(_HotSpotGraalRuntime_instance));
-  }
-
-  static jobject get_HotSpotGraalRuntime_jobject() {
-    initialize_Graal();
-    assert(_HotSpotGraalRuntime_initialized, "must be");
-    return _HotSpotGraalRuntime_instance;
-  }
-
-  static Handle callInitializer(const char* className, const char* methodName, const char* returnType);
-
-  /**
-   * Trigger initialization of HotSpotGraalRuntime through Graal.runtime()
-   */
-  static void initialize_Graal();
-
-  /**
-   * Explicitly initialize HotSpotGraalRuntime itself
-   */
-  static void initialize_HotSpotGraalRuntime();
-
-  static void shutdown();
-
-  static bool shutdown_called() {
-    return _shutdown_called;
-  }
-
-  /**
-   * Given an interface representing a Graal service (i.e. sub-interface of
-   * com.oracle.graal.api.runtime.Service), gets an array of objects, one per
-   * known implementation of the service.
-   */
-  static Handle get_service_impls(KlassHandle serviceKlass, TRAPS);
-
-  static void parse_lines(char* path, ParseClosure* closure, bool warnStatFailure);
-
-  /**
-   * Aborts the VM due to an unexpected exception.
-   */
-  static void abort_on_pending_exception(Handle exception, const char* message, bool dump_core = false);
-
-  /**
-   * Calls Throwable.printStackTrace() on a given exception.
-   */
-  static void call_printStackTrace(Handle exception, Thread* thread);
-
-#define CHECK_ABORT THREAD); \
-  if (HAS_PENDING_EXCEPTION) { \
-    char buf[256]; \
-    jio_snprintf(buf, 256, "Uncaught exception at %s:%d", __FILE__, __LINE__); \
-    GraalRuntime::abort_on_pending_exception(PENDING_EXCEPTION, buf); \
-    return; \
-  } \
-  (void)(0
-
-#define CHECK_ABORT_(result) THREAD); \
-  if (HAS_PENDING_EXCEPTION) { \
-    char buf[256]; \
-    jio_snprintf(buf, 256, "Uncaught exception at %s:%d", __FILE__, __LINE__); \
-    GraalRuntime::abort_on_pending_exception(PENDING_EXCEPTION, buf); \
-    return result; \
-  } \
-  (void)(0
-
-  /**
-   * Same as SystemDictionary::resolve_or_null but uses the Graal loader.
-   */
-  static Klass* resolve_or_null(Symbol* name, TRAPS);
-
-  /**
-   * Same as SystemDictionary::resolve_or_fail but uses the Graal loader.
-   */
-  static Klass* resolve_or_fail(Symbol* name, TRAPS);
-
-  /**
-   * Loads a given Graal class and aborts the VM if it fails.
-   */
-  static Klass* load_required_class(Symbol* name);
-
-  static BufferBlob* initialize_buffer_blob();
-
-  static BasicType kindToBasicType(jchar ch);
-
-  // The following routines are all called from compiled Graal code
-
-  static void new_instance(JavaThread* thread, Klass* klass);
-  static void new_array(JavaThread* thread, Klass* klass, jint length);
-  static void new_multi_array(JavaThread* thread, Klass* klass, int rank, jint* dims);
-  static void dynamic_new_array(JavaThread* thread, oopDesc* element_mirror, jint length);
-  static void dynamic_new_instance(JavaThread* thread, oopDesc* type_mirror);
-  static jboolean thread_is_interrupted(JavaThread* thread, oopDesc* obj, jboolean clear_interrupted);
-  static void vm_message(jboolean vmError, jlong format, jlong v1, jlong v2, jlong v3);
-  static jint identity_hash_code(JavaThread* thread, oopDesc* obj);
-  static address exception_handler_for_pc(JavaThread* thread);
-  static void monitorenter(JavaThread* thread, oopDesc* obj, BasicLock* lock);
-  static void monitorexit (JavaThread* thread, oopDesc* obj, BasicLock* lock);
-  static void create_null_exception(JavaThread* thread);
-  static void create_out_of_bounds_exception(JavaThread* thread, jint index);
-  static void vm_error(JavaThread* thread, jlong where, jlong format, jlong value);
-  static oopDesc* load_and_clear_exception(JavaThread* thread);
-  static void log_printf(JavaThread* thread, oopDesc* format, jlong v1, jlong v2, jlong v3);
-  static void log_primitive(JavaThread* thread, jchar typeChar, jlong value, jboolean newline);
-  // Note: Must be kept in sync with constants in com.oracle.graal.replacements.Log
-  enum {
-    LOG_OBJECT_NEWLINE = 0x01,
-    LOG_OBJECT_STRING  = 0x02,
-    LOG_OBJECT_ADDRESS = 0x04
-  };
-  static void log_object(JavaThread* thread, oopDesc* msg, jint flags);
-  static void write_barrier_pre(JavaThread* thread, oopDesc* obj);
-  static void write_barrier_post(JavaThread* thread, void* card);
-  static jboolean validate_object(JavaThread* thread, oopDesc* parent, oopDesc* child);
-  static void new_store_pre_barrier(JavaThread* thread);
-
-  // Test only function
-  static int test_deoptimize_call_int(JavaThread* thread, int value);
-};
-
-// Tracing macros
-
-#define IF_TRACE_graal_1 if (!(TraceGraal >= 1)) ; else
-#define IF_TRACE_graal_2 if (!(TraceGraal >= 2)) ; else
-#define IF_TRACE_graal_3 if (!(TraceGraal >= 3)) ; else
-#define IF_TRACE_graal_4 if (!(TraceGraal >= 4)) ; else
-#define IF_TRACE_graal_5 if (!(TraceGraal >= 5)) ; else
-
-// using commas and else to keep one-instruction semantics
-
-#define TRACE_graal_1 if (!(TraceGraal >= 1 && (tty->print("TraceGraal-1: "), true))) ; else tty->print_cr
-#define TRACE_graal_2 if (!(TraceGraal >= 2 && (tty->print("   TraceGraal-2: "), true))) ; else tty->print_cr
-#define TRACE_graal_3 if (!(TraceGraal >= 3 && (tty->print("      TraceGraal-3: "), true))) ; else tty->print_cr
-#define TRACE_graal_4 if (!(TraceGraal >= 4 && (tty->print("         TraceGraal-4: "), true))) ; else tty->print_cr
-#define TRACE_graal_5 if (!(TraceGraal >= 5 && (tty->print("            TraceGraal-5: "), true))) ; else tty->print_cr
-
-#endif // SHARE_VM_GRAAL_GRAAL_RUNTIME_HPP
--- a/src/share/vm/graal/vmStructs_graal.hpp	Thu May 28 15:10:18 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,85 +0,0 @@
-/*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#ifndef SHARE_VM_GRAAL_VMSTRUCTS_GRAAL_HPP
-#define SHARE_VM_GRAAL_VMSTRUCTS_GRAAL_HPP
-
-#include "compiler/abstractCompiler.hpp"
-#include "graal/graalCodeInstaller.hpp"
-#include "graal/graalCompilerToVM.hpp"
-#include "graal/graalEnv.hpp"
-
-#define VM_STRUCTS_GRAAL(nonstatic_field, static_field)                       \
-  nonstatic_field(ThreadShadow,  _pending_deoptimization, int)                \
-  nonstatic_field(ThreadShadow,  _pending_failed_speculation, oop)            \
-  nonstatic_field(ThreadShadow,  _pending_transfer_to_interpreter, bool)      \
-  nonstatic_field(MethodData,    _graal_node_count, int)                      \
-  nonstatic_field(GraalEnv,      _task, CompileTask*)                         \
-  nonstatic_field(GraalEnv,      _jvmti_can_hotswap_or_post_breakpoint, bool) \
-
-#define VM_TYPES_GRAAL(declare_type, declare_toplevel_type)                   \
-  declare_toplevel_type(GraalEnv)                                             \
-
-#define VM_INT_CONSTANTS_GRAAL(declare_constant, declare_preprocessor_constant)                   \
-  declare_constant(Deoptimization::Reason_unreached0)                                             \
-  declare_constant(Deoptimization::Reason_type_checked_inlining)                                  \
-  declare_constant(Deoptimization::Reason_optimized_type_check)                                   \
-  declare_constant(Deoptimization::Reason_aliasing)                                               \
-  declare_constant(Deoptimization::Reason_transfer_to_interpreter)                                \
-  declare_constant(Deoptimization::Reason_not_compiled_exception_handler)                         \
-  declare_constant(Deoptimization::Reason_unresolved)                                             \
-  declare_constant(Deoptimization::Reason_jsr_mismatch)                                           \
-  declare_constant(GraalEnv::ok)                                                                  \
-  declare_constant(GraalEnv::dependencies_failed)                                                 \
-  declare_constant(GraalEnv::dependencies_invalid)                                                \
-  declare_constant(GraalEnv::cache_full)                                                          \
-  declare_constant(GraalEnv::code_too_large)                                                      \
-                                                                                                  \
-  declare_preprocessor_constant("JVM_ACC_SYNTHETIC", JVM_ACC_SYNTHETIC)                           \
-  declare_preprocessor_constant("JVM_RECOGNIZED_FIELD_MODIFIERS", JVM_RECOGNIZED_FIELD_MODIFIERS) \
-                                                                                                  \
-  declare_constant(CompilerToVM::KLASS_TAG)                                                       \
-  declare_constant(CompilerToVM::SYMBOL_TAG)                                                      \
-                                                                                                  \
-  declare_constant(CodeInstaller::VERIFIED_ENTRY)                                                 \
-  declare_constant(CodeInstaller::UNVERIFIED_ENTRY)                                               \
-  declare_constant(CodeInstaller::OSR_ENTRY)                                                      \
-  declare_constant(CodeInstaller::EXCEPTION_HANDLER_ENTRY)                                        \
-  declare_constant(CodeInstaller::DEOPT_HANDLER_ENTRY)                                            \
-  declare_constant(CodeInstaller::INVOKEINTERFACE)                                                \
-  declare_constant(CodeInstaller::INVOKEVIRTUAL)                                                  \
-  declare_constant(CodeInstaller::INVOKESTATIC)                                                   \
-  declare_constant(CodeInstaller::INVOKESPECIAL)                                                  \
-  declare_constant(CodeInstaller::INLINE_INVOKE)                                                  \
-  declare_constant(CodeInstaller::POLL_NEAR)                                                      \
-  declare_constant(CodeInstaller::POLL_RETURN_NEAR)                                               \
-  declare_constant(CodeInstaller::POLL_FAR)                                                       \
-  declare_constant(CodeInstaller::POLL_RETURN_FAR)                                                \
-  declare_constant(CodeInstaller::CARD_TABLE_SHIFT)                                               \
-  declare_constant(CodeInstaller::CARD_TABLE_ADDRESS)                                             \
-  declare_constant(CodeInstaller::INVOKE_INVALID)                                                 \
-                                                                                                  \
-  declare_constant(Method::invalid_vtable_index)                                                  \
-
-#endif // SHARE_VM_GRAAL_VMSTRUCTS_GRAAL_HPP
--- a/src/share/vm/interpreter/interpreter.cpp	Thu May 28 15:10:18 2015 -0700
+++ b/src/share/vm/interpreter/interpreter.cpp	Thu May 28 21:11:28 2015 -0700
@@ -409,7 +409,7 @@
 address AbstractInterpreter::deopt_reexecute_entry(Method* method, address bcp) {
   assert(method->contains(bcp), "just checkin'");
   Bytecodes::Code code   = Bytecodes::java_code_at(method, bcp);
-#if defined(COMPILER1) || defined(GRAAL)
+#if defined(COMPILER1) || defined(JVMCI)
   if(code == Bytecodes::_athrow ) {
     return Interpreter::rethrow_exception_entry();
   }
--- a/src/share/vm/interpreter/interpreterRuntime.cpp	Thu May 28 15:10:18 2015 -0700
+++ b/src/share/vm/interpreter/interpreterRuntime.cpp	Thu May 28 21:11:28 2015 -0700
@@ -475,7 +475,7 @@
     }
   } while (should_repeat == true);
 
-#ifdef GRAAL
+#ifdef JVMCI
   if (h_method->method_data() != NULL) {
     ResourceMark rm(thread);
     ProfileData* pdata = h_method->method_data()->allocate_bci_to_data(current_bci, NULL);
--- a/src/share/vm/interpreter/linkResolver.hpp	Thu May 28 15:10:18 2015 -0700
+++ b/src/share/vm/interpreter/linkResolver.hpp	Thu May 28 21:11:28 2015 -0700
@@ -125,11 +125,11 @@
 
  private:
   static void lookup_method_in_klasses          (methodHandle& result, KlassHandle klass, Symbol* name, Symbol* signature, bool checkpolymorphism, bool in_imethod_resolve, TRAPS);
-#ifdef GRAAL
+#ifdef JVMCI
  public:
 #endif
   static void lookup_instance_method_in_klasses (methodHandle& result, KlassHandle klass, Symbol* name, Symbol* signature, TRAPS);
-#ifdef GRAAL
+#ifdef JVMCI
  private:
 #endif
   static void lookup_method_in_interfaces       (methodHandle& result, KlassHandle klass, Symbol* name, Symbol* signature, TRAPS);
@@ -145,12 +145,12 @@
 
   static void linktime_resolve_static_method    (methodHandle& resolved_method, KlassHandle resolved_klass, Symbol* method_name, Symbol* method_signature, KlassHandle current_klass, bool check_access, TRAPS);
   static void linktime_resolve_special_method   (methodHandle& resolved_method, KlassHandle resolved_klass, Symbol* method_name, Symbol* method_signature, KlassHandle current_klass, bool check_access, TRAPS);
-#ifdef GRAAL
+#ifdef JVMCI
  public:
 #endif
   static void linktime_resolve_virtual_method   (methodHandle &resolved_method, KlassHandle resolved_klass, Symbol* method_name, Symbol* method_signature,KlassHandle current_klass, bool check_access, TRAPS);
   static void linktime_resolve_interface_method (methodHandle& resolved_method, KlassHandle resolved_klass, Symbol* method_name, Symbol* method_signature, KlassHandle current_klass, bool check_access, TRAPS);
-#ifdef GRAAL
+#ifdef JVMCI
  private:
 #endif
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/vm/jvmci/jvmciCodeInstaller.cpp	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,988 @@
+/*
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+#include "precompiled.hpp"
+#include "code/compiledIC.hpp"
+#include "compiler/compileBroker.hpp"
+#include "compiler/disassembler.hpp"
+#include "runtime/javaCalls.hpp"
+#include "jvmci/jvmciEnv.hpp"
+#include "jvmci/jvmciCompiler.hpp"
+#include "jvmci/jvmciCodeInstaller.hpp"
+#include "jvmci/jvmciJavaAccess.hpp"
+#include "jvmci/jvmciCompilerToVM.hpp"
+#include "jvmci/jvmciRuntime.hpp"
+#include "asm/register.hpp"
+#include "classfile/vmSymbols.hpp"
+#include "code/vmreg.hpp"
+
+#ifdef TARGET_ARCH_x86
+# include "vmreg_x86.inline.hpp"
+#endif
+#ifdef TARGET_ARCH_sparc
+# include "vmreg_sparc.inline.hpp"
+#endif
+#ifdef TARGET_ARCH_zero
+# include "vmreg_zero.inline.hpp"
+#endif
+#ifdef TARGET_ARCH_arm
+# include "vmreg_arm.inline.hpp"
+#endif
+#ifdef TARGET_ARCH_ppc
+# include "vmreg_ppc.inline.hpp"
+#endif
+
+
+// frequently used constants
+// Allocate them with new so they are never destroyed (otherwise, a
+// forced exit could destroy these objects while they are still in
+// use).
+ConstantOopWriteValue* CodeInstaller::_oop_null_scope_value = new (ResourceObj::C_HEAP, mtCompiler) ConstantOopWriteValue(NULL);
+ConstantIntValue*      CodeInstaller::_int_m1_scope_value = new (ResourceObj::C_HEAP, mtCompiler) ConstantIntValue(-1);
+ConstantIntValue*      CodeInstaller::_int_0_scope_value =  new (ResourceObj::C_HEAP, mtCompiler) ConstantIntValue(0);
+ConstantIntValue*      CodeInstaller::_int_1_scope_value =  new (ResourceObj::C_HEAP, mtCompiler) ConstantIntValue(1);
+ConstantIntValue*      CodeInstaller::_int_2_scope_value =  new (ResourceObj::C_HEAP, mtCompiler) ConstantIntValue(2);
+LocationValue*         CodeInstaller::_illegal_value = new (ResourceObj::C_HEAP, mtCompiler) LocationValue(Location());
+
+Method* getMethodFromHotSpotMethod(oop hotspot_method) {
+  assert(hotspot_method != NULL && hotspot_method->is_a(HotSpotResolvedJavaMethodImpl::klass()), "sanity");
+  return asMethod(HotSpotResolvedJavaMethodImpl::metaspaceMethod(hotspot_method));
+}
+
+const int MapWordBits = 64;
+
+static int entry_value(typeArrayOop words, int i) {
+  jint words_idx = i / MapWordBits;
+  assert(words_idx >= 0 && words_idx < words->length(), "unexpected index");
+  jlong word = words->long_at(words_idx);
+  return (word >> (i % MapWordBits)) & 15LL;
+}
+
+static int fixedmap_size(oop bitset) {
+  typeArrayOop arr = HotSpotOopMap::words(bitset);
+  return arr->length() * MapWordBits;
+}
+
+static void set_vmreg_oops(OopMap* map, VMReg reg, typeArrayOop words, int idx) {
+  int value = entry_value(words, 4 * idx);
+  switch (value) {
+    case 10:
+      map->set_oop(reg);
+      break;
+    case 5:
+      map->set_narrowoop(reg);
+      map->set_narrowoop(reg->next());
+      break;
+    case 1:
+      map->set_narrowoop(reg);
+      break;
+    case 4:
+      map->set_narrowoop(reg->next());
+      break;
+    case 0:
+      break;
+    default:
+      assert(false, err_msg("unexpected bit pattern at %d = 0x%x", idx, value));
+      ShouldNotReachHere();
+  }
+}
+
+// creates a HotSpot oop map out of the byte arrays provided by DebugInfo
+static OopMap* create_oop_map(jint total_frame_size, jint parameter_count, oop debug_info) {
+  OopMap* map = new OopMap(total_frame_size, parameter_count);
+  oop reference_map = DebugInfo::referenceMap(debug_info);
+  oop register_map = HotSpotReferenceMap::registerRefMap(reference_map);
+  oop frame_map = HotSpotReferenceMap::frameRefMap(reference_map);
+  oop callee_save_info = (oop) DebugInfo::calleeSaveInfo(debug_info);
+
+  if (register_map != NULL) {
+    typeArrayOop words = HotSpotOopMap::words(register_map);
+    int mapIdx = 0;
+    for (jint i = 0; i < RegisterImpl::number_of_registers; i++) {
+      set_vmreg_oops(map, as_Register(i)->as_VMReg(), words, mapIdx);
+      mapIdx++;
+    }
+#ifdef TARGET_ARCH_x86
+    for (jint i = 0; i < XMMRegisterImpl::number_of_registers; i++) {
+      VMReg reg = as_XMMRegister(i)->as_VMReg();
+      for (jint j = 0; j < 4; j++) {
+        set_vmreg_oops(map, reg->next(2 * j), words, mapIdx++);
+      }
+    }
+#endif
+#ifdef TARGET_ARCH_sparc
+    for (jint i = 0; i < FloatRegisterImpl::number_of_registers; i++) {
+      VMReg reg = as_FloatRegister(i)->as_VMReg();
+      set_vmreg_oops(map, reg, words, mapIdx++);
+    }
+#endif
+  }
+
+  typeArrayOop words = HotSpotOopMap::words(frame_map);
+  int size = fixedmap_size(frame_map) / 4;
+  for (jint i = 0; i < size; i++) {
+    // HotSpot stack slots are 4 bytes
+    VMReg reg = VMRegImpl::stack2reg(i * VMRegImpl::slots_per_word);
+    set_vmreg_oops(map, reg, words, i);
+  }
+
+  if (callee_save_info != NULL) {
+    objArrayOop registers = RegisterSaveLayout::registers(callee_save_info);
+    typeArrayOop slots = RegisterSaveLayout::slots(callee_save_info);
+    for (jint i = 0; i < slots->length(); i++) {
+      oop jvmci_reg = registers->obj_at(i);
+      jint jvmci_reg_number = code_Register::number(jvmci_reg);
+      VMReg hotspot_reg = CodeInstaller::get_hotspot_reg(jvmci_reg_number);
+      // HotSpot stack slots are 4 bytes
+      jint jvmci_slot = slots->int_at(i);
+      jint hotspot_slot = jvmci_slot * VMRegImpl::slots_per_word;
+      VMReg hotspot_slot_as_reg = VMRegImpl::stack2reg(hotspot_slot);
+      map->set_callee_saved(hotspot_slot_as_reg, hotspot_reg);
+#ifdef _LP64
+      // (copied from generate_oop_map() in c1_Runtime1_x86.cpp)
+      VMReg hotspot_slot_hi_as_reg = VMRegImpl::stack2reg(hotspot_slot + 1);
+      map->set_callee_saved(hotspot_slot_hi_as_reg, hotspot_reg->next());
+#endif
+    }
+  }
+  return map;
+}
+
+static void record_metadata_reference(oop obj, jlong prim, jboolean compressed, OopRecorder* oop_recorder) {
+  if (obj->is_a(HotSpotResolvedObjectTypeImpl::klass())) {
+    Klass* klass = java_lang_Class::as_Klass(HotSpotResolvedObjectTypeImpl::javaClass(obj));
+    if (compressed) {
+      assert(Klass::decode_klass((narrowKlass) prim) == klass, err_msg("%s @ " INTPTR_FORMAT " != " PTR64_FORMAT, klass->name()->as_C_string(), p2i(klass), prim));
+    } else {
+      assert((Klass*) prim == klass, err_msg("%s @ " INTPTR_FORMAT " != " PTR64_FORMAT, klass->name()->as_C_string(), p2i(klass), prim));
+    }
+    int index = oop_recorder->find_index(klass);
+    TRACE_jvmci_3("metadata[%d of %d] = %s", index, oop_recorder->metadata_count(), klass->name()->as_C_string());
+  } else if (obj->is_a(HotSpotResolvedJavaMethodImpl::klass())) {
+    Method* method = (Method*) (address) HotSpotResolvedJavaMethodImpl::metaspaceMethod(obj);
+    assert(!compressed, err_msg("unexpected compressed method pointer %s @ " INTPTR_FORMAT " = " PTR64_FORMAT, method->name()->as_C_string(), p2i(method), prim));
+    int index = oop_recorder->find_index(method);
+    TRACE_jvmci_3("metadata[%d of %d] = %s", index, oop_recorder->metadata_count(), method->name()->as_C_string());
+  } else {
+    assert(java_lang_String::is_instance(obj),
+        err_msg("unexpected metadata reference (%s) for constant " JLONG_FORMAT " (" PTR64_FORMAT ")", obj->klass()->name()->as_C_string(), prim, prim));
+  }
+}
+
+// Records any Metadata values embedded in a Constant (e.g., the value returned by HotSpotResolvedObjectTypeImpl.klass()).
+static void record_metadata_in_constant(oop constant, OopRecorder* oop_recorder) {
+  if (constant->is_a(HotSpotMetaspaceConstantImpl::klass())) {
+    oop obj = HotSpotMetaspaceConstantImpl::metaspaceObject(constant);
+    jlong prim = HotSpotMetaspaceConstantImpl::primitive(constant);
+    assert(Kind::typeChar(AbstractValue::kind(constant)) == 'j', "must have word kind");
+    assert(obj != NULL, "must have an object");
+    assert(prim != 0, "must have a primitive value");
+
+    record_metadata_reference(obj, prim, false, oop_recorder);
+  }
+}
+
+static void record_metadata_in_patch(Handle& constant, OopRecorder* oop_recorder) {
+  record_metadata_reference(HotSpotMetaspaceConstantImpl::metaspaceObject(constant), HotSpotMetaspaceConstantImpl::primitive(constant), HotSpotMetaspaceConstantImpl::compressed(constant), oop_recorder);
+}
+
+ScopeValue* CodeInstaller::get_scope_value(oop value, GrowableArray<ScopeValue*>* objects, ScopeValue* &second) {
+  second = NULL;
+  if (value == AbstractValue::ILLEGAL()) {
+    return _illegal_value;
+  }
+
+  oop lirKind = AbstractValue::lirKind(value);
+  oop platformKind = LIRKind::platformKind(lirKind);
+  jint referenceMask = LIRKind::referenceMask(lirKind);
+  assert(referenceMask != -1, "derived pointers are not allowed");
+  assert(referenceMask == 0 || referenceMask == 1, "unexpected referenceMask");
+  bool reference = referenceMask == 1;
+
+  BasicType type = JVMCIRuntime::kindToBasicType(Kind::typeChar(platformKind));
+
+  if (value->is_a(RegisterValue::klass())) {
+    oop reg = RegisterValue::reg(value);
+    jint number = code_Register::number(reg);
+    VMReg hotspotRegister = get_hotspot_reg(number);
+    if (is_general_purpose_reg(hotspotRegister)) {
+      Location::Type locationType;
+      if (type == T_INT) {
+        locationType = reference ? Location::narrowoop : Location::int_in_long;
+      } else if(type == T_SHORT || type == T_CHAR || type == T_BYTE || type == T_BOOLEAN) {
+        locationType = Location::int_in_long;
+      } else if (type == T_FLOAT) {
+        locationType = Location::int_in_long;
+      } else if (type == T_LONG) {
+        locationType = reference ? Location::oop : Location::lng;
+      } else {
+        assert(type == T_OBJECT && reference, "unexpected type in cpu register");
+        locationType = Location::oop;
+      }
+      ScopeValue* value = new LocationValue(Location::new_reg_loc(locationType, hotspotRegister));
+      if (type == T_LONG && !reference) {
+        second = value;
+      }
+      return value;
+    } else {
+      assert(type == T_FLOAT || type == T_DOUBLE, "only float and double expected in xmm register");
+      Location::Type locationType;
+      if (type == T_FLOAT) {
+        // this seems weird, but the same value is used in c1_LinearScan
+        locationType = Location::normal;
+      } else {
+        locationType = Location::dbl;
+      }
+      assert(!reference, "unexpected type in floating point register");
+      ScopeValue* value = new LocationValue(Location::new_reg_loc(locationType, hotspotRegister));
+      if (type == T_DOUBLE) {
+        second = value;
+      }
+      return value;
+    }
+  } else if (value->is_a(StackSlot::klass())) {
+      Location::Type locationType;
+    if (type == T_LONG) {
+      locationType = reference ? Location::oop : Location::lng;
+    } else if (type == T_INT) {
+      locationType = reference ? Location::narrowoop : Location::normal;
+    } else if(type == T_SHORT || type == T_CHAR || type == T_BYTE || type == T_BOOLEAN) {
+      locationType = Location::normal;
+    } else if (type == T_FLOAT) {
+      assert(!reference, "unexpected type in stack slot");
+      locationType = Location::normal;
+    } else if (type == T_DOUBLE) {
+      assert(!reference, "unexpected type in stack slot");
+      locationType = Location::dbl;
+    } else {
+      assert(type == T_OBJECT && reference, "unexpected type in stack slot");
+      locationType = Location::oop;
+    }
+    jint offset = StackSlot::offset(value);
+#ifdef TARGET_ARCH_sparc
+    if(offset >= 0) {
+      offset += 128;
+    }
+#endif
+    if (StackSlot::addFrameSize(value)) {
+      offset += _total_frame_size;
+    }
+    ScopeValue* value = new LocationValue(Location::new_stk_loc(locationType, offset));
+    if (type == T_DOUBLE || (type == T_LONG && !reference)) {
+      second = value;
+    }
+    return value;
+  } else if (value->is_a(JavaConstant::klass())){
+    record_metadata_in_constant(value, _oop_recorder);
+    if (value->is_a(PrimitiveConstant::klass())) {
+      assert(!reference, "unexpected primitive constant type");
+      if(value->is_a(RawConstant::klass())) {
+        jlong prim = PrimitiveConstant::primitive(value);
+        return new ConstantLongValue(prim);
+      } else if (type == T_INT || type == T_FLOAT) {
+        jint prim = (jint)PrimitiveConstant::primitive(value);
+        switch (prim) {
+          case -1: return _int_m1_scope_value;
+          case  0: return _int_0_scope_value;
+          case  1: return _int_1_scope_value;
+          case  2: return _int_2_scope_value;
+          default: return new ConstantIntValue(prim);
+        }
+      } else {
+        assert(type == T_LONG || type == T_DOUBLE, "unexpected primitive constant type");
+        jlong prim = PrimitiveConstant::primitive(value);
+        second = _int_1_scope_value;
+        return new ConstantLongValue(prim);
+      }
+    } else {
+        assert(reference, "unexpected object constant type");
+      if (value->is_a(NullConstant::klass()) || value->is_a(HotSpotCompressedNullConstant::klass())) {
+        return _oop_null_scope_value;
+      } else {
+        assert(value->is_a(HotSpotObjectConstantImpl::klass()), "unexpected constant type");
+        oop obj = HotSpotObjectConstantImpl::object(value);
+        assert(obj != NULL, "null value must be in NullConstant");
+        return new ConstantOopWriteValue(JNIHandles::make_local(obj));
+      }
+    }
+  } else if (value->is_a(VirtualObject::klass())) {
+    int id = VirtualObject::id(value);
+    ScopeValue* object = objects->at(id);
+    assert(object != NULL, "missing value");
+    return object;
+  } else {
+    value->klass()->print();
+    value->print();
+  }
+  ShouldNotReachHere();
+  return NULL;
+}
+
+void CodeInstaller::record_object_value(ObjectValue* sv, oop value, GrowableArray<ScopeValue*>* objects) {
+  oop type = VirtualObject::type(value);
+  int id = VirtualObject::id(value);
+  oop javaMirror = HotSpotResolvedObjectTypeImpl::javaClass(type);
+  Klass* klass = java_lang_Class::as_Klass(javaMirror);
+  bool isLongArray = klass == Universe::longArrayKlassObj();
+
+  objArrayOop values = VirtualObject::values(value);
+  for (jint i = 0; i < values->length(); i++) {
+    ScopeValue* cur_second = NULL;
+    oop object = values->obj_at(i);
+    ScopeValue* value = get_scope_value(object, objects, cur_second);
+
+    if (isLongArray && cur_second == NULL) {
+      // we're trying to put ints into a long array... this isn't really valid, but it's used for some optimizations.
+      // add an int 0 constant
+      cur_second = _int_0_scope_value;
+    }
+
+    if (cur_second != NULL) {
+      sv->field_values()->append(cur_second);
+    }
+    assert(value != NULL, "missing value");
+    sv->field_values()->append(value);
+  }
+}
+
+MonitorValue* CodeInstaller::get_monitor_value(oop value, GrowableArray<ScopeValue*>* objects) {
+  guarantee(value->is_a(StackLockValue::klass()), "Monitors must be of type MonitorValue");
+
+  ScopeValue* second = NULL;
+  ScopeValue* owner_value = get_scope_value(StackLockValue::owner(value), objects, second);
+  assert(second == NULL, "monitor cannot occupy two stack slots");
+
+  ScopeValue* lock_data_value = get_scope_value(StackLockValue::slot(value), objects, second);
+  assert(second == lock_data_value, "monitor is LONG value that occupies two stack slots");
+  assert(lock_data_value->is_location(), "invalid monitor location");
+  Location lock_data_loc = ((LocationValue*)lock_data_value)->location();
+
+  bool eliminated = false;
+  if (StackLockValue::eliminated(value)) {
+    eliminated = true;
+  }
+
+  return new MonitorValue(owner_value, lock_data_loc, eliminated);
+}
+
+void CodeInstaller::initialize_dependencies(oop compiled_code) {
+  JavaThread* thread = JavaThread::current();
+  CompilerThread* compilerThread = thread->is_Compiler_thread() ? thread->as_CompilerThread() : NULL;
+  _oop_recorder = new OopRecorder(&_arena, true);
+  _dependencies = new Dependencies(&_arena, _oop_recorder, compilerThread != NULL ? compilerThread->log() : NULL);
+  objArrayHandle assumptions = HotSpotCompiledCode::assumptions(compiled_code);
+  if (!assumptions.is_null()) {
+    int length = assumptions->length();
+    for (int i = 0; i < length; ++i) {
+      Handle assumption = assumptions->obj_at(i);
+      if (!assumption.is_null()) {
+        if (assumption->klass() == Assumptions_NoFinalizableSubclass::klass()) {
+          assumption_NoFinalizableSubclass(assumption);
+        } else if (assumption->klass() == Assumptions_ConcreteSubtype::klass()) {
+          assumption_ConcreteSubtype(assumption);
+        } else if (assumption->klass() == Assumptions_LeafType::klass()) {
+          assumption_LeafType(assumption);
+        } else if (assumption->klass() == Assumptions_ConcreteMethod::klass()) {
+          assumption_ConcreteMethod(assumption);
+        } else if (assumption->klass() == Assumptions_CallSiteTargetValue::klass()) {
+          assumption_CallSiteTargetValue(assumption);
+        } else {
+          assumption->print();
+          fatal("unexpected Assumption subclass");
+        }
+      }
+    }
+  }
+  objArrayHandle methods = HotSpotCompiledCode::methods(compiled_code);
+  if (!methods.is_null()) {
+    int length = methods->length();
+    for (int i = 0; i < length; ++i) {
+      Handle method_handle = methods->obj_at(i);
+      methodHandle method = getMethodFromHotSpotMethod(method_handle());
+      _dependencies->assert_evol_method(method());
+    }
+  }
+}
+
+// constructor used to create a method
+JVMCIEnv::CodeInstallResult CodeInstaller::install(Handle& compiled_code, CodeBlob*& cb, Handle installed_code, Handle speculation_log) {
+  BufferBlob* buffer_blob = JVMCIRuntime::initialize_buffer_blob();
+  if (buffer_blob == NULL) {
+    return JVMCIEnv::cache_full;
+  }
+
+  CodeBuffer buffer(buffer_blob);
+  jobject compiled_code_obj = JNIHandles::make_local(compiled_code());
+  initialize_dependencies(JNIHandles::resolve(compiled_code_obj));
+
+  // Get instructions and constants CodeSections early because we need it.
+  _instructions = buffer.insts();
+  _constants = buffer.consts();
+
+  {
+    initialize_fields(JNIHandles::resolve(compiled_code_obj));
+    if (!initialize_buffer(buffer)) {
+      return JVMCIEnv::code_too_large;
+    }
+    process_exception_handlers();
+  }
+
+  int stack_slots = _total_frame_size / HeapWordSize; // conversion to words
+
+  JVMCIEnv::CodeInstallResult result;
+  if (!compiled_code->is_a(HotSpotCompiledNmethod::klass())) {
+    oop stubName = HotSpotCompiledCode::name(compiled_code_obj);
+    char* name = strdup(java_lang_String::as_utf8_string(stubName));
+    cb = RuntimeStub::new_runtime_stub(name,
+                                       &buffer,
+                                       CodeOffsets::frame_never_safe,
+                                       stack_slots,
+                                       _debug_recorder->_oopmaps,
+                                       false);
+    result = JVMCIEnv::ok;
+  } else {
+    nmethod* nm = NULL;
+    methodHandle method = getMethodFromHotSpotMethod(HotSpotCompiledNmethod::method(compiled_code));
+    jint entry_bci = HotSpotCompiledNmethod::entryBCI(compiled_code);
+    jint id = HotSpotCompiledNmethod::id(compiled_code);
+    JVMCIEnv* env = (JVMCIEnv*) (address) HotSpotCompiledNmethod::jvmciEnv(compiled_code);
+    if (id == -1) {
+      // Make sure a valid compile_id is associated with every compile
+      id = CompileBroker::assign_compile_id_unlocked(Thread::current(), method, entry_bci);
+    }
+    result = JVMCIEnv::register_method(method, nm, entry_bci, &_offsets, _custom_stack_area_offset, &buffer, stack_slots, _debug_recorder->_oopmaps, &_exception_handler_table,
+        JVMCICompiler::instance(), _debug_recorder, _dependencies, env, id, false, installed_code, compiled_code, speculation_log);
+    cb = nm;
+  }
+
+  if (cb != NULL) {
+    // Make sure the pre-calculated constants section size was correct.
+    guarantee((cb->code_begin() - cb->content_begin()) >= _constants_size, err_msg("%d < %d", (int)(cb->code_begin() - cb->content_begin()), _constants_size));
+  }
+  return result;
+}
+
+void CodeInstaller::initialize_fields(oop compiled_code) {
+  if (compiled_code->is_a(HotSpotCompiledNmethod::klass())) {
+    Handle hotspotJavaMethod = HotSpotCompiledNmethod::method(compiled_code);
+    methodHandle method = getMethodFromHotSpotMethod(hotspotJavaMethod());
+    _parameter_count = method->size_of_parameters();
+    TRACE_jvmci_1("installing code for %s", method->name_and_sig_as_C_string());
+  } else {
+    // Must be a HotSpotCompiledRuntimeStub
+    // TODO (ds) not sure if this is correct - only used in OopMap constructor for non-product builds
+    _parameter_count = 0;
+  }
+  _sites_handle = JNIHandles::make_local(HotSpotCompiledCode::sites(compiled_code));
+  _exception_handlers_handle = JNIHandles::make_local(HotSpotCompiledCode::exceptionHandlers(compiled_code));
+
+  _code_handle = JNIHandles::make_local(HotSpotCompiledCode::targetCode(compiled_code));
+  _code_size = HotSpotCompiledCode::targetCodeSize(compiled_code);
+  _total_frame_size = HotSpotCompiledCode::totalFrameSize(compiled_code);
+  _custom_stack_area_offset = HotSpotCompiledCode::customStackAreaOffset(compiled_code);
+
+  // Pre-calculate the constants section size.  This is required for PC-relative addressing.
+  _data_section_handle = JNIHandles::make_local(HotSpotCompiledCode::dataSection(compiled_code));
+  guarantee(HotSpotCompiledCode::dataSectionAlignment(compiled_code) <= _constants->alignment(), "Alignment inside constants section is restricted by alignment of section begin");
+  _constants_size = data_section()->length();
+
+  _data_section_patches_handle = JNIHandles::make_local(HotSpotCompiledCode::dataSectionPatches(compiled_code));
+
+#ifndef PRODUCT
+  _comments_handle = JNIHandles::make_local(HotSpotCompiledCode::comments(compiled_code));
+#endif
+
+  _next_call_type = INVOKE_INVALID;
+}
+
+int CodeInstaller::estimate_stub_entries() {
+  // Estimate the number of static call stubs that might be emitted.
+  int static_call_stubs = 0;
+  objArrayOop sites = this->sites();
+  for (int i = 0; i < sites->length(); i++) {
+    oop site = sites->obj_at(i);
+    if (site->is_a(CompilationResult_Mark::klass())) {
+      oop id_obj = CompilationResult_Mark::id(site);
+      if (id_obj != NULL) {
+        assert(java_lang_boxing_object::is_instance(id_obj, T_INT), "Integer id expected");
+        jint id = id_obj->int_field(java_lang_boxing_object::value_offset_in_bytes(T_INT));
+        if (id == INVOKESTATIC || id == INVOKESPECIAL) {
+          static_call_stubs++;
+        }
+      }
+    }
+  }
+  return static_call_stubs;
+}
+
+// perform data and call relocation on the CodeBuffer
+bool CodeInstaller::initialize_buffer(CodeBuffer& buffer) {
+  HandleMark hm;
+  objArrayHandle sites = this->sites();
+  int locs_buffer_size = sites->length() * (relocInfo::length_limit + sizeof(relocInfo));
+  char* locs_buffer = NEW_RESOURCE_ARRAY(char, locs_buffer_size);
+  buffer.insts()->initialize_shared_locs((relocInfo*)locs_buffer, locs_buffer_size / sizeof(relocInfo));
+  // Allocate enough space in the stub section for the static call
+  // stubs.  Stubs have extra relocs but they are managed by the stub
+  // section itself so they don't need to be accounted for in the
+  // locs_buffer above.
+  buffer.initialize_stubs_size(estimate_stub_entries() * CompiledStaticCall::to_interp_stub_size());
+  buffer.initialize_consts_size(_constants_size);
+
+  _debug_recorder = new DebugInformationRecorder(_oop_recorder);
+  _debug_recorder->set_oopmaps(new OopMapSet());
+
+  buffer.initialize_oop_recorder(_oop_recorder);
+
+  // copy the constant data into the newly created CodeBuffer
+  address end_data = _constants->start() + _constants_size;
+  memcpy(_constants->start(), data_section()->base(T_BYTE), _constants_size);
+  _constants->set_end(end_data);
+
+  // copy the code into the newly created CodeBuffer
+  address end_pc = _instructions->start() + _code_size;
+  if (!_instructions->allocates2(end_pc)) {
+    return false;
+  }
+  memcpy(_instructions->start(), code()->base(T_BYTE), _code_size);
+  _instructions->set_end(end_pc);
+
+  for (int i = 0; i < data_section_patches()->length(); i++) {
+    Handle patch = data_section_patches()->obj_at(i);
+    Handle reference = CompilationResult_DataPatch::reference(patch);
+    assert(reference->is_a(CompilationResult_ConstantReference::klass()), err_msg("patch in data section must be a ConstantReference"));
+    Handle constant = CompilationResult_ConstantReference::constant(reference);
+    if (constant->is_a(HotSpotMetaspaceConstantImpl::klass())) {
+      record_metadata_in_patch(constant, _oop_recorder);
+    } else if (constant->is_a(HotSpotObjectConstantImpl::klass())) {
+      Handle obj = HotSpotObjectConstantImpl::object(constant);
+      jobject value = JNIHandles::make_local(obj());
+      int oop_index = _oop_recorder->find_index(value);
+
+      address dest = _constants->start() + CompilationResult_Site::pcOffset(patch);
+      if (HotSpotObjectConstantImpl::compressed(constant)) {
+#ifdef _LP64
+        _constants->relocate(dest, oop_Relocation::spec(oop_index), relocInfo::narrow_oop_in_const);
+#else
+        fatal("unexpected compressed oop in 32-bit mode");
+#endif
+      } else {
+        _constants->relocate(dest, oop_Relocation::spec(oop_index));
+      }
+    } else {
+      ShouldNotReachHere();
+    }
+  }
+  jint last_pc_offset = -1;
+  for (int i = 0; i < sites->length(); i++) {
+    {
+        No_Safepoint_Verifier no_safepoint;
+        oop site = sites->obj_at(i);
+        jint pc_offset = CompilationResult_Site::pcOffset(site);
+
+        if (site->is_a(CompilationResult_Call::klass())) {
+          TRACE_jvmci_4("call at %i", pc_offset);
+          site_Call(buffer, pc_offset, site);
+        } else if (site->is_a(CompilationResult_Infopoint::klass())) {
+          // three reasons for infopoints denote actual safepoints
+          oop reason = CompilationResult_Infopoint::reason(site);
+          if (InfopointReason::SAFEPOINT() == reason || InfopointReason::CALL() == reason || InfopointReason::IMPLICIT_EXCEPTION() == reason) {
+            TRACE_jvmci_4("safepoint at %i", pc_offset);
+            site_Safepoint(buffer, pc_offset, site);
+          } else {
+            // if the infopoint is not an actual safepoint, it must have one of the other reasons
+            // (safeguard against new safepoint types that require handling above)
+            assert(InfopointReason::METHOD_START() == reason || InfopointReason::METHOD_END() == reason || InfopointReason::LINE_NUMBER() == reason, "");
+            site_Infopoint(buffer, pc_offset, site);
+          }
+        } else if (site->is_a(CompilationResult_DataPatch::klass())) {
+          TRACE_jvmci_4("datapatch at %i", pc_offset);
+          site_DataPatch(buffer, pc_offset, site);
+        } else if (site->is_a(CompilationResult_Mark::klass())) {
+          TRACE_jvmci_4("mark at %i", pc_offset);
+          site_Mark(buffer, pc_offset, site);
+        } else {
+          fatal("unexpected Site subclass");
+        }
+        last_pc_offset = pc_offset;
+    }
+    if (CodeInstallSafepointChecks && SafepointSynchronize::do_call_back()) {
+      // this is a hacky way to force a safepoint check but nothing else was jumping out at me.
+      ThreadToNativeFromVM ttnfv(JavaThread::current());
+    }
+  }
+
+#ifndef PRODUCT
+  if (comments() != NULL) {
+    No_Safepoint_Verifier no_safepoint;
+    for (int i = 0; i < comments()->length(); i++) {
+      oop comment = comments()->obj_at(i);
+      assert(comment->is_a(HotSpotCompiledCode_Comment::klass()), "cce");
+      jint offset = HotSpotCompiledCode_Comment::pcOffset(comment);
+      char* text = java_lang_String::as_utf8_string(HotSpotCompiledCode_Comment::text(comment));
+      buffer.block_comment(offset, text);
+    }
+  }
+#endif
+  return true;
+}
+
+void CodeInstaller::assumption_NoFinalizableSubclass(Handle assumption) {
+  Handle receiverType_handle = Assumptions_NoFinalizableSubclass::receiverType(assumption());
+  Klass* receiverType = java_lang_Class::as_Klass(HotSpotResolvedObjectTypeImpl::javaClass(receiverType_handle));
+  _dependencies->assert_has_no_finalizable_subclasses(receiverType);
+}
+
+void CodeInstaller::assumption_ConcreteSubtype(Handle assumption) {
+  Handle context_handle = Assumptions_ConcreteSubtype::context(assumption());
+  Handle subtype_handle = Assumptions_ConcreteSubtype::subtype(assumption());
+  Klass* context = java_lang_Class::as_Klass(HotSpotResolvedObjectTypeImpl::javaClass(context_handle));
+  Klass* subtype = java_lang_Class::as_Klass(HotSpotResolvedObjectTypeImpl::javaClass(subtype_handle));
+
+  assert(context->is_abstract(), "");
+  _dependencies->assert_abstract_with_unique_concrete_subtype(context, subtype);
+}
+
+void CodeInstaller::assumption_LeafType(Handle assumption) {
+  Handle context_handle = Assumptions_LeafType::context(assumption());
+  Klass* context = java_lang_Class::as_Klass(HotSpotResolvedObjectTypeImpl::javaClass(context_handle));
+
+  _dependencies->assert_leaf_type(context);
+}
+
+void CodeInstaller::assumption_ConcreteMethod(Handle assumption) {
+  Handle impl_handle = Assumptions_ConcreteMethod::impl(assumption());
+  Handle context_handle = Assumptions_ConcreteMethod::context(assumption());
+
+  methodHandle impl = getMethodFromHotSpotMethod(impl_handle());
+  Klass* context = java_lang_Class::as_Klass(HotSpotResolvedObjectTypeImpl::javaClass(context_handle));
+
+  _dependencies->assert_unique_concrete_method(context, impl());
+}
+
+void CodeInstaller::assumption_CallSiteTargetValue(Handle assumption) {
+  Handle callSite = Assumptions_CallSiteTargetValue::callSite(assumption());
+  Handle methodHandle = Assumptions_CallSiteTargetValue::methodHandle(assumption());
+
+  _dependencies->assert_call_site_target_value(callSite(), methodHandle());
+}
+
+void CodeInstaller::process_exception_handlers() {
+  if (exception_handlers() != NULL) {
+    objArrayOop handlers = exception_handlers();
+    for (int i = 0; i < handlers->length(); i++) {
+      oop exc = handlers->obj_at(i);
+      jint pc_offset = CompilationResult_Site::pcOffset(exc);
+      jint handler_offset = CompilationResult_ExceptionHandler::handlerPos(exc);
+
+      // Subtable header
+      _exception_handler_table.add_entry(HandlerTableEntry(1, pc_offset, 0));
+
+      // Subtable entry
+      _exception_handler_table.add_entry(HandlerTableEntry(-1, handler_offset, 0));
+    }
+  }
+}
+
+// If deoptimization happens, the interpreter should reexecute these bytecodes.
+// This function mainly helps the compilers to set up the reexecute bit.
+static bool bytecode_should_reexecute(Bytecodes::Code code) {
+  switch (code) {
+    case Bytecodes::_invokedynamic:
+    case Bytecodes::_invokevirtual:
+    case Bytecodes::_invokeinterface:
+    case Bytecodes::_invokespecial:
+    case Bytecodes::_invokestatic:
+      return false;
+    default:
+      return true;
+    }
+  return true;
+}
+
+GrowableArray<ScopeValue*>* CodeInstaller::record_virtual_objects(oop debug_info) {
+  objArrayOop virtualObjects = DebugInfo::virtualObjectMapping(debug_info);
+  if (virtualObjects == NULL) {
+    return NULL;
+  }
+  GrowableArray<ScopeValue*>* objects = new GrowableArray<ScopeValue*>(virtualObjects->length(), virtualObjects->length(), NULL);
+  // Create the unique ObjectValues
+  for (int i = 0; i < virtualObjects->length(); i++) {
+    oop value = virtualObjects->obj_at(i);
+    int id = VirtualObject::id(value);
+    oop type = VirtualObject::type(value);
+    oop javaMirror = HotSpotResolvedObjectTypeImpl::javaClass(type);
+    ObjectValue* sv = new ObjectValue(id, new ConstantOopWriteValue(JNIHandles::make_local(Thread::current(), javaMirror)));
+    assert(objects->at(id) == NULL, "once");
+    objects->at_put(id, sv);
+  }
+  // All the values which could be referenced by the VirtualObjects
+  // exist, so now describe all the VirtualObjects themselves.
+  for (int i = 0; i < virtualObjects->length(); i++) {
+    oop value = virtualObjects->obj_at(i);
+    int id = VirtualObject::id(value);
+    record_object_value(objects->at(id)->as_ObjectValue(), value, objects);
+  }
+  _debug_recorder->dump_object_pool(objects);
+  return objects;
+}
+
+void CodeInstaller::record_scope(jint pc_offset, oop debug_info) {
+  oop position = DebugInfo::bytecodePosition(debug_info);
+  if (position == NULL) {
+    // Stubs do not record scope info, just oop maps
+    return;
+  }
+  
+  GrowableArray<ScopeValue*>* objectMapping = record_virtual_objects(debug_info);
+  record_scope(pc_offset, position, objectMapping);
+}
+
+void CodeInstaller::record_scope(jint pc_offset, oop position, GrowableArray<ScopeValue*>* objects) {
+  oop frame = NULL;
+  if (position->is_a(BytecodeFrame::klass())) {
+    frame = position;
+  }
+  oop caller_frame = BytecodePosition::caller(position);
+  if (caller_frame != NULL) {
+    record_scope(pc_offset, caller_frame, objects);
+  }
+
+  oop hotspot_method = BytecodePosition::method(position);
+  Method* method = getMethodFromHotSpotMethod(hotspot_method);
+  jint bci = BytecodePosition::bci(position);
+  if (bci == BytecodeFrame::BEFORE_BCI()) {
+    bci = SynchronizationEntryBCI;
+  }
+
+  if (TraceJVMCI >= 2) {
+    tty->print_cr("Recording scope pc_offset=%d bci=%d method=%s", pc_offset, bci, method->name_and_sig_as_C_string());
+  }
+
+  bool reexecute = false;
+  if (frame != NULL) {
+    if (bci == SynchronizationEntryBCI){
+       reexecute = false;
+    } else {
+      Bytecodes::Code code = Bytecodes::java_code_at(method, method->bcp_from(bci));
+      reexecute = bytecode_should_reexecute(code);
+      if (frame != NULL) {
+        reexecute = (BytecodeFrame::duringCall(frame) == JNI_FALSE);
+      }
+    }
+  }
+
+  DebugToken* locals_token = NULL;
+  DebugToken* expressions_token = NULL;
+  DebugToken* monitors_token = NULL;
+  bool throw_exception = false;
+
+  if (frame != NULL) {
+    jint local_count = BytecodeFrame::numLocals(frame);
+    jint expression_count = BytecodeFrame::numStack(frame);
+    jint monitor_count = BytecodeFrame::numLocks(frame);
+    objArrayOop values = BytecodeFrame::values(frame);
+
+    assert(local_count + expression_count + monitor_count == values->length(), "unexpected values length");
+
+    GrowableArray<ScopeValue*>* locals = local_count > 0 ? new GrowableArray<ScopeValue*> (local_count) : NULL;
+    GrowableArray<ScopeValue*>* expressions = expression_count > 0 ? new GrowableArray<ScopeValue*> (expression_count) : NULL;
+    GrowableArray<MonitorValue*>* monitors = monitor_count > 0 ? new GrowableArray<MonitorValue*> (monitor_count) : NULL;
+
+    if (TraceJVMCI >= 2) {
+      tty->print_cr("Scope at bci %d with %d values", bci, values->length());
+      tty->print_cr("%d locals %d expressions, %d monitors", local_count, expression_count, monitor_count);
+    }
+
+    for (jint i = 0; i < values->length(); i++) {
+      ScopeValue* second = NULL;
+      oop value = values->obj_at(i);
+      if (i < local_count) {
+        ScopeValue* first = get_scope_value(value, objects, second);
+        if (second != NULL) {
+          locals->append(second);
+        }
+        locals->append(first);
+      } else if (i < local_count + expression_count) {
+        ScopeValue* first = get_scope_value(value, objects, second);
+        if (second != NULL) {
+          expressions->append(second);
+        }
+        expressions->append(first);
+      } else {
+        monitors->append(get_monitor_value(value, objects));
+      }
+      if (second != NULL) {
+        i++;
+        assert(i < values->length(), "double-slot value not followed by Value.ILLEGAL");
+        assert(values->obj_at(i) == AbstractValue::ILLEGAL(), "double-slot value not followed by Value.ILLEGAL");
+      }
+    }
+
+    locals_token = _debug_recorder->create_scope_values(locals);
+    expressions_token = _debug_recorder->create_scope_values(expressions);
+    monitors_token = _debug_recorder->create_monitor_values(monitors);
+
+    throw_exception = BytecodeFrame::rethrowException(frame) == JNI_TRUE;
+  }
+
+  _debug_recorder->describe_scope(pc_offset, method, NULL, bci, reexecute, throw_exception, false, false,
+                                  locals_token, expressions_token, monitors_token);
+}
+
+void CodeInstaller::site_Safepoint(CodeBuffer& buffer, jint pc_offset, oop site) {
+  oop debug_info = CompilationResult_Infopoint::debugInfo(site);
+  assert(debug_info != NULL, "debug info expected");
+
+  // address instruction = _instructions->start() + pc_offset;
+  // jint next_pc_offset = Assembler::locate_next_instruction(instruction) - _instructions->start();
+  _debug_recorder->add_safepoint(pc_offset, create_oop_map(_total_frame_size, _parameter_count, debug_info));
+  record_scope(pc_offset, debug_info);
+  _debug_recorder->end_safepoint(pc_offset);
+}
+
+void CodeInstaller::site_Infopoint(CodeBuffer& buffer, jint pc_offset, oop site) {
+  oop debug_info = CompilationResult_Infopoint::debugInfo(site);
+  assert(debug_info != NULL, "debug info expected");
+
+  _debug_recorder->add_non_safepoint(pc_offset);
+  record_scope(pc_offset, debug_info);
+  _debug_recorder->end_non_safepoint(pc_offset);
+}
+
+void CodeInstaller::site_Call(CodeBuffer& buffer, jint pc_offset, oop site) {
+  oop target = CompilationResult_Call::target(site);
+  InstanceKlass* target_klass = InstanceKlass::cast(target->klass());
+
+  oop hotspot_method = NULL; // JavaMethod
+  oop foreign_call = NULL;
+
+  if (target_klass->is_subclass_of(SystemDictionary::HotSpotForeignCallTarget_klass())) {
+    foreign_call = target;
+  } else {
+    hotspot_method = target;
+  }
+
+  oop debug_info = CompilationResult_Call::debugInfo(site);
+
+  assert(!!hotspot_method ^ !!foreign_call, "Call site needs exactly one type");
+
+  NativeInstruction* inst = nativeInstruction_at(_instructions->start() + pc_offset);
+  jint next_pc_offset = CodeInstaller::pd_next_offset(inst, pc_offset, hotspot_method);
+
+  if (debug_info != NULL) {
+    _debug_recorder->add_safepoint(next_pc_offset, create_oop_map(_total_frame_size, _parameter_count, debug_info));
+    record_scope(next_pc_offset, debug_info);
+  }
+
+  if (foreign_call != NULL) {
+    jlong foreign_call_destination = HotSpotForeignCallTarget::address(foreign_call);
+    CodeInstaller::pd_relocate_ForeignCall(inst, foreign_call_destination);
+  } else { // method != NULL
+    assert(hotspot_method != NULL, "unexpected JavaMethod");
+    assert(debug_info != NULL, "debug info expected");
+
+    TRACE_jvmci_3("method call");
+    CodeInstaller::pd_relocate_JavaMethod(hotspot_method, pc_offset);
+    if (_next_call_type == INVOKESTATIC || _next_call_type == INVOKESPECIAL) {
+      // Need a static call stub for transitions from compiled to interpreted.
+      CompiledStaticCall::emit_to_interp_stub(buffer, _instructions->start() + pc_offset);
+    }
+  }
+
+  _next_call_type = INVOKE_INVALID;
+
+  if (debug_info != NULL) {
+    _debug_recorder->end_safepoint(next_pc_offset);
+  }
+}
+
+void CodeInstaller::site_DataPatch(CodeBuffer& buffer, jint pc_offset, oop site) {
+  oop reference = CompilationResult_DataPatch::reference(site);
+  if (reference->is_a(CompilationResult_ConstantReference::klass())) {
+    Handle constant = CompilationResult_ConstantReference::constant(reference);
+    if (constant->is_a(HotSpotObjectConstantImpl::klass())) {
+      pd_patch_OopConstant(pc_offset, constant);
+    } else if (constant->is_a(HotSpotMetaspaceConstantImpl::klass())) {
+      record_metadata_in_patch(constant, _oop_recorder);
+    } else {
+      fatal("unknown constant type in data patch");
+    }
+  } else if (reference->is_a(CompilationResult_DataSectionReference::klass())) {
+    int data_offset = CompilationResult_DataSectionReference::offset(reference);
+    assert(0 <= data_offset && data_offset < _constants_size, err_msg("data offset 0x%X points outside data section (size 0x%X)", data_offset, _constants_size));
+    pd_patch_DataSectionReference(pc_offset, data_offset);
+  } else {
+    fatal("unknown data patch type");
+  }
+}
+
+void CodeInstaller::site_Mark(CodeBuffer& buffer, jint pc_offset, oop site) {
+  oop id_obj = CompilationResult_Mark::id(site);
+
+  if (id_obj != NULL) {
+    assert(java_lang_boxing_object::is_instance(id_obj, T_INT), "Integer id expected");
+    jint id = id_obj->int_field(java_lang_boxing_object::value_offset_in_bytes(T_INT));
+
+    address pc = _instructions->start() + pc_offset;
+
+    switch (id) {
+      case UNVERIFIED_ENTRY:
+        _offsets.set_value(CodeOffsets::Entry, pc_offset);
+        break;
+      case VERIFIED_ENTRY:
+        _offsets.set_value(CodeOffsets::Verified_Entry, pc_offset);
+        break;
+      case OSR_ENTRY:
+        _offsets.set_value(CodeOffsets::OSR_Entry, pc_offset);
+        break;
+      case EXCEPTION_HANDLER_ENTRY:
+        _offsets.set_value(CodeOffsets::Exceptions, pc_offset);
+        break;
+      case DEOPT_HANDLER_ENTRY:
+        _offsets.set_value(CodeOffsets::Deopt, pc_offset);
+        break;
+      case INVOKEVIRTUAL:
+      case INVOKEINTERFACE:
+      case INLINE_INVOKE:
+      case INVOKESTATIC:
+      case INVOKESPECIAL:
+        _next_call_type = (MarkId) id;
+        _invoke_mark_pc = pc;
+        break;
+      case POLL_NEAR:
+      case POLL_FAR:
+      case POLL_RETURN_NEAR:
+      case POLL_RETURN_FAR:
+        pd_relocate_poll(pc, id);
+        break;
+      case CARD_TABLE_SHIFT:
+      case CARD_TABLE_ADDRESS:
+        break;
+      default:
+        ShouldNotReachHere();
+        break;
+    }
+  }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/vm/jvmci/jvmciCodeInstaller.hpp	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,159 @@
+/*
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+#ifndef SHARE_VM_JVMCI_JVMCI_CODE_INSTALLER_HPP
+#define SHARE_VM_JVMCI_JVMCI_CODE_INSTALLER_HPP
+
+#include "jvmci/jvmciEnv.hpp"
+
+/*
+ * This class handles the conversion from a InstalledCode to a CodeBlob or an nmethod.
+ */
+class CodeInstaller : public StackObj {
+  friend class VMStructs;
+private:
+  enum MarkId {
+    VERIFIED_ENTRY             = 1,
+    UNVERIFIED_ENTRY           = 2,
+    OSR_ENTRY                  = 3,
+    EXCEPTION_HANDLER_ENTRY    = 4,
+    DEOPT_HANDLER_ENTRY        = 5,
+    INVOKEINTERFACE            = 6,
+    INVOKEVIRTUAL              = 7,
+    INVOKESTATIC               = 8,
+    INVOKESPECIAL              = 9,
+    INLINE_INVOKE              = 10,
+    POLL_NEAR                  = 11,
+    POLL_RETURN_NEAR           = 12,
+    POLL_FAR                   = 13,
+    POLL_RETURN_FAR            = 14,
+    CARD_TABLE_ADDRESS         = 15,
+    CARD_TABLE_SHIFT           = 16,
+    INVOKE_INVALID             = -1
+  };
+
+  Arena         _arena;
+
+  jobject       _data_section_handle;
+  jobject       _data_section_patches_handle;
+  jobject       _sites_handle;
+  jobject       _exception_handlers_handle;
+  CodeOffsets   _offsets;
+
+  jobject       _code_handle;
+  jint          _code_size;
+  jint          _total_frame_size;
+  jint          _custom_stack_area_offset;
+  jint          _parameter_count;
+  jint          _constants_size;
+#ifndef PRODUCT
+  jobject       _comments_handle;
+#endif
+
+  MarkId        _next_call_type;
+  address       _invoke_mark_pc;
+
+  CodeSection*  _instructions;
+  CodeSection*  _constants;
+
+  OopRecorder*              _oop_recorder;
+  DebugInformationRecorder* _debug_recorder;
+  Dependencies*             _dependencies;
+  ExceptionHandlerTable     _exception_handler_table;
+
+  static ConstantOopWriteValue* _oop_null_scope_value;
+  static ConstantIntValue*    _int_m1_scope_value;
+  static ConstantIntValue*    _int_0_scope_value;
+  static ConstantIntValue*    _int_1_scope_value;
+  static ConstantIntValue*    _int_2_scope_value;
+  static LocationValue*       _illegal_value;
+
+  jint pd_next_offset(NativeInstruction* inst, jint pc_offset, oop method);
+  void pd_patch_OopConstant(int pc_offset, Handle& constant);
+  void pd_patch_DataSectionReference(int pc_offset, int data_offset);
+  void pd_relocate_CodeBlob(CodeBlob* cb, NativeInstruction* inst);
+  void pd_relocate_ForeignCall(NativeInstruction* inst, jlong foreign_call_destination);
+  void pd_relocate_JavaMethod(oop method, jint pc_offset);
+  void pd_relocate_poll(address pc, jint mark);
+
+  objArrayOop sites() { return (objArrayOop) JNIHandles::resolve(_sites_handle); }
+  arrayOop code() { return (arrayOop) JNIHandles::resolve(_code_handle); }
+  arrayOop data_section() { return (arrayOop) JNIHandles::resolve(_data_section_handle); }
+  objArrayOop data_section_patches() { return (objArrayOop) JNIHandles::resolve(_data_section_patches_handle); }
+  objArrayOop exception_handlers() { return (objArrayOop) JNIHandles::resolve(_exception_handlers_handle); }
+#ifndef PRODUCT
+  objArrayOop comments() { return (objArrayOop) JNIHandles::resolve(_comments_handle); }
+#endif
+
+public:
+
+  CodeInstaller() : _arena(mtCompiler) {}
+  JVMCIEnv::CodeInstallResult install(Handle& compiled_code, CodeBlob*& cb, Handle installed_code, Handle speculation_log);
+
+  static address runtime_call_target_address(oop runtime_call);
+  static VMReg get_hotspot_reg(jint jvmciRegisterNumber);
+  static bool is_general_purpose_reg(VMReg hotspotRegister);
+
+private:
+  ScopeValue* get_scope_value(oop value, GrowableArray<ScopeValue*>* objects, ScopeValue* &second);
+  MonitorValue* get_monitor_value(oop value, GrowableArray<ScopeValue*>* objects);
+
+  // extract the fields of the CompilationResult
+  void initialize_fields(oop target_method);
+  void initialize_dependencies(oop target_method);
+  
+  int estimate_stub_entries();
+  
+  // perform data and call relocation on the CodeBuffer
+  bool initialize_buffer(CodeBuffer& buffer);
+
+  void assumption_NoFinalizableSubclass(Handle assumption);
+  void assumption_ConcreteSubtype(Handle assumption);
+  void assumption_LeafType(Handle assumption);
+  void assumption_ConcreteMethod(Handle assumption);
+  void assumption_CallSiteTargetValue(Handle assumption);
+
+  void site_Safepoint(CodeBuffer& buffer, jint pc_offset, oop site);
+  void site_Infopoint(CodeBuffer& buffer, jint pc_offset, oop site);
+  void site_Call(CodeBuffer& buffer, jint pc_offset, oop site);
+  void site_DataPatch(CodeBuffer& buffer, jint pc_offset, oop site);
+  void site_Mark(CodeBuffer& buffer, jint pc_offset, oop site);
+
+  void record_scope(jint pc_offset, oop debug_info);
+  void record_scope(jint pc_offset, oop code_pos, GrowableArray<ScopeValue*>* objects);
+  void record_object_value(ObjectValue* sv, oop value, GrowableArray<ScopeValue*>* objects);
+
+  GrowableArray<ScopeValue*>* record_virtual_objects(oop debug_info);
+
+  void process_exception_handlers();
+  int estimateStubSpace(int static_call_stubs);
+};
+
+/**
+ * Gets the Method metaspace object from a HotSpotResolvedJavaMethodImpl Java object.
+ */
+Method* getMethodFromHotSpotMethod(oop hotspot_method);
+
+
+
+#endif // SHARE_VM_JVMCI_JVMCI_CODE_INSTALLER_HPP
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/vm/jvmci/jvmciCompiler.cpp	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,168 @@
+/*
+ * 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.
+ */
+
+#include "precompiled.hpp"
+#include "memory/oopFactory.hpp"
+#include "runtime/javaCalls.hpp"
+#include "jvmci/jvmciCompiler.hpp"
+#include "jvmci/jvmciEnv.hpp"
+#include "jvmci/jvmciRuntime.hpp"
+#include "runtime/compilationPolicy.hpp"
+#include "runtime/globals_extension.hpp"
+
+JVMCICompiler* JVMCICompiler::_instance = NULL;
+elapsedTimer JVMCICompiler::_codeInstallTimer;
+
+JVMCICompiler::JVMCICompiler() : AbstractCompiler(jvmci) {
+#ifdef COMPILERJVMCI
+  _bootstrapping = false;
+  _methodsCompiled = 0;
+#endif
+  assert(_instance == NULL, "only one instance allowed");
+  _instance = this;
+}
+
+// Initialization
+void JVMCICompiler::initialize() {
+#ifdef COMPILERJVMCI
+  if (!UseCompiler || !should_perform_init()) {
+    return;
+  }
+
+  BufferBlob* buffer_blob = JVMCIRuntime::initialize_buffer_blob();
+  if (buffer_blob == NULL) {
+    set_state(failed);
+  } else {
+    set_state(initialized);
+  }
+  // JVMCI is considered as application code so we need to
+  // stop the VM deferring compilation now.
+  CompilationPolicy::completed_vm_startup();
+#endif // COMPILERJVMCI
+}
+
+#ifdef COMPILERJVMCI
+void JVMCICompiler::bootstrap() {
+  JavaThread* THREAD = JavaThread::current();
+  _bootstrapping = true;
+  // Allow bootstrap to perform JVMCI compilations of itself
+  bool c1only = JVMCICompileWithC1Only;
+  JVMCICompileWithC1Only = false;
+  ResourceMark rm;
+  HandleMark hm;
+  if (PrintBootstrap) {
+    tty->print("Bootstrapping JVMCI");
+  }
+  jlong start = os::javaTimeMillis();
+
+  Array<Method*>* objectMethods = InstanceKlass::cast(SystemDictionary::Object_klass())->methods();
+  // Initialize compile queue with a selected set of methods.
+  int len = objectMethods->length();
+  for (int i = 0; i < len; i++) {
+    methodHandle mh = objectMethods->at(i);
+    if (!mh->is_native() && !mh->is_static() && !mh->is_initializer()) {
+      ResourceMark rm;
+      int hot_count = 10; // TODO: what's the appropriate value?
+      CompileBroker::compile_method(mh, InvocationEntryBci, CompLevel_full_optimization, mh, hot_count, "bootstrap", THREAD);
+    }
+  }
+
+  int qsize;
+  bool first_round = true;
+  int z = 0;
+  do {
+    // Loop until there is something in the queue.
+    do {
+      os::sleep(THREAD, 100, true);
+      qsize = CompileBroker::queue_size(CompLevel_full_optimization);
+    } while (first_round && qsize == 0);
+    first_round = false;
+    if (PrintBootstrap) {
+      while (z < (_methodsCompiled / 100)) {
+        ++z;
+        tty->print_raw(".");
+      }
+    }
+  } while (qsize != 0);
+
+  if (PrintBootstrap) {
+    tty->print_cr(" in " JLONG_FORMAT " ms (compiled %d methods)", os::javaTimeMillis() - start, _methodsCompiled);
+  }
+  JVMCICompileWithC1Only = c1only;
+  _bootstrapping = false;
+}
+
+void JVMCICompiler::compile_method(methodHandle method, int entry_bci, JVMCIEnv* env) {
+  JVMCI_EXCEPTION_CONTEXT
+
+  bool is_osr = entry_bci != InvocationEntryBci;
+  if (_bootstrapping && is_osr) {
+      // no OSR compilations during bootstrap - the compiler is just too slow at this point,
+      // and we know that there are no endless loops
+      return;
+  }
+
+  JVMCIRuntime::ensure_jvmci_class_loader_is_initialized();
+  HandleMark hm;
+  ResourceMark rm;
+  JavaValue result(T_VOID);
+  JavaCallArguments args;
+  args.push_long((jlong) (address) method());
+  args.push_int(entry_bci);
+  args.push_long((jlong) (address) env);
+  args.push_int(env->task()->compile_id());
+  JavaCalls::call_static(&result, SystemDictionary::CompilationTask_klass(), vmSymbols::compileMetaspaceMethod_name(), vmSymbols::compileMetaspaceMethod_signature(), &args, CHECK_ABORT);
+
+  _methodsCompiled++;
+}
+
+
+// Compilation entry point for methods
+void JVMCICompiler::compile_method(ciEnv* env, ciMethod* target, int entry_bci) {
+  ShouldNotReachHere();
+}
+
+// Print compilation timers and statistics
+void JVMCICompiler::print_timers() {
+  print_compilation_timers();
+}
+
+#endif // COMPILERJVMCI
+
+// Print compilation timers and statistics
+void JVMCICompiler::print_compilation_timers() {
+  TRACE_jvmci_1("JVMCICompiler::print_timers");
+  tty->print_cr("       JVMCI code install time:        %6.3f s",    _codeInstallTimer.seconds());
+}
+
+void JVMCICompiler::compile_the_world() {
+  HandleMark hm;
+  JavaThread* THREAD = JavaThread::current();
+  TempNewSymbol name = SymbolTable::new_symbol("com/oracle/jvmci/hotspot/HotSpotJVMCIRuntime", CHECK_ABORT);
+  KlassHandle klass = JVMCIRuntime::load_required_class(name);
+  TempNewSymbol compileTheWorld = SymbolTable::new_symbol("compileTheWorld", CHECK_ABORT);
+  JavaValue result(T_VOID);
+  JavaCallArguments args;
+  args.push_oop(JVMCIRuntime::get_HotSpotJVMCIRuntime());
+  JavaCalls::call_special(&result, klass, compileTheWorld, vmSymbols::void_method_signature(), &args, CHECK_ABORT);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/vm/jvmci/jvmciCompiler.hpp	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,93 @@
+/*
+ * 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.
+ */
+
+#ifndef SHARE_VM_JVMCI_JVMCI_COMPILER_HPP
+#define SHARE_VM_JVMCI_JVMCI_COMPILER_HPP
+
+#include "compiler/abstractCompiler.hpp"
+#include "jvmci/jvmciEnv.hpp"
+
+class JVMCICompiler : public AbstractCompiler {
+
+private:
+
+#ifdef COMPILERJVMCI
+  bool _bootstrapping;
+
+  /**
+   * Number of methods compiled by JVMCI. This is not synchronized
+   * so may not be 100% accurate.
+   */
+  volatile int  _methodsCompiled;
+
+#endif
+
+  static JVMCICompiler* _instance;
+ 
+  static elapsedTimer _codeInstallTimer;
+
+public:
+
+  JVMCICompiler();
+
+  static JVMCICompiler* instance() { return _instance; }
+
+  virtual const char* name() { return "JVMCI"; }
+
+  virtual bool supports_native()                 { return true; }
+  virtual bool supports_osr   ()                 { return true; }
+
+  bool is_jvmci()                                { return true; }
+  bool is_c1   ()                                { return false; }
+  bool is_c2   ()                                { return false; }
+
+  bool needs_stubs            () { return false; }
+
+  // Initialization
+  virtual void initialize();
+
+#ifdef COMPILERJVMCI
+
+  void bootstrap();
+  
+  // Compilation entry point for methods
+  virtual void compile_method(ciEnv* env, ciMethod* target, int entry_bci);
+
+  void compile_method(methodHandle target, int entry_bci, JVMCIEnv* env);
+
+  // Print compilation timers and statistics
+  virtual void print_timers();
+
+  // Print compilation statistics
+  void reset_compilation_stats();
+#endif // COMPILERJVMCI
+
+  // Print compilation timers and statistics
+  static void print_compilation_timers();
+
+  static elapsedTimer* codeInstallTimer() { return &_codeInstallTimer; }
+
+  void compile_the_world();
+};
+
+#endif // SHARE_VM_JVMCI_JVMCI_COMPILER_HPP
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/vm/jvmci/jvmciCompilerToVM.cpp	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,1115 @@
+/*
+ * 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.
+ */
+
+#include "precompiled.hpp"
+#include "code/scopeDesc.hpp"
+#include "memory/oopFactory.hpp"
+#include "oops/generateOopMap.hpp"
+#include "oops/fieldStreams.hpp"
+#include "runtime/fieldDescriptor.hpp"
+#include "runtime/javaCalls.hpp"
+#include "jvmci/jvmciRuntime.hpp"
+#include "compiler/compileBroker.hpp"
+#include "compiler/compilerOracle.hpp"
+#include "compiler/disassembler.hpp"
+#include "jvmci/jvmciCompilerToVM.hpp"
+#include "jvmci/jvmciCompiler.hpp"
+#include "jvmci/jvmciEnv.hpp"
+#include "jvmci/jvmciJavaAccess.hpp"
+#include "jvmci/jvmciCodeInstaller.hpp"
+#include "gc_implementation/g1/heapRegion.hpp"
+#include "runtime/javaCalls.hpp"
+#include "runtime/deoptimization.hpp"
+#include "runtime/vframe.hpp"
+#include "runtime/vframe_hp.hpp"
+#include "runtime/vmStructs.hpp"
+
+
+// Entry to native method implementation that transitions current thread to '_thread_in_vm'.
+#define C2V_VMENTRY(result_type, name, signature) \
+  JNIEXPORT result_type JNICALL c2v_ ## name signature { \
+  TRACE_jvmci_3("CompilerToVM::" #name); \
+  JVMCI_VM_ENTRY_MARK; \
+
+#define C2V_END }
+
+extern "C" {
+extern VMStructEntry* gHotSpotVMStructs;
+extern uint64_t gHotSpotVMStructEntryTypeNameOffset;
+extern uint64_t gHotSpotVMStructEntryFieldNameOffset;
+extern uint64_t gHotSpotVMStructEntryTypeStringOffset;
+extern uint64_t gHotSpotVMStructEntryIsStaticOffset;
+extern uint64_t gHotSpotVMStructEntryOffsetOffset;
+extern uint64_t gHotSpotVMStructEntryAddressOffset;
+extern uint64_t gHotSpotVMStructEntryArrayStride;
+
+extern VMTypeEntry* gHotSpotVMTypes;
+extern uint64_t gHotSpotVMTypeEntryTypeNameOffset;
+extern uint64_t gHotSpotVMTypeEntrySuperclassNameOffset;
+extern uint64_t gHotSpotVMTypeEntryIsOopTypeOffset;
+extern uint64_t gHotSpotVMTypeEntryIsIntegerTypeOffset;
+extern uint64_t gHotSpotVMTypeEntryIsUnsignedOffset;
+extern uint64_t gHotSpotVMTypeEntrySizeOffset;
+extern uint64_t gHotSpotVMTypeEntryArrayStride;
+
+extern VMIntConstantEntry* gHotSpotVMIntConstants;
+extern uint64_t gHotSpotVMIntConstantEntryNameOffset;
+extern uint64_t gHotSpotVMIntConstantEntryValueOffset;
+extern uint64_t gHotSpotVMIntConstantEntryArrayStride;
+
+extern VMLongConstantEntry* gHotSpotVMLongConstants;
+extern uint64_t gHotSpotVMLongConstantEntryNameOffset;
+extern uint64_t gHotSpotVMLongConstantEntryValueOffset;
+extern uint64_t gHotSpotVMLongConstantEntryArrayStride;
+}
+
+C2V_VMENTRY(void, initializeConfiguration, (JNIEnv *, jobject, jobject config))
+  VMStructs::initHotSpotVMConfig(JNIHandles::resolve(config));
+C2V_END
+
+C2V_VMENTRY(jbyteArray, getBytecode, (JNIEnv *, jobject, jlong metaspace_method))
+  methodHandle method = asMethod(metaspace_method);
+  ResourceMark rm;
+
+  int code_size = method->code_size();
+  typeArrayOop reconstituted_code = oopFactory::new_byteArray(code_size, CHECK_NULL);
+
+  guarantee(method->method_holder()->is_rewritten(), "Method's holder should be rewritten");
+  // iterate over all bytecodes and replace non-Java bytecodes
+
+  for (BytecodeStream s(method); s.next() != Bytecodes::_illegal; ) {
+    Bytecodes::Code code = s.code();
+    Bytecodes::Code raw_code = s.raw_code();
+    int bci = s.bci();
+    int len = s.instruction_size();
+
+    // Restore original byte code.
+    reconstituted_code->byte_at_put(bci, (jbyte) (s.is_wide()? Bytecodes::_wide : code));
+    if (len > 1) {
+      memcpy(reconstituted_code->byte_at_addr(bci + 1), s.bcp()+1, len-1);
+    }
+
+    if (len > 1) {
+      // Restore the big-endian constant pool indexes.
+      // Cf. Rewriter::scan_method
+      switch (code) {
+        case Bytecodes::_getstatic:
+        case Bytecodes::_putstatic:
+        case Bytecodes::_getfield:
+        case Bytecodes::_putfield:
+        case Bytecodes::_invokevirtual:
+        case Bytecodes::_invokespecial:
+        case Bytecodes::_invokestatic:
+        case Bytecodes::_invokeinterface:
+        case Bytecodes::_invokehandle: {
+          int cp_index = Bytes::get_native_u2((address) reconstituted_code->byte_at_addr(bci + 1));
+          Bytes::put_Java_u2((address) reconstituted_code->byte_at_addr(bci + 1), (u2) cp_index);
+          break;
+        }
+
+        case Bytecodes::_invokedynamic:
+          int cp_index = Bytes::get_native_u4((address) reconstituted_code->byte_at_addr(bci + 1));
+          Bytes::put_Java_u4((address) reconstituted_code->byte_at_addr(bci + 1), (u4) cp_index);
+          break;
+      }
+
+      // Not all ldc byte code are rewritten.
+      switch (raw_code) {
+        case Bytecodes::_fast_aldc: {
+          int cpc_index = reconstituted_code->byte_at(bci + 1) & 0xff;
+          int cp_index = method->constants()->object_to_cp_index(cpc_index);
+          assert(cp_index < method->constants()->length(), "sanity check");
+          reconstituted_code->byte_at_put(bci + 1, (jbyte) cp_index);
+          break;
+        }
+
+        case Bytecodes::_fast_aldc_w: {
+          int cpc_index = Bytes::get_native_u2((address) reconstituted_code->byte_at_addr(bci + 1));
+          int cp_index = method->constants()->object_to_cp_index(cpc_index);
+          assert(cp_index < method->constants()->length(), "sanity check");
+          Bytes::put_Java_u2((address) reconstituted_code->byte_at_addr(bci + 1), (u2) cp_index);
+          break;
+        }
+      }
+    }
+  }
+
+  return (jbyteArray) JNIHandles::make_local(THREAD, reconstituted_code);
+C2V_END
+
+C2V_VMENTRY(jint, exceptionTableLength, (JNIEnv *, jobject, jlong metaspace_method))
+  ResourceMark rm;
+  methodHandle method = asMethod(metaspace_method);
+  return method->exception_table_length();
+C2V_END
+
+C2V_VMENTRY(jlong, exceptionTableStart, (JNIEnv *, jobject, jlong metaspace_method))
+  ResourceMark rm;
+  methodHandle method = asMethod(metaspace_method);
+  assert(method->exception_table_length() != 0, "should be handled in Java code");
+  return (jlong) (address) method->exception_table_start();
+C2V_END
+
+C2V_VMENTRY(jint, hasBalancedMonitors, (JNIEnv *, jobject, jlong metaspace_method))
+  // Analyze the method to see if monitors are used properly.
+  methodHandle method(THREAD, asMethod(metaspace_method));
+  {
+    EXCEPTION_MARK;
+    ResourceMark rm(THREAD);
+    GeneratePairingInfo gpi(method);
+    gpi.compute_map(CATCH);
+    if (!gpi.monitor_safe()) {
+      return false;
+    }
+    method->set_guaranteed_monitor_matching();
+  }
+  return true;
+C2V_END
+
+C2V_VMENTRY(jlong, getMetaspaceMethod, (JNIEnv *, jobject, jclass holder_handle, jint slot))
+  oop java_class = JNIHandles::resolve(holder_handle);
+  Klass* holder = java_lang_Class::as_Klass(java_class);
+  methodHandle method = InstanceKlass::cast(holder)->method_with_idnum(slot);
+  return (jlong) (address) method();
+}
+
+C2V_VMENTRY(jlong, findUniqueConcreteMethod, (JNIEnv *, jobject, jlong metaspace_klass, jlong metaspace_method))
+  methodHandle method = asMethod(metaspace_method);
+  KlassHandle holder = asKlass(metaspace_klass);
+  assert(!holder->is_interface(), "should be handled in Java code");
+  ResourceMark rm;
+  MutexLocker locker(Compile_lock);
+  Method* ucm = Dependencies::find_unique_concrete_method(holder(), method());
+  return (jlong) (address) ucm;
+C2V_END
+
+C2V_VMENTRY(jlong, getKlassImplementor, (JNIEnv *, jobject, jlong metaspace_klass))
+  InstanceKlass* klass = (InstanceKlass*) asKlass(metaspace_klass);
+  return (jlong) (address) klass->implementor();
+C2V_END
+
+C2V_VMENTRY(jboolean, methodIsIgnoredBySecurityStackWalk,(JNIEnv *, jobject, jlong metaspace_method))
+  methodHandle method = asMethod(metaspace_method);
+  return method->is_ignored_by_security_stack_walk();
+C2V_END
+
+C2V_VMENTRY(jboolean, canInlineMethod,(JNIEnv *, jobject, jlong metaspace_method))
+  methodHandle method = asMethod(metaspace_method);
+  return !method->is_not_compilable() && !CompilerOracle::should_not_inline(method) && !method->dont_inline();
+C2V_END
+
+C2V_VMENTRY(jboolean, shouldInlineMethod,(JNIEnv *, jobject, jlong metaspace_method))
+  methodHandle method = asMethod(metaspace_method);
+  return CompilerOracle::should_inline(method) || method->force_inline();
+C2V_END
+
+C2V_VMENTRY(jlong, lookupType, (JNIEnv*, jobject, jstring jname, jclass accessing_class, jboolean resolve))
+  ResourceMark rm;
+  Handle name = JNIHandles::resolve(jname);
+  Symbol* class_name = java_lang_String::as_symbol(name, THREAD);
+  assert(class_name != NULL, "name to symbol creation failed");
+  assert(class_name->size() > 1, "primitive types should be handled in Java code");
+
+  Klass* resolved_klass = NULL;
+  Handle class_loader;
+  Handle protection_domain;
+  if (JNIHandles::resolve(accessing_class) == NULL) {
+    THROW_(vmSymbols::java_lang_NullPointerException(), 0L);
+  }
+  Klass* accessing_klass = java_lang_Class::as_Klass(JNIHandles::resolve(accessing_class));
+  class_loader = accessing_klass->class_loader();
+  protection_domain = accessing_klass->protection_domain();
+
+  if (resolve) {
+    resolved_klass = SystemDictionary::resolve_or_null(class_name, class_loader, protection_domain, CHECK_0);
+  } else {
+    if (class_name->byte_at(0) == 'L' &&
+      class_name->byte_at(class_name->utf8_length()-1) == ';') {
+      // This is a name from a signature.  Strip off the trimmings.
+      // Call recursive to keep scope of strippedsym.
+      TempNewSymbol strippedsym = SymbolTable::new_symbol(class_name->as_utf8()+1,
+                                                          class_name->utf8_length()-2,
+                                                          CHECK_0);
+      resolved_klass = SystemDictionary::find(strippedsym, class_loader, protection_domain, CHECK_0);
+    } else if (FieldType::is_array(class_name)) {
+      FieldArrayInfo fd;
+      // dimension and object_key in FieldArrayInfo are assigned as a side-effect
+      // of this call
+      BasicType t = FieldType::get_array_info(class_name, fd, CHECK_0);
+      if (t == T_OBJECT) {
+        TempNewSymbol strippedsym = SymbolTable::new_symbol(class_name->as_utf8()+1+fd.dimension(),
+                                                            class_name->utf8_length()-2-fd.dimension(),
+                                                            CHECK_0);
+        // naked oop "k" is OK here -- we assign back into it
+        resolved_klass = SystemDictionary::find(strippedsym,
+                                                             class_loader,
+                                                             protection_domain,
+                                                             CHECK_0);
+        if (resolved_klass != NULL) {
+          resolved_klass = resolved_klass->array_klass(fd.dimension(), CHECK_0);
+        }
+      } else {
+        resolved_klass = Universe::typeArrayKlassObj(t);
+        resolved_klass = TypeArrayKlass::cast(resolved_klass)->array_klass(fd.dimension(), CHECK_0);
+      }
+    }
+  }
+  return (jlong) (address) resolved_klass;
+C2V_END
+
+C2V_VMENTRY(jobject, resolveConstantInPool, (JNIEnv*, jobject, jlong metaspace_constant_pool, jint index))
+  ConstantPool* cp = (ConstantPool*) metaspace_constant_pool;
+  oop result = cp->resolve_constant_at(index, CHECK_NULL);
+  return JNIHandles::make_local(THREAD, result);
+C2V_END
+
+C2V_VMENTRY(jobject, resolvePossiblyCachedConstantInPool, (JNIEnv*, jobject, jlong metaspace_constant_pool, jint index))
+  ConstantPool* cp = (ConstantPool*) metaspace_constant_pool;
+  oop result = cp->resolve_possibly_cached_constant_at(index, CHECK_NULL);
+  return JNIHandles::make_local(THREAD, result);
+C2V_END
+
+C2V_VMENTRY(jint, lookupNameAndTypeRefIndexInPool, (JNIEnv*, jobject, jlong metaspace_constant_pool, jint index))
+  constantPoolHandle cp = (ConstantPool*) metaspace_constant_pool;
+  return cp->name_and_type_ref_index_at(index);
+C2V_END
+
+C2V_VMENTRY(jobject, lookupNameRefInPool, (JNIEnv*, jobject, jlong metaspace_constant_pool, jint index))
+  constantPoolHandle cp = (ConstantPool*) metaspace_constant_pool;
+  Handle sym = java_lang_String::create_from_symbol(cp->name_ref_at(index), CHECK_NULL);
+  return JNIHandles::make_local(THREAD, sym());
+C2V_END
+
+C2V_VMENTRY(jobject, lookupSignatureRefInPool, (JNIEnv*, jobject, jlong metaspace_constant_pool, jint index))
+  constantPoolHandle cp = (ConstantPool*) metaspace_constant_pool;
+  Handle sym = java_lang_String::create_from_symbol(cp->signature_ref_at(index), CHECK_NULL);
+  return JNIHandles::make_local(THREAD, sym());
+C2V_END
+
+C2V_VMENTRY(jint, lookupKlassRefIndexInPool, (JNIEnv*, jobject, jlong metaspace_constant_pool, jint index))
+  constantPoolHandle cp = (ConstantPool*) metaspace_constant_pool;
+  return cp->klass_ref_index_at(index);
+C2V_END
+
+C2V_VMENTRY(jlong, constantPoolKlassAt, (JNIEnv*, jobject, jlong metaspace_constant_pool, jint index))
+  ConstantPool* cp = (ConstantPool*) metaspace_constant_pool;
+  return (jlong) (address) cp->klass_at(index, THREAD);
+C2V_END
+
+C2V_VMENTRY(jlong, lookupKlassInPool, (JNIEnv*, jobject, jlong metaspace_constant_pool, jint index, jbyte opcode))
+  constantPoolHandle cp = (ConstantPool*) metaspace_constant_pool;
+  KlassHandle loading_klass(cp->pool_holder());
+  bool is_accessible = false;
+  KlassHandle klass = JVMCIEnv::get_klass_by_index(cp, index, is_accessible, loading_klass);
+  if (klass.is_null()) {
+    // We have to lock the cpool to keep the oop from being resolved
+    // while we are accessing it.
+    MonitorLockerEx ml(cp->lock());
+    constantTag tag = cp->tag_at(index);
+    if (tag.is_klass()) {
+      // The klass has been inserted into the constant pool
+      // very recently.
+      return (jlong) CompilerToVM::tag_pointer(cp->resolved_klass_at(index));
+    } else if (tag.is_symbol()) {
+      return (jlong) CompilerToVM::tag_pointer(cp->symbol_at(index));
+    } else {
+      assert(cp->tag_at(index).is_unresolved_klass(), "wrong tag");
+      return (jlong) CompilerToVM::tag_pointer(cp->unresolved_klass_at(index));
+    }
+  }
+  return (jlong) CompilerToVM::tag_pointer(klass());
+C2V_END
+
+C2V_VMENTRY(jobject, lookupAppendixInPool, (JNIEnv*, jobject, jlong metaspace_constant_pool, jint index))
+  constantPoolHandle cp = (ConstantPool*) metaspace_constant_pool;
+  oop appendix_oop = ConstantPool::appendix_at_if_loaded(cp, index);
+  return JNIHandles::make_local(THREAD, appendix_oop);
+C2V_END
+
+C2V_VMENTRY(jlong, lookupMethodInPool, (JNIEnv*, jobject, jlong metaspace_constant_pool, jint index, jbyte opcode))
+  constantPoolHandle cp = (ConstantPool*) metaspace_constant_pool;
+  instanceKlassHandle pool_holder(cp->pool_holder());
+  Bytecodes::Code bc = (Bytecodes::Code) (((int) opcode) & 0xFF);
+  methodHandle method = JVMCIEnv::get_method_by_index(cp, index, bc, pool_holder);
+  return (jlong) (address) method();
+C2V_END
+
+C2V_VMENTRY(jint, constantPoolRemapInstructionOperandFromCache, (JNIEnv*, jobject, jlong metaspace_constant_pool, jint index))
+  ConstantPool* cp = (ConstantPool*) metaspace_constant_pool;
+  return cp->remap_instruction_operand_from_cache(index);
+C2V_END
+
+C2V_VMENTRY(jlong, resolveField, (JNIEnv*, jobject, jlong metaspace_constant_pool, jint index, jbyte opcode, jlongArray info_handle))
+  ResourceMark rm;
+  constantPoolHandle cp = (ConstantPool*) metaspace_constant_pool;
+  Bytecodes::Code code = (Bytecodes::Code)(((int) opcode) & 0xFF);
+  fieldDescriptor result;
+  LinkResolver::resolve_field_access(result, cp, index, Bytecodes::java_code(code), true, false, CHECK_0);
+  typeArrayOop info = (typeArrayOop) JNIHandles::resolve(info_handle);
+  assert(info != NULL && info->length() == 2, "must be");
+  info->long_at_put(0, (jlong) result.access_flags().as_int());
+  info->long_at_put(1, (jlong) result.offset());
+  return (jlong) (address) result.field_holder();
+C2V_END
+
+C2V_VMENTRY(jint, getVtableIndexForInterface, (JNIEnv *, jobject, jlong metaspace_klass, jlong metaspace_method))
+  Klass* klass = (Klass*) metaspace_klass;
+  Method* method = (Method*) metaspace_method;
+  assert(!klass->is_interface(), "");
+  return LinkResolver::vtable_index_of_interface_method(klass, method);
+C2V_END
+
+C2V_VMENTRY(jlong, resolveMethod, (JNIEnv *, jobject, jlong metaspace_klass_receiver, jlong metaspace_method, jlong metaspace_klass_caller))
+  Klass* recv_klass = (Klass*) metaspace_klass_receiver;
+  Klass* caller_klass = (Klass*) metaspace_klass_caller;
+  Method* method = (Method*) metaspace_method;
+
+  if (recv_klass->oop_is_array() || (InstanceKlass::cast(recv_klass)->is_linked())) {
+    Klass* holder_klass = method->method_holder();
+    Symbol* method_name = method->name();
+    Symbol* method_signature = method->signature();
+
+
+    if (holder_klass->is_interface()) {
+      // do link-time resolution to check all access rules.
+      methodHandle resolved_method;
+      LinkResolver::linktime_resolve_interface_method(resolved_method, holder_klass, method_name, method_signature, caller_klass, true, CHECK_AND_CLEAR_0);
+      if (resolved_method->is_private()) {
+        return (jlong) (address) NULL;
+      }
+      assert(recv_klass->is_subtype_of(holder_klass), "");
+      // do actual lookup
+      methodHandle sel_method;
+      LinkResolver::lookup_instance_method_in_klasses(sel_method, recv_klass,
+                resolved_method->name(),
+                resolved_method->signature(), CHECK_AND_CLEAR_0);
+      return (jlong) (address) sel_method();
+    } else {
+      // do link-time resolution to check all access rules.
+      methodHandle resolved_method;
+      LinkResolver::linktime_resolve_virtual_method(resolved_method, holder_klass, method_name, method_signature, caller_klass, true, CHECK_AND_CLEAR_0);
+      // do actual lookup (see LinkResolver::runtime_resolve_virtual_method)
+      int vtable_index = Method::invalid_vtable_index;
+      Method* selected_method;
+
+      if (resolved_method->method_holder()->is_interface()) { // miranda method
+        vtable_index = LinkResolver::vtable_index_of_interface_method(holder_klass, resolved_method);
+        assert(vtable_index >= 0 , "we should have valid vtable index at this point");
+
+        InstanceKlass* inst = InstanceKlass::cast(recv_klass);
+        selected_method = inst->method_at_vtable(vtable_index);
+      } else {
+        // at this point we are sure that resolved_method is virtual and not
+        // a miranda method; therefore, it must have a valid vtable index.
+        assert(!resolved_method->has_itable_index(), "");
+        vtable_index = resolved_method->vtable_index();
+        // We could get a negative vtable_index for final methods,
+        // because as an optimization they are they are never put in the vtable,
+        // unless they override an existing method.
+        // If we do get a negative, it means the resolved method is the the selected
+        // method, and it can never be changed by an override.
+        if (vtable_index == Method::nonvirtual_vtable_index) {
+          assert(resolved_method->can_be_statically_bound(), "cannot override this method");
+          selected_method = resolved_method();
+        } else {
+          // recv_klass might be an arrayKlassOop but all vtables start at
+          // the same place. The cast is to avoid virtual call and assertion.
+          InstanceKlass* inst = (InstanceKlass*)recv_klass;
+          selected_method = inst->method_at_vtable(vtable_index);
+        }
+      }
+      return (jlong) (address) selected_method;
+    }
+  }
+  return (jlong) (address) NULL;
+C2V_END
+
+C2V_VMENTRY(jboolean, hasFinalizableSubclass,(JNIEnv *, jobject, jlong metaspace_klass))
+  Klass* klass = (Klass*) metaspace_klass;
+  assert(klass != NULL, "method must not be called for primitive types");
+  return Dependencies::find_finalizable_subclass(klass) != NULL;
+C2V_END
+
+C2V_VMENTRY(jlong, getClassInitializer, (JNIEnv *, jobject, jlong metaspace_klass))
+  InstanceKlass* klass = (InstanceKlass*) metaspace_klass;
+  return (jlong) (address) klass->class_initializer();
+C2V_END
+
+C2V_VMENTRY(jlong, getMaxCallTargetOffset, (JNIEnv*, jobject, jlong addr))
+  address target_addr = (address) addr;
+  if (target_addr != 0x0) {
+    int64_t off_low = (int64_t)target_addr - ((int64_t)CodeCache::low_bound() + sizeof(int));
+    int64_t off_high = (int64_t)target_addr - ((int64_t)CodeCache::high_bound() + sizeof(int));
+    return MAX2(ABS(off_low), ABS(off_high));
+  }
+  return -1;
+C2V_END
+
+C2V_VMENTRY(void, doNotInlineOrCompile,(JNIEnv *, jobject,  jlong metaspace_method))
+  methodHandle method = asMethod(metaspace_method);
+  method->set_not_c1_compilable();
+  method->set_not_c2_compilable();
+  method->set_dont_inline(true);
+C2V_END
+
+C2V_VMENTRY(jint, installCode, (JNIEnv *jniEnv, jobject, jobject compiled_code, jobject installed_code, jobject speculation_log))
+  ResourceMark rm;
+  HandleMark hm;
+  Handle compiled_code_handle = JNIHandles::resolve(compiled_code);
+  CodeBlob* cb = NULL;
+  Handle installed_code_handle = JNIHandles::resolve(installed_code);
+  Handle speculation_log_handle = JNIHandles::resolve(speculation_log);
+
+  TraceTime install_time("installCode", JVMCICompiler::codeInstallTimer());
+  CodeInstaller installer;
+  JVMCIEnv::CodeInstallResult result = installer.install(compiled_code_handle, cb, installed_code_handle, speculation_log_handle);
+
+  if (PrintCodeCacheOnCompilation) {
+    stringStream s;
+    // Dump code cache  into a buffer before locking the tty,
+    {
+      MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
+      CodeCache::print_summary(&s, false);
+    }
+    ttyLocker ttyl;
+    tty->print_raw_cr(s.as_string());
+  }
+
+  if (result != JVMCIEnv::ok) {
+    assert(cb == NULL, "should be");
+  } else {
+    if (!installed_code_handle.is_null()) {
+      assert(installed_code_handle->is_a(InstalledCode::klass()), "wrong type");
+      InstalledCode::set_address(installed_code_handle, (jlong) cb);
+      InstalledCode::set_version(installed_code_handle, InstalledCode::version(installed_code_handle) + 1);
+      if (installed_code_handle->is_a(HotSpotInstalledCode::klass())) {
+        HotSpotInstalledCode::set_size(installed_code_handle, cb->size());
+        HotSpotInstalledCode::set_codeStart(installed_code_handle, (jlong) cb->code_begin());
+        HotSpotInstalledCode::set_codeSize(installed_code_handle, cb->code_size());
+      }
+      nmethod* nm = cb->as_nmethod_or_null();
+      if (nm != NULL && installed_code_handle->is_scavengable()) {
+        assert(nm->detect_scavenge_root_oops(), "nm should be scavengable if installed_code is scavengable");
+        if (!UseG1GC) {
+          assert(nm->on_scavenge_root_list(), "nm should be on scavengable list");
+        }
+      }
+    }
+  }
+  return result;
+C2V_END
+
+C2V_VMENTRY(void, notifyCompilationStatistics, (JNIEnv *jniEnv, jobject, jint id, jobject hotspot_method, jboolean osr, jint processedBytecodes, jlong time, jlong timeUnitsPerSecond, jobject installed_code))
+  CompilerStatistics* stats = JVMCICompiler::instance()->stats();
+
+  elapsedTimer timer = elapsedTimer(time, timeUnitsPerSecond);
+  if (osr) {
+    stats->_osr.update(timer, processedBytecodes);
+  } else {
+    stats->_standard.update(timer, processedBytecodes);
+  }
+  Handle installed_code_handle = JNIHandles::resolve(installed_code);
+  if (installed_code_handle->is_a(HotSpotInstalledCode::klass())) {
+    stats->_nmethods_size += HotSpotInstalledCode::size(installed_code_handle);
+    stats->_nmethods_code_size += HotSpotInstalledCode::codeSize(installed_code_handle);
+  }
+
+  if (CITimeEach) {
+    methodHandle method = asMethod(HotSpotResolvedJavaMethodImpl::metaspaceMethod(hotspot_method));
+    float bytes_per_sec = 1.0 * processedBytecodes / timer.seconds();
+    tty->print_cr("%3d   seconds: %f bytes/sec: %f (bytes %d)",
+                  id, timer.seconds(), bytes_per_sec, processedBytecodes);
+  }
+C2V_END
+
+C2V_VMENTRY(void, resetCompilationStatistics, (JNIEnv *jniEnv, jobject))
+  CompilerStatistics* stats = JVMCICompiler::instance()->stats();
+  stats->_standard.reset();
+  stats->_osr.reset();
+C2V_END
+
+C2V_VMENTRY(jobject, disassembleCodeBlob, (JNIEnv *jniEnv, jobject, jlong codeBlob))
+  ResourceMark rm;
+  HandleMark hm;
+
+  CodeBlob* cb = (CodeBlob*) (address) codeBlob;
+  if (cb == NULL) {
+    return NULL;
+  }
+
+  // We don't want the stringStream buffer to resize during disassembly as it
+  // uses scoped resource memory. If a nested function called during disassembly uses
+  // a ResourceMark and the buffer expands within the scope of the mark,
+  // the buffer becomes garbage when that scope is exited. Experience shows that
+  // the disassembled code is typically about 10x the code size so a fixed buffer
+  // sized to 20x code size plus a fixed amount for header info should be sufficient.
+  int bufferSize = cb->code_size() * 20 + 1024;
+  char* buffer = NEW_RESOURCE_ARRAY(char, bufferSize);
+  stringStream st(buffer, bufferSize);
+  if (cb->is_nmethod()) {
+    nmethod* nm = (nmethod*) cb;
+    if (!nm->is_alive()) {
+      return NULL;
+    }
+    Disassembler::decode(nm, &st);
+  } else {
+    Disassembler::decode(cb, &st);
+  }
+  if (st.size() <= 0) {
+    return NULL;
+  }
+
+  Handle result = java_lang_String::create_from_platform_dependent_str(st.as_string(), CHECK_NULL);
+  return JNIHandles::make_local(THREAD, result());
+C2V_END
+
+C2V_VMENTRY(jobject, getStackTraceElement, (JNIEnv*, jobject, jlong metaspace_method, int bci))
+  ResourceMark rm;
+  HandleMark hm;
+
+  methodHandle method = asMethod(metaspace_method);
+  oop element = java_lang_StackTraceElement::create(method, bci, CHECK_NULL);
+  return JNIHandles::make_local(THREAD, element);
+C2V_END
+
+C2V_VMENTRY(jobject, executeCompiledMethodVarargs, (JNIEnv*, jobject, jobject args, jobject hotspotInstalledCode))
+  ResourceMark rm;
+  HandleMark hm;
+
+  jlong nmethodValue = InstalledCode::address(hotspotInstalledCode);
+  if (nmethodValue == 0L) {
+    THROW_(vmSymbols::com_oracle_jvmci_code_InvalidInstalledCodeException(), NULL);
+  }
+  nmethod* nm = (nmethod*) (address) nmethodValue;
+  methodHandle mh = nm->method();
+  Symbol* signature = mh->signature();
+  JavaCallArguments jca(mh->size_of_parameters());
+
+  JavaArgumentUnboxer jap(signature, &jca, (arrayOop) JNIHandles::resolve(args), mh->is_static());
+  JavaValue result(jap.get_ret_type());
+  jca.set_alternative_target(nm);
+  JavaCalls::call(&result, mh, &jca, CHECK_NULL);
+
+  if (jap.get_ret_type() == T_VOID) {
+    return NULL;
+  } else if (jap.get_ret_type() == T_OBJECT || jap.get_ret_type() == T_ARRAY) {
+    return JNIHandles::make_local(THREAD, (oop) result.get_jobject());
+  } else {
+    jvalue *value = (jvalue *) result.get_value_addr();
+    // Narrow the value down if required (Important on big endian machines)
+    switch (jap.get_ret_type()) {
+      case T_BOOLEAN:
+       value->z = (jboolean) value->i;
+       break;
+      case T_BYTE:
+       value->b = (jbyte) value->i;
+       break;
+      case T_CHAR:
+       value->c = (jchar) value->i;
+       break;
+      case T_SHORT:
+       value->s = (jshort) value->i;
+       break;
+     }
+    oop o = java_lang_boxing_object::create(jap.get_ret_type(), value, CHECK_NULL);
+    return JNIHandles::make_local(THREAD, o);
+  }
+C2V_END
+
+C2V_VMENTRY(jlongArray, getLineNumberTable, (JNIEnv *, jobject, jlong metaspace_method))
+  Method* method = (Method*) metaspace_method;
+  if (!method->has_linenumber_table()) {
+    return NULL;
+  }
+  u2 num_entries = 0;
+  CompressedLineNumberReadStream streamForSize(method->compressed_linenumber_table());
+  while (streamForSize.read_pair()) {
+    num_entries++;
+  }
+
+  CompressedLineNumberReadStream stream(method->compressed_linenumber_table());
+  typeArrayOop result = oopFactory::new_longArray(2 * num_entries, CHECK_NULL);
+
+  int i = 0;
+  jlong value;
+  while (stream.read_pair()) {
+    value = ((long) stream.bci());
+    result->long_at_put(i, value);
+    value = ((long) stream.line());
+    result->long_at_put(i + 1, value);
+    i += 2;
+  }
+
+  return (jlongArray) JNIHandles::make_local(THREAD, result);
+C2V_END
+
+C2V_VMENTRY(jlong, getLocalVariableTableStart, (JNIEnv *, jobject, jlong metaspace_method))
+  ResourceMark rm;
+  Method* method = (Method*) metaspace_method;
+  if (!method->has_localvariable_table()) {
+    return 0;
+  }
+  return (jlong) (address) method->localvariable_table_start();
+C2V_END
+
+C2V_VMENTRY(jint, getLocalVariableTableLength, (JNIEnv *, jobject, jlong metaspace_method))
+  ResourceMark rm;
+  Method* method = (Method*) metaspace_method;
+  return method->localvariable_table_length();
+C2V_END
+
+C2V_VMENTRY(void, reprofile, (JNIEnv*, jobject, jlong metaspace_method))
+  Method* method = asMethod(metaspace_method);
+  MethodCounters* mcs = method->method_counters();
+  if (mcs != NULL) {
+    mcs->clear_counters();
+  }
+  NOT_PRODUCT(method->set_compiled_invocation_count(0));
+
+  nmethod* code = method->code();
+  if (code != NULL) {
+    code->make_not_entrant();
+  }
+
+  MethodData* method_data = method->method_data();
+  if (method_data == NULL) {
+    ClassLoaderData* loader_data = method->method_holder()->class_loader_data();
+    method_data = MethodData::allocate(loader_data, method, CHECK);
+    method->set_method_data(method_data);
+  } else {
+    method_data->initialize();
+  }
+C2V_END
+
+
+C2V_VMENTRY(void, invalidateInstalledCode, (JNIEnv*, jobject, jobject hotspotInstalledCode))
+  jlong nativeMethod = InstalledCode::address(hotspotInstalledCode);
+  nmethod* m = (nmethod*)nativeMethod;
+  if (m != NULL && !m->is_not_entrant()) {
+    m->mark_for_deoptimization();
+    VM_Deoptimize op;
+    VMThread::execute(&op);
+  }
+  InstalledCode::set_address(hotspotInstalledCode, 0);
+C2V_END
+
+C2V_VMENTRY(jobject, getJavaMirror, (JNIEnv* env, jobject, jlong metaspace_klass))
+  Klass* klass = asKlass(metaspace_klass);
+  return JNIHandles::make_local(THREAD, klass->java_mirror());
+C2V_END
+
+C2V_VMENTRY(jlong, readUnsafeKlassPointer, (JNIEnv*, jobject, jobject o))
+  oop resolved_o = JNIHandles::resolve(o);
+  jlong klass = (jlong)(address)resolved_o->klass();
+  return klass;
+C2V_END
+
+C2V_VMENTRY(jobject, readUncompressedOop, (JNIEnv*, jobject, jlong addr))
+  oop ret = oopDesc::load_decode_heap_oop((oop*)(address)addr);
+  return JNIHandles::make_local(THREAD, ret);
+C2V_END
+
+C2V_VMENTRY(jlongArray, collectCounters, (JNIEnv*, jobject))
+  typeArrayOop arrayOop = oopFactory::new_longArray(JVMCICounterSize, CHECK_NULL);
+  JavaThread::collect_counters(arrayOop);
+  return (jlongArray) JNIHandles::make_local(THREAD, arrayOop);
+C2V_END
+
+C2V_VMENTRY(int, allocateCompileId, (JNIEnv*, jobject, jlong metaspace_method, int entry_bci))
+  HandleMark hm;
+  ResourceMark rm;
+  Method* method = (Method*) metaspace_method;
+  return CompileBroker::assign_compile_id_unlocked(THREAD, method, entry_bci);
+C2V_END
+
+
+C2V_VMENTRY(jboolean, isMature, (JNIEnv*, jobject, jlong metaspace_method_data))
+  MethodData* mdo = asMethodData(metaspace_method_data);
+  return mdo != NULL && mdo->is_mature();
+C2V_END
+
+C2V_VMENTRY(jboolean, hasCompiledCodeForOSR, (JNIEnv*, jobject, jlong metaspace_method, int entry_bci, int comp_level))
+  Method* method = asMethod(metaspace_method);
+  return method->lookup_osr_nmethod_for(entry_bci, comp_level, true) != NULL;
+C2V_END
+
+C2V_VMENTRY(jlong, getTimeStamp, (JNIEnv*, jobject))
+  // tty->time_stamp is the time since VM start which should be used
+  // for all HotSpot log output when a timestamp is required.
+  return tty->time_stamp().milliseconds();
+C2V_END
+
+C2V_VMENTRY(jobject, getSymbol, (JNIEnv*, jobject, jlong metaspaceSymbol))
+  Handle sym = java_lang_String::create_from_symbol((Symbol*)(address)metaspaceSymbol, CHECK_NULL);
+  return JNIHandles::make_local(THREAD, sym());
+C2V_END
+
+bool matches(jlongArray methods, Method* method) {
+  typeArrayOop methods_oop = (typeArrayOop) JNIHandles::resolve(methods);
+
+  for (int i = 0; i < methods_oop->length(); i++) {
+    if (methods_oop->long_at(i) == (jlong) method) {
+      return true;
+    }
+  }
+  return false;
+}
+
+C2V_VMENTRY(jobject, getNextStackFrame, (JNIEnv*, jobject compilerToVM, jobject hs_frame, jlongArray methods, jint initialSkip))
+  ResourceMark rm;
+
+  if (!thread->has_last_Java_frame()) return NULL;
+  Handle result = InstanceKlass::cast(HotSpotStackFrameReference::klass())->allocate_instance(thread);
+  HotSpotStackFrameReference::klass()->initialize(thread);
+
+  StackFrameStream fst(thread);
+  if (hs_frame != NULL) {
+    // look for the correct stack frame if one is given
+    intptr_t* stack_pointer = (intptr_t*) HotSpotStackFrameReference::stackPointer(hs_frame);
+    while (fst.current()->sp() != stack_pointer && !fst.is_done()) {
+      fst.next();
+    }
+    if (fst.current()->sp() != stack_pointer) {
+      THROW_MSG_NULL(vmSymbols::java_lang_IllegalStateException(), "stack frame not found")
+    }
+  }
+
+  int frame_number = 0;
+  vframe* vf = vframe::new_vframe(fst.current(), fst.register_map(), thread);
+  if (hs_frame != NULL) {
+    // look for the correct vframe within the stack frame if one is given
+    int last_frame_number = HotSpotStackFrameReference::frameNumber(hs_frame);
+    while (frame_number < last_frame_number) {
+      if (vf->is_top()) {
+        THROW_MSG_NULL(vmSymbols::java_lang_IllegalStateException(), "invalid frame number")
+      }
+      vf = vf->sender();
+      frame_number ++;
+    }
+    // move one frame forward
+    if (vf->is_top()) {
+      if (fst.is_done()) {
+        return NULL;
+      }
+      fst.next();
+      vf = vframe::new_vframe(fst.current(), fst.register_map(), thread);
+      frame_number = 0;
+    } else {
+      vf = vf->sender();
+      frame_number++;
+    }
+  }
+
+  while (true) {
+    // look for the given method
+    while (true) {
+      StackValueCollection* locals = NULL;
+      if (vf->is_compiled_frame()) {
+        // compiled method frame
+        compiledVFrame* cvf = compiledVFrame::cast(vf);
+        if (methods == NULL || matches(methods, cvf->method())) {
+          if (initialSkip > 0) {
+            initialSkip --;
+          } else {
+            GrowableArray<ScopeValue*>* objects = cvf->scope()->objects();
+            bool reallocated = false;
+            if (objects != NULL) {
+              reallocated = Deoptimization::realloc_objects(thread, fst.current(), objects, THREAD);
+              Deoptimization::reassign_fields(fst.current(), fst.register_map(), objects, reallocated);
+
+              GrowableArray<ScopeValue*>* local_values = cvf->scope()->locals();
+              typeArrayHandle array = oopFactory::new_boolArray(local_values->length(), thread);
+              for (int i = 0; i < local_values->length(); i++) {
+                ScopeValue* value = local_values->at(i);
+                if (value->is_object()) {
+                  array->bool_at_put(i, true);
+                }
+              }
+              HotSpotStackFrameReference::set_localIsVirtual(result, array());
+            } else {
+              HotSpotStackFrameReference::set_localIsVirtual(result, NULL);
+            }
+
+            locals = cvf->locals();
+            HotSpotStackFrameReference::set_bci(result, cvf->bci());
+            HotSpotStackFrameReference::set_metaspaceMethod(result, (jlong) cvf->method());
+          }
+        }
+      } else if (vf->is_interpreted_frame()) {
+        // interpreted method frame
+        interpretedVFrame* ivf = interpretedVFrame::cast(vf);
+        if (methods == NULL || matches(methods, ivf->method())) {
+          if (initialSkip > 0) {
+            initialSkip --;
+          } else {
+            locals = ivf->locals();
+            HotSpotStackFrameReference::set_bci(result, ivf->bci());
+            HotSpotStackFrameReference::set_metaspaceMethod(result, (jlong) ivf->method());
+            HotSpotStackFrameReference::set_localIsVirtual(result, NULL);
+          }
+        }
+      }
+
+      // locals != NULL means that we found a matching frame and result is already partially initialized
+      if (locals != NULL) {
+        HotSpotStackFrameReference::set_compilerToVM(result, JNIHandles::resolve(compilerToVM));
+        HotSpotStackFrameReference::set_stackPointer(result, (jlong) fst.current()->sp());
+        HotSpotStackFrameReference::set_frameNumber(result, frame_number);
+
+        // initialize the locals array
+        objArrayHandle array = oopFactory::new_objectArray(locals->size(), thread);
+        for (int i = 0; i < locals->size(); i++) {
+          StackValue* var = locals->at(i);
+          if (var->type() == T_OBJECT) {
+            array->obj_at_put(i, locals->at(i)->get_obj()());
+          }
+        }
+        HotSpotStackFrameReference::set_locals(result, array());
+
+        return JNIHandles::make_local(thread, result());
+      }
+
+      if (vf->is_top()) {
+        break;
+      }
+      frame_number++;
+      vf = vf->sender();
+    } // end of vframe loop
+
+    if (fst.is_done()) {
+      break;
+    }
+    fst.next();
+    vf = vframe::new_vframe(fst.current(), fst.register_map(), thread);
+    frame_number = 0;
+  } // end of frame loop
+
+  // the end was reached without finding a matching method
+  return NULL;
+C2V_END
+
+C2V_VMENTRY(void, resolveInvokeDynamic, (JNIEnv*, jobject, jlong metaspace_constant_pool, jint index))
+  ConstantPool* cp = (ConstantPool*)metaspace_constant_pool;
+  CallInfo callInfo;
+  LinkResolver::resolve_invokedynamic(callInfo, cp, index, CHECK);
+  ConstantPoolCacheEntry* cp_cache_entry = cp->invokedynamic_cp_cache_entry_at(index);
+  cp_cache_entry->set_dynamic_call(cp, callInfo);
+C2V_END
+
+C2V_VMENTRY(jboolean, shouldDebugNonSafepoints, (JNIEnv*, jobject))
+  //see compute_recording_non_safepoints in debugInfroRec.cpp
+  if (JvmtiExport::should_post_compiled_method_load() && FLAG_IS_DEFAULT(DebugNonSafepoints)) {
+    return true;
+  }
+  return DebugNonSafepoints;
+C2V_END
+
+// public native void materializeVirtualObjects(HotSpotStackFrameReference stackFrame, boolean invalidate);
+C2V_VMENTRY(void, materializeVirtualObjects, (JNIEnv*, jobject, jobject hs_frame, bool invalidate))
+  ResourceMark rm;
+
+  if (hs_frame == NULL) {
+    THROW_MSG(vmSymbols::java_lang_NullPointerException(), "stack frame is null")
+  }
+
+  HotSpotStackFrameReference::klass()->initialize(thread);
+
+  // look for the given stack frame
+  StackFrameStream fst(thread);
+  intptr_t* stack_pointer = (intptr_t*) HotSpotStackFrameReference::stackPointer(hs_frame);
+  while (fst.current()->sp() != stack_pointer && !fst.is_done()) {
+    fst.next();
+  }
+  if (fst.current()->sp() != stack_pointer) {
+    THROW_MSG(vmSymbols::java_lang_IllegalStateException(), "stack frame not found")
+  }
+
+  if (invalidate) {
+    assert(fst.current()->cb()->is_nmethod(), "nmethod expected");
+    ((nmethod*) fst.current()->cb())->make_not_entrant();
+  }
+  Deoptimization::deoptimize(thread, *fst.current(), fst.register_map(), Deoptimization::Reason_none);
+
+  vframe* vf = vframe::new_vframe(fst.current(), fst.register_map(), thread);
+  if (!vf->is_compiled_frame()) {
+    THROW_MSG(vmSymbols::java_lang_IllegalStateException(), "compiled stack frame expected")
+  }
+
+  GrowableArray<compiledVFrame*>* virtualFrames = new GrowableArray<compiledVFrame*>(10);
+  while (true) {
+    assert(vf->is_compiled_frame(), "Wrong frame type");
+    virtualFrames->push(compiledVFrame::cast(vf));
+    if (vf->is_top()) {
+      break;
+    }
+    vf = vf->sender();
+  }
+
+  int last_frame_number = HotSpotStackFrameReference::frameNumber(hs_frame);
+  if (last_frame_number >= virtualFrames->length()) {
+    THROW_MSG(vmSymbols::java_lang_IllegalStateException(), "invalid frame number")
+  }
+
+  // Reallocate the non-escaping objects and restore their fields.
+  assert (virtualFrames->at(last_frame_number)->scope() != NULL,"invalid scope");
+  GrowableArray<ScopeValue*>* objects = virtualFrames->at(last_frame_number)->scope()->objects();
+
+  if (objects == NULL) {
+    // no objects to materialize
+    return;
+  }
+
+  bool reallocated = Deoptimization::realloc_objects(thread, fst.current(), objects, THREAD);
+  Deoptimization::reassign_fields(fst.current(), fst.register_map(), objects, reallocated);
+
+  for (int frame_index = 0; frame_index < virtualFrames->length(); frame_index++) {
+    compiledVFrame* cvf = virtualFrames->at(frame_index);
+
+    GrowableArray<ScopeValue*>* scopeLocals = cvf->scope()->locals();
+    StackValueCollection* locals = cvf->locals();
+
+    if (locals != NULL) {
+      for (int i2 = 0; i2 < locals->size(); i2++) {
+        StackValue* var = locals->at(i2);
+        if (var->type() == T_OBJECT && scopeLocals->at(i2)->is_object()) {
+          jvalue val;
+          val.l = (jobject) locals->at(i2)->get_obj()();
+          cvf->update_local(T_OBJECT, i2, val);
+        }
+      }
+    }
+  }
+
+  // all locals are materialized by now
+  HotSpotStackFrameReference::set_localIsVirtual(hs_frame, NULL);
+
+  // update the locals array
+  objArrayHandle array = HotSpotStackFrameReference::locals(hs_frame);
+  StackValueCollection* locals = virtualFrames->at(last_frame_number)->locals();
+  for (int i = 0; i < locals->size(); i++) {
+    StackValue* var = locals->at(i);
+    if (var->type() == T_OBJECT) {
+      array->obj_at_put(i, locals->at(i)->get_obj()());
+    }
+  }
+C2V_END
+
+C2V_VMENTRY(void, writeDebugOutput, (JNIEnv*, jobject, jbyteArray bytes, jint offset, jint length))
+  while (length > 0) {
+    jbyte* start = ((typeArrayOop) JNIHandles::resolve(bytes))->byte_at_addr(offset);
+    tty->write((char*) start, MIN2(length, O_BUFLEN));
+    length -= O_BUFLEN;
+    offset += O_BUFLEN;
+  }
+C2V_END
+
+C2V_VMENTRY(void, flushDebugOutput, (JNIEnv*, jobject))
+  tty->flush();
+C2V_END
+
+
+#define CC (char*)  /*cast a literal from (const char*)*/
+#define FN_PTR(f) CAST_FROM_FN_PTR(void*, &(c2v_ ## f))
+
+#define TYPE                  "Lcom/oracle/jvmci/meta/JavaType;"
+#define METHOD                "Lcom/oracle/jvmci/meta/JavaMethod;"
+#define FIELD                 "Lcom/oracle/jvmci/meta/JavaField;"
+#define SPECULATION_LOG       "Lcom/oracle/jvmci/code/SpeculationLog;"
+#define STRING                "Ljava/lang/String;"
+#define OBJECT                "Ljava/lang/Object;"
+#define CLASS                 "Ljava/lang/Class;"
+#define STACK_TRACE_ELEMENT   "Ljava/lang/StackTraceElement;"
+#define INSTALLED_CODE        "Lcom/oracle/jvmci/code/InstalledCode;"
+#define RESOLVED_METHOD       "Lcom/oracle/jvmci/meta/ResolvedJavaMethod;"
+#define HS_RESOLVED_METHOD    "Lcom/oracle/jvmci/hotspot/HotSpotResolvedJavaMethod;"
+#define HS_COMPILED_CODE      "Lcom/oracle/jvmci/hotspot/HotSpotCompiledCode;"
+#define HS_CONFIG             "Lcom/oracle/jvmci/hotspot/HotSpotVMConfig;"
+#define HS_STACK_FRAME_REF    "Lcom/oracle/jvmci/hotspot/HotSpotStackFrameReference;"
+#define METASPACE_KLASS       "J"
+#define METASPACE_METHOD      "J"
+#define METASPACE_METHOD_DATA "J"
+#define METASPACE_CONSTANT_POOL "J"
+
+JNINativeMethod CompilerToVM_methods[] = {
+  {CC"getBytecode",                                  CC"("METASPACE_METHOD")[B",                                               FN_PTR(getBytecode)},
+  {CC"exceptionTableStart",                          CC"("METASPACE_METHOD")J",                                                FN_PTR(exceptionTableStart)},
+  {CC"exceptionTableLength",                         CC"("METASPACE_METHOD")I",                                                FN_PTR(exceptionTableLength)},
+  {CC"hasBalancedMonitors",                          CC"("METASPACE_METHOD")Z",                                                FN_PTR(hasBalancedMonitors)},
+  {CC"findUniqueConcreteMethod",                     CC"("METASPACE_KLASS METASPACE_METHOD")"METASPACE_METHOD,                 FN_PTR(findUniqueConcreteMethod)},
+  {CC"getKlassImplementor",                          CC"("METASPACE_KLASS")"METASPACE_KLASS,                                   FN_PTR(getKlassImplementor)},
+  {CC"getStackTraceElement",                         CC"("METASPACE_METHOD"I)"STACK_TRACE_ELEMENT,                             FN_PTR(getStackTraceElement)},
+  {CC"methodIsIgnoredBySecurityStackWalk",           CC"("METASPACE_METHOD")Z",                                                FN_PTR(methodIsIgnoredBySecurityStackWalk)},
+  {CC"doNotInlineOrCompile",                         CC"("METASPACE_METHOD")V",                                                FN_PTR(doNotInlineOrCompile)},
+  {CC"canInlineMethod",                              CC"("METASPACE_METHOD")Z",                                                FN_PTR(canInlineMethod)},
+  {CC"shouldInlineMethod",                           CC"("METASPACE_METHOD")Z",                                                FN_PTR(shouldInlineMethod)},
+  {CC"lookupType",                                   CC"("STRING CLASS"Z)"METASPACE_KLASS,                                     FN_PTR(lookupType)},
+  {CC"resolveConstantInPool",                        CC"("METASPACE_CONSTANT_POOL"I)"OBJECT,                                   FN_PTR(resolveConstantInPool)},
+  {CC"resolvePossiblyCachedConstantInPool",          CC"("METASPACE_CONSTANT_POOL"I)"OBJECT,                                   FN_PTR(resolvePossiblyCachedConstantInPool)},
+  {CC"lookupNameRefInPool",                          CC"("METASPACE_CONSTANT_POOL"I)"STRING,                                   FN_PTR(lookupNameRefInPool)},
+  {CC"lookupNameAndTypeRefIndexInPool",              CC"("METASPACE_CONSTANT_POOL"I)I",                                        FN_PTR(lookupNameAndTypeRefIndexInPool)},
+  {CC"lookupSignatureRefInPool",                     CC"("METASPACE_CONSTANT_POOL"I)"STRING,                                   FN_PTR(lookupSignatureRefInPool)},
+  {CC"lookupKlassRefIndexInPool",                    CC"("METASPACE_CONSTANT_POOL"I)I",                                        FN_PTR(lookupKlassRefIndexInPool)},
+  {CC"constantPoolKlassAt",                          CC"("METASPACE_CONSTANT_POOL"I)"METASPACE_KLASS,                          FN_PTR(constantPoolKlassAt)},
+  {CC"lookupKlassInPool",                            CC"("METASPACE_CONSTANT_POOL"I)"METASPACE_KLASS,                          FN_PTR(lookupKlassInPool)},
+  {CC"lookupAppendixInPool",                         CC"("METASPACE_CONSTANT_POOL"I)"OBJECT,                                   FN_PTR(lookupAppendixInPool)},
+  {CC"lookupMethodInPool",                           CC"("METASPACE_CONSTANT_POOL"IB)"METASPACE_METHOD,                        FN_PTR(lookupMethodInPool)},
+  {CC"constantPoolRemapInstructionOperandFromCache", CC"("METASPACE_CONSTANT_POOL"I)I",                                        FN_PTR(constantPoolRemapInstructionOperandFromCache)},
+  {CC"resolveField",                                 CC"("METASPACE_CONSTANT_POOL"IB[J)"METASPACE_KLASS,                       FN_PTR(resolveField)},
+  {CC"resolveInvokeDynamic",                         CC"("METASPACE_CONSTANT_POOL"I)V",                                        FN_PTR(resolveInvokeDynamic)},
+  {CC"resolveMethod",                                CC"("METASPACE_KLASS METASPACE_METHOD METASPACE_KLASS")"METASPACE_METHOD, FN_PTR(resolveMethod)},
+  {CC"getVtableIndexForInterface",                   CC"("METASPACE_KLASS METASPACE_METHOD")I",                                FN_PTR(getVtableIndexForInterface)},
+  {CC"getClassInitializer",                          CC"("METASPACE_KLASS")"METASPACE_METHOD,                                  FN_PTR(getClassInitializer)},
+  {CC"hasFinalizableSubclass",                       CC"("METASPACE_KLASS")Z",                                                 FN_PTR(hasFinalizableSubclass)},
+  {CC"getMaxCallTargetOffset",                       CC"(J)J",                                                                 FN_PTR(getMaxCallTargetOffset)},
+  {CC"getMetaspaceMethod",                           CC"("CLASS"I)"METASPACE_METHOD,                                           FN_PTR(getMetaspaceMethod)},
+  {CC"initializeConfiguration",                      CC"("HS_CONFIG")V",                                                       FN_PTR(initializeConfiguration)},
+  {CC"installCode",                                  CC"("HS_COMPILED_CODE INSTALLED_CODE SPECULATION_LOG")I",                 FN_PTR(installCode)},
+  {CC"notifyCompilationStatistics",                  CC"(I"HS_RESOLVED_METHOD"ZIJJ"INSTALLED_CODE")V",                         FN_PTR(notifyCompilationStatistics)},
+  {CC"resetCompilationStatistics",                   CC"()V",                                                                  FN_PTR(resetCompilationStatistics)},
+  {CC"disassembleCodeBlob",                          CC"(J)"STRING,                                                            FN_PTR(disassembleCodeBlob)},
+  {CC"executeCompiledMethodVarargs",                 CC"(["OBJECT INSTALLED_CODE")"OBJECT,                                     FN_PTR(executeCompiledMethodVarargs)},
+  {CC"getLineNumberTable",                           CC"("METASPACE_METHOD")[J",                                               FN_PTR(getLineNumberTable)},
+  {CC"getLocalVariableTableStart",                   CC"("METASPACE_METHOD")J",                                                FN_PTR(getLocalVariableTableStart)},
+  {CC"getLocalVariableTableLength",                  CC"("METASPACE_METHOD")I",                                                FN_PTR(getLocalVariableTableLength)},
+  {CC"reprofile",                                    CC"("METASPACE_METHOD")V",                                                FN_PTR(reprofile)},
+  {CC"invalidateInstalledCode",                      CC"("INSTALLED_CODE")V",                                                  FN_PTR(invalidateInstalledCode)},
+  {CC"getJavaMirror",                                CC"("METASPACE_KLASS")"CLASS,                                             FN_PTR(getJavaMirror)},
+  {CC"readUnsafeKlassPointer",                       CC"("OBJECT")J",                                                          FN_PTR(readUnsafeKlassPointer)},
+  {CC"readUncompressedOop",                          CC"(J)"OBJECT,                                                            FN_PTR(readUncompressedOop)},
+  {CC"collectCounters",                              CC"()[J",                                                                 FN_PTR(collectCounters)},
+  {CC"allocateCompileId",                            CC"("METASPACE_METHOD"I)I",                                               FN_PTR(allocateCompileId)},
+  {CC"isMature",                                     CC"("METASPACE_METHOD_DATA")Z",                                           FN_PTR(isMature)},
+  {CC"hasCompiledCodeForOSR",                        CC"("METASPACE_METHOD"II)Z",                                              FN_PTR(hasCompiledCodeForOSR)},
+  {CC"getSymbol",                                    CC"(J)"STRING,                                                            FN_PTR(getSymbol)},
+  {CC"getTimeStamp",                                 CC"()J",                                                                  FN_PTR(getTimeStamp)},
+  {CC"getNextStackFrame",                            CC"("HS_STACK_FRAME_REF "[JI)"HS_STACK_FRAME_REF,                         FN_PTR(getNextStackFrame)},
+  {CC"materializeVirtualObjects",                    CC"("HS_STACK_FRAME_REF"Z)V",                                             FN_PTR(materializeVirtualObjects)},
+  {CC"shouldDebugNonSafepoints",                     CC"()Z",                                                                  FN_PTR(shouldDebugNonSafepoints)},
+  {CC"writeDebugOutput",                             CC"([BII)V",                                                              FN_PTR(writeDebugOutput)},
+  {CC"flushDebugOutput",                             CC"()V",                                                                  FN_PTR(flushDebugOutput)},
+};
+
+int CompilerToVM_methods_count() {
+  return sizeof(CompilerToVM_methods) / sizeof(JNINativeMethod);
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/vm/jvmci/jvmciCompilerToVM.hpp	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,108 @@
+/*
+ * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+#ifndef SHARE_VM_JVMCI_JVMCI_COMPILER_TO_VM_HPP
+#define SHARE_VM_JVMCI_JVMCI_COMPILER_TO_VM_HPP
+
+#include "prims/jni.h"
+#include "runtime/javaCalls.hpp"
+
+class CompilerToVM {
+public:
+  /**
+   * Tag bits used by lookupKlassInPool to distinguish the types in Java.
+   */
+  enum Tags {
+    KLASS_TAG = 0x0,
+    SYMBOL_TAG = 0x1
+  };
+
+  static intptr_t tag_pointer(Klass* klass) {
+    return ((intptr_t) klass) | KLASS_TAG;
+  }
+
+  static intptr_t tag_pointer(Symbol* symbol) {
+    return ((intptr_t) symbol) | SYMBOL_TAG;
+  }
+
+  // nothing here - no need to define the jni method implementations in a header file
+};
+
+extern JNINativeMethod CompilerToVM_methods[];
+int CompilerToVM_methods_count();
+
+inline Method* asMethod(jlong metaspaceMethod) {
+  return (Method*) (address) metaspaceMethod;
+}
+
+inline MethodData* asMethodData(jlong metaspaceMethodData) {
+  return (MethodData*) (address) metaspaceMethodData;
+}
+
+inline Klass* asKlass(jlong metaspaceKlass) {
+  return (Klass*) (address) metaspaceKlass;
+}
+
+class JavaArgumentUnboxer : public SignatureIterator {
+ protected:
+  JavaCallArguments*  _jca;
+  arrayOop _args;
+  int _index;
+
+  oop next_arg(BasicType expectedType) {
+    assert(_index < _args->length(), "out of bounds");
+    oop arg=((objArrayOop) (_args))->obj_at(_index++);
+    assert(expectedType == T_OBJECT || java_lang_boxing_object::is_instance(arg, expectedType), "arg type mismatch");
+    return arg;
+  }
+
+ public:
+  JavaArgumentUnboxer(Symbol* signature, JavaCallArguments*  jca, arrayOop args, bool is_static) : SignatureIterator(signature) {
+    this->_return_type = T_ILLEGAL;
+    _jca = jca;
+    _index = 0;
+    _args = args;
+    if (!is_static) {
+      _jca->push_oop(next_arg(T_OBJECT));
+    }
+    iterate();
+    assert(_index == args->length(), "arg count mismatch with signature");
+  }
+
+  inline void do_bool()   { if (!is_return_type()) _jca->push_int(next_arg(T_BOOLEAN)->bool_field(java_lang_boxing_object::value_offset_in_bytes(T_BOOLEAN))); }
+  inline void do_char()   { if (!is_return_type()) _jca->push_int(next_arg(T_CHAR)->char_field(java_lang_boxing_object::value_offset_in_bytes(T_CHAR))); }
+  inline void do_short()  { if (!is_return_type()) _jca->push_int(next_arg(T_SHORT)->short_field(java_lang_boxing_object::value_offset_in_bytes(T_SHORT))); }
+  inline void do_byte()   { if (!is_return_type()) _jca->push_int(next_arg(T_BYTE)->byte_field(java_lang_boxing_object::value_offset_in_bytes(T_BYTE))); }
+  inline void do_int()    { if (!is_return_type()) _jca->push_int(next_arg(T_INT)->int_field(java_lang_boxing_object::value_offset_in_bytes(T_INT))); }
+
+  inline void do_long()   { if (!is_return_type()) _jca->push_long(next_arg(T_LONG)->long_field(java_lang_boxing_object::value_offset_in_bytes(T_LONG))); }
+  inline void do_float()  { if (!is_return_type()) _jca->push_float(next_arg(T_FLOAT)->float_field(java_lang_boxing_object::value_offset_in_bytes(T_FLOAT))); }
+  inline void do_double() { if (!is_return_type()) _jca->push_double(next_arg(T_DOUBLE)->double_field(java_lang_boxing_object::value_offset_in_bytes(T_DOUBLE))); }
+
+  inline void do_object() { _jca->push_oop(next_arg(T_OBJECT)); }
+  inline void do_object(int begin, int end) { if (!is_return_type()) _jca->push_oop(next_arg(T_OBJECT)); }
+  inline void do_array(int begin, int end)  { if (!is_return_type()) _jca->push_oop(next_arg(T_OBJECT)); }
+  inline void do_void()                     { }
+};
+
+#endif // SHARE_VM_JVMCI_JVMCI_COMPILER_TO_VM_HPP
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/vm/jvmci/jvmciEnv.cpp	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,617 @@
+/*
+ * Copyright (c) 1999, 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.
+ *
+ */
+
+#include "precompiled.hpp"
+#include "jvmci/jvmciEnv.hpp"
+#include "classfile/systemDictionary.hpp"
+#include "classfile/vmSymbols.hpp"
+#include "code/scopeDesc.hpp"
+#include "runtime/sweeper.hpp"
+#include "compiler/compileBroker.hpp"
+#include "compiler/compileLog.hpp"
+#include "compiler/compilerOracle.hpp"
+#include "interpreter/linkResolver.hpp"
+#include "memory/allocation.inline.hpp"
+#include "memory/oopFactory.hpp"
+#include "memory/universe.inline.hpp"
+#include "oops/methodData.hpp"
+#include "oops/objArrayKlass.hpp"
+#include "prims/jvmtiExport.hpp"
+#include "runtime/init.hpp"
+#include "runtime/reflection.hpp"
+#include "runtime/sharedRuntime.hpp"
+#include "utilities/dtrace.hpp"
+#include "jvmci/jvmciRuntime.hpp"
+#include "jvmci/jvmciJavaAccess.hpp"
+
+JVMCIEnv::JVMCIEnv(CompileTask* task, int system_dictionary_modification_counter) {
+  _task = task;
+  _system_dictionary_modification_counter = system_dictionary_modification_counter;
+  {
+    // Get Jvmti capabilities under lock to get consistent values.
+    MutexLocker mu(JvmtiThreadState_lock);
+    _jvmti_can_hotswap_or_post_breakpoint = JvmtiExport::can_hotswap_or_post_breakpoint();
+    _jvmti_can_access_local_variables     = JvmtiExport::can_access_local_variables();
+    _jvmti_can_post_on_exceptions         = JvmtiExport::can_post_on_exceptions();
+  }
+}
+
+// ------------------------------------------------------------------
+// Note: the logic of this method should mirror the logic of
+// constantPoolOopDesc::verify_constant_pool_resolve.
+bool JVMCIEnv::check_klass_accessibility(KlassHandle accessing_klass, KlassHandle resolved_klass) {
+  if (accessing_klass->oop_is_objArray()) {
+    accessing_klass = ObjArrayKlass::cast(accessing_klass())->bottom_klass();
+  }
+  if (!accessing_klass->oop_is_instance()) {
+    return true;
+  }
+
+  if (resolved_klass->oop_is_objArray()) {
+    // Find the element klass, if this is an array.
+    resolved_klass = ObjArrayKlass::cast(resolved_klass())->bottom_klass();
+  }
+  if (resolved_klass->oop_is_instance()) {
+    return Reflection::verify_class_access(accessing_klass(), resolved_klass(), true);
+  }
+  return true;
+}
+
+// ------------------------------------------------------------------
+KlassHandle JVMCIEnv::get_klass_by_name_impl(KlassHandle& accessing_klass,
+                                          constantPoolHandle& cpool,
+                                          Symbol* sym,
+                                          bool require_local) {
+  JVMCI_EXCEPTION_CONTEXT;
+
+  // Now we need to check the SystemDictionary
+  if (sym->byte_at(0) == 'L' &&
+    sym->byte_at(sym->utf8_length()-1) == ';') {
+    // This is a name from a signature.  Strip off the trimmings.
+    // Call recursive to keep scope of strippedsym.
+    TempNewSymbol strippedsym = SymbolTable::new_symbol(sym->as_utf8()+1,
+                    sym->utf8_length()-2,
+                    CHECK_(KlassHandle()));
+    return get_klass_by_name_impl(accessing_klass, cpool, strippedsym, require_local);
+  }
+
+  Handle loader(THREAD, (oop)NULL);
+  Handle domain(THREAD, (oop)NULL);
+  if (!accessing_klass.is_null()) {
+    loader = Handle(THREAD, accessing_klass->class_loader());
+    domain = Handle(THREAD, accessing_klass->protection_domain());
+  }
+
+  KlassHandle found_klass;
+  {
+    ttyUnlocker ttyul;  // release tty lock to avoid ordering problems
+    MutexLocker ml(Compile_lock);
+    Klass*  kls;
+    if (!require_local) {
+      kls = SystemDictionary::find_constrained_instance_or_array_klass(sym, loader, CHECK_(KlassHandle()));
+    } else {
+      kls = SystemDictionary::find_instance_or_array_klass(sym, loader, domain, CHECK_(KlassHandle()));
+    }
+    found_klass = KlassHandle(THREAD, kls);
+  }
+
+  // If we fail to find an array klass, look again for its element type.
+  // The element type may be available either locally or via constraints.
+  // In either case, if we can find the element type in the system dictionary,
+  // we must build an array type around it.  The CI requires array klasses
+  // to be loaded if their element klasses are loaded, except when memory
+  // is exhausted.
+  if (sym->byte_at(0) == '[' &&
+      (sym->byte_at(1) == '[' || sym->byte_at(1) == 'L')) {
+    // We have an unloaded array.
+    // Build it on the fly if the element class exists.
+    TempNewSymbol elem_sym = SymbolTable::new_symbol(sym->as_utf8()+1,
+                                                 sym->utf8_length()-1,
+                                                 CHECK_(KlassHandle()));
+
+    // Get element Klass recursively.
+    KlassHandle elem_klass =
+      get_klass_by_name_impl(accessing_klass,
+                             cpool,
+                             elem_sym,
+                             require_local);
+    if (!elem_klass.is_null()) {
+      // Now make an array for it
+      return elem_klass->array_klass(CHECK_(KlassHandle()));
+    }
+  }
+
+  if (found_klass.is_null() && !cpool.is_null() && cpool->has_preresolution()) {
+    // Look inside the constant pool for pre-resolved class entries.
+    for (int i = cpool->length() - 1; i >= 1; i--) {
+      if (cpool->tag_at(i).is_klass()) {
+        Klass*  kls = cpool->resolved_klass_at(i);
+        if (kls->name() == sym) {
+          return kls;
+        }
+      }
+    }
+  }
+
+  return found_klass();
+}
+
+// ------------------------------------------------------------------
+KlassHandle JVMCIEnv::get_klass_by_name(KlassHandle& accessing_klass,
+                                  Symbol* klass_name,
+                                  bool require_local) {
+  ResourceMark rm;
+  constantPoolHandle cpool;
+  return get_klass_by_name_impl(accessing_klass,
+                                                 cpool,
+                                                 klass_name,
+                                                 require_local);
+}
+
+// ------------------------------------------------------------------
+// Implementation of get_klass_by_index.
+KlassHandle JVMCIEnv::get_klass_by_index_impl(constantPoolHandle& cpool,
+                                        int index,
+                                        bool& is_accessible,
+                                        KlassHandle& accessor) {
+  JVMCI_EXCEPTION_CONTEXT;
+  KlassHandle klass (THREAD, ConstantPool::klass_at_if_loaded(cpool, index));
+  Symbol* klass_name = NULL;
+  if (klass.is_null()) {
+    // The klass has not been inserted into the constant pool.
+    // Try to look it up by name.
+    {
+      // We have to lock the cpool to keep the oop from being resolved
+      // while we are accessing it.
+      MonitorLockerEx ml(cpool->lock());
+
+      constantTag tag = cpool->tag_at(index);
+      if (tag.is_klass()) {
+        // The klass has been inserted into the constant pool
+        // very recently.
+        klass = KlassHandle(THREAD, cpool->resolved_klass_at(index));
+      } else if (tag.is_symbol()) {
+        klass_name = cpool->symbol_at(index);
+      } else {
+        assert(cpool->tag_at(index).is_unresolved_klass(), "wrong tag");
+        klass_name = cpool->unresolved_klass_at(index);
+      }
+    }
+  }
+
+  if (klass.is_null()) {
+    // Not found in constant pool.  Use the name to do the lookup.
+    KlassHandle k = get_klass_by_name_impl(accessor,
+                                        cpool,
+                                        klass_name,
+                                        false);
+    // Calculate accessibility the hard way.
+    if (k.is_null()) {
+      is_accessible = false;
+    } else if (k->class_loader() != accessor->class_loader() &&
+               get_klass_by_name_impl(accessor, cpool, k->name(), true).is_null()) {
+      // Loaded only remotely.  Not linked yet.
+      is_accessible = false;
+    } else {
+      // Linked locally, and we must also check public/private, etc.
+      is_accessible = check_klass_accessibility(accessor, k);
+    }
+    if (!is_accessible) {
+      return KlassHandle();
+    }
+    return k;
+  }
+
+  // It is known to be accessible, since it was found in the constant pool.
+  is_accessible = true;
+  return klass;
+}
+
+// ------------------------------------------------------------------
+// Get a klass from the constant pool.
+KlassHandle JVMCIEnv::get_klass_by_index(constantPoolHandle& cpool,
+                                   int index,
+                                   bool& is_accessible,
+                                   KlassHandle& accessor) {
+  ResourceMark rm;
+  KlassHandle result = get_klass_by_index_impl(cpool, index, is_accessible, accessor);
+  return result;
+}
+
+// ------------------------------------------------------------------
+// Implementation of get_field_by_index.
+//
+// Implementation note: the results of field lookups are cached
+// in the accessor klass.
+void JVMCIEnv::get_field_by_index_impl(instanceKlassHandle& klass, fieldDescriptor& field_desc,
+                                        int index) {
+  JVMCI_EXCEPTION_CONTEXT;
+
+  assert(klass->is_linked(), "must be linked before using its constant-pool");
+
+  constantPoolHandle cpool(thread, klass->constants());
+
+  // Get the field's name, signature, and type.
+  Symbol* name  = cpool->name_ref_at(index);
+
+  int nt_index = cpool->name_and_type_ref_index_at(index);
+  int sig_index = cpool->signature_ref_index_at(nt_index);
+  Symbol* signature = cpool->symbol_at(sig_index);
+
+  // Get the field's declared holder.
+  int holder_index = cpool->klass_ref_index_at(index);
+  bool holder_is_accessible;
+  KlassHandle declared_holder = get_klass_by_index(cpool, holder_index,
+                                               holder_is_accessible,
+                                               klass);
+
+  // The declared holder of this field may not have been loaded.
+  // Bail out with partial field information.
+  if (!holder_is_accessible) {
+    return;
+  }
+
+
+  // Perform the field lookup.
+  Klass*  canonical_holder =
+    InstanceKlass::cast(declared_holder())->find_field(name, signature, &field_desc);
+  if (canonical_holder == NULL) {
+    return;
+  }
+
+  assert(canonical_holder == field_desc.field_holder(), "just checking");
+}
+
+// ------------------------------------------------------------------
+// Get a field by index from a klass's constant pool.
+void JVMCIEnv::get_field_by_index(instanceKlassHandle& accessor, fieldDescriptor& fd, int index) {
+  ResourceMark rm;
+  return get_field_by_index_impl(accessor, fd, index);
+}
+
+// ------------------------------------------------------------------
+// Perform an appropriate method lookup based on accessor, holder,
+// name, signature, and bytecode.
+methodHandle JVMCIEnv::lookup_method(instanceKlassHandle& h_accessor,
+                               instanceKlassHandle& h_holder,
+                               Symbol*       name,
+                               Symbol*       sig,
+                               Bytecodes::Code bc) {
+  JVMCI_EXCEPTION_CONTEXT;
+  LinkResolver::check_klass_accessability(h_accessor, h_holder, KILL_COMPILE_ON_FATAL_(NULL));
+  methodHandle dest_method;
+  switch (bc) {
+  case Bytecodes::_invokestatic:
+    dest_method =
+      LinkResolver::resolve_static_call_or_null(h_holder, name, sig, h_accessor);
+    break;
+  case Bytecodes::_invokespecial:
+    dest_method =
+      LinkResolver::resolve_special_call_or_null(h_holder, name, sig, h_accessor);
+    break;
+  case Bytecodes::_invokeinterface:
+    dest_method =
+      LinkResolver::linktime_resolve_interface_method_or_null(h_holder, name, sig,
+                                                              h_accessor, true);
+    break;
+  case Bytecodes::_invokevirtual:
+    dest_method =
+      LinkResolver::linktime_resolve_virtual_method_or_null(h_holder, name, sig,
+                                                            h_accessor, true);
+    break;
+  default: ShouldNotReachHere();
+  }
+
+  return dest_method;
+}
+
+
+// ------------------------------------------------------------------
+methodHandle JVMCIEnv::get_method_by_index_impl(constantPoolHandle& cpool,
+                                          int index, Bytecodes::Code bc,
+                                          instanceKlassHandle& accessor) {
+  if (bc == Bytecodes::_invokedynamic) {
+    ConstantPoolCacheEntry* cpce = cpool->invokedynamic_cp_cache_entry_at(index);
+    bool is_resolved = !cpce->is_f1_null();
+    if (is_resolved) {
+      // Get the invoker Method* from the constant pool.
+      // (The appendix argument, if any, will be noted in the method's signature.)
+      Method* adapter = cpce->f1_as_method();
+      return methodHandle(adapter);
+    }
+
+    return NULL;
+  }
+
+  int holder_index = cpool->klass_ref_index_at(index);
+  bool holder_is_accessible;
+  KlassHandle holder = get_klass_by_index_impl(cpool, holder_index, holder_is_accessible, accessor);
+
+  // Get the method's name and signature.
+  Symbol* name_sym = cpool->name_ref_at(index);
+  Symbol* sig_sym  = cpool->signature_ref_at(index);
+
+  if (cpool->has_preresolution()
+      || (holder() == SystemDictionary::MethodHandle_klass() &&
+          MethodHandles::is_signature_polymorphic_name(holder(), name_sym))) {
+    // Short-circuit lookups for JSR 292-related call sites.
+    // That is, do not rely only on name-based lookups, because they may fail
+    // if the names are not resolvable in the boot class loader (7056328).
+    switch (bc) {
+    case Bytecodes::_invokevirtual:
+    case Bytecodes::_invokeinterface:
+    case Bytecodes::_invokespecial:
+    case Bytecodes::_invokestatic:
+      {
+        Method* m = ConstantPool::method_at_if_loaded(cpool, index);
+        if (m != NULL) {
+          return m;
+        }
+      }
+      break;
+    }
+  }
+
+  if (holder_is_accessible) { // Our declared holder is loaded.
+    instanceKlassHandle lookup = get_instance_klass_for_declared_method_holder(holder);
+    methodHandle m = lookup_method(accessor, lookup, name_sym, sig_sym, bc);
+    if (!m.is_null() &&
+        (bc == Bytecodes::_invokestatic
+         ?  InstanceKlass::cast(m->method_holder())->is_not_initialized()
+         : !InstanceKlass::cast(m->method_holder())->is_loaded())) {
+      m = NULL;
+    }
+    if (!m.is_null()) {
+      // We found the method.
+      return m;
+    }
+  }
+
+  // Either the declared holder was not loaded, or the method could
+  // not be found.
+
+  return NULL;
+}
+
+// ------------------------------------------------------------------
+instanceKlassHandle JVMCIEnv::get_instance_klass_for_declared_method_holder(KlassHandle& method_holder) {
+  // For the case of <array>.clone(), the method holder can be an ArrayKlass*
+  // instead of an InstanceKlass*.  For that case simply pretend that the
+  // declared holder is Object.clone since that's where the call will bottom out.
+  if (method_holder->oop_is_instance()) {
+    return instanceKlassHandle(method_holder());
+  } else if (method_holder->oop_is_array()) {
+    return instanceKlassHandle(SystemDictionary::Object_klass());
+  } else {
+    ShouldNotReachHere();
+  }
+  return NULL;
+}
+
+
+// ------------------------------------------------------------------
+methodHandle JVMCIEnv::get_method_by_index(constantPoolHandle& cpool,
+                                     int index, Bytecodes::Code bc,
+                                     instanceKlassHandle& accessor) {
+  ResourceMark rm;
+  return get_method_by_index_impl(cpool, index, bc, accessor);
+}
+
+// ------------------------------------------------------------------
+// Check for changes to the system dictionary during compilation
+// class loads, evolution, breakpoints
+JVMCIEnv::CodeInstallResult JVMCIEnv::check_for_system_dictionary_modification(Dependencies* dependencies, Handle compiled_code,
+                                                                               JVMCIEnv* env, char** failure_detail) {
+  // If JVMTI capabilities were enabled during compile, the compilation is invalidated.
+  if (env != NULL) {
+    if (!env->_jvmti_can_hotswap_or_post_breakpoint && JvmtiExport::can_hotswap_or_post_breakpoint()) {
+      *failure_detail = (char*) "Hotswapping or breakpointing was enabled during compilation";
+      return JVMCIEnv::dependencies_failed;
+    }
+  }
+
+  // Dependencies must be checked when the system dictionary changes
+  // or if we don't know whether it has changed (i.e., env == NULL).
+  // In debug mode, always check dependencies.
+  bool counter_changed = env != NULL && env->_system_dictionary_modification_counter != SystemDictionary::number_of_modifications();
+  bool verify_deps = env == NULL || trueInDebug || Debug::ENABLED();
+  if (!counter_changed && !verify_deps) {
+    return JVMCIEnv::ok;
+  }
+
+  for (Dependencies::DepStream deps(dependencies); deps.next(); ) {
+    Klass* witness = deps.check_dependency();
+    if (witness != NULL) {
+      // Use a fixed size buffer to prevent the string stream from
+      // resizing in the context of an inner resource mark.
+      char* buffer = NEW_RESOURCE_ARRAY(char, O_BUFLEN);
+      stringStream st(buffer, O_BUFLEN);
+      deps.print_dependency(witness, true, &st);
+      *failure_detail = st.as_string();
+      if (env == NULL || counter_changed) {
+        return JVMCIEnv::dependencies_failed;
+      } else {
+        // The dependencies were invalid at the time of installation
+        // without any intervening modification of the system
+        // dictionary.  That means they were invalidly constructed.
+        return JVMCIEnv::dependencies_invalid;
+      }
+    }
+    if (LogCompilation) {
+      deps.log_dependency();
+    }
+  }
+
+  return JVMCIEnv::ok;
+}
+
+// ------------------------------------------------------------------
+JVMCIEnv::CodeInstallResult JVMCIEnv::register_method(
+                                methodHandle& method,
+                                nmethod*& nm,
+                                int entry_bci,
+                                CodeOffsets* offsets,
+                                int orig_pc_offset,
+                                CodeBuffer* code_buffer,
+                                int frame_words,
+                                OopMapSet* oop_map_set,
+                                ExceptionHandlerTable* handler_table,
+                                AbstractCompiler* compiler,
+                                DebugInformationRecorder* debug_info,
+                                Dependencies* dependencies,
+                                JVMCIEnv* env,
+                                int compile_id,
+                                bool has_unsafe_access,
+                                Handle installed_code,
+                                Handle compiled_code,
+                                Handle speculation_log) {
+  JVMCI_EXCEPTION_CONTEXT;
+  NMethodSweeper::possibly_sweep();
+  nm = NULL;
+  int comp_level = CompLevel_full_optimization;
+  char* failure_detail = NULL;
+  JVMCIEnv::CodeInstallResult result;
+  {
+    // To prevent compile queue updates.
+    MutexLocker locker(MethodCompileQueue_lock, THREAD);
+
+    // Prevent SystemDictionary::add_to_hierarchy from running
+    // and invalidating our dependencies until we install this method.
+    MutexLocker ml(Compile_lock);
+
+    // Encode the dependencies now, so we can check them right away.
+    dependencies->encode_content_bytes();
+
+    // Check for {class loads, evolution, breakpoints} during compilation
+    result = check_for_system_dictionary_modification(dependencies, compiled_code, env, &failure_detail);
+    if (result != JVMCIEnv::ok) {
+      // While not a true deoptimization, it is a preemptive decompile.
+      MethodData* mdp = method()->method_data();
+      if (mdp != NULL) {
+        mdp->inc_decompile_count();
+        if (mdp->decompile_count() > (uint)PerMethodRecompilationCutoff) {
+          // TODO (chaeubl) enable this in the fastdebug build only once we are more stable
+          ResourceMark m;
+          tty->print_cr("WARN: endless recompilation of %s. Method was set to not compilable.", method()->name_and_sig_as_C_string());
+          //ShouldNotReachHere();
+        }
+      }
+
+      // All buffers in the CodeBuffer are allocated in the CodeCache.
+      // If the code buffer is created on each compile attempt
+      // as in C2, then it must be freed.
+      //code_buffer->free_blob();
+    } else {
+      ImplicitExceptionTable implicit_tbl;
+      nm =  nmethod::new_nmethod(method,
+                                 compile_id,
+                                 entry_bci,
+                                 offsets,
+                                 orig_pc_offset,
+                                 debug_info, dependencies, code_buffer,
+                                 frame_words, oop_map_set,
+                                 handler_table, &implicit_tbl,
+                                 compiler, comp_level, installed_code, speculation_log);
+
+      // Free codeBlobs
+      //code_buffer->free_blob();
+
+      if (nm == NULL) {
+        // The CodeCache is full.  Print out warning and disable compilation.
+        {
+          MutexUnlocker ml(Compile_lock);
+          MutexUnlocker locker(MethodCompileQueue_lock);
+          CompileBroker::handle_full_code_cache();
+        }
+      } else {
+        nm->set_has_unsafe_access(has_unsafe_access);
+#ifdef TARGET_ARCH_x86
+        // It might be preferable to set this only for methods which
+        // use vector instructions but we currently don't track this
+        // and it probably wouldn't make much difference.
+        nm->set_has_wide_vectors(MaxVectorSize > 16);
+#endif
+
+        // Record successful registration.
+        // (Put nm into the task handle *before* publishing to the Java heap.)
+        CompileTask* task = env == NULL ? NULL : env->task();
+        if (task != NULL)  task->set_code(nm);
+
+        if (installed_code->is_a(HotSpotNmethod::klass()) && HotSpotNmethod::isDefault(installed_code())) {
+          if (entry_bci == InvocationEntryBci) {
+            if (TieredCompilation) {
+              // If there is an old version we're done with it
+              nmethod* old = method->code();
+              if (TraceMethodReplacement && old != NULL) {
+                ResourceMark rm;
+                char *method_name = method->name_and_sig_as_C_string();
+                tty->print_cr("Replacing method %s", method_name);
+              }
+              if (old != NULL ) {
+                old->make_not_entrant();
+              }
+            }
+            if (TraceNMethodInstalls) {
+              ResourceMark rm;
+              char *method_name = method->name_and_sig_as_C_string();
+              ttyLocker ttyl;
+              tty->print_cr("Installing method (%d) %s [entry point: %p]",
+                            comp_level,
+                            method_name, nm->entry_point());
+            }
+            // Allow the code to be executed
+            method->set_code(method, nm);
+          } else {
+            if (TraceNMethodInstalls ) {
+              ResourceMark rm;
+              char *method_name = method->name_and_sig_as_C_string();
+              ttyLocker ttyl;
+              tty->print_cr("Installing osr method (%d) %s @ %d",
+                            comp_level,
+                            method_name,
+                            entry_bci);
+            }
+            InstanceKlass::cast(method->method_holder())->add_osr_nmethod(nm);
+          }
+        }
+      }
+      result = nm != NULL ? JVMCIEnv::ok :JVMCIEnv::cache_full;
+    }
+  }
+
+  // String creation must be done outside lock
+  if (failure_detail != NULL) {
+    // A failure to allocate the string is silently ignored.
+    Handle message = java_lang_String::create_from_str(failure_detail, THREAD);
+    HotSpotCompiledNmethod::set_installationFailureMessage(compiled_code, message());
+  }
+
+  // JVMTI -- compiled method notification (must be done outside lock)
+  if (nm != NULL) {
+    nm->post_compiled_method_load_event();
+  }
+
+  return result;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/vm/jvmci/jvmciEnv.hpp	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,171 @@
+/*
+ * Copyright (c) 1999, 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.
+ *
+ */
+
+#ifndef SHARE_VM_JVMCI_JVMCIENV_HPP
+#define SHARE_VM_JVMCI_JVMCIENV_HPP
+
+#include "classfile/systemDictionary.hpp"
+#include "code/debugInfoRec.hpp"
+#include "code/dependencies.hpp"
+#include "code/exceptionHandlerTable.hpp"
+#include "compiler/oopMap.hpp"
+#include "runtime/thread.hpp"
+
+class CompileTask;
+
+// Bring the JVMCI compiler thread into the VM state.
+#define JVMCI_VM_ENTRY_MARK                       \
+  JavaThread* thread = JavaThread::current(); \
+  ThreadInVMfromNative __tiv(thread);       \
+  ResetNoHandleMark rnhm;                   \
+  HandleMarkCleaner __hm(thread);           \
+  Thread* THREAD = thread;                  \
+  debug_only(VMNativeEntryWrapper __vew;)
+
+#define JVMCI_EXCEPTION_CONTEXT \
+  JavaThread* thread=JavaThread::current(); \
+  Thread* THREAD = thread;
+
+//
+// This class is the top level broker for requests from the compiler
+// to the VM.
+class JVMCIEnv : StackObj {
+  CI_PACKAGE_ACCESS_TO
+
+  friend class CompileBroker;
+  friend class Dependencies;  // for get_object, during logging
+
+public:
+
+  enum CodeInstallResult {
+     ok,
+     dependencies_failed,
+     dependencies_invalid,
+     cache_full,
+     code_too_large
+  };
+
+  // Look up a klass by name from a particular class loader (the accessor's).
+  // If require_local, result must be defined in that class loader, or NULL.
+  // If !require_local, a result from remote class loader may be reported,
+  // if sufficient class loader constraints exist such that initiating
+  // a class loading request from the given loader is bound to return
+  // the class defined in the remote loader (or throw an error).
+  //
+  // Return an unloaded klass if !require_local and no class at all is found.
+  //
+  // The CI treats a klass as loaded if it is consistently defined in
+  // another loader, even if it hasn't yet been loaded in all loaders
+  // that could potentially see it via delegation.
+  static KlassHandle get_klass_by_name(KlassHandle& accessing_klass,
+                             Symbol* klass_name,
+                             bool require_local);
+
+  // Constant pool access.
+  static KlassHandle   get_klass_by_index(constantPoolHandle& cpool,
+                                int klass_index,
+                                bool& is_accessible,
+                                KlassHandle& loading_klass);
+  static void   get_field_by_index(instanceKlassHandle& loading_klass, fieldDescriptor& fd,
+                                int field_index);
+  static methodHandle  get_method_by_index(constantPoolHandle& cpool,
+                                 int method_index, Bytecodes::Code bc,
+                                 instanceKlassHandle& loading_klass);
+
+  JVMCIEnv(CompileTask* task, int system_dictionary_modification_counter);
+
+private:
+  CompileTask*     _task;
+  int              _system_dictionary_modification_counter;
+
+  // Cache JVMTI state
+  bool  _jvmti_can_hotswap_or_post_breakpoint;
+  bool  _jvmti_can_access_local_variables;
+  bool  _jvmti_can_post_on_exceptions;
+
+  // Implementation methods for loading and constant pool access.
+  static KlassHandle get_klass_by_name_impl(KlassHandle& accessing_klass,
+                                  constantPoolHandle& cpool,
+                                  Symbol* klass_name,
+                                  bool require_local);
+  static KlassHandle   get_klass_by_index_impl(constantPoolHandle& cpool,
+                                     int klass_index,
+                                     bool& is_accessible,
+                                     KlassHandle& loading_klass);
+  static void   get_field_by_index_impl(instanceKlassHandle& loading_klass, fieldDescriptor& fd,
+                                     int field_index);
+  static methodHandle  get_method_by_index_impl(constantPoolHandle& cpool,
+                                      int method_index, Bytecodes::Code bc,
+                                      instanceKlassHandle& loading_klass);
+
+  // Helper methods
+  static bool       check_klass_accessibility(KlassHandle accessing_klass, KlassHandle resolved_klass);
+  static methodHandle  lookup_method(instanceKlassHandle&  accessor,
+                           instanceKlassHandle&  holder,
+                           Symbol*         name,
+                           Symbol*         sig,
+                           Bytecodes::Code bc);
+
+  private:
+
+  // Is this thread currently in the VM state?
+  static bool is_in_vm();
+
+  // Helper routine for determining the validity of a compilation
+  // with respect to concurrent class loading.
+  static JVMCIEnv::CodeInstallResult check_for_system_dictionary_modification(Dependencies* target, Handle compiled_code,
+                                                                              JVMCIEnv* env, char** failure_detail);
+
+public:
+  CompileTask* task() { return _task; }
+
+  // Register the result of a compilation.
+  static JVMCIEnv::CodeInstallResult register_method(
+                       methodHandle&             target,
+                       nmethod*&                 nm,
+                       int                       entry_bci,
+                       CodeOffsets*              offsets,
+                       int                       orig_pc_offset,
+                       CodeBuffer*               code_buffer,
+                       int                       frame_words,
+                       OopMapSet*                oop_map_set,
+                       ExceptionHandlerTable*    handler_table,
+                       AbstractCompiler*         compiler,
+                       DebugInformationRecorder* debug_info,
+                       Dependencies*             dependencies,
+                       JVMCIEnv*                 env,
+                       int                       compile_id,
+                       bool                      has_unsafe_access,
+                       Handle                    installed_code,
+                       Handle                    compiled_code,
+                       Handle                    speculation_log);
+
+  // converts the Klass* representing the holder of a method into a
+  // InstanceKlass*.  This is needed since the holder of a method in
+  // the bytecodes could be an array type.  Basically this converts
+  // array types into java/lang/Object and other types stay as they are.
+  static instanceKlassHandle get_instance_klass_for_declared_method_holder(KlassHandle& klass);
+};
+
+#endif // SHARE_VM_JVMCI_JVMCIENV_HPP
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/vm/jvmci/jvmciGlobals.cpp	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2000, 2010, 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.
+ *
+ */
+
+#include "precompiled.hpp"
+#include "jvmci/jvmciGlobals.hpp"
+
+JVMCI_FLAGS(MATERIALIZE_DEVELOPER_FLAG, MATERIALIZE_PD_DEVELOPER_FLAG, MATERIALIZE_PRODUCT_FLAG, MATERIALIZE_PD_PRODUCT_FLAG, MATERIALIZE_NOTPRODUCT_FLAG)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/vm/jvmci/jvmciGlobals.hpp	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,118 @@
+/*
+ * Copyright (c) 2000, 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.
+ *
+ */
+
+#ifndef SHARE_VM_JVMCI_JVMCIGLOBALS_HPP
+#define SHARE_VM_JVMCI_JVMCIGLOBALS_HPP
+
+#include "runtime/globals.hpp"
+#ifdef TARGET_ARCH_x86
+# include "jvmciGlobals_x86.hpp"
+#endif
+#ifdef TARGET_ARCH_sparc
+# include "jvmciGlobals_sparc.hpp"
+#endif
+#ifdef TARGET_ARCH_arm
+# include "jvmciGlobals_arm.hpp"
+#endif
+#ifdef TARGET_ARCH_ppc
+# include "jvmciGlobals_ppc.hpp"
+#endif
+
+//
+// Defines all global flags used by the JVMCI compiler. Only flags that need
+// to be accessible to the JVMCI C++ code should be defined here. All other
+// JVMCI flags should be defined in JVMCIOptions.java.
+//
+#define JVMCI_FLAGS(develop, develop_pd, product, product_pd, notproduct)   \
+                                                                            \
+  product(bool, DebugJVMCI, true,                                           \
+          "Enable JVMTI for the compiler thread")                           \
+                                                                            \
+  product(bool, UseJVMCIClassLoader, true,                                  \
+          "Load JVMCI classes with separate class loader")                  \
+                                                                            \
+  COMPILERJVMCI_PRESENT(product(bool, BootstrapJVMCI, true,                 \
+          "Bootstrap JVMCI before running Java main method"))               \
+                                                                            \
+  COMPILERJVMCI_PRESENT(product(bool, PrintBootstrap, true,                 \
+          "Print JVMCI bootstrap progress and summary"))                    \
+                                                                            \
+  COMPILERJVMCI_PRESENT(product(intx, JVMCIThreads, 1,                      \
+          "Force number of JVMCI compiler threads to use"))                 \
+                                                                            \
+  COMPILERJVMCI_PRESENT(product(intx, JVMCIHostThreads, 1,                  \
+          "Force number of compiler threads for JVMCI host compiler"))      \
+                                                                            \
+  JVMCI_ONLY(product(bool, CodeInstallSafepointChecks, true,                \
+          "Perform explicit safepoint checks while installing code"))       \
+                                                                            \
+  NOT_COMPILER2(product_pd(intx, MaxVectorSize,                                \
+          "Max vector size in bytes, "                                      \
+          "actual size could be less depending on elements type"))          \
+                                                                            \
+  product(intx, TraceJVMCI, 0,                                              \
+          "Trace level for JVMCI")                                          \
+                                                                            \
+  product(intx, JVMCICounterSize, 0,                                        \
+          "Reserved size for benchmark counters")                           \
+                                                                            \
+  product(bool, JVMCICountersExcludeCompiler, true,                         \
+          "Exclude JVMCI compiler threads from benchmark counters")         \
+                                                                            \
+  product(bool, JVMCIDeferredInitBarriers, true,                            \
+          "Defer write barriers of young objects")                          \
+                                                                            \
+  product(bool, JVMCIHProfEnabled, false,                                   \
+          "Is Heap  Profiler enabled")                                      \
+                                                                            \
+  product(bool, JVMCICompileWithC1Only, true,                               \
+          "Only compile JVMCI classes with C1")                             \
+                                                                            \
+  product(bool, JVMCICompileAppFirst, false,                                \
+          "Prioritize application compilations over JVMCI compilations")    \
+                                                                            \
+  develop(bool, JVMCIUseFastLocking, true,                                  \
+          "Use fast inlined locking code")                                  \
+                                                                            \
+  develop(bool, JVMCIUseFastNewTypeArray, true,                             \
+          "Use fast inlined type array allocation")                         \
+                                                                            \
+  develop(bool, JVMCIUseFastNewObjectArray, true,                           \
+          "Use fast inlined object array allocation")                       \
+                                                                            \
+  product(intx, JVMCINMethodSizeLimit, (80*K)*wordSize,                     \
+          "Maximum size of a compiled method.")                             \
+                                                                            \
+  notproduct(bool, JVMCIPrintSimpleStubs, false,                            \
+          "Print simple JVMCI stubs")                                       \
+                                                                            \
+  develop(bool, TraceUncollectedSpeculations, false,                        \
+          "Print message when a failed speculation was not collected")      \
+
+
+// Read default values for JVMCI globals
+
+JVMCI_FLAGS(DECLARE_DEVELOPER_FLAG, DECLARE_PD_DEVELOPER_FLAG, DECLARE_PRODUCT_FLAG, DECLARE_PD_PRODUCT_FLAG, DECLARE_NOTPRODUCT_FLAG)
+
+#endif // SHARE_VM_JVMCI_JVMCIGLOBALS_HPP
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/vm/jvmci/jvmciHashtable.cpp	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+#include "jvmci/jvmciHashtable.hpp"
+
+template<class K, class V> bool JVMCIHashtable<K,V>::add(V value, bool replace) {
+  K key = get_key(value);
+  unsigned int hash = compute_hash(key);
+  unsigned int index = hash_to_index(hash);
+  for (JVMCIHashtableEntry<V>* e = bucket(index); e != NULL; e = e->next()) {
+    if (key_equals(get_key(e->literal_addr()), key)) {
+      if (replace) {
+        e->set_literal(value);
+      }
+      return false;
+    }
+  }
+  JVMCIHashtableEntry<V>* e = new JVMCIHashtableEntry<V>(value);
+  e->set_next(_buckets[index]);
+  _buckets[index] = e;
+  ++_number_of_entries;
+  return true;
+}
+
+template<class K, class V> V* JVMCIHashtable<K,V>::get(K key) {
+  unsigned int index = index_for(key);
+  for (JVMCIHashtableEntry<V>* e = bucket(index); e != NULL; e = e->next()) {
+    if (key_equals(get_key(e->literal_addr()), key)) {
+      return e->literal_addr();
+    }
+  }
+  return NULL;
+}
+
+template<class K, class V> void JVMCIHashtable<K, V>::for_each(ValueClosure<V>* closure) {
+  for (size_t i = 0; i < table_size(); ++i) {
+    for (JVMCIHashtableEntry<V>* e = bucket(i); e != NULL && !closure->is_aborted(); e = e->next()) {
+      closure->do_value(e->literal_addr());
+    }
+  }
+}
+
+template<class K, class V> JVMCIHashtable<K,V>::~JVMCIHashtable() {
+  for (size_t i = 0; i < table_size(); ++i) {
+    JVMCIHashtableEntry<V>* e = bucket(i);
+    while (e != NULL) {
+      JVMCIHashtableEntry<V>* current = e;
+      e = e->next();
+      delete current;
+    }
+  }
+  FREE_C_HEAP_ARRAY(JVMCIHashtableEntry*, _buckets, mtCompiler);
+}
+
+// Instantiation
+#include "jvmci/jvmciOptions.hpp"
+template class JVMCIHashtable<const char*, OptionDesc>;
+template class JVMCIHashtable<const char*, OptionValue>;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/vm/jvmci/jvmciHashtable.hpp	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,137 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+#ifndef SHARE_VM_JVMCI_JVMCI_HASHTABLE_HPP
+#define SHARE_VM_JVMCI_JVMCI_HASHTABLE_HPP
+
+#include "memory/allocation.hpp"
+#include "memory/allocation.inline.hpp"
+
+// based on hashtable.hpp
+
+template <class T> class JVMCIHashtableEntry : public CHeapObj<mtCompiler> {
+  friend class VMStructs;
+private:
+  T               _literal;       // ref to item in table.
+  JVMCIHashtableEntry*  _next;          // Link to next element in the linked list for this bucket
+
+public:
+  JVMCIHashtableEntry(T literal) :  _literal(literal), _next(NULL) {}
+
+  T literal() {
+    return _literal;
+  }
+
+  void set_literal(T value) {
+    _literal = value;
+  }
+
+  T* literal_addr() {
+    return &_literal;
+  }
+
+  JVMCIHashtableEntry* next() const {
+    return _next;
+  }
+
+  void set_next(JVMCIHashtableEntry* next) {
+    _next = next;
+  }
+};
+
+template <class V>
+class ValueClosure : public StackObj {
+  bool _abort;
+protected:
+  void abort() { _abort = true; }
+public:
+  ValueClosure() : _abort(false) {}
+  virtual void do_value(V* value) = 0;
+  bool is_aborted() { return _abort; }
+};
+
+template <class K, class V> class JVMCIHashtable : public CHeapObj<mtCompiler> {
+  friend class VMStructs;
+private:
+  // Instance variables
+  unsigned int             _table_size;
+  JVMCIHashtableEntry<V>** _buckets;
+  unsigned int             _number_of_entries;
+
+public:
+  JVMCIHashtable(size_t size) : _table_size(size), _number_of_entries(0) {
+    _buckets = NEW_C_HEAP_ARRAY(JVMCIHashtableEntry<V>*, table_size(), mtCompiler);
+    for (size_t i = 0; i < table_size(); ++i) {
+      _buckets[i] = NULL;
+    }
+  }
+  virtual ~JVMCIHashtable();
+
+private:
+  // Bucket handling
+  unsigned int hash_to_index(unsigned int full_hash) {
+    unsigned int h = full_hash % _table_size;
+    assert(h >= 0 && h < _table_size, "Illegal hash value");
+    return h;
+  }
+
+  unsigned  int index_for(K key) {
+    return hash_to_index(compute_hash(key));
+  }
+
+  size_t entry_size() {
+    return sizeof(V);
+  }
+
+  size_t table_size() { return _table_size; }
+
+  JVMCIHashtableEntry<V>* bucket(unsigned int index) {
+    return _buckets[index];
+  }
+
+  bool add(V v, bool replace);
+
+protected:
+  virtual unsigned int compute_hash(K key) = 0;
+  virtual bool key_equals(K k1, K k2) = 0;
+  virtual K get_key(V value) = 0;
+  virtual K get_key(V* value) = 0;
+
+public:
+  /**
+   * Tries to insert the value in the hash table. Returns false if an entry with the same key already exists.
+   * In this case it does *not* replace the existing entry.
+   */
+  bool add(V v) { return add(v, false); }
+  /**
+   * Inserts the value in the hash table. Returns false if an entry with the same key already exists.
+   * In this case it replaces the existing entry.
+   */
+  bool put(V v) { return add(v, true); }
+  V* get(K k);
+  void for_each(ValueClosure<V>* closure);
+  int number_of_entries() { return _number_of_entries; }
+
+};
+
+#endif // SHARE_VM_JVMCI_JVMCI_HASHTABLE_HPP
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/vm/jvmci/jvmciJavaAccess.cpp	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,85 @@
+/*
+ * 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.
+ */
+
+#include "precompiled.hpp"
+#include "jvmci/jvmciJavaAccess.hpp"
+#include "runtime/jniHandles.hpp"
+#include "classfile/symbolTable.hpp"
+// This function is similar to javaClasses.cpp, it computes the field offset of a (static or instance) field.
+// It looks up the name and signature symbols without creating new ones, all the symbols of these classes need to be already loaded.
+
+void compute_offset(int &dest_offset, Klass* klass, const char* name, const char* signature, bool static_field) {
+  InstanceKlass* ik = InstanceKlass::cast(klass);
+  Symbol* name_symbol = SymbolTable::probe(name, (int)strlen(name));
+  Symbol* signature_symbol = SymbolTable::probe(signature, (int)strlen(signature));
+  if (name_symbol == NULL || signature_symbol == NULL) {
+#ifndef PRODUCT
+    ik->print_on(tty);
+#endif
+    guarantee(false, err_msg("symbol with name %s and signature %s was not found in symbol table (klass=%s)", name, signature, klass->name()->as_C_string()));
+  }
+
+  fieldDescriptor fd;
+  if (!ik->find_field(name_symbol, signature_symbol, &fd)) {
+    ResourceMark rm;
+    fatal(err_msg("Invalid layout of %s at %s", name_symbol->as_C_string(), ik->external_name()));
+  }
+  guarantee(fd.is_static() == static_field, "static/instance mismatch");
+  dest_offset = fd.offset();
+}
+
+// This piece of macro magic creates the contents of the jvmci_compute_offsets method that initializes the field indices of all the access classes.
+
+#define START_CLASS(name) { Klass* k = SystemDictionary::name##_klass(); assert(k != NULL, "Could not find class " #name "");
+
+#define END_CLASS }
+
+#define FIELD(klass, name, signature, static_field) compute_offset(klass::_##name##_offset, k, #name, signature, static_field);
+#define CHAR_FIELD(klass, name) FIELD(klass, name, "C", false)
+#define INT_FIELD(klass, name) FIELD(klass, name, "I", false)
+#define BOOLEAN_FIELD(klass, name) FIELD(klass, name, "Z", false)
+#define LONG_FIELD(klass, name) FIELD(klass, name, "J", false)
+#define FLOAT_FIELD(klass, name) FIELD(klass, name, "F", false)
+#define OOP_FIELD(klass, name, signature) FIELD(klass, name, signature, false)
+#define STATIC_OOP_FIELD(klass, name, signature) FIELD(klass, name, signature, true)
+#define STATIC_INT_FIELD(klass, name) FIELD(klass, name, "I", true)
+#define STATIC_BOOLEAN_FIELD(klass, name) FIELD(klass, name, "Z", true)
+
+
+void jvmci_compute_offsets() {
+  COMPILER_CLASSES_DO(START_CLASS, END_CLASS, CHAR_FIELD, INT_FIELD, BOOLEAN_FIELD, LONG_FIELD, FLOAT_FIELD, OOP_FIELD, OOP_FIELD, OOP_FIELD, STATIC_OOP_FIELD, STATIC_INT_FIELD, STATIC_BOOLEAN_FIELD)
+  guarantee(InstalledCode::_address_offset == sizeof(oopDesc), "codeBlob must be first field!");
+}
+
+#define EMPTY0
+#define EMPTY1(x)
+#define EMPTY2(x,y)
+#define FIELD2(klass, name) int klass::_##name##_offset = 0;
+#define FIELD3(klass, name, sig) FIELD2(klass, name)
+
+COMPILER_CLASSES_DO(EMPTY1, EMPTY0, FIELD2, FIELD2, FIELD2, FIELD2, FIELD2, FIELD3, FIELD3, FIELD3, FIELD3, FIELD2, FIELD2)
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/vm/jvmci/jvmciJavaAccess.hpp	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,354 @@
+/*
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+#ifndef SHARE_VM_JVMCI_JVMCI_JAVA_ACCESS_HPP
+#define SHARE_VM_JVMCI_JVMCI_JAVA_ACCESS_HPP
+
+void jvmci_compute_offsets();
+
+#include "classfile/systemDictionary.hpp"
+#include "oops/instanceMirrorKlass.hpp"
+
+/* This macro defines the structure of the CompilationResult - classes.
+ * It will generate classes with accessors similar to javaClasses.hpp, but with specializations for oops, Handles and jni handles.
+ *
+ * The public interface of these classes will look like this:
+
+ * class StackSlot : AllStatic {
+ * public:
+ *   static Klass* klass();
+ *   static jint  index(oop obj);
+ *   static jint  index(Handle obj);
+ *   static jint  index(jobject obj);
+ *   static void set_index(oop obj, jint x);
+ *   static void set_index(Handle obj, jint x);
+ *   static void set_index(jobject obj, jint x);
+ * };
+ *
+ */
+
+#define COMPILER_CLASSES_DO(start_class, end_class, char_field, int_field, boolean_field, long_field, float_field, oop_field, typeArrayOop_field, objArrayOop_field, static_oop_field, static_int_field, static_boolean_field) \
+  start_class(HotSpotResolvedObjectTypeImpl)                                                                                                                   \
+    oop_field(HotSpotResolvedObjectTypeImpl, javaClass, "Ljava/lang/Class;")                                                                                   \
+  end_class                                                                                                                                                    \
+  start_class(HotSpotResolvedJavaMethodImpl)                                                                                                                   \
+    long_field(HotSpotResolvedJavaMethodImpl, metaspaceMethod)                                                                                                 \
+  end_class                                                                                                                                                    \
+  start_class(InstalledCode)                                                                                                                                   \
+    long_field(InstalledCode, address)                                                                                                                         \
+    long_field(InstalledCode, version)                                                                                                                         \
+    oop_field(InstalledCode, name, "Ljava/lang/String;")                                                                                                       \
+  end_class                                                                                                                                                    \
+  start_class(HotSpotInstalledCode)                                                                                                                            \
+    int_field(HotSpotInstalledCode, size)                                                                                                                      \
+    long_field(HotSpotInstalledCode, codeStart)                                                                                                                \
+    int_field(HotSpotInstalledCode, codeSize)                                                                                                                  \
+  end_class                                                                                                                                                    \
+  start_class(HotSpotNmethod)                                                                                                                                  \
+    boolean_field(HotSpotNmethod, isDefault)                                                                                                                   \
+  end_class                                                                                                                                                    \
+  start_class(HotSpotCompiledCode)                                                                                                                             \
+    oop_field(HotSpotCompiledCode, name, "Ljava/lang/String;")                                                                                                 \
+    objArrayOop_field(HotSpotCompiledCode, sites, "[Lcom/oracle/jvmci/code/CompilationResult$Site;")                                                           \
+    objArrayOop_field(HotSpotCompiledCode, exceptionHandlers, "[Lcom/oracle/jvmci/code/CompilationResult$ExceptionHandler;")                                   \
+    objArrayOop_field(HotSpotCompiledCode, comments, "[Lcom/oracle/jvmci/hotspot/HotSpotCompiledCode$Comment;")                                                \
+    objArrayOop_field(HotSpotCompiledCode, assumptions, "[Lcom/oracle/jvmci/meta/Assumptions$Assumption;")                                                     \
+    typeArrayOop_field(HotSpotCompiledCode, targetCode, "[B")                                                                                                  \
+    int_field(HotSpotCompiledCode, targetCodeSize)                                                                                                             \
+    typeArrayOop_field(HotSpotCompiledCode, dataSection, "[B")                                                                                                 \
+    int_field(HotSpotCompiledCode, dataSectionAlignment)                                                                                                       \
+    objArrayOop_field(HotSpotCompiledCode, dataSectionPatches, "[Lcom/oracle/jvmci/code/CompilationResult$DataPatch;")                                         \
+    int_field(HotSpotCompiledCode, totalFrameSize)                                                                                                             \
+    int_field(HotSpotCompiledCode, customStackAreaOffset)                                                                                                      \
+    objArrayOop_field(HotSpotCompiledCode, methods, "[Lcom/oracle/jvmci/meta/ResolvedJavaMethod;")                                                             \
+  end_class                                                                                                                                                    \
+  start_class(HotSpotCompiledCode_Comment)                                                                                                                     \
+    oop_field(HotSpotCompiledCode_Comment, text, "Ljava/lang/String;")                                                                                         \
+    int_field(HotSpotCompiledCode_Comment, pcOffset)                                                                                                           \
+  end_class                                                                                                                                                    \
+  start_class(HotSpotCompiledNmethod)                                                                                                                          \
+    oop_field(HotSpotCompiledNmethod, method, "Lcom/oracle/jvmci/hotspot/HotSpotResolvedJavaMethod;")                                                          \
+    oop_field(HotSpotCompiledNmethod, installationFailureMessage, "Ljava/lang/String;")                                                                        \
+    int_field(HotSpotCompiledNmethod, entryBCI)                                                                                                                \
+    int_field(HotSpotCompiledNmethod, id)                                                                                                                      \
+    long_field(HotSpotCompiledNmethod, jvmciEnv)                                                                                                               \
+  end_class                                                                                                                                                    \
+  start_class(HotSpotForeignCallTarget)                                                                                                                        \
+    long_field(HotSpotForeignCallTarget, address)                                                                                                              \
+  end_class                                                                                                                                                    \
+  start_class(Assumptions_NoFinalizableSubclass)                                                                                                               \
+    oop_field(Assumptions_NoFinalizableSubclass, receiverType, "Lcom/oracle/jvmci/meta/ResolvedJavaType;")                                                     \
+  end_class                                                                                                                                                    \
+  start_class(Assumptions_ConcreteSubtype)                                                                                                                     \
+    oop_field(Assumptions_ConcreteSubtype, context, "Lcom/oracle/jvmci/meta/ResolvedJavaType;")                                                                \
+    oop_field(Assumptions_ConcreteSubtype, subtype, "Lcom/oracle/jvmci/meta/ResolvedJavaType;")                                                                \
+  end_class                                                                                                                                                    \
+  start_class(Assumptions_LeafType)                                                                                                                            \
+    oop_field(Assumptions_LeafType, context, "Lcom/oracle/jvmci/meta/ResolvedJavaType;")                                                                       \
+  end_class                                                                                                                                                    \
+  start_class(Assumptions_ConcreteMethod)                                                                                                                      \
+    oop_field(Assumptions_ConcreteMethod, method, "Lcom/oracle/jvmci/meta/ResolvedJavaMethod;")                                                                \
+    oop_field(Assumptions_ConcreteMethod, context, "Lcom/oracle/jvmci/meta/ResolvedJavaType;")                                                                 \
+    oop_field(Assumptions_ConcreteMethod, impl, "Lcom/oracle/jvmci/meta/ResolvedJavaMethod;")                                                                  \
+  end_class                                                                                                                                                    \
+  start_class(Assumptions_CallSiteTargetValue)                                                                                                                 \
+    oop_field(Assumptions_CallSiteTargetValue, callSite, "Ljava/lang/invoke/CallSite;")                                                                        \
+    oop_field(Assumptions_CallSiteTargetValue, methodHandle, "Ljava/lang/invoke/MethodHandle;")                                                                \
+  end_class                                                                                                                                                    \
+  start_class(CompilationResult_Site)                                                                                                                          \
+    int_field(CompilationResult_Site, pcOffset)                                                                                                                \
+  end_class                                                                                                                                                    \
+  start_class(CompilationResult_Call)                                                                                                                          \
+    oop_field(CompilationResult_Call, target, "Lcom/oracle/jvmci/meta/InvokeTarget;")                                                                          \
+    oop_field(CompilationResult_Call, debugInfo, "Lcom/oracle/jvmci/code/DebugInfo;")                                                                          \
+  end_class                                                                                                                                                    \
+  start_class(CompilationResult_DataPatch)                                                                                                                     \
+    oop_field(CompilationResult_DataPatch, reference, "Lcom/oracle/jvmci/code/CompilationResult$Reference;")                                                   \
+  end_class                                                                                                                                                    \
+  start_class(CompilationResult_ConstantReference)                                                                                                             \
+    oop_field(CompilationResult_ConstantReference, constant, "Lcom/oracle/jvmci/meta/VMConstant;")                                                             \
+  end_class                                                                                                                                                    \
+  start_class(CompilationResult_DataSectionReference)                                                                                                          \
+    int_field(CompilationResult_DataSectionReference, offset)                                                                                                  \
+  end_class                                                                                                                                                    \
+  start_class(InfopointReason)                                                                                                                                 \
+    static_oop_field(InfopointReason, UNKNOWN, "Lcom/oracle/jvmci/code/InfopointReason;")                                                                      \
+    static_oop_field(InfopointReason, SAFEPOINT, "Lcom/oracle/jvmci/code/InfopointReason;")                                                                    \
+    static_oop_field(InfopointReason, CALL, "Lcom/oracle/jvmci/code/InfopointReason;")                                                                         \
+    static_oop_field(InfopointReason, IMPLICIT_EXCEPTION, "Lcom/oracle/jvmci/code/InfopointReason;")                                                           \
+    static_oop_field(InfopointReason, METHOD_START, "Lcom/oracle/jvmci/code/InfopointReason;")                                                                 \
+    static_oop_field(InfopointReason, METHOD_END, "Lcom/oracle/jvmci/code/InfopointReason;")                                                                   \
+    static_oop_field(InfopointReason, LINE_NUMBER, "Lcom/oracle/jvmci/code/InfopointReason;")                                                                  \
+  end_class                                                                                                                                                    \
+  start_class(CompilationResult_Infopoint)                                                                                                                     \
+    oop_field(CompilationResult_Infopoint, debugInfo, "Lcom/oracle/jvmci/code/DebugInfo;")                                                                     \
+    oop_field(CompilationResult_Infopoint, reason, "Lcom/oracle/jvmci/code/InfopointReason;")                                                                  \
+  end_class                                                                                                                                                    \
+  start_class(CompilationResult_ExceptionHandler)                                                                                                              \
+    int_field(CompilationResult_ExceptionHandler, handlerPos)                                                                                                  \
+  end_class                                                                                                                                                    \
+  start_class(CompilationResult_Mark)                                                                                                                          \
+    oop_field(CompilationResult_Mark, id, "Ljava/lang/Object;")                                                                                                \
+  end_class                                                                                                                                                    \
+  start_class(DebugInfo)                                                                                                                                       \
+    oop_field(DebugInfo, bytecodePosition, "Lcom/oracle/jvmci/code/BytecodePosition;")                                                                         \
+    oop_field(DebugInfo, referenceMap, "Lcom/oracle/jvmci/code/ReferenceMap;")                                                                                 \
+    oop_field(DebugInfo, calleeSaveInfo, "Lcom/oracle/jvmci/code/RegisterSaveLayout;")                                                                         \
+    objArrayOop_field(DebugInfo, virtualObjectMapping, "[Lcom/oracle/jvmci/meta/Value;")                                                                       \
+  end_class                                                                                                                                                    \
+  start_class(HotSpotReferenceMap)                                                                                                                             \
+    oop_field(HotSpotReferenceMap, registerRefMap, "Lcom/oracle/jvmci/hotspot/HotSpotReferenceMap$HotSpotOopMap;")                                             \
+    oop_field(HotSpotReferenceMap, frameRefMap, "Lcom/oracle/jvmci/hotspot/HotSpotReferenceMap$HotSpotOopMap;")                                                \
+  end_class                                                                                                                                                    \
+  start_class(RegisterSaveLayout)                                                                                                                              \
+    objArrayOop_field(RegisterSaveLayout, registers, "[Lcom/oracle/jvmci/code/Register;")                                                                      \
+    typeArrayOop_field(RegisterSaveLayout, slots, "[I")                                                                                                        \
+  end_class                                                                                                                                                    \
+  start_class(HotSpotOopMap)                                                                                                                                   \
+    typeArrayOop_field(HotSpotOopMap, words, "[J")                                                                                                             \
+  end_class                                                                                                                                                    \
+  start_class(BytecodeFrame)                                                                                                                                   \
+    objArrayOop_field(BytecodeFrame, values, "[Lcom/oracle/jvmci/meta/Value;")                                                                                 \
+    int_field(BytecodeFrame, numLocals)                                                                                                                        \
+    int_field(BytecodeFrame, numStack)                                                                                                                         \
+    int_field(BytecodeFrame, numLocks)                                                                                                                         \
+    boolean_field(BytecodeFrame, rethrowException)                                                                                                             \
+    boolean_field(BytecodeFrame, duringCall)                                                                                                                   \
+    static_int_field(BytecodeFrame, BEFORE_BCI)                                                                                                                \
+  end_class                                                                                                                                                    \
+  start_class(BytecodePosition)                                                                                                                                \
+    oop_field(BytecodePosition, caller, "Lcom/oracle/jvmci/code/BytecodePosition;")                                                                            \
+    oop_field(BytecodePosition, method, "Lcom/oracle/jvmci/meta/ResolvedJavaMethod;")                                                                          \
+    int_field(BytecodePosition, bci)                                                                                                                           \
+  end_class                                                                                                                                                    \
+  start_class(JavaConstant)                                                                                                                                    \
+  end_class                                                                                                                                                    \
+  start_class(PrimitiveConstant)                                                                                                                               \
+    long_field(PrimitiveConstant, primitive)                                                                                                                   \
+  end_class                                                                                                                                                    \
+  start_class(RawConstant)                                                                                                                                     \
+    long_field(RawConstant, primitive)                                                                                                                         \
+  end_class                                                                                                                                                    \
+  start_class(NullConstant)                                                                                                                                    \
+  end_class                                                                                                                                                    \
+  start_class(HotSpotCompressedNullConstant)                                                                                                                   \
+  end_class                                                                                                                                                    \
+  start_class(HotSpotObjectConstantImpl)                                                                                                                       \
+    oop_field(HotSpotObjectConstantImpl, object, "Ljava/lang/Object;")                                                                                         \
+    boolean_field(HotSpotObjectConstantImpl, compressed)                                                                                                       \
+  end_class                                                                                                                                                    \
+  start_class(HotSpotMetaspaceConstantImpl)                                                                                                                    \
+    long_field(HotSpotMetaspaceConstantImpl, primitive)                                                                                                        \
+    oop_field(HotSpotMetaspaceConstantImpl, metaspaceObject, "Ljava/lang/Object;")                                                                             \
+    boolean_field(HotSpotMetaspaceConstantImpl, compressed)                                                                                                    \
+  end_class                                                                                                                                                    \
+  start_class(Kind)                                                                                                                                            \
+    char_field(Kind, typeChar)                                                                                                                                 \
+    static_oop_field(Kind, Boolean, "Lcom/oracle/jvmci/meta/Kind;");                                                                                           \
+    static_oop_field(Kind, Byte, "Lcom/oracle/jvmci/meta/Kind;");                                                                                              \
+    static_oop_field(Kind, Char, "Lcom/oracle/jvmci/meta/Kind;");                                                                                              \
+    static_oop_field(Kind, Short, "Lcom/oracle/jvmci/meta/Kind;");                                                                                             \
+    static_oop_field(Kind, Int, "Lcom/oracle/jvmci/meta/Kind;");                                                                                               \
+    static_oop_field(Kind, Long, "Lcom/oracle/jvmci/meta/Kind;");                                                                                              \
+  end_class                                                                                                                                                    \
+  start_class(LIRKind)                                                                                                                                         \
+    oop_field(LIRKind, platformKind, "Lcom/oracle/jvmci/meta/PlatformKind;")                                                                                   \
+    int_field(LIRKind, referenceMask)                                                                                                                          \
+  end_class                                                                                                                                                    \
+  start_class(AbstractValue)                                                                                                                                   \
+    oop_field(AbstractValue, kind, "Lcom/oracle/jvmci/meta/Kind;")                                                                                             \
+    oop_field(AbstractValue, lirKind, "Lcom/oracle/jvmci/meta/LIRKind;")                                                                                       \
+    static_oop_field(AbstractValue, ILLEGAL, "Lcom/oracle/jvmci/meta/AllocatableValue;");                                                                      \
+  end_class                                                                                                                                                    \
+  start_class(RegisterValue)                                                                                                                                   \
+    oop_field(RegisterValue, reg, "Lcom/oracle/jvmci/code/Register;")                                                                                          \
+  end_class                                                                                                                                                    \
+  start_class(RegisterCategory)                                                                                                                                \
+    oop_field(RegisterCategory, name, "Ljava/lang/String;")                                                                                                    \
+    int_field(RegisterCategory, referenceMapOffset)                                                                                                            \
+    int_field(RegisterCategory, referenceMapShift)                                                                                                             \
+  end_class                                                                                                                                                    \
+  start_class(code_Register)                                                                                                                                   \
+    int_field(code_Register, number)                                                                                                                           \
+    int_field(code_Register, encoding)                                                                                                                         \
+    oop_field(code_Register, registerCategory, "Lcom/oracle/jvmci/code/Register$RegisterCategory;")                                                            \
+  end_class                                                                                                                                                    \
+  start_class(StackSlot)                                                                                                                                       \
+    int_field(StackSlot, offset)                                                                                                                               \
+    boolean_field(StackSlot, addFrameSize)                                                                                                                     \
+  end_class                                                                                                                                                    \
+  start_class(VirtualObject)                                                                                                                                   \
+    int_field(VirtualObject, id)                                                                                                                               \
+    oop_field(VirtualObject, type, "Lcom/oracle/jvmci/meta/ResolvedJavaType;")                                                                                 \
+    objArrayOop_field(VirtualObject, values, "[Lcom/oracle/jvmci/meta/Value;")                                                                                 \
+  end_class                                                                                                                                                    \
+  start_class(StackLockValue)                                                                                                                                  \
+    oop_field(StackLockValue, owner, "Lcom/oracle/jvmci/meta/Value;")                                                                                          \
+    oop_field(StackLockValue, slot, "Lcom/oracle/jvmci/code/StackSlotValue;")                                                                                  \
+    boolean_field(StackLockValue, eliminated)                                                                                                                  \
+  end_class                                                                                                                                                    \
+  start_class(SpeculationLog)                                                                                                                                  \
+    oop_field(SpeculationLog, lastFailed, "Ljava/lang/Object;")                                                                                                \
+  end_class                                                                                                                                                    \
+  start_class(HotSpotStackFrameReference)                                                                                                                      \
+    oop_field(HotSpotStackFrameReference, compilerToVM, "Lcom/oracle/jvmci/hotspot/CompilerToVM;")                                                             \
+    long_field(HotSpotStackFrameReference, stackPointer)                                                                                                       \
+    int_field(HotSpotStackFrameReference, frameNumber)                                                                                                         \
+    int_field(HotSpotStackFrameReference, bci)                                                                                                                 \
+    long_field(HotSpotStackFrameReference, metaspaceMethod)                                                                                                    \
+    objArrayOop_field(HotSpotStackFrameReference, locals, "[Ljava/lang/Object;")                                                                               \
+    typeArrayOop_field(HotSpotStackFrameReference, localIsVirtual, "[Z")                                                                                       \
+  end_class                                                                                                                                                    \
+  start_class(Debug)                                                                                                                                           \
+    static_boolean_field(Debug, ENABLED)                                                                                                                       \
+  end_class                                                                                                                                                    \
+  /* end*/
+
+#define START_CLASS(name)                                                                                                                                      \
+class name : AllStatic {                                                                                                                                       \
+  private:                                                                                                                                                     \
+    friend class JVMCICompiler;                                                                                                                                \
+    static void check(oop obj, const char* field_name) {                                                                                                       \
+        assert(obj != NULL, err_msg("NULL field access of %s.%s", #name, field_name));                                                                         \
+        assert(obj->is_a(SystemDictionary::name##_klass()), "wrong class, " #name " expected");                                                                \
+    }                                                                                                                                                          \
+    static void compute_offsets();                                                                                                                             \
+  public:                                                                                                                                                      \
+    static Klass* klass() { return SystemDictionary::name##_klass(); }
+
+#define END_CLASS };
+
+#define FIELD(name, type, accessor, cast)                                                                                                                         \
+    static int _##name##_offset;                                                                                                                                  \
+    static type name(oop obj)                   { check(obj, #name); return cast obj->accessor(_##name##_offset); }                                               \
+    static type name(Handle& obj)                { check(obj(), #name); return cast obj->accessor(_##name##_offset); }                                            \
+    static type name(jobject obj)               { check(JNIHandles::resolve(obj), #name); return cast JNIHandles::resolve(obj)->accessor(_##name##_offset); }     \
+    static void set_##name(oop obj, type x)     { check(obj, #name); obj->accessor##_put(_##name##_offset, x); }                                                  \
+    static void set_##name(Handle& obj, type x)  { check(obj(), #name); obj->accessor##_put(_##name##_offset, x); }                                               \
+    static void set_##name(jobject obj, type x) { check(JNIHandles::resolve(obj), #name); JNIHandles::resolve(obj)->accessor##_put(_##name##_offset, x); }
+
+#define EMPTY_CAST 
+#define CHAR_FIELD(klass, name) FIELD(name, jchar, char_field, EMPTY_CAST)
+#define INT_FIELD(klass, name) FIELD(name, jint, int_field, EMPTY_CAST)
+#define BOOLEAN_FIELD(klass, name) FIELD(name, jboolean, bool_field, EMPTY_CAST)
+#define LONG_FIELD(klass, name) FIELD(name, jlong, long_field, EMPTY_CAST)
+#define FLOAT_FIELD(klass, name) FIELD(name, jfloat, float_field, EMPTY_CAST)
+#define OOP_FIELD(klass, name, signature) FIELD(name, oop, obj_field, EMPTY_CAST)
+#define OBJARRAYOOP_FIELD(klass, name, signature) FIELD(name, objArrayOop, obj_field, (objArrayOop))
+#define TYPEARRAYOOP_FIELD(klass, name, signature) FIELD(name, typeArrayOop, obj_field, (typeArrayOop))
+#define STATIC_OOP_FIELD(klassName, name, signature)                                                           \
+    static int _##name##_offset;                                                                               \
+    static oop name() {                                                                                        \
+      InstanceKlass* ik = InstanceKlass::cast(klassName::klass());                                             \
+      address addr = ik->static_field_addr(_##name##_offset - InstanceMirrorKlass::offset_of_static_fields()); \
+      if (UseCompressedOops) {                                                                                 \
+        return oopDesc::load_decode_heap_oop((narrowOop *)addr);                                               \
+      } else {                                                                                                 \
+        return oopDesc::load_decode_heap_oop((oop*)addr);                                                      \
+      }                                                                                                        \
+    }                                                                                                          \
+    static void set_##name(oop x) {                                                                            \
+      InstanceKlass* ik = InstanceKlass::cast(klassName::klass());                                             \
+      address addr = ik->static_field_addr(_##name##_offset - InstanceMirrorKlass::offset_of_static_fields()); \
+      if (UseCompressedOops) {                                                                                 \
+        oop_store((narrowOop *)addr, x);                                                                       \
+      } else {                                                                                                 \
+        oop_store((oop*)addr, x);                                                                              \
+      }                                                                                                        \
+    }
+#define STATIC_PRIMITIVE_FIELD(klassName, name, jtypename)                                                     \
+    static int _##name##_offset;                                                                               \
+    static jtypename name() {                                                                                  \
+      InstanceKlass* ik = InstanceKlass::cast(klassName::klass());                                             \
+      address addr = ik->static_field_addr(_##name##_offset - InstanceMirrorKlass::offset_of_static_fields()); \
+      return *((jtypename *)addr);                                                                             \
+    }                                                                                                          \
+    static void set_##name(jtypename x) {                                                                      \
+      InstanceKlass* ik = InstanceKlass::cast(klassName::klass());                                             \
+      address addr = ik->static_field_addr(_##name##_offset - InstanceMirrorKlass::offset_of_static_fields()); \
+      *((jtypename *)addr) = x;                                                                                \
+    }
+
+#define STATIC_INT_FIELD(klassName, name) STATIC_PRIMITIVE_FIELD(klassName, name, jint)
+#define STATIC_BOOLEAN_FIELD(klassName, name) STATIC_PRIMITIVE_FIELD(klassName, name, jboolean)
+
+COMPILER_CLASSES_DO(START_CLASS, END_CLASS, CHAR_FIELD, INT_FIELD, BOOLEAN_FIELD, LONG_FIELD, FLOAT_FIELD, OOP_FIELD, TYPEARRAYOOP_FIELD, OBJARRAYOOP_FIELD, STATIC_OOP_FIELD, STATIC_INT_FIELD, STATIC_BOOLEAN_FIELD)
+#undef START_CLASS
+#undef END_CLASS
+#undef FIELD
+#undef CHAR_FIELD
+#undef INT_FIELD
+#undef BOOLEAN_FIELD
+#undef LONG_FIELD
+#undef FLOAT_FIELD
+#undef OOP_FIELD
+#undef TYPEARRAYOOP_FIELD
+#undef OBJARRAYOOP_FIELD
+#undef STATIC_OOP_FIELD
+#undef STATIC_INT_FIELD
+#undef STATIC_BOOLEAN_FIELD
+#undef EMPTY_CAST
+
+void compute_offset(int &dest_offset, Klass* klass, const char* name, const char* signature, bool static_field);
+
+#endif // SHARE_VM_JVMCI_JVMCI_JAVA_ACCESS_HPP
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/vm/jvmci/jvmciOptions.cpp	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,241 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+#include "precompiled.hpp"
+#include "jvmci/jvmciOptions.hpp"
+#include "jvmci/jvmciRuntime.hpp"
+#include "runtime/arguments.hpp"
+#include "utilities/hashtable.inline.hpp"
+
+class OptionsParseClosure : public ParseClosure {
+  OptionsTable* _table;
+public:
+  OptionsParseClosure(OptionsTable* table) : _table(table) {}
+  void do_line(char* line) {
+    char* idx = strchr(line, '\t');
+    if (idx == NULL) {
+      warn_and_abort("invalid format: could not find first tab");
+      return;
+    }
+    *idx = '\0';
+    char* name = line;
+    line = idx + 1;
+    idx = strchr(line, '\t');
+    if (idx == NULL) {
+      warn_and_abort("invalid format: could not find second tab");
+      return;
+    }
+    *idx = '\0';
+    if (strlen(line) != 1) {
+      warn_and_abort("invalid format: type should be 1 char long");
+      return;
+    }
+    char typeChar = *line;
+    line = idx + 1;
+    idx = strchr(line, '\t');
+    if (idx == NULL) {
+      warn_and_abort("invalid format: could not find third tab");
+      return;
+    }
+    *idx = '\0';
+    char* help = line;
+    line = idx + 1;
+    idx = strchr(line, '\t');
+    if (idx == NULL) {
+      warn_and_abort("invalid format: could not find fourth tab");
+      return;
+    }
+    *idx = '\0';
+    char* declaringClass = line;
+    line = idx + 1;
+    char* fieldClass = line;
+    OptionType type;
+    switch(typeChar) {
+      case 's':
+        type = _string;
+        break;
+      case 'i':
+        type = _int;
+        break;
+      case 'j':
+        type = _long;
+        break;
+      case 'f':
+        type = _float;
+        break;
+      case 'd':
+        type = _double;
+        break;
+      case 'z':
+        type = _boolean;
+        break;
+      default:
+        warn_and_abort("unkown type");
+        return;
+    }
+    char* name2 = NEW_C_HEAP_ARRAY(char, (strlen(name) + 1 + strlen(help) + 1 + strlen(declaringClass) + 1 + strlen(fieldClass) + 1), mtCompiler);
+    char* help2 = name2 + strlen(name) + 1;
+    char* declaringClass2 = help2 + strlen(help) + 1;
+    char* fieldClass2 = declaringClass2 + strlen(declaringClass) + 1;
+    strcpy(name2, name);
+    strcpy(help2, help);
+    strcpy(declaringClass2, declaringClass);
+    strcpy(fieldClass2, fieldClass);
+    OptionDesc desc = {name2, help2, type, declaringClass2, fieldClass2};
+    if (!_table->add(desc)) {
+      warn_and_abort("duplicate option");
+      return;
+    }
+  }
+};
+
+class FreeNamesClosure : public ValueClosure<OptionDesc> {
+  void do_value(OptionDesc* desc) {
+    FREE_C_HEAP_ARRAY(char, desc->name, mtCompiler);
+  }
+};
+
+OptionsTable::~OptionsTable() {
+  FreeNamesClosure closure;
+  for_each(&closure);
+}
+
+OptionsTable* OptionsTable::load_options() {
+  OptionsTable* table = new OptionsTable();
+  // Add PrintFlags option manually
+  OptionDesc printFlagsDesc;
+  printFlagsDesc.name = PRINT_FLAGS_ARG;
+  printFlagsDesc.type = _boolean;
+  printFlagsDesc.help = PRINT_FLAGS_HELP;
+  printFlagsDesc.declaringClass = NULL;
+  printFlagsDesc.fieldClass = NULL;
+  table->add(printFlagsDesc);
+
+  char optionsDir[JVM_MAXPATHLEN];
+  const char* fileSep = os::file_separator();
+  jio_snprintf(optionsDir, sizeof(optionsDir), "%s%slib%sjvmci%soptions",
+               Arguments::get_java_home(), fileSep, fileSep, fileSep);
+  DIR* dir = os::opendir(optionsDir);
+  if (dir != NULL) {
+    struct dirent *entry;
+    char *dbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(optionsDir), mtInternal);
+    OptionsParseClosure closure(table);
+    while ((entry = os::readdir(dir, (dirent *) dbuf)) != NULL && !closure.is_aborted()) {
+      const char* name = entry->d_name;
+      char optionFilePath[JVM_MAXPATHLEN];
+      jio_snprintf(optionFilePath, sizeof(optionFilePath), "%s%s%s",optionsDir, fileSep, name);
+      JVMCIRuntime::parse_lines(optionFilePath, &closure, false);
+    }
+    FREE_C_HEAP_ARRAY(char, dbuf, mtInternal);
+    os::closedir(dir);
+    if (closure.is_aborted()) {
+      delete table;
+      return NULL;
+    }
+    return table;
+  }
+  // TODO(gd) should this be silent?
+  warning("Could not open jvmci options directory (%s)",optionsDir);
+  return table;
+}
+
+OptionDesc* OptionsTable::get(const char* name, size_t arglen) {
+  char nameOnly[256];
+  guarantee(arglen < 256, "Max supported option name len is 256");
+  strncpy(nameOnly, name, arglen);
+  nameOnly[arglen] = '\0';
+  return JVMCIHashtable<const char*, OptionDesc>::get(nameOnly);
+}
+
+// Compute string similarity based on Dice's coefficient
+static float str_similar(const char* str1, const char* str2) {
+  size_t len1 = strlen(str1);
+  size_t len2 = strlen(str2);
+
+  if (len1 == 0 || len2 == 0) {
+    return 0;
+  }
+
+  int hits = 0;
+  for (size_t i = 0; i < len1 - 1; ++i) {
+    for (size_t j = 0; j < len2 -1; ++j) {
+      if ((str1[i] == str2[j]) && (str1[i+1] == str2[j+1])) {
+        ++hits;
+        break;
+      }
+    }
+  }
+
+  size_t total = len1 + len2;
+  return 2.0f * (float) hits / (float) total;
+}
+
+float VMOptionsFuzzyMatchSimilarity = 0.7f;
+
+class FuzzyMatchClosure : public ValueClosure<OptionDesc> {
+  OptionDesc* _match;
+  float _max_score;
+  const char* _name;
+public:
+  FuzzyMatchClosure(const char* name) : _name(name), _match(NULL), _max_score(-1) {}
+  void do_value(OptionDesc* value) {
+    float score = str_similar(value->name, _name);
+    if (score > VMOptionsFuzzyMatchSimilarity && score > _max_score) {
+      _max_score = score;
+      _match = value;
+    }
+  }
+  OptionDesc* get_match() {
+    return _match;
+  }
+};
+
+OptionDesc * OptionsTable::fuzzy_match(const char* name, size_t length) {
+  FuzzyMatchClosure closure(name);
+  for_each(&closure);
+  return closure.get_match();
+}
+
+class FreeStringsClosure : public ValueClosure<OptionValue> {
+  void do_value(OptionValue* value) {
+    if (value->desc.type == _string) {
+      FREE_C_HEAP_ARRAY(char, value->string_value, mtCompiler);
+    }
+  }
+};
+
+OptionsValueTable::~OptionsValueTable() {
+  FreeStringsClosure closure;
+  for_each(&closure);
+  delete _table;
+}
+
+
+
+OptionValue* OptionsValueTable::get(const char* name, size_t arglen) {
+  char nameOnly[256];
+  guarantee(arglen < 256, "Max supported option name len is 256");
+  strncpy(nameOnly, name, arglen);
+  nameOnly[arglen] = '\0';
+  return JVMCIHashtable<const char*, OptionValue>::get(nameOnly);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/vm/jvmci/jvmciOptions.hpp	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,103 @@
+/*
+ * Copyright (c) 2015, 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.
+ */
+
+#ifndef SHARE_VM_JVMCI_JVMCI_OPTIONS_HPP
+#define SHARE_VM_JVMCI_JVMCI_OPTIONS_HPP
+
+#include "memory/allocation.hpp"
+#include "utilities/exceptions.hpp"
+#include "jvmci/jvmciHashtable.hpp"
+
+#define PRINT_FLAGS_ARG "PrintFlags"
+#define PRINT_FLAGS_HELP "Prints all JVMCI flags (similar to XX's PrintFlagsFinal)"
+
+enum OptionType {
+  _string,
+  _int,
+  _long,
+  _float,
+  _double,
+  _boolean
+};
+
+struct OptionDesc {
+  const char* name;
+  const char* help;
+  OptionType type;
+  const char* declaringClass;
+  const char* fieldClass;
+};
+
+inline unsigned int compute_string_hash(const char *s, int n) {
+  unsigned int val = 0;
+  while (--n >= 0) {
+    val = *s++ + 31 * val;
+  }
+  return val;
+}
+
+class OptionsTable : public JVMCIHashtable<const char*, OptionDesc> {
+protected:
+  unsigned int compute_hash(const char* key) { return compute_string_hash(key, strlen(key)); }
+  bool key_equals(const char* k1, const char* k2) { return strcmp(k1, k2) == 0; }
+  const char* get_key(OptionDesc value) { return value.name; } ;
+  const char* get_key(OptionDesc* value) { return value->name; } ;
+public:
+  OptionsTable() : JVMCIHashtable<const char*, OptionDesc>(100) {}
+  ~OptionsTable();
+  using JVMCIHashtable<const char*, OptionDesc>::get;
+  OptionDesc* get(const char* name, size_t arglen);
+  OptionDesc * fuzzy_match(const char* name, size_t length);
+
+  static OptionsTable* load_options();
+};
+
+struct OptionValue {
+  OptionDesc desc;
+  union {
+    const char* string_value;
+    jint int_value;
+    jlong long_value;
+    jfloat float_value;
+    jdouble double_value;
+    jboolean boolean_value;
+  };
+};
+
+class OptionsValueTable : public JVMCIHashtable<const char*, OptionValue> {
+  OptionsTable* _table;
+protected:
+  unsigned int compute_hash(const char* key) { return compute_string_hash(key, strlen(key)); }
+  bool key_equals(const char* k1, const char* k2) { return strcmp(k1, k2) == 0; }
+  const char* get_key(OptionValue value) { return value.desc.name; } ;
+  const char* get_key(OptionValue* value) { return value->desc.name; } ;
+public:
+  OptionsValueTable(OptionsTable* table) : _table(table), JVMCIHashtable<const char*, OptionValue>(100) {}
+  ~OptionsValueTable();
+  using JVMCIHashtable<const char*, OptionValue>::get;
+  OptionValue* get(const char* name, size_t arglen);
+  OptionsTable* options_table() { return _table; }
+};
+
+
+#endif // SHARE_VM_JVMCI_JVMCI_OPTIONS_HPP
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/vm/jvmci/jvmciRuntime.cpp	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,1258 @@
+/*
+ * 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.
+ */
+
+#include "precompiled.hpp"
+#include "asm/codeBuffer.hpp"
+#include "compiler/compileBroker.hpp"
+#include "compiler/disassembler.hpp"
+#include "jvmci/jvmciRuntime.hpp"
+#include "jvmci/jvmciCompilerToVM.hpp"
+#include "jvmci/jvmciCompiler.hpp"
+#include "jvmci/jvmciJavaAccess.hpp"
+#include "jvmci/jvmciEnv.hpp"
+#include "memory/oopFactory.hpp"
+#include "prims/jvm.h"
+#include "runtime/biasedLocking.hpp"
+#include "runtime/interfaceSupport.hpp"
+#include "runtime/arguments.hpp"
+#include "runtime/reflection.hpp"
+#include "utilities/debug.hpp"
+#include "utilities/defaultStream.hpp"
+
+	jobject JVMCIRuntime::_HotSpotJVMCIRuntime_instance = NULL;
+bool JVMCIRuntime::_HotSpotJVMCIRuntime_initialized = false;
+bool JVMCIRuntime::_shutdown_called = false;
+
+void JVMCIRuntime::initialize_natives(JNIEnv *env, jclass c2vmClass) {
+  uintptr_t heap_end = (uintptr_t) Universe::heap()->reserved_region().end();
+  uintptr_t allocation_end = heap_end + ((uintptr_t)16) * 1024 * 1024 * 1024;
+  AMD64_ONLY(guarantee(heap_end < allocation_end, "heap end too close to end of address space (might lead to erroneous TLAB allocations)"));
+  NOT_LP64(error("check TLAB allocation code for address space conflicts"));
+
+  ensure_jvmci_class_loader_is_initialized();
+
+  JavaThread* THREAD = JavaThread::current();
+  {
+    ThreadToNativeFromVM trans(THREAD);
+
+    ResourceMark rm;
+    HandleMark hm;
+
+    jvmci_compute_offsets();
+
+    // Ensure _non_oop_bits is initialized
+    Universe::non_oop_word();
+
+    env->RegisterNatives(c2vmClass, CompilerToVM_methods, CompilerToVM_methods_count());
+  }
+  if (HAS_PENDING_EXCEPTION) {
+    abort_on_pending_exception(PENDING_EXCEPTION, "Could not register natives");
+  }
+}
+
+BufferBlob* JVMCIRuntime::initialize_buffer_blob() {
+  JavaThread* THREAD = JavaThread::current();
+  BufferBlob* buffer_blob = THREAD->get_buffer_blob();
+  if (buffer_blob == NULL) {
+    buffer_blob = BufferBlob::create("JVMCI thread-local CodeBuffer", JVMCINMethodSizeLimit);
+    if (buffer_blob != NULL) {
+      THREAD->set_buffer_blob(buffer_blob);
+    }
+  }
+  return buffer_blob;
+}
+
+BasicType JVMCIRuntime::kindToBasicType(jchar ch) {
+  switch(ch) {
+    case 'z': return T_BOOLEAN;
+    case 'b': return T_BYTE;
+    case 's': return T_SHORT;
+    case 'c': return T_CHAR;
+    case 'i': return T_INT;
+    case 'f': return T_FLOAT;
+    case 'j': return T_LONG;
+    case 'd': return T_DOUBLE;
+    case 'a': return T_OBJECT;
+    case '-': return T_ILLEGAL;
+    default:
+      fatal(err_msg("unexpected Kind: %c", ch));
+      break;
+  }
+  return T_ILLEGAL;
+}
+
+// Simple helper to see if the caller of a runtime stub which
+// entered the VM has been deoptimized
+
+static bool caller_is_deopted() {
+  JavaThread* thread = JavaThread::current();
+  RegisterMap reg_map(thread, false);
+  frame runtime_frame = thread->last_frame();
+  frame caller_frame = runtime_frame.sender(&reg_map);
+  assert(caller_frame.is_compiled_frame(), "must be compiled");
+  return caller_frame.is_deoptimized_frame();
+}
+
+// Stress deoptimization
+static void deopt_caller() {
+  if ( !caller_is_deopted()) {
+    JavaThread* thread = JavaThread::current();
+    RegisterMap reg_map(thread, false);
+    frame runtime_frame = thread->last_frame();
+    frame caller_frame = runtime_frame.sender(&reg_map);
+    Deoptimization::deoptimize_frame(thread, caller_frame.id(), Deoptimization::Reason_constraint);
+    assert(caller_is_deopted(), "Must be deoptimized");
+  }
+}
+
+JRT_BLOCK_ENTRY(void, JVMCIRuntime::new_instance(JavaThread* thread, Klass* klass))
+  JRT_BLOCK;
+  assert(klass->is_klass(), "not a class");
+  instanceKlassHandle h(thread, klass);
+  h->check_valid_for_instantiation(true, CHECK);
+  // make sure klass is initialized
+  h->initialize(CHECK);
+  // allocate instance and return via TLS
+  oop obj = h->allocate_instance(CHECK);
+  thread->set_vm_result(obj);
+  JRT_BLOCK_END;
+
+  if (JVMCIDeferredInitBarriers) {
+    new_store_pre_barrier(thread);
+  }
+JRT_END
+
+JRT_BLOCK_ENTRY(void, JVMCIRuntime::new_array(JavaThread* thread, Klass* array_klass, jint length))
+  JRT_BLOCK;
+  // Note: no handle for klass needed since they are not used
+  //       anymore after new_objArray() and no GC can happen before.
+  //       (This may have to change if this code changes!)
+  assert(array_klass->is_klass(), "not a class");
+  oop obj;
+  if (array_klass->oop_is_typeArray()) {
+    BasicType elt_type = TypeArrayKlass::cast(array_klass)->element_type();
+    obj = oopFactory::new_typeArray(elt_type, length, CHECK);
+  } else {
+    Klass* elem_klass = ObjArrayKlass::cast(array_klass)->element_klass();
+    obj = oopFactory::new_objArray(elem_klass, length, CHECK);
+  }
+  thread->set_vm_result(obj);
+  // This is pretty rare but this runtime patch is stressful to deoptimization
+  // if we deoptimize here so force a deopt to stress the path.
+  if (DeoptimizeALot) {
+    static int deopts = 0;
+    // Alternate between deoptimizing and raising an error (which will also cause a deopt)
+    if (deopts++ % 2 == 0) {
+      ResourceMark rm(THREAD);
+      THROW(vmSymbols::java_lang_OutOfMemoryError());
+    } else {
+      deopt_caller();
+    }
+  }
+  JRT_BLOCK_END;
+
+  if (JVMCIDeferredInitBarriers) {
+    new_store_pre_barrier(thread);
+  }
+JRT_END
+
+void JVMCIRuntime::new_store_pre_barrier(JavaThread* thread) {
+  // After any safepoint, just before going back to compiled code,
+  // we inform the GC that we will be doing initializing writes to
+  // this object in the future without emitting card-marks, so
+  // GC may take any compensating steps.
+  // NOTE: Keep this code consistent with GraphKit::store_barrier.
+
+  oop new_obj = thread->vm_result();
+  if (new_obj == NULL)  return;
+
+  assert(Universe::heap()->can_elide_tlab_store_barriers(),
+         "compiler must check this first");
+  // GC may decide to give back a safer copy of new_obj.
+  new_obj = Universe::heap()->new_store_pre_barrier(thread, new_obj);
+  thread->set_vm_result(new_obj);
+}
+
+JRT_ENTRY(void, JVMCIRuntime::new_multi_array(JavaThread* thread, Klass* klass, int rank, jint* dims))
+  assert(klass->is_klass(), "not a class");
+  assert(rank >= 1, "rank must be nonzero");
+  oop obj = ArrayKlass::cast(klass)->multi_allocate(rank, dims, CHECK);
+  thread->set_vm_result(obj);
+JRT_END
+
+JRT_ENTRY(void, JVMCIRuntime::dynamic_new_array(JavaThread* thread, oopDesc* element_mirror, jint length))
+  oop obj = Reflection::reflect_new_array(element_mirror, length, CHECK);
+  thread->set_vm_result(obj);
+JRT_END
+
+JRT_ENTRY(void, JVMCIRuntime::dynamic_new_instance(JavaThread* thread, oopDesc* type_mirror))
+  instanceKlassHandle klass(THREAD, java_lang_Class::as_Klass(type_mirror));
+
+  if (klass == NULL) {
+    ResourceMark rm(THREAD);
+    THROW(vmSymbols::java_lang_InstantiationException());
+  }
+
+  // Create new instance (the receiver)
+  klass->check_valid_for_instantiation(false, CHECK);
+
+  // Make sure klass gets initialized
+  klass->initialize(CHECK);
+
+  oop obj = klass->allocate_instance(CHECK);
+  thread->set_vm_result(obj);
+JRT_END
+
+extern void vm_exit(int code);
+
+// Enter this method from compiled code handler below. This is where we transition
+// to VM mode. This is done as a helper routine so that the method called directly
+// from compiled code does not have to transition to VM. This allows the entry
+// method to see if the nmethod that we have just looked up a handler for has
+// been deoptimized while we were in the vm. This simplifies the assembly code
+// cpu directories.
+//
+// We are entering here from exception stub (via the entry method below)
+// If there is a compiled exception handler in this method, we will continue there;
+// otherwise we will unwind the stack and continue at the caller of top frame method
+// Note: we enter in Java using a special JRT wrapper. This wrapper allows us to
+// control the area where we can allow a safepoint. After we exit the safepoint area we can
+// check to see if the handler we are going to return is now in a nmethod that has
+// been deoptimized. If that is the case we return the deopt blob
+// unpack_with_exception entry instead. This makes life for the exception blob easier
+// because making that same check and diverting is painful from assembly language.
+JRT_ENTRY_NO_ASYNC(static address, exception_handler_for_pc_helper(JavaThread* thread, oopDesc* ex, address pc, nmethod*& nm))
+  // Reset method handle flag.
+  thread->set_is_method_handle_return(false);
+
+  Handle exception(thread, ex);
+  nm = CodeCache::find_nmethod(pc);
+  assert(nm != NULL, "this is not an nmethod");
+  // Adjust the pc as needed/
+  if (nm->is_deopt_pc(pc)) {
+    RegisterMap map(thread, false);
+    frame exception_frame = thread->last_frame().sender(&map);
+    // if the frame isn't deopted then pc must not correspond to the caller of last_frame
+    assert(exception_frame.is_deoptimized_frame(), "must be deopted");
+    pc = exception_frame.pc();
+  }
+#ifdef ASSERT
+  assert(exception.not_null(), "NULL exceptions should be handled by throw_exception");
+  assert(exception->is_oop(), "just checking");
+  // Check that exception is a subclass of Throwable, otherwise we have a VerifyError
+  if (!(exception->is_a(SystemDictionary::Throwable_klass()))) {
+    if (ExitVMOnVerifyError) vm_exit(-1);
+    ShouldNotReachHere();
+  }
+#endif
+
+  // Check the stack guard pages and reenable them if necessary and there is
+  // enough space on the stack to do so.  Use fast exceptions only if the guard
+  // pages are enabled.
+  bool guard_pages_enabled = thread->stack_yellow_zone_enabled();
+  if (!guard_pages_enabled) guard_pages_enabled = thread->reguard_stack();
+
+  if (JvmtiExport::can_post_on_exceptions()) {
+    // To ensure correct notification of exception catches and throws
+    // we have to deoptimize here.  If we attempted to notify the
+    // catches and throws during this exception lookup it's possible
+    // we could deoptimize on the way out of the VM and end back in
+    // the interpreter at the throw site.  This would result in double
+    // notifications since the interpreter would also notify about
+    // these same catches and throws as it unwound the frame.
+
+    RegisterMap reg_map(thread);
+    frame stub_frame = thread->last_frame();
+    frame caller_frame = stub_frame.sender(&reg_map);
+
+    // We don't really want to deoptimize the nmethod itself since we
+    // can actually continue in the exception handler ourselves but I
+    // don't see an easy way to have the desired effect.
+    Deoptimization::deoptimize_frame(thread, caller_frame.id(), Deoptimization::Reason_constraint);
+    assert(caller_is_deopted(), "Must be deoptimized");
+
+    return SharedRuntime::deopt_blob()->unpack_with_exception_in_tls();
+  }
+
+  // ExceptionCache is used only for exceptions at call sites and not for implicit exceptions
+  if (guard_pages_enabled) {
+    address fast_continuation = nm->handler_for_exception_and_pc(exception, pc);
+    if (fast_continuation != NULL) {
+      // Set flag if return address is a method handle call site.
+      thread->set_is_method_handle_return(nm->is_method_handle_return(pc));
+      return fast_continuation;
+    }
+  }
+
+  // If the stack guard pages are enabled, check whether there is a handler in
+  // the current method.  Otherwise (guard pages disabled), force an unwind and
+  // skip the exception cache update (i.e., just leave continuation==NULL).
+  address continuation = NULL;
+  if (guard_pages_enabled) {
+
+    // New exception handling mechanism can support inlined methods
+    // with exception handlers since the mappings are from PC to PC
+
+    // debugging support
+    // tracing
+    if (TraceExceptions) {
+      ttyLocker ttyl;
+      ResourceMark rm;
+      tty->print_cr("Exception <%s> (" INTPTR_FORMAT ") thrown in compiled method <%s> at PC " INTPTR_FORMAT " for thread " INTPTR_FORMAT "",
+                    exception->print_value_string(), p2i((address)exception()), nm->method()->print_value_string(), p2i(pc), p2i(thread));
+    }
+    // for AbortVMOnException flag
+    NOT_PRODUCT(Exceptions::debug_check_abort(exception));
+
+    // Clear out the exception oop and pc since looking up an
+    // exception handler can cause class loading, which might throw an
+    // exception and those fields are expected to be clear during
+    // normal bytecode execution.
+    thread->clear_exception_oop_and_pc();
+
+    continuation = SharedRuntime::compute_compiled_exc_handler(nm, pc, exception, false, false);
+    // If an exception was thrown during exception dispatch, the exception oop may have changed
+    thread->set_exception_oop(exception());
+    thread->set_exception_pc(pc);
+
+    // the exception cache is used only by non-implicit exceptions
+    if (continuation != NULL && !SharedRuntime::deopt_blob()->contains(continuation)) {
+      nm->add_handler_for_exception_and_pc(exception, pc, continuation);
+    }
+  }
+
+  // Set flag if return address is a method handle call site.
+  thread->set_is_method_handle_return(nm->is_method_handle_return(pc));
+
+  if (TraceExceptions) {
+    ttyLocker ttyl;
+    ResourceMark rm;
+    tty->print_cr("Thread " PTR_FORMAT " continuing at PC " PTR_FORMAT " for exception thrown at PC " PTR_FORMAT,
+                  p2i(thread), p2i(continuation), p2i(pc));
+  }
+
+  return continuation;
+JRT_END
+
+// Enter this method from compiled code only if there is a Java exception handler
+// in the method handling the exception.
+// We are entering here from exception stub. We don't do a normal VM transition here.
+// We do it in a helper. This is so we can check to see if the nmethod we have just
+// searched for an exception handler has been deoptimized in the meantime.
+address JVMCIRuntime::exception_handler_for_pc(JavaThread* thread) {
+  oop exception = thread->exception_oop();
+  address pc = thread->exception_pc();
+  // Still in Java mode
+  DEBUG_ONLY(ResetNoHandleMark rnhm);
+  nmethod* nm = NULL;
+  address continuation = NULL;
+  {
+    // Enter VM mode by calling the helper
+    ResetNoHandleMark rnhm;
+    continuation = exception_handler_for_pc_helper(thread, exception, pc, nm);
+  }
+  // Back in JAVA, use no oops DON'T safepoint
+
+  // Now check to see if the nmethod we were called from is now deoptimized.
+  // If so we must return to the deopt blob and deoptimize the nmethod
+  if (nm != NULL && caller_is_deopted()) {
+    continuation = SharedRuntime::deopt_blob()->unpack_with_exception_in_tls();
+  }
+
+  assert(continuation != NULL, "no handler found");
+  return continuation;
+}
+
+JRT_ENTRY(void, JVMCIRuntime::create_null_exception(JavaThread* thread))
+  SharedRuntime::throw_and_post_jvmti_exception(thread, vmSymbols::java_lang_NullPointerException());
+  thread->set_vm_result(PENDING_EXCEPTION);
+  CLEAR_PENDING_EXCEPTION;
+JRT_END
+
+JRT_ENTRY(void, JVMCIRuntime::create_out_of_bounds_exception(JavaThread* thread, jint index))
+  char message[jintAsStringSize];
+  sprintf(message, "%d", index);
+  SharedRuntime::throw_and_post_jvmti_exception(thread, vmSymbols::java_lang_ArrayIndexOutOfBoundsException(), message);
+  thread->set_vm_result(PENDING_EXCEPTION);
+  CLEAR_PENDING_EXCEPTION;
+JRT_END
+
+JRT_ENTRY_NO_ASYNC(void, JVMCIRuntime::monitorenter(JavaThread* thread, oopDesc* obj, BasicLock* lock))
+  if (TraceJVMCI >= 3) {
+    char type[O_BUFLEN];
+    obj->klass()->name()->as_C_string(type, O_BUFLEN);
+    markOop mark = obj->mark();
+    tty->print_cr("%s: entered locking slow case with obj=" INTPTR_FORMAT ", type=%s, mark=" INTPTR_FORMAT ", lock=" INTPTR_FORMAT, thread->name(), p2i(obj), type, p2i(mark), p2i(lock));
+    tty->flush();
+  }
+#ifdef ASSERT
+  if (PrintBiasedLockingStatistics) {
+    Atomic::inc(BiasedLocking::slow_path_entry_count_addr());
+  }
+#endif
+  Handle h_obj(thread, obj);
+  assert(h_obj()->is_oop(), "must be NULL or an object");
+  if (UseBiasedLocking) {
+    // Retry fast entry if bias is revoked to avoid unnecessary inflation
+    ObjectSynchronizer::fast_enter(h_obj, lock, true, CHECK);
+  } else {
+    if (JVMCIUseFastLocking) {
+      // When using fast locking, the compiled code has already tried the fast case
+      ObjectSynchronizer::slow_enter(h_obj, lock, THREAD);
+    } else {
+      ObjectSynchronizer::fast_enter(h_obj, lock, false, THREAD);
+    }
+  }
+  if (TraceJVMCI >= 3) {
+    tty->print_cr("%s: exiting locking slow with obj=" INTPTR_FORMAT, thread->name(), p2i(obj));
+  }
+JRT_END
+
+JRT_LEAF(void, JVMCIRuntime::monitorexit(JavaThread* thread, oopDesc* obj, BasicLock* lock))
+  assert(thread == JavaThread::current(), "threads must correspond");
+  assert(thread->last_Java_sp(), "last_Java_sp must be set");
+  // monitorexit is non-blocking (leaf routine) => no exceptions can be thrown
+  EXCEPTION_MARK;
+
+#ifdef DEBUG
+  if (!obj->is_oop()) {
+    ResetNoHandleMark rhm;
+    nmethod* method = thread->last_frame().cb()->as_nmethod_or_null();
+    if (method != NULL) {
+      tty->print_cr("ERROR in monitorexit in method %s wrong obj " INTPTR_FORMAT, method->name(), p2i(obj));
+    }
+    thread->print_stack_on(tty);
+    assert(false, "invalid lock object pointer dected");
+  }
+#endif
+
+  if (JVMCIUseFastLocking) {
+    // When using fast locking, the compiled code has already tried the fast case
+    ObjectSynchronizer::slow_exit(obj, lock, THREAD);
+  } else {
+    ObjectSynchronizer::fast_exit(obj, lock, THREAD);
+  }
+  if (TraceJVMCI >= 3) {
+    char type[O_BUFLEN];
+    obj->klass()->name()->as_C_string(type, O_BUFLEN);
+    tty->print_cr("%s: exited locking slow case with obj=" INTPTR_FORMAT ", type=%s, mark=" INTPTR_FORMAT ", lock=" INTPTR_FORMAT, thread->name(), p2i(obj), type, p2i(obj->mark()), p2i(lock));
+    tty->flush();
+  }
+JRT_END
+
+JRT_LEAF(void, JVMCIRuntime::log_object(JavaThread* thread, oopDesc* obj, jint flags))
+  bool string =  mask_bits_are_true(flags, LOG_OBJECT_STRING);
+  bool addr = mask_bits_are_true(flags, LOG_OBJECT_ADDRESS);
+  bool newline = mask_bits_are_true(flags, LOG_OBJECT_NEWLINE);
+  if (!string) {
+    if (!addr && obj->is_oop_or_null(true)) {
+      char buf[O_BUFLEN];
+      tty->print("%s@" INTPTR_FORMAT, obj->klass()->name()->as_C_string(buf, O_BUFLEN), p2i(obj));
+    } else {
+      tty->print(INTPTR_FORMAT, p2i(obj));
+    }
+  } else {
+    ResourceMark rm;
+    assert(obj != NULL && java_lang_String::is_instance(obj), "must be");
+    char *buf = java_lang_String::as_utf8_string(obj);
+    tty->print_raw(buf);
+  }
+  if (newline) {
+    tty->cr();
+  }
+JRT_END
+
+JRT_LEAF(void, JVMCIRuntime::write_barrier_pre(JavaThread* thread, oopDesc* obj))
+  thread->satb_mark_queue().enqueue(obj);
+JRT_END
+
+JRT_LEAF(void, JVMCIRuntime::write_barrier_post(JavaThread* thread, void* card_addr))
+  thread->dirty_card_queue().enqueue(card_addr);
+JRT_END
+
+JRT_LEAF(jboolean, JVMCIRuntime::validate_object(JavaThread* thread, oopDesc* parent, oopDesc* child))
+  bool ret = true;
+  if(!Universe::heap()->is_in_closed_subset(parent)) {
+    tty->print_cr("Parent Object "INTPTR_FORMAT" not in heap", p2i(parent));
+    parent->print();
+    ret=false;
+  }
+  if(!Universe::heap()->is_in_closed_subset(child)) {
+    tty->print_cr("Child Object "INTPTR_FORMAT" not in heap", p2i(child));
+    child->print();
+    ret=false;
+  }
+  return (jint)ret;
+JRT_END
+
+JRT_ENTRY(void, JVMCIRuntime::vm_error(JavaThread* thread, jlong where, jlong format, jlong value))
+  ResourceMark rm;
+  const char *error_msg = where == 0L ? "<internal JVMCI error>" : (char*) (address) where;
+  char *detail_msg = NULL;
+  if (format != 0L) {
+    const char* buf = (char*) (address) format;
+    size_t detail_msg_length = strlen(buf) * 2;
+    detail_msg = (char *) NEW_RESOURCE_ARRAY(u_char, detail_msg_length);
+    jio_snprintf(detail_msg, detail_msg_length, buf, value);
+  }
+  report_vm_error(__FILE__, __LINE__, error_msg, detail_msg);
+JRT_END
+
+JRT_LEAF(oopDesc*, JVMCIRuntime::load_and_clear_exception(JavaThread* thread))
+  oop exception = thread->exception_oop();
+  assert(exception != NULL, "npe");
+  thread->set_exception_oop(NULL);
+  thread->set_exception_pc(0);
+  return exception;
+JRT_END
+
+JRT_LEAF(void, JVMCIRuntime::log_printf(JavaThread* thread, oopDesc* format, jlong v1, jlong v2, jlong v3))
+  ResourceMark rm;
+  assert(format != NULL && java_lang_String::is_instance(format), "must be");
+  char *buf = java_lang_String::as_utf8_string(format);
+  tty->print(buf, v1, v2, v3);
+JRT_END
+
+static void decipher(jlong v, bool ignoreZero) {
+  if (v != 0 || !ignoreZero) {
+    void* p = (void *)(address) v;
+    CodeBlob* cb = CodeCache::find_blob(p);
+    if (cb) {
+      if (cb->is_nmethod()) {
+        char buf[O_BUFLEN];
+        tty->print("%s [" INTPTR_FORMAT "+" JLONG_FORMAT "]", cb->as_nmethod_or_null()->method()->name_and_sig_as_C_string(buf, O_BUFLEN), p2i(cb->code_begin()), (jlong)((address)v - cb->code_begin()));
+        return;
+      }
+      cb->print_value_on(tty);
+      return;
+    }
+    if (Universe::heap()->is_in(p)) {
+      oop obj = oop(p);
+      obj->print_value_on(tty);
+      return;
+    }
+    tty->print(INTPTR_FORMAT " [long: " JLONG_FORMAT ", double %lf, char %c]",p2i((void *)v), (jlong)v, (jdouble)v, (char)v);
+  }
+}
+
+JRT_LEAF(void, JVMCIRuntime::vm_message(jboolean vmError, jlong format, jlong v1, jlong v2, jlong v3))
+  ResourceMark rm;
+  char *buf = (char*) (address) format;
+  if (vmError) {
+    if (buf != NULL) {
+      fatal(err_msg(buf, v1, v2, v3));
+    } else {
+      fatal("<anonymous error>");
+    }
+  } else if (buf != NULL) {
+    tty->print(buf, v1, v2, v3);
+  } else {
+    assert(v2 == 0, "v2 != 0");
+    assert(v3 == 0, "v3 != 0");
+    decipher(v1, false);
+  }
+JRT_END
+
+JRT_LEAF(void, JVMCIRuntime::log_primitive(JavaThread* thread, jchar typeChar, jlong value, jboolean newline))
+  union {
+      jlong l;
+      jdouble d;
+      jfloat f;
+  } uu;
+  uu.l = value;
+  switch (typeChar) {
+    case 'z': tty->print(value == 0 ? "false" : "true"); break;
+    case 'b': tty->print("%d", (jbyte) value); break;
+    case 'c': tty->print("%c", (jchar) value); break;
+    case 's': tty->print("%d", (jshort) value); break;
+    case 'i': tty->print("%d", (jint) value); break;
+    case 'f': tty->print("%f", uu.f); break;
+    case 'j': tty->print(JLONG_FORMAT, value); break;
+    case 'd': tty->print("%lf", uu.d); break;
+    default: assert(false, "unknown typeChar"); break;
+  }
+  if (newline) {
+    tty->cr();
+  }
+JRT_END
+
+JRT_ENTRY(jint, JVMCIRuntime::identity_hash_code(JavaThread* thread, oopDesc* obj))
+  return (jint) obj->identity_hash();
+JRT_END
+
+JRT_ENTRY(jboolean, JVMCIRuntime::thread_is_interrupted(JavaThread* thread, oopDesc* receiver, jboolean clear_interrupted))
+  // Ensure that the C++ Thread and OSThread structures aren't freed before we operate.
+  // This locking requires thread_in_vm which is why this method cannot be JRT_LEAF.
+  Handle receiverHandle(thread, receiver);
+  MutexLockerEx ml(thread->threadObj() == (void*)receiver ? NULL : Threads_lock);
+  JavaThread* receiverThread = java_lang_Thread::thread(receiverHandle());
+  if (receiverThread == NULL) {
+    // The other thread may exit during this process, which is ok so return false.
+    return JNI_FALSE;
+  } else {
+    return (jint) Thread::is_interrupted(receiverThread, clear_interrupted != 0);
+  }
+JRT_END
+
+JRT_ENTRY(jint, JVMCIRuntime::test_deoptimize_call_int(JavaThread* thread, int value))
+  deopt_caller();
+  return value;
+JRT_END
+
+// private static void Factory.init()
+JVM_ENTRY(void, JVM_InitJVMCIClassLoader(JNIEnv *env, jclass c, jobject loader_handle))
+  SystemDictionary::init_jvmci_loader(JNIHandles::resolve(loader_handle));
+  SystemDictionary::WKID scan = SystemDictionary::FIRST_JVMCI_WKID;
+  SystemDictionary::initialize_wk_klasses_through(SystemDictionary::LAST_JVMCI_WKID, scan, CHECK);
+JVM_END
+
+// private static JVMCIRuntime JVMCI.initializeRuntime()
+JVM_ENTRY(jobject, JVM_GetJVMCIRuntime(JNIEnv *env, jclass c))
+  JVMCIRuntime::initialize_HotSpotJVMCIRuntime();
+  return JVMCIRuntime::get_HotSpotJVMCIRuntime_jobject();
+JVM_END
+
+// private static Service[] Services.getServiceImpls(String serviceClass)
+JVM_ENTRY(jobject, JVM_GetJVMCIServiceImpls(JNIEnv *env, jclass c, jclass serviceClass))
+  HandleMark hm;
+  ResourceMark rm;
+  KlassHandle serviceKlass(THREAD, java_lang_Class::as_Klass(JNIHandles::resolve_non_null(serviceClass)));
+  return JNIHandles::make_local(THREAD, JVMCIRuntime::get_service_impls(serviceKlass, THREAD)());
+JVM_END
+
+// private static TruffleRuntime Truffle.createRuntime()
+JVM_ENTRY(jobject, JVM_CreateTruffleRuntime(JNIEnv *env, jclass c))
+  JVMCIRuntime::ensure_jvmci_class_loader_is_initialized();
+  TempNewSymbol name = SymbolTable::new_symbol("com/oracle/graal/truffle/hotspot/HotSpotTruffleRuntime", CHECK_NULL);
+  KlassHandle klass = JVMCIRuntime::resolve_or_fail(name, CHECK_NULL);
+
+  TempNewSymbol makeInstance = SymbolTable::new_symbol("makeInstance", CHECK_NULL);
+  TempNewSymbol sig = SymbolTable::new_symbol("()Lcom/oracle/truffle/api/TruffleRuntime;", CHECK_NULL);
+  JavaValue result(T_OBJECT);
+  JavaCalls::call_static(&result, klass, makeInstance, sig, CHECK_NULL);
+  return JNIHandles::make_local(THREAD, (oop) result.get_jobject());
+JVM_END
+
+// private static NativeFunctionInterfaceRuntime.createInterface()
+JVM_ENTRY(jobject, JVM_CreateNativeFunctionInterface(JNIEnv *env, jclass c))
+  JVMCIRuntime::ensure_jvmci_class_loader_is_initialized();
+  TempNewSymbol name = SymbolTable::new_symbol("com/oracle/graal/truffle/hotspot/HotSpotTruffleRuntime", CHECK_NULL);
+  KlassHandle klass = JVMCIRuntime::resolve_or_fail(name, CHECK_NULL);
+
+  TempNewSymbol makeInstance = SymbolTable::new_symbol("createNativeFunctionInterface", CHECK_NULL);
+  TempNewSymbol sig = SymbolTable::new_symbol("()Lcom/oracle/nfi/api/NativeFunctionInterface;", CHECK_NULL);
+  JavaValue result(T_OBJECT);
+  JavaCalls::call_static(&result, klass, makeInstance, sig, CHECK_NULL);
+  return JNIHandles::make_local(THREAD, (oop) result.get_jobject());
+JVM_END
+
+Handle JVMCIRuntime::callInitializer(const char* className, const char* methodName, const char* returnType) {
+  guarantee(!_HotSpotJVMCIRuntime_initialized, "cannot reinitialize HotSpotJVMCIRuntime");
+  Thread* THREAD = Thread::current();
+
+  TempNewSymbol name = SymbolTable::new_symbol(className, CHECK_ABORT_(Handle()));
+  KlassHandle klass = load_required_class(name);
+  TempNewSymbol runtime = SymbolTable::new_symbol(methodName, CHECK_ABORT_(Handle()));
+  TempNewSymbol sig = SymbolTable::new_symbol(returnType, CHECK_ABORT_(Handle()));
+  JavaValue result(T_OBJECT);
+  JavaCalls::call_static(&result, klass, runtime, sig, CHECK_ABORT_(Handle()));
+  return Handle((oop)result.get_jobject());
+}
+
+void JVMCIRuntime::initialize_HotSpotJVMCIRuntime() {
+  if (JNIHandles::resolve(_HotSpotJVMCIRuntime_instance) == NULL) {
+#ifdef ASSERT
+    // This should only be called in the context of the JVMCI class being initialized
+    Thread* THREAD = Thread::current();
+    TempNewSymbol name = SymbolTable::new_symbol("com/oracle/jvmci/runtime/JVMCI", CHECK_ABORT);
+    instanceKlassHandle klass = InstanceKlass::cast(load_required_class(name));
+    assert(klass->is_being_initialized() && klass->is_reentrant_initialization(THREAD),
+           "HotSpotJVMCIRuntime initialization should only be triggered through JVMCI initialization");
+#endif
+
+    Handle result = callInitializer("com/oracle/jvmci/hotspot/HotSpotJVMCIRuntime", "runtime",
+                                    "()Lcom/oracle/jvmci/hotspot/HotSpotJVMCIRuntime;");
+    _HotSpotJVMCIRuntime_initialized = true;
+    _HotSpotJVMCIRuntime_instance = JNIHandles::make_global(result());
+  }
+}
+
+void JVMCIRuntime::initialize_JVMCI() {
+  if (JNIHandles::resolve(_HotSpotJVMCIRuntime_instance) == NULL) {
+    callInitializer("com/oracle/jvmci/runtime/JVMCI",     "getRuntime",      "()Lcom/oracle/jvmci/runtime/JVMCIRuntime;");
+  }
+  assert(_HotSpotJVMCIRuntime_initialized == true, "what?");
+}
+
+// private static void CompilerToVMImpl.init()
+JVM_ENTRY(void, JVM_InitializeJVMCINatives(JNIEnv *env, jclass c2vmClass))
+  JVMCIRuntime::initialize_natives(env, c2vmClass);
+JVM_END
+
+void JVMCIRuntime::ensure_jvmci_class_loader_is_initialized() {
+  // This initialization code is guarded by a static pointer to the Factory class.
+  // Once it is non-null, the JVMCI class loader and well known JVMCI classes are
+  // guaranteed to have been initialized. By going through the static
+  // initializer of Factory, we can rely on class initialization semantics to
+  // synchronize threads racing to do the initialization.
+  static Klass* _FactoryKlass = NULL;
+  if (_FactoryKlass == NULL) {
+    Thread* THREAD = Thread::current();
+    TempNewSymbol name = SymbolTable::new_symbol("com/oracle/jvmci/hotspot/loader/Factory", CHECK_ABORT);
+    KlassHandle klass = SystemDictionary::resolve_or_fail(name, true, THREAD);
+    if (HAS_PENDING_EXCEPTION) {
+      static volatile int seen_error = 0;
+      if (!seen_error && Atomic::cmpxchg(1, &seen_error, 0) == 0) {
+        // Only report the failure on the first thread that hits it
+        abort_on_pending_exception(PENDING_EXCEPTION, "JVMCI classes are not available");
+      } else {
+        CLEAR_PENDING_EXCEPTION;
+        // Give first thread time to report the error.
+        os::sleep(THREAD, 100, false);
+        vm_abort(false);
+      }
+    }
+
+    // We cannot use jvmciJavaAccess for this because we are currently in the
+    // process of initializing that mechanism.
+    TempNewSymbol field_name = SymbolTable::new_symbol("useJVMCIClassLoader", CHECK_ABORT);
+    fieldDescriptor field_desc;
+    if (klass->find_field(field_name, vmSymbols::bool_signature(), &field_desc) == NULL) {
+      ResourceMark rm;
+      fatal(err_msg("Invalid layout of %s at %s", field_name->as_C_string(), klass->external_name()));
+    }
+
+    InstanceKlass* ik = InstanceKlass::cast(klass());
+    address addr = ik->static_field_addr(field_desc.offset() - InstanceMirrorKlass::offset_of_static_fields());
+    *((jboolean *) addr) = (jboolean) UseJVMCIClassLoader;
+    klass->initialize(CHECK_ABORT);
+    _FactoryKlass = klass();
+    assert(!UseJVMCIClassLoader || SystemDictionary::jvmci_loader() != NULL, "JVMCI classloader should have been initialized");
+  }
+}
+
+OptionsValueTable* JVMCIRuntime::parse_arguments() {
+  OptionsTable* table = OptionsTable::load_options();
+  if (table == NULL) {
+    return NULL;
+  }
+
+  OptionsValueTable* options = new OptionsValueTable(table);
+
+  // Process option overrides from jvmci.options first
+  parse_jvmci_options_file(options);
+
+  // Now process options on the command line
+  int numOptions = Arguments::num_jvmci_args();
+  for (int i = 0; i < numOptions; i++) {
+    char* arg = Arguments::jvmci_args_array()[i];
+    if (!parse_argument(options, arg)) {
+      delete options;
+      return NULL;
+    }
+  }
+  return options;
+}
+
+void not_found(OptionsTable* table, const char* argname, size_t namelen) {
+  jio_fprintf(defaultStream::error_stream(),"Unrecognized VM option '%.*s'\n", namelen, argname);
+  OptionDesc* fuzzy_matched = table->fuzzy_match(argname, strlen(argname));
+  if (fuzzy_matched != NULL) {
+    jio_fprintf(defaultStream::error_stream(),
+                "Did you mean '%s%s%s'?\n",
+                (fuzzy_matched->type == _boolean) ? "(+/-)" : "",
+                fuzzy_matched->name,
+                (fuzzy_matched->type == _boolean) ? "" : "=<value>");
+  }
+}
+
+bool JVMCIRuntime::parse_argument(OptionsValueTable* options, const char* arg) {
+  OptionsTable* table = options->options_table();
+  char first = arg[0];
+  const char* name;
+  size_t name_len;
+  if (first == '+' || first == '-') {
+    name = arg + 1;
+    OptionDesc* optionDesc = table->get(name);
+    if (optionDesc == NULL) {
+      not_found(table, name, strlen(name));
+      return false;
+    }
+    if (optionDesc->type != _boolean) {
+      jio_fprintf(defaultStream::error_stream(), "Unexpected +/- setting in VM option '%s'\n", name);
+      return false;
+    }
+    OptionValue value;
+    value.desc = *optionDesc;
+    value.boolean_value = first == '+';
+    options->put(value);
+    return true;
+  } else {
+    const char* sep = strchr(arg, '=');
+    name = arg;
+    const char* value = NULL;
+    if (sep != NULL) {
+      name_len = sep - name;
+      value = sep + 1;
+    } else {
+      name_len = strlen(name);
+    }
+    OptionDesc* optionDesc = table->get(name, name_len);
+    if (optionDesc == NULL) {
+      not_found(table, name, name_len);
+      return false;
+    }
+    if (optionDesc->type == _boolean) {
+      jio_fprintf(defaultStream::error_stream(), "Missing +/- setting for VM option '%s'\n", name);
+      return false;
+    }
+    if (value == NULL) {
+      jio_fprintf(defaultStream::error_stream(), "Must use '-G:%.*s=<value>' format for %.*s option", name_len, name, name_len, name);
+      return false;
+    }
+    OptionValue optionValue;
+    optionValue.desc = *optionDesc;
+    char* check;
+    errno = 0;
+    switch(optionDesc->type) {
+      case _int: {
+        long int int_value = ::strtol(value, &check, 10);
+        if (*check != '\0' || errno == ERANGE || int_value > max_jint || int_value < min_jint) {
+          jio_fprintf(defaultStream::error_stream(), "Expected int value for VM option '%s'\n", name);
+          return false;
+        }
+        optionValue.int_value = int_value;
+        break;
+      }
+      case _long: {
+        long long int long_value = ::strtoll(value, &check, 10);
+        if (*check != '\0' || errno == ERANGE || long_value > max_jlong || long_value < min_jlong) {
+          jio_fprintf(defaultStream::error_stream(), "Expected long value for VM option '%s'\n", name);
+          return false;
+        }
+        optionValue.long_value = long_value;
+        break;
+      }
+      case _float: {
+        optionValue.float_value = ::strtof(value, &check);
+        if (*check != '\0' || errno == ERANGE) {
+          jio_fprintf(defaultStream::error_stream(), "Expected float value for VM option '%s'\n", name);
+          return false;
+        }
+        break;
+      }
+      case _double: {
+        optionValue.double_value = ::strtod(value, &check);
+        if (*check != '\0' || errno == ERANGE) {
+          jio_fprintf(defaultStream::error_stream(), "Expected double value for VM option '%s'\n", name);
+          return false;
+        }
+        break;
+      }
+      case _string: {
+        char* copy = NEW_C_HEAP_ARRAY(char, strlen(value) + 1, mtCompiler);
+        strcpy(copy, value);
+        optionValue.string_value = copy;
+        break;
+      }
+      default:
+        ShouldNotReachHere();
+    }
+    options->put(optionValue);
+    return true;
+  }
+}
+
+class JVMCIOptionParseClosure : public ParseClosure {
+  OptionsValueTable* _options;
+public:
+  JVMCIOptionParseClosure(OptionsValueTable* options) : _options(options) {}
+  void do_line(char* line) {
+    if (!JVMCIRuntime::parse_argument(_options, line)) {
+      warn("There was an error parsing an argument. Skipping it.");
+    }
+  }
+};
+
+void JVMCIRuntime::parse_jvmci_options_file(OptionsValueTable* options) {
+  const char* home = Arguments::get_java_home();
+  size_t path_len = strlen(home) + strlen("/lib/jvmci.options") + 1;
+  char path[JVM_MAXPATHLEN];
+  char sep = os::file_separator()[0];
+  jio_snprintf(path, JVM_MAXPATHLEN, "%s%clib%cjvmci.options", home, sep, sep);
+  JVMCIOptionParseClosure closure(options);
+  parse_lines(path, &closure, false);
+}
+
+#define CHECK_WARN_ABORT_(message) THREAD); \
+  if (HAS_PENDING_EXCEPTION) { \
+    warning(message); \
+    char buf[512]; \
+    jio_snprintf(buf, 512, "Uncaught exception at %s:%d", __FILE__, __LINE__); \
+    JVMCIRuntime::abort_on_pending_exception(PENDING_EXCEPTION, buf); \
+    return; \
+  } \
+  (void)(0
+
+class SetOptionClosure : public ValueClosure<OptionValue> {
+  Thread* _thread;
+public:
+  SetOptionClosure(TRAPS) : _thread(THREAD) {}
+  void do_value(OptionValue* optionValue) {
+    TRAPS = _thread;
+    const char* declaringClass = optionValue->desc.declaringClass;
+    if (declaringClass == NULL) {
+      // skip PrintFlags pseudo-option
+      return;
+    }
+    const char* fieldName = optionValue->desc.name;
+    const char* fieldClass = optionValue->desc.fieldClass;
+
+    size_t fieldSigLen = 2 + strlen(fieldClass);
+    char* fieldSig = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, char, fieldSigLen + 1);
+    jio_snprintf(fieldSig, fieldSigLen + 1, "L%s;", fieldClass);
+    for (size_t i = 0; i < fieldSigLen; ++i) {
+      if (fieldSig[i] == '.') {
+        fieldSig[i] = '/';
+      }
+    }
+    fieldSig[fieldSigLen] = '\0';
+    size_t declaringClassLen = strlen(declaringClass);
+    char* declaringClassBinary = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, char, declaringClassLen + 1);
+    for (size_t i = 0; i < declaringClassLen; ++i) {
+      if (declaringClass[i] == '.') {
+        declaringClassBinary[i] = '/';
+      } else {
+        declaringClassBinary[i] = declaringClass[i];
+      }
+    }
+    declaringClassBinary[declaringClassLen] = '\0';
+
+    TempNewSymbol name = SymbolTable::new_symbol(declaringClassBinary, CHECK_WARN_ABORT_("Declaring class could not be found"));
+    Klass* klass = JVMCIRuntime::resolve_or_null(name, CHECK_WARN_ABORT_("Declaring class could not be resolved"));
+
+    if (klass == NULL) {
+      warning("Declaring class for option %s could not be resolved", declaringClass);
+      abort();
+      return;
+    }
+
+    // The class has been loaded so the field and signature should already be in the symbol
+    // table.  If they're not there, the field doesn't exist.
+    TempNewSymbol fieldname = SymbolTable::probe(fieldName, (int)strlen(fieldName));
+    TempNewSymbol signame = SymbolTable::probe(fieldSig, (int)fieldSigLen);
+    if (fieldname == NULL || signame == NULL) {
+      warning("Symbols for field for option %s not found (in %s)", fieldName, declaringClass);
+      abort();
+      return;
+    }
+    // Make sure class is initialized before handing id's out to fields
+    klass->initialize(CHECK_WARN_ABORT_("Error while initializing declaring class for option"));
+
+    fieldDescriptor fd;
+    if (!InstanceKlass::cast(klass)->find_field(fieldname, signame, true, &fd)) {
+      warning("Field for option %s not found (in %s)", fieldName, declaringClass);
+      abort();
+      return;
+    }
+    oop value;
+    switch(optionValue->desc.type) {
+    case _boolean: {
+      jvalue jv;
+      jv.z = optionValue->boolean_value;
+      value = java_lang_boxing_object::create(T_BOOLEAN, &jv, THREAD);
+      break;
+    }
+    case _int: {
+      jvalue jv;
+      jv.i = optionValue->int_value;
+      value = java_lang_boxing_object::create(T_INT, &jv, THREAD);
+      break;
+    }
+    case _long: {
+      jvalue jv;
+      jv.j = optionValue->long_value;
+      value = java_lang_boxing_object::create(T_LONG, &jv, THREAD);
+      break;
+    }
+    case _float: {
+      jvalue jv;
+      jv.f = optionValue->float_value;
+      value = java_lang_boxing_object::create(T_FLOAT, &jv, THREAD);
+      break;
+    }
+    case _double: {
+      jvalue jv;
+      jv.d = optionValue->double_value;
+      value = java_lang_boxing_object::create(T_DOUBLE, &jv, THREAD);
+      break;
+    }
+    case _string:
+      value = java_lang_String::create_from_str(optionValue->string_value, THREAD)();
+      break;
+    default:
+      ShouldNotReachHere();
+    }
+
+    oop optionValueOop = klass->java_mirror()->obj_field(fd.offset());
+
+    if (optionValueOop == NULL) {
+      warning("Option field was null, can not set %s", fieldName);
+      abort();
+      return;
+    }
+
+    if (!InstanceKlass::cast(optionValueOop->klass())->find_field(vmSymbols::value_name(), vmSymbols::object_signature(), false, &fd)) {
+      warning("'Object value' field not found in option class %s, can not set option %s", fieldClass, fieldName);
+      abort();
+      return;
+    }
+
+    optionValueOop->obj_field_put(fd.offset(), value);
+  }
+};
+
+void JVMCIRuntime::set_options(OptionsValueTable* options, TRAPS) {
+  ensure_jvmci_class_loader_is_initialized();
+  {
+    ResourceMark rm;
+    SetOptionClosure closure(THREAD);
+    options->for_each(&closure);
+    if (closure.is_aborted()) {
+      vm_abort(false);
+    }
+
+    notify_options_set(THREAD);
+  }
+  OptionValue* printFlags = options->get(PRINT_FLAGS_ARG);
+  if (printFlags != NULL && printFlags->boolean_value) {
+    print_flags_helper(CHECK_ABORT);
+  }
+}
+
+void JVMCIRuntime::notify_options_set(TRAPS) {
+  HandleMark hm(THREAD);
+  TempNewSymbol optionsParsedName = SymbolTable::new_symbol("com/oracle/jvmci/runtime/OptionsParsed", CHECK_ABORT);
+  KlassHandle optionsParsedClass = load_required_class(optionsParsedName);
+  objArrayHandle impls = get_service_impls(optionsParsedClass, THREAD);
+  int implsLen = impls->length();
+  if (implsLen != 0) {
+    for (int i = 0; i < implsLen; i++) {
+      JavaValue result(T_VOID);
+      JavaCallArguments args;
+      args.push_oop(impls->obj_at(i));
+      JavaCalls::call_interface(&result, optionsParsedClass, vmSymbols::run_method_name(), vmSymbols::void_method_signature(), &args, CHECK_ABORT);
+    }
+  }
+}
+
+void JVMCIRuntime::print_flags_helper(TRAPS) {
+  // TODO(gd) write this in C++?
+  HandleMark hm(THREAD);
+  TempNewSymbol name = SymbolTable::new_symbol("com/oracle/jvmci/hotspot/HotSpotOptions", CHECK_ABORT);
+  KlassHandle hotSpotOptionsClass = load_required_class(name);
+  TempNewSymbol setOption = SymbolTable::new_symbol("printFlags", CHECK);
+  JavaValue result(T_VOID);
+  JavaCallArguments args;
+  JavaCalls::call_static(&result, hotSpotOptionsClass, setOption, vmSymbols::void_method_signature(), &args, CHECK);
+}
+
+Handle JVMCIRuntime::create_Service(const char* name, TRAPS) {
+  TempNewSymbol kname = SymbolTable::new_symbol(name, CHECK_NH);
+  Klass* k = resolve_or_fail(kname, CHECK_NH);
+  instanceKlassHandle klass(THREAD, k);
+  klass->initialize(CHECK_NH);
+  klass->check_valid_for_instantiation(true, CHECK_NH);
+  JavaValue result(T_VOID);
+  instanceHandle service = klass->allocate_instance_handle(CHECK_NH);
+  JavaCalls::call_special(&result, service, klass, vmSymbols::object_initializer_name(), vmSymbols::void_method_signature(), THREAD);
+  return service;
+}
+
+void JVMCIRuntime::shutdown() {
+  if (_HotSpotJVMCIRuntime_instance != NULL) {
+    _shutdown_called = true;
+    JavaThread* THREAD = JavaThread::current();
+    HandleMark hm(THREAD);
+    TempNewSymbol name = SymbolTable::new_symbol("com/oracle/jvmci/hotspot/HotSpotJVMCIRuntime", CHECK_ABORT);
+    KlassHandle klass = load_required_class(name);
+    JavaValue result(T_VOID);
+    JavaCallArguments args;
+    args.push_oop(get_HotSpotJVMCIRuntime());
+    JavaCalls::call_special(&result, klass, vmSymbols::shutdown_method_name(), vmSymbols::void_method_signature(), &args, CHECK_ABORT);
+
+    JNIHandles::destroy_global(_HotSpotJVMCIRuntime_instance);
+    _HotSpotJVMCIRuntime_instance = NULL;
+  }
+}
+
+void JVMCIRuntime::call_printStackTrace(Handle exception, Thread* thread) {
+  assert(exception->is_a(SystemDictionary::Throwable_klass()), "Throwable instance expected");
+  JavaValue result(T_VOID);
+  JavaCalls::call_virtual(&result,
+                          exception,
+                          KlassHandle(thread,
+                          SystemDictionary::Throwable_klass()),
+                          vmSymbols::printStackTrace_name(),
+                          vmSymbols::void_method_signature(),
+                          thread);
+}
+
+void JVMCIRuntime::abort_on_pending_exception(Handle exception, const char* message, bool dump_core) {
+  Thread* THREAD = Thread::current();
+  CLEAR_PENDING_EXCEPTION;
+  tty->print_raw_cr(message);
+  call_printStackTrace(exception, THREAD);
+
+  // Give other aborting threads to also print their stack traces.
+  // This can be very useful when debugging class initialization
+  // failures.
+  os::sleep(THREAD, 200, false);
+
+  vm_abort(dump_core);
+}
+
+Klass* JVMCIRuntime::resolve_or_null(Symbol* name, TRAPS) {
+  return SystemDictionary::resolve_or_null(name, SystemDictionary::jvmci_loader(), Handle(), CHECK_NULL);
+}
+
+Klass* JVMCIRuntime::resolve_or_fail(Symbol* name, TRAPS) {
+  return SystemDictionary::resolve_or_fail(name, SystemDictionary::jvmci_loader(), Handle(), true, CHECK_NULL);
+}
+
+Klass* JVMCIRuntime::load_required_class(Symbol* name) {
+  Klass* klass = resolve_or_null(name, Thread::current());
+  if (klass == NULL) {
+    tty->print_cr("Could not load class %s", name->as_C_string());
+    vm_abort(false);
+  }
+  return klass;
+}
+
+void JVMCIRuntime::parse_lines(char* path, ParseClosure* closure, bool warnStatFailure) {
+  struct stat st;
+  if (os::stat(path, &st) == 0 && (st.st_mode & S_IFREG) == S_IFREG) { // exists & is regular file
+    int file_handle = os::open(path, 0, 0);
+    if (file_handle != -1) {
+      char* buffer = NEW_C_HEAP_ARRAY(char, st.st_size + 1, mtInternal);
+      int num_read = (int) os::read(file_handle, (char*) buffer, st.st_size);
+      if (num_read == -1) {
+        warning("Error reading file %s due to %s", path, strerror(errno));
+      } else if (num_read != st.st_size) {
+        warning("Only read %d of " SIZE_FORMAT " bytes from %s", num_read, (size_t) st.st_size, path);
+      }
+      os::close(file_handle);
+      closure->set_filename(path);
+      if (num_read == st.st_size) {
+        buffer[num_read] = '\0';
+
+        char* line = buffer;
+        while (line - buffer < num_read && !closure->is_aborted()) {
+          // find line end (\r, \n or \r\n)
+          char* nextline = NULL;
+          char* cr = strchr(line, '\r');
+          char* lf = strchr(line, '\n');
+          if (cr != NULL && lf != NULL) {
+            char* min = MIN2(cr, lf);
+            *min = '\0';
+            if (lf == cr + 1) {
+              nextline = lf + 1;
+            } else {
+              nextline = min + 1;
+            }
+          } else if (cr != NULL) {
+            *cr = '\0';
+            nextline = cr + 1;
+          } else if (lf != NULL) {
+            *lf = '\0';
+            nextline = lf + 1;
+          }
+          // trim left
+          while (*line == ' ' || *line == '\t') line++;
+          char* end = line + strlen(line);
+          // trim right
+          while (end > line && (*(end -1) == ' ' || *(end -1) == '\t')) end--;
+          *end = '\0';
+          // skip comments and empty lines
+          if (*line != '#' && strlen(line) > 0) {
+            closure->parse_line(line);
+          }
+          if (nextline != NULL) {
+            line = nextline;
+          } else {
+            // File without newline at the end
+            break;
+          }
+        }
+      }
+      FREE_C_HEAP_ARRAY(char, buffer, mtInternal);
+    } else {
+      warning("Error opening file %s due to %s", path, strerror(errno));
+    }
+  } else if (warnStatFailure) {
+    warning("Could not stat file %s due to %s", path, strerror(errno));
+  }
+}
+
+class ServiceParseClosure : public ParseClosure {
+  GrowableArray<char*> _implNames;
+public:
+  ServiceParseClosure() : _implNames() {}
+  void do_line(char* line) {
+    size_t lineLen = strlen(line);
+    char* implName = NEW_C_HEAP_ARRAY(char, lineLen + 1, mtCompiler); // TODO (gd) i'm leaking
+    // Turn all '.'s into '/'s
+    for (size_t index = 0; index < lineLen; ++index) {
+      if (line[index] == '.') {
+        implName[index] = '/';
+      } else {
+        implName[index] = line[index];
+      }
+    }
+    implName[lineLen] = '\0';
+    _implNames.append(implName);
+  }
+  GrowableArray<char*>* implNames() {return &_implNames;}
+};
+
+
+objArrayHandle JVMCIRuntime::get_service_impls(KlassHandle serviceKlass, TRAPS) {
+  const char* home = Arguments::get_java_home();
+  const char* serviceName = serviceKlass->external_name();
+  size_t path_len = strlen(home) + strlen("/lib/jvmci/services/") + strlen(serviceName) + 1;
+  char* path = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, char, path_len);
+  char sep = os::file_separator()[0];
+  sprintf(path, "%s%clib%cjvmci%cservices%c%s", home, sep, sep, sep, sep, serviceName);
+  ServiceParseClosure closure;
+  parse_lines(path, &closure, true); // TODO(gd) cache parsing results?
+
+  GrowableArray<char*>* implNames = closure.implNames();
+  objArrayOop servicesOop = oopFactory::new_objArray(serviceKlass(), implNames->length(), CHECK_(objArrayHandle()));
+  objArrayHandle services(THREAD, servicesOop);
+  for (int i = 0; i < implNames->length(); ++i) {
+    char* implName = implNames->at(i);
+    Handle service = create_Service(implName, CHECK_(objArrayHandle()));
+    services->obj_at_put(i, service());
+  }
+  return services;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/vm/jvmci/jvmciRuntime.hpp	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,246 @@
+/*
+ * 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.
+ */
+
+#ifndef SHARE_VM_JVMCI_JVMCI_RUNTIME_HPP
+#define SHARE_VM_JVMCI_JVMCI_RUNTIME_HPP
+
+#include "interpreter/interpreter.hpp"
+#include "memory/allocation.hpp"
+#include "runtime/deoptimization.hpp"
+#include "jvmci/jvmciOptions.hpp"
+
+class ParseClosure : public StackObj {
+  int _lineNo;
+  char* _filename;
+  bool _abort;
+protected:
+  void abort() { _abort = true; }
+  void warn_and_abort(const char* message) {
+    warn(message);
+    abort();
+  }
+  void warn(const char* message) {
+    warning("Error at line %d while parsing %s: %s", _lineNo, _filename == NULL ? "?" : _filename, message);
+  }
+ public:
+  ParseClosure() : _lineNo(0), _filename(NULL), _abort(false) {}
+  void parse_line(char* line) {
+    _lineNo++;
+    do_line(line);
+  }
+  virtual void do_line(char* line) = 0;
+  int lineNo() { return _lineNo; }
+  bool is_aborted() { return _abort; }
+  void set_filename(char* path) {_filename = path; _lineNo = 0;}
+};
+
+class JVMCIRuntime: public CHeapObj<mtCompiler> {
+ private:
+  static jobject _HotSpotJVMCIRuntime_instance;
+  static bool _HotSpotJVMCIRuntime_initialized;
+
+  static bool _shutdown_called;
+
+  /**
+   * Loads default option value overrides from a <jre_home>/lib/jvmci.options if it exists. Each
+   * line in this file must have the format of a JVMCI command line option without the
+   * leading "-G:" prefix. These option values are set prior to processing of any JVMCI
+   * options present on the command line.
+   */
+  static void parse_jvmci_options_file(OptionsValueTable* options);
+
+  /**
+   * Called after all options have been set to notify OptionsParsed providers.
+   */
+  static void notify_options_set(TRAPS);
+
+  static void print_flags_helper(TRAPS);
+
+  /**
+   * Instantiates a service object, calls its default constructor and returns it.
+   *
+   * @param name the name of a class implementing com.oracle.jvmci.runtime.Service
+   */
+  static Handle create_Service(const char* name, TRAPS);
+
+ public:
+
+  /**
+   * Parses the JVMCI specific VM options that were presented by the launcher and sets
+   * the relevants Java fields.
+   */
+  static OptionsValueTable* parse_arguments();
+
+  static bool parse_argument(OptionsValueTable* options, const char* arg);
+
+  static void set_options(OptionsValueTable* options, TRAPS);
+
+  /**
+   * Ensures that the JVMCI class loader is initialized and the well known JVMCI classes are loaded.
+   */
+  static void ensure_jvmci_class_loader_is_initialized();
+
+  static void initialize_natives(JNIEnv *env, jclass c2vmClass);
+
+  static bool is_HotSpotJVMCIRuntime_initialized() { return _HotSpotJVMCIRuntime_initialized; }
+
+  /**
+   * Gets the singleton HotSpotJVMCIRuntime instance, initializing it if necessary
+   */
+  static Handle get_HotSpotJVMCIRuntime() {
+    initialize_JVMCI();
+    return Handle(JNIHandles::resolve_non_null(_HotSpotJVMCIRuntime_instance));
+  }
+
+  static jobject get_HotSpotJVMCIRuntime_jobject() {
+    initialize_JVMCI();
+    assert(_HotSpotJVMCIRuntime_initialized, "must be");
+    return _HotSpotJVMCIRuntime_instance;
+  }
+
+  static Handle callInitializer(const char* className, const char* methodName, const char* returnType);
+
+  /**
+   * Trigger initialization of HotSpotJVMCIRuntime through JVMCI.getRuntime()
+   */
+  static void initialize_JVMCI();
+
+  /**
+   * Explicitly initialize HotSpotJVMCIRuntime itself
+   */
+  static void initialize_HotSpotJVMCIRuntime();
+
+  static void shutdown();
+
+  static bool shutdown_called() {
+    return _shutdown_called;
+  }
+
+  /**
+   * Given an interface representing a JVMCI service (i.e. sub-interface of
+   * com.oracle.jvmci.api.runtime.Service), gets an array of objects, one per
+   * known implementation of the service.
+   */
+  static objArrayHandle get_service_impls(KlassHandle serviceKlass, TRAPS);
+
+  static void parse_lines(char* path, ParseClosure* closure, bool warnStatFailure);
+
+  /**
+   * Aborts the VM due to an unexpected exception.
+   */
+  static void abort_on_pending_exception(Handle exception, const char* message, bool dump_core = false);
+
+  /**
+   * Calls Throwable.printStackTrace() on a given exception.
+   */
+  static void call_printStackTrace(Handle exception, Thread* thread);
+
+#define CHECK_ABORT THREAD); \
+  if (HAS_PENDING_EXCEPTION) { \
+    char buf[256]; \
+    jio_snprintf(buf, 256, "Uncaught exception at %s:%d", __FILE__, __LINE__); \
+    JVMCIRuntime::abort_on_pending_exception(PENDING_EXCEPTION, buf); \
+    return; \
+  } \
+  (void)(0
+
+#define CHECK_ABORT_(result) THREAD); \
+  if (HAS_PENDING_EXCEPTION) { \
+    char buf[256]; \
+    jio_snprintf(buf, 256, "Uncaught exception at %s:%d", __FILE__, __LINE__); \
+    JVMCIRuntime::abort_on_pending_exception(PENDING_EXCEPTION, buf); \
+    return result; \
+  } \
+  (void)(0
+
+  /**
+   * Same as SystemDictionary::resolve_or_null but uses the JVMCI loader.
+   */
+  static Klass* resolve_or_null(Symbol* name, TRAPS);
+
+  /**
+   * Same as SystemDictionary::resolve_or_fail but uses the JVMCI loader.
+   */
+  static Klass* resolve_or_fail(Symbol* name, TRAPS);
+
+  /**
+   * Loads a given JVMCI class and aborts the VM if it fails.
+   */
+  static Klass* load_required_class(Symbol* name);
+
+  static BufferBlob* initialize_buffer_blob();
+
+  static BasicType kindToBasicType(jchar ch);
+
+  // The following routines are all called from compiled JVMCI code
+
+  static void new_instance(JavaThread* thread, Klass* klass);
+  static void new_array(JavaThread* thread, Klass* klass, jint length);
+  static void new_multi_array(JavaThread* thread, Klass* klass, int rank, jint* dims);
+  static void dynamic_new_array(JavaThread* thread, oopDesc* element_mirror, jint length);
+  static void dynamic_new_instance(JavaThread* thread, oopDesc* type_mirror);
+  static jboolean thread_is_interrupted(JavaThread* thread, oopDesc* obj, jboolean clear_interrupted);
+  static void vm_message(jboolean vmError, jlong format, jlong v1, jlong v2, jlong v3);
+  static jint identity_hash_code(JavaThread* thread, oopDesc* obj);
+  static address exception_handler_for_pc(JavaThread* thread);
+  static void monitorenter(JavaThread* thread, oopDesc* obj, BasicLock* lock);
+  static void monitorexit (JavaThread* thread, oopDesc* obj, BasicLock* lock);
+  static void create_null_exception(JavaThread* thread);
+  static void create_out_of_bounds_exception(JavaThread* thread, jint index);
+  static void vm_error(JavaThread* thread, jlong where, jlong format, jlong value);
+  static oopDesc* load_and_clear_exception(JavaThread* thread);
+  static void log_printf(JavaThread* thread, oopDesc* format, jlong v1, jlong v2, jlong v3);
+  static void log_primitive(JavaThread* thread, jchar typeChar, jlong value, jboolean newline);
+  // Note: Must be kept in sync with constants in com.oracle.jvmci.replacements.Log
+  enum {
+    LOG_OBJECT_NEWLINE = 0x01,
+    LOG_OBJECT_STRING  = 0x02,
+    LOG_OBJECT_ADDRESS = 0x04
+  };
+  static void log_object(JavaThread* thread, oopDesc* msg, jint flags);
+  static void write_barrier_pre(JavaThread* thread, oopDesc* obj);
+  static void write_barrier_post(JavaThread* thread, void* card);
+  static jboolean validate_object(JavaThread* thread, oopDesc* parent, oopDesc* child);
+  static void new_store_pre_barrier(JavaThread* thread);
+
+  // Test only function
+  static int test_deoptimize_call_int(JavaThread* thread, int value);
+};
+
+// Tracing macros
+
+#define IF_TRACE_jvmci_1 if (!(TraceJVMCI >= 1)) ; else
+#define IF_TRACE_jvmci_2 if (!(TraceJVMCI >= 2)) ; else
+#define IF_TRACE_jvmci_3 if (!(TraceJVMCI >= 3)) ; else
+#define IF_TRACE_jvmci_4 if (!(TraceJVMCI >= 4)) ; else
+#define IF_TRACE_jvmci_5 if (!(TraceJVMCI >= 5)) ; else
+
+// using commas and else to keep one-instruction semantics
+
+#define TRACE_jvmci_1 if (!(TraceJVMCI >= 1 && (tty->print("TraceJVMCI-1: "), true))) ; else tty->print_cr
+#define TRACE_jvmci_2 if (!(TraceJVMCI >= 2 && (tty->print("   TraceJVMCI-2: "), true))) ; else tty->print_cr
+#define TRACE_jvmci_3 if (!(TraceJVMCI >= 3 && (tty->print("      TraceJVMCI-3: "), true))) ; else tty->print_cr
+#define TRACE_jvmci_4 if (!(TraceJVMCI >= 4 && (tty->print("         TraceJVMCI-4: "), true))) ; else tty->print_cr
+#define TRACE_jvmci_5 if (!(TraceJVMCI >= 5 && (tty->print("            TraceJVMCI-5: "), true))) ; else tty->print_cr
+
+#endif // SHARE_VM_JVMCI_JVMCI_RUNTIME_HPP
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/vm/jvmci/vmStructs_jvmci.hpp	Thu May 28 21:11:28 2015 -0700
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#ifndef SHARE_VM_JVMCI_VMSTRUCTS_JVMCI_HPP
+#define SHARE_VM_JVMCI_VMSTRUCTS_JVMCI_HPP
+
+#include "compiler/abstractCompiler.hpp"
+#include "jvmci/jvmciCodeInstaller.hpp"
+#include "jvmci/jvmciCompilerToVM.hpp"
+#include "jvmci/jvmciEnv.hpp"
+
+#define VM_STRUCTS_JVMCI(nonstatic_field, static_field)                       \
+  nonstatic_field(ThreadShadow,  _pending_deoptimization, int)                \
+  nonstatic_field(ThreadShadow,  _pending_failed_speculation, oop)            \
+  nonstatic_field(ThreadShadow,  _pending_transfer_to_interpreter, bool)      \
+  nonstatic_field(MethodData,    _jvmci_ir_size, int)                         \
+  nonstatic_field(JVMCIEnv,      _task, CompileTask*)                         \
+  nonstatic_field(JVMCIEnv,      _jvmti_can_hotswap_or_post_breakpoint, bool) \
+
+#define VM_TYPES_JVMCI(declare_type, declare_toplevel_type)                   \
+  declare_toplevel_type(JVMCIEnv)                                             \
+
+#define VM_INT_CONSTANTS_JVMCI(declare_constant, declare_preprocessor_constant)                   \
+  declare_constant(Deoptimization::Reason_unreached0)                                             \
+  declare_constant(Deoptimization::Reason_type_checked_inlining)                                  \
+  declare_constant(Deoptimization::Reason_optimized_type_check)                                   \
+  declare_constant(Deoptimization::Reason_aliasing)                                               \
+  declare_constant(Deoptimization::Reason_transfer_to_interpreter)                                \
+  declare_constant(Deoptimization::Reason_not_compiled_exception_handler)                         \
+  declare_constant(Deoptimization::Reason_unresolved)                                             \
+  declare_constant(Deoptimization::Reason_jsr_mismatch)                                           \
+  declare_constant(JVMCIEnv::ok)                                                                  \
+  declare_constant(JVMCIEnv::dependencies_failed)                                                 \
+  declare_constant(JVMCIEnv::dependencies_invalid)                                                \
+  declare_constant(JVMCIEnv::cache_full)                                                          \
+  declare_constant(JVMCIEnv::code_too_large)                                                      \
+                                                                                                  \
+  declare_preprocessor_constant("JVM_ACC_SYNTHETIC", JVM_ACC_SYNTHETIC)                           \
+  declare_preprocessor_constant("JVM_RECOGNIZED_FIELD_MODIFIERS", JVM_RECOGNIZED_FIELD_MODIFIERS) \
+                                                                                                  \
+  declare_constant(CompilerToVM::KLASS_TAG)                                                       \
+  declare_constant(CompilerToVM::SYMBOL_TAG)                                                      \
+                                                                                                  \
+  declare_constant(CodeInstaller::VERIFIED_ENTRY)                                                 \
+  declare_constant(CodeInstaller::UNVERIFIED_ENTRY)                                               \
+  declare_constant(CodeInstaller::OSR_ENTRY)                                                      \
+  declare_constant(CodeInstaller::EXCEPTION_HANDLER_ENTRY)                                        \
+  declare_constant(CodeInstaller::DEOPT_HANDLER_ENTRY)                                            \
+  declare_constant(CodeInstaller::INVOKEINTERFACE)                                                \
+  declare_constant(CodeInstaller::INVOKEVIRTUAL)                                                  \
+  declare_constant(CodeInstaller::INVOKESTATIC)                                                   \
+  declare_constant(CodeInstaller::INVOKESPECIAL)                                                  \
+  declare_constant(CodeInstaller::INLINE_INVOKE)                                                  \
+  declare_constant(CodeInstaller::POLL_NEAR)                                                      \
+  declare_constant(CodeInstaller::POLL_RETURN_NEAR)                                               \
+  declare_constant(CodeInstaller::POLL_FAR)                                                       \
+  declare_constant(CodeInstaller::POLL_RETURN_FAR)                                                \
+  declare_constant(CodeInstaller::CARD_TABLE_SHIFT)                                               \
+  declare_constant(CodeInstaller::CARD_TABLE_ADDRESS)                                             \
+  declare_constant(CodeInstaller::INVOKE_INVALID)                                                 \
+                                                                                                  \
+  declare_constant(Method::invalid_vtable_index)                                                  \
+
+#endif // SHARE_VM_JVMCI_VMSTRUCTS_JVMCI_HPP
--- a/src/share/vm/memory/referenceProcessor.cpp	Thu May 28 15:10:18 2015 -0700
+++ b/src/share/vm/memory/referenceProcessor.cpp	Thu May 28 21:11:28 2015 -0700
@@ -57,7 +57,7 @@
   java_lang_ref_SoftReference::set_clock(_soft_ref_timestamp_clock);
 
   _always_clear_soft_ref_policy = new AlwaysClearPolicy();
-#if defined(COMPILER2) || defined(GRAAL)
+#if defined(COMPILER2) || defined(JVMCI)
   _default_soft_ref_policy      = new LRUMaxHeapPolicy();
 #else
   _default_soft_ref_policy      = new LRUCurrentHeapPolicy();
--- a/src/share/vm/oops/instanceKlass.cpp	Thu May 28 15:10:18 2015 -0700
+++ b/src/share/vm/oops/instanceKlass.cpp	Thu May 28 21:11:28 2015 -0700
@@ -61,9 +61,9 @@
 #include "services/threadService.hpp"
 #include "utilities/dtrace.hpp"
 #include "utilities/macros.hpp"
-#ifdef GRAAL
+#ifdef JVMCI
 #include "classfile/javaAssertions.hpp"
-#include "graal/graalRuntime.hpp"
+#include "jvmci/jvmciRuntime.hpp"
 #endif
 #if INCLUDE_ALL_GCS
 #include "gc_implementation/concurrentMarkSweep/cmsOopClosures.inline.hpp"
--- a/src/share/vm/oops/method.cpp	Thu May 28 15:10:18 2015 -0700
+++ b/src/share/vm/oops/method.cpp	Thu May 28 21:11:28 2015 -0700
@@ -218,7 +218,7 @@
 
   Thread* myThread    = Thread::current();
   methodHandle h_this(myThread, this);
-#if defined(ASSERT) && !defined(GRAAL)
+#if defined(ASSERT) && !defined(JVMCI)
   bool has_capability = myThread->is_VM_thread() ||
                         myThread->is_ConcurrentGC_thread() ||
                         myThread->is_GC_task_thread();
--- a/src/share/vm/oops/methodData.cpp	Thu May 28 15:10:18 2015 -0700
+++ b/src/share/vm/oops/methodData.cpp	Thu May 28 21:11:28 2015 -0700
@@ -420,7 +420,7 @@
   }
 }
 
-#ifdef GRAAL
+#ifdef JVMCI
 void VirtualCallData::clean_weak_klass_links(BoolObjectClosure* is_alive_cl) {
   ReceiverTypeData::clean_weak_klass_links(is_alive_cl);
   for (uint row = 0; row < method_row_limit(); row++) {
@@ -440,7 +440,7 @@
     }
   }
 }
-#endif // GRAAL
+#endif // JVMCI
 
 #ifndef PRODUCT
 void ReceiverTypeData::print_receiver_data_on(outputStream* st) const {
@@ -449,7 +449,7 @@
   for (row = 0; row < row_limit(); row++) {
     if (receiver(row) != NULL)  entries++;
   }
-#ifdef GRAAL
+#ifdef JVMCI
   st->print_cr("count(%u) nonprofiled_count(%u) entries(%u)", count(), nonprofiled_count(), entries);
 #else
   st->print_cr("count(%u) entries(%u)", count(), entries);
@@ -473,7 +473,7 @@
   print_receiver_data_on(st);
 }
 
-#ifdef GRAAL
+#ifdef JVMCI
 void VirtualCallData::print_method_data_on(outputStream* st) const {
   uint row;
   int entries = 0;
@@ -501,7 +501,7 @@
 void VirtualCallData::print_data_on(outputStream* st, const char* extra) const {
   print_shared(st, "VirtualCallData", extra);
   print_receiver_data_on(st);
-#ifdef GRAAL
+#ifdef JVMCI
   print_method_data_on(st);
 #endif
 }
@@ -740,7 +740,7 @@
 }
 
 int MethodData::bytecode_cell_count(Bytecodes::Code code) {
-#if defined(COMPILER1) && !(defined(COMPILER2) || defined(GRAAL))
+#if defined(COMPILER1) && !(defined(COMPILER2) || defined(JVMCI))
   return no_profile_data;
 #else
   switch (code) {
@@ -869,7 +869,7 @@
   return false;
 }
 
-#ifdef GRAAL
+#ifdef JVMCI
 int MethodData::compute_extra_data_count(int data_size, int empty_bc_count, bool needs_speculative_traps) {
   if (!ProfileTraps) return 0;
 
@@ -929,7 +929,7 @@
   while ((c = stream.next()) >= 0) {
     int size_in_bytes = compute_data_size(&stream);
     data_size += size_in_bytes;
-    if (size_in_bytes == 0 GRAAL_ONLY(&& Bytecodes::can_trap(c)))  empty_bc_count += 1;
+    if (size_in_bytes == 0 JVMCI_ONLY(&& Bytecodes::can_trap(c)))  empty_bc_count += 1;
     needs_speculative_traps = needs_speculative_traps || is_speculative_trap_bytecode(c);
   }
   int object_size = in_bytes(data_offset()) + data_size;
@@ -963,7 +963,7 @@
 // the segment in bytes.
 int MethodData::initialize_data(BytecodeStream* stream,
                                        int data_index) {
-#if defined(COMPILER1) && !(defined(COMPILER2) || defined(GRAAL))
+#if defined(COMPILER1) && !(defined(COMPILER2) || defined(JVMCI))
   return 0;
 #else
   int cell_count = -1;
@@ -1176,7 +1176,7 @@
   while ((c = stream.next()) >= 0) {
     int size_in_bytes = initialize_data(&stream, data_size);
     data_size += size_in_bytes;
-    if (size_in_bytes == 0 GRAAL_ONLY(&& Bytecodes::can_trap(c)))  empty_bc_count += 1;
+    if (size_in_bytes == 0 JVMCI_ONLY(&& Bytecodes::can_trap(c)))  empty_bc_count += 1;
     needs_speculative_traps = needs_speculative_traps || is_speculative_trap_bytecode(c);
   }
   _data_size = data_size;
@@ -1236,8 +1236,8 @@
   _num_blocks = 0;
   _would_profile = unknown;
 
-#ifdef GRAAL
-  _graal_node_count = 0;
+#ifdef JVMCI
+  _jvmci_ir_size = 0;
 #endif
 
 #if INCLUDE_RTM_OPT
--- a/src/share/vm/oops/methodData.hpp	Thu May 28 15:10:18 2015 -0700
+++ b/src/share/vm/oops/methodData.hpp	Thu May 28 21:11:28 2015 -0700
@@ -543,7 +543,7 @@
     //  saw a null operand (cast/aastore/instanceof)
       null_seen_flag              = DataLayout::first_flag + 0
 
-#ifdef GRAAL
+#ifdef JVMCI
     // bytecode threw any exception
     , exception_seen_flag         = null_seen_flag + 1
 #endif
@@ -570,7 +570,7 @@
   bool null_seen()     { return flag_at(null_seen_flag); }
   void set_null_seen()    { set_flag_at(null_seen_flag); }
 
-#ifdef GRAAL
+#ifdef JVMCI
   // true if an exception was thrown at the specific BCI
   bool exception_seen() { return flag_at(exception_seen_flag); }
   void set_exception_seen() { set_flag_at(exception_seen_flag); }
@@ -1179,17 +1179,17 @@
 class ReceiverTypeData : public CounterData {
 protected:
   enum {
-#ifdef GRAAL
+#ifdef JVMCI
     // Description of the different counters
     // ReceiverTypeData for instanceof/checkcast/aastore:
     //   C1/C2: count is incremented on type overflow and decremented for failed type checks
-    //   Graal: count decremented for failed type checks and nonprofiled_count is incremented on type overflow
-    //          TODO (chaeubl): in fact, Graal should also increment the count for failed type checks to mimic the C1/C2 behavior
+    //   JVMCI: count decremented for failed type checks and nonprofiled_count is incremented on type overflow
+    //          TODO (chaeubl): in fact, JVMCI should also increment the count for failed type checks to mimic the C1/C2 behavior
     // VirtualCallData for invokevirtual/invokeinterface:
     //   C1/C2: count is incremented on type overflow
-    //   Graal: count is incremented on type overflow, nonprofiled_count is incremented on method overflow
-
-    // Graal is interested in knowing the percentage of type checks involving a type not explicitly in the profile
+    //   JVMCI: count is incremented on type overflow, nonprofiled_count is incremented on method overflow
+
+    // JVMCI is interested in knowing the percentage of type checks involving a type not explicitly in the profile
     nonprofiled_count_off_set = counter_cell_count,
     receiver0_offset,
 #else
@@ -1209,7 +1209,7 @@
   virtual bool is_ReceiverTypeData() const { return true; }
 
   static int static_cell_count() {
-    return counter_cell_count + (uint) TypeProfileWidth * receiver_type_row_cell_count GRAAL_ONLY(+ 1);
+    return counter_cell_count + (uint) TypeProfileWidth * receiver_type_row_cell_count JVMCI_ONLY(+ 1);
   }
 
   virtual int cell_count() const {
@@ -1271,9 +1271,9 @@
     set_count(0);
     set_receiver(row, NULL);
     set_receiver_count(row, 0);
-#ifdef GRAAL
+#ifdef JVMCI
     if (!this->is_VirtualCallData()) {
-      // if this is a ReceiverTypeData for Graal, the nonprofiled_count
+      // if this is a ReceiverTypeData for JVMCI, the nonprofiled_count
       // must also be reset (see "Description of the different counters" above)
       set_nonprofiled_count(0);
     }
@@ -1287,7 +1287,7 @@
   static ByteSize receiver_count_offset(uint row) {
     return cell_offset(receiver_count_cell_index(row));
   }
-#ifdef GRAAL
+#ifdef JVMCI
   static ByteSize nonprofiled_receiver_count_offset() {
     return cell_offset(nonprofiled_count_off_set);
   }
@@ -1364,7 +1364,7 @@
   static int static_cell_count() {
     // At this point we could add more profile state, e.g., for arguments.
     // But for now it's the same size as the base record type.
-    return ReceiverTypeData::static_cell_count() GRAAL_ONLY(+ (uint) MethodProfileWidth * receiver_type_row_cell_count);
+    return ReceiverTypeData::static_cell_count() JVMCI_ONLY(+ (uint) MethodProfileWidth * receiver_type_row_cell_count);
   }
 
   virtual int cell_count() const {
@@ -1386,7 +1386,7 @@
   }
 #endif // CC_INTERP
 
-#ifdef GRAAL
+#ifdef JVMCI
   static ByteSize method_offset(uint row) {
     return cell_offset(method_cell_index(row));
   }
@@ -1442,7 +1442,7 @@
 #endif
 
 #ifndef PRODUCT
-#ifdef GRAAL
+#ifdef JVMCI
   void print_method_data_on(outputStream* st) const;
 #endif
   void print_data_on(outputStream* st, const char* extra = NULL) const;
@@ -2165,7 +2165,7 @@
 
   // Whole-method sticky bits and flags
   enum {
-    _trap_hist_limit    = 20 GRAAL_ONLY(+5),   // decoupled from Deoptimization::Reason_LIMIT
+    _trap_hist_limit    = 20 JVMCI_ONLY(+5),   // decoupled from Deoptimization::Reason_LIMIT
     _trap_hist_mask     = max_jubyte,
     _extra_data_count   = 4     // extra DataLayout headers, for trap history
   }; // Public flag values
@@ -2210,9 +2210,9 @@
   enum WouldProfile {unknown, no_profile, profile};
   WouldProfile      _would_profile;
 
-#ifdef GRAAL
-  // Support for HotSpotMethodData.setCompiledGraphSize(int)
-  int               _graal_node_count;
+#ifdef JVMCI
+  // Support for HotSpotMethodData.setCompiledIRSize(int)
+  int               _jvmci_ir_size;
 #endif
 
   // Size of _data array in bytes.  (Excludes header and extra_data fields.)
@@ -2491,7 +2491,7 @@
 
   // Return (uint)-1 for overflow.
   uint trap_count(int reason) const {
-    assert((uint)reason < GRAAL_ONLY(2*) _trap_hist_limit, "oob");
+    assert((uint)reason < JVMCI_ONLY(2*) _trap_hist_limit, "oob");
     return (int)((_trap_hist._array[reason]+1) & _trap_hist_mask) - 1;
   }
   // For loops:
@@ -2500,7 +2500,7 @@
   uint inc_trap_count(int reason) {
     // Count another trap, anywhere in this method.
     assert(reason >= 0, "must be single trap");
-    assert((uint)reason < GRAAL_ONLY(2*) _trap_hist_limit, "oob");
+    assert((uint)reason < JVMCI_ONLY(2*) _trap_hist_limit, "oob");
     uint cnt1 = 1 + _trap_hist._array[reason];
     if ((cnt1 & _trap_hist_mask) != 0) {  // if no counter overflow...
       _trap_hist._array[reason] = cnt1;
--- a/src/share/vm/opto/superword.hpp	Thu May 28 15:10:18 2015 -0700
+++ b/src/share/vm/opto/superword.hpp	Thu May 28 21:11:28 2015 -0700
@@ -201,7 +201,7 @@
   static const SWNodeInfo initial;
 };
 
-// Graal: OrderedPair is moved up to deal with compilation issues on Windows
+// JVMCI: OrderedPair is moved up to deal with compilation issues on Windows
 //------------------------------OrderedPair---------------------------
 // Ordered pair of Node*.
 class OrderedPair VALUE_OBJ_CLASS_SPEC {
--- a/src/share/vm/precompiled/precompiled.hpp	Thu May 28 15:10:18 2015 -0700
+++ b/src/share/vm/precompiled/precompiled.hpp	Thu May 28 21:11:28 2015 -0700
@@ -295,9 +295,9 @@
 # include "c1/c1_ValueType.hpp"
 # include "c1/c1_globals.hpp"
 #endif // COMPILER1
-#ifdef GRAAL
-# include "graal/graalGlobals.hpp"
-#endif // GRAAL
+#ifdef JVMCI
+# include "jvmci/jvmciGlobals.hpp"
+#endif // JVMCI
 #if INCLUDE_ALL_GCS
 # include "gc_implementation/concurrentMarkSweep/cmsOopClosures.hpp"
 # include "gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp"
--- a/src/share/vm/prims/jni.cpp	Thu May 28 15:10:18 2015 -0700
+++ b/src/share/vm/prims/jni.cpp	Thu May 28 21:11:28 2015 -0700
@@ -33,9 +33,9 @@
 #include "classfile/vmSymbols.hpp"
 #include "interpreter/linkResolver.hpp"
 #include "utilities/macros.hpp"
-#ifdef GRAAL
-#include "graal/graalCompiler.hpp"
-#include "graal/graalRuntime.hpp"
+#ifdef JVMCI
+#include "jvmci/jvmciCompiler.hpp"
+#include "jvmci/jvmciRuntime.hpp"
 #endif
 #if INCLUDE_ALL_GCS
 #include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp"
@@ -5209,27 +5209,27 @@
     *vm = (JavaVM *)(&main_vm);
     *(JNIEnv**)penv = thread->jni_environment();
 
-#if defined(GRAAL)
-    // We turn off CompileTheWorld so that compilation requests are not ignored during bootstrap or that Graal can be compiled by C1/C2.
+#if defined(JVMCI)
+    // We turn off CompileTheWorld so that compilation requests are not ignored during bootstrap or that JVMCI can be compiled by C1/C2.
     bool doCTW = CompileTheWorld;
     CompileTheWorld = false;
 #endif
 
-#ifdef COMPILERGRAAL
-    // Graal is initialized on a CompilerThread
-    if (FLAG_IS_DEFAULT(BootstrapGraal) ? !TieredCompilation : BootstrapGraal) {
-      GraalCompiler::instance()->bootstrap();
+#ifdef COMPILERJVMCI
+    // JVMCI is initialized on a CompilerThread
+    if (FLAG_IS_DEFAULT(BootstrapJVMCI) ? !TieredCompilation : BootstrapJVMCI) {
+      JVMCICompiler::instance()->bootstrap();
     }
-#elif defined(GRAAL)
+#elif defined(JVMCI)
     if (doCTW) {
       // required for hosted CTW.
       CompilationPolicy::completed_vm_startup();
     }
 #endif
 
-#if defined(GRAAL)
+#if defined(JVMCI)
     if (doCTW) {
-      GraalCompiler::instance()->compile_the_world();
+      JVMCICompiler::instance()->compile_the_world();
     }
 #endif
 
--- a/src/share/vm/prims/jvm.cpp	Thu May 28 15:10:18 2015 -0700
+++ b/src/share/vm/prims/jvm.cpp	Thu May 28 21:11:28 2015 -0700
@@ -383,8 +383,8 @@
     const char* compiler_name = "HotSpot " CSIZE "Client Compiler";
 #elif defined(COMPILER2)
     const char* compiler_name = "HotSpot " CSIZE "Server Compiler";
-#elif defined(GRAAL)
-    const char* compiler_name = "HotSpot " CSIZE "Graal Compiler";
+#elif defined(JVMCI)
+    const char* compiler_name = "HotSpot " CSIZE "JVMCI Compiler";
 #else
     const char* compiler_name = "";
 #endif // compilers
@@ -2362,7 +2362,7 @@
 
   ResourceMark rm(THREAD);
   const char* name = k->name()->as_C_string();
-  bool system_class = k->class_loader() == NULL GRAAL_ONLY(|| SystemDictionary::graal_loader() == k->class_loader());
+  bool system_class = k->class_loader() == NULL JVMCI_ONLY(|| SystemDictionary::jvmci_loader() == k->class_loader());
   return JavaAssertions::enabled(name, system_class);
 
 JVM_END
--- a/src/share/vm/prims/nativeLookup.cpp	Thu May 28 15:10:18 2015 -0700
+++ b/src/share/vm/prims/nativeLookup.cpp	Thu May 28 21:11:28 2015 -0700
@@ -126,16 +126,16 @@
   void JNICALL JVM_RegisterMethodHandleMethods(JNIEnv *env, jclass unsafecls);
   void JNICALL JVM_RegisterPerfMethods(JNIEnv *env, jclass perfclass);
   void JNICALL JVM_RegisterWhiteBoxMethods(JNIEnv *env, jclass wbclass);
-#ifdef GRAAL
-  void     JNICALL JVM_InitGraalClassLoader(JNIEnv *env, jclass c, jobject loader);
-  void     JNICALL JVM_InitializeGraalNatives(JNIEnv *env, jclass compilerToVMClass);
-  jobject  JNICALL JVM_GetGraalRuntime(JNIEnv *env, jclass c);
-  jobject  JNICALL JVM_GetGraalServiceImpls(JNIEnv *env, jclass c, jclass serviceClass);
+#ifdef JVMCI
+  void     JNICALL JVM_InitJVMCIClassLoader(JNIEnv *env, jclass c, jobject loader);
+  void     JNICALL JVM_InitializeJVMCINatives(JNIEnv *env, jclass compilerToVMClass);
+  jobject  JNICALL JVM_GetJVMCIRuntime(JNIEnv *env, jclass c);
+  jobject  JNICALL JVM_GetJVMCIRuntime(JNIEnv *env, jclass c);
+  jobject  JNICALL JVM_GetJVMCIServiceImpls(JNIEnv *env, jclass c, jclass serviceClass);
   jobject  JNICALL JVM_CreateTruffleRuntime(JNIEnv *env, jclass c);
   jobject  JNICALL JVM_CreateNativeFunctionInterface(JNIEnv *env, jclass c);
-  jboolean JNICALL JVM_IsCITimingEnabled(JNIEnv *env);
-#ifdef COMPILERGRAAL
-  void     JNICALL JVM_PrintAndResetGraalCompRate(JNIEnv *env, jclass c);
+#ifdef COMPILERJVMCI
+  void     JNICALL JVM_PrintAndResetJVMCICompRate(JNIEnv *env, jclass c);
 #endif
 #endif
 }
@@ -148,14 +148,13 @@
   { CC"Java_java_lang_invoke_MethodHandleNatives_registerNatives", NULL, FN_PTR(JVM_RegisterMethodHandleMethods) },
   { CC"Java_sun_misc_Perf_registerNatives",                        NULL, FN_PTR(JVM_RegisterPerfMethods)         },
   { CC"Java_sun_hotspot_WhiteBox_registerNatives",                 NULL, FN_PTR(JVM_RegisterWhiteBoxMethods)     },
-#ifdef GRAAL
-  { CC"Java_com_oracle_graal_hotspot_loader_Factory_init",                                                NULL, FN_PTR(JVM_InitGraalClassLoader)               },
-  { CC"Java_com_oracle_graal_api_runtime_Graal_initializeRuntime",                                        NULL, FN_PTR(JVM_GetGraalRuntime)                    },
-  { CC"Java_com_oracle_graal_api_runtime_Services_getServiceImpls",                                       NULL, FN_PTR(JVM_GetGraalServiceImpls)               },
-  { CC"Java_com_oracle_truffle_api_Truffle_createRuntime",                                                NULL, FN_PTR(JVM_CreateTruffleRuntime)               },
-  { CC"Java_com_oracle_nfi_NativeFunctionInterfaceRuntime_createInterface",                               NULL, FN_PTR(JVM_CreateNativeFunctionInterface)      },
-  { CC"Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_init",                                       NULL, FN_PTR(JVM_InitializeGraalNatives)             },
-  { CC"Java_com_oracle_graal_hotspot_HotSpotOptions_isCITimingEnabled",                                   NULL, FN_PTR(JVM_IsCITimingEnabled)                  },
+#ifdef JVMCI
+  { CC"Java_com_oracle_jvmci_hotspot_loader_Factory_init",                     NULL, FN_PTR(JVM_InitJVMCIClassLoader)               },
+  { CC"Java_com_oracle_jvmci_runtime_JVMCI_initializeRuntime",                 NULL, FN_PTR(JVM_GetJVMCIRuntime)                    },
+  { CC"Java_com_oracle_jvmci_runtime_Services_getServiceImpls",                NULL, FN_PTR(JVM_GetJVMCIServiceImpls)               },
+  { CC"Java_com_oracle_truffle_api_Truffle_createRuntime",                     NULL, FN_PTR(JVM_CreateTruffleRuntime)               },
+  { CC"Java_com_oracle_nfi_NativeFunctionInterfaceRuntime_createInterface",    NULL, FN_PTR(JVM_CreateNativeFunctionInterface)      },
+  { CC"Java_com_oracle_jvmci_hotspot_CompilerToVMImpl_init",                   NULL, FN_PTR(JVM_InitializeJVMCINatives)             },
 #endif
 };
 
@@ -186,7 +185,7 @@
   // gets found the first time around - otherwise an infinite loop can occure. This is
   // another VM/library dependency
   Handle loader(THREAD, method->method_holder()->class_loader());
-  if (loader.is_null() GRAAL_ONLY(|| loader() == SystemDictionary::graal_loader())) {
+  if (loader.is_null() JVMCI_ONLY(|| loader() == SystemDictionary::jvmci_loader())) {
     entry = lookup_special_native(jni_name);
     if (entry == NULL) {
        entry = (address) os::dll_lookup(os::native_java_library(), jni_name);
--- a/src/share/vm/runtime/advancedThresholdPolicy.cpp	Thu May 28 15:10:18 2015 -0700
+++ b/src/share/vm/runtime/advancedThresholdPolicy.cpp	Thu May 28 21:11:28 2015 -0700
@@ -161,8 +161,8 @@
 
 // Called with the queue locked and with at least one element
 CompileTask* AdvancedThresholdPolicy::select_task(CompileQueue* compile_queue) {
-#ifdef COMPILERGRAAL
-  CompileTask *max_non_graal_task = NULL;
+#ifdef COMPILERJVMCI
+  CompileTask *max_non_jvmci_task = NULL;
 #endif
   CompileTask *max_task = NULL;
   Method* max_method = NULL;
@@ -194,16 +194,16 @@
         max_method = method;
       }
     }
-#ifdef COMPILERGRAAL
-    if (GraalCompileAppFirst && (task->comp_level() == CompLevel_full_optimization || !method->has_compiled_code()) &&
-        SystemDictionary::graal_loader() != NULL &&
-        method->method_holder()->class_loader() != SystemDictionary::graal_loader()) {
-      if (max_non_graal_task == NULL) {
-        max_non_graal_task = task;
+#ifdef COMPILERJVMCI
+    if (JVMCICompileAppFirst && (task->comp_level() == CompLevel_full_optimization || !method->has_compiled_code()) &&
+        SystemDictionary::jvmci_loader() != NULL &&
+        method->method_holder()->class_loader() != SystemDictionary::jvmci_loader()) {
+      if (max_non_jvmci_task == NULL) {
+        max_non_jvmci_task = task;
       } else {
         // Select a method with a higher rate
-        if (compare_methods(method, max_non_graal_task->method())) {
-          max_non_graal_task = task;
+        if (compare_methods(method, max_non_jvmci_task->method())) {
+          max_non_jvmci_task = task;
         }
       }
     }
@@ -211,9 +211,9 @@
     task = next_task;
   }
 
-#ifdef COMPILERGRAAL
-  if (max_non_graal_task != NULL) {
-    max_task = max_non_graal_task;
+#ifdef COMPILERJVMCI
+  if (max_non_jvmci_task != NULL) {
+    max_task = max_non_jvmci_task;
     max_method = max_task->method();
   }
 #endif
@@ -373,11 +373,11 @@
       if (common(p, method, CompLevel_full_profile, disable_feedback) == CompLevel_full_optimization) {
         next_level = CompLevel_full_optimization;
       } else if ((this->*p)(i, b, cur_level)) {
-#ifdef COMPILERGRAAL
-        // Since Graal takes a while to warm up, its queue inevitably backs up during
-        // early VM execution. As of 2014-06-13, Graal's inliner assumes that the root
+#ifdef COMPILERJVMCI
+        // Since JVMCI takes a while to warm up, its queue inevitably backs up during
+        // early VM execution. As of 2014-06-13, JVMCI's inliner assumes that the root
         // compilation method and all potential inlinees have mature profiles (which
-        // includes type profiling). If it sees immature profiles, Graal's inliner
+        // includes type profiling). If it sees immature profiles, JVMCI's inliner
         // can perform pathologically bad (e.g., causing OutOfMemoryErrors due to
         // exploring/inlining too many graphs). Since a rewrite of the inliner is
         // in progress, we simply disable the dialing back heuristic for now and will
--- a/src/share/vm/runtime/arguments.cpp	Thu May 28 15:10:18 2015 -0700
+++ b/src/share/vm/runtime/arguments.cpp	Thu May 28 21:11:28 2015 -0700
@@ -95,9 +95,9 @@
 int     Arguments::_num_jvm_flags               = 0;
 char**  Arguments::_jvm_args_array              = NULL;
 int     Arguments::_num_jvm_args                = 0;
-#ifdef GRAAL
-char**  Arguments::_graal_args_array              = NULL;
-int     Arguments::_num_graal_args                = 0;
+#ifdef JVMCI
+char**  Arguments::_jvmci_args_array              = NULL;
+int     Arguments::_num_jvmci_args                = 0;
 #endif
 char*  Arguments::_java_command                 = NULL;
 SystemProperty* Arguments::_system_properties   = NULL;
@@ -189,13 +189,6 @@
   PropertyList_add(&_system_properties, new SystemProperty("java.vm.version", VM_Version::vm_release(),  false));
   PropertyList_add(&_system_properties, new SystemProperty("java.vm.name", VM_Version::vm_name(),  false));
   PropertyList_add(&_system_properties, new SystemProperty("java.vm.info", VM_Version::vm_info_string(),  true));
-#ifdef GRAAL
-#ifdef GRAAL_VERSION
-  PropertyList_add(&_system_properties, new SystemProperty("graal.version", GRAAL_VERSION,  true));
-#else
-  PropertyList_add(&_system_properties, new SystemProperty("graal.version", "unknown",  true));
-#endif
-#endif
 
   // following are JVMTI agent writeable properties.
   // Properties values are set to NULL and they are
@@ -817,9 +810,9 @@
 void Arguments::build_jvm_flags(const char* arg) {
   add_string(&_jvm_flags_array, &_num_jvm_flags, arg);
 }
-#ifdef GRAAL
-void Arguments::add_graal_arg(const char* arg) {
-  add_string(&_graal_args_array, &_num_graal_args, arg);
+#ifdef JVMCI
+void Arguments::add_jvmci_arg(const char* arg) {
+  add_string(&_jvmci_args_array, &_num_jvmci_args, arg);
 }
 #endif
 
@@ -1127,7 +1120,7 @@
   }
 }
 
-#if defined(COMPILER2) || defined(GRAAL) || defined(_LP64) || !INCLUDE_CDS
+#if defined(COMPILER2) || defined(JVMCI) || defined(_LP64) || !INCLUDE_CDS
 // Conflict: required to use shared spaces (-Xshare:on), but
 // incompatible command line options were chosen.
 
@@ -1177,7 +1170,7 @@
  *    the minimum number of compiler threads is 2.
  */
 int Arguments::get_min_number_of_compiler_threads() {
-#if !defined(COMPILER1) && !defined(COMPILER2) && !defined(SHARK) && !defined(COMPILERGRAAL)
+#if !defined(COMPILER1) && !defined(COMPILER2) && !defined(SHARK) && !defined(COMPILERJVMCI)
   return 0;   // case 1
 #else
   if (!TieredCompilation || (TieredStopAtLevel < CompLevel_full_optimization)) {
@@ -1501,7 +1494,7 @@
   // the only value that can override MaxHeapSize if we are
   // to use UseCompressedOops is InitialHeapSize.
   size_t max_heap_size = MAX2(MaxHeapSize, InitialHeapSize);
-  // Set default on graal with sparc to not use compressed oops as long they are not implemented
+  // Set default on jvmci with sparc to not use compressed oops as long they are not implemented
   if (max_heap_size <= max_heap_for_compressed_oops()) {
 #if !defined(COMPILER1) || defined(TIERED)
     if (FLAG_IS_DEFAULT(UseCompressedOops)) {
@@ -1595,7 +1588,7 @@
 void Arguments::set_ergonomics_flags() {
   select_gc();
 
-#if defined(COMPILER2) || defined(GRAAL)
+#if defined(COMPILER2) || defined(JVMCI)
   // Shared spaces work fine with other GCs but causes bytecode rewriting
   // to be disabled, which hurts interpreter performance and decreases
   // server performance.  When -server is specified, keep the default off
@@ -1679,7 +1672,7 @@
 
 void Arguments::set_g1_gc_flags() {
   assert(UseG1GC, "Error");
-#if defined(COMPILER1) || defined(GRAAL)
+#if defined(COMPILER1) || defined(JVMCI)
   FastTLABRefill = false;
 #endif
   FLAG_SET_DEFAULT(ParallelGCThreads,
@@ -2446,7 +2439,7 @@
     }
 #endif
   }
-#ifdef GRAAL
+#ifdef JVMCI
   if (UseG1GC) {
       if (IgnoreUnrecognizedVMOptions) {
         FLAG_SET_CMDLINE(bool, UseG1GC, true);
@@ -2459,7 +2452,7 @@
   }
 
   if (!ScavengeRootsInCode) {
-      warning("forcing ScavengeRootsInCode non-zero because Graal is enabled");
+      warning("forcing ScavengeRootsInCode non-zero because JVMCI is enabled");
       ScavengeRootsInCode = 1;
   }
   if (TypeProfileLevel != 0) {
@@ -2783,9 +2776,9 @@
           return JNI_ERR;
         }
 #endif // !INCLUDE_JVMTI
-#if defined(GRAAL)
+#if defined(JVMCI)
         if (strcmp(name, "hprof") == 0) {
-          FLAG_SET_CMDLINE(bool, GraalHProfEnabled, true);
+          FLAG_SET_CMDLINE(bool, JVMCIHProfEnabled, true);
         }
 #endif
         add_init_library(name, options);
@@ -2810,9 +2803,9 @@
           return JNI_ERR;
         }
 #endif // !INCLUDE_JVMTI
-#if defined(GRAAL)
+#if defined(JVMCI)
         if (valid_hprof_or_jdwp_agent(name, is_absolute_path)) {
-          FLAG_SET_CMDLINE(bool, GraalHProfEnabled, true);
+          FLAG_SET_CMDLINE(bool, JVMCIHProfEnabled, true);
         }
 #endif
 
@@ -3389,13 +3382,13 @@
         }
       }
     }
-#ifdef GRAAL
+#ifdef JVMCI
     else if (match_option(option, "-G:", &tail)) { // -G:XXX
-      // Option for the Graal compiler.
+      // Option for the JVMCI compiler.
       if (PrintVMOptions) {
-        tty->print_cr("Graal option %s", tail);
+        tty->print_cr("JVMCI option %s", tail);
       }
-      Arguments::add_graal_arg(tail);
+      Arguments::add_jvmci_arg(tail);
 
     // Unknown option
     }
@@ -3615,22 +3608,22 @@
   // This must be done after all -D arguments have been processed.
   scp_p->expand_endorsed();
 
-#ifdef GRAAL
-  if (!UseGraalClassLoader) {
-    // Append lib/graal/*.jar to boot class path
-    char graalDir[JVM_MAXPATHLEN];
+#ifdef JVMCI
+  if (!UseJVMCIClassLoader) {
+    // Append lib/jvmci/*.jar to boot class path
+    char jvmciDir[JVM_MAXPATHLEN];
     const char* fileSep = os::file_separator();
-    jio_snprintf(graalDir, sizeof(graalDir), "%s%slib%sgraal", Arguments::get_java_home(), fileSep, fileSep);
-    DIR* dir = os::opendir(graalDir);
+    jio_snprintf(jvmciDir, sizeof(jvmciDir), "%s%slib%sjvmci", Arguments::get_java_home(), fileSep, fileSep);
+    DIR* dir = os::opendir(jvmciDir);
     if (dir != NULL) {
       struct dirent *entry;
-      char *dbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(graalDir), mtInternal);
+      char *dbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(jvmciDir), mtInternal);
       while ((entry = os::readdir(dir, (dirent *) dbuf)) != NULL) {
         const char* name = entry->d_name;
         const char* ext = name + strlen(name) - 4;
         if (ext > name && strcmp(ext, ".jar") == 0) {
           char fileName[JVM_MAXPATHLEN];
-          jio_snprintf(fileName, sizeof(fileName), "%s%s%s", graalDir, fileSep, name);
+          jio_snprintf(fileName, sizeof(fileName), "%s%s%s", jvmciDir, fileSep, name);
           scp_p->add_suffix(fileName);
           scp_assembly_required = true;
         }
@@ -3666,7 +3659,7 @@
     FLAG_SET_ERGO(uintx, InitialTenuringThreshold, MaxTenuringThreshold);
   }
 
-#if !defined(COMPILER2) && !defined(COMPILERGRAAL)
+#if !defined(COMPILER2) && !defined(COMPILERJVMCI)
   // Don't degrade server performance for footprint
   if (FLAG_IS_DEFAULT(UseLargePages) &&
       MaxHeapSize < LargePageHeapSizeThreshold) {
@@ -4136,9 +4129,9 @@
 #ifdef COMPILER1
       || !UseFastLocking
 #endif // COMPILER1
-#ifdef GRAAL
-      || !GraalUseFastLocking
-#endif // GRAAL
+#ifdef JVMCI
+      || !JVMCIUseFastLocking
+#endif // JVMCI
     ) {
     if (!FLAG_IS_DEFAULT(UseBiasedLocking) && UseBiasedLocking) {
       // flag set to true on command line; warn the user that they
--- a/src/share/vm/runtime/arguments.hpp	Thu May 28 15:10:18 2015 -0700
+++ b/src/share/vm/runtime/arguments.hpp	Thu May 28 21:11:28 2015 -0700
@@ -246,10 +246,10 @@
   // an array containing all jvm arguments specified in the command line
   static char** _jvm_args_array;
   static int    _num_jvm_args;
-#ifdef GRAAL
-  // an array containing all Graal arguments specified in the command line
-  static char** _graal_args_array;
-  static int    _num_graal_args;
+#ifdef JVMCI
+  // an array containing all JVMCI arguments specified in the command line
+  static char** _jvmci_args_array;
+  static int    _num_jvmci_args;
 #endif
   // string containing all java command (class/jarfile name and app args)
   static char* _java_command;
@@ -410,8 +410,8 @@
   // methods to build strings from individual args
   static void build_jvm_args(const char* arg);
   static void build_jvm_flags(const char* arg);
-#ifdef GRAAL
-  static void add_graal_arg(const char* arg);
+#ifdef JVMCI
+  static void add_jvmci_arg(const char* arg);
 #endif
   static void add_string(char*** bldarray, int* count, const char* arg);
   static const char* build_resource_string(char** args, int count);
@@ -492,9 +492,9 @@
   // return a char* array containing all options
   static char** jvm_flags_array()          { return _jvm_flags_array; }
   static char** jvm_args_array()           { return _jvm_args_array; }
-#ifdef GRAAL
-  static char** graal_args_array()           { return _graal_args_array; }
-  static int num_graal_args()               { return _num_graal_args; }
+#ifdef JVMCI
+  static char** jvmci_args_array()           { return _jvmci_args_array; }
+  static int num_jvmci_args()               { return _num_jvmci_args; }
 #endif
   static int num_jvm_flags()               { return _num_jvm_flags; }
   static int num_jvm_args()                { return _num_jvm_args; }
--- a/src/share/vm/runtime/compilationPolicy.cpp	Thu May 28 15:10:18 2015 -0700
+++ b/src/share/vm/runtime/compilationPolicy.cpp	Thu May 28 21:11:28 2015 -0700
@@ -200,7 +200,7 @@
 // - if neither is defined - always return zero.
 int NonTieredCompPolicy::compiler_count(CompLevel comp_level) {
   assert(!TieredCompilation, "This policy should not be used with TieredCompilation");
-#if defined(COMPILER2) || defined(COMPILERGRAAL)
+#if defined(COMPILER2) || defined(COMPILERJVMCI)
   if (is_c2_compile(comp_level)) {
     return _compiler_count;
   } else {
--- a/src/share/vm/runtime/deoptimization.cpp	Thu May 28 15:10:18 2015 -0700
+++ b/src/share/vm/runtime/deoptimization.cpp	Thu May 28 21:11:28 2015 -0700
@@ -92,9 +92,9 @@
 
 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
 
-#ifdef GRAAL
-#include "graal/graalRuntime.hpp"
-#include "graal/graalJavaAccess.hpp"
+#ifdef JVMCI
+#include "jvmci/jvmciRuntime.hpp"
+#include "jvmci/jvmciJavaAccess.hpp"
 #endif
 
 
@@ -225,7 +225,7 @@
 
   bool realloc_failures = false;
 
-#if defined(COMPILER2) || defined(GRAAL)
+#if defined(COMPILER2) || defined(JVMCI)
   // Reallocate the non-escaping objects and restore their fields. Then
   // relock objects if synchronization on them was eliminated.
 #ifdef COMPILER2
@@ -313,7 +313,7 @@
     }
   }
 #endif // COMPILER2
-#endif // COMPILER2 || GRAAL
+#endif // COMPILER2 || JVMCI
 
   // Ensure that no safepoint is taken after pointers have been stored
   // in fields of rematerialized objects.  If a safepoint occurs from here on
@@ -321,7 +321,7 @@
   No_Safepoint_Verifier no_safepoint;
 
   vframeArray* array = create_vframeArray(thread, deoptee, &map, chunk, realloc_failures);
-#if defined(COMPILER2) || defined(GRAAL)
+#if defined(COMPILER2) || defined(JVMCI)
   if (realloc_failures) {
     pop_frames_failed_reallocs(thread, array);
   }
@@ -776,7 +776,7 @@
 }
 
 
-#if defined(COMPILER2) || defined(GRAAL)
+#if defined(COMPILER2) || defined(JVMCI)
 bool Deoptimization::realloc_objects(JavaThread* thread, frame* fr, GrowableArray<ScopeValue*>* objects, TRAPS) {
   Handle pending_exception(thread->pending_exception());
   const char* exception_file = thread->exception_file();
@@ -1111,7 +1111,7 @@
   }
 }
 #endif
-#endif // COMPILER2 || GRAAL
+#endif // COMPILER2 || JVMCI
 
 vframeArray* Deoptimization::create_vframeArray(JavaThread* thread, frame fr, RegisterMap *reg_map, GrowableArray<compiledVFrame*>* chunk, bool realloc_failures) {
   Events::log(thread, "DEOPT PACKING pc=" INTPTR_FORMAT " sp=" INTPTR_FORMAT, fr.pc(), fr.sp());
@@ -1171,7 +1171,7 @@
   return array;
 }
 
-#if defined(COMPILER2) || defined(GRAAL)
+#if defined(COMPILER2) || defined(JVMCI)
 void Deoptimization::pop_frames_failed_reallocs(JavaThread* thread, vframeArray* array) {
   // Reallocation of some scalar replaced objects failed. Record
   // that we need to pop all the interpreter frames for the
@@ -1361,7 +1361,7 @@
 JRT_END
 
 
-#if defined(COMPILER2) || defined(SHARK) || defined(GRAAL)
+#if defined(COMPILER2) || defined(SHARK) || defined(JVMCI)
 void Deoptimization::load_class_by_index(constantPoolHandle constant_pool, int index, TRAPS) {
   // in case of an unresolved klass entry, load the class.
   if (constant_pool->tag_at(index).is_unresolved_klass()) {
@@ -1424,8 +1424,8 @@
   thread->inc_in_deopt_handler();
 
   // We need to update the map if we have biased locking.
-#ifdef GRAAL
-  // (lstadler) Graal might need to get an exception from the stack, which in turn requires the register map to be valid
+#ifdef JVMCI
+  // (lstadler) JVMCI might need to get an exception from the stack, which in turn requires the register map to be valid
   RegisterMap reg_map(thread, true);
 #else
   RegisterMap reg_map(thread, UseBiasedLocking);
@@ -1448,7 +1448,7 @@
 
     DeoptReason reason = trap_request_reason(trap_request);
     DeoptAction action = trap_request_action(trap_request);
-#ifdef GRAAL
+#ifdef JVMCI
     int debug_id = trap_request_debug_id(trap_request);
 #endif
     jint unloaded_class_index = trap_request_index(trap_request); // CP idx or -1
@@ -1462,8 +1462,8 @@
     
     if (TraceDeoptimization) {
       ttyLocker ttyl;
-      tty->print_cr("  bci=%d pc=" INTPTR_FORMAT ", relative_pc=%d, method=%s" GRAAL_ONLY(", debug_id=%d"), trap_scope->bci(), fr.pc(), fr.pc() - nm->code_begin(), trap_scope->method()->name_and_sig_as_C_string()
-#ifdef GRAAL
+      tty->print_cr("  bci=%d pc=" INTPTR_FORMAT ", relative_pc=%d, method=%s" JVMCI_ONLY(", debug_id=%d"), trap_scope->bci(), fr.pc(), fr.pc() - nm->code_begin(), trap_scope->method()->name_and_sig_as_C_string()
+#ifdef JVMCI
           , debug_id
 #endif
           );
@@ -1471,9 +1471,9 @@
 
     methodHandle    trap_method = trap_scope->method();
     int             trap_bci    = trap_scope->bci();
-#ifdef GRAAL
+#ifdef JVMCI
     oop speculation = thread->pending_failed_speculation();
-    if (nm->is_compiled_by_graal()) {
+    if (nm->is_compiled_by_jvmci()) {
     if (speculation != NULL) {
       oop speculation_log = nm->speculation_log();
       if (speculation_log != NULL) {
@@ -1534,8 +1534,8 @@
     bool create_if_missing = ProfileTraps RTM_OPT_ONLY( || UseRTMLocking );
 
     methodHandle profiled_method;
-#ifdef GRAAL
-    if (nm->is_compiled_by_graal()) {
+#ifdef JVMCI
+    if (nm->is_compiled_by_jvmci()) {
       profiled_method = nm->method();
     } else {
       profiled_method = trap_method;
@@ -1604,29 +1604,29 @@
         tty->print("Uncommon trap occurred in");
         nm->method()->print_short_name(tty);
         tty->print(" compiler=%s compile_id=%d", nm->compiler() == NULL ? "" : nm->compiler()->name(), nm->compile_id());
-#ifdef GRAAL
-        oop installedCode = nm->graal_installed_code();
+#ifdef JVMCI
+        oop installedCode = nm->jvmci_installed_code();
         if (installedCode != NULL) {
           oop installedCodeName = NULL;
           if (installedCode->is_a(InstalledCode::klass())) {
             installedCodeName = InstalledCode::name(installedCode);
           }
           if (installedCodeName != NULL) {
-            tty->print(" (Graal: installedCodeName=%s) ", java_lang_String::as_utf8_string(installedCodeName));
+            tty->print(" (JVMCI: installedCodeName=%s) ", java_lang_String::as_utf8_string(installedCodeName));
           } else {
-            tty->print(" (Graal: installed code has no name) ");
+            tty->print(" (JVMCI: installed code has no name) ");
           }
-        } else if (nm->is_compiled_by_graal()) {
-          tty->print(" (Graal: no installed code) ");
+        } else if (nm->is_compiled_by_jvmci()) {
+          tty->print(" (JVMCI: no installed code) ");
         }
-#endif //GRAAL
-        tty->print(" (@" INTPTR_FORMAT ") thread=" UINTX_FORMAT " reason=%s action=%s unloaded_class_index=%d" GRAAL_ONLY(" debug_id=%d"),
+#endif //JVMCI
+        tty->print(" (@" INTPTR_FORMAT ") thread=" UINTX_FORMAT " reason=%s action=%s unloaded_class_index=%d" JVMCI_ONLY(" debug_id=%d"),
                    fr.pc(),
                    os::current_thread_id(),
                    trap_reason_name(reason),
                    trap_action_name(action),
                    unloaded_class_index
-#ifdef GRAAL
+#ifdef JVMCI
                    , debug_id
 #endif
                    );
@@ -1764,8 +1764,8 @@
       bool maybe_prior_trap = false;
       bool maybe_prior_recompile = false;
       pdata = query_update_method_data(trap_mdo, trap_bci, reason, true,
-#ifdef GRAAL
-                                   nm->is_compiled_by_graal() && nm->is_osr_method(),
+#ifdef JVMCI
+                                   nm->is_compiled_by_jvmci() && nm->is_osr_method(),
 #endif
                                    nm->method(),
                                    //outputs:
@@ -1913,7 +1913,7 @@
                                          int trap_bci,
                                          Deoptimization::DeoptReason reason,
                                          bool update_total_trap_count,
-#ifdef GRAAL
+#ifdef JVMCI
                                          bool is_osr,
 #endif
                                          Method* compiled_method,
@@ -1926,7 +1926,7 @@
   uint this_trap_count = 0;
   if (update_total_trap_count) {
     uint idx = reason;
-#ifdef GRAAL
+#ifdef JVMCI
     if (is_osr) {
       idx += Reason_LIMIT;
     }
@@ -2000,12 +2000,12 @@
   bool ignore_maybe_prior_trap;
   bool ignore_maybe_prior_recompile;
   assert(!reason_is_speculate(reason), "reason speculate only used by compiler");
-  // Graal uses the total counts to determine if deoptimizations are happening too frequently -> do not adjust total counts
-  bool update_total_counts = GRAAL_ONLY(false) NOT_GRAAL(true);
+  // JVMCI uses the total counts to determine if deoptimizations are happening too frequently -> do not adjust total counts
+  bool update_total_counts = JVMCI_ONLY(false) NOT_JVMCI(true);
   query_update_method_data(trap_mdo, trap_bci,
                            (DeoptReason)reason,
                            update_total_counts,
-#ifdef GRAAL
+#ifdef JVMCI
                            false,
 #endif
                            NULL,
@@ -2124,12 +2124,12 @@
   // Note:  Keep this in sync. with enum DeoptReason.
   "none",
   "null_check",
-  "null_assert" GRAAL_ONLY("_or_unreached0"),
+  "null_assert" JVMCI_ONLY("_or_unreached0"),
   "range_check",
   "class_check",
   "array_check",
-  "intrinsic" GRAAL_ONLY("_or_type_checked_inlining"),
-  "bimorphic" GRAAL_ONLY("_or_optimized_type_check"),
+  "intrinsic" JVMCI_ONLY("_or_type_checked_inlining"),
+  "bimorphic" JVMCI_ONLY("_or_optimized_type_check"),
   "unloaded",
   "uninitialized",
   "unreached",
@@ -2142,7 +2142,7 @@
   "speculate_class_check",
   "rtm_state_change",
   "unstable_if"
-#ifdef GRAAL
+#ifdef JVMCI
   "aliasing",
   "transfer_to_interpreter",
   "not_compiled_exception_handler",
@@ -2181,21 +2181,21 @@
   jint unloaded_class_index = trap_request_index(trap_request);
   const char* reason = trap_reason_name(trap_request_reason(trap_request));
   const char* action = trap_action_name(trap_request_action(trap_request));
-#ifdef GRAAL
+#ifdef JVMCI
   int debug_id = trap_request_debug_id(trap_request);
 #endif
   size_t len;
   if (unloaded_class_index < 0) {
-    len = jio_snprintf(buf, buflen, "reason='%s' action='%s'" GRAAL_ONLY(" debug_id='%d'"),
+    len = jio_snprintf(buf, buflen, "reason='%s' action='%s'" JVMCI_ONLY(" debug_id='%d'"),
                        reason, action
-#ifdef GRAAL
+#ifdef JVMCI
                        ,debug_id
 #endif
                        );
   } else {
-    len = jio_snprintf(buf, buflen, "reason='%s' action='%s' index='%d'" GRAAL_ONLY(" debug_id='%d'"),
+    len = jio_snprintf(buf, buflen, "reason='%s' action='%s' index='%d'" JVMCI_ONLY(" debug_id='%d'"),
                        reason, action, unloaded_class_index
-#ifdef GRAAL
+#ifdef JVMCI
                        ,debug_id
 #endif
                        );
@@ -2295,7 +2295,7 @@
     if (xtty != NULL)  xtty->tail("statistics");
   }
 }
-#else // COMPILER2 || SHARK || GRAAL
+#else // COMPILER2 || SHARK || JVMCI
 
 
 // Stubs for C1 only system.
@@ -2331,4 +2331,4 @@
   return buf;
 }
 
-#endif // COMPILER2 || SHARK || GRAAL
+#endif // COMPILER2 || SHARK || JVMCI
--- a/src/share/vm/runtime/deoptimization.hpp	Thu May 28 15:10:18 2015 -0700
+++ b/src/share/vm/runtime/deoptimization.hpp	Thu May 28 21:11:28 2015 -0700
@@ -42,11 +42,11 @@
     Reason_many = -1,             // indicates presence of several reasons
     Reason_none = 0,              // indicates absence of a relevant deopt.
     // Next 7 reasons are recorded per bytecode in DataLayout::trap_bits.
-    // This is more complicated for Graal as Graal may deoptimize to *some* bytecode before the
-    // bytecode that actually caused the deopt (with inlining, Graal may even deoptimize to a
+    // This is more complicated for JVMCI as JVMCI may deoptimize to *some* bytecode before the
+    // bytecode that actually caused the deopt (with inlining, JVMCI may even deoptimize to a
     // bytecode in another method):
     //  - bytecode y in method b() causes deopt
-    //  - Graal deoptimizes to bytecode x in method a()
+    //  - JVMCI deoptimizes to bytecode x in method a()
     // -> the deopt reason will be recorded for method a() at bytecode x
     Reason_null_check,            // saw unexpected null or zero divisor (@bci)
     Reason_null_assert,           // saw unexpected non-null or non-zero (@bci)
@@ -56,7 +56,7 @@
     Reason_intrinsic,             // saw unexpected operand to intrinsic (@bci)
     Reason_bimorphic,             // saw unexpected object class in bimorphic inlining (@bci)
 
-#ifdef GRAAL
+#ifdef JVMCI
     Reason_unreached0             = Reason_null_assert,
     Reason_type_checked_inlining  = Reason_intrinsic,
     Reason_optimized_type_check   = Reason_bimorphic,
@@ -75,7 +75,7 @@
     Reason_speculate_class_check, // saw unexpected object class from type speculation
     Reason_rtm_state_change,      // rtm state change detected
     Reason_unstable_if,           // a branch predicted always false was taken
-#ifdef GRAAL
+#ifdef JVMCI
     Reason_aliasing,              // optimistic assumption about aliasing failed
     Reason_transfer_to_interpreter, // explicit transferToInterpreter()
     Reason_not_compiled_exception_handler,
@@ -138,8 +138,8 @@
   // executing in a particular CodeBlob if UseBiasedLocking is enabled
   static void revoke_biases_of_monitors(CodeBlob* cb);
 
-#if defined(COMPILER2) || defined(GRAAL)
-GRAAL_ONLY(public:)
+#if defined(COMPILER2) || defined(JVMCI)
+JVMCI_ONLY(public:)
 
   // Support for restoring non-escaping objects
   static bool realloc_objects(JavaThread* thread, frame* fr, GrowableArray<ScopeValue*>* objects, TRAPS);
@@ -149,7 +149,7 @@
   static void relock_objects(GrowableArray<MonitorInfo*>* monitors, JavaThread* thread, bool realloc_failures);
   static void pop_frames_failed_reallocs(JavaThread* thread, vframeArray* array);
   NOT_PRODUCT(static void print_objects(GrowableArray<ScopeValue*>* objects, bool realloc_failures);)
-#endif // COMPILER2 || GRAAL
+#endif // COMPILER2 || JVMCI
 
   public:
   static vframeArray* create_vframeArray(JavaThread* thread, frame fr, RegisterMap *reg_map, GrowableArray<compiledVFrame*>* chunk, bool realloc_failures);
@@ -312,8 +312,8 @@
   }
   static int make_trap_request(DeoptReason reason, DeoptAction action,
                                int index = -1) {
-#if defined(COMPILERGRAAL) && !defined(COMPILER1) && !defined(COMPILER2)
-    assert(index == -1, "Graal does not use index");
+#if defined(COMPILERJVMCI) && !defined(COMPILER1) && !defined(COMPILER2)
+    assert(index == -1, "JVMCI does not use index");
 #endif
 
     assert((1 << _reason_bits) >= Reason_LIMIT, "enough bits");
@@ -395,7 +395,7 @@
                                                int trap_bci,
                                                DeoptReason reason,
                                                bool update_total_trap_count,
-#ifdef GRAAL
+#ifdef JVMCI
                                                bool is_osr,
 #endif
                                                Method* compiled_method,
--- a/src/share/vm/runtime/frame.cpp	Thu May 28 15:10:18 2015 -0700
+++ b/src/share/vm/runtime/frame.cpp	Thu May 28 21:11:28 2015 -0700
@@ -734,10 +734,10 @@
                   nm->compile_id(), (nm->is_osr_method() ? "%" : ""),
                   ((nm->compiler() != NULL) ? nm->compiler()->name() : ""),
                   buf, m->code_size(), _pc, _cb->code_begin(), _pc - _cb->code_begin());
-#ifdef GRAAL
-        char* graalName = nm->graal_installed_code_name(buf, buflen);
-        if (graalName != NULL) {
-          st->print(" (%s)", graalName);
+#ifdef JVMCI
+        char* jvmciName = nm->jvmci_installed_code_name(buf, buflen);
+        if (jvmciName != NULL) {
+          st->print(" (%s)", jvmciName);
         }
 #endif
       } else {
--- a/src/share/vm/runtime/globals.cpp	Thu May 28 15:10:18 2015 -0700
+++ b/src/share/vm/runtime/globals.cpp	Thu May 28 21:11:28 2015 -0700
@@ -38,8 +38,8 @@
 #ifdef COMPILER1
 #include "c1/c1_globals.hpp"
 #endif
-#ifdef GRAAL
-#include "graal/graalGlobals.hpp"
+#ifdef JVMCI
+#include "jvmci/jvmciGlobals.hpp"
 #endif
 #ifdef COMPILER2
 #include "opto/c2_globals.hpp"
@@ -358,7 +358,7 @@
 
   Data data[] = {
       { KIND_C1, "C1" },
-      { KIND_GRAAL, "Graal" },
+      { KIND_JVMCI, "JVMCI" },
       { KIND_C2, "C2" },
       { KIND_ARCH, "ARCH" },
       { KIND_SHARK, "SHARK" },
@@ -458,11 +458,11 @@
 #define C1_PD_DEVELOP_FLAG_STRUCT(       type, name,        doc) { #type, XSTR(name), NAME(name), NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_C1 | Flag::KIND_DEVELOP | Flag::KIND_PLATFORM_DEPENDENT) },
 #define C1_NOTPRODUCT_FLAG_STRUCT(       type, name, value, doc) { #type, XSTR(name), NAME(name), NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_C1 | Flag::KIND_NOT_PRODUCT) },
 
-#define GRAAL_PRODUCT_FLAG_STRUCT(          type, name, value, doc) { #type, XSTR(name), &name,      NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_GRAAL | Flag::KIND_PRODUCT) },
-#define GRAAL_PD_PRODUCT_FLAG_STRUCT(       type, name,        doc) { #type, XSTR(name), &name,      NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_GRAAL | Flag::KIND_PRODUCT | Flag::KIND_PLATFORM_DEPENDENT) },
-#define GRAAL_DEVELOP_FLAG_STRUCT(          type, name, value, doc) { #type, XSTR(name), NAME(name), NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_GRAAL | Flag::KIND_DEVELOP) },
-#define GRAAL_PD_DEVELOP_FLAG_STRUCT(       type, name,        doc) { #type, XSTR(name), NAME(name), NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_GRAAL | Flag::KIND_DEVELOP | Flag::KIND_PLATFORM_DEPENDENT) },
-#define GRAAL_NOTPRODUCT_FLAG_STRUCT(       type, name, value, doc) { #type, XSTR(name), NAME(name), NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_GRAAL | Flag::KIND_NOT_PRODUCT) },
+#define JVMCI_PRODUCT_FLAG_STRUCT(          type, name, value, doc) { #type, XSTR(name), &name,      NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_JVMCI | Flag::KIND_PRODUCT) },
+#define JVMCI_PD_PRODUCT_FLAG_STRUCT(       type, name,        doc) { #type, XSTR(name), &name,      NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_JVMCI | Flag::KIND_PRODUCT | Flag::KIND_PLATFORM_DEPENDENT) },
+#define JVMCI_DEVELOP_FLAG_STRUCT(          type, name, value, doc) { #type, XSTR(name), NAME(name), NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_JVMCI | Flag::KIND_DEVELOP) },
+#define JVMCI_PD_DEVELOP_FLAG_STRUCT(       type, name,        doc) { #type, XSTR(name), NAME(name), NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_JVMCI | Flag::KIND_DEVELOP | Flag::KIND_PLATFORM_DEPENDENT) },
+#define JVMCI_NOTPRODUCT_FLAG_STRUCT(       type, name, value, doc) { #type, XSTR(name), NAME(name), NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_JVMCI | Flag::KIND_NOT_PRODUCT) },
 
 #define C2_PRODUCT_FLAG_STRUCT(          type, name, value, doc) { #type, XSTR(name), &name,      NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_C2 | Flag::KIND_PRODUCT) },
 #define C2_PD_PRODUCT_FLAG_STRUCT(       type, name,        doc) { #type, XSTR(name), &name,      NOT_PRODUCT_ARG(doc) Flag::Flags(Flag::DEFAULT | Flag::KIND_C2 | Flag::KIND_PRODUCT | Flag::KIND_PLATFORM_DEPENDENT) },
@@ -494,8 +494,8 @@
 #ifdef COMPILER1
  C1_FLAGS(C1_DEVELOP_FLAG_STRUCT, C1_PD_DEVELOP_FLAG_STRUCT, C1_PRODUCT_FLAG_STRUCT, C1_PD_PRODUCT_FLAG_STRUCT, C1_DIAGNOSTIC_FLAG_STRUCT, C1_NOTPRODUCT_FLAG_STRUCT)
 #endif
-#ifdef GRAAL
- GRAAL_FLAGS(GRAAL_DEVELOP_FLAG_STRUCT, GRAAL_PD_DEVELOP_FLAG_STRUCT, GRAAL_PRODUCT_FLAG_STRUCT, GRAAL_PD_PRODUCT_FLAG_STRUCT, GRAAL_NOTPRODUCT_FLAG_STRUCT)
+#ifdef JVMCI
+ JVMCI_FLAGS(JVMCI_DEVELOP_FLAG_STRUCT, JVMCI_PD_DEVELOP_FLAG_STRUCT, JVMCI_PRODUCT_FLAG_STRUCT, JVMCI_PD_PRODUCT_FLAG_STRUCT, JVMCI_NOTPRODUCT_FLAG_STRUCT)
 #endif
 #ifdef COMPILER2
  C2_FLAGS(C2_DEVELOP_FLAG_STRUCT, C2_PD_DEVELOP_FLAG_STRUCT, C2_PRODUCT_FLAG_STRUCT, C2_PD_PRODUCT_FLAG_STRUCT, C2_DIAGNOSTIC_FLAG_STRUCT, C2_EXPERIMENTAL_FLAG_STRUCT, C2_NOTPRODUCT_FLAG_STRUCT)
--- a/src/share/vm/runtime/globals.hpp	Thu May 28 15:10:18 2015 -0700
+++ b/src/share/vm/runtime/globals.hpp	Thu May 28 21:11:28 2015 -0700
@@ -129,20 +129,20 @@
 # include "c1_globals_bsd.hpp"
 #endif
 #endif
-#ifdef COMPILERGRAAL 
+#ifdef COMPILERJVMCI 
 #ifdef TARGET_ARCH_x86
-# include "graalGlobals_x86.hpp"
+# include "jvmciGlobals_x86.hpp"
 #endif
 #ifdef TARGET_ARCH_sparc
-# include "graalGlobals_sparc.hpp"
+# include "jvmciGlobals_sparc.hpp"
 #endif
 #ifdef TARGET_ARCH_arm
-# include "graalGlobals_arm.hpp"
+# include "jvmciGlobals_arm.hpp"
 #endif
 #ifdef TARGET_ARCH_ppc
-# include "graalGlobals_ppc.hpp"
+# include "jvmciGlobals_ppc.hpp"
 #endif
-#endif // COMPILERGRAAL
+#endif // COMPILERJVMCI
 #ifdef COMPILER2
 #ifdef TARGET_ARCH_x86
 # include "c2_globals_x86.hpp"
@@ -178,7 +178,7 @@
 #endif
 #endif
 
-#if !defined(COMPILER1) && !defined(COMPILER2) && !defined(SHARK) && !defined(COMPILERGRAAL)
+#if !defined(COMPILER1) && !defined(COMPILER2) && !defined(SHARK) && !defined(COMPILERJVMCI)
 define_pd_global(bool, BackgroundCompilation,        false);
 define_pd_global(bool, UseTLAB,                      false);
 define_pd_global(bool, CICompileOSR,                 false);
@@ -210,7 +210,7 @@
 #define CI_COMPILER_COUNT 0
 #else
 
-#if defined(COMPILER2) || defined(COMPILERGRAAL)
+#if defined(COMPILER2) || defined(COMPILERJVMCI)
 #define CI_COMPILER_COUNT 2
 #else
 #define CI_COMPILER_COUNT 1
@@ -253,7 +253,7 @@
     KIND_SHARK              = 1 << 15,
     KIND_LP64_PRODUCT       = 1 << 16,
     KIND_COMMERCIAL         = 1 << 17,
-    KIND_GRAAL              = 1 << 18,
+    KIND_JVMCI              = 1 << 18,
 
     KIND_MASK = ~VALUE_ORIGIN_MASK
   };
@@ -998,7 +998,7 @@
   product(bool, PrintNMethodStatistics, false,                              \
           "Print a summary statistic for the generated nmethods")           \
                                                                             \
-  product(bool, ShareDebugInfo, IS_GRAAL_DEFINED,                           \
+  product(bool, ShareDebugInfo, IS_JVMCI_DEFINED,                           \
           "Always tries to share similar debug info inside a nmethod")      \
                                                                             \
   diagnostic(bool, PrintNMethods, false,                                    \
@@ -2713,11 +2713,11 @@
           "Delay invoking the compiler until main application class is "    \
           "loaded")                                                         \
                                                                             \
-  NOT_GRAAL(develop(bool, CompileTheWorld, false,                           \
+  NOT_JVMCI(develop(bool, CompileTheWorld, false,                           \
           "Compile all methods in all classes in bootstrap class path "     \
             "(stress test)"))                                               \
                                                                             \
-  GRAAL_ONLY(product(bool, CompileTheWorld, false,                          \
+  JVMCI_ONLY(product(bool, CompileTheWorld, false,                          \
           "Compile all methods in all classes in bootstrap class path "     \
                      "(stress test)"))                                      \
                                                                             \
--- a/src/share/vm/runtime/globals_extension.hpp	Thu May 28 15:10:18 2015 -0700
+++ b/src/share/vm/runtime/globals_extension.hpp	Thu May 28 21:11:28 2015 -0700
@@ -57,11 +57,11 @@
 #define C1_PD_DEVELOP_FLAG_MEMBER(type, name, doc)               FLAG_MEMBER(name),
 #define C1_NOTPRODUCT_FLAG_MEMBER(type, name, value, doc)        FLAG_MEMBER(name),
 
-#define GRAAL_PRODUCT_FLAG_MEMBER(type, name, value, doc)           FLAG_MEMBER(name),
-#define GRAAL_PD_PRODUCT_FLAG_MEMBER(type, name, doc)               FLAG_MEMBER(name),
-#define GRAAL_DEVELOP_FLAG_MEMBER(type, name, value, doc)           FLAG_MEMBER(name),
-#define GRAAL_PD_DEVELOP_FLAG_MEMBER(type, name, doc)               FLAG_MEMBER(name),
-#define GRAAL_NOTPRODUCT_FLAG_MEMBER(type, name, value, doc)        FLAG_MEMBER(name),
+#define JVMCI_PRODUCT_FLAG_MEMBER(type, name, value, doc)           FLAG_MEMBER(name),
+#define JVMCI_PD_PRODUCT_FLAG_MEMBER(type, name, doc)               FLAG_MEMBER(name),
+#define JVMCI_DEVELOP_FLAG_MEMBER(type, name, value, doc)           FLAG_MEMBER(name),
+#define JVMCI_PD_DEVELOP_FLAG_MEMBER(type, name, doc)               FLAG_MEMBER(name),
+#define JVMCI_NOTPRODUCT_FLAG_MEMBER(type, name, value, doc)        FLAG_MEMBER(name),
 
 #define C2_PRODUCT_FLAG_MEMBER(type, name, value, doc)           FLAG_MEMBER(name),
 #define C2_PD_PRODUCT_FLAG_MEMBER(type, name, doc)               FLAG_MEMBER(name),
@@ -86,8 +86,8 @@
 #ifdef COMPILER1
  C1_FLAGS(C1_DEVELOP_FLAG_MEMBER, C1_PD_DEVELOP_FLAG_MEMBER, C1_PRODUCT_FLAG_MEMBER, C1_PD_PRODUCT_FLAG_MEMBER, C1_DIAGNOSTIC_FLAG_MEMBER, C1_NOTPRODUCT_FLAG_MEMBER)
 #endif
-#ifdef GRAAL
- GRAAL_FLAGS(GRAAL_DEVELOP_FLAG_MEMBER, GRAAL_PD_DEVELOP_FLAG_MEMBER, GRAAL_PRODUCT_FLAG_MEMBER, GRAAL_PD_PRODUCT_FLAG_MEMBER, GRAAL_NOTPRODUCT_FLAG_MEMBER)
+#ifdef JVMCI
+ JVMCI_FLAGS(JVMCI_DEVELOP_FLAG_MEMBER, JVMCI_PD_DEVELOP_FLAG_MEMBER, JVMCI_PRODUCT_FLAG_MEMBER, JVMCI_PD_PRODUCT_FLAG_MEMBER, JVMCI_NOTPRODUCT_FLAG_MEMBER)
 #endif
 #ifdef COMPILER2
  C2_FLAGS(C2_DEVELOP_FLAG_MEMBER, C2_PD_DEVELOP_FLAG_MEMBER, C2_PRODUCT_FLAG_MEMBER, C2_PD_PRODUCT_FLAG_MEMBER, C2_DIAGNOSTIC_FLAG_MEMBER, C2_EXPERIMENTAL_FLAG_MEMBER, C2_NOTPRODUCT_FLAG_MEMBER)
@@ -118,11 +118,11 @@
 #define C1_PD_DEVELOP_FLAG_MEMBER_WITH_TYPE(type, name, doc)               FLAG_MEMBER_WITH_TYPE(name,type),
 #define C1_NOTPRODUCT_FLAG_MEMBER_WITH_TYPE(type, name, value, doc)        FLAG_MEMBER_WITH_TYPE(name,type),
 
-#define GRAAL_PRODUCT_FLAG_MEMBER_WITH_TYPE(type, name, value, doc)           FLAG_MEMBER_WITH_TYPE(name,type),
-#define GRAAL_PD_PRODUCT_FLAG_MEMBER_WITH_TYPE(type, name, doc)               FLAG_MEMBER_WITH_TYPE(name,type),
-#define GRAAL_DEVELOP_FLAG_MEMBER_WITH_TYPE(type, name, value, doc)           FLAG_MEMBER_WITH_TYPE(name,type),
-#define GRAAL_PD_DEVELOP_FLAG_MEMBER_WITH_TYPE(type, name, doc)               FLAG_MEMBER_WITH_TYPE(name,type),
-#define GRAAL_NOTPRODUCT_FLAG_MEMBER_WITH_TYPE(type, name, value, doc)        FLAG_MEMBER_WITH_TYPE(name,type),
+#define JVMCI_PRODUCT_FLAG_MEMBER_WITH_TYPE(type, name, value, doc)           FLAG_MEMBER_WITH_TYPE(name,type),
+#define JVMCI_PD_PRODUCT_FLAG_MEMBER_WITH_TYPE(type, name, doc)               FLAG_MEMBER_WITH_TYPE(name,type),
+#define JVMCI_DEVELOP_FLAG_MEMBER_WITH_TYPE(type, name, value, doc)           FLAG_MEMBER_WITH_TYPE(name,type),
+#define JVMCI_PD_DEVELOP_FLAG_MEMBER_WITH_TYPE(type, name, doc)               FLAG_MEMBER_WITH_TYPE(name,type),
+#define JVMCI_NOTPRODUCT_FLAG_MEMBER_WITH_TYPE(type, name, value, doc)        FLAG_MEMBER_WITH_TYPE(name,type),
 
 #ifdef _LP64
 #define RUNTIME_LP64_PRODUCT_FLAG_MEMBER_WITH_TYPE(type, name, value, doc) FLAG_MEMBER_WITH_TYPE(name,type),
@@ -180,12 +180,12 @@
           C1_DIAGNOSTIC_FLAG_MEMBER_WITH_TYPE,
           C1_NOTPRODUCT_FLAG_MEMBER_WITH_TYPE)
 #endif
-#ifdef GRAAL
- GRAAL_FLAGS(GRAAL_DEVELOP_FLAG_MEMBER_WITH_TYPE,
-          GRAAL_PD_DEVELOP_FLAG_MEMBER_WITH_TYPE,
-          GRAAL_PRODUCT_FLAG_MEMBER_WITH_TYPE,
-          GRAAL_PD_PRODUCT_FLAG_MEMBER_WITH_TYPE,
-          GRAAL_NOTPRODUCT_FLAG_MEMBER_WITH_TYPE)
+#ifdef JVMCI
+ JVMCI_FLAGS(JVMCI_DEVELOP_FLAG_MEMBER_WITH_TYPE,
+          JVMCI_PD_DEVELOP_FLAG_MEMBER_WITH_TYPE,
+          JVMCI_PRODUCT_FLAG_MEMBER_WITH_TYPE,
+          JVMCI_PD_PRODUCT_FLAG_MEMBER_WITH_TYPE,
+          JVMCI_NOTPRODUCT_FLAG_MEMBER_WITH_TYPE)
 #endif
 #ifdef COMPILER2
  C2_FLAGS(C2_DEVELOP_FLAG_MEMBER_WITH_TYPE,
--- a/src/share/vm/runtime/java.cpp	Thu May 28 15:10:18 2015 -0700
+++ b/src/share/vm/runtime/java.cpp	Thu May 28 21:11:28 2015 -0700
@@ -30,9 +30,9 @@
 #include "compiler/compileBroker.hpp"
 #include "compiler/compilerOracle.hpp"
 #include "interpreter/bytecodeHistogram.hpp"
-#ifdef GRAAL
-#include "graal/graalCompiler.hpp"
-#include "graal/graalRuntime.hpp"
+#ifdef JVMCI
+#include "jvmci/jvmciCompiler.hpp"
+#include "jvmci/jvmciRuntime.hpp"
 #endif
 #include "memory/genCollectedHeap.hpp"
 #include "memory/oopFactory.hpp"
@@ -490,8 +490,8 @@
     }
   }
 
-#ifdef GRAAL
-  GraalRuntime::shutdown();
+#ifdef JVMCI
+  JVMCIRuntime::shutdown();
 #endif
 
   // The only difference between this and Win32's _onexit procs is that
--- a/src/share/vm/runtime/javaCalls.cpp	Thu May 28 15:10:18 2015 -0700
+++ b/src/share/vm/runtime/javaCalls.cpp	Thu May 28 21:11:28 2015 -0700
@@ -40,9 +40,9 @@
 #include "runtime/signature.hpp"
 #include "runtime/stubRoutines.hpp"
 #include "runtime/thread.inline.hpp"
-#ifdef GRAAL
-#include "graal/graalJavaAccess.hpp"
-#include "graal/graalRuntime.hpp"
+#ifdef JVMCI
+#include "jvmci/jvmciJavaAccess.hpp"
+#include "jvmci/jvmciRuntime.hpp"
 #endif
 
 // -----------------------------------------------------
@@ -343,7 +343,7 @@
 
   CHECK_UNHANDLED_OOPS_ONLY(thread->clear_unhandled_oops();)
 
-#ifdef GRAAL
+#ifdef JVMCI
   nmethod* nm = args->alternative_target();
   if (nm == NULL) {
 #endif
@@ -353,7 +353,7 @@
     args->verify(method, result->get_type(), thread);
   }
   else debug_only(args->verify(method, result->get_type(), thread));
-#ifdef GRAAL
+#ifdef JVMCI
   }
 #else
 
@@ -418,13 +418,13 @@
     os::bang_stack_shadow_pages();
   }
 
-#ifdef GRAAL
+#ifdef JVMCI
   if (nm != NULL) {
     if (nm->is_alive()) {
-      ((JavaThread*) THREAD)->set_graal_alternate_call_target(nm->verified_entry_point());
+      ((JavaThread*) THREAD)->set_jvmci_alternate_call_target(nm->verified_entry_point());
       entry_point = method->adapter()->get_i2c_entry();
     } else {
-      THROW(vmSymbols::com_oracle_graal_api_code_InvalidInstalledCodeException());
+      THROW(vmSymbols::com_oracle_jvmci_code_InvalidInstalledCodeException());
     }
   }
 #endif
--- a/src/share/vm/runtime/javaCalls.hpp	Thu May 28 15:10:18 2015 -0700
+++ b/src/share/vm/runtime/javaCalls.hpp	Thu May 28 21:11:28 2015 -0700
@@ -100,7 +100,7 @@
   int         _size;
   int         _max_size;
   bool        _start_at_zero;      // Support late setting of receiver
-#ifdef GRAAL
+#ifdef JVMCI
   nmethod*    _alternative_target; // Nmethod that should be called instead of normal target
 #endif
 
@@ -112,7 +112,7 @@
     _max_size = _default_size;
     _size = 0;
     _start_at_zero = false;
-    GRAAL_ONLY(_alternative_target = NULL;)
+    JVMCI_ONLY(_alternative_target = NULL;)
   }
 
  public:
@@ -134,13 +134,13 @@
       _max_size = max_size;
       _size = 0;
       _start_at_zero = false;
-      GRAAL_ONLY(_alternative_target = NULL;)
+      JVMCI_ONLY(_alternative_target = NULL;)
     } else {
       initialize();
     }
   }
 
-#ifdef GRAAL
+#ifdef JVMCI
   void set_alternative_target(nmethod* target) {
     _alternative_target = target;
   }
--- a/src/share/vm/runtime/os.cpp	Thu May 28 15:10:18 2015 -0700
+++ b/src/share/vm/runtime/os.cpp	Thu May 28 21:11:28 2015 -0700
@@ -1189,8 +1189,8 @@
         "%/lib/jce.jar:"
         "%/lib/charsets.jar:"
         "%/lib/jfr.jar:"
-#ifdef GRAAL
-        "%/lib/graal-loader.jar:"
+#ifdef JVMCI
+        "%/lib/jvmci-loader.jar:"
 #endif
 #ifndef NO_TRUFFLE_JAR
         "%/lib/truffle.jar:"
--- a/src/share/vm/runtime/os.hpp	Thu May 28 15:10:18 2015 -0700
+++ b/src/share/vm/runtime/os.hpp	Thu May 28 21:11:28 2015 -0700
@@ -104,7 +104,7 @@
 class os: AllStatic {
   friend class VMStructs;
   friend class MallocTracker;
-#ifdef GRAAL
+#ifdef JVMCI
   friend class Arguments; // need access to format_boot_path
 #endif
 
--- a/src/share/vm/runtime/rframe.cpp	Thu May 28 15:10:18 2015 -0700
+++ b/src/share/vm/runtime/rframe.cpp	Thu May 28 21:11:28 2015 -0700
@@ -152,7 +152,7 @@
 
 void RFrame::print(const char* kind) {
 #ifndef PRODUCT
-#if defined(COMPILER2) || defined(GRAAL)
+#if defined(COMPILER2) || defined(JVMCI)
   int cnt = top_method()->interpreter_invocation_count();
 #else
   int cnt = top_method()->invocation_count();
--- a/src/share/vm/runtime/sharedRuntime.cpp	Thu May 28 15:10:18 2015 -0700
+++ b/src/share/vm/runtime/sharedRuntime.cpp	Thu May 28 21:11:28 2015 -0700
@@ -111,8 +111,8 @@
   _resolve_virtual_call_blob           = generate_resolve_blob(CAST_FROM_FN_PTR(address, SharedRuntime::resolve_virtual_call_C),       "resolve_virtual_call");
   _resolve_static_call_blob            = generate_resolve_blob(CAST_FROM_FN_PTR(address, SharedRuntime::resolve_static_call_C),        "resolve_static_call");
 
-#if defined(COMPILER2) || defined(GRAAL)
-  // Vectors are generated only by C2 and Graal.
+#if defined(COMPILER2) || defined(JVMCI)
+  // Vectors are generated only by C2 and JVMCI.
   bool support_wide = is_wide_vector(MaxVectorSize);
   if (support_wide) {
     _polling_page_vectors_safepoint_handler_blob = generate_handler_blob(CAST_FROM_FN_PTR(address, SafepointSynchronize::handle_polling_page_exception), POLL_AT_VECTOR_LOOP);
@@ -488,8 +488,8 @@
   // Reset method handle flag.
   thread->set_is_method_handle_return(false);
 
-#ifdef GRAAL
-  // Graal's ExceptionHandlerStub expects the thread local exception PC to be clear
+#ifdef JVMCI
+  // JVMCI's ExceptionHandlerStub expects the thread local exception PC to be clear
   // and other exception handler continuations do not read it
   thread->set_exception_pc(NULL);
 #endif
@@ -650,8 +650,8 @@
   assert(nm != NULL, "must exist");
   ResourceMark rm;
 
-#ifdef GRAAL
-  if (nm->is_compiled_by_graal()) {
+#ifdef JVMCI
+  if (nm->is_compiled_by_jvmci()) {
     // lookup exception handler for this pc
     int catch_pco = ret_pc - nm->code_begin();
     ExceptionHandlerTable table(nm);
@@ -795,10 +795,10 @@
   throw_and_post_jvmti_exception(thread, exception);
 JRT_END
 
-#ifdef GRAAL
+#ifdef JVMCI
 address SharedRuntime::deoptimize_for_implicit_exception(JavaThread* thread, address pc, nmethod* nm, int deopt_reason) {
   assert(deopt_reason > Deoptimization::Reason_none && deopt_reason < Deoptimization::Reason_LIMIT, "invalid deopt reason");
-  thread->set_graal_implicit_exception_pc(pc);
+  thread->set_jvmci_implicit_exception_pc(pc);
   thread->set_pending_deoptimization(Deoptimization::make_trap_request((Deoptimization::DeoptReason)deopt_reason, Deoptimization::Action_reinterpret));
   return (SharedRuntime::deopt_blob()->implicit_exception_uncommon_trap());
 }
@@ -901,8 +901,8 @@
 #ifndef PRODUCT
           _implicit_null_throws++;
 #endif
-#ifdef GRAAL
-          if (nm->is_compiled_by_graal() && nm->pc_desc_at(pc) != NULL) {
+#ifdef JVMCI
+          if (nm->is_compiled_by_jvmci() && nm->pc_desc_at(pc) != NULL) {
             // If there's no PcDesc then we'll die way down inside of
             // deopt instead of just getting normal error reporting,
             // so only go there if it will succeed.
@@ -910,7 +910,7 @@
           } else {
 #endif
           target_pc = nm->continuation_for_implicit_exception(pc);
-#ifdef GRAAL
+#ifdef JVMCI
           }
 #endif
           // If there's an unexpected fault, target_pc might be NULL,
@@ -928,13 +928,13 @@
 #ifndef PRODUCT
         _implicit_div0_throws++;
 #endif
-#ifdef GRAAL
-        if (nm->is_compiled_by_graal() && nm->pc_desc_at(pc) != NULL) {
+#ifdef JVMCI
+        if (nm->is_compiled_by_jvmci() && nm->pc_desc_at(pc) != NULL) {
           return deoptimize_for_implicit_exception(thread, pc, nm, Deoptimization::Reason_div0_check);
         } else {
 #endif
         target_pc = nm->continuation_for_implicit_exception(pc);
-#ifdef GRAAL
+#ifdef JVMCI
         }
 #endif
         // If there's an unexpected fault, target_pc might be NULL,
@@ -1013,7 +1013,7 @@
 
 
 JRT_ENTRY_NO_ASYNC(void, SharedRuntime::register_finalizer(JavaThread* thread, oopDesc* obj))
-#ifdef GRAAL
+#ifdef JVMCI
   if (!obj->klass()->has_finalizer()) {
     return;
   }
--- a/src/share/vm/runtime/sharedRuntime.hpp	Thu May 28 15:10:18 2015 -0700
+++ b/src/share/vm/runtime/sharedRuntime.hpp	Thu May 28 21:11:28 2015 -0700
@@ -193,7 +193,7 @@
   static address continuation_for_implicit_exception(JavaThread* thread,
                                                      address faulting_pc,
                                                      ImplicitExceptionKind exception_kind);
-#ifdef GRAAL
+#ifdef JVMCI
   static address deoptimize_for_implicit_exception(JavaThread* thread, address pc, nmethod* nm, int deopt_reason);
 #endif
 
--- a/src/share/vm/runtime/simpleThresholdPolicy.inline.hpp	Thu May 28 15:10:18 2015 -0700
+++ b/src/share/vm/runtime/simpleThresholdPolicy.inline.hpp	Thu May 28 21:11:28 2015 -0700
@@ -58,10 +58,10 @@
       method->is_constant_getter()) {
     return true;
   }
-#ifdef COMPILERGRAAL
-  if (TieredCompilation && GraalCompileWithC1Only &&
-      SystemDictionary::graal_loader() != NULL &&
-      method->method_holder()->class_loader() == SystemDictionary::graal_loader()) {
+#ifdef COMPILERJVMCI
+  if (TieredCompilation && JVMCICompileWithC1Only &&
+      SystemDictionary::jvmci_loader() != NULL &&
+      method->method_holder()->class_loader() == SystemDictionary::jvmci_loader()) {
     return true;
   }
 #endif
--- a/src/share/vm/runtime/sweeper.cpp	Thu May 28 15:10:18 2015 -0700
+++ b/src/share/vm/runtime/sweeper.cpp	Thu May 28 21:11:28 2015 -0700
@@ -241,7 +241,7 @@
 void NMethodSweeper::possibly_sweep() {
   assert(JavaThread::current()->thread_state() == _thread_in_vm, "must run in vm mode");
   // Only compiler threads are allowed to sweep
-  if (!MethodFlushing || !sweep_in_progress() NOT_GRAAL(|| !Thread::current()->is_Compiler_thread()) GRAAL_ONLY(|| !Thread::current()->is_Java_thread())) {
+  if (!MethodFlushing || !sweep_in_progress() NOT_JVMCI(|| !Thread::current()->is_Compiler_thread()) JVMCI_ONLY(|| !Thread::current()->is_Java_thread())) {
     return;
   }
 
@@ -458,14 +458,14 @@
 
 class NMethodMarker: public StackObj {
  private:
-#ifdef GRAAL
+#ifdef JVMCI
   JavaThread* _thread;
 #else
   CompilerThread* _thread;
 #endif
  public:
   NMethodMarker(nmethod* nm) {
-#ifdef GRAAL
+#ifdef JVMCI
     _thread = JavaThread::current();
 #else
     _thread = CompilerThread::current();
--- a/src/share/vm/runtime/thread.cpp	Thu May 28 15:10:18 2015 -0700
+++ b/src/share/vm/runtime/thread.cpp	Thu May 28 21:11:28 2015 -0700
@@ -29,9 +29,9 @@
 #include "classfile/vmSymbols.hpp"
 #include "code/scopeDesc.hpp"
 #include "compiler/compileBroker.hpp"
-#ifdef GRAAL
-#include "graal/graalCompiler.hpp"
-#include "graal/graalRuntime.hpp"
+#ifdef JVMCI
+#include "jvmci/jvmciCompiler.hpp"
+#include "jvmci/jvmciRuntime.hpp"
 #endif
 #include "interpreter/interpreter.hpp"
 #include "interpreter/linkResolver.hpp"
@@ -843,7 +843,7 @@
   active_handles()->oops_do(f);
   // Do oop for ThreadShadow
   f->do_oop((oop*)&_pending_exception);
-#ifdef GRAAL
+#ifdef JVMCI
   f->do_oop((oop*)&_pending_failed_speculation);
 #endif
   handle_area()->oops_do(f);
@@ -1426,32 +1426,32 @@
 
 // ======= JavaThread ========
 
-#ifdef GRAAL
-
-jlong* JavaThread::_graal_old_thread_counters;
-
-bool graal_counters_include(JavaThread* thread) {
+#ifdef JVMCI
+
+jlong* JavaThread::_jvmci_old_thread_counters;
+
+bool jvmci_counters_include(JavaThread* thread) {
   oop threadObj = thread->threadObj();
-  return !GraalCountersExcludeCompiler || !thread->is_Compiler_thread();
+  return !JVMCICountersExcludeCompiler || !thread->is_Compiler_thread();
 }
 
 void JavaThread::collect_counters(typeArrayOop array) {
-  if (GraalCounterSize > 0) {
+  if (JVMCICounterSize > 0) {
     MutexLocker tl(Threads_lock);
     for (int i = 0; i < array->length(); i++) {
-      array->long_at_put(i, _graal_old_thread_counters[i]);
+      array->long_at_put(i, _jvmci_old_thread_counters[i]);
     }
     for (JavaThread* tp = Threads::first(); tp != NULL; tp = tp->next()) {
-      if (graal_counters_include(tp)) {
+      if (jvmci_counters_include(tp)) {
         for (int i = 0; i < array->length(); i++) {
-          array->long_at_put(i, array->long_at(i) + tp->_graal_counters[i]);
+          array->long_at_put(i, array->long_at(i) + tp->_jvmci_counters[i]);
         }
       }
     }
   }
 }
 
-#endif // GRAAL
+#endif // JVMCI
 
 // A JavaThread is a normal Java thread
 
@@ -1486,16 +1486,16 @@
   _in_deopt_handler = 0;
   _doing_unsafe_access = false;
   _stack_guard_state = stack_guard_unused;
-#ifdef GRAAL
-  _graal_alternate_call_target = NULL;
-  _graal_implicit_exception_pc = NULL;
-  if (GraalCounterSize > 0) {
-    _graal_counters = NEW_C_HEAP_ARRAY(jlong, GraalCounterSize, mtInternal);
-    memset(_graal_counters, 0, sizeof(jlong) * GraalCounterSize);
+#ifdef JVMCI
+  _jvmci_alternate_call_target = NULL;
+  _jvmci_implicit_exception_pc = NULL;
+  if (JVMCICounterSize > 0) {
+    _jvmci_counters = NEW_C_HEAP_ARRAY(jlong, JVMCICounterSize, mtInternal);
+    memset(_jvmci_counters, 0, sizeof(jlong) * JVMCICounterSize);
   } else {
-    _graal_counters = NULL;
+    _jvmci_counters = NULL;
   }
-#endif // GRAAL
+#endif // JVMCI
   (void)const_cast<oop&>(_exception_oop = NULL);
   _exception_pc  = 0;
   _exception_handler_pc = 0;
@@ -1676,16 +1676,16 @@
   if (_thread_profiler != NULL) delete _thread_profiler;
   if (_thread_stat != NULL) delete _thread_stat;
 
-#ifdef GRAAL
-  if (GraalCounterSize > 0) {
-    if (graal_counters_include(this)) {
-      for (int i = 0; i < GraalCounterSize; i++) {
-        _graal_old_thread_counters[i] += _graal_counters[i];
+#ifdef JVMCI
+  if (JVMCICounterSize > 0) {
+    if (jvmci_counters_include(this)) {
+      for (int i = 0; i < JVMCICounterSize; i++) {
+        _jvmci_old_thread_counters[i] += _jvmci_counters[i];
       }
     }
-    FREE_C_HEAP_ARRAY(jlong, _graal_counters, mtInternal);
+    FREE_C_HEAP_ARRAY(jlong, _jvmci_counters, mtInternal);
   }
-#endif // GRAAL
+#endif // JVMCI
 }
 
 
@@ -3304,9 +3304,9 @@
 #endif
 }
 
-#ifdef COMPILERGRAAL
+#ifdef COMPILERJVMCI
 bool CompilerThread::can_call_java() const {
-  return _compiler != NULL && _compiler->is_graal();
+  return _compiler != NULL && _compiler->is_jvmci();
 }
 #endif
 
@@ -3395,8 +3395,8 @@
   jint parse_result = Arguments::parse(args);
   if (parse_result != JNI_OK) return parse_result;
 
-#ifdef GRAAL
-  OptionsValueTable* options = GraalRuntime::parse_arguments();
+#ifdef JVMCI
+  OptionsValueTable* options = JVMCIRuntime::parse_arguments();
   if (options == NULL) {
     return JNI_ERR;
   }
@@ -3456,14 +3456,14 @@
   // Initialize global data structures and create system classes in heap
   vm_init_globals();
 
-#ifdef GRAAL
-  if (GraalCounterSize > 0) {
-    JavaThread::_graal_old_thread_counters = NEW_C_HEAP_ARRAY(jlong, GraalCounterSize, mtInternal);
-    memset(JavaThread::_graal_old_thread_counters, 0, sizeof(jlong) * GraalCounterSize);
+#ifdef JVMCI
+  if (JVMCICounterSize > 0) {
+    JavaThread::_jvmci_old_thread_counters = NEW_C_HEAP_ARRAY(jlong, JVMCICounterSize, mtInternal);
+    memset(JavaThread::_jvmci_old_thread_counters, 0, sizeof(jlong) * JVMCICounterSize);
   } else {
-    JavaThread::_graal_old_thread_counters = NULL;
+    JavaThread::_jvmci_old_thread_counters = NULL;
   }
-#endif // GRAAL
+#endif // JVMCI
 
   // Attach the main thread to this os thread
   JavaThread* main_thread = new JavaThread();
@@ -3709,12 +3709,12 @@
     Chunk::start_chunk_pool_cleaner_task();
   }
 
-#ifdef GRAAL
-  GraalRuntime::set_options(options, main_thread);
+#ifdef JVMCI
+  JVMCIRuntime::set_options(options, main_thread);
 #endif
 
   // initialize compiler(s)
-#if defined(COMPILER1) || defined(COMPILER2) || defined(SHARK) || defined(COMPILERGRAAL)
+#if defined(COMPILER1) || defined(COMPILER2) || defined(SHARK) || defined(COMPILERJVMCI)
   CompileBroker::compilation_init();
 #endif
 
@@ -4132,11 +4132,11 @@
 
   delete thread;
 
-#ifdef GRAAL
-  if (GraalCounterSize > 0) {
-    FREE_C_HEAP_ARRAY(jlong, JavaThread::_graal_old_thread_counters, mtInternal);
+#ifdef JVMCI
+  if (JVMCICounterSize > 0) {
+    FREE_C_HEAP_ARRAY(jlong, JavaThread::_jvmci_old_thread_counters, mtInternal);
   }
-#endif // GRAAL
+#endif // JVMCI
 
   // exit_globals() will delete tty
   exit_globals();
--- a/src/share/vm/runtime/thread.hpp	Thu May 28 15:10:18 2015 -0700
+++ b/src/share/vm/runtime/thread.hpp	Thu May 28 21:11:28 2015 -0700
@@ -916,17 +916,17 @@
 
  private:
 
-#ifdef GRAAL
-  address   _graal_alternate_call_target;
-  address   _graal_implicit_exception_pc;    // pc at which the most recent implicit exception occurred
+#ifdef JVMCI
+  address   _jvmci_alternate_call_target;
+  address   _jvmci_implicit_exception_pc;    // pc at which the most recent implicit exception occurred
 
-  jlong*    _graal_counters;
+  jlong*    _jvmci_counters;
 
  public:
-  static jlong* _graal_old_thread_counters;
+  static jlong* _jvmci_old_thread_counters;
   static void collect_counters(typeArrayOop array);
  private:
-#endif // GRAAL
+#endif // JVMCI
 
   nmethod*      _scanned_nmethod;  // nmethod being scanned by the sweeper
 
@@ -1301,9 +1301,9 @@
   MemRegion deferred_card_mark() const           { return _deferred_card_mark; }
   void set_deferred_card_mark(MemRegion mr)      { _deferred_card_mark = mr;   }
 
-#ifdef GRAAL
-  void set_graal_alternate_call_target(address a) { _graal_alternate_call_target = a; }
-  void set_graal_implicit_exception_pc(address a) { _graal_implicit_exception_pc = a; }
+#ifdef JVMCI
+  void set_jvmci_alternate_call_target(address a) { _jvmci_alternate_call_target = a; }
+  void set_jvmci_implicit_exception_pc(address a) { _jvmci_implicit_exception_pc = a; }
 #endif
 
   // Exception handling for compiled methods
@@ -1399,11 +1399,11 @@
   static ByteSize thread_state_offset()          { return byte_offset_of(JavaThread, _thread_state        ); }
   static ByteSize saved_exception_pc_offset()    { return byte_offset_of(JavaThread, _saved_exception_pc  ); }
   static ByteSize osthread_offset()              { return byte_offset_of(JavaThread, _osthread            ); }
-#ifdef GRAAL
-  static ByteSize graal_alternate_call_target_offset() { return byte_offset_of(JavaThread, _graal_alternate_call_target); }
-  static ByteSize graal_implicit_exception_pc_offset() { return byte_offset_of(JavaThread, _graal_implicit_exception_pc); }
-  static ByteSize graal_counters_offset()        { return byte_offset_of(JavaThread, _graal_counters      ); }
-#endif // GRAAL
+#ifdef JVMCI
+  static ByteSize jvmci_alternate_call_target_offset() { return byte_offset_of(JavaThread, _jvmci_alternate_call_target); }
+  static ByteSize jvmci_implicit_exception_pc_offset() { return byte_offset_of(JavaThread, _jvmci_implicit_exception_pc); }
+  static ByteSize jvmci_counters_offset()        { return byte_offset_of(JavaThread, _jvmci_counters      ); }
+#endif // JVMCI
   static ByteSize exception_oop_offset()         { return byte_offset_of(JavaThread, _exception_oop       ); }
   static ByteSize exception_pc_offset()          { return byte_offset_of(JavaThread, _exception_pc        ); }
   static ByteSize exception_handler_pc_offset()  { return byte_offset_of(JavaThread, _exception_handler_pc); }
@@ -1875,7 +1875,7 @@
 
   bool is_Compiler_thread() const                { return true; }
 
-#ifdef COMPILERGRAAL
+#ifdef COMPILERJVMCI
   virtual bool can_call_java() const;
 #else
   virtual bool can_call_java() const             { return false; }
--- a/src/share/vm/runtime/vframe.cpp	Thu May 28 15:10:18 2015 -0700
+++ b/src/share/vm/runtime/vframe.cpp	Thu May 28 21:11:28 2015 -0700
@@ -357,7 +357,7 @@
 
   InterpreterOopMap oop_mask;
   // oopmap for current bci
-  if ((TraceDeoptimization && Verbose) GRAAL_ONLY( || PrintDeoptimizationDetails)) {
+  if ((TraceDeoptimization && Verbose) JVMCI_ONLY( || PrintDeoptimizationDetails)) {
     methodHandle m_h(Thread::current(), method());
     OopMapCache::compute_one_oop_map(m_h, bci(), &oop_mask);
   } else {
--- a/src/share/vm/runtime/vmStructs.cpp	Thu May 28 15:10:18 2015 -0700
+++ b/src/share/vm/runtime/vmStructs.cpp	Thu May 28 21:11:28 2015 -0700
@@ -70,7 +70,7 @@
 #include "oops/constMethod.hpp"
 #include "oops/constantPool.hpp"
 #include "oops/cpCache.hpp"
-#ifdef GRAAL
+#ifdef JVMCI
 #include "oops/fieldStreams.hpp"
 #endif
 #include "oops/instanceClassLoaderKlass.hpp"
@@ -106,9 +106,9 @@
 #include "utilities/globalDefinitions.hpp"
 #include "utilities/hashtable.hpp"
 #include "utilities/macros.hpp"
-#ifdef GRAAL
-# include "graal/graalRuntime.hpp"
-# include "graal/vmStructs_graal.hpp"
+#ifdef JVMCI
+# include "jvmci/jvmciRuntime.hpp"
+# include "jvmci/vmStructs_jvmci.hpp"
 #endif
 #ifdef TARGET_ARCH_x86
 # include "vmStructs_x86.hpp"
@@ -3030,8 +3030,8 @@
              GENERATE_C1_UNCHECKED_STATIC_VM_STRUCT_ENTRY,
              GENERATE_C2_UNCHECKED_STATIC_VM_STRUCT_ENTRY)
 
-#ifdef GRAAL
-   VM_STRUCTS_GRAAL(GENERATE_NONSTATIC_VM_STRUCT_ENTRY,
+#ifdef JVMCI
+   VM_STRUCTS_JVMCI(GENERATE_NONSTATIC_VM_STRUCT_ENTRY,
                     GENERATE_STATIC_VM_STRUCT_ENTRY)
 #endif
 
@@ -3079,8 +3079,8 @@
            GENERATE_C2_VM_TYPE_ENTRY,
            GENERATE_C2_TOPLEVEL_VM_TYPE_ENTRY)
 
-#ifdef GRAAL
-  VM_TYPES_GRAAL(GENERATE_VM_TYPE_ENTRY,
+#ifdef JVMCI
+  VM_TYPES_JVMCI(GENERATE_VM_TYPE_ENTRY,
                  GENERATE_TOPLEVEL_VM_TYPE_ENTRY)
 #endif
 
@@ -3126,8 +3126,8 @@
                    GENERATE_C2_VM_INT_CONSTANT_ENTRY,
                    GENERATE_C2_PREPROCESSOR_VM_INT_CONSTANT_ENTRY)
 
-#ifdef GRAAL
-  VM_INT_CONSTANTS_GRAAL(GENERATE_VM_INT_CONSTANT_ENTRY,
+#ifdef JVMCI
+  VM_INT_CONSTANTS_JVMCI(GENERATE_VM_INT_CONSTANT_ENTRY,
                          GENERATE_PREPROCESSOR_VM_INT_CONSTANT_ENTRY)
 
 #endif
@@ -3478,7 +3478,7 @@
 #endif
 
 
-#ifdef GRAAL
+#ifdef JVMCI
 // Emit intialization code for HotSpotVMConfig.  It's placed here so
 // it can take advantage of the relaxed access checking enjoyed by
 // VMStructs.
--- a/src/share/vm/runtime/vmStructs.hpp	Thu May 28 15:10:18 2015 -0700
+++ b/src/share/vm/runtime/vmStructs.hpp	Thu May 28 21:11:28 2015 -0700
@@ -126,9 +126,9 @@
   static void test();
 #endif
 
-#ifdef GRAAL
+#ifdef JVMCI
   // The definition of this method is generated by
-  // com.oracle.graal.hotspotvmconfig.HotSpotVMConfigProcessor.
+  // com.oracle.jvmci.hotspotvmconfig.HotSpotVMConfigProcessor.
 static void initHotSpotVMConfig(oop config);
 #endif
 
--- a/src/share/vm/runtime/vm_version.cpp	Thu May 28 15:10:18 2015 -0700
+++ b/src/share/vm/runtime/vm_version.cpp	Thu May 28 21:11:28 2015 -0700
@@ -112,11 +112,11 @@
 
 #ifndef VMTYPE
   #ifdef TIERED
-    #ifdef COMPILERGRAAL
-      #define VMTYPE "Graal"
-    #else // COMPILERGRAAL
+    #ifdef COMPILERJVMCI
+      #define VMTYPE "JVMCI"
+    #else // COMPILERJVMCI
       #define VMTYPE "Server"
-    #endif // COMPILERGRAAL
+    #endif // COMPILERJVMCI
   #else // TIERED
     #ifdef ZERO
       #ifdef SHARK
@@ -127,7 +127,7 @@
     #else // ZERO
       #define VMTYPE COMPILER1_PRESENT("Client")   \
                      COMPILER2_PRESENT("Server")   \
-                     COMPILERGRAAL_PRESENT("Graal")
+                     COMPILERJVMCI_PRESENT("JVMCI")
     #endif // ZERO
   #endif // TIERED
 #endif
--- a/src/share/vm/utilities/exceptions.hpp	Thu May 28 15:10:18 2015 -0700
+++ b/src/share/vm/utilities/exceptions.hpp	Thu May 28 21:11:28 2015 -0700
@@ -61,7 +61,7 @@
   friend class VMStructs;
 
  protected:
-#ifdef GRAAL
+#ifdef JVMCI
   int _pending_deoptimization;
   oop _pending_failed_speculation;
   bool _pending_monitorenter;
@@ -85,7 +85,7 @@
   bool has_pending_exception() const             { return _pending_exception != NULL; }
   const char* exception_file() const             { return _exception_file; }
   int  exception_line() const                    { return _exception_line; }
-#ifdef GRAAL
+#ifdef JVMCI
   int  pending_deoptimization() const            { return _pending_deoptimization; }
   oop  pending_failed_speculation() const        { return _pending_failed_speculation; }
   bool has_pending_monitorenter() const          { return _pending_monitorenter; }
@@ -93,7 +93,7 @@
 
   // Code generation support
   static ByteSize pending_exception_offset()     { return byte_offset_of(ThreadShadow, _pending_exception); }
-#ifdef GRAAL
+#ifdef JVMCI
   static ByteSize pending_deoptimization_offset() { return byte_offset_of(ThreadShadow, _pending_deoptimization); }
   static ByteSize pending_monitorenter_offset()  { return byte_offset_of(ThreadShadow, _pending_monitorenter); }
   static ByteSize pending_failed_speculation_offset() { return byte_offset_of(ThreadShadow, _pending_failed_speculation); }
@@ -112,7 +112,7 @@
 
   ThreadShadow() : _pending_exception(NULL),
                    _exception_file(NULL), _exception_line(0)
-#ifdef GRAAL
+#ifdef JVMCI
                    , _pending_monitorenter(false), _pending_deoptimization(-1), _pending_failed_speculation(NULL), _pending_transfer_to_interpreter(false)
 #endif
   {}
--- a/src/share/vm/utilities/globalDefinitions.hpp	Thu May 28 15:10:18 2015 -0700
+++ b/src/share/vm/utilities/globalDefinitions.hpp	Thu May 28 21:11:28 2015 -0700
@@ -894,20 +894,20 @@
   CompLevel_simple            = 1,         // C1
   CompLevel_limited_profile   = 2,         // C1, invocation & backedge counters
   CompLevel_full_profile      = 3,         // C1, invocation & backedge counters + mdo
-  CompLevel_full_optimization = 4,         // C2, Shark or Graal
+  CompLevel_full_optimization = 4,         // C2, Shark or JVMCI
 
-#if defined(COMPILER2) || defined(SHARK) || defined(COMPILERGRAAL)
-  CompLevel_highest_tier      = CompLevel_full_optimization,  // pure C2 and tiered or Graal and tiered
+#if defined(COMPILER2) || defined(SHARK) || defined(COMPILERJVMCI)
+  CompLevel_highest_tier      = CompLevel_full_optimization,  // pure C2 and tiered or JVMCI and tiered
 #elif defined(COMPILER1)
-  CompLevel_highest_tier      = CompLevel_simple,             // pure C1 or Graal
+  CompLevel_highest_tier      = CompLevel_simple,             // pure C1 or JVMCI
 #else
   CompLevel_highest_tier      = CompLevel_none,
 #endif
 
 #if defined(TIERED)
   CompLevel_initial_compile   = CompLevel_full_profile        // tiered
-#elif defined(COMPILER1) || defined(COMPILERGRAAL)
-  CompLevel_initial_compile   = CompLevel_simple              // pure C1 or Graal
+#elif defined(COMPILER1) || defined(COMPILERJVMCI)
+  CompLevel_initial_compile   = CompLevel_simple              // pure C1 or JVMCI
 #elif defined(COMPILER2) || defined(SHARK)
   CompLevel_initial_compile   = CompLevel_full_optimization   // pure C2
 #else
--- a/src/share/vm/utilities/macros.hpp	Thu May 28 15:10:18 2015 -0700
+++ b/src/share/vm/utilities/macros.hpp	Thu May 28 21:11:28 2015 -0700
@@ -166,7 +166,7 @@
 
 // COMPILER1 variant
 #ifdef COMPILER1
-#if defined(COMPILER2) || defined(COMPILERGRAAL)
+#if defined(COMPILER2) || defined(COMPILERJVMCI)
   #define TIERED
 #endif
 #define COMPILER1_PRESENT(code) code
@@ -183,27 +183,27 @@
 #define NOT_COMPILER2(code) code
 #endif // COMPILER2
 
-#ifdef COMPILERGRAAL
-#define COMPILERGRAAL_PRESENT(code) code
-#define NOT_COMPILERGRAAL(code)
-#else // COMPILERGRAAL
-#define COMPILERGRAAL_PRESENT(code)
-#define NOT_COMPILERGRAAL(code) code
-#endif // COMPILERGRAAL
+#ifdef COMPILERJVMCI
+#define COMPILERJVMCI_PRESENT(code) code
+#define NOT_COMPILERJVMCI(code)
+#else // COMPILERJVMCI
+#define COMPILERJVMCI_PRESENT(code)
+#define NOT_COMPILERJVMCI(code) code
+#endif // COMPILERJVMCI
 
-#if defined(COMPILERGRAAL) && !defined(GRAAL)
-#error "COMPILERGRAAL needs GRAAL to be defined"
+#if defined(COMPILERJVMCI) && !defined(JVMCI)
+#error "COMPILERJVMCI needs JVMCI to be defined"
 #endif
 
-#ifdef GRAAL
-#define GRAAL_ONLY(code) code
-#define NOT_GRAAL(code)
-#define IS_GRAAL_DEFINED true
-#else // GRAAL
-#define GRAAL_ONLY(code)
-#define NOT_GRAAL(code) code
-#define IS_GRAAL_DEFINED false
-#endif // GRAAL
+#ifdef JVMCI
+#define JVMCI_ONLY(code) code
+#define NOT_JVMCI(code)
+#define IS_JVMCI_DEFINED true
+#else // JVMCI
+#define JVMCI_ONLY(code)
+#define NOT_JVMCI(code) code
+#define IS_JVMCI_DEFINED false
+#endif // JVMCI
 
 #ifdef TIERED
 #define TIERED_ONLY(code) code
--- a/src/share/vm/utilities/top.hpp	Thu May 28 15:10:18 2015 -0700
+++ b/src/share/vm/utilities/top.hpp	Thu May 28 21:11:28 2015 -0700
@@ -42,8 +42,8 @@
 #ifdef COMPILER2
 #include "opto/c2_globals.hpp"
 #endif
-#ifdef GRAAL
-#include "graal/graalGlobals.hpp"
+#ifdef JVMCI
+#include "jvmci/jvmciGlobals.hpp"
 #endif
 
 // THIS FILE IS INTESIONALLY LEFT EMPTY